/* Copter Cave — design rétro arcade, fond sombre et accents néon.
   Tout le style vit ici (CSP : style-src 'self'). Aucune police distante. */

:root {
  --bg: #05060a;
  --bg-soft: #0a0f1e;
  --cyan: #22d3ee;
  --cyan-dim: #0e7490;
  --magenta: #e879f9;
  --amber: #fbbf24;
  --text: #e2e8f0;
  --text-dim: #7c8aa5;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow: hidden;
  overscroll-behavior: none;
}

/* Conteneur plein écran : le jeu occupe tout le viewport. */
.game {
  position: fixed;
  inset: 0;
  background: var(--bg);
  touch-action: none;          /* bloque le scroll/zoom pendant le maintien */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* HUD : score affiché en jeu, en haut à gauche. */
.hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  z-index: 2;
  pointer-events: none;
}

.score {
  font-family: var(--mono);
  font-size: clamp(20px, 6vw, 34px);
  font-weight: 700;
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan), 0 0 20px rgba(34, 211, 238, 0.45);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

/* Écrans superposés (menu / game over). */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 3vh, 24px);
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(34, 211, 238, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(5, 6, 10, 0.72), rgba(5, 6, 10, 0.9));
  backdrop-filter: blur(2px);
}

.overlay[hidden] {
  display: none;
}

.title {
  font-family: var(--mono);
  font-weight: 800;
  font-size: clamp(40px, 14vw, 96px);
  line-height: 0.95;
  letter-spacing: 0.08em;
  color: var(--cyan);
  text-shadow:
    0 0 6px var(--cyan),
    0 0 18px rgba(34, 211, 238, 0.65),
    0 0 42px rgba(34, 211, 238, 0.35);
  animation: flicker 4s infinite;
}

.title--small {
  font-size: clamp(32px, 11vw, 72px);
  color: var(--magenta);
  text-shadow:
    0 0 6px var(--magenta),
    0 0 18px rgba(232, 121, 249, 0.6),
    0 0 42px rgba(232, 121, 249, 0.3);
}

.tagline {
  font-size: clamp(15px, 4vw, 20px);
  color: var(--text);
  letter-spacing: 0.04em;
}

.highscore {
  font-family: var(--mono);
  font-size: clamp(14px, 4vw, 18px);
  color: var(--amber);
}

.highscore__label {
  color: var(--text-dim);
}

.hint {
  font-family: var(--mono);
  font-size: clamp(11px, 3vw, 14px);
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.score-label {
  font-family: var(--mono);
  font-size: clamp(12px, 3.4vw, 15px);
  color: var(--text-dim);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.final-score,
.best-score {
  font-family: var(--mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.final-score {
  font-size: clamp(40px, 14vw, 80px);
  color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan), 0 0 26px rgba(34, 211, 238, 0.5);
}

.best-score {
  font-size: clamp(20px, 7vw, 34px);
  color: var(--amber);
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.btn {
  margin-top: 6px;
  padding: 14px 34px;
  font-family: var(--mono);
  font-size: clamp(15px, 4.5vw, 19px);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg);
  background: linear-gradient(180deg, #67e8f9, var(--cyan));
  border: 2px solid var(--cyan);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.55);
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}

.btn:hover {
  box-shadow: 0 0 22px rgba(34, 211, 238, 0.85);
}

.btn:active {
  transform: translateY(2px);
}

.btn:focus-visible {
  outline: 2px solid var(--magenta);
  outline-offset: 3px;
}

/* Léger clignotement néon du titre. */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.7; }
  94% { opacity: 1; }
  97% { opacity: 0.85; }
  98% { opacity: 1; }
}

/* Réduit les animations si l'utilisateur le demande. */
@media (prefers-reduced-motion: reduce) {
  .title {
    animation: none;
  }
}
