/* ==========================================================================
   MediLearn · 医学学习站 — 设计系统
   纯静态站点，无构建步骤
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root {
  --bg: #f5f7fb;
  --bg-soft: #eef2f9;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --surface-3: #f2f5fa;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #7c8aa0;
  --border: #e3e8f0;
  --border-2: #d3dbe8;

  --brand: #2563eb;
  --brand-soft: #e8f0ff;
  --brand-ink: #1d4ed8;
  --teal: #0d9488;
  --teal-soft: #e0f5f2;
  --rose: #e11d48;
  --rose-soft: #ffe9ee;
  --amber: #d97706;
  --amber-soft: #fff3e0;
  --violet: #7c3aed;
  --violet-soft: #f0e9ff;
  --cyan: #0891b2;
  --cyan-soft: #e0f6fb;

  --ok: #12855f;
  --ok-soft: #e2f6ee;
  --bad: #d92d3f;
  --bad-soft: #ffeaed;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .08), 0 2px 6px rgba(15, 23, 42, .04);
  --shadow-lg: 0 20px 48px rgba(15, 23, 42, .12);

  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 999px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --font-serif: Georgia, "Songti SC", "SimSun", serif;

  --maxw: 1180px;
  --hdr: 62px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

html[data-theme="dark"] {
  --bg: #0a0f1c;
  --bg-soft: #0e1524;
  --surface: #131b2c;
  --surface-2: #172033;
  --surface-3: #1c2740;
  --text: #e9eefb;
  --text-2: #a9b8d4;
  --text-3: #7d8ead;
  --border: #22304c;
  --border-2: #2e3f60;

  --brand: #60a5fa;
  --brand-soft: #16294a;
  --brand-ink: #93c5fd;
  --teal: #2dd4bf;
  --teal-soft: #10312f;
  --rose: #fb7185;
  --rose-soft: #3a1622;
  --amber: #fbbf24;
  --amber-soft: #3a2a10;
  --violet: #a78bfa;
  --violet-soft: #2a1f47;
  --cyan: #22d3ee;
  --cyan-soft: #0d2c36;

  --ok: #34d399;
  --ok-soft: #0f2f27;
  --bad: #f87171;
  --bad-soft: #3a1720;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .35);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, .45);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, .55);
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--hdr) + 18px); }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.35; margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 .9em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }
::selection { background: var(--brand); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.page { padding: 34px 0 90px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; } .mt-4 { margin-top: 36px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }

/* ---------- Header ---------- */
.hdr {
  position: sticky; top: 0; z-index: 60;
  height: var(--hdr);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.hdr-in { display: flex; align-items: center; gap: 16px; height: 100%; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); font-size: 16.5px; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 32px;
  background: linear-gradient(140deg, var(--brand), var(--teal));
  display: grid; place-items: center; color: #fff; font-size: 17px;
  box-shadow: var(--shadow-sm);
}
.nav { display: flex; gap: 2px; margin-left: 6px; }
.nav a {
  padding: 7px 13px; border-radius: var(--r-full); color: var(--text-2);
  font-size: 14px; font-weight: 500; transition: .16s var(--ease);
}
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 650; }
.hdr-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); display: grid; place-items: center;
  font-size: 15px; transition: .16s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-3); }

.menu-btn { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--r-sm); border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600;
  transition: .16s var(--ease); white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-3); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--r-xs); }
.btn-lg { padding: 12px 22px; font-size: 15px; border-radius: var(--r-md); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-full);
  background: var(--surface-3); color: var(--text-2);
  font-size: 12px; font-weight: 600; border: 1px solid transparent;
}
.chip-brand { background: var(--brand-soft); color: var(--brand-ink); }
.chip-teal { background: var(--teal-soft); color: var(--teal); }
.chip-rose { background: var(--rose-soft); color: var(--rose); }
.chip-amber { background: var(--amber-soft); color: var(--amber); }
.chip-violet { background: var(--violet-soft); color: var(--violet); }
.chip-cyan { background: var(--cyan-soft); color: var(--cyan); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-line { background: transparent; border-color: var(--border-2); color: var(--text-3); }
/* 考频 / 重难点标记 */
.chip-hot { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 26%, transparent); }
.chip-mid { background: var(--amber-soft); color: var(--amber); }
.chip-low { background: var(--surface-3); color: var(--text-3); }
.chip-key { background: var(--violet-soft); color: var(--violet); }
.chip-diff { background: var(--brand-soft); color: var(--brand-ink); }
.chip-year { background: transparent; border-color: var(--border-2); color: var(--text-3); font-variant-numeric: tabular-nums; }

/* 重点内容红色强调（==文本==） */
mark.hl {
  background: var(--bad-soft); color: var(--bad);
  padding: 0 3px; border-radius: 3px; font-weight: 700;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-xs);
}
.card-pad { padding: 20px 22px; }
.card-hover { transition: .2s var(--ease); }
.card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--border-2); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl); padding: 44px 40px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.hero::before {
  content: ""; position: absolute; inset: -60% -20% auto auto;
  width: 620px; height: 620px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 62%);
  pointer-events: none;
}
.hero::after {
  content: ""; position: absolute; inset: auto auto -70% -12%;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--teal) 18%, transparent), transparent 62%);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(26px, 3.4vw, 40px); letter-spacing: -.025em; margin-bottom: 12px; }
.hero .lead { font-size: 16.5px; color: var(--text-2); max-width: 660px; margin-bottom: 22px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.grad-text {
  background: linear-gradient(100deg, var(--brand), var(--teal));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 16px 18px; box-shadow: var(--shadow-xs);
}
.stat-n { font-size: 27px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.stat-l { font-size: 12.5px; color: var(--text-3); font-weight: 600; margin-top: 2px; }

/* ---------- Section head ---------- */
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.sec-head h2 { font-size: 21px; }
.sec-head .sub { font-size: 13.5px; color: var(--text-3); margin-top: 3px; }

/* ---------- Subject grid ---------- */
.subj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.subj-card {
  position: relative; overflow: hidden; display: block; color: inherit;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow-xs);
  transition: .22s var(--ease);
}
.subj-card:hover { text-decoration: none; transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--border-2); }
.subj-card::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--accent, var(--brand));
}
.subj-top { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.subj-ico {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 13px;
  display: grid; place-items: center; font-size: 23px;
  background: var(--accent-soft, var(--brand-soft));
}
.subj-name { font-size: 18px; font-weight: 750; }
.subj-en { font-size: 12px; color: var(--text-3); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; margin-top: 1px; }
.subj-desc { font-size: 13.5px; color: var(--text-2); margin: 0 0 16px; min-height: 42px; }
.subj-foot { display: flex; align-items: center; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.subj-meta { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.subj-meta b { color: var(--text); font-weight: 750; }

/* Progress ring */
.ring { position: relative; width: 52px; height: 52px; flex: 0 0 52px; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring-txt {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 800; color: var(--text);
}
.ring-lg { width: 78px; height: 78px; flex-basis: 78px; }
.ring-lg .ring-txt { font-size: 17px; }

.bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent, var(--brand)); transition: width .5s var(--ease); }

/* ---------- List rows (chapters / knowledge) ---------- */
.acc { display: flex; flex-direction: column; gap: 12px; }
.chapter { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-xs); }
.chapter-hd {
  display: flex; align-items: center; gap: 14px; padding: 15px 18px;
  cursor: pointer; user-select: none; transition: background .16s var(--ease);
}
.chapter-hd:hover { background: var(--surface-2); }
.chapter-no {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-soft, var(--brand-soft)); color: var(--accent, var(--brand));
  font-weight: 800; font-size: 13px;
}
.chapter-t { font-weight: 700; font-size: 15.5px; }
.chapter-s { font-size: 12.5px; color: var(--text-3); }
.caret { color: var(--text-3); transition: transform .22s var(--ease); font-size: 12px; }
.chapter.open .caret { transform: rotate(90deg); }
.chapter-bd { display: none; border-top: 1px solid var(--border); background: var(--surface-2); }
.chapter.open .chapter-bd { display: block; }

.klist { display: flex; flex-direction: column; }
.krow {
  display: flex; align-items: center; gap: 14px; padding: 13px 18px;
  border-bottom: 1px solid var(--border); transition: background .16s var(--ease);
}
.krow:last-child { border-bottom: 0; }
.krow:hover { background: var(--surface-3); }
.krow-main { flex: 1; min-width: 0; }
.krow-t { font-weight: 650; font-size: 14.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.krow-d { font-size: 12.5px; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.krow-acts { display: flex; gap: 6px; flex: 0 0 auto; }
.krow.done .krow-t { color: var(--text-2); }

/* ---------- Knowledge article ---------- */
.klayout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 30px; align-items: start; }
.toc { position: sticky; top: calc(var(--hdr) + 20px); font-size: 13.5px; }
.toc-h { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }
.toc a {
  display: block; padding: 5px 11px; border-radius: var(--r-xs); color: var(--text-2);
  border-left: 2px solid transparent; line-height: 1.5;
}
.toc a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.toc a.on { color: var(--brand-ink); border-left-color: var(--brand); background: var(--brand-soft); font-weight: 650; }

.article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 32px 36px; box-shadow: var(--shadow-xs); }
.article h2 { font-size: 25px; margin-bottom: 10px; letter-spacing: -.02em; }
.article h3 { font-size: 18px; margin: 30px 0 12px; padding-left: 12px; border-left: 3px solid var(--accent, var(--brand)); }
.article h4 { font-size: 15.5px; margin: 20px 0 8px; color: var(--text); }
.article ul, .article ol { margin: 0 0 1em; padding-left: 22px; }
.article li { margin-bottom: .35em; }
.article li::marker { color: var(--accent, var(--brand)); font-weight: 700; }
.article b, .article strong { font-weight: 700; color: var(--text); }
.article code {
  font-family: var(--font-mono); font-size: .88em; background: var(--surface-3);
  padding: 2px 6px; border-radius: 5px; color: var(--rose);
}
.k-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }

/* content blocks */
.blk-table { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--r-sm); }
.blk-table table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.blk-table th {
  background: var(--surface-3); text-align: left; padding: 10px 14px;
  font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.blk-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.blk-table tr:last-child td { border-bottom: 0; }
.blk-table tbody tr:hover { background: var(--surface-2); }

.note { border-radius: var(--r-sm); padding: 13px 16px; margin: 0 0 18px; font-size: 14px; border: 1px solid; border-left-width: 4px; }
.note-t { font-weight: 750; font-size: 13px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.note-info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); border-left-color: var(--brand); }
.note-info .note-t { color: var(--brand-ink); }
.note-tip { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); border-left-color: var(--ok); }
.note-tip .note-t { color: var(--ok); }
.note-warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 32%, transparent); border-left-color: var(--amber); }
.note-warn .note-t { color: var(--amber); }
.note-key { background: var(--violet-soft); border-color: color-mix(in srgb, var(--violet) 30%, transparent); border-left-color: var(--violet); }
.note-key .note-t { color: var(--violet); }

.term-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 0 0 18px; }
.term {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 11px 14px; transition: .16s var(--ease);
}
.term:hover { border-color: var(--accent, var(--brand)); background: var(--surface); }
.term-en { font-weight: 700; font-size: 14px; color: var(--accent, var(--brand)); font-family: var(--font-mono); }
.term-cn { font-size: 13.5px; font-weight: 650; }
.term-no { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

.kv { display: flex; flex-direction: column; gap: 0; margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.kv-row { display: grid; grid-template-columns: 150px 1fr; gap: 14px; padding: 10px 14px; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.kv-row:last-child { border-bottom: 0; }
.kv-row:nth-child(odd) { background: var(--surface-2); }
.kv-k { font-weight: 700; color: var(--text-2); }

.fig { margin: 0 0 20px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); }
.fig svg { display: block; width: 100%; height: auto; }
.fig figcaption { padding: 9px 14px; font-size: 12.5px; color: var(--text-3); border-top: 1px solid var(--border); text-align: center; }

.pager { display: flex; gap: 12px; margin-top: 28px; }
.pager a {
  flex: 1; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); transition: .16s var(--ease); min-width: 0;
}
.pager a:hover { border-color: var(--accent, var(--brand)); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.pager .dir { font-size: 11.5px; color: var(--text-3); font-weight: 700; letter-spacing: .04em; }
.pager .t { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager .next { text-align: right; }

/* ---------- Quiz ---------- */
.quiz-top { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.qbar { flex: 1; min-width: 200px; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.qbar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--teal)); transition: width .35s var(--ease); }

.q { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 26px 28px; box-shadow: var(--shadow-xs); }
.q-no { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.q-num {
  width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-ink); font-weight: 800; font-size: 13px;
}
.q-stem { font-size: 16.5px; font-weight: 650; line-height: 1.7; margin-bottom: 18px; }

.opts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2);
  cursor: pointer; transition: .15s var(--ease); font-size: 14.5px; line-height: 1.6;
}
.opt:hover { border-color: var(--brand); background: var(--surface); }
.opt input { display: none; }
.opt-key {
  width: 25px; height: 25px; flex: 0 0 25px; border-radius: 7px; display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--border-2); color: var(--text-2);
  font-weight: 800; font-size: 12.5px; transition: .15s var(--ease);
}
.opt.sel { border-color: var(--brand); background: var(--brand-soft); }
.opt.sel .opt-key { background: var(--brand); border-color: var(--brand); color: #fff; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .opt-key { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .opt-key { background: var(--bad); border-color: var(--bad); color: #fff; }
.opt.locked { cursor: default; }
.opt.locked:hover { border-color: inherit; }

.q-fill {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text); font-size: 15px; font-family: inherit; margin-bottom: 18px;
}
.q-fill:focus { outline: none; border-color: var(--brand); background: var(--surface); }

.q-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.fb { border-radius: var(--r-sm); padding: 14px 16px; margin-bottom: 18px; font-size: 14px; border: 1px solid; }
.fb-t { font-weight: 800; font-size: 13.5px; margin-bottom: 5px; display: flex; align-items: center; gap: 7px; }
.fb-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 34%, transparent); }
.fb-ok .fb-t { color: var(--ok); }
.fb-bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 34%, transparent); }
.fb-bad .fb-t { color: var(--bad); }

/* result */
.result { text-align: center; padding: 44px 28px; }
.result .score { font-size: 62px; font-weight: 850; letter-spacing: -.04em; line-height: 1; }
.result .score span { font-size: 22px; color: var(--text-3); font-weight: 700; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 8px; margin: 24px 0; }
.qdot {
  aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 13.5px;
  border: 1.5px solid var(--border); background: var(--surface-2); color: var(--text-2); cursor: pointer; transition: .15s var(--ease);
}
.qdot:hover { transform: scale(1.08); }
.qdot.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.qdot.bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.qdot.skip { opacity: .55; }

/* ---------- Wrong book ---------- */
.wrow { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); padding: 16px 18px; margin-bottom: 12px; }
.wrow-hd { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.wrow-q { font-weight: 650; font-size: 14.5px; line-height: 1.65; margin-bottom: 8px; }
.wrow-line { font-size: 13.5px; margin-bottom: 3px; }
.wrow-line b { font-weight: 700; }

/* ---------- Toolbar / filters ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); margin-bottom: 18px; box-shadow: var(--shadow-xs);
}
.search {
  flex: 1; min-width: 190px; position: relative;
}
.search input {
  width: 100%; padding: 9px 14px 9px 36px; border: 1px solid var(--border-2); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text); font-size: 14px; font-family: inherit;
}
.search input:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-soft); }
.search::before {
  content: "⌕"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); font-size: 16px; pointer-events: none;
}
.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--text-2); padding: 6px 13px;
  border-radius: 7px; font-size: 13px; font-weight: 650; transition: .15s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow-xs); }

/* ---------- Breadcrumb ---------- */
.crumb { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-3); margin-bottom: 14px; flex-wrap: wrap; }
.crumb a { color: var(--text-2); }
.crumb span.sep { opacity: .5; }

/* ---------- Empty / toast ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--text-3); }
.empty .ico { font-size: 44px; margin-bottom: 10px; opacity: .8; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 22px);
  background: var(--text); color: var(--bg); padding: 11px 20px; border-radius: var(--r-full);
  font-size: 13.5px; font-weight: 650; box-shadow: var(--shadow-lg); opacity: 0;
  pointer-events: none; transition: .28s var(--ease); z-index: 999; max-width: 90vw; text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Footer ---------- */
.ftr { border-top: 1px solid var(--border); padding: 46px 0 26px; margin-top: 64px; color: var(--text-3); font-size: 13px; }
.ftr-in { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.ftr-author { display: inline-flex; align-items: center; gap: 6px; }
.ftr-author b { color: var(--text-2); font-weight: 700; letter-spacing: .02em; }
.ftr-author a { color: var(--text-3); text-decoration: none; border-bottom: 1px dashed transparent; transition: color .25s, border-color .25s; }
.ftr-author a:hover { color: var(--brand); border-bottom-color: var(--brand); }

/* 多栏页脚 */
.ftr-grid {
  display: grid; gap: 28px 24px;
  grid-template-columns: 1.6fr 1fr 1fr 1.2fr;
  padding-bottom: 26px; border-bottom: 1px solid var(--border);
}
.ftr-brand .logo { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 12px; }
.ftr-brand p { margin: 0 0 12px; line-height: 1.85; max-width: 34ch; }
.ftr-stat { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ftr-col { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.ftr-col h4 {
  margin: 0 0 4px; font-size: 12.5px; font-weight: 700;
  color: var(--text-2); letter-spacing: .06em;
}
.ftr-col a { color: var(--text-3); text-decoration: none; transition: color .2s, transform .2s; width: fit-content; }
.ftr-col a:hover { color: var(--brand); transform: translateX(2px); }
.ftr-note { font-size: 12px; opacity: .8; }
.ftr-bottom {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-top: 18px; font-size: 12.5px;
}
@media (max-width: 860px) {
  .ftr-grid { grid-template-columns: 1fr 1fr; }
  .ftr-brand { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .ftr { padding: 34px 0 22px; }
  .ftr-grid { grid-template-columns: 1fr; gap: 22px; }
  .ftr-bottom { flex-direction: column; gap: 6px; }
}

/* ---------- 相关知识点 ---------- */
.related { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }
.related-h {
  font-size: 13px; font-weight: 700; color: var(--text-3);
  letter-spacing: .04em; margin-bottom: 14px;
}
.related-grid { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.related-card {
  display: block; padding: 14px 16px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent, var(--brand));
  text-decoration: none; transition: .2s var(--ease);
  min-width: 0;
}
.related-card:hover {
  background: var(--surface); border-color: var(--border-2);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px -14px rgba(15, 23, 42, .3);
}
.related-ch { font-size: 11.5px; color: var(--text-3); margin-bottom: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.related-t { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.5; margin-bottom: 6px; }
.related-m { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .related-grid { grid-template-columns: 1fr; } }

/* ---------- 返回顶部 ---------- */
.to-top {
  position: fixed; right: 20px; bottom: 92px; z-index: 88;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 18px; font-weight: 700; line-height: 1;
  color: var(--text-2); cursor: pointer;
  border: 1px solid var(--border-2);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 10px 26px -12px rgba(15, 23, 42, .34);
  opacity: 0; transform: translateY(10px) scale(.94);
  pointer-events: none;
  transition: opacity .26s var(--ease), transform .26s var(--ease), color .2s, border-color .2s;
}
.to-top.on { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.to-top:hover { color: var(--brand); border-color: var(--brand); }
.to-top:active { transform: scale(.94); }
@media (max-width: 760px) {
  .to-top { right: 12px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); width: 40px; height: 40px; }
}
@media print { .to-top { display: none !important; } }

/* ---------- 作者卡片 ---------- */
.author-card {
  display: flex; gap: 20px; align-items: flex-start;
  padding: 26px 28px; border-radius: var(--r-lg);
  background: var(--glass); border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
  box-shadow: var(--shadow-2); position: relative; overflow: hidden;
}
.author-card::after {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 320px; height: 320px;
  background: radial-gradient(circle, var(--brand-soft), transparent 68%);
  pointer-events: none;
}
.author-av {
  position: relative; flex: 0 0 62px; width: 62px; height: 62px; border-radius: 20px;
  display: grid; place-items: center; font-size: 26px; font-weight: 800; color: #fff;
  background: linear-gradient(140deg, var(--brand), var(--violet));
  box-shadow: 0 10px 26px -8px rgba(37, 99, 235, .6);
}
.author-main { position: relative; min-width: 0; }
.author-name { font-size: 19px; font-weight: 800; letter-spacing: .02em; }
.author-role { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.author-desc { font-size: 14px; line-height: 1.85; color: var(--text-2); margin: 10px 0 14px; }
.author-links { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .author-card { flex-direction: column; gap: 14px; padding: 22px 20px; }
}

/* ---------- 键盘可见焦点 ---------- */
:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 10px;
}
:where(a, button):focus:not(:focus-visible) { outline: none; }

/* ---------- Modal ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(8, 14, 26, .55); backdrop-filter: blur(4px);
  z-index: 200; display: grid; place-items: center; padding: 22px; opacity: 0; pointer-events: none; transition: .2s var(--ease);
}
.mask.on { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  max-width: 520px; width: 100%; padding: 26px; box-shadow: var(--shadow-lg);
  transform: translateY(14px); transition: .24s var(--ease); max-height: 86vh; overflow: auto;
}
.mask.on .modal { transform: translateY(0); }
.modal h3 { font-size: 18px; margin-bottom: 6px; }
.dl-opt {
  display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--border);
  border-radius: var(--r-sm); margin-top: 10px; cursor: pointer; transition: .16s var(--ease); background: var(--surface-2);
}
.dl-opt:hover { border-color: var(--brand); background: var(--surface); transform: translateX(3px); }
.modal-wide { max-width: 1000px; }

/* ---------- 资料汇总行 ---------- */
.mrow {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; margin-bottom: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent, var(--brand));
  border-radius: var(--r-sm); transition: .16s var(--ease);
}
.mrow:hover { background: var(--surface); border-color: var(--border-2); transform: translateX(2px); }
.mrow-ico { font-size: 20px; line-height: 1; flex: none; }
.mrow-main { min-width: 0; flex: 1; }
.mrow-n {
  font-size: 14px; font-weight: 600; line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mrow-m { display: flex; align-items: center; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.mrow-act { display: flex; gap: 8px; flex: none; }
.mrow-act .gbtn { white-space: nowrap; }
@media (max-width: 760px) {
  .mrow { flex-wrap: wrap; align-items: flex-start; padding: 12px; }
  .mrow-n { white-space: normal; word-break: break-all; }
  .mrow-act { width: 100%; justify-content: flex-end; }
}
.dl-ico { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px; display: grid; place-items: center; font-size: 19px; background: var(--brand-soft); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .klayout { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; display: none; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .wrap { padding: 0 16px; }
  .hero { padding: 30px 22px; border-radius: var(--r-lg); }
  .article { padding: 22px 18px; }
  .nav { display: none; }
  .menu-btn { display: grid; }
  .nav.open {
    display: flex; flex-direction: column; position: absolute; top: var(--hdr); left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px 16px;
    box-shadow: var(--shadow-md); gap: 4px;
  }
  .subj-grid { grid-template-columns: 1fr; }
  .krow { flex-wrap: wrap; }
  .krow-acts { width: 100%; }
  .krow-acts .btn { flex: 1; }
  .kv-row { grid-template-columns: 1fr; gap: 3px; }
  .pager { flex-direction: column; }
  .pager .next { text-align: left; }
  .q { padding: 20px 18px; }
  .result .score { font-size: 48px; }
}

/* ==========================================================================
   ██  高级视觉层 · Premium FX Layer
   极光背景 / 玻璃拟态悬浮按钮 / 滚动揭示 / 光斑跟随 / 涟漪 / 视差
   ========================================================================== */

/* ---------- 0. 动效开关 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- 1. 极光背景 ---------- */
.fx-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.fx-bg i {
  position: absolute; display: block; border-radius: 50%;
  filter: blur(72px); opacity: .5;
  will-change: transform;
}
.fx-bg i:nth-child(1) { width: 46vw; height: 46vw; left: -12vw; top: -14vw; background: color-mix(in srgb, var(--brand) 42%, transparent); animation: fxDrift1 26s ease-in-out infinite; }
.fx-bg i:nth-child(2) { width: 40vw; height: 40vw; right: -10vw; top: 4vw; background: color-mix(in srgb, var(--teal) 36%, transparent); animation: fxDrift2 32s ease-in-out infinite; }
.fx-bg i:nth-child(3) { width: 36vw; height: 36vw; left: 22vw; bottom: -16vw; background: color-mix(in srgb, var(--violet) 30%, transparent); animation: fxDrift3 38s ease-in-out infinite; }
html[data-theme="dark"] .fx-bg i { opacity: .34; filter: blur(90px); }
.fx-bg .fx-grid {
  position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(color-mix(in srgb, var(--border) 60%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--border) 60%, transparent) 1px, transparent 1px);
  background-size: 62px 62px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 10%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 10%, transparent 72%);
}
@keyframes fxDrift1 { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(7vw,5vw,0) scale(1.14); } }
@keyframes fxDrift2 { 0%,100% { transform: translate3d(0,0,0) scale(1.06); } 50% { transform: translate3d(-8vw,7vw,0) scale(.9); } }
@keyframes fxDrift3 { 0%,100% { transform: translate3d(0,0,0) scale(.94); } 50% { transform: translate3d(6vw,-6vw,0) scale(1.16); } }

/* 页面内容浮在背景之上 */
/* 注意：.hdr 必须保持 sticky + z-index 60，不能并入这条规则 */
.page, .ftr { position: relative; z-index: 1; }

/* ---------- 2. 玻璃拟态悬浮按钮 ---------- */
.gbtn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--r-full);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--surface) 80%, transparent),
      color-mix(in srgb, var(--surface-2) 58%, transparent));
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  color: var(--text); font-size: 14px; font-weight: 650; white-space: nowrap;
  text-decoration: none; cursor: pointer; overflow: hidden; isolation: isolate;
  box-shadow: 0 10px 26px -8px rgba(15, 23, 42, .22),
              inset 0 1px 0 rgba(255, 255, 255, .78),
              inset 0 -1px 0 rgba(255, 255, 255, .16);
  transition: transform .34s var(--ease), box-shadow .34s var(--ease), border-color .34s var(--ease), color .2s var(--ease);
}
html[data-theme="dark"] .gbtn {
  border-color: rgba(255, 255, 255, .14);
  background: linear-gradient(135deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .035));
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .7),
              inset 0 1px 0 rgba(255, 255, 255, .2),
              inset 0 -1px 0 rgba(255, 255, 255, .04);
}
.gbtn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, .55) 48%, transparent 74%);
  transform: translateX(-130%); transition: transform .78s var(--ease);
}
.gbtn:hover::before { transform: translateX(130%); }
.gbtn:hover {
  transform: translateY(-3px) scale(1.022);
  border-color: color-mix(in srgb, var(--brand) 55%, transparent);
  box-shadow: 0 20px 40px -12px color-mix(in srgb, var(--brand) 42%, transparent),
              0 6px 14px -6px rgba(15, 23, 42, .2),
              inset 0 1px 0 rgba(255, 255, 255, .85);
  text-decoration: none; color: var(--text);
}
.gbtn:active { transform: translateY(-1px) scale(.995); }
.gbtn-sm { padding: 7px 14px; font-size: 13px; gap: 6px; }
.gbtn-lg { padding: 14px 26px; font-size: 15.5px; }
.gbtn-block { width: 100%; }
.gbtn-primary {
  border-color: color-mix(in srgb, var(--brand) 62%, transparent);
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--brand) 88%, transparent),
      color-mix(in srgb, var(--brand-ink) 78%, transparent));
  color: #fff;
  box-shadow: 0 14px 30px -10px color-mix(in srgb, var(--brand) 62%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, .42);
}
.gbtn-primary:hover { color: #fff; border-color: var(--brand-ink); }
/* 深色模式必须显式覆盖：上面 html[data-theme="dark"] .gbtn（0,2,1）
   的特异性高于 .gbtn-primary（0,1,0），若不覆盖，主按钮会退化成普通玻璃按钮，
   全站的主按钮都会失去品牌色。深色下 --brand 为浅蓝，故用深色文字保证对比度。 */
html[data-theme="dark"] .gbtn-primary {
  border-color: color-mix(in srgb, var(--brand) 58%, transparent);
  background: linear-gradient(135deg, var(--brand), var(--brand-ink));
  color: #0b1220;
  box-shadow: 0 14px 34px -10px color-mix(in srgb, var(--brand) 58%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, .5);
}
html[data-theme="dark"] .gbtn-primary:hover {
  border-color: var(--brand-ink);
  background: linear-gradient(135deg, var(--brand-ink), var(--brand));
  color: #0b1220;
}
html[data-theme="dark"] .gbtn-accent {
  border-color: color-mix(in srgb, var(--accent, var(--brand)) 46%, transparent);
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--accent, var(--brand)) 26%, transparent),
      color-mix(in srgb, var(--accent, var(--brand)) 12%, transparent));
  color: var(--accent, var(--brand));
}
.gbtn-accent {
  border-color: color-mix(in srgb, var(--accent, var(--brand)) 58%, transparent);
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--accent, var(--brand)) 20%, transparent),
      color-mix(in srgb, var(--accent-soft, var(--brand-soft)) 62%, transparent));
  color: var(--accent, var(--brand));
}
.gbtn-ico { font-size: 1.05em; line-height: 1; }
.gbtn[disabled] { opacity: .45; pointer-events: none; }

/* 悬浮操作坞（底部胶囊工具条） */
.dock {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 90; display: flex; align-items: center; gap: 8px; padding: 8px;
  border-radius: var(--r-full);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 22px 48px -16px rgba(15, 23, 42, .38), inset 0 1px 0 rgba(255, 255, 255, .6);
  max-width: calc(100vw - 24px); overflow-x: auto; scrollbar-width: none;
  opacity: 0; transform: translateX(-50%) translateY(20px); pointer-events: none;
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
html[data-theme="dark"] .dock { background: rgba(20, 28, 45, .72); box-shadow: 0 22px 52px -16px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .16); }
.dock::-webkit-scrollbar { display: none; }
.dock.on { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
/* 向下阅读时收进屏幕下方，不遮挡正文 */
.dock.on.hide { opacity: 0; transform: translateX(-50%) translateY(calc(100% + 26px)); pointer-events: none; }
.dock .gbtn { box-shadow: none; background: transparent; border-color: transparent; backdrop-filter: none; }
.dock .gbtn:hover { background: var(--surface-3); transform: translateY(-2px); box-shadow: 0 8px 18px -8px rgba(15, 23, 42, .3); }
html[data-theme="dark"] .dock .gbtn:hover { background: rgba(255, 255, 255, .1); }

/* ---------- 3. 光斑跟随卡片 ---------- */
.spot { position: relative; overflow: hidden; }
.spot::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--accent, var(--brand)) 20%, transparent), transparent 62%);
  transition: opacity .32s var(--ease);
}
.spot:hover::before { opacity: 1; }
.spot > * { position: relative; z-index: 1; }

/* ---------- 4. 滚动揭示 ---------- */
.rv { opacity: 0; transform: translateY(22px); transition: opacity .68s var(--ease), transform .68s var(--ease); }
.rv.rv-in { opacity: 1; transform: none; }
.rv-l { transform: translateX(-26px); }
.rv-r { transform: translateX(26px); }
.rv-s { transform: scale(.94); }
.rv-d1 { transition-delay: .06s; } .rv-d2 { transition-delay: .12s; } .rv-d3 { transition-delay: .18s; }
.rv-d4 { transition-delay: .24s; } .rv-d5 { transition-delay: .3s; } .rv-d6 { transition-delay: .36s; }

/* ---------- 5. 涟漪 ---------- */
.ripple-host { position: relative; overflow: hidden; }
.ripple {
  position: absolute; border-radius: 50%; transform: scale(0); pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, .62), rgba(255, 255, 255, 0) 68%);
  animation: fxRipple .62s var(--ease) forwards;
}
@keyframes fxRipple { to { transform: scale(2.6); opacity: 0; } }

/* ---------- 6. 标题渐变与下划线动画 ---------- */
.grad-anim {
  background: linear-gradient(100deg, var(--brand), var(--teal), var(--violet), var(--brand));
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: fxGrad 9s linear infinite;
}
@keyframes fxGrad { to { background-position: 300% 0; } }
.uline { position: relative; }
.uline::after {
  content: ""; position: absolute; left: 0; bottom: -3px; height: 2px; width: 100%;
  background: linear-gradient(90deg, var(--brand), var(--teal));
  transform: scaleX(0); transform-origin: left; transition: transform .34s var(--ease);
}
.uline:hover::after { transform: scaleX(1); }

/* ---------- 7. 数字与徽标 ---------- */
.badge-dot { position: relative; }
.badge-dot::after {
  content: ""; position: absolute; top: -2px; right: -2px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--rose); box-shadow: 0 0 0 2px var(--surface); animation: fxPulse 2.1s var(--ease) infinite;
}
@keyframes fxPulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.35); opacity: .62; } }

.stat-fx .stat-n { font-variant-numeric: tabular-nums; }
.tick { display: inline-block; animation: fxPop .5s var(--ease) both; }
@keyframes fxPop { from { opacity: 0; transform: translateY(10px) scale(.9); } to { opacity: 1; transform: none; } }

/* ---------- 8. 进度条流光 ---------- */
.bar.fx > i { position: relative; overflow: hidden; }
.bar.fx > i::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent);
  transform: translateX(-100%); animation: fxShine 2.4s var(--ease) infinite;
}
@keyframes fxShine { to { transform: translateX(100%); } }

.ring svg circle:last-of-type { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--brand) 45%, transparent)); }

/* ---------- 9. 弹窗弹簧入场 ---------- */
@keyframes fxSpringIn { 0% { transform: translateY(26px) scale(.94); opacity: 0; } 60% { transform: translateY(-4px) scale(1.012); opacity: 1; } 100% { transform: none; } }
.mask.on .modal { animation: fxSpringIn .44s var(--ease) both; }

/* ---------- 10. 页面入场 ---------- */
@keyframes fxPageIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.page { animation: fxPageIn .55s var(--ease) both; }

/* ---------- 11. 首页 / 科目页组件 ---------- */
.hero-fx { position: relative; }
.hero-fx .orb {
  position: absolute; border-radius: 50%; pointer-events: none; filter: blur(2px); opacity: .85;
  animation: fxFloat 7.5s ease-in-out infinite;
}
.hero-fx .orb.o1 { width: 130px; height: 130px; right: 6%; top: 12%; background: radial-gradient(circle at 32% 30%, color-mix(in srgb, var(--brand) 42%, transparent), transparent 68%); }
.hero-fx .orb.o2 { width: 86px; height: 86px; right: 22%; bottom: 12%; background: radial-gradient(circle at 32% 30%, color-mix(in srgb, var(--teal) 44%, transparent), transparent 68%); animation-delay: 1.4s; }
.hero-fx .orb.o3 { width: 58px; height: 58px; right: 36%; top: 22%; background: radial-gradient(circle at 32% 30%, color-mix(in srgb, var(--violet) 42%, transparent), transparent 68%); animation-delay: 2.6s; }
@keyframes fxFloat { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-18px) } }

.hero-tag {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: var(--r-full);
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-bottom: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6);
}

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.tile {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface); color: inherit;
  box-shadow: var(--shadow-xs); transition: .26s var(--ease); text-decoration: none;
}
.tile:hover { text-decoration: none; transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--accent, var(--brand)); }
.tile-ico { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--accent-soft, var(--brand-soft)); }
.tile-t { font-weight: 700; font-size: 14.5px; }
.tile-d { font-size: 12.5px; color: var(--text-3); }

.subj-hero {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 30px 32px;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent, var(--brand)) 12%, var(--surface)),
    var(--surface) 62%);
}
.subj-hero::after {
  content: ""; position: absolute; inset: auto -8% -60% auto; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent, var(--brand)) 26%, transparent), transparent 66%);
  pointer-events: none;
}
.subj-hero > * { position: relative; z-index: 1; }
.subj-hero .sh-ico {
  width: 62px; height: 62px; border-radius: 18px; display: grid; place-items: center; font-size: 31px;
  background: var(--accent-soft, var(--brand-soft)); box-shadow: var(--shadow-sm); flex: 0 0 62px;
}

.metric-strip { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 18px; }
.metric { min-width: 92px; }
.metric b { display: block; font-size: 22px; font-weight: 820; letter-spacing: -.02em; }
.metric span { font-size: 12px; color: var(--text-3); font-weight: 650; }

/* 章节手风琴：展开动画 */
.chapter-bd { display: block; max-height: 0; overflow: hidden; opacity: 0; transition: max-height .42s var(--ease), opacity .32s var(--ease); border-top: 1px solid transparent; }
.chapter.open .chapter-bd { max-height: 4000px; opacity: 1; border-top-color: var(--border); }

/* 知识点行悬停指示 */
.krow { position: relative; }
.krow::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent, var(--brand)); transform: scaleY(0); transform-origin: center;
  transition: transform .26s var(--ease);
}
.krow:hover::before { transform: scaleY(1); }

/* ---------- 12. 标签页 ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
  padding: 8px 16px; border-radius: var(--r-full); font-size: 13.5px; font-weight: 650;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  transition: .2s var(--ease);
}
.tab:hover { color: var(--text); border-color: var(--border-2); transform: translateY(-2px); }
.tab.on { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--brand) 70%, transparent); }

/* ---------- 13. 搜索建议浮层 ---------- */
.sug {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 80;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px) saturate(180%); -webkit-backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  max-height: 380px; overflow: auto; padding: 6px;
}
.sug-item { display: block; padding: 10px 12px; border-radius: var(--r-xs); color: inherit; text-decoration: none; transition: background .15s var(--ease); }
.sug-item:hover { background: var(--surface-3); text-decoration: none; }
.sug-t { font-weight: 650; font-size: 14px; }
.sug-d { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sug mark { background: color-mix(in srgb, var(--amber) 42%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }

/* ---------- 14. 做题页 ---------- */
.q-enter { animation: fxSlideIn .42s var(--ease) both; }
@keyframes fxSlideIn { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
.opt { position: relative; overflow: hidden; }
.opt::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: currentColor; opacity: 0; transition: opacity .2s var(--ease);
}
.opt.sel::after, .opt.right::after, .opt.wrong::after { opacity: .9; }
.qdot { transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.qdot:hover { box-shadow: 0 8px 18px -8px rgba(15, 23, 42, .4); }

/* ---------- 15. 计时 / 彩带 ---------- */
.confetti {
  position: fixed; top: -12px; width: 9px; height: 14px; border-radius: 2px; z-index: 999;
  pointer-events: none; animation: fxFall linear forwards;
}
@keyframes fxFall { to { transform: translateY(104vh) rotate(760deg); opacity: 0; } }

/* ---------- 16. 骨架屏 ---------- */
.skel {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%; animation: fxSkel 1.4s ease infinite; border-radius: var(--r-xs);
}
@keyframes fxSkel { to { background-position: -135% 0; } }

/* ==========================================================================
   17.5 交互可视化 · Interactive Viz（医学统计学）
   ========================================================================== */
.viz-slot { margin: 0 0 22px; }
.viz {
  position: relative; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-sm);
  padding: 15px 16px 13px;
  transition: box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.viz:hover { box-shadow: var(--shadow-md); border-color: var(--border-2); }
.viz::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--brand), var(--violet)); opacity: .85;
}
.viz-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.viz-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px;
  background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft);
  animation: vzPulse 2.4s ease-in-out infinite;
}
@keyframes vzPulse { 0%, 100% { box-shadow: 0 0 0 4px var(--brand-soft); } 50% { box-shadow: 0 0 0 7px transparent; } }
.viz-title { font-size: 14.5px; font-weight: 750; letter-spacing: .01em; }
.viz-tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 7px; border-radius: var(--r-full);
  color: var(--brand-ink); background: var(--brand-soft);
}
.viz-desc { font-size: 12.5px; color: var(--text-3); line-height: 1.7; margin: 2px 0 6px; }

.viz-stage { margin: 2px -4px 4px; }
.vz-svg { width: 100%; height: auto; display: block; overflow: visible; }
@keyframes vzIn { from { opacity: 0; transform: translateY(5px) scale(.995); } to { opacity: 1; transform: none; } }

/* SVG 元素配色 */
.vz-axis { stroke: var(--border-2); stroke-width: 1.2; }
.vz-tick { stroke: var(--border-2); stroke-width: 1; }
.vz-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; opacity: .8; }
.vz-txt { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.vz-txt-b { fill: var(--text-2); font-weight: 700; }
.vz-curve { fill: none; stroke: var(--brand); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.vz-curve-2 { stroke: var(--text-3); stroke-width: 1.6; opacity: .75; }
.vz-curve-v { stroke: var(--violet); stroke-width: 2.2; }
.vz-dashline { stroke-dasharray: 5 4; }
.vz-area { fill: var(--brand); opacity: .2; }
.vz-area-2 { fill: var(--violet); opacity: .18; }
.vz-area-bad { fill: var(--bad); opacity: .2; }
.vz-bar { fill: var(--brand); opacity: .72; }
.vz-ref { stroke: var(--text-3); stroke-width: 1.2; stroke-dasharray: 4 4; }
.vz-ref-bad { stroke: var(--bad); }
.vz-dash { stroke: var(--border-2); stroke-width: 1.2; stroke-dasharray: 4 4; }
.vz-dot { fill: var(--bad); stroke: var(--surface); stroke-width: 2; }

/* 控件 */
.viz-ctl { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 10px; }
.vz-row { display: grid; grid-template-columns: 96px 1fr 58px; align-items: center; gap: 10px; }
.vz-lab { font-size: 12px; color: var(--text-2); font-weight: 650; white-space: nowrap; }
.vz-val { font-size: 12px; font-weight: 750; color: var(--brand-ink); text-align: right; font-variant-numeric: tabular-nums; }
.vz-row input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer;
}
.vz-row input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 99px;
  background: linear-gradient(90deg, var(--brand-soft), var(--surface-3));
  border: 1px solid var(--border);
}
.vz-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%;
  background: var(--brand); border: 2px solid var(--surface);
  box-shadow: 0 2px 8px -2px rgba(37, 99, 235, .7); transition: transform .14s var(--ease);
}
.vz-row input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.18); }
.vz-row input[type="range"]::-moz-range-track { height: 6px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border); }
.vz-row input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--brand); border: 2px solid var(--surface); }
.vz-row input[type="range"]:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 99px; }

.vz-seg { display: flex; gap: 4px; flex-wrap: wrap; padding: 3px; background: var(--surface-3); border-radius: var(--r-full); width: fit-content; max-width: 100%; }
.vz-segbtn {
  border: 0; background: transparent; color: var(--text-2); cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 650; padding: 6px 12px; border-radius: var(--r-full);
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.vz-segbtn:hover { color: var(--text); }
.vz-segbtn.on { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow-xs); transform: translateY(-1px); }

/* 读数 */
.viz-out { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.vz-kv {
  flex: 1 1 140px; min-width: 0;
  padding: 8px 11px; border-radius: var(--r-sm);
  background: var(--surface-3); border: 1px solid var(--border);
}
.vz-kv span { display: block; font-size: 10.5px; color: var(--text-3); letter-spacing: .02em; margin-bottom: 2px; }
.vz-kv b { font-size: 13px; font-weight: 750; font-variant-numeric: tabular-nums; word-break: break-word; }
.vz-kv.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 26%, transparent); }
.vz-kv.ok b { color: var(--ok); }
.vz-kv.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 26%, transparent); }
.vz-kv.bad b { color: var(--bad); }
.vz-note {
  flex: 1 1 100%; font-size: 12.5px; line-height: 1.8; color: var(--text-2);
  padding: 9px 12px; border-radius: var(--r-sm);
  background: var(--brand-soft); border: 1px dashed color-mix(in srgb, var(--brand) 34%, transparent);
}
.vz-note b { color: var(--brand-ink); }
.viz-err { font-size: 13px; color: var(--bad); padding: 10px; }

html[data-theme="dark"] .viz { background: linear-gradient(180deg, var(--surface), var(--bg-soft)); }
html[data-theme="dark"] .vz-area { opacity: .3; }
html[data-theme="dark"] .vz-area-2 { opacity: .26; }
html[data-theme="dark"] .vz-area-bad { opacity: .3; }
html[data-theme="dark"] .vz-bar { opacity: .8; }
html[data-theme="dark"] .vz-kv { background: var(--surface-2); }

@media (max-width: 760px) {
  .viz { padding: 13px 12px 12px; border-radius: var(--r-md); }
  .viz-title { font-size: 13.5px; }
  .vz-row { grid-template-columns: 78px 1fr 52px; gap: 8px; }
  .vz-lab { font-size: 11.5px; }
  .vz-kv { flex: 1 1 44%; }
  .viz-ctl { gap: 6px; }
  .vz-row { min-height: 40px; }
  .vz-row input[type="range"] { height: 30px; }
  .vz-row input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -9px; }
  .vz-segbtn { padding: 8px 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .viz-dot { animation: none; }
  .vz-svg { animation: none !important; }
}

/* ==========================================================================
   18. 移动端适配层 · Mobile Layer
   安全区 / 触摸目标 / 抽屉导航 / 横向滚动 / 性能降级
   ========================================================================== */

/* ---------- 18.1 基础：安全区与横溢 ---------- */
@media (max-width: 900px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { overflow-x: hidden; }
  .wrap {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  /* iOS 聚焦表单时若字号 <16px 会自动放大页面 */
  input, textarea, select { font-size: 16px; }
  /* 图片/图表不撑破容器 */
  img, svg, canvas { max-width: 100%; }
}

/* ---------- 18.2 触摸设备：放大点击热区 ---------- */
@media (hover: none) and (pointer: coarse) {
  .gbtn { min-height: 44px; }
  .gbtn-sm { min-height: 40px; }
  .icon-btn { width: 40px; height: 40px; }
  .nav a { min-height: 44px; display: flex; align-items: center; }
  .opt { padding: 14px 15px; }
  .opt-key { width: 27px; height: 27px; flex: 0 0 27px; }
  .qdot { min-width: 40px; min-height: 40px; }
  /* 触摸屏没有 hover，光斑跟随无意义且耗电 */
  .spot::before { display: none !important; }
  .qdot:hover, .dl-opt:hover, .pager a:hover { transform: none; }
}

/* ---------- 18.3 头部与抽屉导航 ---------- */
@media (max-width: 760px) {
  :root { --hdr: 58px; }
  .hdr-in { gap: 10px; }
  .logo { font-size: 15.5px; gap: 8px; }
  .logo-mark { width: 30px; height: 30px; flex: 0 0 30px; font-size: 16px; }
  .hdr-tools { gap: 6px; }

  .nav.open {
    position: fixed; top: var(--hdr); left: 0; right: 0; bottom: auto;
    display: flex; flex-direction: column; gap: 3px;
    max-height: calc(100dvh - var(--hdr) - 8px); overflow-y: auto; overscroll-behavior: contain;
    padding: 10px max(14px, env(safe-area-inset-left)) calc(16px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-right));
    background: var(--surface);
    -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border); border-radius: 0 0 20px 20px;
    box-shadow: 0 26px 50px -18px rgba(15, 23, 42, .34);
    animation: navDrop .26s var(--ease) both;
    z-index: 70;
  }
  body.nav-lock .hdr { z-index: 66; }
  .nav.open a { padding: 13px 14px; border-radius: 12px; font-size: 15.5px; }
  .nav.open a.on { background: var(--brand-soft); }
  @keyframes navDrop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

  .nav-scrim {
    position: fixed; inset: 0; z-index: 55; background: rgba(8, 14, 26, .38);
    opacity: 0; pointer-events: none; transition: opacity .24s var(--ease);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  }
  .nav-scrim.on { opacity: 1; pointer-events: auto; }
  body.nav-lock { overflow: hidden; }
}

/* ---------- 18.4 首页 / 通用区块 ---------- */
@media (max-width: 760px) {
  .page { padding-top: 22px; }
  .hero { padding: 26px 18px 28px; border-radius: var(--r-lg); }
  .hero h1 { font-size: clamp(25px, 7.6vw, 32px); line-height: 1.24; }
  .hero .lead { font-size: 15px; line-height: 1.78; margin-bottom: 18px; }
  .hero-tag { font-size: 11.5px; }
  .hero-actions { flex-direction: column; align-items: stretch; gap: 9px; }
  .hero-actions > .gbtn, .hero-actions > a { width: 100%; justify-content: center; }
  .hero-fx .orb.o1 { width: 92px; height: 92px; right: -8%; top: 4%; }
  .hero-fx .orb.o2 { width: 62px; height: 62px; right: 4%; bottom: 6%; }
  .hero-fx .orb.o3 { display: none; }

  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 15px 14px; }
  .stat-n { font-size: 24px; }
  .stat-l { font-size: 11.5px; }

  .metric-strip { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .metric { min-width: 0; }

  .sec-head { flex-wrap: wrap; gap: 10px; }
  .sec-head h2 { font-size: 19px; }
  .subj-grid { grid-template-columns: 1fr; }
  .card-pad { padding: 18px 16px; }
  .row-between { flex-wrap: wrap; gap: 10px; }
}

@media (max-width: 420px) {
  .hero h1 { font-size: 24px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-n { font-size: 22px; }
}

/* ---------- 18.5 正文与表格 ---------- */
@media (max-width: 760px) {
  /* 工具栏：移动端不吸顶，标签整行、按钮均分 */
  .toolbar { position: static !important; gap: 8px; padding: 10px 12px; margin-bottom: 14px; }
  .toolbar > div { flex: 1 1 100% !important; }
  .toolbar .row { gap: 6px !important; }
  .toolbar .chip { font-size: 11.5px; padding: 3px 9px; }
  .toolbar .gbtn { flex: 1 1 auto; justify-content: center; }
  .toolbar .gbtn-sm { padding: 9px 10px; font-size: 12.5px; }

  .article { padding: 20px 16px; border-radius: var(--r-md); }
  .article h3 { font-size: 17px; }
  .article p, .article li { font-size: 14.8px; line-height: 1.82; }
  .blk-table { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; position: relative; }
  .blk-table table { font-size: 13px; min-width: 460px; }
  .blk-table th, .blk-table td { padding: 9px 11px; }
  .term-grid { grid-template-columns: 1fr; }
  .kv-row { grid-template-columns: 1fr; gap: 2px; }
  .note { padding: 12px 13px; font-size: 14px; }
  .krow { padding: 13px 14px; }
  .chapter-hd { padding: 14px; }
  .crumb { flex-wrap: wrap; row-gap: 3px; }
}

/* ---------- 18.6 练习页 ---------- */
@media (max-width: 760px) {
  .q { padding: 18px 15px; }
  .q-stem { font-size: 15.5px; line-height: 1.75; }
  .opt { font-size: 14.5px; }
  .q-foot { gap: 8px; }
  .q-foot .spacer { display: none; }
  .q-foot .gbtn { flex: 1 1 46%; justify-content: center; }
  .q-foot .gbtn-sm { flex: 0 0 auto; }
  .qgrid { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 7px; }
  .qdot { width: 100%; height: 38px; font-size: 12.5px; }
  .quiz-top { gap: 10px; }
  .result { padding: 32px 18px; }
  .result .score { font-size: 46px; }
}

/* ---------- 18.7 悬浮坞 ---------- */
@media (max-width: 760px) {
  .dock {
    bottom: calc(10px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 16px);
    padding: 5px; gap: 1px;
    border-radius: var(--r-full);
  }
  .dock .gbtn { padding: 9px 11px; font-size: 12px; gap: 4px; min-height: 40px; }
  .dock .gbtn-ico { font-size: 13px; }
}
@media (max-width: 400px) {
  .dock .gbtn { padding: 8px 9px; font-size: 11.5px; }
}

/* ---------- 18.8 弹窗与提示 ---------- */
@media (max-width: 640px) {
  .mask { padding: 14px; align-items: flex-end; }
  .modal { max-height: 88dvh; padding: 20px 18px; border-radius: var(--r-lg) var(--r-lg) 14px 14px; }
  .modal h3 { font-size: 17px; }
  .toast { left: 14px; right: 14px; transform: none; bottom: calc(74px + env(safe-area-inset-bottom)); text-align: center; }
}

/* ---------- 18.9 性能降级：小屏减少模糊与视差开销 ---------- */
@media (max-width: 760px) {
  .fx-bg i { filter: blur(54px); opacity: .36; }
  .fx-bg .fx-grid { display: none; }
  .hdr { -webkit-backdrop-filter: saturate(160%) blur(10px); backdrop-filter: saturate(160%) blur(10px); }
  .gbtn { -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
}
@media (prefers-reduced-motion: reduce) {
  .nav.open { animation: none; }
}

/* ---------- 打印时隐藏特效层 ---------- */
@media print {
  .fx-bg, .dock, .hero-fx .orb, .sug, .tabs { display: none !important; }
  .rv { opacity: 1 !important; transform: none !important; }
  .page { animation: none !important; }
}

/* ---------- Print / PDF ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --text: #000; --text-2: #333; --border: #ccc; }
  .hdr, .ftr, .toc, .pager, .crumb, .no-print, .toast, .mask, .hero-actions { display: none !important; }
  .klayout { grid-template-columns: 1fr; }
  .article { border: 0; box-shadow: none; padding: 0; }
  .page { padding: 0; }
  body { font-size: 11.5pt; }
  a { color: #000; text-decoration: none; }
  .article h3 { break-after: avoid; }
  .blk-table, .note, .term-grid, .kv, .fig { break-inside: avoid; }
}
