/* ============================================================
   溯源 · Sapling Research
   Dark botanical system — ink green, warm gold, living mint
   ============================================================ */

:root {
  --bg: #050c09;
  --bg-deep: #030806;
  --panel: rgba(11, 25, 20, 0.72);
  --panel-solid: #0a1712;
  --panel-soft: rgba(255, 255, 255, 0.024);
  --line: rgba(126, 231, 183, 0.11);
  --line-strong: rgba(126, 231, 183, 0.24);
  --text: #e9f3ec;
  --text-soft: #c8d8cf;
  --muted: #8ba398;
  --dim: #5b7369;
  --gold: #e8c97e;
  --gold-soft: rgba(232, 201, 126, 0.14);
  --mint: #6fe3b0;
  --mint-soft: rgba(111, 227, 176, 0.13);
  --coral: #ff9175;
  --sky: #8fd3ff;
  --danger: #ff7d6b;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", STSong, "Times New Roman", serif;
  --sans: "Inter", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --topbar-h: 64px;
  --rail-w: 332px;
  --radius: 16px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-panel: 0 24px 60px -24px rgba(0, 0, 0, 0.85);
}

* { box-sizing: border-box; }

/* 作者样式会覆盖 UA 的 [hidden]，必须显式兜底，否则全屏遮罩层会一直挡住页面 */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

body {
  overflow: hidden;
  background:
    radial-gradient(80% 60% at 78% -10%, rgba(32, 108, 82, 0.18), transparent 62%),
    radial-gradient(60% 50% at 8% 108%, rgba(232, 201, 126, 0.06), transparent 65%),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.32;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.14'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
::selection { background: rgba(111, 227, 176, 0.28); color: #fff; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(126, 231, 183, 0.14); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(126, 231, 183, 0.26); }

/* ---------------------------------------------------------------- layout */

.app {
  height: 100dvh;
  display: grid;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
}

.stage {
  min-height: 0;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
}

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 22px;
  min-width: 0;
  height: var(--topbar-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(7, 17, 13, 0.92), rgba(6, 14, 11, 0.78));
  backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; flex: none; }

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--mint);
  background:
    radial-gradient(circle at 30% 20%, rgba(111, 227, 176, 0.2), transparent 60%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 24px -8px rgba(111, 227, 176, 0.5);
}
.brand-mark svg { width: 25px; height: 25px; }
.brand-leaf-a { transform-origin: 20px 19px; animation: leafBreathe 7s ease-in-out infinite; }
.brand-leaf-b { transform-origin: 20px 24px; animation: leafBreathe 7s ease-in-out -2.4s infinite; }
.brand-stem { stroke-dasharray: 18; stroke-dashoffset: 0; animation: stemGrow 6s ease-in-out infinite; }

.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-family: var(--serif); font-size: 19px; letter-spacing: 0.12em; }
.brand-text span {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  color: var(--dim);
  margin-top: 4px;
}

.topbar-center {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 11px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.mode-chip i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
}
.mode-chip.is-live i { background: var(--mint); box-shadow: 0 0 10px var(--mint); animation: blink 1.6s ease-in-out infinite; }

.topbar-topic {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--serif);
  font-size: 13.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

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

.rail-toggle { display: none; }

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--muted);
  transition: 0.22s var(--ease-out);
}
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { color: var(--mint); background: rgba(111, 227, 176, 0.07); border-color: var(--line); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  font-size: 12.5px;
  transition: 0.22s var(--ease-out);
}
.btn-ghost:hover { border-color: rgba(111, 227, 176, 0.5); color: var(--mint); box-shadow: 0 0 22px -8px rgba(111, 227, 176, 0.6); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.status-dot.on { background: var(--mint); box-shadow: 0 0 9px var(--mint); }

.menu-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: none;
  gap: 8px;
}
.menu {
  position: absolute;
  top: 42px; right: 0;
  width: 210px;
  padding: 6px;
  border-radius: 13px;
  border: 1px solid var(--line-strong);
  background: rgba(10, 23, 18, 0.97);
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(20px);
  z-index: 50;
  animation: menuIn 0.24s var(--ease-out);
}
.menu button {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 11px;
  border-radius: 9px;
  text-align: left;
  transition: 0.18s;
}
.menu button:hover { background: rgba(111, 227, 176, 0.08); }
.menu button span { font-size: 12.5px; color: var(--text-soft); }
.menu button em { font-style: normal; font-size: 10.5px; color: var(--dim); }

/* ---------------------------------------------------------------- rail */

.rail {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px 28px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(9, 20, 16, 0.72), rgba(5, 12, 9, 0.9)),
    radial-gradient(80% 40% at 50% 0%, rgba(111, 227, 176, 0.06), transparent 70%);
  scrollbar-gutter: stable;
}

.rail-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008));
  padding: 15px;
  margin-bottom: 12px;
  overflow: hidden;
}
.rail-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.research-card {
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(111, 227, 176, 0.1), transparent 58%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.008));
  padding: 17px 16px 15px;
}

.card-kicker {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--dim);
  margin-bottom: 8px;
}
.research-card h2 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1.28;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: linear-gradient(110deg, #f4fbf6 10%, #c9e8d7 55%, #e8c97e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.field { position: relative; display: block; }
.field textarea {
  width: 100%;
  resize: none;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(3, 10, 7, 0.6);
  padding: 11px 12px 22px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  outline: none;
  transition: 0.22s;
}
.field textarea::placeholder { color: var(--dim); }
.field textarea:focus { border-color: rgba(111, 227, 176, 0.45); box-shadow: 0 0 0 3px rgba(111, 227, 176, 0.06); }
.field-count {
  position: absolute;
  right: 10px; bottom: 7px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--dim);
}

.example-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 10px 0 12px;
}
.example-row > span { font-size: 10.5px; color: var(--dim); margin-right: 2px; }
.example-row button {
  padding: 4px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  font-size: 10.5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  transition: 0.18s;
}
.example-row button:hover { color: var(--gold); border-color: rgba(232, 201, 126, 0.4); background: var(--gold-soft); }

.btn-primary {
  position: relative;
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 12px;
  background: linear-gradient(120deg, #e8c97e 0%, #a9e6bf 52%, #6fe3b0 100%);
  color: #07120d;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  box-shadow: 0 12px 30px -14px rgba(111, 227, 176, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s, filter 0.2s;
  overflow: hidden;
}
.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.5) 48%, transparent 72%);
  transform: translateX(-110%);
  transition: transform 0.7s var(--ease-out);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 16px 36px -14px rgba(111, 227, 176, 1); }
.btn-primary:hover::before { transform: translateX(110%); }
.btn-primary:active { transform: translateY(0) scale(0.995); }
.btn-primary:disabled { filter: saturate(0.5); transform: none; }
.btn-sprout { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary kbd {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 400;
  color: rgba(7, 18, 13, 0.55);
  border: 1px solid rgba(7, 18, 13, 0.18);
  border-radius: 5px;
  padding: 2px 5px;
}
.btn-primary.is-running { background: linear-gradient(120deg, #263d33, #1c3a2e); color: var(--mint); box-shadow: none; }
.btn-primary.is-running kbd { color: var(--mint); border-color: var(--line-strong); }

.run-note { margin: 10px 2px 0; font-size: 10.5px; line-height: 1.55; color: var(--dim); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}
.card-head-hint {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 2px 7px;
}

.pipeline { list-style: none; margin: 0; padding: 0; }
.pipeline li {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 0 0 15px 2px;
  color: var(--dim);
}
.pipeline li:last-child { padding-bottom: 0; }
.pipeline li::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 15px;
  bottom: 2px;
  width: 1px;
  background: linear-gradient(180deg, rgba(126, 231, 183, 0.2), rgba(126, 231, 183, 0.05));
}
.pipeline li:last-child::before { display: none; }
.pipeline li i {
  position: relative;
  flex: none;
  width: 13px; height: 13px;
  margin-top: 2px;
  border-radius: 50%;
  border: 1px solid rgba(126, 231, 183, 0.26);
  background: #081410;
  transition: 0.3s;
}
.pipeline li div { display: flex; flex-direction: column; gap: 2px; }
.pipeline li strong { font-size: 12px; font-weight: 600; color: var(--muted); transition: 0.3s; }
.pipeline li span { font-size: 10.5px; color: var(--dim); }
.pipeline li.active i { border-color: var(--gold); background: var(--gold); box-shadow: 0 0 0 4px rgba(232, 201, 126, 0.12), 0 0 14px rgba(232, 201, 126, 0.6); animation: blink 1.4s ease-in-out infinite; }
.pipeline li.active strong { color: var(--text); }
.pipeline li.done i { border-color: var(--mint); background: var(--mint); box-shadow: 0 0 12px rgba(111, 227, 176, 0.55); }
.pipeline li.done i::after {
  content: "";
  position: absolute; inset: 3px;
  border-radius: 50%;
  background: #06110d;
}
.pipeline li.done strong { color: var(--text-soft); }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.stats-grid > div { background: rgba(6, 15, 11, 0.75); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.stats-grid strong { font-family: var(--serif); font-size: 21px; font-weight: 500; color: var(--text); line-height: 1.1; }
.stats-grid span { font-size: 9.5px; color: var(--dim); letter-spacing: 0.06em; }

.confidence-row { display: flex; align-items: center; gap: 8px; margin-top: 11px; font-size: 10px; color: var(--dim); }
.confidence-row > span { white-space: nowrap; }
.confidence-bar { flex: 1; height: 3px; border-radius: 99px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.confidence-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--mint)); transition: width 0.9s var(--ease-out); box-shadow: 0 0 12px rgba(111, 227, 176, 0.7); }
.confidence-row b { font-family: var(--mono); font-size: 10px; font-weight: 400; color: var(--mint); min-width: 28px; text-align: right; }

.switch-row { display: flex; flex-wrap: wrap; gap: 9px 14px; }
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 10.5px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span {
  width: 28px; height: 16px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.35);
  position: relative;
  transition: 0.24s;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--dim);
  transition: 0.24s var(--ease-out);
}
.switch input:checked + span { background: rgba(111, 227, 176, 0.16); border-color: rgba(111, 227, 176, 0.5); }
.switch input:checked + span::after { left: 14px; background: var(--mint); box-shadow: 0 0 8px var(--mint); }

.about-card { background: linear-gradient(150deg, rgba(232, 201, 126, 0.05), rgba(255, 255, 255, 0.012)); }
.about-link { display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: left; }
.about-link > span { display: flex; flex-direction: column; gap: 3px; }
.about-link strong { font-size: 11.5px; color: var(--text-soft); font-weight: 600; }
.about-link em { font-style: normal; font-size: 10px; color: var(--dim); }
.about-link svg { width: 15px; height: 15px; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s; }
.about-link:hover svg { transform: translateX(3px); }
.about-foot { margin: 10px 0 0; font-size: 9.5px; color: var(--dim); letter-spacing: 0.04em; }

/* ---------------------------------------------------------------- workspace */

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) 44px;
  background: rgba(4, 10, 7, 0.35);
}

.workspace-head { padding: 19px 26px 12px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: var(--dim);
  text-transform: uppercase;
}
.pill {
  padding: 3px 8px;
  border-radius: 99px;
  border: 1px solid rgba(232, 201, 126, 0.3);
  background: var(--gold-soft);
  color: var(--gold);
  letter-spacing: 0.1em;
}
.pill.live { border-color: rgba(111, 227, 176, 0.35); background: var(--mint-soft); color: var(--mint); }

.workspace-head h1 {
  margin: 9px 0 7px;
  font-family: var(--serif);
  font-size: clamp(21px, 2.1vw, 29px);
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.25;
  color: #f2faf5;
}
.thesis {
  margin: 0;
  max-width: 830px;
  font-size: 12px;
  line-height: 1.68;
  color: var(--muted);
}

.meta-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  font-size: 9.5px;
  color: var(--dim);
  letter-spacing: 0.04em;
}
.meta-row span b { font-weight: 500; color: var(--muted); font-family: var(--mono); }

/* ---------------------------------------------------------------- tree */

.tree-host {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-top: 1px solid rgba(126, 231, 183, 0.06);
  background:
    radial-gradient(58% 52% at 50% 46%, rgba(26, 92, 67, 0.2), transparent 72%),
    radial-gradient(40% 30% at 82% 6%, rgba(232, 201, 126, 0.07), transparent 70%),
    linear-gradient(180deg, rgba(4, 11, 8, 0.4), rgba(3, 8, 6, 0.8));
}
.tree-host::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 120px 30px rgba(2, 6, 4, 0.72);
}
.spores { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0.7; }
.tree-svg { position: relative; z-index: 2; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.tree-svg.dragging { cursor: grabbing; }
.tree-svg.is-animating { cursor: progress; }

.tree-hint {
  position: absolute;
  left: 50%; bottom: 12px;
  transform: translateX(-50%);
  z-index: 3;
  font-size: 9.5px;
  color: rgba(139, 163, 152, 0.46);
  letter-spacing: 0.08em;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.5s;
}

.zoom-stack {
  position: absolute;
  right: 14px; bottom: 14px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(7, 17, 13, 0.82);
  backdrop-filter: blur(12px);
}
.zoom-stack button {
  width: 30px; height: 29px;
  display: grid; place-items: center;
  font-size: 15px;
  color: var(--muted);
  transition: 0.18s;
}
.zoom-stack button:hover { background: rgba(111, 227, 176, 0.09); color: var(--mint); }
.zoom-stack svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.growth-indicator {
  position: absolute;
  left: 14px; bottom: 14px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(7, 17, 13, 0.8);
  backdrop-filter: blur(12px);
  font-size: 9.5px;
  color: var(--muted);
}
.growth-indicator i { width: 5px; height: 5px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 8px var(--mint); animation: blink 1.1s infinite; }
.growth-indicator b { font-family: var(--mono); font-weight: 400; color: var(--mint); }

.tree-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: radial-gradient(50% 50% at 50% 50%, rgba(5, 13, 9, 0.72), rgba(4, 10, 7, 0.94));
  backdrop-filter: blur(3px);
}
.tree-loading strong { font-family: var(--serif); font-size: 17px; font-weight: 500; letter-spacing: 0.08em; }
.tree-loading > span { font-size: 10.5px; color: var(--muted); letter-spacing: 0.06em; }
.seed-loader { position: relative; width: 44px; height: 54px; margin-bottom: 4px; }
.seed-loader i {
  position: absolute;
  left: 50%; bottom: 0;
  width: 2px;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--mint), transparent);
  transform-origin: bottom center;
  animation: seedSprout 1.8s var(--ease-out) infinite;
}
.seed-loader i:nth-child(1) { height: 34px; margin-left: -1px; }
.seed-loader i:nth-child(2) { height: 24px; margin-left: -12px; transform: rotate(-24deg); animation-delay: 0.2s; background: linear-gradient(180deg, var(--gold), transparent); }
.seed-loader i:nth-child(3) { height: 26px; margin-left: 10px; transform: rotate(24deg); animation-delay: 0.4s; background: linear-gradient(180deg, var(--mint), transparent); }

.tree-tooltip {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  max-width: 260px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(8, 20, 15, 0.96);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(14px);
  transform: translate(-50%, -120%);
}
.tree-tooltip strong { display: block; font-size: 12px; line-height: 1.45; color: var(--text); font-weight: 600; }
.tree-tooltip span { display: block; margin-top: 4px; font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.08em; color: var(--dim); }
.tree-tooltip em { font-style: normal; color: var(--gold); }
.tree-tooltip .tip-summary {
  display: block;
  margin-top: 5px;
  font-style: normal;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--muted);
  letter-spacing: 0;
}

/* SVG tree */

.tree-svg {
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
}

.tree-svg text {
  font-family: var(--sans);
  user-select: none;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(4, 11, 8, 0.9);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.label-trunk { font-size: 16px; font-weight: 600; fill: #f1f9f4; letter-spacing: 0.02em; }
.label-trunk-sub { font-family: var(--mono); font-size: 9px; fill: rgba(232, 201, 126, 0.78); letter-spacing: 0.1em; }
.label-q { font-size: 13.5px; font-weight: 500; fill: #dcefe4; }
.label-q-sub { font-family: var(--mono); font-size: 9px; fill: rgba(139, 163, 152, 0.9); letter-spacing: 0.06em; }
.label-f { font-size: 12px; fill: #a9c6b6; }
.label-f-sub { font-family: var(--mono); font-size: 8.5px; fill: rgba(111, 227, 176, 0.62); letter-spacing: 0.06em; }
.label-anchor { font-family: var(--serif); font-size: 19px; font-weight: 500; fill: #f7fcf8; letter-spacing: 0.06em; }
.label-anchor-sub { font-family: var(--mono); font-size: 9px; fill: rgba(232, 201, 126, 0.75); letter-spacing: 0.2em; }
.label-end { font-family: var(--serif); font-size: 21px; fill: #fff8e4; letter-spacing: 0.05em; }

.edge { fill: none; stroke-linecap: round; }
.edge-trunk { stroke: url(#gradTrunk); stroke-width: 3.4; }
.edge-trunk-glow { stroke: rgba(111, 227, 176, 0.14); stroke-width: 9; filter: blur(3px); }
.edge-branch { stroke: rgba(232, 201, 126, 0.42); stroke-width: 1.6; }
.edge-twig { stroke: rgba(111, 227, 176, 0.34); stroke-width: 1.05; }

.edge-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: drawLine 0.85s var(--ease-out) forwards; }
.node-in { opacity: 0; animation: nodeIn 0.72s var(--ease-out) forwards; }
.node-label { opacity: 0; animation: fadeUp 0.55s var(--ease-out) forwards; }
.node-label.is-hidden { display: none; }

.node--start .ring { transform-box: fill-box; transform-origin: center; }
.node--end .bloom { transform-box: fill-box; transform-origin: center; }

.tree-svg.no-anim .edge-draw { animation: none; stroke-dashoffset: 0; }
.tree-svg.no-anim .node-in,
.tree-svg.no-anim .node-label { animation: none; opacity: 1; }

.node { cursor: pointer; outline: none; }
.node:focus,
.node:focus-visible { outline: none; }
.node .hit { fill: transparent; }
.node .core, .node .halo, .node .leaf, .node .petal { transition: 0.25s var(--ease-out); }
.node:hover .halo { opacity: 0.9; }
.node:hover .core { filter: drop-shadow(0 0 9px currentColor); }

.node--start .halo { fill: rgba(232, 201, 126, 0.08); stroke: rgba(232, 201, 126, 0.16); stroke-width: 1; }
.node--start .seed { fill: url(#gradSeed); }
.node--start .ring { fill: none; stroke: rgba(232, 201, 126, 0.28); stroke-width: 1; stroke-dasharray: 2 5; animation: rotateSlow 26s linear infinite; transform-origin: center; }

.node--trunk .halo { fill: rgba(232, 201, 126, 0.08); }
.node--trunk .core { fill: #0c1f18; stroke: var(--gold); stroke-width: 2; }
.node--trunk .inner { fill: var(--gold); }
.node--trunk .stage-num { font-family: var(--mono); font-size: 8.5px; fill: rgba(232, 201, 126, 0.68); letter-spacing: 0.12em; }

.node--question .halo { fill: rgba(232, 201, 126, 0.06); }
.node--question .core { fill: #0a1a14; stroke: rgba(232, 201, 126, 0.85); stroke-width: 1.5; }
.node--question .diamond { fill: rgba(232, 201, 126, 0.14); stroke: rgba(232, 201, 126, 0.7); stroke-width: 1; }
.node--question.status-debated .core { stroke: var(--coral); }
.node--question.status-open .core { stroke: var(--sky); }

.node--finding .leaf { fill: rgba(111, 227, 176, 0.16); stroke: rgba(111, 227, 176, 0.55); stroke-width: 1; }
.node--finding.status-debated .leaf { fill: rgba(255, 145, 117, 0.14); stroke: rgba(255, 145, 117, 0.6); }
.node--finding.status-open .leaf { fill: rgba(143, 211, 255, 0.12); stroke: rgba(143, 211, 255, 0.55); }

.node--end .halo { fill: rgba(232, 201, 126, 0.1); }
.node--end .petal { fill: rgba(232, 201, 126, 0.16); stroke: rgba(232, 201, 126, 0.55); stroke-width: 0.8; transform-origin: center; }
.node--end .petal:nth-child(2n) { fill: rgba(111, 227, 176, 0.14); stroke: rgba(111, 227, 176, 0.5); }
.node--end .core { fill: url(#gradSeed); }
.node--end .bloom { animation: rotateSlow 46s linear infinite; transform-origin: center; }
.node--end .rays { stroke: rgba(232, 201, 126, 0.22); stroke-width: 1; }

.source-dot { fill: var(--gold); opacity: 0.75; }
.source-dot.pulse { animation: dotPulse 3.4s ease-in-out infinite; }

.node.is-lit .core { filter: drop-shadow(0 0 12px currentColor); }
.tree-svg.has-focus .node:not(.is-lit) { opacity: 0.2; }
.tree-svg.has-focus .edge:not(.is-lit) { opacity: 0.12; }
.tree-svg.has-focus .edge.is-lit { opacity: 1; }
.node.is-lit .halo { opacity: 0.85; }

/* 证据采集中的主干节点：脉冲高亮 */
.node.is-growing .core { filter: drop-shadow(0 0 14px rgba(232, 201, 126, 0.9)); }
.node.is-growing .halo { opacity: 1; animation: growingPulse 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes growingPulse {
  0%, 100% { transform: scale(1); opacity: 0.55; }
  50% { transform: scale(1.18); opacity: 1; }
}
.tree-svg.has-focus .node.is-lit .node-inner { filter: drop-shadow(0 0 8px rgba(232, 201, 126, 0.28)); }

/* 枝干上的叶片与增量渲染 */
.edge-leaf { fill: rgba(111, 227, 176, 0.26); stroke: rgba(111, 227, 176, 0.42); stroke-width: 0.4; }
.leaf-draw { opacity: 0; animation: fadeIn 0.5s var(--ease-out) forwards; }
.no-anim-in { opacity: 1 !important; animation: none !important; }

/* 自动分析步骤 */
.auto-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.auto-steps li {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: rgba(8, 20, 15, 0.5);
}
.auto-steps li > i { width: 7px; height: 7px; border-radius: 50%; background: rgba(143, 211, 255, 0.45); flex: none; }
.auto-steps li > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.auto-steps strong { font-size: 11.5px; color: var(--text); font-weight: 600; }
.auto-steps span {
  font-size: 9.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.auto-steps em {
  margin-left: auto; font-style: normal; font-size: 9px; letter-spacing: 0.04em;
  font-family: var(--mono); color: var(--dim); flex: none; max-width: 96px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.auto-steps li.is-running > i { background: var(--gold); animation: blink 1.1s ease-in-out infinite; }
.auto-steps li.is-running em { color: var(--gold); }
.auto-steps li.is-done > i { background: #6fe3b0; }
.auto-steps li.is-warn > i { background: var(--coral); }
.auto-steps li.is-warn em { color: var(--coral); }

/* 生长日志 */
.log-card { display: flex; flex-direction: column; min-height: 0; }
.growth-log {
  list-style: none; margin: 0; padding: 0; max-height: 232px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px; font-size: 10px; line-height: 1.5;
  scrollbar-width: thin;
}
.growth-log:empty::after {
  content: '开始生长后，这里会逐步显示每一步在做什么。';
  color: var(--dim); font-size: 10px; line-height: 1.6;
}
.log-item { display: flex; gap: 7px; padding: 3px 2px; border-bottom: 1px dashed rgba(255, 255, 255, 0.05); }
.log-item time { font-family: var(--mono); font-size: 8.5px; color: rgba(255, 255, 255, 0.3); flex: none; padding-top: 1px; }
.log-item span { color: rgba(226, 241, 233, 0.78); word-break: break-word; }
.log-step span { color: var(--gold); }
.log-source span { color: #8fd3ff; }
.log-tree span { color: #b9e7c9; }
.log-review span { color: #d9c7ff; }
.log-warn span { color: var(--coral); }
.log-ok span { color: #6fe3b0; }

.branch-group.sway { animation: sway 8s ease-in-out infinite alternate; transform-box: view-box; }

/* ---------------------------------------------------------------- footer */

.workspace-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  border-top: 1px solid var(--line);
  background: rgba(5, 13, 9, 0.6);
  font-size: 9.5px;
  color: var(--dim);
  overflow: hidden;
}
.legend, .legend-status { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.legend > span, .legend-status > span { display: inline-flex; align-items: center; gap: 5px; }
.lg { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.lg-start { background: var(--gold); box-shadow: 0 0 7px var(--gold); }
.lg-trunk { background: #f2dfae; }
.lg-question { border: 1px solid var(--gold); background: transparent; }
.lg-finding { border: 1px solid var(--mint); background: transparent; transform: rotate(45deg); border-radius: 1px; }
.lg-source { background: var(--mint); width: 4px; height: 4px; }
.st { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
.st-consensus { background: var(--mint); }
.st-debated { background: var(--coral); }
.st-open { background: var(--sky); }

/* ---------------------------------------------------------------- inspector */

.inspector {
  position: fixed;
  z-index: 45;
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  width: 424px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background:
    radial-gradient(80% 30% at 100% 0%, rgba(111, 227, 176, 0.07), transparent 60%),
    linear-gradient(180deg, rgba(9, 21, 16, 0.98), rgba(5, 12, 9, 0.99));
  box-shadow: -30px 0 80px -30px rgba(0, 0, 0, 0.9);
  transform: translateX(102%);
  will-change: transform;
  transition: transform 0.42s var(--ease-out);
}
.inspector.open { transform: none; }

.inspector-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.inspector-head h2 {
  margin: 7px 0 0;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.02em;
}
.inspector-body { flex: 1; overflow-y: auto; padding: 18px 20px 40px; }

.inspector-section { margin-bottom: 22px; }
.inspector-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: var(--dim);
  text-transform: uppercase;
}
.inspector-section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid var(--line);
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.badge b { font-weight: 500; color: var(--text-soft); font-family: var(--mono); }
.badge.status-consensus { border-color: rgba(111, 227, 176, 0.3); color: var(--mint); background: var(--mint-soft); }
.badge.status-debated { border-color: rgba(255, 145, 117, 0.3); color: var(--coral); background: rgba(255, 145, 117, 0.08); }
.badge.status-open { border-color: rgba(143, 211, 255, 0.3); color: var(--sky); background: rgba(143, 211, 255, 0.08); }
.badge.source-count { border-color: rgba(232, 201, 126, 0.3); color: var(--gold); background: var(--gold-soft); }

.detail-text { font-size: 12.5px; line-height: 1.85; color: var(--text-soft); white-space: pre-wrap; }
.detail-text + .detail-text { margin-top: 10px; color: var(--muted); }
.relation {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px dashed var(--line-strong);
  font-size: 10.5px;
  color: var(--dim);
}
.relation b { font-weight: 500; color: var(--text-soft); }
.relation button { margin-left: auto; color: var(--mint); font-size: 10px; }
.relation button:hover { text-decoration: underline; }

.source-list { display: flex; flex-direction: column; gap: 8px; }
.source-card {
  display: block;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  transition: 0.2s var(--ease-out);
}
.source-card:hover { border-color: rgba(232, 201, 126, 0.34); background: rgba(232, 201, 126, 0.045); transform: translateY(-1px); }
.source-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.source-type { font-family: var(--mono); font-size: 8px; letter-spacing: 0.14em; color: var(--gold); text-transform: uppercase; }
.source-year { font-family: var(--mono); font-size: 8.5px; color: var(--dim); }
.source-title { display: block; font-size: 11.5px; line-height: 1.5; font-weight: 600; color: var(--text-soft); }
.source-meta { display: block; margin-top: 3px; font-size: 9.5px; color: var(--dim); }
.source-quote { margin: 7px 0 0; font-size: 10px; line-height: 1.65; color: var(--muted); font-style: italic; }
.source-quote:empty { display: none; }
.source-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 7px; font-size: 9.5px; color: var(--gold); }
.source-link svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 2; }

.child-list { display: flex; flex-direction: column; gap: 6px; }
.child-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  text-align: left;
  transition: 0.18s;
}
.child-item:hover { border-color: var(--line-strong); background: rgba(111, 227, 176, 0.05); }
.child-item i { flex: none; width: 6px; height: 6px; margin-top: 5px; border-radius: 50%; background: var(--gold); }
.child-item.is-finding i { border-radius: 1px; transform: rotate(45deg); background: var(--mint); }
.child-item span { font-size: 11px; line-height: 1.55; color: var(--text-soft); }
.child-item em { display: block; font-style: normal; font-size: 9px; color: var(--dim); margin-top: 2px; }

.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  font-size: 10.5px;
  color: var(--text-soft);
  transition: 0.18s;
}
.action-btn:hover { border-color: rgba(111, 227, 176, 0.5); color: var(--mint); background: rgba(111, 227, 176, 0.06); }
.action-btn.primary { border-color: transparent; background: linear-gradient(120deg, rgba(232, 201, 126, 0.9), rgba(111, 227, 176, 0.9)); color: #07120d; font-weight: 600; }
.action-btn.primary:hover { filter: brightness(1.05); }
.action-btn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.empty-note { font-size: 11px; line-height: 1.7; color: var(--dim); }

/* ---------------------------------------------------------------- modal */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 6, 4, 0.72);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.24s ease;
}
.modal {
  width: min(620px, 100%);
  max-height: min(86dvh, 820px);
  overflow-y: auto;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(111, 227, 176, 0.08), transparent 60%),
    linear-gradient(180deg, #0b1b15, #07130e);
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.95);
  padding: 24px;
  animation: modalIn 0.36s var(--ease-out);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 6px; }
.modal-head h2 { margin: 6px 0 0; font-family: var(--serif); font-size: 23px; font-weight: 500; letter-spacing: 0.03em; }
.modal-desc { margin: 8px 0 20px; font-size: 11.5px; line-height: 1.7; color: var(--muted); }
.modal-section { margin-bottom: 18px; }
.modal-section h3 {
  margin: 0 0 9px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: var(--dim);
  font-weight: 500;
  text-transform: uppercase;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.form-field label { font-size: 10px; color: var(--muted); letter-spacing: 0.04em; }
.form-field input, .form-field select {
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(3, 10, 7, 0.6);
  padding: 0 11px;
  font-size: 11.5px;
  color: var(--text);
  outline: none;
  transition: 0.2s;
}
.form-field input:focus, .form-field select:focus { border-color: rgba(111, 227, 176, 0.45); box-shadow: 0 0 0 3px rgba(111, 227, 176, 0.06); }
.form-field select option { background: #0a1712; }
.form-note { font-size: 9.5px; line-height: 1.65; color: var(--dim); margin: 2px 0 0; }
.endpoint-preview {
  margin: 0;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.6;
  color: var(--dim);
  word-break: break-all;
}
.diag-box {
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  font-size: 10px;
  line-height: 1.6;
}
.diag-head { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.14em; color: var(--dim); margin-bottom: 6px; text-transform: uppercase; }
.diag-url { font-family: var(--mono); font-size: 9px; color: var(--muted); word-break: break-all; }
.diag-row { display: flex; gap: 6px; align-items: flex-start; margin-top: 4px; color: var(--muted); }
.diag-row b { flex: none; font-weight: 600; }
.diag-row.ok b { color: #6fe3b0; }
.diag-row.bad b, .diag-row.bad span { color: #ff9175; }
#cfgBridge b { display: block; font-size: 10.5px; color: var(--text); margin-bottom: 2px; }
#cfgBridge > span { display: block; font-size: 9.5px; line-height: 1.6; color: var(--dim); }
#cfgBridge a { display: inline-block; margin-top: 6px; font-size: 10px; color: #8fd3ff; text-decoration: none; }
#cfgBridge a:hover { text-decoration: underline; }
.bridge-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bridge-chip {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(111, 227, 176, 0.35);
  background: rgba(111, 227, 176, 0.08);
  color: #6fe3b0;
  font-size: 9.5px;
  cursor: pointer;
}
.bridge-chip:hover { background: rgba(111, 227, 176, 0.16); }
.bridge-empty { font-size: 9.5px; color: var(--dim); }
.check-line { display: inline-flex; align-items: center; gap: 7px; font-size: 10.5px; color: var(--muted); cursor: pointer; }
.check-line input { accent-color: #6fe3b0; }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.modal-actions .btn-ghost, .modal-actions .btn-solid { height: 36px; padding: 0 16px; border-radius: 9px; font-size: 11.5px; }
.btn-solid { background: linear-gradient(120deg, var(--gold), var(--mint)); color: #07120d; font-weight: 700; border: 0; }
.btn-solid:hover { filter: brightness(1.05); }
.btn-ghost.danger { border-color: rgba(255, 125, 107, 0.35); color: var(--danger); }

.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.preset-grid button {
  padding: 9px 8px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  font-size: 10.5px;
  color: var(--muted);
  text-align: center;
  transition: 0.18s;
}
.preset-grid button:hover { border-color: var(--line-strong); color: var(--text-soft); }
.preset-grid button.active { border-color: rgba(111, 227, 176, 0.5); color: var(--mint); background: var(--mint-soft); }

.arch-flow { display: flex; flex-direction: column; gap: 8px; }
.arch-step {
  display: flex;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}
.arch-step b {
  flex: none;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 6px;
  background: var(--gold-soft);
  color: var(--gold);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
}
.arch-step div { display: flex; flex-direction: column; gap: 3px; }
.arch-step strong { font-size: 11.5px; font-weight: 600; color: var(--text-soft); }
.arch-step span { font-size: 10px; line-height: 1.6; color: var(--muted); }
.arch-code {
  margin: 0;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(2, 8, 5, 0.7);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.75;
  color: var(--muted);
  overflow-x: auto;
  white-space: pre;
}
.arch-code em { color: var(--mint); font-style: normal; }
.arch-list { margin: 0; padding-left: 16px; font-size: 10.5px; line-height: 1.8; color: var(--muted); }
.arch-list li::marker { color: var(--gold); }

/* ---------------------------------------------------------------- toast */

.toast-root {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 100;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 460px;
  padding: 9px 14px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  background: rgba(9, 22, 16, 0.96);
  box-shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.9);
  font-size: 11px;
  color: var(--text-soft);
  animation: toastIn 0.36s var(--ease-out);
  backdrop-filter: blur(16px);
}
.toast::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 8px var(--mint); flex: none; }
.toast.error::before { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.toast.leaving { animation: toastOut 0.3s ease forwards; }

/* ---------------------------------------------------------------- keyframes */

@keyframes drawLine { to { stroke-dashoffset: 0; } }
@keyframes nodeIn {
  0% { opacity: 0; transform: scale(0.35); }
  62% { opacity: 1; transform: scale(1.07); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes sway {
  from { transform: rotate(-0.9deg); }
  to { transform: rotate(0.9deg); }
}
@keyframes rotateSlow { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes dotPulse { 0%, 100% { opacity: 0.45; r: 1.5; } 50% { opacity: 1; r: 2.5; } }
@keyframes stemGrow { 0%, 100% { stroke-dasharray: 18; } 50% { stroke-dasharray: 10; } }
@keyframes leafBreathe { 0%, 100% { transform: rotate(0deg) scale(1); } 50% { transform: rotate(4deg) scale(1.05); } }
@keyframes seedSprout {
  0% { transform: scaleY(0.2) rotate(0deg); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: scaleY(1.05) rotate(0deg); opacity: 0; }
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(7px); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1240px) {
  :root { --rail-w: 304px; }
  .topbar { gap: 14px; }
  .topbar-topic { display: none; }
  .topbar-center { flex: 0 0 auto; }
  .topbar-actions { margin-left: auto; }
}

@media (max-width: 860px) {
  .topbar { gap: 10px; padding: 0 14px; }
  .brand-text span { display: none; }
  /* 窄屏优先保留：专家圆桌 / 导出 / 接入 AI，其余次要按钮收起，避免顶栏挤压换行 */
  #replayBtn, #fitBtn { display: none; }
}

@media (max-width: 560px) {
  #panelBtn { display: none; }
  .topbar-actions { gap: 6px; }
}

@media (max-width: 980px) {
  :root { --topbar-h: 58px; }
  .app { grid-template-rows: var(--topbar-h) minmax(0, 1fr); }
  .stage { grid-template-columns: 1fr; }
  .rail {
    position: fixed;
    z-index: 60;
    left: 10px; right: 10px; bottom: 10px;
    max-height: 74dvh;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    transform: translateY(calc(100% + 20px));
    transition: transform 0.4s var(--ease-out);
    box-shadow: 0 -20px 80px -20px rgba(0, 0, 0, 0.9);
  }
  .rail.open { transform: none; }
  .workspace { grid-column: 1; }
  .rail-toggle { display: grid; }
  .inspector { width: 100%; top: auto; height: 76dvh; border-left: 0; border-top: 1px solid var(--line-strong); border-radius: 20px 20px 0 0; transform: translateY(102%); }
  .inspector.open { transform: none; }
  .brand { min-width: 0; }
  .brand-text span { display: none; }
  .workspace-head { padding: 14px 18px 10px; }
  .workspace-foot { padding: 0 14px; }
  .legend-status { display: none; }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar-center { display: none; }
  .modal { padding: 18px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .preset-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .workspace-head h1 { font-size: 19px; }
  .thesis { font-size: 11px; }
  .meta-row span:nth-child(n+4) { display: none; }
  .legend { gap: 9px; font-size: 8.5px; }
  .btn-ghost#aiBtn span:last-child { display: none; }
  .btn-ghost#aiBtn { padding: 0 9px; }
  .tree-hint { display: none; }
  .inspector { height: 82dvh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------------------- domain + expert panel */

.domain-auto {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 38px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(111, 227, 176, 0.08), rgba(143, 211, 255, 0.04));
}
.domain-auto-label {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  color: var(--dim);
  text-transform: uppercase;
}
.domain-auto-value { font-size: 12.5px; color: var(--text); letter-spacing: 0.02em; }
.domain-tagline { margin: 8px 0 11px; font-size: 10.5px; line-height: 1.65; color: var(--dim); }
.btn-outline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(111, 227, 176, 0.05);
  color: var(--text-soft);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  transition: 0.2s;
}
.btn-outline:hover { color: var(--mint); border-color: rgba(111, 227, 176, 0.4); background: rgba(111, 227, 176, 0.09); }
.btn-outline svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn-outline:disabled { opacity: 0.5; }

.source-authority { display: inline-flex; align-items: center; gap: 4px; }
.source-authority.a { color: var(--mint); }
.source-authority.b { color: var(--gold); }
.source-authority.c { color: var(--sky); }
.source-authority.d { color: var(--dim); }

.logic-chain { display: flex; flex-direction: column; gap: 1px; border-radius: 11px; overflow: hidden; background: var(--line); border: 1px solid var(--line); }
.logic-row { display: grid; grid-template-columns: 62px 1fr; gap: 9px; padding: 8px 10px; background: rgba(7, 17, 13, 0.72); }
.logic-row b { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.12em; color: var(--dim); font-weight: 500; padding-top: 2px; }
.logic-row span { font-size: 11px; line-height: 1.65; color: var(--text-soft); }
.logic-row.is-warn span { color: var(--gold); }

.panel-modal { width: min(1080px, 100%); }
.panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 4px 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.panel-toolbar .domain-pill {
  padding: 4px 9px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--mint);
}
.panel-scope { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
.panel-scope input { accent-color: var(--mint); }
.panel-toolbar .btn-solid { margin-left: auto; height: 34px; padding: 0 16px; }
.panel-note { font-size: 10px; color: var(--dim); margin: -4px 0 12px; }

.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.expert-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0.008));
  padding: 13px;
  min-height: 120px;
  transition: 0.3s;
}
.expert-card.is-running { border-color: rgba(111, 227, 176, 0.32); box-shadow: 0 0 0 1px rgba(111, 227, 176, 0.08) inset; }
.expert-card.is-error { border-color: rgba(255, 125, 107, 0.35); }
.expert-head { display: flex; align-items: flex-start; gap: 9px; }
.expert-glyph {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(111, 227, 176, 0.06);
  color: var(--mint);
  font-family: var(--serif);
  font-size: 15px;
  flex: none;
}
.expert-card[data-expert="logician"] .expert-glyph { color: var(--gold); background: rgba(232, 201, 126, 0.07); }
.expert-card[data-expert="redteam"] .expert-glyph { color: var(--coral); background: rgba(255, 145, 117, 0.07); }
.expert-head div { flex: 1; min-width: 0; }
.expert-head strong { display: block; font-size: 12px; font-weight: 600; }
.expert-head em { display: block; margin-top: 2px; font-style: normal; font-size: 9px; color: var(--dim); letter-spacing: 0.05em; }
.verdict {
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--dim);
  white-space: nowrap;
}
.verdict.pass { color: var(--mint); border-color: rgba(111, 227, 176, 0.4); background: rgba(111, 227, 176, 0.08); }
.verdict.revise { color: var(--gold); border-color: rgba(232, 201, 126, 0.4); background: rgba(232, 201, 126, 0.08); }
.verdict.fail { color: var(--coral); border-color: rgba(255, 145, 117, 0.4); background: rgba(255, 145, 117, 0.08); }
.expert-summary { margin: 9px 0 0; font-size: 11px; line-height: 1.65; color: var(--text-soft); }
.expert-empty { margin: 9px 0 0; font-size: 10.5px; color: var(--dim); }
.issue-list { list-style: none; margin: 9px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.issue-item { padding: 7px 9px; border-radius: 9px; background: rgba(255, 255, 255, 0.022); border-left: 2px solid var(--line-strong); }
.issue-item.high { border-left-color: var(--coral); }
.issue-item.medium { border-left-color: var(--gold); }
.issue-item.low { border-left-color: var(--sky); }
.issue-item b { font-size: 10.5px; color: var(--text); font-weight: 600; }
.issue-item span { display: block; margin-top: 3px; font-size: 10px; line-height: 1.6; color: var(--muted); }
.issue-item em { display: block; margin-top: 3px; font-style: normal; font-size: 9.5px; line-height: 1.55; color: var(--mint); }
.expert-question { margin-top: 9px; padding: 7px 9px; border-radius: 9px; background: rgba(232, 201, 126, 0.06); font-size: 10px; line-height: 1.6; color: var(--gold); }
.tool-list { margin-top: 9px; display: flex; flex-direction: column; gap: 5px; }
.tool-item { display: flex; align-items: flex-start; gap: 6px; font-size: 9.5px; line-height: 1.5; color: var(--muted); }
.tool-item i { width: 5px; height: 5px; margin-top: 5px; border-radius: 50%; background: var(--dim); flex: none; }
.tool-item.ok i { background: var(--mint); box-shadow: 0 0 6px var(--mint); }
.tool-item.bad i { background: var(--coral); }
.tool-item b { color: var(--text-soft); font-weight: 500; }

.panel-verdict { margin-top: 12px; padding: 15px 16px; border-radius: 15px; border: 1px solid var(--line-strong); background: radial-gradient(120% 80% at 0% 0%, rgba(232, 201, 126, 0.08), transparent 60%), rgba(7, 17, 13, 0.68); }
.panel-verdict-head { display: flex; align-items: center; gap: 10px; }
.panel-verdict-head strong { font-family: var(--serif); font-size: 19px; font-weight: 500; letter-spacing: 0.04em; }
.panel-score { font-family: var(--mono); font-size: 11px; color: var(--gold); }
.panel-verdict p { margin: 8px 0 0; font-size: 11.5px; line-height: 1.75; color: var(--text-soft); }
.panel-fix { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.panel-fix li { position: relative; padding-left: 14px; font-size: 10.5px; line-height: 1.6; color: var(--muted); }
.panel-fix li::before { content: "→"; position: absolute; left: 0; color: var(--mint); }
.panel-disagree { margin-top: 9px; font-size: 10px; color: var(--coral); line-height: 1.6; }

@media (max-width: 860px) {
  .panel-grid { grid-template-columns: 1fr; }
  .panel-modal { padding: 16px; }
  .panel-toolbar .btn-solid { margin-left: 0; width: 100%; }
}

/* ---------------------------------------------------------------- follow-up */

.followup-card {
  border: 1px solid rgba(232, 201, 126, 0.22);
  border-radius: 12px;
  padding: 13px 13px 11px;
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(232, 201, 126, 0.09), transparent 62%),
    rgba(255, 255, 255, 0.018);
}
.followup-q {
  margin: 0 0 8px;
  font-size: 12.5px;
  line-height: 1.75;
  font-weight: 600;
  color: #f4f9f6;
}
.followup-why { margin: 0; font-size: 10.5px; line-height: 1.7; color: var(--dim); }
.followup-more {
  margin: 10px 0 0;
  padding: 10px 0 0;
  border-top: 1px dashed var(--line);
  list-style: none;
  display: grid;
  gap: 9px;
}
.followup-more li { display: grid; gap: 3px; }
.followup-more b { font-size: 11px; line-height: 1.65; font-weight: 500; color: var(--text-soft); }
.followup-more span { font-size: 10px; line-height: 1.6; color: var(--dim); }
.followup-card .action-row { margin-top: 11px; }

/* ---------------------------------------------------------------- agent gateway */

.gateway-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.gateway-mode {
  padding: 10px 11px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.gateway-mode b { display: block; font-size: 11.5px; font-weight: 600; color: var(--text-soft); }
.gateway-mode span { display: block; margin-top: 4px; font-size: 9.5px; line-height: 1.6; color: var(--dim); }
.gateway-mode.is-on { border-color: rgba(111, 227, 176, 0.34); background: rgba(111, 227, 176, 0.06); }
.gateway-mode.is-on b { color: var(--mint); }
.gateway-tip { margin: 0 0 12px; font-size: 10px; line-height: 1.7; color: var(--dim); }
@media (max-width: 860px) {
  .gateway-modes { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- 同行评审 */

.modal-wide { width: min(900px, 100%); }

.review-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(262px, 1fr)); gap: 10px; }
.review-card .expert-head em { line-height: 1.5; }
.review-score {
  flex: none;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--gold);
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid rgba(232, 201, 126, 0.28);
  background: rgba(232, 201, 126, 0.07);
}
.review-minor { margin: 8px 0 0; padding-left: 14px; font-size: 10px; line-height: 1.65; color: var(--muted); }
.review-minor li::marker { color: var(--dim); }
.review-tools { margin-top: 8px; font-family: var(--mono); font-size: 9.5px; line-height: 1.6; color: var(--dim); }

.decision-badge {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  color: var(--text-soft);
}
.decision-badge.accept { color: var(--mint); border-color: rgba(111, 227, 176, 0.4); background: rgba(111, 227, 176, 0.08); }
.decision-badge.minor { color: var(--sky); border-color: rgba(143, 211, 255, 0.35); background: rgba(143, 211, 255, 0.07); }
.decision-badge.major { color: var(--gold); border-color: rgba(232, 201, 126, 0.4); background: rgba(232, 201, 126, 0.08); }
.decision-badge.reject { color: var(--coral); border-color: rgba(255, 145, 117, 0.4); background: rgba(255, 145, 117, 0.08); }

.score-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.score-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  font-size: 9.5px;
  color: var(--dim);
}
.score-chip b { font-family: var(--mono); font-size: 12px; color: var(--mint); }

.review-block { margin-top: 12px; }
.review-block > b {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--dim);
  text-transform: uppercase;
}
.revision-list { margin: 7px 0 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.revision-list li {
  padding: 8px 10px;
  border-radius: 9px;
  border-left: 2px solid var(--gold);
  background: rgba(255, 255, 255, 0.022);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--text-soft);
}
.revision-list em { display: block; margin-top: 3px; font-style: normal; font-size: 9.5px; color: var(--dim); }

/* ---------------------------------------------------------------- 竞品分析 */

.rail-tools { display: grid; gap: 8px; margin-top: 10px; }

.comp-classes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.comp-class { padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); }
.comp-class b { display: block; font-size: 11px; color: var(--text-soft); }
.comp-class span { display: block; margin-top: 3px; font-size: 9px; line-height: 1.55; color: var(--dim); }

.comp-group { margin-bottom: 16px; }
.comp-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.comp-group-head b { font-family: var(--serif); font-size: 15px; font-weight: 500; color: var(--gold); }
.comp-group-head span { font-size: 9.5px; color: var(--dim); }
.comp-list { display: grid; gap: 8px; }
.comp-row { padding: 11px 12px; border-radius: 11px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.018); }
.comp-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.comp-name strong { font-size: 12.5px; font-weight: 600; color: var(--text); }
.threat {
  font-family: var(--mono);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  color: var(--dim);
}
.threat-high { color: var(--coral); border-color: rgba(255, 145, 117, 0.35); background: rgba(255, 145, 117, 0.07); }
.threat-medium { color: var(--gold); border-color: rgba(232, 201, 126, 0.3); background: rgba(232, 201, 126, 0.06); }
.threat-low { color: var(--mint); border-color: rgba(111, 227, 176, 0.3); background: rgba(111, 227, 176, 0.06); }
.comp-row p { margin: 0 0 3px; font-size: 10px; line-height: 1.65; color: var(--muted); }
.comp-row p b { display: inline-block; min-width: 34px; margin-right: 6px; font-weight: 600; color: var(--dim); }
.comp-note { color: var(--text-soft) !important; }
.comp-link { display: inline-block; margin-top: 5px; font-size: 9.5px; color: var(--mint); text-decoration: none; }
.comp-link:hover { text-decoration: underline; }

@media (max-width: 860px) {
  .comp-classes { grid-template-columns: 1fr 1fr; }
}

/* ---------------------------------------------------------------- 历史记录 */

.history-actions { display: flex; gap: 7px; margin-bottom: 9px; }
.history-actions .btn-outline { flex: 1; justify-content: center; padding: 6px 8px; font-size: 10px; }
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.history-list:empty::after { content: '还没有存档。生长完成后会自动保存，也可以点「保存当前」。'; color: var(--dim); font-size: 10px; line-height: 1.6; }
.history-item { display: flex; align-items: flex-start; gap: 8px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: rgba(8, 20, 15, 0.45); }
.history-open { flex: 1; min-width: 0; text-align: left; display: flex; flex-direction: column; gap: 3px; }
.history-open b { font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-open span { font-size: 9px; color: var(--dim); font-family: var(--mono); letter-spacing: 0.03em; }
.history-item:hover { border-color: rgba(232, 201, 126, 0.35); background: rgba(19, 37, 29, 0.6); }
.history-del { flex: none; width: 20px; height: 20px; border-radius: 6px; color: var(--dim); font-size: 13px; line-height: 1; }
.history-del:hover { color: var(--coral); background: rgba(255, 145, 117, 0.1); }

/* ---------------------------------------------------------------- 调研文档 */

.modal-doc { width: min(940px, 100%); padding: 0; display: flex; flex-direction: column; max-height: min(90dvh, 900px); }
.doc-modal-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 20px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3;
  background: linear-gradient(180deg, #0b1b15, rgba(11, 27, 21, 0.94));
  backdrop-filter: blur(10px);
}
.doc-modal-head strong { font-family: var(--serif); font-size: 16px; font-weight: 500; }
.doc-modal-head .doc-actions { margin-left: auto; display: flex; gap: 7px; }
.doc-modal-head .doc-actions button {
  font-size: 10px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-strong);
  color: var(--muted); font-family: var(--mono); letter-spacing: 0.04em;
}
.doc-modal-head .doc-actions button:hover { color: var(--gold); border-color: rgba(232, 201, 126, 0.4); }
.doc-view { overflow-y: auto; padding: 22px 26px 34px; font-size: 12.5px; line-height: 1.75; color: var(--muted); }
.doc-view .doc-kicker { font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; color: var(--dim); }
.doc-view h1 { font-family: var(--serif); font-weight: 500; font-size: 25px; line-height: 1.35; color: var(--text); margin: 8px 0 10px; }
.doc-view .doc-question { margin: 0 0 5px; color: var(--muted); }
.doc-view .doc-thesis { margin: 0; color: var(--gold); }
.doc-view h2 { font-size: 13px; color: var(--text); margin: 26px 0 10px; padding-bottom: 7px; border-bottom: 1px solid var(--line); letter-spacing: 0.04em; }
.doc-view h3 { font-size: 13px; color: var(--text); margin: 0; font-weight: 600; }
.doc-view h4 { font-size: 11.5px; color: var(--text); margin: 14px 0 5px; }
.doc-view p { margin: 4px 0; }
.doc-view p strong { display: inline-block; min-width: 70px; color: var(--dim); font-weight: 500; font-size: 10.5px; }
.doc-view .doc-chain { color: var(--gold); font-weight: 600; }
.doc-view .doc-stage { padding: 11px 0; border-top: 1px dashed rgba(255, 255, 255, 0.06); }
.doc-view .doc-stage:first-of-type { border-top: 0; }
.doc-view .doc-stage header { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.doc-view .doc-stage header b { font-family: var(--mono); font-size: 9.5px; color: var(--dim); }
.doc-view .doc-tag { font-size: 9px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--dim); }
.doc-view .doc-tag.s-consensus { color: #6fe3b0; border-color: rgba(111, 227, 176, 0.35); }
.doc-view .doc-tag.s-debated { color: var(--coral); border-color: rgba(255, 145, 117, 0.35); }
.doc-view .doc-tag.s-open { color: #8fd3ff; border-color: rgba(143, 211, 255, 0.35); }
.doc-view .doc-empty { color: var(--dim); font-size: 10px; }
.doc-view ul, .doc-view ol { padding-left: 18px; margin: 4px 0; }
.doc-view li { margin: 3px 0; }
.doc-view li em { color: var(--dim); font-style: normal; font-size: 9.5px; margin-left: 6px; }
.doc-view .doc-qa-group { margin-bottom: 12px; }
.doc-view .doc-sources a { color: #8fd3ff; text-decoration: none; border-bottom: 1px solid rgba(143, 211, 255, 0.3); }
.doc-view .doc-qa { padding: 10px 0; border-top: 1px dashed rgba(255, 255, 255, 0.07); }
.doc-view .doc-qa p { margin: 3px 0; }
.doc-view .doc-qa b { display: inline-block; min-width: 24px; color: var(--gold); }
.doc-view .doc-qa .a { color: rgba(226, 241, 233, 0.78); }
.doc-view .doc-foot { margin-top: 30px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--dim); font-family: var(--mono); font-size: 9px; }

@media print {
  body > *:not(.modal-root) { display: none !important; }
  .modal-root { position: static !important; display: block !important; background: #fff !important; }
  .modal-doc { width: 100% !important; max-height: none !important; box-shadow: none !important; border: 0 !important; }
  .doc-modal-head { display: none !important; }
  .doc-view { color: #1b2620 !important; overflow: visible !important; }
  .doc-view h1, .doc-view h2, .doc-view h3, .doc-view h4 { color: #111 !important; }
}
