:root {
  --fond: #0e0f0d;
  --fond-2: #151614;
  --fond-3: #1b1c1a;
  --trait: #2a2b29;
  --texte: #e8f5ee;
  --texte-2: #c4d6cc;
  --texte-3: #9fb3a8;
  --vert: #6be6b0;
  --signal: #22eaac;
  --orange: #ff8a4c;
  --jaune: #ffd27a;
  --bleu: #7fd4ff;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--fond); color: var(--texte); font-family: var(--mono); }
body { min-height: 100vh; }
a { color: var(--vert); }
a:hover { color: var(--signal); }
button, input, textarea { font-family: var(--mono); font-size: 16px; }

/* Fond 3D */
/* pointer-events: none : un clic droit sur le fond doit ouvrir le menu de la page (« Afficher le code source »), pas celui d’une image. */
#fond3d { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; pointer-events: none; }
.scanlines { position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.03) 0 1px, transparent 1px 4px); }

/* Barre du haut */
.hud { position: fixed; top: 0; left: 0; right: 0; z-index: 20; height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 24px; background: rgba(14,15,13,0.88); border-bottom: 1px solid var(--trait); backdrop-filter: blur(6px); font-size: 14px; color: var(--texte-3); }
.hud .marque { display: flex; align-items: center; gap: 12px; color: var(--texte); font-weight: 700; letter-spacing: 2px; }
.hud .carre { width: 14px; height: 14px; border: 3px solid var(--vert); }
.hud .stats { display: flex; gap: 22px; align-items: center; }
.hud .stats b { color: var(--texte); }
.hud .pts b { color: var(--vert); }

/* Mise en page */
.page { position: relative; z-index: 2; min-height: 100vh; padding: 110px 64px 140px; max-width: 1180px; }
.surtitre { font-size: 14px; letter-spacing: 3px; color: var(--texte-3); text-transform: uppercase; }
h1.titre { font-family: var(--sans); font-size: clamp(48px, 7vw, 96px); line-height: 0.95; font-weight: 600; margin: 18px 0 26px; letter-spacing: -1px; }
.titre .vert { color: var(--vert); }
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after { content: attr(data-texte); position: absolute; left: 0; top: 0; opacity: .55; pointer-events: none; }
.glitch::before { color: var(--orange); transform: translate(4px, 2px); animation: glitch 3.2s infinite steps(1); }
.glitch::after { color: var(--signal); transform: translate(-4px, -2px); animation: glitch 2.7s infinite reverse steps(1); }
@keyframes glitch { 0%, 92%, 100% { clip-path: inset(0 0 0 0); } 93% { clip-path: inset(10% 0 60% 0); transform: translate(10px, 0); } 96% { clip-path: inset(60% 0 10% 0); transform: translate(-10px, 0); } }
p.lead { font-size: 18px; line-height: 1.65; color: var(--texte-2); max-width: 640px; }
.carte { background: rgba(21,22,20,0.92); border: 1px solid var(--trait); padding: 28px; }
.carte.pointilles { border: 2px dashed #3a3b39; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 52px; padding: 0 26px; border: none; cursor: pointer;
  background: var(--vert); color: #0e0f0d; font-weight: 700; text-decoration: none; transition: transform .1s, background .2s; }
.btn:hover { background: var(--signal); color: #0e0f0d; transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--vert); border: 2px solid var(--vert); }
.champ { height: 52px; padding: 0 16px; background: #0b0c0a; color: var(--texte); border: 1px solid #3a3b39; outline: none; min-width: 0; }
.champ:focus { border-color: var(--vert); }
.ligne-form { display: flex; gap: 12px; flex-wrap: wrap; }
.erreur { color: var(--orange); min-height: 24px; margin-top: 10px; }
.secoue { animation: secoue .4s; }
@keyframes secoue { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ARIA */
.aria-bouton { position: fixed; right: 24px; bottom: 24px; z-index: 30; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 22px 0 14px;
  background: var(--fond-2); color: var(--texte); border: 2px solid var(--vert); cursor: pointer; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.aria-bouton .oeil { width: 30px; height: 30px; background: var(--vert); animation: pulse 2s infinite; }
.aria-bouton.nouveau { animation: rebond 1s 3; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(107,230,176,0.15); } }
@keyframes rebond { 50% { transform: translateY(-8px); } }
.aria-panneau { position: fixed; right: 24px; bottom: 100px; z-index: 30; width: min(420px, calc(100vw - 48px)); max-height: calc(100vh - 180px); overflow: auto;
  background: rgba(14,15,13,0.97); border: 1px solid var(--vert); padding: 22px; display: none; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.aria-panneau.ouvert { display: flex; }
.aria-panneau .entete { display: flex; justify-content: space-between; align-items: center; color: var(--vert); font-weight: 700; letter-spacing: 2px; }
.aria-panneau .fermer { background: none; border: none; color: var(--texte-3); cursor: pointer; font-size: 22px; width: 44px; height: 44px; }
.bulle { background: #0b120e; border-left: 3px solid var(--vert); padding: 14px 16px; line-height: 1.55; color: var(--texte-2); font-size: 15px; }
.bulle.indice { border-left-color: var(--jaune); }
.bulle .etiquette { display: block; font-size: 12px; color: var(--jaune); margin-bottom: 6px; letter-spacing: 1px; }

/* Le savais-tu ? (bouton ampoule en bas à gauche, pendant d’ARIA) */
.savoir-bouton { position: fixed; left: 24px; bottom: 24px; z-index: 30; display: flex; align-items: center; justify-content: center; width: 60px; height: 60px; padding: 0;
  background: var(--fond-2); color: var(--jaune); border: 2px solid var(--jaune); cursor: pointer; box-shadow: 0 10px 40px rgba(0,0,0,.5); font-size: 14px; }
.savoir-bouton:not(.lu) svg { animation: lueur 2.4s infinite; }
.savoir-bouton.lu { border-color: var(--trait); color: var(--texte-3); }
@keyframes lueur { 50% { filter: drop-shadow(0 0 6px var(--jaune)); } }
.savoir-panneau { position: fixed; left: 24px; bottom: 100px; z-index: 30; width: min(400px, calc(100vw - 48px)); max-height: calc(100vh - 180px); overflow: auto;
  background: rgba(14,15,13,0.97); border: 1px solid var(--jaune); padding: 22px; display: none; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.savoir-panneau.ouvert { display: flex; }
.savoir-panneau .entete { display: flex; justify-content: space-between; align-items: center; color: var(--jaune); font-weight: 700; letter-spacing: 2px; }
.savoir-panneau .fermer { background: none; border: none; color: var(--texte-3); cursor: pointer; font-size: 22px; width: 44px; height: 44px; }
.bulle.savoir { border-left-color: var(--jaune); }
.bulle.savoir strong { display: block; color: var(--texte); margin-bottom: 6px; }
.bulle.savoir p { margin: 0; white-space: pre-line; }
.savoir-points { margin: 0; font-size: 13px; color: var(--texte-3); }
@media (prefers-reduced-motion: reduce) { .savoir-bouton svg { animation: none !important; } }

/* Toasts */
.toasts { position: fixed; top: 70px; right: 24px; z-index: 40; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--fond-2); border: 1px solid var(--vert); color: var(--texte); padding: 14px 18px; max-width: 360px; animation: entre .3s; }
.toast.alerte { border-color: var(--orange); }
@keyframes entre { from { transform: translateX(30px); opacity: 0; } }

/* Connexion au serveur perdue (NC.api) : au-dessus de tout, y compris du voile des transitions */
.hors-ligne { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; width: min(560px, calc(100% - 32px));
  background: var(--orange); color: #0e0f0d; font-weight: 700; padding: 14px 20px; text-align: center; line-height: 1.4; }

/* Célébration */
.celebration { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(5,6,5,0.88); }
.celebration .boite { position: relative; text-align: center; display: flex; flex-direction: column; gap: 18px; align-items: center; padding: 40px; }
.celebration .grand { font-family: var(--sans); font-size: clamp(44px, 8vw, 96px); font-weight: 700; color: var(--vert); letter-spacing: -1px; line-height: 1; }
.celebration .sous { font-size: 20px; color: var(--texte-2); max-width: 620px; line-height: 1.5; }
.confetti { position: fixed; width: 10px; height: 10px; z-index: 51; pointer-events: none; animation: explose 1.4s cubic-bezier(.1,.8,.3,1) forwards; }
@keyframes explose { to { transform: translate(var(--dx), var(--dy)) rotate(720deg); opacity: 0; } }

.avert-mobile { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(14, 15, 13, .92); }
.avert-carte { max-width: 420px; padding: 28px 24px; background: var(--fond-2); border: 1px solid var(--vert); }
.avert-carte h2 { margin: 0 0 16px; font-size: 22px; line-height: 1.3; color: var(--vert); }
.avert-carte p { margin: 0 0 14px; font-size: 16px; line-height: 1.6; color: var(--texte-2); }
.avert-carte .btn { margin-top: 8px; width: 100%; }

@media (max-width: 760px) {
  .page { padding: 90px 20px 140px; }
  .hud .stats .niv { display: none; }
}
