/* Base : tokens, reset, mise en page portrait plein écran. */
:root {
  --bg: #0b130b;
  --panel: #14201a;
  --panel-2: #1b2b22;
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef3ea;
  --muted: #9bb09f;
  --gold: #ffd25e;
  --life: #ff6b6b;
  --p0: #4f8dff;
  --p1: #b36bff;
  --accent: #5ed07a;
  --radius: 12px;
  --gutter: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background:
    radial-gradient(120% 80% at 50% 0%, #17301c 0%, var(--bg) 60%);
}

#app {
  position: relative; /* ancre du terrain plein écran, du HUD, du dock et du menu d’accueil */
  height: 100dvh;
  max-width: min(600px, calc(100dvh * 0.62)); /* écran large : une colonne portrait centrée, pas un étirement */
  margin: 0 auto;
  overflow: hidden;
}

/* terrain : le canvas occupe TOUT l'écran, HUD et dock se superposent (css/hud.css) */
.stage { position: absolute; inset: 0; overflow: hidden; }
#game { position: absolute; left: 0; top: 0; display: block; touch-action: none; background: #5aa8ee; }

.toast {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translate(-50%, -8px);
  max-width: calc(100% - 32px);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(10, 16, 10, 0.92);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(255, 107, 107, 0.6); }

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 10, 5, 0.7);
  backdrop-filter: blur(3px);
}
.overlay[hidden] { display: none; }
.overlay-card {
  padding: 22px 26px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: center;
  display: grid;
  gap: 10px;
}
.overlay-card h2 { margin: 0; font-size: 22px; }
.overlay-card p { margin: 0; color: var(--muted); }

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px; /* cible tactile */
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s, filter 0.15s;
}
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: linear-gradient(#3fae5f, #2c8a49); border-color: rgba(255, 255, 255, 0.18); }
.btn-ghost { background: transparent; }
.btn[hidden] { display: none; }
