:root {
  --fond: #f4f5f7;
  --carte: #ffffff;
  --texte: #1f2328;
  --discret: #636c76;
  --bord: #d8dee4;
  --accent: #2f6fdb;
  --positif: rgb(214, 96, 77);
  --negatif: rgb(67, 147, 195);
  --proba: rgb(46, 160, 67);
  --train: #2f6fdb;
  --val: #e8590c;
  --rayon: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texte);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--fond); font-size: 14px; line-height: 1.45; }
h1 { font-size: 18px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 10px; }
h2 small { font-weight: normal; color: var(--discret); font-size: 12px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.bandeau {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; background: var(--carte); border-bottom: 1px solid var(--bord);
}
.sous-titre { color: var(--discret); font-weight: normal; font-size: 14px; margin-left: 6px; }

.pastille { padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eaeef2; color: var(--discret); white-space: nowrap; }
.pastille[data-etat="en_cours"] { background: #ddf4e4; color: #1a7f37; }
.pastille[data-etat="preparation"] { background: #fff4d4; color: #9a6700; }
.pastille[data-etat="termine"] { background: #dbe9ff; color: #0b4fb3; }
.pastille[data-etat="arrete"] { background: #fff1e5; color: #bc4c00; }
.pastille[data-etat="erreur"], .pastille[data-etat="deconnecte"] { background: #ffebe9; color: #cf222e; }

.mise-en-page { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 16px; padding: 16px; }

.panneau section, .carte {
  background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px 16px;
}
.panneau { display: flex; flex-direction: column; gap: 16px; }
main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 10px; }
label small { display: block; font-weight: normal; color: var(--discret); font-size: 12px; margin-top: 2px; }
input, select, button { font: inherit; }
input:not([type="range"]), select {
  display: block; width: 100%; margin-top: 3px; padding: 5px 8px;
  border: 1px solid var(--bord); border-radius: 6px; background: #fff; color: var(--texte);
}
input[type="range"] { width: 100%; }
.deux-colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

button {
  padding: 6px 12px; border: 1px solid var(--bord); border-radius: 6px;
  background: #f6f8fa; color: var(--texte); cursor: pointer; font-weight: 600;
}
button:hover { background: #eef1f4; }
button.principal { background: var(--accent); color: #fff; border-color: var(--accent); }
button.principal:hover { filter: brightness(1.08); }
.boutons { display: flex; gap: 8px; }
.boutons button { flex: 1; }
.erreur { color: #cf222e; font-size: 13px; margin: 8px 0 0; }

details { margin-top: 12px; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13px; }
pre { background: #f6f8fa; border: 1px solid var(--bord); border-radius: 6px; padding: 10px; overflow-x: auto; margin: 8px 0 0; }

.aide { color: var(--discret); font-size: 12px; margin: 8px 0 0; }

.petit-tableau { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12px; }
.petit-tableau td, .petit-tableau th { padding: 3px 6px; border-bottom: 1px solid #eef1f4; text-align: right; }
.petit-tableau th { text-align: left; font-weight: 600; }
.petit-tableau td:first-child { text-align: left; }

.legende div { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.echantillon { width: 22px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.echantillon.trait { height: 0; border-top: 1px solid #555; border-bottom: 4px solid #555; border-radius: 0; height: 6px; background: none; }

/* --- frise de lecture --- */
.frise { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.frise input[type="range"] { flex: 1 1 300px; }
.frise button.actif { background: #ffebe9; border-color: #ffb3ad; color: #cf222e; }
.vitesse { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: normal; }
.vitesse select { width: auto; margin: 0; }
.position { flex-basis: 100%; font-size: 13px; color: var(--discret); font-variant-numeric: tabular-nums; }
.position strong { color: var(--texte); }

/* --- grille principale --- */
.grille { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); grid-auto-rows: auto; gap: 16px; }
.zone-reseau { grid-row: span 3; position: relative; }
.entete { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.entete h2 { margin: 0; }
.bascule { display: inline-flex; border: 1px solid var(--bord); border-radius: 6px; overflow: hidden; }
.bascule button { border: 0; border-radius: 0; background: #fff; font-weight: 500; }
.bascule button.actif { background: var(--accent); color: #fff; }

#svg-reseau { width: 100%; height: auto; display: block; }
.vide { position: absolute; inset: 60px 16px auto; text-align: center; color: var(--discret); }
.vide[hidden] { display: none; }
.prediction { margin: 4px 0 0; font-size: 14px; text-align: center; min-height: 1.4em; }
.prediction .juste { color: #1a7f37; font-weight: 700; }
.prediction .faux { color: #cf222e; font-weight: 700; }

.arete { stroke-linecap: round; pointer-events: none; transition: stroke-width .08s linear; }
.arete.selectionnee { filter: drop-shadow(0 0 2.5px #000); }
.arete-zone { stroke: transparent; stroke-width: 9; cursor: pointer; }
.noeud { stroke: #57606a; stroke-width: 1.2; cursor: default; }
.noeud { cursor: pointer; }
.noeud.predit { stroke: #1a7f37; stroke-width: 3; }
.noeud.detaille { stroke: #1f2328; stroke-width: 3; stroke-dasharray: 4 2; }
.valeur-noeud { font-size: 10px; text-anchor: middle; dominant-baseline: central; pointer-events: none; font-variant-numeric: tabular-nums; }
.etiquette { font-size: 12px; fill: var(--texte); dominant-baseline: central; }
.etiquette.vraie { font-weight: 700; }
.titre-colonne { font-size: 12px; fill: var(--discret); text-anchor: middle; font-weight: 600; }

/* --- courbes --- */
.courbe { width: 100%; height: auto; display: block; }
.courbe .axe { stroke: #afb8c1; stroke-width: 1; }
.courbe .grille-ligne { stroke: #eef1f4; stroke-width: 1; }
.courbe text { font-size: 10px; fill: var(--discret); }
.courbe .curseur { stroke: #1f2328; stroke-width: 1; stroke-dasharray: 3 3; }
.legende-courbe { display: flex; gap: 14px; font-size: 12px; color: var(--discret); margin-top: 4px; }
.legende-courbe span::before { content: ""; display: inline-block; width: 18px; height: 0; margin-right: 5px; vertical-align: middle; }
.l-train::before { border-top: 2px solid var(--train); }
.l-val::before { border-top: 2px dashed var(--val); }

/* --- matrices --- */
.matrices { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.matrice { border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
.matrice caption { text-align: left; font-weight: 600; font-size: 12px; margin-bottom: 4px; }
.matrice th { font-weight: 600; padding: 2px 5px; color: var(--discret); white-space: nowrap; }
.matrice th.ligne { text-align: right; }
.matrice td { width: 48px; height: 24px; text-align: center; border: 1px solid #fff; cursor: pointer; }
.matrice tr.biais td { border-top: 2px solid #57606a; }
.matrice td.selectionnee { outline: 2px solid #1f2328; outline-offset: -2px; }

.infobulle {
  position: fixed; z-index: 10; pointer-events: none; max-width: 300px;
  background: #1f2328; color: #fff; padding: 6px 10px; border-radius: 6px; font-size: 12px; line-height: 1.5;
}

/* --- pas à pas --- */
label.case { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
label.case input { width: auto; margin: 0; }
label.case small { flex-basis: 100%; }
.commandes-pas { display: flex; align-items: center; gap: 8px; flex-basis: 100%; flex-wrap: wrap; }
.commandes-pas[hidden] { display: none; }
#btn-mode.actif { background: #fff4d4; border-color: #e3b341; color: #9a6700; }
.commandes-pas button:disabled { opacity: .45; cursor: not-allowed; }
.info-pas { font-size: 12px; color: var(--discret); }
.pastille[data-etat="attente_pas"] { background: #fff4d4; color: #9a6700; }

/* --- calcul détaillé d'un neurone --- */
.calcul { margin-top: 14px; border-top: 1px solid var(--bord); padding-top: 12px; }
.calcul h3 { font-size: 14px; margin: 0 0 4px; }
.calcul .formule { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--discret); margin: 0 0 8px; }
.tableau-calcul { border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; width: 100%; max-width: 640px; }
.tableau-calcul th { text-align: right; font-weight: 600; color: var(--discret); padding: 3px 8px; border-bottom: 1px solid var(--bord); }
.tableau-calcul th:first-child, .tableau-calcul td:first-child { text-align: left; }
.tableau-calcul td { text-align: right; padding: 3px 8px; border-bottom: 1px solid #eef1f4; white-space: nowrap; }
.tableau-calcul td.op { color: var(--discret); text-align: center; padding: 3px 2px; }
.tableau-calcul td.barre { width: 120px; }
.tableau-calcul .barre span { display: inline-block; height: 9px; border-radius: 2px; vertical-align: middle; }
.tableau-calcul tr.total td { border-top: 2px solid #57606a; font-weight: 700; }
.tableau-calcul tr.resultat td { font-weight: 700; background: #f6f8fa; }
.tableau-calcul tr.choisie td { background: #ddf4e4; }

/* --- frontière de décision --- */
.grille-bas { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 16px; align-items: start; }
.zone-matrices { overflow-x: auto; }
.choix-axes { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 8px; }
.choix-axes label { font-size: 12px; }
#carte-frontiere { width: 100%; aspect-ratio: 1; display: block; }
.legende-especes { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; margin-top: 4px; }
.legende-especes span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 5px; vertical-align: -2px; background: var(--c); }

@media (max-width: 1100px) {
  .grille-bas { grid-template-columns: 1fr; }
  .mise-en-page { grid-template-columns: 1fr; }
  .grille { grid-template-columns: 1fr; }
  .zone-reseau { grid-row: auto; }
}

/* --- aide contextuelle --- */
.bandeau-droite { display: flex; align-items: center; gap: 10px; }
#btn-guide { padding: 4px 10px; font-size: 13px; }
.btn-aide {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: 1px;
  width: 18px; height: 18px; padding: 0; margin-left: 6px; border-radius: 50%;
  border: 1px solid #afb8c1; background: #fff; color: var(--discret); font-size: 11px; font-weight: 700; line-height: 1;
}
.btn-aide:hover, .btn-aide.ouvert { background: var(--accent); border-color: var(--accent); color: #fff; }
.frise { position: relative; }
.btn-aide.coin { position: absolute; right: 12px; bottom: 12px; }
.bulle-aide {
  position: fixed; z-index: 20; width: min(380px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto;
  background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon);
  box-shadow: 0 8px 28px rgba(31, 35, 40, .18); padding: 12px 16px; font-size: 13px;
}
.bulle-aide h3 { margin: 0 24px 6px 0; font-size: 14px; }
.bulle-aide p { margin: 0 0 8px; }
.bulle-aide ul { margin: 0 0 8px; padding-left: 18px; }
.bulle-aide li { margin-bottom: 3px; }
.bulle-aide .fermer, .guide-entete button {
  position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 18px; padding: 2px 6px; color: var(--discret);
}
.bulle-aide .astuce { background: #fff8e1; border-radius: 6px; padding: 6px 8px; margin: 4px 0 0; }
.conseil {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px;
  background: #fff8e1; border: 1px solid #f2d27a; border-radius: var(--rayon); font-size: 13px;
}
.conseil[hidden] { display: none; }
.conseil > div { flex: 1; }
.conseil-icone { font-size: 16px; line-height: 1.2; }
#btn-fermer-conseil { border: 0; background: none; padding: 0 4px; font-size: 18px; line-height: 1; color: #9a6700; }
.guide { width: min(680px, calc(100vw - 32px)); max-height: 85vh; padding: 0; border: 1px solid var(--bord); border-radius: var(--rayon); color: var(--texte); }
.guide::backdrop { background: rgba(31, 35, 40, .45); }
.guide-entete { position: sticky; top: 0; background: var(--carte); padding: 14px 20px 10px; border-bottom: 1px solid var(--bord); }
.guide-entete h2 { margin: 0; font-size: 17px; }
.guide-entete button { top: 10px; right: 12px; }
.guide-corps { padding: 4px 20px 18px; font-size: 13.5px; }
.guide-corps h3 { font-size: 14px; margin: 16px 0 6px; }
.guide-corps ol, .guide-corps ul { padding-left: 20px; margin: 0; }
.guide-corps li { margin-bottom: 4px; }
.guide-corps .petit-tableau th { white-space: nowrap; width: 1%; padding-right: 14px; }
.guide-corps .petit-tableau td { text-align: left; }
.guide-corps label.case { margin: 18px 0 0; font-weight: normal; }
.vocabulaire { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.vocabulaire dt { font-weight: 600; }
.vocabulaire dd { margin: 0; }
kbd { font-family: ui-monospace, Menlo, monospace; font-size: 11px; padding: 1px 5px; border: 1px solid var(--bord); border-bottom-width: 2px; border-radius: 4px; background: #f6f8fa; }

/* --- navigation entre les pages --- */
.bandeau { flex-wrap: wrap; }
.onglets { display: flex; gap: 4px; margin-right: auto; margin-left: 12px; }
.onglets a { padding: 5px 12px; border-radius: 6px; color: var(--discret); text-decoration: none; font-weight: 600; font-size: 13px; }
.onglets a:hover { background: #eef1f4; color: var(--texte); }
.onglets a.actif { background: var(--accent); color: #fff; }

/* --- panneau données --- */
.note { color: #9a6700; background: #fff8e1; border-radius: 6px; padding: 6px 8px; font-size: 12px; margin: 8px 0 0; }
.note[hidden] { display: none; }
fieldset.choix-vue { border: 0; padding: 0; margin: 0 0 8px; }
fieldset.choix-vue legend { font-weight: 600; font-size: 13px; padding: 0; margin-bottom: 4px; }
fieldset.choix-vue label.case { font-weight: normal; margin-bottom: 4px; }
[hidden] { display: none !important; }
button.petit { padding: 3px 10px; font-size: 12px; margin-bottom: 8px; }
.defilant { max-height: 260px; overflow-y: auto; }
.image-exemple:not(:empty) { margin-top: 8px; }
canvas.chiffre { image-rendering: pixelated; border: 1px solid var(--bord); border-radius: 3px; vertical-align: middle; }
.legende-especes .symbole::before { display: none; }
.legende-especes .symbole { color: var(--discret); }
.matrice.compacte td { width: 26px; height: 7px; padding: 0; border-width: 0 1px 0 0; }
.matrice.compacte th.ligne { font-size: 0; padding: 0; }

/* --- page « observer » --- */
.choix-modele { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.choix-modele button, .choix-modele a { text-align: left; font-weight: 600; font-size: 13px; padding: 7px 10px; }
.choix-modele a { border: 1px solid var(--bord); border-radius: 6px; color: var(--texte); text-decoration: none; background: #f6f8fa; }
.choix-modele a:hover { background: #eef1f4; }
.choix-modele .actif { background: var(--accent); border-color: var(--accent); color: #fff; }
.choix-modele small { display: block; font-weight: normal; font-size: 11px; opacity: .8; }
.vue-modele { display: grid; grid-template-columns: minmax(340px, 600px) minmax(0, 1fr); gap: 16px; align-items: start; }
.colonne { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
#carte { width: 100%; aspect-ratio: 1; display: block; cursor: crosshair; }
.scores { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.score { background: #f6f8fa; border: 1px solid var(--bord); border-radius: 6px; padding: 4px 10px; font-size: 12px; }
.score strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.parametres label output { font-weight: normal; color: var(--accent); margin-left: 4px; }
.explication { font-size: 13px; }
.explication p { margin: 0 0 8px; }
.explication ol, .explication ul { margin: 0 0 8px; padding-left: 20px; }
.chargement { opacity: .55; transition: opacity .15s; }
.equation { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.9; overflow-x: auto; }
.equation .terme { padding: 1px 4px; border-radius: 4px; }
.modeles-images { display: flex; flex-wrap: wrap; gap: 10px; }
.modeles-images figure { margin: 0; text-align: center; font-size: 12px; }
.modeles-images canvas { width: 64px; height: 64px; image-rendering: pixelated; border: 1px solid var(--bord); border-radius: 4px; display: block; }
.arbre-conteneur { overflow: auto; max-height: 520px; border: 1px solid #eef1f4; border-radius: 6px; }
.arbre-conteneur svg { display: block; }
.arbre-noeud { cursor: pointer; }
.arbre-noeud rect { stroke: #8c959f; stroke-width: 1; }
.arbre-noeud.choisi rect { stroke: #1f2328; stroke-width: 2.5; }
.arbre-noeud text { font-size: 10px; fill: #1f2328; }
.arbre-noeud.cache { opacity: .12; }
.arbre-lien { stroke: #afb8c1; stroke-width: 1.2; fill: none; }
.arbre-lien.cache { opacity: .12; }
.barres { width: 100%; border-collapse: collapse; font-size: 12px; }
.barres td { padding: 2px 4px; }
.barres td:first-child { white-space: nowrap; width: 1%; }
.barres .barre { height: 12px; border-radius: 2px; display: block; min-width: 1px; }
.tableau-voisins { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.tableau-voisins th, .tableau-voisins td { padding: 3px 6px; border-bottom: 1px solid #eef1f4; text-align: right; }
.tableau-voisins th:first-child, .tableau-voisins td:first-child { text-align: left; }
.tableau-voisins tr.hors td { color: #afb8c1; }
.pastille-classe { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.frise-modele { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.frise-modele input[type="range"] { flex: 1 1 200px; }
.frise-modele label { margin: 0; display: flex; align-items: center; gap: 6px; font-weight: normal; }
.frise-modele select { width: auto; margin: 0; }

/* --- page « comparer » --- */
.liste-modeles { display: flex; flex-direction: column; gap: 8px; }
.carte-modele { border: 1px solid var(--bord); border-radius: 8px; padding: 8px 10px; }
.carte-modele > label.case { font-weight: 700; margin: 0; }
.carte-modele .reglages { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; margin-top: 6px; }
.carte-modele .reglages label { font-size: 12px; margin-bottom: 4px; }
.carte-modele.inactif .reglages { display: none; }
.tableau-comparaison { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tableau-comparaison th, .tableau-comparaison td { padding: 6px 8px; border-bottom: 1px solid #eef1f4; text-align: right; }
.tableau-comparaison th { color: var(--discret); font-weight: 600; font-size: 12px; }
.tableau-comparaison th:first-child, .tableau-comparaison td:first-child { text-align: left; }
.tableau-comparaison tr.meilleur td { background: #ddf4e4; }
.tableau-comparaison .alerte { color: #bc4c00; font-size: 11px; display: block; }
.grille-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.grille-cartes figure { margin: 0; }
.grille-cartes figcaption { font-size: 13px; font-weight: 600; margin-bottom: 4px; display: flex; justify-content: space-between; }
.grille-cartes canvas { width: 100%; aspect-ratio: 1; display: block; }
.confusions { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.confusion { border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
.confusion caption { font-weight: 600; font-size: 12px; text-align: left; margin-bottom: 4px; }
.confusion td { width: 30px; height: 26px; text-align: center; border: 1px solid #fff; }
.confusion th { font-weight: 600; color: var(--discret); padding: 0 4px; font-size: 10px; }
@media (max-width: 1100px) { .vue-modele { grid-template-columns: 1fr; } }

/* --- dessin, CSV, projection --- */
.bouton-fichier { display: inline-block; cursor: pointer; color: var(--accent); font-size: 12px; margin-bottom: 10px; }
.bouton-fichier:hover { text-decoration: underline; }
.outils-dessin { background: #f6f8fa; border: 1px dashed var(--bord); border-radius: 8px; padding: 8px; margin-bottom: 10px; }
.outils-dessin small { display: block; color: var(--discret); font-size: 12px; margin: 6px 0; }
.classes-dessin { display: flex; gap: 6px; }
.classes-dessin button { flex: 1; padding: 4px 6px; font-size: 12px; border-left: 6px solid var(--c); }
.classes-dessin button.actif { background: var(--c); color: #fff; border-color: var(--c); }
#btn-projection.actif { background: var(--accent); color: #fff; border-color: var(--accent); }
body.projection .panneau { display: none; }
body.projection .mise-en-page { grid-template-columns: minmax(0, 1fr); }
body.projection main { zoom: 1.15; }
body.projection .bandeau h1 { font-size: 22px; }
.grille-chaleur td { width: 54px; height: 32px; font-size: 12px; }
.grille-cartes figcaption select { width: auto; margin: 0; padding: 2px 4px; font-size: 12px; }

.bandeau h1 a.retour { color: var(--discret); text-decoration: none; margin-right: 4px; }
.bandeau h1 a.retour:hover { color: var(--accent); }

/* --- expériences sur les données --- */
details.experiences { border: 1px solid var(--bord); border-radius: 8px; padding: 6px 10px; margin: 6px 0 10px; background: #fbfcfd; }
details.experiences[open] { padding-bottom: 10px; }
details.experiences summary { cursor: pointer; font-weight: 600; font-size: 13px; }
details.experiences > label:first-of-type { margin-top: 10px; }
.pastille-exp { background: #fff4d4; color: #9a6700; border-radius: 999px; padding: 1px 8px; font-size: 11px; margin-left: 4px; }
details.experiences label.case { flex-wrap: nowrap; align-items: flex-start; margin-bottom: 8px; }
details.experiences label.case input { margin-top: 3px; flex: none; }
.note-case { display: block; color: var(--discret); font-size: 12px; margin: -4px 0 0 22px; }

/* --- export et missions --- */
.btn-export { float: right; padding: 1px 8px; font-size: 11px; font-weight: 600; color: var(--discret); background: transparent; border-color: transparent; }
.carte:hover .btn-export { border-color: var(--bord); background: #f6f8fa; }
.btn-export:hover { color: var(--accent); }
#btn-missions { white-space: nowrap; }
#annonces { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.annonce { background: #1f2328; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.25); font-size: 14px; transition: opacity .6s, transform .6s; }
.annonce.partie { opacity: 0; transform: translateY(10px); }
ul.missions { list-style: none; padding: 0; margin: 0; }
ul.missions li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eef1f4; }
ul.missions li.faite { color: var(--discret); }
ul.missions .coche { font-size: 18px; line-height: 1.2; }
.petit-lien { font-size: 12px; font-weight: normal; margin-left: 8px; }
.guide-corps h3 small { font-weight: normal; color: var(--discret); font-size: 12px; }

/* --- Bayes, seuil --- */
.grille-petites { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.grille-petites figure { margin: 0; }
.grille-petites figcaption { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calcul-bayes td, .calcul-bayes th { text-align: right; }
.calcul-bayes tr.gagnant td { background: #ddf4e4; }
.seuil-grille { display: grid; grid-template-columns: minmax(150px, 230px) 1fr; gap: 14px; align-items: start; margin-bottom: 10px; }
.petite-carte { width: 100%; aspect-ratio: 1; display: block; }
.seuil-grille .confusion td { width: 54px; height: 30px; font-size: 13px; }

/* --- comparer : mesures, point, importance, fuite --- */
.sous-titre-carte { font-size: 14px; margin: 18px 0 8px; }
.legende-tableau { caption-side: bottom; text-align: left; font-size: 12px; color: var(--discret); padding-top: 6px; }
.roc-ligne { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.legende-roc { display: flex; flex-direction: column; gap: 4px; font-size: 12px; max-width: 320px; }
.legende-roc .trait { display: inline-block; width: 18px; height: 3px; margin-right: 6px; vertical-align: middle; }
.point-modeles td.cellule-pile { width: 60%; }
.point-modeles .pile { display: flex; height: 18px; border-radius: 3px; overflow: hidden; background: #f6f8fa; }
.point-modeles .pile span { display: block; height: 100%; color: #fff; font-size: 10px; text-align: center; line-height: 18px; overflow: hidden; }
.point-modeles td:last-child { white-space: nowrap; }
.tableau-importance { border-collapse: collapse; font-size: 12px; width: 100%; font-variant-numeric: tabular-nums; }
.tableau-importance th, .tableau-importance td { padding: 3px 6px; border-bottom: 1px solid #eef1f4; text-align: left; }
.tableau-importance th { color: var(--discret); font-weight: 600; }
.tableau-importance td:first-child { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.tableau-importance td:not(:first-child) { min-width: 90px; }
.tableau-importance .barre-imp { display: inline-block; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; max-width: 60px; }
.tableau-importance tr.bruit td:first-child { color: var(--discret); font-style: italic; }
.barres.fuite td { padding: 6px 4px; vertical-align: middle; }
.barres.fuite td:first-child { white-space: normal; width: 45%; }
.barres.fuite .barre { display: inline-block; vertical-align: middle; max-width: 70%; }
.barres.fuite th { text-align: left; font-size: 12px; color: var(--discret); }
.barres.fuite td.optimiste { color: #cf222e; font-weight: 700; }

/* --- régression --- */
.graphe-regression { width: 100%; display: block; }
.graphe-regression text { font-size: 12px; fill: #636c76; }
.graphe-regression .grille-ligne { stroke: #eef1f4; }
.tableau-regression tr[data-k] { cursor: pointer; }
.tableau-regression tr.actuel td { background: #dbe9ff; }
.tableau-regression tr.meilleur td { font-weight: 700; }

/* --- non supervisé --- */
.bascule-couleur { display: flex; gap: 12px; align-items: center; font-size: 12px; margin-bottom: 6px; color: var(--discret); }
.bascule-couleur label { margin: 0; font-weight: normal; }
.tableau-contrib td { position: relative; }
.tableau-contrib td:not(:first-child) { width: 30%; text-align: center; }
.tableau-contrib .barre-div { position: absolute; top: 25%; height: 50%; width: var(--l); background: var(--c); opacity: .35; border-radius: 2px; }
.tableau-contrib small { position: relative; }
#carte-seuil-cv { cursor: default; }

/* --- menus : application et sous-menu du simulateur --- */
.sous-onglets { display: flex; align-items: center; gap: 4px; padding: 6px 20px; background: #f6f8fa; border-bottom: 1px solid var(--bord); flex-wrap: wrap; }
.sous-onglets span { font-size: 12px; font-weight: 700; color: var(--discret); margin-right: 8px; }
.sous-onglets a { padding: 3px 10px; border-radius: 6px; color: var(--discret); text-decoration: none; font-weight: 600; font-size: 12.5px; }
.sous-onglets a:hover { background: #eef1f4; color: var(--texte); }
.sous-onglets a.actif { background: #dbe9ff; color: #0b4fb3; }
body.projection .sous-onglets { display: none; }

/* --- accueil et page des TP --- */
main.accueil { max-width: 1100px; margin: 0 auto; padding: 24px 20px 48px; display: block; }
main.accueil section { margin-bottom: 28px; }
main.accueil h2 { font-size: 20px; margin: 0 0 8px; }
.accroche { text-align: center; padding: 18px 0 8px; }
.accroche h2 { font-size: 26px !important; }
.accroche p { max-width: 720px; margin: 0 auto; font-size: 15px; color: var(--discret); }
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 20px 0 32px; }
.tuile { display: block; background: var(--carte); border: 1px solid var(--bord); border-radius: 12px; padding: 18px; color: var(--texte); text-decoration: none; transition: border-color .15s, transform .15s; }
a.tuile:hover, #tuile-missions:hover { border-color: var(--accent); transform: translateY(-2px); cursor: pointer; }
.tuile-icone { font-size: 30px; }
.tuile h3 { margin: 6px 0; font-size: 17px; }
.tuile p { margin: 0 0 8px; color: var(--discret); font-size: 13.5px; }
.tuile-progres { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--accent); }
.liens-simulation { margin: 0; padding-left: 18px; font-size: 13.5px; }
.liens-simulation li { margin: 3px 0; }
.liens-simulation small { display: block; color: var(--discret); }
.par-ou { background: var(--carte); border: 1px solid var(--bord); border-radius: 12px; padding: 16px 20px; }
.par-ou ol { margin: 0; padding-left: 20px; line-height: 1.9; }
.liste-scenarios { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-top: 12px; }
.scenario { background: var(--carte); border: 1px solid var(--bord); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; }
.scenario h3 { margin: 0 0 6px; font-size: 16px; }
.scenario p { margin: 0 0 8px; font-size: 13.5px; color: var(--discret); }
.scenario .boutons { margin-top: auto; display: flex; gap: 8px; }
.scenario-infos { font-size: 12.5px !important; }
.scenario .fait { font-size: 12px; color: #1a7f37; background: #ddf4e4; padding: 1px 8px; border-radius: 999px; margin-left: 6px; }
.scenario.a-venir { border-style: dashed; background: transparent; }

/* --- démos et TP : projecteur, bulle, curseur --- */
.visite-projecteur { position: fixed; z-index: 900; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 4px var(--accent), 0 0 0 9999px rgba(15, 20, 30, .42); transition: all .35s ease; }
.visite-projecteur.plein { left: 50%; top: 50%; width: 0; height: 0; box-shadow: 0 0 0 9999px rgba(15, 20, 30, .42); }
body.visite-tp .visite-projecteur { box-shadow: 0 0 0 4px var(--accent), 0 0 0 9999px rgba(15, 20, 30, .18); }
body.visite-tp .visite-projecteur.plein { box-shadow: 0 0 0 9999px rgba(15, 20, 30, .18); }
.visite-bulle { position: fixed; z-index: 1000; width: min(380px, calc(100vw - 32px)); background: var(--carte); color: var(--texte);
  border-radius: 12px; padding: 12px 16px 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); border: 1px solid var(--bord);
  transition: left .3s ease, top .3s ease, opacity .2s; font-size: 14px; }
.visite-bulle.discrete { opacity: .25; pointer-events: none; }
.visite-bulle::before { content: ""; position: absolute; width: 14px; height: 14px; background: var(--carte); border: 1px solid var(--bord); transform: rotate(45deg); display: none; }
.visite-bulle[data-fleche="haut"]::before { display: block; top: -8px; left: calc(var(--fleche-x) - 7px); border-right: 0; border-bottom: 0; }
.visite-bulle[data-fleche="bas"]::before { display: block; bottom: -8px; left: calc(var(--fleche-x) - 7px); border-left: 0; border-top: 0; }
.visite-entete { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .03em; }
.visite-quitter { border: 0; background: transparent; font-size: 20px; padding: 0 4px; color: var(--discret); }
.visite-bulle h4 { margin: 6px 0 6px; font-size: 16px; }
.visite-texte { line-height: 1.5; }
.visite-texte ol { margin: 6px 0; padding-left: 20px; }
.visite-indice { background: #fff8c5; border-radius: 6px; padding: 6px 10px; margin: 8px 0 0; font-size: 13px; }
.visite-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.visite-actions button { font-size: 13px; }
.visite-actions button.principal, .scenario button.principal { background: var(--accent); color: #fff; border-color: var(--accent); }
.visite-curseur { position: fixed; z-index: 1100; pointer-events: none; opacity: 0; left: 50%; top: 50%; transition: left .8s cubic-bezier(.4, 0, .2, 1), top .8s cubic-bezier(.4, 0, .2, 1), opacity .3s; }
.visite-curseur.visible { opacity: 1; }
.visite-curseur::after { content: ""; position: absolute; left: -10px; top: -10px; width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--accent); opacity: 0; }
.visite-curseur.clic::after { animation: clic-visite .35s ease-out; }
@keyframes clic-visite { from { opacity: 1; transform: scale(.4); } to { opacity: 0; transform: scale(1.8); } }

/* --- barre principale : identique sur toutes les pages (le cours reprend les mêmes règles) --- */
.bandeau { height: 56px; padding: 0 20px; gap: 18px; flex-wrap: nowrap; justify-content: flex-start; }
.bandeau .marque { display: flex; align-items: center; gap: 8px; color: var(--texte); text-decoration: none; font-weight: 700; font-size: 18px; line-height: 26px; white-space: nowrap; flex-shrink: 0; }
.bandeau .marque:hover span { color: var(--accent); }
.onglets { margin: 0; gap: 4px; flex-shrink: 0; }
.onglets a { padding: 6px 12px; border-radius: 6px; color: #636c76; font-size: 14px; font-weight: 600; text-decoration: none; }
.onglets a:hover { background: #eef1f4; color: #1f2328; }
.onglets a.actif { background: #2f6fdb; color: #fff; }
.bandeau-droite { margin-left: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sous-onglets .fil { font-size: 12.5px; font-weight: 600; color: var(--texte); margin-left: 4px; }
@media (max-width: 1150px) { .bandeau-droite .pastille { display: none; } }
@media (max-width: 900px) { .bandeau { height: auto; flex-wrap: wrap; padding: 10px 16px; } .bandeau-droite { margin-left: 0; } }

/* --- sous-menu déroulant du simulateur (« Comparer les modèles ») et pastilles de couleur --- */
.menu-deroulant { position: relative; }
.menu-deroulant > button { padding: 3px 10px; border-radius: 6px; border: 0; background: none; color: var(--discret); font-weight: 600; font-size: 12.5px; cursor: pointer; }
.menu-deroulant > button:hover, .menu-deroulant.ouvert > button { background: #eef1f4; color: var(--texte); }
.menu-deroulant.actif > button { background: #dbe9ff; color: #0b4fb3; }
.menu-liste { display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 50; min-width: 180px; background: #fff; border: 1px solid var(--bord);
  border-radius: 8px; box-shadow: 0 6px 20px rgba(31, 35, 40, .12); padding: 4px; flex-direction: column; }
.menu-deroulant.ouvert .menu-liste, .menu-deroulant:hover .menu-liste, .menu-deroulant:focus-within .menu-liste { display: flex; }
.menu-deroulant:hover .menu-liste { margin-top: 0; }
.menu-liste::before { content: ""; position: absolute; top: -6px; left: 0; right: 0; height: 6px; }
.menu-liste a { display: block; padding: 6px 10px !important; white-space: nowrap; }
.pastille-couleur { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.tableau-comparaison tr.reference td { color: var(--discret); font-style: italic; }

/* --- page Images (CNN) --- */
.barre-progression { height: 6px; background: #eef1f4; border-radius: 3px; overflow: hidden; margin: 4px 0 10px; }
.barre-progression > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.deux-courbes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .deux-courbes { grid-template-columns: 1fr; } }
.reglages-cnn.inactif { opacity: .4; pointer-events: none; }
.filtres { display: flex; flex-wrap: wrap; gap: 6px; }
canvas.carte-pixels { image-rendering: pixelated; border: 1px solid #d8dee4; border-radius: 3px; background: #fff; }
.test-image { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .test-image { grid-template-columns: 1fr; } }
#dessin { width: 280px; height: 280px; border: 2px dashed #8c959f; border-radius: 8px; cursor: crosshair; touch-action: none; background: #fff; display: block; }
.couche-activations { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 0; border-top: 1px solid #eef1f4; }
.titre-couche { display: flex; flex-direction: column; font-size: 12.5px; }
.titre-couche small { color: var(--discret); }
.cartes-couche { display: flex; flex-wrap: wrap; gap: 4px; }
.evaluation { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 12px; }
@media (max-width: 900px) { .evaluation { grid-template-columns: 1fr; } }
.evaluation .confusion td, .evaluation .confusion th { width: 26px; height: 22px; text-align: center; }
.erreurs { display: flex; flex-wrap: wrap; gap: 6px; }
.erreur-image { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; font-size: 11px; background: #fff; }
.erreur-image strong { color: #cf222e; }
