/* ============================================================
   生生 · 生物学概念图谱
   模块： tokens / base / header / graph / panels / themes / index
   ============================================================ */

/* ── 设计令牌 ────────────────────────────────────────────── */
:root {
  --paper: #F4F0E6;
  --paper-deep: #EDE7DA;
  --paper-card: #FBF8F1;
  --paper-white: #FFFDF7;
  --ink: #1D2A23;
  --ink-soft: #3E4C43;
  --muted: #566256;
  --faint: #646F64;
  --line: #D9D1C1;
  --line-soft: #E6DFD2;
  --line-strong: #C6BCA8;

  --teal: #2B6D6A;
  --teal-deep: #1D5552;
  --teal-soft: #E2EEEA;
  --amber: #C98A2E;
  --amber-soft: #F4E8D2;
  --clay: #B4573F;

  --rel-pre: #805F3C;
  --rel-part: #566F5E;
  --rel-deepen: #6A5591;
  --rel-link: #3F6B79;
  --rel-contrast: #985640;

  --shadow-sm: 0 1px 2px rgba(29, 42, 35, .05), 0 6px 18px -10px rgba(29, 42, 35, .16);
  --shadow-md: 0 2px 6px rgba(29, 42, 35, .05), 0 22px 48px -26px rgba(29, 42, 35, .34);
  --shadow-lg: 0 30px 80px -32px rgba(24, 38, 31, .42);

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

  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "Source Han Serif CN", "SimSun", serif;
  --font-sans: "Inter", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Consolas, monospace;

  --header-h: 72px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

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

html { height: 100%; }

body {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 680px at 82% -10%, rgba(201, 138, 46, .07), transparent 60%),
    radial-gradient(1000px 720px at 8% 108%, rgba(43, 109, 106, .07), transparent 62%);
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3, h4, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
svg { display: block; }
[hidden] { display: none !important; }

::selection { background: rgba(201, 138, 46, .26); }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kicker {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--faint);
}

kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  color: var(--faint);
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(108, 119, 109, .26);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(108, 119, 109, .45); }
* { scrollbar-width: thin; scrollbar-color: rgba(108, 119, 109, .32) transparent; }

/* ── 顶栏 ────────────────────────────────────────────────── */
.app-header {
  position: relative;
  z-index: 60;
  flex: 0 0 auto;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 0 24px;
  background: rgba(248, 245, 237, .88);
  border-bottom: 1px solid rgba(198, 188, 168, .68);
  backdrop-filter: blur(18px) saturate(1.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  border-radius: 10px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  color: var(--teal-deep);
  flex: none;
}
.brand-mark svg { width: 100%; height: 100%; }

.brand-copy { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.brand-name {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--ink);
}
.brand-sub {
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--muted);
  padding-left: 9px;
  border-left: 1px solid var(--line);
}

.view-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(230, 223, 210, .58);
  flex: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 550;
  letter-spacing: .01em;
  transition: color .16s, background .16s, box-shadow .16s;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.is-active {
  background: var(--paper-white);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(29, 42, 35, .07), 0 4px 10px -6px rgba(29, 42, 35, .2);
}
.tab-num {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--faint);
  padding-top: 1px;
}
.tab.is-active .tab-num { color: var(--teal); }

.header-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* 搜索 */
.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 286px;
  height: 38px;
  padding: 0 9px 0 11px;
  background: var(--paper-white);
  border: 1px solid var(--line);
  border-radius: 11px;
  transition: border-color .16s, box-shadow .16s, width .2s var(--ease);
}
.search:focus-within {
  border-color: rgba(43, 109, 106, .55);
  box-shadow: 0 0 0 3px rgba(43, 109, 106, .1);
}
.search-icon { width: 15px; height: 15px; color: var(--faint); }
.search input {
  min-width: 0;
  flex: 1;
  height: 100%;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 12.5px;
  color: var(--ink);
}
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { display: none; }
.search-kbd { flex: none; }
.search-clear {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  color: var(--faint);
}
.search-clear:hover { background: var(--paper-deep); color: var(--ink); }
.search-clear .icon { width: 13px; height: 13px; }

.search-panel {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  width: 388px;
  max-height: min(440px, 66vh);
  overflow-y: auto;
  padding: 7px;
  background: var(--paper-white);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow-md);
  z-index: 120;
}
.search-panel-head {
  padding: 8px 10px 6px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
}
.search-result {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  text-align: left;
  border-radius: 10px;
  border: 1px solid transparent;
}
.search-result:hover, .search-result.is-active {
  background: var(--paper);
  border-color: var(--line-soft);
}
.sr-level {
  flex: none;
  margin-top: 1px;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 650;
  color: var(--level-color, var(--teal));
  background: var(--level-soft, var(--teal-soft));
}
.sr-main { min-width: 0; flex: 1; }
.sr-name {
  display: block;
  font-family: var(--font-serif);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}
.sr-meta {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sr-go { color: var(--line-strong); margin-top: 3px; }
.search-result.is-active .sr-go { color: var(--teal); }
.search-empty { padding: 22px 14px 18px; text-align: center; color: var(--muted); font-size: 12px; }
.search-suggests { padding: 6px 8px 10px; }
.suggest-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.suggest-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 99px;
  background: var(--paper);
  font-size: 11.5px;
  color: var(--ink-soft);
}
.suggest-chip:hover { border-color: var(--line-strong); background: var(--paper-white); }
.suggest-chip i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--dot, var(--teal));
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: background .16s, color .16s, border-color .16s;
}
.icon-btn:hover { background: var(--paper-deep); color: var(--ink); }
.icon-btn .icon { width: 17px; height: 17px; }
.about-btn { border-color: var(--line); background: rgba(251, 248, 241, .6); }

/* ── 主区域 ──────────────────────────────────────────────── */
#appMain {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
}

.view {
  position: absolute;
  inset: 0;
}
.view-graph { overflow: hidden; }
.view-themes, .view-index {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
.view-themes {
  background:
    linear-gradient(180deg, rgba(251, 248, 241, .72), transparent 240px);
}
.view-index {
  background: linear-gradient(180deg, rgba(251, 248, 241, .5), transparent 300px);
}

/* ── 图谱舞台 ────────────────────────────────────────────── */
.graph-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(89, 103, 91, .17) 0.7px, transparent 0.7px),
    linear-gradient(180deg, rgba(255, 253, 247, .35), transparent 38%);
  background-size: 24px 24px, 100% 100%;
  background-position: 0 0, 0 0;
}

.stage-canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#graphSvg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
}
#graphSvg.is-panning { cursor: grabbing; }

.graph-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .04em;
  z-index: 15;
  transition: opacity .5s var(--ease), visibility .5s;
}
.graph-loading.is-done { opacity: 0; visibility: hidden; }
.loading-ring {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--teal);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 学段泳道 */
.lane-band { opacity: .8; }
.lane-index {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  fill: var(--faint);
}
.lane-title {
  font-family: var(--font-serif);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: .06em;
  fill: var(--ink);
}
.lane-sub {
  font-family: var(--font-sans);
  font-size: 11.5px;
  letter-spacing: .03em;
  fill: var(--muted);
}
.lane-count {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--faint);
}

/* 关系线 */
.edge {
  fill: none;
  stroke-width: 1.3;
  vector-effect: non-scaling-stroke;
  transition: opacity .22s ease, stroke-width .22s ease;
  pointer-events: none;
}
.edge.type-pre { stroke: var(--rel-pre); opacity: .56; }
.edge.type-part { stroke: var(--rel-part); opacity: .46; stroke-dasharray: 5 5; }
.edge.type-deepen { stroke: var(--rel-deepen); opacity: .5; stroke-dasharray: 2 5; }
.edge.type-link { stroke: var(--rel-link); opacity: .3; stroke-dasharray: 2 4; }
.edge.type-contrast { stroke: var(--rel-contrast); opacity: .44; stroke-dasharray: 9 4 2 4; }

.edge.is-incident { opacity: .92; stroke-width: 1.8; }
.edge.is-hover-edge { opacity: .95; stroke-width: 2; }
.edge.is-dimmed { opacity: .055; }
.edge.is-path {
  opacity: 1;
  stroke: var(--amber) !important;
  stroke-width: 2.2;
  stroke-dasharray: none;
}
.edge.is-hidden { display: none; }

/* 节点 */
.node { cursor: pointer; }
.node-core {
  stroke: var(--paper-white);
  stroke-width: 1.4;
  transition: stroke-width .16s, filter .16s;
}
.node-halo {
  fill: none;
  stroke: transparent;
  stroke-width: 2;
  opacity: 0;
  transition: opacity .16s, stroke .16s;
}
.node-hit { fill: transparent; }
.node:hover .node-core { stroke: #fff; stroke-width: 2.4; }
.node:hover .node-halo { opacity: .55; stroke: rgba(201, 138, 46, .8); }
.node:focus { outline: none; }
.node:focus-visible .node-halo { opacity: .9; stroke: var(--teal); }
.node:focus-visible .node-core { stroke: #fff; stroke-width: 2.6; }

.node.is-selected .node-halo { opacity: 1; stroke: var(--amber); stroke-width: 2.2; }
.node.is-selected .node-core { stroke: #fff; stroke-width: 2.2; }
.node.is-neighbor .node-halo { opacity: .38; stroke: var(--line-strong); }
.node.is-path .node-halo { opacity: 1; stroke: var(--amber); stroke-width: 2; stroke-dasharray: 3 3; }
.node.is-dimmed { opacity: .16; }
.node.is-hidden, .lane.is-hidden { display: none; }
.node.is-selected { filter: drop-shadow(0 2px 7px rgba(201, 138, 46, .35)); }

.graph-stage.has-path .edge:not(.is-path) { opacity: .075; }
.graph-stage.has-path .node:not(.is-path):not(.is-selected) { opacity: .28; }
.graph-stage.has-path .node.is-path { opacity: 1; }
.graph-stage.has-path .label:not(.is-path-label):not(.is-selected-label) { opacity: .16; }

/* 标签层 */
.label-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 8;
}
.label {
  position: absolute;
  left: 0; top: 0;
  white-space: nowrap;
  font-size: 11.5px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: .005em;
  color: #2A382F;
  text-shadow:
    0 0 3px var(--paper), 0 0 3px var(--paper), 0 0 5px var(--paper),
    0 1px 0 var(--paper);
  transition: opacity .2s, color .2s;
}
.label.is-hidden { display: none; }
.label.is-dim { opacity: .16; }
.label.is-hover { color: var(--teal-deep); font-weight: 700; z-index: 9; }
.label.is-selected-label { color: #85570F; font-weight: 700; z-index: 9; }
.label.is-path-label { color: #85570F; font-weight: 650; }

/* 悬浮提示 */
.graph-tooltip {
  position: absolute;
  z-index: 30;
  width: max-content;
  max-width: 240px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(29, 42, 35, .95);
  color: #F8F4EA;
  box-shadow: 0 12px 30px -16px rgba(0, 0, 0, .5);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.graph-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 8px; height: 8px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 1px;
}
.tooltip-level {
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #C8CFC4;
}
.tooltip-name { font-family: var(--font-serif); font-size: 14px; font-weight: 600; line-height: 1.4; }
.tooltip-meta { font-size: 10.5px; color: #B9C2B7; }

/* 舞台工具 */
.stage-toolbar {
  position: absolute;
  right: 70px;
  bottom: 14px;
  z-index: 22;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.stage-toolbar > * { pointer-events: auto; }

.mobile-filter-btn {
  display: none;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(251, 248, 241, .92);
  box-shadow: var(--shadow-sm);
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-soft);
  backdrop-filter: blur(12px);
}
.filter-badge {
  width: 7px; height: 7px;
  min-width: 7px;
  padding: 0;
  border-radius: 99px;
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(201, 138, 46, .16);
}

.stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(251, 248, 241, .92);
  box-shadow: var(--shadow-sm);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 550;
  backdrop-filter: blur(12px);
  transition: background .16s, border-color .16s, color .16s;
}
.stage-pill:hover { border-color: var(--line-strong); background: var(--paper-white); }
.stage-pill[aria-expanded="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.stage-pill .icon { width: 16px; height: 16px; }
.stage-pill[aria-expanded="true"] .icon { color: #E7C98F; }
@media (min-width: 901px) {
  .stage-toolbar .path-toggle[aria-expanded="true"] { display: none; }
}

.mobile-lanes {
  display: none;
  align-items: center;
  gap: 1px;
  height: 35px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(251, 248, 241, .92);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}
.mobile-lane-btn {
  height: 27px;
  min-width: 30px;
  padding: 0 6px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 550;
  white-space: nowrap;
}
.mobile-lane-btn:hover { background: var(--paper-deep); color: var(--ink); }
.mobile-lane-btn.is-active { background: var(--ink); color: var(--paper); }

/* 筛选面板 */
.filter-panel {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 24;
  width: 272px;
  max-height: calc(100% - 36px);
  display: flex;
  flex-direction: column;
  background: rgba(251, 248, 241, .91);
  border: 1px solid rgba(198, 188, 168, .74);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px) saturate(1.05);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 9px;
  flex: none;
}
.panel-head h2 {
  margin-top: 2px;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .02em;
}
.panel-head-actions { display: flex; align-items: center; gap: 2px; margin-top: -2px; }
.panel-collapse, .panel-close {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  color: var(--muted);
}
.panel-collapse:hover, .panel-close:hover { background: var(--paper-deep); color: var(--ink); }
.panel-collapse .icon, .panel-close .icon { width: 15px; height: 15px; }
.panel-collapse { transition: transform .2s; }
.filter-panel.is-collapsed .panel-collapse { transform: rotate(-90deg); }
.panel-close { display: none; }

.panel-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 16px 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.panel-foot {
  flex: none;
  padding: 0 16px 13px;
  background: linear-gradient(180deg, rgba(251, 248, 241, 0), rgba(251, 248, 241, .72) 18%);
}
.panel-foot .panel-stats { margin-top: 0; }
.panel-foot .reset-filters { margin-top: 7px; }
.filter-panel.is-collapsed .panel-body,
.filter-panel.is-collapsed .panel-foot { display: none; }

.filter-group { padding-top: 10px; margin-top: 9px; border-top: 1px solid var(--line-soft); }
.filter-group:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}
.group-head h3 {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .12em;
  color: var(--faint);
  text-transform: uppercase;
}
.text-btn {
  font-size: 10.5px;
  color: var(--teal);
  padding: 2px 4px;
  border-radius: 4px;
  opacity: .9;
}
.text-btn:hover { text-decoration: underline; opacity: 1; }

.level-list { display: flex; flex-direction: column; gap: 3px; }
.level-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto 16px;
  align-items: center;
  column-gap: 9px;
  width: 100%;
  padding: 5px 9px;
  border-radius: 9px;
  border: 1px solid transparent;
  text-align: left;
  transition: background .14s, border-color .14s, opacity .14s;
}
.level-row:hover { background: rgba(237, 231, 218, .6); }
.level-row .swatch {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--level-color);
  box-shadow: 0 0 0 3px var(--level-soft);
}
.level-name { display: block; font-size: 12px; font-weight: 600; line-height: 1.2; }
.level-desc { display: block; margin-top: 1px; font-size: 9.5px; color: var(--faint); line-height: 1.3; }
.level-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--faint);
}
.level-check {
  display: grid;
  place-items: center;
  width: 16px; height: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: transparent;
}
.level-check .icon { width: 11px; height: 11px; stroke-width: 2.4; }
.level-row.is-on { background: var(--level-soft); border-color: color-mix(in srgb, var(--level-color) 18%, transparent); }
.level-row.is-on .level-check { background: var(--level-color); border-color: var(--level-color); color: #fff; }
.level-row.is-off { opacity: .52; }
.level-row.is-off .level-check { background: transparent; }

.domain-list { display: flex; flex-direction: column; gap: 1px; }
.domain-row, .type-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 27px;
  padding: 3px 7px;
  border-radius: 7px;
  text-align: left;
  font-size: 11.5px;
  color: var(--ink-soft);
  transition: background .14s, opacity .14s;
}
.domain-row:hover, .type-row:hover { background: rgba(237, 231, 218, .62); }
.domain-row.is-off, .type-row.is-off { opacity: .42; }
.check-box {
  display: grid;
  place-items: center;
  width: 14px; height: 14px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: transparent;
  color: transparent;
  transition: background .14s, border-color .14s;
}
.check-box .icon { width: 10px; height: 10px; stroke-width: 2.6; }
.domain-row.is-on .check-box { background: var(--dot); border-color: var(--dot); color: #fff; }
.type-row.is-on .check-box { background: var(--rel-color); border-color: var(--rel-color); color: #fff; }
.type-row .line-sample-wrap { display: inline-flex; width: 30px; flex: none; }
.domain-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--teal)); flex: none; }
.domain-row .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--dot);
  flex: none;
}
.domain-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.domain-count { font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); }

.type-row .line-sample { width: 30px; flex: none; }
.type-row.is-on .line-sample { color: var(--rel-color); }
.type-row.is-off .line-sample { color: var(--line-strong); }
.type-name { flex: 1; }
.type-count { font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); }

.panel-stats {
  margin-top: 10px;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(237, 231, 218, .58);
  font-size: 10.5px;
  line-height: 1.65;
  color: var(--muted);
}
.panel-stats strong { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.panel-stats .stat-row { display: flex; justify-content: space-between; gap: 8px; }
.panel-stats .stat-row + .stat-row { margin-top: 1px; }

.reset-filters {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 30px;
  margin-top: 7px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}
.reset-filters:hover { background: var(--paper-white); color: var(--ink); border-color: var(--line-strong); }
.reset-filters .icon { width: 13px; height: 13px; }

/* 舞台底部 */
.stage-footer {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 14px;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}
.stage-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 99px;
  background: rgba(244, 240, 230, .82);
  border: 1px solid rgba(217, 209, 193, .6);
  backdrop-filter: blur(8px);
  font-size: 10.5px;
  color: var(--muted);
  transition: opacity .3s;
}
.hint-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--amber);
  flex: none;
}
.graph-stage.path-open .stage-hint { opacity: 0; }

.zoom-controls {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px;
  background: rgba(251, 248, 241, .92);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
  backdrop-filter: blur(12px);
}
.zoom-btn {
  display: grid;
  place-items: center;
  width: 32px; height: 30px;
  border-radius: 7px;
  color: var(--muted);
}
.zoom-btn:hover { background: var(--paper-deep); color: var(--ink); }
.zoom-btn .icon { width: 15px; height: 15px; }
.zoom-btn + .zoom-btn { border-top: 1px solid var(--line-soft); border-radius: 0 0 7px 7px; }
.zoom-btn:first-child { border-radius: 7px 7px 0 0; }

.empty-graph {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 18;
  width: min(340px, calc(100% - 40px));
  padding: 26px;
  text-align: center;
  background: var(--paper-white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.empty-icon { width: 26px; height: 26px; margin: 0 auto 10px; color: var(--faint); }
.empty-graph h3 { font-family: var(--font-serif); font-size: 19px; margin-bottom: 6px; }
.empty-graph p { font-size: 12px; color: var(--muted); margin-bottom: 16px; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--paper-white);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  transition: background .16s, border-color .16s, color .16s, transform .16s;
}
.btn:hover { background: var(--paper); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.btn-primary:hover { background: var(--teal-deep); border-color: var(--teal-deep); }
.btn-ghost { background: transparent; }
.btn .icon { width: 15px; height: 15px; }

/* 学习路径 */
.path-bar {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 26;
  width: min(840px, calc(100% - 130px));
  padding: 15px 17px 16px;
  background: rgba(251, 248, 241, .96);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px) saturate(1.05);
}
.path-bar-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.path-title { display: flex; align-items: flex-start; gap: 10px; }
.path-mark {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--amber-soft);
  color: #8B5E17;
  flex: none;
}
.path-mark .icon { width: 16px; height: 16px; }
.path-title strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.3;
}
.path-title span:not(.path-mark) {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted);
}
.path-close { margin-top: -4px; margin-right: -5px; }
.path-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 9px;
  margin-top: 12px;
}
@media (min-width: 901px) and (max-width: 1439px) {
  .path-bar {
    left: 300px;
    right: 70px;
    width: auto;
    transform: none;
  }
}
@media (min-width: 1300px) {
  body.detail-open .path-bar {
    left: 300px;
    right: 430px;
    width: auto;
    transform: none;
  }
}
@media (max-width: 1299px) {
  body.detail-open .path-bar { display: none; }
}
.path-field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.path-field > span {
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
}
.path-field select {
  width: 100%;
  height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: var(--paper-white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236C776D' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  font-size: 12px;
  color: var(--ink);
  appearance: none;
  outline: none;
  text-overflow: ellipsis;
}
.path-field select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(43, 109, 106, .1); }
.path-arrow { color: var(--line-strong); padding-bottom: 7px; }
.path-arrow .icon { width: 15px; height: 15px; }
.path-submit { height: 34px; }
.path-clear { height: 34px; }
.path-result { margin-top: 12px; border-top: 1px solid var(--line-soft); padding-top: 11px; }
.path-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 8px;
  font-size: 11px;
  color: var(--muted);
}
.path-summary strong {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
}
.path-mode-tag {
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--amber-soft);
  color: #7E5512;
  font-size: 9.5px;
  font-weight: 650;
}
.path-mode-tag.is-soft { background: var(--paper-deep); color: var(--muted); }
.path-steps {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.path-step {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 190px;
  height: 27px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper-white);
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.path-step:hover { border-color: var(--amber); color: #7E5512; }
.path-step .step-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--step-color, var(--teal));
  flex: none;
}
.path-step-level {
  flex: none;
  padding: 1px 3px;
  border-radius: 4px;
  background: var(--level-soft);
  color: var(--level-color);
  font-size: 8px;
  font-weight: 700;
  line-height: 1.2;
}
.path-step.is-start, .path-step.is-end { border-color: var(--amber); background: #FBF2E2; }
.path-rel {
  flex: none;
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  color: var(--faint);
  white-space: nowrap;
}
.path-rel .icon { width: 11px; height: 11px; }
.path-empty {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(180, 87, 63, .07);
  color: #8B4D3C;
  font-size: 11px;
  line-height: 1.6;
}

/* 详情面板 */
.detail-scrim {
  position: absolute;
  inset: 0;
  z-index: 38;
  background: rgba(24, 35, 28, .16);
  backdrop-filter: blur(1px);
  opacity: 0;
  transition: opacity .25s;
}
.detail-scrim.is-open { opacity: 1; }

.detail-panel {
  position: absolute;
  top: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 42;
  width: 402px;
  display: flex;
  flex-direction: column;
  background: var(--paper-card);
  border: 1px solid rgba(198, 188, 168, .82);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateX(18px);
  transition: opacity .24s var(--ease), transform .28s var(--ease), visibility .28s;
  overflow: hidden;
}
.detail-panel.is-open { opacity: 1; visibility: visible; transform: none; }
.detail-panel:focus { outline: none; }

.detail-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 10px;
}
.detail-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 10.5px;
  color: var(--muted);
}
.detail-kicker .domain-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dot); }
.detail-kicker .kicker-sep { color: var(--line-strong); }
.detail-level {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--level-soft);
  color: var(--level-color);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: .02em;
}
.detail-close {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  flex: none;
  margin: -4px -5px 0 0;
  border-radius: 8px;
  color: var(--muted);
}
.detail-close:hover { background: var(--paper-deep); color: var(--ink); }
.detail-close .icon { width: 17px; height: 17px; }
.detail-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 20px 22px;
}
.detail-title {
  font-family: var(--font-serif);
  font-size: 27px;
  line-height: 1.32;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--ink);
  margin-top: 4px;
}
.detail-en {
  margin-top: 5px;
  font-size: 10.5px;
  letter-spacing: .03em;
  color: var(--faint);
  font-style: italic;
}
.detail-summary {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 11px;
  background: rgba(237, 231, 218, .46);
  border-left: 2px solid var(--dot, var(--teal));
  font-size: 13px;
  line-height: 1.8;
  color: var(--ink-soft);
}
.detail-section { margin-top: 22px; }
.detail-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 9px;
}
.detail-section h3 .count {
  font-family: var(--font-mono);
  letter-spacing: 0;
  color: var(--line-strong);
}
.point-list { display: flex; flex-direction: column; gap: 7px; }
.point-list li {
  position: relative;
  padding-left: 15px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}
.point-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .62em;
  width: 5px; height: 5px;
  border-radius: 1px 4px 1px 4px;
  background: var(--dot, var(--teal));
  opacity: .75;
  transform: rotate(45deg);
}
.rel-group + .rel-group { margin-top: 13px; }
.rel-group-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}
.rel-group-head .rel-count {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--line-strong);
}
.rel-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 7px;
  border-radius: 7px;
  text-align: left;
  border: 1px solid transparent;
  transition: background .14s, border-color .14s;
}
.rel-row:hover { background: var(--paper); border-color: var(--line-soft); }
.rel-type {
  flex: none;
  width: 34px;
  font-size: 9px;
  font-weight: 650;
  color: var(--rel-color);
}
.rel-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rel-level {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  color: var(--faint);
}
.rel-level i {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--level-color);
}
.rel-go { width: 13px; height: 13px; color: var(--line-strong); flex: none; }
.rel-row:hover .rel-go { color: var(--teal); }
.rel-filtered { font-size: 8.5px; color: var(--faint); font-style: italic; }

.detail-theme {
  padding: 12px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--paper-white);
}
.detail-theme-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.detail-theme-name {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.detail-theme-link {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--teal);
}
.detail-theme-link:hover { text-decoration: underline; }
.detail-theme-link .icon { width: 11px; height: 11px; }
.theme-step {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.theme-step-level {
  padding-top: 3px;
  font-size: 9px;
  color: var(--faint);
}
.theme-step-items { display: flex; flex-wrap: wrap; gap: 4px; }
.theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--paper);
  font-size: 10px;
  line-height: 1.4;
  color: var(--muted);
  text-align: left;
}
.theme-chip:hover { border-color: var(--line-strong); color: var(--ink); }
.theme-chip.is-current {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 18px; }
.tag {
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  font-size: 9.5px;
  color: var(--muted);
}
.detail-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-top: 1px solid var(--line-soft);
  background: rgba(244, 240, 230, .6);
}
.detail-locate {
  flex: 1;
  justify-content: center;
}
.detail-copy { width: 34px; height: 34px; flex: none; border: 1px solid var(--line); border-radius: 9px; display: grid; place-items: center; color: var(--muted); }
.detail-copy:hover { background: var(--paper-white); color: var(--ink); }
.detail-copy .icon { width: 15px; height: 15px; }

/* ── 主题演进 ────────────────────────────────────────────── */
.themes-shell {
  max-width: 1460px;
  min-width: 0;
  margin: 0 auto;
  padding: 34px 34px 70px;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: 44px;
  align-items: start;
}
.theme-index {
  position: sticky;
  top: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 150px);
}
.theme-index-head h2 {
  margin: 5px 0 9px;
  font-family: var(--font-serif);
  font-size: 31px;
  font-weight: 700;
  letter-spacing: .01em;
}
.theme-index-head > p:not(.kicker) {
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--muted);
}
.theme-nav {
  width: 100%;
  min-width: 0;
  margin-top: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  flex: 1;
}
.theme-nav-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  text-align: left;
  color: var(--muted);
  transition: background .15s, color .15s, border-color .15s;
}
.theme-nav-item:hover { background: rgba(251, 248, 241, .75); color: var(--ink); }
.theme-nav-item.is-active {
  background: var(--paper-white);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.theme-nav-num {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--line-strong);
}
.theme-nav-item.is-active .theme-nav-num { color: var(--amber); }
.theme-nav-name {
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-nav-meta {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--faint);
}
.theme-index-foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 10px;
  line-height: 1.7;
  color: var(--faint);
}
.theme-index-foot strong { color: var(--muted); font-weight: 600; }

.theme-detail { min-width: 0; width: 100%; overflow-x: hidden; }
.theme-hero { padding: 4px 0 26px; border-bottom: 1px solid var(--line); }
.theme-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.theme-hero-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--amber);
}
.theme-hero-meta { font-size: 10px; color: var(--faint); }
.theme-hero h2 {
  max-width: 760px;
  margin: 10px 0 0;
  font-family: var(--font-serif);
  font-size: clamp(30px, 3.4vw, 42px);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: .01em;
}
.theme-question {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.7;
  color: var(--teal-deep);
}
.theme-question::before {
  content: "Q";
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--amber);
  padding-top: 6px;
  flex: none;
}
.theme-blurb {
  max-width: 760px;
  margin-top: 12px;
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--ink-soft);
}
.theme-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr) 34px minmax(0, 1fr);
  gap: 6px;
  margin-top: 26px;
  align-items: start;
}
.theme-arrow {
  display: grid;
  place-items: center;
  padding-top: 42px;
  color: var(--line-strong);
}
.theme-arrow .icon { width: 16px; height: 16px; }
.theme-lane {
  min-width: 0;
  padding: 15px 14px;
  border-radius: var(--radius-lg);
  background: rgba(251, 248, 241, .62);
  border: 1px solid var(--line-soft);
}
.theme-lane-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
}
.theme-lane-head::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  width: 34px; height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.theme-lane-index {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--line-strong);
}
.theme-lane-head h3 {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.2;
}
.theme-lane-head p {
  margin-top: 2px;
  font-size: 9.5px;
  color: var(--faint);
}
.theme-lane-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--faint);
}
.theme-cards { display: flex; flex-direction: column; gap: 7px; }
.theme-card {
  display: block;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: var(--paper-white);
  text-align: left;
  transition: border-color .16s, box-shadow .16s, transform .16s;
}
.theme-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.theme-card-top { display: flex; align-items: center; gap: 5px; margin-bottom: 4px; }
.theme-card-top .domain-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--dot); }
.theme-card-domain { font-size: 8.5px; letter-spacing: .06em; color: var(--faint); }
.theme-card strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink);
}
.theme-card-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
  font-size: 10.5px;
  line-height: 1.65;
  color: var(--muted);
}
.theme-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--faint);
}
.theme-card-foot .icon { width: 11px; height: 11px; opacity: .6; }
.theme-card:hover .theme-card-foot .icon { opacity: 1; color: var(--teal); }
.theme-empty {
  padding: 18px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  text-align: center;
  font-size: 10.5px;
  color: var(--faint);
  line-height: 1.7;
}
.theme-footer {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 24px;
  padding: 15px 17px;
  border-radius: 13px;
  background: var(--teal-soft);
  border: 1px solid rgba(43, 109, 106, .14);
}
.theme-footer .icon { width: 17px; height: 17px; color: var(--teal); flex: none; margin-top: 2px; }
.theme-footer p { font-size: 11px; line-height: 1.8; color: #31554F; }
.theme-footer strong { font-weight: 650; }

/* ── 概念索引 ────────────────────────────────────────────── */
.index-shell {
  max-width: 1160px;
  margin: 0 auto;
  padding: 36px 34px 80px;
}
.index-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px 32px;
  align-items: start;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.index-head h2 {
  margin: 9px 0 12px;
  font-family: var(--font-serif);
  font-size: clamp(31px, 4vw, 44px);
  line-height: 1.28;
  font-weight: 700;
  letter-spacing: .01em;
}
.index-head-copy > p:not(.kicker) {
  max-width: 500px;
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--muted);
}
.index-stats {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 22px;
  padding-top: 8px;
}
.index-stat strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 25px;
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.index-stat span { display: block; margin-top: 2px; font-size: 9.5px; color: var(--faint); letter-spacing: .06em; }
.index-tools {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.index-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 330px;
  height: 38px;
  padding: 0 10px 0 12px;
  background: var(--paper-white);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.index-search:focus-within { border-color: rgba(43, 109, 106, .55); box-shadow: 0 0 0 3px rgba(43, 109, 106, .1); }
.index-search .icon { width: 15px; height: 15px; color: var(--faint); }
.index-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 12px; }
.index-search input::placeholder { color: var(--faint); }
.index-clear { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; color: var(--faint); }
.index-clear:hover { background: var(--paper-deep); color: var(--ink); }
.index-clear .icon { width: 12px; height: 12px; }
.index-levels { display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: rgba(230, 223, 210, .55); }
.level-pill {
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 11.5px;
}
.level-pill:hover { color: var(--ink); }
.level-pill.is-active { background: var(--paper-white); color: var(--ink); box-shadow: 0 1px 2px rgba(29, 42, 35, .08); font-weight: 600; }
.index-count { margin-left: auto; font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }

.index-group { margin-top: 32px; }
.index-group-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 2px 10px;
  background: linear-gradient(180deg, var(--paper) 74%, rgba(244, 240, 230, 0));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.index-group-head h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
}
.index-group-head .group-desc { font-size: 10.5px; color: var(--faint); }
.index-group-head .group-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--faint);
}
.index-row {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  gap: 13px;
  width: 100%;
  padding: 13px 10px;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 9px;
  text-align: left;
  transition: background .14s, border-color .14s;
}
.index-row:hover { background: rgba(251, 248, 241, .8); }
.index-row .index-dot {
  width: 7px; height: 7px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--dot);
}
.index-main { min-width: 0; }
.index-name-line { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.index-name {
  font-family: var(--font-serif);
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}
.index-en { font-size: 9.5px; color: var(--faint); font-style: italic; letter-spacing: .02em; }
.index-summary {
  margin-top: 3px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.index-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 3px;
  font-size: 9.5px;
  color: var(--faint);
  white-space: nowrap;
}
.index-meta .meta-domain { display: inline-flex; align-items: center; gap: 4px; }
.index-meta .meta-domain i { width: 5px; height: 5px; border-radius: 50%; background: var(--dot); }
.index-meta .meta-rel { font-family: var(--font-mono); }
.index-meta .icon { width: 13px; height: 13px; color: var(--line-strong); }
.index-row:hover .index-meta .icon { color: var(--teal); }
.index-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}
.index-empty strong { display: block; margin-bottom: 6px; font-family: var(--font-serif); font-size: 19px; color: var(--ink); }

/* ── 页脚 ────────────────────────────────────────────────── */
.site-foot {
  position: relative;
  z-index: 40;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 24px;
  border-top: 1px solid var(--line);
  background: rgba(248, 245, 237, .94);
  font-size: 10px;
  color: var(--faint);
}
.site-foot > div { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.site-foot p { flex: 1; text-align: right; font-size: 9.5px; line-height: 1.5; }
.foot-brand { font-family: var(--font-serif); font-size: 13px; color: var(--muted); letter-spacing: .08em; }
.foot-sep { color: var(--line-strong); }
body[data-view="graph"] .site-foot { display: none; }
body.detail-open .site-foot { display: none; }

/* ── 说明弹窗 ────────────────────────────────────────────── */
.about-dialog {
  width: min(780px, calc(100vw - 32px));
  max-height: min(88vh, 900px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--paper-card);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.about-dialog::backdrop {
  background: rgba(24, 35, 28, .38);
  backdrop-filter: blur(5px);
}
.about-scroll {
  max-height: min(88vh, 900px);
  overflow-y: auto;
  padding: 34px 38px 30px;
}
.about-dialog h2 {
  margin: 7px 0 8px;
  font-family: var(--font-serif);
  font-size: 32px;
  line-height: 1.3;
}
.about-lead { max-width: 590px; font-size: 12.5px; line-height: 1.85; color: var(--muted); }
.dialog-close {
  position: absolute;
  top: 16px; right: 16px;
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  color: var(--muted);
  z-index: 2;
}
.dialog-close:hover { background: var(--paper-deep); color: var(--ink); }
.dialog-close .icon { width: 17px; height: 17px; }
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 22px;
}
.about-grid section {
  padding: 16px 17px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: var(--paper-white);
}
.about-num {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .12em;
  color: var(--amber);
}
.about-grid h3 {
  margin: 6px 0 5px;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
}
.about-grid p { font-size: 11px; line-height: 1.75; color: var(--muted); }
.about-relations {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin-top: 20px;
  padding: 15px 17px;
  border-radius: 13px;
  background: rgba(237, 231, 218, .45);
}
.about-rel {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10.5px;
  color: var(--muted);
}
.about-rel svg { width: 34px; flex: none; color: var(--rel-color); }
.about-rel strong { color: var(--ink-soft); font-weight: 600; }
.about-note {
  margin-top: 20px;
  padding: 15px 17px;
  border-left: 2px solid var(--teal);
  border-radius: 0 10px 10px 0;
  background: var(--teal-soft);
}
.about-note strong { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--teal-deep); }
.about-note p { margin-top: 4px; font-size: 10.5px; line-height: 1.8; color: #3E5D56; }
.about-shortcuts { margin-top: 18px; font-size: 9.5px; color: var(--faint); }
.about-shortcuts kbd { margin: 0 2px; }

/* ── toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  z-index: 200;
  padding: 9px 15px;
  border-radius: 99px;
  background: var(--ink);
  color: #F6F1E5;
  font-size: 11.5px;
  letter-spacing: .01em;
  box-shadow: 0 16px 40px -20px rgba(0, 0, 0, .6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  max-width: calc(100vw - 32px);
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 901px) {
  .toast { top: 88px; bottom: auto; transform: translate(-50%, -8px); }
  .toast.is-show { transform: translate(-50%, 0); }
}

/* ── 响应式 ──────────────────────────────────────────────── */
@media (max-width: 1260px) {
  .brand-sub { display: none; }
  .search { width: 248px; }
  .themes-shell { padding: 28px 26px 60px; gap: 30px; grid-template-columns: 248px minmax(0, 1fr); }
  .theme-progress { grid-template-columns: minmax(0, 1fr) 26px minmax(0, 1fr) 26px minmax(0, 1fr); }
}

@media (max-width: 1180px) {
  .theme-progress { grid-template-columns: 1fr; gap: 8px; }
  .theme-arrow { padding: 0; transform: rotate(90deg); height: 20px; }
}

@media (max-width: 1080px) {
  .app-header { gap: 16px; padding: 0 18px; }
  .view-tabs { margin-left: 0; }
  .search { width: 210px; }
  .search-kbd { display: none; }
  .filter-panel { width: 252px; }
  .detail-panel { width: 366px; }
  .index-shell { padding: 30px 26px 70px; }
  .theme-card-summary { -webkit-line-clamp: 2; }
}

@media (max-width: 900px) {
  .app-header {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 16px 8px;
    gap: 8px 12px;
  }
  .brand-mark { width: 32px; height: 32px; }
  .brand-name { font-size: 20px; }
  .header-tools { flex: 1; justify-content: flex-end; }
  .search { width: min(280px, 100%); }
  .view-tabs { order: 3; width: 100%; justify-content: stretch; }
  .tab { flex: 1; justify-content: center; height: 30px; }
  .graph-stage { top: 0; }
  .filter-panel {
    position: fixed;
    top: 104px;
    bottom: 10px;
    left: 10px;
    width: min(320px, calc(100vw - 20px));
    max-height: none;
    z-index: 90;
    transform: translateX(calc(-100% - 20px));
    transition: transform .28s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .filter-panel.is-open { transform: none; }
  .filter-panel.is-collapsed .panel-body { display: block; }
  .filter-panel .panel-collapse { display: none; }
  .filter-panel .panel-close { display: grid; }
  .filter-scrim {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(24, 35, 28, .28);
    backdrop-filter: blur(2px);
  }
  .mobile-filter-btn { display: inline-flex; }
  .stage-toolbar { top: 12px; right: 12px; bottom: auto; left: auto; }
  .detail-panel {
    position: fixed;
    top: 104px; right: 10px; bottom: 10px;
    width: min(400px, calc(100vw - 20px));
    z-index: 100;
  }
  .detail-scrim { position: fixed; z-index: 95; }
  .path-bar {
    position: fixed;
    bottom: 10px;
    width: calc(100vw - 20px);
    z-index: 85;
    max-height: 60vh;
    overflow-y: auto;
  }
  .themes-shell { grid-template-columns: 1fr; gap: 22px; padding: 24px 20px 56px; }
  .theme-index { position: static; max-height: none; }
  .theme-index-head > p:not(.kicker) { max-width: 600px; }
  .theme-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    margin-top: 14px;
    padding-bottom: 4px;
  }
  .theme-nav-item {
    flex: none;
    width: auto;
    max-width: 210px;
    grid-template-columns: 18px minmax(0, 1fr);
    padding: 8px 10px;
  }
  .theme-nav-meta { display: none; }
  .theme-nav-name { font-size: 12px; }
  .theme-index-foot { display: none; }
  .theme-progress { grid-template-columns: 1fr; gap: 8px; }
  .theme-arrow { padding: 0; transform: rotate(90deg); height: 20px; }
  .index-head { grid-template-columns: 1fr; }
  .index-stats { display: none; }
  .index-head h2 { font-size: 32px; }
  .site-foot { flex-direction: column; gap: 3px; align-items: flex-start; padding: 9px 16px; }
  .site-foot p { text-align: left; }
  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .app-header { padding: 8px 10px 7px; gap: 7px 8px; }
  .brand-copy { display: none; }
  .brand { gap: 0; }
  .brand-mark { width: 30px; height: 30px; }
  .header-tools { flex: 1; min-width: 0; gap: 6px; }
  .search { flex: 1; width: auto; min-width: 0; height: 34px; padding: 0 8px 0 9px; }
  .search input { font-size: 11.5px; }
  .about-btn { width: 34px; height: 34px; flex: none; }
  .view-tabs { width: 100%; min-width: 0; }
  .tab { flex: 1 1 0; min-width: 0; padding: 0 4px; font-size: 11.5px; gap: 4px; }

  .stage-toolbar { left: 10px; right: 10px; top: 8px; width: auto; justify-content: flex-start; gap: 6px; }
  .mobile-filter-btn { height: 35px; padding: 0 9px; font-size: 11px; gap: 5px; flex: none; }
  .mobile-filter-btn .icon { width: 14px; height: 14px; }
  .mobile-lanes { display: flex; flex: none; }
  .stage-pill { height: 35px; padding: 0 9px; font-size: 11px; gap: 5px; margin-left: auto; }
  .stage-pill .icon { width: 14px; height: 14px; }
  .path-toggle-label { display: inline; }
  .graph-stage::after {
    content: "";
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 62px;
    z-index: 21;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(244, 240, 230, .98) 16%, rgba(244, 240, 230, .78) 52%, rgba(244, 240, 230, 0));
  }
}

@media (max-width: 640px) {
  .app-header { padding: 8px 10px 7px; }
  .brand { gap: 0; }
  .brand-name { font-size: 19px; }
  .header-tools { gap: 6px; }
  .search { height: 34px; padding: 0 8px 0 9px; }
  .search input { font-size: 11.5px; }
  .search-panel {
    position: fixed;
    top: 112px;
    left: 10px;
    right: 10px;
    width: auto;
    max-height: 60vh;
  }
  .about-btn { width: 34px; height: 34px; }
  .tab { font-size: 11.5px; padding: 0 4px; gap: 4px; }
  .tab-num { display: none; }
  .stage-hint { display: none; }
  .stage-footer { left: 12px; right: 12px; bottom: 10px; justify-content: flex-end; }
  .stage-toolbar { left: 10px; right: 10px; top: 8px; width: auto; justify-content: flex-start; gap: 6px; }
  .stage-pill { height: 35px; padding: 0 9px; font-size: 11px; }
  .mobile-filter-btn { height: 35px; padding: 0 9px; }
  .filter-panel { top: 101px; bottom: 8px; left: 8px; width: calc(100vw - 16px); max-height: none; }
  .detail-panel { top: 101px; right: 8px; bottom: 8px; width: calc(100vw - 16px); border-radius: 18px; }
  .detail-title { font-size: 24px; }
  .detail-head { padding: 16px 17px 8px; }
  .detail-scroll { padding: 0 17px 20px; }
  .detail-foot { padding: 10px 17px; }
  .path-bar { padding: 13px; bottom: 8px; width: calc(100vw - 16px); }
  .path-bar-head > .path-title span:not(.path-mark) { display: none; }
  .path-form { flex-wrap: wrap; gap: 7px; }
  .path-field { flex: 1 1 42%; }
  .path-arrow { display: none; }
  .path-submit { flex: 1 1 45%; min-width: 0; }
  .path-clear { flex: 1 1 45%; min-width: 0; }
  .path-steps { padding-bottom: 6px; }
  .zoom-controls { flex-direction: row; }
  .zoom-btn { width: 34px; height: 32px; }
  .zoom-btn + .zoom-btn { border-top: 0; border-left: 1px solid var(--line-soft); border-radius: 0; }
  .zoom-btn:first-child { border-radius: 7px 0 0 7px; }
  .zoom-btn:last-child { border-radius: 0 7px 7px 0; }
  .theme-hero h2 { font-size: 28px; }
  .theme-question { font-size: 15px; }
  .index-shell { padding: 22px 16px 60px; }
  .index-head h2 { font-size: 28px; }
  .index-tools { gap: 8px; }
  .index-search { width: 100%; }
  .index-levels { width: 100%; }
  .level-pill { flex: 1; }
  .index-count { margin-left: 0; width: 100%; }
  .index-row { grid-template-columns: 7px minmax(0, 1fr); gap: 10px; }
  .index-meta { display: none; }
  .index-name { font-size: 15px; }
  .index-summary { -webkit-line-clamp: 2; }
  .index-group-head { padding-top: 10px; }
  .site-foot { font-size: 9px; padding: 8px 12px; }
  .site-foot p { display: none; }
  .about-scroll { padding: 26px 20px 24px; }
  .about-dialog h2 { font-size: 26px; }
  .about-relations { grid-template-columns: 1fr; }
  .about-shortcuts { display: none; }
  .toast { bottom: 18px; font-size: 10.5px; }
}

@media (max-width: 420px) {
  .brand-copy { display: none; }
  .search { flex: 1; }
  .detail-kicker { font-size: 9.5px; }
  .detail-theme-top { flex-direction: column; gap: 3px; }
}

/* ── 动效与可访问性 ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .node-core { forced-color-adjust: none; }
  .edge { forced-color-adjust: none; }
}

/* 防止窄屏横向溢出 */
img, svg { max-width: 100%; }
@media (max-width: 900px) {
  .view-themes, .view-index { -webkit-overflow-scrolling: touch; }
}
