/* =====================================================================
   La Grande Aventure des Découvertes — styles communs à toutes les pages
   (barre du haut, cartes, boutons 3D, quiz, memory, cartes à retourner,
   glisser-déposer, mascotte, badges, étoiles, scènes 3D)
   ===================================================================== */

:root {
  --accent: #ff6b35;
  --accent-fonce: #9d0208;
  --accent-clair: #fff1e6;
  --fond-1: #2c3e50;
  --fond-2: #151a22;
  --texte: #2b2d42;
  --carte: #fffdf8;
  --or: #ffd166;
  --vert: #38b000;
  --vert-fonce: #1f6f00;
  --rouge: #e63946;
  --rouge-fonce: #8d0801;
  --rayon: 26px;
  --police: 'Fredoka', 'Comic Sans MS', 'Segoe UI', sans-serif;
}
body.theme-accueil  { --accent: #7b2cbf; --accent-fonce: #3c096c; --accent-clair: #f3e8ff; --fond-1: #3c1a78; --fond-2: #0d0221; }
/* ambiance « jour » de l'accueil (soleil couchant), choisie dans le menu des réglages ; la nuit violette reste celle par défaut */
body.theme-accueil.ambiance-couchant { --accent: #e76f51; --accent-fonce: #9c3d1f; --accent-clair: #fff1e6; --fond-1: #c8553d; --fond-2: #2b0f1a; }
body.theme-volcans  { --accent: #e85d04; --accent-fonce: #9d0208; --accent-clair: #fff1e0; --fond-1: #4a1010; --fond-2: #120606; }
body.theme-corps    { --accent: #1d9bb8; --accent-fonce: #0b4f6c; --accent-clair: #e3f7fb; --fond-1: #0f6e7d; --fond-2: #0b2a3f; }
body.theme-pluie    { --accent: #2a7de1; --accent-fonce: #1d3557; --accent-clair: #e6f2ff; --fond-1: #4a8bbd; --fond-2: #142640; }
body.theme-ferme    { --accent: #3a9a3a; --accent-fonce: #1d5e2a; --accent-clair: #eaf7df; --fond-1: #7cc35a; --fond-2: #2a6a22; }
body.theme-pompiers { --accent: #e5383b; --accent-fonce: #8d0801; --accent-clair: #ffecec; --fond-1: #7d1919; --fond-2: #1f0303; }
body.theme-dinos    { --accent: #6a994e; --accent-fonce: #1b4332; --accent-clair: #eef6e4; --fond-1: #2d6a4f; --fond-2: #081c15; }
body.theme-police   { --accent: #2563eb; --accent-fonce: #1e3a8a; --accent-clair: #e8efff; --fond-1: #1e40af; --fond-2: #0b1026; }
body.theme-cafe     { --accent: #a0522d; --accent-fonce: #4a2c17; --accent-clair: #fbf1e4; --fond-1: #7a4a2a; --fond-2: #24130a; }
body.theme-maisons  { --accent: #d97706; --accent-fonce: #7c2d12; --accent-clair: #fff4e5; --fond-1: #b45309; --fond-2: #2b1407; }
body.theme-chateaux { --accent: #6d28d9; --accent-fonce: #3b0764; --accent-clair: #f3e8ff; --fond-1: #57534e; --fond-2: #1c1917; }
body.theme-paris    { --accent: #0284c7; --accent-fonce: #0c4a6e; --accent-clair: #e0f2fe; --fond-1: #1e3a8a; --fond-2: #0f0a2e; }
body.theme-londres  { --accent: #c8102e; --accent-fonce: #012169; --accent-clair: #fdecee; --fond-1: #3b4a6b; --fond-2: #10162b; }
body.theme-alphabet { --accent: #16a34a; --accent-fonce: #14532d; --accent-clair: #e8f8ee; --fond-1: #0f766e; --fond-2: #062925; }
body.theme-ecriture { --accent: #db2777; --accent-fonce: #831843; --accent-clair: #fdeaf3; --fond-1: #9d174d; --fond-2: #2a0717; }
body.theme-plateau  { --accent: #059669; --accent-fonce: #064e3b; --accent-clair: #e6f7f0; --fond-1: #065f46; --fond-2: #021c14; }
body.theme-labyrinthe { --accent: #0891b2; --accent-fonce: #164e63; --accent-clair: #e0f7fb; --fond-1: #155e75; --fond-2: #04141c; }
body.theme-sphinx   { --accent: #ca8a04; --accent-fonce: #713f12; --accent-clair: #fdf6e3; --fond-1: #a16207; --fond-2: #1f1503; }
body.theme-compter  { --accent: #ea580c; --accent-fonce: #7c2d12; --accent-clair: #fff1e6; --fond-1: #c2410c; --fond-2: #2a0e04; }
body.theme-lire     { --accent: #7c3aed; --accent-fonce: #4c1d95; --accent-clair: #f3ecff; --fond-1: #6d28d9; --fond-2: #1a0b3d; }
body.theme-chimie   { --accent: #0d9488; --accent-fonce: #134e4a; --accent-clair: #e6f8f6; --fond-1: #0f766e; --fond-2: #04201d; }
body.theme-techno   { --accent: #475569; --accent-fonce: #1e293b; --accent-clair: #eef2f7; --fond-1: #334155; --fond-2: #0b1120; }
body.theme-tri      { --accent: #65a30d; --accent-fonce: #365314; --accent-clair: #f1f9e6; --fond-1: #4d7c0f; --fond-2: #111c04; }
body.theme-politesse { --accent: #e11d48; --accent-fonce: #881337; --accent-clair: #ffeef2; --fond-1: #be123c; --fond-2: #2a0510; }
body.theme-piano    { --accent: #4361ee; --accent-fonce: #1d3557; --accent-clair: #eef1ff; --fond-1: #3a3f8f; --fond-2: #0d1033; }

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; overflow-x: clip; -webkit-text-size-adjust: 100%; }
/* rien ne doit faire défiler la page de côté sur téléphone (Safari iOS ignore overflow-x sur body seul) */
html, body { max-width: 100%; }
button, a, [data-zone], .jeton { -webkit-tap-highlight-color: transparent; }
canvas { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body {
  font-family: var(--police);
  color: #fff;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 0%, var(--fond-1), var(--fond-2) 75%) fixed;
  padding: 0 16px 120px;
  overflow-x: hidden;
}
/* pois lumineux qui défilent doucement derrière la page */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(rgba(255,255,255,0.13) 2px, transparent 2.5px),
    radial-gradient(rgba(255,255,255,0.07) 3px, transparent 3.5px);
  background-size: 48px 48px, 96px 96px;
  background-position: 0 0, 24px 24px;
  animation: pois 70s linear infinite;
}
@keyframes pois { to { background-position: 480px 960px, 504px 984px; } }

.page { max-width: 1000px; margin: 0 auto; }
img, svg, canvas { max-width: 100%; }
button { font-family: inherit; }
a { color: inherit; }

/* ===================== Barre du haut (HUD) ===================== */
.hud {
  position: sticky; top: 0; z-index: 80;
  margin: 0 -16px 10px; padding: 9px 16px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(8, 8, 28, 0.55);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.hud-nav {
  display: flex; gap: 6px; flex: 1; min-width: 0;
  overflow-x: auto; scrollbar-width: none; padding: 4px 2px;
}
.hud-nav::-webkit-scrollbar { display: none; }
.hud-lien {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 7px 13px; border-radius: 999px;
  color: #fff; text-decoration: none; font-weight: 600; font-size: 0.95rem;
  background: rgba(255,255,255,0.1);
  transition: transform 0.15s, background 0.2s;
  white-space: nowrap;
}
.hud-lien .e { font-size: 1.2em; }
.hud-lien:hover { background: rgba(255,255,255,0.22); transform: translateY(-2px) rotate(-2deg); }
.hud-lien.actif { background: var(--or); color: #3a2a00; }
.hud-droite { display: flex; align-items: center; gap: 8px; flex: none; }
.hud-etoiles {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(180deg, #ffe08a, #ffb703);
  color: #5a3a00; font-weight: 700; font-size: 1.05rem;
  padding: 6px 14px; border-radius: 999px;
  box-shadow: 0 3px 0 #c77d00;
  text-decoration: none;
}
.hud-etoiles.bump { animation: bump 0.45s; }
.hud-btn {
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,0.15); font-size: 1.2rem; color: #fff;
  transition: transform 0.15s, opacity 0.2s, filter 0.2s;
}
.hud-btn:hover { transform: scale(1.12) rotate(8deg); }
.hud-btn.off { opacity: 0.45; filter: grayscale(1); }
@media (max-width: 1400px) { .hud-lien .n { display: none; } .hud-lien { padding: 7px 10px; } .hud-lien.actif .n { display: inline; } }
@media (max-width: 560px) { .hud-lien.actif .n { display: none; } }
@media (max-width: 420px) { .hud-btn { width: 32px; height: 32px; font-size: 0.95rem; } .hud-etoiles { padding: 5px 10px; } .hud-avatar { width: 34px; height: 34px; font-size: 1.1rem; } .hud-droite { gap: 5px; } }

/* ===================== En-tête de page ===================== */
.hero { text-align: center; padding: 14px 0 26px; perspective: 900px; }
.hero-emoji {
  display: inline-block; font-size: 5.2rem; line-height: 1.1;
  animation: piece 6s ease-in-out infinite;
  filter: drop-shadow(0 14px 10px rgba(0,0,0,0.45));
  cursor: pointer; user-select: none;
}
.hero-emoji.saute { animation: saut-hero 0.8s cubic-bezier(.3,1.6,.5,1); }
@keyframes piece { 0%, 100% { transform: rotateY(-28deg) translateY(0); } 50% { transform: rotateY(28deg) translateY(-12px); } }
@keyframes saut-hero { 0% { transform: rotateY(0) translateY(0) scale(1); } 50% { transform: rotateY(360deg) translateY(-40px) scale(1.25); } 100% { transform: rotateY(720deg) translateY(0) scale(1); } }
.hero h1 {
  font-size: clamp(2rem, 6.5vw, 3.3rem); line-height: 1.15;
  color: var(--or);
  text-shadow: 0 4px 0 var(--accent-fonce), 0 10px 20px rgba(0,0,0,0.45);
}
.hero h1 .lettre { display: inline-block; animation: vague 2.6s ease-in-out infinite; }
@keyframes vague { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-7px) rotate(-4deg); } }
.hero .sous-titre { font-size: 1.15rem; max-width: 680px; margin: 10px auto 0; opacity: 0.92; line-height: 1.5; }

/* missions (badges de la page) */
.missions {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin: 18px auto 0; max-width: 900px;
}
.missions-titre { width: 100%; text-align: center; font-weight: 700; font-size: 1rem; opacity: 0.95; margin-bottom: 2px; }
.mission {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 13px 5px 5px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 0.9rem; font-weight: 600; color: #fff;
  background: rgba(255,255,255,0.1); border: 2px dashed rgba(255,255,255,0.35);
  transition: transform 0.15s;
}
.mission:hover { transform: translateY(-3px) scale(1.04); }
.mission .medaille {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.1rem; background: rgba(0,0,0,0.3); filter: grayscale(1); opacity: 0.6;
}
.mission.gagne { background: linear-gradient(180deg, #fff3c4, #ffd166); color: #5a3a00; border: 2px solid #ffb703; }
.mission.gagne .medaille { background: #fff; filter: none; opacity: 1; animation: medaille-tourne 4s ease-in-out infinite; }
@keyframes medaille-tourne { 0%, 70%, 100% { transform: rotateY(0); } 85% { transform: rotateY(360deg); } }

/* ===================== Cartes (sections) ===================== */
.carte {
  position: relative;
  background: var(--carte); color: var(--texte);
  border-radius: var(--rayon);
  padding: 26px;
  margin-bottom: 32px;
  border-top: 8px solid var(--accent);
  box-shadow: 0 10px 0 rgba(0,0,0,0.16), 0 24px 44px rgba(0,0,0,0.35);
  scroll-margin-top: 80px;
}
@media (max-width: 600px) { .carte { padding: 18px 14px; } }
.carte h2 {
  color: var(--accent-fonce);
  font-size: clamp(1.35rem, 3.6vw, 1.8rem);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.carte h2 .e { font-size: 1.35em; display: inline-block; animation: sautille 2.6s ease-in-out infinite; }
.carte .intro { line-height: 1.6; margin-bottom: 16px; font-size: 1.05rem; }
/* apparition en 3D au défilement (la classe js-reveal est posée par commun.js) */
.js-reveal .carte {
  opacity: 0;
  transform: translateY(46px) scale(0.96);
  transition: opacity 0.7s ease, transform 0.8s cubic-bezier(.2,.9,.3,1.15);
}
.js-reveal .carte.apparue { opacity: 1; transform: none; }

.pied { text-align: center; opacity: 0.75; margin-top: 30px; font-size: 0.9rem; }

/* ===================== Boutons en relief ===================== */
.btn {
  --c: var(--accent); --cf: var(--accent-fonce);
  position: relative;
  font: inherit; font-weight: 700; font-size: 1.05rem; color: #fff;
  background: var(--c); border: none; border-radius: 999px;
  padding: 12px 22px; cursor: pointer;
  box-shadow: 0 6px 0 var(--cf), 0 10px 18px rgba(0,0,0,0.2);
  transition: transform 0.1s, box-shadow 0.1s, filter 0.2s;
  user-select: none;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 8px 0 var(--cf), 0 14px 22px rgba(0,0,0,0.22); }
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--cf), 0 4px 8px rgba(0,0,0,0.2); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; filter: grayscale(0.4); }
.btn-gros { font-size: 1.25rem; padding: 15px 30px; }
.btn-petit { font-size: 0.9rem; padding: 7px 15px; box-shadow: 0 4px 0 var(--cf); }
.btn-or { --c: #ffb703; --cf: #b86e00; color: #4a2c00; }
.btn-gris { --c: #eceff3; --cf: #adb5bd; color: #333; }
.btn-bleu { --c: #3a86ff; --cf: #1d4ed8; }
.btn-vert { --c: #38b000; --cf: #1f6f00; }
.btn-rouge { --c: #e63946; --cf: #8d0801; }
.btn.actif { --c: var(--accent-fonce); --cf: #000; }
.rangee { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; margin: 14px 0; }

.btn-lire {
  flex: none;
  border: 2px solid currentColor; background: #fff; color: var(--accent-fonce);
  border-radius: 999px; padding: 5px 14px; cursor: pointer; min-height: 44px; min-width: 44px;
  font: inherit; font-weight: 600; font-size: 0.88rem;
  transition: transform 0.15s;
}
.btn-lire:hover { transform: scale(1.08); }
.btn-lire.parle { animation: pulse 0.9s ease-in-out infinite; background: var(--or); }

/* ===================== Mises en page ===================== */
.duo { display: flex; gap: 20px; flex-wrap: wrap; }
.duo > .visuel { flex: 1 1 400px; min-width: 0; }
.duo > .panneau { flex: 1 1 280px; min-width: 240px; }
.pastille {
  display: inline-block; background: var(--accent); color: #fff;
  border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; font-weight: 700; margin-bottom: 10px;
}
.panneau {
  position: relative;
  background: var(--accent-clair); color: var(--texte);
  border-radius: 20px; padding: 20px;
  border: 3px dashed var(--accent);
}
.panneau h3 { color: var(--accent-fonce); font-size: 1.35rem; margin-bottom: 8px; }
.panneau p { line-height: 1.6; font-size: 1.05rem; }
.panneau .astuce { font-size: 0.92rem; opacity: 0.85; margin-top: 10px; }
.panneau.pop { animation: popin 0.45s cubic-bezier(.2,1.4,.4,1); }
.info-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.jauge { width: 100%; height: 26px; border-radius: 999px; background: #e9ecef; border: 2px solid rgba(0,0,0,0.15); overflow: hidden; }
.jauge > div { height: 100%; width: 0%; border-radius: 999px; transition: width 0.3s; background: linear-gradient(90deg, var(--or), var(--accent)); }

/* points cliquables dans les dessins SVG */
.hotspot { cursor: pointer; }
.hotspot .halo { fill: none; stroke: #ffd166; stroke-width: 3; animation: halo 1.8s ease-out infinite; transform-box: fill-box; transform-origin: center; pointer-events: none; }
.hotspot .point { fill: #ffd166; stroke: #fff; stroke-width: 2; transition: fill 0.2s, transform 0.2s; transform-box: fill-box; transform-origin: center; }
.hotspot:hover .point { fill: #fff; transform: scale(1.25); }
.hotspot.vu .point { fill: #9be564; }
.hotspot.vu .halo { display: none; }
.hotspot.choisi .point { fill: var(--accent); stroke: #000; stroke-width: 3; }
.hotspot text { pointer-events: none; font-weight: 700; }
@keyframes halo { 0% { transform: scale(0.9); opacity: 0.9; } 100% { transform: scale(2); opacity: 0; } }

/* ===================== Scènes 3D ===================== */
.scene3d {
  position: relative; border-radius: 22px; overflow: hidden;
  background: linear-gradient(#8ecae6, #e0f4ff);
  box-shadow: inset 0 0 0 3px rgba(0,0,0,0.12), 0 12px 30px rgba(0,0,0,0.25);
  user-select: none;
}
.scene3d canvas { display: block; width: 100%; height: 470px; touch-action: none; cursor: grab; outline: none; }
.scene3d canvas.survol { cursor: pointer; }
.scene3d canvas:active { cursor: grabbing; }
@media (max-width: 640px) { .scene3d canvas { height: 360px; } }
.aide3d {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  background: rgba(0,0,0,0.55); color: #fff;
  padding: 6px 14px; border-radius: 999px;
  font-size: 0.82rem; pointer-events: none; white-space: nowrap;
  transition: opacity 0.8s;
}
@media (max-width: 520px) { .aide3d { white-space: normal; width: 90%; text-align: center; } }
.zoom3d { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 8px; }
.zoom3d button {
  width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,0.88); color: #222; font-size: 1.35rem; font-weight: 700;
  box-shadow: 0 4px 0 rgba(0,0,0,0.25);
  transition: transform 0.1s;
}
.zoom3d button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,0.25); }
.etiquette3d {
  position: absolute; left: 0; top: 0; z-index: 3;
  transform: translate(-50%, -140%);
  background: #fff; color: #222; padding: 5px 12px; border-radius: 999px;
  font-weight: 700; font-size: 0.92rem; white-space: nowrap; pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  opacity: 0; transition: opacity 0.15s;
}
.etiquette3d.visible { opacity: 1; }
.bulle3d {
  position: absolute; left: 0; top: 0; z-index: 4;
  transform: translate(-50%, -100%) scale(0); transform-origin: 50% 100%;
  background: #fff; color: #222; padding: 8px 14px; border-radius: 18px;
  font-weight: 700; font-size: 1.05rem; white-space: nowrap; pointer-events: none;
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
  transition: transform 0.3s cubic-bezier(.2,1.6,.4,1);
}
.bulle3d::after {
  content: ''; position: absolute; left: 50%; bottom: -9px; margin-left: -9px;
  border: 9px solid transparent; border-top-color: #fff; border-bottom: 0;
}
.bulle3d.visible { transform: translate(-50%, -100%) scale(1); }
.sans-3d {
  display: none; padding: 16px; border-radius: 14px;
  background: #ffe0e0; color: #8d0801; border: 2px dashed #e63946; margin-bottom: 12px;
}
.secousse { animation: secousse 0.12s linear infinite; }
@keyframes secousse {
  0% { transform: translate(0, 0); } 25% { transform: translate(-3px, 2px); }
  50% { transform: translate(3px, -2px); } 75% { transform: translate(-2px, -3px); } 100% { transform: translate(0, 0); }
}

/* ===================== Quiz ===================== */
.quiz-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.quiz-num { font-weight: 700; color: var(--accent-fonce); }
.quiz-points { display: flex; gap: 7px; flex-wrap: wrap; }
.quiz-point { width: 14px; height: 14px; border-radius: 50%; background: #dee2e6; transition: transform 0.3s, background 0.3s; }
.quiz-point.actuel { background: var(--accent); transform: scale(1.35); box-shadow: 0 0 0 4px var(--accent-clair); }
.quiz-point.juste { background: var(--vert); }
.quiz-point.faux { background: var(--rouge); }
.quiz-serie { font-weight: 700; color: #e85d04; min-width: 70px; text-align: right; }
.quiz-serie.chaud { animation: bump 0.5s; }
.quiz-question { font-size: 1.3rem; font-weight: 700; margin: 6px 0 16px; display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; line-height: 1.4; }
.quiz-reponses { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; perspective: 900px; }
.quiz-rep {
  display: flex; align-items: center; gap: 12px; text-align: left;
  font: inherit; font-size: 1.05rem; font-weight: 600;
  padding: 13px 16px; border-radius: 18px;
  border: 3px solid var(--accent); background: #fff; color: var(--texte);
  box-shadow: 0 5px 0 var(--accent); cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
  animation: arrivee 0.55s cubic-bezier(.2,1.3,.4,1) backwards;
}
.quiz-rep:nth-child(2) { animation-delay: 0.08s; }
.quiz-rep:nth-child(3) { animation-delay: 0.16s; }
.quiz-rep:nth-child(4) { animation-delay: 0.24s; }
.quiz-rep:hover:not(:disabled) { transform: translateY(-3px) rotateX(10deg); box-shadow: 0 8px 0 var(--accent); }
.quiz-rep:disabled { cursor: default; }
.quiz-rep .lettre {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700;
}
.quiz-rep.juste { background: var(--vert); border-color: var(--vert-fonce); color: #fff; box-shadow: 0 5px 0 var(--vert-fonce); animation: victoire 0.6s; }
.quiz-rep.juste .lettre, .quiz-rep.faux .lettre { background: #fff; color: #222; }
.quiz-rep.faux { background: var(--rouge); border-color: var(--rouge-fonce); color: #fff; box-shadow: 0 5px 0 var(--rouge-fonce); animation: secoue 0.45s; }
.quiz-rep.eteinte { opacity: 0.45; }
@keyframes arrivee { from { opacity: 0; transform: rotateX(-90deg) translateY(-14px); } }
.quiz-explication { margin-top: 14px; padding: 14px 16px; border-radius: 16px; line-height: 1.55; font-size: 1.05rem; animation: popin 0.4s cubic-bezier(.2,1.4,.4,1); }
.quiz-explication.ok { background: #d8f3dc; color: #1b4332; }
.quiz-explication.ko { background: #ffe0e0; color: #8d0801; }
.quiz-suite { display: flex; justify-content: flex-end; margin-top: 14px; }
.quiz-fin { text-align: center; padding: 10px 0; }
.quiz-fin h3 { font-size: 1.6rem; color: var(--accent-fonce); margin-bottom: 8px; }
.quiz-fin p { font-size: 1.1rem; line-height: 1.5; }
.grosses-etoiles { margin: 12px 0; perspective: 600px; }
.grosses-etoiles span { font-size: 2.8rem; display: inline-block; animation: etoile-pop 0.6s cubic-bezier(.2,1.6,.4,1) backwards; }
.grosses-etoiles span.vide { filter: grayscale(1); opacity: 0.3; }
@keyframes etoile-pop { from { transform: scale(0) rotateY(540deg); opacity: 0; } }

/* ===================== Cartes « Le savais-tu ? » ===================== */
.faits { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.fait { perspective: 1100px; background: none; border: none; padding: 0; font: inherit; cursor: pointer; text-align: left; color: inherit; }
.fait-int { display: grid; height: 100%; min-height: 170px; transform-style: preserve-3d; transition: transform 0.75s cubic-bezier(.3,1.35,.5,1); }
.fait:hover .fait-int { transform: rotateY(12deg) rotateX(5deg); }
.fait.retourne .fait-int { transform: rotateY(180deg); }
.fait.retourne:hover .fait-int { transform: rotateY(170deg) rotateX(4deg); }
.fait-face {
  grid-area: 1 / 1;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 20px; padding: 18px;
  display: flex; flex-direction: column; justify-content: center; gap: 8px;
  box-shadow: 0 6px 0 rgba(0,0,0,0.14);
}
.fait-avant { background: linear-gradient(135deg, var(--accent), var(--accent-fonce)); color: #fff; font-weight: 700; font-size: 1.1rem; line-height: 1.4; }
.fait-avant .q { font-size: 2rem; display: inline-block; animation: sautille 2s ease-in-out infinite; }
.fait-arriere { background: var(--accent-clair); color: var(--texte); transform: rotateY(180deg); line-height: 1.5; border: 3px solid var(--accent); }

/* ===================== Memory ===================== */
.memory { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 12px; perspective: 1000px; }
.mem { display: block; width: 100%; aspect-ratio: 3 / 4; background: none; border: none; padding: 0; cursor: pointer; font: inherit; }
.mem-int { display: block; position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.55s cubic-bezier(.3,1.3,.5,1); }
.mem:hover .mem-int { transform: rotateY(16deg) translateZ(12px); }
.mem.ouverte .mem-int, .mem.trouvee .mem-int { transform: rotateY(180deg); }
.mem-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  box-shadow: 0 5px 0 rgba(0,0,0,0.18);
}
.mem-dos { background: repeating-linear-gradient(45deg, var(--accent) 0 10px, var(--accent-fonce) 10px 20px); color: #fff; font-size: 2rem; border: 3px solid #fff; }
.mem-avant { background: #fff; transform: rotateY(180deg); border: 3px solid var(--accent); }
.mem-avant .e { font-size: 2.5rem; line-height: 1.1; }
.mem-avant .n { font-size: 0.78rem; font-weight: 700; color: var(--accent-fonce); text-align: center; padding: 0 4px; }
.mem.trouvee { cursor: default; }
.mem.trouvee .mem-avant { background: #d8f3dc; border-color: var(--vert); }
.mem.trouvee .mem-int { animation: mem-gagne 0.6s; }
@keyframes mem-gagne { 50% { transform: rotateY(180deg) scale(1.12) translateZ(30px); } }
.stats { text-align: center; font-weight: 700; color: var(--accent-fonce); margin-top: 12px; }

/* ===================== Jeu des paires ===================== */
.paires { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.paires-col { display: grid; gap: 10px; align-content: start; }
.paires-col h4 { text-align: center; color: var(--accent-fonce); }
.paire {
  font: inherit; font-weight: 600; font-size: 1rem;
  padding: 12px 14px; border-radius: 16px; cursor: pointer;
  border: 3px solid var(--accent); background: #fff; color: var(--texte);
  box-shadow: 0 4px 0 var(--accent);
  transition: transform 0.12s, background 0.2s;
}
.paire:hover:not(.trouvee) { transform: translateY(-2px) rotate(-1deg); }
.paire.choisie { background: #ffe08a; border-color: #ffb703; box-shadow: 0 4px 0 #b86e00; transform: scale(1.04); }
.paire.trouvee { cursor: default; border-color: rgba(0,0,0,0.15); box-shadow: 0 4px 0 rgba(0,0,0,0.15); animation: victoire 0.5s; }
.paire.trouvee::after { content: ' ✔'; }
.paire.faux { animation: secoue 0.4s; background: #ffd6d6; }
@media (max-width: 520px) { .paires { gap: 8px; } .paire { font-size: 0.9rem; padding: 10px 8px; } }

.message { text-align: center; font-weight: 700; font-size: 1.1rem; min-height: 1.6em; margin-top: 12px; }
.message.ok { color: #1f7a1f; }
.message.ko { color: #c1121f; }

/* ===================== Glisser-déposer ===================== */
.jeton {
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
  font: inherit; font-weight: 700; font-size: 1rem;
  padding: 10px 14px; border-radius: 14px;
  background: #fff; color: var(--texte);
  border: 3px solid var(--accent); box-shadow: 0 5px 0 var(--accent-fonce);
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform 0.15s, opacity 0.2s, box-shadow 0.15s;
}
.jeton .e { font-size: 1.5em; }
.jeton:hover { transform: translateY(-3px) rotate(-2deg); }
.jeton.en-vol { opacity: 0.3; }
.jeton.choisi { background: #ffe08a; transform: scale(1.08) rotate(-2deg); box-shadow: 0 0 0 4px #ffb703, 0 5px 0 #b86e00; }
.jeton.bloque { cursor: default; border-color: var(--vert); box-shadow: 0 4px 0 var(--vert-fonce); background: #d8f3dc; transform: none; }
.jeton.retour { animation: secoue 0.45s; }
.fantome {
  position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; margin: 0;
  transform: translate(-50%, -50%) rotate(-6deg) scale(1.12);
  box-shadow: 0 18px 30px rgba(0,0,0,0.35) !important;
}
[data-zone] { transition: transform 0.2s, box-shadow 0.2s, background 0.2s; }
[data-zone].survol { box-shadow: 0 0 0 5px #ffb703, 0 0 18px rgba(255,183,3,0.8) !important; filter: brightness(1.06); }
.selection-active [data-zone]:not(.remplie) { animation: invite 1.2s ease-in-out infinite; }
@keyframes invite { 50% { box-shadow: 0 0 0 4px rgba(255,183,3,0.7); } }

/* jeu « remets dans l'ordre » */
.ordre-cases { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin: 10px 0 18px; }
.ordre-case {
  position: relative; min-height: 96px; padding: 12px 8px 10px;
  border: 3px dashed var(--accent); border-radius: 18px; background: var(--accent-clair);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.ordre-num {
  position: absolute; top: -13px; left: -9px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700;
  box-shadow: 0 3px 0 var(--accent-fonce);
}
.ordre-vide { font-size: 1.7rem; opacity: 0.35; }
.ordre-case.remplie { border-style: solid; border-color: var(--vert); background: #eafbe7; }
.ordre-case.faux { animation: secoue 0.4s; background: #ffe0e0; }
.ordre-case .jeton { width: 100%; justify-content: center; text-align: center; flex-direction: column; gap: 4px; font-size: 0.92rem; }
.ordre-reserve { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 64px; padding: 14px; border-radius: 18px; background: rgba(0,0,0,0.05); }

/* ===================== Mascotte ===================== */
.mascotte { position: fixed; left: 14px; bottom: 14px; z-index: 90; display: flex; align-items: flex-end; gap: 10px; pointer-events: none; }
.mascotte-perso {
  pointer-events: auto; flex: none;
  width: 74px; height: 74px; border-radius: 50%; border: none; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #fff, #ffe8b0 55%, #f4b860);
  font-size: 2.7rem; display: grid; place-items: center;
  box-shadow: 0 6px 0 #b8742a, 0 14px 26px rgba(0,0,0,0.4);
  animation: flotte 3.2s ease-in-out infinite;
}
.mascotte-perso:hover { animation: none; transform: scale(1.12) rotate(-10deg); }
.mascotte.parle .mascotte-perso { animation: parle 0.32s ease-in-out infinite alternate; }
.mascotte-bulle {
  pointer-events: auto; cursor: pointer;
  max-width: min(330px, 68vw); margin-bottom: 44px;
  background: #fff; color: var(--texte);
  padding: 12px 16px; border-radius: 20px 20px 20px 4px;
  font-weight: 600; line-height: 1.4; font-size: 1rem;
  box-shadow: 0 8px 22px rgba(0,0,0,0.3);
  transform-origin: bottom left; transform: scale(0) rotate(-8deg); opacity: 0;
  transition: transform 0.35s cubic-bezier(.2,1.5,.4,1), opacity 0.2s;
}
.mascotte-bulle.visible { transform: scale(1) rotate(0); opacity: 1; }
body.cacher-mascotte .mascotte { display: none; }
@media (max-width: 600px) { .mascotte-perso { width: 58px; height: 58px; font-size: 2.1rem; } .mascotte-bulle { margin-bottom: 34px; font-size: 0.92rem; } }

/* ===================== Récompenses ===================== */
.toast-badge {
  position: fixed; top: 76px; left: 50%; z-index: 2300;
  display: flex; gap: 14px; align-items: center;
  max-width: 92vw; padding: 14px 24px 14px 16px; border-radius: 24px;
  background: linear-gradient(135deg, #fff7d6, #ffd166); color: #4a2c00;
  box-shadow: 0 10px 0 #c98a00, 0 22px 44px rgba(0,0,0,0.45);
  transform: translateX(-50%);
  animation: toast-entre 0.65s cubic-bezier(.2,1.4,.4,1);
  perspective: 600px; cursor: pointer;
}
.toast-badge .medaille { font-size: 3.2rem; display: inline-block; animation: medaille 1.5s cubic-bezier(.2,.8,.3,1); }
.toast-badge .titre { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 1px; opacity: 0.75; font-weight: 700; }
.toast-badge .nom { font-size: 1.3rem; font-weight: 700; }
.toast-badge .desc { font-size: 0.92rem; }
.toast-badge.sort { animation: toast-sort 0.45s forwards; }
@keyframes toast-entre { from { transform: translateX(-50%) translateY(-140px) rotateX(70deg); opacity: 0; } }
@keyframes toast-sort { to { transform: translateX(-50%) translateY(-140px) scale(0.8); opacity: 0; } }
@keyframes medaille { from { transform: rotateY(0) scale(0.2); } to { transform: rotateY(1080deg) scale(1); } }

.etoile-vol { position: fixed; left: 0; top: 0; z-index: 2400; font-size: 1.8rem; pointer-events: none; will-change: transform; }
.etincelle { position: fixed; left: 0; top: 0; z-index: 2400; pointer-events: none; border-radius: 50%; will-change: transform, opacity; }
.confetti { position: fixed; top: -50px; z-index: 2200; pointer-events: none; animation: tombe linear forwards; }
@keyframes tombe { to { transform: translate3d(var(--dx, 0px), 118vh, 0) rotateX(var(--rx, 720deg)) rotateY(var(--ry, 360deg)); } }

/* inclinaison 3D qui suit la souris (classe posée par Aventure.incliner) */
.incline { transform-style: preserve-3d; transition: transform 0.25s ease-out; will-change: transform; }
.incline .reflet {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle at var(--rx, 50%) var(--ry, 0%), rgba(255,255,255,0.45), transparent 55%);
  opacity: 0; transition: opacity 0.3s;
}
.incline:hover .reflet { opacity: 1; }

/* ===================== Barre du haut : maison, menu des aventures ===================== */
.hud-maison {
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.45rem; text-decoration: none; background: rgba(255,255,255,0.15); transition: transform 0.15s;
}
.hud-maison.actif { background: var(--or); }
.hud-maison:hover { transform: scale(1.1) rotate(-8deg); }
.hud-menu {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px 0 10px;
  border: none; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 700; font-size: 1rem;
  background: var(--or); color: #3a2a00; box-shadow: 0 3px 0 #c98a00; max-width: 46vw;
}
.hud-menu .e { font-size: 1.3rem; }
.hud-menu .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-menu .fleche { font-size: 0.8rem; transition: transform 0.2s; }
.hud-menu[aria-expanded="true"] .fleche { transform: rotate(180deg); }
.hud-droite { margin-left: auto; }
/* la bande d'icônes n'est montrée que sur grand écran ; sinon, le menu suffit */
@media (max-width: 1099px) { .hud-nav { display: none; } }
@media (min-width: 1100px) { .hud-menu .n { display: none; } .hud-menu { padding: 0 12px; } }
@media (max-width: 700px) {
  .hud { gap: 6px; padding: 7px 10px; }
  .hud-large { display: none; }
  .hud-menu { font-size: 0.92rem; padding: 0 10px 0 8px; }
  .hud-avatar { width: 40px; height: 40px; }
}
@media (max-width: 380px) {
  .hud-menu .n { display: none; }
  .hud-etoiles { padding: 5px 9px; font-size: 0.95rem; }
}
.menu-aventures {
  position: fixed; left: 50%; top: 66px; z-index: 1600; transform: translateX(-50%);
  width: min(720px, calc(100vw - 16px)); max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: #fffdf8; color: var(--texte); border-radius: 24px; padding: 14px 14px 18px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.5); animation: menu-ouvre 0.3s cubic-bezier(.2,1.3,.4,1);
}
@keyframes menu-ouvre { from { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(0.96); } }
.menu-aventures h3 { font-size: 1rem; color: var(--accent-fonce); margin: 14px 4px 8px; }
.menu-reglages { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 8px; }
.menu-reglage {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px;
  border: 2px solid #e5e7eb; border-radius: 16px; background: #fff; cursor: pointer; font: inherit; font-size: 1.4rem;
  color: var(--texte); text-decoration: none;
}
.menu-reglage span { font-size: 0.75rem; font-weight: 700; }
.menu-reglage.off { opacity: 0.5; filter: grayscale(1); }
.menu-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.menu-carte {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px 8px; min-height: 92px;
  border-radius: 16px; background: #fff; border: 2px solid #eee; border-bottom: 5px solid var(--c);
  text-decoration: none; color: var(--texte); text-align: center; transition: transform 0.15s;
}
.menu-carte:active { transform: scale(0.96); }
.menu-carte .e { font-size: 2rem; line-height: 1.1; }
.menu-carte .n { font-weight: 700; font-size: 0.85rem; color: var(--c); line-height: 1.15; }
.menu-carte .p { font-size: 0.7rem; color: #777; font-weight: 600; }
.menu-carte.actif { background: var(--accent-clair); border-color: var(--c); box-shadow: 0 0 0 3px var(--c); }
@media (max-width: 400px) { .menu-grille { grid-template-columns: repeat(3, 1fr); } .menu-carte .e { font-size: 1.7rem; } }

.menu-test { display: block; width: 100%; margin-top: 10px; min-height: 48px; border-radius: 16px; border: 2px dashed var(--accent); background: var(--accent-clair); color: var(--accent-fonce); font: inherit; font-weight: 700; cursor: pointer; }
.menu-diag { font-size: 0.85rem; line-height: 1.5; margin: 6px 4px 0; color: #444; }
.menu-diag:empty { display: none; }
.menu-voix { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.menu-voix-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 52px; padding: 8px 12px; border-radius: 14px; border: 2px solid #e5e7eb; background: #fff; color: var(--texte); font: inherit; cursor: pointer; text-align: left; }
.menu-voix-btn small { font-size: 0.72rem; color: #777; }
.menu-voix-btn.actif { border-color: var(--accent); background: var(--accent-clair); box-shadow: 0 0 0 3px var(--accent); }
.menu-voix .menu-diag { grid-column: 1 / -1; }

/* ===================== Plein écran et téléphone à l'horizontale ===================== */
.carte.plein-ecran {
  position: fixed; inset: 0; z-index: 1500; margin: 0; border-radius: 0; border-top-width: 6px;
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 10px 12px calc(16px + env(safe-area-inset-bottom));
  transform: none !important; opacity: 1 !important;
}
.carte.plein-ecran .scene3d canvas { height: calc(100vh - 170px) !important; height: calc(100dvh - 170px) !important; min-height: 260px; }
.carte.plein-ecran .duo > .visuel { flex-basis: 60%; }
body.jeu-plein-ecran { overflow: hidden; }
body.jeu-plein-ecran .hud, body.jeu-plein-ecran .mascotte, body.jeu-plein-ecran .fusee { display: none; }
.bouton-plein-ecran { font-size: 1.15rem !important; }
.carte.plein-ecran .bouton-plein-ecran { background: #ffd166 !important; }
/* invitation à tourner le téléphone (jamais bloquante) */
.carte.plein-ecran::before {
  content: '📱↻ Tourne ton téléphone pour jouer en grand !';
  display: none; position: sticky; top: 0; z-index: 5; margin: -10px -12px 8px; padding: 8px 12px;
  background: #ffd166; color: #4a2c00; font-weight: 700; text-align: center; font-size: 0.95rem;
}
@media (orientation: portrait) and (max-width: 700px) {
  .carte.plein-ecran::before { display: block; }
  .carte.plein-ecran .scene3d canvas { height: calc(100vh - 230px) !important; height: calc(100dvh - 230px) !important; }
}
/* téléphone tenu à l'horizontale (sans plein écran) : la scène tient dans la hauteur de l'écran */
@media (orientation: landscape) and (max-height: 520px) {
  .scene3d canvas { height: 78vh !important; height: 78dvh !important; min-height: 230px; }
  .carte.plein-ecran > h2, .carte.plein-ecran > .intro { display: none; }
  .carte.plein-ecran .scene3d canvas { height: calc(100vh - 24px) !important; height: calc(100dvh - 24px) !important; }
  .hud { padding: 4px 12px; }
  .hero { padding: 6px 0 14px; }
  .hero-emoji { font-size: 3rem; }
  .mascotte-perso { width: 50px; height: 50px; font-size: 1.8rem; }
}
/* petits écrans : mascotte plus discrète, bulle qui ne cache pas le jeu */
@media (max-width: 600px) {
  .mascotte { left: 8px; bottom: 8px; }
  .mascotte-bulle { max-width: calc(100vw - 90px); font-size: 0.88rem; padding: 9px 12px; margin-bottom: 30px; }
  .carte h2 { font-size: 1.3rem; }
  .carte .intro { font-size: 0.98rem; }
  .btn { padding: 11px 18px; }
  .zoom3d button { width: 46px; height: 46px; }
  .rangee { gap: 9px; }
  .quiz-question { font-size: 1.12rem; }
  .quiz-reponses { grid-template-columns: 1fr; }
}

/* ===================== Petits plus des jeux ===================== */
.quiz-outils { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.quiz-record { font-weight: 700; color: var(--accent-fonce); background: var(--accent-clair); padding: 4px 12px; border-radius: 999px; font-size: 0.9rem; }
.quiz-record.nouveau { display: inline-block; margin: 0 auto 6px; animation: bump 0.6s 3; background: #ffe08a; color: #5a3a00; }
.quiz-rep { position: relative; }
.quiz-rep.jokerise { opacity: 0.15; transform: scale(0.92) rotateX(30deg); transition: opacity 0.4s, transform 0.4s; }
.quiz-plus {
  position: absolute; right: 12px; top: -6px; font-weight: 700; color: #1f6f00; background: #fff;
  border-radius: 999px; padding: 2px 10px; box-shadow: 0 3px 8px rgba(0,0,0,0.2); pointer-events: none;
  animation: plus-monte 1s ease-out forwards;
}
@keyframes plus-monte { from { transform: translateY(0) scale(0.5); opacity: 0; } 30% { transform: translateY(-14px) scale(1.2); opacity: 1; } to { transform: translateY(-40px) scale(1); opacity: 0; } }
.mem-niveaux { margin: 0 0 12px; }
.indice { animation: indice 0.5s ease-in-out 3 !important; box-shadow: 0 0 0 5px #ffd166, 0 0 24px #ffd166 !important; }
@keyframes indice { 50% { transform: scale(1.08) rotate(-2deg); } }

/* ===================== Avatar, portail, fusée ===================== */
.hud-avatar {
  width: 42px; height: 42px; border-radius: 50%; border: 3px solid #fff; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #fff, #ffd6f5); font-size: 1.4rem; line-height: 1;
  box-shadow: 0 3px 0 rgba(0,0,0,0.3); transition: transform 0.2s;
}
.hud-avatar:hover { transform: scale(1.15) rotate(-10deg); }
.choix-avatar {
  position: fixed; top: 64px; right: 12px; z-index: 300; width: min(330px, 92vw);
  background: #fff; color: var(--texte); border-radius: 22px; padding: 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.45); animation: toast-entre 0.45s cubic-bezier(.2,1.4,.4,1);
  transform-origin: top right;
}
.choix-titre { font-weight: 700; text-align: center; margin-bottom: 10px; color: var(--accent-fonce); }
.choix-grille { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.choix-grille button {
  font-size: 1.6rem; aspect-ratio: 1; border-radius: 14px; border: 2px solid #eee; background: #f8f9fa; cursor: pointer;
  transition: transform 0.15s;
}
.choix-grille button:hover { transform: scale(1.2) rotate(8deg); }
.choix-grille button.choisi { border-color: var(--accent); background: var(--accent-clair); }

.portail {
  position: fixed; inset: 0; z-index: 2000; pointer-events: none;
  background: var(--c);
  background: radial-gradient(circle, var(--c) 0%, color-mix(in srgb, var(--c) 60%, #000) 100%);
  display: grid; place-items: center;
  clip-path: circle(0% at 50% 50%);
  animation: portail-ouvre 0.55s cubic-bezier(.6,0,.4,1) forwards;
}
.portail span { font-size: 7rem; animation: portail-emoji 0.6s ease-out; filter: drop-shadow(0 10px 20px rgba(0,0,0,0.4)); }
.portail.entree { clip-path: circle(150% at 50% 50%); animation: portail-ferme 0.7s cubic-bezier(.6,0,.4,1) 0.05s forwards; }
@keyframes portail-ouvre { to { clip-path: circle(150% at 50% 50%); } }
@keyframes portail-ferme { to { clip-path: circle(0% at 50% 50%); } }
@keyframes portail-emoji { from { transform: rotateY(540deg) scale(0.2); } }

.fusee {
  position: fixed; right: 16px; bottom: 18px; z-index: 85; width: 56px; height: 56px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 1.8rem;
  background: radial-gradient(circle at 35% 30%, #fff, #c7d2fe); box-shadow: 0 5px 0 #6366f1, 0 10px 20px rgba(0,0,0,0.35);
  opacity: 0; transform: translateY(80px); transition: opacity 0.3s, transform 0.3s; pointer-events: none;
}
.fusee span, .fusee { line-height: 1; }
.fusee.visible { opacity: 1; transform: none; pointer-events: auto; animation: flotte 2.6s ease-in-out infinite; }
.fusee.decolle { animation: decolle 0.9s ease-in forwards; }
@keyframes decolle { 30% { transform: translateY(8px) rotate(-10deg); } 100% { transform: translateY(-110vh) rotate(0); } }

.mascotte-perso.looping { animation: looping 1.5s cubic-bezier(.4,0,.2,1); }
@keyframes looping { 0% { transform: none; } 40% { transform: translateY(-160px) rotate(360deg) scale(1.3); } 70% { transform: translateY(-120px) rotateY(540deg) scale(1.2); } 100% { transform: rotate(720deg); } }

:focus-visible { outline: 4px solid #ffd166; outline-offset: 3px; }

/* ===================== Animations partagées ===================== */
@keyframes popin { from { transform: scale(0.85) rotate(-2deg); opacity: 0.3; } }
@keyframes victoire { 0% { transform: scale(1); } 40% { transform: scale(1.12) rotate(-3deg); } 70% { transform: scale(0.97) rotate(2deg); } 100% { transform: scale(1); } }
@keyframes secoue { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px) rotate(-2deg); } 40% { transform: translateX(7px) rotate(2deg); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@keyframes sautille { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(-6deg); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.35) rotate(-6deg); } 100% { transform: scale(1); } }
@keyframes flotte { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
@keyframes parle { from { transform: scale(1) rotate(-4deg); } to { transform: scale(1.08) rotate(4deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
