/* 历史人格测试 · 月白纸、玄墨、朱批、石青 */
:root {
  --paper: #eaf0f1;
  --leaf: #f7fafa;
  --leaf-2: #e1e9eb;
  --ink: #1b2226;
  --ink-2: #46535a;
  --ink-3: #7b878d;
  --rule: #c9d4d7;
  --rule-2: #dbe3e5;
  --zhu: #c4372a;
  --zhu-soft: #f3dcd8;
  --shiqing: #2c5a78;
  --shiqing-soft: #d9e5ec;
  --shadow: 0 1px 0 rgba(27, 34, 38, .06), 0 10px 30px -18px rgba(27, 34, 38, .35);
  --jielan: rgba(27, 34, 38, .045);
  --song: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC", "SimSun", serif;
  --hei: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121719; --leaf: #1a2124; --leaf-2: #222b2e; --ink: #e6ecec; --ink-2: #b7c2c5; --ink-3: #85939a;
    --rule: #334045; --rule-2: #2a3438; --zhu: #e0685b; --zhu-soft: #3b2522; --shiqing: #86b3d0; --shiqing-soft: #1f2f3a;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -18px rgba(0, 0, 0, .7);
    --jielan: rgba(230, 236, 236, .05);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--hei); font-size: 15px; line-height: 1.7; }
button { font: inherit; color: inherit; }
a { color: var(--shiqing); }
:focus-visible { outline: 2px solid var(--zhu); outline-offset: 2px; }
.shell { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; padding: 0 18px 28px; }
/* 页脚备案号要能露出来：底部留出固定按钮栏的高度 */
.foot { padding: 18px 18px calc(104px + env(safe-area-inset-bottom)); color: var(--ink-3); font-size: 12px; text-align: center; line-height: 1.8; }
.foot p { margin: 0; }
.foot a { color: var(--ink-3); text-decoration: none; white-space: nowrap; }

/* 通用 */
.song { font-family: var(--song); }
.btn { appearance: none; border: 0; border-radius: 3px; padding: 14px 20px; font-size: 16px; font-weight: 600; letter-spacing: .12em; cursor: pointer; min-height: 48px; transition: transform .12s ease, background-color .2s ease, opacity .2s ease; }
.btn:active { transform: translateY(1px); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-zhu { background: var(--zhu); color: #fff; }
.btn-line { background: transparent; box-shadow: inset 0 0 0 1px var(--rule); color: var(--ink-2); }
.btn[disabled] { opacity: .35; cursor: not-allowed; }
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--paper) 70%, transparent); }
.dock-inner { max-width: 484px; margin: 0 auto; display: flex; gap: 10px; }
.dock .btn { flex: 1; }
.seal { display: inline-grid; place-items: center; border: 1.5px solid var(--zhu); color: var(--zhu); font-family: var(--song); font-weight: 700; border-radius: 2px; line-height: 1.1; }
.tag { display: inline-block; font-size: 11px; letter-spacing: .08em; padding: 0 6px; border-radius: 2px; background: var(--shiqing-soft); color: var(--shiqing); line-height: 20px; white-space: nowrap; }
.tag-zhu { background: var(--zhu-soft); color: var(--zhu); }
.muted { color: var(--ink-3); }
.enter { animation: enter .42s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* 书口：顶部卷名与问次 */
.shukou { position: sticky; top: 0; z-index: 5; margin: 0 -18px; padding: calc(10px + env(safe-area-inset-top)) 18px 8px; background: var(--paper); display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 6px 12px; }
.shukou .juan { font-family: var(--song); font-weight: 700; letter-spacing: .18em; font-size: 14px; }
.shukou .juan small { font-family: var(--hei); font-weight: 400; letter-spacing: .06em; color: var(--ink-3); margin-left: 8px; font-size: 12px; }
.shukou .count { font-size: 12px; color: var(--ink-3); letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.ticks { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; }
.ticks i { height: 3px; background: var(--rule-2); border-radius: 1px; }
.ticks i.done { background: var(--ink); }
.ticks i.now { background: var(--zhu); }
.ticks i.gap { margin-right: 5px; }

/* 首页 */
.cover { padding-top: calc(28px + env(safe-area-inset-top)); display: grid; gap: 26px; }
.cover-head { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: start; min-height: 300px; }
.cover-lead { align-self: end; display: grid; gap: 14px; }
.cover-lead .kicker { font-size: 12px; letter-spacing: .28em; color: var(--ink-3); }
.cover-lead p { margin: 0; font-family: var(--song); font-size: 17px; line-height: 1.95; color: var(--ink); }
.cover-lead p em { font-style: normal; color: var(--zhu); background: linear-gradient(transparent 62%, var(--zhu-soft) 62%); }
.vtitle { writing-mode: vertical-rl; font-family: var(--song); font-weight: 900; font-size: 50px; letter-spacing: .12em; line-height: 1; color: var(--ink); position: relative; padding-left: 8px; border-left: 1px solid var(--rule); }
.vtitle .seal { position: absolute; bottom: -8px; left: -30px; width: 36px; height: 36px; font-size: 13px; writing-mode: horizontal-tb; letter-spacing: 0; background: var(--leaf); transform: rotate(-4deg); }
.toc { background: var(--leaf); box-shadow: var(--shadow); border-radius: 4px; padding: 6px 16px; }
.toc h2, .cast h2 { margin: 0; font-size: 12px; letter-spacing: .3em; color: var(--ink-3); font-weight: 500; padding: 10px 0 6px; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { display: grid; grid-template-columns: 3.2em 5.2em 1fr; gap: 8px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--rule-2); font-size: 13.5px; }
.toc li b { font-family: var(--song); font-weight: 700; letter-spacing: .12em; }
.toc li span { color: var(--ink-3); font-size: 12.5px; line-height: 1.6; }
.toc li .j { font-style: normal; color: var(--zhu); font-family: var(--song); font-size: 13px; letter-spacing: .1em; }
.cast { display: grid; gap: 4px; }
.cast-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--rule-2); border: 1px solid var(--rule-2); border-radius: 4px; overflow: hidden; }
.cast-grid div { background: var(--leaf); padding: 10px 4px 8px; text-align: center; display: grid; gap: 2px; }
.cast-grid b { font-family: var(--song); font-size: 15px; font-weight: 700; }
.cast-grid small { font-size: 10.5px; color: var(--ink-3); letter-spacing: .06em; }
.cast p { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-3); }
.resume { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 4px; background: var(--zhu-soft); color: var(--ink); font-size: 13.5px; }

/* 卷首 */
.juanshou { min-height: calc(100vh - 160px); min-height: calc(100dvh - 160px); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: center; padding-top: 32px; }
.jv { display: grid; justify-items: center; gap: 12px; }
.jno { font-family: var(--song); font-weight: 700; color: var(--zhu); letter-spacing: .3em; font-size: 15px; }
.juanshou .vtitle { font-size: 56px; border-left: 0; padding-left: 0; }
.juanshou-body { display: grid; gap: 14px; }
.juanshou-body p { margin: 0; font-family: var(--song); font-size: 18px; line-height: 1.9; }
.juanshou-body .muted { font-family: var(--hei); font-size: 13px; }

/* 题目 */
.q { padding-top: 14px; display: grid; gap: 16px; }
.q-theme { margin: 0; font-family: var(--song); font-size: 22px; line-height: 1.45; font-weight: 700; text-wrap: balance; }
.q-scene { margin: 0; font-family: var(--song); font-size: 16.5px; line-height: 1.95; color: var(--ink); padding: 14px 16px; background: var(--leaf); border-radius: 4px; box-shadow: var(--shadow);
  background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(2em - 1px), var(--jielan) calc(2em - 1px), var(--jielan) 2em); background-position: 16px 0; background-size: calc(100% - 32px) 100%; background-repeat: no-repeat; }
.opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.opt { position: relative; display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: start; width: 100%; text-align: left; background: var(--leaf); border: 0; border-radius: 4px; padding: 14px 14px 14px 10px; box-shadow: inset 0 0 0 1px var(--rule-2); cursor: pointer; min-height: 56px; transition: box-shadow .2s ease, background-color .2s ease; }
.opt:hover { box-shadow: inset 0 0 0 1px var(--rule); }
.opt .key { position: relative; width: 32px; height: 32px; display: grid; place-items: center; font-family: var(--song); font-weight: 700; font-size: 17px; color: var(--ink-2); }
.opt .key svg { position: absolute; inset: -4px; width: 40px; height: 40px; overflow: visible; }
.opt .key svg ellipse { fill: none; stroke: var(--zhu); stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 120; stroke-dashoffset: 120; transition: stroke-dashoffset .45s ease; }
.opt .txt { font-size: 15.5px; line-height: 1.7; padding-top: 3px; }
.opt.sel { box-shadow: inset 0 0 0 1.5px var(--zhu); }
.opt.sel .key { color: var(--zhu); }
.opt.sel .key svg ellipse { stroke-dashoffset: 0; }
.opt[disabled] { cursor: default; }
.opt.locked:not(.sel) { opacity: .78; }
.opt .who { grid-column: 2; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--rule); font-size: 13px; color: var(--ink-2); }
.opt .who b { font-family: var(--song); font-size: 16px; color: var(--ink); }
.opt.sel .who b { color: var(--zhu); }
.opt .mine { position: absolute; top: -9px; right: 10px; font-size: 11px; letter-spacing: .15em; background: var(--zhu); color: #fff; padding: 0 8px; border-radius: 2px; line-height: 20px; }

/* 揭晓 */
.reveal { background: var(--leaf); border-radius: 4px; box-shadow: var(--shadow); padding: 18px 16px 16px; display: grid; gap: 12px; position: relative; }
.reveal .seal { position: absolute; top: -12px; left: 14px; padding: 2px 8px; font-size: 12px; letter-spacing: .3em; background: var(--leaf); }
.reveal-head { display: grid; gap: 4px; }
.reveal-head .lab { font-size: 12px; color: var(--ink-3); letter-spacing: .12em; }
.reveal-head .name { font-family: var(--song); font-weight: 900; font-size: 30px; line-height: 1.25; }
.reveal-head .name.zhu { color: var(--zhu); }
.reveal .did { margin: 0; font-size: 14.5px; line-height: 1.8; color: var(--ink); }
.reveal .did span { color: var(--ink-3); }
.reveal .src { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--ink-3); }
.reveal .story { margin: 0; padding-top: 12px; border-top: 1px solid var(--rule-2); font-family: var(--song); font-size: 15.5px; line-height: 1.95; }

/* 结果 */
.res { padding-top: calc(22px + env(safe-area-inset-top)); display: grid; gap: 22px; }
.res-head { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: stretch; }
.res-head .vtitle { font-size: 26px; font-weight: 700; letter-spacing: .3em; color: var(--ink-2); padding-left: 10px; }
.benzhuan { display: grid; gap: 10px; align-content: end; }
.benzhuan .lab { font-size: 12px; letter-spacing: .3em; color: var(--ink-3); }
.benzhuan .names { font-family: var(--song); font-weight: 900; font-size: clamp(44px, 14.5vw, 64px); line-height: 1.05; letter-spacing: .02em; display: flex; flex-wrap: wrap; gap: 0 14px; }
.benzhuan .names span { white-space: nowrap; }
.benzhuan .names.many { font-size: clamp(32px, 10vw, 40px); }
.benzhuan .meta { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: 13px; color: var(--ink-2); }
.juan-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.jc { background: var(--leaf); border-radius: 4px; box-shadow: var(--shadow); padding: 12px 12px 10px; display: grid; gap: 6px; align-content: start; text-align: left; border: 0; cursor: pointer; }
.jc .jn { font-size: 11.5px; letter-spacing: .14em; color: var(--ink-3); }
.jc .jn b { font-family: var(--song); color: var(--zhu); font-weight: 700; margin-right: 6px; }
.jc .who { font-family: var(--song); font-weight: 900; font-size: 24px; line-height: 1.25; }
.jc .who.many { font-size: 18px; }
.jc .who.none { font-size: 16px; color: var(--ink-2); font-weight: 700; }
.dots { display: flex; gap: 4px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--rule); }
.dots i.on { background: var(--zhu); box-shadow: none; }
.jc .hint { font-size: 12px; color: var(--ink-3); }
.shigong { margin: 0; padding: 16px; border-radius: 4px; background: var(--leaf-2); font-family: var(--song); font-size: 16px; line-height: 2; }
.shigong b { color: var(--zhu); letter-spacing: .1em; margin-right: 6px; }
.sect h2 { margin: 0 0 10px; font-size: 12px; letter-spacing: .3em; color: var(--ink-3); font-weight: 500; display: flex; justify-content: space-between; align-items: baseline; }
.peers { display: flex; flex-wrap: wrap; gap: 8px; }
.peer { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 10px; border-radius: 3px; background: var(--leaf); box-shadow: inset 0 0 0 1px var(--rule-2); font-size: 13px; }
.peer b { font-family: var(--song); font-size: 15px; }
.peer i { font-style: normal; color: var(--zhu); font-variant-numeric: tabular-nums; }
.peer.cameo b { color: var(--shiqing); }
.review { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.review details { background: var(--leaf); border-radius: 4px; box-shadow: inset 0 0 0 1px var(--rule-2); }
.review summary { list-style: none; cursor: pointer; padding: 12px 14px; display: grid; grid-template-columns: 2.6em 1fr auto; gap: 8px; align-items: baseline; }
.review summary::-webkit-details-marker { display: none; }
.review summary .n { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.review summary .t { font-size: 14px; line-height: 1.6; }
.review summary .f { font-family: var(--song); font-weight: 700; color: var(--zhu); white-space: nowrap; }
.review summary .f.none { color: var(--ink-3); font-weight: 400; font-family: var(--hei); font-size: 12px; }
.review .body { padding: 0 14px 14px; display: grid; gap: 8px; font-size: 13.5px; }
.review .body .row { display: grid; grid-template-columns: 1.6em 1fr; gap: 6px; line-height: 1.7; }
.review .body .row .k { font-family: var(--song); font-weight: 700; color: var(--ink-3); }
.review .body .row.me .k, .review .body .row.me b { color: var(--zhu); }
.review .body .row b { font-family: var(--song); }
.review .body .story { margin: 4px 0 0; padding-top: 10px; border-top: 1px solid var(--rule-2); font-family: var(--song); line-height: 1.9; font-size: 14.5px; }
.evid { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.evid li { padding: 10px 12px; border-left: 2px solid var(--zhu); background: var(--leaf); border-radius: 0 4px 4px 0; font-size: 13.5px; line-height: 1.75; }
.evid li .q { display: block; font-size: 12px; color: var(--ink-3); padding: 0; }
.evid li b { font-family: var(--song); }

/* 弹层 */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(18, 23, 25, .5); display: grid; align-items: end; animation: fade .2s ease both; }
.sheet-card { background: var(--paper); border-radius: 12px 12px 0 0; max-height: 88vh; overflow: auto; padding: 16px 18px calc(18px + env(safe-area-inset-bottom)); max-width: 520px; width: 100%; margin: 0 auto; display: grid; gap: 14px; animation: rise .28s cubic-bezier(.2, .7, .2, 1) both; }
.sheet-card h3 { margin: 0; font-family: var(--song); font-size: 20px; }
.sheet-card img { width: 100%; border-radius: 6px; box-shadow: var(--shadow); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

/* 评审工具（#dev） */
.devbar { position: fixed; top: 8px; right: 8px; z-index: 60; display: flex; flex-wrap: wrap; gap: 6px; max-width: 280px; justify-content: flex-end; }
.devbar button, .devbar a { font-size: 11px; padding: 4px 8px; border-radius: 3px; border: 0; background: #1b2226; color: #fff; text-decoration: none; cursor: pointer; }

@media (max-width: 360px) {
  .vtitle { font-size: 42px; }
  .benzhuan .names { font-size: 52px; }
  .juan-cards { grid-template-columns: 1fr; }
  .toc li { grid-template-columns: 3em 1fr; }
  .toc li span { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
