:root {
  color-scheme: dark;
  --bg: #05060f;
  --text: #f0f0f5;
  --accent: #7c5cff;
}

* {
  box-sizing: border-box;
}

/* ============================================================
   Synthwave loading splash (shows on entry, then reveals game)
   ============================================================ */
.splash {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.6rem;
  background: radial-gradient(ellipse 110% 75% at 50% 42%, #1c1046 0%, #0a0613 62%, #05030c 100%);
  transition: opacity 0.5s ease;
}

.splash.done {
  opacity: 0;
  pointer-events: none;
}

.splash-logo {
  font-size: clamp(2.1rem, 8.5vw, 3.6rem);
  animation: splash-throb 1.2s ease-in-out infinite;
}

/* Chromatic "tritone" logo — the same treatment as the in-game 3-2-1 /
   LEGENDARY! text: a white Orbitron core with pink + cyan offset fringes
   and a neon glow. */
.overlay-logo,
.splash-logo {
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
  background: none;
  filter: none;
  text-shadow:
    -0.05em 0.04em 0 #ff4ec7,
    0.05em -0.04em 0 #4dd2ff,
    0 0 0.26em rgba(155, 107, 255, 0.95),
    0 0 0.55em rgba(255, 78, 199, 0.5);
}

@keyframes splash-throb {
  50% {
    transform: scale(1.04);
  }
}

.splash-bar {
  width: min(320px, 68vw);
  height: 14px;
  border-radius: 8px;
  border: 2px solid rgba(155, 107, 255, 0.55);
  overflow: hidden;
  background: rgba(10, 6, 22, 0.7);
  box-shadow: 0 0 20px rgba(124, 92, 255, 0.4);
}

.splash-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, #3cf0ff, #ff3ca6, #ffd93d);
  box-shadow: 0 0 14px rgba(255, 60, 166, 0.7);
  animation: splash-load 1.4s ease-out forwards;
}

@keyframes splash-load {
  to {
    width: 100%;
  }
}

.splash-load {
  font-family: "Orbitron", monospace;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: #b6a6e0;
  animation: splash-blink 0.9s steps(1) infinite;
}

@keyframes splash-blink {
  50% {
    opacity: 0.25;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 0%, #16123a 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Orbitron", "Segoe UI", system-ui, sans-serif;
  overflow-x: hidden;
  /* A game, not a document — dragging the mouse to steer must never
     select text or start a drag, which is what steals cursor focus. */
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.back-link {
  position: absolute;
  top: 1.25rem;
  left: 1.5rem;
  z-index: 6;
  display: inline-block;
  color: #8f8fb0;
  text-decoration: none;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.back-link:hover {
  color: var(--accent);
}

.arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* vertically center the game screen */
  min-height: 100vh;
  padding: 1rem;
}

/* The game logo + tagline now live inside the start overlay (a title card).
   Font + glossy chrome come from the shared .os-logo class. */
.overlay .overlay-logo {
  margin: 0 0 0.2rem;
  font-size: clamp(2.4rem, 9vw, 3.7rem);
}

.overlay .overlay-tagline {
  margin: 0 0 0.5rem;
  color: #b6a6e0;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Game-over / win screens are not the title card — hide the logo + tagline */
.overlay.ended .overlay-logo,
.overlay.ended .overlay-tagline {
  display: none;
}

.stage {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  line-height: 0;
}

canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background:
    radial-gradient(circle at 50% 12%, rgba(64, 42, 138, 0.42) 0%, rgba(30, 20, 72, 0.18) 45%, transparent 72%),
    rgba(5, 3, 13, 0.93);
  touch-action: none;
}

.hud {
  position: absolute;
  top: 12px;
  font-family: "Orbitron", "Courier New", monospace;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 0.9rem;
  text-shadow: 0 0 10px currentColor;
  pointer-events: none;
  line-height: 1;
}

.hud-score {
  left: 16px;
  color: #7cf5ff;
}

.hud-score span {
  color: #fff;
}

.hud-lives {
  right: 104px;
  color: #ff6ec7;
  letter-spacing: 0.2em;
}

/* Inside the OS shell, the shell chrome owns volume + fullscreen, so the
   game hides its own duplicate buttons (back-link too — the shell has HUB). */
html.in-shell .mute-btn,
html.in-shell .back-link {
  display: none;
}

.mute-btn {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 5, 12, 0.6);
  border: 1.5px solid rgba(77, 210, 255, 0.5);
  border-radius: 10px;
  color: #7cf5ff;
  cursor: pointer;
  z-index: 5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease,
    color 0.15s ease;
}

.mute-btn svg {
  display: block;
  width: 21px;
  height: 21px;
  filter: drop-shadow(0 0 5px currentColor);
}

.mute-btn:hover {
  border-color: #4dd2ff;
  box-shadow: 0 0 14px rgba(77, 210, 255, 0.5);
}

.mute-btn:active {
  transform: scale(0.92);
}

.mute-btn.muted {
  color: #ff6ec7;
  border-color: rgba(255, 110, 199, 0.6);
}

.mute-btn.muted:hover {
  border-color: #ff6ec7;
  box-shadow: 0 0 14px rgba(255, 110, 199, 0.5);
}

/* Full-screen button — sits just left of the mute button */
.fs-btn {
  right: 56px;
  color: #ffd23c;
  border-color: rgba(255, 210, 60, 0.55);
}
.fs-btn:hover {
  border-color: #ffd23c;
  box-shadow: 0 0 14px rgba(255, 210, 60, 0.5);
}

.hud-level {
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  color: #ffd23c;
  letter-spacing: 0.22em;
  font-size: 0.82rem;
}

.hud-combo {
  left: 50%;
  top: 40px;
  transform: translateX(-50%);
  color: #ffd93d;
  font-size: 1.1rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.hud-combo.show {
  opacity: 1;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
  /* Translucent title card — a warm sun bleed at the top + pink at the
     horizon so the synthwave scene peeks through the glass. */
  background:
    radial-gradient(ellipse 90% 55% at 50% 10%, rgba(255, 150, 80, 0.16), transparent 62%),
    radial-gradient(ellipse 75% 45% at 50% 100%, rgba(255, 60, 166, 0.1), transparent 62%),
    rgba(8, 5, 20, 0.56);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  line-height: 1.5;
  transition: opacity 0.3s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* The game-state heading (Game Over / You Win) — scoped by id so it never
   overrides the shared .os-logo on the title-card logo (also an h2). */
#overlayTitle {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #ff4ec7, #ffd93d, #4dff9e, #4dd2ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 78, 199, 0.55));
}

/* Start screen has no game-state heading — hide it when empty. */
#overlayTitle:empty {
  display: none;
}

.overlay p {
  margin: 0;
  color: #c4c4e0;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  line-height: 1.7;
}

.overlay p .hint {
  display: inline-block;
  margin-top: 0.4rem;
  color: #8f8fb0;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.overlay button {
  margin-top: 0.5rem;
  padding: 0.7rem 2.4rem;
  font-family: "Orbitron", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(90deg, #b06bff, #ff4ec7);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(255, 78, 199, 0.55);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.overlay button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 34px rgba(255, 78, 199, 0.8);
}

.overlay button:active {
  transform: scale(0.98);
}
