/* Lumen 2.0 design system — hand-rolled, no framework.
   Concept: lumen = light. Light behaves like light here — it glows, layers,
   and moves with intent. Two themes from one token set: warm paper (default)
   and deep night. Amber is the light source, cyan is the signal.
   Space Grotesk carries display type, Inter UI, JetBrains Mono data. */

:root {
  /* ----- LIGHT (default): warm paper ----- */
  color-scheme: light;
  --bg: #f5f3ee;
  --bg-raise: #fbfaf7;
  --panel: #ffffff;
  --panel-2: #edeae2;
  --border: rgba(30, 34, 48, 0.10);
  --border-2: rgba(30, 34, 48, 0.18);
  --text: #1d212c;
  --text-2: #3d4456;
  --muted: #687083;
  --faint: #969eb0;
  --accent: #a87708;          /* amber as ink */
  --accent-2: #d09a14;
  --accent-deep: #8a6203;
  --cyan: #0d72a8;            /* signal as ink */
  --good: #15803d;
  --warn: #b45309;
  --bad: #d03131;
  --shadow: 0 16px 44px rgba(34, 28, 12, 0.13);
  --glass: rgba(251, 250, 247, 0.78);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --inset-bg: rgba(30, 34, 48, 0.05);
  --input-bg: #ffffff;
  --wash-1: rgba(30, 34, 48, 0.035);
  --wash-2: rgba(30, 34, 48, 0.07);
  --dot: rgba(30, 34, 48, 0.075);
  --amb-1: rgba(208, 154, 20, 0.10);
  --amb-2: rgba(13, 114, 168, 0.06);
  --amb-3: rgba(124, 58, 237, 0.025);
  --hairline: rgba(30, 34, 48, 0.20);
  --hairline-amber: rgba(168, 119, 8, 0.45);
  --label-halo: 0 1px 3px rgba(255, 255, 255, 0.9);
  --glow-amber-text: none;
  --glow-amber-box: 0 0 18px rgba(208, 154, 20, 0.14);
  --glow-cyan: 0 0 6px rgba(13, 114, 168, 0.3);
  --status-glow: none;
  --brand-glow: 0 0 10px rgba(228, 171, 28, 0.55), 0 0 26px rgba(228, 171, 28, 0.2);
  --ring-amber: rgba(168, 119, 8, 0.45);

  --radius: 12px;
  --radius-sm: 8px;
  --sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --display: 'Space Grotesk', 'Inter', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease-spring: cubic-bezier(0.34, 1.4, 0.4, 1);
  --ease-out: cubic-bezier(0.2, 0.7, 0.3, 1);
}

html[data-theme="dark"] {
  /* ----- DARK: deep night ----- */
  color-scheme: dark;
  --bg: #05060a;
  --bg-raise: #0a0c12;
  --panel: #0f1219;
  --panel-2: #161a24;
  --border: rgba(148, 163, 198, 0.10);
  --border-2: rgba(148, 163, 198, 0.20);
  --text: #e9ecf4;
  --text-2: #c2c9d8;
  --muted: #8b94ab;
  --faint: #5a637a;
  --accent: #ffd166;
  --accent-2: #ffe9ad;
  --accent-deep: #f5b93c;
  --cyan: #7dd3fc;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  --glass: rgba(8, 10, 15, 0.72);
  --glass-strong: rgba(18, 21, 30, 0.88);
  --inset-bg: rgba(0, 0, 0, 0.32);
  --input-bg: rgba(0, 0, 0, 0.32);
  --wash-1: rgba(148, 163, 198, 0.05);
  --wash-2: rgba(148, 163, 198, 0.09);
  --dot: rgba(233, 236, 244, 0.045);
  --amb-1: rgba(255, 209, 102, 0.075);
  --amb-2: rgba(125, 211, 252, 0.055);
  --amb-3: rgba(196, 181, 253, 0.025);
  --hairline: rgba(148, 163, 198, 0.25);
  --hairline-amber: rgba(255, 209, 102, 0.5);
  --label-halo: 0 1px 4px rgba(0, 0, 0, 0.9);
  --glow-amber-text: 0 0 18px rgba(255, 209, 102, 0.35);
  --glow-amber-box: 0 0 18px rgba(255, 209, 102, 0.18);
  --glow-cyan: 0 0 8px rgba(125, 211, 252, 0.45);
  --status-glow: 0 0 12px currentColor;
  --brand-glow: 0 0 16px rgba(255, 209, 102, 0.75), 0 0 40px rgba(255, 209, 102, 0.25);
  --ring-amber: rgba(255, 209, 102, 0.4);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

/* Ambient light: two soft sources + a faint dot lattice. Fixed, zero-jank.
   The light drifts — slowly enough that you feel it rather than see it. */
@keyframes aurora {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(2.5%, -2%, 0) scale(1.06); }
  100% { transform: translate3d(-2%, 1.5%, 0) scale(1.02); }
}
body::before {
  content: '';
  position: fixed; inset: -8%; z-index: -2; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 45% at 18% -5%, var(--amb-1), transparent 60%),
    radial-gradient(ellipse 55% 45% at 88% 110%, var(--amb-2), transparent 60%),
    radial-gradient(ellipse 40% 35% at 70% 20%, var(--amb-3), transparent 60%);
  animation: aurora 50s ease-in-out infinite alternate;
}
body::after {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 0%, transparent 75%);
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: var(--hairline); }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { letter-spacing: -0.015em; margin: 0; }
h1, h2 { font-family: var(--display); }
p { margin: 0 0 10px; }

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

.mono { font-family: var(--mono); font-size: 0.92em; }
.dim { color: var(--muted); }
.warn-text { color: var(--warn); }
.kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 6px;
  text-shadow: var(--glow-amber-text);
}
.grad-text {
  background: linear-gradient(115deg, var(--accent-2) 5%, var(--accent) 45%, var(--cyan) 110%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- Motion vocabulary ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes springIn {
  0% { opacity: 0; transform: translateY(14px) scale(0.97); }
  70% { opacity: 1; transform: translateY(-2px) scale(1.005); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes breathe { 0%, 100% { opacity: 0.6; transform: scale(1); } 50% { opacity: 1; transform: scale(1.12); } }
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ringOut {
  from { opacity: 0.5; transform: translate(-50%, -50%) scale(0.5); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(1.9); }
}

/* Route + list entrances: children stagger in. */
.route-anim > * { animation: fadeUp 0.4s var(--ease-out) both; }
.stagger > * { animation: fadeUp 0.45s var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.10s; }
.stagger > *:nth-child(4) { animation-delay: 0.14s; }
.stagger > *:nth-child(5) { animation-delay: 0.18s; }
.stagger > *:nth-child(6) { animation-delay: 0.22s; }
.stagger > *:nth-child(7) { animation-delay: 0.26s; }
.stagger > *:nth-child(8) { animation-delay: 0.30s; }
.stagger > *:nth-child(9) { animation-delay: 0.34s; }
.stagger > *:nth-child(10) { animation-delay: 0.38s; }
.stagger > *:nth-child(n+11) { animation-delay: 0.42s; }

/* ---------- App shell: icon sidebar + slim contextual topbar ---------- */
#app { display: flex; flex-direction: row; height: 100%; }
#main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

#sidebar {
  width: 78px; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 0 14px; gap: 18px;
  border-right: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  position: relative; z-index: 21;
}
#sidebar::after {
  content: ''; position: absolute; top: 0; bottom: 0; right: -1px; width: 1px;
  background: linear-gradient(180deg, var(--hairline-amber), transparent 35%, transparent 70%, var(--amb-2));
  pointer-events: none; opacity: 0.6;
}
.side-nav { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 0 10px; }
.side-nav button {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 100%; padding: 9px 0 7px; border-radius: 11px;
  color: var(--muted);
  transition: color 0.18s, background 0.18s, transform 0.18s var(--ease-spring);
}
.side-nav button:hover { color: var(--text); background: var(--wash-1); transform: translateY(-1px); }
.side-nav button.nav-active { color: var(--accent); background: var(--wash-2); box-shadow: inset 0 0 0 1px var(--border); }
.side-nav button.nav-active::before {
  content: ''; position: absolute; left: -10px; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: var(--glow-amber-box);
}
.side-nav-label { font-size: 9.5px; font-weight: 600; letter-spacing: 0.02em; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; align-items: center; }

#topbar {
  display: flex; align-items: center; gap: 14px;
  height: 50px; padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  flex-shrink: 0; position: relative; z-index: 20;
}
#topbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--hairline-amber) 18%, var(--amb-2) 55%, transparent 90%);
  pointer-events: none; opacity: 0.7;
}
.topbar-title { display: flex; align-items: baseline; gap: 7px; }
.topbar-view { font-family: var(--mono); font-size: 11.5px; }
.brand { display: flex; align-items: center; justify-content: center; }
.brand:hover { text-decoration: none; }
.brand-dot {
  position: relative;
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3cf, #ffd166 55%, #e9a90c);
  box-shadow: var(--brand-glow);
  animation: breathe 4.5s ease-in-out infinite;
}
.brand-name { font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand-ver { font-size: 11px; color: var(--faint); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.palette-trigger {
  display: flex; align-items: center; gap: 8px;
  flex: 1; max-width: 420px; margin: 0 auto;
  padding: 7px 12px; border-radius: 10px;
  border: 1px solid var(--border-2); background: var(--input-bg);
  color: var(--faint); font-size: 12.5px; text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s, color 0.2s;
}
.palette-trigger:hover { border-color: var(--accent-2); color: var(--muted); box-shadow: 0 0 0 3px rgba(228, 171, 28, 0.10); }
.palette-trigger span { flex: 1; }
.palette-trigger kbd {
  padding: 1px 5px; border: 1px solid var(--border-2);
  border-radius: 4px; font-size: 10.5px; color: var(--faint); background: var(--inset-bg);
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  color: var(--muted); transition: color 0.18s, background 0.18s, transform 0.18s var(--ease-spring);
}
.icon-btn:hover { color: var(--text); background: var(--wash-2); transform: translateY(-1px); }

.ai-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted);
  background: var(--inset-bg);
  transition: border-color 0.2s;
}
.ai-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); transition: background 0.2s, box-shadow 0.2s; }
.ai-loading .ai-dot { background: var(--cyan); box-shadow: var(--glow-cyan); animation: pulse 1.4s ease-in-out infinite; }
.ai-ready .ai-dot { background: var(--good); box-shadow: 0 0 8px var(--good); }
.ai-ready { border-color: var(--good); }
.ai-error .ai-dot { background: var(--bad); box-shadow: 0 0 8px var(--bad); }

#view-root { flex: 1; min-height: 0; }
#mobile-nav { display: none; }

/* ---------- Buttons / inputs / chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 8px 15px; border-radius: 9px;
  font-weight: 600; font-size: 13.5px; white-space: nowrap;
  transition: transform 0.18s var(--ease-spring), background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(180deg, #ffe9ad, #ffd166 55%, #f0b228);
  color: #1a1405;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 16px rgba(228, 171, 28, 0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 6px 26px rgba(228, 171, 28, 0.45);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost {
  border: 1px solid var(--border-2); color: var(--text-2); font-weight: 500;
  background: var(--wash-1);
}
.btn-ghost:hover { background: var(--wash-2); color: var(--text); border-color: var(--hairline); }
.btn-danger { border: 1px solid var(--bad); color: var(--bad); font-weight: 500; }
.btn-danger:hover { background: rgba(220, 60, 60, 0.08); box-shadow: 0 0 18px rgba(220, 60, 60, 0.12); }
.btn-danger:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-xs { padding: 2px 8px; font-size: 11.5px; }
.btn-block { width: 100%; }
.btn-on { border-color: var(--accent); color: var(--accent); box-shadow: var(--glow-amber-box); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.input {
  width: 100%; background: var(--input-bg); border: 1px solid var(--border-2);
  border-radius: 9px; padding: 8px 12px;
  color: var(--text); font: inherit; font-size: 13.5px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input::placeholder { color: var(--faint); }
.input:focus {
  outline: none; border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(228, 171, 28, 0.13);
}
.input-sm { padding: 5px 9px; font-size: 12.5px; width: auto; }
.input-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
select.input { appearance: none; }

.chip {
  font-family: var(--mono); font-size: 11px; padding: 3px 10px;
  border-radius: 999px; border: 1px solid var(--border-2); color: var(--muted);
  transition: color 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.18s var(--ease-spring);
}
.chip:hover { color: var(--text); transform: translateY(-1px); }
.chip-active {
  border-color: var(--accent-2); color: var(--accent);
  background: rgba(228, 171, 28, 0.10); box-shadow: var(--glow-amber-box);
}
.minitag { font-family: var(--mono); font-size: 10.5px; color: var(--faint); margin-right: 6px; }

.seg {
  display: inline-flex; background: var(--inset-bg); border: 1px solid var(--border);
  border-radius: 9px; padding: 2px; gap: 2px;
}
.seg-btn { padding: 4px 11px; border-radius: 7px; font-size: 12px; color: var(--muted); transition: color 0.18s, background 0.18s, box-shadow 0.18s; }
.seg-btn:hover { color: var(--text); }
.seg-active { background: var(--bg-raise); color: var(--text); box-shadow: 0 1px 5px rgba(0, 0, 0, 0.18); }

.callout {
  border: 1px solid var(--border-2);
  background: linear-gradient(180deg, var(--wash-1), transparent), var(--bg-raise);
  border-radius: var(--radius); padding: 13px 15px; font-size: 13.5px; color: var(--text-2);
}
.callout-warn { border-color: var(--warn); background: rgba(214, 138, 16, 0.06); }
.callout-danger { border-color: var(--bad); background: rgba(220, 60, 60, 0.06); }

.scorebar {
  display: inline-block; width: 64px; height: 5px; vertical-align: middle;
  background: var(--wash-2); border-radius: 99px; overflow: hidden;
}
.scorebar-fill {
  display: block; height: 100%; border-radius: 99px;
  background: var(--cyan);
  box-shadow: var(--glow-cyan);
  transform-origin: left;
  animation: growX 0.6s var(--ease-out) both;
}

.spinner {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--border-2); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite; vertical-align: -2px; margin-right: 4px;
}
.caret {
  display: inline-block; width: 7px; height: 15px; margin-left: 2px; vertical-align: -2px;
  background: var(--accent); box-shadow: var(--glow-amber-box);
  animation: pulse 0.9s infinite;
}

/* ---------- Toasts ---------- */
#toast-root { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--glass-strong); border: 1px solid var(--border-2);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius); padding: 10px 16px; font-size: 13.5px;
  box-shadow: var(--shadow); animation: springIn 0.4s var(--ease-out) both; max-width: 560px;
}
.toast-success { border-color: var(--good); }
.toast-warn { border-color: var(--warn); }
.toast-error { border-color: var(--bad); }
.toast-action { color: var(--accent); font-weight: 600; }
.toast-out { opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(10, 9, 4, 0.45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 9vh 16px 16px; overflow-y: auto;
}
html[data-theme="dark"] .modal-backdrop { background: rgba(3, 4, 7, 0.68); }
.modal {
  position: relative;
  width: 100%; max-width: 560px;
  background: linear-gradient(180deg, var(--wash-1), transparent 120px), var(--bg-raise);
  border: 1px solid var(--border-2); border-radius: 16px;
  box-shadow: var(--shadow);
  animation: scaleIn 0.28s var(--ease-out) both;
}
.modal::before {
  content: ''; position: absolute; top: -1px; left: 24px; right: 24px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--hairline-amber), transparent);
}
.modal-wide { max-width: 700px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 17px 18px 13px; border-bottom: 1px solid var(--border); }
.modal-kicker { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.modal-title { font-family: var(--display); font-size: 18px; font-weight: 700; margin-top: 2px; }
.modal-body { padding: 16px 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }
.modal-foot .btn-row { justify-content: flex-end; width: 100%; }

/* ---------- Panes ---------- */
.three-pane { display: grid; grid-template-columns: 256px 1fr 288px; height: 100%; }
.pane { min-height: 0; overflow-y: auto; }
.pane-left { border-right: 1px solid var(--border); background: var(--bg-raise); display: flex; flex-direction: column; }
.pane-left-head { padding: 12px; border-bottom: 1px solid var(--border); }
.pane-left-foot { padding: 12px; border-top: 1px solid var(--border); margin-top: auto; }
.pane-right { border-left: 1px solid var(--border); background: var(--bg-raise); padding: 14px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }

.note-list { flex: 1; overflow-y: auto; padding: 6px 0; }
.note-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%;
  text-align: left; padding: 9px 14px; border-left: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s, padding-left 0.18s var(--ease-out);
}
.note-item:hover { background: var(--wash-1); padding-left: 17px; }
.note-item.selected {
  background: linear-gradient(90deg, rgba(228, 171, 28, 0.10), transparent 70%);
  border-left-color: var(--accent-2);
}
.note-item-title { font-weight: 600; font-size: 13.5px; }
.note-item-snippet { font-size: 12px; color: var(--muted); }
.note-item-meta { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 10.5px; }
.empty-hint { padding: 24px 16px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- Reader / editor ---------- */
.reader, .editor { max-width: 720px; margin: 0 auto; padding: 22px 32px 60px; animation: fadeUp 0.35s var(--ease-out) both; }
.reader-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; margin-bottom: 18px; position: sticky; top: 0; z-index: 5;
  background: linear-gradient(180deg, var(--bg) 70%, transparent); padding: 8px 0;
}
.reader-actions { display: flex; gap: 6px; }
.reader-source { margin-top: 24px; font-size: 11.5px; color: var(--faint); word-break: break-all; }
.editor-textarea { min-height: 320px; font-family: var(--mono); font-size: 13px; line-height: 1.6; resize: vertical; margin-top: 8px; }
.editor-hint { font-size: 12px; margin-top: 8px; }

.cited-chunk {
  position: relative;
  border: 1px solid var(--accent-2);
  background: linear-gradient(180deg, rgba(228, 171, 28, 0.10), rgba(228, 171, 28, 0.03));
  box-shadow: var(--glow-amber-box);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 20px;
  transition: border-color 1.4s, background 1.4s, box-shadow 1.4s;
  animation: springIn 0.45s var(--ease-out) both;
}
.cited-chunk-fade { border-color: var(--border-2); background: var(--panel); box-shadow: none; }
.cited-chunk-head { font-size: 11px; color: var(--accent); margin-bottom: 6px; }
.cited-chunk-body { font-size: 13.5px; }
.cited-chunk-body p:last-child { margin-bottom: 0; }

.prose { color: var(--text-2); }
.prose h1 { font-family: var(--display); font-size: 27px; color: var(--text); margin: 4px 0 14px; }
.prose h2 {
  font-family: var(--display); font-size: 19px; color: var(--text); margin: 26px 0 8px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.prose h3 { font-size: 15.5px; color: var(--text); margin: 18px 0 6px; }
.prose p { line-height: 1.75; }
.prose ul, .prose ol { padding-left: 22px; line-height: 1.75; margin: 0 0 10px; }
.prose li::marker { color: var(--accent); }
.prose strong { color: var(--accent-deep); }
html[data-theme="dark"] .prose strong { color: var(--accent-2); }
.prose em { color: var(--cyan); font-style: italic; }
.prose code { font-family: var(--mono); font-size: 0.88em; background: var(--panel-2); color: var(--accent-deep); padding: 1px 5px; border-radius: 4px; }
html[data-theme="dark"] .prose code { color: var(--accent-2); }
.prose pre { background: var(--inset-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; overflow-x: auto; }
.prose pre code { background: none; color: var(--text-2); padding: 0; }
.prose blockquote {
  border-left: 3px solid var(--accent-2); margin: 14px 0; padding: 2px 0 2px 16px;
  color: var(--muted); font-style: italic;
  background: linear-gradient(90deg, rgba(228, 171, 28, 0.06), transparent 60%);
  border-radius: 0 8px 8px 0;
}
.prose a { text-decoration: underline; text-decoration-color: var(--border-2); }

/* ---------- Rail ---------- */
.rail-section { margin-bottom: 22px; }
.rail-title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; font-weight: 500; }
.rail-hint { font-size: 12px; margin-bottom: 8px; }
.rail-empty { font-size: 12.5px; }
.rail-link {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  width: 100%; text-align: left; padding: 6px 8px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--cyan);
  transition: background 0.15s, padding-left 0.18s var(--ease-out);
}
.rail-link:hover { background: var(--wash-1); padding-left: 11px; }
.rail-chunk {
  display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left;
  padding: 6px 8px; border-radius: var(--radius-sm); font-size: 11.5px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.rail-chunk:hover { background: var(--wash-1); }
.rail-chunk-active {
  border-color: var(--accent-2);
  background: rgba(228, 171, 28, 0.07);
  box-shadow: var(--glow-amber-box);
}
.rail-foot { font-size: 11.5px; border-top: 1px solid var(--border); padding-top: 10px; }

/* ---------- Graph ---------- */
.graph-wrap {
  position: relative; height: 100%; overflow: hidden;
  background:
    radial-gradient(ellipse 50% 40% at 28% 8%, var(--amb-1), transparent 60%),
    radial-gradient(ellipse 50% 45% at 78% 85%, var(--amb-2), transparent 60%);
}
#graph-svg { width: 100%; height: 100%; cursor: grab; display: block; }
#graph-svg:active { cursor: grabbing; }
.graph-overlay { position: absolute; z-index: 5; }
.graph-overlay-tl { top: 14px; left: 16px; pointer-events: none; font-size: 13px; animation: fadeUp 0.5s var(--ease-out) both; }
.graph-overlay-tr { top: 14px; right: 16px; display: flex; gap: 8px; align-items: center; animation: fadeUp 0.5s var(--ease-out) 0.08s both; }
.graph-overlay-br { bottom: 12px; right: 16px; font-size: 11px; pointer-events: none; }
.graph-link { stroke: var(--hairline); stroke-opacity: 0.55; transition: stroke 0.25s; }
.graph-link-hot { stroke: var(--accent-2); stroke-opacity: 1; filter: drop-shadow(0 0 4px rgba(228, 171, 28, 0.6)); }
.graph-node { cursor: pointer; }
.graph-label {
  fill: var(--muted); font-size: 11px; font-family: var(--sans);
  pointer-events: none; user-select: none;
  text-shadow: var(--label-halo);
}
.hover-card {
  position: absolute; z-index: 10; width: 264px; pointer-events: none;
  background: var(--glass-strong); border: 1px solid var(--border-2); border-radius: var(--radius);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 12px; box-shadow: var(--shadow); animation: scaleIn 0.18s var(--ease-out) both;
}
.hover-title { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.hover-snippet { font-size: 12px; margin-top: 6px; }
.hover-cta { font-size: 10px; color: var(--accent); margin-top: 8px; }
.graph-list {
  position: absolute; z-index: 6; top: 56px; right: 16px; bottom: 16px; width: 320px;
  overflow-y: auto; background: var(--glass-strong); border: 1px solid var(--border-2);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
  animation: scaleIn 0.22s var(--ease-out) both;
}
.graph-list-row { margin-bottom: 6px; }
.graph-list-links { font-size: 11px; padding: 0 8px 6px; }
.graph-mobile-note { display: none; }

/* ---------- Ask ---------- */
.ask-layout { display: grid; grid-template-columns: 1fr 340px; height: 100%; }
.ask-main { display: flex; flex-direction: column; min-height: 0; }
.ask-thread { flex: 1; overflow-y: auto; padding: 26px 32px; display: flex; flex-direction: column; gap: 16px; }
.ask-rail { overflow-y: auto; }

.ask-composer {
  border-top: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding: 12px 32px 14px;
}
.ask-composer-inner { display: flex; gap: 8px; align-items: flex-end; max-width: 780px; margin: 0 auto; }
.ask-input { resize: none; max-height: 140px; }
.ask-composer-hint { display: flex; justify-content: space-between; font-size: 11.5px; max-width: 780px; margin: 6px auto 0; color: var(--faint); }

.qa-card {
  position: relative;
  max-width: 780px; width: 100%; margin: 0 auto;
  border: 1px solid var(--border); border-radius: 14px;
  background: linear-gradient(180deg, var(--wash-1), transparent 90px), var(--bg-raise);
  animation: springIn 0.45s var(--ease-out) both;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.qa-card::before {
  content: ''; position: absolute; top: -1px; left: 20px; right: 20px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--hairline), transparent);
  transition: background 0.25s;
}
.qa-selected { border-color: var(--cyan); box-shadow: var(--glow-cyan); }
.qa-selected::before { background: linear-gradient(90deg, transparent, var(--cyan), transparent); }
.qa-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--wash-1); border-radius: 14px 14px 0 0; }
.qa-q { font-weight: 600; }
.evidence-btn {
  font-size: 10.5px; color: var(--faint); white-space: nowrap; padding: 3px 9px;
  border: 1px solid var(--border); border-radius: 999px;
  transition: color 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.evidence-btn:hover, .evidence-btn-on {
  color: var(--cyan); border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
}
.qa-body { padding: 14px 16px; }
.ask-answer { font-size: 14px; }
.cite-inline { color: var(--accent); font-size: 0.85em; text-shadow: var(--glow-amber-text); }
.cite-chip {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--accent);
  background: linear-gradient(180deg, rgba(228, 171, 28, 0.15), rgba(228, 171, 28, 0.06));
  border: 1px solid var(--accent-2); border-radius: 6px;
  padding: 0 5px; margin: 0 1px; vertical-align: baseline; line-height: 1.5;
  transition: background 0.18s, box-shadow 0.18s, transform 0.18s var(--ease-spring);
}
.cite-chip:hover {
  background: rgba(228, 171, 28, 0.24);
  box-shadow: var(--glow-amber-box);
  transform: translateY(-1px);
}
.source-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border-2); }
.feedback-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; }

.no-answer {
  border: 1px dashed var(--border-2); border-radius: var(--radius); padding: 14px;
  background: repeating-linear-gradient(-45deg, transparent 0 14px, var(--wash-1) 14px 28px);
}
.no-answer-title { font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.retrieval-only p:first-child { color: var(--text-2); }
.ask-error { border: 1px solid var(--bad); background: rgba(220, 60, 60, 0.05); border-radius: var(--radius); padding: 14px; }
.ask-error-title { font-weight: 600; color: var(--bad); margin-bottom: 4px; }
.suggest-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; max-width: 560px; }
.suggest-row .btn { animation: fadeUp 0.4s var(--ease-out) both; }
.suggest-row .btn:nth-child(1) { animation-delay: 0.18s; }
.suggest-row .btn:nth-child(2) { animation-delay: 0.26s; }
.suggest-row .btn:nth-child(3) { animation-delay: 0.34s; }
.suggest-row .btn:nth-child(4) { animation-delay: 0.42s; }

/* Evidence rail: a lit timeline. */
.ev-q { font-size: 12.5px; font-style: italic; }
.ask-rail .rail-section { position: relative; }
.ask-rail .rail-section:has(.ev-step)::before {
  content: ''; position: absolute; left: 9px; top: 26px; bottom: -22px; width: 1px;
  background: linear-gradient(180deg, var(--hairline-amber), var(--border));
}
.ask-rail .rail-section:has(.ev-step):last-of-type::before { display: none; }
.ev-step { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; position: relative; z-index: 1; }
.ev-step-n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 19px; height: 19px; border-radius: 50%; font-size: 10px;
  border: 1px solid var(--accent-2); color: var(--accent);
  background: var(--bg-raise);
  box-shadow: var(--glow-amber-box);
}
.ev-meta { font-size: 11.5px; margin: 4px 0 10px 27px; }
.ev-chunk {
  padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin: 0 0 6px 27px;
  background: var(--wash-1);
  transition: border-color 0.18s, background 0.18s;
  animation: fadeUp 0.35s var(--ease-out) both;
}
.ev-chunk:nth-child(odd) { animation-delay: 0.05s; }
.ev-chunk:hover { border-color: var(--border-2); background: var(--wash-2); }
.ev-chunk-top { display: flex; gap: 6px; align-items: baseline; }
.ev-chunk-link { color: var(--cyan); font-size: 12px; text-align: left; }
.ev-chunk-link:hover { text-decoration: underline; }
.ev-chunk-path { font-size: 11px; margin: 2px 0 6px 22px; }
.ev-score { display: flex; align-items: center; gap: 8px; font-size: 11px; margin-left: 22px; flex-wrap: wrap; }
.ev-relevance { display: flex; align-items: center; gap: 6px; font-size: 11px; margin: 6px 0 0 22px; }
.ev-prompt summary { cursor: pointer; font-size: 11px; color: var(--muted); padding: 6px 0 6px 27px; transition: color 0.15s; }
.ev-prompt summary:hover { color: var(--accent); }
.ev-prompt pre {
  max-height: 280px; overflow: auto; white-space: pre-wrap; font-size: 11px;
  font-family: var(--mono); background: var(--inset-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px; margin: 0 0 0 27px; color: var(--text-2);
}

/* ---------- Eval Lab ---------- */
.lab { height: 100%; overflow-y: auto; padding: 30px 36px 80px; max-width: 1180px; margin: 0 auto; }
.lab-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.lab-head h1 { font-size: 34px; }
.lab-sub { max-width: 620px; margin-top: 8px; }
.lab-controls { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.lab-control { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.lab-corpus { margin: 18px 0 6px; }
.lab-corpus-line { font-size: 11.5px; margin-bottom: 8px; }
.lab-corpus .callout { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.lab-progress { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.lab-progress-bar { flex: 1; height: 6px; background: var(--wash-2); border-radius: 99px; overflow: hidden; }
.lab-progress-fill {
  height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, #f0b228, #ffd166);
  box-shadow: 0 0 12px rgba(228, 171, 28, 0.55);
  transition: width 0.15s;
}

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0 24px; }
.metric {
  position: relative;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--wash-1), transparent 60%), var(--bg-raise);
  border-radius: var(--radius); padding: 14px;
  transition: border-color 0.2s, transform 0.25s var(--ease-spring), box-shadow 0.25s;
  animation: fadeUp 0.45s var(--ease-out) both;
}
.metric:nth-child(2) { animation-delay: 0.05s; }
.metric:nth-child(3) { animation-delay: 0.10s; }
.metric:nth-child(4) { animation-delay: 0.15s; }
.metric:nth-child(5) { animation-delay: 0.20s; }
.metric:nth-child(6) { animation-delay: 0.25s; }
.metric::before {
  content: ''; position: absolute; top: -1px; left: 14px; right: 14px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--hairline-amber), transparent);
  opacity: 0; transition: opacity 0.25s;
}
.metric:hover { transform: translateY(-2px); border-color: var(--border-2); box-shadow: var(--shadow); }
.metric:hover::before { opacity: 1; }
.metric-value {
  font-family: var(--display); font-size: 28px; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.metric-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.metric-sub { font-size: 11px; margin-top: 4px; }
.metric-note { display: flex; flex-direction: column; justify-content: center; }

.lab-columns { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.lab-cases-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.case {
  border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px;
  background: var(--bg-raise);
  transition: border-color 0.18s, background 0.18s;
}
.case:hover { background: var(--wash-1); }
.case-summary { display: grid; grid-template-columns: 44px 1fr 110px 80px; gap: 10px; align-items: center; padding: 9px 12px; cursor: pointer; font-size: 13px; list-style: none; }
.case-summary::-webkit-details-marker { display: none; }
.case-q { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case[open] .case-q { white-space: normal; }
.case-status { font-size: 11px; }
.case-pass .case-status { color: var(--good); text-shadow: var(--status-glow); }
.case-warn .case-status { color: var(--warn); }
.case-fail .case-status { color: var(--bad); text-shadow: var(--status-glow); }
.case-detail { padding: 4px 12px 12px; font-size: 12px; display: flex; flex-direction: column; gap: 6px; border-top: 1px dashed var(--border-2); animation: fadeUp 0.25s var(--ease-out) both; }
.case-retrieved { display: flex; flex-direction: column; gap: 4px; }
.case-retrieved .ev-score { margin-left: 0; }

.lab-gen-row { display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; font-size: 11px; }
.case-gen { border-top: 1px dashed var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.case-answer { font-size: 12.5px; color: var(--text-2); background: var(--wash-1); border-radius: var(--radius-sm); padding: 8px 10px; white-space: pre-wrap; }
.bb-list { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.bb-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 6px; align-items: center; }
.bb-row .bb-q { grid-column: 1; }
.bb-row .bb-toggle { grid-column: 2; grid-row: 1; }
.bb-gold { grid-column: 1 / -1; font-size: 10.5px; padding-left: 4px; }
.bb-row-off { opacity: 0.45; }

.run-row {
  display: flex; align-items: center; gap: 8px; padding: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.run-row-active { border-color: var(--accent-2); box-shadow: var(--glow-amber-box); }
.run-load { display: flex; flex-direction: column; flex: 1; text-align: left; gap: 1px; font-size: 11.5px; }
.run-load:hover { color: var(--accent); }
.compare {
  border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 10px; margin: 10px 0;
  font-size: 12px; animation: scaleIn 0.25s var(--ease-out) both;
  background: var(--wash-1);
}
.compare-head, .compare-row { display: grid; grid-template-columns: 1fr 70px 70px 56px; gap: 6px; padding: 3px 0; }
.compare-head { font-size: 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.delta-up { color: var(--good); text-shadow: var(--status-glow); }
.delta-down { color: var(--bad); }

/* ---------- About ---------- */
.about { height: 100%; overflow-y: auto; padding: 56px 36px 80px; }
.about > section, .about-foot { max-width: 880px; margin: 0 auto; }
.about-hero { animation: fadeUp 0.55s var(--ease-out) both; }
.about-hero h1 { font-size: 48px; line-height: 1.06; margin-bottom: 18px; letter-spacing: -0.025em; }
.about-lede { font-size: 17px; color: var(--text-2); max-width: 640px; line-height: 1.7; }
.about-pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 30px; }
.pillar {
  position: relative;
  border: 1px solid var(--border); border-radius: 14px;
  background: linear-gradient(180deg, var(--wash-1), transparent 70%), var(--bg-raise);
  padding: 18px; font-size: 13px; color: var(--muted);
  transition: transform 0.3s var(--ease-spring), border-color 0.25s, box-shadow 0.25s;
  animation: fadeUp 0.5s var(--ease-out) both;
}
.pillar:nth-child(2) { animation-delay: 0.08s; }
.pillar:nth-child(3) { animation-delay: 0.16s; }
.pillar::before {
  content: ''; position: absolute; top: -1px; left: 18px; right: 18px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--hairline-amber), transparent);
  opacity: 0; transition: opacity 0.25s;
}
.pillar:hover { transform: translateY(-3px); border-color: var(--border-2); box-shadow: var(--shadow); }
.pillar:hover::before { opacity: 1; }
.pillar-k { font-family: var(--mono); color: var(--accent); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 8px; }
.about-section { margin-top: 52px; }
.about-section h2 { font-size: 23px; margin-bottom: 14px; }
.about-steps { padding-left: 20px; color: var(--text-2); line-height: 1.75; }
.about-steps li { margin-bottom: 10px; }
.about-steps li::marker { color: var(--accent); font-family: var(--mono); }
.about-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0; }
.about-table th, .about-table td { text-align: left; padding: 9px 12px; border: 1px solid var(--border); }
.about-table th { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); background: var(--bg-raise); }
.about-table td { color: var(--text-2); }
.decision-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.decision {
  border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px;
  background: linear-gradient(180deg, var(--wash-1), transparent 70%), var(--bg-raise);
  transition: border-color 0.2s, transform 0.25s var(--ease-spring);
}
.decision:hover { border-color: var(--border-2); transform: translateY(-2px); }
.decision h3 { font-size: 14.5px; margin-bottom: 6px; }
.decision p { font-size: 13px; margin: 0; }
.about-roadmap { list-style: none; padding: 0; color: var(--text-2); }
.about-roadmap li { padding: 9px 0; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: baseline; }
.about-foot { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13.5px; }

/* ---------- Settings / import / palette / tour ---------- */
.set-section { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.set-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.set-key-row { display: flex; gap: 6px; align-items: stretch; }
.set-key-row .btn { flex-shrink: 0; }
.set-hint { font-size: 12px; margin-top: 6px; }
.set-privacy { padding-left: 18px; font-size: 12.5px; line-height: 1.7; margin: 0; }

.imp-pane { margin: 14px 0; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 2px dashed var(--border-2); border-radius: var(--radius);
  padding: 32px; text-align: center; cursor: pointer; font-size: 13.5px;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.dropzone:hover, .dropzone-hot {
  border-color: var(--accent-2);
  background: rgba(228, 171, 28, 0.05);
  box-shadow: inset 0 0 40px rgba(228, 171, 28, 0.04);
}
#imp-review { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.palette-input { font-size: 15px; padding: 11px 13px; }
.palette-list { margin-top: 10px; max-height: 320px; overflow-y: auto; }
.palette-item {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; width: 100%;
  text-align: left; padding: 8px 10px; border-radius: var(--radius-sm); align-items: center;
  border-left: 2px solid transparent;
  transition: background 0.12s, border-color 0.12s, padding-left 0.15s var(--ease-out);
}
.palette-item:hover, .palette-active { background: var(--wash-2); border-left-color: var(--accent-2); padding-left: 13px; }
.palette-label { font-weight: 500; font-size: 13.5px; }
.palette-sub { grid-column: 1 / -1; font-size: 11.5px; }
.palette-hint { font-size: 10px; }

.tour-dots { display: flex; gap: 6px; margin-bottom: 12px; }
.tour-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-2); transition: background 0.25s, box-shadow 0.25s; }
.tour-dot-on { background: var(--accent-2); box-shadow: var(--glow-amber-box); }
.tour-body { color: var(--text-2); font-size: 14px; line-height: 1.7; }

/* Info tips — hover/focus a small ⓘ to demystify a technical term. */
.info-dot {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid var(--border-2); color: var(--faint);
  font-family: var(--mono); font-size: 9px; font-style: normal;
  vertical-align: 1px; margin-left: 5px; cursor: help;
  transition: color 0.15s, border-color 0.15s;
}
.info-dot:hover, .info-dot:focus-visible { color: var(--accent); border-color: var(--accent-2); }
.info-dot::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px);
  width: max-content; max-width: 240px;
  background: var(--glass-strong); color: var(--text-2);
  border: 1px solid var(--border-2); border-radius: 9px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 8px 11px; font-family: var(--sans); font-size: 11.5px; line-height: 1.55;
  font-weight: 400; letter-spacing: 0; text-transform: none; white-space: normal; text-align: left;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; z-index: 60;
  transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out);
}
.info-dot-wide::after { max-width: 320px; }
.info-dot-down::after { bottom: auto; top: calc(100% + 8px); transform: translateX(-50%) translateY(-4px); }
.info-dot:hover::after, .info-dot:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }
/* keep the bubble on-screen when the ⓘ sits near the right edge */
.graph-overlay-tr .info-dot::after, .lab-controls .info-dot::after { left: auto; right: -8px; bottom: auto; top: calc(100% + 8px); transform: translateY(-4px); }
.graph-overlay-tr .info-dot:hover::after, .graph-overlay-tr .info-dot:focus-visible::after,
.lab-controls .info-dot:hover::after, .lab-controls .info-dot:focus-visible::after { transform: translateY(0); }

/* Scroll reveal (About) */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out); }
.reveal.revealed { opacity: 1; transform: translateY(0); }

/* ---------- Empty states ---------- */
.empty-state { max-width: 520px; margin: 8vh auto 0; text-align: center; padding: 0 20px; animation: fadeUp 0.5s var(--ease-out) both; }
.empty-state-art {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 32px; color: var(--accent-2); margin-bottom: 18px;
  width: 64px; height: 64px;
  text-shadow: var(--glow-amber-text);
}
.empty-state-art::before, .empty-state-art::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 64px; height: 64px; border-radius: 50%;
  border: 1px solid var(--ring-amber);
  animation: ringOut 3.2s var(--ease-out) infinite;
}
.empty-state-art::after { animation-delay: 1.6s; }
.empty-state h2 { font-size: 23px; margin-bottom: 8px; }
.empty-state p { color: var(--muted); line-height: 1.7; }

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

/* ---------- Mobile (read mode) ---------- */
@media (max-width: 920px) {
  #app { flex-direction: column; }
  #sidebar { display: none; }
  .palette-trigger span { display: none; }
  .palette-trigger { flex: 0 0 auto; max-width: none; margin: 0; }
  .three-pane { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .pane-left { max-height: 38vh; border-right: none; border-bottom: 1px solid var(--border); }
  .pane-right { display: none; }
  .ask-layout { grid-template-columns: 1fr; }
  .ask-rail { display: none; }
  .lab-columns { grid-template-columns: 1fr; }
  .about-pillars, .decision-grid { grid-template-columns: 1fr; }
  #mobile-nav {
    display: flex; justify-content: space-around; border-top: 1px solid var(--border);
    background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  }
  #mobile-nav button { color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 6px 12px; }
  #graph-svg, .graph-overlay-tr, .graph-overlay-br { display: none; }
  .graph-mobile-note {
    display: block; margin: 60px 20px; padding: 16px; text-align: center;
    border: 1px solid var(--border-2); border-radius: var(--radius); color: var(--muted); font-size: 13.5px;
  }
  .reader, .editor { padding: 18px 16px 50px; }
  .ask-thread, .ask-composer { padding-left: 14px; padding-right: 14px; }
  .lab { padding: 20px 16px 60px; }
  .about { padding: 28px 18px 60px; }
  .about-hero h1 { font-size: 32px; }
  .case-summary { grid-template-columns: 1fr 90px; }
  .case-summary > .mono.dim:first-child, .case-summary > .mono.dim:last-child { display: none; }
}
