/* LA CELLULE 3D — feuille de style
   Mise en page : une barre en haut, puis un écran plein cadre (scène 3D) avec ses panneaux.
   Couleurs inspirées des colorations de microscopie : hématoxyline (violet), éosine (rose),
   chlorophylle (vert) et membrane animale (orangé). */
: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;
  --vegetal: #357a26;
  --animal: #b9531f;
  --froid: #2a5fa8;
  --rose: #a8325a;
  --bon: #1f7a3d;
  --bon-doux: #dff3e5;
  --faux: #b3261e;
  --faux-doux: #fbe2df;
  --bulle-fond: #1c1a2c;
  --bulle-texte: #ffffff;
  --verre: rgba(255, 255, 255, 0.8);
  --scene-chaud-1: #f6e8dc; --scene-chaud-2: #d9bfae;
  --scene-vert-1: #e6f2d9; --scene-vert-2: #b7d3a1;
  --scene-froid-1: #e6eef8; --scene-froid-2: #b9c9df;
  --scene-rose-1: #f8e6ea; --scene-rose-2: #ddb7c1;
  --scene-neutre-1: #f1f2f9; --scene-neutre-2: #cfd3e5;
  --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);
  --rayon: 10px;
  --gouttiere: 16px;
}
/* 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 et des couleurs de coloration
   sombres donnait du texte foncé sur une scène ou une bulle foncée 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); height: 100%; }

/* ---------- ambiances (fond de scène et couleur du titre) ---------- */
[data-fond], .scene { --scene-1: var(--scene-neutre-1); --scene-2: var(--scene-neutre-2); --titre: var(--encre); }
[data-fond="chaud"] { --scene-1: var(--scene-chaud-1); --scene-2: var(--scene-chaud-2); --titre: var(--animal); }
[data-fond="vert"] { --scene-1: var(--scene-vert-1); --scene-2: var(--scene-vert-2); --titre: var(--vegetal); }
[data-fond="froid"] { --scene-1: var(--scene-froid-1); --scene-2: var(--scene-froid-2); --titre: var(--froid); }
[data-fond="rose"] { --scene-1: var(--scene-rose-1); --scene-2: var(--scene-rose-2); --titre: var(--rose); }

/* ---------- barre ---------- */
.barre {
  display: flex; align-items: center; gap: 12px 28px; 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: -16px;
  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; display: inline-flex; align-items: baseline; gap: 0.3em;
}
.marque span {
  font-family: var(--f-mono); font-weight: 500; font-size: var(--t-xs); color: var(--accent-encre); background: var(--accent);
  padding: 2px 6px; border-radius: 4px; letter-spacing: 0.04em; transform: translateY(-2px);
}
.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-langue { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--encre-2); }
.choix-langue svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; flex: none; }
.choix-langue select {
  border: 1px solid var(--ligne); border-radius: 999px; background: var(--surface); color: var(--encre);
  padding: 4px 10px; font-size: var(--t-s);
}
.choix-langue select:hover { border-color: var(--accent); }
/* Le russe utilise une police qui contient l'alphabet cyrillique. */
html[lang="ru"] { --f-titre: "Golos Text", "Segoe UI", system-ui, sans-serif; --f-texte: "Golos Text", "Segoe UI", system-ui, sans-serif; }

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

/* ---------- accueil ---------- */
.accueil { overflow: auto; }
.accueil-mise { max-width: 1160px; margin: 0 auto; padding: 32px var(--gouttiere) 48px; display: grid; gap: 30px; }
.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; }
.section-accueil { display: grid; gap: 14px; scroll-margin-top: 16px; }
.section-accueil h2 { font-size: var(--t-xl); font-weight: 720; }
.grille-cellules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .grille-cellules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grille-cellules { grid-template-columns: minmax(0, 1fr); } }
.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;
}
.carte:hover { transform: translateY(-3px); }
.carte img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: radial-gradient(110% 90% at 50% 40%, var(--scene-1), var(--scene-2)); }
.carte-texte { padding: 12px 14px 14px; display: grid; gap: 2px; 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); }
.raccourcis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; scroll-margin-top: 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 3D ---------- */
.scene { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(115% 90% at 50% 40%, var(--scene-1), var(--scene-2)); }
[data-fond="chaud"] .scene { --scene-1: var(--scene-chaud-1); --scene-2: var(--scene-chaud-2); }
[data-fond="vert"] .scene { --scene-1: var(--scene-vert-1); --scene-2: var(--scene-vert-2); }
[data-fond="froid"] .scene { --scene-1: var(--scene-froid-1); --scene-2: var(--scene-froid-2); }
[data-fond="rose"] .scene { --scene-1: var(--scene-rose-1); --scene-2: var(--scene-rose-2); }
.scene .toile { display: block; width: 100%; height: 100%; touch-action: none; }
.scene.masquee { visibility: hidden; }
.scene.microscope { filter: grayscale(1) contrast(1.35) brightness(1.04); }
.sans-3d { position: absolute; inset: auto 16px 50% 16px; text-align: center; color: var(--encre-2); }

.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); }

.barre-echelle {
  position: absolute; right: var(--gouttiere); bottom: 12px; z-index: 2; pointer-events: none;
  display: grid; justify-items: center; gap: 2px; padding: 4px 8px 3px; border-radius: 6px; background: var(--verre);
}
.barre-echelle .trait { display: block; height: 6px; border: 2px solid var(--encre); border-top: 0; min-width: 20px; }
.barre-echelle .texte { font-family: var(--f-mono); font-size: var(--t-xs); color: var(--encre); font-variant-numeric: tabular-nums; }

.outils { display: flex; flex-wrap: wrap; gap: 6px; }
.outils button, .bascule > *, .actions-cellule button, .quiz-actions 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, .actions-cellule button:hover, .quiz-actions button:hover { border-color: var(--accent); }
.outils button[aria-pressed="true"], .actions-cellule 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-current="true"], .bascule > [aria-pressed="true"] { background: var(--accent); color: var(--accent-encre); border-color: var(--accent); position: relative; }

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

/* ---------- écran cellule ---------- */
.cellule .outils { position: absolute; top: 14px; right: var(--gouttiere); z-index: 3; justify-content: flex-end; max-width: calc(100% - 340px); }
.panneau-cellule {
  position: absolute; top: 14px; left: var(--gouttiere); bottom: 44px; width: 300px; z-index: 3;
  background: var(--verre); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--ligne); border-radius: 14px; box-shadow: var(--ombre);
  padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: auto;
}
.choix-cellule {
  width: 100%; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--ligne); background: var(--surface); color: var(--encre);
  font-size: var(--t-s); font-weight: 700;
}
.panneau-cellule 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-cellule { display: flex; flex-wrap: wrap; gap: 6px; }
.actions-cellule button { background: var(--surface); font-weight: 700; }
.bloc-panneau { display: flex; flex-direction: column; gap: 10px; }
.liste-organites { list-style: none; margin: 0 -6px; padding: 0; display: grid; gap: 1px; align-content: start; }
.liste-organites a { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; color: var(--encre); text-decoration: none; font-size: var(--t-s); }
.liste-organites a:hover, .liste-organites a.actif { background: var(--accent-doux); color: var(--accent); }
.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.18); }
.pastille.trait { border-radius: 0; height: 0; border-top: 2px dashed var(--p); box-shadow: none; background: none; width: 16px; }

.calque-legendes { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.legende {
  position: absolute; left: 0; top: 0; pointer-events: auto; display: inline-flex; align-items: center; gap: 6px;
  margin: -9px 0 0 -5px; padding: 2px 8px 2px 4px; border-radius: 999px; white-space: nowrap;
  font-size: var(--t-xs); font-weight: 700; color: var(--encre); text-decoration: none;
  background: var(--verre); border: 1px solid var(--ligne);
}
.legende .point { width: 8px; height: 8px; border-radius: 50%; background: var(--eosine); box-shadow: 0 0 0 2px var(--surface); }
.legende:hover, .legende.actif { background: var(--accent); color: var(--accent-encre); border-color: var(--accent); }
.muettes .legende { font-family: var(--f-mono); font-size: var(--t-s); cursor: default; }

.illustration { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 108px var(--gouttiere) 50px 330px; overflow: auto; }
.avec-illustration .aide-souris, .avec-illustration .barre-echelle { display: none; }

/* ---------- photos au microscope ---------- */
.cadre-photos {
  width: min(100%, 880px); display: grid; gap: 10px; padding: 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--ligne); box-shadow: var(--ombre);
}
.cadre-photos h2 { font-size: var(--t-xl); font-weight: 740; color: var(--titre); }
figure.photo { margin: 0; display: grid; gap: 8px; }
.photo .agrandir { display: block; width: 100%; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: #101018; cursor: zoom-in; }
.photo .agrandir img { display: block; width: 100%; height: auto; max-height: 58vh; object-fit: contain; }
.photos-fiche .photo .agrandir img { max-height: 380px; }
.photo figcaption, .loupe figcaption { font-size: var(--t-s); color: var(--encre-2); line-height: 1.45; }
.type-photo {
  display: inline-block; font-family: var(--f-mono); font-size: var(--t-xs); color: var(--accent); background: var(--accent-doux);
  padding: 1px 8px; border-radius: 999px; margin-right: 4px;
}
.credit { display: block; margin-top: 4px; font-size: var(--t-xs); }
.nav-photos { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: var(--t-s); color: var(--encre-2); font-variant-numeric: tabular-nums; }
.nav-photos button {
  border: 1px solid var(--ligne); background: var(--surface); color: var(--encre); border-radius: 999px; padding: 4px 14px; font-size: var(--t-m);
}
.nav-photos button:hover { border-color: var(--accent); }
.photos-fiche { display: grid; gap: 16px; }
.boutons-coupe { display: flex; flex-wrap: wrap; gap: 6px; }
.loupe {
  border: 0; padding: 12px; border-radius: 14px; background: var(--surface); color: var(--encre);
  width: min(96vw, 1200px); max-height: 94vh; box-shadow: var(--ombre);
}
.loupe::backdrop { background: rgba(10, 10, 20, 0.72); }
.loupe figure { margin: 0; display: grid; gap: 8px; }
.loupe img { display: block; margin: 0 auto; max-width: 100%; max-height: 76vh; width: auto; height: auto; background: #101018; border-radius: 8px; }
.fermer-loupe {
  position: absolute; top: 18px; right: 18px; border: 1px solid var(--ligne); background: var(--verre); color: var(--encre);
  border-radius: 999px; padding: 5px 12px; font-size: var(--t-s); font-weight: 700;
}

.panneau-coupe {
  position: absolute; right: var(--gouttiere); bottom: 64px; z-index: 3; width: min(330px, calc(100% - 2 * var(--gouttiere)));
  background: var(--verre); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--ligne); border-radius: 12px; box-shadow: var(--ombre); padding: 12px; display: grid; gap: 8px;
  font-size: var(--t-s);
}
.panneau-titre { margin: 0; font-weight: 700; }
.panneau-coupe input[type="range"] { width: 100%; accent-color: var(--accent); }
.panneau-coupe .case { display: flex; gap: 8px; align-items: flex-start; }
.panneau-coupe .case input { accent-color: var(--accent); margin-top: 3px; }
.panneau-coupe .bascule > * { font-size: var(--t-xs); padding: 5px 9px; }

/* ---------- quiz et étapes ---------- */
.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: 5px; 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; }
.quiz-erreurs { margin: 0; padding-left: 1.2em; font-size: var(--t-s); }
.quiz-muette { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.quiz-muette li { display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 8px; transition: background 0.3s; }
.quiz-muette li.eclair { background: var(--accent-doux); }
.quiz-muette .num { font-family: var(--f-mono); font-weight: 500; min-width: 2em; text-align: center; padding: 2px 6px; border-radius: 999px; background: var(--surface-2); }
.quiz-muette .reponse { border: 1px dashed var(--ligne); background: none; color: var(--encre-2); border-radius: 8px; padding: 3px 10px; font-size: var(--t-s); text-align: left; flex: 1; }
.quiz-muette li[data-vu="1"] .reponse { border-style: solid; color: var(--encre); font-weight: 700; }
.etapes { margin: 0; padding-left: 1.4em; display: grid; gap: 8px; font-size: var(--t-s); }
.etapes li { padding: 6px 8px; border-radius: 8px; color: var(--encre-2); }
.etapes li.actif { background: var(--accent-doux); color: var(--encre); }
.etapes li::marker { font-family: var(--f-mono); font-weight: 500; color: var(--accent); }
#endo-etapes li { cursor: pointer; }

/* ---------- fiche ---------- */
#ecran-fiche { overflow: hidden; }
.fiche { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(340px, 1fr); height: 100%; }
.fiche-scene { position: relative; min-height: 0; }
.outils-fiche { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 3; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; pointer-events: none; }
.outils-fiche .groupe { display: flex; flex-wrap: wrap; gap: 6px; pointer-events: auto; }
.fiche-scene .barre-echelle { right: auto; left: 12px; }
.fiche-scene .aide-souris { max-width: calc(100% - 300px); }
.fiche-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;
}
.retour { font-size: var(--t-s); text-decoration: none; font-weight: 700; justify-self: start; }
.retour:hover { text-decoration: underline; }
.fiche-texte h1 { font-size: var(--t-xxl); font-weight: 780; color: var(--titre); }
.sous-titre { margin: -4px 0 0; color: var(--encre-2); font-size: var(--t-s); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.puces-cellules { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.puces-cellules a { padding: 2px 9px; border-radius: 999px; border: 1px solid var(--ligne); text-decoration: none; color: var(--encre); font-size: var(--t-xs); }
.puces-cellules a:hover { border-color: var(--accent); }
.puces-cellules a[aria-current="true"] { background: var(--accent); color: var(--accent-encre); border-color: var(--accent); }
.formule { font-family: var(--f-mono); color: var(--encre); font-weight: 500; }
.texte { display: grid; gap: 10px; max-width: 68ch; }
.texte h3 { font-size: var(--t-l); font-weight: 700; margin-top: 6px; }
.texte p { margin: 0; }
#fiche-contenu { display: grid; gap: 18px; }
#fiche-contenu h3 { font-size: var(--t-m); font-weight: 700; }
.animations { display: grid; gap: 10px; }
.boutons-anim, .lecteur { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lecteur input[type="range"] { flex: 1 1 200px; accent-color: var(--accent); }
.bouton-anim, .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;
}
.bouton-anim[aria-expanded="true"], .bouton:hover, .bouton-anim:hover { background: var(--accent); color: var(--accent-encre); }
.figure-anim, .formule-dev, .adn-schemas img, .situer img { background: #ffffff; border-radius: var(--rayon); border: 1px solid var(--ligne); }
.figure-anim { margin: 0; padding: 10px; display: grid; justify-items: center; gap: 6px; }
.figure-anim figcaption, .formule-dev figcaption { font-size: var(--t-xs); color: #57546f; }
.situer { display: grid; gap: 10px; padding: 16px; background: var(--surface-2); border-radius: 12px; }
.situer img { padding: 8px; justify-self: start; width: 100%; max-width: 340px; }
.arguments ul { margin: 8px 0 0; padding-left: 1.2em; display: grid; gap: 6px; font-size: var(--t-s); }
.legende-couleurs ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; font-size: var(--t-s); }
.legende-couleurs li { display: flex; align-items: center; gap: 8px; }
.formule-dev { margin: 0; padding: 12px; display: grid; gap: 6px; justify-items: center; }
.adn-schemas { display: grid; gap: 10px; }
.adn-schemas img { padding: 8px; width: 100%; max-width: 420px; }
.note { margin: 0; font-size: var(--t-xs); color: var(--encre-2); }
.fiche-nav { border-top: 1px solid var(--ligne); padding-top: 16px; margin-top: 8px; display: grid; gap: 14px; }
.nav-groupe h3 { 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: 6px; }
.nav-groupe ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.nav-groupe a { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--encre); text-decoration: none; font-size: var(--t-s); }
.nav-groupe a:hover { background: var(--accent-doux); color: var(--accent); }
.nav-groupe a[aria-current="page"] { background: var(--accent); color: var(--accent-encre); }

/* ---------- échelles ---------- */
.echelle { overflow: auto; }
.echelle-mise { max-width: 1100px; margin: 0 auto; padding: 28px var(--gouttiere) 40px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 574px); gap: 32px; align-items: start; }
.echelle-texte { display: grid; gap: 12px; position: sticky; top: 20px; }
.echelle-texte h1 { font-size: var(--t-xxl); font-weight: 780; }
.echelle-texte > p { margin: 0; color: var(--encre-2); }
#echelle-liste { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--ligne); }
#echelle-liste li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 4px; border-bottom: 1px solid var(--ligne); font-size: var(--t-s); }
#echelle-liste li.actif { background: var(--accent-doux); }
#echelle-liste .taille { font-family: var(--f-mono); font-variant-numeric: tabular-nums; color: var(--encre-2); white-space: nowrap; }
.echelle-image { position: relative; background: #ffffff; border-radius: 14px; border: 1px solid var(--ligne); overflow: hidden; }
.echelle-image img { display: block; width: 100%; height: auto; }
.echelle-image svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.echelle-image .textes-echelle { pointer-events: none; font-family: Verdana, "DejaVu Sans", "Golos Text", Arial, sans-serif; font-size: 11px; fill: #111111; }
.textes-echelle .axe { font-size: 12.5px; }
.textes-echelle .vertical { font-size: 12.5px; letter-spacing: 0.04em; }
.echelle-image svg [data-i] > *:not(title) { fill: transparent; cursor: help; }
.echelle-image svg a > *:not(title) { cursor: pointer; }
.echelle-image svg .actif > *:not(title) { fill: rgba(79, 63, 194, 0.16); stroke: #4f3fc2; stroke-width: 2; }
.bulle-echelle {
  position: absolute; transform: translate(10px, -50%); background: #1c1a2c; color: #ffffff; padding: 5px 10px; border-radius: 8px;
  font-size: var(--t-s); pointer-events: none; white-space: nowrap; font-family: var(--f-mono);
}
.bulle-echelle strong { font-family: var(--f-texte); }

/* ---------- petits écrans ---------- */
@media (max-width: 960px) {
  .raccourcis { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .cellule { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
  .cellule .scene { position: relative; inset: auto; grid-row: 1; }
  .illustration { grid-row: 1; position: relative; inset: auto; padding: 56px var(--gouttiere) 12px; }
  .cellule .outils { max-width: calc(100% - 2 * var(--gouttiere)); left: var(--gouttiere); justify-content: flex-start; top: 10px; }
  .cellule .aide-souris { display: none; }
  .panneau-cellule {
    position: relative; inset: auto; width: auto; grid-row: 2; border-radius: 0; border-width: 1px 0 0; box-shadow: none;
    max-height: 42vh; background: var(--surface); padding: 12px var(--gouttiere);
  }
  .panneau-cellule h1 { font-size: var(--t-l); }
  .liste-organites { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .panneau-coupe { bottom: auto; top: 96px; }
  #ecran-fiche { overflow: auto; }
  .fiche { grid-template-columns: minmax(0, 1fr); height: auto; }
  .fiche-scene { height: min(58vh, 520px); min-height: 300px; }
  .fiche-scene .aide-souris { display: none; }
  .fiche-texte { border-left: 0; border-top: 1px solid var(--ligne); overflow: visible; padding-inline: var(--gouttiere); }
  .echelle-mise { grid-template-columns: minmax(0, 1fr); }
  .echelle-texte { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  .carte { transition: none; }
  .carte:hover { transform: none; }
  .quiz-progression span { transition: none; }
}
