/* ==========================================================================
   Cours de chimie en scrollytelling : feuille commune aux fiches chimie/*.html
   Préfixe ch-. Moteur de défilement : ../css/scrolly.css + ../js/scrolly.js.
   Direction : papier crème, surfaces et schémas pastel, deux accents saturés
   (framboise pour l'important, bleu pétrole pour les repères), Fraunces + Outfit.

   Couleurs (passe du 1er oct. 2026, valeurs de ../css/couleurs.css) : trois familles,
   lilas, menthe et ciel. Chaque partie porte data-teinte="lilas|menthe|ciel" et tout ce
   qu'elle contient s'accorde à sa famille :
     --ch-t   pastel (fonds, bandes)       --ch-t-m  moyen (formes, bordures, pastilles)
     --ch-t-f foncé (élément actif, texte blanc dessus)
     --ch-t-x texte coloré, lisible (≥ 4,5:1) sur le pastel comme sur le moyen
   Encarts au code commun du site : définition ciel, exemple et exercice citron,
   piège rose, à retenir menthe (.ch-retenir), repère lilas (.ch-note), citation pêche (.ch-citation).
   ========================================================================== */

body.ch-page {
    --ch-paper: #faf6f0;
    --ch-paper-2: #f3ece3;
    --ch-card: #fffdf9;
    --ch-line: #e9dfd5;
    --ch-line-2: #d8cabd;
    --ch-ink: #2a2331;
    --ch-ink-2: #51485a;
    --ch-ink-3: #6e6478;
    --ch-accent: #b3244e;
    --ch-accent-2: #9b1d42;
    --ch-accent-soft: #fbe4ea;
    --ch-teal: #1d5a61;
    --ch-teal-soft: #dcefef;
    --ch-rose: #f8d7df;
    --ch-peche: #fbe0cf;
    --ch-beurre: #f8ecc2;
    --ch-menthe: #d5eee0;
    --ch-ciel: #d7e7f4;
    --ch-lilas: #e5ddf4;
    --ch-sauge: #e0e9d4;
    --ch-ok: #1c6e46;
    --ch-ok-soft: #e1f3e8;
    --ch-ko: #b3244e;
    --ch-ko-soft: #fbe4ea;
    --ch-serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
    --ch-sans: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
    /* encarts (code commun) : titres assombris quand le ton foncé commun passe sous 4,5:1 */
    --ch-def-fond: var(--mk-ciel, #E3F0FB);     --ch-def-bord: var(--mk-ciel-m, #BCD9F5);     --ch-def-titre: #1D4ED8;
    --ch-ex-fond: var(--mk-citron, #FFF4CC);    --ch-ex-bord: var(--mk-citron-m, #FBE38E);    --ch-ex-titre: #854d0e;
    --ch-piege-fond: var(--mk-rose, #FDE7EF);   --ch-piege-bord: var(--mk-rose-m, #F9C6D8);   --ch-piege-titre: #BE185D;
    --ch-ret-fond: var(--mk-menthe, #E2F5EA);   --ch-ret-bord: var(--mk-menthe-m, #B6E5C8);   --ch-ret-titre: #166534;
    --ch-rep-fond: var(--mk-lilas, #EEE8FD);    --ch-rep-bord: var(--mk-lilas-m, #D4C8F7);    --ch-rep-titre: #6D28D9;
    --ch-cit-fond: var(--mk-peche, #FFEADB);    --ch-cit-bord: var(--mk-peche-m, #FDCDAE);    --ch-cit-titre: #9a3412;
    margin: 0;
    min-height: 100vh;
    padding-bottom: 96px;
    background: var(--ch-paper);
    color: var(--ch-ink);
    font-family: var(--ch-sans);
    font-size: 1.0625rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
/* familles : lilas par défaut (en-tête), puis une famille par partie */
body.ch-page, .ch-page [data-teinte="lilas"] {
    --ch-t: var(--mk-lilas, #EEE8FD); --ch-t-m: var(--mk-lilas-m, #D4C8F7); --ch-t-f: var(--mk-lilas-f, #6D28D9); --ch-t-x: #5b21b6;
}
.ch-page [data-teinte="menthe"] {
    --ch-t: var(--mk-menthe, #E2F5EA); --ch-t-m: var(--mk-menthe-m, #B6E5C8); --ch-t-f: var(--mk-menthe-f, #15803D); --ch-t-x: #166534;
}
.ch-page [data-teinte="ciel"] {
    --ch-t: var(--mk-ciel, #E3F0FB); --ch-t-m: var(--mk-ciel-m, #BCD9F5); --ch-t-f: var(--mk-ciel-f, #1D4ED8); --ch-t-x: #1e40af;
}
.ch-page ::selection { background: var(--ch-rose); color: var(--ch-ink); }
.ch-page a { color: var(--ch-accent); text-underline-offset: 3px; }
.ch-page img, .ch-page svg { max-width: 100%; }
.ch-page sub, .ch-page sup { line-height: 0; }
.ch-page .hidden { display: none !important; }
.ch-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- Mise en page ---------------- */
.ch-wrap { max-width: 42rem; margin: 0 auto; padding: 0 16px; }
.ch-wrap-large { max-width: 56rem; margin: 0 auto; padding: 0 16px; }
.ch-section { padding: 52px 0 12px; }
.ch-bande { background: var(--ch-t); padding-bottom: 44px; margin-top: 28px; }
.ch-section + .ch-section.ch-bande { margin-top: 36px; }

/* ---------------- Typographie ---------------- */
.ch-kicker {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
    margin: 0 0 12px;
    font-size: 0.74rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--ch-accent);
}
.ch-kicker span + span::before { content: '·'; margin-right: 10px; color: var(--ch-line-2); }
.ch-h1 {
    margin: 0 0 14px;
    font-family: var(--ch-serif); font-weight: 600; font-optical-sizing: auto;
    font-size: clamp(2.15rem, 9vw, 3.5rem); line-height: 1.04; letter-spacing: -0.012em;
    color: var(--ch-ink);
}
.ch-h2 {
    margin: 0 0 14px;
    font-family: var(--ch-serif); font-weight: 600; font-optical-sizing: auto;
    font-size: clamp(1.62rem, 6.4vw, 2.25rem); line-height: 1.12; letter-spacing: -0.008em;
    color: var(--ch-ink);
}
.ch-h3 { margin: 26px 0 8px; font-size: 1.12rem; font-weight: 700; line-height: 1.3; color: var(--ch-ink); }
/* numéro de partie : pastille dans la famille de la partie */
.ch-num {
    display: table; margin: 0 0 12px; padding: 4px 12px 3px; border-radius: 999px;
    background: var(--ch-t-m); color: var(--ch-t-x);
    font-size: 0.74rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; line-height: 1.5;
}
.ch-lead { margin: 0 0 18px; font-size: 1.16rem; line-height: 1.6; color: var(--ch-ink-2); }
.ch-page p { margin: 0 0 14px; }
.ch-prose p, .ch-prose li { color: var(--ch-ink-2); }
.ch-prose strong, .ch-page strong { color: var(--ch-ink); font-weight: 700; }
.ch-prose ul, .ch-liste { list-style: none; margin: 0 0 16px; padding: 0; }
.ch-prose ul li, .ch-liste li { position: relative; padding-left: 20px; margin-bottom: 8px; }
.ch-prose ul li::before, .ch-liste li::before {
    content: ''; position: absolute; left: 3px; top: 0.66em;
    width: 7px; height: 7px; border-radius: 50%; background: var(--ch-t-f);
}
.ch-prose ol, .ch-etapes { counter-reset: ch-e; list-style: none; margin: 0 0 16px; padding: 0; }
.ch-prose ol li, .ch-etapes li { counter-increment: ch-e; position: relative; padding-left: 36px; margin-bottom: 10px; }
.ch-prose ol li::before, .ch-etapes li::before {
    content: counter(ch-e); position: absolute; left: 0; top: 0.05em;
    width: 25px; height: 25px; border-radius: 50%;
    background: var(--ch-t-m); color: var(--ch-t-x);
    font-size: 0.8rem; font-weight: 800; line-height: 25px; text-align: center;
}
/* listes de méthode (étapes numérotées d'un bloc de cours) : une carte pastel par étape, blanche dans une bande */
.ch-prose > ol:not(.ch-etapes):not(.tp-frise) { display: grid; gap: 8px; }
.ch-prose > ol:not(.ch-etapes):not(.tp-frise) > li { margin: 0; padding: 10px 14px 10px 50px; border-radius: 14px; background: var(--ch-t); border: 1.5px solid var(--ch-t-m); }
.ch-prose > ol:not(.ch-etapes):not(.tp-frise) > li::before { left: 13px; top: 11px; }
.ch-bande .ch-prose > ol:not(.ch-etapes):not(.tp-frise) > li { background: var(--ch-card); }
.ch-hl { background: var(--mk-citron-m, #FBE38E); padding: 0 0.16em; border-radius: 0.22em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.ch-f { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ch-formule {
    margin: 16px 0; padding: 14px 16px;
    background: var(--ch-t); border: 1.5px solid var(--ch-t-m); border-radius: 16px;
    text-align: center; font-size: 1.18rem; font-weight: 600; line-height: 1.6; color: var(--ch-ink);
    font-variant-numeric: tabular-nums;
}
.ch-bande .ch-formule { background: var(--ch-card); }
.ch-formule small { display: block; margin-top: 4px; font-size: 0.86rem; font-weight: 500; color: var(--ch-ink-2); line-height: 1.45; }

/* Encadrés au code couleur commun : définition (ciel), exemple (citron), piège (rose),
   repère (.ch-note, lilas), à retenir (.ch-retenir, menthe) */
.ch-def, .ch-ex, .ch-piege, .ch-note, .ch-retenir, .ch-citation {
    margin: 18px 0; padding: 14px 16px; border-radius: 16px; border: 1.5px solid;
    font-size: 1rem; line-height: 1.6; color: var(--ch-ink-2);
}
.ch-def { background: var(--ch-def-fond); border-color: var(--ch-def-bord); }
.ch-ex { background: var(--ch-ex-fond); border-color: var(--ch-ex-bord); }
.ch-piege { background: var(--ch-piege-fond); border-color: var(--ch-piege-bord); }
.ch-note { background: var(--ch-rep-fond); border-color: var(--ch-rep-bord); }
.ch-page .ch-retenir { background: var(--ch-ret-fond); border-color: var(--ch-ret-bord); }
.ch-page .ch-citation { background: var(--ch-cit-fond); border-color: var(--ch-cit-bord); }
/* encart de la même famille que sa bande : fond clair, le liseré garde la couleur */
.ch-bande[data-teinte="ciel"] .ch-def:not(.ch-retenir), .ch-bande[data-teinte="lilas"] .ch-note:not(.ch-retenir), .ch-page .ch-bande[data-teinte="menthe"] .ch-retenir { background: var(--ch-card); }
/* à l'intérieur d'un encart, puces, numéros et formules prennent la famille de l'encart */
.ch-def { --ch-t: var(--ch-def-fond); --ch-t-m: var(--ch-def-bord); --ch-t-f: var(--ch-def-titre); --ch-t-x: #1e40af; }
.ch-ex { --ch-t: var(--ch-ex-fond); --ch-t-m: var(--ch-ex-bord); --ch-t-f: var(--ch-ex-titre); --ch-t-x: var(--ch-ex-titre); }
.ch-piege { --ch-t: var(--ch-piege-fond); --ch-t-m: var(--ch-piege-bord); --ch-t-f: var(--ch-piege-titre); --ch-t-x: #9d174d; }
.ch-note { --ch-t: var(--ch-rep-fond); --ch-t-m: var(--ch-rep-bord); --ch-t-f: var(--ch-rep-titre); --ch-t-x: #5b21b6; }
.ch-page .ch-retenir { --ch-t: var(--ch-ret-fond); --ch-t-m: var(--ch-ret-bord); --ch-t-f: var(--mk-menthe-f, #15803D); --ch-t-x: var(--ch-ret-titre); }
.ch-def .ch-formule, .ch-ex .ch-formule, .ch-piege .ch-formule, .ch-note .ch-formule, .ch-retenir .ch-formule { background: var(--ch-card); }
.ch-page .ch-citation { --ch-t: var(--ch-cit-fond); --ch-t-m: var(--ch-cit-bord); --ch-t-f: var(--ch-cit-titre); --ch-t-x: var(--ch-cit-titre); }
.ch-def > b:first-child, .ch-ex > b:first-child, .ch-piege > b:first-child, .ch-note > b:first-child, .ch-retenir > b:first-child, .ch-citation > b:first-child {
    display: block; margin-bottom: 4px;
    font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
}
.ch-def > b:first-child { color: var(--ch-def-titre); }
.ch-ex > b:first-child { color: var(--ch-ex-titre); }
.ch-piege > b:first-child { color: var(--ch-piege-titre); }
.ch-note > b:first-child { color: var(--ch-rep-titre); }
.ch-page .ch-retenir > b:first-child { color: var(--ch-ret-titre); }
.ch-page .ch-citation > b:first-child { color: var(--ch-cit-titre); }
.ch-def p:last-child, .ch-ex p:last-child, .ch-piege p:last-child, .ch-note p:last-child, .ch-retenir p:last-child, .ch-citation p:last-child { margin-bottom: 0; }

/* Tableaux */
.ch-table-wrap { margin: 16px 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ch-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.ch-table th, .ch-table td { padding: 9px 8px; border-bottom: 1px solid var(--ch-line); text-align: left; vertical-align: top; }
.ch-table th { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ch-t-x); background: var(--ch-t); border-bottom: 1.5px solid var(--ch-t-m); }
.ch-table th:first-child { border-top-left-radius: 10px; }
.ch-table th:last-child { border-top-right-radius: 10px; }
.ch-bande .ch-table th { background: var(--ch-t-m); }
.ch-table td { color: var(--ch-ink-2); }
.ch-table td:first-child { font-weight: 600; color: var(--ch-ink); }
.ch-table .ch-num-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Figures statiques */
.ch-figure { margin: 18px 0; }
.ch-figure svg { display: block; width: 100%; height: auto; margin: 0 auto; }
.ch-figure figcaption { margin-top: 8px; font-size: 0.9rem; line-height: 1.5; color: var(--ch-ink-3); text-align: center; }
.ch-svg text { font-family: var(--ch-sans); }

/* ---------------- En-tête de fiche ---------------- */
.ch-hero { padding: 76px 0 8px; }
.ch-hero .ch-wrap { position: relative; }
.ch-hero-fig { margin: 8px 0 22px; }
.ch-hero-fig svg { display: block; box-sizing: border-box; width: 100%; max-width: 30rem; height: auto; margin: 0 auto; padding: 10px 8px; background: var(--ch-t); border: 1.5px solid var(--ch-t-m); border-radius: 22px; }
.ch-bande .ch-hero-fig svg { background: var(--ch-card); }
/* halos des étiquettes (paint-order) accordés au fond du panneau de la figure */
.ch-hero-fig svg text[paint-order="stroke"] { stroke: var(--ch-t); }
.ch-bande .ch-hero-fig svg text[paint-order="stroke"] { stroke: var(--ch-card); }
.ch-objectifs {
    margin: 22px 0 0; padding: 16px 18px;
    background: var(--ch-t); border: 1.5px solid var(--ch-t-m); border-radius: 18px;
}
.ch-objectifs > p:first-child { margin: 0 0 8px; font-weight: 800; color: var(--ch-t-x); }
.ch-objectifs ul { list-style: none; margin: 0; padding: 0; }
.ch-objectifs li { position: relative; padding-left: 26px; margin-bottom: 7px; color: var(--ch-ink-2); line-height: 1.5; }
.ch-objectifs li::before {
    content: ''; position: absolute; left: 2px; top: 0.22em; width: 15px; height: 15px; border-radius: 50%;
    border: 2px solid var(--ch-t-f); background: var(--ch-t-m);
}
/* plan : chaque pastille prend la couleur de la partie qu'elle ouvre (data-teinte sur le li) */
.ch-sommaire { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.ch-sommaire a {
    display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px;
    border-radius: 999px; border: 1.5px solid var(--ch-t-m); background: var(--ch-t);
    color: var(--ch-t-x); font-size: 0.86rem; font-weight: 700; text-decoration: none;
}
.ch-sommaire a:hover { border-color: var(--ch-t-f); background: var(--ch-t-m); }

/* ---------------- Boutons et puces ---------------- */
.ch-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 46px; padding: 0 22px; border: 0; border-radius: 14px;
    background: var(--ch-accent); color: #fff;
    font: 700 1rem/1.2 var(--ch-sans); cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}
.ch-btn:hover { background: var(--ch-accent-2); }
.ch-btn:active { transform: translateY(1px); }
.ch-btn-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 42px; padding: 0 16px; border-radius: 12px;
    border: 1.5px solid var(--ch-t-m); background: var(--ch-card); color: var(--ch-ink-2);
    font: 600 0.92rem/1.2 var(--ch-sans); cursor: pointer;
}
.ch-btn-ghost:hover { border-color: var(--ch-accent); color: var(--ch-accent); }
.ch-puces { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
/* pastilles de choix : pastel de la famille, la pastille active passe au ton foncé */
.ch-puce {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 40px; padding: 0 13px; border-radius: 999px;
    border: 1.5px solid var(--ch-t-m); background: var(--ch-card); color: var(--ch-ink-2);
    font: 600 0.88rem/1.1 var(--ch-sans); cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.ch-puce:hover { border-color: var(--ch-t-f); color: var(--ch-ink); }
.ch-puce[aria-pressed="true"] { background: var(--ch-t-f); border-color: var(--ch-t-f); color: #fff; }
.ch-page button:focus-visible, .ch-page a:focus-visible, .ch-page summary:focus-visible, .ch-page input:focus-visible, .ch-page [tabindex]:focus-visible {
    outline: 3px solid var(--ch-accent); outline-offset: 2px;
}

/* Rangée de puces qui défile de côté (une seule ligne, le bouton actif se recentre) */
.ch-rangee { display: flex; flex-wrap: nowrap; justify-content: flex-start; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 2px 2px 4px; margin: 8px 0 0;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%); }
.ch-rangee::-webkit-scrollbar { display: none; }
.ch-rangee .ch-puce { flex: none; }
@media (min-width: 900px) { .ch-rangee { flex-wrap: wrap; justify-content: center; -webkit-mask-image: none; mask-image: none; } }
/* une rangée de pastilles précédée de son étiquette (scènes à deux choix) */
.ch-choix { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.ch-choix > span { flex: 0 0 74px; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ch-ink-3); }
.ch-choix .ch-rangee { flex: 1 1 auto; min-width: 0; margin-top: 0; }

/* ---------------- Scènes collées (mk-pin) ---------------- */
.ch-pin { --mk-pin-couleur: var(--ch-t-f); --mk-pin-haut: 10px; --mk-pin-bas: 70px; margin: 22px 0 8px; }
.ch-pin > .mk-pin-scene { padding: 0 12px; }
/* scène collée : carte pastel de la famille, schéma sur un écran blanc à l'intérieur */
.ch-scene {
    max-width: 34rem; margin: 0 auto; padding: 12px 12px 10px;
    background: var(--ch-t); border: 1.5px solid var(--ch-t-m); border-radius: 22px;
    color: var(--ch-ink);
}
.ch-scene-titre { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; margin: 2px 4px 6px; }
.ch-scene-titre h3, .ch-scene-titre p { margin: 0; }
.ch-scene-titre h3 { font-size: 1.02rem; font-weight: 700; line-height: 1.3; }
/* pas de capitales forcées : les titres dynamiques contiennent des symboles chimiques (Co ≠ CO) */
.ch-scene-titre p { font-size: 0.86rem; font-weight: 800; letter-spacing: 0.01em; color: var(--ch-t-x); }
.ch-scene svg { display: block; box-sizing: border-box; width: 100%; height: auto; padding: 6px 4px; background: var(--ch-card); border-radius: 16px; }
.ch-scene .ch-puces { justify-content: center; margin-top: 8px; }
.ch-scene .mk-pin-indice { color: var(--ch-ink-2); }
.ch-scene .mk-pin-barre { background: var(--ch-t-m); }
.ch-lectures { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; margin: 8px 0 0; }
.ch-lecture { min-width: 0; padding: 6px 10px 7px; border-radius: 12px; background: var(--ch-card); }
.ch-lecture span { display: block; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ch-t-x); }
.ch-lecture b { display: block; font-size: 1.04rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ch-ink); overflow-wrap: anywhere; }
.ch-explique { margin: 8px 2px 0; min-height: 4.2em; font-size: 0.93rem; line-height: 1.5; color: var(--ch-ink-2); }
.ch-explique b { color: var(--ch-ink); }

/* ---------------- Séquences pas à pas (mk-scrolly) ---------------- */
/* légende collée (moteur) : le schéma prend sa hauteur naturelle et se réduit si schéma + texte dépassent l'écran */
.ch-scrolly { --mk-card-bg: #fffdf9; --mk-card-fg: #2a2331; --mk-card-border: var(--ch-t-m); --mk-pin-couleur: var(--ch-t-f); --mk-scrolly-bottom: 72px; --mk-graphic-h: auto; margin: 26px auto 10px; }
.ch-scrolly .mk-scrolly-graphic { padding: 0 12px; box-sizing: border-box; }
/* schéma de séquence : panneau pastel de la famille, comme les figures d'ouverture (blanc dans une bande) ;
   les halos des étiquettes prennent la couleur du panneau */
.ch-scrolly .mk-scrolly-graphic > svg {
    box-sizing: border-box; height: auto; max-height: 100%;
    background: var(--ch-t); border: 1.5px solid var(--ch-t-m); border-radius: 22px;
}
.ch-scrolly svg text[paint-order="stroke"] { stroke: var(--ch-t); }
.ch-bande .ch-scrolly .mk-scrolly-graphic > svg { background: var(--ch-card); }
.ch-bande .ch-scrolly svg text[paint-order="stroke"] { stroke: var(--ch-card); }
.ch-scrolly .mk-step-card { border-width: 1.5px; }
.ch-scrolly .mk-step-card { font-size: 1rem; line-height: 1.58; }
.ch-scrolly .mk-step-card p { margin: 0 0 8px; color: var(--ch-ink-2); }
.ch-scrolly .mk-step-card p:last-child { margin-bottom: 0; }
.ch-etape { display: block; margin-bottom: 4px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ch-accent); }

/* ---------------- Petits exercices ---------------- */
/* exercice : code commun citron ; options blanches, bonne réponse menthe, erreur rose */
.ch-exo {
    margin: 26px 0; padding: 16px 16px 14px;
    background: var(--ch-ex-fond); border: 1.5px solid var(--ch-ex-bord); border-radius: 20px;
}
.ch-exo-tag {
    display: inline-flex; align-items: center; gap: 6px; margin: 0 0 8px; padding: 3px 10px;
    border-radius: 999px; background: var(--ch-ex-bord); color: var(--ch-ex-titre);
    font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
}
.ch-exo-q { margin: 0 0 10px; font-weight: 600; color: var(--ch-ink); line-height: 1.5; }
.ch-exo-opts { display: grid; gap: 8px; }
.ch-exo-opts button, .ch-classer-items button, .ch-bac-btn {
    min-height: 46px; padding: 10px 14px; border-radius: 14px; text-align: left;
    border: 1.5px solid var(--ch-ex-bord); background: var(--ch-card); color: var(--ch-ink);
    font: 600 0.98rem/1.35 var(--ch-sans); cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.ch-exo-opts button:hover:not(:disabled), .ch-classer-items button:hover:not(:disabled), .ch-bac-btn:hover { border-color: var(--ch-accent); }
.ch-page .is-ok { border-color: var(--mk-menthe-f, #15803D) !important; background: var(--mk-menthe, #E2F5EA) !important; color: #134e32 !important; }
.ch-page .is-ko { border-color: var(--mk-rose-f, #BE185D) !important; background: var(--mk-rose, #FDE7EF) !important; color: #7d1535 !important; }
.ch-exo-opts button:disabled { cursor: default; }
.ch-exo-chat .mk-chat { margin: 12px 0 0; }
.ch-exo-fin { margin-top: 10px; }
@keyframes ch-secoue { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.ch-secoue { animation: ch-secoue 0.32s ease; }
/* classer */
.ch-classer-items { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; min-height: 46px; }
.ch-classer-items button { text-align: center; }
.ch-classer-items button[aria-pressed="true"] { border-color: var(--ch-accent); background: var(--ch-accent-soft); box-shadow: 0 0 0 2px var(--ch-accent) inset; }
.ch-classer-bacs { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; }
/* zones de dépôt : pastel de la famille de la partie */
.ch-bac { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 16px; background: var(--ch-t); border: 1.5px solid var(--ch-t-m); min-width: 0; }
.ch-bac.is-cible { box-shadow: 0 0 0 2px var(--ch-accent) inset; }
.ch-bac-btn { text-align: center; background: var(--ch-card); font-weight: 700; }
.ch-page .ch-bac-btn { border-color: var(--ch-t-m); }
.ch-bac-liste { display: flex; flex-wrap: wrap; gap: 5px; min-height: 6px; }
.ch-bac-liste span {
    display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; border-radius: 999px;
    background: var(--mk-menthe, #E2F5EA); border: 1px solid var(--mk-menthe-m, #B6E5C8); color: #134e32; font-size: 0.86rem; font-weight: 600;
}
/* saisie numérique */
.ch-saisie-ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ch-saisie-ligne input {
    width: 9rem; min-height: 46px; padding: 0 12px; border-radius: 12px;
    border: 1.5px solid var(--ch-ex-bord); background: var(--ch-card); color: var(--ch-ink);
    font: 600 1.05rem/1 var(--ch-sans); font-variant-numeric: tabular-nums;
}
.ch-unite { font-weight: 600; color: var(--ch-ink-2); }
/* remettre dans l'ordre */
.ch-ordre-liste { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.ch-ordre-liste li {
    display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 14px;
    border: 1.5px solid var(--ch-ex-bord); background: var(--ch-card); color: var(--ch-ink); line-height: 1.4;
}
.ch-ordre-liste li > span:first-child { flex: 1; min-width: 0; }
.ch-ordre-btns { display: flex; gap: 4px; flex: none; }
.ch-ordre-btns button {
    width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid var(--ch-ex-bord);
    background: var(--ch-ex-fond); color: var(--ch-ink-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.ch-ordre-btns button:disabled { opacity: 0.35; cursor: default; }

/* ---------------- Exercices corrigés (code exercice : citron) ---------------- */
.ch-corriges { display: grid; gap: 10px; margin: 14px 0; }
details.ch-corrige { border: 1.5px solid var(--ch-ex-bord); border-radius: 16px; background: var(--ch-ex-fond); padding: 0; }
details.ch-corrige > summary {
    list-style: none; cursor: pointer; padding: 14px 16px; font-weight: 600; line-height: 1.5; color: var(--ch-ink);
}
details.ch-corrige > summary::-webkit-details-marker { display: none; }
details.ch-corrige > summary::after {
    content: 'Voir le corrigé'; display: table; margin-top: 8px; padding: 3px 10px; border-radius: 999px;
    background: var(--ch-ex-bord); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ch-ex-titre);
}
details.ch-corrige[open] > summary::after { content: 'Masquer le corrigé'; background: var(--ch-card); color: var(--ch-ink-2); }
.ch-corrige-sol { margin: 0 8px 8px; padding: 12px 12px 12px; border-radius: 12px; background: var(--ch-card); color: var(--ch-ink-2); }
.ch-corrige-sol p { margin: 0 0 8px; }
.ch-corrige-sol p:last-child { margin-bottom: 0; }
.ch-exo .ch-corrige { margin-top: 12px; }

/* ---------------- Pièges (code piège : rose) ---------------- */
.ch-pieges { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 10px; }
.ch-pieges li, .ch-prose .ch-pieges li {
    position: relative; margin: 0; padding: 12px 14px 12px 46px; border-radius: 16px;
    background: var(--ch-piege-fond); border: 1.5px solid var(--ch-piege-bord); color: var(--ch-ink-2); line-height: 1.55;
}
.ch-pieges li::before, .ch-prose .ch-pieges li::before {
    content: '!'; position: absolute; left: 12px; top: 12px; width: 24px; height: 24px; border-radius: 8px;
    background: var(--mk-rose-f, #BE185D); color: #fff; font-weight: 800; font-size: 0.9rem; line-height: 24px; text-align: center;
}
.ch-pieges b { color: var(--ch-ink); }

/* ---------------- Récapitulatif (code à retenir : menthe) ---------------- */
.ch-recap { margin: 14px 0; padding: 4px 16px; border-radius: 18px; background: var(--ch-ret-fond); border: 1.5px solid var(--ch-ret-bord); }
.ch-bande[data-teinte="menthe"] .ch-recap { background: var(--ch-card); }
.ch-recap div { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--ch-ret-bord); }
.ch-recap div:last-child { border-bottom: 0; }
.ch-recap dt { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ch-ret-titre); }
.ch-recap dd { margin: 0; color: var(--ch-ink); font-weight: 500; }
@media (min-width: 640px) { .ch-recap div { grid-template-columns: 11rem 1fr; gap: 16px; align-items: baseline; } }
.ch-liens { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.ch-liens a {
    display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px;
    border: 1.5px solid var(--ch-t-m); background: var(--ch-t); color: var(--ch-t-x); font-weight: 700; font-size: 0.92rem; text-decoration: none;
}
.ch-bande .ch-liens a { background: var(--ch-card); }
.ch-liens a:hover { border-color: var(--ch-accent); color: var(--ch-accent); }

/* ---------------- Quiz : options pastel de la famille, juste menthe, faux rose ---------------- */
.ch-quiz { padding: 18px 16px 16px; background: var(--ch-card); border: 1.5px solid var(--ch-t-m); border-radius: 22px; }
.ch-quiz-tete { display: flex; justify-content: space-between; gap: 10px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ch-t-x); }
.ch-quiz-barre { height: 6px; margin: 8px 0 14px; border-radius: 999px; background: var(--ch-t-m); overflow: hidden; }
.ch-quiz-barre i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--ch-accent); transition: width 0.3s ease; }
.ch-quiz-q { margin: 0 0 12px; font-family: var(--ch-serif); font-size: 1.24rem; font-weight: 600; line-height: 1.35; color: var(--ch-ink); }
.ch-quiz-opts { display: grid; gap: 8px; }
.ch-quiz-opts button {
    min-height: 48px; padding: 11px 14px; border-radius: 14px; text-align: left;
    border: 2px solid var(--ch-t-m); background: var(--ch-t); color: var(--ch-ink);
    font: 600 0.98rem/1.4 var(--ch-sans); cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease;
}
.ch-quiz-opts button:hover:not(:disabled) { border-color: var(--ch-accent); }
.ch-quiz-opts button.correct { border-color: var(--mk-menthe-f, #15803D); background: var(--mk-menthe, #E2F5EA); color: #134e32; }
.ch-quiz-opts button.wrong { border-color: var(--mk-rose-f, #BE185D); background: var(--mk-rose, #FDE7EF); color: #7d1535; }
.ch-quiz-expl { margin: 12px 0 0; font-size: 0.95rem; line-height: 1.55; color: var(--ch-ink-2); }
.ch-quiz-expl:not(:empty) { padding: 11px 13px; border-radius: 14px; background: var(--ch-card); border: 1.5px dashed var(--ch-t-m); }
.ch-quiz-note { margin: 4px 0 6px; text-align: center; font-family: var(--ch-serif); font-size: 3rem; font-weight: 600; line-height: 1.05; color: var(--ch-accent); }
.ch-quiz-label { margin: 0; text-align: center; font-size: 0.76rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ch-ink-3); }
.ch-centre { text-align: center; }

/* ---------------- Bas de page ---------------- */
.ch-page .mk-sources { color: var(--ch-ink-2); }
.ch-page .mk-sources-liste { list-style: decimal; }
.ch-page .capsule-arrow svg { width: 20px; height: 20px; display: block; margin: 0 auto; }

/* ---------------- Glossaire dans les cours ---------------- */
.ch-page .term {
    color: inherit; font-weight: 600; border-bottom: 0;
    text-decoration: underline dotted var(--ch-accent); text-decoration-thickness: 2px; text-underline-offset: 3px;
    cursor: help; padding: 0; margin: 0; border-radius: 3px;
}
.ch-page .term:hover, .ch-page .term:active { color: var(--ch-accent); background: var(--ch-accent-soft); padding: 0; margin: 0; }

/* ---------------- Grand écran ---------------- */
@media (min-width: 900px) {
    .ch-hero { padding-top: 104px; }
    .ch-section { padding-top: 72px; }
    .ch-pin > .mk-pin-scene { padding: 0 24px; }
    .ch-scene { padding: 16px 18px 14px; }
}

/* ---------------- Animations réduites ---------------- */
@media (prefers-reduced-motion: reduce) {
    .ch-page *, .ch-page *::before, .ch-page *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
