/* ==========================================================================
   STYLE.CSS — identité visuelle : arcade néon rétro
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

:root {
  --bg: #0a0114;
  --bg-2: #150524;
  --panel: #1b0830;
  --neon-pink: #ff2bd6;
  --neon-cyan: #29f5ff;
  --neon-violet: #9b3bff;
  --neon-yellow: #f6ff2b;
  --text: #efe6ff;
  --text-dim: #b6a6d9;
  --font-display: 'Press Start 2P', monospace;
  --font-body: 'VT323', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(ellipse at 50% -10%, var(--bg-2), var(--bg) 60%);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 22px;
  overflow-x: hidden;
}

/* ---- Scanlines CRT sur toute la page ---- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.035) 0px,
    rgba(255,255,255,0.035) 1px,
    transparent 2px,
    transparent 4px
  );
  mix-blend-mode: overlay;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 51;
  box-shadow: inset 0 0 12vw rgba(0,0,0,0.75);
}

/* ---- Particules flottantes en fond ---- */
.particules {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.particule {
  position: absolute;
  top: 110vh;
  color: var(--neon-violet);
  opacity: 0.5;
  animation: flotter linear infinite;
  text-shadow: 0 0 8px currentColor;
}
@keyframes flotter {
  to { transform: translateY(-130vh) rotate(360deg); opacity: 0; }
}

/* ---- Layout général ---- */
.ecran {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6vh 5vw;
  text-align: center;
}

.cadre-arcade {
  position: relative;
  width: min(720px, 100%);
  margin: 0 auto;
  background: linear-gradient(180deg, var(--panel), #10041e);
  border: 3px solid var(--neon-cyan);
  border-radius: 6px;
  box-shadow:
    0 0 12px var(--neon-cyan),
    0 0 40px rgba(41,245,255,0.25),
    inset 0 0 30px rgba(155,59,255,0.15);
  padding: 5vh 5vw;
}
.cadre-arcade::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 8px;
  padding: 3px;
  background: linear-gradient(120deg, var(--neon-pink), var(--neon-violet), var(--neon-cyan), var(--neon-pink));
  background-size: 300% 300%;
  animation: bordure 6s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: -1;
  opacity: 0.9;
}
@keyframes bordure {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

/* ---- Typographie ---- */
h1, h2, .titre-pixel {
  font-family: var(--font-display);
  line-height: 1.6;
  letter-spacing: 1px;
}
h1 {
  font-size: clamp(22px, 6vw, 40px);
  color: var(--neon-pink);
  text-shadow: 0 0 6px var(--neon-pink), 0 0 24px var(--neon-pink);
  margin: 0 0 0.6em;
  animation: glitchTitre 4s infinite;
}
@keyframes glitchTitre {
  0%, 90%, 100% { text-shadow: 0 0 6px var(--neon-pink), 0 0 24px var(--neon-pink); transform: translate(0,0); }
  91% { text-shadow: -2px 0 var(--neon-cyan), 2px 0 var(--neon-pink); transform: translate(-2px,1px); }
  92% { text-shadow: 2px 0 var(--neon-cyan), -2px 0 var(--neon-pink); transform: translate(2px,-1px); }
  93% { text-shadow: -1px 0 var(--neon-yellow), 1px 0 var(--neon-cyan); transform: translate(1px,0); }
  94%, 100% { text-shadow: 0 0 6px var(--neon-pink), 0 0 24px var(--neon-pink); transform: translate(0,0); }
}
h2 {
  font-size: clamp(14px, 3.6vw, 20px);
  color: var(--neon-cyan);
  text-shadow: 0 0 6px var(--neon-cyan);
  margin: 0 0 1em;
}
p, label { font-size: 1.3rem; color: var(--text-dim); line-height: 1.5; }
.eyebrow {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--neon-yellow);
  text-shadow: 0 0 6px var(--neon-yellow);
  letter-spacing: 3px;
  margin-bottom: 1.2em;
  display: inline-block;
  animation: clignoterNeon 1.4s ease-in-out infinite;
}
@keyframes clignoterNeon {
  0%, 100% { opacity: 1; text-shadow: 0 0 6px var(--neon-yellow), 0 0 18px var(--neon-yellow); }
  50% { opacity: 0.55; text-shadow: 0 0 2px var(--neon-yellow); }
}

/* ---- Boutons rétro ---- */
.btn {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--bg);
  background: var(--neon-yellow);
  border: none;
  padding: 1.1em 1.6em;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  margin-top: 1.5em;
  box-shadow: 0 0 10px var(--neon-yellow), 0 4px 0 #8a8f00;
  transition: transform 0.08s ease;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 10px var(--neon-yellow); }
.btn.secondaire {
  background: transparent;
  color: var(--neon-cyan);
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 10px rgba(41,245,255,0.5), 0 4px 0 #0a5a63;
}

/* ---- Champs de formulaire ---- */
input[type="text"], input[type="password"] {
  font-family: var(--font-body);
  font-size: 1.4rem;
  width: 100%;
  max-width: 420px;
  padding: 0.6em 0.8em;
  background: #05010a;
  border: 2px solid var(--neon-violet);
  color: var(--text);
  outline: none;
  margin: 0.8em 0;
  box-shadow: inset 0 0 10px rgba(155,59,255,0.4);
}
input:focus { border-color: var(--neon-cyan); box-shadow: inset 0 0 10px rgba(41,245,255,0.5); }

.erreur {
  font-family: var(--font-body);
  font-size: 1.2rem;
  color: var(--neon-pink);
  min-height: 1.4em;
  margin-top: 0.3em;
}
.secoue { animation: secouer 0.4s; }
@keyframes secouer {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.indice {
  margin-top: 1.4em;
  font-size: 1.1rem;
  color: var(--text-dim);
  opacity: 0.6;
  cursor: pointer;
}
.indice:hover { opacity: 1; }

/* ---- Barre de progression niveaux ---- */
.niveaux-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 2em;
  justify-content: center;
}
.pastille {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #2a1440;
  border: 2px solid var(--neon-violet);
}
.pastille.active {
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
}

/* ---- Galerie photos ---- */
.grille-photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5em;
  width: min(900px, 100%);
}
.carte-photo {
  background: var(--panel);
  border: 2px solid var(--neon-pink);
  box-shadow: 0 0 10px rgba(255,43,214,0.4);
  padding: 0.8em;
  transform: rotate(var(--rot, -1deg));
}
.carte-photo:nth-child(even) { --rot: 1.2deg; }
.carte-photo:nth-child(3n) { --rot: -0.6deg; }
.carte-photo img, .carte-photo .placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  background: repeating-linear-gradient(45deg, #24103d, #24103d 10px, #1a0b2c 10px, #1a0b2c 20px);
}
.carte-photo .placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--neon-cyan);
  text-align: center;
  padding: 1em;
}
.carte-photo figcaption {
  font-size: 1.15rem;
  color: var(--text-dim);
  margin-top: 0.5em;
}

/* ---- Jeu ---- */
.zone-jeu {
  position: relative;
  width: min(700px, 100%);
  height: 420px;
  background: #05010a;
  border: 3px solid var(--neon-violet);
  box-shadow: inset 0 0 30px rgba(155,59,255,0.4);
  overflow: hidden;
  margin: 1.5em auto;
  cursor: crosshair;
}
.coeur {
  position: absolute;
  font-size: 28px;
  color: var(--neon-pink);
  text-shadow: 0 0 8px var(--neon-pink);
  cursor: pointer;
  user-select: none;
  background: none;
  border: none;
  animation: tomber linear forwards;
}
@keyframes tomber {
  from { transform: translateY(-40px); }
  to { transform: translateY(440px); }
}
.coeur img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 0 6px var(--neon-pink));
}
.coeur.coeur-repli { font-size: 30px; }

/* ---- Jeu de montagne ---- */
.zone-montagne {
  position: relative;
  width: min(700px, 100%);
  height: 420px;
  margin: 1.5em auto;
  background: linear-gradient(180deg, #150524 0%, #05010a 100%);
  border: 3px solid var(--neon-violet);
  box-shadow: inset 0 0 30px rgba(155,59,255,0.4);
  overflow: hidden;
}
.silhouette-montagne {
  position: absolute;
  bottom: 0; left: 0; width: 100%; height: 100%;
  clip-path: polygon(0% 100%, 15% 60%, 30% 78%, 48% 30%, 65% 55%, 82% 20%, 100% 100%);
  background: linear-gradient(180deg, #2a1450, #120428);
  border-top: 2px solid var(--neon-cyan);
  opacity: 0.9;
}
.neige {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}
.flocon {
  position: absolute;
  top: -10%;
  color: #ffffff;
  text-shadow: 0 0 4px var(--neon-cyan);
  animation: neigeChute linear infinite;
}
@keyframes neigeChute {
  0% { transform: translateY(-10%) translateX(0); }
  50% { transform: translateY(200%) translateX(10px); }
  100% { transform: translateY(420%) translateX(-6px); }
}
.piste-montagne {
  position: absolute;
  left: 50%;
  bottom: 20px;
  top: 20px;
  width: 6px;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.08);
}
.grimpeur {
  position: absolute;
  left: 50%;
  bottom: 0%;
  transform: translate(-50%, 50%);
  font-size: 32px;
  transition: bottom 0.1s linear;
  filter: drop-shadow(0 0 8px var(--neon-yellow));
  z-index: 2;
}
.drapeau-sommet {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 28px;
  filter: drop-shadow(0 0 8px var(--neon-cyan));
  z-index: 2;
}
.barre-altitude-wrap {
  width: min(700px, 100%);
  height: 14px;
  background: #1b0830;
  border: 2px solid var(--neon-violet);
  margin: 0.5em auto 0;
}
.barre-altitude {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon-pink), var(--neon-yellow));
  box-shadow: 0 0 8px var(--neon-yellow);
  transition: width 0.1s linear;
}
.btn-grimpe {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--bg);
  background: var(--neon-cyan);
  border: none;
  padding: 1em 2em;
  cursor: pointer;
  margin-top: 1.5em;
  box-shadow: 0 0 14px var(--neon-cyan), 0 5px 0 #0a5a63;
  transition: transform 0.05s ease;
  user-select: none;
}
.btn-grimpe:active { transform: translateY(5px); box-shadow: 0 0 14px var(--neon-cyan); }
.rafale-alerte {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--neon-pink);
  text-shadow: 0 0 10px var(--neon-pink);
  z-index: 4;
  animation: rafaleAnim 0.9s ease-out forwards;
  pointer-events: none;
}
@keyframes rafaleAnim {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(1); }
}
.hud-jeu {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--neon-yellow);
  text-shadow: 0 0 6px var(--neon-yellow);
  display: flex;
  justify-content: space-between;
  width: min(700px, 100%);
  margin: 0 auto;
}

footer.mini {
  position: relative;
  z-index: 1;
  font-size: 1rem;
  color: var(--text-dim);
  opacity: 0.5;
  margin-top: 3em;
}

/* ---- Photo dans une énigme ---- */
.photo-enigme {
  width: min(420px, 100%);
  aspect-ratio: 4/3;
  object-fit: cover;
  border: 3px solid var(--neon-pink);
  box-shadow: 0 0 14px rgba(255,43,214,0.5);
  margin: 1em auto;
  display: block;
}
.photo-placeholder {
  width: min(420px, 100%);
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--neon-pink);
  box-shadow: 0 0 14px rgba(255,43,214,0.5);
  margin: 1em auto;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--neon-cyan);
  text-align: center;
  padding: 1em;
  background: repeating-linear-gradient(45deg, #24103d, #24103d 10px, #1a0b2c 10px, #1a0b2c 20px);
}

/* ---- Boîte indice / gage ---- */
.boite-indice {
  border: 2px dashed var(--neon-yellow);
  background: rgba(246,255,43,0.06);
  padding: 1.2em 1.4em;
  margin: 1.4em 0;
  text-align: left;
}
.boite-indice .label {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--neon-yellow);
  text-shadow: 0 0 6px var(--neon-yellow);
  display: block;
  margin-bottom: 0.6em;
}
.boite-indice p { color: var(--text); font-size: 1.3rem; margin: 0; }

/* ---- Section "déjà complété" ---- */
.deja-complete { opacity: 0.9; }

/* ---- Canvas jeu Pac-Man ---- */
.zone-pacman { position: relative; display: inline-block; margin-top: 0.5em; }
.canvas-jeu {
  border: 3px solid var(--neon-cyan);
  box-shadow: 0 0 12px var(--neon-cyan), inset 0 0 20px rgba(41,245,255,0.15);
  background: #05010a;
  display: block;
  max-width: 100%;
  height: auto;
}
.aide-touches { font-size: 1rem; opacity: 0.6; margin-top: 0.6em; }

/* ---- Pavé directionnel tactile (mobile-friendly pour le jeu Pac-Man) ---- */
.dpad {
  display: grid;
  grid-template-columns: 56px 56px 56px;
  grid-template-rows: 56px 56px;
  gap: 6px;
  justify-content: center;
  margin: 1.2em auto 0;
}
.dpad-btn {
  background: rgba(155,59,255,0.25);
  border: 2px solid var(--neon-violet);
  color: var(--neon-cyan);
  font-size: 20px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(155,59,255,0.4);
  user-select: none;
  touch-action: manipulation;
}
.dpad-btn:active { background: rgba(155,59,255,0.55); }
.dpad-haut { grid-column: 2; grid-row: 1; }
.dpad-gauche { grid-column: 1; grid-row: 2; }
.dpad-droite { grid-column: 3; grid-row: 2; }
.dpad-bas { grid-column: 2; grid-row: 2; }

/* ---- Barre de score globale (en haut, sur toutes les pages) ---- */
#barreScoreGlobale {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 34px;
  z-index: 60;
  background: linear-gradient(180deg, #150524, #0a0114);
  border-bottom: 2px solid var(--neon-cyan);
  box-shadow: 0 0 10px rgba(41,245,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2em;
  padding: 0 0.8em;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--neon-yellow);
  text-shadow: 0 0 6px var(--neon-yellow);
  letter-spacing: 1px;
}
#btnResetGlobal {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--neon-pink);
  text-shadow: 0 0 6px var(--neon-pink);
  background: transparent;
  border: 1px solid var(--neon-pink);
  border-radius: 3px;
  padding: 0.3em 0.6em;
  cursor: pointer;
  letter-spacing: 1px;
  white-space: nowrap;
}
#btnResetGlobal:hover { background: rgba(255,43,214,0.15); }

/* ---- Écran de chargement ---- */
#ecranChargement {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}
.chargement-inner { text-align: center; }
.chargement-titre {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--neon-cyan);
  text-shadow: 0 0 6px var(--neon-cyan);
  margin-bottom: 1.2em;
}
.barre-chargement-wrap {
  width: 260px;
  max-width: 60vw;
  height: 16px;
  background: #1b0830;
  border: 2px solid var(--neon-violet);
}
.barre-chargement {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon-pink), var(--neon-yellow));
  box-shadow: 0 0 8px var(--neon-yellow);
  transition: width 0.1s linear;
}
#contenuPrincipal { opacity: 0; transition: opacity 0.6s ease; }

@media (max-width: 480px) {
  body { font-size: 19px; }
  .cadre-arcade { padding: 6vh 6vw; }
  .zone-jeu { height: 320px; }
  .zone-montagne { height: 300px; }
  .hud-jeu { font-size: 11px; }
  #barreScoreGlobale { font-size: 10px; gap: 0.6em; }
  #btnResetGlobal { font-size: 9px; padding: 0.25em 0.5em; }
  .dpad { grid-template-columns: 48px 48px 48px; grid-template-rows: 48px 48px; }
  .dpad-btn { font-size: 17px; }
}
