:root {
  --bg: #04060a;
  --fg: #e8fffb;
  --cyan: #5cf0ff;
  --amber: #ffb14b;
  --rose: #ff5c4b;
  --dim: #3a8e95;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "JetBrains Mono", "Courier New", ui-monospace, monospace;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

canvas {
  display: block;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}
canvas#game-gpu {
  z-index: 0;
  pointer-events: none;
}
canvas#game {
  z-index: 1;
  cursor: crosshair;
  touch-action: none;
}

/* CRT vignette — was a per-frame radial-gradient fillRect in JS; moved
   here so the compositor handles it without touching frame budget. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background: radial-gradient(
    ellipse at center,
    transparent 35%,
    rgba(0, 0, 0, 0.55) 92%
  );
}

/* CRT scanlines — was the worst offender (67% of frame time on Firefox)
   when done as a per-frame "overlay" blend fillRect. As a fixed CSS
   pseudo-element it's effectively free. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.04) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: overlay;
}

/* Score — top center, big, Asteroids-style */
#score {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Press Start 2P", "VT323", "Courier New", monospace;
  font-size: clamp(26px, 4.4vw, 56px);
  letter-spacing: 0.10em;
  color: var(--fg);
  text-shadow:
    0 0 10px var(--cyan),
    0 0 24px var(--cyan),
    0 0 48px rgba(92, 240, 255, 0.55);
  pointer-events: none;
  z-index: 11;
  user-select: none;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1;
}

/* HUD */
#hud {
  position: fixed;
  top: 18px;
  left: 18px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-shadow: 0 0 8px var(--cyan), 0 0 16px rgba(92, 240, 255, 0.4);
  pointer-events: none;
  z-index: 10;
  user-select: none;
}
#hud .row {
  display: flex;
  gap: 14px;
  padding: 3px 0;
  font-variant-numeric: tabular-nums;
}
#hud .lbl {
  color: var(--cyan);
  opacity: 0.65;
}
#hud .bar {
  margin-top: 8px;
  width: 132px;
  height: 5px;
  border: 1px solid var(--cyan);
  box-shadow: 0 0 8px rgba(92, 240, 255, 0.5);
  padding: 1px;
}
#hud #speedbar {
  height: 100%;
  width: 0%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  transition: width 60ms linear;
}

/* Start overlay */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at center, rgba(4, 6, 10, 0.65) 0%, rgba(4, 6, 10, 0.95) 75%);
  z-index: 20;
  text-align: center;
}
.overlay.hidden { display: none; }

.overlay .title {
  font-size: clamp(48px, 11vw, 132px);
  letter-spacing: 0.18em;
  font-weight: 700;
  line-height: 1;
}
.overlay .title .g1 {
  color: var(--fg);
  text-shadow: 0 0 12px var(--cyan), 0 0 36px var(--cyan);
}
.overlay .title .g2 {
  margin-left: 0.18em;
  color: var(--amber);
  text-shadow: 0 0 12px var(--amber), 0 0 36px var(--amber);
}

.overlay .sub {
  margin-top: 14px;
  color: var(--cyan);
  letter-spacing: 0.5em;
  opacity: 0.7;
  font-size: 12px;
}

.overlay .ctrls {
  margin: 36px 0 18px;
  line-height: 2.2;
  font-size: 13px;
  letter-spacing: 0.2em;
  opacity: 0.92;
}
.overlay .ctrls-or {
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--amber);
  opacity: 0.75;
  text-shadow: 0 0 8px var(--amber);
}
.overlay kbd {
  display: inline-block;
  padding: 2px 8px;
  margin: 0 2px;
  border: 1px solid var(--cyan);
  border-radius: 2px;
  font-family: inherit;
  color: var(--fg);
  box-shadow: 0 0 8px rgba(92, 240, 255, 0.5);
  background: rgba(92, 240, 255, 0.05);
}

.overlay .hint {
  margin-top: 28px;
  letter-spacing: 0.4em;
  font-size: 12px;
  color: var(--amber);
  text-shadow: 0 0 10px var(--amber);
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0.15; } }
