/* Quatre en classe : charte de Quatre.be
   Framboise #FF4669, marine #2B3588, orange #F7630C, soleil #F5A524, ardoise #7D8386.
   Signature : des boutons en forme de touches de clavier. */

:root {
  --surface: #FFFFFF;
  --surface-2: #F6F7FB;
  --surface-chaude: #FFF6E2;
  --marine-texte: #2B3588;
  --encre-fixe: #1E2350;
  --bord-champ: #8A93B8;
  --framboise: #FF4669;
  --framboise-fonce: #D62D50;
  --marine: #2B3588;
  --marine-fonce: #1C2466;
  --encre: #1E2350;
  --orange: #F7630C;
  --soleil: #F5A524;
  --menthe: #1FA67A;
  --ardoise: #5E6569;
  --fond: #F2F4FB;
  --papier: #FFFFFF;
  --trait: #DCE0EF;
  --juste: #1FA67A;
  --juste-fond: #E3F6EE;
  --faux: #D62D50;
  --faux-fond: #FFE8EC;
  --rayon: 14px;
  --police: "Century Gothic", CenturyGothic, "URW Gothic", "URW Gothic L", "Avant Garde", "TeX Gyre Adventor", Futura, "Questrial", system-ui, sans-serif;
  --police-code: "Consolas", "SF Mono", "Menlo", "DejaVu Sans Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--police);
  font-size: 17px;
  line-height: 1.55;
  color: var(--encre);
  background: var(--fond);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; color: var(--marine-texte); }
h1 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.2rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--marine-texte); text-underline-offset: 3px; }
a:hover { color: var(--framboise-fonce); }
small { font-size: .82em; }
code, kbd { font-family: var(--police-code); }
:focus-visible { outline: 3px solid var(--soleil); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Marque ---------- */
.marque { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--marine-texte); }
.marque-texte { font-size: 1.2rem; letter-spacing: -.01em; }
.marque-texte b { color: var(--framboise); }

/* ---------- Touches de clavier (côté élèves) ---------- */
.touche {
  --face: var(--framboise);
  --ombre: var(--framboise-fonce);
  --texte: #fff;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 3rem;
  padding: .7rem 1.3rem;
  font: inherit;
  font-weight: 700;
  color: var(--texte);
  text-decoration: none;
  text-align: center;
  background: var(--face);
  border: 0;
  border-radius: 12px;
  box-shadow: 0 5px 0 var(--ombre), 0 7px 12px rgba(30, 35, 80, .14);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s, background-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.touche:hover { color: var(--texte); filter: brightness(1.04); }
.touche:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--ombre), 0 2px 4px rgba(30, 35, 80, .14); }
.touche:disabled { cursor: default; }
.touche kbd {
  font-size: .72rem;
  font-weight: 700;
  min-width: 1.6em;
  padding: .1em .4em;
  border-radius: 5px;
  background: rgba(255, 255, 255, .22);
  color: inherit;
  line-height: 1.4;
}
.touche-claire { --face: #fff; --ombre: #C9CFE6; --texte: var(--marine); }
.touche-claire kbd { background: var(--fond); }
.touche-petite { min-height: 2.3rem; padding: .35rem .9rem; font-size: .9rem; box-shadow: 0 3px 0 var(--ombre); }
.touche-petite:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ombre); }
.touche-grande { min-height: 3.6rem; padding: .9rem 2.2rem; font-size: 1.2rem; }
.touche-valider { --face: var(--marine); --ombre: var(--marine-fonce); }
.touche-suivant { --face: var(--marine); --ombre: var(--marine-fonce); margin-top: .8rem; }

/* ---------- Côté élèves : structure ---------- */
.barre-eleve {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .9rem clamp(1rem, 4vw, 2.5rem);
  background: var(--papier);
  border-bottom: 1px solid var(--trait);
}
.qui { display: flex; align-items: center; gap: .7rem; }
.qui-image { font-size: 1.8rem; line-height: 1; }
.qui-nom { display: flex; flex-direction: column; font-weight: 700; line-height: 1.15; }
.qui-nom small { font-weight: 400; color: var(--ardoise); }
.contenu-eleve { width: 100%; max-width: 1100px; margin: 0 auto; padding: clamp(1.2rem, 4vw, 2.5rem) clamp(1rem, 4vw, 2.5rem) 3rem; }
.pied { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; justify-content: center; padding: 1.4rem 1rem 2rem; font-size: .85rem; color: var(--ardoise); }
.pied a { color: var(--ardoise); }

.erreur-eleve { color: var(--faux); background: var(--faux-fond); padding: .7rem 1rem; border-radius: 10px; font-weight: 700; }
.flash { padding: .8rem 1.1rem; border-radius: 10px; margin: 0 0 1rem; font-weight: 700; }
.flash-ok { background: var(--juste-fond); color: #116B4E; }
.flash-erreur { background: var(--faux-fond); color: var(--faux); }
.flash-info { background: var(--surface-chaude); color: #8A5300; }

/* Accueil : le code de la classe */
.accueil { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: clamp(1rem, 5vh, 3rem); }
.accueil-titre .logo-carres { margin-bottom: 1rem; }
.accueil-titre .logo-carres rect { transform-box: fill-box; transform-origin: center; animation: carre-arrive .55s cubic-bezier(.3, 1.5, .5, 1) both; }
.accueil-titre .logo-carres rect:nth-child(2) { animation-delay: .1s; }
.accueil-titre .logo-carres rect:nth-child(3) { animation-delay: .2s; }
.accueil-titre .logo-carres rect:nth-child(4) { animation-delay: .3s; }
@keyframes carre-arrive { from { transform: scale(0) rotate(-40deg); opacity: 0; } }
.accueil-titre h1 { font-size: clamp(1.8rem, 1.2rem + 2.5vw, 2.8rem); max-width: 16ch; margin-inline: auto; }
.accueil-titre p { color: var(--ardoise); font-size: 1.1rem; }
.form-code { display: flex; flex-direction: column; align-items: center; margin-top: 1rem; }
.code-touches { position: relative; }
.code-touches input {
  font: 700 2rem var(--police-code); text-align: center; letter-spacing: .3em;
  width: 13ch; padding: .6rem; border: 3px solid var(--marine); border-radius: 12px; text-transform: uppercase;
}
.code-cases { display: none; }
.code-touches.avec-js input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: text; z-index: 2; }
.code-touches.avec-js .code-cases { display: flex; gap: clamp(.35rem, 1.5vw, .7rem); }
.code-cases span {
  display: grid; place-items: center;
  width: clamp(2.8rem, 12vw, 4rem); height: clamp(3.2rem, 13vw, 4.5rem);
  font: 700 clamp(1.5rem, 6vw, 2.2rem) var(--police-code);
  color: var(--marine-texte); background: var(--surface); border-radius: 12px;
  box-shadow: 0 5px 0 #C9CFE6, inset 0 0 0 2px #C9CFE6;
  transition: transform .08s, box-shadow .08s;
}
.code-cases span.remplie { box-shadow: 0 5px 0 var(--marine-fonce), inset 0 0 0 2px var(--marine); }
.code-cases span.active { box-shadow: 0 5px 0 var(--framboise-fonce), inset 0 0 0 3px var(--framboise); animation: clignote 1s steps(1) infinite; }
@keyframes clignote { 50% { box-shadow: 0 5px 0 #C9CFE6, inset 0 0 0 2px #C9CFE6; } }
.aide { color: var(--ardoise); font-size: .9rem; margin: 1rem 0; }
.form-code .erreur-eleve { max-width: 28rem; }

/* Choix du prénom et de l'image */
.etape { text-align: center; }
.etape-classe { display: inline-flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: center; font-weight: 700; color: var(--ardoise); }
.etape-classe a { font-weight: 400; font-size: .9rem; }
.pastille-classe { width: 14px; height: 14px; border-radius: 4px; background: var(--couleur); }
.prenoms { list-style: none; padding: 0; margin: 1.5rem auto 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.1rem .9rem; max-width: 900px; }
.prenoms .touche { width: 100%; --face: #fff; --ombre: #C9CFE6; --texte: var(--marine); font-size: 1.1rem; }
.prenoms .touche:hover { --ombre: var(--couleur); }
.images { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; max-width: 520px; margin: 1.5rem auto 0; }
.touche-image { --face: #fff; --ombre: #C9CFE6; aspect-ratio: 1; font-size: clamp(2rem, 8vw, 3rem); padding: 0; }
.retour { margin-top: 1.5rem; }

/* Tableau de bord */
.tableau-bord { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1.2rem; margin-bottom: 2rem; }
.bonjour h1 { margin-bottom: .2rem; }
.bonjour p { color: var(--ardoise); margin: 0; max-width: 46ch; }
.compteur {
  display: grid; grid-template-columns: auto auto 1fr; align-items: baseline; gap: 0 .4rem;
  min-width: 220px; padding: .8rem 1.2rem 1rem; background: var(--marine); color: #fff; border-radius: var(--rayon);
}
.compteur-etoile { color: var(--soleil); font-size: 1.6rem; }
.compteur strong { font-size: 2rem; line-height: 1; }
.compteur > span:last-of-type { opacity: .7; }
.compteur .jauge { grid-column: 1 / -1; margin-top: .6rem; }
.jauge { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.jauge div { height: 100%; background: var(--soleil); border-radius: inherit; }

.domaine-eleve { margin-bottom: 2.2rem; }
.domaine-eleve h2 { display: flex; align-items: center; gap: .6rem; font-size: 1.1rem; color: var(--encre); }
.domaine-eleve h2::before { content: ""; width: 14px; height: 14px; border-radius: 4px; background: var(--couleur); }
.tuiles { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 1.3rem 1.1rem; }
.tuile {
  display: grid; grid-template-rows: auto auto 1fr auto; gap: .25rem; height: 100%;
  padding: 1.1rem 1.1rem 1rem; text-decoration: none; color: var(--encre);
  background: var(--surface); border-radius: var(--rayon);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--couleur), #000 22%), 0 8px 16px rgba(30, 35, 80, .1);
  border-top: 5px solid var(--couleur);
  transition: transform .08s, box-shadow .08s;
}
.tuile:hover { color: var(--encre); transform: translateY(-2px); }
.tuile:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--couleur), 0 2px 4px rgba(30, 35, 80, .1); }
.tuile-icone { font-size: 2rem; line-height: 1.2; }
.tuile-titre { font-weight: 700; font-size: 1.08rem; color: var(--marine-texte); }
.tuile-resume { font-size: .9rem; color: var(--ardoise); line-height: 1.4; }
.tuile-bas { display: flex; align-items: center; justify-content: space-between; margin-top: .6rem; }
.nouveau { font-size: .75rem; font-weight: 700; color: #fff; background: var(--framboise); padding: .1rem .55rem; border-radius: 99px; }

.etoiles { letter-spacing: .05em; font-size: 1.15rem; white-space: nowrap; }
.etoiles .pleine { color: var(--soleil); }
.etoiles .vide { color: #D5D9E8; }

.badges { margin-top: 1rem; padding: 1.5rem; background: var(--surface); border-radius: var(--rayon); }
.badges h2 small { font-weight: 400; color: var(--ardoise); font-size: .8rem; margin-left: .4rem; }
.badges ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.badges li { display: flex; flex-direction: column; align-items: center; text-align: center; padding: .9rem .6rem; border-radius: 12px; background: var(--fond); }
.badges li strong { font-size: .92rem; margin-top: .3rem; }
.badges li small { color: var(--ardoise); line-height: 1.3; }
.badge-emoji { font-size: 1.9rem; line-height: 1; }
.badges li.a-gagner .badge-emoji { filter: grayscale(1); opacity: .35; }
.badges li.gagne { background: var(--surface-chaude); box-shadow: inset 0 0 0 2px var(--soleil); }

.texte-page { max-width: 68ch; background: var(--surface); padding: clamp(1.2rem, 4vw, 2.5rem); border-radius: var(--rayon); }
.texte-page h2 { margin-top: 1.5rem; }
.texte-page li { margin-bottom: .5rem; }

/* ---------- Jeux ---------- */
.zone-jeu { max-width: 820px; margin: 0 auto; }
.jeu-entete { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.jeu-entete h1 { margin: 0; font-size: 1.5rem; flex: 1; min-width: 12ch; }
.etiquette { display: inline-block; font-size: .75rem; font-weight: 700; padding: .15rem .6rem; border-radius: 99px; background: var(--surface-chaude); color: #8A5300; vertical-align: middle; }

.jeu { background: var(--surface); border-radius: 20px; padding: clamp(1.1rem, 4vw, 2rem); box-shadow: 0 2px 0 var(--trait); border-top: 6px solid var(--couleur); }
.jeu-intro { text-align: center; padding: 1.5rem 0 .5rem; }
.consigne { font-size: 1.15rem; max-width: 52ch; margin: 0 auto 1.4rem; }
.record { color: var(--ardoise); }

.jeu-haut { display: grid; grid-template-columns: 1fr auto; gap: .3rem 1rem; margin-bottom: 1.3rem; font-size: .88rem; color: var(--ardoise); }
.progression { grid-column: 1 / -1; height: 10px; border-radius: 99px; background: var(--fond); overflow: hidden; }
.progression-barre { height: 100%; width: 0; background: var(--couleur); border-radius: inherit; transition: width .3s; }
.progression-score { font-weight: 700; color: var(--encre); }

.jeu-carte { padding: 1.3rem; border-radius: var(--rayon); background: var(--fond); margin-bottom: 1.3rem; text-align: center; }
.enonce { font-size: clamp(1.15rem, 1rem + .6vw, 1.4rem); font-weight: 700; margin: 0; }
.jeu-carte-tri { min-height: 7rem; display: grid; place-items: center; }

.reponses { display: grid; gap: 1.1rem .9rem; }
.reponses-2 { grid-template-columns: 1fr 1fr; }
.reponses-3 { grid-template-columns: repeat(3, 1fr); }
.reponses-quiz { grid-template-columns: 1fr 1fr; }
.touche-choix { --face: #fff; --ombre: #C9CFE6; --texte: var(--encre); min-height: 3.6rem; font-size: 1.05rem; }
.touche-choix kbd { background: var(--fond); color: var(--ardoise); }
.touche-large { justify-content: flex-start; text-align: left; font-weight: 400; line-height: 1.35; }
.touche-choix.juste { --face: var(--juste-fond); --ombre: var(--juste); --texte: #0D5C42; box-shadow: 0 5px 0 var(--ombre), inset 0 0 0 2px var(--juste); }
.touche-choix.faux { --face: var(--faux-fond); --ombre: var(--faux); --texte: #8C1B33; box-shadow: 0 5px 0 var(--ombre), inset 0 0 0 2px var(--faux); }
.touche-choix:disabled:not(.juste):not(.faux) { opacity: .55; }

.verdict { margin-top: 1.4rem; padding: 1rem 1.2rem; border-radius: var(--rayon); text-align: left; animation: monte .25s ease-out; }
@keyframes monte { from { opacity: 0; transform: translateY(6px); } }
.verdict strong { font-size: 1.1rem; }
.verdict p { margin: .3rem 0 0; }
.verdict-juste { background: var(--juste-fond); }
.verdict-juste strong { color: #0D5C42; }
.verdict-faux { background: var(--faux-fond); }
.verdict-faux strong { color: #8C1B33; }

/* Faux messages (jeu de l'arnaque) */
.message { width: 100%; max-width: 480px; text-align: left; background: var(--surface); border-radius: 14px; padding: 1rem 1.1rem; box-shadow: 0 2px 8px rgba(30, 35, 80, .1); }
.message-tete { display: flex; flex-direction: column; gap: .1rem; margin-bottom: .5rem; font-size: .85rem; }
.message-genre { font-weight: 700; color: var(--ardoise); }
.message-de { font-family: var(--police-code); word-break: break-all; color: var(--marine-texte); }
.message-objet { font-weight: 700; margin-bottom: .4rem; }
.message-texte { margin: 0; }
.message-sms .message-texte, .message-dm .message-texte { background: var(--surface-2); padding: .7rem .9rem; border-radius: 16px 16px 16px 4px; }
.message-email { border-top: 4px solid var(--marine); }

/* Binaire */
.nombre-cible { color: var(--framboise); font-size: 1.5em; }
.bits { display: flex; justify-content: center; gap: clamp(.3rem, 1.5vw, .7rem); margin: 1.3rem 0 .4rem; flex-wrap: wrap; }
.bit {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  width: clamp(3rem, 9vw, 4.4rem); padding: .5rem 0 .6rem; font: inherit;
  background: var(--surface); border: 0; border-radius: 12px; cursor: pointer;
  box-shadow: 0 5px 0 #C9CFE6; transition: transform .08s, box-shadow .08s, background .15s;
}
.bits-8 .bit { width: clamp(2.4rem, 9.5vw, 3.8rem); }
.bit:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 #C9CFE6; }
.bit:disabled { cursor: default; }
.bit-valeur { font-size: .8rem; color: var(--ardoise); font-weight: 700; }
.bit-etat { font: 700 1.7rem var(--police-code); color: #B9BFD6; }
.bit.allume { background: var(--soleil); box-shadow: 0 5px 0 #C98500; }
.bit.allume .bit-etat { color: var(--encre); }
.bit.allume .bit-valeur { color: var(--encre); }
.somme { min-height: 1.6em; font-weight: 700; color: var(--marine-texte); margin: .5rem 0 0; }
.controles-binaire { display: flex; justify-content: center; align-items: center; gap: .8rem; flex-wrap: wrap; }
.champ-nombre { font: 700 1.6rem var(--police-code); width: 7ch; padding: .4rem .6rem; text-align: center; border: 3px solid var(--marine); border-radius: 12px; }

/* Mot de passe */
.touche-mdp { font-family: var(--police-code); font-weight: 700; word-break: break-all; }
.champ-mdp { width: 100%; max-width: 30rem; font: 1.3rem var(--police-code); padding: .7rem .9rem; border: 3px solid var(--marine); border-radius: 12px; margin-top: .8rem; }
.attention { font-size: .9rem; color: #8A5300; background: var(--surface-chaude); padding: .4rem .8rem; border-radius: 8px; display: inline-block; margin: .6rem 0 0; }
.jauge-mdp { height: 12px; max-width: 30rem; margin: .8rem auto .4rem; border-radius: 99px; background: var(--surface); overflow: hidden; }
.jauge-mdp div { height: 100%; width: 0; background: var(--faux); transition: width .25s, background .25s; }
.jauge-mdp[data-niveau="moyen"] div { background: var(--orange); }
.jauge-mdp[data-niveau="bon"] div { background: var(--soleil); }
.jauge-mdp[data-niveau="top"] div { background: var(--juste); }
.temps-mdp { min-height: 1.5em; font-weight: 700; color: var(--marine-texte); }
.criteres { list-style: none; padding: 0; margin: .4rem auto 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .3rem .8rem; max-width: 34rem; text-align: left; font-size: .92rem; }
.criteres li::before { content: "○"; display: inline-block; width: 1.4em; color: var(--ardoise); }
.criteres li.ok { color: #0D5C42; font-weight: 700; }
.criteres li.ok::before { content: "✓"; color: var(--juste); }

/* Robot */
.robot-mise-en-page { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.3rem; align-items: start; }
.robot-carte { margin: 0; }
.niveau-titre { font-weight: 700; color: var(--marine-texte); }
.grille-robot { position: relative; display: grid; gap: 4px; padding: 4px; background: #C9CFE6; border-radius: 12px; }
.case { aspect-ratio: 1; background: var(--surface); border-radius: 7px; display: grid; place-items: center; }
.case.mur { background: repeating-linear-gradient(45deg, var(--marine) 0 6px, var(--marine-fonce) 6px 12px); }
.etoile-cible { color: var(--soleil); font-size: clamp(1.4rem, 5vw, 2.2rem); line-height: 1; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.15); } }
.robot {
  --pas-l: calc((100% - 8px) / var(--lignes));
  --pas-k: calc((100% - 8px) / var(--colonnes));
  position: absolute;
  top: calc(4px + var(--l) * var(--pas-l));
  left: calc(4px + var(--k) * var(--pas-k));
  width: calc(var(--pas-k) - 4px);
  height: calc(var(--pas-l) - 4px);
  display: grid; place-items: center;
  color: var(--framboise);
  transition: top .35s ease-in-out, left .35s ease-in-out;
  pointer-events: none;
}
.robot svg { width: 78%; height: 78%; transform: rotate(var(--rot)); transition: transform .3s ease-in-out; }
.robot.secoue svg { animation: secoue .4s; }
@keyframes secoue { 25% { transform: rotate(var(--rot)) translateX(-4px); } 75% { transform: rotate(var(--rot)) translateX(4px); } }
.robot.gagne svg { animation: saute .5s; }
@keyframes saute { 50% { transform: rotate(var(--rot)) scale(1.25); } }
.robot-commandes h3 { margin: 1.2rem 0 .5rem; font-size: .95rem; }
.palette { display: grid; gap: .9rem; }
.touche-instr { --face: var(--marine); --ombre: var(--marine-fonce); justify-content: flex-start; }
.programme { list-style: none; padding: .6rem; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; min-height: 3.4rem; background: var(--fond); border-radius: 12px; counter-reset: instr; }
.programme-vide { color: var(--ardoise); font-size: .88rem; align-self: center; padding: 0 .3rem; }
.puce { width: 2.4rem; height: 2.4rem; font-size: 1.3rem; font-weight: 700; color: var(--marine-texte); background: var(--surface); border: 0; border-radius: 8px; box-shadow: 0 3px 0 #C9CFE6; cursor: pointer; }
.puce:hover { background: var(--faux-fond); }
.puce.active { background: var(--soleil); box-shadow: 0 3px 0 #C98500; }
.message-robot { min-height: 1.5em; font-weight: 700; color: var(--faux); margin: .6rem 0; font-size: .92rem; }
.controles-robot { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: .8rem; }

.lien { background: none; border: 0; padding: 0; font: inherit; color: var(--marine-texte); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.lien:hover { color: var(--framboise-fonce); }
.lien-danger { color: var(--faux); }

/* Fin de partie : le seul moment animé */
.jeu-fin { text-align: center; padding: 1rem 0 .5rem; }
.fin-etoiles { font-size: clamp(3.5rem, 12vw, 5.5rem); line-height: 1; margin-bottom: .6rem; }
.fin-etoiles span { display: inline-block; animation: etoile-arrive .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.fin-etoiles .pleine { color: var(--soleil); text-shadow: 0 4px 0 #C98500; }
.fin-etoiles .vide { color: #E2E5F0; }
@keyframes etoile-arrive { from { transform: scale(0) rotate(-90deg); opacity: 0; } }
.fin-score { font-size: 1.15rem; color: var(--ardoise); }
.fin-infos { min-height: 1rem; display: flex; flex-direction: column; align-items: center; gap: .5rem; margin-bottom: 1.3rem; }
.fin-record { font-weight: 700; color: var(--framboise); font-size: 1.1rem; margin: 0; }
.fin-badge { display: inline-flex; align-items: center; gap: .6rem; padding: .5rem 1rem; border-radius: 99px; background: var(--surface-chaude); box-shadow: inset 0 0 0 2px var(--soleil); font-weight: 700; }
.fin-boutons { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.note-essai { color: var(--ardoise); font-size: .9rem; }

/* ---------- Côté enseignants ---------- */
.cote-ens { font-size: 16px; background: var(--surface-2); }
.barre-ens { display: flex; align-items: center; gap: .8rem 2rem; flex-wrap: wrap; padding: .8rem clamp(1rem, 3vw, 2rem); background: var(--marine); }
.barre-ens .marque { color: #fff; }
.barre-ens .marque-texte b { color: #fff; }
.barre-ens .logo-carres { background: #fff; border-radius: 9px; padding: 3px; }
.nav-ens { display: flex; gap: .3rem; flex-wrap: wrap; flex: 1; }
.nav-ens a { color: #fff; text-decoration: none; padding: .45rem .8rem; border-radius: 8px; opacity: .85; }
.nav-ens a:hover { opacity: 1; background: rgba(255, 255, 255, .1); color: #fff; }
.nav-ens a[aria-current] { opacity: 1; background: rgba(255, 255, 255, .16); box-shadow: inset 0 -3px 0 var(--framboise); }
.ens-qui { color: rgba(255, 255, 255, .8); font-size: .9rem; }
.ens-qui a { color: #fff; margin-left: .5rem; }
.contenu-ens { width: 100%; max-width: 1200px; margin: 0 auto; padding: clamp(1.2rem, 3vw, 2.2rem) clamp(1rem, 3vw, 2rem) 3rem; }
.pied-ens { border-top: 1px solid var(--trait); }
.etroit { max-width: 34rem; margin-inline: auto; }
.intro { color: var(--ardoise); font-size: 1.05rem; max-width: 70ch; }
.note { color: var(--ardoise); font-size: .88rem; }

.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1.2rem; font: inherit; font-weight: 700; color: #fff; text-decoration: none;
  background: var(--framboise); border: 0; border-radius: 10px; cursor: pointer;
  box-shadow: 0 3px 0 var(--framboise-fonce);
}
.bouton:hover { color: #fff; background: #FF5A7A; }
.bouton:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--framboise-fonce); }
.bouton-clair { background: var(--surface); color: var(--marine-texte); box-shadow: 0 3px 0 #C9CFE6, inset 0 0 0 1px var(--trait); }
.bouton-clair:hover { background: var(--fond); color: var(--marine-texte); }
.bouton-danger { background: var(--faux); box-shadow: 0 3px 0 #9C1C37; }

.formulaire { display: grid; gap: 1rem; }
.formulaire label { display: grid; gap: .3rem; font-weight: 700; font-size: .92rem; }
.formulaire label small { font-weight: 400; color: var(--ardoise); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input[type="date"], input[type="url"], input:not([type]), select, textarea {
  font: inherit; font-weight: 400; color: var(--encre);
  padding: .6rem .75rem; border: 1px solid var(--bord-champ); border-radius: 9px; background: var(--surface); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--marine); box-shadow: 0 0 0 3px rgba(43, 53, 136, .2); }
textarea { resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 700; font-size: .92rem; margin-bottom: .4rem; padding: 0; }
.formulaire .choix { display: flex; flex-direction: row; align-items: baseline; gap: .5rem; font-weight: 400; }
.formulaire fieldset { display: grid; gap: .6rem; }
.si-mysql { display: grid; gap: .8rem; padding: 1rem; border-radius: 10px; background: var(--fond); }
.formulaire:not(:has(input[value="mysql"]:checked)) .si-mysql { display: none; }
.piege { position: absolute; left: -9999px; }

.titre-ligne { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.titre-ligne h1, .titre-ligne h2 { margin: 0; }
.mise-en-page-2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 2rem; align-items: start; }
.panneau { background: var(--surface); border-radius: var(--rayon); padding: 1.3rem 1.4rem; box-shadow: 0 1px 0 var(--trait), 0 0 0 1px #E8EBF5; }
.panneau h2 { font-size: 1.1rem; }
.panneau-danger { box-shadow: inset 0 0 0 1px #F5B5C2; }
.panneau-danger h2 { color: var(--faux); }
.etat-vide { padding: 1.5rem; border-radius: var(--rayon); border: 2px dashed #C9CFE6; color: var(--ardoise); }
.etat-vide strong { color: var(--encre); }

.liste-classes { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.liste-classes a {
  display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; height: 100%;
  padding: 1.1rem 1.2rem; text-decoration: none; color: var(--encre);
  background: var(--surface); border-radius: var(--rayon); border-left: 6px solid var(--couleur);
  box-shadow: 0 1px 0 var(--trait), 0 0 0 1px #E8EBF5;
}
.liste-classes a:hover { box-shadow: 0 0 0 2px var(--couleur); color: var(--encre); }
.classe-nom { font-weight: 700; font-size: 1.2rem; color: var(--marine-texte); }
.classe-annee { grid-column: 1; font-size: .88rem; color: var(--ardoise); }
.classe-code { grid-column: 2; grid-row: 1 / 3; align-self: center; font: 700 1rem var(--police-code); letter-spacing: .12em; padding: .3rem .55rem; border-radius: 7px; background: var(--fond); }
.classe-stats { grid-column: 1 / -1; font-size: .85rem; color: var(--ardoise); margin-top: .5rem; }

.couleurs { display: flex !important; flex-wrap: wrap; gap: .5rem; }
.couleurs legend { width: 100%; }
.pastille { display: block !important; position: relative; width: 2.1rem; height: 2.1rem; border-radius: 9px; background: var(--couleur); cursor: pointer; }
.pastille input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pastille:has(input:checked) { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--couleur); }
.pastille:has(input:focus-visible) { outline: 3px solid var(--soleil); outline-offset: 4px; }

.entete-classe { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; padding-bottom: 1rem; border-bottom: 4px solid var(--couleur); }
.entete-classe h1 { margin-bottom: .2rem; }
.fil { margin: 0 0 .3rem; font-size: .9rem; }
.sous-titre { color: var(--ardoise); margin: 0; }
.code-grand { display: grid; justify-items: end; gap: .1rem; }
.code-grand span { font-size: .8rem; color: var(--ardoise); }
.code-grand strong { font: 700 2rem var(--police-code); letter-spacing: .15em; color: var(--marine-texte); line-height: 1.1; }
.code-grand .lien { font-size: .85rem; }

.onglets { display: flex; gap: .3rem; flex-wrap: wrap; margin: 1.2rem 0 1.6rem; }
.onglets a { padding: .55rem 1rem; border-radius: 9px; text-decoration: none; font-weight: 700; color: var(--ardoise); }
.onglets a:hover { background: var(--surface); color: var(--marine-texte); }
.onglets a[aria-current] { background: var(--marine); color: #fff; }

.filtre { max-width: 20rem; margin-bottom: .8rem; }
.defile { overflow-x: auto; margin-bottom: 1rem; -webkit-overflow-scrolling: touch; }
.tableau { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--rayon); overflow: hidden; box-shadow: 0 0 0 1px #E8EBF5; font-size: .94rem; }
.tableau th, .tableau td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid #EEF0F7; vertical-align: middle; }
.tableau thead th { background: var(--surface-2); font-size: .82rem; color: var(--ardoise); font-weight: 700; }
.tableau tbody tr:last-child > * { border-bottom: 0; }
.tableau tr.en-attente { background: var(--surface-chaude); }
.actions { display: flex; gap: .9rem; flex-wrap: wrap; justify-content: flex-end; }
.actions form { margin: 0; }
.actions .lien { font-size: .88rem; }
.renommer { display: flex; gap: .5rem; align-items: center; }
.renommer input { max-width: 12rem; padding: .35rem .5rem; border-color: transparent; background: transparent; font-weight: 700; }
.renommer input:hover, .renommer input:focus { border-color: #C3C9E0; background: var(--surface); }
.renommer .lien { font-size: .8rem; opacity: 0; }
.renommer:focus-within .lien { opacity: 1; }
.image-secrete { font-size: 1.4rem; vertical-align: middle; }

.matrice th, .matrice td { text-align: center; white-space: nowrap; }
.matrice th:first-child, .matrice tbody th { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.matrice thead th:first-child { background: var(--surface-2); }
.matrice thead th { vertical-align: bottom; }
.matrice .jeu-icone { display: block; font-size: 1.3rem; }
.th-titre { display: block; max-width: 7.5rem; white-space: normal; line-height: 1.2; font-size: .75rem; margin: 0 auto; }
.matrice td small { display: block; color: var(--ardoise); font-size: .72rem; }
.matrice .etoiles { font-size: 1rem; }
.pas-joue { color: #C3C9E0; }
.recentes { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.recentes li { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; padding: .5rem .8rem; background: var(--surface); border-radius: 9px; }
.recentes small { color: var(--ardoise); }

.formulaire-jeux .domaine { margin-bottom: 1.6rem; }
.formulaire-jeux .domaine legend { display: flex; align-items: center; gap: .5rem; font-size: 1.05rem; color: var(--marine-texte); margin-bottom: .7rem; }
.formulaire-jeux .domaine legend::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--couleur); }
.formulaire-jeux .domaine { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .7rem; }
.jeu-choix { display: grid; grid-template-columns: auto auto 1fr; gap: .8rem; align-items: center; padding: .8rem 1rem; background: var(--surface); border-radius: 12px; box-shadow: 0 0 0 1px #E8EBF5; cursor: pointer; }
.jeu-choix:has(input:checked) { box-shadow: 0 0 0 2px var(--couleur); }
.jeu-choix input { width: 1.2rem; height: 1.2rem; accent-color: var(--marine); }
.jeu-choix small { color: var(--ardoise); }
.jeu-icone { font-size: 1.6rem; line-height: 1; }
.annees { font-size: .72rem; font-weight: 700; color: var(--marine-texte); background: var(--fond); padding: .05rem .45rem; border-radius: 99px; }
.barre-actions { position: sticky; bottom: 0; padding: 1rem 0; background: linear-gradient(transparent, #F6F7FB 35%); }

.grille-reglages { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.3rem; align-items: start; margin-bottom: 2rem; }
.grille-reglages form + form { margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px solid #EEF0F7; }
.equipe { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .4rem; }
.equipe li { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.equipe small { color: var(--ardoise); }
.equipe form { margin-left: auto; }

.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin: 0 0 2rem; }
.chiffres div { background: var(--surface); padding: 1rem 1.2rem; border-radius: var(--rayon); box-shadow: 0 0 0 1px #E8EBF5; }
.chiffres dt { font-size: .85rem; color: var(--ardoise); }
.chiffres dd { margin: 0; font-size: 2rem; font-weight: 700; color: var(--marine-texte); }
.populaires { margin: 0; padding-left: 1.3rem; }
.populaires small { color: var(--ardoise); }

.domaine-catalogue h2 { display: flex; align-items: center; gap: .5rem; margin-top: 1.8rem; }
.domaine-catalogue h2::before { content: ""; width: 14px; height: 14px; border-radius: 4px; background: var(--couleur); }
.catalogue { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.catalogue li { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; padding: 1rem 1.2rem; background: var(--surface); border-radius: 12px; box-shadow: 0 0 0 1px #E8EBF5; }
.catalogue h3 { margin: 0 0 .2rem; }
.catalogue p { margin: 0; color: var(--ardoise); font-size: .92rem; }

/* ---------- Cartes de connexion à imprimer ---------- */
.page-cartes { background: var(--surface); display: block; }
.cartes-barre { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.5rem; background: var(--fond); }
.cartes-barre p { margin: 0; }
.cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5cm, 1fr)); gap: 0; padding: 1rem; }
.carte { border: 1px dashed #9AA0B8; padding: .7cm .6cm; break-inside: avoid; border-top: 6px solid var(--couleur); }
.carte-tete { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--marine-texte); }
.carte-tete b { color: var(--framboise); }
.carte-prenom { font-size: 1.6rem; font-weight: 700; margin: .3rem 0 .5rem; }
.carte dl { display: grid; grid-template-columns: auto 1fr; gap: .25rem .6rem; margin: 0; font-size: .9rem; align-items: center; }
.carte dt { color: var(--ardoise); }
.carte dd { margin: 0; font-weight: 700; }
.carte-code { font: 700 1.3rem var(--police-code); letter-spacing: .15em; }
.carte-image { font-size: 1.6rem; vertical-align: middle; }

@media print {
  .cartes-barre { display: none; }
  .cartes { grid-template-columns: 1fr 1fr; padding: 0; }
  .carte { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { margin: 1cm; }
}

/* ---------- Petits écrans ---------- */
@media (max-width: 860px) {
  .mise-en-page-2 { grid-template-columns: 1fr; }
  .mise-en-page-2 > aside { order: -1; }
  .robot-mise-en-page { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .reponses-quiz, .reponses-3 { grid-template-columns: 1fr; }
  .images { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .compteur { width: 100%; }
  .catalogue li { grid-template-columns: auto 1fr; }
  .catalogue li .bouton { grid-column: 1 / -1; }
  .code-grand { justify-items: start; }
  .touche kbd { display: none; }
  .qui-nom small { display: none; }
}

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

/* ---------- Atelier ---------- */
.creer-jeu { margin-bottom: 2rem; }
.modeles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.modele {
  display: grid; justify-items: start; gap: .3rem; text-align: left;
  padding: 1rem 1.1rem 1.1rem; font: inherit; color: var(--encre); cursor: pointer;
  background: var(--fond); border: 0; border-radius: 12px; box-shadow: 0 4px 0 #C9CFE6;
  transition: transform .08s, box-shadow .08s;
}
.modele:hover { box-shadow: 0 4px 0 var(--marine), inset 0 0 0 2px var(--marine); }
.modele:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--marine); }
.modele strong { font-size: 1.1rem; color: var(--marine-texte); }
.modele small { color: var(--ardoise); line-height: 1.4; }
.modele-apercu { width: 100%; height: 3.4rem; margin-bottom: .5rem; border-radius: 8px; background-color: #fff; background-repeat: no-repeat; }
.modele-quiz {
  background-image: linear-gradient(var(--marine), var(--marine)), linear-gradient(#DCE0EF, #DCE0EF), linear-gradient(var(--juste), var(--juste)), linear-gradient(#DCE0EF, #DCE0EF), linear-gradient(#DCE0EF, #DCE0EF);
  background-size: 60% 6px, 42% 9px, 42% 9px, 42% 9px, 42% 9px;
  background-position: 12px 10px, 12px 26px, calc(100% - 12px) 26px, 12px 40px, calc(100% - 12px) 40px;
}
.modele-tri {
  background-image: linear-gradient(var(--framboise), var(--framboise)), linear-gradient(var(--marine), var(--marine)), linear-gradient(#DCE0EF, #DCE0EF), linear-gradient(#DCE0EF, #DCE0EF), linear-gradient(#DCE0EF, #DCE0EF);
  background-size: 40% 8px, 40% 8px, 32% 8px, 32% 8px, 32% 8px;
  background-position: 10% 10px, 90% 10px, 14% 26px, 86% 26px, 14% 40px;
}
.modele-vf {
  background-image: linear-gradient(var(--marine), var(--marine)), linear-gradient(var(--juste), var(--juste)), linear-gradient(var(--faux), var(--faux));
  background-size: 70% 7px, 30% 14px, 30% 14px;
  background-position: 50% 10px, 22% 32px, 78% 32px;
}

.statut { display: inline-block; vertical-align: middle; font-size: .72rem; font-weight: 700; padding: .12rem .55rem; border-radius: 99px; background: var(--surface-2); color: var(--ardoise); white-space: nowrap; }
.statut-publie, .statut-faite { background: var(--juste-fond); color: #0D5C42; }
.statut-brouillon, .statut-nouvelle { background: var(--surface-chaude); color: #8A5300; }
.statut-en_cours { background: var(--surface-2); color: var(--marine-texte); }
.statut-refusee { background: var(--faux-fond); color: var(--faux); }
.origine { font-size: .72rem; font-weight: 700; color: var(--framboise-fonce); margin-left: .3rem; }

.bloc-demandes { margin-top: 2.5rem; }
.demandes { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.demandes > li { background: var(--surface); border-radius: 12px; padding: .9rem 1.1rem; box-shadow: 0 0 0 1px #E8EBF5; }
.grille-atelier .demandes > li { background: var(--fond); box-shadow: none; }
.demandes .titre-ligne { margin-bottom: .2rem; }
.demandes summary { cursor: pointer; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.demandes details .formulaire { margin-top: .8rem; }
.reponse { margin: .5rem 0; padding: .6rem .9rem; border-left: 4px solid var(--soleil); background: var(--surface-chaude); border-radius: 0 8px 8px 0; font-size: .92rem; }
.actions-gauche { justify-content: flex-start; }
.catalogue .actions { flex-direction: column; align-items: flex-end; gap: .3rem; }

/* Éditeur */
.editeur-mise-en-page { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.6rem; align-items: start; }
.editeur { display: grid; gap: 1.4rem; }
.editeur > .panneau > legend { float: left; width: 100%; font-size: 1.15rem; color: var(--marine-texte); margin-bottom: 1rem; }
.editeur > .panneau > legend + * { clear: both; }
.editeur label { display: grid; gap: .3rem; font-weight: 700; font-size: .9rem; }
.editeur label small { font-weight: 400; color: var(--ardoise); }
.editeur .choix { display: inline-flex; flex-direction: row; align-items: center; gap: .4rem; font-weight: 400; margin-right: 1.2rem; }
.grille-champs { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.2rem; }
.grille-champs .large { grid-column: 1 / -1; }
.grille-champs fieldset legend { font-size: .9rem; }
.categories-tri { grid-template-columns: repeat(3, 1fr); margin-bottom: 1.2rem; }
.icones { display: flex !important; flex-wrap: wrap; gap: .4rem; }
.icones legend { width: 100%; }
.icone-choix { display: block !important; position: relative; cursor: pointer; }
.icone-choix input { position: absolute; opacity: 0; }
.icone-choix span { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; font-size: 1.4rem; border-radius: 9px; background: var(--fond); }
.icone-choix input:checked + span { background: var(--surface); box-shadow: inset 0 0 0 2px var(--marine); }
.icone-choix input:focus-visible + span { outline: 3px solid var(--soleil); outline-offset: 2px; }

.lignes { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .8rem; counter-reset: ligne; }
.ligne { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: .8rem; align-items: start; padding: .9rem; background: var(--fond); border-radius: 12px; counter-increment: ligne; }
.ligne-num::before { content: counter(ligne); display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 8px; background: var(--surface); font-weight: 700; color: var(--marine-texte); }
.ligne-champs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem .8rem; }
.ligne-champs .large { grid-column: 1 / -1; }
.ligne-champs input, .ligne-champs select { padding: .45rem .6rem; }
.ligne-champs .bonne input { border-color: var(--juste); box-shadow: inset 4px 0 0 var(--juste); }
.ligne-champs .mauvaise input { box-shadow: inset 4px 0 0 #F5B5C2; }
.ligne .lien { font-size: .82rem; margin-top: .3rem; }

.import { margin-bottom: 1rem; padding: .8rem 1rem; border-radius: 12px; background: var(--surface-chaude); box-shadow: inset 0 0 0 1px #F7DFAA; }
.import summary { cursor: pointer; font-weight: 700; color: var(--marine-texte); }
.import[open] summary { margin-bottom: .8rem; }
.import .format code { display: inline-block; font-size: .85rem; padding: .3rem .6rem; background: var(--surface); border-radius: 6px; }
.import textarea { font-family: var(--police-code); font-size: .88rem; }
.invite { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #F7DFAA; }
.invite pre { white-space: pre-wrap; font: .85rem/1.5 var(--police-code); background: var(--surface); padding: .8rem; border-radius: 8px; margin: .5rem 0; }

.barre-editeur { display: flex; gap: .8rem; flex-wrap: wrap; z-index: 2; }
.bouton-publier { background: var(--marine); box-shadow: 0 3px 0 var(--marine-fonce); }
.bouton-publier:hover { background: #3A45A0; }
.editeur-cote { display: grid; gap: 1rem; position: sticky; top: 1rem; }
.editeur-cote p { font-size: .92rem; }
.a-faire { margin: 0; padding-left: 1.2rem; font-size: .9rem; color: #8A5300; }
.a-faire li { margin-bottom: .3rem; }

@media (max-width: 960px) {
  .editeur-mise-en-page { grid-template-columns: 1fr; }
  .editeur-cote { position: static; }
}
@media (max-width: 600px) {
  .grille-champs, .categories-tri, .ligne-champs { grid-template-columns: 1fr; }
  .ligne { grid-template-columns: minmax(0, 1fr); }
  .ligne-num { display: none; }
}

/* ---------- Glisser-déposer ---------- */
.glissable { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.glissable:active { cursor: grabbing; }
.en-vol { opacity: .3; }
.fantome { position: fixed; z-index: 1000; pointer-events: none; margin: 0; transform: rotate(-2deg) scale(1.04); box-shadow: 0 14px 30px rgba(30, 35, 80, .3) !important; opacity: .95; }
.choisi { outline: 3px solid var(--soleil) !important; outline-offset: 3px; }
.a-une-selection [data-cible]:not(:disabled) { animation: appel 1.2s ease-in-out infinite; }
@keyframes appel { 50% { box-shadow: 0 0 0 4px rgba(245, 165, 36, .45); } }
[data-cible].survol { outline: 3px dashed var(--marine); outline-offset: 3px; }
.secoue-moi { animation: secoue-x .4s; }
@keyframes secoue-x { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.aide-glisser { color: var(--ardoise); font-size: .9rem; text-align: center; margin: 0 0 .8rem; }

.jeu-carte-tri { position: relative; }
.jeu-carte-tri.glissable { box-shadow: 0 0 0 2px #C9CFE6, 0 6px 0 #C9CFE6; background: var(--surface); }
.jeu-carte-tri.glissable:hover { box-shadow: 0 0 0 2px var(--marine), 0 6px 0 var(--marine); }
.poignee { position: absolute; right: .7rem; bottom: .5rem; font-size: .72rem; color: var(--ardoise); }
.carte-juste { box-shadow: inset 0 0 0 2px var(--juste); background: var(--juste-fond); }
.carte-faux { box-shadow: inset 0 0 0 2px var(--faux); background: var(--faux-fond); }
.carte-juste .poignee, .carte-faux .poignee { display: none; }

/* Mots et étiquettes à glisser */
.banque { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; min-height: 3rem; padding: .9rem; border-radius: var(--rayon); background: var(--fond); }
.mot { font: inherit; font-weight: 700; color: var(--marine-texte); padding: .5rem 1rem; background: var(--surface); border: 0; border-radius: 10px; box-shadow: 0 4px 0 #C9CFE6; }
.mot:hover { box-shadow: 0 4px 0 var(--marine); }

/* Texte à trous */
.jeu-carte-texte { text-align: left; background: var(--surface); box-shadow: inset 0 0 0 2px var(--fond); }
.texte-trous { font-size: clamp(1.1rem, 1rem + .4vw, 1.3rem); line-height: 2.4; margin: 0; }
.trou { display: inline-block; min-width: 7ch; min-height: 1.9em; margin: 0 .2em; padding: 0 .6em; vertical-align: middle; font: inherit; font-weight: 700; line-height: 1.9em; text-align: center; color: var(--marine-texte); background: var(--fond); border: 2px dashed #9AA3C8; border-radius: 8px; }
button.trou { cursor: pointer; }
.trou-saisie { border-style: solid; width: auto; line-height: 1.4; }
.trou-juste { background: var(--juste-fond); border: 2px solid var(--juste); color: #0D5C42; }
.trou-rattrape { background: var(--surface-chaude); border: 2px solid var(--orange); color: #8A5300; }
.trou-faux { background: var(--faux-fond); border: 2px solid var(--faux); color: #8C1B33; }

/* Relier par paires */
.paires { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 1rem clamp(1rem, 6vw, 4rem); }
.colonne { display: grid; gap: .7rem; align-content: start; }
.carte-paire { font: inherit; color: var(--encre); text-align: left; padding: .75rem 1rem; background: var(--surface); border: 0; border-radius: 12px; box-shadow: 0 4px 0 #C9CFE6, inset 0 0 0 2px #E3E7F4; min-height: 3.2rem; }
.colonne-gauche .carte-paire { font-weight: 700; color: var(--marine-texte); }
.cible-paire { cursor: pointer; }
.carte-paire.relie { background: color-mix(in srgb, var(--paire) 12%, #fff); box-shadow: inset 0 0 0 3px var(--paire); color: var(--encre); }
.carte-paire.relie::after { content: " ✓"; color: var(--paire); font-weight: 700; }

/* Memory */
.memory { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; perspective: 900px; }
.memory-16 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.memory-8, .memory-10 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.carte-memory { position: relative; aspect-ratio: 4 / 3; padding: 0; border: 0; background: none; cursor: pointer; transform-style: preserve-3d; transition: transform .35s; font: inherit; }
.carte-memory .face { position: absolute; inset: 0; display: grid; place-items: center; padding: .4rem; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.carte-memory .dos {
  background-color: var(--marine);
  background-image: radial-gradient(circle at 30% 30%, var(--framboise) 0 14%, transparent 15%), radial-gradient(circle at 70% 30%, #fff 0 14%, transparent 15%), radial-gradient(circle at 30% 70%, var(--soleil) 0 14%, transparent 15%), radial-gradient(circle at 70% 70%, var(--orange) 0 14%, transparent 15%);
  box-shadow: 0 5px 0 var(--marine-fonce);
}
.carte-memory .recto { transform: rotateY(180deg); background: var(--surface); box-shadow: 0 5px 0 #C9CFE6, inset 0 0 0 2px #E3E7F4; font-weight: 700; font-size: clamp(.85rem, .7rem + .6vw, 1.1rem); color: var(--marine-texte); text-align: center; line-height: 1.25; }
.carte-memory.ouverte, .carte-memory.trouvee { transform: rotateY(180deg); }
.carte-memory.trouvee .recto { box-shadow: inset 0 0 0 3px var(--paire); background: color-mix(in srgb, var(--paire) 10%, #fff); }

/* Course */
.chrono { grid-column: 1 / -1; height: 14px; border-radius: 99px; background: var(--fond); overflow: hidden; }
.chrono-barre { height: 100%; background: var(--menthe); border-radius: inherit; transition: width 1s linear, background .3s; }
.chrono.presse .chrono-barre { background: var(--framboise); }
.chrono-texte { font-weight: 700; font-size: 1.1rem; color: var(--encre); font-variant-numeric: tabular-nums; }
.fin-course { text-align: center; }

/* Étiquettes sur une image */
.carte-image { padding: .6rem; background: var(--surface); box-shadow: inset 0 0 0 2px var(--fond); }
.image-zones { position: relative; max-width: 760px; margin: 0 auto; }
.image-zones img { display: block; width: 100%; height: auto; border-radius: 10px; user-select: none; -webkit-user-drag: none; }
.zone-cible {
  position: absolute; transform: translate(-50%, -50%);
  min-width: 2.2rem; height: 2.2rem; padding: 0 .5rem; font: inherit; font-weight: 700; font-size: .95rem;
  color: #fff; background: var(--framboise); border: 3px solid #fff; border-radius: 99px; cursor: pointer;
  box-shadow: 0 3px 8px rgba(30, 35, 80, .35);
}
.zone-placee { color: #0D5C42; background: var(--surface); border-color: var(--juste); font-size: .82rem; white-space: nowrap; cursor: default; }
.zone-rattrapee { color: #8A5300; border-color: var(--orange); }

/* Vidéo interactive */
.video-cadre { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 14px; overflow: hidden; margin-bottom: 1rem; }
.video-cadre video, .video-cadre iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-cadre .erreur-eleve { position: absolute; left: 1rem; right: 1rem; bottom: 1rem; }
.video-question:empty { display: none; }

/* H5P */
.jeu-h5p iframe { display: block; width: 100%; border: 0; border-radius: 10px; background: var(--surface); }
.activite-libre { font-size: .75rem; font-weight: 700; color: var(--marine-texte); background: var(--fond); padding: .1rem .55rem; border-radius: 99px; }

@media (max-width: 560px) {
  .paires { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: .6rem; }
  .carte-paire { padding: .55rem .6rem; font-size: .9rem; }
  .memory { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
  .zone-cible { min-width: 1.8rem; height: 1.8rem; font-size: .8rem; }
  .zone-placee { font-size: .7rem; padding: 0 .35rem; }
}
.banque:empty { display: none; }

/* Atelier : modèles regroupés et éditeurs avec médias */
.groupes-modeles h3 { margin: 1.2rem 0 .6rem; font-size: .95rem; color: var(--ardoise); }
.groupes-modeles h3:first-of-type { margin-top: 0; }
.modele-apercu { display: grid; place-items: center; height: 3rem; font-size: 1.7rem; background-image: none !important; }
.aide-editeur { font-size: .9rem; color: var(--ardoise); margin: .8rem 0; }
.apercu-zones { position: relative; max-width: 760px; margin: 0 auto; border-radius: 10px; background: var(--fond); min-height: 4rem; display: grid; place-items: center; }
.apercu-zones img { display: block; width: 100%; height: auto; border-radius: 10px; cursor: crosshair; }
.apercu-zones.mode-placement { outline: 3px dashed var(--framboise); outline-offset: 4px; }
.repere { position: absolute; transform: translate(-50%, -50%); padding: .15rem .55rem; font-size: .78rem; font-weight: 700; color: #fff; background: var(--framboise); border: 2px solid #fff; border-radius: 99px; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 6px rgba(30, 35, 80, .35); }
.ligne.en-placement { box-shadow: inset 0 0 0 3px var(--framboise); }
.emplacement { grid-column: 1 / -1; margin: 0; font-size: .88rem; color: var(--ardoise); }
.ligne-zones .ligne-champs, .ligne-paires .ligne-champs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ligne-vq .moment { max-width: 9rem; }
.moment-actuel { align-self: end; justify-self: start; font-size: .85rem; margin-bottom: .55rem; }
.choix-source { display: flex; gap: 1.2rem; flex-wrap: wrap; margin-bottom: 1rem; }
.si-fichier, .si-youtube { margin-bottom: 1rem; }
.editeur:has(input[name=source_video][value=fichier]:checked) .si-youtube { display: none; }
.editeur:has(input[name=source_video][value=youtube]:checked) .si-fichier { display: none; }
.apercu-video { max-width: 640px; }
.apercu-video video, .apercu-video iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 10px; background: #000; }
.editeur input[type=file] { padding: .5rem; background: var(--fond); border-radius: 9px; }

/* ---------- Mode direct ---------- */
.point-direct { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; background: var(--framboise); box-shadow: 0 0 0 0 rgba(255, 70, 105, .6); animation: emission 1.6s infinite; flex: none; }
@keyframes emission { 70% { box-shadow: 0 0 0 .55rem rgba(255, 70, 105, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 70, 105, 0); } }
.bouton-direct { margin-left: auto; align-self: center; background: var(--surface); color: var(--marine-texte); box-shadow: 0 3px 0 #C9CFE6, inset 0 0 0 1px var(--trait); }
.bouton-direct:hover { background: var(--fond); color: var(--marine-texte); }
.bouton-direct .point-direct { margin-right: .2rem; }

.bandeau-direct {
  display: flex; align-items: center; gap: .9rem; margin: 0 0 1.8rem; padding: .9rem 1.2rem;
  color: #fff; text-decoration: none; background: var(--marine); border-radius: var(--rayon);
  box-shadow: 0 6px 0 var(--marine-fonce);
}
.bandeau-direct:hover { color: #fff; }
.bandeau-direct > span:nth-child(2) { flex: 1; }
.bandeau-direct .point-direct { background: #fff; }
.bandeau-direct[hidden] { display: none; }
.bandeau-connexion { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 50; margin: 0; padding: .5rem 1rem; border-radius: 99px; background: var(--encre); color: #fff; font-size: .9rem; }

.grille-direct .panneau h2 { display: flex; gap: .5rem; align-items: center; }

/* Écran projeté */
.cote-direct-ens { background: var(--fond); }
.barre-direct { display: flex; align-items: center; gap: .8rem 1.5rem; flex-wrap: wrap; padding: .7rem clamp(1rem, 3vw, 2rem); background: var(--marine); color: #fff; }
.barre-direct .marque { color: #fff; }
.barre-direct .marque-texte b { color: #fff; }
.barre-direct .logo-carres { background: #fff; border-radius: 9px; padding: 3px; }
.direct-titre { font-weight: 700; flex: 1; opacity: .85; }
.direct-acces { font-size: 1.05rem; }
.code-direct { font-family: var(--police-code); letter-spacing: .12em; font-size: 1.35rem; color: var(--soleil); }
.lien-clair { color: #fff; }
.direct { width: 100%; max-width: 1400px; margin: 0 auto; padding: clamp(1rem, 3vw, 2.5rem); }
.direct-chargement { text-align: center; color: var(--ardoise); }

.direct-attente { text-align: center; padding-top: 3vh; }
.direct-attente h1 { font-size: clamp(2rem, 1.4rem + 3vw, 4rem); }
.direct-consigne { font-size: 1.3rem; color: var(--ardoise); }
.compteur-participants { font-size: 2rem; font-weight: 700; color: var(--framboise); margin: 2rem 0 1rem; }
.noms-participants { list-style: none; padding: 0; margin: 0 auto 2.5rem; max-width: 1000px; display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.noms-participants li { padding: .45rem 1rem; border-radius: 99px; background: var(--surface); font-weight: 700; font-size: 1.2rem; color: var(--marine-texte); box-shadow: 0 3px 0 #C9CFE6; animation: monte .3s ease-out; }

.direct-entete { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .5rem 2rem; margin-bottom: 2rem; }
.direct-numero { grid-column: 1 / -1; font-weight: 700; color: var(--ardoise); }
.direct-question { font-size: clamp(1.6rem, 1rem + 2.4vw, 3.2rem); margin: 0; color: var(--encre); }
.chrono-rond {
  --part: 1;
  display: grid; place-items: center; width: 6.5rem; height: 6.5rem; border-radius: 50%;
  background: conic-gradient(var(--marine) calc(var(--part) * 360deg), #DCE0EF 0);
}
.chrono-rond span { display: grid; place-items: center; width: 5.2rem; height: 5.2rem; border-radius: 50%; background: var(--surface); font-size: 2.2rem; font-weight: 700; color: var(--marine-texte); font-variant-numeric: tabular-nums; }
.chrono-rond.presse { background: conic-gradient(var(--framboise) calc(var(--part) * 360deg), #DCE0EF 0); }
.chrono-rond.presse span { color: var(--framboise); }

.tuiles-direct { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.tuile-direct {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 1rem; min-height: 6rem;
  padding: 1rem 1.4rem; font: inherit; font-size: clamp(1.1rem, .9rem + 1vw, 1.8rem); font-weight: 700; text-align: left;
  color: #fff; border: 0; border-radius: 16px; box-shadow: 0 6px 0 rgba(0, 0, 0, .25);
}
.tuile-direct.c0 { background: var(--framboise); }
.tuile-direct.c1 { background: var(--marine); }
.tuile-direct.c2 { background: var(--soleil); color: var(--encre); }
.tuile-direct.c3 { background: var(--menthe); }
.tuile-direct .forme { font-size: 1.6em; line-height: 1; flex: none; width: 1.2em; text-align: center; }
.tuile-direct .texte-choix { position: relative; z-index: 1; flex: 1; }
.tuile-direct.pas-bonne { opacity: .35; }
.tuile-direct.bonne { box-shadow: 0 6px 0 rgba(0, 0, 0, .25), inset 0 0 0 5px #fff; }
.tuile-direct.bonne::after { content: "✓"; position: relative; z-index: 1; font-size: 1.6em; }
.barre-repartition { position: absolute; left: 0; bottom: 0; height: 8px; background: rgba(255, 255, 255, .85); border-radius: 0 4px 0 0; }
.nb-repartition { position: relative; z-index: 1; font-size: 1.2em; padding: .1em .5em; border-radius: 99px; background: rgba(0, 0, 0, .18); }
.direct-pied { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1.6rem; font-size: 1.2rem; }
.compte-reponses { font-weight: 700; color: var(--marine-texte); }
.direct-resultats { display: grid; gap: 1.2rem; justify-items: center; margin-top: 1.6rem; text-align: center; }
.direct-explication { font-size: 1.3rem; max-width: 60ch; margin: 0; padding: .8rem 1.2rem; background: var(--surface); border-radius: 12px; }
.classement-court { width: 100%; max-width: 560px; background: var(--surface); border-radius: var(--rayon); padding: 1rem 1.4rem; text-align: left; }
.classement-court h2 { font-size: 1.1rem; margin-bottom: .5rem; }
.classement-court ol { margin: 0; padding-left: 1.4rem; display: grid; gap: .3rem; font-size: 1.15rem; }
.classement-court li strong { float: right; color: var(--marine-texte); }

.direct-fin { text-align: center; }
.direct-fin h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.6rem); }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 220px)); justify-content: center; align-items: end; gap: 1rem; margin: 2rem auto; }
.marche { display: grid; justify-items: center; gap: .3rem; animation: monte-podium .6s cubic-bezier(.3, 1.4, .5, 1) both; }
.marche-1 { animation-delay: 1s; }
.marche-2 { animation-delay: .5s; }
@keyframes monte-podium { from { opacity: 0; transform: translateY(40px); } }
.podium-image { font-size: 3rem; line-height: 1; }
.marche strong { font-size: 1.5rem; }
.podium-points { color: var(--ardoise); font-weight: 700; }
.podium-socle { width: 100%; display: grid; place-items: start center; padding-top: .6rem; font-size: 2.6rem; font-weight: 700; color: #fff; border-radius: 12px 12px 0 0; }
.marche-1 .podium-socle { height: 11rem; background: var(--soleil); color: var(--encre); }
.marche-2 .podium-socle { height: 8rem; background: var(--marine); }
.marche-3 .podium-socle { height: 6rem; background: var(--orange); }
.classement-complet { max-width: 520px; margin: 0 auto 2rem; text-align: left; display: grid; gap: .3rem; font-size: 1.1rem; }
.classement-complet small { color: var(--ardoise); }

/* Nuage de mots */
.nuage { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .3rem 1.2rem; min-height: 50vh; padding: 2rem; background: var(--surface); border-radius: 20px; }
.mot-nuage { font: inherit; font-weight: 700; line-height: 1.1; background: none; border: 0; padding: .1rem .2rem; border-radius: 8px; animation: apparait .4s ease-out; }
button.mot-nuage { cursor: pointer; }
button.mot-nuage:hover { text-decoration: line-through; opacity: .6; }
@keyframes apparait { from { opacity: 0; transform: scale(.6); } }
.nuage-vide { color: var(--ardoise); font-size: 1.3rem; }
.mots-masques { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: 1rem; font-size: .95rem; }

/* Appareil de l'élève */
.direct-eleve { max-width: 720px; padding: 0; }
.direct-message { text-align: center; background: var(--surface); border-radius: 20px; padding: clamp(1.4rem, 5vw, 2.5rem); }
.direct-message h1 { font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.2rem); }
.attente-points { display: flex; justify-content: center; gap: .5rem; margin-top: 1.5rem; }
.attente-points span { width: .9rem; height: .9rem; border-radius: 50%; background: var(--framboise); animation: rebond 1.2s infinite ease-in-out; }
.attente-points span:nth-child(2) { background: var(--marine); animation-delay: .15s; }
.attente-points span:nth-child(3) { background: var(--soleil); animation-delay: .3s; }
@keyframes rebond { 40% { transform: translateY(-10px); } }
.direct-entete-eleve { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.direct-entete-eleve .chrono-rond { width: 4rem; height: 4rem; }
.direct-entete-eleve .chrono-rond span { width: 3.1rem; height: 3.1rem; font-size: 1.3rem; }
.direct-question-eleve { font-size: 1.25rem; font-weight: 700; margin-bottom: 1rem; }
.direct-eleve .tuiles-direct { gap: .8rem; }
.direct-eleve .tuile-direct { min-height: 7rem; font-size: 1.1rem; flex-direction: column; justify-content: center; text-align: center; gap: .4rem; }
.direct-eleve .tuile-direct:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.tuile-direct.choisie { box-shadow: 0 6px 0 rgba(0, 0, 0, .25), inset 0 0 0 5px #fff; }
.tuile-direct.pas-choisie { opacity: .3; }
.direct-envoye { text-align: center; font-weight: 700; color: var(--marine-texte); font-size: 1.2rem; }
.verdict-direct.juste { background: var(--juste-fond); }
.verdict-direct.juste h1 { color: #0D5C42; }
.verdict-direct.faux { background: var(--faux-fond); }
.verdict-direct.faux h1 { color: #8C1B33; }
.points-gagnes { font-size: 2rem; font-weight: 700; color: #0D5C42; }
.mon-rang { font-size: 1.15rem; font-weight: 700; color: var(--marine-texte); }
.mon-rang-final { font-size: 1.4rem; margin: 1rem 0 1.5rem; }
.form-mot { display: flex; gap: .7rem; max-width: 26rem; margin: 1.2rem auto; }
.form-mot[hidden] { display: none; }
.champ-mot { flex: 1; font-size: 1.2rem; padding: .7rem .9rem; border: 3px solid var(--marine); border-radius: 12px; }
.mes-mots { list-style: none; padding: 0; margin: 0 0 .5rem; display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.mes-mots li { padding: .35rem .9rem; border-radius: 99px; background: var(--fond); font-weight: 700; color: var(--marine-texte); }

@media (max-width: 700px) {
  .tuiles-direct { grid-template-columns: 1fr 1fr; }
  .tuile-direct { min-height: 4.5rem; font-size: 1rem; padding: .7rem .9rem; }
  .podium { gap: .4rem; }
  .marche strong { font-size: 1.1rem; }
  .direct-entete { grid-template-columns: 1fr; }
}

/* Écrire aux enseignants */
.selection-comptes { display: none; margin-top: .6rem; padding: .8rem; border-radius: 10px; background: var(--fond); }
#form-message:has(input[name=cible][value=choix]:checked) .selection-comptes { display: block; }
.liste-cases { list-style: none; padding: 0; margin: .5rem 0 0; max-height: 16rem; overflow-y: auto; display: grid; gap: .3rem; }
.liste-cases small { color: var(--ardoise); }
.barre-boutons { display: flex; gap: .8rem; flex-wrap: wrap; }
.historique-messages { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.historique-messages li { padding: .6rem .8rem; border-radius: 10px; background: var(--fond); }
.historique-messages summary { cursor: pointer; }
.historique-messages small { color: var(--ardoise); }
.corps-message { white-space: pre-wrap; font: .88rem/1.5 var(--police); margin: .6rem 0 0; padding: .6rem; background: var(--surface); border-radius: 8px; }

/* ---------- Aventures : affichage immersif ---------- */
.cote-aventure { --fond-av: var(--marine); --fond-av-fonce: var(--marine-fonce); --accent-av: var(--soleil); background: var(--fond-av); color: #fff; font-size: 17px; }
.cote-aventure.theme-framboise { --fond-av: #C8264A; --fond-av-fonce: #9C1C37; }
.cote-aventure.theme-orange { --fond-av: #C94C06; --fond-av-fonce: #9A3A04; }
.cote-aventure.theme-menthe { --fond-av: #137A5A; --fond-av-fonce: #0D5C42; }
.cote-aventure.theme-lavande { --fond-av: #5B45B0; --fond-av-fonce: #433286; }
.cote-aventure .barre-eleve { background: transparent; border-bottom: 1px solid rgba(255, 255, 255, .15); }
.cote-aventure .barre-eleve .marque, .cote-aventure .qui-nom { color: #fff; }
.cote-aventure .marque-texte b { color: var(--accent-av); }
.cote-aventure .qui-nom small { color: rgba(255, 255, 255, .7); }
.cote-aventure .pied, .cote-aventure .pied a { color: rgba(255, 255, 255, .6); }
.cote-aventure .contenu-eleve { max-width: 1240px; padding-top: 1rem; }
.cote-aventure h1, .cote-aventure h2 { color: #fff; }
.cote-aventure a { color: #fff; }
.cote-aventure .etiquette-essai { display: inline-block; margin-bottom: .6rem; font-size: .8rem; font-weight: 700; padding: .2rem .7rem; border-radius: 99px; background: rgba(255, 255, 255, .15); }

.aventure { position: relative; }
.av-haut { position: sticky; top: 0; z-index: 5; padding: .7rem 0 .9rem; background: var(--fond-av); }
.av-haut-ligne { display: flex; align-items: center; gap: 1rem; margin-bottom: .6rem; }
.av-titre-jeu { flex: 1; font-weight: 700; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av-points { font-weight: 700; font-variant-numeric: tabular-nums; }
.av-points span { color: var(--accent-av); }
.av-inventaire { display: flex; gap: .3rem; }
.av-case { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 8px; background: rgba(255, 255, 255, .14); font: 700 1rem var(--police); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .2); }
.av-case.pleine { background: var(--surface); color: var(--fond-av); box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.av-case.nouvelle { animation: tuile-arrive .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes tuile-arrive { from { transform: scale(0) rotate(-30deg); } }
.av-progression { display: flex; gap: 5px; height: 8px; }
.av-segment { position: relative; border-radius: 99px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.av-segment > span { position: absolute; inset: 0 auto 0 0; background: var(--accent-av); border-radius: inherit; transition: width .4s; }
.av-segment.en-cours { box-shadow: 0 0 0 2px rgba(255, 255, 255, .45); }

.av-scene { min-height: 60vh; padding: 1.4rem 0 1rem; outline: none; animation: av-entree .35s ease-out; }
@keyframes av-entree { from { opacity: 0; transform: translateY(8px); } }
.av-deux { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(1.4rem, 4vw, 3.5rem); align-items: center; }
.av-deux-large { grid-template-columns: minmax(0, .55fr) minmax(0, 1.45fr); }
.av-colonne { min-width: 0; }
.av-lieu { margin: 0 0 .4rem; font-size: .8rem; font-weight: 700; letter-spacing: .04em; color: var(--accent-av); text-transform: uppercase; }
.av-titre { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.6rem); line-height: 1.02; letter-spacing: -.02em; margin: 0 0 1rem; }
.av-titre-moyen { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.5rem); }
.av-texte p { margin: 0 0 .9rem; font-size: 1.1rem; line-height: 1.55; color: rgba(255, 255, 255, .92); max-width: 60ch; }
.av-texte strong { color: #fff; }
.av-pastilles { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem; }
.av-pastilles span { padding: .3rem .8rem; border-radius: 99px; background: rgba(255, 255, 255, .14); font-size: .88rem; font-weight: 700; }
.av-aide { font-size: .9rem; color: rgba(255, 255, 255, .7); }
.av-message { min-height: 1.4em; font-weight: 700; color: var(--accent-av); }

.av-image { position: relative; border-radius: 22px; overflow: hidden; background: var(--fond-av-fonce); box-shadow: 0 18px 40px rgba(0, 0, 0, .28); aspect-ratio: 16 / 9; }
.av-image img { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.av-image.sans-image { display: grid; place-items: center; background: linear-gradient(135deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .03)); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .15); }
.av-icone { font-size: clamp(3rem, 8vw, 6rem); }
.av-vignette { width: min(240px, 60%); margin-bottom: 1rem; border-radius: 16px; }

.av-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }
.av-actions > :only-child { margin-left: auto; }
.av-bouton {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 3.3rem; padding: .8rem 2rem;
  font: 700 1.1rem var(--police); color: var(--encre); text-decoration: none; cursor: pointer;
  background: var(--accent-av); border: 0; border-radius: 14px; box-shadow: 0 5px 0 #C98500, 0 8px 18px rgba(0, 0, 0, .2);
  transition: transform .08s, box-shadow .08s;
}
.av-bouton:hover { color: var(--encre); filter: brightness(1.05); }
.av-bouton:active { transform: translateY(4px); box-shadow: 0 1px 0 #C98500; }
.av-principal { margin-left: auto; }
.av-lien { font: 700 1rem var(--police); color: rgba(255, 255, 255, .85); background: none; border: 0; padding: .5rem 0; cursor: pointer; }
.av-lien:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.cote-aventure :focus-visible { outline: 3px solid var(--accent-av); outline-offset: 3px; }

/* Hall et zones */
.av-image-hall, .av-image-scene { aspect-ratio: 16 / 9; }
.av-zones { position: absolute; inset: 0; }
.av-zone {
  position: absolute; transform: translate(-50%, -50%); display: grid; gap: .05rem; justify-items: center;
  padding: .45rem .9rem; font: inherit; color: var(--encre); cursor: pointer; white-space: nowrap;
  background: var(--surface); border: 0; border-radius: 12px; box-shadow: 0 4px 0 rgba(0, 0, 0, .25), 0 8px 20px rgba(0, 0, 0, .25);
  animation: zone-appel 2.4s ease-in-out infinite;
}
.av-zone:hover { transform: translate(-50%, -50%) scale(1.06); animation: none; }
.av-zone-nom { font-weight: 700; font-size: .92rem; }
.av-zone small { font-size: .75rem; color: var(--ardoise); }
.av-zone.finie { background: var(--juste-fond); animation: none; }
.av-zone.finie small { color: #0D5C42; font-weight: 700; }
.av-zone-finale { background: var(--encre); color: #fff; }
.av-zone-finale small { color: rgba(255, 255, 255, .75); }
.av-zone-finale.ouverte { background: var(--accent-av); color: var(--encre); }
.av-zone-finale.ouverte small { color: var(--encre); }
.av-zone.refus { animation: secoue-x .4s; }
@keyframes zone-appel { 50% { box-shadow: 0 4px 0 rgba(0, 0, 0, .25), 0 0 0 7px rgba(255, 255, 255, .35); } }
.av-zones-grille { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; padding: 1.4rem; width: 100%; align-self: stretch; align-content: center; }
.av-zones-grille .av-zone { position: static; transform: none; padding: 1.2rem; white-space: normal; animation: none; }

/* Points à observer */
.av-point { position: absolute; transform: translate(-50%, -50%); width: 2.2rem; height: 2.2rem; padding: 0; border: 3px solid #fff; border-radius: 50%; background: var(--accent-av); cursor: pointer; box-shadow: 0 0 0 0 rgba(245, 165, 36, .7); animation: point-appel 1.8s infinite; }
.av-point span { position: absolute; left: 50%; top: 115%; transform: translateX(-50%); padding: .15rem .5rem; border-radius: 99px; background: rgba(30, 35, 80, .85); color: #fff; font-size: .75rem; font-weight: 700; white-space: nowrap; pointer-events: none; }
.av-point.vu { background: #fff; animation: none; }
.av-point.vu::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--fond-av); font-weight: 700; }
@keyframes point-appel { 70% { box-shadow: 0 0 0 14px rgba(245, 165, 36, 0); } }
.av-bulle { position: absolute; z-index: 2; transform: translateX(-50%); width: min(320px, 80%); padding: .9rem 1.1rem; border-radius: 14px; background: var(--surface); color: var(--encre); box-shadow: 0 12px 30px rgba(0, 0, 0, .3); cursor: pointer; animation: av-entree .2s ease-out; }
.av-bulle.en-haut { transform: translate(-50%, -100%); }
.av-bulle strong { display: block; margin-bottom: .3rem; color: var(--marine-texte); }
.av-bulle .av-texte p { color: var(--encre); font-size: .95rem; margin: 0; }

/* Dialogues et défis */
.av-qui { font-weight: 700; color: var(--accent-av); margin: 0 0 .4rem; }
.av-replique { margin: 0 0 1rem; padding: 1rem 1.2rem; border-radius: 4px 18px 18px 18px; background: rgba(255, 255, 255, .12); }
.av-replique .av-texte p { margin: 0; font-size: 1.12rem; }
.av-question { font-weight: 700; font-size: 1.1rem; }
.av-defi { display: inline-block; margin: 0 0 .6rem; padding: .2rem .7rem; border-radius: 99px; background: var(--accent-av); color: var(--encre); font-weight: 700; font-size: .8rem; }
.av-choix { display: grid; gap: 1rem; }
.av-carte-choix {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .9rem; width: 100%;
  padding: 1.1rem 1.2rem; font: inherit; font-size: 1.05rem; line-height: 1.4; text-align: left; color: var(--encre); cursor: pointer;
  background: var(--surface); border: 0; border-radius: 16px; box-shadow: 0 5px 0 rgba(0, 0, 0, .22); transition: transform .08s, box-shadow .08s;
}
.av-carte-choix:hover:not(:disabled) { transform: translateY(-2px); }
.av-carte-choix:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, .22); }
.av-lettre-choix { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--fond); color: var(--marine-texte); font-weight: 700; font-size: .9rem; }
.av-fleche { color: var(--ardoise); }
.av-carte-choix.juste { background: var(--juste-fond); box-shadow: 0 5px 0 var(--juste), inset 0 0 0 3px var(--juste); }
.av-carte-choix.faux { background: var(--faux-fond); box-shadow: 0 5px 0 var(--faux), inset 0 0 0 3px var(--faux); }
.av-carte-choix:disabled:not(.juste):not(.faux) { opacity: .5; cursor: default; }
.av-retour { padding: 1rem 1.2rem; border-radius: 14px; background: var(--surface); color: var(--encre); animation: av-entree .25s ease-out; }
.av-retour.juste { box-shadow: inset 5px 0 0 var(--juste); }
.av-retour.faux { box-shadow: inset 5px 0 0 var(--faux); }
.av-retour .av-texte p { color: var(--encre); margin: .4rem 0 0; font-size: 1rem; }
.av-verdict { display: inline-block; margin: 0 0 .8rem; padding: .3rem .9rem; border-radius: 99px; font-weight: 700; }
.av-verdict.juste { background: var(--juste-fond); color: #0D5C42; }
.av-verdict.faux { background: var(--faux-fond); color: #8C1B33; }

/* À retenir */
.av-retenir { max-width: 760px; margin: 0 auto; padding: clamp(1.4rem, 4vw, 2.6rem); border-radius: 22px; background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .15); }
.av-badge-retenir { display: inline-block; margin: 0 0 .8rem; padding: .3rem .9rem; border-radius: 99px; background: var(--accent-av); color: var(--encre); font-weight: 700; }
.av-source { font-size: .85rem; color: rgba(255, 255, 255, .6); margin: 1rem 0 0; }

/* Lettres et cadenas */
.av-tuile-cadre { display: grid; place-items: center; aspect-ratio: 16 / 10; border-radius: 22px; background: var(--surface-chaude); }
.av-tuile {
  display: grid; place-items: center; width: clamp(7rem, 22vw, 12rem); aspect-ratio: 1; border-radius: 26%;
  font: 700 clamp(4rem, 13vw, 7.5rem) var(--police); color: #fff; background: var(--fond-av);
  box-shadow: 0 12px 0 var(--fond-av-fonce), 0 20px 30px rgba(0, 0, 0, .25); animation: tuile-arrive .6s cubic-bezier(.3, 1.6, .5, 1);
}
.av-cadenas { display: grid; justify-items: center; gap: 1.2rem; padding: 2rem 1rem; border-radius: 22px; background: rgba(255, 255, 255, .1); }
.av-cadenas-icone { font-size: 3.5rem; }
.av-code { display: flex; gap: .6rem; }
.av-case-code { width: 3.6rem; height: 4.2rem; font: 700 2rem var(--police); color: var(--fond-av); background: rgba(255, 255, 255, .2); border: 0; border-radius: 12px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); cursor: pointer; }
.av-case-code.remplie { background: var(--surface); box-shadow: 0 4px 0 rgba(0, 0, 0, .25); }
.av-code.refus { animation: secoue-x .45s; }
.av-code.ouvert .av-case-code { background: var(--juste-fond); color: #0D5C42; transition: background .3s; }
.av-reserve { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.av-tuile-petite { width: 3.4rem; font-size: 1.8rem; border: 0; cursor: pointer; box-shadow: 0 5px 0 var(--fond-av-fonce); background: var(--accent-av); color: var(--encre); animation: none; }
.av-tuile-petite:disabled { opacity: .25; cursor: default; }

/* Fin */
.av-etoiles { font-size: clamp(3rem, 9vw, 4.6rem); line-height: 1; margin: .5rem 0 1rem; }
.av-etoiles span { display: inline-block; animation: etoile-arrive .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.av-etoiles .pleine { color: var(--accent-av); text-shadow: 0 4px 0 #C98500; }
.av-etoiles .vide { color: rgba(255, 255, 255, .2); }
.av-score { font-weight: 700; }
.av-record { color: var(--accent-av); font-weight: 700; }
.av-badge { display: inline-block; padding: .4rem 1rem; border-radius: 99px; background: var(--surface); color: var(--encre); font-weight: 700; }

@media (max-width: 860px) {
  .av-deux, .av-deux-large { grid-template-columns: 1fr; }
  .av-image-grande { order: -1; }
  .av-zone { padding: .3rem .55rem; }
  .av-zone-nom { font-size: .75rem; }
  .av-zone small { display: none; }
  .av-titre { margin-bottom: .6rem; }
}
@media (max-width: 560px) {
  .av-inventaire .av-case { width: 1.5rem; height: 1.5rem; font-size: .8rem; }
  .av-case-code { width: 2.9rem; height: 3.5rem; font-size: 1.6rem; }
  .av-bouton { padding: .7rem 1.4rem; }
  .av-point span { display: none; }
}

/* ---------- Atelier : éditeur d'aventure ---------- */
.editeur-aventure { display: grid; gap: 1rem; }
.editeur-aventure details > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: 1.05rem; color: var(--marine-texte); }
.editeur-aventure details > summary::-webkit-details-marker { display: none; }
.editeur-aventure details > summary::before { content: "▸"; color: var(--framboise); transition: transform .15s; }
.editeur-aventure details[open] > summary::before { transform: rotate(90deg); }
.editeur-aventure details[open] > summary { margin-bottom: 1rem; }
.ea-ia { border: 2px solid var(--framboise); background: linear-gradient(135deg, #fff 60%, #FFF0F3); }
.ea-ia-titre { font-weight: 700; font-size: 1.15rem; }
.ea-ia summary small { color: var(--ardoise); font-size: .85rem; }
.ea-etapes-ia { margin: 0; padding-left: 1.4rem; display: grid; gap: 1.1rem; }
.ea-etapes-ia > li > strong { display: block; margin-bottom: .45rem; color: var(--marine-texte); }
.ea-invite { max-height: 14rem; overflow: auto; white-space: pre-wrap; font-size: .78rem; background: var(--fond); border: 1px solid var(--trait); border-radius: 10px; padding: .8rem; margin: 0 0 .5rem; }
.ea-etapes-ia textarea { width: 100%; }
.ea-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: .45rem; }
.ea-bilan { margin: 0; }
.ea-titre-pieces { margin: .6rem 0 0; font-size: 1.2rem; color: var(--marine-texte); }
.ea-piece > summary .ea-piece-icone { font-size: 1.4rem; }
.ea-lettre { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 7px; background: var(--soleil); color: var(--encre); font-weight: 700; box-shadow: 0 3px 0 #C98410; }
.ea-sous-titre { font-size: 1rem; margin: 1.2rem 0 .5rem; color: var(--marine-texte); }
.ea-etape-outils { display: flex; flex-wrap: wrap; gap: .3rem 1rem; justify-content: flex-end; margin: -.4rem 0 .6rem; font-size: .85rem; }
.ea-liste-etapes { display: grid; gap: .6rem; }
.ea-etape { border: 1px solid var(--trait); border-left: 5px solid var(--marine); border-radius: 10px; padding: .7rem .9rem; background: var(--surface); }
.ea-etape > summary { font-size: .95rem !important; color: var(--encre) !important; }
.ea-type { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .1rem .5rem; border-radius: 99px; background: var(--fond); color: var(--marine-texte); }
.ea-type-explorer { border-left-color: var(--orange); }
.ea-type-dialogue { border-left-color: var(--framboise); }
.ea-type-qcm { border-left-color: var(--soleil); }
.ea-type-retenir { border-left-color: var(--menthe); }
.ea-ajout { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .8rem; }
.ea-ligne { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 2fr) auto; gap: .6rem; align-items: start; padding: .6rem 0; border-top: 1px dashed var(--trait); }
.ea-num { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; margin-top: 1.4rem; border-radius: 50%; background: var(--framboise); color: #fff; font-weight: 700; font-size: .85rem; }
.ea-ligne-choix { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ea-ligne-choix > .large, .ea-ligne-choix > .ea-juste { grid-column: 1 / -1; }
.ea-ligne-choix.juste { background: var(--juste-fond); border-radius: 10px; padding: .6rem; border-top: 0; }
.ea-juste { font-weight: 700; display: flex !important; align-items: center; gap: .4rem; }
.ea-bonne input { border-color: var(--juste) !important; background: var(--juste-fond); }
.ea-court { max-width: 6rem; }
.ea-zones, .ea-choix { display: grid; gap: .4rem; }
.ea-image { margin-top: 1rem; padding: .9rem; border-radius: 12px; background: var(--fond); display: grid; gap: .7rem; }
.ea-image-tete strong { color: var(--marine-texte); }
.ea-image-corps { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 1rem; align-items: start; }
.ea-vignette img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; }
.ea-sans-image { aspect-ratio: 16 / 9; display: grid; place-items: center; text-align: center; padding: .5rem; font-size: .78rem; color: var(--ardoise); border: 2px dashed var(--trait); border-radius: 8px; background: var(--surface); }
.ea-image-outils { display: grid; gap: .4rem; justify-items: start; }
.ea-idee { display: grid; gap: .3rem; }
.ea-idee small { color: var(--ardoise); font-weight: 400; }
.ea-idee textarea { width: 100%; font-size: .88rem; }
.ea-plan { position: relative; max-width: 760px; margin: 0 auto; border-radius: 10px; overflow: hidden; background: var(--fond); }
.ea-plan img { display: block; width: 100%; height: auto; cursor: crosshair; user-select: none; -webkit-user-drag: none; }
.ea-plan-vide { padding: 1rem; text-align: center; border: 2px dashed var(--trait); }
.ea-plan-vide .ea-repere { display: none; }
.ea-repere { position: absolute; transform: translate(-50%, -50%); padding: .2rem .6rem; font: 700 .78rem var(--police); color: #fff; background: var(--marine); border: 2px solid #fff; border-radius: 99px; white-space: nowrap; cursor: grab; touch-action: none; box-shadow: 0 2px 8px rgba(30, 35, 80, .4); }
.ea-repere:active { cursor: grabbing; }
.ea-zones .ea-repere { background: var(--framboise); }
.ea-repere.final { background: var(--encre); }
.ea-verif { margin: .3rem 0 0; color: var(--faux); }
.ea-verif.ea-ok { color: var(--juste); }
@media (max-width: 700px) {
  .ea-ligne, .ea-ligne-choix, .ea-image-corps { grid-template-columns: minmax(0, 1fr); }
  .ea-num { margin-top: 0; }
}
.bouton.bouton-petit { padding: .35rem .8rem; font-size: .85rem; }
.av-vue-scene { position: relative; min-width: 0; }
.av-bulle { pointer-events: none; }
@media (max-width: 700px) {
  .av-vue-scene .av-bulle, .av-vue-scene .av-bulle.en-haut { position: static; transform: none; width: auto; margin-top: .8rem; }
}
.ea-repere { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
.ea-repere:hover, .ea-repere:focus, .ea-repere:active { z-index: 3; max-width: none; }
/* Le hall : le plan prend toute la largeur ; les portes sont des étiquettes compactes */
.av-hall .av-deux-large { grid-template-columns: 1fr; gap: 1.2rem; }
.av-hall .av-colonne-etroite { max-width: 48rem; }
.av-hall .av-colonne-etroite .av-titre { margin-bottom: .2rem; }
.av-zone { white-space: normal; max-width: 9.5rem; text-align: center; line-height: 1.15; padding: .4rem .7rem; }
.av-zone-icone { font-size: 1.3rem; line-height: 1; }
.av-zone.finie .av-zone-icone { color: var(--juste); font-weight: 700; }
@media (max-width: 700px) {
  .av-image-hall .av-zones:not(.av-zones-grille) .av-zone { width: 2.7rem; height: 2.7rem; padding: 0; border-radius: 50%; place-content: center; }
  .av-image-hall .av-zones:not(.av-zones-grille) .av-zone-nom, .av-image-hall .av-zones:not(.av-zones-grille) .av-zone small { display: none; }
}
.av-hall .av-image-hall { width: min(100%, calc((100vh - 270px) * 16 / 9)); min-width: min(100%, 560px); justify-self: center; }
.av-image-hall .av-zone { max-width: 7.6rem; padding: .35rem .55rem; }
.av-image-hall .av-zone-nom { font-size: .8rem; }
.av-image-hall .av-zone small { font-size: .68rem; }
.av-hall .av-deux-large { align-content: start; align-items: start; }
.av-hall .av-image-hall { width: min(100%, calc((100vh - 360px) * 16 / 9)); min-width: min(100%, 520px); }

/* ---------- Aventure : fond blanc et couleurs de Quatre.be ----------
   La couleur choisie (--fond-av) colore les titres, les tuiles et les cadres ; boutons framboise comme sur le site. */
.cote-aventure { background: var(--surface); color: var(--encre); --accent-av: var(--soleil); --fond-doux: var(--fond); }
.cote-aventure.theme-framboise { --fond-av: var(--framboise); --fond-av-fonce: var(--framboise-fonce); --fond-doux: #FFF0F3; }
.cote-aventure.theme-orange { --fond-av: var(--orange); --fond-av-fonce: #B84A08; --fond-doux: #FFF3EA; }
.cote-aventure.theme-menthe { --fond-av: var(--menthe); --fond-av-fonce: #137A5A; --fond-doux: #E9F8F2; }
.cote-aventure.theme-lavande { --fond-av: #7B61D6; --fond-av-fonce: #5B45B0; --fond-doux: #F1EEFC; }
.cote-aventure .barre-eleve { background: var(--surface); border-bottom: 1px solid var(--trait); }
.cote-aventure .barre-eleve .marque { color: var(--marine-texte); }
.cote-aventure .qui-nom { color: var(--encre); }
.cote-aventure .marque-texte b { color: var(--framboise); }
.cote-aventure .qui-nom small { color: var(--ardoise); }
.cote-aventure .pied, .cote-aventure .pied a { color: var(--ardoise); }
.cote-aventure h1, .cote-aventure h2 { color: var(--fond-av); }
.cote-aventure a { color: var(--marine-texte); }
.cote-aventure .etiquette-essai { background: var(--fond); color: var(--ardoise); }
.av-haut { background: var(--surface); }
.av-titre-jeu { color: var(--marine-texte); }
.av-points { color: var(--encre); }
.av-case { background: var(--fond); box-shadow: inset 0 0 0 2px var(--trait); color: var(--fond-av); }
.av-case.pleine { background: var(--fond-av); color: #fff; box-shadow: 0 3px 0 var(--fond-av-fonce); }
.av-segment { background: var(--fond); box-shadow: inset 0 0 0 1px var(--trait); }
.av-segment > span { background: var(--orange); }
.av-segment.en-cours { box-shadow: 0 0 0 2px var(--fond-av); }
.av-lieu, .av-qui, .av-message, .av-record { color: var(--framboise); }
.av-texte p { color: var(--encre); }
.av-texte strong { color: var(--fond-av); }
.av-pastilles span { background: var(--fond-doux); color: var(--fond-av); }
.av-aide { color: var(--ardoise); }
.av-image { background: var(--fond-doux); box-shadow: 0 10px 30px rgba(43, 53, 136, .16); }
.av-image.sans-image { background: var(--fond-doux); box-shadow: inset 0 0 0 2px var(--trait); }
.av-image .av-icone { filter: none; }
.av-bouton { color: #fff; background: var(--framboise); box-shadow: 0 5px 0 var(--framboise-fonce), 0 8px 18px rgba(214, 45, 80, .2); }
.av-bouton:hover { color: #fff; }
.av-bouton:active { box-shadow: 0 1px 0 var(--framboise-fonce); }
.av-lien { color: var(--marine-texte); }
.av-lien:hover { color: var(--framboise-fonce); }
.cote-aventure :focus-visible { outline-color: var(--framboise); }
.av-zone { box-shadow: 0 4px 0 rgba(30, 35, 80, .25), 0 8px 20px rgba(30, 35, 80, .2); }
.av-zones-grille .av-zone { background: var(--surface); box-shadow: 0 4px 0 var(--trait), inset 0 0 0 2px var(--trait); }
.av-zone-finale { background: var(--marine); }
.av-zone-finale.ouverte { background: var(--soleil); color: var(--encre); }
@keyframes zone-appel { 50% { box-shadow: 0 4px 0 rgba(30, 35, 80, .25), 0 0 0 7px rgba(255, 70, 105, .3); } }
.av-point { background: var(--soleil); }
.av-point span { background: var(--marine); }
.av-point.vu::after { color: var(--marine-texte); }
.av-bulle { box-shadow: 0 12px 30px rgba(30, 35, 80, .25), inset 0 0 0 2px var(--trait); }
.av-replique { background: var(--fond-doux); color: var(--encre); }
.av-defi, .av-badge-retenir { background: var(--soleil); color: var(--encre); }
.av-carte-choix { box-shadow: 0 5px 0 var(--trait), inset 0 0 0 2px var(--trait); }
.av-carte-choix:hover:not(:disabled) { box-shadow: 0 5px 0 var(--fond-av), inset 0 0 0 2px var(--fond-av); }
.av-carte-choix:active:not(:disabled) { box-shadow: 0 1px 0 var(--fond-av), inset 0 0 0 2px var(--fond-av); }
.av-retour { box-shadow: inset 0 0 0 2px var(--trait); }
.av-retour.juste { box-shadow: inset 5px 0 0 var(--juste), inset 0 0 0 2px var(--trait); }
.av-retour.faux { box-shadow: inset 5px 0 0 var(--faux), inset 0 0 0 2px var(--trait); }
.av-retenir { background: var(--fond-doux); box-shadow: inset 6px 0 0 var(--fond-av); }
.av-source { color: var(--ardoise); }
.av-tuile-cadre { background: var(--fond-doux); }
.av-badge { background: var(--fond-doux); }
.av-tuile { color: #fff; background: var(--fond-av); }
.av-cadenas { background: var(--fond-doux); }
.av-case-code { color: var(--fond-av); background: var(--surface); box-shadow: inset 0 0 0 2px var(--trait); }
.av-case-code.remplie { box-shadow: 0 4px 0 var(--fond-av-fonce), inset 0 0 0 2px var(--fond-av); }
.av-tuile-petite { background: var(--soleil); color: var(--encre); box-shadow: 0 5px 0 #C98410; }
.av-etoiles .pleine { color: var(--soleil); text-shadow: 0 4px 0 #C98410; }
.av-etoiles .vide { color: var(--trait); }
@media (min-width: 1000px) {
  .av-hall .av-deux-large { grid-template-columns: minmax(0, .42fr) minmax(0, 1.58fr); align-items: center; }
  .av-hall .av-image-hall { width: 100%; min-width: 0; }
}

/* ======================================================================
   Commun : icônes, accessibilité, thème sombre, lecture facilitée
   ====================================================================== */
.ic { width: 1.15em; height: 1.15em; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.aller-contenu { position: absolute; left: .5rem; top: -4rem; z-index: 100; padding: .6rem 1rem; border-radius: 8px; background: var(--framboise); color: #fff; font-weight: 700; text-decoration: none; }
.aller-contenu:focus { top: .5rem; color: #fff; }
.visuellement-cache { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--framboise); outline-offset: 2px; }
main:focus { outline: none; }
input, textarea, select { color: var(--encre); }
::placeholder { color: var(--ardoise); opacity: .85; }

/* Boutons d'affichage dans les en-têtes */
.affichage { display: flex; gap: .4rem; align-items: center; }
.bouton-affichage { display: inline-flex; align-items: center; gap: .35rem; min-height: 2.4rem; min-width: 2.4rem; justify-content: center; padding: .3rem .6rem; font: 700 .82rem var(--police); color: var(--marine-texte); background: var(--surface); border: 1px solid var(--trait); border-radius: 99px; cursor: pointer; }
.bouton-affichage:hover { border-color: var(--framboise); }
.bouton-affichage[aria-pressed="true"] { background: var(--framboise); border-color: var(--framboise); color: #fff; }
.bouton-affichage .si-clair, .bouton-affichage .si-sombre, .bouton-affichage .si-auto { display: none; }
.bouton-affichage[data-etat="clair"] .si-clair, .bouton-affichage[data-etat="sombre"] .si-sombre, .bouton-affichage[data-etat="auto"] .si-auto, .bouton-affichage:not([data-etat]) .si-auto { display: block; }
.barre-ens .bouton-affichage { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .25); }
.barre-ens .bouton-affichage[aria-pressed="true"] { background: var(--framboise); border-color: var(--framboise); }
.barre-eleve { flex-wrap: wrap; gap: .6rem 1rem; }
.barre-eleve .affichage { margin-left: auto; }
.barre-eleve .qui { margin-left: 0; }
.nav-ens a { display: inline-flex; align-items: center; gap: .4rem; }
.ens-qui { display: flex; gap: .2rem 1rem; flex-wrap: wrap; align-items: center; }
.ens-qui a { display: inline-flex; align-items: center; gap: .35rem; margin-left: 0; text-decoration: none; opacity: .9; }
.ens-qui a:hover, .ens-qui a[aria-current] { opacity: 1; text-decoration: underline; }
.bouton-menu { display: none; align-items: center; gap: .4rem; padding: .45rem .8rem; font: 700 .9rem var(--police); color: #fff; background: rgba(255, 255, 255, .12); border: 0; border-radius: 8px; cursor: pointer; }
@media (max-width: 1100px) {
  .bouton-menu { display: inline-flex; margin-left: auto; }
  .nav-ens { display: none; order: 10; flex-basis: 100%; flex-direction: column; gap: .2rem; }
  .nav-ens.ouvert { display: flex; }
  .nav-ens a { padding: .7rem .8rem; }
  .texte-affichage { display: none; }
}

/* Menu des élèves dans la boîte à outils */
.nav-eleve { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1.4rem; }
.nav-eleve a { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1rem; border-radius: 99px; font-weight: 700; text-decoration: none; color: var(--marine-texte); background: var(--surface); box-shadow: inset 0 0 0 1px var(--trait); }
.nav-eleve a[aria-current] { background: var(--marine); color: #fff; box-shadow: none; }

/* ---------- Thème sombre ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --fond: #12152B; --surface: #1C2142; --surface-2: #252B55; --surface-chaude: #302A1C; --papier: #1C2142;
    --encre: #E9EBF8; --ardoise: #B3B9D3; --trait: #3A4174; --marine-texte: #B4BDFF; --bord-champ: #6B74A8;
    --juste: #3CCB97; --juste-fond: #12392D; --faux: #FF7891; --faux-fond: #461A2B;
    color-scheme: dark;
  }
}
:root[data-theme="sombre"] {
  --fond: #12152B; --surface: #1C2142; --surface-2: #252B55; --surface-chaude: #302A1C; --papier: #1C2142;
  --encre: #E9EBF8; --ardoise: #B3B9D3; --trait: #3A4174; --marine-texte: #B4BDFF; --bord-champ: #6B74A8;
  --juste: #3CCB97; --juste-fond: #12392D; --faux: #FF7891; --faux-fond: #461A2B;
  color-scheme: dark;
}
/* Éléments à garder lisibles en sombre (texte foncé sur fond coloré clair) */
:root[data-theme="sombre"] :is(.av-defi, .av-badge-retenir, .av-zone-finale.ouverte, .av-tuile-petite, .badge-api, .puce-soleil),
:root:not([data-theme="clair"]) .theme-auto-sombre :is(.av-defi) { color: var(--encre-fixe); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) :is(.av-defi, .av-badge-retenir, .av-zone-finale.ouverte, .av-tuile-petite, .badge-api, .puce-soleil) { color: var(--encre-fixe); }
  :root:not([data-theme="clair"]) .barre-ens { background: #1A2061; }
  :root:not([data-theme="clair"]) .flash-ok { color: #8FE3C3; }
}
:root[data-theme="sombre"] .barre-ens { background: #1A2061; }
:root[data-theme="sombre"] .flash-ok { color: #8FE3C3; }
.page-cartes { --surface: #fff; --encre: #1E2350; --fond: #F2F4FB; color-scheme: light; }

/* ---------- Lecture facilitée (élèves DYS) ---------- */
:root[data-lecture="facile"] body { font-family: Verdana, "Atkinson Hyperlegible", Tahoma, Arial, sans-serif; font-size: 19px; line-height: 1.8; letter-spacing: .04em; word-spacing: .14em; }
:root[data-lecture="facile"] :is(button, input, textarea, select, .bouton, .av-bouton, .av-carte-choix) { font-family: Verdana, Tahoma, Arial, sans-serif; letter-spacing: .03em; }
:root[data-lecture="facile"] :is(p, li, dd, td) { max-width: 70ch; text-align: left; }
:root[data-lecture="facile"] :is(em, i) { font-style: normal; font-weight: 700; }
:root[data-lecture="facile"] :is(h1, h2, h3) { letter-spacing: .01em; line-height: 1.3; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ======================================================================
   Boîte à outils : accueil, bibliothèque, outils, espace personnel
   ====================================================================== */
.c-framboise { --c: var(--framboise); --c-doux: #FFE8EE; }
.c-marine { --c: #3B47B0; --c-doux: #E6E9FB; }
.c-orange { --c: #E25A07; --c-doux: #FFEEDF; }
.c-soleil { --c: #C77F00; --c-doux: #FFF3DC; }
.c-menthe { --c: #168A65; --c-doux: #E2F5EE; }
.c-lavande { --c: #6A50C8; --c-doux: #EEEAFB; }
:root[data-theme="sombre"] [class*="c-"] { --c-doux: rgba(255, 255, 255, .07); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="clair"]) [class*="c-"] { --c-doux: rgba(255, 255, 255, .07); } }
:root[data-theme="sombre"] .c-marine { --c: #8E9BFF; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="clair"]) .c-marine { --c: #8E9BFF; } }

.boite { display: grid; gap: 2.2rem; }
.boite-bienvenue { display: grid; gap: 1.1rem; padding: clamp(1.4rem, 4vw, 2.4rem); border-radius: 22px; background: var(--surface); box-shadow: 0 1px 0 var(--trait), 0 10px 30px rgba(43, 53, 136, .08); position: relative; overflow: hidden; }
.boite-bienvenue::after { content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 40px; background: linear-gradient(135deg, var(--framboise), var(--orange)); opacity: .12; transform: rotate(18deg); }
.boite-bienvenue h1 { margin: 0; font-size: clamp(1.7rem, 1.2rem + 2vw, 2.5rem); color: var(--marine-texte); }
.boite-bienvenue p { margin: 0; max-width: 62ch; color: var(--ardoise); font-size: 1.08rem; }
.compteurs { display: flex; flex-wrap: wrap; gap: .6rem; }
.compteur-b { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .9rem; border-radius: 99px; background: var(--surface-2); font-size: .92rem; }
.compteur-b strong { font-size: 1.15rem; color: var(--marine-texte); }

/* Recherche */
.recherche { position: relative; max-width: 46rem; }
.recherche .ic-loupe { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); width: 1.3rem; height: 1.3rem; color: var(--ardoise); pointer-events: none; }
.recherche input[type="search"] { width: 100%; padding: .95rem 1rem .95rem 3rem; font: inherit; font-size: 1.08rem; border: 2px solid var(--trait); border-radius: 14px; background: var(--surface); }
.recherche input[type="search"]:focus { border-color: var(--framboise); outline: none; box-shadow: 0 0 0 4px rgba(255, 70, 105, .18); }
.suggestions { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + .4rem); margin: 0; padding: .4rem; list-style: none; background: var(--surface); border-radius: 14px; box-shadow: 0 16px 40px rgba(20, 25, 70, .22), inset 0 0 0 1px var(--trait); max-height: 60vh; overflow: auto; }
.suggestions li { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: 10px; cursor: pointer; }
.suggestions li[aria-selected="true"], .suggestions li:hover { background: var(--surface-2); }
.suggestions .type { margin-left: auto; font-size: .75rem; font-weight: 700; color: var(--ardoise); text-transform: uppercase; letter-spacing: .04em; }
.suggestions .vide { color: var(--ardoise); cursor: default; }
.suggestions mark { background: none; color: var(--framboise); font-weight: 700; }

/* Sections et cartes */
.section-boite > header { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.section-boite h2 { display: flex; align-items: center; gap: .55rem; margin: 0; font-size: 1.3rem; color: var(--marine-texte); }
.section-boite h2 .ic { color: var(--framboise); }
.section-boite > header a { font-weight: 700; }
.grille-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 1rem; margin: 0; padding: 0; list-style: none; }
.carte-b { position: relative; display: flex; flex-direction: column; gap: .55rem; padding: 1.1rem 1.15rem 1rem; border-radius: 16px; background: var(--surface); box-shadow: 0 1px 0 var(--trait), inset 0 0 0 1px var(--trait); transition: transform .15s ease, box-shadow .15s ease; }
.carte-b:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(43, 53, 136, .12), inset 0 0 0 1px var(--c, var(--trait)); }
.carte-b-tete { display: flex; gap: .8rem; align-items: flex-start; }
.carte-icone { display: grid; place-items: center; width: 2.9rem; height: 2.9rem; flex-shrink: 0; border-radius: 12px; background: var(--c-doux, var(--surface-2)); color: var(--c, var(--marine-texte)); }
.carte-icone .ic { width: 1.5rem; height: 1.5rem; }
.carte-icone img { width: 2rem; height: 2rem; object-fit: contain; }
.carte-b h3 { margin: .1rem 0 0; font-size: 1.05rem; line-height: 1.25; }
.carte-b h3 a, .carte-b h3 button { color: var(--encre); text-decoration: none; font: inherit; font-weight: 700; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.carte-b h3 a::after, .carte-b h3 button.lien-carte::after { content: ""; position: absolute; inset: 0; border-radius: 16px; }
.carte-b h3 a:focus-visible, .carte-b h3 button:focus-visible { outline: none; }
.carte-b:has(h3 a:focus-visible, h3 button:focus-visible) { outline: 3px solid var(--framboise); outline-offset: 2px; }
.carte-b p { margin: 0; color: var(--ardoise); font-size: .93rem; line-height: 1.5; }
.carte-meta { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: auto; padding-top: .3rem; }
.etiq { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 99px; font-size: .76rem; font-weight: 700; background: var(--surface-2); color: var(--ardoise); }
.etiq-cat { background: var(--c-doux); color: var(--c); }
.etiq-reco { background: #FFF3DC; color: #8A5A00; }
.badge-api { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 99px; font-size: .76rem; font-weight: 700; background: #EEEAFB; color: #4B36A8; }
.bouton-favori { position: relative; z-index: 2; margin-left: auto; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; flex-shrink: 0; border-radius: 50%; border: 0; background: transparent; color: var(--ardoise); cursor: pointer; }
.bouton-favori:hover { background: var(--surface-2); color: var(--framboise); }
.bouton-favori[aria-pressed="true"] { color: var(--framboise); }
.bouton-favori[aria-pressed="true"] .ic { fill: currentColor; }
.raccourcis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: .7rem; margin: 0; padding: 0; list-style: none; }
.raccourci { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; border-radius: 14px; text-decoration: none; font-weight: 700; color: var(--encre); background: var(--surface); box-shadow: inset 0 0 0 1px var(--trait), 0 3px 0 var(--trait); transition: transform .12s; }
.raccourci:hover { transform: translateY(-2px); color: var(--encre); box-shadow: inset 0 0 0 2px var(--c), 0 3px 0 var(--c); }
.raccourci .carte-icone { width: 2.4rem; height: 2.4rem; }
.raccourci small { display: block; font-weight: 400; color: var(--ardoise); font-size: .8rem; }

/* États vides */
.etat-vide { display: grid; justify-items: center; gap: .5rem; padding: 2rem 1rem; text-align: center; color: var(--ardoise); border: 2px dashed var(--trait); border-radius: 16px; }
.etat-vide .ic { width: 2.2rem; height: 2.2rem; color: var(--trait); }
.etat-vide p { margin: 0; max-width: 46ch; }

/* Bibliothèque : filtres */
.mise-en-page-biblio { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 1.6rem; align-items: start; }
.filtres { position: sticky; top: 1rem; display: grid; gap: 1.1rem; padding: 1.2rem; border-radius: 16px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--trait); }
.filtres fieldset { margin: 0; padding: 0; border: 0; display: grid; gap: .35rem; }
.filtres legend { margin-bottom: .4rem; font-weight: 700; font-size: .9rem; color: var(--marine-texte); }
.filtres label.choix { font-size: .92rem; display: flex; align-items: center; gap: .5rem; }
.filtres .compte { margin-left: auto; font-size: .78rem; color: var(--ardoise); }
.barre-resultats { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin: 0 0 1rem; }
.barre-resultats select { width: auto; }
.bouton-filtres { display: none; }
@media (max-width: 860px) {
  .mise-en-page-biblio { grid-template-columns: 1fr; }
  .filtres { position: static; display: none; }
  .filtres.ouvert { display: grid; }
  .bouton-filtres { display: inline-flex; }
}

/* Fiche d'une ressource (fenêtre) */
dialog.fiche { width: min(640px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 0; border: 0; border-radius: 20px; background: var(--surface); color: var(--encre); box-shadow: 0 30px 80px rgba(10, 15, 50, .35); }
dialog.fiche::backdrop { background: rgba(18, 21, 43, .55); }
.fiche-corps { padding: 1.6rem; display: grid; gap: 1rem; }
.fiche-corps h2 { margin: 0; color: var(--encre); }
.fiche dl { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1rem; margin: 0; }
.fiche dt { font-weight: 700; color: var(--marine-texte); }
.fiche dd { margin: 0; }
.fiche-fermer { position: absolute; right: .8rem; top: .8rem; }
.fiche .a-savoir { padding: .7rem 1rem; border-radius: 12px; background: var(--surface-chaude); }
@media (max-width: 560px) { .fiche dl { grid-template-columns: 1fr; } .fiche dt { margin-top: .4rem; } }

/* Outils */
.outil-entete { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.4rem; }
.outil-entete .carte-icone { width: 3.4rem; height: 3.4rem; }
.outil-entete h1 { margin: 0; font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); color: var(--marine-texte); }
.outil-entete p { margin: .2rem 0 0; color: var(--ardoise); }
.outil-entete .bouton-favori { margin-left: auto; }
.outil { display: grid; gap: 1.2rem; }
.outil .panneau { display: grid; gap: .9rem; }
.outil label { display: grid; gap: .3rem; font-weight: 700; font-size: .92rem; }
.outil label.choix { display: flex; font-weight: 400; }
.outil textarea { min-height: 8rem; resize: vertical; }
.deux-colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 1.2rem; align-items: start; }
.champs-ligne { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: end; }
.champs-ligne > label { flex: 1 1 10rem; }
.barre-outil { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.sortie { position: relative; padding: 1rem 1.1rem; border-radius: 12px; background: var(--surface-2); white-space: pre-wrap; word-break: break-word; font-size: 1rem; line-height: 1.6; min-height: 3rem; }
.sortie-code { font: 1.25rem/1.4 var(--police-code); letter-spacing: .02em; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .7rem; margin: 0; }
.stats div { padding: .8rem 1rem; border-radius: 12px; background: var(--surface-2); }
.stats dt { font-size: .8rem; color: var(--ardoise); }
.stats dd { margin: 0; font-size: 1.5rem; font-weight: 700; color: var(--marine-texte); }
.erreur-champ { color: var(--faux); font-weight: 700; font-size: .9rem; margin: 0; }
.aide-outil { color: var(--ardoise); font-size: .9rem; margin: 0; }
.avertissement { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem 1rem; border-radius: 12px; background: var(--surface-chaude); font-size: .93rem; }
.avertissement .ic { color: var(--orange); margin-top: .15rem; }
.liste-outil { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.liste-outil > li { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; padding: .6rem .8rem; border-radius: 12px; background: var(--surface-2); }
.liste-outil > li.fait .texte-tache { text-decoration: line-through; color: var(--ardoise); }
.liste-outil .grow { flex: 1 1 12rem; min-width: 0; }
.bouton-icone { display: inline-grid; place-items: center; width: 2.3rem; height: 2.3rem; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--ardoise); cursor: pointer; }
.bouton-icone:hover { background: var(--surface); color: var(--framboise); }
.toast { position: fixed; left: 50%; bottom: 1.4rem; z-index: 200; transform: translateX(-50%); padding: .7rem 1.2rem; border-radius: 12px; background: var(--encre); color: var(--surface); font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: av-entree .2s ease-out; }
.jauge { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.jauge > span { display: block; height: 100%; border-radius: inherit; transition: width .3s, background .3s; }
.table-outil { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table-outil th, .table-outil td { padding: .5rem .6rem; border-bottom: 1px solid var(--trait); text-align: left; vertical-align: top; }
.table-outil th { color: var(--marine-texte); font-size: .85rem; }
.table-outil input, .table-outil textarea, .table-outil select { min-width: 6rem; }
.defile-x { overflow-x: auto; }
.minuteur-cadran { font: 700 clamp(4rem, 18vw, 11rem)/1 var(--police); text-align: center; color: var(--marine-texte); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.minuteur-cadran.fini { color: var(--framboise); animation: secoue-x .5s 2; }
.minuteur-plein { position: fixed; inset: 0; z-index: 150; display: grid; place-content: center; gap: 2rem; background: var(--fond); }
.flashcard { perspective: 1000px; min-height: 14rem; cursor: pointer; }
.flashcard-int { position: relative; min-height: 14rem; transition: transform .45s; transform-style: preserve-3d; }
.flashcard.retournee .flashcard-int { transform: rotateY(180deg); }
.flashcard-face { position: absolute; inset: 0; display: grid; place-items: center; padding: 1.5rem; text-align: center; font-size: 1.35rem; font-weight: 700; border-radius: 18px; background: var(--surface); box-shadow: inset 0 0 0 2px var(--trait), 0 6px 0 var(--trait); backface-visibility: hidden; }
.flashcard-face.dos { transform: rotateY(180deg); background: var(--surface-2); color: var(--marine-texte); }
.groupes-resultat { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .8rem; }
.groupe-carte { padding: .9rem 1rem; border-radius: 14px; background: var(--surface-2); border-top: 5px solid var(--c, var(--framboise)); }
.groupe-carte h3 { margin: 0 0 .4rem; font-size: 1rem; }
.groupe-carte ul { margin: 0; padding-left: 1.1rem; }
.tirage-nom { min-height: 6rem; display: grid; place-items: center; font: 700 clamp(2.2rem, 8vw, 4.5rem)/1.1 var(--police); color: var(--framboise); text-align: center; }
.tirage-nom.roule { color: var(--ardoise); }
.document-apercu { padding: clamp(1.2rem, 4vw, 2.4rem); border-radius: 12px; background: #fff; color: #1E2350; box-shadow: inset 0 0 0 1px var(--trait); line-height: 1.6; }
.document-apercu h1, .document-apercu h2, .document-apercu h3 { color: #2B3588; }
.document-apercu table { width: 100%; border-collapse: collapse; }
.document-apercu th, .document-apercu td { border: 1px solid #C9CFE6; padding: .4rem .5rem; text-align: left; vertical-align: top; }
.quiz-jeu-choix { display: grid; gap: .6rem; }
.quiz-jeu-choix button { text-align: left; padding: .8rem 1rem; font: inherit; border-radius: 12px; border: 0; background: var(--surface); color: var(--encre); box-shadow: inset 0 0 0 2px var(--trait), 0 3px 0 var(--trait); cursor: pointer; }
.quiz-jeu-choix button.juste { background: var(--juste-fond); box-shadow: inset 0 0 0 2px var(--juste); }
.quiz-jeu-choix button.faux { background: var(--faux-fond); box-shadow: inset 0 0 0 2px var(--faux); }
.reponse-ia { white-space: pre-wrap; }
.ia-indispo { display: flex; gap: .8rem; padding: 1rem 1.2rem; border-radius: 14px; background: #EEEAFB; color: #33246F; }
.ia-indispo .ic { color: #6A50C8; width: 1.6rem; height: 1.6rem; }
.chargement { display: inline-block; width: 1.1rem; height: 1.1rem; border: 3px solid var(--trait); border-top-color: var(--framboise); border-radius: 50%; animation: tourne .8s linear infinite; vertical-align: -.2em; }
@keyframes tourne { to { transform: rotate(360deg); } }
.personnaliser li { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border-radius: 10px; background: var(--surface-2); }
.personnaliser li label { flex: 1; }
.productions li { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }

@media print {
  .barre-ens, .barre-eleve, .pied, .nav-eleve, .outil-entete .bouton-favori, .barre-outil, .pas-imprimer, .aller-contenu { display: none !important; }
  body, main { background: #fff !important; color: #000 !important; }
  .document-apercu { box-shadow: none; padding: 0; }
}

/* Administration de la boîte à outils */
.choix-icones { display: flex; flex-wrap: wrap; gap: .35rem; max-height: 15rem; overflow: auto; padding: .3rem; border-radius: 10px; background: var(--surface-2); }
.choix-icones .icone-choix span { width: 2.4rem; height: 2.4rem; background: var(--surface); color: var(--marine-texte); }
.choix-icones .icone-choix .ic { width: 1.3rem; height: 1.3rem; }
.grille-cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .4rem 1rem; }
.guide-admin h2 { margin-top: 2rem; }
.guide-admin nav ol { columns: 2; }
@media (max-width: 640px) { .guide-admin nav ol { columns: 1; } }
.titre-ligne .bouton .ic, .barre-outil .bouton .ic { margin-right: .1rem; }
.bouton .ic { width: 1.1em; height: 1.1em; }
.barre-ens { gap: .6rem 1.2rem; }
.nav-ens { gap: .1rem; }
.nav-ens a { padding: .42rem .6rem; font-size: .93rem; }
@media (max-width: 1500px) { .barre-ens .texte-affichage { display: none; } }
@media (min-width: 1101px) and (max-width: 1450px) { .nav-ens .ic { display: none; } }
/* Aventure en thème sombre : titres et textes colorés éclaircis */
:root[data-theme="sombre"] .cote-aventure :is(h1, h2, .av-texte strong, .av-titre-jeu) { color: var(--marine-texte); }
:root[data-theme="sombre"] .cote-aventure .av-case.pleine, :root[data-theme="sombre"] .cote-aventure .av-tuile { color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) .cote-aventure :is(h1, h2, .av-texte strong, .av-titre-jeu) { color: var(--marine-texte); }
}
.av-scene:focus, .av-scene:focus-visible, main:focus-visible { outline: none; }
.boite-bienvenue > * { position: relative; z-index: 1; }
.recherche input[type="search"] { border-color: var(--bord-champ); }
@media (max-width: 600px) { .boite-bienvenue::after { width: 110px; height: 110px; right: -50px; top: -50px; } }

/* Contrastes AA : boutons framboise un peu plus soutenus, étiquettes de couleur lisibles */
.bouton, .av-bouton { background: #E0284F; box-shadow: 0 3px 0 #A81D3B; }
.bouton:hover, .av-bouton:hover { background: #CC1F45; }
.av-bouton { box-shadow: 0 5px 0 #A81D3B, 0 8px 18px rgba(214, 45, 80, .2); }
.bouton-clair { background: var(--surface); }
.bouton-clair:hover { background: var(--surface-2); }
.bouton-publier { background: var(--marine); box-shadow: 0 3px 0 var(--marine-fonce); }
.bouton-danger { background: #C42347; box-shadow: 0 3px 0 #8C1530; color: #fff; }
.c-framboise { --c-texte: #C2183F; } .c-marine { --c-texte: #2B3588; } .c-orange { --c-texte: #A84300; }
.c-soleil { --c-texte: #7A5000; } .c-menthe { --c-texte: #0D6648; } .c-lavande { --c-texte: #5238B5; }
.etiq-cat { color: var(--c-texte, var(--marine-texte)); }
:root[data-theme="sombre"] .c-framboise { --c-texte: #FF8FA6; } :root[data-theme="sombre"] .c-marine { --c-texte: #B4BDFF; } :root[data-theme="sombre"] .c-orange { --c-texte: #FFAD7A; }
:root[data-theme="sombre"] .c-soleil { --c-texte: #F5C26B; } :root[data-theme="sombre"] .c-menthe { --c-texte: #6EDBB2; } :root[data-theme="sombre"] .c-lavande { --c-texte: #C3B5FF; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) .c-framboise { --c-texte: #FF8FA6; } :root:not([data-theme="clair"]) .c-marine { --c-texte: #B4BDFF; } :root:not([data-theme="clair"]) .c-orange { --c-texte: #FFAD7A; }
  :root:not([data-theme="clair"]) .c-soleil { --c-texte: #F5C26B; } :root:not([data-theme="clair"]) .c-menthe { --c-texte: #6EDBB2; } :root:not([data-theme="clair"]) .c-lavande { --c-texte: #C3B5FF; }
}
.lien-danger { color: #B8203F; }
:root[data-theme="sombre"] .lien-danger { color: var(--faux); }
:root[data-theme="sombre"] :is(.statut-publie, .statut-faite) { color: #8FE3C3; }
:root[data-theme="sombre"] :is(.statut-brouillon, .statut-nouvelle, .etiquette) { color: #F5C26B; }
:root[data-theme="sombre"] .cote-aventure .av-pastilles span { color: var(--marine-texte); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) .lien-danger { color: var(--faux); }
  :root:not([data-theme="clair"]) :is(.statut-publie, .statut-faite) { color: #8FE3C3; }
  :root:not([data-theme="clair"]) :is(.statut-brouillon, .statut-nouvelle, .etiquette) { color: #F5C26B; }
  :root:not([data-theme="clair"]) .cote-aventure .av-pastilles span { color: var(--marine-texte); }
}
