/* Layout: interrogation card with a 15-cell track above; voice orb + live captions inside; reasoning rail beside. */
:root {
  --bg: #eef1f6; --surface: #ffffff; --sunk: #e3e8f0; --ink: #14213d; --muted: #5b6680; --line: #d3d9e5;
  --accent: #3a4fe0; --accent-ink: #ffffff; --yes: #1d8558; --no: #c2412d; --guess: #c98a12; --guess-soft: #fbefd5;
  --yes-soft: #dcf1e6; --no-soft: #f8e1dc; --lang: #ebeefc;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #0f1420; --surface: #171e2e; --sunk: #1e2638; --ink: #e7ecf5; --muted: #95a1b9; --line: #2b3549;
  --accent: #8090ff; --accent-ink: #0f1420; --yes: #42c18a; --no: #f07261; --guess: #f2c055; --guess-soft: #3a3020;
  --yes-soft: #17352a; --no-soft: #3d1f1b; --lang: #232c48; color-scheme: dark } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5; padding-top: env(safe-area-inset-top, 0px); }
.wrap { max-width: 1080px; margin: 0 auto; padding-inline: 20px; padding-block: 24px 48px; display: flex; flex-direction: column; gap: 18px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: -0.02em; }
.brand span { color: var(--accent); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stat { font-family: var(--mono); font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; }
.pill i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.pill.listening i { background: var(--yes); box-shadow: 0 0 0 4px color-mix(in srgb, var(--yes) 25%, transparent); }
.pill.speaking i { background: var(--guess); }
.pill.error i { background: var(--no); }

.track { max-width: 760px; display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 6px; }
.cell { aspect-ratio: 1; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface); display: grid; place-items: center; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.cell.now { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.cell.y { background: var(--yes); border-color: var(--yes); color: var(--surface); }
.cell.n { background: var(--no); border-color: var(--no); color: var(--surface); }
.cell.u { background: var(--sunk); border-color: var(--muted); color: var(--muted); border-style: dashed; }
.cell.gx { background: var(--guess-soft); border-color: var(--guess); color: var(--guess); }
.cell.gy { background: var(--guess); border-color: var(--guess); color: var(--surface); }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: clamp(22px, 4vw, 40px); min-width: 0; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.eyebrow.g { color: var(--guess); }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.12; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(28px, 4.4vw, 42px); }
.q { font-size: clamp(26px, 4vw, 38px); min-height: 2.3em; }
p { margin: 0; max-width: 62ch; }
.lede { color: var(--muted); font-size: 17px; }
.note { font-size: 13.5px; color: var(--muted); }
.err { color: var(--no); }
label { font-weight: 700; font-size: 14px; }
input[type=text] { flex: 1; min-width: 0; font: inherit; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); }
button { font: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.big { border: 0; border-radius: 14px; padding: 18px 22px; font-family: var(--display); font-weight: 700; font-size: 22px; }
.b-go { background: var(--accent); color: var(--accent-ink); }
.ghost { background: var(--sunk); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; font-weight: 700; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding: 2px 0; font-size: 14px; }

/* voice area */
.voice { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 22px; align-items: center; }
@media (max-width: 520px) { .voice { grid-template-columns: 1fr; justify-items: center; } }
.orb { position: relative; width: 120px; height: 120px; display: grid; place-items: center; }
.orb .core { width: 64px; height: 64px; border-radius: 50%; background: var(--muted); transition: background .2s; }
.orb .ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--muted); opacity: .35; transform: scale(.6); transition: transform .08s linear, border-color .2s; }
.orb.listening .core { background: var(--yes); } .orb.listening .ring { border-color: var(--yes); }
.orb.speaking .core { background: var(--guess); } .orb.speaking .ring { border-color: var(--guess); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.95); opacity: .6; } }
.captions { display: flex; flex-direction: column; gap: 10px; min-width: 0; width: 100%; }
.cap { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.cap .who { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cap p { font-size: 17px; overflow-wrap: anywhere; }
.cap.you p { font-weight: 700; }
.dim { color: var(--muted); font-weight: 400 !important; }
.understood { background: var(--sunk); border-radius: 12px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }
.chip { font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 99px; font-weight: 500; white-space: nowrap; }
.chip.y { background: var(--yes-soft); color: var(--yes); }
.chip.n { background: var(--no-soft); color: var(--no); }
.chip.l { background: var(--lang); color: var(--accent); }
.chip.u { background: var(--guess-soft); color: var(--guess); }
.chip.d { background: var(--sunk); color: var(--muted); border: 1px dashed var(--muted); }
.backup { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding-top: 14px; }
.mini { background: var(--sunk); border: 1px solid var(--line); color: var(--ink); border-radius: 10px; padding: 7px 12px; font-size: 14px; }
.mini.y { color: var(--yes); } .mini.n { color: var(--no); } .mini.u { color: var(--muted); }
.mini[aria-pressed=true] { background: var(--no-soft); color: var(--no); }

.rail { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel h3 { margin: 0; font-family: var(--mono); font-weight: 500; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.bits { display: flex; align-items: baseline; gap: 8px; }
.bits strong { font-family: var(--display); font-size: 40px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.bits span, .small { color: var(--muted); font-size: 14px; }
.meter { height: 8px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.meter > div { height: 100%; background: var(--accent); transition: width .4s ease; }
.sus, .hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sus li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 14px; }
.sus .pc { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.sus .bar { grid-column: 1 / -1; height: 4px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.sus .bar > div { height: 100%; background: var(--guess); }
.hide-sus .sus { filter: blur(6px); user-select: none; }
.hist { max-height: 420px; overflow-y: auto; }
.hist li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; font-size: 13.5px; }
.hist .no { font-family: var(--mono); font-size: 11.5px; color: var(--muted); padding-top: 2px; }
.hist .body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hist .said { color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.hist .tags { display: flex; flex-wrap: wrap; gap: 4px; }
.empty { color: var(--muted); font-size: 13.5px; }
@media (max-width: 480px) { .track { gap: 3px; } .cell { border-radius: 5px; font-size: 10px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.demotabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.demotabs a { font-size: 13px; font-weight: 700; color: var(--muted); text-decoration: none; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line); }
.demotabs a[aria-current="page"] { background: var(--accent); color: var(--accent-ink, #fff); border-color: var(--accent); }

.arena { display: inline-flex; align-items: baseline; gap: 8px; font-family: var(--display, inherit); font-weight: 800; font-size: 14px; color: var(--ink); margin-right: 6px; padding: 5px 2px; }
.arena em { font-style: normal; font-weight: 500; font-size: 12.5px; color: var(--muted); }
