/* Page chapitre du parcours : étapes, vidéo animée, leçon en cartes, cartes mémo, quiz. */

.chap { padding-top: 32px; padding-bottom: 80px; max-width: 920px; }
.chap-fil { display: flex; gap: 8px; align-items: center; color: var(--texte-2); font-size: .95rem; }
.chap-fil a { color: var(--texte-2); text-decoration: none; font-weight: 700; }
.chap-fil a:hover { color: var(--texte); }
.chap-tete { margin: 18px 0 28px; }
.chap-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; color: var(--texte-2); font-weight: 700; font-size: .95rem; }
.chap-tete h1 { font-size: clamp(1.9rem, 4.4vw, 2.8rem); margin-top: 10px; letter-spacing: -.03em; }

/* Sélecteur de chapitre */
.chap-choix { position: relative; }
.chap-choix > button { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--trait); background: var(--surface); color: var(--texte); font: 700 .95rem var(--f-texte); cursor: pointer; }
.chap-choix > button svg { width: 16px; height: 16px; transition: transform .2s ease; }
.chap-choix.ouvert > button svg { transform: rotate(180deg); }
.chap-liste { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: min(420px, 92vw); max-height: 70vh; overflow: auto; padding: 8px; background: var(--surface); border: 1px solid var(--trait); border-radius: 16px; box-shadow: 0 24px 60px -20px rgb(11 31 58 / .4); display: none; }
.chap-choix.ouvert .chap-liste { display: block; }
.chap-liste a { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; text-decoration: none; }
.chap-liste a:hover { background: color-mix(in srgb, var(--texte) 6%, transparent); }
.chap-liste a.courant { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.chap-liste a.verrou { color: var(--texte-2); }
.chap-liste b { font-family: var(--f-titre); width: 1.8rem; color: var(--texte-2); font-variant-numeric: tabular-nums; }
.chap-liste span { flex: 1; }
.chap-liste svg { width: 16px; height: 16px; color: var(--texte-2); }

/* Étapes du chapitre */
.etapes-chap { display: flex; gap: 6px; overflow-x: auto; padding: 4px; margin: 0 -4px 28px; scrollbar-width: none; }
.etapes-chap::-webkit-scrollbar { display: none; }
.etapes-chap button {
    flex: 1 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 48px;
    border: 1px solid var(--trait); border-radius: 14px; background: var(--surface); color: var(--texte-2);
    font: 700 .95rem var(--f-texte); cursor: pointer; transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.etapes-chap button:hover { color: var(--texte); border-color: var(--texte-2); }
.etapes-chap button .pastille { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 800 .8rem var(--f-titre); background: color-mix(in srgb, var(--texte) 8%, transparent); flex-shrink: 0; }
.etapes-chap button.actif { color: var(--texte); border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.etapes-chap button.actif .pastille { background: var(--accent); color: #fff; }
html.dark .etapes-chap button.actif .pastille { color: var(--nuit); }
.etapes-chap button.fait .pastille { background: var(--vert-vif); color: #062A19; }
.etapes-chap button.fait .pastille::before { content: ''; width: 12px; height: 7px; border: 2.5px solid currentColor; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.etapes-chap button.fait .pastille span { display: none; }

.etape[hidden] { display: none; }
.etape { animation: etape-entre .35s cubic-bezier(.2,.8,.2,1); }
@keyframes etape-entre { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.suite { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- Lecteur vidéo ---------- */
.sv { border-radius: 22px; overflow: hidden; background: var(--noir); color: #fff; box-shadow: 0 30px 60px -30px rgb(6 11 20 / .6); }
.sv-ecran { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.sv-fond { position: absolute; inset: 0; background:
    radial-gradient(60% 80% at 25% 50%, rgb(124 192 245 / .22), transparent 70%),
    radial-gradient(40% 50% at 85% 20%, rgb(52 199 123 / .12), transparent 70%),
    linear-gradient(160deg, #0E2748, #060B14); }
.sv-fond::after { content: ''; position: absolute; inset: 0; opacity: .35;
    background-image: radial-gradient(rgb(255 255 255 / .18) 1px, transparent 1px); background-size: 22px 22px;
    mask-image: radial-gradient(70% 70% at 30% 50%, #000, transparent); -webkit-mask-image: radial-gradient(70% 70% at 30% 50%, #000, transparent); }
.sv.joue .sv-fond { animation: fond-respire 12s ease-in-out infinite alternate; }
@keyframes fond-respire { to { transform: scale(1.06); } }
.sv-scene { position: absolute; inset: 0 0 18% 0; display: grid; grid-template-columns: .9fr 1.1fr; align-items: center; gap: 4%; padding: 4% 6%; }
.sv-picto { display: grid; place-items: center; color: var(--ciel); }
.sv-picto .picto { width: min(100%, 300px); height: auto; filter: drop-shadow(0 18px 30px rgb(0 0 0 / .45)); overflow: visible; }
.sv-num { font-weight: 700; color: var(--ciel); font-size: clamp(.75rem, 1.6vw, .95rem); }
.sv-texte h3 { font-size: clamp(1.15rem, 3.2vw, 2.1rem); line-height: 1.1; margin-top: 6px; color: #fff; }
.sv-cles { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sv-cles li { padding: .3em .8em; border-radius: 999px; background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .18); font-weight: 700; font-size: clamp(.72rem, 1.5vw, .95rem); }
.sv-sous-titre { position: absolute; left: 6%; right: 6%; bottom: 5%; margin: 0; text-align: center; font-size: clamp(.8rem, 1.8vw, 1.08rem); line-height: 1.45; color: #E7EEF8; text-shadow: 0 1px 2px rgb(0 0 0 / .6); }
.sv:not(.demarre) .sv-sous-titre { opacity: 0; }

/* Entrée d'une scène : le pictogramme se dessine, le texte arrive, les mots-clés tombent un par un */
.sv-scene.entre .picto .m > * { stroke-dasharray: 400; stroke-dashoffset: 400; animation: dessine 1.1s cubic-bezier(.4,0,.2,1) forwards; }
.sv-scene.entre .picto .m > *:nth-child(2) { animation-delay: .15s; }
.sv-scene.entre .picto .m > *:nth-child(3) { animation-delay: .3s; }
.sv-scene.entre .picto .m > *:nth-child(n+4) { animation-delay: .45s; }
@keyframes dessine { to { stroke-dashoffset: 0; } }
.sv-scene.entre .sv-num, .sv-scene.entre h3 { animation: monte .6s cubic-bezier(.2,.8,.2,1) both; }
.sv-scene.entre h3 { animation-delay: .12s; }
.sv-scene.entre .sv-cles li { animation: monte .5s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(.7s + var(--j) * .45s); }
@keyframes monte { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Mouvements propres à chaque pictogramme (seulement pendant la lecture) */
.picto .a { stroke: var(--vert-vif); }
.picto .r { stroke: #FF7A6E; }
.picto .plein { fill: var(--vert-vif); stroke: var(--vert-vif); }
.picto .m { transform-origin: 60px 60px; transform-box: view-box; }
.sv.joue .picto-flotte .m { animation: flotte 4s ease-in-out infinite; }
.sv.joue .picto-pulse .m { animation: pulse 2.4s ease-in-out infinite; }
.sv.joue .picto-tourne .m { animation: tourne 3s linear infinite; }
.sv.joue .picto-tourne-lent .m { animation: tourne 14s linear infinite; }
.sv.joue .picto-secoue .m { animation: secoue 2.6s ease-in-out infinite; }
.sv.joue .picto-glisse .m { animation: glisse 2.4s ease-in-out infinite; }
.sv.joue .picto-scrute .m { animation: scrute 5s ease-in-out infinite; }
.sv.joue .picto-clignote .m { animation: pulse 1.4s ease-in-out infinite; }
.sv.joue .picto-glitch .m { animation: glitch 3s steps(1) infinite; }
.sv.joue .picto-ferme .anse { animation: ferme 3s ease-in-out infinite; }
.sv.joue .picto .roue { transform-origin: 60px 60px; transform-box: view-box; animation: tourne 6s ease-in-out infinite alternate; }
.sv.joue .picto .goutte { animation: goutte 1.8s ease-in infinite; }
.sv.joue .picto .flux { stroke-dasharray: 6 8; animation: flux 1s linear infinite; }
.sv.joue .picto .clignote { animation: clignote 1.2s steps(1) infinite; }
.sv.joue .picto .rebond { animation: rebond 1.6s ease-in-out infinite; }
.sv.joue .picto .balance { transform-origin: 96px 12px; transform-box: view-box; animation: balance 2.4s ease-in-out infinite; }
.sv.joue .picto .seq { animation: seq 2.8s ease-in-out infinite; }
.sv.joue .picto .s2 { animation-delay: .35s; } .sv.joue .picto .s3 { animation-delay: .7s; } .sv.joue .picto .s4 { animation-delay: 1.05s; }
.sv.joue .picto .barre { transform-origin: 0 100px; transform-box: view-box; animation: barre 2.8s ease-in-out infinite; }
.sv.joue .picto .gauche { animation: ecarte-g 3s ease-in-out infinite; }
.sv.joue .picto .droite { animation: ecarte-d 3s ease-in-out infinite; }
@keyframes flotte { 50% { transform: translateY(-6px); } }
@keyframes pulse { 50% { transform: scale(1.06); } }
@keyframes tourne { to { transform: rotate(360deg); } }
@keyframes secoue { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-6deg); } 80% { transform: rotate(6deg); } 85% { transform: rotate(-4deg); } 90% { transform: rotate(3deg); } }
@keyframes glisse { 50% { transform: translateX(8px); } }
@keyframes scrute { 25% { transform: translate(-8px, -4px); } 50% { transform: translate(6px, 4px); } 75% { transform: translate(-4px, 6px); } }
@keyframes glitch { 0%, 100% { transform: none; } 92% { transform: translateX(-3px) skewX(4deg); } 95% { transform: translateX(3px); } }
@keyframes ferme { 0%, 30% { transform: translateY(-8px); } 50%, 100% { transform: translateY(0); } }
@keyframes goutte { from { transform: translateY(-6px); opacity: 0; } 30% { opacity: 1; } to { transform: translateY(14px); opacity: 0; } }
@keyframes flux { to { stroke-dashoffset: -14; } }
@keyframes clignote { 50% { opacity: .15; } }
@keyframes rebond { 50% { transform: translateY(-6px); } }
@keyframes balance { 50% { transform: rotate(8deg); } }
@keyframes seq { 0%, 100% { opacity: .25; } 30%, 70% { opacity: 1; } }
@keyframes barre { 0% { transform: scaleY(.2); } 40%, 100% { transform: scaleY(1); } }
@keyframes ecarte-g { 50% { transform: translateX(-5px); } }
@keyframes ecarte-d { 50% { transform: translateX(5px); } }

/* Écran de départ */
.sv-depart { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 18px; border: 0; cursor: pointer; color: #fff; text-align: left;
    background: linear-gradient(180deg, rgb(6 11 20 / .25), rgb(6 11 20 / .7)); font: inherit; transition: opacity .3s ease; }
.sv.demarre .sv-depart { opacity: 0; pointer-events: none; }
.sv-depart-btn { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--ciel); color: var(--nuit); box-shadow: 0 0 0 10px rgb(124 192 245 / .2); transition: transform .2s ease; }
.sv-depart:hover .sv-depart-btn { transform: scale(1.06); }
.sv-depart-btn svg { width: 32px; height: 32px; margin-left: 4px; }
.sv-depart-txt strong { display: block; font: 750 1.35rem var(--f-titre); }
.sv-depart-txt small { color: #C3D1E4; font-size: .95rem; }
.sv:not(.demarre) .sv-scene { opacity: .35; filter: blur(1px); }

/* Barre de contrôle */
.sv-controles { display: flex; align-items: center; gap: 6px; padding: 10px 12px; background: #0A1424; }
.sv-b { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 0; background: transparent; color: #DCE6F3; cursor: pointer; flex-shrink: 0; font: 800 .85rem var(--f-titre); }
.sv-b:hover { background: rgb(255 255 255 / .08); color: #fff; }
.sv-b svg { width: 20px; height: 20px; }
.sv-lecture { background: rgb(255 255 255 / .1); }
.sv-son .barre { display: none; }
.sv-son.coupe .ondes { display: none; }
.sv-son.coupe .barre { display: inline; }
.sv-segments { flex: 1; display: flex; gap: 4px; min-width: 0; }
.sv-seg { position: relative; flex: 1; height: 24px; border: 0; background: transparent; padding: 0; cursor: pointer; display: flex; align-items: center; }
.sv-seg span { display: block; height: 5px; width: 0; border-radius: 999px; background: var(--ciel); position: relative; z-index: 1; }
.sv-seg::after { content: ''; position: absolute; left: 0; right: 0; height: 5px; border-radius: 999px; background: rgb(255 255 255 / .16); }
.sv-seg.vu span { width: 100% !important; }
.sv-seg:hover::after { background: rgb(255 255 255 / .3); }
.sv :focus-visible { outline: 3px solid var(--ciel); outline-offset: 2px; }

@media (max-width: 640px) {
    .sv-ecran { aspect-ratio: 4 / 5; }
    .sv-scene { grid-template-columns: 1fr; grid-template-rows: auto auto; align-content: center; text-align: center; inset: 0 0 26% 0; gap: 10px; padding: 8% 7% 0; }
    .sv-picto .picto { width: 46%; }
    .sv-cles { justify-content: center; }
    .sv-sous-titre { bottom: 4%; }
    .sv-depart { flex-direction: column; text-align: center; }
    .sv-vitesse { display: none; }
}

/* ---------- Leçon en cartes ---------- */
.lecon-intro { font-size: 1.15rem; color: var(--texte-2); margin: 10px 0 22px; max-width: 70ch; }
.lecon h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.lecon-carte { background: var(--surface); border: 1px solid var(--trait); border-radius: 20px; padding: clamp(22px, 4vw, 36px); box-shadow: var(--ombre); }
.lecon-carte .rang { font-weight: 700; color: var(--accent); font-size: .95rem; }
.lecon-carte h3 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); margin: 8px 0 14px; }
.lecon-carte p { font-size: 1.1rem; line-height: 1.7; max-width: 70ch; }
.lecon-carte.entre { animation: carte-entre .4s cubic-bezier(.2,.8,.2,1); }
.lecon-carte.entre-gauche { animation: carte-entre-g .4s cubic-bezier(.2,.8,.2,1); }
@keyframes carte-entre { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes carte-entre-g { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
.lecon-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.points { display: flex; gap: 6px; flex-wrap: wrap; }
.points button { width: 10px; height: 10px; padding: 0; border-radius: 999px; border: 0; background: var(--trait); cursor: pointer; transition: width .25s ease, background-color .25s ease; }
.points button.vu { background: color-mix(in srgb, var(--accent) 45%, var(--trait)); }
.points button.actif { width: 28px; background: var(--accent); }
.tableau-lecon { overflow-x: auto; margin-top: 18px; border: 1px solid var(--trait); border-radius: 12px; }
.tableau-lecon table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.tableau-lecon th { text-align: left; padding: 10px 14px; background: color-mix(in srgb, var(--texte) 5%, transparent); font-family: var(--f-titre); font-weight: 650; }
.tableau-lecon td { padding: 10px 14px; border-top: 1px solid var(--trait); vertical-align: top; }
.tableau-lecon td:first-child { font-weight: 700; }

/* ---------- Cartes mémo ---------- */
.memo-tete { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.memo-tete p { color: var(--texte-2); }
.memo-compte { font-weight: 700; }
.memo-compte strong { color: var(--vert); }
.memo-scene { perspective: 1400px; }
.memo-carte { position: relative; min-height: 300px; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.2,.8,.2,1); cursor: pointer; border-radius: 22px; }
.memo-carte.retournee { transform: rotateY(180deg); }
.memo-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 22px; padding: clamp(24px, 5vw, 44px); display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.memo-recto { background: var(--surface); border: 1px solid var(--trait); box-shadow: var(--ombre); }
.memo-verso { background: linear-gradient(160deg, var(--nuit), #081629); color: #fff; transform: rotateY(180deg); }
.memo-face small { font-weight: 700; color: var(--accent); }
.memo-verso small { color: var(--vert-vif); }
.memo-face p { font: 650 clamp(1.25rem, 2.8vw, 1.7rem)/1.3 var(--f-titre); letter-spacing: -.015em; }
.memo-verso p { font: 400 clamp(1.1rem, 2.4vw, 1.35rem)/1.5 var(--f-texte); letter-spacing: 0; }
.memo-face .astuce { color: var(--texte-2); font-size: .95rem; font-weight: 400; }
.memo-verso .astuce { color: #C3D1E4; }
.memo-carte.sort-d { animation: sort-d .4s ease forwards; }
.memo-carte.sort-g { animation: sort-g .4s ease forwards; }
@keyframes sort-d { to { transform: translateX(60px) rotateY(180deg) rotate(4deg); opacity: 0; } }
@keyframes sort-g { to { transform: translateX(-60px) rotateY(180deg) rotate(-4deg); opacity: 0; } }
.memo-actions { display: flex; justify-content: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.memo-actions[hidden] { display: none; }
.btn-savais { background: var(--vert); color: #fff; border-color: var(--vert); }
html.dark .btn-savais { color: #062A19; }
.memo-fin { text-align: center; padding: 40px 20px; background: var(--surface); border: 1px solid var(--trait); border-radius: 22px; }
.memo-fin h3 { font-size: 1.6rem; margin: 14px 0 8px; }
.memo-fin p { color: var(--texte-2); }
.memo-fin .suite { justify-content: center; }

/* ---------- Quiz ---------- */
.quiz-tete { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.quiz-tete p { font-weight: 700; color: var(--texte-2); }
.serie { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: color-mix(in srgb, var(--vert) 14%, transparent); color: var(--vert); font-weight: 700; font-size: .95rem; opacity: 0; transform: scale(.9); transition: opacity .2s ease, transform .2s ease; }
.serie.on { opacity: 1; transform: none; }
.serie svg { width: 16px; height: 16px; }
.quiz-barre { height: 8px; border-radius: 999px; background: var(--trait); margin: 14px 0 22px; overflow: hidden; }
.quiz-barre span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .4s ease; }
.question { background: var(--surface); border: 1px solid var(--trait); border-radius: 22px; padding: clamp(22px, 4vw, 34px); box-shadow: var(--ombre); }
.question.entre { animation: carte-entre .4s cubic-bezier(.2,.8,.2,1); }
.question h3 { font-size: clamp(1.2rem, 2.6vw, 1.55rem); line-height: 1.3; letter-spacing: -.015em; }
.choix { display: grid; gap: 10px; margin-top: 22px; }
.choix button { display: flex; gap: 14px; align-items: center; text-align: left; padding: 14px 16px; min-height: 56px; border-radius: 14px; border: 1.5px solid var(--trait); background: transparent; color: var(--texte); font: 400 1.05rem/1.4 var(--f-texte); cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.choix button:hover:not(:disabled) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.choix button:disabled { cursor: default; }
.choix .lettre { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font: 800 .85rem var(--f-titre); background: color-mix(in srgb, var(--texte) 8%, transparent); }
.choix button.attente { border-color: var(--accent); }
.choix button.juste { border-color: var(--vert); background: color-mix(in srgb, var(--vert) 12%, transparent); }
.choix button.juste .lettre { background: var(--vert); color: #fff; }
.choix button.faux { border-color: var(--alerte); background: color-mix(in srgb, var(--alerte) 10%, transparent); animation: non .4s ease; }
.choix button.faux .lettre { background: var(--alerte); color: #fff; }
.choix button.eteint { opacity: .5; }
@keyframes non { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
.explication { margin-top: 18px; padding: 14px 16px; border-radius: 14px; border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.explication strong { display: block; font-family: var(--f-titre); margin-bottom: 4px; }
.explication.juste { border-color: var(--vert); background: color-mix(in srgb, var(--vert) 9%, transparent); }
.explication.faux { border-color: var(--alerte); background: color-mix(in srgb, var(--alerte) 8%, transparent); }
.quiz-msg { margin-top: 16px; padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--alerte) 10%, transparent); }

/* Résultat */
.resultat { text-align: center; background: var(--surface); border: 1px solid var(--trait); border-radius: 22px; padding: clamp(28px, 5vw, 48px); box-shadow: var(--ombre); }
.anneau { width: 170px; height: 170px; margin: 0 auto; position: relative; }
.anneau svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.anneau circle { fill: none; stroke-width: 12; }
.anneau .fond { stroke: var(--trait); }
.anneau .val { stroke: var(--vert-vif); stroke-linecap: round; stroke-dasharray: 440; stroke-dashoffset: 440; transition: stroke-dashoffset 1.2s cubic-bezier(.2,.8,.2,1); }
.anneau.rate .val { stroke: var(--alerte); }
.anneau b { position: absolute; inset: 0; display: grid; place-items: center; font: 800 2.4rem var(--f-titre); letter-spacing: -.03em; }
.resultat h3 { font-size: 1.6rem; margin-top: 18px; }
.resultat p { color: var(--texte-2); margin-top: 8px; }
.gain { display: inline-flex; gap: 8px; align-items: center; margin-top: 16px; padding: 8px 16px; border-radius: 999px; background: color-mix(in srgb, var(--vert) 14%, transparent); color: var(--vert); font-weight: 700; animation: gain .6s cubic-bezier(.3,1.6,.5,1) .9s both; }
@keyframes gain { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
.resultat .suite { justify-content: center; }

/* Navigation entre chapitres */
.chap-pied { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--trait); flex-wrap: wrap; }
.sg-btn.desactive { opacity: .45; pointer-events: none; }
.chap-erreur { padding: 24px; border-radius: 16px; background: var(--surface); border: 1px solid var(--trait); }

/* ---------- Leçon : l'essentiel d'abord, le détail sur demande ---------- */
.lecon-carte .detail[hidden] { display: none; }
.lecon-carte .detail { margin-top: 12px; }
.lire-suite { margin-top: 14px; display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 6px 0; color: var(--accent); font: 700 1rem var(--f-texte); cursor: pointer; }
.lire-suite svg { width: 16px; height: 16px; transition: transform .2s ease; }
.lire-suite[aria-expanded="true"] svg { transform: rotate(180deg); }

/* ---------- Ateliers ---------- */
.at-tete { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.at-tete h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.at-tete p { color: var(--texte-2); margin-top: 6px; max-width: 52ch; }
.at-etapes { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.at-etapes button { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--trait); background: var(--surface); color: var(--texte-2); font: 700 .9rem var(--f-texte); cursor: pointer; }
.at-etapes button span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--texte) 8%, transparent); font: 800 .78rem var(--f-titre); }
.at-etapes button.actif { color: var(--texte); border-color: var(--accent); }
.at-etapes button.actif span { background: var(--accent); color: #fff; }
html.dark .at-etapes button.actif span { color: var(--nuit); }
.at-etapes button.fait span { background: var(--vert-vif); color: #062A19; }
.at-boite { background: var(--surface); border: 1px solid var(--trait); border-radius: 22px; padding: clamp(22px, 4vw, 34px); box-shadow: var(--ombre); }
.at-boite.entre { animation: carte-entre .4s cubic-bezier(.2,.8,.2,1); }
.at-type { font-weight: 700; color: var(--accent); font-size: .95rem; }
.at-boite h3 { font-size: clamp(1.3rem, 2.8vw, 1.7rem); margin: 6px 0 14px; }
.at-consigne { color: var(--texte-2); margin-bottom: 18px; }
.at-aide { color: var(--texte-2); margin-top: 14px; }
.at-compte { font-weight: 700; color: var(--texte-2); font-size: .95rem; }
.at-score { font-size: 1.2rem; text-align: center; padding: 14px; }
.at-score b { font: 800 2.2rem var(--f-titre); color: var(--vert); margin-right: 6px; }

/* Relier */
.at-relier { display: grid; grid-template-columns: .8fr 1.2fr; gap: 14px 28px; }
.at-col { display: grid; gap: 10px; align-content: start; }
.at-col button { position: relative; text-align: left; padding: 14px 16px; min-height: 54px; border-radius: 14px; border: 1.5px solid var(--trait); background: transparent; color: var(--texte); font: 400 1rem/1.4 var(--f-texte); cursor: pointer; transition: border-color .15s ease, background-color .15s ease, transform .15s ease; }
.at-col[data-col="t"] button { font-family: var(--f-titre); font-weight: 700; font-size: 1.05rem; }
.at-col button:hover:not(.lie) { border-color: var(--accent); }
.at-col button.choisi { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); transform: translateX(4px); }
.at-col button.lie { border-color: var(--vert); background: color-mix(in srgb, var(--vert) 10%, transparent); cursor: default; padding-left: 46px; }
.at-col button.lie::before { content: attr(data-num); position: absolute; left: 12px; top: 50%; margin-top: -13px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--vert); color: #fff; font: 800 .8rem var(--f-titre); }
html.dark .at-col button.lie::before { color: #062A19; }
.at-col button.erreur { border-color: var(--alerte); animation: non .4s ease; }

/* Trier */
.at-tri { text-align: center; }
.at-carte { margin: 12px auto 20px; max-width: 520px; padding: 26px 22px; border-radius: 18px; background: linear-gradient(160deg, var(--nuit), #081629); color: #fff; font: 650 clamp(1.1rem, 2.4vw, 1.35rem)/1.35 var(--f-titre); box-shadow: 0 18px 40px -20px rgb(6 11 20 / .6); }
.at-carte.entre { animation: carte-tombe .35s cubic-bezier(.2,.8,.2,1); }
.at-carte.ok { box-shadow: 0 0 0 4px var(--vert-vif); }
.at-carte.ko { box-shadow: 0 0 0 4px var(--alerte); animation: non .4s ease; }
@keyframes carte-tombe { from { opacity: 0; transform: translateY(-14px) rotate(-2deg); } to { opacity: 1; transform: none; } }
.at-cats { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.at-cats .sg-btn { white-space: normal; text-align: center; min-height: 52px; }
.at-cats .sg-btn.juste { background: var(--vert); border-color: var(--vert); color: #fff; }
.at-cats .sg-btn.faux { background: var(--alerte); border-color: var(--alerte); color: #fff; }

/* Mise en situation */
.at-contexte { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: 16px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.at-bulle { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--nuit); color: var(--ciel); font: 800 1.1rem var(--f-titre); }
html.dark .at-bulle { background: var(--ciel); color: var(--nuit); }
.at-contexte p { font-size: 1.08rem; line-height: 1.55; }
.at-situation h4 { font: 700 1.2rem var(--f-titre); margin: 20px 0 12px; }
.at-choix { display: grid; gap: 10px; }
.at-choix button { display: flex; gap: 14px; align-items: center; text-align: left; padding: 14px 16px; min-height: 56px; border-radius: 14px; border: 1.5px solid var(--trait); background: transparent; color: var(--texte); font: 400 1.02rem/1.4 var(--f-texte); cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.at-choix button:hover:not(:disabled) { border-color: var(--accent); }
.at-choix .lettre { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font: 800 .85rem var(--f-titre); background: color-mix(in srgb, var(--texte) 8%, transparent); }
.at-choix button.juste { border-color: var(--vert); background: color-mix(in srgb, var(--vert) 12%, transparent); }
.at-choix button.juste .lettre { background: var(--vert); color: #fff; }
.at-choix button.faux { border-color: var(--alerte); background: color-mix(in srgb, var(--alerte) 8%, transparent); animation: non .4s ease; opacity: .7; }
.at-choix button.eteint { opacity: .5; }

/* Vrai ou faux */
.at-vf { text-align: center; }
.at-affirmation { margin: 14px auto 22px; max-width: 600px; font: 650 clamp(1.15rem, 2.6vw, 1.45rem)/1.35 var(--f-titre); }
.at-affirmation.entre { animation: monte .4s cubic-bezier(.2,.8,.2,1); }
.at-vf-btns { display: flex; justify-content: center; gap: 12px; }
.at-vf-btns .sg-btn { min-width: 130px; border-color: var(--trait); background: var(--surface); color: var(--texte); }
.at-vf-btns .sg-btn.juste { background: var(--vert); border-color: var(--vert); color: #fff; }
.at-vf-btns .sg-btn.faux { background: var(--alerte); border-color: var(--alerte); color: #fff; }

/* Retour commun */
.at-retour { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; padding: 14px 16px; border-radius: 14px; text-align: left; animation: monte .35s cubic-bezier(.2,.8,.2,1); }
.at-retour.juste { background: color-mix(in srgb, var(--vert) 10%, transparent); }
.at-retour.faux { background: color-mix(in srgb, var(--alerte) 9%, transparent); }
.at-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.at-retour.juste .at-ico { background: var(--vert); }
.at-retour.faux .at-ico { background: var(--alerte); }
.at-ico svg { width: 18px; height: 18px; }
.at-retour strong { font-family: var(--f-titre); display: block; }
.at-retour p { color: var(--texte-2); margin-top: 2px; }
.at-retour p:empty { display: none; }

@media (max-width: 640px) {
    .at-relier { grid-template-columns: 1fr; }
    .at-col[data-col="t"] { grid-template-columns: 1fr 1fr; }
    .at-col[data-col="t"] button { text-align: center; }
    .at-col[data-col="t"] button.lie { padding-left: 40px; text-align: left; }
}
