/* =========================================================
   重邮 802 · 数据结构一轮通关
   静态站点样式表（无外部依赖）
   设计关键词：护眼浅色、极简、专注、响应式
   ========================================================= */

/* ---------- 设计变量 ---------- */
:root {
  --bg: #f5f4ee;
  --bg-deep: #eeede5;
  --surface: #fffef9;
  --surface-2: #f1f0e8;
  --surface-3: #e9e8de;
  --ink: #1d2a26;
  --ink-2: #34443e;
  --muted: #68766f;
  --muted-2: #8b9791;
  --line: #deddd2;
  --line-strong: #c9c8bb;

  --brand: #0f6b5c;
  --brand-2: #14806d;
  --brand-dark: #0a4f45;
  --brand-soft: #e2f0ea;
  --brand-softer: #f0f7f4;

  --amber: #e8b93b;
  --amber-soft: #fff3c9;
  --amber-ink: #6b4a00;

  --red: #b4433a;
  --red-soft: #fbe9e6;
  --red-line: #eccbc5;

  --blue: #2d5f8b;
  --blue-soft: #e7eff7;
  --purple: #6b5b95;
  --purple-soft: #efecf7;

  --code-bg: #101a1f;
  --code-bg-2: #0b1317;
  --code-ink: #d9e6e2;
  --code-muted: #7f9a92;
  --code-key: #7fd1b9;
  --code-type: #8ec7ff;
  --code-str: #f3c969;
  --code-comment: #7d918a;
  --code-num: #f19a8b;
  --code-fn: #c8b6ff;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(29, 42, 38, .06), 0 2px 8px rgba(29, 42, 38, .04);
  --shadow: 0 1px 2px rgba(29, 42, 38, .06), 0 12px 32px rgba(29, 42, 38, .07);
  --shadow-lg: 0 2px 4px rgba(29, 42, 38, .06), 0 24px 64px rgba(29, 42, 38, .10);

  --topbar-h: 64px;
  --sidebar-w: 254px;
  --content-max: 1180px;

  --font-sans: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Source Han Sans SC", sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* ---------- 基础重置 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    linear-gradient(180deg, #f8f7f1 0, var(--bg) 280px, var(--bg) 100%);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.no-scroll { overflow: hidden; }

::selection { background: var(--amber-soft); color: var(--ink); }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }

img, svg { max-width: 100%; display: block; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

h1, h2, h3, h4, h5 { margin: 0 0 .55em; line-height: 1.3; color: var(--ink); }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.5em; }
li { margin: .28em 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

:focus-visible {
  outline: 3px solid rgba(15, 107, 92, .28);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 300;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { top: 10px; color: #fff; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 90;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px;
  background: rgba(255, 254, 249, .93);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex; align-items: center; gap: 12px;
  min-width: 0; color: var(--ink);
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  background: var(--brand); color: #fff;
  border-radius: 11px;
  font-family: var(--font-mono); font-weight: 700; font-size: 12px;
  letter-spacing: -.5px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
}
.brand-text { line-height: 1.2; min-width: 0; }
.brand-title { font-size: 15px; font-weight: 700; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--muted); white-space: nowrap; letter-spacing: .04em; }

.topbar-spacer { flex: 1; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.countdown-pill {
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 6px 12px; border: 1px solid var(--line);
  background: var(--surface); border-radius: 999px;
  font-size: 12.5px; color: var(--muted);
  white-space: nowrap;
}
.countdown-pill strong { font-family: var(--font-mono); color: var(--brand); font-size: 15px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 38px; height: 38px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 10px; color: var(--ink-2);
  transition: background .15s, border-color .15s, color .15s;
}
.icon-btn:hover { background: var(--brand-soft); border-color: #bfd8cf; color: var(--brand-dark); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-toggle { display: none; }

.search-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 12px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 10px; color: var(--muted); font-size: 13px;
}
.search-trigger:hover { border-color: var(--line-strong); background: var(--surface-2); }
.search-trigger kbd {
  font-family: var(--font-mono); font-size: 10px; color: var(--muted-2);
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 5px; padding: 1px 5px;
}

/* ---------- 侧栏 ---------- */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; z-index: 80;
  width: var(--sidebar-w);
  overflow-y: auto;
  padding: 18px 14px 32px;
  background: rgba(250, 249, 243, .82);
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }

.nav-group { margin-bottom: 20px; }
.nav-group-title {
  padding: 0 10px; margin-bottom: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em;
  color: var(--muted-2); text-transform: uppercase;
}
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; margin: 2px 0;
  border-radius: 9px; color: var(--ink-2); font-size: 13.5px;
  line-height: 1.35; border: 1px solid transparent;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.active {
  background: var(--brand-soft); color: var(--brand-dark);
  border-color: #cfe3da; font-weight: 700;
}
.nav-link svg { width: 16px; height: 16px; flex: 0 0 16px; color: currentColor; opacity: .85; }
.nav-num {
  flex: 0 0 22px; font-family: var(--font-mono); font-size: 10.5px;
  color: var(--muted-2); font-weight: 700;
}
.nav-link.active .nav-num { color: var(--brand); }
.nav-dot {
  margin-left: auto; width: 7px; height: 7px; border-radius: 50%;
  background: var(--line-strong); flex: 0 0 7px;
}
.nav-dot.done { background: var(--brand); }

.sidebar-progress {
  margin: 8px 6px 20px; padding: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.sidebar-progress-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); }
.sidebar-progress-top strong { font-family: var(--font-mono); font-size: 18px; color: var(--brand); }
.sidebar-progress .bar { margin: 9px 0 8px; }
.sidebar-progress-note { font-size: 11px; color: var(--muted-2); line-height: 1.5; }

.sidebar-backdrop {
  display: none; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 70;
  background: rgba(20, 28, 25, .35);
}

/* ---------- 主内容 ---------- */
.main {
  margin-left: var(--sidebar-w);
  padding: calc(var(--topbar-h) + 30px) 28px 90px;
  min-height: 100vh;
}
.view-root { max-width: var(--content-max); margin: 0 auto; }

/* ---------- 通用组件 ---------- */
.surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin: 34px 0 16px;
}
.section-head h2 { font-size: 21px; margin: 0; letter-spacing: -.01em; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: .12em;
  color: var(--brand); text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 18px; height: 2px; background: var(--brand); border-radius: 2px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.bar {
  height: 8px; border-radius: 999px; background: var(--surface-3);
  overflow: hidden;
}
.bar > i {
  display: block; height: 100%; width: 0%;
  border-radius: inherit; background: var(--brand);
  transition: width .35s ease;
}
.bar.amber > i { background: var(--amber); }
.bar.blue > i { background: var(--blue); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 1.7;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-must { background: var(--amber-soft); color: var(--amber-ink); border-color: #f0dc94; }
.badge-high { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.badge-mid { background: var(--blue-soft); color: var(--blue); border-color: #cddded; }
.badge-low { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.badge-brand { background: var(--brand-soft); color: var(--brand-dark); border-color: #cfe3da; }
.badge-type { background: transparent; color: var(--ink-2); border-color: var(--line-strong); font-weight: 600; }
.badge-purple { background: var(--purple-soft); color: var(--purple); border-color: #ddd6ee; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 7px;
  background: var(--surface-2); color: var(--muted);
  font-size: 11.5px; border: 1px solid var(--line);
}
.chip strong { color: var(--ink-2); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 8px 15px;
  border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 700; line-height: 1.2;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn-amber { background: var(--amber); border-color: var(--amber); color: #3d2a00; }
.btn-amber:hover { background: #e0ad25; border-color: #e0ad25; color: #3d2a00; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { min-height: 30px; padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-icon { width: 34px; height: 34px; min-height: 34px; padding: 0; }
.btn-icon svg { width: 16px; height: 16px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn[aria-pressed="true"] { background: var(--brand-soft); border-color: #bfd8cf; color: var(--brand-dark); }

.callout {
  position: relative;
  padding: 14px 16px 14px 18px;
  margin: 0 0 16px;
  background: var(--brand-softer);
  border: 1px solid #d5e6df;
  border-left: 4px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px;
}
.callout p:last-child { margin-bottom: 0; }
.callout-title { display: block; font-weight: 800; font-size: 12px; letter-spacing: .06em; color: var(--brand-dark); margin-bottom: 3px; }
.callout.warn { background: #fff8eb; border-color: #f0dfb6; border-left-color: var(--amber); }
.callout.warn .callout-title { color: var(--amber-ink); }
.callout.danger { background: var(--red-soft); border-color: var(--red-line); border-left-color: var(--red); }
.callout.danger .callout-title { color: var(--red); }
.callout.blue { background: var(--blue-soft); border-color: #cddded; border-left-color: var(--blue); }
.callout.blue .callout-title { color: var(--blue); }

mark, .key {
  background: linear-gradient(transparent 42%, #ffe58a 42%, #ffe58a 92%, transparent 92%);
  color: inherit; padding: 0 1px; font-weight: 700;
}
.must-text { color: var(--red); font-weight: 800; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

.kbd {
  font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--line);
  border-bottom-width: 2px; background: var(--surface); border-radius: 5px; padding: 1px 5px;
}

.empty-state {
  padding: 44px 20px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface);
}
.empty-state strong { display: block; color: var(--ink); margin-bottom: 4px; font-size: 16px; }

/* ---------- 首页 ---------- */
.hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 28px; align-items: center;
  padding: 34px 36px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.hero::after {
  content: "802"; position: absolute; right: -16px; bottom: -52px;
  font-family: var(--font-mono); font-weight: 800; font-size: 210px; line-height: 1;
  color: rgba(15, 107, 92, .045); letter-spacing: -.08em; pointer-events: none;
}
.hero-copy { position: relative; z-index: 1; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px; margin-bottom: 14px;
  background: var(--brand-soft); color: var(--brand-dark);
  border-radius: 999px; font-size: 11.5px; font-weight: 700;
}
.hero-tag .pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(30px, 3.6vw, 45px);
  line-height: 1.22; letter-spacing: -.02em;
  margin-bottom: 12px;
}
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p.lead { max-width: 620px; color: var(--ink-2); font-size: 15px; margin-bottom: 20px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hero-note { margin-top: 14px; font-size: 11.5px; color: var(--muted-2); }

.hero-panel { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.progress-ring {
  --p: 0%;
  position: relative; width: 158px; aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--brand) var(--p), var(--surface-3) 0);
  display: grid; place-items: center;
}
.progress-ring::before { content: ""; position: absolute; inset: 11px; background: var(--surface); border-radius: 50%; }
.progress-ring-inner { position: relative; z-index: 1; text-align: center; line-height: 1.15; }
.progress-ring-inner strong { display: block; font-family: var(--font-mono); font-size: 30px; color: var(--brand); letter-spacing: -.04em; }
.progress-ring-inner span { font-size: 11px; color: var(--muted); }
.hero-panel .mini-stats { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hero-panel .mini-stat { padding: 8px 10px; background: var(--surface-2); border-radius: 9px; text-align: center; }
.hero-panel .mini-stat strong { display: block; font-family: var(--font-mono); font-size: 17px; color: var(--ink); }
.hero-panel .mini-stat span { font-size: 10.5px; color: var(--muted); }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.stat-card {
  padding: 16px 17px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.stat-card .stat-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); }
.stat-card .stat-value { margin: 5px 0 2px; font-family: var(--font-mono); font-size: 26px; font-weight: 700; color: var(--ink); letter-spacing: -.04em; }
.stat-card .stat-sub { font-size: 11px; color: var(--muted-2); }
.stat-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.stat-icon svg { width: 15px; height: 15px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr); gap: 16px; align-items: start; }
.today-card { padding: 22px; }
.today-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.today-head h3 { font-size: 18px; margin: 0 0 3px; }
.today-date { font-size: 12px; color: var(--muted); }
.today-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.today-list li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; background: var(--surface-2); border-radius: 9px; font-size: 13px; }
.today-list .task-check { width: 18px; height: 18px; border: 1.5px solid var(--line-strong); border-radius: 5px; flex: 0 0 18px; margin-top: 2px; background: var(--surface); display: grid; place-items: center; color: transparent; font-size: 11px; }
.today-list .task-check.done { background: var(--brand); border-color: var(--brand); color: #fff; }
.today-list .task-copy { flex: 1; }
.today-list .task-copy small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }

.quick-panel { padding: 20px; }
.quick-panel h3 { font-size: 15px; margin-bottom: 12px; }
.quick-links { display: grid; gap: 7px; }
.quick-link { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 9px; color: var(--ink-2); font-size: 12.5px; border: 1px solid transparent; }
.quick-link:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.quick-link .q-ico { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: 0 0 26px; }
.quick-link .q-ico svg { width: 14px; height: 14px; }
.quick-link span { flex: 1; }
.quick-link .arrow { color: var(--muted-2); font-family: var(--font-mono); }

.chapter-map { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.chapter-card {
  position: relative; display: flex; flex-direction: column;
  padding: 18px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: transform .16s, box-shadow .16s, border-color .16s;
  color: var(--ink);
}
.chapter-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c8d8d1; color: var(--ink); }
.chapter-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.chapter-num { font-family: var(--font-mono); font-size: 11px; font-weight: 800; color: var(--brand); letter-spacing: .1em; }
.chapter-card h3 { font-family: var(--font-serif); font-size: 19px; margin: 0 0 5px; }
.chapter-card p { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin: 0 0 14px; }
.chapter-card .chapter-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); }
.chapter-card .bar { flex: 1; height: 6px; }
.chapter-card .chapter-arrow { color: var(--brand); font-family: var(--font-mono); }

.exam-table { width: 100%; font-size: 13px; }
.exam-table td, .exam-table th { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.exam-table th { background: var(--surface-2); font-size: 11.5px; color: var(--muted); font-weight: 700; }
.exam-table tr:last-child td { border-bottom: 0; }

/* ---------- 页面头部 ---------- */
.page-head { margin-bottom: 22px; }
.page-head .eyebrow { margin-bottom: 8px; }
.page-head h1 { font-family: var(--font-serif); font-size: clamp(26px, 3vw, 36px); letter-spacing: -.02em; margin-bottom: 7px; }
.page-head p { max-width: 780px; color: var(--muted); font-size: 14px; margin: 0; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 12px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.toolbar .grow { flex: 1; }
.toolbar-label { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.select, .input, .textarea {
  min-height: 36px; padding: 6px 10px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font-size: 12.5px;
}
.select { padding-right: 28px; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid rgba(15,107,92,.18); border-color: var(--brand); }
.input-search { min-width: 180px; flex: 1; }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 9px; gap: 2px; }
.segmented button {
  border: 0; background: transparent; color: var(--muted);
  padding: 5px 10px; border-radius: 7px; font-size: 12px; font-weight: 700;
}
.segmented button.active { background: var(--surface); color: var(--brand-dark); box-shadow: var(--shadow-sm); }

/* ---------- 章节页 ---------- */
.chapter-hero {
  position: relative; overflow: hidden;
  padding: 28px 30px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}
.chapter-hero::after {
  content: attr(data-num); position: absolute; right: 14px; bottom: -42px;
  font-family: var(--font-mono); font-size: 150px; font-weight: 800; line-height: 1;
  color: rgba(15,107,92,.05); letter-spacing: -.08em; pointer-events: none;
}
.chapter-breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11.5px; color: var(--muted); margin-bottom: 10px; }
.chapter-breadcrumb span { color: var(--muted-2); }
.chapter-hero h1 { font-family: var(--font-serif); font-size: clamp(28px, 3.2vw, 38px); margin: 0 0 7px; letter-spacing: -.02em; }
.chapter-hero .chapter-lead { max-width: 760px; color: var(--ink-2); font-size: 14px; margin-bottom: 13px; }
.chapter-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.chapter-progress-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.chapter-progress-row .progress-info { min-width: 160px; }
.chapter-progress-row .progress-info span { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.chapter-progress-row .progress-info strong { font-family: var(--font-mono); color: var(--brand); }
.chapter-progress-row .bar { width: 220px; max-width: 38vw; }
.chapter-progress-row .btn { margin-left: auto; }

.chapter-layout { display: grid; grid-template-columns: minmax(0, 1fr) 248px; gap: 24px; align-items: start; }
.chapter-body { min-width: 0; }
.mobile-chapter-toc { display: none; margin-bottom: 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.mobile-chapter-toc summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--brand-dark); }
.mobile-chapter-toc .toc-list { margin-top: 8px; }
.chapter-toc {
  position: sticky; top: calc(var(--topbar-h) + 22px);
  padding: 15px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  max-height: calc(100vh - var(--topbar-h) - 44px); overflow-y: auto;
}
.chapter-toc h4 { font-size: 11px; letter-spacing: .12em; color: var(--muted-2); margin: 0 0 8px; text-transform: uppercase; }
.toc-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1px; }
.toc-list a { display: flex; gap: 7px; align-items: center; padding: 6px 7px; border-radius: 6px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.toc-list a:hover { background: var(--surface-2); color: var(--ink); }
.toc-list a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.toc-list .toc-check { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); flex: 0 0 6px; }
.toc-list .toc-check.done { background: var(--brand); }
.toc-progress { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.toc-progress .bar { margin-top: 6px; height: 5px; }

.chapter-block {
  scroll-margin-top: calc(var(--topbar-h) + 20px);
  margin-bottom: 22px; padding: 24px 26px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.block-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.block-num {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-dark);
  font-family: var(--font-mono); font-size: 12px; font-weight: 800;
}
.block-title-wrap { flex: 1; min-width: 0; }
.block-title-wrap h2 { font-size: 20px; margin: 0 0 2px; letter-spacing: -.01em; }
.block-title-wrap p { margin: 0; color: var(--muted); font-size: 12px; }
.read-toggle {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 7px; font-size: 11px; color: var(--muted);
}
.read-toggle:hover { border-color: var(--line-strong); background: var(--surface-2); }
.read-toggle.done { background: var(--brand-soft); border-color: #cfe3da; color: var(--brand-dark); font-weight: 700; }
.read-toggle .tick { width: 13px; height: 13px; border-radius: 4px; border: 1.5px solid currentColor; display: grid; place-items: center; font-size: 9px; }
.read-toggle.done .tick { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 章节内容排版 */
.prose { font-size: 14.5px; color: var(--ink-2); }
.prose > :last-child { margin-bottom: 0; }
.prose h3 {
  font-size: 17px; margin: 1.5em 0 .55em; padding-left: 10px;
  border-left: 3px solid var(--brand); line-height: 1.35;
}
.prose h3:first-child { margin-top: 0; }
.prose h4 { font-size: 14.5px; margin: 1.25em 0 .4em; color: var(--ink); }
.prose strong { color: var(--ink); }
.prose code {
  font-family: var(--font-mono); font-size: .9em;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px; color: var(--brand-dark);
}
.prose blockquote {
  margin: 14px 0; padding: 12px 16px;
  background: var(--surface-2); border-left: 3px solid var(--line-strong);
  border-radius: 0 8px 8px 0; color: var(--muted);
}
.prose table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 13px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); font-size: 12px; color: var(--ink-2); font-weight: 700; }
.prose tr:nth-child(even) td { background: #fcfbf6; }
.prose ul, .prose ol { padding-left: 1.35em; }
.prose li::marker { color: var(--brand); }
.prose .formula {
  display: block; margin: 12px 0; padding: 12px 14px;
  background: var(--code-bg); color: var(--code-ink);
  border-radius: 9px; font-family: var(--font-mono); font-size: 13px;
  overflow-x: auto; line-height: 1.65;
}
.prose .formula.light {
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
}
.prose .cols-2, .prose .cols-3 { display: grid; gap: 12px; margin: 12px 0; }
.prose .cols-2 { grid-template-columns: 1fr 1fr; }
.prose .cols-3 { grid-template-columns: repeat(3, 1fr); }
.prose .mini-card { padding: 12px 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; font-size: 13px; }
.prose .mini-card strong { display: block; margin-bottom: 3px; }
.prose .steps { counter-reset: step; list-style: none; padding: 0; display: grid; gap: 8px; }
.prose .steps li { counter-increment: step; position: relative; padding: 9px 11px 9px 40px; background: var(--surface-2); border-radius: 8px; font-size: 13.5px; }
.prose .steps li::before {
  content: counter(step); position: absolute; left: 10px; top: 8px;
  width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: #fff; font-family: var(--font-mono); font-size: 10px; font-weight: 700;
}
.prose .tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }

/* 框架图 */
.framework {
  display: grid; grid-template-columns: minmax(150px, .62fr) minmax(0, 2.2fr);
  gap: 18px; align-items: stretch;
}
.framework-root {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 18px; text-align: center;
  background: var(--brand); color: #fff; border-radius: 12px;
}
.framework-root strong { font-family: var(--font-serif); font-size: 20px; }
.framework-root span { font-size: 11px; opacity: .8; margin-top: 4px; }
.framework-branches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.framework-branch { position: relative; padding: 12px 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; font-size: 12.5px; }
.framework-branch::before { content: ""; position: absolute; left: -6px; top: 18px; width: 6px; height: 1px; background: var(--line-strong); }
.framework-branch strong { display: block; font-size: 12.5px; color: var(--brand-dark); margin-bottom: 3px; }
.framework-branch ul { margin: 0; padding-left: 1.1em; color: var(--muted); }
.framework-branch li { margin: 2px 0; }

/* 考点层级表 */
.level-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.level-table th, .level-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.level-table th { background: var(--surface-2); color: var(--muted); font-size: 11px; white-space: nowrap; }
.level-table td:first-child { font-weight: 700; color: var(--ink); }
.level-table tr:hover td { background: #fcfbf6; }

/* 命题特色 */
.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.style-card { padding: 14px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.style-card h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 7px; font-size: 13px; }
.style-card ul { margin: 0; padding-left: 1.15em; font-size: 12.5px; color: var(--ink-2); }
.style-card li { margin: 3px 0; }
.style-card.hot { background: var(--red-soft); border-color: var(--red-line); }
.style-card.hot h4 { color: var(--red); }
.style-card.cold { background: var(--blue-soft); border-color: #cddded; }
.style-card.cold h4 { color: var(--blue); }

/* 易错点 */
.error-list { display: grid; gap: 9px; }
.error-item { padding: 11px 13px; background: #fffaf0; border: 1px solid #f0e3c2; border-radius: 9px; font-size: 13px; }
.error-item strong { display: block; color: var(--amber-ink); margin-bottom: 2px; }
.error-item p { margin: 0; color: var(--ink-2); }

/* 易混辨析 */
.confusion-grid { display: grid; gap: 12px; }
.confusion-card { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.table-wrap { overflow-x: auto; }
.table-wrap table { min-width: 520px; }
.prose .table-wrap table { min-width: 0; }
.confusion-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.confusion-head h4 { margin: 0; font-size: 14px; }
.confusion-head .vs { font-family: var(--font-mono); font-size: 10px; color: var(--muted-2); }
.confusion-card .table-wrap { margin: 0; }
.confusion-card table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.confusion-card th, .confusion-card td { padding: 8px 11px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; text-align: left; }
.confusion-card th { background: #fbfaf5; color: var(--muted); font-size: 11px; }
.confusion-card th:last-child, .confusion-card td:last-child { border-right: 0; }
.confusion-card tr:last-child td { border-bottom: 0; }
.confusion-foot { padding: 9px 13px; background: var(--brand-softer); border-top: 1px solid #d5e6df; font-size: 12px; color: var(--brand-dark); }
.confusion-foot strong { color: var(--brand-dark); }

/* ---------- 题库 ---------- */
.quiz-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.quiz-stat { padding: 13px 15px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.quiz-stat span { font-size: 11px; color: var(--muted); }
.quiz-stat strong { display: block; font-family: var(--font-mono); font-size: 22px; color: var(--ink); margin-top: 2px; }
.quiz-stat em { font-style: normal; font-size: 10.5px; color: var(--muted-2); }

.q-list { display: grid; gap: 13px; }
.q-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.q-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.q-id { font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-weight: 700; }
.q-card-head .spacer { flex: 1; }
.bookmark-btn { border: 0; background: transparent; color: var(--muted-2); font-size: 17px; line-height: 1; padding: 2px 4px; }
.bookmark-btn.on { color: var(--amber); }
.q-body { padding: 16px 18px; }
.q-stem { font-size: 14.5px; color: var(--ink); margin-bottom: 12px; }
.q-stem p:last-child { margin-bottom: 0; }
.q-stem pre { margin: 10px 0; }
.q-options { display: grid; gap: 7px; margin: 10px 0 12px; }
.q-option {
  display: flex; gap: 10px; align-items: flex-start; width: 100%;
  padding: 9px 12px; text-align: left;
  border: 1px solid var(--line); background: var(--surface); border-radius: 9px;
  font-size: 13.5px; color: var(--ink-2);
}
.q-option:hover { border-color: var(--line-strong); background: var(--surface-2); }
.q-option .opt-key { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-2); font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.q-option.correct { background: var(--brand-soft); border-color: var(--brand); }
.q-option.correct .opt-key { background: var(--brand); color: #fff; }
.q-option.wrong { background: var(--red-soft); border-color: var(--red); }
.q-option.wrong .opt-key { background: var(--red); color: #fff; }
.q-option[disabled] { cursor: default; }
.q-fill { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.q-fill .input { flex: 1; min-width: 180px; }
.q-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.q-actions .self-label { font-size: 11.5px; color: var(--muted); margin-right: 2px; }
.q-answer { display: none; margin-top: 14px; border-top: 1px dashed var(--line-strong); padding-top: 14px; }
.q-card[data-revealed="true"] .q-answer { display: block; }
.answer-block { margin-bottom: 13px; }
.answer-block:last-child { margin-bottom: 0; }
.answer-block h5 { display: flex; align-items: center; gap: 6px; font-size: 12px; letter-spacing: .05em; color: var(--brand-dark); margin: 0 0 5px; }
.answer-block h5::before { content: ""; width: 4px; height: 12px; border-radius: 2px; background: var(--brand); }
.answer-block p { margin: 0 0 6px; font-size: 13.5px; }
.answer-block ul { margin: 4px 0 0; padding-left: 1.3em; font-size: 13px; }
.trap-box { padding: 10px 12px; background: #fff8eb; border: 1px solid #f0dfb6; border-radius: 8px; font-size: 12.5px; color: #6b4a00; }
.trap-box strong { color: #8a5a00; }
.q-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.q-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: 11px; color: var(--muted-2); }
.q-foot a { color: var(--brand); }
.q-code { margin: 8px 0 10px; padding: 9px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.q-code summary { cursor: pointer; color: var(--brand-dark); font-size: 12px; font-weight: 700; }
.q-code[open] summary { margin-bottom: 8px; }
.q-status { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.q-status.correct { background: var(--brand-soft); color: var(--brand-dark); }
.q-status.wrong { background: var(--red-soft); color: var(--red); }
.q-status.seen { background: var(--blue-soft); color: var(--blue); }

.pager { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin: 20px 0 0; }
.pager button { min-width: 34px; height: 34px; padding: 0 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; font-size: 12px; color: var(--muted); }
.pager button.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.pager button:hover:not(.active) { background: var(--surface-2); }

/* ---------- 代码 ---------- */
.code-shell { margin: 12px 0; background: var(--code-bg); border-radius: 10px; overflow: hidden; border: 1px solid #1e2d33; }
.code-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--code-bg-2); border-bottom: 1px solid #1e2d33; color: var(--code-muted); font-size: 11px; }
.code-dots { display: inline-flex; gap: 4px; }
.code-dots i { width: 7px; height: 7px; border-radius: 50%; background: #3a4b50; }
.code-dots i:nth-child(1) { background: #b45a52; }
.code-dots i:nth-child(2) { background: #b8903f; }
.code-dots i:nth-child(3) { background: #4f8a6a; }
.code-head .code-title { font-family: var(--font-mono); color: #a9c1b9; }
.code-head .spacer { flex: 1; }
.copy-btn { border: 1px solid #2a3c42; background: #152329; color: #a9c1b9; border-radius: 5px; padding: 2px 7px; font-size: 10.5px; }
.copy-btn:hover { background: #1b2d34; color: #fff; }
.code-shell pre { margin: 0; padding: 14px 15px; max-height: 520px; overflow: auto; }
.code-shell.expanded pre { max-height: none; }
.code-shell pre code { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; color: var(--code-ink); white-space: pre; tab-size: 4; }
.code-expand { width: 100%; border: 0; border-top: 1px solid #1e2d33; background: #132127; color: #9ab4ac; padding: 6px; font-size: 11px; }
.code-expand:hover { color: #fff; }
.tok-comment { color: var(--code-comment); font-style: italic; }
.tok-string { color: var(--code-str); }
.tok-key { color: var(--code-key); font-weight: 700; }
.tok-type { color: var(--code-type); }
.tok-num { color: var(--code-num); }
.tok-fn { color: var(--code-fn); }
.tok-pre { color: #d7a7e8; }

.code-lab-grid { display: grid; gap: 16px; }
.code-lab { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.code-lab-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--surface), #fbfaf5); }
.code-lab-head .lab-icon { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-family: var(--font-mono); font-size: 12px; font-weight: 800; }
.code-lab-head h3 { margin: 0 0 3px; font-size: 16.5px; }
.code-lab-head p { margin: 0; color: var(--muted); font-size: 12px; }
.code-lab-head .spacer { flex: 1; }
.code-lab-body { padding: 16px 18px; }
.code-lab-body h4 { font-size: 12px; letter-spacing: .05em; color: var(--brand-dark); margin: 0 0 5px; }
.code-lab-body p { font-size: 13.5px; margin-bottom: 10px; }
.complexity-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.complexity-item { padding: 9px 11px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.complexity-item span { display: block; font-size: 10.5px; color: var(--muted); }
.complexity-item strong { font-family: var(--font-mono); font-size: 13px; color: var(--ink); }
.edge-list { margin: 0; padding-left: 1.2em; font-size: 12.5px; color: var(--ink-2); }
.edge-list li { margin: 3px 0; }
.edge-list li strong { color: var(--red); }
.code-lab-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--line); background: #fbfaf5; }

/* ---------- 复杂度速查 ---------- */
.complexity-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.complexity-table th, .complexity-table td { padding: 8px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.complexity-table thead th { position: sticky; top: var(--topbar-h); z-index: 2; background: var(--surface-2); color: var(--muted); font-size: 10.5px; letter-spacing: .03em; }
.complexity-table tbody tr:hover td { background: #fcfbf6; }
.complexity-table td:first-child { font-weight: 700; color: var(--ink); }
.complexity-table .cat-row td { background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; font-size: 11px; letter-spacing: .08em; }
.stability { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; }
.stability.yes { color: var(--brand); }
.stability.no { color: var(--red); }
.stability.na { color: var(--muted-2); }
.memory-note { font-family: var(--font-mono); font-size: 11.5px; color: var(--brand-dark); }

/* ---------- 背诵卡片 ---------- */
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.flashcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.flashcard-head { display: flex; align-items: center; gap: 7px; padding: 10px 13px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.flashcard-head .spacer { flex: 1; }
.flashcard-q { padding: 14px 15px; font-size: 13.5px; font-weight: 700; color: var(--ink); }
.flashcard-toggle { width: 100%; border: 0; border-top: 1px solid var(--line); background: var(--surface); padding: 7px 14px; text-align: left; color: var(--brand); font-size: 11.5px; font-weight: 700; }
.flashcard-toggle:hover { background: var(--brand-softer); }
.flashcard-a { display: none; padding: 13px 15px 15px; border-top: 1px dashed var(--line-strong); font-size: 13px; color: var(--ink-2); background: #fcfbf6; }
.flashcard.open .flashcard-a { display: block; }
.flashcard-a p:last-child { margin-bottom: 0; }
.flashcard-foot { display: flex; flex-wrap: wrap; gap: 6px; padding: 9px 13px; border-top: 1px solid var(--line); background: var(--surface); align-items: center; }
.flashcard-foot .spacer { flex: 1; }
.card-status { font-size: 10.5px; font-weight: 700; }
.card-status.mastered { color: var(--brand); }
.card-status.review { color: var(--amber-ink); }

/* ---------- 规划 ---------- */
.plan-hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); gap: 18px; align-items: stretch; margin-bottom: 20px; }
.plan-summary { padding: 22px; }
.plan-summary h2 { font-family: var(--font-serif); font-size: 23px; margin-bottom: 6px; }
.plan-summary p { color: var(--muted); font-size: 13px; }
.plan-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.plan-metric { padding: 9px 10px; background: var(--surface-2); border-radius: 8px; }
.plan-metric span { display: block; font-size: 10.5px; color: var(--muted); }
.plan-metric strong { font-family: var(--font-mono); font-size: 17px; color: var(--ink); }
.settings-card { padding: 20px; }
.settings-card h3 { font-size: 15px; margin-bottom: 12px; }
.form-row { display: grid; gap: 5px; margin-bottom: 10px; }
.form-row label { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.form-row .input, .form-row .select { width: 100%; }
.settings-note { font-size: 11px; color: var(--muted-2); line-height: 1.55; margin: 8px 0 0; }
.danger-zone { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

.week-list { display: grid; gap: 14px; }
.week-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.week-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 17px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.week-head h3 { margin: 0; font-size: 15px; }
.week-head .week-sub { color: var(--muted); font-size: 11.5px; }
.week-head .spacer { flex: 1; }
.week-progress { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.week-progress .bar { width: 100px; height: 6px; }
.day-list { display: grid; }
.day-row { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: start; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.day-row:last-child { border-bottom: 0; }
.day-row.today { background: #fffdf4; }
.day-label { font-family: var(--font-mono); font-size: 11px; color: var(--muted); line-height: 1.5; }
.day-label strong { display: block; font-size: 12.5px; color: var(--ink); }
.day-copy h4 { margin: 0 0 4px; font-size: 13.5px; }
.day-tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 12px; color: var(--ink-2); }
.day-tasks li { display: flex; gap: 6px; align-items: flex-start; }
.day-tasks li::before { content: "·"; color: var(--brand); font-weight: 800; }
.day-check { width: 21px; height: 21px; margin-top: 1px; border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: 6px; display: grid; place-items: center; color: transparent; font-size: 11px; }
.day-check.done { background: var(--brand); border-color: var(--brand); color: #fff; }
.day-row.today .day-label strong { color: var(--brand-dark); }

/* ---------- 考纲 ---------- */
.syllabus-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.syllabus-main { padding: 24px 26px; }
.syllabus-main h2 { font-family: var(--font-serif); font-size: 22px; }
.syllabus-part { padding: 13px 0; border-bottom: 1px solid var(--line); }
.syllabus-part:last-child { border-bottom: 0; }
.syllabus-part h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 0 0 4px; }
.syllabus-part .part-no { font-family: var(--font-mono); font-size: 11px; color: var(--brand); }
.syllabus-part ul { margin: 0; padding-left: 1.3em; color: var(--ink-2); font-size: 13px; }
.syllabus-part li { margin: 2px 0; }
.syllabus-side { display: grid; gap: 12px; }
.side-card { padding: 17px; }
.side-card h3 { font-size: 14px; margin-bottom: 8px; }
.side-card ul { margin: 0; padding-left: 1.2em; font-size: 12.5px; color: var(--ink-2); }
.mapping-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.mapping-table th, .mapping-table td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.mapping-table th { color: var(--muted); font-size: 10.5px; background: var(--surface-2); }

/* ---------- 搜索 ---------- */
.search-overlay { position: fixed; inset: 0; z-index: 200; display: none; background: rgba(20, 28, 25, .42); backdrop-filter: blur(5px); padding: 8vh 16px 16px; }
.search-overlay.open { display: block; }
.search-panel { max-width: 720px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.search-box { display: flex; align-items: center; gap: 9px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.search-box svg { width: 18px; height: 18px; color: var(--muted); flex: 0 0 18px; }
.search-box input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--ink); }
.search-box kbd { font-family: var(--font-mono); font-size: 10px; color: var(--muted-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.search-results { max-height: 62vh; overflow-y: auto; padding: 8px; }
.search-group-title { padding: 8px 10px 4px; font-size: 10px; letter-spacing: .12em; color: var(--muted-2); font-weight: 700; text-transform: uppercase; }
.search-result { display: flex; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--ink-2); width: 100%; border: 0; background: transparent; text-align: left; }
.search-result:hover { background: var(--surface-2); color: var(--ink); }
.search-result .sr-type { flex: 0 0 44px; font-size: 10px; color: var(--muted-2); padding-top: 2px; }
.search-result .sr-title { font-size: 13px; font-weight: 700; }
.search-result .sr-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 模态、Toast ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 210; display: none; background: rgba(20,28,25,.4); padding: 20px; place-items: center; }
.modal-overlay.open { display: grid; }
.modal { width: min(540px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 22px; }
.modal h3 { font-size: 18px; margin-bottom: 8px; }
.modal p { font-size: 13px; color: var(--muted); }
.modal .btn-row { justify-content: flex-end; margin-top: 18px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(18px);
  z-index: 250; padding: 9px 16px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 12.5px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 移动底栏 ---------- */
.mobile-tabbar { display: none; }

/* ---------- 页脚 ---------- */
.footer {
  max-width: var(--content-max); margin: 40px auto 0;
  padding-top: 18px; border-top: 1px solid var(--line);
  color: var(--muted-2); font-size: 11px; line-height: 1.7;
}
.footer strong { color: var(--muted); }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  :root { --sidebar-w: 232px; }
  .main { padding-left: 22px; padding-right: 22px; }
  .chapter-layout { grid-template-columns: minmax(0, 1fr) 220px; gap: 18px; }
  .hero { grid-template-columns: minmax(0, 1.2fr) minmax(270px, .8fr); padding: 28px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1020px) {
  .hero { grid-template-columns: 1fr; }
  .hero-panel { flex-direction: row; justify-content: flex-start; flex-wrap: wrap; }
  .hero-panel .mini-stats { max-width: 280px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .chapter-layout { grid-template-columns: 1fr; }
  .chapter-toc { display: none; }
  .mobile-chapter-toc { display: block; }
  .chapter-map { grid-template-columns: repeat(2, 1fr); }
  .syllabus-grid { grid-template-columns: 1fr; }
  .plan-hero { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  :root { --topbar-h: 58px; }
  .sidebar { transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); width: 280px; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  .main { margin-left: 0; padding: calc(var(--topbar-h) + 20px) 16px 86px; }
  .menu-toggle { display: inline-flex; }
  .search-trigger span { display: none; }
  .search-trigger kbd { display: none; }
  .topbar { padding: 0 14px; }
  .brand-sub { display: none; }
  .countdown-pill { padding: 5px 9px; font-size: 11px; }
  .countdown-pill strong { font-size: 13px; }
  .mobile-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 85;
    height: 58px; padding-bottom: env(safe-area-inset-bottom, 0);
    background: rgba(255,254,249,.96); border-top: 1px solid var(--line);
    backdrop-filter: blur(12px);
  }
  .mobile-tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; font-size: 10px; color: var(--muted); line-height: 1.1;
  }
  .mobile-tabbar a.active { color: var(--brand); font-weight: 700; }
  .mobile-tabbar svg { width: 19px; height: 19px; }
  .footer { padding-bottom: 10px; }
}

@media (max-width: 720px) {
  body { font-size: 14px; }
  .hero { padding: 22px 20px; border-radius: var(--radius); }
  .hero h1 { font-size: 30px; }
  .hero-panel { justify-content: center; }
  .progress-ring { width: 132px; }
  .progress-ring-inner strong { font-size: 25px; }
  .stat-grid { gap: 8px; }
  .stat-card { padding: 13px; }
  .stat-card .stat-value { font-size: 23px; }
  .chapter-map { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .style-grid { grid-template-columns: 1fr; }
  .framework { grid-template-columns: 1fr; }
  .framework-branches { grid-template-columns: 1fr 1fr; }
  .prose .cols-2, .prose .cols-3 { grid-template-columns: 1fr; }
  .chapter-hero { padding: 20px; border-radius: var(--radius); }
  .chapter-hero::after { font-size: 100px; bottom: -26px; }
  .chapter-block { padding: 18px 16px; border-radius: var(--radius); }
  .block-head { flex-wrap: wrap; }
  .read-toggle { margin-left: 46px; }
  .quiz-stats { grid-template-columns: repeat(2, 1fr); }
  .card-grid { grid-template-columns: 1fr; }
  .complexity-grid { grid-template-columns: 1fr 1fr; }
  .day-row { grid-template-columns: 46px 1fr auto; gap: 8px; padding: 11px 12px; }
  .plan-metrics { grid-template-columns: 1fr 1fr; }
  .toolbar { gap: 7px; padding: 10px; }
  .toolbar .input-search { flex: 1 1 100%; }
  .chapter-progress-row .btn { margin-left: 0; }
  .chapter-progress-row .bar { width: 100%; max-width: none; }
  .chapter-progress-row .progress-info { flex: 1 1 100%; }
  .syllabus-main { padding: 18px 16px; }
  .q-body { padding: 14px; }
  .code-lab-head { padding: 13px; }
  .code-lab-body { padding: 13px; }
}

@media (max-width: 480px) {
  .topbar-actions .icon-btn:not(.menu-toggle) { display: none; }
  .search-trigger { display: inline-flex; }
  .hero-actions .btn { flex: 1 1 auto; }
  .framework-branches { grid-template-columns: 1fr; }
  .flashcard-head { flex-wrap: wrap; }
  .complexity-grid { grid-template-columns: 1fr; }
  .q-card-head { padding: 9px 12px; }
  .q-id { width: 100%; }
}

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

/* ---------- 打印 ---------- */
@media print {
  .topbar, .sidebar, .sidebar-backdrop, .mobile-tabbar, .chapter-toc,
  .read-toggle, .q-actions, .bookmark-btn, .copy-btn, .code-expand,
  .toolbar, .footer { display: none !important; }
  .main { margin: 0; padding: 0; }
  .view-root { max-width: none; }
  .chapter-layout { display: block; }
  .chapter-block, .q-card, .code-lab, .flashcard { break-inside: avoid; box-shadow: none; border-color: #999; }
  .code-shell { background: #111; }
  body { background: #fff; }
}
