/* ============================================================
   WHO IS CLAUDE : arc-HUD skin.
   Near-black ground, teal signal, amber caution, red inhibit,
   violet for the model itself. Hairlines, layered glow, mono numerics.
   ============================================================ */

:root {
  color-scheme: dark;
  --bg: #05080b;
  --bg-2: #0a0f14;
  --bg-3: #0f161d;
  --ink: #d7e2e6;
  --ink-2: #8fa3ab;
  --ink-3: #5b6c74;
  --line: rgba(94, 234, 212, 0.14);
  --line-2: rgba(215, 226, 230, 0.08);
  --teal: #5eead4;
  --teal-2: rgba(94, 234, 212, 0.55);
  --teal-3: rgba(94, 234, 212, 0.12);
  --amber: #f5a524;
  --gold: #f5c451;
  --red: #e5484d;
  --violet: #a78bfa;
  --blue: #60a5fa;
  --grey: #8fa3ab;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", "Fira Code", Consolas, "SF Mono", Menlo, monospace;
  --panel: rgba(8, 13, 18, 0.9);
  --panel-edge: rgba(94, 234, 212, 0.18);
  --glow: 0 0 0 1px rgba(94, 234, 212, 0.10), 0 0 18px rgba(94, 234, 212, 0.10), 0 0 48px rgba(94, 234, 212, 0.05);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.35, 0.44, 1);
  --top-h: 56px;
  --rail-w: 312px;
  --detail-w: 420px;
  --r: 10px;
  --gutter: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
b, strong { font-weight: 600; color: #eef6f8; }
a { color: var(--teal); text-decoration: none; border-bottom: 1px solid rgba(94,234,212,0.3); }
a:hover { border-bottom-color: var(--teal); }
kbd {
  font-family: var(--mono); font-size: 11px; color: var(--ink-2);
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px;
  padding: 1px 5px; background: rgba(255,255,255,0.02);
}
::selection { background: rgba(94,234,212,0.28); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
body.preload *, body.preload *::before, body.preload *::after { transition: none !important; }

* { scrollbar-width: thin; scrollbar-color: rgba(94,234,212,0.25) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(94,234,212,0.18); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }

/* ------------------------------------------------------------ STAGE */
.stage { position: fixed; inset: 0; background:
  radial-gradient(1200px 800px at 60% 45%, rgba(94,234,212,0.045), transparent 60%),
  radial-gradient(900px 700px at 20% 80%, rgba(167,139,250,0.035), transparent 60%),
  var(--bg); }
#graph { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#graph.grabbing { cursor: grabbing; }
#graph.pointing { cursor: pointer; }

.hud-bl {
  position: fixed; left: calc(var(--gutter) + 4px); bottom: 10px; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  font: 11px/1 var(--mono); color: var(--ink-3); letter-spacing: 0.08em; text-transform: uppercase;
  pointer-events: none; transition: left .35s var(--ease-out);
}
body.rail-open .hud-bl { left: calc(var(--rail-w) + 28px); }
.hud-zoom { color: var(--teal-2); }
.hud-sep { width: 1px; height: 10px; background: var(--line); }

.hud-tl {
  position: fixed; top: calc(var(--top-h) + 12px); right: var(--gutter); z-index: 6;
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 560px;
  pointer-events: none;
}
.truth-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 999px; background: var(--panel);
  border: 1px solid var(--line-2); font: 11px/1.2 var(--mono); color: var(--ink-2);
  backdrop-filter: blur(8px);
}
.truth-pill i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; box-shadow: 0 0 8px currentColor; }
.truth-pill b { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------ TOP BAR */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); z-index: 20;
  display: flex; align-items: center; gap: 14px; padding: 0 var(--gutter);
  background: linear-gradient(180deg, rgba(5,8,11,0.96), rgba(5,8,11,0.82));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(94,234,212,0.5), rgba(167,139,250,0.4), transparent);
  opacity: .5;
}
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand h1 { margin: 0; font: 600 15px/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; }
.brand-sub { font: 11px/1 var(--mono); color: var(--ink-3); letter-spacing: 0.04em; }
.brand-ring {
  width: 22px; height: 22px; border-radius: 50%; position: relative;
  border: 1.5px solid var(--teal); box-shadow: 0 0 12px rgba(94,234,212,0.45), inset 0 0 6px rgba(94,234,212,0.3);
}
.brand-ring::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 8px var(--teal); animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; transform: scale(.8); } }

.seg {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  border: 1px solid var(--line-2); border-radius: 999px; background: rgba(255,255,255,0.015);
}
.seg-label { font: 10px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); padding: 0 8px 0 10px; }
.seg-btn {
  padding: 6px 12px; border-radius: 999px; font-size: 13px; color: var(--ink-2); white-space: nowrap;
  transition: background .2s, color .2s, box-shadow .2s;
}
.seg-btn:hover { color: var(--ink); background: rgba(255,255,255,0.04); }
.seg-btn.on { color: #04110f; background: var(--teal); box-shadow: 0 0 14px rgba(94,234,212,0.45); font-weight: 600; }
.seg-btn .num { font: 10px/1 var(--mono); opacity: .55; margin-right: 6px; }
.seg-btn.on .num { opacity: .7; }
.modes { margin-left: 8px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.modes::-webkit-scrollbar { display: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.truth .seg-btn.on[data-truth="on"] { background: linear-gradient(90deg, #5eead4, #60a5fa, #a78bfa, #f5a524); }

.ico {
  width: 34px; height: 34px; border-radius: 9px; display: inline-grid; place-items: center;
  color: var(--ink-2); border: 1px solid transparent; transition: color .2s, background .2s, border-color .2s;
}
.ico:hover { color: var(--ink); background: rgba(255,255,255,0.04); border-color: var(--line-2); }
.ico.on { color: var(--teal); border-color: var(--line); background: var(--teal-3); }
.ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 28px; height: 28px; }
.ico.sm svg { width: 15px; height: 15px; }
.burger { margin-left: -6px; }

/* ------------------------------------------------------------ RAIL (scene list) */
.rail {
  position: fixed; z-index: 15; top: calc(var(--top-h) + 14px); left: var(--gutter); bottom: 14px;
  width: var(--rail-w); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 14px;
  box-shadow: var(--glow); backdrop-filter: blur(12px);
  transform: translateX(calc(-100% - 40px)); opacity: 0; pointer-events: none;
  transition: transform .45s var(--ease-out), opacity .3s;
}
body.rail-open .rail { transform: none; opacity: 1; pointer-events: auto; }
.rail-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 10px 16px; border-bottom: 1px solid var(--line-2); }
.rail-title { font: 10px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); }
.rail-count { font: 11px/1 var(--mono); color: var(--teal-2); }
.rail-close { margin-left: auto; }
.rail-body { overflow-y: auto; padding: 8px 8px 14px; flex: 1; }

.acc { border-radius: 10px; margin-bottom: 4px; }
.acc-head {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 10px 10px; border-radius: 10px; color: var(--ink);
}
.acc-head:hover { background: rgba(255,255,255,0.03); }
.acc-num { font: 11px/1 var(--mono); color: var(--teal-2); width: 16px; }
.acc-name { font-weight: 600; font-size: 13.5px; }
.acc-meta { margin-left: auto; font: 11px/1 var(--mono); color: var(--ink-3); }
.acc-chev { width: 14px; height: 14px; stroke: var(--ink-3); fill: none; stroke-width: 1.8; transition: transform .25s; }
.acc.open .acc-chev { transform: rotate(90deg); }
.acc-body { display: none; padding: 2px 0 8px 0; }
.acc.open .acc-body { display: block; }
.acc-blurb { font-size: 12.5px; color: var(--ink-2); padding: 0 12px 8px 36px; }

.scene-card {
  width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
  padding: 9px 12px 9px 36px; border-radius: 9px; position: relative; color: var(--ink-2);
  border: 1px solid transparent; transition: background .2s, border-color .2s, color .2s;
}
.scene-card:hover { background: rgba(255,255,255,0.03); color: var(--ink); }
.scene-card.on { background: var(--teal-3); border-color: var(--line); color: var(--ink); }
.scene-card.on::before { content: ""; position: absolute; left: 16px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 10px var(--teal); }
.scene-card .sc-title { font-size: 13px; font-weight: 600; color: inherit; }
.scene-card .sc-steps { font: 11px/1.6 var(--mono); color: var(--ink-3); }
.scene-card .sc-sub { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); line-height: 1.4; }
.scene-card.on .sc-sub { color: var(--ink-2); }
.scene-card .sc-tag { grid-column: 1 / -1; font: 10px/1.4 var(--mono); color: var(--teal-2); letter-spacing: .04em; }

.rail-foot { padding: 10px 16px 14px; border-top: 1px solid var(--line-2); font: 11px/1.5 var(--mono); color: var(--ink-3); }
.rail-foot b { color: var(--teal-2); font-weight: 600; }
.about { margin: 0 0 6px; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.about b { color: var(--teal); }

.scrim { position: fixed; inset: 0; z-index: 14; background: rgba(0,0,0,0.5); backdrop-filter: blur(2px); }

/* ------------------------------------------------------------ NARRATOR */
.narrator {
  position: fixed; z-index: 12; left: 50%; bottom: 18px; transform: translateX(-50%);
  width: min(780px, calc(100% - 2 * var(--gutter)));
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 16px;
  box-shadow: var(--glow), 0 20px 60px rgba(0,0,0,0.5); backdrop-filter: blur(14px);
  padding: 14px 18px 12px; transition: left .45s var(--ease-out), width .45s var(--ease-out);
}
body.rail-open.wide .narrator { left: calc(50% + (var(--rail-w) + var(--gutter)) / 2); width: min(780px, calc(100% - var(--rail-w) - 4 * var(--gutter))); }
body.detail-open.wide .narrator { left: calc(50% - (var(--detail-w) + var(--gutter)) / 2); width: min(780px, calc(100% - var(--detail-w) - 4 * var(--gutter))); }
body.rail-open.detail-open.wide .narrator { left: calc(50% + (var(--rail-w) - var(--detail-w)) / 2); width: min(700px, calc(100% - var(--rail-w) - var(--detail-w) - 5 * var(--gutter))); }
.narrator::before {
  content: ""; position: absolute; left: 18px; right: 18px; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--teal), transparent); opacity: .6;
}
.nar-top { display: flex; align-items: center; gap: 10px; min-height: 20px; }
.nar-scene { font: 10.5px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--teal-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nar-count { margin-left: auto; font: 11px/1 var(--mono); color: var(--ink-3); white-space: nowrap; }
.nar-conf:empty { display: none; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 3px 8px; border-radius: 999px; font: 10.5px/1.2 var(--mono); letter-spacing: .04em;
  border: 1px solid currentColor; background: rgba(255,255,255,0.02);
}
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.nar-text {
  margin: 8px 0 10px; font-size: 16px; line-height: 1.55; color: var(--ink); min-height: 3.1em;
  text-wrap: pretty;
}
.nar-text .caret { display: inline-block; width: 7px; height: 1.05em; vertical-align: -0.15em; margin-left: 2px; background: var(--teal); box-shadow: 0 0 8px var(--teal); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.nar-text b { color: #ffffff; }
.nar-text em { color: var(--teal); font-style: normal; }
.nar-text code { font: 0.9em var(--mono); color: var(--gold); background: rgba(245,196,81,0.08); padding: 1px 5px; border-radius: 4px; }

.nar-variants { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -2px 0 10px; }
.nar-variants .vlabel { font: 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin-right: 4px; }
.vbtn {
  padding: 5px 11px; border-radius: 999px; font-size: 12.5px; color: var(--ink-2);
  border: 1px solid var(--line-2); transition: all .2s;
}
.vbtn:hover { color: var(--ink); border-color: var(--line); }
.vbtn.on { color: #120d02; background: var(--gold); border-color: var(--gold); box-shadow: 0 0 14px rgba(245,196,81,0.4); font-weight: 600; }

.nar-bottom { display: flex; align-items: center; gap: 12px; }
.nar-dots { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; min-width: 0; }
.nar-dots button { width: 18px; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.08); transition: background .25s, box-shadow .25s; }
.nar-dots button.done { background: rgba(94,234,212,0.35); }
.nar-dots button.cur { background: var(--teal); box-shadow: 0 0 10px var(--teal); }
.nar-ctrl { display: flex; align-items: center; gap: 4px; }
.play { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); color: var(--teal); background: var(--teal-3); }
.play:hover { background: rgba(94,234,212,0.2); color: var(--teal); }
.play svg { width: 18px; height: 18px; }
.play .i-play { fill: currentColor; stroke: none; }
.play .i-pause { display: none; stroke-width: 2.4; }
body.playing .play .i-play { display: none; }
body.playing .play .i-pause { display: block; }
.speed { font: 11px/1 var(--mono); color: var(--ink-3); padding: 6px 8px; border-radius: 7px; border: 1px solid var(--line-2); min-width: 38px; }
.speed:hover { color: var(--ink); }
.nar-next {
  display: block; width: 100%; margin-top: 10px; padding: 10px 14px; border-radius: 10px; text-align: left;
  border: 1px solid var(--line); background: linear-gradient(90deg, rgba(94,234,212,0.10), rgba(167,139,250,0.08));
  color: var(--ink); font-size: 13.5px;
}
.nar-next:hover { border-color: var(--teal-2); }
.nar-next b { color: var(--teal); }

/* ------------------------------------------------------------ DETAIL */
.detail {
  position: fixed; z-index: 16; top: calc(var(--top-h) + 14px); right: var(--gutter); bottom: 14px;
  width: var(--detail-w); background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 14px;
  box-shadow: var(--glow); backdrop-filter: blur(12px);
  transform: translateX(calc(100% + 40px)); opacity: 0; pointer-events: none;
  transition: transform .45s var(--ease-out), opacity .3s;
}
body.detail-open .detail { transform: none; opacity: 1; pointer-events: auto; }
.detail-close { position: absolute; top: 10px; right: 10px; z-index: 2; }
.detail-body { height: 100%; overflow-y: auto; padding: 18px 20px 22px; }
.d-kind { font: 10.5px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); display: flex; gap: 8px; align-items: center; padding-right: 36px; flex-wrap: wrap; }
.d-title { margin: 10px 0 4px; font-size: 20px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
.d-sub { font: 12px/1.4 var(--mono); color: var(--ink-3); margin-bottom: 14px; }
.d-sec { margin-top: 16px; }
.d-sec h3 { margin: 0 0 6px; font: 10px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--teal-2); }
.d-sec p { margin: 0 0 8px; color: var(--ink-2); font-size: 14px; }
.d-sec p b { color: var(--ink); }
.d-quote { margin: 8px 0; padding: 10px 12px; border-left: 2px solid var(--gold); background: rgba(245,196,81,0.05); border-radius: 0 8px 8px 0; font: 13px/1.5 var(--mono); color: #e9dcc0; }
.d-src { display: grid; gap: 8px; }
.d-src a { display: block; border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 11px; color: var(--ink); background: rgba(255,255,255,0.015); }
.d-src a:hover { border-color: var(--line); background: var(--teal-3); }
.d-src a span { display: block; font: 11px/1.4 var(--mono); color: var(--ink-3); margin-top: 2px; word-break: break-all; }
.d-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.d-steps button { font: 11.5px/1 var(--mono); padding: 6px 9px; border-radius: 7px; border: 1px solid var(--line-2); color: var(--ink-2); }
.d-steps button:hover { border-color: var(--teal-2); color: var(--teal); }
.d-truth { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.d-try { border: 1px dashed rgba(245,196,81,0.35); border-radius: 10px; padding: 10px 12px; background: rgba(245,196,81,0.03); }
.d-try .t-row { display: grid; grid-template-columns: 58px 1fr; gap: 8px; font-size: 13px; margin: 4px 0; }
.d-try .t-row span:first-child { font: 10px/1.9 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.d-try .t-row.bad span:last-child { color: #f3a6a8; }
.d-try .t-row.good span:last-child { color: #a8f0e2; }

/* ------------------------------------------------------------ LEGEND */
.legend {
  position: fixed; z-index: 17; right: var(--gutter); top: calc(var(--top-h) + 14px);
  width: 330px; max-height: calc(100% - var(--top-h) - 40px); overflow: auto;
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 14px;
  box-shadow: var(--glow); backdrop-filter: blur(12px);
}
.legend-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 16px; font: 10px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); border-bottom: 1px solid var(--line-2); }
.legend-body { padding: 10px 16px 16px; }
.lg-h { font: 10px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--teal-2); margin: 12px 0 8px; }
.lg-row { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 10px; margin: 6px 0; font-size: 12.5px; color: var(--ink-2); }
.lg-row canvas { width: 44px; height: 24px; }
.lg-row b { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------ OVERLAY */
.overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0,0,0,0.55); backdrop-filter: blur(4px); padding: var(--gutter); }
.overlay-card { width: min(420px, 100%); background: var(--bg-2); border: 1px solid var(--panel-edge); border-radius: 14px; box-shadow: var(--glow); padding: 6px 18px 18px; }
.overlay-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; font: 10px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 6px 0 0; }
.keys dt { text-align: right; }
.keys dd { margin: 0; color: var(--ink-2); }

.tooltip {
  position: fixed; z-index: 30; pointer-events: none; max-width: 280px;
  padding: 8px 10px; border-radius: 9px; background: rgba(8,13,18,0.96); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink); box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.tooltip .tt-k { display: block; font: 10px/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 2px; }
.tooltip .tt-hint { display: block; font: 10.5px/1.4 var(--mono); color: var(--teal-2); margin-top: 4px; }

/* ------------------------------------------------------------ BOOT */
.boot {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px;
  background: radial-gradient(700px 500px at 50% 45%, rgba(94,234,212,0.08), transparent 70%), var(--bg);
  transition: opacity .6s var(--ease-out), visibility .6s;
  cursor: pointer;
}
.boot.done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-ring { position: relative; width: 240px; height: 240px; }
.boot-ring svg { width: 100%; height: 100%; overflow: visible; }
.boot-ring circle { fill: none; }
.r-track { stroke: rgba(94,234,212,0.08); stroke-width: 1; }
.r-draw { stroke: url(#bg1); stroke-width: 2; stroke-dasharray: 654; stroke-dashoffset: 654; transform-origin: 120px 120px; transform: rotate(-90deg); animation: draw 1.6s var(--ease-out) forwards; filter: drop-shadow(0 0 6px rgba(94,234,212,0.6)); }
.r-ticks { stroke: rgba(94,234,212,0.3); stroke-width: 6; stroke-dasharray: 1 13.4; }
.r-inner { stroke: rgba(167,139,250,0.2); stroke-width: 1; }
.r-arc { stroke-width: 1.5; stroke-linecap: round; transform-origin: 120px 120px; }
.r-arc.a1 { stroke: rgba(94,234,212,0.55); stroke-dasharray: 60 468; animation: spin 3.6s linear infinite; }
.r-arc.a2 { stroke: rgba(167,139,250,0.5); stroke-dasharray: 40 664; animation: spin 5s linear infinite reverse; }
.r-core { fill: var(--teal); filter: drop-shadow(0 0 6px var(--teal)); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.boot-core { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.boot-title { font: 600 16px/1 var(--sans); letter-spacing: .28em; margin-top: 30px; }
.boot-sub { font: 11px/1 var(--mono); color: var(--ink-3); margin-top: 8px; letter-spacing: .06em; }
.boot-counters { display: flex; gap: 26px; flex-wrap: wrap; justify-content: center; padding: 0 var(--gutter); }
.bc { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 64px; }
.bc b { font: 600 22px/1 var(--mono); color: var(--teal); text-shadow: 0 0 14px rgba(94,234,212,0.5); }
.bc span { font: 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.boot-hint { font: 10.5px/1 var(--mono); color: var(--ink-3); letter-spacing: .12em; opacity: .7; }

/* ------------------------------------------------------------ RESPONSIVE */
@media (max-width: 1180px) {
  .brand-sub { display: none; }
}
@media (max-width: 980px) {
  .truth .seg-label { display: none; }
  .seg-btn { padding: 6px 10px; }
}
@media (max-width: 760px) {
  :root { --top-h: 104px; --gutter: 12px; }
  .topbar { flex-wrap: wrap; align-content: center; row-gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .brand h1 { font-size: 13px; letter-spacing: .12em; }
  .modes { order: 3; flex: 1 0 100%; margin-left: 0; justify-content: flex-start; }
  .modes .seg-btn { padding: 6px 11px; font-size: 12.5px; }
  .top-actions { gap: 2px; }
  #btnHelp { display: none; }
  .truth .seg-btn { padding: 5px 9px; font-size: 12px; }
  .rail { left: 0; top: 0; bottom: 0; border-radius: 0 14px 14px 0; width: min(88vw, 340px); z-index: 25; }
  .narrator { bottom: max(10px, env(safe-area-inset-bottom)); padding: 12px 14px 10px; border-radius: 14px; }
  .nar-text { font-size: 14.5px; min-height: 4.6em; margin: 6px 0 8px; }
  .nar-dots button { width: 12px; }
  .detail { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: min(72vh, 620px); border-radius: 16px 16px 0 0; transform: translateY(calc(100% + 30px)); z-index: 26; }
  body.detail-open .detail { transform: none; }
  .legend { left: var(--gutter); right: var(--gutter); width: auto; }
  .hud-bl { display: none; }
  .hud-tl { left: var(--gutter); right: var(--gutter); justify-content: flex-start; max-width: none; }
  .truth-pill { font-size: 10px; padding: 3px 7px; }
  .boot-ring { width: 190px; height: 190px; }
  .boot-counters { gap: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   WOW PASS: aurora, glass, grain, motion. Everything here is
   decoration on top of the working UI and honours reduced motion.
   ============================================================ */
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

/* film grain + vignette */
.stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 85% 75% at 50% 45%, transparent 55%, rgba(0,0,0,0.55) 100%);
}
body::after {
  content: ""; position: fixed; inset: -50%; z-index: 4; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.1s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

/* title: a slow light passing through the words */
.brand h1 {
  background: linear-gradient(100deg, #e8f0f3 0%, #e8f0f3 38%, #5eead4 48%, #c4b5fd 56%, #e8f0f3 66%, #e8f0f3 100%);
  background-size: 260% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 7.5s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -160% 0; } }
.brand-ring::before {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  background: conic-gradient(from var(--ang), transparent 0 70%, rgba(94,234,212,0.9) 85%, transparent 100%);
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%); mask: radial-gradient(circle, transparent 58%, #000 60%);
  animation: spinang 3.2s linear infinite;
}
@keyframes spinang { to { --ang: 360deg; } }

/* view tabs: a sliding glider pill */
.modes { position: relative; }
.modes .seg-btn { position: relative; z-index: 1; }
.modes .seg-btn.on { background: transparent; box-shadow: none; color: #04110f; }
.seg-glider {
  position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; z-index: 0; border-radius: 999px; pointer-events: none;
  background: linear-gradient(95deg, #5eead4, #7dd3fc 60%, #a5b4fc);
  box-shadow: 0 0 18px rgba(94,234,212,0.55), inset 0 0 0 1px rgba(255,255,255,0.25);
  transition: transform .5s var(--ease-spring), width .5s var(--ease-spring);
}

/* narrator: aurora border + autoplay progress */
.narrator {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    conic-gradient(from var(--ang), rgba(94,234,212,0.55), rgba(167,139,250,0.45), rgba(96,165,250,0.3), rgba(94,234,212,0.1), rgba(245,196,81,0.35), rgba(94,234,212,0.55)) border-box;
  animation: spinang 14s linear infinite;
}
.narrator::after {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: -1px; height: 2px; border-radius: 2px;
  transform-origin: left center; transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, #5eead4, #a78bfa); box-shadow: 0 0 10px rgba(94,234,212,0.7);
  transition: transform .12s linear;
}
.nar-text { animation: textin .5s var(--ease-out); }
@keyframes textin { from { opacity: .35; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* first visit: point at play */
body.coach .play { animation: coach 1.8s var(--ease-out) infinite; }
@keyframes coach { 0% { box-shadow: 0 0 0 0 rgba(94,234,212,0.55); } 70% { box-shadow: 0 0 0 14px rgba(94,234,212,0); } 100% { box-shadow: 0 0 0 0 rgba(94,234,212,0); } }
.nar-ctrl { position: relative; }
body.coach .nar-ctrl::before {
  content: "press play"; position: absolute; top: 50%; right: calc(100% + 10px); transform: translateY(-50%);
  font: 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #04110f; white-space: nowrap;
  background: var(--teal); padding: 6px 10px; border-radius: 999px; box-shadow: 0 0 16px rgba(94,234,212,0.6);
  animation: bob 1.8s ease-in-out infinite; pointer-events: none;
}
@keyframes bob { 50% { transform: translate(-4px, -50%); } }

/* glass everywhere */
.tooltip { background: rgba(8,13,18,0.78); backdrop-filter: blur(12px) saturate(1.3); border-color: rgba(94,234,212,0.25); }
.rail, .detail, .legend { background: linear-gradient(180deg, rgba(12,19,26,0.9), rgba(6,10,14,0.92)); }

/* detail panel: content rises in, one block after another */
body.detail-open .detail-body > * { animation: rise .55s var(--ease-out) both; }
.detail-body > *:nth-child(2) { animation-delay: .04s; } .detail-body > *:nth-child(3) { animation-delay: .08s; }
.detail-body > *:nth-child(4) { animation-delay: .12s; } .detail-body > *:nth-child(5) { animation-delay: .16s; }
.detail-body > *:nth-child(6) { animation-delay: .2s; } .detail-body > *:nth-child(7) { animation-delay: .24s; }
.detail-body > *:nth-child(n+8) { animation-delay: .28s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.d-title { background: linear-gradient(90deg, #ffffff, #b8fff2); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* micro interactions */
.vbtn, .scene-card, .nar-next, .ico { transition: transform .25s var(--ease-spring), background .2s, color .2s, border-color .2s, box-shadow .25s; }
.vbtn:hover, .nar-next:hover { transform: translateY(-1px); }
.scene-card:hover { box-shadow: inset 0 0 0 1px rgba(94,234,212,0.18), 0 6px 20px rgba(0,0,0,0.25); }
.play:hover { transform: scale(1.06); box-shadow: 0 0 20px rgba(94,234,212,0.45); }
.nar-next { position: relative; overflow: hidden; }
.nar-next::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(100deg, transparent 30%, rgba(94,234,212,0.18) 50%, transparent 70%);
  animation: sweep 3.2s ease-in-out infinite;
}
@keyframes sweep { 60%, 100% { transform: translateX(100%); } }

/* boot: rays behind the ring, a typing caret */
.boot::before {
  content: ""; position: absolute; left: 50%; top: 45%; width: 1100px; height: 1100px; margin: -550px 0 0 -550px; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(94,234,212,0.06) 0deg 2deg, transparent 2deg 12deg);
  -webkit-mask: radial-gradient(circle, #000 0, transparent 62%); mask: radial-gradient(circle, #000 0, transparent 62%);
  animation: spin 40s linear infinite;
}
.boot-title { min-height: 1em; }
.bcaret { display: inline-block; width: 8px; height: 14px; margin-left: 3px; vertical-align: -1px; background: var(--teal); box-shadow: 0 0 8px var(--teal); animation: blink .8s steps(1) infinite; }

/* final QA fixes */
html, body { overscroll-behavior-x: none; }
.narrator { touch-action: pan-y; }                 /* horizontal swipes belong to the narrator, not the browser */
.boot-sub { max-width: 160px; text-align: center; line-height: 1.5; margin-top: 10px; }
.nar-dots { flex-wrap: nowrap; overflow: hidden; }
.nar-dots button { flex: 1 1 18px; min-width: 4px; max-width: 18px; }
.nar-text { min-height: calc(2 * 1.55em); }

/* ?poster=1: a clean frame for link preview images */
body.poster .topbar, body.poster .narrator, body.poster .rail, body.poster .hud-bl, body.poster .hud-tl, body.poster .detail { display: none !important; }
body.poster .stage::after {
  background:
    linear-gradient(90deg, rgba(5,8,11,0.98) 0%, rgba(5,8,11,0.93) 36%, rgba(5,8,11,0.55) 45%, rgba(5,8,11,0) 54%),
    radial-gradient(ellipse 85% 75% at 60% 45%, transparent 55%, rgba(0,0,0,0.5) 100%);
}
.poster-title { position: fixed; z-index: 30; left: 5.5%; top: 50%; transform: translateY(-50%); width: 36%; }
.poster-title .pt-ring { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--teal); box-shadow: 0 0 22px rgba(94,234,212,0.6), inset 0 0 10px rgba(94,234,212,0.35); position: relative; margin-bottom: 22px; }
.poster-title .pt-ring::after { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 14px var(--teal); }
.poster-title h2 {
  margin: 0; font: 700 64px/0.98 var(--sans); letter-spacing: -0.02em;
  background: linear-gradient(100deg, #ffffff 0%, #d7fff7 45%, #5eead4 70%, #c4b5fd 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(94,234,212,0.25));
}
.poster-title p { margin: 18px 0 0; font: 400 21px/1.4 var(--sans); color: #b9c8ce; }
.poster-title .pt-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.poster-title .pt-chips span { font: 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--teal); border: 1px solid rgba(94,234,212,0.35); background: rgba(94,234,212,0.07); padding: 7px 10px; border-radius: 999px; }
.poster-title .pt-url { margin-top: 26px; font: 600 15px/1 var(--mono); letter-spacing: .06em; color: #e8f0f3; opacity: .85; }

/* legend open: narrator shifts left instead of hiding under it */
body.legend-open.wide .narrator { left: calc(50% - (330px + var(--gutter)) / 2); width: min(780px, calc(100% - 330px - 4 * var(--gutter))); }

@media (max-width: 760px) {
  .nar-text { min-height: 3.2em; }
  .nar-variants { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -4px; }
  .nar-variants::-webkit-scrollbar { display: none; }
  .nar-variants .vbtn { flex: 0 0 auto; }
  body::after { opacity: .04; }
  body.coach .nar-ctrl::before { display: none; }   /* on phones the pulsing ring is enough */
  .boot-sub { max-width: 124px; font-size: 10px; }
  .truth .seg-label { display: inline; font-size: 9px; padding: 0 4px 0 8px; letter-spacing: .12em; }
  .modes { -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent); mask-image: linear-gradient(90deg, #000 86%, transparent); }
  .detail { height: auto; max-height: min(72vh, 620px); background: var(--bg-2); }
  .detail::before { content: ""; display: block; width: 38px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.18); margin: 8px auto 0; }
  .detail-body { max-height: calc(min(72vh, 620px) - 16px); height: auto; }
}
@media (prefers-reduced-motion: reduce) {
  body::after, .boot::before { animation: none; }
  .brand h1 { animation: none; background-position: 50% 0; }
}
