:root {
  --nuit: #0d1030;
  --nuit2: #1b1748;
  --violet: #3b2a72;
  --or: #ffd27a;
  --or2: #f0b44c;
  --rose: #ff8fb1;
  --rose2: #ff5c8a;
  --creme: #fff7ec;
  --encre: #2d2440;
  --doux: #7a6f93;
  --pixel: 'Pixelify Sans', system-ui, sans-serif;
  --police: 'Quicksand', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--nuit); }
body {
  min-height: 100vh;
  font-family: var(--police);
  font-weight: 500;
  color: var(--creme);
  background: radial-gradient(120% 60% at 50% 0%, #241c5e 0%, var(--nuit) 65%) var(--nuit);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body.bloque { overflow: hidden; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }

main { max-width: 560px; margin: 0 auto; padding: 0 16px calc(40px + env(safe-area-inset-bottom)); }

/* ---------- Scène ---------- */
.ciel { margin: 0 -16px; overflow: hidden; }
#scene { display: block; margin: 0 auto; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: manipulation; }

.titre { text-align: center; margin-top: 14px; }
.titre h1 {
  font-family: var(--pixel); font-weight: 600; font-size: 34px; color: var(--or); letter-spacing: 1px;
  text-shadow: 0 0 18px rgba(255, 210, 122, 0.45), 3px 3px 0 #5a3a7a;
}
#sous-titre { color: #cfc6ee; font-size: 15px; margin-top: 6px; line-height: 1.4; }
.compteur { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--or); }
.compteur span { background: rgba(255, 255, 255, 0.07); padding: 4px 10px; border-radius: 99px; font-variant-numeric: tabular-nums; }

/* ---------- Grille ---------- */
.grille { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 20px; perspective: 900px; }
.case { position: relative; aspect-ratio: 1; transform: rotate(var(--r, 0deg)); transition: transform 0.2s; }
.case:active { transform: rotate(var(--r, 0deg)) scale(0.94); }
.case-in { position: absolute; inset: 0; transition: transform 0.8s cubic-bezier(0.3, 1.4, 0.5, 1); transform-style: preserve-3d; -webkit-transform-style: preserve-3d; }
.case.ouverte .case-in { transform: rotateY(180deg); }
.face, .dos {
  position: absolute; inset: 0; border-radius: 12px; display: grid; place-items: center; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), inset 0 0 0 2px rgba(255, 255, 255, 0.08);
}
.face { background: var(--fond); }
.c0 { --fond: linear-gradient(145deg, #3b2a72, #2a1f57); }
.c1 { --fond: linear-gradient(145deg, #7a2848, #5a1c37); }
.c2 { --fond: linear-gradient(145deg, #1f5a52, #16423d); }
.c3 { --fond: linear-gradient(145deg, #234a85, #193566); }
.c4 { --fond: linear-gradient(145deg, #6a3b7d, #4d2a5c); }
.finale { --fond: linear-gradient(145deg, #f0b44c, #c9862c); }
/* le ruban */
.face::before, .face::after { content: ''; position: absolute; background: rgba(255, 143, 177, 0.85); }
.face::before { left: 50%; top: 0; bottom: 0; width: 16%; transform: translateX(-50%); }
.face::after { top: 50%; left: 0; right: 0; height: 16%; transform: translateY(-50%); }
.finale .face::before, .finale .face::after { background: rgba(255, 255, 255, 0.75); }
.num {
  position: relative; z-index: 1; width: 58%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: var(--creme); color: var(--encre); font-family: var(--pixel); font-weight: 600; font-size: clamp(14px, 4.6vw, 22px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
.dos { transform: rotateY(180deg); background: linear-gradient(145deg, #ff8fb1, #ffd27a); background-size: cover; background-position: center; }
.dos-emoji { font-size: clamp(18px, 6vw, 28px); }
.dos.morceau { background-size: 500% 500%; }
.dos.morceau .dos-emoji { width: 58%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 247, 236, 0.88); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2); transition: opacity 0.8s; }
.grille.complete .dos-emoji { opacity: 0; }
/* La fin : Merci Lisa */
.fin-calendrier { margin-top: 18px; text-align: center; animation: monte 0.8s both; }
.fin-calendrier[hidden] { display: none; }
.fin-calendrier .merci { margin: 0 0 10px; font-family: var(--pixel); font-size: 30px; color: var(--or); text-shadow: 0 0 18px rgba(255, 210, 122, 0.5); }
.fin-calendrier .btn-photo { margin: 0; }
/* Le 25 : toutes les cases retournées forment la photo */
.grille { transition: gap 1.4s ease; }
.grille.complete { gap: 0; }
.grille.complete .case { transform: none; transition: transform 1.4s ease; }
.grille.complete .dos { border-radius: 0; box-shadow: none; inset: -0.6px; transition: border-radius 1.4s; }
.grille.complete .num-dos { opacity: 0; transition: opacity 1s; }
.grille.complete::after { content: 'Ma photo préférée de toi 💛'; grid-column: 1 / -1; text-align: center; margin-top: 12px; font-family: var(--pixel); color: var(--or, #ffd27a); animation: photoApparait 2s ease both; }
@keyframes photoApparait { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.num-dos {
  position: absolute; top: 4px; left: 4px; font-family: var(--pixel); font-size: 11px; color: var(--encre);
  background: rgba(255, 247, 236, 0.85); border-radius: 6px; padding: 0 4px;
}
.verrouillee .face { filter: saturate(0.55) brightness(0.75); }
.dispo { animation: sautille 2.4s ease-in-out infinite; }
.dispo .face { box-shadow: 0 0 0 2px var(--or), 0 0 18px 4px rgba(255, 210, 122, 0.55), 0 4px 0 rgba(0, 0, 0, 0.35); }
@keyframes sautille {
  0%, 100% { transform: rotate(var(--r)) translateY(0); }
  50% { transform: rotate(var(--r)) translateY(-4px); }
}
.secoue { animation: secoue 0.45s; }
@keyframes secoue {
  0%, 100% { translate: 0; }
  20% { translate: -5px; }
  40% { translate: 5px; }
  60% { translate: -3px; }
  80% { translate: 3px; }
}


/* ---------- Intro ---------- */
.intro {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(90% 60% at 50% 40%, #2a2066, var(--nuit)); text-align: center; padding: 24px;
  transition: opacity 0.8s, transform 0.8s;
}
.intro.partie { opacity: 0; transform: scale(1.08); pointer-events: none; }
.intro-etoiles { position: absolute; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 28% 72%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 78% 22%, #fff3d1, transparent), radial-gradient(1px 1px at 88% 64%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 52% 10%, #fff, transparent), radial-gradient(1px 1px at 65% 85%, #fff3d1, transparent),
    radial-gradient(1px 1px at 8% 88%, #fff, transparent), radial-gradient(1.5px 1.5px at 40% 40%, #d8dcff, transparent);
  animation: scintille 3s ease-in-out infinite alternate;
}
@keyframes scintille { from { opacity: 0.5; } to { opacity: 1; } }
.intro-pour { font-family: var(--pixel); color: #cfc6ee; font-size: 20px; }
.intro-nom {
  font-family: var(--pixel); font-weight: 600; font-size: 88px; line-height: 1; color: var(--or);
  text-shadow: 0 0 30px rgba(255, 210, 122, 0.5), 5px 5px 0 #5a3a7a; animation: flotte 3s ease-in-out infinite;
}
@keyframes flotte { 50% { transform: translateY(-8px); } }
.intro-txt { color: #cfc6ee; margin-bottom: 18px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-block; margin-top: 14px; padding: 12px 22px; border-radius: 99px; text-decoration: none;
  background: var(--or); color: var(--encre); font-weight: 700; font-size: 16px;
  box-shadow: 0 4px 0 var(--or2); transition: transform 0.1s, box-shadow 0.1s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--or2); }
.btn:disabled { opacity: 0.5; }
.btn-grand { font-size: 19px; padding: 14px 30px; }
.btn-discret { background: transparent; box-shadow: none; color: var(--doux); font-size: 14px; text-decoration: underline; padding: 6px; }

/* ---------- Fenêtre ---------- */
.modale {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(8, 8, 30, 0.65); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modale[hidden] { display: none; }
.carte-modale {
  position: relative; width: 100%; max-width: 460px; max-height: 88vh; max-height: 88dvh; overflow-y: auto;
  background: var(--creme); color: var(--encre); border-radius: 24px; padding: 26px 20px 26px; text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); animation: carteTourne 0.75s cubic-bezier(0.25, 1.2, 0.45, 1); transform-origin: 50% 50%;
}
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
/* La fenêtre arrive en tournant, comme une carte qu'on retourne */
@keyframes carteTourne {
  0% { transform: perspective(1100px) rotateY(-120deg) scale(0.55); opacity: 0; }
  55% { transform: perspective(1100px) rotateY(14deg) scale(1.03); opacity: 1; }
  100% { transform: perspective(1100px) rotateY(0) scale(1); }
}
/* L'ouverture d'une case : elle se soulève, frissonne, perd son ruban, puis tourne sur elle-même */
.case.ouverture { z-index: 5; animation: deballe 1.1s cubic-bezier(0.4, 0, 0.3, 1) forwards; }
.case.ouverture .face { box-shadow: 0 0 0 3px var(--or), 0 0 30px 10px rgba(255, 210, 122, 0.8); }
.case.ouverture .face::before { animation: rubanV 0.6s 0.35s forwards; }
.case.ouverture .face::after { animation: rubanH 0.6s 0.35s forwards; }
@keyframes deballe {
  0% { transform: rotate(var(--r)); }
  12% { transform: translateY(-8px) rotate(-7deg) scale(1.08); }
  22% { transform: translateY(-8px) rotate(6deg) scale(1.1); }
  32% { transform: translateY(-10px) rotate(-5deg) scale(1.12); }
  42% { transform: translateY(-10px) rotate(3deg) scale(1.15); }
  100% { transform: translateY(-14px) perspective(600px) rotateY(720deg) scale(1.35); }
}
@keyframes rubanV { to { transform: translate(-50%, -140%) rotate(25deg); opacity: 0; } }
@keyframes rubanH { to { transform: translate(140%, -50%) rotate(-25deg); opacity: 0; } }
.effet { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 65; pointer-events: none; }
.fermer { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border-radius: 50%; font-size: 26px; line-height: 1; color: var(--doux); }
.m-tete { display: inline-block; font-family: var(--pixel); font-size: 15px; background: var(--encre); color: var(--or); padding: 4px 12px; border-radius: 99px; }
.m-num { font-weight: 600; }
.m-titre { font-size: 23px; font-weight: 700; margin: 12px 0 6px; line-height: 1.25; }
.m-corps { margin-top: 8px; }
.texte { font-size: 16px; line-height: 1.6; margin-top: 10px; }
.question { font-size: 18px; font-weight: 700; margin: 12px 0; line-height: 1.4; }
.media { display: block; width: 100%; border-radius: 16px; margin-top: 14px; }
.apres {
  margin-top: 18px; padding: 16px; border-radius: 16px; background: #fff; box-shadow: 0 3px 0 #eadfce; line-height: 1.6; text-align: left;
  animation: monte 0.6s both;
}
@keyframes monte { from { opacity: 0; transform: translateY(14px); } }

/* Lettre */
.lettre {
  margin-top: 14px; padding: 18px 18px 22px; border-radius: 14px; text-align: left; min-height: 160px;
  background: repeating-linear-gradient(#fffdf8 0 27px, #f1e6d3 27px 28px); box-shadow: 0 3px 0 #eadfce;
  font-size: 16px; line-height: 28px;
}
.curseur { animation: clignote 0.8s steps(1) infinite; color: var(--rose2); }
@keyframes clignote { 50% { opacity: 0; } }
.signature { text-align: right; margin-top: 14px; font-weight: 700; color: var(--rose2); }

/* Tu m'aimes ? */
.tma-zone { position: relative; height: 200px; margin-top: 8px; }
.btn-oui, .btn-non { position: absolute; margin: 0; }
.btn-oui { left: 30%; top: 50%; transform: translate(-50%, -50%); background: var(--rose); box-shadow: 0 4px 0 #e0668f; color: #fff; transition: transform 0.25s; z-index: 1; }
.btn-non { left: 58%; top: calc(50% - 22px); background: #e9e3f5; box-shadow: 0 4px 0 #cfc6e6; color: var(--doux); transition: left 0.2s, top 0.2s; white-space: nowrap; }
.tma-zone.reponse { display: grid; place-items: center; height: 120px; }
.gros-coeur { font-size: 64px; animation: battement 0.9s ease-in-out infinite; }
@keyframes battement { 30% { transform: scale(1.2); } 60% { transform: scale(1); } }

/* Roue */
.roue-boite { position: relative; width: min(300px, 100%); aspect-ratio: 1; margin: 18px auto 0; }
.roue { width: 100%; height: 100%; border-radius: 50%; box-shadow: 0 0 0 6px var(--encre), 0 8px 24px rgba(0, 0, 0, 0.25); transition: transform 5s cubic-bezier(0.12, 0.6, 0.08, 1); }
.roue-fleche { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 26px solid var(--rose2); filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.3)); }
.roue-res { min-height: 28px; margin-top: 12px; font-size: 18px; opacity: 0; transition: opacity 0.4s; }
.roue-res.montre { opacity: 1; }
.roue-chances { margin: 10px 0 0; font-family: var(--pixel); color: var(--doux); }
.roue-ajout { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; font-weight: 600; font-size: 14px; }
.roue-ajout input { width: 64px; padding: 8px; border: 2px solid #eadfce; border-radius: 12px; font: inherit; font-size: 16px; text-align: center; background: #fffdf8; color: inherit; }
.roue-ajout .btn { margin: 0; }

/* Grattage */
.grattage { position: relative; width: 100%; aspect-ratio: 16 / 10; margin-top: 14px; border-radius: 18px; overflow: hidden; box-shadow: 0 4px 0 #eadfce; }
.grattage-dessous { position: absolute; inset: 0; display: grid; place-items: center; padding: 18px; background: linear-gradient(135deg, #ffe1ea, #fff1cf); font-weight: 700; font-size: 17px; line-height: 1.5; }
.grattage-cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; transition: opacity 0.8s; }
.grattage-cv.parti { opacity: 0; pointer-events: none; }

/* Cartes à retourner */
.cartes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; perspective: 800px; }
.cf { position: relative; height: 110px; }
.cf-in { position: absolute; inset: 0; transition: transform 0.6s; transform-style: preserve-3d; -webkit-transform-style: preserve-3d; }
.cf.retournee .cf-in { transform: rotateY(180deg); }
.cf-face, .cf-dos { position: absolute; inset: 0; border-radius: 14px; display: grid; place-items: center; padding: 8px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.cf-face { background: linear-gradient(145deg, var(--violet), #2a1f57); color: var(--or); font-family: var(--pixel); font-size: 30px; box-shadow: 0 3px 0 #1d1640; }
.cf-dos { transform: rotateY(180deg); background: #fff; color: var(--encre); font-size: 13.5px; line-height: 1.35; box-shadow: 0 3px 0 #eadfce; }

/* Quiz */
.quiz-num { font-size: 13px; color: var(--doux); margin-top: 8px; }
.choix { display: block; width: 100%; margin-top: 8px; padding: 12px 16px; border-radius: 14px; background: #fff; box-shadow: 0 3px 0 #eadfce; text-align: left; font-weight: 600; }
.choix.bon { background: #d9f5e6; box-shadow: 0 3px 0 #9fd9b8; }
.choix.faux { background: #ffe0e6; box-shadow: 0 3px 0 #f4a9b9; }
.quiz-reac { min-height: 24px; margin-top: 12px; font-style: italic; color: var(--doux); line-height: 1.5; }
.quiz-score { font-size: 26px; font-family: var(--pixel); margin-top: 16px; }

/* Énigme */
.champ { width: 100%; padding: 13px 16px; border-radius: 14px; border: 2px solid #e6dccb; font: inherit; font-size: 16px; background: #fff; color: var(--encre); margin-top: 4px; }
.champ:focus { outline: none; border-color: var(--rose); }

/* Le ciel du 5 juillet, en plein écran */
.ciel-entrer { display: block; margin: 16px auto 0; }
.cp { position: fixed; inset: 0; z-index: 90; background: #05071f; touch-action: none; overscroll-behavior: none; animation: cpEntre 0.9s ease; }
@keyframes cpEntre { from { opacity: 0; transform: scale(1.1); } }
.cp-cv { position: absolute; inset: 0; display: block; touch-action: none; }
.cp-haut { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 14px 0; pointer-events: none; }
.cp-titre { display: grid; gap: 2px; color: var(--creme); font-size: 15px; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7); }
.cp-titre small { font-size: 12px; color: #d8d0f5; }
.cp-titre b { color: var(--or); font-weight: 700; }
.cp-fermer { pointer-events: auto; flex: none; width: 42px; height: 42px; border-radius: 50%; background: rgba(13, 16, 48, 0.6); color: #fff; font-size: 26px; line-height: 1; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cp-bas { position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: 8px; padding: 30px 14px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(5, 7, 31, 0), rgba(5, 7, 31, 0.55) 45%, rgba(5, 7, 31, 0.75)); }
.cp-carte { max-height: 34vh; overflow-y: auto; padding: 12px 14px; border-radius: 18px; background: rgba(255, 247, 236, 0.96); color: var(--encre); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45); }
.cp-carte[hidden] { display: none; }
.cp-carte h4 { font-size: 16px; color: var(--violet); margin-bottom: 4px; }
.cp-carte p { font-size: 14.5px; line-height: 1.45; }
.cp-carte.apparait { animation: monte 0.45s both; }
.cp-suivant { display: block; margin: 8px 0 0 auto; padding: 7px 16px; border-radius: 99px; background: var(--or); color: var(--encre); font-weight: 700; box-shadow: 0 3px 0 var(--or2); }
.cp-suivant[hidden] { display: none; }
.cp-outils { display: flex; justify-content: center; gap: 8px; }
.cp-outils button { padding: 9px 15px; border-radius: 99px; background: rgba(255, 255, 255, 0.15); color: #fff; font-weight: 700; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cp-outils .cp-visite { background: var(--rose); box-shadow: 0 3px 0 #e0668f; }
.cp-heure { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #d8d0f5; }
.cp-heure input { flex: 1; accent-color: var(--or); }
.cp-aide { text-align: center; font-size: 11.5px; color: rgba(216, 208, 245, 0.7); }

/* Ancienne carte du ciel */
.ciel5 { margin-top: 14px; padding: 14px 10px 12px; border-radius: 20px; background: linear-gradient(180deg, #11143a, #2a1f57); color: var(--creme); }
.ciel5 canvas { display: block; margin: 0 auto; touch-action: manipulation; }
.ciel-info { min-height: 40px; margin-top: 8px; font-size: 13.5px; line-height: 1.4; color: #e8e2ff; }
.ciel-info strong { color: var(--or); }
.ciel-heure { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: #cfc6ee; }
.ciel-heure input { flex: 1; accent-color: var(--or); }
.ciel-heure-txt { font-size: 12px; color: var(--or); margin-top: 4px; }

/* Notre histoire */
.histoire { margin-top: 12px; }
.h-ecran { position: relative; margin: 0 auto; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 0 #1d1640; }
.h-ecran canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; cursor: pointer; }
.h-bulles { position: absolute; inset: 0; pointer-events: none; }
.h-bulles .bulle { font-size: 15px; min-height: 26px; padding: 3px 7px; }
.h-bulles .bulle-texte { font-size: 12px; }
.h-legende { min-height: 48px; margin-top: 10px; font-size: 16px; font-weight: 600; line-height: 1.45; }
.h-legende.apparait { animation: monte 0.5s both; }
.h-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.h-nav .btn { margin-top: 4px; }
.h-points { font-family: var(--pixel); color: var(--doux); }

/* Carte de nos endroits */
.carte-lieux { margin-top: 12px; }
.cl-ecran { display: flex; justify-content: center; }
.cl-ecran canvas { display: block; border-radius: 14px; box-shadow: 0 4px 0 #1d1640; cursor: pointer; touch-action: manipulation; }
.cl-fiche { min-height: 74px; margin-top: 10px; line-height: 1.45; }
.cl-fiche strong { display: block; font-size: 17px; }
.cl-fiche p { margin: 4px 0 0; font-size: 15px; }
.cl-fiche.apparait { animation: monte 0.45s both; }
.cl-compte { margin: 4px 0 0; text-align: center; font-family: var(--pixel); color: var(--doux); }

/* Mini-jeu */
.jeu { position: relative; margin: 14px auto 0; max-width: 100%; border-radius: 14px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; box-shadow: 0 4px 0 #1d1640; }
.jeu canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
.jeu-hud { position: absolute; top: 6px; left: 8px; right: 8px; display: flex; justify-content: space-between; font-family: var(--pixel); font-size: 15px; color: #fff; text-shadow: 1px 1px 0 #000; pointer-events: none; }
.jeu-ecran {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 10px 14px; text-align: center; background: rgba(13, 16, 48, 0.85); color: var(--creme); font-size: 12.5px; line-height: 1.35;
}
.jeu-ecran h3 { font-family: var(--pixel); font-size: 21px; color: var(--or); }
.jeu-obj { color: var(--or); font-weight: 700; }
.jeu-ecran .btn { margin-top: 6px; padding: 8px 18px; font-size: 14px; }
.jeu-bulle {
  position: absolute; max-width: 70%; background: #fff; color: var(--encre); font-family: var(--pixel); font-size: 12px; line-height: 1.2;
  padding: 3px 8px; border-radius: 8px; pointer-events: none; opacity: 0; transform: translateY(-100%); transition: opacity 0.2s;
}
.jeu-bulle.montre { opacity: 1; }
.jeu-record { font-size: 13px; color: var(--doux); margin-top: 8px; }
.jeu-onglets { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.jeu-onglets .onglet { margin: 0; padding: 7px 12px; font-size: 13.5px; background: #efe6f7; color: var(--doux); box-shadow: none; }
.jeu-onglets .onglet.actif { background: var(--rose, #ff5c8a); color: #fff; }
.jeu-zone { display: flex; flex-direction: column; align-items: center; }
.course .jeu-hud { gap: 8px; }
.course-zone { position: absolute; top: 34px; left: 50%; transform: translateX(-50%); padding: 5px 12px; border-radius: 99px; background: rgba(13, 16, 48, 0.75); color: #fff; font-family: var(--pixel); font-size: 14px; white-space: nowrap; opacity: 0; pointer-events: none; }
.course-zone.montre { animation: zoneMontre 2.6s ease both; }
@keyframes zoneMontre { 0% { opacity: 0; transform: translate(-50%, -8px); } 15%, 75% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -4px); } }

/* Rougis pas */
.rougir { margin-top: 12px; padding: 14px; border-radius: 18px; background: linear-gradient(180deg, #1c1850, #3b2a72); }
.rougir-bulle { position: relative; display: inline-block; background: #fff; color: var(--encre); font-weight: 700; padding: 10px 14px; border-radius: 14px; min-height: 42px; line-height: 1.35; margin-bottom: 12px; }
.rougir-bulle::after { content: ''; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); border: 8px solid transparent; border-bottom: 0; border-top-color: #fff; }
.rougir-cv { display: block; margin: 0 auto; width: 100%; max-width: 320px; aspect-ratio: 80 / 44; border-radius: 12px; image-rendering: pixelated; image-rendering: crisp-edges; }
.rougir-jauge { height: 12px; margin: 12px 8px 0; border-radius: 99px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
.rougir-jauge span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #ffb3c8, #ff3b5c); transition: width 0.5s; }
.rougir-legende { color: var(--creme); font-size: 14px; margin-top: 6px; font-weight: 700; }
.tremble { animation: secoue 0.35s; }

/* Journal */
.journal {
  margin-top: 14px; padding: 16px 14px 18px; background: #f6f0e2; color: #1d1a16; text-align: left;
  font-family: 'Playfair Display', Georgia, serif; border-radius: 4px; box-shadow: 0 3px 0 #e2d6bd, 0 10px 24px rgba(0, 0, 0, 0.12);
  transform: rotate(-0.6deg); animation: deplie 0.7s cubic-bezier(0.3, 1.3, 0.5, 1);
}
@keyframes deplie { from { transform: rotate(-8deg) scale(0.7); opacity: 0; } }
.j-nom { font-size: 30px; font-weight: 900; text-align: center; line-height: 1; letter-spacing: -0.5px; }
.j-edition { font-size: 11px; text-align: center; border-top: 2px solid #1d1a16; border-bottom: 1px solid #1d1a16; padding: 4px 0; margin: 8px 0 12px; font-style: italic; }
.j-une { font-size: 22px; font-weight: 900; line-height: 1.15; }
.j-chapo { font-size: 14px; line-height: 1.45; margin: 8px 0 12px; font-style: italic; }
.j-colonnes { columns: 2; column-gap: 14px; column-rule: 1px solid #cbbd9f; }
.j-art { break-inside: avoid; margin-bottom: 12px; }
.j-rub { font-family: var(--police); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #a3302a; }
.j-art h4 { font-size: 15px; font-weight: 700; line-height: 1.2; margin: 2px 0 4px; }
.j-art p { font-size: 13px; line-height: 1.4; font-family: Georgia, 'Times New Roman', serif; }
.j-chapo { font-family: Georgia, 'Times New Roman', serif; }

.note-sami { margin-top: 14px; padding: 14px; border-radius: 14px; background: #fff3c4; border: 2px dashed var(--or2); text-align: left; line-height: 1.5; }

/* ---------- Divers ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none; transition: 0.35s;
  background: var(--creme); color: var(--encre); padding: 11px 18px; border-radius: 99px; font-weight: 700; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); max-width: calc(100vw - 32px); text-align: center;
}
.toast.montre { transform: translate(-50%, 0); opacity: 1; }
.confettis { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
.confettis span { position: absolute; top: -40px; animation: tombe linear forwards; }
@keyframes tombe { to { transform: translateY(110vh) rotate(540deg); } }
.btn-son {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 10px; z-index: 45; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(13, 16, 48, 0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); font-size: 18px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.ciel { position: relative; }
.ciel-bulles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.bulle {
  position: absolute; transform: translate(-50%, -100%); display: flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 34px; min-height: 30px; padding: 4px 8px; background: #fff; border: 2.5px solid #1a1530; border-radius: 16px;
  font-size: 19px; line-height: 1; white-space: nowrap; color: #1a1530; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25); animation: bullePop 0.25s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.bulle canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
.bulle-texte { font-family: var(--pixel); font-weight: 600; font-size: 15px; letter-spacing: 0.5px; }
.bulle.pensee::before, .bulle.pensee::after { content: ''; position: absolute; left: var(--queue, 50%); background: #fff; border: 2.5px solid #1a1530; border-radius: 50%; }
.bulle.pensee::before { width: 9px; height: 9px; bottom: -14px; transform: translateX(-60%); }
.bulle.pensee::after { width: 5px; height: 5px; bottom: -22px; transform: translateX(-20%); }
.bulle.parole::after { content: ''; position: absolute; left: var(--queue, 50%); bottom: -10px; transform: translateX(-50%); border: 7px solid transparent; border-top: 9px solid #1a1530; border-bottom: 0; }
.bulle.parole::before { content: ''; position: absolute; left: var(--queue, 50%); bottom: -6px; transform: translateX(-50%); z-index: 1; border: 5px solid transparent; border-top: 7px solid #fff; border-bottom: 0; }
@keyframes bullePop { from { transform: translate(-50%, -100%) scale(0.3); opacity: 0; } }
.btn-gr {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 10px; z-index: 45; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(13, 16, 48, 0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); font-size: 18px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}
/* Garde-robe */
.gr { position: fixed; inset: 0; z-index: 55; display: grid; place-items: end center; background: rgba(8, 8, 30, 0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.gr[hidden] { display: none; }
.gr-carte {
  position: relative; width: 100%; max-width: 520px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; background: var(--creme); color: var(--encre);
  border-radius: 24px 24px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); text-align: center; animation: monteFenetre 0.35s cubic-bezier(0.3, 1.2, 0.5, 1);
}
@keyframes monteFenetre { from { transform: translateY(100%); } }
.gr-titre { font-family: var(--pixel); font-size: 24px; color: var(--violet); }
.gr-onglets { display: inline-flex; gap: 4px; margin-top: 10px; background: #ece4f6; padding: 4px; border-radius: 99px; }
.gr-onglets button { padding: 7px 20px; border-radius: 99px; font-weight: 700; color: var(--doux); }
.gr-onglets button.actif { background: var(--violet); color: #fff; }
.gr-apercu { display: block; margin: 12px auto 4px; width: 96px; height: 138px; image-rendering: pixelated; image-rendering: crisp-edges; background: radial-gradient(circle at 50% 70%, #3b2a72, #1b1748); border-radius: 16px; padding: 6px 14px; box-sizing: content-box; }
.gr-apercu.saute { animation: saut 0.3s; }
@keyframes saut { 50% { transform: translateY(-6px); } }
.gr-section { text-align: left; margin-top: 12px; }
.gr-sous { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.gr-choix { display: flex; flex-wrap: wrap; gap: 6px; }
.gr-puce { padding: 7px 11px; border-radius: 99px; background: #fff; box-shadow: 0 2px 0 #eadfce; font-size: 13px; font-weight: 600; }
.gr-puce.choisi { background: var(--rose); color: #fff; box-shadow: 0 2px 0 #e0668f; }
.gr-pastille { width: 32px; height: 32px; padding: 0; border: 3px solid #fff; }
.gr-pastille.choisi { border-color: var(--rose2); box-shadow: 0 0 0 2px var(--rose2); }
.gr-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.bandeau-apercu {
  position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 40; font-size: 12px;
  background: rgba(0, 0, 0, 0.6); padding: 5px 10px; border-radius: 99px; color: #fff3c4;
}
.bandeau-apercu button { text-decoration: underline; margin-left: 4px; font-size: 12px; }
.bandeau-apercu { white-space: nowrap; max-width: calc(100vw - 110px); overflow-x: auto; }
.etat-liste { display: grid; gap: 6px; margin-top: 12px; text-align: left; }
.etat-ligne { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 12px; background: #fff; box-shadow: 0 2px 0 #eadfce; text-align: left; }
.etat-n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-family: var(--pixel); background: var(--encre); color: var(--or); }
.etat-txt { display: grid; gap: 2px; font-size: 14px; }
.etat-txt small { color: var(--doux); font-size: 12px; line-height: 1.35; }
.etat-completer { background: #fff7dc; }
.etat-preparer { background: #ffecec; }

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

.video-charge { margin: 6px 0 0; text-align: center; font-size: 13px; color: var(--doux); }

/* Rien ne doit faire glisser la fenêtre de côté sur iPhone (ex. le journal penché) */
.carte-modale { overflow-x: hidden; }
.journal { margin-left: 8px; margin-right: 8px; }

/* Safari (iPhone) laisse parfois voir le dos d'une case à travers sa face : on cache vraiment le côté qui ne doit pas se voir.
   Le changement se fait à mi-chemin du retournement (0,4 s). */
.face { transform: rotateY(0deg) translateZ(1px); -webkit-transform: rotateY(0deg) translateZ(1px); transition: visibility 0s linear 0.4s; }
.dos { -webkit-transform: rotateY(180deg) translateZ(1px); transform: rotateY(180deg) translateZ(1px); visibility: hidden; transition: visibility 0s linear 0.4s; }
.case.ouverte .face { visibility: hidden; }
.case.ouverte .dos { visibility: visible; }
