@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;700;800&family=IBM+Plex+Mono:wght@400;500;700&display=swap");
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");

/* =====================================================
   DESIGN SYSTEM — Cyber-Minimalism / Neo-Brutalist
   Pure black. Razor lines. Monochrome + controlled glitch.
   ===================================================== */

:root {
  color-scheme: dark;

  /* Pure Blacks */
  --void: #000000;
  --surface: #050505;
  --surface-raised: #0a0a0a;

  /* Ink */
  --ink: #ffffff;
  --ink-2: #888888;
  --ink-3: #444444;

  /* Wire (the only decorative lines) */
  --wire: rgba(255, 255, 255, 0.06);
  --wire-hover: rgba(255, 255, 255, 0.12);
  --wire-active: rgba(255, 255, 255, 0.25);

  /* Glitch Colors — ONLY for animations, never static UI */
  --glitch-cyan: rgba(0, 255, 255, 0.85);
  --glitch-magenta: rgba(255, 0, 255, 0.85);

  /* Typography */
  --font-display: "Space Grotesk", "Pretendard", "Inter", sans-serif;
  --font-body: "Pretendard", "Inter", sans-serif;
  --font-mono: "IBM Plex Mono", "Menlo", monospace;
}

/* =====================================================
   RESET & BASE
   ===================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--void);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  line-height: 1.5;
  background: var(--void);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Skip-link (a11y) */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--ink);
  color: var(--void);
  padding: 12px;
  z-index: 9999;
  font-weight: 700;
  transition: transform 0.2s;
}
.skip-link:focus {
  transform: translateY(40px);
}

/* =====================================================
   FLOATING ISLAND HEADER
   Capsule nav floating at top-center.
   ===================================================== */
.navbar,
.navbar-shell {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  padding: 0 6px;
  height: 48px;
  border: 1px solid var(--wire);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  width: auto;
}

.navbar-container {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0;
}

.navbar-brand {
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 100%;
}

.logo-text {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: var(--ink);
  text-transform: uppercase;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  text-decoration: none;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  padding: 8px 14px;
  border-radius: 999px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.nav-link:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}
.nav-link--active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
}

.nav-btn {
  appearance: none;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  padding: 8px 14px;
  border-radius: 999px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.nav-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}


/* =====================================================
   THEATER LAYOUT — Minimal overhead, game is king
   ===================================================== */
.theater-main {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 80px 24px 48px; /* 80px top accounts for floating nav */
  display: flex;
  flex-direction: column;
  align-items: center;
}

.theater-header-block {
  text-align: center;
  margin-bottom: 28px;
}

.theater-hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--ink);
  margin-bottom: 16px;
  animation: retro-color-cycle 6s linear infinite;
}

@keyframes retro-color-cycle {
  0%   { color: #ff00ff; }
  16%  { color: #00ffff; }
  33%  { color: #ff6600; }
  50%  { color: #39ff14; }
  66%  { color: #ff004d; }
  83%  { color: #ffff00; }
  100% { color: #ff00ff; }
}

@media (prefers-reduced-motion: reduce) {
  .theater-hero-title { animation: none; color: var(--ink); }
}

/* =====================================================
   FLAGSHIP RELAY — 2026
   ===================================================== */
:root { --acid: #d7ff18; --hot: #ff174f; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 4%, rgba(119, 0, 255, 0.08), transparent 28%);
}

.theater-main { max-width: 1220px; padding: 94px 24px 110px; gap: 56px; }
.theater-header-block { min-height: 260px; display: grid; place-content: center; text-align: center; }
.hero-eyebrow, .section-kicker {
  font: 700 0.68rem/1 var(--font-mono);
  letter-spacing: .18em;
  color: #777;
  text-transform: uppercase;
}
.theater-hero-title {
  margin: 20px 0 22px;
  font-family: var(--font-display);
  font-size: clamp(4rem, 9vw, 8.6rem);
  font-weight: 800;
  line-height: .84;
  letter-spacing: -.075em;
  color: transparent;
  background: linear-gradient(115deg, #ff174f 0%, #f00086 24%, #8e23ff 47%, #00d4ff 68%, #ff174f 100%);
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: title-spectrum 7s linear infinite;
  filter: saturate(1.15);
}
@keyframes title-spectrum { to { background-position: -240% 0; } }
.hero-tags { justify-content: center; }
.hero-tag { background: #020202; border-color: #181818; color: #777; letter-spacing: .14em; }

.game-stage-container { width: 100%; }
.relay-experience { display: grid; grid-template-columns: 260px minmax(0, 1fr); border: 1px solid #1a1a1a; background: #030303; }
.relay-briefing { min-height: 550px; display: flex; flex-direction: column; justify-content: space-between; padding: 34px 28px; border-right: 1px solid #1a1a1a; }
.relay-briefing h2 { margin: 16px 0 18px; font: 700 2.05rem/1.05 var(--font-display); letter-spacing: -.045em; }
.relay-briefing > div > p:last-child { color: #777; font-size: .88rem; line-height: 1.8; }
.briefing-rules { display: grid; gap: 0; border-top: 1px solid #1a1a1a; }
.briefing-rules div { display: flex; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid #111; font: 700 .65rem/1 var(--font-mono); letter-spacing: .08em; }
.briefing-rules dt { color: #555; }.briefing-rules dd { color: #bbb; }
.relay-frame-shell { min-width: 0; border: 0; background: #050505; }
.frame-hud { min-height: 58px; padding: 12px 18px; border-bottom-color: #1a1a1a; }
.hud-label { color: #555; }.hud-stage-name { color: #f2f2f2; }
.relay-frame-wrap { aspect-ratio: 16 / 9; min-height: 490px; }
.relay-frame { height: 100%; min-height: 490px; background: #080808; }
.theater-notices { display: flex; justify-content: space-between; padding: 12px 2px 0; color: #4d4d4d; font: 500 .68rem/1.5 var(--font-mono); }

.daily-route-section { display: grid; gap: 22px; }
.section-heading-row { display: flex; justify-content: space-between; align-items: end; }
.section-heading-row h2 { margin-top: 10px; font: 700 1.8rem/1 var(--font-display); letter-spacing: -.04em; }
.section-heading-row a { color: #777; font: 600 .72rem var(--font-mono); text-underline-offset: 5px; }
.daily-route-list { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.route-card { min-width: 0; position: relative; border: 1px solid #171717; background: #050505; overflow: hidden; }
.route-card img { display: block; width: 100%; aspect-ratio: 16/10; object-fit: cover; filter: grayscale(.35) brightness(.72); }
.route-card > div { padding: 12px; display: grid; gap: 7px; min-width: 0; }
.route-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .79rem; }
.route-card > div span, .route-index { color: #555; font: 700 .6rem var(--font-mono); letter-spacing: .1em; }
.route-index { position: absolute; top: 8px; left: 8px; z-index: 1; padding: 4px 6px; color: white; background: rgba(0,0,0,.76); }
.route-card[data-status="playing"] { border-color: #6326ff; box-shadow: inset 0 -2px #6326ff; }
.route-card[data-status="playing"] > div span { color: #9d74ff; }
.route-card[data-status="cleared"] { border-color: #557000; }.route-card[data-status="cleared"] > div span { color: var(--acid); }

.launch-section { min-height: 240px; display: grid; place-content: center; gap: 18px; text-align: center; border-top: 1px solid #111; border-bottom: 1px solid #111; }
.launch-section p { color: #555; font: 600 .68rem var(--font-mono); }
.launch-button { min-width: min(480px, 84vw); min-height: 74px; border: 0; background: var(--acid); color: #080808; cursor: pointer; font: 800 clamp(1.5rem, 3vw, 2.35rem) var(--font-display); letter-spacing: -.04em; box-shadow: 0 0 46px rgba(215,255,24,.08); transition: transform .18s, box-shadow .18s; }
.launch-button:hover { transform: translateY(-2px); box-shadow: 0 0 70px rgba(215,255,24,.18); }
.launch-button:focus-visible { outline: 3px solid white; outline-offset: 5px; }
.ad-rail { min-height: 92px; display: grid; place-content: center; gap: 8px; text-align: center; border: 1px solid #101010; color: #343434; }
.ad-rail span { font: 700 .58rem var(--font-mono); letter-spacing: .14em; }.ad-rail p { font-size: .72rem; }
.site-footer { max-width: 1220px; margin: 0 auto; padding: 22px 24px 44px; display: flex; justify-content: space-between; gap: 20px; color: #444; font: 500 .64rem var(--font-mono); }
.site-footer nav { display: flex; gap: 18px; }.site-footer a { color: #666; }

@media (max-width: 820px) {
  .theater-main { padding: 76px 14px 72px; gap: 38px; }
  .theater-header-block { min-height: 230px; }
  .theater-hero-title { font-size: clamp(3rem, 15vw, 5rem); }
  .relay-experience { grid-template-columns: 1fr; }
  .relay-briefing { min-height: 0; padding: 24px 20px; border-right: 0; border-bottom: 1px solid #1a1a1a; gap: 28px; }
  .relay-briefing h2 { font-size: 1.8rem; }
  .relay-frame-wrap, .relay-frame { min-height: 54vw; }
  .daily-route-list { grid-template-columns: repeat(5, minmax(150px, 1fr)); overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x mandatory; }
  .route-card { scroll-snap-align: start; }
  .section-heading-row { align-items: start; }.section-heading-row a { font-size: .62rem; }
  .theater-notices { flex-direction: column; gap: 4px; }
  .site-footer { flex-direction: column; }.site-footer nav { flex-wrap: wrap; }
}

@media (max-width: 540px) {
  .navbar-actions .nav-link:nth-child(3) { display: none; }
  .navbar-brand { padding: 0 10px; }.nav-link, .nav-btn { min-height: 40px; padding: 10px 8px; }
  .hero-tags { gap: 5px; }.hero-tag { padding: 5px 7px; font-size: .58rem; }
  .frame-hud { flex-direction: row; align-items: center; }
  .hud-stage-name { max-width: 58vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .launch-section { min-height: 200px; }
}

@media (prefers-reduced-motion: reduce) {
  .theater-hero-title { animation: none; background-position: 48% 0; }
  html { scroll-behavior: auto; }
}

.policy-page { width: min(760px, calc(100% - 32px)); margin: 0 auto; padding: 96px 0 120px; }
.policy-page > a { display: inline-block; margin-bottom: 80px; color: #777; font: 700 .7rem var(--font-mono); text-underline-offset: 5px; }
.policy-page h1 { margin: 18px 0 40px; font: 800 clamp(2.7rem, 8vw, 5.4rem)/.96 var(--font-display); letter-spacing: -.06em; }
.policy-page h2 { margin: 50px 0 12px; font: 700 1.15rem var(--font-display); }
.policy-page p { color: #8a8a8a; font-size: .95rem; line-height: 1.9; }

.theater-subtitle {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-2);
  letter-spacing: 0.04em;
}

/* =====================================================
   HERO TAGS — Sharp monochrome badges
   ===================================================== */
.hero-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.hero-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink-2);
  padding: 5px 12px;
  border: 1px solid var(--wire);
  background: transparent;
}

/* =====================================================
   GAME CONTAINER — Edge-to-edge, razor-border
   ===================================================== */
.game-stage-container {
  position: relative;
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
}

.cinematic-glow-layer {
  display: none; /* killed — no more orange glow blob */
}

.relay-frame-shell {
  background: var(--void);
  border: 1px solid var(--wire);
  overflow: hidden;
}

.frame-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--wire);
}
.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hud-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.hud-stage-name, .hud-progress-count {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
}

.relay-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--void);
}
.relay-frame {
  width: 100%;
  height: 100%;
  border: none;
}

.theater-notices {
  text-align: center;
  margin-top: 16px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}

/* =====================================================
   OVERLAY — In-game overlays (Game Over, Victory)
   ===================================================== */
.relay-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 10;
}
.relay-overlay[hidden] {
  display: none !important;
}

.relay-overlay-card {
  width: min(90%, 460px);
  padding: 32px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--wire);
}

.blur-panel {
  background: var(--surface);
  border: 1px solid var(--wire);
}
.glass-panel {
  background: var(--surface-raised);
  border: 1px solid var(--wire);
}

.overlay-kicker {
  font-family: var(--font-mono);
  color: var(--ink-3);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

#relay-overlay-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: -0.03em;
}
.overlay-copy {
  color: var(--ink-2);
  font-size: 0.9rem;
  margin-bottom: 20px;
  line-height: 1.5;
}
.overlay-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* =====================================================
   RANKING SAVE PANEL
   ===================================================== */
.ranking-save-panel {
  padding: 16px;
  text-align: left;
  margin-bottom: 20px;
}
.ranking-save-panel[hidden] {
  display: none !important;
}
.ranking-save-label {
  display: block;
  font-family: var(--font-mono);
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--ink-2);
  text-transform: uppercase;
}
.ranking-save-row {
  display: flex;
  gap: 8px;
}
.ranking-save-input {
  flex: 1;
  background: var(--void);
  border: 1px solid var(--wire);
  padding: 0 14px;
  height: 40px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: border-color 0.15s;
}
.ranking-save-input:focus {
  outline: none;
  border-color: var(--wire-active);
}
.ranking-save-input::placeholder {
  color: var(--ink-3);
}
.ranking-save-status {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-2);
  margin-top: 6px;
  min-height: 1.2rem;
}

/* =====================================================
   BUTTONS — Brutalist, functional
   ===================================================== */
.action-btn {
  appearance: none;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  white-space: nowrap;
}

.action-btn-primary {
  background: var(--ink);
  color: var(--void);
  border: 1px solid var(--ink);
}
.action-btn-primary:hover {
  background: #d0d0d0;
  border-color: #d0d0d0;
}

.action-btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--wire);
}
.action-btn-ghost:hover {
  color: var(--ink);
  border-color: var(--wire-active);
  background: rgba(255, 255, 255, 0.03);
}

.action-btn[hidden] {
  display: none !important;
}

/* =====================================================
   MODALS (Prompt / Leaderboard)
   ===================================================== */
.prompt-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
}
.prompt-modal[aria-hidden="true"] {
  display: none;
}

.prompt-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.prompt-sheet {
  position: relative;
  width: min(100%, 620px);
  max-height: 90vh;
  padding: 28px;
  overflow-y: auto;
  z-index: 2;
  background: var(--surface);
  border: 1px solid var(--wire);
}
.prompt-sheet-leaderboard {
  width: min(100%, 700px);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}
.panel-kicker {
  font-family: var(--font-mono);
  color: var(--ink-3);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.panel-head h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  margin-top: 4px;
  letter-spacing: -0.03em;
}
.panel-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--wire);
  color: var(--ink-2);
  width: 36px;
  height: 36px;
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.15s, color 0.15s;
}
.icon-btn:hover {
  border-color: var(--wire-active);
  color: var(--ink);
}

/* Prompt Guide */
.prompt-guide {
  padding: 20px;
}
#prompt-guide-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  text-transform: uppercase;
  color: var(--ink-2);
}
.prompt-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.prompt-step-card {
  background: var(--void);
  border: 1px solid var(--wire);
  padding: 14px;
}
.prompt-step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.step-num {
  background: var(--ink);
  color: var(--void);
  font-family: var(--font-mono);
  font-weight: 800;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
}
.prompt-step-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  flex: 1;
}
.prompt-step-code {
  background: var(--surface);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-2);
  overflow-x: auto;
  border: 1px solid var(--wire);
  white-space: pre-wrap;
  line-height: 1.6;
}
.copy-small-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--wire);
  color: var(--ink-2);
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: border-color 0.15s, color 0.15s;
}
.copy-small-btn:hover {
  border-color: var(--wire-active);
  color: var(--ink);
}

/* Leaderboard */
.leaderboard-summary {
  margin-bottom: 20px;
}
.leaderboard-copy {
  font-size: 0.85rem;
  color: var(--ink-2);
  line-height: 1.5;
}
.leaderboard-status {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-3);
  margin-top: 6px;
}
.leaderboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: var(--void);
  border: 1px solid var(--wire);
  transition: border-color 0.12s;
}
.leaderboard-item:hover {
  border-color: var(--wire-hover);
}
.leaderboard-rank {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink-3);
  width: 28px;
  font-size: 0.85rem;
}
.leaderboard-main {
  flex: 1;
}
.leaderboard-name {
  font-weight: 700;
  font-size: 0.9rem;
}
.leaderboard-score {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-2);
}
.leaderboard-meta {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-3);
}

/* =====================================================
   GLITCH TITLE — Always active, cyber color split
   ===================================================== */
.theater-hero-title.glitch-infinite {
  position: relative;
  display: inline-block;
}
.theater-hero-title.glitch-infinite::before,
.theater-hero-title.glitch-infinite::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}
.theater-hero-title.glitch-infinite::before {
  animation: glitch-anim-1 3s ease-in-out infinite;
  color: var(--glitch-cyan);
  z-index: -1;
}
.theater-hero-title.glitch-infinite::after {
  animation: glitch-anim-2 3s ease-in-out infinite reverse;
  color: var(--glitch-magenta);
  z-index: -2;
}

@keyframes glitch-anim-1 {
  0%, 55% { clip-path: inset(0 0 0 0); transform: translate(0); opacity: 0; }
  60% { clip-path: inset(20% 0 60% 0); transform: translate(-3px, 1px); opacity: 0.8; }
  65% { clip-path: inset(60% 0 10% 0); transform: translate(3px, -1px); }
  70% { clip-path: inset(40% 0 40% 0); transform: translate(-2px, 2px); }
  75% { clip-path: inset(80% 0 5% 0); transform: translate(2px, -2px); }
  80% { clip-path: inset(10% 0 70% 0); transform: translate(-1px, 1px); opacity: 0.8; }
  85%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); opacity: 0; }
}
@keyframes glitch-anim-2 {
  0%, 50% { clip-path: inset(0 0 0 0); transform: translate(0); opacity: 0; }
  55% { clip-path: inset(10% 0 50% 0); transform: translate(3px, -1px); opacity: 0.8; }
  60% { clip-path: inset(30% 0 20% 0); transform: translate(-3px, 2px); }
  65% { clip-path: inset(70% 0 10% 0); transform: translate(2px, -1px); }
  70% { clip-path: inset(20% 0 60% 0); transform: translate(-2px, 2px); }
  75% { clip-path: inset(50% 0 30% 0); transform: translate(3px, -2px); opacity: 0.8; }
  80%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); opacity: 0; }
}

/* Scrambler dud characters */
.dud {
  color: var(--ink-3);
  opacity: 0.6;
}

/* =====================================================
   BACKGROUND — Subtle glitch atmosphere
   ===================================================== */
.bg-glitch-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--void);
  overflow: hidden;
}
.bg-glitch-layer::before,
.bg-glitch-layer::after {
  content: "";
  position: absolute;
  inset: -10vw;
  background-size: 100% 8px;
  opacity: 0.08;
  mix-blend-mode: screen;
}
.bg-glitch-layer::before {
  background-image: repeating-linear-gradient(transparent 0, transparent 48%, var(--glitch-cyan) 49%, rgba(0,255,255,0.3) 50%);
  animation: bg-glitch-1 6s infinite steps(15, end);
}
.bg-glitch-layer::after {
  background-image: repeating-linear-gradient(transparent 0, transparent 48%, var(--glitch-magenta) 49%, rgba(255,0,255,0.3) 50%);
  animation: bg-glitch-2 8s infinite steps(15, end);
}

@keyframes bg-glitch-1 {
  0%, 100% { transform: translateY(0) translateX(0); }
  10% { transform: translateY(8px) translateX(-4px); }
  30% { transform: translateY(16px) translateX(4px); }
  50% { transform: translateY(-8px) translateX(0); }
  80% { transform: translateY(24px) translateX(-6px); }
}
@keyframes bg-glitch-2 {
  0%, 100% { transform: translateY(0) translateX(0); }
  15% { transform: translateY(-8px) translateX(4px); }
  40% { transform: translateY(-16px) translateX(-4px); }
  60% { transform: translateY(8px) translateX(0); }
  85% { transform: translateY(-24px) translateX(6px); }
}

/* CRT scanlines — very subtle */
.crt-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    transparent 0px,
    rgba(0, 0, 0, 0.12) 1px,
    transparent 2px
  );
  opacity: 0.5;
}

/* =====================================================
   INTERACTIVE UTILITY CLASSES
   ===================================================== */
.reveal-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.reveal-up.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

.tilt-card {
  transition: transform 0.1s ease-out;
  transform-style: preserve-3d;
}

.glow-target {
  position: relative;
}
.glow-target::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(600px circle at var(--glow-x, 50%) var(--glow-y, 50%), rgba(255, 255, 255, 0.04), transparent 40%);
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.glow-target:hover::before {
  opacity: 1;
}

.magnetic-btn {
  will-change: transform;
}

/* =====================================================
   FOCUS VISIBLE (a11y)
   ===================================================== */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
  .theater-hero-title {
    font-size: 2.2rem;
  }
  .hero-tags {
    gap: 8px;
  }
  .hero-tag {
    font-size: 0.65rem;
    padding: 4px 8px;
  }
}

@media (max-width: 600px) {
  .navbar,
  .navbar-shell {
    top: 8px;
    height: 42px;
    padding: 0 4px;
  }
  .logo-text {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
  }
  .nav-link,
  .nav-btn {
    font-size: 0.65rem;
    padding: 6px 10px;
  }
  .theater-main {
    padding: 64px 12px 32px;
  }
  .theater-hero-title {
    font-size: 1.8rem;
  }
  .frame-hud {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 12px;
  }
  .hud-stage-name,
  .hud-progress-count {
    font-size: 0.75rem;
  }
  .prompt-sheet {
    padding: 20px 16px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Final cascade guards for the flagship responsive layout. */
.theater-main { padding-top: 70px; gap: 40px; }
.theater-header-block { min-height: 200px; }
.relay-briefing { min-height: 450px; }
.relay-frame-wrap, .relay-frame { min-height: 0; }
.relay-frame-wrap { aspect-ratio: 16 / 8.5; }
.relay-overlay-card { max-width: calc(100% - 24px); min-width: 0; }
.relay-overlay-card * { min-width: 0; }
@media (max-width: 600px) {
  .theater-main { padding: 76px 14px 72px; gap: 38px; }
  .theater-header-block { min-height: 230px; }
  .theater-hero-title { font-size: clamp(3rem, 15vw, 5rem); }
  .frame-hud { flex-direction: row; align-items: center; }
  .relay-overlay { padding: 10px; }
  .relay-frame-wrap { aspect-ratio: 16 / 9; }
  .relay-overlay-card { width: 100%; max-width: 100%; padding: 18px 14px; }
  #relay-overlay-title { font-size: 1.75rem; }
  .ranking-save-row { flex-direction: column; }
  .ranking-save-input, .ranking-save-row .action-btn { width: 100%; min-height: 44px; }
  .daily-route-list { grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; scroll-snap-type: none; }
  .route-card:last-child { grid-column: 1 / -1; }
}
