/* Parcours : neutres froids, un seul accent cobalt, Geist. */
:root {
  --fond: #f2f3f5;
  --fond-2: #e9ebef;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --coque: rgba(20, 24, 33, 0.035);
  --trait: rgba(20, 24, 33, 0.08);
  --trait-fort: rgba(20, 24, 33, 0.16);
  --encre: #14171f;
  --encre-2: #4a505e;
  --encre-3: #7a8090;
  --accent: #2f55d4;
  --accent-fort: #2346b8;
  --accent-doux: rgba(47, 85, 212, 0.09);
  --accent-texte: #ffffff;
  --ok: #1f8a55;
  --ok-doux: rgba(31, 138, 85, 0.1);
  --ko: #c4432f;
  --ko-doux: rgba(196, 67, 47, 0.08);
  --code-fond: #fbfbfc;
  --term-fond: #10131a;
  --term-encre: #dfe3ea;
  --ombre: 0 1px 1px rgba(20, 24, 33, 0.03), 0 12px 32px -12px rgba(30, 40, 70, 0.14);
  --ombre-forte: 0 2px 4px rgba(20, 24, 33, 0.04), 0 24px 60px -20px rgba(30, 40, 70, 0.28);
  --reflet: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --r-coque: 22px;
  --r-coeur: 17px;
  --r-petit: 10px;
  --mono: "Geist Mono", ui-monospace, monospace;
  --sans: "Geist", system-ui, sans-serif;
  --sortie: cubic-bezier(0.23, 1, 0.32, 1);
  --glisse: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #0c0e12;
    --fond-2: #12151b;
    --surface: #161a21;
    --surface-2: #1c2029;
    --coque: rgba(255, 255, 255, 0.03);
    --trait: rgba(255, 255, 255, 0.07);
    --trait-fort: rgba(255, 255, 255, 0.14);
    --encre: #e8eaef;
    --encre-2: #a9afbd;
    --encre-3: #7c8293;
    --accent: #8aa2ff;
    --accent-fort: #a6b8ff;
    --accent-doux: rgba(138, 162, 255, 0.12);
    --accent-texte: #0c1020;
    --ok: #5fcf93;
    --ok-doux: rgba(95, 207, 147, 0.1);
    --ko: #f08f7c;
    --ko-doux: rgba(240, 143, 124, 0.09);
    --code-fond: #12151b;
    --term-fond: #08090c;
    --ombre: 0 1px 1px rgba(0, 0, 0, 0.3), 0 16px 40px -16px rgba(0, 0, 0, 0.6);
    --ombre-forte: 0 2px 4px rgba(0, 0, 0, 0.3), 0 30px 70px -24px rgba(0, 0, 0, 0.7);
    --reflet: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #0c0e12;
  --fond-2: #12151b;
  --surface: #161a21;
  --surface-2: #1c2029;
  --coque: rgba(255, 255, 255, 0.03);
  --trait: rgba(255, 255, 255, 0.07);
  --trait-fort: rgba(255, 255, 255, 0.14);
  --encre: #e8eaef;
  --encre-2: #a9afbd;
  --encre-3: #7c8293;
  --accent: #8aa2ff;
  --accent-fort: #a6b8ff;
  --accent-doux: rgba(138, 162, 255, 0.12);
  --accent-texte: #0c1020;
  --ok: #5fcf93;
  --ok-doux: rgba(95, 207, 147, 0.1);
  --ko: #f08f7c;
  --ko-doux: rgba(240, 143, 124, 0.09);
  --code-fond: #12151b;
  --term-fond: #08090c;
  --ombre: 0 1px 1px rgba(0, 0, 0, 0.3), 0 16px 40px -16px rgba(0, 0, 0, 0.6);
  --ombre-forte: 0 2px 4px rgba(0, 0, 0, 0.3), 0 30px 70px -24px rgba(0, 0, 0, 0.7);
  --reflet: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fond);
  color: var(--encre);
  font: 400 17px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01";
}
/* Grain très léger, fixe, pour casser l'aplat numérique */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: var(--accent); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
button, a, [role="button"], .choix-bouton, .seg {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
code, pre, kbd { font-family: var(--mono); }
::selection { background: var(--accent-doux); }
i.ph, i.ph-light, i.ph-fill { line-height: 1; }

/* ---------- Coque double bordure ---------- */
.coque {
  padding: 6px;
  border-radius: var(--r-coque);
  background: var(--coque);
  box-shadow: 0 0 0 1px var(--trait);
}
.coeur {
  border-radius: var(--r-coeur);
  background: var(--surface);
  box-shadow: var(--reflet), var(--ombre);
}

/* ---------- Boutons ---------- */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 0 22px;
  border: 0; border-radius: 999px;
  background: var(--accent); color: var(--accent-texte);
  font-weight: 600; font-size: 15px; letter-spacing: -0.005em; text-decoration: none; white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 6px 18px -8px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: transform 160ms var(--sortie), background-color 200ms ease, box-shadow 200ms ease, opacity 200ms ease;
}
.bouton:active { transform: scale(0.97); }
.bouton:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.bouton .pastille-icone {
  display: grid; place-items: center; width: 28px; height: 28px; margin-right: -12px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.18); font-size: 15px;
  transition: transform 260ms var(--sortie);
}
.bouton.secondaire { background: var(--surface); color: var(--encre); box-shadow: 0 0 0 1px var(--trait-fort), var(--reflet); }
.bouton.secondaire .pastille-icone { background: var(--surface-2); }
.bouton.fantome { background: transparent; color: var(--encre-2); box-shadow: none; min-height: 38px; padding: 0 14px; font-weight: 500; gap: 7px; }
.bouton.danger { background: transparent; color: var(--ko); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ko) 50%, transparent); }
.bouton.pret { animation: invite 1.6s var(--sortie) 1; }
@keyframes invite { 30% { transform: scale(1.04); } 60% { transform: scale(0.99); } }
@media (hover: hover) and (pointer: fine) {
  .bouton:hover:not(:disabled) { background: var(--accent-fort); }
  .bouton:hover:not(:disabled) .pastille-icone { transform: translate(2px, -1px) scale(1.06); }
  .bouton.secondaire:hover:not(:disabled) { background: var(--surface-2); }
  .bouton.fantome:hover:not(:disabled) { background: var(--coque); color: var(--encre); }
  .bouton.danger:hover { background: var(--ko-doux); }
}

/* ---------- Apparition au défilement ---------- */
.revele { opacity: 0; transform: translateY(18px); filter: blur(6px); transition: opacity 700ms var(--sortie), transform 700ms var(--sortie), filter 700ms var(--sortie); }
.revele.vu { opacity: 1; transform: none; filter: none; }

/* ---------- Accueil ---------- */
.accueil { max-width: 1180px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top, 0px)) 24px 120px; }
.entete {
  position: sticky; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  width: max-content; max-width: 100%; margin: 0 auto 0 0; padding: 6px 6px 6px 14px;
  border-radius: 999px; background: color-mix(in srgb, var(--surface) 72%, transparent);
  box-shadow: 0 0 0 1px var(--trait), var(--ombre);
  backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
}
.marque { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -0.02em; color: var(--encre); text-decoration: none; }
.marque img { border-radius: 8px; }
.entete nav { display: flex; gap: 2px; }
.lien-nav { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; color: var(--encre-2); text-decoration: none; font-size: 14px; font-weight: 500; transition: background-color 200ms ease, color 200ms ease; }
.lien-nav .compte { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-texte); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
@media (hover: hover) and (pointer: fine) { .lien-nav:hover { background: var(--coque); color: var(--encre); } }

.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 56px; align-items: center; padding: 72px 0 96px; }
.hero h1 {
  margin: 0 0 22px; font-weight: 700; font-size: clamp(40px, 5.6vw, 68px); line-height: 1.02; letter-spacing: -0.045em; text-wrap: balance;
}
.hero h1 em { font-style: italic; font-weight: 600; color: var(--accent); padding-right: 0.06em; }
.chapo { color: var(--encre-2); margin: 0 0 30px; max-width: 52ch; font-size: 18px; line-height: 1.6; text-wrap: pretty; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero-stat { color: var(--encre-3); font-size: 14px; font-variant-numeric: tabular-nums; }

/* Mini Python vivant dans le hero */
.essai { transform: rotate(1.2deg); }
.essai .coeur { overflow: hidden; }
.essai-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px 18px; font-size: 13px; color: var(--encre-3); }
.essai-tete b { color: var(--encre); font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.essai-tete b i { color: var(--accent); font-size: 18px; }
.essai .CodeMirror { height: auto; font-family: var(--mono); font-size: 15px; line-height: 1.7; background: transparent; color: var(--encre); padding: 4px 0 8px; }
.essai .CodeMirror-gutters { background: transparent; border: 0; }
.essai .CodeMirror-linenumber { color: var(--encre-3); opacity: 0.6; padding: 0 12px 0 10px; }
.essai-sortie { margin: 0 8px 8px; padding: 14px 16px; border-radius: 12px; background: var(--term-fond); color: var(--term-encre); font: 14px/1.6 var(--mono); min-height: 74px; white-space: pre-wrap; }
.essai-sortie .attente { color: #7f8798; }
.essai-pied { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 8px 8px 18px; font-size: 13px; color: var(--encre-3); }

.reprise { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; margin-bottom: 120px; }
.carte-action { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 26px 26px 24px; color: var(--encre); text-decoration: none; transition: transform 300ms var(--sortie); }
a.carte-lien { display: block; text-decoration: none; color: inherit; border-radius: var(--r-coque); transition: transform 300ms var(--sortie); }
a.carte-lien:active { transform: scale(0.985); }
@media (hover: hover) and (pointer: fine) { a.carte-lien:hover { transform: translateY(-3px); } }
.carte-action .ca-icone { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 22px; background: var(--accent-doux); color: var(--accent); margin-bottom: 14px; }
.ca-label { font-size: 14px; color: var(--encre-3); font-weight: 500; }
.ca-titre { font-size: 23px; font-weight: 650; line-height: 1.25; letter-spacing: -0.02em; }
.ca-meta { font-size: 14px; color: var(--encre-3); margin-top: auto; padding-top: 14px; display: flex; align-items: center; gap: 8px; }
.barre-mini { height: 4px; border-radius: 4px; background: var(--fond-2); overflow: hidden; margin-top: 16px; }
.barre-mini span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transform-origin: left; }
.reprise .principale .coeur { background: radial-gradient(120% 140% at 100% 0%, var(--accent-doux), transparent 60%), var(--surface); }

.titre-section { font-size: clamp(30px, 4vw, 44px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.08; margin: 0 0 14px; }
.intro-section { color: var(--encre-2); max-width: 56ch; margin: 0 0 48px; }

/* Le chemin : modules reliés par une ligne */
.chemin { position: relative; display: grid; gap: 28px; padding-left: 64px; }
.chemin::before { content: ""; position: absolute; left: 23px; top: 24px; bottom: 24px; width: 2px; background: linear-gradient(var(--accent), var(--trait-fort) 40%, var(--trait)); border-radius: 2px; }
.etape-chemin { position: relative; }
.noeud { position: absolute; left: -64px; top: 18px; width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; font-size: 22px; background: var(--surface); color: var(--encre-2); box-shadow: 0 0 0 1px var(--trait-fort), var(--ombre); }
.etape-chemin.actif .noeud { background: var(--accent); color: var(--accent-texte); box-shadow: 0 0 0 6px var(--accent-doux), var(--ombre); }
.etape-chemin.fini .noeud { background: var(--ok); color: #fff; }
.module-corps { padding: 26px 26px 14px; }
.module-tete { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; flex-wrap: wrap; }
.module-tete h3 { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: -0.02em; }
.module-avancee { font: 500 13px var(--mono); color: var(--encre-3); font-variant-numeric: tabular-nums; }
.module-corps > p { margin: 4px 0 14px; color: var(--encre-2); font-size: 15px; }
.lecons { list-style: none; margin: 0 -12px; padding: 0; }
.lecon-ligne { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; color: var(--encre); text-decoration: none; transition: background-color 200ms ease; }
.lecon-ligne:active { background: var(--coque); }
@media (hover: hover) and (pointer: fine) { .lecon-ligne:hover { background: var(--coque); } .lecon-ligne:hover .fleche { transform: translateX(3px); opacity: 1; } }
.lecon-ligne .etat { width: 26px; height: 26px; border-radius: 9px; flex: none; display: grid; place-items: center; font-size: 14px; box-shadow: inset 0 0 0 1.5px var(--trait-fort); color: var(--encre-3); }
.lecon-ligne.en-cours .etat { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); }
.lecon-ligne.finie .etat { background: var(--ok); box-shadow: none; color: #fff; }
.lecon-titre { flex: 1; font-weight: 500; min-width: 0; }
.lecon-titre code { font-size: 0.9em; }
.lecon-meta { color: var(--encre-3); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fleche { color: var(--encre-3); opacity: 0; transition: transform 250ms var(--sortie), opacity 200ms ease; }

/* Ensuite : bande horizontale */
.a-venir { margin-top: 140px; }
.bande { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 280px); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 4px 18px; margin: 0 -4px; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: var(--trait-fort) transparent; }
.bande > li { list-style: none; scroll-snap-align: start; }
.carte-venir { height: 100%; padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.carte-venir i { font-size: 26px; color: var(--accent); }
.carte-venir b { font-size: 17px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.3; }
.carte-venir span { color: var(--encre-3); font-size: 14px; line-height: 1.5; }
.carte-venir.securite .coeur, .bande li.securite .coeur { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 16%, var(--surface)), var(--surface) 70%); }

.pied { margin-top: 120px; padding-top: 28px; border-top: 1px solid var(--trait); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--encre-3); font-size: 14px; }

/* ---------- Leçon ---------- */
.lecon { max-width: 780px; margin: 0 auto; padding: 0 24px calc(140px + env(safe-area-inset-bottom, 0px)); }
.barre-lecon {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 0 12px;
  background: linear-gradient(var(--fond) 70%, color-mix(in srgb, var(--fond) 0%, transparent));
}
.retour { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; flex: none; color: var(--encre); text-decoration: none; font-size: 19px; background: var(--surface); box-shadow: 0 0 0 1px var(--trait), var(--reflet); transition: transform 160ms var(--sortie); }
.retour:active { transform: scale(0.94); }
.bl-titres { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.35; }
.bl-module { font-size: 13px; color: var(--encre-3); }
.bl-titre { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.01em; }
.bl-compte { font: 500 13px var(--mono); color: var(--encre-3); font-variant-numeric: tabular-nums; }
.progression { display: flex; gap: 4px; margin: 4px 0 44px; }
.seg { flex: 1; height: 6px; border-radius: 6px; background: var(--fond-2); box-shadow: inset 0 0 0 1px var(--trait); position: relative; overflow: hidden; cursor: pointer; }
.seg::after { content: ""; position: absolute; inset: 0; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 500ms var(--sortie); border-radius: 6px; }
.seg.fait::after { transform: scaleX(1); opacity: 0.45; }
.seg.actuel::after { transform: scaleX(1); opacity: 1; }
.seg.verrou { cursor: default; }

.etape { animation: entree 420ms var(--sortie) both; }
@keyframes entree { from { opacity: 0; transform: translateY(12px); filter: blur(4px); } }
.etape h2 { font-weight: 700; font-size: clamp(30px, 4.6vw, 42px); line-height: 1.1; margin: 0 0 24px; letter-spacing: -0.035em; text-wrap: balance; }
.puce-etape { display: inline-flex; align-items: center; gap: 7px; margin: 0 0 14px; padding: 5px 12px 5px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-doux); }
.puce-etape i { font-size: 16px; }

/* Texte des leçons */
.prose { max-width: 66ch; text-wrap: pretty; }
.prose p, .prose ul, .prose ol { margin: 0 0 18px; }
.prose h3 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; margin: 40px 0 12px; }
.prose h4 { font-size: 18px; font-weight: 650; margin: 28px 0 8px; }
.prose li { margin-bottom: 8px; padding-left: 4px; }
.prose li::marker { color: var(--accent); }
.prose strong { font-weight: 650; }
.prose :not(pre) > code { font-size: 0.86em; padding: 2px 7px; border-radius: 7px; background: var(--surface); box-shadow: 0 0 0 1px var(--trait); white-space: nowrap; }
.prose pre { margin: 0 0 22px; padding: 16px 18px; border-radius: 14px; overflow-x: auto; font-size: 14.5px; line-height: 1.65; background: var(--code-fond); box-shadow: 0 0 0 1px var(--trait); }
.prose pre.bloc-terminal { background: var(--term-fond); color: var(--term-encre); box-shadow: none; }
.prose pre.bloc-terminal::before { content: "terminal"; display: block; font-size: 11.5px; color: #6f7788; margin-bottom: 6px; font-family: var(--sans); }
.prose pre.bloc-sortie { background: var(--fond-2); color: var(--encre-2); box-shadow: none; }
.prose blockquote { margin: 26px 0; padding: 18px 20px; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 1px var(--trait), var(--reflet); }
.prose blockquote p:last-child { margin-bottom: 0; }
.table-defile { overflow-x: auto; margin: 0 0 22px; border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 1px var(--trait); }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; }
.prose th, .prose td { text-align: left; padding: 11px 14px; vertical-align: top; }
.prose tbody tr + tr td { border-top: 1px solid var(--trait); }
.prose th { background: var(--surface-2); font-weight: 600; font-size: 13.5px; color: var(--encre-2); }
.prose td code { white-space: nowrap; }

/* Encadrés : définition, histoire, attention, astuce, retenir */
.encadre { margin: 28px 0; padding: 6px; border-radius: 20px; background: var(--coque); box-shadow: 0 0 0 1px var(--trait); }
.encadre > div { padding: 18px 20px 4px; border-radius: 15px; background: var(--surface); box-shadow: var(--reflet); }
.encadre-tete { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-weight: 650; letter-spacing: -0.01em; }
.encadre-tete i { font-size: 20px; }
.encadre-tete small { font-weight: 500; color: var(--encre-3); font-size: 13px; }
.encadre.def .encadre-tete i { color: var(--accent); }
.encadre.def > div { background: linear-gradient(135deg, var(--accent-doux), transparent 55%), var(--surface); }
.encadre.attention .encadre-tete i { color: var(--ko); }
.encadre.attention > div { background: linear-gradient(135deg, var(--ko-doux), transparent 55%), var(--surface); }
.encadre.astuce .encadre-tete i, .encadre.retenir .encadre-tete i { color: var(--ok); }
.encadre.retenir > div { background: linear-gradient(135deg, var(--ok-doux), transparent 55%), var(--surface); }
.encadre.histoire .encadre-tete i { color: var(--encre-2); }

/* Étape « L'histoire » */
.histoire-carte { margin-top: 8px; }
.histoire-carte .coeur { padding: 30px 30px 14px; position: relative; overflow: hidden; }
.histoire-annee { font: 700 clamp(64px, 12vw, 120px)/0.9 var(--sans); letter-spacing: -0.06em; color: transparent; -webkit-text-stroke: 1.5px var(--trait-fort); position: absolute; right: 18px; top: 14px; pointer-events: none; }
.histoire-qui { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; position: relative; }
.histoire-qui .avatar { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; font-size: 17px; background: var(--accent-doux); color: var(--accent); }
.histoire-qui b { display: block; font-size: 16px; }
.histoire-qui span { font-size: 14px; color: var(--encre-3); }
.histoire-carte .prose { position: relative; }

/* ---------- Éditeur ---------- */
.boite-code { margin: 28px 0 16px; }
.boite-code .coeur { overflow: hidden; background: var(--code-fond); }
.boite-code .CodeMirror { height: auto; min-height: 120px; font-family: var(--mono); font-size: 15px; line-height: 1.7; background: transparent; color: var(--encre); padding: 10px 0; }
.boite-code .CodeMirror-gutters { background: transparent; border-right: 1px solid var(--trait); }
.boite-code .CodeMirror-linenumber { color: var(--encre-3); padding: 0 12px 0 8px; }
.CodeMirror-cursor { border-left: 2px solid var(--accent) !important; }
.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected { background: var(--accent-doux) !important; }
.CodeMirror-matchingbracket { color: var(--accent) !important; font-weight: 700; }
.ligne-erreur { background: var(--ko-doux); box-shadow: inset 3px 0 0 var(--ko); }
.barre-code { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; border-top: 1px solid var(--trait); background: var(--surface); }
.astuce { font-size: 13px; color: var(--encre-3); margin-right: auto; padding-left: 8px; }
.astuce kbd, .astuce code { font-size: 12px; padding: 1px 6px; border-radius: 5px; background: var(--fond-2); }
.astuce.bas { margin: 10px 0 0; padding: 0; }

.sortie { margin: 0 0 16px; border-radius: 16px; overflow: hidden; background: var(--term-fond); color: var(--term-encre); animation: entree 300ms var(--sortie) both; }
.sortie-tete { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 12.5px; color: #7f8798; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.sortie-texte { margin: 0; padding: 14px 16px; font: 14.5px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; }
.sortie-texte.vide { color: #7f8798; font-family: var(--sans); font-size: 14px; }
.erreur { padding: 16px; background: rgba(240, 143, 124, 0.08); border-top: 1px solid rgba(240, 143, 124, 0.18); }
.err-tete { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.err-type { font: 600 14px var(--mono); color: #f4a493; }
.err-ligne { font-size: 12.5px; padding: 2px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); color: #c5cbd6; }
.err-texte { margin: 0 0 10px; font: 13.5px/1.55 var(--mono); white-space: pre-wrap; color: #e6e9ef; }
.err-aide { margin: 0; font-size: 15px; color: #c5cbd6; line-height: 1.6; }
.err-aide code { color: #fff; }

.verdict { margin: 0 0 16px; padding: 18px 20px; border-radius: 18px; background: var(--surface); box-shadow: 0 0 0 1px var(--trait), var(--reflet); animation: entree 320ms var(--sortie) both; }
.verdict.ok { background: linear-gradient(135deg, var(--ok-doux), transparent 60%), var(--surface); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ok) 30%, transparent); }
.v-titre { margin: 0 0 12px; font-weight: 650; display: flex; align-items: center; gap: 10px; }
.v-titre i { font-size: 22px; }
.verdict.ok .v-titre { color: var(--ok); }
.verdict.ok .v-titre i { animation: tampon 500ms var(--sortie) both; }
@keyframes tampon { from { transform: scale(0.6) rotate(-20deg); opacity: 0; } 60% { transform: scale(1.15); } }
.verdict .prose { margin-top: 12px; }
.tests { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tests li { display: flex; gap: 12px; font-size: 15px; align-items: flex-start; animation: entree 300ms var(--sortie) both; }
.tests li:nth-child(2) { animation-delay: 40ms; } .tests li:nth-child(3) { animation-delay: 80ms; } .tests li:nth-child(4) { animation-delay: 120ms; } .tests li:nth-child(5) { animation-delay: 160ms; } .tests li:nth-child(6) { animation-delay: 200ms; }
.tests li > i { font-size: 20px; flex: none; margin-top: 2px; }
.tests li.ok > i { color: var(--ok); }
.tests li.ko > i { color: var(--encre-3); }
.tests em { display: block; font-style: normal; color: var(--encre-2); font-size: 14px; margin-top: 2px; }

.indices { display: grid; gap: 10px; margin-bottom: 16px; }
.indice { padding: 14px 18px; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 1px var(--trait); font-size: 15px; animation: entree 300ms var(--sortie) both; }
.indice > span { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.indice p { margin: 0 0 6px; }
.indice p:last-child { margin: 0; }
.solution { margin: 0 0 16px; border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 1px var(--trait); animation: entree 300ms var(--sortie) both; }
.sol-tete { padding: 10px 16px; font-size: 13px; color: var(--encre-2); background: var(--surface-2); }
.solution pre { margin: 0; padding: 16px 18px; background: var(--code-fond); font-size: 14.5px; overflow-x: auto; }

.charge-python { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 12px 16px; border-radius: 14px; background: var(--accent-doux); font-size: 14px; color: var(--encre); }
.charge-python .barre-charge { width: 54px; height: 4px; border-radius: 4px; background: var(--trait-fort); overflow: hidden; flex: none; }
.charge-python .barre-charge span { display: block; width: 40%; height: 100%; background: var(--accent); border-radius: 4px; animation: navette 1.1s var(--glisse) infinite alternate; }
@keyframes navette { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* Coloration Python */
.cm-s-default .cm-keyword { color: #a237c2; }
.cm-s-default .cm-def, .cm-s-default .cm-variable-2 { color: #2457c5; }
.cm-s-default .cm-string { color: #1c7c4a; }
.cm-s-default .cm-number { color: #b8541f; }
.cm-s-default .cm-comment { color: #8a90a0; font-style: italic; }
.cm-s-default .cm-builtin { color: #0f7285; }
.cm-s-default .cm-operator { color: #5a6070; }
.cm-s-default .cm-variable, .cm-s-default .cm-property { color: var(--encre); }
:root[data-theme="dark"] .cm-s-default .cm-keyword { color: #d49cf6; }
:root[data-theme="dark"] .cm-s-default .cm-def, :root[data-theme="dark"] .cm-s-default .cm-variable-2 { color: #8db1ff; }
:root[data-theme="dark"] .cm-s-default .cm-string { color: #8fdcaa; }
:root[data-theme="dark"] .cm-s-default .cm-number { color: #f4ad80; }
:root[data-theme="dark"] .cm-s-default .cm-builtin { color: #7fd4e2; }
:root[data-theme="dark"] .cm-s-default .cm-operator { color: #a9afbd; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cm-s-default .cm-keyword { color: #d49cf6; }
  :root:not([data-theme="light"]) .cm-s-default .cm-def, :root:not([data-theme="light"]) .cm-s-default .cm-variable-2 { color: #8db1ff; }
  :root:not([data-theme="light"]) .cm-s-default .cm-string { color: #8fdcaa; }
  :root:not([data-theme="light"]) .cm-s-default .cm-number { color: #f4ad80; }
  :root:not([data-theme="light"]) .cm-s-default .cm-builtin { color: #7fd4e2; }
  :root:not([data-theme="light"]) .cm-s-default .cm-operator { color: #a9afbd; }
}

/* Fichier fourni à un exercice */
.fichier-fourni { margin: 20px 0 0; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 1px var(--trait); overflow: hidden; }
.fichier-fourni summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; cursor: pointer; list-style: none; }
.fichier-fourni summary::-webkit-details-marker { display: none; }
.fichier-fourni summary i { font-size: 20px; color: var(--accent); }
.fichier-fourni summary span { font-size: 13px; color: var(--encre-3); }
.fichier-fourni pre { margin: 0; padding: 14px 16px; border-top: 1px solid var(--trait); background: var(--code-fond); font: 13.5px/1.6 var(--mono); overflow-x: auto; }

/* ---------- Quiz ---------- */
.choix { display: grid; gap: 10px; margin: 24px 0 16px; }
.choix-bouton { display: flex; align-items: center; gap: 14px; text-align: left; padding: 16px 18px; border-radius: 16px; border: 0; background: var(--surface); box-shadow: 0 0 0 1px var(--trait), var(--reflet); cursor: pointer; transition: transform 160ms var(--sortie), box-shadow 200ms ease, background-color 200ms ease; }
.choix-bouton .lettre { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center; font: 600 13px var(--mono); background: var(--fond-2); color: var(--encre-2); transition: background-color 200ms ease, color 200ms ease; }
.choix-bouton p { margin: 0; }
.choix-bouton:active:not(:disabled) { transform: scale(0.985); }
@media (hover: hover) and (pointer: fine) { .choix-bouton:hover:not(:disabled) { box-shadow: 0 0 0 1.5px var(--accent), var(--reflet); } }
.choix-bouton.juste { background: linear-gradient(135deg, var(--ok-doux), transparent 70%), var(--surface); box-shadow: 0 0 0 1.5px var(--ok); }
.choix-bouton.juste .lettre { background: var(--ok); color: #fff; }
.choix-bouton.faux { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--ko) 60%, transparent); opacity: 0.7; animation: secoue 360ms var(--sortie); }
.choix-bouton.faux .lettre { background: var(--ko); color: #fff; }
.choix-bouton:disabled { cursor: default; }
@keyframes secoue { 25% { transform: translateX(-5px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }

/* ---------- Terminal et console ---------- */
.objectifs { list-style: none; padding: 0; margin: 24px 0; display: grid; gap: 8px; counter-reset: obj; }
.objectifs li { display: flex; gap: 14px; align-items: flex-start; padding: 12px 16px; border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 1px var(--trait); transition: background-color 300ms ease, box-shadow 300ms ease; }
.objectifs li p { margin: 0; }
.case { width: 22px; height: 22px; border-radius: 7px; flex: none; margin-top: 3px; display: grid; place-items: center; box-shadow: inset 0 0 0 1.5px var(--trait-fort); color: transparent; font-size: 14px; transition: background-color 250ms ease, box-shadow 250ms ease, color 250ms ease, transform 300ms var(--sortie); }
.objectifs li.ok { background: linear-gradient(135deg, var(--ok-doux), transparent 70%), var(--surface); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ok) 30%, transparent); }
.objectifs li.ok .case { background: var(--ok); box-shadow: none; color: #fff; transform: scale(1.08); }

.terminal { border-radius: 18px; background: var(--term-fond); color: var(--term-encre); overflow: hidden; box-shadow: var(--ombre-forte); margin-top: 10px; }
.term-barre { display: flex; align-items: center; gap: 7px; padding: 11px 14px; background: rgba(255, 255, 255, 0.03); border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-size: 13px; }
.term-barre > span { width: 11px; height: 11px; border-radius: 50%; background: #2a2f3a; }
.term-barre b { font-weight: 500; color: #8a92a3; margin-left: 8px; flex: 1; }
.term-reset { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 0; box-shadow: inset 0 0 0 1px #2a2f3a; color: #8a92a3; border-radius: 999px; font-size: 12px; padding: 4px 11px; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .term-reset:hover { color: #fff; box-shadow: inset 0 0 0 1px #4a5160; } }
.term-corps { scrollbar-color: #2a2f3a transparent; padding: 14px 16px 16px; font: 14px/1.6 var(--mono); height: 380px; overflow-y: auto; cursor: text; overscroll-behavior: contain; }
.term-sortie > div { white-space: pre-wrap; word-break: break-word; }
.term-ligne { display: flex; gap: 8px; align-items: baseline; }
.term-invite, .t-invite { color: #7cd3ae; white-space: nowrap; }
.term-saisie { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--term-encre); font: inherit; caret-color: #8aa2ff; padding: 0; }
.t-err { color: #f4a493; }
.t-info { color: #c2b38a; font-family: var(--sans); font-size: 14px; line-height: 1.55; }
.t-info code { color: #fff; }
.t-dir { color: #8db1ff; font-weight: 600; }
.t-vert { color: #8fdcaa; }
.t-rouge { color: #f4a493; }
.t-jaune { color: #e8cf7e; }
.t-cyan { color: #7fd4e2; }

.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(8, 10, 14, 0.5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fondu 200ms ease both; }
@keyframes fondu { from { opacity: 0; } }
.modal-boite { width: min(680px, 100%); animation: monte 260ms var(--sortie) both; }
@keyframes monte { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
.modal-boite .coeur { overflow: hidden; }
.modal-tete { display: flex; flex-direction: column; padding: 16px 18px; border-bottom: 1px solid var(--trait); }
.modal-tete span { font-size: 13px; color: var(--encre-3); }
.modal-texte { width: 100%; height: 300px; border: 0; padding: 16px 18px; resize: vertical; background: var(--code-fond); color: var(--encre); font: 16px/1.6 var(--mono); outline: none; }
.modal-pied { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--trait); }

/* ---------- Navigation des étapes ---------- */
.nav-etapes {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 20;
  transform: translateX(-50%); width: min(760px, calc(100% - 24px));
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px;
  border-radius: 999px; background: color-mix(in srgb, var(--surface) 78%, transparent);
  box-shadow: 0 0 0 1px var(--trait), var(--ombre-forte);
  backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
}
.nav-etapes .bouton { min-width: 132px; }
.nav-etapes .indication { font-size: 13px; color: var(--encre-3); text-align: center; flex: 1; line-height: 1.3; }

/* ---------- Fin, révision, réglages ---------- */
.fin { padding-top: 80px; }
.fin h1 { font-size: clamp(36px, 6vw, 56px); font-weight: 700; letter-spacing: -0.045em; line-height: 1.04; margin: 0 0 18px; text-wrap: balance; }
.fin .medaille { width: 68px; height: 68px; border-radius: 22px; display: grid; place-items: center; font-size: 34px; background: var(--ok); color: #fff; margin-bottom: 26px; box-shadow: 0 0 0 8px var(--ok-doux); animation: tampon 600ms var(--sortie) both; }
.fin-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.resume { margin: 28px 0; }
.resume .coeur { padding: 22px 24px 6px; }
.zone-carte { padding-top: 24px; }
.carte-rev .coeur { padding: 30px 28px; }
.rev-q { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; margin-bottom: 8px; }
.rev-r { margin: 22px 0; padding-top: 22px; border-top: 1px solid var(--trait); animation: entree 300ms var(--sortie) both; }
.rev-notes { display: flex; flex-wrap: wrap; gap: 10px; }
.reglages section { margin: 30px 0 46px; }
.reglages h2 { font-size: 21px; margin: 0 0 12px; letter-spacing: -0.02em; }
.segmente { display: inline-flex; padding: 5px; border-radius: 999px; background: var(--coque); box-shadow: 0 0 0 1px var(--trait); gap: 4px; flex-wrap: wrap; }
.segmente button { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; cursor: pointer; color: var(--encre-2); font-weight: 500; transition: background-color 200ms ease, color 200ms ease; }
.segmente button.actif { background: var(--surface); color: var(--encre); box-shadow: 0 0 0 1px var(--trait), var(--ombre); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.saut { position: absolute; left: -999px; top: 8px; z-index: 50; padding: 8px 14px; border-radius: 999px; background: var(--accent); color: var(--accent-texte); }
.saut:focus { left: 12px; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding: 48px 0 72px; }
  .essai { transform: none; }
  .reprise { grid-template-columns: 1fr; margin-bottom: 88px; }
}
@media (max-width: 640px) {
  body { font-size: 16.5px; }
  .accueil, .lecon { padding-left: 16px; padding-right: 16px; }
  .entete nav .lien-nav span.libelle { display: none; }
  .chemin { padding-left: 0; }
  .chemin::before, .noeud { display: none; }
  .module-corps { padding: 20px 18px 10px; }
  .lecon-meta { display: none; }
  .term-corps { height: 320px; font-size: 13.5px; }
  .nav-etapes .bouton { min-width: 0; padding: 0 18px; }
  .nav-etapes .indication { display: none; }
  .nav-etapes { justify-content: space-between; }
  .nav-etapes [data-suiv] { flex: 1; }
  .astuce { width: 100%; order: 5; padding: 4px 8px 0; }
  .histoire-carte .coeur { padding: 24px 20px 8px; }
  .histoire-annee { position: static; display: block; font-size: 56px; margin-bottom: 14px; }
  .a-venir { margin-top: 100px; }
}
@media (pointer: coarse) {
  .term-saisie, .modal-texte, input, textarea, select { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .revele { opacity: 1; transform: none; filter: none; }
  .essai { transform: none; }
}
