:root {
  --bg: #05060A;
  --fg: #E8FBFF;
  --accent: #5FE3FF;
  --asteroid: #C9F5FF;
  --danger: #FF6B6B;
  --hud: #9FE8FF;
  --font-mono: 'VT323', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  line-height: 1.3;
  -webkit-user-select: none;
  user-select: none;
}

#stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
}

canvas#game {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: var(--bg);
  touch-action: none;
}

[hidden] { display: none !important; }

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: 18px 24px;
  z-index: 5;
}

.hud-score,
.hud-wave,
.hud-lives {
  position: absolute;
  top: 18px;
  color: var(--hud);
  font-size: 22px;
  letter-spacing: 1px;
  text-shadow: 0 0 6px rgba(159, 232, 255, 0.65);
}

.hud-score {
  left: 24px;
  line-height: 1.1;
}
.hud-score span { font-size: 28px; color: var(--fg); }

.hud-wave {
  left: 50%;
  transform: translateX(-50%);
  font-size: 20px;
}

.hud-lives {
  right: 24px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.hud-lives svg {
  width: 22px;
  height: 22px;
  overflow: visible;
}
.hud-lives svg path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px var(--accent));
}

.mobile-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  color: var(--hud);
  opacity: 0.75;
  z-index: 5;
  text-align: center;
  padding: 0 16px;
}

/* ---------- Overlay screens ---------- */
.overlay-screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  background: radial-gradient(ellipse at center, rgba(5,6,10,0.35) 0%, rgba(5,6,10,0.85) 75%);
  padding: 24px;
}

.title {
  font-size: 64px;
  margin: 0;
  letter-spacing: 6px;
  color: var(--fg);
}

.title.glow {
  text-shadow: 0 0 8px var(--accent), 0 0 22px var(--accent), 0 0 44px rgba(95, 227, 255, 0.5);
}

.title.danger {
  color: var(--danger);
  text-shadow: 0 0 8px var(--danger), 0 0 22px var(--danger), 0 0 44px rgba(255, 107, 107, 0.5);
}

.subtitle {
  font-size: 24px;
  letter-spacing: 6px;
  color: var(--accent);
  margin: 0 0 10px;
}

.subtitle.small {
  font-size: 18px;
  color: var(--hud);
  letter-spacing: 3px;
}

.controls-hint {
  list-style: none;
  padding: 0;
  margin: 8px 0 22px;
  font-size: 18px;
  color: var(--hud);
}
.controls-hint li { margin: 4px 0; }
.controls-hint .key {
  display: inline-block;
  min-width: 2.4em;
  padding: 1px 8px;
  margin-right: 8px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--fg);
  box-shadow: 0 0 6px rgba(95, 227, 255, 0.4);
}

.btn-action {
  font-family: var(--font-mono);
  font-size: 26px;
  letter-spacing: 3px;
  padding: 10px 38px;
  background: transparent;
  color: var(--fg);
  border: 2px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(95, 227, 255, 0.5);
  transition: box-shadow 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.btn-action:hover,
.btn-action:focus-visible {
  box-shadow: 0 0 18px var(--accent), 0 0 40px rgba(95, 227, 255, 0.6);
  background: rgba(95, 227, 255, 0.08);
  transform: translateY(-1px);
}

.btn-action:active {
  transform: translateY(0);
  box-shadow: 0 0 6px var(--accent);
}

.mobile-only-hint {
  display: none;
  font-size: 14px;
  color: var(--hud);
  opacity: 0.8;
  max-width: 320px;
}

.fatal-message {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  font-size: 22px;
  color: var(--fg);
  background: var(--bg);
}
.fatal-message[hidden] { display: none !important; }
.overlay-screen[hidden] { display: none !important; }

/* ---------- Responsive < 768px ---------- */
@media (max-width: 767px) {
  .title { font-size: 44px; letter-spacing: 3px; }
  .subtitle { font-size: 18px; letter-spacing: 3px; }
  .controls-hint { font-size: 15px; }
  .btn-action { font-size: 20px; padding: 8px 28px; }

  .hud-score,
  .hud-wave { font-size: 16px; }
  .hud-score span { font-size: 20px; }
  .hud-lives svg { width: 16px; height: 16px; }
  .hud-lives { gap: 5px; }

  .mobile-only-hint { display: block; }
  .mobile-hint { display: block; }
}

@media (min-width: 768px) {
  .mobile-hint { display: none; }
}
