/* ═══════════════════════════════════════════════════════════════════
   stage.css — the review stage (prototype only).
   Layout: a quiet observatory — rails of instruments either side,
   the phone as the only lit object in the room.
   Dark-first; light mirrors it for viewers on a light theme.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --st-bg: #05060a;
  --st-bg-2: #0a0c14;
  --st-surface: rgb(255 255 255 / 0.028);
  --st-surface-hi: rgb(255 255 255 / 0.06);
  --st-line: rgb(255 255 255 / 0.075);
  --st-ink: rgb(236 241 250 / 0.92);
  --st-ink-2: rgb(236 241 250 / 0.58);
  --st-ink-3: rgb(236 241 250 / 0.34);
  --st-accent: rgb(107 219 255);
  --st-accent-rgb: 107 219 255;
  --st-glow: rgb(107 219 255 / 0.10);
  --st-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --st-mono: "SF Mono", SFMono-Regular, ui-monospace, "Geist Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --st-bg: #e6ebf2;
    --st-bg-2: #dfe5ee;
    --st-surface: rgb(255 255 255 / 0.55);
    --st-surface-hi: rgb(255 255 255 / 0.85);
    --st-line: rgb(26 31 46 / 0.10);
    --st-ink: rgb(22 27 40 / 0.92);
    --st-ink-2: rgb(22 27 40 / 0.62);
    --st-ink-3: rgb(22 27 40 / 0.40);
    --st-accent: rgb(0 117 168);
    --st-accent-rgb: 0 117 168;
    --st-glow: rgb(0 117 168 / 0.10);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --st-bg: #e6ebf2;
  --st-bg-2: #dfe5ee;
  --st-surface: rgb(255 255 255 / 0.55);
  --st-surface-hi: rgb(255 255 255 / 0.85);
  --st-line: rgb(26 31 46 / 0.10);
  --st-ink: rgb(22 27 40 / 0.92);
  --st-ink-2: rgb(22 27 40 / 0.62);
  --st-ink-3: rgb(22 27 40 / 0.40);
  --st-accent: rgb(0 117 168);
  --st-accent-rgb: 0 117 168;
  --st-glow: rgb(0 117 168 / 0.10);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--st-bg);
  color: var(--st-ink);
  font: 13px/1.45 var(--st-font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
#root { height: 100%; }

.stage {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: 0 1fr 0;
  transition: grid-template-columns 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.stage.left-open { grid-template-columns: 276px 1fr 0; }
.stage.right-open { grid-template-columns: 0 1fr 288px; }
.stage.left-open.right-open { grid-template-columns: 276px 1fr 288px; }
.stage.presenting { grid-template-columns: 0 1fr 0 !important; }

.stage-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 55% at 50% 48%, var(--st-glow), transparent 70%),
    radial-gradient(circle at 1px 1px, var(--st-line) 1px, transparent 1.2px) 0 0 / 22px 22px;
  mask-image: radial-gradient(80% 80% at 50% 50%, #000 40%, transparent 100%);
}

/* ── Rails ── */
.stage-rail {
  position: relative;
  z-index: 2;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--st-bg-2), var(--st-bg));
  border-color: var(--st-line);
  border-style: solid;
  border-width: 0;
}
.stage-rail.left { border-right-width: 1px; }
.stage-rail.right { border-left-width: 1px; }
.stage-rail.left { grid-column: 1; grid-row: 1; }
.stage-center { grid-column: 2; grid-row: 1; }
.stage-rail.right { grid-column: 3; grid-row: 1; }
.stage-rail > * { width: 276px; }
.stage-rail.right > * { width: 288px; }
.stage.presenting .stage-rail { visibility: hidden; }

.stage-brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 14px; flex: none; }
.stage-brand-icon { width: 40px; height: 40px; border-radius: 10px; box-shadow: 0 0 0 0.5px rgb(255 255 255 / 0.12), 0 6px 18px rgb(0 0 0 / 0.35); }
.stage-brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.2px; }
.stage-brand-meta { font: 500 10px/1.3 var(--st-mono); letter-spacing: 1.2px; text-transform: uppercase; color: var(--st-ink-3); margin-top: 2px; }

.stage-eyebrow {
  margin: 0 0 8px;
  font: 600 9.5px/1.2 var(--st-mono);
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--st-ink-3);
}

.scenario-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 12px 16px; scrollbar-width: thin; scrollbar-color: var(--st-line) transparent; }
.scenario-group { padding: 12px 6px 4px; }
.scenario-search {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 6px 4px;
  padding: 0 10px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--st-line);
  background: var(--st-bg-2);
  color: var(--st-ink-3);
}
.scenario-search:focus-within { border-color: rgb(var(--st-accent-rgb) / 0.5); color: var(--st-ink-2); }
.scenario-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--st-ink); font: 500 12.5px var(--st-font); }
.scenario-search input::placeholder { color: var(--st-ink-3); }
.scenario-search input::-webkit-search-cancel-button { display: none; }
.scenario-search kbd { font: 600 10px var(--st-mono); color: var(--st-ink-3); border: 1px solid var(--st-line); border-radius: 5px; padding: 1px 5px; }
.scenario-empty { margin: 16px 10px; font-size: 12.5px; color: var(--st-ink-3); }
.scenario {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  text-align: left;
  padding: 7px 10px 7px 14px;
  margin: 1px 0;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--st-ink-2);
  font: inherit;
  cursor: pointer;
  position: relative;
}
.scenario::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  width: 4px;
  height: 4px;
  margin-top: -2px;
  border-radius: 50%;
  background: var(--st-ink-3);
  opacity: 0;
  transition: opacity 0.2s, background 0.2s, box-shadow 0.2s;
}
.scenario:hover { background: var(--st-surface); color: var(--st-ink); }
.scenario:hover::before { opacity: 1; }
.scenario.active { background: var(--st-surface-hi); color: var(--st-ink); }
.scenario.active::before { opacity: 1; background: var(--st-accent); box-shadow: 0 0 8px rgb(var(--st-accent-rgb) / 0.8); }
.scenario-title { font-size: 13px; font-weight: 500; }
.scenario-caption { font-size: 11.5px; color: var(--st-ink-3); line-height: 1.35; }
.scenario:focus-visible, .stage-chip:focus-visible, .stage-seg button:focus-visible, .aurora-chip:focus-visible { outline: 2px solid var(--st-accent); outline-offset: 1px; }

.stage-footer { flex: none; padding: 12px 18px 16px; border-top: 1px solid var(--st-line); color: var(--st-ink-3); font-size: 11px; line-height: 1.6; }
.stage-footer code { font: 500 10.5px var(--st-mono); color: var(--st-ink-2); }

/* ── Center ── */
.stage-center { position: relative; z-index: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; overflow: clip; }
.stage-topbar {
  width: 100%;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 0;
  height: 48px;
}
.stage.presenting .stage-topbar { opacity: 0; pointer-events: none; height: 20px; }
.stage-topbar-right { display: flex; gap: 8px; }
.stage-title-cluster { display: flex; gap: 7px; align-items: center; font: 500 10.5px var(--st-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--st-ink-3); white-space: nowrap; overflow: hidden; }
.stage-device-name { color: var(--st-ink-2); }
.stage-sep { opacity: 0.5; }
.stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--st-line);
  background: var(--st-surface);
  color: var(--st-ink-2);
  font: 500 12px var(--st-font);
  cursor: pointer;
  white-space: nowrap;
}
.stage-chip:hover { color: var(--st-ink); background: var(--st-surface-hi); }
.stage-chip[aria-pressed="true"] { color: var(--st-ink); }

.device-slot { position: relative; flex: 1; min-height: 0; width: 100%; overflow: clip; }
.device-scaler { position: absolute; left: 50%; top: 50%; transform-origin: 50% 50%; transition: transform var(--dur-glide, 0.6s) var(--ease-glide, ease); }
.device-scaler.compare { display: flex; gap: 64px; align-items: flex-start; }
.compare-device { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.compare-device figcaption { font: 600 11px var(--st-mono); letter-spacing: 1.4px; text-transform: uppercase; color: var(--st-ink-3); }

/* ── Controls ── */
.stage-controls { padding: 20px 18px 24px; overflow-y: auto; height: 100%; display: flex; flex-direction: column; gap: 22px; scrollbar-width: thin; scrollbar-color: var(--st-line) transparent; }
.stage-seg { display: flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--st-surface); border: 1px solid var(--st-line); }
.stage-seg button {
  flex: 1;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--st-ink-2);
  font: 500 12px var(--st-font);
  cursor: pointer;
}
.stage-seg button.on { background: var(--st-surface-hi); color: var(--st-ink); box-shadow: 0 1px 3px rgb(0 0 0 / 0.25), inset 0 0 0 0.5px var(--st-line); }
.stage-row { margin-top: 8px; }
.stage-select-wrap { position: relative; color: var(--st-ink-3); }
.stage-select-wrap .sf { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.stage-select {
  width: 100%;
  appearance: none;
  height: 34px;
  padding: 0 30px 0 11px;
  border-radius: 10px;
  border: 1px solid var(--st-line);
  background: var(--st-surface);
  color: var(--st-ink);
  font: 500 12.5px var(--st-font);
}
.stage-toggle { display: flex; align-items: center; gap: 10px; margin-top: 10px; cursor: pointer; position: relative; }
.stage-toggle-text { flex: 1; display: flex; flex-direction: column; font-size: 12.5px; color: var(--st-ink-2); }
.stage-toggle-text small { font: 500 10px var(--st-mono); color: var(--st-ink-3); }
.stage-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.stage-switch { width: 34px; height: 20px; border-radius: 999px; background: var(--st-surface-hi); border: 1px solid var(--st-line); position: relative; transition: background 0.2s; flex: none; }
.stage-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--st-ink-2); transition: transform 0.25s cubic-bezier(0.3, 1.4, 0.5, 1), background 0.2s; }
.stage-toggle input:checked + .stage-switch { background: rgb(var(--st-accent-rgb) / 0.3); border-color: rgb(var(--st-accent-rgb) / 0.5); }
.stage-toggle input:checked + .stage-switch::after { transform: translateX(14px); background: var(--st-accent); }
.stage-toggle input:focus-visible + .stage-switch { outline: 2px solid var(--st-accent); outline-offset: 2px; }

.aurora-states { display: flex; flex-wrap: wrap; gap: 6px; }
.aurora-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  border: 1px solid var(--st-line);
  background: var(--st-surface);
  color: var(--st-ink-2);
  font: 500 11px var(--st-mono);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
}
.aurora-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--st-ink-3)); box-shadow: 0 0 6px var(--c, transparent); }
.aurora-chip[data-state="idle"] { --c: rgb(20 56 117); }
.aurora-chip[data-state="listening"] { --c: rgb(13 107 158); }
.aurora-chip[data-state="thinking"] { --c: rgb(82 36 153); }
.aurora-chip[data-state="streaming"] { --c: rgb(8 140 107); }
.aurora-chip[data-state="error"] { --c: rgb(179 41 31); }
.aurora-chip[data-state="auto"] { --c: var(--st-accent); }
.aurora-chip.on { color: var(--st-ink); background: var(--st-surface-hi); border-color: rgb(var(--st-accent-rgb) / 0.45); }

.stage-slider { display: grid; grid-template-columns: auto 1fr 38px; align-items: center; gap: 10px; margin-top: 12px; font-size: 12.5px; color: var(--st-ink-2); }
.stage-slider input { width: 100%; accent-color: var(--st-accent); }
.stage-slider output { font: 500 11px var(--st-mono); color: var(--st-ink-3); text-align: right; }

.stage-keys { display: grid; grid-template-columns: 44px 1fr; gap: 6px 10px; margin: 0; font-size: 12px; }
.stage-keys dt { font: 600 10.5px var(--st-mono); color: var(--st-ink-2); background: var(--st-surface); border: 1px solid var(--st-line); border-radius: 6px; text-align: center; padding: 2px 0; height: fit-content; }
.stage-keys dd { margin: 0; color: var(--st-ink-3); }

/* ── Guided tour ── */
.tour-card {
  position: absolute;
  left: 24px;
  bottom: 24px;
  z-index: 5;
  width: min(320px, calc(100% - 48px));
  padding: 16px 16px 14px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--st-bg-2) 82%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--st-line);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.45);
  animation: tour-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes tour-in { from { opacity: 0; transform: translateY(12px); } }
.tour-meta { display: flex; align-items: center; }
.tour-count { font: 600 10px var(--st-mono); letter-spacing: 1.4px; color: var(--st-accent); }
.tour-x { width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--st-surface); color: var(--st-ink-2); display: grid; place-items: center; cursor: pointer; }
.tour-title { margin: 8px 0 6px; font: 600 17px/1.25 var(--st-font); letter-spacing: -0.2px; color: var(--st-ink); text-wrap: balance; }
.tour-body { margin: 0; font-size: 13px; line-height: 1.5; color: var(--st-ink-2); }
.tour-progress { margin-top: 14px; height: 2px; border-radius: 2px; background: var(--st-line); overflow: hidden; }
.tour-progress span { display: block; height: 100%; background: var(--st-accent); box-shadow: 0 0 8px rgb(var(--st-accent-rgb) / 0.6); transition: width 0.1s linear; }
.tour-controls { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.tour-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--st-line); background: var(--st-surface); color: var(--st-ink); display: grid; place-items: center; cursor: pointer; }
.tour-btn:disabled { opacity: 0.35; cursor: default; }
.tour-btn.primary { background: var(--st-accent); color: #04121a; border-color: transparent; }
.tour-dots { display: flex; gap: 5px; margin-left: auto; }
.tour-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--st-line); cursor: pointer; transition: width 0.3s, background 0.3s; }
.tour-dots i.done { background: rgb(var(--st-accent-rgb) / 0.45); }
.tour-dots i.on { width: 16px; background: var(--st-accent); }
.stage-chip.accent { color: var(--st-accent); border-color: rgb(var(--st-accent-rgb) / 0.35); }

.quirks-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 0; border: 0; background: none; color: var(--st-ink-3); cursor: pointer; }
.quirks-count { font: 600 10px var(--st-mono); color: var(--st-ink-2); background: var(--st-surface-hi); border: 1px solid var(--st-line); border-radius: 999px; padding: 1px 7px; }
.quirks-intro { margin: 8px 0 0; font-size: 11.5px; color: var(--st-ink-3); line-height: 1.45; }
.quirks-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.quirks-list li { padding: 10px 11px; border-radius: 10px; background: var(--st-surface); border: 1px solid var(--st-line); }
.quirk-title { font-size: 12.5px; font-weight: 600; color: var(--st-ink); display: flex; gap: 7px; align-items: baseline; flex-wrap: wrap; }
.quirk-area { font: 600 9px var(--st-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--st-accent); }
.quirk-detail { margin-top: 4px; font-size: 11.5px; line-height: 1.45; color: var(--st-ink-2); }
.quirk-swift { display: inline-block; margin-top: 6px; font: 500 10px var(--st-mono); color: var(--st-ink-3); }

@media (max-width: 1100px) {
  .stage.left-open, .stage.right-open, .stage.left-open.right-open { grid-template-columns: 0 1fr 0; }
  .stage-rail { position: absolute; top: 56px; bottom: 12px; border-radius: 16px; border-width: 1px !important; box-shadow: 0 20px 50px rgb(0 0 0 / 0.45); transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.25s; }
  .stage-rail.left { left: 12px; transform: translateX(calc(-100% - 20px)); opacity: 0; }
  .stage-rail.right { right: 12px; transform: translateX(calc(100% + 20px)); opacity: 0; }
  .stage.left-open .stage-rail.left, .stage.right-open .stage-rail.right { transform: none; opacity: 1; }
}
@media (max-width: 760px) {
  .stage-title-cluster { display: none; } /* the chips need the room; the device name lives in Controls */
  .stage-topbar { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .stage, .stage-rail { transition: none; }
}
