/* LE CORPS HUMAIN — feuille de style
   Même famille visuelle que « À la découverte des cellules » : barre en haut, puis un écran plein cadre
   (le dessin) avec ses panneaux. Les dessins gardent leurs couleurs ; le fond de scène suit l'ambiance de la couche. */
:root {
  --fond: #f4f4f9;
  --surface: #ffffff;
  --surface-2: #ebe9f3;
  --encre: #1c1a2c;
  --encre-2: #57546f;
  --ligne: #d8d5e5;
  --accent: #4f3fc2;
  --accent-encre: #ffffff;
  --accent-doux: #e6e2ff;
  --eosine: #c23a68;
  --bon: #1f7a3d;
  --bon-doux: #dff3e5;
  --faux: #b3261e;
  --faux-doux: #fbe2df;
  --soleil: #fff4c9;
  --soleil-bord: #e8c95a;
  --soleil-encre: #6b4e00;
  --bulle-fond: #1c1a2c;
  --bulle-texte: #ffffff;
  --verre: rgba(255, 255, 255, 0.82);
  --scene-chaud-1: #fbf0e6; --scene-chaud-2: #e6cdbb;
  --scene-froid-1: #eef3fa; --scene-froid-2: #c3d1e4;
  --scene-rose-1: #fbeef0; --scene-rose-2: #e2c2c8;
  --ombre: 0 1px 2px rgba(28, 26, 44, 0.08), 0 8px 24px rgba(28, 26, 44, 0.08);

  --f-titre: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-texte: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --t-xs: 0.78rem; --t-s: 0.875rem; --t-m: 1rem; --t-l: 1.2rem; --t-xl: 1.6rem; --t-xxl: clamp(2rem, 4.2vw, 3.1rem);
  --gouttiere: 16px;
  --panneau: 330px;
}
/* Pas de thème sombre : le site ScolaTools n'en a pas, et ../commun/scolatools.css (chargé après cette feuille)
   garde le texte et les panneaux en clair. Garder ici des fonds de scène, des bulles, des encadrés « soleil » et des
   titres de couche sombres donnait du texte foncé sur une scène foncée et des titres trop pâles quand l'ordinateur
   de l'élève était réglé en mode sombre. */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font: var(--t-m)/1.55 var(--f-texte);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--f-titre); line-height: 1.12; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
a { color: var(--accent); text-underline-offset: 0.18em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); height: 100%; }

/* ---------- ambiances ---------- */
[data-fond], .scene { --scene-1: var(--scene-froid-1); --scene-2: var(--scene-froid-2); --titre: var(--encre); }
[data-fond="froid"] { --scene-1: var(--scene-froid-1); --scene-2: var(--scene-froid-2); --titre: #2a5fa8; }
[data-fond="rose"] { --scene-1: var(--scene-rose-1); --scene-2: var(--scene-rose-2); --titre: #b0323f; }
[data-fond="chaud"] { --scene-1: var(--scene-chaud-1); --scene-2: var(--scene-chaud-2); --titre: #b9531f; }

/* ---------- barre ---------- */
.barre {
  display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap;
  padding: 10px var(--gouttiere);
  background: var(--surface);
  border-bottom: 1px solid var(--ligne);
  position: relative; z-index: 5;
}
.lien-portail {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; margin-right: -12px;
  color: var(--encre-2); text-decoration: none; font-size: var(--t-l); border: 1px solid var(--ligne);
}
.lien-portail:hover { color: var(--accent); border-color: var(--accent); }
.marque { font-family: var(--f-titre); font-weight: 750; font-size: var(--t-l); color: var(--encre); text-decoration: none; letter-spacing: -0.02em; }
.barre nav { display: flex; gap: 4px; flex-wrap: wrap; }
.barre nav a { color: var(--encre-2); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: var(--t-s); }
.barre nav a:hover { color: var(--encre); background: var(--surface-2); }
.barre nav a[aria-current="page"] { color: var(--accent-encre); background: var(--accent); }
.choix-niveau { margin-left: auto; }

main { position: relative; min-height: 0; }
.ecran { position: absolute; inset: 0; }

/* ---------- boutons ---------- */
.outils { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.outils button, .bascule > *, .quiz-actions button, .filtres button {
  border: 1px solid var(--ligne); background: var(--verre); color: var(--encre); border-radius: 999px;
  padding: 6px 12px; font-size: var(--t-s); line-height: 1.2; text-decoration: none;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.outils button:hover, .bascule > *:hover, .quiz-actions button:hover, .filtres button:hover { border-color: var(--accent); }
.outils button[aria-pressed="true"] { background: var(--accent); color: var(--accent-encre); border-color: var(--accent); }
.bascule { display: inline-flex; flex-wrap: wrap; gap: 0; }
.bascule > * { border-radius: 0; margin-left: -1px; }
.bascule > *:first-child { border-radius: 999px 0 0 999px; margin-left: 0; }
.bascule > *:last-child { border-radius: 0 999px 999px 0; }
.bascule > [aria-pressed="true"], .bascule > [aria-current="true"] { background: var(--accent); color: var(--accent-encre); border-color: var(--accent); position: relative; }
.zoom { display: inline-flex; gap: 4px; }
.zoom button { min-width: 34px; }
.bouton {
  border: 1px solid var(--accent); color: var(--accent); background: transparent; border-radius: 999px; padding: 6px 14px;
  font-size: var(--t-s); font-weight: 700; text-decoration: none; justify-self: start; display: inline-block; line-height: 1.3;
}
.bouton:hover, .bouton[aria-expanded="true"] { background: var(--accent); color: var(--accent-encre); }
.bouton.plein { background: var(--accent); color: var(--accent-encre); }
.bouton.plein:hover { filter: brightness(1.08); }

/* ---------- accueil ---------- */
.accueil { overflow: auto; }
.accueil-mise { max-width: 1160px; margin: 0 auto; padding: 32px var(--gouttiere) 48px; display: grid; gap: 30px; }
.accueil-haut { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 28px; align-items: center; }
.accueil-intro { display: grid; gap: 12px; max-width: 66ch; }
.surtitre { font-family: var(--f-mono); font-size: var(--t-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--eosine); margin: 0; }
.accueil-intro h1 { font-size: var(--t-xxl); font-weight: 780; }
.accueil-intro p { margin: 0; color: var(--encre-2); font-size: var(--t-l); line-height: 1.5; }
.savais-tu {
  background: var(--soleil); border: 1px solid var(--soleil-bord); border-radius: 16px; padding: 18px 20px; display: grid; gap: 10px;
  box-shadow: var(--ombre);
}
.savais-titre { margin: 0; font-family: var(--f-titre); font-weight: 750; font-size: var(--t-l); color: var(--soleil-encre); }
.anecdote { margin: 0; min-height: 4.6em; }
.anecdote strong { color: var(--soleil-encre); }
.savais-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.savais-tu .bouton { border-color: var(--soleil-encre); color: var(--soleil-encre); }
.savais-tu .bouton:hover { background: var(--soleil-encre); color: var(--soleil); }
.apparait { animation: apparait 0.45s ease; }
@keyframes apparait { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-accueil { display: grid; gap: 14px; }
.section-accueil h2 { font-size: var(--t-xl); font-weight: 720; }
.grille-couches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grille-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.carte {
  display: grid; grid-template-rows: auto 1fr; text-decoration: none; color: var(--encre);
  background: var(--surface); border: 1px solid var(--ligne); border-radius: 14px; overflow: hidden; box-shadow: var(--ombre);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.carte:hover { transform: translateY(-3px); border-color: var(--accent); }
.carte .vignette { display: block; width: 100%; aspect-ratio: 4 / 3; background: radial-gradient(110% 90% at 50% 40%, var(--scene-1), var(--scene-2)); }
.carte .vignette svg { display: block; width: 100%; height: 100%; }
.carte-texte { padding: 12px 14px 14px; display: grid; gap: 4px; align-content: start; }
.carte h3 { font-size: var(--t-l); font-weight: 720; color: var(--titre); }
.carte p { margin: 0; color: var(--encre-2); font-size: var(--t-s); }
.carte .meta { font-family: var(--f-mono); font-size: var(--t-xs); color: var(--accent); }
.raccourcis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.bloc { background: var(--surface); border: 1px solid var(--ligne); border-radius: 14px; padding: 18px; display: grid; gap: 10px; align-content: start; }
.bloc h2 { font-size: var(--t-l); font-weight: 700; }
.bloc p { margin: 0; color: var(--encre-2); font-size: var(--t-s); }
.puces { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.puces a { display: inline-block; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); color: var(--encre); text-decoration: none; font-size: var(--t-s); }
.puces a:hover { background: var(--accent-doux); color: var(--accent); }
.credits { font-size: var(--t-s); color: var(--encre-2); max-width: 80ch; display: grid; gap: 8px; border-top: 1px solid var(--ligne); padding-top: 20px; }
.credits p { margin: 0; }

/* ---------- scènes et dessins ---------- */
.scene { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(115% 90% at 50% 40%, var(--scene-1), var(--scene-2)); }
.dessin { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.dessin.glisse { cursor: grabbing; }
.partie { cursor: pointer; transition: opacity 0.25s ease; }
.dessin .partie:hover, .partie.survol { filter: url(#halo-survol); }
.partie.actif { filter: url(#halo-actif); }
.partie.cible { filter: url(#halo-quiz); }
.partie.trouve { filter: url(#halo-bon); }
.partie.estompe { opacity: 0.12; pointer-events: none; }
.sans-clic .partie { cursor: default; }
.avant-plan { pointer-events: none; }
.avant-plan .partie { animation: apparait-plan 0.3s ease; }
@keyframes apparait-plan { from { opacity: 0; } to { opacity: 1; } }
.partie.pop { animation: pop 0.45s ease; transform-box: fill-box; transform-origin: 50% 50%; }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(1.07); } 70% { transform: scale(0.98); } 100% { transform: scale(1); } }

/* le cœur bat, les poumons respirent */
.anime .bat { animation: battement 0.86s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 55%; }
@keyframes battement { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.08); } 24% { transform: scale(0.97); } 36% { transform: scale(1.04); } 52% { transform: scale(1); } }
.anime .respire { animation: respiration 4.4s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 0%; }
@keyframes respiration { 0%, 100% { transform: scale(1, 1); } 45% { transform: scale(1.035, 1.06); } }
.anime .respire-diaphragme { animation: diaphragme 4.4s ease-in-out infinite; }
@keyframes diaphragme { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(9px); } }

/* légendes (dans le dessin) */
.legendes { pointer-events: none; }
.legendes line, .legendes polyline { stroke: var(--encre-2); stroke-width: 1px; vector-effect: non-scaling-stroke; fill: none; }
.legendes circle { fill: var(--eosine); stroke: var(--surface); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.legendes text {
  font-family: var(--f-texte); font-weight: 700; font-size: calc(12.5px / var(--z, 1)); fill: var(--encre);
  paint-order: stroke; stroke: var(--surface); stroke-width: calc(3.5px / var(--z, 1)); stroke-linejoin: round;
}
.legendes .lien { pointer-events: auto; cursor: pointer; }
.legendes .lien:hover text { fill: var(--accent); }
.legendes .actif text { fill: var(--accent); }

/* rayons X */
.lentille-bord { fill: none; stroke: #7fe3ff; stroke-width: 3px; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 4px #7fe3ff); pointer-events: none; }
.lentille-reticule { stroke: #7fe3ff; stroke-width: 1px; vector-effect: non-scaling-stroke; opacity: 0.6; pointer-events: none; }
.peau-rx { pointer-events: none; }

.infobulle {
  position: absolute; left: 0; top: 0; z-index: 4; pointer-events: none; max-width: 300px;
  background: var(--bulle-fond); color: var(--bulle-texte); padding: 7px 11px; border-radius: 8px;
  font-size: var(--t-s); line-height: 1.35; box-shadow: var(--ombre); display: grid; gap: 1px;
}
.infobulle strong { font-weight: 700; }
.infobulle span { opacity: 0.75; font-size: var(--t-xs); }

.aide-souris {
  position: absolute; left: calc(var(--panneau) + 2 * var(--gouttiere)); right: var(--gouttiere); bottom: 10px; margin: 0 auto; z-index: 2; width: max-content; max-width: calc(100% - var(--panneau) - 3 * var(--gouttiere));
  font-size: var(--t-xs); color: var(--encre-2); background: var(--verre); padding: 4px 10px; border-radius: 999px;
  white-space: nowrap; pointer-events: none; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- écran d'exploration ---------- */
.explorer .scene { left: calc(var(--panneau) + var(--gouttiere)); }
.explorer .dessin, .puzzle .dessin { position: absolute; top: 54px; left: 0; width: 100%; height: calc(100% - 84px); }
.puzzle .dessin { top: 12px; height: calc(100% - 24px); }
.defs-globales { position: absolute; width: 0; height: 0; overflow: hidden; }
.explorer .outils { position: absolute; top: 14px; right: var(--gouttiere); z-index: 3; justify-content: flex-end; max-width: calc(100% - var(--panneau) - 3 * var(--gouttiere)); }
.filtres { display: flex; flex-wrap: wrap; gap: 5px; }
.filtres button { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; font-size: var(--t-xs); font-weight: 700; background: var(--surface); }
.filtres button::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--p, var(--encre-2)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); }
.filtres button[aria-pressed="true"] { background: var(--accent); color: var(--accent-encre); border-color: var(--accent); }
.panneau {
  position: absolute; top: 14px; left: var(--gouttiere); bottom: 14px; width: var(--panneau); z-index: 3;
  background: var(--surface); border: 1px solid var(--ligne); border-radius: 14px; box-shadow: var(--ombre);
  padding: 14px; display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: auto;
}
.onglets-couche { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.onglets-couche a { text-align: center; padding: 6px 4px; border-radius: 8px; text-decoration: none; color: var(--encre-2); font-size: var(--t-s); font-weight: 700; }
.onglets-couche a:hover { color: var(--encre); }
.onglets-couche a[aria-current="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.panneau h1 { font-size: var(--t-xl); font-weight: 760; color: var(--titre); }
.consigne { margin: 0; font-size: var(--t-s); color: var(--encre-2); }
.actions-panneau { display: flex; flex-wrap: wrap; gap: 6px; }
.bloc-panneau { display: flex; flex-direction: column; gap: 10px; }
.liste-parties { display: grid; gap: 12px; }
.groupe-parties h2 { font-family: var(--f-mono); font-size: var(--t-xs); font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--encre-2); margin-bottom: 2px; }
.groupe-parties ul { list-style: none; margin: 0 -6px; padding: 0; display: grid; gap: 1px; }
.groupe-parties a { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 8px; color: var(--encre); text-decoration: none; font-size: var(--t-s); }
.groupe-parties a:hover, .groupe-parties a.actif { background: var(--accent-doux); color: var(--accent); }
.groupe-parties a .vue { margin-left: auto; font-family: var(--f-mono); font-size: var(--t-xs); color: var(--encre-2); }
.groupe-parties a.ailleurs { color: var(--encre-2); }
.pastille { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--p); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); }

/* fiche */
.fiche { gap: 12px; }
.retour { font-size: var(--t-s); text-decoration: none; font-weight: 700; justify-self: start; align-self: flex-start; background: none; border: 0; padding: 0; color: var(--accent); }
.retour:hover { text-decoration: underline; }
.fiche h1 { font-size: var(--t-xl); }
.sous-titre { margin: -6px 0 0; color: var(--encre-2); font-size: var(--t-s); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.etiquette { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-mono); font-size: var(--t-xs); padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--encre); }
.etiquette .pastille { width: 9px; height: 9px; }
.texte { display: grid; gap: 10px; }
.texte p { margin: 0; }
.encart-savais { background: var(--soleil); border: 1px solid var(--soleil-bord); border-radius: 12px; padding: 10px 12px; font-size: var(--t-s); }
.ampoule { width: 1.15em; height: 1.15em; vertical-align: -0.2em; fill: #ffd84a; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.encart-savais strong { display: block; font-family: var(--f-titre); color: var(--soleil-encre); margin-bottom: 2px; }
.plus { border: 1px solid var(--ligne); border-radius: 12px; padding: 8px 12px; font-size: var(--t-s); }
.plus summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.plus[open] summary { margin-bottom: 6px; }
.plus p { margin: 0 0 8px; }
.plus p:last-child { margin-bottom: 0; }
.liens-fiche { display: flex; flex-wrap: wrap; gap: 6px; }
.voir-aussi { display: grid; gap: 6px; border-top: 1px solid var(--ligne); padding-top: 12px; }
.voir-aussi h2 { font-family: var(--f-mono); font-size: var(--t-xs); font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--encre-2); }
.nav-fiche { display: flex; justify-content: space-between; gap: 8px; }
.nav-fiche button { border: 1px solid var(--ligne); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: var(--t-s); }
.nav-fiche button:hover { border-color: var(--accent); }

/* ---------- quiz ---------- */
.quiz-titre { font-size: var(--t-l); font-weight: 720; }
.choix-quiz { display: grid; gap: 8px; }
.choix-quiz button {
  display: grid; gap: 2px; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--ligne);
  background: var(--surface); color: var(--encre);
}
.choix-quiz button:hover { border-color: var(--accent); }
.choix-quiz strong { font-size: var(--t-m); }
.choix-quiz span { font-size: var(--t-s); color: var(--encre-2); }
.choix-quiz em { font-style: normal; font-size: var(--t-xs); color: var(--accent); font-family: var(--f-mono); }
.quitter-quiz { align-self: flex-start; background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font-size: var(--t-s); }
.quiz-entete { display: flex; justify-content: space-between; gap: 8px; font-size: var(--t-xs); color: var(--encre-2); font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.quiz-progression { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.quiz-progression span { display: block; height: 100%; background: var(--accent); transition: width 0.3s; }
.quiz-question { margin: 0; font-size: var(--t-l); line-height: 1.35; }
.quiz-question strong { color: var(--accent); }
.quiz-choix { display: grid; gap: 6px; }
.quiz-choix button { text-align: left; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--ligne); background: var(--surface); color: var(--encre); font-size: var(--t-s); }
.quiz-choix button:hover:not(:disabled) { border-color: var(--accent); }
.quiz-choix button[data-ton="bon"] { background: var(--bon-doux); border-color: var(--bon); color: var(--bon); font-weight: 700; }
.quiz-choix button[data-ton="faux"] { background: var(--faux-doux); border-color: var(--faux); color: var(--faux); }
.quiz-retour { margin: 0; font-size: var(--t-s); color: var(--encre-2); min-height: 1.5em; }
.quiz-retour[data-ton="bon"] { color: var(--bon); font-weight: 700; }
.quiz-retour[data-ton="faux"] { color: var(--faux); }
.quiz-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.quiz-actions .suivant { background: var(--accent); color: var(--accent-encre); border-color: var(--accent); font-weight: 700; }
.quiz-score { margin: 0; font-family: var(--f-titre); font-size: 2.6rem; line-height: 1; color: var(--accent); }
.quiz-score strong { font-weight: 800; }
.etoiles { margin: 0; font-size: 2rem; letter-spacing: 0.15em; line-height: 1; color: #e8b400; }
.etoiles .vide { color: var(--ligne); }
.etoiles span { display: inline-block; animation: etoile 0.5s ease backwards; }
.etoiles span:nth-child(2) { animation-delay: 0.15s; }
.etoiles span:nth-child(3) { animation-delay: 0.3s; }
@keyframes etoile { from { transform: scale(0) rotate(-90deg); } to { transform: none; } }
.quiz-erreurs { margin: 0; padding-left: 1.2em; font-size: var(--t-s); }
.secoue { animation: secoue 0.4s ease; }
@keyframes secoue { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

/* ---------- animations ---------- */
#ecran-anim { overflow: hidden; }
.anim { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(340px, 1fr); }
.anim-scene { position: relative; min-height: 0; }
.anim .scene { --scene-1: var(--scene-froid-1); --scene-2: var(--scene-froid-2); }
.anim-texte {
  overflow: auto; background: var(--surface); border-left: 1px solid var(--ligne);
  padding: 22px clamp(18px, 2.4vw, 32px) 32px; display: grid; gap: 14px; align-content: start; min-width: 0;
}
.anim-texte h1 { font-size: var(--t-xxl); font-weight: 780; }
.lecteur { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lecteur button { border: 1px solid var(--accent); color: var(--accent); background: transparent; border-radius: 999px; padding: 6px 14px; font-size: var(--t-s); font-weight: 700; }
.lecteur button:hover, .lecteur button[aria-pressed="true"] { background: var(--accent); color: var(--accent-encre); }
.lecteur label { display: flex; align-items: center; gap: 8px; font-size: var(--t-s); color: var(--encre-2); flex: 1 1 220px; }
.lecteur input[type="range"] { flex: 1; accent-color: var(--accent); }
.lecteur .valeur { font-family: var(--f-mono); font-size: var(--t-xs); color: var(--encre); min-width: 6.5em; }
.etapes { margin: 0; padding-left: 1.4em; display: grid; gap: 6px; font-size: var(--t-s); }
.etapes li { padding: 6px 8px; border-radius: 8px; color: var(--encre-2); cursor: pointer; transition: background 0.3s; }
.etapes li.actif { background: var(--accent-doux); color: var(--encre); }
.etapes li::marker { font-family: var(--f-mono); font-weight: 500; color: var(--accent); }
.etapes .duree { display: block; font-family: var(--f-mono); font-size: var(--t-xs); color: var(--accent); }
.note { margin: 0; font-size: var(--t-xs); color: var(--encre-2); }
.anim-schema text { font-family: var(--f-texte); }

/* ---------- puzzle ---------- */
.puzzle .scene { left: calc(var(--panneau) + var(--gouttiere)); }
.piece { cursor: grab; }
.piece.prise { cursor: grabbing; filter: url(#halo-survol) drop-shadow(0 6px 6px rgba(0, 0, 0, 0.25)); }
.piece.place { cursor: default; }
.piece.place-ok { animation: fixe 0.5s ease; }
@keyframes fixe { 0% { opacity: 0.6; } 50% { opacity: 1; filter: url(#halo-bon); } 100% { opacity: 1; } }
.emplacement { fill: none; stroke: var(--encre-2); stroke-width: 1.4px; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; opacity: 0.7; }
.emplacement-organe * { fill: none !important; stroke: none !important; }
.emplacement-organe g[stroke-linejoin] * { fill: rgba(255, 255, 255, 0.28) !important; stroke: var(--encre-2) !important; stroke-width: 1.3px !important; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.emplacement-organe.indice g[stroke-linejoin] * { stroke: #1fc0ff !important; stroke-width: 3px !important; animation: clignote 0.65s ease-in-out infinite alternate; }
@keyframes clignote { from { fill: rgba(31, 192, 255, 0.08); } to { fill: rgba(31, 192, 255, 0.4); } }
.piece.indice-piece { filter: url(#halo-quiz); }
.etiquette-piece { font-family: var(--f-texte); font-weight: 700; font-size: 12px; fill: var(--encre); paint-order: stroke; stroke: var(--surface); stroke-width: 3.5px; stroke-linejoin: round; pointer-events: none; }
.panneau-puzzle .case { display: flex; gap: 8px; align-items: flex-start; font-size: var(--t-s); }
.panneau-puzzle .case input { accent-color: var(--accent); margin-top: 3px; }


/* dessins réduits et aplatis (pieds du corps entier) : contours d'épaisseur constante */
.aplati * { vector-effect: non-scaling-stroke; }
/* les os en transparence, par-dessus les muscles ou les organes */
.fantome { opacity: 0.5; pointer-events: none; }
.fantome:empty { display: none; }

/* expressions du visage */
.expressions { border: 1px solid var(--ligne); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; background: var(--surface-2); }
.expressions-titre { margin: 0; font-family: var(--f-titre); font-weight: 750; font-size: var(--t-m); }
.expressions-mise { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: center; }
.mini-visage { width: 64px; height: 64px; display: block; }
.puces-expressions { display: flex; flex-wrap: wrap; gap: 5px; }
.puces-expressions button { border: 1px solid var(--ligne); background: var(--surface); color: var(--encre); border-radius: 999px; padding: 4px 10px; font-size: var(--t-xs); font-weight: 700; }
.puces-expressions button:hover { border-color: var(--accent); }
.puces-expressions button[aria-pressed="true"] { background: var(--accent); color: var(--accent-encre); border-color: var(--accent); }
.liens-fiche .bouton { margin: 0 6px 6px 0; }

/* ---------- confettis ---------- */
.confettis { position: fixed; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.confettis i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: tombe linear forwards; }
@keyframes tombe { to { transform: translate(var(--dx), 105vh) rotate(var(--r)); } }

/* ---------- petits écrans ---------- */
@media (max-width: 960px) {
  .raccourcis, .grille-couches { grid-template-columns: minmax(0, 1fr); }
  .accueil-haut { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .explorer, .puzzle { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
  .explorer .scene, .puzzle .scene { position: relative; inset: auto; grid-row: 1; }
  .explorer .outils { max-width: calc(100% - 2 * var(--gouttiere)); left: var(--gouttiere); justify-content: flex-start; top: 10px; }
  .explorer .dessin { top: 48px; height: calc(100% - 52px); }
  .aide-souris { display: none; }
  .panneau {
    position: relative; inset: auto; width: auto; grid-row: 2; border-radius: 0; border-width: 1px 0 0; box-shadow: none;
    max-height: 44vh; padding: 12px var(--gouttiere);
  }
  .liste-parties { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  #ecran-anim { overflow: auto; }
  .anim { grid-template-columns: minmax(0, 1fr); }
  .anim-scene { height: min(56vh, 520px); min-height: 300px; }
  .anim-texte { border-left: 0; border-top: 1px solid var(--ligne); overflow: visible; padding-inline: var(--gouttiere); }
  .barre nav a { padding: 5px 9px; }
}
.marque-court { display: none; }
@media (max-width: 560px) {
  .barre { gap: 8px 12px; padding-block: 8px; }
  .marque-long { display: none; }
  .marque-court { display: inline; }
  .barre nav { order: 3; width: 100%; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; }
  .barre nav a { white-space: nowrap; }
  .choix-niveau > * { padding: 4px 10px; }
  .panneau { max-height: 40vh; }
  .zoom #btn-zoom-init { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .carte, .partie { transition: none; }
  .carte:hover { transform: none; }
  .anime .bat, .anime .respire, .anime .respire-diaphragme, .partie.pop, .etoiles span, .apparait, .secoue, .piece.place-ok { animation: none; }
  .quiz-progression span { transition: none; }
  .confettis { display: none; }
}
