:root {
  --hud-bg: rgba(0, 0, 0, 0.45);
  --text: #e2e8f0;
  --muted: #cbd5e1;
  --font: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: #0d1528;
  color: var(--text);
}

#playfield {
  width: 100vw;
  height: 100vh;
  display: block;
  background: #0d1528;
}

.hud {
  position: fixed;
  top: 12px;
  left: 12px;
  display: none;
}

.hud-inline {
  grid-auto-flow: column;
  align-items: center;
  gap: 10px;
}

.status { color: var(--muted); font-size: 14px; }

.score {
  position: fixed;
  right: 18px;
  bottom: 16px;
  font-size: 58px;
  font-weight: 800;
  color: #fcd34d;
  text-shadow: 0 2px 8px rgba(0,0,0,0.35);
  pointer-events: none;
}

.score-topleft {
  top: 32px;
  left: 32px;
  right: auto;
  bottom: auto;
}

.score-pulse {
  animation: scorePulse 0.35s ease-out;
}

@keyframes scorePulse {
  0% { transform: scale(1.0); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1.0); }
}

.lives {
  font-size: 22px;
  color: #e2e8f0;
  text-shadow: 0 1px 4px rgba(0,0,0,0.35);
  margin-top: 4px;
}

#splash {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.82), rgba(0,0,0,0.95));
  z-index: 5;
}

#splash img {
  max-width: 80vw;
  max-height: 80vh;
  object-fit: contain;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.55));
}

.splash-hint {
  margin-top: 16px;
  color: #e2e8f0;
  font-weight: 600;
  letter-spacing: 0.04em;
}

#title-overlay {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 440px;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  z-index: 4;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.35));
}

.life-overlay {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 960px;
  max-width: 90vw;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 3;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4));
}

.life-overlay.visible {
  opacity: 1;
}

#gameover {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  z-index: 6;
}

#gameover img {
  max-width: 80vw;
  max-height: 80vh;
  object-fit: contain;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.55));
}

#touch-controls {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 40vh;
  display: none;
  opacity: 1;
  z-index: 4;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.touch-btn {
  position: absolute;
  height: 20vh;
  border: 1px solid rgba(226, 232, 240, 0.35);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  touch-action: none;
  user-select: none;
  pointer-events: auto;
}

#touch-left { left: 0; bottom: 0; width: 33.333%; }
#touch-fire { left: 33.333%; bottom: 0; width: 33.333%; }
#touch-right { left: 66.666%; bottom: 0; width: 33.333%; }

#touch-thrust {
  left: 33.333%;
  bottom: 20vh;
  width: 33.333%;
}

#touch-controls.touch-hidden {
  opacity: 0;
  pointer-events: none;
}

@media (hover: none) and (pointer: coarse) {
  #touch-controls { display: block; }
}
