/* ═══════════════════════════════════════════════════════════
   财务管理基础 · 刷题 —— 样式表
   设计取向：账本 / 纸墨质感，金铜色作主强调，信息密度适中
   ═══════════════════════════════════════════════════════════ */

@property --p {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

:root {
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --sp: 4px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --fs-base: 15.5px;
  --maxw: 860px;
  --maxw-wide: 1040px;
  --fs-q: 1;          /* 题干/选项/解析的字号倍率，由顶栏 Aa 按钮调节 */
}

html[data-theme="dark"] {
  --bg: #0f1216;
  --bg-soft: #131820;
  --panel: #171d26;
  --panel-2: #1d242e;
  --panel-3: #232b37;
  --line: #27303d;
  --line-soft: #1f2632;
  --text: #e8ecf1;
  --text-2: #b3bdcb;
  --muted: #8894a4;
  --accent: #d9a441;
  --accent-ink: #120f08;
  --accent-soft: rgba(217, 164, 65, .13);
  --accent-line: rgba(217, 164, 65, .38);
  --ok: #45b96a;
  --ok-soft: rgba(69, 185, 106, .13);
  --bad: #ef5b52;
  --bad-soft: rgba(239, 91, 82, .13);
  --glow: rgba(217, 164, 65, .10);
  --shadow: 0 12px 32px -18px rgba(0, 0, 0, .9);
  --shadow-lift: 0 22px 48px -24px rgba(0, 0, 0, .95);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f4f2ec;
  --bg-soft: #faf9f5;
  --panel: #ffffff;
  --panel-2: #fbfaf6;
  --panel-3: #f1eee5;
  --line: #e0dcd0;
  --line-soft: #ece8dd;
  --text: #1a1f27;
  --text-2: #3d4652;
  --muted: #6d7787;
  --accent: #9a7420;
  --accent-ink: #ffffff;
  --accent-soft: rgba(154, 116, 32, .10);
  --accent-line: rgba(154, 116, 32, .35);
  --ok: #17803d;
  --ok-soft: rgba(23, 128, 61, .10);
  --bad: #b42318;
  --bad-soft: rgba(180, 35, 24, .09);
  --glow: rgba(154, 116, 32, .055);
  --shadow: 0 10px 28px -20px rgba(28, 24, 12, .45);
  --shadow-lift: 0 20px 44px -26px rgba(28, 24, 12, .5);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  background-image:
    radial-gradient(900px 380px at 50% -14%, var(--glow), transparent 68%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--accent); color: var(--accent-ink); }

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ── 容器 ───────────────────────────────────────── */
.view { min-height: 100vh; min-height: 100svh; padding-bottom: 40px; }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }
.wrap-wide { max-width: var(--maxw-wide); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }

/* ── 顶栏 ───────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .brand {
  display: flex; align-items: center; gap: 9px;
  white-space: nowrap; min-width: 0;
}
/* 两行品牌锁定：主标题在上，副标题在下。窄屏也不隐藏，只是字号略缩 */
.topbar .brand .bt {
  display: flex; flex-direction: column; justify-content: center;
  line-height: 1.2; min-width: 0;
}
.topbar .brand .bt b {
  font-size: 15px; font-weight: 700; letter-spacing: .01em;
  overflow: hidden; text-overflow: ellipsis;
}
.topbar .brand .bt small {
  font-size: 11.5px; font-weight: 500; color: var(--muted);
  letter-spacing: .02em;
  overflow: hidden; text-overflow: ellipsis;
}
.brand-mark {
  width: 27px; height: 27px; border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--accent), #b3812c);
  color: #140f05; font-size: 15px; font-weight: 800;
  font-family: "Songti SC", "SimSun", serif;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}

.icon-btn {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  transition: background .18s var(--ease), border-color .18s var(--ease), transform .12s;
  font-size: 14px; color: var(--text-2);
}
.icon-btn:hover { background: var(--panel-2); border-color: var(--panel-3); }
.icon-btn:active { transform: scale(.94); }

/* 顶栏文字导航 */
.nav-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 560;
  cursor: pointer;
  white-space: nowrap;
  transition: all .16s var(--ease);
}
.nav-btn:hover { background: var(--panel); color: var(--text); }
.nav-btn[aria-current="page"] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}

/* ── 按钮 ───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 17px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 14.5px; font-weight: 560;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s var(--ease), border-color .18s var(--ease),
              transform .12s var(--ease), box-shadow .18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--panel-2); border-color: var(--panel-3); }
.btn:active { transform: translateY(1px) scale(.995); }
.btn:disabled { opacity: .42; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(165deg, var(--accent), #bd8c2f);
  border-color: transparent;
  color: #16110a;
  font-weight: 700;
  box-shadow: 0 8px 22px -14px var(--accent), inset 0 1px 0 rgba(255,255,255,.3);
}
.btn-primary:hover { filter: brightness(1.06); background: linear-gradient(165deg, var(--accent), #bd8c2f); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--panel); color: var(--text); }
.btn-lg { padding: 14px 26px; font-size: 15.5px; border-radius: var(--r-lg); }
.btn-block { width: 100%; }
.btn-ok { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.btn-bad { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }

/* ── 卡片 ───────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card-tight { padding: 14px 16px; }
.card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; letter-spacing: .08em;
  color: var(--muted); text-transform: uppercase;
  margin-bottom: 12px;
}
.card-title::before {
  content: ""; width: 3px; height: 13px; border-radius: 2px;
  background: var(--accent);
}

/* ── 首页 Hero ──────────────────────────────────── */
.hero { padding: 34px 0 22px; }
.hero-eyebrow {
  font-size: 12.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: 12px;
}
.hero h1 { font-size: clamp(27px, 5.6vw, 38px); letter-spacing: -.025em; }
.hero h1 em {
  font-style: normal;
  background: linear-gradient(180deg, var(--accent), #a97a24);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); margin-top: 10px; font-size: 14.5px; max-width: 46em; }

.stat-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  margin-top: 20px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.stat-strip div { background: var(--panel); padding: 13px 12px; }
.stat-strip b {
  display: block; font-size: 21px; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.stat-strip span { font-size: 12px; color: var(--muted); }

/* ── 分段 / 芯片 ────────────────────────────────── */
.seg {
  display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 3px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  max-width: 100%;
}
.seg button {
  border: 0; background: transparent; color: var(--muted);
  padding: 7px 14px; border-radius: 8px; cursor: pointer;
  font-size: 13.5px; font-weight: 560; white-space: nowrap;
  transition: all .16s var(--ease);
}
.seg button[aria-pressed="true"] {
  background: var(--panel-3); color: var(--text);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
}
.seg button:hover:not([aria-pressed="true"]) { color: var(--text-2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }/* 模式卡（刷题 / 测试 / 章节测试） */
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 9px; }
.mode-card {
  display: flex; flex-direction: column; gap: 3px;
  padding: 13px 14px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel-2);
  cursor: pointer;
  transition: all .16s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.mode-card:hover { border-color: var(--panel-3); }
.mode-card b { font-size: 15px; font-weight: 650; }
.mode-card span { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.mode-card[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.mode-card[aria-pressed="true"] b { color: var(--accent); }
.mode-card[aria-pressed="true"] span { color: var(--text-2); }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 13.5px; cursor: pointer;
  transition: all .16s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: var(--panel-3); color: var(--text); }
.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
  font-weight: 600;
}
.chip .n {
  font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums;
  padding-left: 2px;
}
.chip[aria-pressed="true"] .n { color: var(--accent); opacity: .8; }

/* ── 表单 ───────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 9px; }
.field > label { font-size: 13px; font-weight: 650; color: var(--muted); letter-spacing: .03em; }
.input {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
  width: 96px;
  outline: none;
  transition: border-color .16s;
}
.input:focus { border-color: var(--accent-line); }
.input::-webkit-outer-spin-button, .input::-webkit-inner-spin-button { opacity: .4; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; color: var(--text-2); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i {
  width: 38px; height: 22px; border-radius: 99px; flex: none;
  background: var(--panel-3); border: 1px solid var(--line);
  position: relative; transition: all .2s var(--ease);
}
.switch i::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); transition: all .2s var(--ease);
}
.switch input:checked + i { background: var(--accent-soft); border-color: var(--accent-line); }
.switch input:checked + i::after { left: 19px; background: var(--accent); }

/* ── 题目主体 ───────────────────────────────────── */
.qhead {
  display: flex; align-items: center; gap: 9px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.badge {
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 6px;
  background: var(--panel-3); color: var(--text-2);
}
.badge[data-t="single"] { background: rgba(90, 140, 220, .15); color: #7aa5e8; }
.badge[data-t="multiple"] { background: rgba(150, 110, 210, .15); color: #a98ce0; }
.badge[data-t="judge"] { background: rgba(80, 175, 140, .15); color: #56c39c; }
.badge[data-t="case"] { background: rgba(210, 150, 60, .16); color: #d9a441; }
html[data-theme="light"] .badge[data-t="single"] { color: #1d4ed8; }
html[data-theme="light"] .badge[data-t="multiple"] { color: #6d28d9; }
html[data-theme="light"] .badge[data-t="judge"] { color: #0f766e; }
html[data-theme="light"] .badge[data-t="case"] { color: #92400e; }

.qmeta { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.stem {
  font-size: calc(17px * var(--fs-q));
  line-height: 1.9;
  letter-spacing: .005em;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.stem .blank {
  display: inline-block; min-width: 2.2em;
  border-bottom: 1.5px dashed var(--accent-line);
  margin: 0 3px 0 2px; vertical-align: -0.12em;
  height: .9em;
}
.stem sup { font-size: .72em; }

/* 选项 */
.opts { display: flex; flex-direction: column; gap: 9px; margin-top: 18px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; text-align: left;
  padding: 13px 15px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: calc(15px * var(--fs-q)); line-height: 1.72;
  color: var(--text);
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-tap-highlight-color: transparent;
}
.opt:hover { border-color: var(--panel-3); background: var(--panel-3); }
.opt:active { transform: scale(.995); }
.opt .k {
  flex: none;
  width: 25px; height: 25px; margin-top: 1px;
  display: grid; place-items: center;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 12.5px; font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  transition: all .15s var(--ease);
}
.opt .t { flex: 1; min-width: 0; }

.opt[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent-soft); }
.opt[aria-pressed="true"] .k { background: var(--accent); border-color: var(--accent); color: #17120a; }

.opt.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.is-correct .k { background: var(--ok); border-color: var(--ok); color: #04120a; }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.is-wrong .k { background: var(--bad); border-color: var(--bad); color: #1a0503; }
.opt.is-missed { border-color: var(--ok); border-style: dashed; }
.opt.is-missed .k { color: var(--ok); border-color: var(--ok); }
.opt.locked { cursor: default; }
.opt.locked:hover { background: var(--panel-2); border-color: var(--line); }
.opt:disabled { opacity: 1; }
.judge-btn:disabled { opacity: 1; }
.opt.locked.is-correct:hover { background: var(--ok-soft); border-color: var(--ok); }
.opt.locked.is-wrong:hover { background: var(--bad-soft); border-color: var(--bad); }
.opt.locked.is-missed:hover { border-color: var(--ok); }

/* 判断题大按钮 */
.judge-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 18px; }
.judge-btn {
  padding: 20px 10px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--panel-2);
  font-size: 16px; font-weight: 600; cursor: pointer;
  transition: all .15s var(--ease);
}
.judge-btn:hover { border-color: var(--panel-3); }
.judge-btn[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.judge-btn.is-correct { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.judge-btn.is-wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }

/* 反馈 */
.feedback {
  margin-top: 16px; padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--panel-2);
  animation: fadeUp .28s var(--ease);
}
.feedback.ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.feedback.no { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.fb-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14.5px; margin-bottom: 9px; }
.feedback.ok .fb-head { color: var(--ok); }
.feedback.no .fb-head { color: var(--bad); }
.fb-head .ans { font-weight: 600; color: var(--text-2); font-size: 13px; margin-left: auto; }
.explain { font-size: calc(14.5px * var(--fs-q)); line-height: 1.82; color: var(--text-2); overflow-wrap: anywhere; }
.explain sup { font-size: .72em; }
.explain mark { background: var(--accent-soft); color: var(--accent); padding: 0 3px; border-radius: 3px; }
.explain .ex-label {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .06em;
  color: var(--muted); margin-bottom: 5px;
}

@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── 进度 ───────────────────────────────────────── */
.progress-line {
  height: 3px; background: var(--line-soft); position: relative; overflow: hidden;
}
.progress-line i {
  position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(90deg, #b3812c, var(--accent));
  transition: width .3s var(--ease);
}

/* ── 答题底栏 ───────────────────────────────────── */
.quizbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-top: 1px solid var(--line-soft);
}
body.has-quizbar .view { padding-bottom: 92px; }

/* ── 评分环 ─────────────────────────────────────── */
.score-hero {
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
  padding: 26px 22px;
}
.ring {
  --p: 0;
  --sz: 132px;
  width: var(--sz); height: var(--sz); flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px;
  position: relative;
  transition: --p .8s var(--ease);
}
.ring::before {
  content: ""; position: absolute; inset: 9px;
  background: var(--panel); border-radius: 50%;
}
.ring b {
  position: relative; font-size: 34px; font-weight: 750;
  font-variant-numeric: tabular-nums; letter-spacing: -.03em;
  line-height: 1;
}
.ring b small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.ring .cap {
  position: relative;
  font-size: 10.5px; color: var(--muted); letter-spacing: .16em;
}
.score-info { flex: 1; min-width: 220px; }
.score-info h2 { font-size: 21px; margin-bottom: 4px; }
.score-info p { color: var(--muted); font-size: 13.5px; }
.score-kv { display: flex; gap: 22px; margin-top: 16px; flex-wrap: wrap; }
.score-kv div span { display: block; font-size: 12px; color: var(--muted); }
.score-kv div b { font-size: 17px; font-variant-numeric: tabular-nums; }
.score-kv .c-ok { color: var(--ok); }
.score-kv .c-bad { color: var(--bad); }

/* 分项条 */
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-item { display: grid; grid-template-columns: 96px 1fr 62px; gap: 11px; align-items: center; font-size: 13px; }
.bar-item .lb { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 7px; border-radius: 99px; background: var(--panel-3); overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .6s var(--ease); }
.bar-item .vv { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── 回顾列表 ───────────────────────────────────── */
.review { display: flex; flex-direction: column; gap: 9px; }
.rv {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--panel); overflow: hidden;
}
.rv > summary {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; cursor: pointer; list-style: none;
  font-size: 14px;
}
.rv > summary::-webkit-details-marker { display: none; }
.rv > summary:hover { background: var(--panel-2); }
.rv .no { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; width: 34px; }
.rv .tx {
  flex: 1; min-width: 0; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rv[data-r="ok"] { border-left: 3px solid var(--ok); }
.rv[data-r="no"] { border-left: 3px solid var(--bad); }
.rv[data-r="skip"] { border-left: 3px solid var(--muted); }
.rv .tag { font-size: 11.5px; font-weight: 700; flex: none; }
.rv[data-r="ok"] .tag { color: var(--ok); }
.rv[data-r="no"] .tag { color: var(--bad); }
.rv[data-r="skip"] .tag { color: var(--muted); }
.rv-body { padding: 4px 14px 16px 58px; border-top: 1px solid var(--line-soft); }

/* ── 答题卡抽屉 ─────────────────────────────────── */
.sheet-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4, 6, 9, .58);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity .22s var(--ease);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-mask.on { opacity: 1; pointer-events: auto; }
.sheet-panel {
  width: min(560px, 100%);
  max-height: 76vh;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(16px);
  transition: transform .26s var(--ease);
  display: flex; flex-direction: column; gap: 13px;
}
.sheet-mask.on .sheet-panel { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.sheet-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.dot-cur { background: var(--accent); }
.dot-done { background: var(--panel-3); border: 1px solid var(--muted); }
.dot-ok { background: var(--ok); }
.dot-no { background: var(--bad); }
.sheet-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 8px; overflow-y: auto; padding: 2px;
}
.sheet-grid button {
  aspect-ratio: 1; border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 13px; font-variant-numeric: tabular-nums;
  cursor: pointer; transition: all .14s var(--ease);
}
.sheet-grid button:hover { border-color: var(--accent-line); }
.sheet-grid button.done { background: var(--panel-3); color: var(--text); }
.sheet-grid button.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.sheet-grid button.no { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.sheet-grid button.cur { outline: 2px solid var(--accent); outline-offset: 1px; }
.sheet-grid button.mk { position: relative; }
.sheet-grid button.mk::after {
  content: ""; position: absolute; top: 4px; right: 4px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}

/* ── 空状态 / 提示 ──────────────────────────────── */
.empty {
  text-align: center; padding: 52px 20px; color: var(--muted);
}
.empty .big { font-size: 34px; margin-bottom: 12px; opacity: .5; }
.empty h3 { color: var(--text-2); font-size: 16px; margin-bottom: 6px; }
.empty p { font-size: 13.5px; }

.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 12px);
  background: var(--panel-3); color: var(--text);
  border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; z-index: 90;
  opacity: 0; pointer-events: none;
  transition: all .24s var(--ease);
  box-shadow: var(--shadow-lift);
  max-width: 86vw; text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.boot {
  min-height: 78vh; display: grid; place-content: center; gap: 14px;
  text-align: center; color: var(--muted); font-size: 14px;
}
.boot-mark {
  width: 54px; height: 54px; margin: 0 auto; border-radius: 15px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--accent), #b3812c);
  color: #140f05; font-size: 26px; font-weight: 800;
  font-family: "Songti SC", "SimSun", serif;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .62; transform: scale(.96); } }

/* ── 历史 / 统计 ────────────────────────────────── */
.hist { display: flex; flex-direction: column; }
.hist-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px;
  align-items: center; padding: 11px 2px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
}
.hist-row:last-child { border-bottom: 0; }
.hist-row .m { color: var(--text-2); }
.hist-row .m small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.hist-row .sc {
  font-weight: 700; font-variant-numeric: tabular-nums;
  font-size: 15px; min-width: 46px; text-align: right;
}
.hist-row .sc.hi { color: var(--ok); }
.hist-row .sc.lo { color: var(--bad); }

/* ── 工具类 ─────────────────────────────────────── */
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.tnum { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.divider { height: 1px; background: var(--line-soft); margin: 16px 0; }
.hide { display: none !important; }

/* ── 响应式 ─────────────────────────────────────── */
@media (max-width: 640px) {
  :root { --fs-base: 15px; }
  .wrap { padding: 0 15px; }
  .card { padding: 15px; border-radius: 14px; }
  .stem { font-size: calc(16.5px * var(--fs-q)); line-height: 1.85; }
  .opt { padding: 12px 13px; font-size: calc(14.5px * var(--fs-q)); }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .score-hero { gap: 18px; padding: 20px 16px; }
  .ring { --sz: 112px; }
  .ring b { font-size: 29px; }
  .bar-item { grid-template-columns: 78px 1fr 54px; gap: 8px; }
  .rv-body { padding-left: 14px; }
  .sheet-grid { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
  .hero { padding: 24px 0 16px; }
  .quizbar .btn { padding: 10px 14px; font-size: 14px; }
  .topbar .brand .bt b { font-size: 14px; }
  .topbar .brand .bt small { font-size: 10.5px; }
  .nav-btn { padding: 6px 8px; font-size: 12.5px; }
  /* 模式卡：窄屏改横排，标题与说明一行读完 */
  .mode-grid { grid-template-columns: 1fr; gap: 7px; }
  .mode-card { flex-direction: row; align-items: baseline; gap: 10px; padding: 11px 13px; }
  .mode-card b { flex: none; width: 4.6em; }
  .mode-card span { flex: 1; }
}

/* 超窄屏（360 / 320）：头部元素整体收紧，保证两行品牌不被省略号截断 */
@media (max-width: 400px) {
  .topbar { padding: calc(8px + env(safe-area-inset-top)) 12px 8px; gap: 8px; }
  .topbar .brand { gap: 7px; }
  .brand-mark { width: 24px; height: 24px; border-radius: 7px; font-size: 13px; }
  .topbar .brand .bt b { font-size: 13px; }
  .topbar .brand .bt small { font-size: 10px; }
  .nav-btn { padding: 5px 7px; font-size: 12px; }
  .icon-btn { width: 32px; height: 32px; }
}

/* 极窄屏（≤340，老机型）：再压一档，避免主标题被省略号吃掉 */
@media (max-width: 340px) {
  .topbar { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .topbar .brand { gap: 6px; }
  .brand-mark { width: 22px; height: 22px; font-size: 12px; }
  .topbar .brand .bt b { font-size: 12px; }
  .topbar .brand .bt small { font-size: 9.5px; }
  .nav-btn { padding: 4px 6px; font-size: 11px; }
  .icon-btn { width: 30px; height: 30px; font-size: 12px; }
}

@media (min-width: 900px) {
  .sheet-mask { align-items: center; }
  .sheet-panel { border-radius: var(--r-xl); max-height: 70vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* 打印：结果页可直接印 */
@media print {
  .topbar, .quizbar, .sheet-mask, .toast, .no-print { display: none !important; }
  body, .card { background: #fff !important; color: #000 !important; box-shadow: none !important; }
  .view { padding-bottom: 0; }
}
