:root {
  --ink: #0a0b0e;
  --ink-2: #101218;
  --panel: #13151c;
  --line: #23262f;
  --amber: #ffb000;
  --amber-soft: #ffce6b;
  --teal: #4fd1c5;
  --rose: #ff7a59;
  --text: #e9e4d6;
  --muted: #797d88;
  --glow: 0 0 18px rgba(255, 176, 0, .55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "IBM Plex Mono", monospace;
  background: radial-gradient(1200px 700px at 70% -10%, #16181f 0%, var(--ink) 60%);
  color: var(--text);
  overflow: hidden;
  position: relative;
}

/* grain + vignette atmosphere */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  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='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 49; pointer-events: none;
  box-shadow: inset 0 0 240px 40px rgba(0,0,0,.75);
}

.app { display: grid; grid-template-rows: auto 1fr; height: 100%; }

header {
  display: flex; align-items: baseline; gap: 24px;
  padding: 18px 26px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,176,0,.04), transparent);
}
.brand {
  font-family: "Syne", sans-serif; font-weight: 800; letter-spacing: 1px;
  font-size: 22px; color: var(--text);
}
.brand b { color: var(--amber); text-shadow: var(--glow); }
.tag { color: var(--muted); font-size: 12px; letter-spacing: .5px; }

.tabs { margin-left: auto; display: flex; gap: 6px; }
.tab {
  font-family: "IBM Plex Mono", monospace; font-size: 12px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--muted);
  background: transparent; border: 1px solid var(--line); border-radius: 2px;
  padding: 9px 16px; cursor: pointer; transition: all .18s ease;
}
.tab:hover { color: var(--text); border-color: #3a3e49; }
.tab.active {
  color: var(--ink); background: var(--amber); border-color: var(--amber);
  box-shadow: var(--glow); font-weight: 600;
}

.stage { display: grid; grid-template-columns: 340px 1fr; min-height: 0; }

aside {
  border-right: 1px solid var(--line); background: var(--ink-2);
  padding: 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px;
}
.eyebrow {
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--amber);
}
.lede { font-family: "Syne", sans-serif; font-weight: 700; font-size: 19px; line-height: 1.25; }
.copy { color: var(--muted); font-size: 13px; line-height: 1.6; }

button.act {
  font-family: "IBM Plex Mono", monospace; font-size: 13px; letter-spacing: .5px;
  color: var(--ink); background: var(--amber); border: 0; border-radius: 2px;
  padding: 12px 16px; cursor: pointer; font-weight: 600; transition: transform .1s, box-shadow .2s;
}
button.act:hover { box-shadow: var(--glow); }
button.act:active { transform: translateY(1px); }
button.act:disabled { opacity: .4; cursor: default; box-shadow: none; }

.qbtn {
  text-align: left; width: 100%; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-left: 2px solid var(--teal); border-radius: 2px;
  padding: 12px 14px; font-family: inherit; font-size: 13px; line-height: 1.45;
  cursor: pointer; transition: all .16s ease;
}
.qbtn:hover { border-left-color: var(--amber); background: #181b22; }

.panel-note { font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 14px; }

.facts { display: flex; flex-direction: column; gap: 7px; }
.fact {
  font-size: 12.5px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 2px; padding: 9px 11px; opacity: 0; transform: translateY(6px);
  animation: rise .35s ease forwards;
}
.fact .s { color: var(--amber-soft); }
.fact .p { color: var(--muted); padding: 0 6px; font-size: 11px; }
.fact .o { color: var(--teal); }
@keyframes rise { to { opacity: 1; transform: none; } }

.readout { font-size: 12px; color: var(--muted); line-height: 1.6; min-height: 18px; }
.readout b { color: var(--amber); }

.legend { display: flex; flex-direction: column; gap: 8px;
  border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line);
  padding: 13px 0; font-size: 12.5px; color: var(--text); }
.legend span { display: flex; align-items: center; gap: 9px; }
.legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block;
  box-shadow: 0 0 8px currentColor; }

.reading { min-height: 64px; background: var(--panel); border: 1px solid var(--line);
  border-left: 2px solid var(--amber); border-radius: 2px; padding: 11px 12px; }
.reading:empty { display: none; }
.reading .src { color: var(--amber); font-size: 11px; letter-spacing: .5px; margin-bottom: 6px; }
.reading .txt { color: var(--text); font-size: 12.5px; line-height: 1.55; }

#cy { width: 100%; height: 100%; background:
  radial-gradient(900px 600px at 50% 40%, #0e1015 0%, var(--ink) 70%); }

.hint {
  position: absolute; bottom: 16px; right: 20px; z-index: 20;
  font-size: 11px; color: var(--muted); letter-spacing: .5px;
  background: rgba(10,11,14,.7); border: 1px solid var(--line);
  padding: 7px 11px; border-radius: 2px;
}
.stage > div { position: relative; min-width: 0; }

#mode-bar { margin: 8px 0; font-size: 14px; }
#mode-bar label { margin-right: 12px; }
#live-note { color: #999; font-size: 12px; }
.facts .graph-only { font-weight: 600; }
.fact.graph-only { border-left: 2px solid var(--teal); }
.fact .badge { margin-left: 8px; vertical-align: middle; }
.badge { background: #2a7; color: #fff; border-radius: 4px; padding: 0 6px; font-size: 11px; }

/* live-pipeline panel: section headers + vector-hit rows */
.section-label { font-size: 11px; letter-spacing: .5px; text-transform: uppercase;
  color: var(--muted); margin: 16px 0 8px; }
.hits { display: flex; flex-direction: column; gap: 6px; }
.hit { display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: 12.5px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 2px; padding: 8px 11px; }
.hit .src { color: var(--text); }
.hit .score { color: var(--amber-soft); font-size: 11px; }
