/* 数据开发学习站 · 全站样式 */
:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f0eee8;
  --sidebar: #fbfaf7;
  --ink: #1b1f24;
  --ink-2: #333b44;
  --muted: #667085;
  --line: #e3ded5;
  --line-strong: #d3ccc0;
  --accent: #0f766e;
  --accent-2: #0d5f59;
  --accent-soft: rgba(15, 118, 110, 0.09);
  --amber: #b45309;
  --amber-soft: rgba(180, 83, 9, 0.09);
  --red: #b42318;
  --red-soft: rgba(180, 35, 24, 0.08);
  --green: #16794c;
  --green-soft: rgba(22, 121, 76, 0.1);
  --code-bg: #121820;
  --code-ink: #e6edf3;
  --mark: #fff1b8;
  --shadow-sm: 0 1px 2px rgba(27, 31, 36, 0.05);
  --shadow: 0 2px 6px rgba(27, 31, 36, 0.06), 0 14px 34px rgba(27, 31, 36, 0.05);
  --radius: 12px;
  --radius-lg: 18px;
  --topbar-h: calc(62px + env(safe-area-inset-top, 0px));
  --sidebar-w: 296px;
  --toc-w: 228px;
  --font-sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

.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;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:root { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

html[data-theme="dark"] {
  --bg: #0b1115;
  --surface: #111a20;
  --surface-2: #17232b;
  --sidebar: #0d151a;
  --ink: #e7edf3;
  --ink-2: #c6d0d9;
  --muted: #8d9aa7;
  --line: #21303a;
  --line-strong: #2e4250;
  --accent: #2dd4bf;
  --accent-2: #5eead4;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.12);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.12);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.12);
  --code-bg: #070d12;
  --code-ink: #dbe6ef;
  --mark: #4a3a10;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.45), 0 18px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 20px); }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); }
button { font-family: inherit; }
kbd {
  font-family: var(--font-mono);
  font-size: 0.76em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--muted);
}
::selection { background: var(--accent-soft); }

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #fff; padding: 8px 14px; z-index: 100;
}
.skip:focus { left: 10px; top: 10px; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: var(--topbar-h);
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 20px;
  padding: env(safe-area-inset-top, 0px) 22px 0;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); flex: 0 0 auto; }
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #0f766e, #115e59 55%, #134e4a);
  color: #fff; font-weight: 800; font-size: 0.92rem; letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 0.98rem; letter-spacing: 0.01em; }
.brand-text small { color: var(--muted); font-size: 0.7rem; letter-spacing: 0.06em; margin-top: 3px; }
.topnav { display: flex; align-items: center; gap: 4px; margin-left: 8px; flex: 1; }
.topnav a {
  color: var(--muted); font-size: 0.9rem; padding: 7px 11px; border-radius: 8px;
}
.topnav a:hover { color: var(--ink); background: var(--surface-2); }
.topnav a.active { color: var(--accent-2); background: var(--accent-soft); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.search-btn {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); border-radius: 9px; padding: 7px 10px 7px 12px;
  font-size: 0.84rem; cursor: pointer; min-width: 178px;
}
.search-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.search-btn svg { width: 15px; height: 15px; }
.search-btn kbd { margin-left: auto; }
.icon-btn {
  width: 36px; height: 36px; flex: 0 0 auto;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 17px; height: 17px; }
#menuBtn { display: none; }

/* ---------- 阅读进度 / 移动端工具 ---------- */
.read-progress {
  position: fixed; left: 0; right: 0; top: 0; height: 3px;
  z-index: 70; pointer-events: none;
}
.read-progress i {
  display: block; height: 100%; width: 100%;
  transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent), #2dd4bf);
  transition: transform .08s linear;
}
.nav-backdrop {
  display: none; position: fixed; left: 0; right: 0; bottom: 0;
  top: var(--topbar-h); z-index: 49;
  background: rgba(8, 12, 16, .46);
  opacity: 0; visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.mobile-tools {
  position: fixed; right: 14px; z-index: 46;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: none; flex-direction: column; gap: 10px;
}
.mobile-tools[hidden] { display: none !important; }
.mt-btn {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--ink-2); cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .14);
  transition: transform .12s ease, color .12s ease;
}
.mt-btn[hidden] { display: none !important; }
.mt-btn svg { width: 21px; height: 21px; }
.mt-btn:hover { color: var(--accent-2); }
.mt-btn:active { transform: scale(.94); }

/* 本页目录底部抽屉 */
.toc-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; top: auto;
  width: 100%; max-width: 560px; margin: 0 auto;
  max-height: 76vh; padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: var(--surface); color: var(--ink-2);
  box-shadow: 0 -18px 50px rgba(0, 0, 0, .22);
}
.toc-sheet[open] { display: flex; flex-direction: column; animation: ts-up .22s ease; }
.toc-sheet:not([open]) { display: none; }
.toc-sheet::backdrop {
  background: rgba(8, 12, 16, .46);
  backdrop-filter: blur(2px);
}
@keyframes ts-up {
  from { transform: translateY(20px); opacity: .5; }
  to { transform: none; opacity: 1; }
}
.ts-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--line);
}
.ts-title { margin-right: auto; font-size: .95rem; font-weight: 700; color: var(--ink); }
.ts-size { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ts-size button {
  border: 0; background: var(--surface); color: var(--muted);
  font-size: .78rem; padding: 6px 9px; cursor: pointer;
}
.ts-size button + button { border-left: 1px solid var(--line); }
.ts-size button.on { background: var(--accent-soft); color: var(--accent-2); font-weight: 700; }
.ts-close {
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted); cursor: pointer;
}
.ts-close svg { width: 16px; height: 16px; }
.ts-links { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 10px 12px; }
.ts-links a {
  display: block; padding: 11px 12px; border-radius: 9px;
  color: var(--ink-2); font-size: .92rem; line-height: 1.5;
}
.ts-links a.lv3 { padding-left: 26px; font-size: .86rem; color: var(--muted); }
.ts-links a.active { color: var(--accent-2); background: var(--accent-soft); font-weight: 600; }
.ts-links .ts-empty { padding: 16px 12px; color: var(--muted); font-size: .88rem; }

/* ---------- 三栏布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  align-items: start;
  max-width: 1500px;
  margin: 0 auto;
}
.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 18px 12px 26px;
}
.sidebar::-webkit-scrollbar, .toc-inner::-webkit-scrollbar, #nav::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb, .toc-inner::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

.side-top { padding: 0 8px 10px; }
.side-top .side-progress-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.74rem; color: var(--muted); margin-bottom: 6px;
}
.side-top .side-progress-label b { color: var(--ink); font-variant-numeric: tabular-nums; }
.progress-track {
  height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden;
}
.progress-track > i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), #14b8a6);
  border-radius: 99px; transition: width 0.3s ease;
}
.side-progress-actions { display: flex; gap: 6px; margin-top: 8px; }
.side-progress-actions button {
  flex: 1; min-width: 0; padding: 3px 0;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--muted);
  font: inherit; font-size: 0.68rem; line-height: 1.5; cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.side-progress-actions button:hover,
.side-progress-actions button:focus-visible {
  color: var(--accent-2); border-color: var(--accent); background: var(--accent-soft);
}
.side-progress-actions button.danger:hover,
.side-progress-actions button.danger:focus-visible {
  color: var(--red); border-color: var(--red); background: var(--red-soft);
}
.side-links { display: flex; flex-direction: column; gap: 2px; padding: 8px 4px 12px; }
.side-link {
  display: flex; align-items: center; gap: 9px;
  color: var(--ink-2); font-size: 0.9rem; padding: 8px 10px; border-radius: 8px;
}
.side-link:hover { background: var(--surface-2); color: var(--ink); }
.side-link.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.side-link .ico { width: 17px; height: 17px; color: var(--muted); flex: 0 0 auto; }
.side-link.active .ico { color: var(--accent); }
.side-sep { height: 1px; background: var(--line); margin: 4px 10px 10px; }
.side-label {
  padding: 6px 12px 2px; font-size: 0.7rem; font-weight: 700;
  color: var(--muted); letter-spacing: 0.12em;
}
.side-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-filter {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font: inherit; font-size: 0.62rem; font-weight: 600; letter-spacing: 0;
  padding: 2px 8px; border-radius: 99px; cursor: pointer;
}
.side-filter:hover { border-color: var(--accent); color: var(--accent-2); }
.side-filter[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }
.side-filter[hidden] { display: none; }
.side-chapter.goal-hide { display: none; }
.side-group.goal-empty { display: none; }

.side-group { margin: 2px 0; }
.side-group > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 8px;
  font-size: 0.72rem; font-weight: 700; color: var(--muted);
  letter-spacing: 0.08em;
}
.side-group > summary::-webkit-details-marker { display: none; }
.side-group > summary:hover { background: var(--surface-2); color: var(--ink-2); }
.side-group > summary .mod-no {
  font-family: var(--font-mono); font-size: 0.66rem; color: var(--accent);
  background: var(--accent-soft); padding: 1px 5px; border-radius: 5px; letter-spacing: 0;
}
.side-group > summary .mod-count {
  margin-left: auto; font-weight: 500; font-size: 0.68rem; color: var(--muted);
  font-variant-numeric: tabular-nums; letter-spacing: 0;
}
.side-group > summary .chev { transition: transform 0.18s ease; width: 13px; height: 13px; }
.side-group[open] > summary .chev { transform: rotate(90deg); }
.side-group .side-chapters { padding: 2px 0 8px; }
.side-chapter {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 10px 6px 30px; border-radius: 7px;
  color: var(--ink-2); font-size: 0.87rem; line-height: 1.45;
  position: relative;
}
.side-chapter::before {
  content: ""; position: absolute; left: 17px; top: 13px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong);
}
.side-chapter:hover { background: var(--surface-2); color: var(--ink); }
.side-chapter.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.side-chapter.active::before { background: var(--accent); }
.side-chapter.done::before { background: var(--green); }
.side-chapter .ch-title { flex: 1; min-width: 0; }
.side-chapter .ch-badge {
  flex: 0 0 auto; font-size: 0.66rem; color: var(--muted);
  font-variant-numeric: tabular-nums; background: var(--surface-2);
  border-radius: 20px; padding: 0 6px; margin-top: 3px;
}
.side-chapter.done .ch-badge { color: var(--green); background: var(--green-soft); }
.side-chapter .star { color: var(--amber); font-size: 0.66rem; margin-left: 2px; }

/* ---------- 主内容 ---------- */
.main { min-width: 0; padding: 30px 44px 90px; }
.main-inner { max-width: 850px; margin: 0 auto; }
.main.wide .main-inner { max-width: 1040px; }
.breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  font-size: 0.8rem; color: var(--muted); margin-bottom: 22px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent-2); }
.breadcrumb .sep { opacity: 0.5; }

.page-head { margin-bottom: 28px; }
.eyebrow {
  font-size: 0.72rem; letter-spacing: 0.12em; font-weight: 700;
  color: var(--accent); text-transform: uppercase; margin-bottom: 8px;
}
.page-head h1 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 1.28; letter-spacing: -0.02em;
  margin: 0 0 10px; color: var(--ink);
}
.lede { color: var(--muted); font-size: 1rem; margin: 0 0 14px; max-width: 70ch; }
.meta-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.75rem; padding: 3px 9px; border-radius: 99px;
  background: var(--surface-2); color: var(--muted); border: 1px solid transparent;
}
.chip.req { background: var(--accent-soft); color: var(--accent-2); }
.chip.opt { background: var(--amber-soft); color: var(--amber); }
.chip.level { background: var(--surface-2); }
.chip.practice-chip b { font-weight: 700; color: var(--ink); }
.chip.practice-chip.done { background: var(--accent-soft); color: var(--accent-2); }
.prereq { margin-top: 12px; font-size: 0.84rem; color: var(--muted); }
.prereq a { font-weight: 600; }

/* 移动端本页目录 */
.mobile-toc { display: none; margin: 0 0 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.mobile-toc summary { cursor: pointer; padding: 10px 14px; font-size: 0.86rem; color: var(--muted); }
.mobile-toc .toc-links { padding: 0 14px 12px; }

/* 右侧目录 */
.toc {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; padding: 34px 18px 30px 6px;
}
.toc-inner { border-left: 1px solid var(--line); padding-left: 16px; }
.toc-title { font-size: 0.7rem; letter-spacing: 0.12em; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.toc a {
  display: block; font-size: 0.8rem; line-height: 1.45; color: var(--muted);
  padding: 4px 0; border-left: 2px solid transparent; margin-left: -18px; padding-left: 16px;
}
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--accent-2); border-left-color: var(--accent); font-weight: 600; }
.toc a.lv3 { padding-left: 28px; font-size: 0.76rem; }
.toc .toc-empty { font-size: 0.8rem; color: var(--muted); }

/* ---------- 正文排版 ---------- */
.prose { font-size: 1rem; line-height: 1.86; color: var(--ink-2); overflow-x: clip; }
.prose > *:first-child { margin-top: 0; }
.prose h2 {
  font-size: 1.42rem; line-height: 1.35; color: var(--ink);
  margin: 46px 0 14px; padding-top: 6px; letter-spacing: -0.01em;
}
.prose h2::after {
  content: ""; display: block; width: 42px; height: 3px; border-radius: 3px;
  background: var(--accent); opacity: 0.85; margin-top: 10px;
}
.prose h3 { font-size: 1.12rem; color: var(--ink); margin: 30px 0 10px; }
.prose h4 { font-size: 1rem; color: var(--ink); margin: 22px 0 8px; }
.prose p { margin: 12px 0; }
.prose ul, .prose ol { padding-left: 1.5em; margin: 12px 0; }
.prose li { margin: 6px 0; }
.prose li > p { margin: 4px 0; }
.prose strong { color: var(--ink); font-weight: 650; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 34px 0; }
.prose img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.prose blockquote {
  margin: 18px 0; padding: 12px 18px;
  border-left: 3px solid var(--line-strong);
  background: var(--surface-2); border-radius: 0 10px 10px 0;
  color: var(--ink-2); font-size: 0.95rem;
}
.prose blockquote p { margin: 5px 0; }
.prose blockquote.callout { border-left-width: 3px; }
.prose blockquote.tip { background: var(--accent-soft); border-left-color: var(--accent); }
.prose blockquote.warn { background: var(--red-soft); border-left-color: var(--red); }
.prose blockquote.interview { background: var(--amber-soft); border-left-color: var(--amber); }
.prose blockquote.tip strong:first-child { color: var(--accent-2); }
.prose blockquote.warn strong:first-child { color: var(--red); }
.prose blockquote.interview strong:first-child { color: var(--amber); }

.prose .result-note {
  margin: 16px 0 22px;
  padding: 11px 16px 11px 17px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 4px 10px 10px 4px;
  font-size: 0.93rem;
  line-height: 1.75;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.prose .result-note strong { color: var(--ink); }
.prose .result-note code {
  background: rgba(15,118,110,.1); border-color: transparent; color: var(--ink);
}
html[data-theme="dark"] .prose .result-note code { background: rgba(45,212,191,.13); }

.prose code {
  font-family: var(--font-mono); font-size: 0.86em;
  background: var(--surface-2); color: var(--ink);
  padding: 0.14em 0.4em; border-radius: 5px;
  border: 1px solid var(--line);
}
.prose pre {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,0) 54px),
    var(--code-bg);
  color: var(--code-ink);
  border-radius: 14px; padding: 18px 18px 16px;
  overflow-x: auto; margin: 18px 0; line-height: 1.7; tab-size: 2;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 12px 28px rgba(10, 16, 22, .14), inset 0 1px 0 rgba(255,255,255,.05);
}
.prose pre.has-lang { padding-top: 36px; }
.prose pre.has-lang::before {
  content: ""; position: absolute; left: 14px; right: 14px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(125,211,252,.5), rgba(45,212,191,.5), transparent);
  pointer-events: none;
}
.prose pre[data-lang="sql"] { border-color: rgba(45,212,191,.22); }
.prose pre code {
  background: none; border: none; padding: 0; color: inherit;
  font-size: 0.84rem; white-space: pre;
}
.prose pre .code-lang {
  position: absolute; left: 14px; top: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.12em;
  color: rgba(230, 237, 243, 0.52); text-transform: uppercase;
  pointer-events: none;
}
.prose pre .code-lang::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: #2dd4bf; box-shadow: 0 0 0 3px rgba(45,212,191,.14);
}
.prose pre .copy-btn {
  position: absolute; right: 10px; top: 8px;
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06);
  color: rgba(230,237,243,.72); font-size: 0.66rem; line-height: 1.2;
  border-radius: 999px; padding: 4px 10px; cursor: pointer; opacity: .5;
  transition: opacity .15s ease, background .15s ease, color .15s ease;
}
.prose pre:hover .copy-btn, .prose pre .copy-btn:focus-visible { opacity: 1; }
.prose pre .copy-btn:hover, .prose pre .copy-btn:focus-visible { color: #fff; background: rgba(255,255,255,.14); }
@media (hover: none) { .prose pre .copy-btn { opacity: 0.8; } }

.prose pre .tok-kw { color: #7dd3fc; font-weight: 600; }
.prose pre .tok-type { color: #f0abfc; }
.prose pre .tok-fn { color: #c4b5fd; }
.prose pre .tok-str { color: #86efac; }
.prose pre .tok-num { color: #fcd34d; }
.prose pre .tok-com { color: #7c8b99; font-style: italic; }

.prose table {
  border-collapse: separate; border-spacing: 0;
  width: 100%; margin: 20px 0; font-size: 0.9rem;
  display: block; overflow-x: auto; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 10px;
}
.prose table th, .prose table td {
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  padding: 9px 13px; text-align: left; vertical-align: top;
}
.prose table th {
  background: var(--surface-2); color: var(--ink); font-weight: 600;
  position: sticky; top: 0;
}
.prose table tr:last-child td { border-bottom: none; }
.prose table th:last-child, .prose table td:last-child { border-right: none; }
.prose table tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.prose table td { white-space: normal; }

@media (max-width: 760px) {
  .prose table.practice-table {
    display: block; border: 0; border-radius: 0; background: none;
    overflow: visible; white-space: normal; margin: 14px 0;
  }
  .prose .practice-table thead { display: none; }
  .prose .practice-table tbody { display: block; }
  .prose table.practice-table tr {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "no    diff  diff"
      "title title title"
      "topic topic topic"
      "alt   alt   alt";
    gap: 8px 10px;
    margin: 10px 0;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    white-space: normal;
  }
  .prose table.practice-table td {
    display: block; padding: 0; border: 0; background: none !important;
    white-space: normal; vertical-align: baseline;
  }
  .prose .practice-table td::before {
    content: attr(data-label);
    display: inline-block; margin-right: 6px;
    font-size: 0.68rem; color: var(--muted); letter-spacing: 0.02em;
  }
  .prose .practice-table td:nth-child(1) {
    grid-area: no; align-self: center;
    font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted);
  }
  .prose .practice-table td:nth-child(2) {
    grid-area: title; display: flex; align-items: flex-start; gap: 8px;
    font-weight: 600; font-size: 0.95rem; line-height: 1.55;
  }
  .prose .practice-table td:nth-child(2) input.task { margin-right: 0; margin-top: 2px; }
  .prose .practice-table td:nth-child(3) {
    grid-area: diff; justify-self: end; align-self: center;
    padding: 2px 9px; border-radius: 99px; font-size: 0.68rem; font-weight: 600;
  }
  .prose .practice-table td:nth-child(4) { grid-area: topic; font-size: 0.82rem; color: var(--ink-2); }
  .prose .practice-table td:nth-child(5) { grid-area: alt; font-size: 0.78rem; color: var(--muted); }
  .prose .practice-table td:nth-child(1)::before,
  .prose .practice-table td:nth-child(2)::before,
  .prose .practice-table td:nth-child(3)::before { display: none; }
  .prose .practice-table td.cell-empty { display: none; }
  .prose .practice-table td.diff-easy { background: var(--green-soft) !important; color: var(--green); }
  .prose .practice-table td.diff-medium { background: var(--amber-soft) !important; color: var(--amber); }
  .prose .practice-table td.diff-hard { background: var(--red-soft) !important; color: var(--red); }
}

.prose details {
  margin: 16px 0; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); overflow: hidden;
}
.prose details > summary {
  cursor: pointer; padding: 11px 16px;
  font-size: 0.9rem; font-weight: 600; color: var(--accent-2);
  background: var(--accent-soft); list-style: none;
  display: flex; align-items: center; gap: 8px;
}
.prose details > summary::-webkit-details-marker { display: none; }
.prose details > summary::before {
  content: "+"; width: 18px; height: 18px; border-radius: 5px;
  display: inline-grid; place-items: center; flex: 0 0 auto;
  background: var(--surface); color: var(--accent);
  font-family: var(--font-mono); font-size: 0.8rem;
}
.prose details[open] > summary::before { content: "−"; }
.prose details > *:not(summary) { margin-left: 16px; margin-right: 16px; }
.prose details > *:not(summary):last-child { margin-bottom: 16px; }
.prose details[open] > summary { border-bottom: 1px solid var(--line); }

.prose input.task {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; flex: 0 0 auto;
  border: 1.6px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); cursor: pointer; position: relative;
  vertical-align: -3px; margin-right: 8px;
}
.prose input.task:hover { border-color: var(--accent); }
.prose input.task:checked { background: var(--accent); border-color: var(--accent); }
.prose input.task:checked::after {
  content: ""; position: absolute; left: 6px; top: 2px;
  width: 4px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.prose li:has(> input.task:checked) { opacity: 0.58; }
.prose li:has(> input.task:checked) > * { text-decoration: line-through; text-decoration-color: var(--line-strong); }
.prose input.task.sql-task {
  width: 15px; height: 15px; border-radius: 4px;
  margin-right: 6px; vertical-align: -2px;
}
.prose input.task.sql-task:checked::after {
  left: 4px; top: 1px; width: 3px; height: 8px;
}

/* 章节底部 */
.chapter-foot {
  margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.chapter-foot .chapter-progress { flex: 1; min-width: 200px; }
.chapter-foot .chapter-progress .label {
  display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); margin-bottom: 6px;
}
.chapter-foot .chapter-progress b { color: var(--ink); font-variant-numeric: tabular-nums; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.pager-card {
  display: block; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: 11px; background: var(--surface); color: var(--muted);
  font-size: 0.78rem; line-height: 1.4; transition: border-color .15s ease, transform .15s ease;
}
.pager-card:hover { border-color: var(--accent); color: var(--accent-2); transform: translateY(-1px); }
.pager-card b { display: block; color: var(--ink); font-size: 0.92rem; margin-top: 4px; }
.pager-card.next { text-align: right; }
.pager-card.next b { color: var(--ink); }
.pager-card:hover b { color: var(--accent-2); }
.pager-card.disabled { visibility: hidden; }

/* ---------- 首页 ---------- */
.home-hero {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); padding: 52px 48px 36px;
  box-shadow: var(--shadow-sm);
}
.home-hero::before {
  content: ""; position: absolute; inset: -40% -20% auto auto;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 65%);
  pointer-events: none;
}
.home-hero::after {
  content: ""; position: absolute; left: -120px; bottom: -220px;
  width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, var(--amber-soft), transparent 65%);
  pointer-events: none;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.76rem; color: var(--accent-2); font-weight: 700;
  letter-spacing: 0.06em; margin-bottom: 16px;
}
.hero-eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.home-hero h1 {
  position: relative; z-index: 1;
  font-size: clamp(2rem, 4.4vw, 3.25rem);
  line-height: 1.16; letter-spacing: -0.035em; margin: 0 0 16px;
}
.home-hero h1 em { font-style: normal; color: var(--accent); }
.home-hero .hero-lede {
  position: relative; z-index: 1;
  color: var(--muted); font-size: 1.05rem; max-width: 60ch; margin: 0 0 26px;
}
.hero-actions { position: relative; z-index: 1; display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; font-size: 0.9rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px var(--accent-soft); }
.btn-primary:hover { background: var(--accent-2); color: #fff; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-2); }
.hero-stats {
  position: relative; z-index: 1; display: grid;
  grid-template-columns: repeat(4, 1fr); gap: 0;
  margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line);
}
.hero-stats .stat { padding-right: 18px; }
.hero-stats .stat + .stat { border-left: 1px solid var(--line); padding-left: 22px; }
.hero-stats .num { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.hero-stats .num span { font-size: 0.78rem; color: var(--muted); font-weight: 500; margin-left: 3px; }
.hero-stats .lab { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }

.home-section { margin-top: 46px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.section-head h2 { font-size: 1.25rem; margin: 0; letter-spacing: -0.01em; }
.section-head p { margin: 0; color: var(--muted); font-size: 0.85rem; }
.section-head .more { margin-left: auto; font-size: 0.82rem; font-weight: 600; }

.continue-card {
  display: flex; align-items: center; gap: 18px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.continue-card .cc-icon {
  width: 44px; height: 44px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
}
.continue-card .cc-body { flex: 1; min-width: 0; }
.continue-card .cc-label { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.08em; }
.continue-card .cc-title { font-size: 1rem; font-weight: 650; margin-top: 2px; }
.continue-card .cc-meta { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.continue-card .btn { flex: 0 0 auto; }
.continue-empty { color: var(--muted); font-size: 0.88rem; }

.goal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.goal-card {
  display: flex; flex-direction: column; gap: 6px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  color: var(--ink); padding: 16px 16px 14px; box-shadow: var(--shadow-sm);
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.goal-card:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow); }
.goal-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-sm); }
.gc-head { display: flex; align-items: center; gap: 8px; }
.gc-head b { font-size: 0.98rem; }
.gc-state {
  margin-left: auto; opacity: 0; font-size: 0.64rem; color: var(--accent-2);
  background: var(--accent-soft); border-radius: 99px; padding: 1px 7px; white-space: nowrap;
}
.goal-card.active .gc-state { opacity: 1; }
.gc-desc { font-size: 0.79rem; color: var(--muted); line-height: 1.55; min-height: 2.5em; }
.gc-meta { font-size: 0.71rem; color: var(--muted); }
.goal-progress { display: block; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 2px; }
.goal-progress i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width 0.3s ease; }
.goal-card.done .goal-progress i { background: var(--green); }
.gc-foot { display: flex; justify-content: space-between; font-size: 0.71rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.gc-foot .gc-pct { color: var(--accent-2); font-weight: 600; }
.goal-note { margin: 10px 0 0; font-size: 0.8rem; color: var(--muted); }
.goal-note b { color: var(--ink-2); }
.goal-callout {
  margin-top: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 10px 14px; border: 1px dashed var(--line-strong); border-radius: 10px;
  background: var(--surface); font-size: 0.84rem; color: var(--muted);
}
.goal-callout b { color: var(--ink); }
.goal-callout a { margin-left: auto; font-weight: 600; }
.plan-filter {
  margin-top: 12px; display: flex; gap: 10px 16px; align-items: center;
  justify-content: space-between; flex-wrap: wrap;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); font-size: 0.84rem; color: var(--muted);
}
.plan-filter[hidden] { display: none; }
.plan-empty {
  margin: 14px 0 0; padding: 16px; border: 1px dashed var(--line); border-radius: 10px;
  color: var(--muted); font-size: 0.86rem; text-align: center;
}
.plan-empty[hidden] { display: none; }
.plan-filter b { color: var(--ink); }
.pf-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.pf-seg button {
  border: 0; background: var(--surface); color: var(--muted);
  font: inherit; font-size: 0.76rem; padding: 5px 12px; cursor: pointer;
}
.pf-seg button + button { border-left: 1px solid var(--line); }
.pf-seg button.active { background: var(--accent); color: #fff; }
.gp-switch { display: inline-block; margin-top: 8px; font-size: 0.8rem; font-weight: 600; }
#goalPicker { scroll-margin-top: 76px; }
.plan-tip { margin-top: 14px; font-size: 0.8rem; color: var(--muted); }
.plan-tip code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: 0.9em; }
.goal-panel {
  display: none; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); padding: 24px; box-shadow: var(--shadow-sm);
  scroll-margin-top: 76px;
}
.goal-panel.show { display: block; }
.gp-head { display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.gp-head h2 { margin: 4px 0 6px; font-size: 1.3rem; }
.gp-head p { margin: 0; color: var(--muted); font-size: 0.88rem; max-width: 70ch; }
.gp-nums { display: flex; gap: 18px; }
.gp-nums div { text-align: right; }
.gp-nums b { display: block; font-size: 1.3rem; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.gp-nums span { font-size: 0.7rem; color: var(--muted); }
.gp-focus { margin: 16px 0; padding-left: 1.2em; font-size: 0.85rem; color: var(--ink-2); }
.gp-focus li { margin: 4px 0; }
.gp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.gp-mod { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.gp-mod h3 { margin: 0 0 8px; font-size: 0.8rem; color: var(--muted); display: flex; gap: 6px; align-items: baseline; }
.gp-mod h3 span { font-family: var(--font-mono); font-size: 0.68rem; color: var(--accent); background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }
.gp-links { display: flex; flex-direction: column; gap: 3px; }
.gp-links a { font-size: 0.83rem; color: var(--ink-2); display: flex; gap: 8px; align-items: baseline; padding: 2px 0; }
.gp-links a:hover { color: var(--accent-2); }
.gp-links a span { margin-left: auto; font-size: 0.68rem; color: var(--muted); flex: 0 0 auto; }
.gp-note { font-size: 0.78rem; color: var(--muted); margin: 14px 0; }
.goal-chip { background: var(--accent-soft); color: var(--accent-2); border-color: transparent; }
.goal-chip.out { background: var(--amber-soft); color: var(--amber); }
.side-chapter.out-of-plan { opacity: 0.42; }
.side-chapter.out-of-plan:hover { opacity: 0.78; }
.chapter-row.out-of-plan { opacity: 0.45; }
.chapter-row.out-of-plan:hover { opacity: 0.8; }
.chapter-row.goal-hide { display: none; }
.mod-card.out-of-plan { opacity: 0.45; }
.mod-card.out-of-plan:hover { opacity: 0.85; }

.side-plan {
  display: flex; flex-direction: column; gap: 1px; margin: 8px 4px 0;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.side-plan span { font-size: 0.62rem; color: var(--muted); letter-spacing: 0.08em; }
.side-plan b { font-size: 0.8rem; color: var(--accent-2); }
.side-plan:hover { border-color: var(--accent); }

.roadmap-strip {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 20px 22px; box-shadow: var(--shadow-sm);
}
.roadmap-strip .rs-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.roadmap-strip .rs-top h3 { margin: 0; font-size: 1rem; }
.roadmap-strip .rs-top .rs-prog { margin-left: auto; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.roadmap-strip .rs-top .rs-prog b { color: var(--accent-2); }
.rs-stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; margin-top: 14px; }
.rs-stage {
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px;
  font-size: 0.72rem; color: var(--muted); line-height: 1.35; background: var(--bg);
}
.rs-stage b { display: block; color: var(--ink-2); font-size: 0.76rem; margin-bottom: 3px; }
.rs-stage.done { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.rs-stage.current { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-2); }
.rs-stage.current b { color: var(--accent-2); }

.mod-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.mod-card {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 20px 20px 16px;
  box-shadow: var(--shadow-sm); transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
  color: var(--ink);
}
.mod-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); color: var(--ink); }
.mod-card .mc-top { display: flex; align-items: center; gap: 10px; }
.mod-card .mc-no {
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--accent);
  background: var(--accent-soft); border-radius: 6px; padding: 2px 7px;
}
.mod-card h3 { margin: 0; font-size: 1.05rem; letter-spacing: -0.01em; }
.mod-card .mc-desc { font-size: 0.84rem; color: var(--muted); line-height: 1.65; margin: 0; flex: 1; }
.mod-card .mc-foot {
  display: flex; align-items: center; gap: 10px; font-size: 0.74rem; color: var(--muted);
  border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px;
}
.mod-card .mc-progress { margin-left: auto; width: 74px; }

.path-list { display: flex; flex-direction: column; gap: 0; }
.path-item { display: flex; gap: 14px; }
.path-rail { width: 30px; flex: 0 0 30px; display: flex; justify-content: center; position: relative; }
.path-rail::before { content: ""; position: absolute; top: 26px; bottom: -10px; left: 50%; width: 2px; background: var(--line); transform: translateX(-50%); }
.path-item:last-child .path-rail::before { display: none; }
.path-dot {
  width: 24px; height: 24px; border-radius: 50%; flex: 0 0 auto; margin-top: 12px;
  display: grid; place-items: center; font-size: 0.64rem; font-weight: 700;
  background: var(--surface); border: 2px solid var(--line-strong); color: var(--muted); z-index: 1;
}
.path-item.current .path-dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.path-body {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); padding: 13px 16px; margin-bottom: 10px;
}
.path-body h3 { margin: 0; font-size: 0.92rem; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.path-body h3 span { font-size: 0.72rem; color: var(--muted); font-weight: 400; }
.path-body p { margin: 4px 0 0; font-size: 0.8rem; color: var(--muted); }
.path-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.path-chips a { font-size: 0.74rem; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.path-chips a:hover { background: var(--accent-soft); color: var(--accent-2); }

.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.feature { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 14px 16px; }
.feature b { display: block; font-size: 0.88rem; margin-bottom: 4px; }
.feature p { margin: 0; font-size: 0.78rem; color: var(--muted); line-height: 1.55; }

/* ---------- 学习顺序 ---------- */
.route-hero { margin-bottom: 30px; }
.route-hero h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); line-height: 1.2; letter-spacing: -0.03em; margin: 0 0 12px; }
.route-hero p { color: var(--muted); max-width: 68ch; margin: 0; }
.howto { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 22px 0 8px; }
.howto-item { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 14px 16px; }
.howto-item b { display: block; font-size: 0.86rem; margin-bottom: 4px; }
.howto-item p { margin: 0; font-size: 0.78rem; color: var(--muted); line-height: 1.6; }

.stage { display: flex; gap: 14px; }
.stage-rail { width: 42px; flex: 0 0 42px; display: flex; justify-content: center; position: relative; }
.stage-rail::before { content: ""; position: absolute; top: 40px; bottom: -16px; left: 50%; width: 2px; background: var(--line); transform: translateX(-50%); }
.stage:last-child .stage-rail::before { display: none; }
.stage-dot {
  position: relative; z-index: 1; width: 34px; height: 34px; margin-top: 16px;
  border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto;
  background: var(--surface); border: 2px solid var(--line-strong);
  font-size: 0.64rem; font-weight: 700; color: var(--muted);
}
.stage.done .stage-dot { background: var(--green); border-color: var(--green); color: #fff; }
.stage.current .stage-dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.stage-card {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 20px 22px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.stage.done .stage-card { opacity: 0.78; }
.stage.current .stage-card { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.stage-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stage-head .stage-no { font-size: 0.7rem; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: 2px 8px; border-radius: 6px; }
.stage-head h2 { margin: 0; font-size: 1.14rem; letter-spacing: -0.01em; }
.stage-goal { margin: 10px 0 14px; font-size: 0.92rem; color: var(--ink-2); }
.stage-cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; }
.stage-col h4 { margin: 0 0 8px; font-size: 0.76rem; letter-spacing: 0.09em; color: var(--muted); text-transform: uppercase; }
.stage-chapters { display: flex; flex-direction: column; gap: 3px; }
.stage-chapters a { display: flex; align-items: baseline; gap: 7px; font-size: 0.85rem; color: var(--ink-2); padding: 3px 0; }
.stage-chapters a:hover { color: var(--accent-2); }
.stage-chapters a.out-of-plan { opacity: 0.45; }
.stage-chapters a.out-of-plan:hover { opacity: 0.8; }
.stage-chapters a.goal-hide { display: none; }
.stage.goal-hidden { display: none; }
.stage-chapters a .tag { font-size: 0.64rem; color: var(--muted); background: var(--surface-2); border-radius: 4px; padding: 0 5px; flex: 0 0 auto; }
.stage-chapters a .tag.opt { color: var(--amber); background: var(--amber-soft); }
.stage-tasks { margin: 0; padding-left: 1.1em; font-size: 0.84rem; color: var(--ink-2); }
.stage-tasks li { margin: 5px 0; }
.stage-criteria { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.stage-criteria li { display: flex; align-items: flex-start; gap: 8px; font-size: 0.84rem; color: var(--ink-2); }
.stage-criteria input.task { margin-top: 4px; flex: 0 0 auto; }
.stage-criteria li:has(input:checked) span { opacity: 0.5; text-decoration: line-through; }
.stage-pitfalls { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.stage-pitfalls h4 { margin: 0 0 6px; font-size: 0.72rem; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; }
.stage-pitfalls p { margin: 4px 0; font-size: 0.8rem; color: var(--muted); }
.stage-pitfalls p b { color: var(--ink-2); }
.rules-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 8px; }
.rule { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 15px 17px; }
.rule b { display: block; font-size: 0.88rem; margin-bottom: 4px; }
.rule p { margin: 0; font-size: 0.82rem; color: var(--muted); line-height: 1.65; }

/* ---------- 技术地图 ---------- */
.map-flow { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.map-layer {
  display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 18px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.map-layer .ml-left h3 { margin: 0 0 4px; font-size: 0.98rem; }
.map-layer .ml-left p { margin: 0; font-size: 0.77rem; color: var(--muted); line-height: 1.55; }
.map-items { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.map-item {
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px;
  background: var(--bg); min-width: 140px; max-width: 100%;
}
.map-item:hover { border-color: var(--accent); }
.map-item b { font-size: 0.82rem; color: var(--ink); }
.map-item span { font-size: 0.72rem; color: var(--muted); }
.map-arrow { text-align: center; color: var(--line-strong); font-size: 0.8rem; line-height: 1; }

/* ---------- 模块页 ---------- */
.module-hero {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); padding: 30px 32px; margin-bottom: 26px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.module-hero::after {
  content: attr(data-no); position: absolute; right: 22px; top: -18px;
  font-family: var(--font-mono); font-size: 6rem; font-weight: 800;
  color: var(--accent-soft); letter-spacing: -0.05em; pointer-events: none;
}
.module-hero h1 { margin: 6px 0 10px; font-size: clamp(1.8rem, 3.6vw, 2.4rem); letter-spacing: -0.03em; }
.module-hero .module-desc { color: var(--muted); max-width: 62ch; margin: 0 0 18px; }
.module-goals { margin: 0; padding-left: 1.2em; font-size: 0.88rem; color: var(--ink-2); }
.module-goals li { margin: 4px 0; }
.module-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chapter-list { display: flex; flex-direction: column; gap: 10px; }
.chapter-row {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
  padding: 14px 16px; color: var(--ink); transition: border-color .15s ease, transform .15s ease;
}
.chapter-row:hover { border-color: var(--accent); transform: translateX(2px); color: var(--ink); }
.chapter-row .cr-no {
  width: 32px; height: 32px; border-radius: 8px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2);
  font-family: var(--font-mono); font-size: 0.76rem; font-weight: 700;
}
.chapter-row .cr-body { flex: 1; min-width: 0; }
.chapter-row .cr-body b { display: block; font-size: 0.94rem; }
.chapter-row .cr-body span { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.chapter-row .cr-meta { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.chapter-row .cr-pct { font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.chapter-row.done .cr-no { background: var(--green-soft); color: var(--green); }

/* ---------- 面试题库 ---------- */
.bank-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 24px 0 8px; }
.bank-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 22px; box-shadow: var(--shadow-sm); }
.bank-card h3 { margin: 0 0 8px; font-size: 1.02rem; }
.bank-card p { margin: 0 0 12px; font-size: 0.83rem; color: var(--muted); }
.bank-card .num { font-size: 2rem; font-weight: 800; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.bank-card .num span { font-size: 0.76rem; color: var(--muted); font-weight: 500; margin-left: 4px; }
.q-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); margin-top: 10px; }
.q-item { display: flex; align-items: baseline; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: 0.9rem; }
.q-item:last-child { border-bottom: none; }
.q-item:hover { background: var(--surface-2); color: var(--accent-2); }
.q-item .q-no { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); flex: 0 0 24px; }
.q-item .q-tag { margin-left: auto; font-size: 0.68rem; color: var(--muted); background: var(--surface-2); border-radius: 99px; padding: 1px 8px; flex: 0 0 auto; }

/* ---------- 搜索 ---------- */
.search-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(8, 12, 16, 0.5); backdrop-filter: blur(3px);
  display: none; justify-content: center; padding: 84px 18px 20px;
}
.search-overlay.show { display: flex; }
body.search-open { overflow: hidden; }
.search-panel {
  width: min(760px, 100%); max-height: 74vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); overflow: hidden;
}
.search-input-wrap { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.search-input-wrap svg { width: 18px; height: 18px; color: var(--muted); flex: 0 0 auto; }
#searchInput {
  flex: 1; border: none; outline: none; background: transparent;
  color: var(--ink); font-size: 1rem; font-family: inherit;
}
.search-input-wrap kbd { flex: 0 0 auto; }
.search-results { overflow-y: auto; padding: 6px 0; }
.search-empty { padding: 42px 20px; text-align: center; color: var(--muted); font-size: 0.9rem; }
.search-item { display: block; padding: 12px 20px; border-bottom: 1px solid var(--line); color: var(--ink); }
.search-item:last-child { border-bottom: none; }
.search-item:hover, .search-item.active { background: var(--accent-soft); color: var(--ink); }
.search-item .si-top { display: flex; align-items: baseline; gap: 8px; }
.search-item .si-title { font-size: 0.93rem; font-weight: 650; }
.search-item .si-mod { font-size: 0.68rem; color: var(--muted); background: var(--surface-2); border-radius: 99px; padding: 1px 7px; }
.search-item .si-snippet { font-size: 0.8rem; color: var(--muted); margin-top: 3px; line-height: 1.55; }
.search-item mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
.search-foot { padding: 9px 18px; border-top: 1px solid var(--line); font-size: 0.72rem; color: var(--muted); display: flex; justify-content: space-between; }

/* ---------- 其他 ---------- */
.footer {
  max-width: 1040px; margin: 0 auto; padding: 30px 44px 46px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 0.8rem;
  display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center;
}
.footer a { color: var(--muted); }
.footer a:hover { color: var(--accent-2); }
.footer .foot-right { margin-left: auto; }
.footer .icp { white-space: nowrap; }
.empty-hint { border: 1px dashed var(--line-strong); border-radius: 10px; padding: 16px; color: var(--muted); font-size: 0.85rem; }
.redirect-note { max-width: 620px; margin: 80px auto; text-align: center; }
.redirect-note h1 { font-size: 1.4rem; }
.redirect-note p { color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 99px;
  font-size: 0.8rem; opacity: 0; pointer-events: none; transition: all .2s ease; z-index: 90;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 1280px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
  .mobile-toc { display: block; }
}
@media (max-width: 1024px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h); z-index: 50;
    width: min(320px, 86vw); transform: translateX(-102%);
    visibility: hidden;
    transition: transform .22s ease, visibility .22s ease;
    box-shadow: 0 0 50px rgba(0,0,0,.28);
  }
  .sidebar.open { transform: none; visibility: visible; }
  body.nav-open { overflow: hidden; }
  #menuBtn { display: inline-grid; }
  .topnav { display: none; }
  .search-btn { min-width: 0; padding: 7px 10px; }
  .search-btn .sb-text, .search-btn kbd { display: none; }
  .main { padding: 24px 26px 70px; }
  .footer { padding: 26px 26px 40px; }
  .nav-backdrop { display: block; }
  .nav-backdrop.show { opacity: 1; visibility: visible; }
  .mobile-tools:not([hidden]) { display: flex; }
  html { --read-size: 16px; }
  html[data-read="sm"] { --read-size: 14.5px; }
  html[data-read="lg"] { --read-size: 18px; }
  .prose { font-size: var(--read-size); }
}
@media (max-width: 860px) {
  .stage-cols { grid-template-columns: 1fr; gap: 14px; }
  .map-layer { grid-template-columns: 1fr; gap: 10px; }
  .mod-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .howto { grid-template-columns: 1fr; }
  .bank-grid { grid-template-columns: 1fr; }
  .rs-stages { grid-template-columns: repeat(4, 1fr); }
  .rules-grid { grid-template-columns: 1fr; }
  .goal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gp-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .section-head { flex-wrap: wrap; gap: 3px 10px; }
  .section-head p { flex-basis: 100%; }
  .topbar { padding: env(safe-area-inset-top, 0px) 12px 0; gap: 8px; }
  .brand-text small { display: none; }
  .home-hero { padding: 34px 22px 26px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); row-gap: 18px; }
  .hero-stats .stat:nth-child(3) { border-left: none; padding-left: 0; }
  .hero-stats .stat:nth-child(4) { border-left: 1px solid var(--line); }
  .main { padding: 18px 16px 56px; }
  .module-hero { padding: 22px 20px; }
  .module-hero::after { font-size: 4.4rem; top: -12px; }
  .stage-card { padding: 16px; }
  .stage-rail { width: 30px; flex-basis: 30px; }
  .stage-dot { width: 28px; height: 28px; font-size: 0.58rem; }
  .feature-grid { grid-template-columns: 1fr; }
  .rs-stages { grid-template-columns: repeat(2, 1fr); }
  .pager { grid-template-columns: 1fr; }
  .chapter-row { flex-wrap: wrap; }
  .chapter-row .cr-meta { width: 100%; justify-content: flex-end; }
  .continue-card { flex-wrap: wrap; }
  .search-overlay { padding: 20px 10px; }
  .search-panel { max-height: calc(100vh - 40px); }
  .footer { padding: 22px 16px 34px; }
  .footer .foot-right { margin-left: 0; }
  .prose pre { padding: 16px 14px 14px; border-radius: 10px; }
  .prose pre.has-lang { padding-top: 34px; }
  .prose pre code { font-size: 0.82rem; }
  .prose a { overflow-wrap: anywhere; }
  .prose input.task {
    width: 24px; height: 24px; border-radius: 7px;
    margin-right: 10px; vertical-align: -4px;
  }
  .prose input.task:checked::after { left: 7px; top: 3px; width: 5px; height: 11px; }
  .prose input.task.sql-task {
    width: 20px; height: 20px; border-radius: 5px;
    margin-right: 7px; vertical-align: -3px;
  }
  .prose input.task.sql-task:checked::after { left: 5px; top: 2px; width: 4px; height: 9px; }
  .prose li:has(> input.task) { line-height: 1.75; padding: 2px 0; }
  .prose details > summary { padding: 13px 16px; }
  .prose pre .copy-btn { font-size: .72rem; padding: 6px 11px; opacity: .85; }
  .pager-card { padding: 14px 16px; }
  .mobile-tools { right: 12px; }
  .icon-btn { width: 40px; height: 40px; }
  .ts-size button { padding: 8px 10px; }
  .goal-grid { grid-template-columns: 1fr; }
  .goal-card { padding: 14px 14px 12px; }
  .gc-desc { min-height: 0; }
  .goal-panel { padding: 18px 16px; }
  .gp-head { flex-direction: column; gap: 12px; }
  .gp-nums { width: 100%; justify-content: space-between; gap: 10px; }
  .gp-nums div { text-align: left; }
  .gp-nums b { font-size: 1.15rem; }
  .goal-callout a { margin-left: 0; }
  .gp-links a { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  .topbar, .sidebar, .toc, .footer, .search-overlay, .toast,
  .skip, .copy-btn, .mobile-toc, .pager, .chapter-foot { display: none !important; }
  .layout { display: block; max-width: none; }
  .main { padding: 0; }
  .main-inner { max-width: none; }
  .prose pre { white-space: pre-wrap; word-break: break-word; }
  .prose a { color: inherit; text-decoration: underline; }
  .prose table { overflow: visible; white-space: normal; }
  body { background: #fff; color: #000; }
}
