/* ───────────── Mini Génies : espace professeur + jeu ───────────── */
:root {
  --violet: #7c3aed; --violet2: #c026d3; --rose: #f472b6; --encre: #2b1d52; --doux: #6b5b95;
  --rouge: #f43f5e; --bleu: #3b82f6; --orange: #f59e0b; --vert: #22c55e; --jaune: #fbbf24;
  --carte: #ffffff; --ombre: 0 18px 40px rgba(60, 20, 110, .28);
  --police: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--police); color: var(--encre); min-height: 100vh; overflow-x: hidden;
  background: linear-gradient(135deg, #6d28d9 0%, #a21caf 55%, #ec4899 100%) fixed;
}
a { color: var(--violet); }
h1, h2, h3 { margin: 0; line-height: 1.15; }

/* Formes qui flottent en arrière-plan */
.flottants { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.flottants span { position: absolute; bottom: -80px; font-size: 38px; opacity: .55; animation: flotte linear infinite; filter: drop-shadow(0 4px 6px rgba(0,0,0,.15)); }
@keyframes flotte { 0% { transform: translateY(0) rotate(0); } 100% { transform: translateY(-115vh) rotate(360deg); } }

/* ───── Boutons « gros bonbons » ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; border: 0; text-decoration: none;
  font: 800 16px var(--police); color: #fff; padding: 12px 22px; border-radius: 16px; background: var(--violet);
  box-shadow: 0 6px 0 rgba(0,0,0,.22); transition: transform .12s, box-shadow .12s, filter .15s; user-select: none;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 8px 0 rgba(0,0,0,.22); }
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 rgba(0,0,0,.22); }
.btn.vert { background: var(--vert); } .btn.rouge { background: var(--rouge); } .btn.orange { background: var(--orange); }
.btn.bleu { background: var(--bleu); } .btn.gris { background: #e5def5; color: var(--encre); box-shadow: 0 6px 0 #c9bde6; }
.btn.petit { font-size: 13px; padding: 8px 14px; border-radius: 12px; box-shadow: 0 4px 0 rgba(0,0,0,.2); }
.btn.petit:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.2); }

/* ───── Espace professeur ───── */
.page { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 18px 16px 60px; }
.entete { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: rgba(255,255,255,.95); border-radius: 22px; padding: 10px 18px; box-shadow: var(--ombre); margin-bottom: 18px; }
.logo { display: flex; align-items: center; gap: 8px; font-size: 24px; font-weight: 900; text-decoration: none; color: var(--encre); }
.logo svg { width: 46px; height: 46px; }
.logo b { background: linear-gradient(90deg, #f43f5e, #f59e0b, #22c55e, #3b82f6, #8b5cf6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.entete nav { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.entete nav a, .entete nav button { font: 700 14px var(--police); color: var(--encre); background: transparent; border: 0; padding: 8px 12px; border-radius: 12px; text-decoration: none; cursor: pointer; }
.entete nav a:hover, .entete nav button:hover, .entete nav a.actif { background: #efe7ff; }
.panneau { background: var(--carte); border-radius: 24px; padding: 20px 22px; box-shadow: var(--ombre); margin-bottom: 18px; }
.panneau h2 { font-size: 22px; margin-bottom: 12px; }
.sous { color: var(--doux); font-size: 14px; }
.flash { padding: 12px 16px; border-radius: 14px; margin-bottom: 14px; font-weight: 700; animation: pop-in .4s both; }
.flash.ok { background: #dcfce7; color: #166534; } .flash.erreur { background: #ffe4e6; color: #9f1239; }
.flash.mdp { background: #fef3c7; color: #78350f; font-weight: 600; } .flash.mdp code { font-size: 20px; background: #fff; padding: 2px 10px; border-radius: 8px; user-select: all; }
.champ, select.champ, textarea.champ { font: 600 16px var(--police); padding: 11px 14px; border: 3px solid #e2d8f8; border-radius: 14px; background: #fbf9ff; color: var(--encre); width: 100%; }
.champ:focus { outline: none; border-color: var(--violet); background: #fff; }
label.lib { display: block; font-weight: 800; font-size: 13px; margin: 0 0 5px; color: var(--doux); text-transform: uppercase; letter-spacing: .04em; }
.ligne { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.ligne > .col { flex: 1 1 180px; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.carte-classe { border-radius: 20px; padding: 16px; color: #fff; position: relative; overflow: hidden; box-shadow: 0 8px 0 rgba(0,0,0,.14); animation: pop-in .45s both; animation-delay: calc(var(--i, 0) * 70ms); }
.carte-classe h3 { font-size: 22px; } .carte-classe .emo { position: absolute; right: 10px; top: 4px; font-size: 54px; opacity: .35; }
.carte-classe .stats { margin: 6px 0 12px; font-weight: 700; opacity: .95; font-size: 14px; }
.carte-classe .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.carte-classe .btn.gris { background: rgba(255,255,255,.9); }
details.edit { background: #f7f2ff; border-radius: 14px; padding: 8px 12px; margin-top: 8px; } details.edit summary { cursor: pointer; font-weight: 800; color: var(--violet); }
table.tab { width: 100%; border-collapse: collapse; } table.tab th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--doux); padding: 8px 10px; }
table.tab td { padding: 9px 10px; border-top: 2px solid #f0eaff; vertical-align: middle; }
.avatar { display: inline-flex; width: 38px; height: 38px; border-radius: 50%; align-items: center; justify-content: center; font-size: 22px; vertical-align: middle; margin-right: 8px; }
.onglets { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; } .onglets a { padding: 9px 16px; border-radius: 999px; background: #efe7ff; color: var(--violet); font-weight: 800; text-decoration: none; } .onglets a.actif { background: var(--violet); color: #fff; }
.pastille { display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: #efe7ff; color: var(--violet); }
.pastille.ok { background: #dcfce7; color: #166534; } .pastille.off { background: #ffe4e6; color: #9f1239; }
.barre-pct { height: 10px; border-radius: 999px; background: #efe7ff; overflow: hidden; min-width: 70px; } .barre-pct i { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #84cc16); }
.centre-carte { position: relative; z-index: 1; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.centre-carte .panneau { width: 100%; max-width: 440px; text-align: center; }
.pave { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px auto; max-width: 270px; }
.pave button { font: 900 26px var(--police); padding: 14px 0; border-radius: 16px; border: 0; background: #efe7ff; color: var(--encre); box-shadow: 0 5px 0 #d4c4f3; cursor: pointer; }
.pave button:active { transform: translateY(4px); box-shadow: 0 1px 0 #d4c4f3; }
.points-pin { display: flex; gap: 12px; justify-content: center; margin: 10px 0; } .points-pin i { width: 20px; height: 20px; border-radius: 50%; background: #e2d8f8; transition: .15s; } .points-pin i.plein { background: var(--violet); transform: scale(1.2); }

/* ───── Mascotte ───── */
.mascotte { width: 120px; height: 120px; animation: flotter 3s ease-in-out infinite; transform-origin: 50% 80%; overflow: visible; }
.mascotte .yeux { animation: clignote 4.5s infinite; transform-origin: 100px 104px; }
.mascotte .bouche-joie, .mascotte .bouche-triste, .mascotte .bouche-oh { display: none; }
.mascotte.joie { animation: saute .7s ease-in-out infinite; } .mascotte.joie .bouche-sourire { display: none; } .mascotte.joie .bouche-joie { display: block; }
.mascotte.triste { animation: penche 2.4s ease-in-out infinite; } .mascotte.triste .bouche-sourire { display: none; } .mascotte.triste .bouche-triste { display: block; }
.mascotte.reflexion .bouche-sourire { display: none; } .mascotte.reflexion .bouche-oh { display: block; }
@keyframes flotter { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-9px) rotate(2deg); } }
@keyframes saute { 0%, 100% { transform: translateY(0) scale(1, 1) rotate(-4deg); } 40% { transform: translateY(-26px) scale(.95, 1.08) rotate(5deg); } 75% { transform: translateY(0) scale(1.08, .92); } }
@keyframes penche { 0%, 100% { transform: rotate(-7deg) translateY(3px); } 50% { transform: rotate(5deg) translateY(6px); } }
@keyframes clignote { 0%, 92%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }

/* ───── Animations communes ───── */
@keyframes pop-in { 0% { opacity: 0; transform: scale(.6) translateY(14px); } 70% { transform: scale(1.06); } 100% { opacity: 1; transform: none; } }
@keyframes glisse { 0% { opacity: 0; transform: translateY(24px); } 100% { opacity: 1; transform: none; } }
@keyframes gelee { 0% { transform: scale(1); } 25% { transform: scale(1.14, .88); } 50% { transform: scale(.9, 1.12); } 75% { transform: scale(1.06, .96); } 100% { transform: scale(1); } }
@keyframes secoue { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-11px) rotate(-2deg); } 40% { transform: translateX(10px) rotate(2deg); } 60% { transform: translateX(-7px); } 80% { transform: translateX(5px); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes ondule { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes brille { 0% { box-shadow: 0 0 0 0 rgba(251,191,36,.8); } 100% { box-shadow: 0 0 0 22px rgba(251,191,36,0); } }

/* ───────────────── Le jeu ───────────────── */
body.jeu-corps { overflow: hidden; height: 100vh; }
.jeu { position: relative; z-index: 1; height: 100vh; display: grid; grid-template-columns: 1fr 310px; gap: 14px; padding: 14px; }
.scene { background: var(--carte); border-radius: 30px; box-shadow: var(--ombre); overflow-y: auto; padding: 22px 26px; position: relative; display: flex; flex-direction: column; align-items: center; }
.scene > * { width: 100%; max-width: 760px; }
.scene.entre { animation: glisse .4s both; }
.lateral { background: rgba(255,255,255,.96); border-radius: 30px; box-shadow: var(--ombre); padding: 16px; display: flex; flex-direction: column; overflow: hidden; }
.lateral h3 { font-size: 24px; text-align: center; margin-bottom: 8px; } .lateral h3 span { display: inline-block; animation: ondule 2s infinite; }
.periodes { display: flex; gap: 5px; justify-content: center; margin-bottom: 8px; } .periodes button { font: 800 12px var(--police); padding: 6px 11px; border-radius: 999px; border: 0; background: #efe7ff; color: var(--violet); cursor: pointer; } .periodes button.actif { background: var(--violet); color: #fff; }
.rang { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 7px; padding: 3px; }
.rang .lig { display: flex; align-items: center; gap: 9px; background: #f1ebff; border-radius: 16px; padding: 9px 12px; font-weight: 900; text-transform: uppercase; animation: pop-in .4s both; animation-delay: calc(var(--i, 0) * 50ms); transition: transform .3s; }
.rang .lig .nb { margin-left: auto; color: #b45309; white-space: nowrap; } .rang .lig.moi { background: #d9f7e5; box-shadow: inset 0 0 0 3px #4ade80; } .rang .lig .medaille { width: 26px; text-align: center; }
.rang .lig.monte { animation: gelee .8s, brille 1s; }
.pied-lateral { padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.titre-arc { font-size: clamp(34px, 6vw, 58px); font-weight: 900; text-align: center; margin: 4px 0 2px; letter-spacing: .5px; }
.titre-arc span { display: inline-block; animation: ondule 2.2s ease-in-out infinite; animation-delay: calc(var(--i) * 110ms); }
.consigne { text-align: center; font-weight: 800; font-size: clamp(16px, 2.2vw, 22px); margin: 4px 0 14px; color: var(--encre); }
.tuiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; width: 100%; }
.tuile {
  --c: var(--violet); border: 0; cursor: pointer; border-radius: 26px; background: var(--c); color: #fff; font: 900 clamp(22px, 3.4vw, 34px) var(--police);
  padding: 26px 12px; min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 9px 0 rgba(0,0,0,.22); animation: pop-in .5s both; animation-delay: calc(var(--i, 0) * 80ms); transition: transform .15s, box-shadow .15s; text-shadow: 0 2px 0 rgba(0,0,0,.15);
}
.tuile .emo { font-size: clamp(38px, 5vw, 56px); line-height: 1; transition: transform .25s; } .tuile small { font-size: 14px; font-weight: 700; opacity: .9; }
.tuile:hover { transform: translateY(-5px) rotate(-1deg); box-shadow: 0 14px 0 rgba(0,0,0,.2); } .tuile:hover .emo { transform: scale(1.25) rotate(8deg); }
.tuile:active { transform: translateY(6px); box-shadow: 0 2px 0 rgba(0,0,0,.22); }
.tuiles.trois { grid-template-columns: repeat(3, 1fr); } .tuiles.quatre { grid-template-columns: repeat(2, 1fr); }
.retour { align-self: flex-start; margin-bottom: 4px; }
.joueur-pastille { align-self: center; margin-top: 18px; font: 900 18px var(--police); background: var(--orange); color: #fff; border: 0; border-radius: 999px; padding: 12px 24px; box-shadow: 0 6px 0 rgba(0,0,0,.2); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.joueur-pastille:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,.2); }
.bascule-classe { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; cursor: pointer; background: #efe7ff; padding: 8px 14px; border-radius: 999px; margin: 10px 4px 0; }
.bascule-classe input { width: 20px; height: 20px; accent-color: var(--violet); }
.bulles-joueurs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; width: 100%; }
.bulle-joueur { border: 0; cursor: pointer; border-radius: 26px; padding: 16px 8px; background: var(--c); color: #fff; font: 900 18px var(--police); display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 7px 0 rgba(0,0,0,.2); animation: pop-in .5s both; animation-delay: calc(var(--i, 0) * 45ms); text-transform: uppercase; word-break: break-word; }
.bulle-joueur .emo { font-size: 52px; transition: transform .25s; } .bulle-joueur:hover .emo { transform: scale(1.2) rotate(-8deg); } .bulle-joueur small { font-size: 12px; opacity: .9; }
.bulle-joueur:active { transform: translateY(5px); box-shadow: 0 1px 0 rgba(0,0,0,.2); }

/* Question */
.haut-jeu { display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 8px; }
.piste { flex: 1; height: 16px; background: #ece4fb; border-radius: 999px; position: relative; }
.piste .rempli { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f43f5e, #f59e0b, #22c55e); transition: width .5s cubic-bezier(.3, 1.4, .5, 1); }
.piste .fusee { position: absolute; top: -13px; font-size: 28px; transform: translateX(-50%) rotate(45deg); transition: left .5s cubic-bezier(.3, 1.4, .5, 1); filter: drop-shadow(0 3px 2px rgba(0,0,0,.2)); }
.compteur { font-weight: 900; color: var(--doux); white-space: nowrap; }
.flamme { font-weight: 900; font-size: 20px; color: #ea580c; white-space: nowrap; } .flamme.chaud { animation: pulse .6s infinite; }
.gain-flottant { font-weight: 900; font-size: 20px; color: #b45309; white-space: nowrap; }
.qui { text-align: center; font: 900 clamp(20px, 3vw, 28px) var(--police); color: var(--violet2); margin: 2px 0 6px; animation: pop-in .5s both; }
.zone-question { display: flex; gap: 14px; align-items: center; width: 100%; background: #f6f1ff; border-radius: 24px; padding: 14px 18px; margin-bottom: 14px; animation: glisse .45s both; }
.zone-question .mascotte { width: 84px; height: 84px; flex: none; }
.zone-question .texte { flex: 1; font-weight: 900; font-size: clamp(20px, 2.8vw, 30px); line-height: 1.25; }
.outils-q { display: flex; flex-direction: column; gap: 6px; }
.reponses { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: 100%; }
.rep {
  --c: var(--rouge); position: relative; border: 0; cursor: pointer; border-radius: 22px; background: var(--c); color: #fff; padding: 18px 16px 18px 58px; text-align: left;
  font: 900 clamp(17px, 2.3vw, 24px) var(--police); line-height: 1.2; min-height: 84px; box-shadow: 0 8px 0 rgba(0,0,0,.24); text-shadow: 0 2px 0 rgba(0,0,0,.14);
  animation: pop-in .5s both; animation-delay: calc(var(--i, 0) * 90ms); transition: transform .12s, box-shadow .12s, opacity .3s, filter .3s; display: flex; align-items: center;
}
.rep::before { content: ""; position: absolute; left: 16px; top: 50%; width: 28px; height: 28px; margin-top: -14px; border-radius: 50%; background: rgba(255,255,255,.4); box-shadow: inset 0 0 0 4px rgba(255,255,255,.75); }
.rep:hover:not(:disabled) { transform: translateY(-4px) scale(1.02); } .rep:active:not(:disabled) { transform: translateY(6px); box-shadow: 0 2px 0 rgba(0,0,0,.24); }
.rep.c0 { --c: var(--rouge); } .rep.c1 { --c: var(--bleu); } .rep.c2 { --c: var(--orange); } .rep.c3 { --c: var(--vert); }
.rep.bonne { animation: gelee .7s, brille 1s; box-shadow: 0 0 0 6px #fff, 0 0 0 12px #16a34a; } .rep.bonne::before { content: "✓"; display: flex; align-items: center; justify-content: center; color: #16a34a; background: #fff; font-size: 20px; }
.rep.mauvaise { animation: secoue .5s; filter: grayscale(.8) brightness(.8); opacity: .75; } .rep.mauvaise::before { content: "✗"; display: flex; align-items: center; justify-content: center; color: #be123c; background: #fff; font-size: 20px; }
.rep:disabled { cursor: default; } .rep.estompee { opacity: .45; }
.retour-q { width: 100%; margin-top: 14px; border-radius: 20px; padding: 14px 18px; font-weight: 800; font-size: clamp(16px, 2vw, 21px); animation: pop-in .45s both; display: none; }
.retour-q.montre { display: block; } .retour-q.bien { background: #dcfce7; color: #166534; } .retour-q.mal { background: #ffe4e6; color: #9f1239; } .retour-q.info { background: #fef3c7; color: #78350f; }
.retour-q strong { display: block; font-size: 1.2em; margin-bottom: 2px; }
.actions-q { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; width: 100%; }

/* Bulles */
.bassin { position: relative; width: 100%; height: clamp(300px, 46vh, 480px); border-radius: 26px; overflow: hidden; background: linear-gradient(180deg, #bae6fd 0%, #38bdf8 55%, #0ea5e9 100%); box-shadow: inset 0 0 40px rgba(255,255,255,.4); margin-top: 6px; }
.bassin::after { content: "🐠"; position: absolute; bottom: 8px; left: -60px; font-size: 40px; animation: nage 14s linear infinite; }
@keyframes nage { 0% { transform: translateX(0); } 100% { transform: translateX(110vw) scaleX(-1); } }
.bulle { position: absolute; bottom: -170px; width: 150px; height: 150px; animation: monte var(--d, 14s) linear infinite; animation-delay: var(--dl, 0s); left: var(--x, 10%); }
@keyframes monte { 0% { transform: translateY(0); } 100% { transform: translateY(calc(-1 * (clamp(300px, 46vh, 480px) + 340px))); } }
.bulle button { width: 100%; height: 100%; border: 0; border-radius: 50%; cursor: pointer; color: #fff; padding: 14px; font: 900 clamp(14px, 1.8vw, 19px) var(--police); line-height: 1.15; text-shadow: 0 2px 0 rgba(0,0,0,.2);
  background: radial-gradient(circle at 30% 28%, rgba(255,255,255,.9) 0 9%, rgba(255,255,255,.15) 10% 30%, transparent 31%), radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--c) 78%, #fff) 0%, var(--c) 70%);
  box-shadow: inset -8px -10px 18px rgba(0,0,0,.18), 0 6px 14px rgba(0,60,120,.3); animation: balance 3.2s ease-in-out infinite; animation-delay: var(--dl, 0s); display: flex; align-items: center; justify-content: center; text-align: center; }
@keyframes balance { 0%, 100% { transform: translateX(-16px) scale(1); } 50% { transform: translateX(16px) scale(1.04, .97); } }
.bulle.c0 button { --c: var(--rouge); } .bulle.c1 button { --c: var(--bleu); } .bulle.c2 button { --c: var(--orange); } .bulle.c3 button { --c: var(--vert); }
.bulle.eclate button { animation: eclate .4s forwards; } @keyframes eclate { to { transform: scale(1.7); opacity: 0; } } .bulle.mauvaise button { animation: secoue .5s, estompe .6s .4s forwards; } @keyframes estompe { to { opacity: .2; transform: scale(.7); } }
.bulle.estompee { opacity: .35; transition: opacity .4s; }
.bulle.bonne button { box-shadow: 0 0 0 8px #fff, 0 0 0 16px #16a34a; animation: gelee .7s; }

/* Vrai ou faux */
.carte-vf { width: 100%; background: #f6f1ff; border-radius: 26px; padding: 20px 22px; text-align: center; animation: pop-in .5s both; }
.carte-vf .q { font-weight: 900; font-size: clamp(19px, 2.6vw, 28px); margin-bottom: 12px; } .carte-vf .prop { font-weight: 900; font-size: clamp(22px, 3.2vw, 34px); color: var(--violet2); background: #fff; border-radius: 18px; padding: 14px; box-shadow: inset 0 0 0 4px #e9ddff; }
.minuteur { width: 100%; height: 14px; border-radius: 999px; background: #ece4fb; overflow: hidden; margin: 12px 0 4px; } .minuteur i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #22c55e, #f59e0b, #f43f5e); transform-origin: left; animation: compte var(--t, 12s) linear forwards; }
@keyframes compte { to { transform: scaleX(0); } }
.vf-boutons { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; margin-top: 12px; } .vf-boutons .tuile { min-height: 110px; }

/* Mémoire */
.memo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; perspective: 900px; }
.mcarte { aspect-ratio: 1 / 1.05; position: relative; cursor: pointer; border: 0; padding: 0; background: none; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.4, 1.5, .6, 1); animation: pop-in .5s both; animation-delay: calc(var(--i, 0) * 40ms); font-family: var(--police); }
.mcarte.retournee, .mcarte.trouvee { transform: rotateY(180deg); }
.mcarte .face, .mcarte .dos { position: absolute; inset: 0; border-radius: 18px; display: flex; align-items: center; justify-content: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; text-align: center; padding: 4px; }
.mcarte .dos { background: linear-gradient(135deg, #8b5cf6, #ec4899); font-size: 40px; box-shadow: 0 6px 0 rgba(0,0,0,.2); color: #fff; }
.mcarte .face { background: #fff; transform: rotateY(180deg); box-shadow: inset 0 0 0 5px #e9ddff, 0 6px 0 rgba(0,0,0,.14); font-weight: 900; font-size: clamp(13px, 1.8vw, 20px); line-height: 1.1; color: var(--encre); }
.mcarte .face.emoji { font-size: clamp(34px, 5vw, 58px); }
.mcarte.trouvee .face { background: #dcfce7; box-shadow: inset 0 0 0 5px #4ade80, 0 0 18px rgba(34,197,94,.6); } .mcarte.trouvee { animation: gelee .6s .3s; }
.mcarte.faux { animation: secoue .45s; }

/* Résultat */
.resultat { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.resultat .gros-badge { font-size: 82px; animation: saute .8s 2; } .resultat h2 { font-size: clamp(28px, 4vw, 42px); }
.resultat .score { font-size: clamp(46px, 7vw, 78px); font-weight: 900; color: var(--violet); } .resultat .score span { color: var(--orange); }
.gain-box { background: linear-gradient(135deg, #fde68a, #fbbf24); border-radius: 22px; padding: 12px 26px; font-weight: 900; font-size: 28px; box-shadow: 0 7px 0 #d97706; margin: 8px 0; animation: pop-in .6s .3s both; }
.gain-box .n { font-size: 40px; display: inline-block; min-width: 1.5em; }
.recap { width: 100%; text-align: left; margin-top: 14px; border-top: 3px dashed #e6dbfa; padding-top: 10px; max-height: 190px; overflow-y: auto; font-size: 15px; } .recap div { padding: 5px 0; border-bottom: 1px solid #f0eaff; } .recap .ok { color: #16a34a; font-weight: 900; } .recap .no { color: #e11d48; font-weight: 900; }
.modal { position: fixed; inset: 0; background: rgba(40, 10, 80, .72); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; animation: glisse .3s both; }
.modal .boite { background: #fff; border-radius: 30px; padding: 26px 30px; text-align: center; max-width: 430px; width: 100%; animation: pop-in .5s both; box-shadow: var(--ombre); }
.modal .boite .emo-badge { font-size: 92px; animation: saute .9s infinite; } .modal h3 { font-size: 28px; margin: 4px 0; } .modal p { margin: 6px 0 14px; font-weight: 700; color: var(--doux); }
.avatar-choix { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 8px 0; } .avatar-choix label { cursor: pointer; } .avatar-choix input { display: none; } .avatar-choix span { display: flex; align-items: center; justify-content: center; font-size: 28px; border-radius: 14px; padding: 5px 0; background: #f3ecff; border: 3px solid transparent; } .avatar-choix input:checked + span { border-color: var(--violet); background: #e6d8ff; transform: scale(1.1); }

/* Barre d'outils son */
.outils-son { position: fixed; bottom: 26px; left: 28px; z-index: 40; display: flex; gap: 6px; }
.outils-son button { width: 50px; height: 50px; border-radius: 50%; border: 0; font-size: 22px; cursor: pointer; background: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.2); transition: transform .12s; } .outils-son button:active { transform: translateY(3px); } .outils-son button.coupe { opacity: .45; filter: grayscale(1); }
.demarrage { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: linear-gradient(135deg, #6d28d9, #a21caf 55%, #ec4899); color: #fff; text-align: center; padding: 20px; cursor: pointer; }
.demarrage .mascotte { width: 190px; height: 190px; } .demarrage .btn { font-size: 26px; padding: 18px 40px; animation: pulse 1.4s infinite; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 55; }
.etoile-vol { position: fixed; z-index: 58; font-size: 34px; pointer-events: none; }

@media (max-width: 880px) {
  .outils-son { bottom: 12px; left: 12px; }
  body.jeu-corps { overflow: auto; height: auto; }
  .jeu { grid-template-columns: 1fr; height: auto; min-height: 100vh; } .scene { overflow: visible; padding: 16px 14px; } .lateral { max-height: 420px; }
  .reponses { grid-template-columns: 1fr; } .tuiles.trois { grid-template-columns: repeat(2, 1fr); } .memo { gap: 7px; } .zone-question .mascotte { display: none; } .outils-son button { width: 40px; height: 40px; font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .flottants { display: none; } .titre-arc span, .mascotte, .gros-badge, .emo-badge { animation: none !important; }
}

/* ───── Administration ───── */
.cartes-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.carte-stat { background: #fff; border-radius: 20px; padding: 14px 16px; box-shadow: 0 6px 0 rgba(0,0,0,.1); text-align: center; animation: pop-in .45s both; animation-delay: calc(var(--i, 0) * 60ms); }
.carte-stat b { display: block; font-size: 34px; color: var(--violet); line-height: 1.1; } .carte-stat span { font-weight: 800; font-size: 13px; color: var(--doux); }
.point { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #cbd5e1; margin-right: 6px; vertical-align: middle; }
.point.vert { background: #22c55e; animation: brille-vert 1.6s infinite; }
@keyframes brille-vert { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.7); } 100% { box-shadow: 0 0 0 10px rgba(34,197,94,0); } }
.barres { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 6px; }
.barres div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 11px; color: var(--doux); font-weight: 800; }
.barres i { display: block; width: 100%; min-height: 3px; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, #a78bfa, #7c3aed); }
.sous-liste { margin: 6px 0 0 18px; padding: 0; list-style: none; } .sous-liste li { padding: 3px 0; }
.rep-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } @media (max-width: 640px) { .rep-edit { grid-template-columns: 1fr; } }

/* ───── Quiz de classe : réglages, tirage, tours ───── */
.reglages { width: 100%; max-width: 920px; margin: 0 auto; display: grid; gap: 12px; padding-bottom: 20px; }
.reg-bloc { background: #fff; border-radius: 22px; padding: 12px 16px 14px; box-shadow: 0 8px 0 rgba(60,20,110,.12); text-align: left; }
.reg-bloc h3 { font-size: 19px; margin-bottom: 6px; color: var(--encre); } .reg-bloc .aide { margin: 0 0 8px; font-size: 14px; font-weight: 700; color: var(--doux); }
.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce { --c: var(--violet); cursor: pointer; border: 3px solid #e4d9fb; background: #faf7ff; color: var(--encre); border-radius: 999px; padding: 8px 16px; font: 800 17px var(--police); transition: transform .15s, background .15s, border-color .15s; }
.puce:hover { transform: translateY(-2px); } .puce:active { transform: scale(.96); }
.puce.on { background: var(--c); border-color: var(--c); color: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.18); animation: pop-in .3s both; }
.reg-resume { background: #fff7d6; border: 3px dashed #f6c744; border-radius: 18px; padding: 12px 16px; text-align: center; font: 800 20px var(--police); color: var(--encre); }
.rang-tour { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 0 0 8px; }
.pj { position: relative; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--c); font-size: 22px; transition: transform .3s, opacity .3s; }
.pj.fait { opacity: .4; filter: grayscale(.4); } .pj.aven { opacity: .85; } .pj.cour { transform: scale(1.35); box-shadow: 0 0 0 4px #fff, 0 0 0 8px var(--c); z-index: 1; }
.pj i { position: absolute; right: -4px; bottom: -4px; background: #22c55e; color: #fff; font: 900 11px var(--police); width: 17px; height: 17px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-style: normal; }
.tirage { text-align: center; margin-top: 40px; } .tirage-carte { --c: #8b5cf6; display: inline-flex; flex-direction: column; align-items: center; gap: 6px; background: var(--c); color: #fff; border-radius: 36px; padding: 26px 56px; min-width: 280px; box-shadow: 0 14px 0 rgba(0,0,0,.2); font: 900 clamp(34px, 6vw, 54px) var(--police); }
.tirage-carte .emo { font-size: clamp(70px, 12vw, 120px); line-height: 1; } .tirage-carte.arret { animation: pop-in .6s both; }
.podium { width: 100%; display: grid; gap: 8px; margin: 10px 0; }
.podium .lg { display: flex; align-items: center; gap: 12px; background: #faf7ff; border-radius: 18px; padding: 8px 16px; font-size: 20px; animation: pop-in .5s both; animation-delay: calc(var(--i) * .08s); }
.podium .lg:nth-child(1) { background: #fff3c4; font-size: 24px; } .podium .rg { width: 40px; font-size: 26px; text-align: center; } .podium b { flex: 1; text-align: left; } .podium .pt { font-weight: 900; color: var(--violet); } .podium .ga { color: #d97706; font-weight: 800; }

.pj em { position: absolute; left: -5px; top: -7px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #fbbf24; color: #5b3a00; font: 900 12px/20px var(--police); font-style: normal; text-align: center; }
.pj em.gagne { animation: pop-in .5s both; }

.plus-live { color: #16a34a; font-weight: 900; animation: pop-in .4s both; }

/* ───── Nouveaux jeux : pendu, relier, ordre, qui suis-je ?, jeu de l'oie ───── */
.secoue { animation: secoue .45s; }
.pendu, .relier, .ordre, .quisuisje { width: 100%; max-width: 860px; margin: 0 auto; }
.vies, .vies-r { display: flex; justify-content: center; gap: 6px; font-size: 28px; margin: 6px 0; } .vies .perdue, .vies-r .perdue { opacity: .18; filter: grayscale(1); transform: scale(.8); } .vies span, .vies-r span { transition: all .3s; }
.indice-p { text-align: center; font-weight: 800; color: var(--doux); margin: 4px 0 10px; }
.mot-p { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 10px 0 16px; }
.case-l { min-width: 44px; height: 56px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center; font: 900 32px var(--police); color: var(--encre); background: #fff; border-radius: 12px; border-bottom: 5px solid var(--violet); box-shadow: 0 4px 0 rgba(0,0,0,.12); animation: pop-in .35s both; }
.case-l.sep { background: transparent; box-shadow: none; border-color: transparent; min-width: 18px; } .case-l.rate { color: #f43f5e; border-color: #f43f5e; }
.clavier { display: grid; grid-template-columns: repeat(auto-fit, minmax(46px, 1fr)); gap: 7px; max-width: 700px; margin: 0 auto; }
.touche { cursor: pointer; border: 0; border-radius: 12px; padding: 12px 0; font: 900 22px var(--police); color: #fff; background: var(--violet); box-shadow: 0 5px 0 rgba(0,0,0,.2); transition: transform .1s; } .touche:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,.2); }
.touche.bonne-l { background: #22c55e; } .touche.mauvaise-l { background: #cbd5e1; color: #64748b; } .touche:disabled { cursor: default; }
.relier { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; } .col-r { display: grid; gap: 10px; align-content: start; }
.carte-r, .carte-o { cursor: pointer; border: 4px solid #e4d9fb; background: #fff; border-radius: 18px; padding: 12px 10px; font: 800 clamp(15px, 2vw, 20px) var(--police); color: var(--encre); box-shadow: 0 5px 0 rgba(0,0,0,.12); transition: transform .12s, background .2s, border-color .2s; }
.carte-r:hover, .carte-o:hover { transform: translateY(-3px); } .carte-r.choisie { border-color: var(--violet); background: #f1e9ff; transform: scale(1.04); }
.carte-r.lie { --c: #22c55e; background: var(--c); border-color: var(--c); color: #fff; animation: pop-in .4s both; cursor: default; }
.slots { display: grid; gap: 8px; margin: 6px 0 10px; } .slot { min-height: 48px; border: 3px dashed #cbbcf0; border-radius: 14px; padding: 8px 12px; display: flex; align-items: center; gap: 10px; font: 800 18px var(--police); color: var(--doux); background: rgba(255,255,255,.6); }
.slot.plein { border-style: solid; border-color: #22c55e; background: #e9fbef; color: var(--encre); animation: pop-in .35s both; } .slot .num { width: 30px; height: 30px; border-radius: 50%; background: var(--violet); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; flex: none; }
.cartes-o { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; } .carte-o.posee { opacity: .25; transform: scale(.92); }
.indices { display: grid; gap: 8px; margin-bottom: 10px; } .indice { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 16px; padding: 10px 14px; font: 800 clamp(16px, 2.2vw, 22px) var(--police); box-shadow: 0 5px 0 rgba(0,0,0,.1); } .indice.nouveau { animation: pop-in .45s both; } .indice span { width: 34px; height: 34px; border-radius: 50%; background: #f59e0b; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; flex: none; }
.plateau { position: relative; display: grid; grid-template-columns: repeat(10, 1fr); grid-auto-rows: minmax(64px, 1fr); gap: 6px; width: 100%; max-width: 980px; margin: 4px auto 10px; padding: 36px 8px 8px; background: rgba(255,255,255,.35); border-radius: 22px; }
.depart-o { position: absolute; left: 10px; top: 4px; display: flex; align-items: center; gap: 6px; } .depart-o b { font-size: 24px; }
.case-o { position: relative; background: #fff; border-radius: 12px; display: flex; align-items: center; justify-content: center; border-bottom: 4px solid #d9ccf5; min-height: 64px; } .case-o i { position: absolute; left: 5px; top: 2px; font: 800 11px var(--police); color: var(--doux); font-style: normal; }
.case-o b { font-size: clamp(18px, 2.4vw, 28px); opacity: .85; } .case-o.avance { background: #dcfce7; border-color: #22c55e; } .case-o.piege { background: #fee2e2; border-color: #f43f5e; } .case-o.fin { background: #fef3c7; border-color: #f59e0b; }
.pions { position: absolute; inset: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; align-content: center; gap: 1px; }
.pion { width: clamp(24px, 3vw, 34px); height: clamp(24px, 3vw, 34px); border-radius: 50%; background: var(--c); border: 2px solid #fff; display: inline-flex; align-items: center; justify-content: center; font-size: clamp(14px, 2vw, 20px); box-shadow: 0 2px 4px rgba(0,0,0,.3); transition: transform .2s; } .pion.actif { transform: scale(1.35); z-index: 2; box-shadow: 0 0 0 3px #fbbf24, 0 3px 6px rgba(0,0,0,.35); }
.depart-o .pions { position: static; justify-content: flex-start; inset: auto; }
.zone-oie { width: 100%; text-align: center; } .de { font-size: clamp(90px, 14vw, 150px); line-height: 1; margin: 6px 0; display: inline-block; animation: tourne .35s linear infinite; } .de.arret { animation: pop-in .5s both; }
@keyframes tourne { to { transform: rotate(360deg); } }
@media (max-width: 700px) { .relier { grid-template-columns: 1fr; } .plateau { grid-template-columns: repeat(10, 1fr); gap: 3px; } }

.tuiles.quatre .tuile:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* ───── Mini Monde (jeu 3D en cubes) ───── */
.tuile.monde-tuile { grid-column: 1 / -1; flex-direction: row; gap: 14px; background: linear-gradient(135deg, #16a34a, #0ea5e9); }
.tuile.monde-tuile small { display: block; }
.monde { position: fixed; inset: 0; z-index: 50; background: #a9d6ff; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.monde-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.monde-viseur { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #fff; font: 900 30px/1 var(--police); text-shadow: 0 0 3px #000, 0 0 1px #000; pointer-events: none; }
.monde-haut { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; align-items: center; gap: 8px; pointer-events: none; }
.monde-haut > * { pointer-events: auto; }
.monde-info { flex: 1; text-align: center; color: #fff; font-weight: 800; font-size: 16px; text-shadow: 0 2px 4px rgba(0,0,0,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.monde-btn { width: 52px; height: 52px; border-radius: 16px; border: 0; background: rgba(255,255,255,.85); box-shadow: 0 4px 0 rgba(0,0,0,.25); font: 800 24px/1 var(--police); color: var(--encre); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; touch-action: none; }
.monde-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.monde-btn.grand { width: 74px; height: 74px; font-size: 32px; border-radius: 22px; }
.monde-btn small { font-size: 11px; margin-top: 2px; }
.monde-btn.rouge { background: #fecaca; }
.monde-btn.on { background: #fde68a; }
.monde-btn.cache { display: none; }
.monde-droite { position: absolute; right: calc(14px + env(safe-area-inset-right)); bottom: calc(96px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.monde-pad { position: absolute; left: calc(18px + env(safe-area-inset-left)); bottom: calc(100px + env(safe-area-inset-bottom)); width: 140px; height: 140px; touch-action: none; }
.monde-manette { width: 100%; height: 100%; border-radius: 50%; background: rgba(255,255,255,.28); border: 3px solid rgba(255,255,255,.7); display: flex; align-items: center; justify-content: center; }
.monde-manette i { width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 3px 8px rgba(0,0,0,.3); pointer-events: none; }
.monde-barre { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(10px + env(safe-area-inset-bottom)); max-width: calc(100% - 20px); display: flex; gap: 6px; padding: 6px; background: rgba(0,0,0,.35); border-radius: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.monde-barre::-webkit-scrollbar { display: none; }
.monde-case { position: relative; flex: 0 0 auto; width: 52px; height: 52px; padding: 4px; border-radius: 10px; border: 3px solid rgba(255,255,255,.35); background: rgba(255,255,255,.15); cursor: pointer; }
.monde-case canvas { width: 100%; height: 100%; image-rendering: pixelated; display: block; border-radius: 4px; }
.monde-case.on { border-color: #fde047; background: rgba(253,224,71,.35); transform: translateY(-3px); }
.monde-case.rare { border-color: #c4b5fd; }
.monde-case span { position: absolute; right: 2px; bottom: 0; color: #fff; font: 900 13px var(--police); text-shadow: 0 1px 2px #000; }
.monde-toast { position: absolute; left: 50%; top: calc(74px + env(safe-area-inset-top)); transform: translate(-50%, -10px); background: rgba(43,29,82,.85); color: #fff; padding: 8px 16px; border-radius: 999px; font-weight: 800; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.monde-toast.vu { opacity: 1; transform: translate(-50%, 0); }
.monde.verrou .monde-pad, .monde.verrou .monde-droite { opacity: .35; }
.monde-q .boite { max-width: 520px; }
.monde-q-emo { font-size: 56px; animation: saute .9s infinite; }
.monde-q h3 { font-size: clamp(18px, 3vw, 24px); margin: 8px 0 14px; }
.monde-q-rep { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.monde-q-rep .btn { width: 100%; font-size: 17px; padding: 14px 10px; white-space: normal; }
.monde-q-rep .btn:disabled { cursor: default; }
.monde-q-rep .monde-bonne { outline: 5px solid #22c55e; outline-offset: 2px; }
.monde-q-fin .btn { margin-top: 12px; }
.monde-gain { font-size: 18px; color: #15803d; font-weight: 800; }
.monde-perdu { color: #9f1239; font-weight: 700; }
.monde-aide { text-align: left; }
.monde-aide h3, .monde-aide .btn { display: block; margin-left: auto; margin-right: auto; text-align: center; }
@media (max-width: 600px) {
  .monde-pad { width: 116px; height: 116px; bottom: calc(86px + env(safe-area-inset-bottom)); }
  .monde-btn.grand { width: 62px; height: 62px; font-size: 26px; }
  .monde-droite { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .monde-case { width: 44px; height: 44px; }
  .monde-q-rep { grid-template-columns: 1fr; }
}
@media (hover: hover) and (pointer: fine) { .monde-pad { display: none; } }
