/* ==========================================================================
   数径 · 高数 × 线代复习站
   Design tokens → layout → components → pages → responsive
   ========================================================================== */

:root {
  --bg: #f3efe5;
  --bg-deep: #eae3d4;
  --surface: #fffdf8;
  --surface-2: #f7f2e7;
  --surface-3: #efe8d9;
  --ink: #16212e;
  --ink-2: #33404e;
  --muted: #6d7885;
  --faint: #98a0a8;
  --line: #ded5c3;
  --line-soft: #eae3d5;
  --line-strong: #c9bea8;

  --nav: #12283f;
  --nav-deep: #0c1d2e;
  --nav-ink: #f2ecdd;
  --nav-muted: #93a5b7;
  --nav-line: rgba(255, 255, 255, .1);

  --accent: #bd5a35;
  --accent-deep: #a24828;
  --accent-soft: #f4e2d7;
  --teal: #1e6b62;
  --teal-soft: #dcebe6;
  --gold: #a97c31;
  --gold-soft: #f2e5c9;
  --green: #2f7350;
  --green-soft: #e1eee6;
  --red: #ad463d;
  --red-soft: #f7e2de;
  --blue: #315e85;
  --blue-soft: #e2eaf1;

  --shadow: 0 28px 60px -30px rgba(22, 33, 46, .32);
  --shadow-sm: 0 8px 24px -16px rgba(22, 33, 46, .35);
  --shadow-lift: 0 20px 40px -22px rgba(22, 33, 46, .38);

  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --font-ui: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  --font-display: "STZhongsong", "华文中宋", "Songti SC", "Noto Serif SC", "SimSun", serif;
  --font-mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --topbar-h: 68px;
}

[data-theme="dark"] {
  --bg: #0d151f;
  --bg-deep: #0a1119;
  --surface: #141f2c;
  --surface-2: #1a2736;
  --surface-3: #223142;
  --ink: #eef0e9;
  --ink-2: #c8d0d8;
  --muted: #9aa8b6;
  --faint: #748392;
  --line: #2a3949;
  --line-soft: #223141;
  --line-strong: #3a4c5e;

  --nav: #080f18;
  --nav-deep: #050b12;
  --nav-ink: #eef0e9;
  --nav-muted: #8999aa;
  --nav-line: rgba(255, 255, 255, .08);

  --accent: #e07a52;
  --accent-deep: #ef8b62;
  --accent-soft: #3a241d;
  --teal: #6ec3b7;
  --teal-soft: #16302e;
  --gold: #d9b06a;
  --gold-soft: #302719;
  --green: #7ec39d;
  --green-soft: #173024;
  --red: #ef9188;
  --red-soft: #3b211e;
  --blue: #8db7d8;
  --blue-soft: #1b2d3c;

  --shadow: 0 30px 70px -34px rgba(0, 0, 0, .8);
  --shadow-sm: 0 8px 24px -16px rgba(0, 0, 0, .8);
  --shadow-lift: 0 22px 44px -24px rgba(0, 0, 0, .9);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(1000px 500px at 85% -12%, rgba(189, 90, 53, .08), transparent 60%),
    radial-gradient(800px 500px at 20% 110%, rgba(30, 107, 98, .06), transparent 60%),
    var(--bg);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
::selection { background: rgba(189, 90, 53, .22); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 16px; top: -60px; z-index: 200;
  background: var(--surface); color: var(--ink); padding: 10px 16px;
  border-radius: 8px; border: 1px solid var(--line); transition: top .2s;
}
.skip-link:focus { top: 12px; }

/* ---------- Layout ---------- */
.app { min-height: 100vh; }
.main {
  margin-left: 278px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.view {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 34px 42px 76px;
  flex: 1;
  outline: none;
}
.page { animation: rise .42s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  width: 278px;
  display: flex; flex-direction: column;
  color: var(--nav-ink);
  background:
    radial-gradient(500px 300px at 50% -10%, rgba(233, 197, 138, .09), transparent 65%),
    linear-gradient(180deg, var(--nav), var(--nav-deep));
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.sidebar::after {
  content: "";
  position: absolute; inset: 0; pointer-events: none; opacity: .18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.25'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}
.brand {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 13px;
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--nav-line);
}
.brand-mark {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  color: #f0d7a8;
  background: linear-gradient(145deg, rgba(233, 197, 138, .2), rgba(233, 197, 138, .04));
  border: 1px solid rgba(233, 197, 138, .3);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px; line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14);
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.25; }
.brand-copy strong { font-family: var(--font-display); font-size: 19px; letter-spacing: .04em; font-weight: 600; white-space: nowrap; }
.brand-copy small { color: var(--nav-muted); font-size: 9px; letter-spacing: .2em; margin-top: 5px; }

.sidebar-close {
  display: none;
  position: absolute; top: 24px; right: 16px; z-index: 3;
  width: 32px; height: 32px; border-radius: 9px;
  border: 1px solid var(--nav-line); background: rgba(255, 255, 255, .05);
  color: var(--nav-muted); font-size: 22px; line-height: 1;
}
.sidebar-close:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.sidebar-scroll { position: relative; z-index: 1; flex: 1; overflow-y: auto; padding: 18px 14px 8px; scrollbar-width: thin; }
.sidebar-scroll::-webkit-scrollbar { width: 5px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 4px; }
.sidebar-label {
  padding: 10px 12px 8px;
  color: var(--nav-muted);
  font-size: 10px; font-weight: 600; letter-spacing: .18em;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  min-height: 40px; padding: 9px 12px;
  border-radius: 10px;
  color: #c3ced9;
  font-size: 13.5px; line-height: 1.35;
  transition: background .18s, color .18s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .82; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, .095); color: #fff; }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0; background: #e2b97c;
}
.nav-item .nav-count {
  margin-left: auto; font-size: 10.5px; color: var(--nav-muted);
  font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-count { color: #e6c995; }
.nav-item .nav-arrow { margin-left: auto; width: 14px; height: 14px; opacity: .45; }
.nav-group { margin-top: 9px; }
.nav-sub {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px 7px 41px;
  border-radius: 8px;
  color: #aebccb; font-size: 12.5px;
  transition: background .16s, color .16s;
}
.nav-sub:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav-sub.active { color: #fff; background: rgba(255, 255, 255, .06); }
.nav-sub .dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .45; flex: none; }
.nav-sub .nav-pct { margin-left: auto; font-size: 10px; color: var(--nav-muted); font-variant-numeric: tabular-nums; }

.sidebar-quote {
  position: relative;
  margin: 22px 8px 8px;
  padding: 18px 16px 16px;
  border: 1px solid var(--nav-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .03);
}
.sidebar-quote-mark {
  position: absolute; top: 2px; left: 12px;
  font-family: Georgia, serif; font-size: 40px; color: #d9b87e; opacity: .5;
}
.sidebar-quote p { font-family: var(--font-display); font-size: 14px; letter-spacing: .08em; color: #e7dfcf; padding-left: 8px; }
.sidebar-quote small { display: block; margin-top: 7px; color: var(--nav-muted); font-size: 10.5px; line-height: 1.6; }

.sidebar-foot { position: relative; z-index: 1; padding: 14px 22px 20px; border-top: 1px solid var(--nav-line); }
.side-progress-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; color: var(--nav-muted); }
.side-progress-head b { color: #ead9b8; font-size: 13px; font-variant-numeric: tabular-nums; }
.side-progress .progress { height: 4px; background: rgba(255, 255, 255, .09); margin-top: 8px; }
.side-progress .progress i { background: linear-gradient(90deg, #c8995a, #eed4a2); }
.side-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.local-badge {
  margin-left: auto; color: var(--nav-muted); font-size: 9.5px;
  border: 1px solid var(--nav-line); border-radius: 20px; padding: 3px 8px;
}
.icon-btn {
  width: 36px; height: 36px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent; color: var(--muted);
  transition: background .18s, color .18s, border-color .18s, transform .18s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.icon-btn:active { transform: scale(.96); }
.icon-btn svg, .icon-btn .icon { width: 18px; height: 18px; }
.icon-btn.on-dark { border-color: var(--nav-line); color: var(--nav-muted); }
.icon-btn.on-dark:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.theme-top { display: none; }

.scrim {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(6, 14, 22, .5); backdrop-filter: blur(2px);
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 0 36px 0 42px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(16px) saturate(1.1);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: .4; }
.crumbs .current { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.search-trigger {
  display: flex; align-items: center; gap: 9px;
  height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--muted);
  font-size: 12.5px;
  transition: border-color .18s, box-shadow .18s;
}
.search-trigger:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.search-trigger svg { width: 16px; height: 16px; }
.search-trigger kbd {
  margin-left: 12px; padding: 2px 6px;
  border: 1px solid var(--line); border-radius: 5px;
  background: var(--surface-2); color: var(--faint);
  font-family: var(--font-ui); font-size: 9.5px;
}
.streak-pill {
  display: flex; align-items: center; gap: 4px;
  height: 38px; padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 11px; color: var(--muted);
}
.streak-pill svg { width: 15px; height: 15px; color: var(--accent); margin-right: 2px; }
.streak-pill b { color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- Generic components ---------- */
.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #d9915f); transition: width .55s cubic-bezier(.2, .7, .3, 1); }
.progress.teal i { background: linear-gradient(90deg, var(--teal), #58a69a); }
.progress.gold i { background: linear-gradient(90deg, var(--gold), #d8b06b); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 10px 18px;
  border: 1px solid transparent; border-radius: 11px;
  background: transparent; color: var(--ink);
  font-size: 13px; font-weight: 600; line-height: 1.2;
  transition: transform .18s, background .18s, color .18s, border-color .18s, box-shadow .18s;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--ink); color: var(--surface); box-shadow: 0 8px 20px -14px rgba(22, 33, 46, .7); }
.btn-primary:hover { background: var(--accent); box-shadow: 0 10px 24px -14px rgba(189, 90, 53, .7); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 10px 24px -14px rgba(189, 90, 53, .75); }
.btn-accent:hover { background: var(--accent-deep); }
.btn-soft { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.btn-soft:hover { border-color: var(--line-strong); background: var(--surface-3); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn-outline { border-color: var(--line-strong); background: transparent; }
.btn-outline:hover { background: var(--surface-2); }
.btn-sm { min-height: 34px; padding: 7px 12px; font-size: 12px; border-radius: 9px; }
.btn-lg { min-height: 48px; padding: 13px 22px; font-size: 14px; border-radius: 12px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  color: var(--muted); font-size: 10.5px; line-height: 1.5;
  white-space: nowrap;
}
.chip.accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.chip.teal { color: var(--teal); background: var(--teal-soft); border-color: transparent; }
.chip.gold { color: var(--gold); background: var(--gold-soft); border-color: transparent; }
.chip.red { color: var(--red); background: var(--red-soft); border-color: transparent; }
.chip.blue { color: var(--blue); background: var(--blue-soft); border-color: transparent; }

.section { margin-top: 42px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.section-head .eyebrow { color: var(--accent); font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.section-head h2 { font-family: var(--font-display); font-size: 26px; line-height: 1.35; font-weight: 600; letter-spacing: .01em; margin-top: 3px; }
.section-head p { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.section-head .head-link { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.section-head .head-link:hover { color: var(--accent); }
.section-head .head-link svg { width: 14px; height: 14px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.empty {
  padding: 64px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.empty .empty-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 20px; background: var(--surface-2); color: var(--faint);
}
.empty .empty-icon svg { width: 28px; height: 28px; }
.empty h3 { font-family: var(--font-display); font-size: 21px; }
.empty p { color: var(--muted); font-size: 13px; margin-top: 6px; }
.empty .btn { margin-top: 18px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .72fr);
  gap: 32px; align-items: stretch;
  padding: 38px 40px;
  border-radius: var(--radius-xl);
  color: #f5efe1;
  background:
    radial-gradient(620px 320px at 92% 8%, rgba(215, 162, 100, .24), transparent 64%),
    radial-gradient(500px 360px at 4% 100%, rgba(83, 150, 144, .18), transparent 60%),
    linear-gradient(135deg, #17334d 0%, #10263c 52%, #0c1e30 100%);
  box-shadow: 0 34px 70px -38px rgba(12, 30, 48, .7);
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(110deg, transparent 30%, #000 100%);
  opacity: .55;
}
.hero::after {
  content: "∫";
  position: absolute; right: -18px; bottom: -92px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 330px; line-height: 1;
  color: rgba(236, 210, 165, .07);
  pointer-events: none;
}
.hero-main { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; }
.hero-kicker {
  display: inline-flex; align-items: center; gap: 9px;
  color: #dfc08d; font-size: 10.5px; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase;
}
.hero-kicker::before { content: ""; width: 22px; height: 1px; background: currentColor; opacity: .7; }
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 3.4vw, 46px);
  font-weight: 600; line-height: 1.22;
  letter-spacing: .015em;
  margin: 14px 0 12px;
  color: #fbf6ea;
}
.hero h1 em { font-style: normal; color: #e9c58a; }
.hero-sub { color: #b8c6d4; font-size: 13.5px; line-height: 1.9; max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.hero-actions .btn-primary { background: #f3ead7; color: #142b42; }
.hero-actions .btn-primary:hover { background: #e9c58a; color: #10263c; }
.hero-actions .btn-ghost { color: #c8d4df; }
.hero-actions .btn-ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.hero-stats {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; gap: 10px 26px;
  margin-top: 30px; padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, .12);
}
.hero-stat b { display: block; font-family: var(--font-display); font-size: 21px; font-weight: 600; color: #f6edda; line-height: 1.3; font-variant-numeric: tabular-nums; }
.hero-stat span { color: #93a8bb; font-size: 10.5px; letter-spacing: .04em; }

.hero-panel {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 24px 20px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 20px;
  background: rgba(255, 255, 255, .045);
  backdrop-filter: blur(8px);
}
.ring { position: relative; width: 164px; height: 164px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: rgba(255, 255, 255, .12); stroke-width: 8; }
.ring .value { fill: none; stroke: #e6c187; stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset .8s cubic-bezier(.2, .7, .3, 1); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center b { font-family: var(--font-display); font-size: 39px; font-weight: 600; line-height: 1; color: #fbf3e3; font-variant-numeric: tabular-nums; }
.ring-center span { margin-top: 7px; font-size: 10px; color: #a4b4c4; letter-spacing: .12em; }
.hero-panel-note { text-align: center; }
.hero-panel-note strong { display: block; font-size: 12px; color: #e7dcc7; font-weight: 600; }
.hero-panel-note span { display: block; margin-top: 3px; font-size: 10.5px; color: #93a8bb; }

/* ---------- Quick route ---------- */
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.quick-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.quick-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: var(--line-strong); }
.quick-top { display: flex; align-items: center; justify-content: space-between; }
.quick-icon {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 11px; background: var(--surface-2); color: var(--accent);
}
.quick-icon svg { width: 19px; height: 19px; }
.quick-card:nth-child(2) .quick-icon { color: var(--teal); background: var(--teal-soft); }
.quick-card:nth-child(3) .quick-icon { color: var(--red); background: var(--red-soft); }
.quick-label { color: var(--faint); font-size: 9.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.quick-card h3 { font-size: 15.5px; font-weight: 650; line-height: 1.45; }
.quick-card p { color: var(--muted); font-size: 12px; line-height: 1.65; min-height: 38px; }
.quick-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 4px; }
.quick-foot .go { color: var(--accent); font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.quick-foot .go svg { width: 13px; height: 13px; transition: transform .2s; }
.quick-card:hover .go svg { transform: translateX(3px); }

/* ---------- Chapter cards ---------- */
.subject-block { margin-top: 44px; }
.subject-head {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding-bottom: 14px; margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.subject-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.subject-title .num { font-family: Georgia, serif; font-size: 13px; color: var(--accent); letter-spacing: .05em; }
.subject-title h2 { font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: .03em; }
.subject-title span { color: var(--muted); font-size: 11.5px; }
.subject-progress { display: flex; align-items: center; gap: 10px; width: 190px; }
.subject-progress .progress { flex: 1; }
.subject-progress b { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.chapter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chapter-card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 21px 22px 18px;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface);
  transition: transform .22s, box-shadow .22s, border-color .22s;
  overflow: hidden;
}
.chapter-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--accent), transparent);
  opacity: 0; transition: opacity .22s;
}
.chapter-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-lift); }
.chapter-card:hover::before { opacity: 1; }
.chapter-card[data-subject="linear"]::before { background: linear-gradient(180deg, var(--teal), transparent); }
.chapter-card[data-subject="drawing"]::before { background: linear-gradient(180deg, var(--gold), transparent); }
.cc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cc-index { font-family: Georgia, serif; font-size: 11px; color: var(--faint); letter-spacing: .12em; }
.cc-tags { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
.cc-title { display: flex; align-items: baseline; gap: 8px; margin-top: 7px; }
.cc-title h3 { font-size: 18px; font-weight: 650; letter-spacing: .01em; }
.cc-title .en { font-family: Georgia, serif; font-size: 10px; color: var(--faint); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-desc { color: var(--muted); font-size: 11.5px; line-height: 1.7; margin-top: 7px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-bottom { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line-soft); }
.cc-bottom .progress { flex: 1; height: 4px; }
.cc-pct { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cc-go { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--muted); flex: none; transition: background .18s, color .18s, transform .18s; }
.cc-go svg { width: 13px; height: 13px; }
.chapter-card:hover .cc-go { background: var(--accent); color: #fff; transform: translateX(2px); }
.chapter-card[data-subject="linear"]:hover .cc-go { background: var(--teal); }
.chapter-card[data-subject="drawing"]:hover .cc-go { background: var(--gold); }

/* ---------- Home lower ---------- */
.home-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 16px; margin-top: 42px; }
.tips-panel { padding: 24px; }
.tips-panel h2 { font-family: var(--font-display); font-size: 23px; font-weight: 600; }
.tips-panel > p { color: var(--muted); font-size: 12px; margin-top: 4px; }
.tip { display: flex; gap: 13px; padding: 15px 0; border-bottom: 1px solid var(--line-soft); }
.tip:last-child { border-bottom: 0; padding-bottom: 0; }
.tip-num {
  width: 27px; height: 27px; flex: none; display: grid; place-items: center;
  border-radius: 8px; background: var(--surface-2); color: var(--accent);
  font-family: Georgia, serif; font-size: 12px;
}
.tip h3 { font-size: 13.5px; font-weight: 650; }
.tip p { color: var(--muted); font-size: 11.5px; line-height: 1.7; margin-top: 2px; }
.tip .chip { margin-top: 6px; }

.heat-panel { padding: 24px; display: flex; flex-direction: column; }
.heat-panel h2 { font-family: var(--font-display); font-size: 23px; font-weight: 600; }
.heat-panel p { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.heatmap { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; margin-top: 18px; }
.heat-cell { aspect-ratio: 1; border-radius: 3px; background: var(--surface-3); border: 1px solid transparent; }
.heat-cell[data-level="1"] { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); }
.heat-cell[data-level="2"] { background: color-mix(in srgb, var(--accent) 44%, var(--surface-2)); }
.heat-cell[data-level="3"] { background: color-mix(in srgb, var(--accent) 68%, var(--surface-2)); }
.heat-cell[data-level="4"] { background: var(--accent); }
.heat-legend { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; color: var(--faint); font-size: 9.5px; }
.heat-legend .scale { display: flex; align-items: center; gap: 4px; }
.heat-legend .scale i { width: 9px; height: 9px; border-radius: 2px; background: var(--surface-3); display: block; }
.heat-legend .scale i:nth-child(2) { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); }
.heat-legend .scale i:nth-child(3) { background: color-mix(in srgb, var(--accent) 44%, var(--surface-2)); }
.heat-legend .scale i:nth-child(4) { background: color-mix(in srgb, var(--accent) 68%, var(--surface-2)); }
.heat-legend .scale i:nth-child(5) { background: var(--accent); }

.exam-banner {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 22px;
  margin-top: 42px; padding: 26px 30px;
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
}
.exam-banner::after {
  content: "45:00"; position: absolute; right: 170px; bottom: -22px;
  font-family: Georgia, serif; font-size: 90px; color: var(--ink); opacity: .04;
  pointer-events: none;
}
.exam-banner h2 { font-family: var(--font-display); font-size: 23px; font-weight: 600; }
.exam-banner p { color: var(--muted); font-size: 12px; margin-top: 4px; }
.exam-banner .btn { flex: none; position: relative; z-index: 1; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 8px; flex: none; position: relative; z-index: 1; }

/* ---------- Chapter page ---------- */
.chapter-page { max-width: 980px; margin: 0 auto; }
.chapter-hero {
  position: relative; overflow: hidden;
  padding: 32px 36px 30px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background:
    radial-gradient(500px 220px at 100% 0%, var(--accent-soft), transparent 70%),
    var(--surface);
}
.chapter-hero[data-subject="linear"] {
  background:
    radial-gradient(500px 220px at 100% 0%, var(--teal-soft), transparent 70%),
    var(--surface);
}
.chapter-hero[data-subject="drawing"] {
  background:
    radial-gradient(500px 220px at 100% 0%, var(--gold-soft), transparent 70%),
    var(--surface);
}
.chapter-hero::after {
  content: attr(data-mark);
  position: absolute; right: 22px; top: -18px;
  font-family: Georgia, serif; font-size: 120px; line-height: 1;
  color: var(--ink); opacity: .035; pointer-events: none;
}
.chapter-hero-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.chapter-hero h1 { font-family: var(--font-display); font-size: clamp(28px, 3vw, 38px); font-weight: 600; letter-spacing: .02em; margin-top: 8px; line-height: 1.3; }
.chapter-hero .en { font-family: Georgia, serif; font-style: italic; color: var(--faint); font-size: 12px; margin-top: 2px; }
.chapter-intro { color: var(--muted); font-size: 13px; line-height: 1.9; max-width: 690px; margin-top: 13px; }
.chapter-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chapter-meta .chip { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.chapter-progress-row { display: flex; align-items: center; gap: 14px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.chapter-progress-row .progress { flex: 1; max-width: 360px; }
.chapter-progress-row b { font-family: var(--font-display); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chapter-progress-row small { color: var(--muted); font-size: 10.5px; }
.chapter-progress-row .btn { margin-left: auto; }

.map-wrap { margin-top: 24px; }
.map-title { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 10px; }
.map-title::before { content: ""; width: 14px; height: 1px; background: var(--accent); }
.map-flow { display: flex; align-items: stretch; gap: 0; }
.map-step {
  flex: 1; position: relative;
  padding: 14px 16px 13px;
  border: 1px solid var(--line); background: var(--surface);
}
.map-step:first-child { border-radius: 12px 0 0 12px; }
.map-step:last-child { border-radius: 0 12px 12px 0; }
.map-step + .map-step { border-left: 0; }
.map-step::after {
  content: ""; position: absolute; right: -5px; top: 50%; z-index: 2;
  width: 9px; height: 9px; transform: translateY(-50%) rotate(45deg);
  border-top: 1px solid var(--line); border-right: 1px solid var(--line);
  background: var(--surface);
}
.map-step:last-child::after { display: none; }
.map-step b { display: block; font-size: 12.5px; font-weight: 650; }
.map-step span { display: block; color: var(--faint); font-size: 10px; margin-top: 2px; line-height: 1.5; }

.kp-list { margin-top: 26px; display: flex; flex-direction: column; gap: 16px; }
.kp-card {
  position: relative;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  scroll-margin-top: 88px;
  transition: border-color .2s, box-shadow .2s;
}
.kp-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.kp-card.is-read { border-color: color-mix(in srgb, var(--teal) 38%, var(--line)); }
.kp-card.is-highlight { animation: kp-highlight 1.6s ease; }
@keyframes kp-highlight {
  0% { box-shadow: 0 0 0 0 rgba(189, 90, 53, .28); border-color: var(--accent); }
  45% { box-shadow: 0 0 0 6px rgba(189, 90, 53, .12); border-color: var(--accent); }
  100% { box-shadow: var(--shadow-sm); border-color: var(--line); }
}
.kp-head { display: flex; align-items: flex-start; gap: 14px; }
.kp-num {
  flex: none; width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--accent);
  font-family: Georgia, serif; font-size: 12px;
}
.kp-card.is-read .kp-num { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.kp-head-main { flex: 1; min-width: 0; }
.kp-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.kp-title-row h2 { font-size: 18px; font-weight: 650; line-height: 1.5; }
.kp-toggle {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 10.5px;
  transition: all .18s;
}
.kp-toggle svg { width: 13px; height: 13px; }
.kp-toggle:hover { border-color: var(--teal); color: var(--teal); }
.kp-toggle.on { background: var(--teal-soft); border-color: transparent; color: var(--teal); }
.kp-summary { color: var(--muted); font-size: 12.5px; line-height: 1.85; margin-top: 7px; }
.kp-formulas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 16px; }
.formula-box {
  min-width: 0;
  padding: 12px 14px 11px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.formula-box.wide { grid-column: 1 / -1; }
.kp-formulas > .formula-box:last-child:nth-child(odd):not(.wide) { grid-column: 1 / -1; }
.formula-box .label { display: block; color: var(--faint); font-size: 9.5px; letter-spacing: .04em; margin-bottom: 5px; }
.formula-tex { overflow-x: auto; overflow-y: hidden; font-size: 13px; scrollbar-width: thin; }
.formula-tex mjx-container { margin: 0 !important; }
.formula-tex mjx-container[display="true"] { margin: 2px 0 !important; }
.kp-points { list-style: none; margin-top: 16px; display: grid; gap: 7px; }
.kp-points li { position: relative; padding-left: 17px; color: var(--ink-2); font-size: 12.5px; line-height: 1.8; }
.kp-points li::before { content: ""; position: absolute; left: 2px; top: .78em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: .65; }
.callouts { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 16px; }
.callout { padding: 12px 14px; border-radius: 10px; font-size: 11.5px; line-height: 1.75; border: 1px solid transparent; }
.callout b { display: flex; align-items: center; gap: 5px; font-size: 10px; letter-spacing: .08em; margin-bottom: 3px; white-space: nowrap; }
.callout b svg { width: 13px; height: 13px; }
.callout.tip { background: var(--gold-soft); color: #7a5b21; }
.callout.tip b { color: var(--gold); }
.callout.warn { background: var(--red-soft); color: #85372f; }
.callout.warn b { color: var(--red); }
[data-theme="dark"] .callout.tip { color: #e0c28e; }
[data-theme="dark"] .callout.warn { color: #e9aaa3; }

.examples-block { margin-top: 34px; }
.examples-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.examples-head h2 { font-family: var(--font-display); font-size: 25px; font-weight: 600; }
.examples-head p { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.example { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; }
.example summary {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  cursor: pointer; list-style: none;
  transition: background .18s;
}
.example summary::-webkit-details-marker { display: none; }
.example summary:hover { background: var(--surface-2); }
.example .ex-mark {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center;
  border-radius: 7px; background: var(--accent-soft); color: var(--accent);
  font-family: Georgia, serif; font-size: 11px;
}
.example .ex-title { font-size: 13.5px; font-weight: 650; }
.example .ex-tag { margin-left: auto; }
.example .ex-chevron { width: 15px; height: 15px; color: var(--faint); transition: transform .2s; }
.example[open] .ex-chevron { transform: rotate(180deg); }
.example-body { padding: 4px 20px 20px 58px; border-top: 1px solid var(--line-soft); }
.example-q { color: var(--ink-2); font-size: 13px; line-height: 1.9; margin-top: 14px; }
.example-steps { list-style: none; margin-top: 12px; display: grid; gap: 8px; counter-reset: step; }
.example-steps li { position: relative; padding-left: 28px; color: var(--muted); font-size: 12.5px; line-height: 1.9; counter-increment: step; }
.example-steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 3px;
  width: 18px; height: 18px; display: grid; place-items: center;
  border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--faint); font-size: 9.5px;
}
.example-answer {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 14px; padding: 7px 12px;
  border-radius: 8px; background: var(--teal-soft); color: var(--teal);
  font-size: 12px; font-weight: 600;
}
.example-answer b { font-size: 9.5px; letter-spacing: .08em; opacity: .8; }

.chapter-quiz-cta {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  margin-top: 34px; padding: 28px 30px;
  border-radius: var(--radius-lg);
  color: #f4ecdc;
  background: linear-gradient(130deg, #1a3a56, #10263c);
}
.chapter-quiz-cta::after {
  content: "?"; position: absolute; right: 150px; top: -28px;
  font-family: var(--font-display); font-size: 150px; color: rgba(255, 255, 255, .05);
}
.chapter-quiz-cta h2 { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.chapter-quiz-cta p { color: #a9bdcd; font-size: 11.5px; margin-top: 4px; }
.chapter-quiz-cta .btn { flex: none; position: relative; z-index: 1; }
.chapter-quiz-cta .btn-accent { background: #e9c58a; color: #142b42; }
.chapter-quiz-cta .btn-accent:hover { background: #f4d7a6; }

.chapter-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }
.chapter-nav a {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
  padding: 13px 16px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); font-size: 12px; transition: border-color .18s, background .18s;
}
.chapter-nav a:hover { border-color: var(--line-strong); background: var(--surface-2); }
.chapter-nav a.next { text-align: right; }
.chapter-nav span { color: var(--faint); font-size: 9.5px; letter-spacing: .08em; }
.chapter-nav b { font-weight: 600; }

/* ---------- Quiz ---------- */
.quiz-page { max-width: 1120px; margin: 0 auto; }
.quiz-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 16px; align-items: start; }
.quiz-layout > .q-card { min-width: 0; }
.quiz-side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 10px; }
.quiz-side-card { padding: 16px 16px 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.quiz-side-kicker { color: var(--accent); font-size: 8.5px; font-weight: 700; letter-spacing: .12em; }
.quiz-side-card h3 { margin-top: 5px; font-family: var(--font-display); font-size: 20px; font-weight: 600; line-height: 1.35; }
.quiz-side-card p { margin-top: 5px; color: var(--muted); font-size: 10.5px; line-height: 1.7; }
.quiz-side-add {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 39px; margin-top: 12px; padding: 8px 10px;
  border: 1px solid var(--accent); border-radius: 9px;
  background: var(--accent); color: #fff;
  font-size: 10.5px; font-weight: 600;
  transition: background .18s, border-color .18s, color .18s;
}
.quiz-side-add:hover { background: var(--accent-strong, var(--ink)); border-color: var(--ink); }
.quiz-side-add svg { width: 14px; height: 14px; }
.quiz-side-add.added { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.quiz-side-add.added:hover { background: var(--green-soft); border-color: var(--green); }
.quiz-side-note { margin-top: 8px; color: var(--faint); font-size: 9px; line-height: 1.6; text-align: center; }
.quiz-side-meta { background: var(--surface-2); }
.quiz-side-stats { display: flex; gap: 18px; margin-top: 12px; }
.quiz-side-stats b { display: block; font-family: var(--font-display); font-size: 25px; font-weight: 600; line-height: 1; }
.quiz-side-stats span { display: block; margin-top: 3px; color: var(--faint); font-size: 8.5px; }
.quiz-side-hint { display: flex; align-items: flex-start; gap: 6px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 9.5px; line-height: 1.6; }
.quiz-side-hint svg { width: 12px; height: 12px; flex: none; margin-top: 2px; color: var(--gold); }
.quiz-top { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.quiz-top-left { display: flex; align-items: center; gap: 12px; }
.quiz-back { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--surface); }
.quiz-back:hover { color: var(--ink); border-color: var(--line-strong); }
.quiz-title-sm { font-size: 12px; color: var(--muted); }
.quiz-title-sm b { display: block; color: var(--ink); font-size: 14px; font-weight: 650; }
.quiz-counter { font-family: var(--font-display); font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; }
.quiz-counter span { font-family: var(--font-ui); font-size: 11px; color: var(--faint); }
.quiz-progress { display: flex; gap: 5px; margin-bottom: 20px; }
.quiz-progress i { height: 4px; flex: 1; border-radius: 99px; background: var(--surface-3); transition: background .3s; }
.quiz-progress i.done { background: var(--teal); }
.quiz-progress i.current { background: var(--accent); }
.quiz-progress i.right { background: var(--green); }
.quiz-progress i.wrong { background: var(--red); }

.q-card { padding: 32px 34px 28px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-sm); }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 14px; }
.q-stem { font-size: 18px; line-height: 1.95; color: var(--ink); }
.q-stem p + p { margin-top: 8px; }
.q-stem mjx-container { font-size: 1.02em !important; }
.options { display: grid; gap: 9px; margin-top: 22px; }
.option {
  display: flex; align-items: flex-start; gap: 13px;
  width: 100%; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink-2);
  text-align: left; font-size: 13px; line-height: 1.8;
  transition: border-color .16s, background .16s, transform .16s;
}
.option:hover { border-color: var(--line-strong); background: var(--surface-2); }
.option .letter {
  flex: none; width: 25px; height: 25px; display: grid; place-items: center;
  border-radius: 7px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted);
  font-family: Georgia, serif; font-size: 11px; transition: all .16s;
}
.option.selected { border-color: var(--ink); background: var(--surface-2); }
.option.selected .letter { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.option.correct { border-color: var(--green); background: var(--green-soft); color: var(--ink); }
.option.correct .letter { background: var(--green); color: #fff; border-color: var(--green); }
.option.wrong { border-color: var(--red); background: var(--red-soft); color: var(--ink); }
.option.wrong .letter { background: var(--red); color: #fff; border-color: var(--red); }
.option[disabled] { cursor: default; }
.option .option-tex { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.option .option-tex::-webkit-scrollbar { width: 0; height: 0; display: none; }
.option .option-tex mjx-container { margin: 0 !important; }

.fill-wrap { margin-top: 22px; }
.fill-label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 7px; }
.fill-input {
  width: 100%; height: 54px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-2); color: var(--ink);
  font-family: var(--font-mono); font-size: 17px;
  transition: border-color .18s, background .18s;
}
.fill-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.fill-input.correct { border-color: var(--green); background: var(--green-soft); }
.fill-input.wrong { border-color: var(--red); background: var(--red-soft); }
.fill-hint { color: var(--faint); font-size: 10.5px; margin-top: 6px; }

.feedback { margin-top: 20px; padding: 16px 18px; border-radius: 12px; border: 1px solid transparent; animation: rise .28s ease both; }
.feedback.ok { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.feedback.no { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.feedback-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.feedback.ok .feedback-head { color: var(--green); }
.feedback.no .feedback-head { color: var(--red); }
.feedback-head svg { width: 17px; height: 17px; }
.feedback-answer { margin-top: 7px; font-size: 12px; color: var(--ink-2); }
.feedback-explain { margin-top: 6px; font-size: 12px; line-height: 1.85; color: var(--muted); }
.feedback-explain mjx-container { font-size: 1em !important; }

.course-hint {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  text-decoration: none;
  transition: border-color .18s, background .18s;
}
.course-hint:hover { border-color: var(--accent); background: var(--accent-soft); }
.course-hint-icon {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border-radius: 8px; background: var(--accent-soft); color: var(--accent);
}
.course-hint-icon svg { width: 14px; height: 14px; }
.course-hint-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.course-hint-main small { color: var(--faint); font-size: 8.5px; letter-spacing: .03em; }
.course-hint-main b { font-size: 11px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-hint-main > span { color: var(--muted); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-hint-go { display: flex; align-items: center; gap: 2px; flex: none; color: var(--accent); font-size: 9.5px; font-weight: 600; white-space: nowrap; }
.course-hint-go svg { width: 12px; height: 12px; }

/* 隐藏滚动条轨道，保留滚动功能 */
html { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { width: 0; height: 0; display: none; }
.sidebar-scroll, .auth-panel, .search-panel, .rank-board, .modal-panel,
.formula-tex, .option .option-tex, .q-stem, .feedback-explain { scrollbar-width: none; }
.sidebar-scroll::-webkit-scrollbar, .auth-panel::-webkit-scrollbar, .search-panel::-webkit-scrollbar,
.rank-board::-webkit-scrollbar, .formula-tex::-webkit-scrollbar, .option .option-tex::-webkit-scrollbar,
.q-stem::-webkit-scrollbar, .feedback-explain::-webkit-scrollbar { width: 0; height: 0; display: none; }
mjx-container[display="true"] { scrollbar-width: none; }
mjx-container[display="true"]::-webkit-scrollbar { width: 0; height: 0; display: none; }

.q-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.q-actions .left { color: var(--faint); font-size: 10.5px; }
.q-actions .right { display: flex; gap: 9px; margin-left: auto; }

.result { max-width: 820px; margin: 0 auto; }
.result-hero { position: relative; overflow: hidden; padding: 36px; border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--line); text-align: center; }
.result-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(400px 200px at 50% 0%, var(--accent-soft), transparent 70%); opacity: .7; }
.result-hero > * { position: relative; }
.result-kicker { color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.result-score { font-family: var(--font-display); font-size: 66px; line-height: 1.1; margin-top: 8px; font-variant-numeric: tabular-nums; }
.result-score small { font-size: 18px; color: var(--faint); }
.result-title { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin-top: 4px; }
.result-sub { color: var(--muted); font-size: 12px; margin-top: 6px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0 4px; }
.result-stat { padding: 14px 10px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 72%, transparent); border: 1px solid var(--line-soft); }
.result-stat b { display: block; font-family: var(--font-display); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.result-stat span { color: var(--muted); font-size: 10px; }
.result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.result-review { margin-top: 18px; }
.review-item { display: flex; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); margin-top: 8px; }
.review-item .ri-mark { width: 23px; height: 23px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.review-item.ok .ri-mark { background: var(--green-soft); color: var(--green); }
.review-item.no .ri-mark { background: var(--red-soft); color: var(--red); }
.review-item .ri-main { flex: 1; min-width: 0; }
.review-item .ri-stem { font-size: 12.5px; line-height: 1.8; }
.review-item .ri-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.review-item .ri-explain { color: var(--muted); font-size: 11.5px; line-height: 1.8; margin-top: 7px; display: none; }
.review-item.open .ri-explain { display: block; }
.review-item .ri-toggle { border: 0; background: transparent; color: var(--accent); font-size: 10.5px; padding: 0; white-space: nowrap; align-self: flex-start; }

/* ---------- Exam ---------- */
.exam-page { max-width: 1040px; margin: 0 auto; }
.exam-hub-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.exam-hub-card {
  display: flex; flex-direction: column; gap: 7px;
  padding: 20px 20px 17px;
  border: 1px solid var(--line); border-radius: 15px;
  background: var(--surface); color: var(--ink);
  text-decoration: none;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.exam-hub-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-lift); }
.exam-hub-card[data-subject="linear"] { background: linear-gradient(160deg, var(--teal-soft), var(--surface) 70%); }
.exam-hub-card[data-subject="drawing"] { background: linear-gradient(160deg, var(--gold-soft), var(--surface) 70%); }
.exam-hub-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.exam-hub-top > span:last-child { color: var(--faint); font-size: 9.5px; }
.exam-hub-card h2 { margin-top: 6px; font-family: var(--font-display); font-size: 22px; font-weight: 600; line-height: 1.35; }
.exam-hub-card p { color: var(--muted); font-size: 10.5px; line-height: 1.6; }
.exam-hub-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 11px; border-top: 1px solid var(--line-soft); color: var(--faint); font-size: 9.5px; }
.exam-hub-foot b { display: flex; align-items: center; gap: 4px; color: var(--accent); font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.exam-hub-foot svg { width: 12px; height: 12px; }
.exam-intro { position: relative; overflow: hidden; padding: 34px 36px; border-radius: var(--radius-xl); background: linear-gradient(135deg, #17334d, #0f2438); color: #f2ead9; }
.exam-intro::after { content: "EXAM"; position: absolute; right: 24px; bottom: -18px; font-family: Georgia, serif; font-size: 100px; color: rgba(255, 255, 255, .05); letter-spacing: .08em; }
.exam-intro .hero-kicker { color: #dfc08d; }
.exam-intro h1 { font-family: var(--font-display); font-size: 34px; font-weight: 600; margin-top: 10px; }
.exam-intro p { color: #b8c6d4; font-size: 12.5px; line-height: 1.9; max-width: 660px; margin-top: 8px; }
.exam-facts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.exam-fact { padding: 9px 14px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 9px; background: rgba(255, 255, 255, .05); font-size: 11px; color: #d9e1e9; }
.exam-fact b { color: #f0d7a8; margin-right: 4px; }
.exam-intro .btn { margin-top: 22px; background: #e9c58a; color: #142b42; }
.exam-intro .btn:hover { background: #f4d7a6; }

.exam-run-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 18px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
}
.exam-timer { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.exam-timer svg { width: 17px; height: 17px; color: var(--accent); }
.exam-timer.low { color: var(--red); }
.exam-timer.low svg { color: var(--red); }
.exam-run-meta { color: var(--muted); font-size: 11px; }
.exam-grid { display: grid; grid-template-columns: minmax(0, 1fr) 214px; gap: 16px; align-items: start; }
.exam-palette { position: sticky; top: 84px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.exam-palette h3 { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .08em; margin-bottom: 10px; }
.palette-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.palette-btn {
  aspect-ratio: 1; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); color: var(--muted);
  font-size: 11px; font-variant-numeric: tabular-nums;
  transition: all .15s;
}
.palette-btn:hover { border-color: var(--line-strong); }
.palette-btn.answered { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.palette-btn.current { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.palette-legend { display: flex; gap: 12px; margin-top: 12px; color: var(--faint); font-size: 9.5px; }
.palette-legend span { display: flex; align-items: center; gap: 4px; }
.palette-legend i { width: 7px; height: 7px; border-radius: 2px; background: var(--teal-soft); display: block; }
.palette-legend span:last-child i { background: var(--ink); }
.exam-palette .btn { width: 100%; margin-top: 14px; }
.exam-main .q-card { padding: 26px 28px 24px; }
.exam-note {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 11px; padding: 11px 14px;
  border: 1px dashed var(--line-strong); border-radius: 10px;
  color: var(--muted); font-size: 10.5px; line-height: 1.7;
}
.exam-note svg { width: 14px; height: 14px; flex: none; margin-top: 3px; color: var(--accent); }
.exam-note b { color: var(--ink-2); font-weight: 600; }

/* ---------- Mistakes ---------- */
.mistakes-page { max-width: 980px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-head .eyebrow { color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.page-head h1 { font-family: var(--font-display); font-size: 34px; font-weight: 600; line-height: 1.3; margin-top: 4px; }
.page-head p { color: var(--muted); font-size: 12px; margin-top: 5px; max-width: 600px; }
.mistake-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.m-stat { padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.m-stat b { display: block; font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.m-stat span { color: var(--muted); font-size: 10.5px; }
.m-stat.hot b { color: var(--red); }
.mistake-list { display: flex; flex-direction: column; gap: 10px; }
.mistake-card { padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.mistake-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.mistake-stem { font-size: 13.5px; line-height: 1.9; color: var(--ink-2); }
.mistake-answer { margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 11.5px; line-height: 1.8; }
.mistake-answer b { color: var(--teal); }
.mistake-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.mistake-foot .when { color: var(--faint); font-size: 10px; }
.mistake-foot .acts { display: flex; gap: 6px; }

/* ---------- Formulas ---------- */
.formulas-page { max-width: 1040px; margin: 0 auto; }
.formula-toolbar { position: sticky; top: calc(var(--topbar-h) + 10px); z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); }
.formula-search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px; height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.formula-search svg { width: 15px; height: 15px; color: var(--faint); flex: none; }
.formula-search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 12px; }
.filter-chips { display: flex; gap: 5px; }
.filter-chip { height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; }
.filter-chip.active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.formula-toolbar .btn { height: 32px; min-height: 32px; padding: 0 11px; font-size: 11px; }
.formula-group { margin-top: 26px; }
.formula-group-head { display: flex; align-items: baseline; gap: 10px; padding-bottom: 9px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.formula-group-head h2 { font-size: 15px; font-weight: 650; }
.formula-group-head span { color: var(--faint); font-size: 10px; }
.formula-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.formula-card { position: relative; padding: 15px 16px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.formula-card .fc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.formula-card .fc-label { color: var(--muted); font-size: 10.5px; font-weight: 600; }
.formula-card .fc-copy { opacity: 0; border: 0; background: transparent; color: var(--faint); padding: 2px; transition: opacity .16s, color .16s; }
.formula-card:hover .fc-copy { opacity: 1; }
.formula-card .fc-copy:hover { color: var(--accent); }
.formula-card .fc-copy svg { width: 14px; height: 14px; }
.formula-card .formula-tex { font-size: 13px; }
.formulas-page.masked .formula-card .formula-tex { filter: blur(7px); opacity: .3; transition: filter .25s, opacity .25s; }
.formulas-page.masked .formula-card.revealed .formula-tex { filter: none; opacity: 1; }
.formulas-page.masked .formula-card:not(.revealed) { cursor: pointer; }
.formulas-page.masked .formula-card:not(.revealed)::after {
  content: "点击回忆";
  position: absolute; right: 12px; bottom: 9px;
  color: var(--faint); font-size: 9px; letter-spacing: .04em;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: 99px; padding: 1px 7px; pointer-events: none;
}
.print-only { display: none; }

/* ---------- Courses ---------- */
.courses-page { max-width: 1040px; margin: 0 auto; }
.courses-hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(230px, .6fr);
  gap: 28px; align-items: center;
  padding: 34px 36px;
  border-radius: var(--radius-xl);
  color: #f4ecdc;
  background:
    radial-gradient(520px 260px at 92% 5%, rgba(107, 183, 171, .2), transparent 65%),
    linear-gradient(135deg, #173a3a, #102a31 55%, #0d2029);
  box-shadow: 0 30px 60px -36px rgba(10, 32, 40, .7);
}
.courses-hero::after {
  content: "▶"; position: absolute; right: 18px; bottom: -46px;
  font-family: Georgia, serif; font-size: 180px; color: rgba(255, 255, 255, .045);
  pointer-events: none;
}
.courses-hero-main { position: relative; z-index: 1; }
.courses-hero h1 { font-family: var(--font-display); font-size: clamp(28px, 3.1vw, 39px); font-weight: 600; line-height: 1.3; margin-top: 11px; letter-spacing: .01em; }
.courses-hero p { color: #b7cbc9; font-size: 12.5px; line-height: 1.9; max-width: 650px; margin-top: 10px; }
.course-progress-row { display: flex; align-items: center; gap: 14px; margin-top: 22px; padding-top: 17px; border-top: 1px solid rgba(255, 255, 255, .13); }
.course-progress-copy { display: flex; align-items: baseline; gap: 7px; flex: none; }
.course-progress-copy b { font-family: var(--font-display); font-size: 25px; font-weight: 600; color: #f5e5c8; font-variant-numeric: tabular-nums; }
.course-progress-copy b span { font-size: 12px; color: #9db5b3; }
.course-progress-copy small { color: #9db5b3; font-size: 9.5px; }
.course-progress-row .progress { flex: 1; max-width: 260px; height: 5px; background: rgba(255, 255, 255, .12); }
.course-progress-row .progress i { background: linear-gradient(90deg, #6dbdb1, #e6c187); }
.course-progress-pct { color: #d8c8a9; font-family: var(--font-mono); font-size: 11px; }
.courses-hero-side { position: relative; z-index: 1; display: grid; gap: 8px; }
.course-hero-stat { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 11px 14px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px; background: rgba(255, 255, 255, .04); }
.course-hero-stat b { font-family: var(--font-display); font-size: 24px; font-weight: 600; color: #f0d7a8; }
.course-hero-stat span { color: #a9c0be; font-size: 9.5px; }

.course-source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.course-source {
  position: relative; overflow: hidden;
  display: flex; gap: 16px;
  padding: 22px 22px 20px;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface);
}
.course-source-mark {
  width: 54px; height: 54px; flex: none;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--accent-soft); color: var(--accent);
  font-family: Georgia, serif; font-size: 29px; line-height: 1;
}
.course-source[data-subject="linear"] .course-source-mark { background: var(--teal-soft); color: var(--teal); }
.course-source-body { min-width: 0; flex: 1; }
.course-source-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.course-source-pages { color: var(--faint); font-family: var(--font-mono); font-size: 10px; }
.course-source h2 { font-family: var(--font-display); font-size: 22px; font-weight: 600; line-height: 1.35; margin-top: 7px; }
.course-source-sub { color: var(--accent); font-size: 10px; letter-spacing: .02em; margin-top: 2px; }
.course-source p { color: var(--muted); font-size: 11px; line-height: 1.75; margin-top: 8px; }
.course-source-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--faint); font-size: 9.5px; margin-top: 9px; }
.course-source .btn { margin-top: 12px; }

.course-how { margin-top: 34px; }
.course-how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.course-step { position: relative; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.course-step-no { font-family: Georgia, serif; font-size: 12px; color: var(--accent); }
.course-step h3 { font-size: 13.5px; font-weight: 650; margin-top: 9px; }
.course-step p { color: var(--muted); font-size: 11px; line-height: 1.75; margin-top: 5px; }

.course-note {
  display: flex; align-items: flex-start; gap: 9px;
  margin-top: 18px; padding: 13px 15px;
  border: 1px dashed var(--line-strong); border-radius: 11px;
  color: var(--muted); font-size: 10.5px; line-height: 1.75;
}
.course-note svg { width: 14px; height: 14px; flex: none; margin-top: 3px; color: var(--accent); }

.course-group { margin-top: 28px; }
.course-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 9px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.course-group-head h2 { font-family: var(--font-display); font-size: 23px; font-weight: 600; }
.course-group-head span { color: var(--faint); font-size: 10px; }
.course-list { display: flex; flex-direction: column; gap: 7px; }
.course-row {
  display: grid; grid-template-columns: 38px minmax(0, 1fr) 132px auto;
  gap: 14px; align-items: center;
  padding: 15px 16px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface);
  scroll-margin-top: 88px;
  transition: border-color .18s, background .18s;
}
.course-row:hover { border-color: var(--line-strong); }
.course-row.watched { background: color-mix(in srgb, var(--teal-soft) 45%, var(--surface)); border-color: color-mix(in srgb, var(--teal) 26%, var(--line)); }
.course-row-no { font-family: Georgia, serif; font-size: 11px; color: var(--faint); }
.course-row-title { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.course-row-title h3 { font-size: 14px; font-weight: 650; }
.course-row-title h3 a:hover { color: var(--accent); }
.course-row-main p { color: var(--muted); font-size: 10.5px; line-height: 1.65; margin-top: 3px; }
.course-range { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line-soft); }
.course-range b { color: var(--ink-2); font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.course-range span { color: var(--accent); font-size: 9px; }
.course-range:hover { border-color: var(--accent); }
.course-row-actions { display: flex; align-items: center; gap: 5px; justify-content: flex-end; }
.course-row-actions .btn { min-height: 31px; padding: 6px 9px; font-size: 10.5px; }
.course-row.is-highlight { animation: kp-highlight 1.6s ease; }
.chapter-meta a.chip:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 36%, var(--line)); }

/* ---------- Adaptive plan ---------- */
.adaptive-plan {
  margin-top: 18px;
  padding: 26px 26px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.adaptive-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.adaptive-head .eyebrow { color: var(--teal); font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.adaptive-head h2 { font-family: var(--font-display); font-size: 26px; font-weight: 600; margin-top: 3px; }
.adaptive-head p { color: var(--muted); font-size: 11.5px; line-height: 1.75; max-width: 660px; margin-top: 5px; }
.adaptive-head > .chip { flex: none; margin-top: 4px; }

.schedule-settings {
  display: grid; grid-template-columns: 1.05fr .8fr .8fr auto auto;
  gap: 12px; align-items: end;
  margin-top: 18px; padding: 15px;
  border: 1px solid var(--line-soft); border-radius: 12px;
  background: var(--surface-2);
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { color: var(--muted); font-size: 10px; font-weight: 600; }
.field input, .field select {
  width: 100%; height: 40px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font-size: 12px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field small { color: var(--faint); font-size: 9px; }
.number-field { position: relative; }
.number-field input { padding-right: 44px; font-family: var(--font-mono); }
.number-field em { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 9.5px; font-style: normal; pointer-events: none; }
.schedule-settings .btn { min-height: 40px; align-self: end; }

.schedule-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.schedule-kpi { padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface); }
.schedule-kpi b { display: block; font-family: var(--font-display); font-size: 23px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.schedule-kpi span { color: var(--muted); font-size: 9.5px; }

.schedule-meter { margin-top: 15px; }
.schedule-meter-head { display: flex; align-items: baseline; gap: 10px; color: var(--muted); font-size: 10px; margin-bottom: 6px; }
.schedule-meter-head b { color: var(--ink); font-family: var(--font-mono); font-size: 11px; }
.schedule-meter-head span:last-child { margin-left: auto; color: var(--faint); }
.schedule-meter .progress { height: 6px; }
.schedule-meter .progress i { background: linear-gradient(90deg, var(--teal), #7bbdb0); }

.schedule-status {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 14px; padding: 12px 14px;
  border: 1px solid transparent; border-radius: 10px;
}
.schedule-status > svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.schedule-status b { display: block; font-size: 12px; font-weight: 700; }
.schedule-status p { font-size: 10.5px; line-height: 1.7; margin-top: 2px; }
.schedule-status-side { margin-left: auto; align-self: center; font-size: 9.5px; white-space: nowrap; opacity: .8; }
.schedule-status.good { color: #286347; background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 24%, transparent); }
.schedule-status.ok { color: var(--blue); background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 22%, transparent); }
.schedule-status.tight { color: #7a5b21; background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 26%, transparent); }
.schedule-status.bad { color: #85372f; background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
[data-theme="dark"] .schedule-status.good { color: #9ed7b8; }
[data-theme="dark"] .schedule-status.tight { color: #e0c28e; }
[data-theme="dark"] .schedule-status.bad { color: #e9aaa3; }

.schedule-days-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 22px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.schedule-days-head h3 { font-size: 13px; font-weight: 650; }
.schedule-days-head span { color: var(--faint); font-size: 9.5px; }
.schedule-days { display: flex; flex-direction: column; }
.schedule-day { display: grid; grid-template-columns: 92px minmax(0, 1fr) 54px; gap: 14px; align-items: start; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.schedule-day.today { margin-top: 8px; padding: 13px 12px; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: 10px; background: color-mix(in srgb, var(--accent-soft) 32%, var(--surface)); }
.day-date b { display: block; font-family: var(--font-mono); font-size: 15px; font-weight: 600; line-height: 1.35; }
.day-date span { display: block; color: var(--faint); font-size: 9px; margin-top: 2px; }
.day-tasks { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.day-task { display: flex; align-items: flex-start; gap: 8px; }
.task-bullet { width: 6px; height: 6px; flex: none; margin-top: 6px; border-radius: 50%; background: var(--accent); opacity: .7; }
.day-task.review .task-bullet { background: var(--teal); }
.task-copy { min-width: 0; flex: 1; }
.task-copy b { display: block; font-size: 11px; font-weight: 600; line-height: 1.6; }
.task-copy em { display: block; color: var(--muted); font-size: 9.5px; font-style: normal; line-height: 1.55; }
.task-minutes { flex: none; color: var(--faint); font-family: var(--font-mono); font-size: 10px; padding-top: 1px; }
.task-minutes small { font-size: 8px; margin-left: 1px; }
.day-total { text-align: right; padding-top: 1px; }
.day-total b { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.day-total span { display: block; color: var(--faint); font-size: 8.5px; }
.schedule-empty { padding: 24px; margin-top: 10px; border: 1px dashed var(--line-strong); border-radius: 10px; color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 8px; }
.schedule-empty svg { width: 16px; height: 16px; color: var(--red); }
.schedule-foot { display: flex; flex-wrap: wrap; gap: 7px 16px; justify-content: space-between; margin-top: 14px; color: var(--faint); font-size: 9.5px; line-height: 1.6; }
.schedule-warning { color: var(--red); }

.plan-template-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-top: 32px; }
.plan-template-head .eyebrow { color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.plan-template-head h2 { font-family: var(--font-display); font-size: 25px; font-weight: 600; margin-top: 2px; }
.plan-template-head > span { color: var(--faint); font-size: 10px; }

/* ---------- Plan ---------- */
.plan-page { max-width: 980px; margin: 0 auto; }
.plan-hero { display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 30px 34px; border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--line); }
.plan-hero h1 { font-family: var(--font-display); font-size: 34px; font-weight: 600; }
.plan-hero p { color: var(--muted); font-size: 12px; margin-top: 5px; max-width: 600px; }
.plan-progress { flex: none; text-align: center; }
.plan-progress b { display: block; font-family: var(--font-display); font-size: 38px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.plan-progress span { color: var(--muted); font-size: 10px; }
.plan-progress .progress { width: 160px; margin-top: 8px; }
.plan-note { margin-top: 14px; padding: 11px 14px; border-radius: 9px; background: var(--gold-soft); color: #7a5b21; font-size: 11px; line-height: 1.7; }
[data-theme="dark"] .plan-note { color: #e0c28e; }
.phase { margin-top: 20px; padding: 24px 26px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.phase-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.phase-head h2 { font-family: var(--font-display); font-size: 23px; font-weight: 600; }
.phase-head .range { color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .12em; margin-bottom: 3px; }
.phase-head p { color: var(--muted); font-size: 11.5px; line-height: 1.7; margin-top: 5px; max-width: 660px; }
.phase-pct { flex: none; font-family: var(--font-display); font-size: 20px; color: var(--muted); font-variant-numeric: tabular-nums; }
.phase .progress { margin-top: 14px; height: 5px; }
.tasks { margin-top: 14px; display: grid; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: 11px; overflow: hidden; }
.task { display: flex; align-items: flex-start; gap: 12px; padding: 13px 15px; background: var(--surface); transition: background .16s; }
.task:hover { background: var(--surface-2); }
.task-check {
  flex: none; width: 20px; height: 20px; margin-top: 2px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: transparent; color: transparent;
  transition: all .18s;
}
.task-check svg { width: 13px; height: 13px; }
.task.done .task-check { background: var(--teal); border-color: var(--teal); color: #fff; }
.task.done .task-title { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 12.5px; font-weight: 600; line-height: 1.6; }
.task-desc { color: var(--muted); font-size: 10.5px; line-height: 1.65; margin-top: 2px; }
.task-side { display: flex; align-items: center; gap: 8px; flex: none; }
.task-side .chip { font-size: 9px; }
.task-side a { color: var(--accent); font-size: 10px; white-space: nowrap; }
.task-side a:hover { text-decoration: underline; }

/* ---------- Leaderboard ---------- */
.rank-page { display: flex; flex-direction: column; gap: 18px; }
.rank-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 28px;
  padding: 30px 32px;
  border: 1px solid var(--line); border-radius: 18px;
  background:
    radial-gradient(ellipse at 92% 10%, var(--accent-soft) 0%, transparent 55%),
    linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
}
.rank-hero::after {
  content: "∑"; position: absolute; right: 26px; bottom: -46px;
  font-family: var(--font-display); font-size: 190px; line-height: 1;
  color: var(--line-soft); pointer-events: none;
}
.rank-hero-copy { position: relative; z-index: 1; max-width: 660px; }
.rank-hero h1 { font-family: var(--font-display); font-size: clamp(30px, 4vw, 46px); line-height: 1.25; font-weight: 600; margin-top: 8px; }
.rank-hero h1 em { color: var(--accent); font-style: normal; }
.rank-hero p { color: var(--muted); font-size: 12px; line-height: 1.8; margin-top: 10px; max-width: 580px; }
.rank-tabs { display: flex; gap: 5px; align-self: flex-start; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.rank-tabs button { height: 32px; padding: 0 18px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 11px; }
.rank-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.rank-board { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; }
.rank-loading, .rank-empty { padding: 48px 24px; text-align: center; color: var(--muted); font-size: 12px; }
.rank-gate { padding: 46px 24px; text-align: center; }
.rank-gate .rank-gate-icon { width: 48px; height: 48px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.rank-gate .rank-gate-icon svg { width: 24px; height: 24px; }
.rank-gate h2 { font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.rank-gate p { color: var(--muted); font-size: 11.5px; margin: 6px auto 16px; max-width: 360px; line-height: 1.7; }
.rank-podium { display: grid; grid-template-columns: 1fr 1.12fr 1fr; align-items: end; gap: 10px; padding: 26px 22px 0; }
.rank-podium-card { position: relative; text-align: center; padding: 18px 12px 16px; border: 1px solid var(--line-soft); border-radius: 13px 13px 0 0; background: var(--surface-2); }
.rank-podium-card.first { padding-top: 26px; border-color: color-mix(in srgb, var(--gold) 40%, var(--line)); background: linear-gradient(180deg, var(--gold-soft), var(--surface)); }
.rank-podium-card.second { margin-bottom: 0; }
.rank-podium-card.third { margin-bottom: -4px; }
.rank-medal { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--faint); line-height: 1; }
.rank-podium-card.first .rank-medal { color: var(--gold); }
.rank-avatar { width: 38px; height: 38px; margin: 8px auto 6px; display: grid; place-items: center; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); font-family: var(--font-display); font-size: 16px; color: var(--ink); }
.rank-podium-card.first .rank-avatar { width: 46px; height: 46px; border-color: var(--gold); color: var(--accent); background: var(--surface); }
.rank-podium-name { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-podium-xp { color: var(--accent); font-family: var(--font-display); font-size: 18px; font-weight: 600; margin-top: 2px; }
.rank-podium-xp small { font-family: var(--font-body); color: var(--faint); font-size: 8px; margin-left: 2px; }
.rank-list { padding: 6px 0 0; }
.rank-list-head { display: grid; grid-template-columns: 42px 1fr 100px 100px 80px; gap: 8px; padding: 9px 22px; border-top: 1px solid var(--line-soft); color: var(--faint); font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase; }
.rank-row { display: grid; grid-template-columns: 42px 1fr 100px 100px 80px; gap: 8px; align-items: center; padding: 10px 22px; border-top: 1px solid var(--line-soft); font-size: 11px; }
.rank-row.me { background: var(--accent-soft); border-left: 2px solid var(--accent); padding-left: 20px; }
.rank-row-rank { color: var(--faint); font-family: var(--font-display); font-size: 13px; }
.rank-row.me .rank-row-rank { color: var(--accent); font-weight: 700; }
.rank-row-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rank-row-name b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row-name span { color: var(--faint); font-size: 9px; white-space: nowrap; }
.rank-row-points { color: var(--ink); font-family: var(--font-display); font-size: 15px; font-weight: 600; }
.rank-row-points small { color: var(--faint); font-family: var(--font-body); font-size: 8px; margin-left: 2px; }
.rank-row-meta { color: var(--muted); font-size: 9.5px; white-space: nowrap; }
.rank-row-me-tag { display: inline-block; padding: 1px 5px; border-radius: 4px; background: var(--accent); color: #fff; font-size: 7.5px; vertical-align: 1px; margin-left: 5px; }
.rank-me-card { margin: 0 22px 18px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent-soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rank-me-card p { color: var(--muted); font-size: 10.5px; }
.rank-me-card b { font-family: var(--font-display); font-size: 20px; color: var(--accent); }
.rank-rule { border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); padding: 18px 22px; }
.rank-rule-head { display: flex; align-items: baseline; gap: 10px; }
.rank-rule-head h2 { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.rank-rule-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }
.rank-rule-grid div { padding: 9px 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--surface); }
.rank-rule-grid span { display: block; color: var(--muted); font-size: 9px; line-height: 1.4; }
.rank-rule-grid b { display: block; margin-top: 3px; font-family: var(--font-display); font-size: 14px; color: var(--accent); font-weight: 600; }
.rank-rule > p { color: var(--faint); font-size: 9px; line-height: 1.6; margin-top: 10px; }

@media (max-width: 900px) {
  .rank-rule-grid { grid-template-columns: repeat(2, 1fr); }
  .rank-list-head, .rank-row { grid-template-columns: 34px 1fr 86px 74px; }
  .rank-list-head span:nth-child(4), .rank-row-meta:nth-child(4) { display: none; }
}
@media (max-width: 720px) {
  .rank-hero { padding: 22px 20px; align-items: flex-start; }
  .rank-hero h1 { font-size: 30px; }
  .rank-podium { padding: 18px 12px 0; gap: 6px; }
  .rank-podium-card { padding: 13px 7px 12px; }
  .rank-podium-card.first { padding-top: 19px; }
  .rank-avatar { width: 31px; height: 31px; font-size: 13px; }
  .rank-podium-card.first .rank-avatar { width: 37px; height: 37px; }
  .rank-podium-name { font-size: 10px; }
  .rank-podium-xp { font-size: 15px; }
  .rank-list-head, .rank-row { grid-template-columns: 30px 1fr 72px; padding-left: 14px; padding-right: 14px; }
  .rank-list-head span:nth-child(3), .rank-row-meta { display: none; }
  .rank-row.me { padding-left: 12px; }
  .rank-me-card { margin: 0 14px 14px; }
  .rank-rule { padding: 15px 16px; }
  .rank-rule-head { display: block; }
  .rank-rule-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Account / auth ---------- */
.auth-trigger {
  display: flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--muted);
  font-size: 11.5px; white-space: nowrap;
  transition: border-color .18s, background .18s, color .18s;
}
.auth-trigger:hover { border-color: var(--line-strong); color: var(--ink); }
.auth-avatar {
  width: 23px; height: 23px; flex: none;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--surface-2); color: var(--muted);
  font-family: var(--font-display); font-size: 12px; line-height: 1;
}
.auth-avatar svg { width: 14px; height: 14px; }
.auth-trigger.signed-in .auth-avatar { background: var(--accent-soft); color: var(--accent); }
.auth-label { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.auth-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong); flex: none; }
.auth-trigger.signed-in .auth-dot { background: var(--green); }
.auth-trigger.is-syncing .auth-dot { background: var(--gold); animation: auth-pulse 1.1s ease-in-out infinite; }
.auth-trigger.is-error .auth-dot { background: var(--red); }
@keyframes auth-pulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }

.auth-modal { position: fixed; inset: 0; z-index: 130; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 18px 24px; }
.auth-modal[hidden] { display: none; }
.auth-backdrop { position: absolute; inset: 0; background: rgba(8,17,26,.56); backdrop-filter: blur(3px); animation: fade .2s ease both; }
.auth-panel {
  position: relative; width: min(430px, 100%); max-height: 84vh; overflow-y: auto;
  padding: 25px 26px 22px;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 40px 90px -30px rgba(0,0,0,.45);
  animation: drop .24s cubic-bezier(.2,.7,.3,1) both;
}
.auth-close {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  font-size: 20px; line-height: 1;
}
.auth-close:hover { color: var(--ink); border-color: var(--line-strong); }
.auth-kicker { color: var(--accent); font-size: 9.5px; font-weight: 700; letter-spacing: .14em; }
.auth-panel h2 { font-family: var(--font-display); font-size: 25px; font-weight: 600; line-height: 1.35; margin-top: 5px; padding-right: 28px; }
.auth-lead { color: var(--muted); font-size: 11.5px; line-height: 1.7; margin-top: 5px; }
.auth-tabs { display: flex; gap: 3px; padding: 3px; margin-top: 16px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line-soft); }
.auth-tabs button { flex: 1; height: 31px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 11.5px; }
.auth-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.auth-form { display: flex; flex-direction: column; gap: 11px; margin-top: 15px; }
.auth-field { display: flex; flex-direction: column; gap: 4px; }
.auth-field span { color: var(--muted); font-size: 10px; font-weight: 600; }
.auth-field input {
  width: 100%; height: 41px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); color: var(--ink); font-size: 12.5px;
  outline: none; transition: border-color .18s, background .18s;
}
.auth-field input:focus { border-color: var(--accent); background: var(--surface); }
.auth-error { padding: 8px 10px; border-radius: 8px; background: var(--red-soft); color: #85372f; font-size: 10.5px; line-height: 1.6; }
[data-theme="dark"] .auth-error { color: #e9aaa3; }
.auth-submit { width: 100%; margin-top: 3px; }
.auth-note { color: var(--faint); font-size: 9.5px; line-height: 1.65; margin-top: 13px; }
.auth-account { margin-top: 16px; border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden; }
.auth-account-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); font-size: 10.5px; }
.auth-account-row:last-child { border-bottom: 0; }
.auth-account-row span { color: var(--muted); }
.auth-account-row b { font-weight: 600; color: var(--ink-2); }
.auth-actions { display: flex; gap: 8px; margin-top: 15px; }
.auth-actions .btn { flex: 1; }
.auth-modal ~ .search-panel { z-index: 140; }

/* ---------- Modal / search ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 18px 24px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 17, 26, .56); backdrop-filter: blur(3px); animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.search-panel {
  position: relative; width: min(700px, 100%); max-height: 76vh;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .45);
  overflow: hidden;
  animation: drop .25s cubic-bezier(.2, .7, .3, 1) both;
}
@keyframes drop { from { opacity: 0; transform: translateY(-12px) scale(.99); } to { opacity: 1; transform: none; } }
.search-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.search-head > svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search-head input { flex: 1; height: 34px; border: 0; outline: 0; background: transparent; font-size: 15px; }
.kbd-btn { border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--faint); font-size: 9.5px; padding: 3px 7px; }
.search-results { overflow-y: auto; padding: 10px; flex: 1; min-height: 160px; }
.search-hint { padding: 22px 12px; color: var(--faint); font-size: 11px; text-align: center; }
.search-hint span { display: block; margin-bottom: 10px; }
.search-hint button { margin: 3px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 99px; background: transparent; color: var(--muted); font-size: 10.5px; }
.search-hint button:hover { border-color: var(--accent); color: var(--accent); }
.sr-group-label { padding: 9px 10px 5px; color: var(--faint); font-size: 9.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.sr-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 11px; border-radius: 9px; cursor: pointer; }
.sr-item:hover, .sr-item.active { background: var(--surface-2); }
.sr-item .sr-icon { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 7px; background: var(--surface-3); color: var(--muted); font-family: Georgia, serif; font-size: 11px; }
.sr-item .sr-main { min-width: 0; flex: 1; }
.sr-item b { display: block; font-size: 12.5px; font-weight: 600; line-height: 1.5; }
.sr-item small { display: block; color: var(--faint); font-size: 10px; line-height: 1.55; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-item .sr-go { color: var(--faint); font-size: 11px; }
.search-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: 9.5px; }
.search-foot kbd { border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-family: var(--font-ui); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 150;
  transform: translate(-50%, 20px);
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 99px;
  background: var(--ink); color: var(--surface);
  font-size: 12px; box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .5);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Boot / misc ---------- */
.boot { min-height: 52vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 12px; }
.boot-mark { font-family: Georgia, serif; font-size: 46px; color: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.98); } 50% { opacity: 1; transform: scale(1.03); } }
.site-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 18px 42px 24px; border-top: 1px solid var(--line); color: var(--faint); font-size: 10px; }
.noscript { position: fixed; inset: 0; z-index: 999; display: grid; place-items: center; background: var(--bg); color: var(--ink); }

/* MathJax overflow safety */
/* 全局 svg{display:block} 会让 MathJax 的行内公式变成“块”，必须还原。 */
mjx-container svg { display: inline; }
mjx-container[jax="SVG"] { max-width: 100%; }
mjx-container[jax="SVG"][display="true"] { overflow-x: auto; overflow-y: hidden; }
.kp-formulas mjx-container, .formula-card mjx-container, .option mjx-container { max-width: 100%; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .view { padding: 30px 30px 66px; }
  .topbar { padding: 0 26px 0 30px; }
  .hero { grid-template-columns: minmax(0, 1.3fr) minmax(260px, .7fr); padding: 32px; }
  .site-foot { padding-left: 30px; padding-right: 30px; }
}

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform .28s cubic-bezier(.2, .7, .3, 1); box-shadow: 30px 0 60px -30px rgba(0, 0, 0, .5); }
  .sidebar.open { transform: none; }
  .sidebar-close { display: grid; place-items: center; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .theme-top { display: inline-grid; }
  .topbar { padding: 0 22px; }
  .view { padding: 28px 26px 64px; }
  .site-foot { padding-left: 26px; padding-right: 26px; }
}

@media (max-width: 900px) {
  .exam-hub-grid { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .hero-panel { flex-direction: row; justify-content: flex-start; gap: 24px; padding: 18px 22px; }
  .ring { width: 118px; height: 118px; flex: none; }
  .ring-center b { font-size: 30px; }
  .hero-panel-note { text-align: left; }
  .quick-grid { grid-template-columns: 1fr; }
  .quick-card p { min-height: 0; }
  .home-cols { grid-template-columns: 1fr; }
  .chapter-grid { grid-template-columns: 1fr; }
  .map-flow { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
  .map-step { border: 1px solid var(--line) !important; border-radius: 10px !important; }
  .map-step::after { display: none; }
  .kp-formulas { grid-template-columns: 1fr; }
  .callouts { grid-template-columns: 1fr; }
  .exam-grid { grid-template-columns: 1fr; }
  .exam-palette { position: static; order: 2; }
  .exam-palette .btn { width: auto; }
  .formula-grid { grid-template-columns: 1fr; }
  .courses-hero { grid-template-columns: 1fr; }
  .courses-hero-side { grid-template-columns: repeat(3, 1fr); }
  .course-source-grid { grid-template-columns: 1fr; }
  .course-how-grid { grid-template-columns: 1fr; }
  .course-row { grid-template-columns: 30px minmax(0, 1fr); gap: 8px 12px; }
  .course-range { grid-column: 2; align-self: start; width: fit-content; }
  .course-row-actions { grid-column: 2; justify-content: flex-start; }
  .schedule-settings { grid-template-columns: 1fr 1fr; }
  .schedule-kpis { grid-template-columns: repeat(2, 1fr); }
  .schedule-day { grid-template-columns: 82px minmax(0, 1fr) 46px; gap: 10px; }
}

@media (max-width: 980px) {
  .quiz-page { max-width: 900px; }
  .quiz-layout { grid-template-columns: 1fr; }
  .quiz-side { position: static; display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  :root { --topbar-h: 60px; }
  .topbar { padding: 0 16px; gap: 8px; }
  .view { padding: 22px 16px 56px; }
  .site-foot { padding: 16px; flex-direction: column; gap: 4px; }
  .topbar-actions { gap: 6px; }
  .auth-trigger { width: 36px; padding: 0; justify-content: center; }
  .auth-label, .auth-dot { display: none; }
  .auth-panel { padding: 22px 20px 20px; }
  .search-trigger { width: 36px; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .streak-pill { display: none; }
  .theme-top { display: none; }
  .crumbs { font-size: 11px; }
  .hero { padding: 26px 22px; border-radius: 20px; }
  .hero h1 { font-size: 31px; }
  .hero-sub { font-size: 12.5px; }
  .hero-stats { gap: 10px 20px; }
  .hero-stat b { font-size: 18px; }
  .hero-panel { padding: 16px; gap: 18px; }
  .section { margin-top: 34px; }
  .section-head { align-items: flex-start; }
  .section-head h2 { font-size: 22px; }
  .section-head p { display: none; }
  .subject-title h2 { font-size: 24px; }
  .subject-progress { width: 120px; }
  .subject-head { align-items: flex-end; }
  .chapter-hero { padding: 24px 22px; border-radius: 20px; }
  .chapter-hero h1 { font-size: 29px; }
  .chapter-progress-row { flex-wrap: wrap; }
  .chapter-progress-row .btn { margin-left: 0; }
  .kp-card { padding: 21px 19px; }
  .kp-head { gap: 10px; }
  .kp-title-row h2 { font-size: 16px; }
  .kp-toggle { height: 28px; }
  .kp-toggle span { display: none; }
  .kp-toggle { padding: 0 8px; }
  .chapter-quiz-cta { flex-direction: column; align-items: flex-start; padding: 22px; }
  .exam-banner { flex-direction: column; align-items: flex-start; padding: 22px; }
  .exam-banner::after { display: none; }
  .banner-actions { width: 100%; }
  .banner-actions .btn { flex: 1; }
  .examples-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .example-body { padding-left: 20px; }
  .q-card { padding: 22px 18px; border-radius: 18px; }
  .q-stem { font-size: 15.5px; }
  .option { padding: 12px; gap: 10px; }
  .quiz-top { gap: 8px; }
  .quiz-counter { font-size: 19px; }
  .quiz-side { grid-template-columns: 1fr; }
  .exam-hub-grid { grid-template-columns: 1fr; }
  .result-hero { padding: 26px 18px; }
  .result-score { font-size: 54px; }
  .result-stats { gap: 6px; }
  .result-stat b { font-size: 20px; }
  .exam-run-head { flex-wrap: wrap; gap: 6px 14px; }
  .exam-timer { font-size: 16px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head h1 { font-size: 28px; }
  .mistake-stats { grid-template-columns: 1fr; gap: 8px; }
  .m-stat { display: flex; align-items: baseline; gap: 10px; padding: 12px 16px; }
  .m-stat b { font-size: 22px; }
  .plan-hero { flex-direction: column; align-items: flex-start; gap: 18px; padding: 24px 20px; }
  .plan-hero h1 { font-size: 28px; }
  .phase { padding: 20px 16px; }
  .phase-head { gap: 8px; }
  .phase-head h2 { font-size: 20px; }
  .task { padding: 12px; gap: 9px; }
  .task-side { display: none; }
  .formula-toolbar { top: calc(var(--topbar-h) + 4px); padding: 8px; }
  .filter-chips { width: 100%; }
  .filter-chip { flex: 1; }
  .formula-toolbar .btn { flex: 1; }
  .search-panel { max-height: 82vh; }
  .modal { padding-top: 6vh; }
  .chapter-nav { flex-direction: column; }
  .chapter-nav a.next { text-align: left; }
  .q-actions { flex-wrap: wrap; }
  .q-actions .left { width: 100%; }
  .q-actions .right { width: 100%; }
  .q-actions .right .btn { flex: 1; }
  .formula-card .fc-copy { opacity: 1; }
  .courses-hero { padding: 25px 20px; border-radius: 20px; }
  .courses-hero h1 { font-size: 26px; }
  .courses-hero-side { grid-template-columns: 1fr; gap: 5px; }
  .course-hero-stat { display: flex; align-items: baseline; justify-content: space-between; padding: 8px 11px; }
  .course-hero-stat b { font-size: 19px; }
  .course-how .head-link { display: none; }
  .course-progress-row { flex-wrap: wrap; }
  .course-progress-row .progress { max-width: none; width: 100%; order: 3; }
  .course-source { padding: 18px; gap: 12px; }
  .course-source-mark { width: 42px; height: 42px; font-size: 23px; border-radius: 11px; }
  .course-source h2 { font-size: 19px; }
  .course-row { padding: 13px 12px; }
  .course-row-title h3 { font-size: 13px; }
  .course-row-main p { font-size: 10px; }
  .adaptive-plan { padding: 20px 16px; }
  .adaptive-head { flex-direction: column; gap: 8px; }
  .adaptive-head h2 { font-size: 22px; }
  .schedule-settings { grid-template-columns: 1fr; padding: 12px; }
  .schedule-settings .btn { width: 100%; }
  .schedule-kpis { gap: 6px; }
  .schedule-kpi { padding: 10px 11px; }
  .schedule-kpi b { font-size: 20px; }
  .schedule-status { flex-wrap: wrap; }
  .schedule-status-side { width: 100%; margin-left: 26px; }
  .schedule-day { grid-template-columns: 62px minmax(0, 1fr) 38px; gap: 8px; padding: 12px 0; }
  .day-date b { font-size: 13px; }
  .day-date span { font-size: 8px; }
  .task-copy b { font-size: 10.5px; }
  .task-copy em { font-size: 9px; }
  .schedule-foot { flex-direction: column; }
  .plan-template-head { flex-direction: column; gap: 2px; }
}

@media (max-width: 420px) {
  .hero-panel { flex-direction: column; align-items: flex-start; }
  .hero-actions .btn { flex: 1; }
  .subject-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .subject-progress { width: 100%; }
  .cc-tags .chip:nth-child(3) { display: none; }
  .quiz-progress { gap: 3px; }
  .exam-palette { padding: 12px; }
}

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

/* ---------- Print ---------- */
@media print {
  body { background: #fff; color: #111; }
  .sidebar, .topbar, .site-foot, .formula-toolbar, .scrim, .toast, .modal, .btn, .fc-copy { display: none !important; }
  .main { margin: 0; }
  .view { padding: 0; width: 100%; max-width: none; }
  .formulas-page .page-head p { color: #444; }
  .formula-group { break-inside: avoid; }
  .formula-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .formula-card { border: 1px solid #ddd; break-inside: avoid; }
  .formulas-page.masked .formula-tex { filter: none !important; opacity: 1 !important; }
  .formulas-page.masked .formula-card::after { display: none !important; }
  .print-only { display: block; }
  a { color: #111; }
}
