/* ==========================================================================
   DSA Wiki — 设计系统
   深色：夜航 / 荧光绿；浅色：暖纸 / 墨绿
   ========================================================================== */

/* ---------- 主题变量 ---------- */
:root {
  --sidebar-w: clamp(252px, 17vw, 280px);
  --toc-w: 208px;
  --pad-x: clamp(40px, 3.4vw, 64px);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", "Cascadia Code",
    "Roboto Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --speed: .22s;
  --content: 1040px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b12;
  --bg-soft: #0a1019;
  --bg-elev: #0d1521;
  --panel: rgba(15, 24, 38, .66);
  --panel-solid: #0e1724;
  --panel-2: rgba(255, 255, 255, .035);
  --border: rgba(148, 163, 184, .14);
  --border-strong: rgba(148, 163, 184, .26);
  --text: #e9eff8;
  --text-soft: #c6d2e2;
  --muted: #93a5ba;
  --faint: #667b91;
  --accent: #3ddc97;
  --accent-2: #38d3e8;
  --accent-3: #f2c14e;
  --accent-ink: #04150f;
  --accent-soft: rgba(61, 220, 151, .10);
  --accent-line: rgba(61, 220, 151, .30);
  --danger: #fb7185;
  --warn: #fbbf24;
  --info: #7dd3fc;
  --violet: #a78bfa;
  --code-bg: #070d16;
  --code-border: rgba(148, 163, 184, .16);
  --grid: rgba(148, 163, 184, .055);
  --shadow: 0 24px 70px -24px rgba(0, 0, 0, .78);
  --shadow-soft: 0 10px 34px -18px rgba(0, 0, 0, .65);
  --glow: 0 0 0 1px rgba(61, 220, 151, .14), 0 20px 60px -30px rgba(61, 220, 151, .35);
  --sidebar-bg: linear-gradient(180deg, rgba(9, 14, 23, .96), rgba(7, 11, 18, .92));
  --selection: rgba(61, 220, 151, .24);
  --ring-track: rgba(148, 163, 184, .16);
  --inverse: #071018;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f4ed;
  --bg-soft: #f0ede4;
  --bg-elev: #fffdf8;
  --panel: rgba(255, 255, 255, .74);
  --panel-solid: #fffdf8;
  --panel-2: rgba(15, 45, 60, .035);
  --border: rgba(17, 48, 62, .13);
  --border-strong: rgba(17, 48, 62, .24);
  --text: #102531;
  --text-soft: #294352;
  --muted: #536b78;
  --faint: #7b8f99;
  --accent: #0d7a63;
  --accent-2: #0e7490;
  --accent-3: #a16207;
  --accent-ink: #f4fffb;
  --accent-soft: rgba(13, 122, 99, .09);
  --accent-line: rgba(13, 122, 99, .28);
  --danger: #be123c;
  --warn: #b45309;
  --info: #0369a1;
  --violet: #6d28d9;
  --code-bg: #10202b;
  --code-border: rgba(16, 32, 43, .18);
  --grid: rgba(17, 48, 62, .055);
  --shadow: 0 24px 60px -30px rgba(30, 58, 72, .38);
  --shadow-soft: 0 10px 30px -20px rgba(30, 58, 72, .32);
  --glow: 0 0 0 1px rgba(13, 122, 99, .12), 0 20px 50px -30px rgba(13, 122, 99, .22);
  --sidebar-bg: linear-gradient(180deg, rgba(255, 253, 247, .96), rgba(246, 243, 235, .94));
  --selection: rgba(13, 122, 99, .18);
  --ring-track: rgba(17, 48, 62, .14);
  --inverse: #fffdf8;
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
::selection { background: var(--selection); }
a { color: var(--accent); text-decoration: none; transition: color var(--speed) var(--ease); }
a:hover { color: var(--accent-2); }
img, svg { max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, h5 { line-height: 1.28; color: var(--text); font-weight: 700; }
p { margin: 0 0 1.1em; }
strong { color: var(--text); font-weight: 650; }
em { font-style: normal; }
code, kbd, pre { font-family: var(--font-mono); }
hr { border: 0; border-top: 1px solid var(--border); margin: 3rem 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip-link {
  position: fixed; top: -100px; left: 16px; z-index: 300;
  background: var(--accent); color: var(--accent-ink); padding: 10px 16px;
  border-radius: 8px; font-weight: 700; font-size: 14px;
}
.skip-link:focus { top: 12px; }
.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;
}
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 环境光与网格 ---------- */
.ambient { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(110px); opacity: .42; animation: drift 26s var(--ease) infinite alternate; }
.orb-a { width: 540px; height: 540px; left: -160px; top: -180px; background: radial-gradient(circle, rgba(61, 220, 151, .30), transparent 66%); }
.orb-b { width: 620px; height: 620px; right: -220px; top: 8%; background: radial-gradient(circle, rgba(56, 211, 232, .22), transparent 66%); animation-delay: -9s; }
.orb-c { width: 520px; height: 520px; left: 38%; bottom: -300px; background: radial-gradient(circle, rgba(242, 193, 78, .13), transparent 68%); animation-delay: -17s; }
html[data-theme="light"] .orb { opacity: .30; }
html[data-theme="light"] .orb-a { background: radial-gradient(circle, rgba(13, 122, 99, .20), transparent 66%); }
html[data-theme="light"] .orb-b { background: radial-gradient(circle, rgba(14, 116, 144, .16), transparent 66%); }
html[data-theme="light"] .orb-c { background: radial-gradient(circle, rgba(161, 98, 7, .11), transparent 68%); }
.grid-plane {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, #000 20%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, #000 20%, transparent 80%);
  opacity: .7;
}
@keyframes drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(40px, 50px, 0) scale(1.12); } }

/* ---------- 外壳布局 ---------- */
.shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  width: var(--sidebar-w); display: flex; flex-direction: column;
  background: var(--sidebar-bg); border-right: 1px solid var(--border);
  backdrop-filter: blur(22px) saturate(1.1); -webkit-backdrop-filter: blur(22px) saturate(1.1);
}
.sidebar-top { flex: 1; min-height: 0; overflow-y: auto; padding: 26px 18px 18px; scrollbar-width: thin; }
.main-col { flex: 1; min-width: 0; margin-left: var(--sidebar-w); }
.main { width: 100%; max-width: 1280px; margin: 0; padding: 52px var(--pad-x) 100px; }
.page { max-width: 100%; }
.toc-rail {
  position: fixed; top: 0; right: 28px; z-index: 20; width: var(--toc-w);
  height: 100vh; padding: 116px 0 40px; display: none;
}
.toc-inner { border-left: 1px solid var(--border); padding-left: 20px; height: 100%; overflow-y: auto; scrollbar-width: none; }
.toc-title { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin: 0 0 14px; }
.toc-nav { display: flex; flex-direction: column; gap: 2px; }
.toc-nav a {
  display: block; padding: 6px 0 6px 10px; margin-left: -10px; font-size: 12.5px;
  line-height: 1.5; color: var(--muted); border-left: 1px solid transparent;
  transition: color var(--speed), border-color var(--speed);
}
.toc-nav a:hover { color: var(--text); }
.toc-nav a.is-active { color: var(--accent); border-left-color: var(--accent); background: linear-gradient(90deg, var(--accent-soft), transparent 80%); }
.toc-nav a.toc-h3 { padding-left: 24px; font-size: 12px; color: var(--faint); }
.toc-nav a.toc-h3.is-active { color: var(--accent); }
.toc-top { display: inline-flex; align-items: center; gap: 6px; margin-top: 24px; font-size: 12px; color: var(--faint); }
.toc-top .icon { transform: rotate(90deg); width: 13px; height: 13px; }
body.toc-off .toc-rail { display: none; }

@media (min-width: 1680px) {
  body:not(.toc-off) .main-col { padding-right: 220px; }
  .toc-rail { display: block; }
}

/* ---------- 内联目录（中小屏） ---------- */
.toc-inline {
  display: none; margin: -16px 0 34px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--panel); overflow: hidden;
}
.toc-inline summary {
  display: flex; align-items: center; gap: 9px; padding: 12px 16px;
  cursor: pointer; list-style: none; font-size: 11px; font-weight: 650;
  letter-spacing: .1em; color: var(--muted);
}
.toc-inline summary::-webkit-details-marker { display: none; }
.toc-inline summary::after {
  content: "＋"; margin-left: auto; color: var(--accent); font-size: 14px;
  font-weight: 400; line-height: 1;
}
.toc-inline[open] summary::after { content: "－"; }
.toc-inline summary em { font-style: normal; font-weight: 400; letter-spacing: 0; color: var(--faint); }
.toc-inline-links {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px;
  padding: 8px 18px 16px; border-top: 1px solid var(--border);
}
.toc-inline-links a {
  display: block; padding: 6px 0; font-size: 12.5px; line-height: 1.5;
  color: var(--muted); border-bottom: 1px dashed color-mix(in srgb, var(--border) 70%, transparent);
}
.toc-inline-links a:hover { color: var(--accent); }
.toc-inline-links a.toc-h3 { padding-left: 16px; font-size: 12px; color: var(--faint); }
@media (max-width: 1679px) { .toc-inline { display: block; } }
@media (max-width: 640px) { .toc-inline-links { grid-template-columns: 1fr; } }

/* ---------- 移动端关闭按钮 ---------- */
.sidebar-top { position: relative; }
.sidebar .sidebar-close { display: none; position: absolute; top: 26px; right: 16px; z-index: 2; }
.search-close {
  display: none; width: 30px; height: 30px; flex: none; place-items: center;
  border-radius: 7px; border: 1px solid var(--border); background: var(--panel-2); color: var(--muted);
}
.search-close:hover { color: var(--text); border-color: var(--border-strong); }
.search-close .icon { width: 14px; height: 14px; }
@media (max-width: 1100px) { .sidebar .sidebar-close { display: inline-grid; } }
@media (max-width: 620px) {
  .search-field kbd { display: none; }
  .search-close { display: inline-grid; }
}

/* ---------- 侧栏品牌 ---------- */
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; margin-bottom: 22px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border-radius: 12px; color: var(--accent);
  background: linear-gradient(145deg, rgba(61, 220, 151, .16), rgba(56, 211, 232, .06));
  border: 1px solid var(--accent-line); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}
html[data-theme="light"] .brand-mark { background: linear-gradient(145deg, rgba(13, 122, 99, .12), rgba(14, 116, 144, .05)); }
.brand-mark svg { width: 26px; height: 26px; }
.brand-mark--sm { width: 34px; height: 34px; border-radius: 9px; }
.brand-mark--sm svg { width: 22px; height: 22px; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.25; }
.brand-copy strong { font-size: 17px; letter-spacing: -.02em; font-weight: 800; }
.brand-copy strong span { color: var(--accent); }
.brand-copy small { font-size: 10.5px; color: var(--faint); letter-spacing: .16em; margin-top: 2px; }

/* ---------- 搜索触发器 ---------- */
.search-trigger {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 10px 11px; margin-bottom: 22px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--faint); font-size: 12.5px; text-align: left;
  transition: border-color var(--speed), background var(--speed), color var(--speed);
}
.search-trigger:hover { border-color: var(--accent-line); color: var(--text-soft); background: var(--accent-soft); }
.search-trigger .icon { width: 15px; height: 15px; }
.search-trigger span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-trigger kbd, .search-field kbd {
  font-size: 10px; padding: 2px 5px; border-radius: 4px; color: var(--faint);
  background: var(--panel-2); border: 1px solid var(--border); white-space: nowrap;
}

/* ---------- 导航 ---------- */
.nav-group { margin-bottom: 18px; }
.nav-group-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 10px 7px; }
.nav-group-head span { font-size: 10.5px; font-weight: 750; letter-spacing: .18em; color: var(--faint); }
.nav-group-head em { font-size: 10px; color: var(--faint); opacity: .6; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin: 1px 0; border-radius: 9px;
  color: var(--muted); font-size: 13.5px; font-weight: 500;
  transition: color var(--speed), background var(--speed);
}
.nav-link .icon { width: 16.5px; height: 16.5px; opacity: .8; }
.nav-link:hover { color: var(--text); background: var(--panel-2); }
.nav-link.is-active { color: var(--text); background: linear-gradient(90deg, var(--accent-soft), transparent); font-weight: 650; }
.nav-link.is-active::before {
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 2px;
  border-radius: 2px; background: var(--accent); box-shadow: 0 0 12px var(--accent);
}
.nav-link.is-active .icon { color: var(--accent); opacity: 1; }
.nav-text { flex: 1; }
.nav-chapter { font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); opacity: .7; }
.nav-link.is-visited .nav-chapter::after { content: " ✓"; color: var(--accent); }

/* ---------- 侧栏底部 ---------- */
.sidebar-bottom { padding: 14px 20px 18px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--bg-soft) 60%, transparent); }
.side-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; }
.progress-ring {
  width: 44px; height: 44px; flex: none; border-radius: 50%; position: relative;
  display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p, 0) * 1%), var(--ring-track) 0);
  transition: background .4s var(--ease);
}
.progress-ring::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--bg-elev); }
.progress-ring span { position: relative; z-index: 1; font-family: var(--font-mono); font-size: 11.5px; font-weight: 700; color: var(--text); }
.side-progress-copy { display: flex; flex-direction: column; line-height: 1.4; }
.side-progress-copy strong { font-size: 12.5px; }
.side-progress-copy small { font-size: 10.5px; color: var(--faint); }
.side-actions { display: flex; align-items: center; gap: 7px; }
.side-version { margin-left: auto; font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); opacity: .7; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center;
  border-radius: 9px; border: 1px solid var(--border); background: var(--panel-2);
  color: var(--muted); transition: all var(--speed) var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--panel); }
.icon-btn .icon { width: 16px; height: 16px; }
#themeToggle .icon-sun, html[data-theme="light"] #themeToggle .icon-moon { display: none; }
html[data-theme="light"] #themeToggle .icon-sun { display: block; }

/* ---------- 移动端 ---------- */
.mobile-bar { display: none; }
.sidebar-scrim { display: none; }
@media (max-width: 1100px) {
  .sidebar { transform: translateX(-102%); transition: transform .3s var(--ease); box-shadow: none; }
  .sidebar.is-open { transform: translateX(0); box-shadow: 0 0 80px rgba(0, 0, 0, .5); }
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(2, 8, 14, .55); backdrop-filter: blur(3px); }
  .sidebar-scrim[hidden] { display: none; }
  .main-col { margin-left: 0; }
  .main { padding: 24px 20px 70px; max-width: none; }
  .mobile-bar {
    position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: color-mix(in srgb, var(--bg) 80%, transparent);
    border-bottom: 1px solid var(--border); backdrop-filter: blur(16px);
  }
  .mobile-brand { font-weight: 800; font-size: 15px; letter-spacing: -.02em; color: var(--text); }
  .mobile-brand span { color: var(--accent); }
  .reading-progress { top: 55px; }
  .page { max-width: none; }
}
@media (min-width: 1101px) {
  .reading-progress { position: fixed; }
}

/* ---------- 阅读进度 ---------- */
.reading-progress {
  position: sticky; top: 0; z-index: 50; height: 2px; width: 100%;
  background: transparent; pointer-events: none;
}
@media (min-width: 1101px) { .reading-progress { position: fixed; top: 0; left: var(--sidebar-w); right: 0; width: auto; } }
#progressBar {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent); transition: width .1s linear;
}

/* ---------- 页头 ---------- */
.page-head { padding: 6px 0 38px; margin-bottom: 42px; border-bottom: 1px solid var(--border); }
.kicker { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 18px; font-size: 11.5px; font-weight: 650; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.kicker-num {
  font-family: var(--font-mono); font-size: 10px; padding: 3px 8px; border-radius: 5px;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line);
  letter-spacing: .06em;
}
.page-head h1 { font-size: clamp(2.2rem, 1.55rem + 2.3vw, 3.45rem); letter-spacing: -.04em; line-height: 1.14; margin: 0 0 18px; text-wrap: balance; word-break: keep-all; overflow-wrap: anywhere; }
.lede { font-size: 1.13rem; line-height: 1.88; color: var(--muted); max-width: 56em; margin: 0 0 24px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; }
.meta-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  font-size: 12px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border);
}
.meta-chip .icon { width: 12px; height: 12px; color: var(--faint); }

/* ---------- 正文排版 ---------- */
.prose { font-size: 16.4px; line-height: 1.95; color: var(--text-soft); }
.prose > p, .prose > ul, .prose > ol, .prose > blockquote { max-width: 1040px; }
.prose h2 {
  position: relative; margin: 3.5em 0 .95em; font-size: 1.72rem; letter-spacing: -.028em; word-break: keep-all; overflow-wrap: anywhere;
  scroll-margin-top: 90px; padding-top: 1.1em; border-top: 1px solid var(--border);
}
.prose h2::before {
  content: ""; position: absolute; top: -1px; left: 0; width: 42px; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 2px;
}
.prose h3 { margin: 2.4em 0 .65em; font-size: 1.22rem; letter-spacing: -.018em; scroll-margin-top: 90px; word-break: keep-all; overflow-wrap: anywhere; }
.prose h4 { margin: 1.8em 0 .5em; font-size: 1rem; color: var(--text); }
.prose p { margin: 0 0 1.15em; }
.prose ul, .prose ol { padding-left: 1.35em; margin: 0 0 1.3em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--accent); }
.prose li > ul, .prose li > ol { margin-top: .35em; }
.prose a {
  color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 3px; text-decoration-thickness: 1px; transition: all var(--speed);
}
.prose a:hover { text-decoration-color: var(--accent); background: var(--accent-soft); }
.prose strong { color: var(--text); font-weight: 680; }
.prose blockquote {
  margin: 1.8em 0; padding: 4px 0 4px 20px; border-left: 2px solid var(--accent);
  color: var(--muted); font-size: 15px;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code {
  padding: 2px 6px; border-radius: 5px; font-size: .855em;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 14%, transparent);
  white-space: nowrap;
}
.prose pre code { padding: 0; border: 0; background: none; color: inherit; font-size: inherit; white-space: inherit; }
.prose .figure, .prose .table-wrap, .prose .callout, .prose .card-grid, .prose .split, .prose .tabs, .prose .quiz { max-width: none; }
.prose hr { margin: 2.8em 0; }

/* ---------- 标题锚点 ---------- */
.heading-anchor {
  display: inline-grid; place-items: center; width: 24px; height: 24px; margin-left: 8px;
  border-radius: 6px; color: var(--faint); opacity: 0; vertical-align: middle;
  transition: opacity var(--speed), color var(--speed), background var(--speed);
  border: 0; background: none; padding: 0; cursor: pointer;
}
h2:hover .heading-anchor, h3:hover .heading-anchor, .heading-anchor:focus-visible { opacity: 1; }
.heading-anchor:hover { color: var(--accent); background: var(--accent-soft); }
.heading-anchor .icon { width: 14px; height: 14px; }

/* ---------- 代码块 ---------- */
.code-block, .prose pre {
  position: relative; margin: 1.6em 0; border-radius: 13px; overflow: hidden;
  background: var(--code-bg); border: 1px solid var(--code-border);
  box-shadow: var(--shadow-soft);
}
.prose pre { padding: 44px 20px 18px; overflow-x: auto; font-size: 13px; line-height: 1.75; color: #d6e2f0; }
.prose pre::before {
  content: attr(data-lang); position: absolute; top: 0; left: 0; right: 0; height: 32px;
  display: flex; align-items: center; padding: 0 14px; font-family: var(--font-mono);
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #6f8399;
  background: rgba(255, 255, 255, .025); border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.prose pre:not([data-lang])::before { content: "code"; }
.copy-btn {
  position: absolute; top: 5px; right: 8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px;
  border-radius: 6px; border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .04); color: #8297ab; font-size: 10.5px;
  transition: all var(--speed);
}
.copy-btn:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.copy-btn .icon { width: 12px; height: 12px; }
.copy-btn.is-done { color: var(--accent); border-color: var(--accent-line); }

/* ---------- 表格 ---------- */
.table-wrap {
  margin: 1.7em 0; border: 1px solid var(--border); border-radius: 13px;
  overflow-x: auto; background: var(--panel); box-shadow: var(--shadow-soft);
}
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.65; min-width: 480px; }
.table-wrap th {
  text-align: left; padding: 11px 15px; font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); font-weight: 700;
  background: color-mix(in srgb, var(--panel-2) 65%, transparent);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table-wrap td { padding: 11px 15px; border-top: 1px solid var(--border); vertical-align: top; color: var(--text-soft); }
.table-wrap tr:first-child td { border-top: 0; }
.table-wrap tbody tr { transition: background var(--speed); }
.table-wrap tbody tr:hover { background: var(--panel-2); }
.table-wrap td:first-child { color: var(--text); font-weight: 550; }
.table-wrap code { font-size: .85em; }

/* ---------- 提示框 ---------- */
.callout {
  display: grid; grid-template-columns: 30px 1fr; gap: 13px;
  margin: 1.7em 0; padding: 17px 20px 15px; border-radius: 13px;
  border: 1px solid color-mix(in srgb, var(--callout-c) 22%, transparent);
  background: color-mix(in srgb, var(--callout-c) 7%, var(--panel));
  --callout-c: var(--accent);
}
.callout-icon {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  color: var(--callout-c); background: color-mix(in srgb, var(--callout-c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--callout-c) 24%, transparent);
}
.callout-icon .icon { width: 16px; height: 16px; }
.callout-title { display: block; margin-bottom: 3px; color: var(--text); font-size: 13.5px; font-weight: 700; }
.callout p { margin: 0; font-size: 14.2px; line-height: 1.8; color: var(--text-soft); }
.callout p + p { margin-top: .5em; }
.callout--warn { --callout-c: var(--warn); }
.callout--danger { --callout-c: var(--danger); }
.callout--story { --callout-c: var(--violet); }
.callout--deep { --callout-c: var(--info); }
.callout--tip { --callout-c: var(--accent); }

/* ---------- 卡片 / 网格 ---------- */
.card-grid { display: grid; gap: 14px; margin: 1.7em 0; }
.card-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 20px; border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--panel), color-mix(in srgb, var(--panel) 40%, transparent));
  box-shadow: var(--shadow-soft); overflow: hidden;
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
}
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--accent) 8%, transparent), transparent 60%);
  opacity: 0; transition: opacity .3s;
}
.card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card:hover::after { opacity: 1; }
.card-icon {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line);
  margin-bottom: 2px;
}
.card-icon .icon { width: 18px; height: 18px; }
.card h3, .card h4 { margin: 0; font-size: 14.5px; }
.card p { margin: 0; font-size: 12.8px; line-height: 1.7; color: var(--muted); }
.card .card-link { margin-top: auto; padding-top: 6px; font-size: 12px; font-weight: 600; color: var(--accent); display: inline-flex; align-items: center; gap: 4px; }
.card .card-link .icon { width: 12px; height: 12px; transition: transform var(--speed); }
.card:hover .card-link .icon { transform: translateX(3px); }
.card-num { position: absolute; top: 14px; right: 16px; font-family: var(--font-mono); font-size: 11px; color: var(--faint); opacity: .65; }
.card--link { color: inherit; }
.card--link:hover { color: inherit; }

/* ---------- 统计条 ---------- */
.stat-band {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  margin: 2.2em 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); overflow: hidden;
}
.stat { padding: 18px 20px; border-left: 1px solid var(--border); }
.stat:first-child { border-left: 0; }
.stat b { display: block; font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; color: var(--text); letter-spacing: -.03em; line-height: 1.2; }
.stat span { font-size: 11.5px; color: var(--muted); }
.stat b em { font-style: normal; font-size: .6em; color: var(--accent); margin-left: 2px; }

/* ---------- 步骤 ---------- */
.steps { margin: 1.8em 0; display: flex; flex-direction: column; gap: 0; }
.step { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 16px; padding-bottom: 26px; }
.step:last-child { padding-bottom: 0; }
.step::before {
  content: ""; position: absolute; left: 16px; top: 34px; bottom: 0; width: 1px;
  background: linear-gradient(var(--border-strong), var(--border));
}
.step:last-child::before { display: none; }
.step-num {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border: 1px solid var(--accent-line); position: relative; z-index: 1;
}
.step-body { padding-top: 4px; }
.step-body strong { display: block; font-size: 14.5px; margin-bottom: 3px; }
.step-body p { margin: 0; font-size: 13.8px; line-height: 1.75; color: var(--muted); }
.step-body p + p { margin-top: .5em; }

/* ---------- 流程 ---------- */
.flow { display: flex; align-items: stretch; flex-wrap: wrap; gap: 8px; margin: 1.8em 0; }
.flow-node {
  flex: 1 1 120px; min-width: 110px; padding: 13px 14px; border-radius: 11px;
  background: var(--panel); border: 1px solid var(--border); text-align: center;
  transition: all var(--speed);
}
.flow-node:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.flow-node strong { display: block; font-size: 13px; margin-bottom: 2px; }
.flow-node span { font-size: 10.5px; color: var(--faint); font-family: var(--font-mono); }
.flow-arrow { display: grid; place-items: center; color: var(--faint); flex: none; }
.flow-arrow .icon { width: 14px; height: 14px; }
.flow-node--accent { background: var(--accent-soft); border-color: var(--accent-line); }
.flow-node--accent strong { color: var(--accent); }

/* ---------- 流水线步骤地图 ---------- */
.pipeline-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 1.9em 0; }
.pipeline-step {
  position: relative; padding: 16px 17px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: linear-gradient(155deg, var(--panel), transparent);
  transition: border-color var(--speed), transform var(--speed), background var(--speed);
}
.pipeline-step:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.pipeline-step b {
  display: block; font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .12em; color: var(--accent); margin-bottom: 12px;
}
.pipeline-step strong { display: block; font-size: 13.5px; color: var(--text); }
.pipeline-step span { display: block; margin-top: 3px; font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); }
.pipeline-step em { display: block; margin-top: 8px; font-style: normal; font-size: 10.5px; line-height: 1.5; color: var(--muted); }
.pipeline-step--accent { border-color: var(--accent-line); background: linear-gradient(155deg, var(--accent-soft), transparent); }
@media (max-width: 820px) { .pipeline-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }
@media (max-width: 360px) { .pipeline-steps { grid-template-columns: 1fr; } }

/* ---------- 分层架构 ---------- */
.layers { display: flex; flex-direction: column; gap: 8px; margin: 1.8em 0; }
.layer {
  display: grid; grid-template-columns: 116px 1fr; gap: 16px; align-items: start;
  padding: 16px 18px; border-radius: 12px; border: 1px solid var(--border);
  background: linear-gradient(90deg, var(--panel), transparent);
  transition: border-color var(--speed), transform var(--speed);
}
.layer:hover { border-color: var(--accent-line); transform: translateX(3px); }
.layer-name { font-size: 12px; font-weight: 750; letter-spacing: .06em; color: var(--accent); padding-top: 2px; }
.layer-name span { display: block; font-family: var(--font-mono); font-size: 9px; color: var(--faint); letter-spacing: .04em; margin-top: 3px; }
.layer-body { display: flex; flex-wrap: wrap; gap: 6px; }
.layer-body code { font-size: 11.5px; }
.layer-desc { width: 100%; font-size: 12.5px; color: var(--muted); line-height: 1.7; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 550; color: var(--muted); background: var(--panel-2);
  border: 1px solid var(--border); white-space: nowrap;
}
.tag--accent { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.tag--warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 9%, transparent); border-color: color-mix(in srgb, var(--warn) 26%, transparent); }
.tag--danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent); border-color: color-mix(in srgb, var(--danger) 26%, transparent); }
.tag--info { color: var(--info); background: color-mix(in srgb, var(--info) 9%, transparent); border-color: color-mix(in srgb, var(--info) 26%, transparent); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: .8em 0 1.2em; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font-size: 13.5px; font-weight: 600;
  text-decoration: none; transition: all .2s var(--ease); white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); background: var(--panel-2); color: var(--text); transform: translateY(-1px); }
.btn .icon { width: 15px; height: 15px; }
.btn--primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--accent-2)));
  color: var(--accent-ink); border-color: transparent;
  box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--accent) 55%, transparent);
}
.btn--primary:hover { color: var(--accent-ink); filter: brightness(1.06); box-shadow: 0 14px 36px -12px color-mix(in srgb, var(--accent) 65%, transparent); }
.btn--ghost { background: transparent; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 1.6em 0; }

/* ---------- Tabs ---------- */
.tabs { margin: 1.7em 0; border: 1px solid var(--border); border-radius: 13px; background: var(--panel); overflow: hidden; }
.tab-list { display: flex; gap: 2px; padding: 6px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tab-list::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 8px 13px; border-radius: 8px; border: 1px solid transparent; background: transparent;
  color: var(--muted); font-size: 12.5px; font-weight: 550; white-space: nowrap; transition: all var(--speed);
}
.tab-btn:hover { color: var(--text); background: var(--panel-2); }
.tab-btn[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.tab-panel { display: none; padding: 20px 22px; }
.tab-panel.is-active { display: block; animation: fadeUp .3s var(--ease); }
.tab-panel > :first-child { margin-top: 0; }
.tab-panel > :last-child { margin-bottom: 0; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 分割布局 ---------- */
.split { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin: 1.7em 0; align-items: start; }
.split--wide-left { grid-template-columns: 1.3fr 1fr; }
.split--wide-right { grid-template-columns: 1fr 1.3fr; }

/* ---------- 图表 ---------- */
.figure {
  margin: 1.9em 0; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--panel); overflow: hidden; box-shadow: var(--shadow-soft);
}
.figure-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.figure-head strong { color: var(--text); font-size: 12.5px; }
.figure-body { padding: 16px; }
.figure figcaption { padding: 10px 16px 14px; font-size: 11.5px; color: var(--faint); border-top: 1px solid var(--border); }
.figure-body canvas { display: block; width: 100%; }

/* ---------- 摘要卡 / 金句 ---------- */
.pullquote {
  margin: 2.2em 0; padding: 26px 30px; border-radius: var(--radius);
  background: linear-gradient(120deg, var(--accent-soft), transparent 70%);
  border: 1px solid var(--accent-line); border-left: 3px solid var(--accent);
  font-size: 1.08rem; line-height: 1.75; color: var(--text); font-weight: 500;
}
.pullquote span { display: block; margin-top: 8px; font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---------- 测验 ---------- */
.quiz { margin: 2em 0; padding: 20px 22px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel); }
.quiz-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--accent); text-transform: uppercase; }
.quiz-question { font-size: 14.5px; font-weight: 650; color: var(--text); margin-bottom: 12px; }
.quiz-options { display: flex; flex-direction: column; gap: 7px; }
.quiz-options button {
  text-align: left; padding: 10px 14px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text-soft); font-size: 13px; transition: all var(--speed);
}
.quiz-options button:hover:not(:disabled) { border-color: var(--accent-line); background: var(--accent-soft); }
.quiz-options button:disabled { cursor: default; }
.quiz-options button.is-correct { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.quiz-options button.is-wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); color: var(--danger); }
.quiz-explain { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); font-size: 13px; line-height: 1.75; color: var(--muted); }
.quiz-explain.is-visible { display: block; animation: fadeUp .3s var(--ease); }
.quiz-explain strong { color: var(--accent); }

/* ---------- 术语提示 ---------- */
.term {
  color: inherit; border-bottom: 1px dotted var(--accent); cursor: help;
  text-underline-offset: 3px; transition: color var(--speed), background var(--speed);
}
.term:hover { color: var(--accent); background: var(--accent-soft); }
.term-tip {
  position: fixed; z-index: 200; max-width: 320px; padding: 11px 14px; border-radius: 10px;
  background: var(--panel-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  font-size: 12.5px; line-height: 1.65; color: var(--text-soft); pointer-events: none;
  opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s;
}
.term-tip.is-visible { opacity: 1; transform: none; }
.term-tip strong { display: block; color: var(--text); margin-bottom: 3px; }

/* ---------- 筛选器 ---------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 1.5em 0 1.2em; }
.filter-label { font-size: 11px; color: var(--faint); letter-spacing: .08em; margin-right: 4px; }
.chip-btn {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--muted); font-size: 12px; font-weight: 550;
  transition: all var(--speed);
}
.chip-btn:hover { color: var(--text); border-color: var(--border-strong); }
.chip-btn.is-active { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
[data-filter-item][hidden] { display: none !important; }

/* ---------- 策略卡 ---------- */
.strategy-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 1.4em 0; }
.strategy {
  padding: 17px 18px; border-radius: 13px; border: 1px solid var(--border);
  background: var(--panel); transition: all .25s var(--ease); position: relative;
}
.strategy:hover { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.strategy-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.strategy h4 { margin: 0; font-size: 14px; }
.strategy-code { font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); }
.strategy p { margin: 0 0 9px; font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.strategy .tag-row { margin: 0; }

/* ---------- 术语表 ---------- */
.glossary-search { position: relative; margin: 1.8em 0 1.4em; }
.glossary-search input {
  width: 100%; padding: 12px 16px 12px 42px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  font-size: 14px; transition: border-color var(--speed), box-shadow var(--speed);
}
.glossary-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.glossary-search .icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.glossary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.gloss-item {
  padding: 14px 16px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--panel); scroll-margin-top: 90px;
}
.gloss-item h4 { margin: 0 0 5px; font-size: 13.5px; display: flex; align-items: baseline; gap: 7px; }
.gloss-item h4 span { font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); font-weight: 400; }
.gloss-item p { margin: 0; font-size: 12.3px; line-height: 1.7; color: var(--muted); }
.gloss-item .gloss-link { display: inline-block; margin-top: 6px; font-size: 11px; color: var(--accent); }
.gloss-empty { padding: 30px 0; text-align: center; color: var(--faint); font-size: 13px; }

/* ---------- 页脚 ---------- */
.site-footer { margin-top: 70px; padding-top: 26px; border-top: 1px solid var(--border); }
.footer-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 20px; }
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-brand strong { display: block; font-size: 13px; }
.footer-brand span:not(.brand-mark) { display: block; font-size: 11px; color: var(--faint); }
.footer-note { font-size: 11.5px; color: var(--faint); max-width: 40em; line-height: 1.7; margin: 0; }
.footer-bottom { display: flex; flex-wrap: wrap; gap: 8px 20px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 10.5px; color: var(--faint); }
.footer-bottom code { font-size: 9.5px; padding: 1px 5px; border-radius: 4px; background: var(--panel-2); }
.footer-links { margin-left: auto; display: flex; gap: 14px; }
.footer-links a { color: var(--faint); }
.footer-links a:hover { color: var(--accent); }

/* ---------- 章节导航 ---------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 54px; }
.pager-card {
  display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  transition: all .22s var(--ease); min-height: 82px;
}
.pager-card:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); transform: translateY(-2px); }
.pager-dir { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--faint); letter-spacing: .05em; }
.pager-dir .icon { width: 12px; height: 12px; }
.pager-card strong { font-size: 14px; }
.pager-card em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.pager-next { text-align: right; align-items: flex-end; }
.pager-empty { visibility: hidden; }

/* ---------- 动画 ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; z-index: 250; transform: translate(-50%, 16px);
  padding: 10px 18px; border-radius: 9px; font-size: 12.5px; color: var(--text);
  background: var(--panel-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: all .25s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 搜索 ---------- */
.search-overlay {
  position: fixed; inset: 0; z-index: 200; padding: 10vh 20px 20px;
  background: rgba(2, 7, 13, .62); backdrop-filter: blur(10px);
  animation: overlayIn .2s var(--ease);
}
.search-overlay[hidden] { display: none; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.search-panel {
  width: min(720px, 100%); margin: 0 auto; max-height: 76vh; display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: 16px;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .7); overflow: hidden;
  animation: panelIn .26s var(--ease);
}
@keyframes panelIn { from { opacity: 0; transform: translateY(-10px) scale(.985); } to { opacity: 1; transform: none; } }
.search-field { display: flex; align-items: center; gap: 11px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.search-field .icon { width: 18px; height: 18px; color: var(--accent); }
.search-field input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 15.5px; color: var(--text); outline: none; }
.search-field input::placeholder { color: var(--faint); }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-body { flex: 1; min-height: 120px; overflow-y: auto; padding: 14px 10px; }
.search-default { padding: 6px 10px 10px; }
.search-label { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin: 6px 0 10px; }
.search-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.search-chips button {
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--muted); font-size: 11.5px; transition: all var(--speed);
}
.search-chips button:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.search-tip { display: flex; gap: 9px; align-items: flex-start; padding: 12px 14px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--border); font-size: 11.5px; color: var(--faint); line-height: 1.6; }
.search-tip .icon { width: 14px; height: 14px; color: var(--accent); margin-top: 2px; }
.search-results { display: none; }
.search-results.has-results { display: block; }
.search-group-label { padding: 10px 12px 5px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.search-result {
  display: block; padding: 11px 12px; border-radius: 9px; color: var(--text-soft);
  border: 1px solid transparent; transition: background var(--speed), border-color var(--speed);
}
.search-result:hover, .search-result.is-selected { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }
.search-result-top { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.search-result-page { font-size: 10px; color: var(--faint); font-family: var(--font-mono); }
.search-result-kind { margin-left: auto; font-size: 9px; padding: 1px 6px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--border); color: var(--faint); }
.search-result-title { font-size: 13.5px; font-weight: 650; line-height: 1.45; }
.search-result-snippet { margin-top: 3px; font-size: 11.5px; line-height: 1.6; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-result-snippet mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text); border-radius: 2px; padding: 0 1px; }
.search-no-result { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.search-no-result strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }
.search-footer { display: flex; align-items: center; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: 10px; color: var(--faint); }
.search-footer span { display: inline-flex; align-items: center; gap: 4px; }
.search-footer kbd { font-size: 9px; padding: 1px 4px; border-radius: 3px; background: var(--panel-2); border: 1px solid var(--border); }
.search-count { margin-left: auto; }

/* ---------- 首页 Hero ---------- */
.page--home { max-width: 100%; }
.hero { display: grid; grid-template-columns: 1.08fr .92fr; gap: 48px; align-items: center; padding: 34px 0 46px; min-height: 520px; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 22px; padding: 5px 11px 5px 6px;
  border-radius: 999px; background: var(--panel); border: 1px solid var(--border);
  font-size: 11px; color: var(--muted); letter-spacing: .03em;
}
.hero-eyebrow b { padding: 2px 7px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 9px; letter-spacing: .06em; }
.hero-eyebrow .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: pulse 2.4s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.hero h1 { font-size: clamp(2.35rem, 1.85rem + 2.1vw, 3.3rem); line-height: 1.14; letter-spacing: -.045em; margin: 0 0 20px; font-weight: 780; word-break: keep-all; overflow-wrap: anywhere; }
.hero-line { display: inline-block; white-space: nowrap; }
.hero h1 .grad {
  background: linear-gradient(100deg, var(--accent) 5%, var(--accent-2) 55%, var(--accent-3) 105%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
}
.hero-lede { font-size: 1.08rem; line-height: 1.9; color: var(--muted); max-width: 33em; margin-bottom: 28px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 18px; font-size: 11px; color: var(--faint); }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta .icon { width: 13px; height: 13px; color: var(--accent); }

/* Hero 视觉：分析卡 */
.hero-stage { position: relative; perspective: 1200px; }
.analysis-card {
  position: relative; z-index: 2; border-radius: 18px; padding: 0; overflow: hidden;
  background: linear-gradient(165deg, rgba(20, 32, 48, .97), rgba(10, 17, 27, .97));
  border: 1px solid rgba(61, 220, 151, .18);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .03) inset;
  transform: rotateY(-7deg) rotateX(2deg);
  transition: transform .6s var(--ease);
}
.hero-stage:hover .analysis-card { transform: rotateY(-2deg) rotateX(0); }
html[data-theme="light"] .analysis-card { background: linear-gradient(165deg, #102433, #0a1822); }
.ac-top { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.ac-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.ac-dot:first-child { background: #ff6b6b; }
.ac-dot:nth-child(2) { background: #fbbf24; }
.ac-dot:nth-child(3) { background: #3ddc97; }
.ac-title { margin-left: 8px; font-family: var(--font-mono); font-size: 9.5px; color: #7d93a8; letter-spacing: .09em; }
.ac-live { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 8.5px; color: #3ddc97; letter-spacing: .12em; }
.ac-live i { width: 5px; height: 5px; border-radius: 50%; background: #3ddc97; box-shadow: 0 0 8px #3ddc97; }
.ac-body { padding: 16px 18px 14px; color: #e8eef7; }
.ac-stock { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.ac-name { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.ac-code { font-family: var(--font-mono); font-size: 9.5px; color: #7d93a8; margin-top: 2px; }
.ac-price { text-align: right; font-family: var(--font-mono); }
.ac-price b { display: block; font-size: 19px; font-weight: 650; letter-spacing: -.02em; }
.ac-price span { font-size: 10px; color: #ff8b9c; }
.ac-chart { margin: 4px 0 12px; height: 76px; }
.ac-chart svg { width: 100%; height: 100%; overflow: visible; }
.ac-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.ac-cell { padding: 8px 9px; border-radius: 8px; background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .06); }
.ac-cell small { display: block; font-size: 8.5px; color: #7d93a8; letter-spacing: .05em; margin-bottom: 2px; }
.ac-cell b { font-size: 10.5px; font-weight: 600; color: #dbe6f3; }
.ac-cell b.up { color: #3ddc97; }
.ac-verdict { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px; background: rgba(61, 220, 151, .08); border: 1px solid rgba(61, 220, 151, .2); }
.ac-badge { font-size: 9px; padding: 2px 7px; border-radius: 999px; background: rgba(61, 220, 151, .16); color: #3ddc97; border: 1px solid rgba(61, 220, 151, .3); font-weight: 650; }
.ac-verdict-text { font-size: 10px; color: #b9c8d8; line-height: 1.5; }
.ac-score { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(#3ddc97 65%, rgba(255, 255, 255, .08) 0); position: relative; flex: none; }
.ac-score::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: #0c1622; }
.ac-score b { position: relative; font-family: var(--font-mono); font-size: 10px; color: #3ddc97; }
.ac-foot { display: flex; justify-content: space-between; padding: 9px 16px; border-top: 1px solid rgba(255, 255, 255, .06); font-family: var(--font-mono); font-size: 8.5px; color: #6f8399; }
.float-chip {
  position: absolute; z-index: 3; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border-radius: 9px; font-size: 10px; font-weight: 550;
  background: var(--panel-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  animation: float 6s ease-in-out infinite; white-space: nowrap; color: var(--text-soft);
}
.float-chip .icon { width: 12px; height: 12px; color: var(--accent); }
.float-chip--a { top: -16px; left: 8px; }
.float-chip--b { top: -16px; right: 8px; animation-delay: -2.4s; }
.float-chip--c { bottom: -34px; right: 18px; animation-delay: -4.1s; }
@keyframes float { 50% { transform: translateY(-7px); } }
.hero-note { position: absolute; bottom: -62px; left: 4px; font-size: 9.5px; color: var(--faint); letter-spacing: .04em; }

/* ---------- 首页区块 ---------- */
.home-section { margin: 76px 0; }
.section-head { margin-bottom: 26px; }
.section-head .kicker { margin-bottom: 10px; }
.section-head h2 { font-size: clamp(1.65rem, 1.35rem + 1.1vw, 2.15rem); letter-spacing: -.03em; margin: 0 0 8px; word-break: keep-all; overflow-wrap: anywhere; }
.section-head p { color: var(--muted); font-size: 14px; margin: 0; max-width: 44em; line-height: 1.8; }
.section-head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.home-section--tight { margin: 46px 0; }

.hero-band {
  display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 10px; color: var(--faint); letter-spacing: .06em;
}
.hero-band span { display: inline-flex; align-items: center; gap: 6px; }
.hero-band i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }

.cap-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cap-card {
  position: relative; padding: 20px; border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--panel), transparent 90%); overflow: hidden;
  transition: all .28s var(--ease);
}
.cap-card:hover { border-color: var(--accent-line); transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.cap-card .card-icon { margin-bottom: 12px; }
.cap-card h3 { margin: 0 0 5px; font-size: 14.5px; }
.cap-card p { margin: 0; font-size: 12.4px; line-height: 1.72; color: var(--muted); }
.cap-card .cap-tag { position: absolute; top: 18px; right: 18px; font-family: var(--font-mono); font-size: 9px; color: var(--faint); letter-spacing: .08em; }

.path-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.path-card {
  position: relative; padding: 20px 18px 18px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--panel); display: flex; flex-direction: column; min-height: 200px;
  transition: all .28s var(--ease); overflow: hidden;
}
.path-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: .45; }
.path-card:hover { transform: translateY(-4px); border-color: var(--accent-line); box-shadow: var(--shadow-soft); }
.path-num { font-family: var(--font-mono); font-size: 10px; color: var(--accent); letter-spacing: .1em; margin-bottom: 12px; }
.path-card h3 { margin: 0 0 6px; font-size: 15px; }
.path-card p { margin: 0 0 14px; font-size: 12.2px; line-height: 1.7; color: var(--muted); }
.path-card .path-link { margin-top: auto; font-size: 11.5px; font-weight: 600; color: var(--accent); display: inline-flex; align-items: center; gap: 4px; }
.path-card .path-link .icon { width: 11px; height: 11px; }
.path-card .path-time { position: absolute; top: 18px; right: 16px; font-size: 9.5px; color: var(--faint); }

.arch-mini {
  padding: 24px; border-radius: var(--radius); border: 1px solid var(--border);
  background: radial-gradient(800px circle at 20% 0%, var(--accent-soft), transparent 55%), var(--panel);
}
.arch-mini-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.arch-mini-node { padding: 10px 14px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-elev); font-family: var(--font-mono); font-size: 10.5px; color: var(--text-soft); }
.arch-mini-node b { display: block; font-family: var(--font-sans); font-size: 11.5px; color: var(--text); margin-bottom: 1px; }
.arch-mini-node--accent { border-color: var(--accent-line); background: var(--accent-soft); }
.arch-mini-arrow { color: var(--faint); }
.arch-mini-arrow .icon { width: 13px; height: 13px; }
.arch-mini-caption { margin: 16px 0 0; font-size: 11px; color: var(--faint); }

.graph-teaser {
  position: relative; display: grid; grid-template-columns: 1fr .9fr; gap: 30px; align-items: center;
  padding: 34px; border-radius: var(--radius-lg); overflow: hidden;
  background: radial-gradient(600px circle at 85% 50%, var(--accent-soft), transparent 60%), linear-gradient(135deg, var(--panel), transparent);
  border: 1px solid var(--border);
}
.graph-teaser h2 { margin: 0 0 10px; font-size: 1.65rem; letter-spacing: -.025em; }
.graph-teaser p { color: var(--muted); font-size: 13.5px; line-height: 1.8; margin: 0 0 18px; max-width: 34em; }
.graph-teaser-art { position: relative; height: 230px; }
.graph-teaser-art svg { width: 100%; height: 100%; }
.gt-node { animation: nodePulse 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes nodePulse { 50% { opacity: .55; } }

.cta-band {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px;
  margin-top: 54px; padding: 26px 28px; border-radius: var(--radius);
  background: linear-gradient(120deg, var(--accent-soft), transparent 65%), var(--panel);
  border: 1px solid var(--accent-line);
}
.cta-band strong { font-size: 15px; display: block; margin-bottom: 3px; }
.cta-band p { margin: 0; font-size: 12px; color: var(--muted); }

/* ---------- 知识图谱 ---------- */
body.page-graph { overflow: hidden; }
body.page-graph .main { max-width: none; padding: 0; width: 100%; }
body.page-graph .page--graph { max-width: none; width: 100%; height: 100%; }
body.page-graph .site-footer, body.page-graph .pager { display: none; }
body.page-graph .main-col { height: 100vh; overflow: hidden; }
@media (max-width: 1100px) {
  body.page-graph { overflow: auto; }
  body.page-graph .main-col { height: auto; }
  .graph-page { height: calc(100vh - 56px); height: calc(100dvh - 56px); min-height: 560px; }
}
.graph-page { position: relative; height: 100vh; min-height: 620px; display: flex; flex-direction: column; overflow: hidden; }
.graph-canvas-wrap { position: relative; flex: 1; min-height: 0; }
#graphCanvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#graphCanvas.is-dragging { cursor: grabbing; }
.graph-overlay { position: absolute; inset: 0; pointer-events: none; }
.graph-overlay > * { pointer-events: auto; }
.graph-hero {
  position: absolute; top: 24px; left: 24px; max-width: 460px; z-index: 3;
  padding: 14px 18px; margin: -4px -8px; border-radius: 18px; pointer-events: none;
  background: radial-gradient(ellipse at 18% 28%, color-mix(in srgb, var(--bg) 94%, transparent) 0%, color-mix(in srgb, var(--bg) 62%, transparent) 55%, transparent 100%);
  backdrop-filter: blur(2px);
}
.graph-hero .kicker { margin-bottom: 12px; }
.graph-hero h1 { font-size: clamp(1.7rem, 2.4vw, 2.4rem); letter-spacing: -.04em; margin: 0 0 8px; word-break: keep-all; overflow-wrap: anywhere; }
.graph-hero p { margin: 0 0 12px; font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.graph-stats { display: flex; gap: 16px; font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); letter-spacing: .05em; }
.graph-stats b { color: var(--accent); font-weight: 600; }
.graph-controls { position: absolute; top: 24px; right: 24px; z-index: 4; display: flex; flex-direction: column; gap: 8px; width: 300px; }
.graph-search {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--panel-solid) 88%, transparent); border: 1px solid var(--border-strong);
  backdrop-filter: blur(14px); box-shadow: var(--shadow-soft);
}
.graph-search .icon { width: 15px; height: 15px; color: var(--faint); flex: none; }
.graph-search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 12.5px; color: var(--text); }
.graph-search input::placeholder { color: var(--faint); }
.graph-search-status { display: none; padding: 0 4px; font-size: 9.5px; color: var(--accent); letter-spacing: .02em; text-align: right; }
.graph-search-status.is-visible { display: block; }
.graph-actions { display: flex; gap: 6px; }
.graph-action {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 8px; border-radius: 8px; border: 1px solid var(--border); background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
  color: var(--muted); font-size: 10.5px; backdrop-filter: blur(12px); transition: all var(--speed);
}
.graph-action:hover { color: var(--text); border-color: var(--border-strong); }
.graph-action .icon { width: 12px; height: 12px; }
.graph-action.is-active { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.graph-filters { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
.graph-filter {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px;
  border: 1px solid var(--border); background: color-mix(in srgb, var(--panel-solid) 82%, transparent);
  color: var(--muted); font-size: 10px; backdrop-filter: blur(10px); transition: all var(--speed);
}
.graph-filter i { width: 6px; height: 6px; border-radius: 50%; background: var(--g-color); }
.graph-filter:hover { color: var(--text); border-color: var(--border-strong); }
.graph-filter.is-off { opacity: .38; }

.graph-legend {
  position: absolute; left: 28px; bottom: 24px; z-index: 3; display: flex; flex-wrap: wrap; gap: 6px 12px;
  max-width: 420px; padding: 10px 14px; border-radius: 10px; font-size: 9.5px; color: var(--faint);
  background: color-mix(in srgb, var(--panel-solid) 78%, transparent); border: 1px solid var(--border); backdrop-filter: blur(10px);
}
.graph-legend span { display: inline-flex; align-items: center; gap: 5px; }
.graph-legend i { width: 6px; height: 6px; border-radius: 50%; }
.graph-zoom { position: absolute; right: 24px; bottom: 24px; z-index: 3; display: flex; gap: 5px; }
.graph-zoom button {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px;
  border: 1px solid var(--border); background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
  color: var(--muted); backdrop-filter: blur(10px);
}
.graph-zoom button:hover { color: var(--text); border-color: var(--border-strong); }
.graph-zoom .icon { width: 14px; height: 14px; }

.graph-panel {
  position: absolute; top: 24px; right: 24px; z-index: 5; width: 330px; max-height: calc(100% - 48px);
  display: none; flex-direction: column; overflow: hidden; border-radius: 15px;
  background: color-mix(in srgb, var(--panel-solid) 94%, transparent); border: 1px solid var(--border-strong);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6); backdrop-filter: blur(20px);
  animation: panelIn .24s var(--ease);
}
.graph-panel.is-open { display: flex; }
.graph-panel-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 17px 12px; border-bottom: 1px solid var(--border); }
.graph-panel-head .graph-group-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; }
.graph-panel-head h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; line-height: 1.35; }
.graph-panel-head small { display: block; font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); margin-top: 2px; }
.graph-panel-close { margin-left: auto; flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); }
.graph-panel-body { padding: 14px 17px 17px; overflow-y: auto; }
.graph-panel-body p { font-size: 12.8px; line-height: 1.8; color: var(--text-soft); margin: 0 0 12px; }
.graph-panel-links { display: flex; flex-direction: column; gap: 5px; margin: 12px 0; }
.graph-panel-links a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px;
  border-radius: 7px; border: 1px solid var(--border); background: var(--panel-2);
  font-size: 11.5px; color: var(--text-soft);
}
.graph-panel-links a:hover { border-color: var(--accent-line); color: var(--accent); }
.graph-panel-links a .icon { width: 11px; height: 11px; color: var(--faint); }
.graph-panel-relations { margin: 12px 0 4px; }
.graph-panel-relations h3 { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin: 0 0 7px; font-weight: 700; }
.rel-item { display: flex; align-items: baseline; gap: 6px; padding: 4px 0; font-size: 11px; color: var(--muted); }
.rel-item i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); flex: none; }
.rel-item b { color: var(--text-soft); font-weight: 550; }
.rel-type { margin-left: auto; font-size: 8.5px; color: var(--faint); font-family: var(--font-mono); }
.graph-panel-cta { display: flex; gap: 6px; margin-top: 14px; }
.graph-panel-cta .btn { flex: 1; padding: 8px 10px; font-size: 11px; }

.graph-tooltip {
  position: fixed; z-index: 30; pointer-events: none; padding: 7px 10px; border-radius: 7px;
  background: var(--panel-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  font-size: 11px; color: var(--text); opacity: 0; transform: translate(-50%, -130%);
  transition: opacity .12s; white-space: nowrap;
}
.graph-tooltip.is-visible { opacity: 1; }
.graph-tooltip small { display: block; color: var(--faint); font-size: 9px; }

.graph-list {
  position: absolute; inset: 0; z-index: 6; display: none; padding: 100px 30px 30px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); overflow-y: auto;
}
.graph-list.is-open { display: block; }
.graph-list-inner { max-width: 900px; margin: 0 auto; }
.graph-list h2 { font-size: 16px; margin: 22px 0 8px; display: flex; align-items: center; gap: 8px; }
.graph-list-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.graph-list-item {
  display: flex; align-items: center; gap: 7px; padding: 8px 10px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--panel); font-size: 11.5px; color: var(--text-soft);
}
.graph-list-item:hover { border-color: var(--accent-line); color: var(--accent); }
.graph-list-item i { width: 5px; height: 5px; border-radius: 50%; flex: none; }
.graph-empty { padding: 60px 20px; text-align: center; color: var(--faint); }

@media (max-width: 900px) {
  .graph-hero { top: 14px; left: 16px; right: 16px; max-width: none; }
  .graph-hero h1 { font-size: 1.5rem; }
  .graph-hero p { display: none; }
  .graph-stats { display: none; }
  .graph-controls { top: 112px; left: 16px; right: 16px; width: auto; flex-direction: column; }
  .graph-filters { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
  .graph-filters::-webkit-scrollbar { display: none; }
  .graph-filter { flex: none; }
  .graph-legend { display: none; }
  .graph-zoom { display: none; }
  .graph-panel { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 54%; border-radius: 16px 16px 0 0; }
  .graph-list-grid { grid-template-columns: repeat(2, 1fr); }
  .graph-list { padding-top: 80px; }
}

/* ---------- 首页响应式 ---------- */
@media (max-width: 1180px) {
  .hero { gap: 30px; }
  .float-chip--b { left: -12px; }
  .cap-grid { grid-template-columns: repeat(2, 1fr); }
  .path-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 12px; min-height: 0; gap: 46px; }
  .hero-stage { max-width: 440px; margin: 0 auto; width: 100%; }
  .analysis-card { transform: none; }
  .float-chip--a, .float-chip--b { display: none; }
  .hero-note { bottom: -28px; }
  .graph-teaser { grid-template-columns: 1fr; padding: 26px; }
  .graph-teaser-art { height: 180px; order: -1; }
  .card-grid.cols-3, .card-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .stat-band { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; border-top: 1px solid var(--border); }
  .stat:nth-child(4) { border-top: 1px solid var(--border); }
}
@media (max-width: 620px) {
  body { font-size: 15px; }
  .prose { font-size: 15.2px; }
  .prose h2 { font-size: 1.38rem; }
  .page-head h1 { font-size: clamp(1.5rem, 6.6vw, 1.85rem); }
  .lede { font-size: 1rem; }
  .hero h1 { font-size: 2.05rem; }
  .hero-line { white-space: nowrap; }
  .hero-meta { gap: 10px; }
  .hero-cta .btn { flex: 1; }
  .cap-grid, .card-grid.cols-2, .card-grid.cols-3, .card-grid.cols-4, .path-grid, .strategy-grid, .glossary-grid, .split, .split--wide-left, .split--wide-right { grid-template-columns: 1fr; }
  .pager { grid-template-columns: 1fr; }
  .pager-empty { display: none; }
  .pager-next { text-align: left; align-items: flex-start; }
  .figure-body { padding: 10px; }
  .flow { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); }
  .layer { grid-template-columns: 1fr; gap: 7px; }
  .tab-panel { padding: 16px; }
  .footer-links { margin-left: 0; }
  .footer-bottom { flex-direction: column; gap: 5px; }
  .stat b { font-size: 1.25rem; }
  .search-overlay { padding: 0; }
  .search-panel { max-height: 100vh; height: 100%; border-radius: 0; border: 0; }
  .search-field { padding: 14px 15px; }
  .graph-controls .graph-actions { display: flex; }
}

/* ---------- 打印 ---------- */
@media print {
  .sidebar, .toc-rail, .mobile-bar, .reading-progress, .search-overlay, .pager, .ambient, .graph-controls { display: none !important; }
  .main-col { margin: 0 !important; }
  .main { padding: 0 !important; max-width: 100% !important; }
  body { background: #fff; color: #000; }
  .page { max-width: 100%; }
  a { color: #000; text-decoration: underline; }
}

/* ==========================================================================
   内容组件补充：清单 / 源码锚点 / 公式 / 计算器 / 图表 / 阶段 / 浏览器预览
   ========================================================================== */

/* ---------- 完成清单 ---------- */
.checklist { display: flex; flex-direction: column; gap: 2px; margin: 1.4em 0 1.8em; padding: 8px 0; }
.checklist label {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px;
  border-radius: 8px; font-size: 13.5px; color: var(--text-soft); cursor: pointer;
  transition: background var(--speed);
}
.checklist label:hover { background: var(--panel-2); }
.checklist input {
  appearance: none; -webkit-appearance: none; width: 17px; height: 17px; margin: 3px 0 0;
  border-radius: 5px; border: 1px solid var(--border-strong); background: var(--panel-2);
  display: grid; place-items: center; flex: none; cursor: pointer; transition: all var(--speed);
}
.checklist input::after { content: ""; width: 9px; height: 5px; border-left: 1.8px solid var(--accent-ink); border-bottom: 1.8px solid var(--accent-ink); transform: rotate(-45deg) scale(0); transition: transform var(--speed); margin-top: -2px; }
.checklist input:checked { background: var(--accent); border-color: var(--accent); }
.checklist input:checked::after { transform: rotate(-45deg) scale(1); }

/* ---------- 源码锚点 ---------- */
.source-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 1.2em 0 1.8em; }
.source-list a {
  font-family: var(--font-mono); font-size: 10.5px; padding: 5px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--muted) !important;
  text-decoration: none !important;
}
.source-list a:hover { color: var(--accent) !important; border-color: var(--accent-line); background: var(--accent-soft); }

/* ---------- 公式 ---------- */
.formula {
  margin: 1.3em 0; padding: 16px 20px; border-radius: 11px;
  background: var(--panel-2); border: 1px dashed var(--border-strong);
  font-family: var(--font-mono); font-size: 13px; line-height: 2; color: var(--text);
  overflow-x: auto;
}

/* ---------- 通用小网格 ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 1.6em 0; }
@media (max-width: 720px) { .grid-3 { grid-template-columns: 1fr; } }

/* ---------- 图表控制 ---------- */
.chart-controls { display: flex; flex-wrap: wrap; gap: 5px; }
.chart-controls .chip-btn { padding: 4px 9px; font-size: 10px; }
.figure-head { flex-wrap: wrap; }
#klineChart { height: 400px; cursor: crosshair; }
@media (max-width: 640px) { #klineChart { height: 320px; } }

/* ---------- 仓位计算器 ---------- */
.calc { margin: 1.8em 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.calc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.calc-head strong { font-size: 14px; }
.calc-head span { font-size: 10.5px; color: var(--faint); }
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 16px 18px 6px; }
.calc-grid label { font-size: 10.5px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.calc-grid input {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-soft); color: var(--text); font-family: var(--font-mono); font-size: 13px;
}
.calc-grid input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.calc-result { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 14px 18px 0; border-radius: 10px; overflow: hidden; background: var(--border); }
.calc-result div { padding: 11px 13px; background: var(--panel-solid); }
.calc-result span { display: block; font-size: 10px; color: var(--faint); margin-bottom: 3px; }
.calc-result b { font-family: var(--font-mono); font-size: 13px; color: var(--accent); font-weight: 600; }
.calc-note { margin: 12px 18px 16px; font-size: 11px; line-height: 1.6; color: var(--faint); min-height: 2.5em; }
.calc-note.is-error { color: var(--danger); }
@media (max-width: 720px) { .calc-grid, .calc-result { grid-template-columns: repeat(2, 1fr); } }

/* ---------- 流水线阶段 ---------- */
.stage-nav { display: flex; gap: 5px; overflow-x: auto; margin: 2em 0 0; padding-bottom: 6px; scrollbar-width: none; }
.stage-nav::-webkit-scrollbar { display: none; }
.stage-btn {
  flex: none; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--muted); font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .02em; transition: all var(--speed); white-space: nowrap;
}
.stage-btn:hover { color: var(--text); border-color: var(--border-strong); }
.stage-btn.is-active { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.stage-panels { border: 1px solid var(--border); border-top: 0; border-radius: 0 0 14px 14px; background: var(--panel); padding: 4px 22px 22px; }
.stage-panel { display: none; }
.stage-panel.is-active { display: block; animation: fadeUp .28s var(--ease); }
.stage-panel h3 { margin-top: 20px; }
.stage-panel > :last-child { margin-bottom: 4px; }

/* ---------- 浏览器预览 ---------- */
.browser-mock {
  margin: 1.7em 0 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  background: var(--panel-solid); box-shadow: var(--shadow-soft);
}
.browser-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.browser-bar span { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.browser-bar span:first-child { background: #ff6b6b; }
.browser-bar span:nth-child(2) { background: #fbbf24; }
.browser-bar span:nth-child(3) { background: #3ddc97; }
.browser-bar em { margin-left: 10px; font-style: normal; font-family: var(--font-mono); font-size: 9px; color: var(--faint); }
.browser-body { display: grid; grid-template-columns: 148px 1fr; min-height: 240px; }
.browser-side { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; border-right: 1px solid var(--border); font-size: 10px; color: var(--muted); }
.browser-side b { font-size: 12px; color: var(--accent); padding: 0 7px 10px; }
.browser-side span { padding: 6px 8px; border-radius: 6px; }
.browser-side .is-active { background: var(--accent-soft); color: var(--accent); }
.browser-main { padding: 16px 18px; }
.browser-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-size: 13px; }
.browser-head .tag { font-size: 9px; }
.browser-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.browser-card { padding: 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); }
.browser-card small { display: block; font-size: 8.5px; color: var(--faint); }
.browser-card b { display: block; font-family: var(--font-mono); font-size: 18px; margin: 2px 0; }
.browser-card span { font-size: 8.5px; color: var(--muted); }
.browser-list { display: flex; flex-direction: column; gap: 1px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.browser-list span, .browser-list em { padding: 7px 10px; font-size: 9.5px; background: var(--panel-2); }
.browser-list em { font-style: normal; color: var(--accent); }
.mock-caption { font-size: 10px; color: var(--faint); text-align: center; margin: 8px 0 0; }
@media (max-width: 640px) { .browser-body { grid-template-columns: 1fr; } .browser-side { display: none; } }

/* ---------- 对话演示 ---------- */
.chat-demo { margin: 1.8em 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--panel); box-shadow: var(--shadow-soft); }
.chat-head { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--panel-2); font-family: var(--font-mono); font-size: 9px; color: var(--faint); letter-spacing: .06em; }
.chat-head .ac-dot { width: 7px; height: 7px; }
.chat-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 92%; padding: 11px 14px; border-radius: 12px; font-size: 13px; line-height: 1.75; }
.chat-msg b { display: block; font-size: 10px; letter-spacing: .04em; color: var(--faint); margin-bottom: 3px; font-weight: 600; }
.chat-msg p { margin: 0 0 6px; }
.chat-msg p:last-child { margin-bottom: 0; }
.chat-user { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--text); border-bottom-right-radius: 4px; }
.chat-bot { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 2px 4px; }
.chat-tool-label { font-size: 9px; color: var(--faint); letter-spacing: .08em; }
.chat-tool { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 5px; border: 1px solid var(--accent-line); background: var(--accent-soft); font-family: var(--font-mono); font-size: 9px; color: var(--accent); }
.chat-tool .icon { width: 9px; height: 9px; }
.chat-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chat-meta .tag { font-size: 9px; }
.chat-foot { padding: 8px 14px; border-top: 1px solid var(--border); font-size: 9px; color: var(--faint); text-align: right; }

/* ---------- 多智能体 ---------- */
.agent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 1.6em 0; }
.agent-card { padding: 15px 16px; border-radius: 11px; border: 1px solid var(--border); background: var(--panel); }
.agent-card span { font-family: var(--font-mono); font-size: 8.5px; letter-spacing: .1em; color: var(--accent); }
.agent-card h4 { margin: 4px 0 5px; font-size: 13px; }
.agent-card p { margin: 0; font-size: 11.5px; line-height: 1.65; color: var(--muted); }
@media (max-width: 820px) { .agent-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .agent-grid { grid-template-columns: 1fr; } }

/* ---------- 消息预览 ---------- */
.msg-preview { padding: 16px; border-radius: 10px; }
.msg-wecom { background: linear-gradient(160deg, #e8f3ec, #f2f7f4); }
.msg-telegram { background: #17212b; }
.msg-email { background: #f7f4ec; }
.msg-card { max-width: 420px; padding: 14px 16px; border-radius: 10px; background: #fff; box-shadow: 0 8px 22px -16px rgba(0,0,0,.4); color: #1b2b36; font-size: 12.5px; line-height: 1.7; }
.msg-telegram .msg-card { background: #0f1a24; color: #dbe6f3; border: 1px solid rgba(255,255,255,.08); }
.msg-email .msg-card { max-width: 100%; border: 1px solid #e3ded2; }
.msg-title { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.msg-card p { margin: 0 0 8px; }
.msg-divider { height: 1px; background: rgba(0,0,0,.08); margin: 8px 0; }
.msg-telegram .msg-divider { background: rgba(255,255,255,.1); }
.msg-muted { color: #7b8b96; font-size: 10.5px; }
.msg-telegram .msg-muted { color: #7f93a8; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 11px; margin: 8px 0; }
.mini-table th, .mini-table td { padding: 5px 7px; border-bottom: 1px solid #e8e2d6; text-align: left; }
.mini-table th { font-size: 9px; color: #7b8b96; }

/* ---------- 术语表补充 ---------- */
.gloss-count { font-size: 11px; color: var(--faint); margin: -6px 0 18px; }
.gloss-count strong { color: var(--accent); }
.glossary-grid { margin-bottom: 8px; }

/* ---------- 图谱面板位置修正 ---------- */
.graph-panel { top: auto; bottom: 24px; max-height: calc(100% - 190px); }
.graph-page.panel-open .graph-zoom { opacity: 0; pointer-events: none; }
.graph-list-item { cursor: pointer; text-align: left; font-family: var(--font-sans); background: var(--panel); }
.rel-item { width: 100%; border: 0; background: none; padding: 4px 0; cursor: pointer; font-family: var(--font-sans); text-align: left; }
.rel-item:hover b { color: var(--accent); }
.graph-filter.is-active { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
body.page-graph .reading-progress { display: none; }

@media (max-width: 900px) {
  .graph-controls { top: 112px; bottom: auto; }
  .graph-panel { bottom: 0; max-height: 52%; border-radius: 16px 16px 0 0; }
  .graph-page.panel-open .graph-controls { opacity: 0; pointer-events: none; }
}

/* ---------- 手机端：表格、标签页、阶段面板 ---------- */
@media (max-width: 820px) {
  .table-wrap.is-stacked { border: 0; background: none; box-shadow: none; overflow: visible; }
  .table-wrap.is-stacked table { display: block; min-width: 0; }
  .table-wrap.is-stacked thead { display: none; }
  .table-wrap.is-stacked tbody { display: block; }
  .table-wrap.is-stacked tr {
    display: block; padding: 13px 15px 10px; margin-bottom: 10px;
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--panel); box-shadow: var(--shadow-soft);
  }
  .table-wrap.is-stacked tbody tr:hover { background: var(--panel); }
  .table-wrap.is-stacked td {
    position: relative; display: block;
    padding: 6px 0 6px 92px; border: 0; font-size: 13px; line-height: 1.65;
    overflow-wrap: anywhere; min-height: 28px;
  }
  .table-wrap.is-stacked td::before {
    content: attr(data-label); position: absolute; left: 0; top: 8px; width: 82px;
    font-size: 9.5px; font-weight: 700; letter-spacing: .06em; color: var(--faint);
    text-transform: uppercase;
  }
  .table-wrap.is-stacked td:first-child {
    display: block; padding: 0 0 8px; margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
    font-size: 14.5px; font-weight: 700; color: var(--text);
  }
  .table-wrap.is-stacked td:first-child::before {
    position: static; display: block; width: auto; margin-bottom: 3px; font-size: 9px;
  }
  .table-wrap.is-stacked td code { white-space: normal; overflow-wrap: anywhere; }
  .table-wrap.is-stacked td[data-label=""]::before { display: none; }
  .table-wrap.is-stacked td:empty { display: none; }
}
@media (max-width: 620px) {
  .flow { gap: 6px; }
  .flow-node { flex: 0 0 auto; }
  .tab-list { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
  .tab-btn { width: 100%; text-align: center; padding: 8px 8px; font-size: 11.5px; }
  .stage-panels { padding: 4px 14px 18px; }
  .stage-btn { padding: 7px 10px; font-size: 9.5px; }
}

/* ---------- 打印补充 ---------- */
@media print {
  .stage-nav, .chart-controls, .calc, .chat-demo, .browser-mock { break-inside: avoid; }
  .toc-inline { display: none !important; }
}

/* 首页使用更宽的画布，让英雄区与卡片矩阵真正铺开 */
body.page-index .main { max-width: 1440px; margin: 0 auto; }
body.page-index .page--home { max-width: 100%; }
