/* base.css — reset, tokens, layout global, gate mobile */

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

:root {
  /* Échelle d'espacement (grille 4 px) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  /* Palette : nuit violette, sang de bandana, vert Ratz, or d'annif */
  --bg: #0a0812;
  --bg-2: #16112a;
  --surface: rgba(22, 17, 40, 0.82);
  --surface-border: rgba(150, 130, 200, 0.22);
  --text: #eae6f2;
  --muted: #9a92ad;
  --accent: #d0272f;
  --accent-dark: #7d1218;
  --green: #7da03c;
  --gold: #e8b64c;

  --font-display: "Creepster", cursive;
  --font-body: "Special Elite", "Courier New", monospace;

  --shadow-card: 0 20px 60px rgba(0, 0, 0, 0.6);
}

html,
body {
  height: 100%;
}

body {
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(120, 60, 160, 0.14), transparent 60%),
    radial-gradient(900px 600px at 85% 110%, rgba(208, 39, 47, 0.10), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 45%);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  overflow: hidden;
}

#stage {
  position: relative;
  z-index: 2;
  height: 100vh;
  perspective: 950px;
}

/* ── Écrans : un seul visible, piloté par body[data-screen] ── */
.screen {
  display: none;
  height: 100%;
  padding: var(--s-6);
  overflow-y: auto; /* garde-fou petits écrans : le panneau reste accessible */
}

/* margin:auto (et non align-items:center) : centre quand ça tient,
   déroule proprement depuis le haut quand ça déborde */
.screen > * {
  margin: auto;
}

body[data-screen="gate"] #screen-gate,
body[data-screen="welcome"] #screen-welcome,
body[data-screen="game"] #screen-game,
body[data-screen="birthday"] #screen-birthday {
  display: flex;
  animation: screen-in 700ms ease-out both;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Panneaux ── */
.panel {
  max-width: 860px;
  text-align: center;
  padding: var(--s-7);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(4px);
}

.panel-narrow {
  max-width: 560px;
}

/* ── Titres 3D lévitants ── */
.title-3d {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text);
  text-shadow:
    0 1px 0 #3a2b52,
    0 2px 0 #33254a,
    0 3px 0 #2c1f40,
    0 4px 0 #251a36,
    0 6px 2px rgba(0, 0, 0, 0.5),
    0 12px 24px rgba(0, 0, 0, 0.7);
  transform: rotateX(7deg) translateZ(24px);
  animation: float-title 6s ease-in-out infinite;
}

@keyframes float-title {
  0%,
  100% {
    transform: rotateX(7deg) translateZ(24px) translateY(0);
  }
  50% {
    transform: rotateX(7deg) translateZ(24px) translateY(-10px);
  }
}

.accent {
  color: var(--accent);
  text-shadow:
    0 1px 0 #5c0d12,
    0 2px 0 #4d0b0f,
    0 3px 0 #3f090c,
    0 6px 2px rgba(0, 0, 0, 0.5),
    0 0 32px rgba(208, 39, 47, 0.45);
}

.lead {
  color: var(--muted);
  margin-top: var(--s-4);
}

/* ── Boutons ── */
.btn {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--text);
  background: linear-gradient(180deg, #8e1a20, var(--accent-dark));
  border: 1px solid rgba(255, 120, 120, 0.35);
  border-radius: 10px;
  padding: var(--s-4) var(--s-6);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
  box-shadow: 0 6px 20px rgba(208, 39, 47, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
  box-shadow: 0 10px 28px rgba(208, 39, 47, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  cursor: wait;
  filter: grayscale(0.4) brightness(0.8);
  transform: none;
}

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

/* ── Gate mobile : en dessous de 900 px, seul l'écran-portail existe ──
   Géré en CSS pur : réactif au resize, aucune course avec l'init JS. */
@media (max-width: 899px) {
  #screen-gate {
    display: flex !important;
  }
  .screen:not(#screen-gate) {
    display: none !important;
  }
}

/* ── Repli reduced-motion (MOTION-1) ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
