/* ============================================================
   法硕真题刷题台 — 双主题样式
   ============================================================ */
:root {
  --bg: #f2ede4;
  --bg-deep: #e8e1d4;
  --surface: #fffdf8;
  --surface-2: #f8f4ec;
  --surface-3: #f1ebe0;
  --ink: #20242a;
  --ink-2: #444c55;
  --muted: #7d7f80;
  --faint: #a6a5a1;
  --line: rgba(38, 40, 42, .11);
  --line-strong: rgba(38, 40, 42, .2);
  --accent: #2f6d5f;
  --accent-ink: #f7fffb;
  --accent-soft: #e3efe9;
  --accent-line: rgba(47, 109, 95, .3);
  --gold: #a97b3f;
  --correct: #2c7a56;
  --correct-soft: #e4f1e9;
  --correct-line: rgba(44, 122, 86, .35);
  --wrong: #ad4a44;
  --wrong-soft: #f7e6e3;
  --wrong-line: rgba(173, 74, 68, .35);
  --shadow: 0 24px 60px -38px rgba(55, 45, 30, .38);
  --shadow-sm: 0 8px 24px -18px rgba(55, 45, 30, .4);
  --radius: 18px;
  --radius-sm: 12px;
  --serif: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  --xf: #b4534b; --xf-soft: #f4e2de;
  --mf: #3f7d6e; --mf-soft: #e2efe9;
  --fl: #4b6b9c; --fl-soft: #e5ebf5;
  --xa: #8a5a9e; --xa-soft: #f0e7f4;
  --fz: #a5763f; --fz-soft: #f4ebdf;
}

html[data-theme="dark"] {
  --bg: #0d1216;
  --bg-deep: #080c0f;
  --surface: #151d23;
  --surface-2: #111820;
  --surface-3: #1c262e;
  --ink: #e9e4d8;
  --ink-2: #c2beb4;
  --muted: #8f9394;
  --faint: #6f7477;
  --line: rgba(233, 228, 216, .1);
  --line-strong: rgba(233, 228, 216, .2);
  --accent: #7fc7b2;
  --accent-ink: #08130f;
  --accent-soft: #17312a;
  --accent-line: rgba(127, 199, 178, .32);
  --gold: #d3a96d;
  --correct: #7cc79c;
  --correct-soft: #14291f;
  --correct-line: rgba(124, 199, 156, .35);
  --wrong: #e19186;
  --wrong-soft: #2c1a18;
  --wrong-line: rgba(225, 145, 134, .35);
  --shadow: 0 28px 70px -40px #000;
  --shadow-sm: 0 10px 24px -18px #000;

  --xf: #e19a91; --xf-soft: #2c1c1a;
  --mf: #84c3b2; --mf-soft: #152a25;
  --fl: #93aede; --fl-soft: #1a2233;
  --xa: #c39bd6; --xa-soft: #241a2d;
  --fz: #d2ab77; --fz-soft: #2a2116;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; font-synthesis: none; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .35s ease, color .35s ease;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(169, 123, 63, .09), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(47, 109, 95, .07), transparent 55%),
    linear-gradient(180deg, transparent, var(--bg-deep));
  opacity: .9;
}
html[data-theme="dark"] body::before {
  background:
    radial-gradient(1100px 600px at 8% -10%, rgba(211, 169, 109, .07), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, rgba(127, 199, 178, .06), transparent 55%),
    linear-gradient(180deg, transparent, var(--bg-deep));
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-soft); color: var(--ink); }

/* 主题切换过渡 */
.topbar, .sidebar, .qcard, .subject-card, .panel, .side-section, .seg, .pill, .option,
.subj-input, .q-explain, .q-result, .modal-panel, .jump-grid button, .toast {
  transition: background-color .35s ease, border-color .35s ease, color .2s ease, box-shadow .3s ease;
}

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ================= 顶栏 ================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.brand-seal {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 10px 10px 10px 3px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent-ink) 25%, transparent);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-family: var(--serif); font-size: 18px; letter-spacing: .08em; }
.brand-text small { color: var(--muted); font-size: 10.5px; letter-spacing: .14em; }

.mode-switch {
  display: flex;
  margin-left: 10px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  gap: 3px;
}
.mode-btn {
  display: flex; align-items: center; gap: 7px;
  border: 0; background: transparent;
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .02em;
}
.mode-btn em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--faint);
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 500;
}
.mode-btn .mode-ico { font-size: 12px; opacity: .8; }
.mode-btn:hover { color: var(--ink); }
.mode-btn.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.mode-btn.is-active .mode-ico { color: var(--accent); }
.mode-btn.is-active em { background: var(--accent-soft); color: var(--accent); }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.top-stat {
  display: flex; align-items: baseline; gap: 4px;
  color: var(--muted); font-size: 12px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}
.top-stat-num { font-family: var(--serif); font-size: 16px; color: var(--ink); font-weight: 700; }
.top-stat-sep { color: var(--faint); }
.top-stat-total { color: var(--ink-2); }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#themeBtn .ico-moon { display: none; }
html[data-theme="dark"] #themeBtn .ico-sun { display: none; }
html[data-theme="dark"] #themeBtn .ico-moon { display: block; }
.menu-btn { display: none; }

/* ================= 布局 ================= */
.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  max-width: 1560px;
  margin: 0 auto;
  min-height: calc(100vh - 72px);
}
.overlay { display: none; }
.sidebar {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
  z-index: 20;
}
.side-inner { height: 100%; display: flex; flex-direction: column; }
.side-scroll { flex: 1; overflow-y: auto; padding: 0 16px 8px; }
.side-section { padding: 16px 4px; border-bottom: 1px solid var(--line); }
.side-section:last-child { border-bottom: 0; }
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
  font-size: 11.5px;
  letter-spacing: .16em;
  color: var(--muted);
  text-transform: uppercase;
}
.link-btn {
  border: 0; background: none; padding: 2px 0;
  color: var(--accent); font-size: 12px; letter-spacing: .02em;
}
.link-btn:hover { text-decoration: underline; }

.seg {
  display: grid; grid-template-columns: 1fr 1fr;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 11px;
}
.seg-btn {
  border: 0; background: transparent;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px; font-weight: 600;
}
.seg-btn.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg-btn:hover { color: var(--ink); }

/* 学科树 / 考点树 */
.tree { display: flex; flex-direction: column; gap: 3px; }
.tree-item {
  width: 100%;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  text-align: left;
  font-size: 13.5px;
}
.tree-item:hover { background: var(--surface-2); color: var(--ink); }
.tree-item.is-active {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.tree-item .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--subj, var(--accent));
  flex: 0 0 auto;
}
.tree-item .name { flex: 1; }
.tree-item .num { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.tree-item .mini-bar {
  position: absolute; left: 0; bottom: 0; height: 2px;
  background: var(--subj, var(--accent));
  border-radius: 2px;
  opacity: .55;
}
.tree-item { position: relative; overflow: hidden; }

.acc { border: 0; margin: 0; }
.acc > summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 8px;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
}
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary:hover { background: var(--surface-2); }
.acc > summary .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--subj); }
.acc > summary .num { margin-left: auto; font-weight: 400; color: var(--faint); font-size: 11px; }
.acc > summary::after {
  content: "›";
  color: var(--faint);
  transition: transform .2s;
  font-size: 15px;
  margin-left: 2px;
}
.acc[open] > summary::after { transform: rotate(90deg); }
.acc .acc-body { padding: 2px 0 6px 12px; border-left: 1px solid var(--line); margin-left: 12px; }
.group-label {
  padding: 9px 8px 3px;
  font-size: 10.5px;
  letter-spacing: .12em;
  color: var(--muted);
  text-transform: uppercase;
}
.topic-btn {
  width: 100%;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--ink-2);
  font-size: 12.5px;
  text-align: left;
}
.topic-btn:hover { background: var(--surface-2); color: var(--ink); }
.topic-btn.is-active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.topic-btn .num { margin-left: auto; color: var(--faint); font-size: 10.5px; }
.topic-btn.zero { opacity: .38; }

/* 筛选 */
.filters .field { margin-bottom: 13px; }
.filters .field > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .04em;
  margin-bottom: 6px;
}
.pill-row { display: flex; gap: 5px; }
.pill-row.wrap { flex-wrap: wrap; }
.pill {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
}
.pill:hover { color: var(--ink); border-color: var(--line-strong); }
.pill.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
  font-weight: 600;
}
select {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  border-radius: 9px;
  padding: 8px 30px 8px 10px;
  font-size: 12.5px;
  color: var(--ink-2);
}
select:focus { outline: 2px solid var(--accent-line); outline-offset: 1px; }

.side-foot {
  padding: 14px 18px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.mini-progress-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.mini-progress-head span:last-child { color: var(--accent); font-weight: 700; }
.bar { height: 5px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--gold))); border-radius: 999px; transition: width .4s ease; }
.mini-stats { margin-top: 7px; font-size: 10.5px; color: var(--faint); }
.side-note { margin: 10px 0 0; font-size: 10px; color: var(--faint); letter-spacing: .04em; }
.side-link { display: inline-block; color: var(--accent); text-decoration: none; font-size: 11px; margin-top: 6px; }
.side-link:hover { text-decoration: underline; }

/* ================= 主区域 ================= */
.main { grid-column: 2; grid-row: 1; min-width: 0; padding: 18px 32px 90px; }
.main-toolbar {
  display: flex; align-items: center; gap: 14px;
  padding: 4px 0 16px;
}
.crumbs { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-height: 28px; font-size: 12.5px; color: var(--muted); }
.crumbs button {
  border: 0; background: none; padding: 2px 0; color: var(--muted);
  font-size: 12.5px;
}
.crumbs button:hover { color: var(--accent); }
.crumbs .sep { color: var(--faint); opacity: .6; }
.crumbs .here { color: var(--ink); font-weight: 600; }
.tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search {
  position: relative;
  display: flex; align-items: center;
}
.search svg {
  position: absolute; left: 10px; width: 15px; height: 15px;
  fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round;
}
.search input {
  width: 190px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 9px;
  padding: 8px 10px 8px 32px;
  font-size: 12.5px;
  color: var(--ink);
  transition: width .2s, border-color .2s;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; border-color: var(--accent-line); width: 240px; }
.select-compact {
  width: auto;
  background-color: var(--surface);
  font-size: 12px;
  padding: 8px 28px 8px 10px;
}

/* ================= 首页 Dashboard ================= */
.view { min-height: 60vh; }
.dashboard { display: flex; flex-direction: column; gap: 26px; animation: fadeUp .45s ease both; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  gap: 30px;
  align-items: stretch;
  padding: 22px 0 6px;
}
.hero-copy { padding: 18px 4px; }
.eyebrow {
  margin: 0 0 14px;
  font-size: 11px;
  letter-spacing: .24em;
  color: var(--muted);
  text-transform: uppercase;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(38px, 4.6vw, 62px);
  line-height: 1.14;
  letter-spacing: .01em;
  margin: 0 0 18px;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
  position: relative;
}
.hero h1 em::after {
  content: "";
  position: absolute;
  left: 2px; right: 2px; bottom: 4px;
  height: 10px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  z-index: -1;
  border-radius: 3px;
}
.hero-sub { margin: 0; color: var(--ink-2); font-size: 14px; letter-spacing: .06em; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
}
.btn:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: 0 12px 28px -16px color-mix(in srgb, var(--accent) 80%, #000);
  padding: 11px 20px;
}
.btn.primary:hover { filter: brightness(1.04); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.kbd {
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent-ink) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-ink) 20%, transparent);
  opacity: .8;
}
.hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: center;
}
.stat-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 16px 16px 14px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--stat-color, var(--accent));
}
.stat-card .stat-num {
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1.1;
  font-weight: 700;
  color: var(--ink);
}
.stat-card .stat-label { font-size: 11px; color: var(--muted); letter-spacing: .1em; margin-top: 4px; }
.stat-card .stat-sub { font-size: 10.5px; color: var(--faint); margin-top: 2px; }

.panel { background: transparent; }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.panel-head h2 { font-family: var(--serif); font-size: 22px; margin: 0; letter-spacing: .03em; }
.panel-head .muted { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.subject-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.subject-card {
  --subj: var(--accent);
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 15px 14px 12px;
  text-align: left;
  overflow: hidden;
  min-height: 132px;
  display: flex; flex-direction: column;
}
.subject-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: color-mix(in srgb, var(--subj) 40%, var(--line)); }
.subject-card .subj-top { display: flex; align-items: center; gap: 7px; }
.subject-card .subj-seal {
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--subj) 12%, var(--surface));
  color: var(--subj);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 14px;
}
.subject-card .subj-name { font-weight: 700; font-size: 13.5px; }
.subject-card .subj-count {
  margin-top: auto;
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.2;
  color: var(--subj);
  font-weight: 700;
}
.subject-card .subj-count small { font-family: var(--sans); font-size: 10px; color: var(--faint); font-weight: 400; margin-left: 3px; }
.subject-card .subj-bar { margin-top: 8px; height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.subject-card .subj-bar i { display: block; height: 100%; background: var(--subj); border-radius: 999px; }
.subject-card .subj-foot { display: flex; justify-content: space-between; margin-top: 6px; font-size: 10px; color: var(--faint); }
.subject-card.all { justify-content: center; align-items: center; text-align: center; border-style: dashed; }
.subject-card.all .subj-count { color: var(--ink); }

.tips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tip {
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 11.5px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.tip b { color: var(--ink-2); margin-right: 5px; }

/* ================= 刷题区 ================= */
.practice { animation: fadeUp .4s ease both; }
.practice-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.practice-kicker { display: block; font-size: 10.5px; letter-spacing: .18em; color: var(--muted); text-transform: uppercase; margin-bottom: 4px; }
.practice-title h2 { font-family: var(--sans); font-weight: 600; margin: 0; font-size: 22px; letter-spacing: .02em; }
.practice-tools { display: flex; align-items: center; gap: 8px; }
.counter { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 4px; }
.practice-bar { margin: 12px 0 18px; height: 3px; }
.practice-bar i { background: var(--accent); }

.qcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px 20px;
  position: relative;
  overflow: hidden;
}
.qcard::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--subj, var(--accent)), color-mix(in srgb, var(--subj, var(--accent)) 30%, transparent));
  opacity: .85;
}
.q-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 10.5px;
  letter-spacing: .03em;
}
.chip.subj { color: var(--subj); border-color: color-mix(in srgb, var(--subj) 30%, transparent); background: color-mix(in srgb, var(--subj) 9%, var(--surface)); }
.chip.topic { color: var(--ink-2); }
.chip.type { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 30%, transparent); background: color-mix(in srgb, var(--gold) 8%, var(--surface)); }
.q-no { margin-left: auto; font-family: var(--serif); font-size: 12px; color: var(--faint); letter-spacing: .08em; }

.q-material {
  margin: 0 0 18px;
  padding: 14px 17px;
  background: var(--surface-2);
  border-left: 3px solid var(--gold);
  border-radius: 10px;
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.9;
  color: var(--ink-2);
  white-space: pre-wrap;
}
.q-material-head {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--gold);
  margin-bottom: 6px;
}
.q-stem {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.95;
  letter-spacing: .015em;
  color: var(--ink);
  margin: 2px 0 20px;
  white-space: pre-wrap;
  word-break: break-word;
}
.q-stem strong { color: var(--accent); }

.q-options { display: flex; flex-direction: column; gap: 9px; }
.option {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.65;
  position: relative;
}
.option:hover { border-color: var(--line-strong); background: var(--surface-3); }
.option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.option-key {
  flex: 0 0 auto;
  width: 25px; height: 25px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 1px;
  transition: all .2s;
}
.option-text { flex: 1; }
.option .mark { flex: 0 0 auto; font-size: 14px; opacity: 0; margin-top: 2px; }
.option.is-selected {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.option.is-selected .option-key { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.option.is-correct {
  border-color: var(--correct-line);
  background: var(--correct-soft);
  color: var(--ink);
}
.option.is-correct .option-key { background: var(--correct); color: var(--accent-ink); border-color: var(--correct); }
.option.is-wrong {
  border-color: var(--wrong-line);
  background: var(--wrong-soft);
  color: var(--ink);
  text-decoration-color: var(--wrong);
}
.option.is-wrong .option-key { background: var(--wrong); color: var(--accent-ink); border-color: var(--wrong); }
.option.is-correct .mark, .option.is-wrong .mark { opacity: 1; }
.option.is-correct .mark { color: var(--correct); }
.option.is-wrong .mark { color: var(--wrong); }
.option[disabled] { cursor: default; }

.q-actions { display: flex; align-items: center; gap: 10px; margin-top: 20px; }
.q-actions .btn.primary { min-width: 120px; }
.hint { color: var(--faint); font-size: 11px; margin-left: 2px; }
.q-actions .spacer { flex: 1; }

.q-result {
  margin-top: 18px;
  border-radius: 12px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.q-result.right { background: var(--correct-soft); border-color: var(--correct-line); }
.q-result.wrong { background: var(--wrong-soft); border-color: var(--wrong-line); }
.result-title { font-weight: 700; font-size: 13.5px; }
.q-result.right .result-title { color: var(--correct); }
.q-result.wrong .result-title { color: var(--wrong); }
.result-answer { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.ans-chip {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 5px;
  border-radius: 6px;
  font-weight: 700; font-size: 12px;
  background: var(--correct); color: var(--accent-ink);
}
.q-result.wrong .ans-chip { background: var(--wrong); }

.q-explain {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 15px 18px;
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--ink-2);
  max-height: 520px;
  overflow-y: auto;
}
.q-explain h4 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: .16em;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
}
.q-explain p { margin: 0 0 8px; }
.q-explain p:last-child { margin-bottom: 0; }
.q-explain .ref-label { color: var(--accent); font-weight: 700; }

.q-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 18px; padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.q-foot-left, .q-foot-right { display: flex; gap: 6px; align-items: center; }
.chip-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 8px;
}
.chip-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.chip-btn[aria-pressed="true"] { color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); border-color: color-mix(in srgb, var(--gold) 25%, transparent); }
.chip-btn .star { font-size: 14px; }

.subj-input {
  width: 100%;
  resize: vertical;
  min-height: 120px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 12px;
  padding: 13px 15px;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink);
}
.subj-input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent); }
.subj-input::placeholder { color: var(--faint); }
.subj-meta { display: flex; justify-content: space-between; margin-top: 6px; font-size: 10.5px; color: var(--faint); }
.q-subjective .btn { margin-top: 4px; }

.rate-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.rate-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
}
.rate-btn:hover { border-color: var(--line-strong); }
.rate-btn.is-active[data-rate="mastered"] { background: var(--correct-soft); border-color: var(--correct-line); color: var(--correct); }
.rate-btn.is-active[data-rate="fuzzy"] { background: color-mix(in srgb, var(--gold) 12%, var(--surface)); border-color: color-mix(in srgb, var(--gold) 35%, transparent); color: var(--gold); }
.rate-btn.is-active[data-rate="unknown"] { background: var(--wrong-soft); border-color: var(--wrong-line); color: var(--wrong); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; }
.pager .btn { min-width: 112px; }
.pager-mid { color: var(--faint); font-size: 11px; letter-spacing: .08em; }

/* ================= 弹窗 / 提示 ================= */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 10, 12, .5); backdrop-filter: blur(3px); }
.modal-panel {
  position: relative;
  width: min(720px, calc(100vw - 32px));
  max-height: min(76vh, 720px);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  animation: pop .22s ease both;
}
.modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-family: var(--serif); font-size: 18px; }
.legend { margin-left: auto; display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--muted); }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--line-strong); margin-left: 4px; }
.legend .dot.done { background: var(--correct); border-color: var(--correct); }
.legend .dot.wrong { background: var(--wrong); border-color: var(--wrong); }
.jump-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 6px;
  overflow-y: auto;
}
.jump-grid button {
  height: 40px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.jump-grid button:hover { border-color: var(--line-strong); color: var(--ink); }
.jump-grid button.done { background: var(--correct-soft); border-color: var(--correct-line); color: var(--correct); }
.jump-grid button.wrong { background: var(--wrong-soft); border-color: var(--wrong-line); color: var(--wrong); }
.jump-grid button.current { outline: 2px solid var(--accent); outline-offset: 1px; color: var(--ink); font-weight: 700; }

.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  transition: opacity .2s, transform .2s;
  box-shadow: var(--shadow);
}
.toast.show { opacity: .94; transform: translate(-50%, 0); }
html[data-theme="dark"] .toast { background: #e9e4d8; color: #111; }

.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}
.empty h3 { font-family: var(--serif); color: var(--ink); font-size: 22px; margin: 0 0 8px; }
.empty p { margin: 0 0 16px; font-size: 13px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ================= 响应式 ================= */
@media (max-width: 1280px) {
  .subject-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1100px) {
  .shell { grid-template-columns: 270px minmax(0, 1fr); }
  .main { padding: 16px 22px 80px; }
  .hero { grid-template-columns: 1fr; gap: 18px; }
  .hero-stats { grid-template-columns: repeat(4, 1fr); }
  .stat-card .stat-num { font-size: 22px; }
}
@media (max-width: 900px) {
  .menu-btn { display: grid; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 72px; left: 0; bottom: 0;
    width: min(330px, 86vw);
    height: calc(100vh - 72px);
    transform: translateX(-102%);
    transition: transform .28s ease;
    background: var(--surface);
    border-right: 1px solid var(--line-strong);
    z-index: 60;
    padding-top: 10px;
  }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open { overflow: hidden; }
  .overlay {
    display: block;
    position: fixed; inset: 0; z-index: 50;
    background: rgba(8, 10, 12, .45);
    opacity: 0; pointer-events: none;
    transition: opacity .25s;
  }
  body.sidebar-open .overlay { opacity: 1; pointer-events: auto; }
  .brand-text small { display: none; }
  .top-stat { display: none; }
  .main { padding: 14px 16px 80px; }
  .main-toolbar { flex-wrap: wrap; gap: 10px; }
  .tools { width: 100%; margin-left: 0; }
  .search { flex: 1; }
  .search input, .search input:focus { width: 100%; }
  .hero h1 { font-size: 40px; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .subject-grid { grid-template-columns: repeat(2, 1fr); }
  .tips { grid-template-columns: 1fr; }
  .practice-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .qcard { padding: 22px 18px 16px; }
  .q-stem { font-size: 18px; line-height: 1.85; }
}
@media (max-width: 520px) {
  .topbar { padding: 0 10px; gap: 7px; height: 62px; }
  .brand { gap: 7px; }
  .brand-seal { width: 32px; height: 32px; font-size: 17px; }
  .brand-text strong { font-size: 14px; letter-spacing: .04em; }
  .mode-switch { margin-left: auto; padding: 3px; gap: 2px; }
  .mode-btn { padding: 6px 8px; font-size: 12.5px; white-space: nowrap; gap: 4px; }
  .mode-btn .mode-ico { display: none; }
  .mode-btn em { display: none; }
  .top-actions { gap: 6px; }
  .top-actions .icon-btn { width: 34px; height: 34px; }
  .icon-btn svg { width: 16px; height: 16px; }
  .hero-actions .btn { white-space: nowrap; padding: 10px 12px; }
  .sidebar { top: 62px; height: calc(100vh - 62px); }
  .main { padding: 10px 12px 70px; }
  .hero h1 { font-size: 33px; }
  .hero-actions .btn { flex: 1; }
  .subject-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .subject-card { min-height: 118px; padding: 12px; }
  .qcard { border-radius: 14px; }
  .q-no { display: none; }
  .q-foot { flex-direction: column; align-items: flex-start; }
  .pager .btn { min-width: 0; flex: 1; }
  .pager-mid { display: none; }
  .search input { font-size: 16px; }
  .jump-grid { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
}
