* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  overscroll-behavior: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

#game-canvas {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  touch-action: none;
  cursor: pointer;
  background: #05060f;
}

/* Effet CRT : scanlines + légère vignette, purement décoratif, désactivable
   (touche C) sans toucher au rendu du canvas lui-même. */
#crt-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.18) 0px,
      rgba(0, 0, 0, 0.18) 1px,
      rgba(0, 0, 0, 0) 2px,
      rgba(0, 0, 0, 0) 3px
    ),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.45) 100%);
  mix-blend-mode: multiply;
}
#crt-overlay.hidden {
  display: none;
}

/* Champ caché servant uniquement à ouvrir le clavier virtuel mobile pour la
   saisie du nom (game over) — jamais visible, le rendu du texte tapé se
   fait dans le canvas via js/hud.js. */
#name-input {
  position: absolute;
  top: -1000px;
  left: -1000px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  font-size: 16px; /* évite le zoom auto de Safari iOS au focus d'un input */
}

/* Contrôles musique : seul élément d'UI "réelle" du jeu (avec #name-input),
   volontairement en HTML plutôt qu'en canvas — un <input type="range"> se
   glisse nativement au doigt comme à la souris, pas besoin de réinventer le
   drag-and-drop dans le rendu du jeu pour ça. */
#music-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(5, 6, 15, 0.6);
  border: 1px solid rgba(78, 225, 255, 0.35);
  border-radius: 4px;
  font-family: monospace;
  z-index: 2;
}

#music-controls button {
  background: transparent;
  border: none;
  color: #cfe8ff;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
}
#music-controls button:hover,
#music-controls button:active {
  color: #4ee1ff;
}

#music-controls input[type="range"] {
  width: 64px;
  accent-color: #4ee1ff;
}

@media (max-width: 480px) {
  #music-controls {
    top: 4px;
    right: 4px;
    padding: 3px 6px;
    gap: 4px;
  }
  #music-controls input[type="range"] {
    width: 44px;
  }
}
