* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-arcade);
  font-size: var(--fs-md);
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: none;
}

#stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  /* Neutral-dark letterbox so the bars around the 16:9 canvas don't clash with
     the in-game colours (each scene paints its own full-canvas backdrop). */
  background: #050409;
  overflow: hidden;
}

#game {
  display: block;
  image-rendering: pixelated;
  /* Fill the entire viewport. The canvas' internal resolution is kept at the
     same aspect as the window (see fitCanvas in main.js), so 100vw x 100vh
     scales uniformly with no distortion and no letterbox. */
  width: 100vw;
  height: 100vh;
  background: #000;
}

/* CRT scanline overlay (toggleable via body.crt) */
#stage.crt::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg, rgba(0,0,0,.16) 0px, rgba(0,0,0,.16) 1px, transparent 2px, transparent 3px);
  mix-blend-mode: multiply;
  z-index: 50;
}

/* ---- Overlay (menus / forms drawn over the canvas) ---- */
#overlay {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  z-index: 40;
  padding: var(--space-4);
}
#overlay.show { display: grid; }

.panel {
  background: rgba(21,16,43,.92);
  border: 2px solid var(--neon-cyan);
  box-shadow: var(--glow-cyan);
  padding: var(--space-5);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.title {
  font-size: var(--fs-xl);
  color: var(--neon-magenta);
  text-shadow: var(--glow-magenta);
  margin-bottom: var(--space-3);
  line-height: 1.3;
}
.subtitle { font-size: var(--fs-sm); color: var(--text-dim); margin-bottom: var(--space-4); }
h2.section { font-size: var(--fs-lg); color: var(--neon-cyan); margin-bottom: var(--space-3); }

label { display: block; font-size: var(--fs-sm); margin: var(--space-3) 0 var(--space-1); color: var(--text-dim); }
input[type=text], input[type=email] {
  width: 100%;
  font-family: var(--font-arcade);
  font-size: var(--fs-md);
  padding: var(--space-3);
  background: #0b0820;
  border: 2px solid var(--text-dim);
  color: var(--text);
}
input:focus { outline: none; border-color: var(--neon-cyan); box-shadow: var(--glow-cyan); }

.consent { display: flex; gap: var(--space-2); align-items: flex-start; margin: var(--space-4) 0; font-size: var(--fs-sm); line-height: 1.8; }
.consent input { margin-top: 4px; }
.consent a { color: var(--neon-cyan); }

button, .btn {
  font-family: var(--font-arcade);
  font-size: var(--fs-md);
  padding: var(--space-3) var(--space-4);
  background: transparent;
  color: var(--neon-cyan);
  border: 2px solid var(--neon-cyan);
  cursor: pointer;
  transition: transform .06s ease, background .1s ease;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: rgba(47,243,255,.15); }
button:active { transform: translateY(2px); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary, .btn.primary { color: var(--bg); background: var(--neon-magenta); border-color: var(--neon-magenta); }
button.danger { color: var(--warn-red); border-color: var(--warn-red); }
button.danger:hover { background: rgba(255,59,59,.15); }

.row { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-4); }
.error { color: var(--warn-red); font-size: var(--fs-sm); margin-top: var(--space-2); min-height: 1.4em; }
.hint  { color: var(--text-dim); font-size: var(--fs-xs); margin-top: var(--space-2); }
/* Grey legal links pinned to the bottom of the screen (title screen only).
   Independent of #overlay so it never affects the centred panel layout. */
.legal-footer {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: var(--space-3);
  text-align: center;
  font-size: var(--fs-xs);
  z-index: 41;
}
.legal-footer.show { display: block; }
.legal-footer a { color: #8a8a99; text-decoration: none; margin: 0 var(--space-2); }
.legal-footer a:hover { color: #c2c2cf; text-decoration: underline; }
.legal-footer .sep { color: #55556a; }

/* Social icons, top-right (title screen only) — brand colours, synthwave glow. */
.social {
  display: none;
  position: fixed;
  top: var(--space-4); right: var(--space-5);
  gap: var(--space-4);
  z-index: 41;
}
.social.show { display: flex; }
.social { align-items: center; }
.social a { line-height: 0; transition: transform .12s ease, filter .15s ease; }
.social a:hover { transform: translateY(-2px) scale(1.08); }
/* Size by height so the wide YouTube mark and the square Instagram mark read
   as the same size; width follows the aspect ratio (no distortion). */
.social svg { height: 38px; width: auto; display: block; }

/* YouTube — neon brand red */
.social .yt { color: #ff2d55; }
.social .yt svg { filter: drop-shadow(0 0 5px #ff2d55) drop-shadow(0 0 12px rgba(255,45,85,.7)); }
.social .yt:hover svg { filter: drop-shadow(0 0 7px #ff2d55) drop-shadow(0 0 20px #ff2d55); }

/* Instagram — synthwave gradient (yellow → pink → purple) */
.social .ig svg { filter: drop-shadow(0 0 5px var(--sunset-pink)) drop-shadow(0 0 12px rgba(177,59,255,.6)); }
.social .ig:hover svg { filter: drop-shadow(0 0 7px var(--sunset-pink)) drop-shadow(0 0 20px var(--neon-purple)); }

/* Title screen: the menu panel keeps its original centred position; the LIVE
   announcement is taken out of flow and hung directly below it, so the menu
   never shifts (the stack's height equals just the menu panel). */
.boot-stack { position: relative; width: 100%; max-width: 640px; }
.boot-stack > .panel { max-height: none; }
/* Title-screen menu panel: yellow border + glow (other scenes stay cyan). */
.boot-stack > .panel:not(.live-box) {
  border-color: var(--neon-yellow);
  box-shadow: 0 0 8px var(--neon-yellow), 0 0 18px rgba(255, 225, 77, .5);
}
/* Angle custom property so the conic-gradient border can be animated. */
@property --lb-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

.live-box {
  position: absolute;
  top: calc(100% + var(--space-4));
  left: 0; right: 0;
  text-align: center;
  /* Chase-light contour: magenta ↔ yellow running around the border. The inner
     padding-box layer masks the conic gradient to just the border area. */
  border: 3px solid transparent;
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    conic-gradient(from var(--lb-angle),
      var(--neon-magenta), var(--neon-yellow), var(--neon-magenta), var(--neon-yellow),
      var(--neon-magenta), var(--neon-yellow), var(--neon-magenta)) border-box;
  box-shadow: 0 0 14px rgba(255, 60, 172, .35);
  animation: lb-run 4s linear infinite;
}
@keyframes lb-run { to { --lb-angle: 360deg; } }
@media (prefers-reduced-motion: reduce) { .live-box { animation: none; } }
.live-title {
  font-size: var(--fs-lg); color: var(--neon-magenta);
  text-shadow: var(--glow-magenta); margin-bottom: var(--space-3);
}
.live-text { font-size: var(--fs-sm); color: var(--text-dim); line-height: 1.9; margin-bottom: var(--space-4); }
.live-text strong { color: var(--text); }

/* ---- Track map ---- */
.tracklist { list-style: none; display: grid; gap: var(--space-2); margin: var(--space-3) 0; }
.track {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3); border: 2px solid var(--text-dim); background: #0b0820;
  cursor: pointer; font-size: var(--fs-sm);
}
.track.locked { opacity: .45; cursor: not-allowed; }
.track.unlocked:hover { border-color: var(--neon-green); box-shadow: 0 0 10px rgba(57,255,122,.4); }
.track .idx { color: var(--neon-yellow); }
.track .lock { margin-left: auto; }

/* ---- Leaderboard ---- */
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); margin-top: var(--space-3); }
th, td { text-align: left; padding: var(--space-2) var(--space-3); border-bottom: 1px solid #2a2350; }
th { color: var(--neon-yellow); }
td.rank { color: var(--text-dim); }
.tabs { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }
.tabs button { font-size: var(--fs-xs); padding: var(--space-2) var(--space-3); }
.tabs button.active { background: var(--neon-cyan); color: var(--bg); }

/* ---- HUD (during play, §10) ---- */
#hud {
  position: fixed; top: 0; left: 0; right: 0;
  display: none; align-items: center; gap: var(--space-4);
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-sm);
  z-index: 30;
  pointer-events: none;
  /* dark strip + strong shadow so the HUD stays legible over bright (orange)
     and dark level backgrounds alike */
  background: linear-gradient(180deg, rgba(0,0,0,.78) 0%, rgba(0,0,0,.5) 60%, transparent 100%);
  text-shadow: 0 1px 2px #000, 0 0 6px rgba(0,0,0,.95);
}
#hud.show { display: flex; }
#hud .level-name { color: var(--neon-cyan); }
#hud .score { color: var(--neon-yellow); }
#hud .lives { color: var(--warn-red); letter-spacing: 2px; }
#hud .progress-wrap { flex: 1; height: 14px; border: 2px solid var(--neon-cyan); background: #0b0820; }
#hud .progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta)); transition: width .1s linear; }
#hud .time { color: var(--text-dim); min-width: 90px; text-align: right; }

.center-col { text-align: center; }
.spacer { height: var(--space-4); }
.loading { color: var(--neon-cyan); font-size: var(--fs-sm); text-align: center; }
