:root {
  color-scheme: dark;
  --ink: #f4f7ff;
  --muted: #8d98ad;
  --cyan: #72e5ff;
  --gold: #ffd36f;
  --magenta: #ff4fb8;
  --panel: rgba(5, 8, 16, .58);
  --line: rgba(255, 255, 255, .14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #03050a; }
body { color: var(--ink); }
button, select, a { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; }

.skip-link {
  position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 14px;
  color: #03050a; background: #fff; transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

#overdrive { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.screen-noise, .vignette { position: fixed; inset: 0; pointer-events: none; }
.screen-noise {
  z-index: 3; opacity: .055; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
}
.vignette { z-index: 2; background: radial-gradient(circle at 55% 46%, transparent 28%, rgba(1, 2, 7, .25) 66%, rgba(0, 0, 0, .72) 100%); }

.boot {
  position: fixed; inset: 0; z-index: 80; display: grid; place-content: center; justify-items: center;
  gap: 22px; background: #03050a; transition: opacity .55s ease, visibility .55s;
}
.boot.complete { opacity: 0; visibility: hidden; }
.boot-mark { font-size: clamp(2rem, 7vw, 5rem); font-weight: 950; letter-spacing: .08em; }
.boot-mark span { color: var(--cyan); }
.boot-line { width: min(340px, 72vw); height: 2px; background: rgba(255,255,255,.12); overflow: hidden; }
.boot-line i { display: block; width: 4%; height: 100%; background: linear-gradient(90deg, var(--cyan), #fff, var(--gold)); box-shadow: 0 0 20px var(--cyan); transition: width .25s ease; }
.boot-status { color: var(--muted); font: 700 10px/1 ui-monospace, monospace; letter-spacing: .22em; }

.hud-top, .hud-bottom, .scene-copy, .chapter-nav, .blast-button { position: fixed; z-index: 10; }
.hud-top { top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: max(18px, env(safe-area-inset-top)) 28px 18px; }
.identity { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.identity-mark { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(114,229,255,.38); background: rgba(4,9,20,.7); font-weight: 950; box-shadow: inset 0 0 22px rgba(114,229,255,.12), 0 0 28px rgba(114,229,255,.08); }
.identity b, .identity small { display: block; letter-spacing: .12em; }
.identity b { font-size: 12px; }
.identity small { margin-top: 4px; color: var(--muted); font: 700 8px/1 ui-monospace, monospace; }
.telemetry { display: flex; gap: 18px; color: var(--muted); font: 700 9px/1 ui-monospace, monospace; letter-spacing: .1em; }
.telemetry span { display: inline-flex; align-items: center; gap: 6px; }
.telemetry b { color: var(--ink); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #65ff9c; box-shadow: 0 0 14px #65ff9c; }

.scene-copy { left: clamp(28px, 7vw, 110px); top: 50%; width: min(560px, 46vw); transform: translateY(-50%); pointer-events: none; }
.copy-panel { position: absolute; left: 0; top: 50%; width: 100%; opacity: 0; transform: translate3d(0, 30px, 0); visibility: hidden; transition: opacity .5s ease, transform .65s cubic-bezier(.16,1,.3,1), visibility .5s; }
.copy-panel.active { position: relative; top: auto; opacity: 1; transform: none; visibility: visible; }
.chapter { margin: 0 0 16px; color: var(--cyan); font: 800 10px/1 ui-monospace, monospace; letter-spacing: .22em; }
.copy-panel h1, .copy-panel h2 { margin: 0; color: #fff; font-size: clamp(3.4rem, 7vw, 7.4rem); line-height: .78; letter-spacing: 0; text-transform: uppercase; text-shadow: 0 0 42px rgba(97,190,255,.12); }
.copy-panel em { color: transparent; font-style: normal; -webkit-text-stroke: 1px rgba(255,255,255,.76); }
.copy-panel > p:not(.chapter) { max-width: 500px; margin: 28px 0 0; color: rgba(225,231,243,.72); font-size: clamp(.88rem, 1.2vw, 1.05rem); line-height: 1.8; }
.copy-panel dl { display: flex; gap: 34px; margin: 32px 0 0; }
.copy-panel dl div { min-width: 110px; border-top: 1px solid var(--line); padding-top: 10px; }
.copy-panel dt { color: var(--muted); font: 700 8px/1 ui-monospace, monospace; letter-spacing: .16em; }
.copy-panel dd { margin: 7px 0 0; color: #fff; font: 800 11px/1 ui-monospace, monospace; }
.scene-5 .copy-panel.active > p:not(.chapter), .scene-5 .copy-panel.active dl { text-shadow: 0 2px 18px #000, 0 0 32px #000; }

.chapter-nav { right: 28px; top: 50%; display: grid; gap: 9px; transform: translateY(-50%); }
.chapter-nav button { display: flex; align-items: center; justify-content: flex-end; gap: 9px; width: 70px; height: 28px; padding: 0; border: 0; background: transparent; color: rgba(255,255,255,.38); }
.chapter-nav span { font: 700 9px/1 ui-monospace, monospace; }
.chapter-nav i { width: 20px; height: 1px; background: currentColor; transition: width .3s ease, color .3s ease, box-shadow .3s ease; }
.chapter-nav button.active { color: #fff; }
.chapter-nav button.active i { width: 44px; color: var(--cyan); box-shadow: 0 0 10px var(--cyan); }

.hud-bottom { left: 28px; right: 28px; bottom: max(20px, env(safe-area-inset-bottom)); display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.scene-name span, .scene-name b { display: block; font-family: ui-monospace, monospace; }
.scene-name span { color: var(--cyan); font-size: 9px; }
.scene-name b { margin-top: 6px; font-size: 11px; letter-spacing: .14em; }
.controls { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.controls button, .quality-control { min-height: 42px; border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(16px); }
.controls button { padding: 0 14px; font: 800 9px/1 ui-monospace, monospace; letter-spacing: .08em; }
.controls button:hover, .controls button:focus-visible, .quality-control:focus-within { border-color: rgba(114,229,255,.6); background: rgba(15,27,50,.76); }
.quality-control { display: flex; align-items: center; gap: 8px; padding: 0 10px; }
.quality-control span { color: var(--muted); font: 700 8px/1 ui-monospace, monospace; }
.quality-control select { border: 0; outline: 0; background: transparent; font: 800 9px/1 ui-monospace, monospace; }
.quality-control option { color: #fff; background: #080c16; }
.controls .icon-control { width: 42px; padding: 0; font-size: 16px; }
.controls .primary { color: #031019; border-color: var(--cyan); background: var(--cyan); }

.blast-button { display: none; left: 50%; bottom: 90px; min-height: 48px; padding: 0 24px; transform: translateX(-50%); border: 1px solid rgba(255,79,184,.7); background: rgba(44,5,31,.72); color: #fff; font: 900 10px/1 ui-monospace, monospace; letter-spacing: .14em; box-shadow: 0 0 32px rgba(255,79,184,.14); }
.scene-4 .blast-button { display: block; }
.blast-button:hover { background: rgba(91,8,59,.82); box-shadow: 0 0 40px rgba(255,79,184,.3); }

.fallback { position: fixed; inset: 0; z-index: 90; display: grid; place-content: center; padding: 28px; text-align: center; background: #03050a; }
.fallback[hidden] { display: none; }
.fallback h1 { font-size: clamp(2rem, 7vw, 5rem); }
.fallback p { color: var(--muted); }
.fallback a { color: var(--cyan); }

body.hero-embed .skip-link,
body.hero-embed .hud-top,
body.hero-embed .scene-copy,
body.hero-embed .chapter-nav,
body.hero-embed .hud-bottom,
body.hero-embed .blast-button { display: none; }
body.hero-embed #overdrive {
  transition: opacity .1s ease, transform .18s cubic-bezier(.16,1,.3,1);
  transform: scale(1.01);
}
body.hero-embed.scene-transition #overdrive { opacity: .14; transform: scale(1.025); }
body.hero-embed .boot { background: #02050b; }

@media (max-width: 760px) {
  .hud-top { padding: max(12px, env(safe-area-inset-top)) 14px 12px; }
  .identity-mark { width: 38px; height: 38px; }
  .identity b { font-size: 10px; }
  .telemetry span:nth-child(1), .telemetry span:nth-child(3) { display: none; }
  .scene-copy { left: 18px; top: auto; bottom: 128px; width: calc(100% - 72px); transform: none; }
  .copy-panel h1, .copy-panel h2 { font-size: clamp(3rem, 16vw, 5rem); }
  .copy-panel > p:not(.chapter) { display: none; }
  .copy-panel dl { gap: 14px; margin-top: 18px; }
  .copy-panel dl div { min-width: 0; flex: 1; }
  .chapter-nav { right: 10px; }
  .chapter-nav button { width: 44px; }
  .chapter-nav span { display: none; }
  .chapter-nav button.active i { width: 34px; }
  .hud-bottom { left: 14px; right: 14px; bottom: max(12px, env(safe-area-inset-bottom)); }
  .scene-name, .quality-control span, #soundButton { display: none; }
  .controls { width: 100%; justify-content: flex-end; }
  .quality-control { margin-right: auto; }
  .controls button, .quality-control { min-height: 44px; }
  .blast-button { bottom: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  .copy-panel, .boot, .chapter-nav i { transition: none; }
  .screen-noise { display: none; }
  body.hero-embed #overdrive { transition: none; transform: none; }
}
