/* CF2M Campus — charte CF2M : marine #1F4E8E, cyan #009DE0 */
:root {
    color-scheme: light;
    --marine: #1F4E8E;
    --cyan: #009DE0;
    /* Fond de la PAGE : un bleu tres pale qui fait ressortir les cartes
       blanches. Distinct de --fond, qui remplit les champs et les badges
       et doit rester neutre a l'interieur des cartes. */
    --fond-page: #e9f0fa;
    --fond: #f4f6fa;
    --carte: #ffffff;
    --texte: #1a202c;
    --muted: #5c6b80;
    --bordure: #e2e8f0;
    --ok: #16a34a;
    --ok-fond: #ecfdf3;
    --rouge: #dc2626;
    --rouge-fond: #fef2f2;
    --ambre: #d97706;
    --degrade: linear-gradient(135deg, #1F4E8E 0%, #009DE0 100%);
    --ombre: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 12px rgba(16, 24, 40, 0.06);
    --ombre-survol: 0 4px 8px rgba(16, 24, 40, 0.06), 0 12px 28px rgba(16, 24, 40, 0.12);
    /* Couleurs sémantiques : fond doux + texte fort, contraste garanti */
    --ok-soft: #d9f2e5;    --ok-fort: #0c6b4a;
    /* Texte pose SUR une pastille --ok-fort (pastille foncee -> texte blanc) */
    --sur-ok: #ffffff;
    --warn-soft: #fdf0d5;  --warn-fort: #8a5a00;
    --danger-soft: #fde3e3; --danger-fort: #a32d2d;
    --info-soft: #e1f2fb;  --info-fort: #0b6e9e;
    /* Teintes des camemberts : DISTINCTES, jamais un degrade, et dans CET
       ORDRE — l'ordre est le mecanisme de securite, pas un choix esthetique.
       Validees avec validate_palette.js (outil dataviz) en anneau de six
       couleurs, la sixieme rejoignant la premiere, sur les fonds de carte du
       site : CVD ΔE >= 9,1 (cible 8), vision normale ΔE >= 22,9 (plancher 15).
       L'ancienne palette echouait en toutes paires — bleu et violet a ΔE 12,3,
       difficiles a distinguer meme sans daltonisme.
       Trois teintes sont sous 3:1 sur blanc : le tableau a cote du camembert
       sert de relais, comme l'exige la regle. Le violet remplace le vert de la
       palette de reference : un vert se lirait comme « bien » dans un camembert
       d'ERREURS. La 7e part est le fourre-tout « Autre » : un gris neutre, pas
       ardoise — l'ardoise tirait vers le bleu voisin (ΔE 12,4). */
    --part-0: #2a78d6; --part-1: #eb6834; --part-2: #1baf7a;
    --part-3: #eda100; --part-4: #4a3aa7; --part-5: #e87ba4;
    --part-6: #6f6f6b;
    /* Echelle a cinq niveaux des indicateurs : deux verts pour distinguer un
       ecart franc d'un ecart leger, puis l'orange et le rouge du cote
       defavorable. Les deux fonds ne servent qu'aux extremes. */
    /* Les deux classes du face-a-face. */
    --duel-g: #2277B5; --duel-d: #123A66;
    --niv-tres-haut: #0a6b45; --niv-haut: #2b8257;
    --niv-bas: #a35c00;       --niv-tres-bas: #a32d2d;
    --niv-haut-fond: #e6f6ee; --niv-bas-fond: #fdecec;
    /* Accent de la matiere. L'orange du SQL est un choix de reconnaissance :
       c'est la couleur qu'on associe aux bases de donnees. Ce qu'il faut
       savoir : aucun orange ne se separe de l'ambre et du rouge des
       indicateurs sous daltonisme — les trois s'effondrent sur la meme teinte
       (au mieux 29 de distance, seuil 60). On l'accepte parce que la
       comparaison n'a jamais lieu : l'accent est du decor, toujours present,
       les indicateurs sont du contenu. L'ecart qui compte, Python contre SQL,
       vaut 177 en clair et 217 en sombre.
       Le cyan de l'accent est plus profond que celui du logo (#009DE0), qui
       n'atteignait que 2,65 de contraste sur le fond de page — sous le seuil
       meme pour un simple filet. Le logo garde sa couleur. */
    --accent-python: #0072A2;
    --accent-sql: #C2410C;
    --sur-accent: #ffffff;
    /* Coloration de la requete SQL. Le principe : seul ce que la base connait
       vraiment prend une couleur — mots reserves, fonctions, tables et colonnes
       du schema. Un mot mal orthographie reste en noir, et c'est le signal.
       Les alias (p, r, c) restent noirs eux aussi : c'est normal, ils
       n'appartiennent a aucun dictionnaire. */
    --sql-mot: #1F4E8E;         /* SELECT, FROM, WHERE...        */
    --sql-fonction: #7C3AED;    /* COUNT, AVG, ROUND...          */
    --sql-table: #0C6B4A;       /* products, orders...           */
    --sql-colonne: #B45309;     /* name, price, rating...        */
    --sql-texte: #A32D2D;       /* 'chaines de caracteres'       */
    --sql-nombre: #0B6E9E;
    --sql-commentaire: #6B7280;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --fond-page: #0f172a;
    --fond: #0f172a;
    --carte: #1e293b;
    --texte: #e2e8f0;
    --muted: #94a3b8;
    --bordure: #334155;
    --ok-fond: #052e16;
    --rouge-fond: #450a0a;
    --marine: #6ba3e8;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --fond-page: #0f172a;
        --fond: #0f172a;
        --carte: #1e293b;
        --texte: #e2e8f0;
        --muted: #94a3b8;
        --bordure: #334155;
        --ok-fond: #052e16;
        --rouge-fond: #450a0a;
        --marine: #6ba3e8;
        --ombre: 0 1px 2px rgba(0, 0, 0, 0.30), 0 4px 14px rgba(0, 0, 0, 0.35);
        --ombre-survol: 0 6px 16px rgba(0, 0, 0, 0.40), 0 14px 32px rgba(0, 0, 0, 0.50);
    }
}
:root[data-theme="dark"] {
    --ombre: 0 1px 2px rgba(0, 0, 0, 0.30), 0 4px 14px rgba(0, 0, 0, 0.35);
    --ombre-survol: 0 6px 16px rgba(0, 0, 0, 0.40), 0 14px 32px rgba(0, 0, 0, 0.50);
}
:root[data-theme="dark"], .dark-semantique {
    --ok-soft: rgba(34, 197, 94, 0.16);    --ok-fort: #6ee7a8;
    --warn-soft: rgba(217, 119, 6, 0.20);  --warn-fort: #fbbf24;
    --danger-soft: rgba(220, 38, 38, 0.22); --danger-fort: #f87171;
    --info-soft: rgba(0, 157, 224, 0.20);  --info-fort: #5fc8f5;
    /* La pastille --ok-fort est claire ici : le texte dessus doit etre fonce */
    --sur-ok: #06281c;
    /* --ok et --ambre n'etaient definis que pour le theme clair : trop sombres
       sur fond sombre (contraste 4.1 et 4.3, sous le seuil AA de 4.5). */
    --ok: #4ade80;
    --ambre: #fbbf24;
    /* Memes teintes, remontees pour tenir sur fond sombre (nuancier verifie). */
    --part-0: #3987e5; --part-1: #d95926; --part-2: #199e70;
    --part-3: #c98500; --part-4: #9085e9; --part-5: #d55181;
    --part-6: #94A3B8;
    --duel-g: #2E8FD4; --duel-d: #1B5486;
    --niv-tres-haut: #5ce6a4; --niv-haut: #3fbf85;
    --niv-bas: #fbbf24;       --niv-tres-bas: #f87171;
    --niv-haut-fond: rgba(34, 197, 94, .13);
    --niv-bas-fond: rgba(220, 38, 38, .15);
    --accent-python: #38BDF8;
    --accent-sql: #F97316;
    /* L'accent est clair sur fond sombre : le texte pose dessus doit foncer. */
    --sur-accent: #0f172a;
    /* Memes roles, remontes pour tenir sur fond sombre. */
    --sql-mot: #7FB3FF;
    --sql-fonction: #C4A6FF;
    --sql-table: #5FD3A8;
    --sql-colonne: #F0B357;
    --sql-texte: #FF9E9E;
    --sql-nombre: #7FD4F5;
    --sql-commentaire: #8A94A6;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ok-soft: rgba(34, 197, 94, 0.16);    --ok-fort: #6ee7a8;
        --warn-soft: rgba(217, 119, 6, 0.20);  --warn-fort: #fbbf24;
        --danger-soft: rgba(220, 38, 38, 0.22); --danger-fort: #f87171;
        --info-soft: rgba(0, 157, 224, 0.20);  --info-fort: #5fc8f5;
        --sur-ok: #06281c;
        --ok: #4ade80;
        --ambre: #fbbf24;
        --part-0: #3987e5; --part-1: #d95926; --part-2: #199e70;
        --part-3: #c98500; --part-4: #9085e9; --part-5: #d55181;
        --part-6: #94A3B8;
        --duel-g: #2E8FD4; --duel-d: #1B5486;
        --niv-tres-haut: #5ce6a4; --niv-haut: #3fbf85;
        --niv-bas: #fbbf24;       --niv-tres-bas: #f87171;
        --niv-haut-fond: rgba(34, 197, 94, .13);
        --niv-bas-fond: rgba(220, 38, 38, .15);
        --accent-python: #38BDF8;
        --accent-sql: #F97316;
        --sur-accent: #0f172a;
        --sql-mot: #7FB3FF;
        --sql-fonction: #C4A6FF;
        --sql-table: #5FD3A8;
        --sql-colonne: #F0B357;
        --sql-texte: #FF9E9E;
        --sql-nombre: #7FD4F5;
        --sql-commentaire: #8A94A6;
    }
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    background: var(--fond-page);
    color: var(--texte);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
body, .carte, .topbar, .kpi, .btn-principal, .btn-secondaire,
input, textarea, .seance-carte, .exo-ligne {
    transition: background-color .25s ease, color .25s ease,
                border-color .25s ease, box-shadow .2s ease, transform .2s ease;
}

/* ── Barre du haut ── */
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 24px;
    background: var(--carte);
    border-bottom: none;
    box-shadow: 0 1px 0 var(--bordure), 0 2px 8px rgba(16, 24, 40, 0.05);
    position: relative;
}
/* La matiere courante est posee sur <html> : tout ce qui suit s'y adapte
   sans qu'aucune page ait a s'en occuper. */
:root { --accent: var(--accent-python); }
:root[data-cours="sql"] { --accent: var(--accent-sql); }

.topbar::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0;
    height: 3px; background: var(--accent);
}

/* Le commutateur de matiere : un seul pour tout le site. */
.mode-cours {
    display: inline-flex; gap: 2px; padding: 2px;
    border: 1px solid var(--bordure); border-radius: 999px;
    background: var(--fond);
}
.mode-choix {
    padding: 3px 11px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
    color: var(--muted); text-decoration: none; white-space: nowrap;
}
.mode-choix:hover { color: var(--texte); }
.mode-choix.actif { background: var(--accent); color: var(--sur-accent); }
.topbar-brand { display: flex; align-items: center; gap: 14px; }
.brand-user { font-size: 13px; }
.logo { height: 64px; display: block; }
.logo-lien { display: inline-flex; line-height: 0; }
@media (prefers-color-scheme: dark) {
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-nav { display: flex; align-items: center; gap: 3px; }
/* Onglet = symbole + libellé. Le symbole donne le repère visuel, le libellé
   évite de faire deviner : les deux, jamais l'un sans l'autre sur ordinateur. */
.onglet {
    display: inline-flex; align-items: center; gap: 7px;
    color: var(--marine); text-decoration: none; font-weight: 600;
    font-size: 14px; padding: 8px 12px; border-radius: 10px;
    white-space: nowrap;
    transition: background .18s ease, color .18s ease;
}
.onglet .symb { width: 17px; height: 17px; flex: none; }
.onglet:hover { background: var(--info-soft); color: var(--info-fort); }
.onglet.actif { background: var(--accent); color: var(--sur-accent); }
.onglet:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.onglet-sortie { color: var(--muted); }
.onglet-sortie:hover { background: var(--danger-soft); color: var(--danger-fort); }

/* Barre du bas : uniquement sur téléphone (voir la requête média plus bas) */
.barre-basse { display: none; }
.onglet-bas {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 2px 7px; text-decoration: none; color: var(--muted);
    font-size: 10.5px; font-weight: 600; text-align: center;
    border-top: 2px solid transparent; min-width: 0;
}
.onglet-bas .symb { width: 21px; height: 21px; }
.onglet-bas span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.onglet-bas.actif { color: var(--marine); border-top-color: var(--marine); }
.onglet-bas:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }

.contenu { max-width: 980px; margin: 0 auto; padding: 24px 16px 48px; }


.pied { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }

h1 { color: var(--marine); font-size: 25px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 4px; }
h2 { color: var(--marine); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 12px; }
.muted { color: var(--muted); }
.ok { color: var(--ok-fort); font-weight: 600; }
.rouge { color: var(--rouge); font-weight: 600; }
.etoiles { color: var(--warn-fort); letter-spacing: 2px; }
.cache { display: none; }

/* ── Icônes maison (remplacent les emojis) ── */
.icone { height: 1em; width: auto; vertical-align: -0.15em; display: inline-block; }
.icone-lg { height: 1.4em; }
.icone-blanc { filter: brightness(0) invert(1); }
:root[data-theme="dark"] .icone { filter: brightness(0) invert(1); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .icone { filter: brightness(0) invert(1); }
}

/* ── Bouton clair/sombre ── */
.bouton-theme {
    background: none; border: 1px solid var(--bordure); border-radius: 50%;
    width: 36px; height: 36px; cursor: pointer; display: inline-flex;
    align-items: center; justify-content: center;
    color: var(--marine); flex-shrink: 0;
}
.bouton-theme:hover { background: var(--fond); border-color: var(--cyan); color: var(--cyan); }

.entete-page { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ── Cartes ── */
.carte {
    background: var(--carte);
    border: 1px solid var(--bordure);
    border-radius: 14px;
    padding: 20px;
    margin: 14px 0;
    box-shadow: var(--ombre);
}

/* ── Boutons ── */
.btn-principal {
    background: var(--degrade); color: #fff; border: none;
    padding: 10px 22px; border-radius: 9px; font-size: 14px; font-weight: 600;
    cursor: pointer; text-decoration: none; display: inline-block;
    box-shadow: 0 2px 8px rgba(0, 157, 224, 0.30);
}
.btn-principal:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0, 157, 224, 0.40); }
.btn-principal:active { transform: translateY(0); }
.btn-principal:disabled { opacity: 0.6; cursor: wait; transform: none; }
.btn-large { width: 100%; padding: 12px; margin-top: 12px; }
.btn-secondaire {
    background: transparent; color: var(--marine);
    border: 1px solid var(--bordure); padding: 7px 14px; border-radius: 8px;
    font-size: 13px; cursor: pointer; text-decoration: none; display: inline-block;
}
.btn-secondaire:hover { border-color: var(--cyan); color: var(--cyan); background: var(--fond); }
.btn-secondaire.actif { background: var(--marine); color: #fff; border-color: var(--marine); }
.btn-secondaire.actif:hover { color: #fff; }
.btn-desactive { opacity: 0.45; pointer-events: none; cursor: not-allowed; }
/* Action qui efface quelque chose : même gabarit que le bouton secondaire,
   en rouge, pour qu'on ne la prenne pas pour « Reprendre ». */
.btn-danger {
    background: transparent; color: var(--danger-fort);
    border: 1px solid var(--danger-soft); padding: 7px 14px; border-radius: 8px;
    font-size: 13px; cursor: pointer; text-decoration: none; display: inline-block;
}
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger-fort); }

/* ── Navigation entre exercices ── */
.nav-exercices {
    display: flex; justify-content: space-between; align-items: center;
    margin: 16px 0;
}

/* ── Progression admin : cellules heatmap ── */
.cellule {
    display: inline-block; padding: 3px 8px; border-radius: 6px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.cellule-ok    { background: var(--ok-soft); color: var(--ok-fort); }
.cellule-cours { background: var(--warn-soft); color: var(--warn-fort); }
.cellule-ko    { background: var(--danger-soft); color: var(--danger-fort); }
.cellule-vide  { background: transparent; color: var(--muted); }
.soum-cell { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.soum-lien { color: var(--cyan); text-decoration: none; }
.soum-lien:hover { text-decoration: underline; }
.code-soumis {
    background: var(--fond); border: 1px solid var(--bordure); border-radius: 6px;
    padding: 8px 10px; margin: 6px 0 0; font-size: 12.5px; white-space: pre-wrap;
    font-family: var(--mono, monospace); overflow-x: auto;
}

.ligne-bloque-resume { cursor: pointer; }
.ligne-bloque-resume:hover td { background: rgba(0, 157, 224, 0.08); }

.comparatif-bloque { display: flex; gap: 16px; padding: 12px 4px; flex-wrap: wrap; }
.comparatif-carte {
    flex: 1; min-width: 280px; border-radius: 8px; overflow: hidden;
    border: 1px solid var(--bordure); background: var(--carte);
}
.comparatif-entete {
    padding: 8px 14px; font-weight: 600; font-size: 13px; color: #fff;
}
.comparatif-eleve .comparatif-entete { background: var(--marine); }
.comparatif-formateur .comparatif-entete { background: var(--cyan); }
.comparatif-corps { padding: 12px 14px; font-size: 13px; }
.comparatif-carte .code-soumis { margin-top: 0; }
.comparatif-liste { margin: 0; }
.comparatif-liste dt {
    font-weight: 600; color: var(--muted); font-size: 11.5px;
    text-transform: uppercase; letter-spacing: .03em; margin-top: 12px;
}
.comparatif-liste dt:first-child { margin-top: 0; }
.comparatif-liste dd { margin: 4px 0 0; }
.lien-code { color: var(--cyan); cursor: pointer; font-size: 13px; }

/* ── Carte admin (corrigé + notes, invisible pour les élèves) ── */
.carte-admin { border: 2px solid var(--marine); border-style: dashed; }
.carte-admin h2 { color: var(--marine); }
.carte-admin #solution { font-family: var(--mono, monospace); font-size: 13px; }
.legende { font-size: 12px; margin-top: 8px; }

/* ── Classement ── */
.tableau tr.ligne-moi td { background: #eaf5fc; font-weight: 600; color: #14224a; }
.tableau tr:not(.ligne-moi):hover td { background: rgba(0, 157, 224, 0.12); }
.rang {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    font-weight: 700; font-size: 13px; box-shadow: var(--ombre);
}
.rang-1 { background: linear-gradient(135deg, #f6d365, #e0a219); color: #4a3600; }
.rang-2 { background: linear-gradient(135deg, #dfe4ec, #b3bcca); color: #3a4250; }
.rang-3 { background: linear-gradient(135deg, #e0a06a, #b9712f); color: #ffffff; }
.rang-num { display: inline-flex; justify-content: center; width: 26px; color: var(--muted); }
.icone-titre { vertical-align: -4px; margin-right: 4px; }

/* ── Login ── */
.carte-login { max-width: 380px; margin: 8vh auto; text-align: center; }
.logo-login { height: 60px; margin-bottom: 8px; }
.carte-login form { text-align: left; }

/* ── Formulaires ── */
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=date], textarea {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--bordure); border-radius: 8px;
    font-size: 14px; background: var(--fond); color: var(--texte);
}
textarea { font-family: Consolas, "Courier New", monospace; font-size: 13.5px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--cyan); border-color: var(--cyan); }

/* ── Alertes / feedback ── */
.alerte { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin: 12px 0; }
.alerte-ok { background: var(--ok-fond); color: var(--ok); border: 1px solid var(--ok); }
.alerte-erreur { background: var(--rouge-fond); color: var(--rouge); border: 1px solid var(--rouge); }
/* L'essai n'est ni une reussite ni un echec : il ne doit ressembler ni au vert
   ni au rouge, sinon il se lit comme un verdict. */
.alerte-essai { background: var(--info-soft); color: var(--info-fort); border: 1px solid var(--info-fort); }

/* ── Le Mémo (bibliothèque de référence) ── */
.memo-recherche { display: flex; align-items: center; gap: 14px; }
.memo-recherche input { flex: 1; }

/* Deux colonnes : navigation par thème à gauche, fiches à droite */
.memo-page { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 20px; align-items: start; }
.memo-nav {
    position: sticky; top: 16px; background: var(--carte);
    border: 1px solid var(--bordure); border-radius: 14px;
    padding: 14px 12px; box-shadow: var(--ombre);
    max-height: calc(100vh - 40px); overflow: auto;
}
.memo-nav-titre {
    margin: 0 0 8px 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--muted);
}
.memo-theme {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; text-align: left; font-family: inherit; font-size: 14px; font-weight: 600;
    color: var(--texte); background: none; border: none; border-radius: 9px;
    padding: 9px 11px; cursor: pointer; transition: all .15s ease;
}
.memo-theme:hover { background: var(--fond); }
/* Chevron : indique qu'un clic sur le thème actif replie ou déplie sa liste */
.memo-theme::before {
    content: "\25B8"; font-size: 11px; line-height: 1; opacity: .55;
    transition: transform .15s ease; transform-origin: 50% 50%;
}
.memo-theme.ouvert::before { transform: rotate(90deg); opacity: .9; }
.memo-theme-nom { flex: 1 1 auto; }
.memo-theme.actif { background: var(--degrade); color: #fff; }
.memo-nav-nb {
    font-size: 11px; font-weight: 700; background: var(--fond); color: var(--muted);
    border-radius: 999px; padding: 1px 8px;
}
.memo-theme.actif .memo-nav-nb { background: rgba(255,255,255,.22); color: #fff; }
.memo-nav-fonctions { padding: 4px 0 10px 6px; }
.memo-nav-groupe {
    margin: 10px 0 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .05em;
    text-transform: uppercase; color: var(--muted);
}
.memo-nav-fonctions a {
    display: block; padding: 4px 8px; border-radius: 6px;
    font-family: var(--mono, Consolas, monospace); font-size: 12.5px;
    color: var(--marine); text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.memo-nav-fonctions a:hover { background: var(--info-soft); color: var(--info-fort); }

@media (max-width: 820px) {
    .memo-page { grid-template-columns: 1fr; }
    .memo-nav { position: static; max-height: none; }
}

.memo-categorie {
    margin: 22px 0 10px; padding-bottom: 7px;
    border-bottom: 2px solid var(--cyan); font-size: 15px;
}
.memo-bloc-theme > .memo-categorie:first-child { margin-top: 4px; }
.memo-fiche { border-left: 4px solid var(--marine); }
.memo-fiche.memo-cible { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(0,157,224,.30); }
.memo-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.memo-tete h3 {
    margin: 0; font-size: 17px; color: var(--marine);
    font-family: var(--mono, Consolas, monospace);
}
.memo-badges { display: flex; gap: 7px; flex-wrap: wrap; }
.memo-role { margin: 8px 0 12px; font-size: 14.5px; }
.memo-lignes { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.memo-lignes > div { display: flex; gap: 12px; align-items: baseline; }
.memo-cle {
    flex: 0 0 74px; font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted); padding-top: 2px;
}
/* Syntaxe principale : une seule forme, bien visible sous le titre */
.memo-syntaxe {
    margin: 10px 0 10px; padding: 0;
}
.memo-syntaxe code {
    display: inline-block; padding: 5px 11px; font-size: 14px;
    background: var(--info-soft); color: var(--info-fort);
    border-radius: 7px; border: 1px solid rgba(0,157,224,.30);
}
/* Paramètres et variantes : chaque ligne est EXPLIQUÉE, jamais un nom seul */
.memo-parametres, .memo-variantes { margin: 14px 0 0; }
.memo-sous-titre {
    margin: 0 0 7px; font-size: 11px; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: var(--muted);
}
.memo-param {
    display: grid; grid-template-columns: minmax(120px, max-content) 1fr;
    gap: 4px 14px; align-items: baseline;
    padding: 6px 0; font-size: 13.5px;
    border-top: 1px solid var(--bordure);
}
.memo-param code { white-space: nowrap; }
@media (max-width: 620px) {
    .memo-param { grid-template-columns: 1fr; }
}
.memo-piege {
    margin: 12px 0 0; padding: 10px 14px; font-size: 13.5px;
    background: var(--warn-soft); color: var(--warn-fort);
    border-radius: 8px; border-left: 3px solid var(--warn-fort);
}
.memo-essai { margin-top: 14px; }
.memo-essai-tete {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 6px; font-size: 12.5px;
}
.memo-code {
    width: 100%; font-family: var(--mono, Consolas, monospace); font-size: 13px;
    line-height: 1.5; padding: 10px 12px; resize: vertical;
    border: 1px solid var(--bordure); border-radius: 8px;
    background: var(--fond); color: var(--texte);
}
.memo-sortie {
    margin: 8px 0 0; padding: 10px 14px; border-radius: 8px;
    background: #0F2137; color: #E6EDF6;
    font-family: var(--mono, Consolas, monospace); font-size: 13px;
    white-space: pre-wrap; max-height: 220px; overflow: auto;
}
.memo-sortie.muted { color: #8FA3BC; font-style: italic; }
.memo-sortie.erreur { color: #FF9B95; }
.memo-reconstruire { margin-top: 12px; }
.memo-reconstruire summary {
    cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--cyan);
}
/* Table ASCII : repliée par défaut, elle ne prend qu'une ligne fermée */
.ascii-convertisseur {
    display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap;
    margin: 10px 0 12px;
}
.ascii-convertisseur label { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.ascii-convertisseur input {
    width: 110px; padding: 6px 10px; font-size: 14px;
    font-family: var(--mono, Consolas, monospace);
}
.ascii-resultat {
    padding: 7px 12px; border-radius: 8px; font-size: 13px; font-weight: 600;
    font-family: var(--mono, Consolas, monospace);
    background: var(--info-soft); color: var(--info-fort);
}
.ascii-legende { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ascii-legende .ascii-case { padding: 3px 10px; font-size: 11px; font-weight: 600; }
.ascii-grille {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 4px; max-height: 320px; overflow: auto;
}
.ascii-case {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 5px 2px; border-radius: 6px; line-height: 1.15;
    font-family: var(--mono, Consolas, monospace); border: 1px solid transparent;
}
.ascii-case b { font-size: 14px; }
.ascii-case small { font-size: 10.5px; opacity: .75; }
.ascii-case.chiffre    { background: var(--ok-soft);     color: var(--ok-fort); }
.ascii-case.majuscule  { background: var(--info-soft);   color: var(--info-fort); }
.ascii-case.minuscule  { background: var(--warn-soft);   color: var(--warn-fort); }
.ascii-case.symbole    { background: var(--fond); color: var(--muted); border-color: var(--bordure); }

.memo-reconstruire pre {
    margin: 8px 0 0; padding: 10px 14px; font-size: 13px;
    background: var(--fond); border: 1px solid var(--bordure); border-radius: 8px;
    font-family: var(--mono, Consolas, monospace); white-space: pre-wrap;
}

/* ── Console « Exécuter » (Python dans le navigateur) ── */
.actions-boutons { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
/* Le dernier envoi ne correspond plus à l'exercice (énoncé réécrit). */
.alerte-modele {
    background: var(--warn-soft); color: var(--warn-fort); border-radius: 8px;
    padding: 10px 12px; margin: 6px 0 10px; font-size: 14px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
}
.alerte-modele .btn-secondaire { background: var(--carte); }
.bloc-console {
    border: 1px solid var(--bordure); border-radius: 10px;
    margin: 12px 0; overflow: hidden; background: #0F2137;
}
.console-entete {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 14px; font-size: 12.5px; font-weight: 600;
    color: #C7D6E6; background: rgba(255,255,255,.06);
}
.console-entete .muted { color: #8FA3BC; font-weight: 400; }
.console-fermer {
    background: none; border: none; color: #8FA3BC; cursor: pointer; font-size: 13px;
}
.console-fermer:hover { color: #fff; }
#console-sortie {
    margin: 0; padding: 12px 16px; color: #E6EDF6;
    font-family: var(--mono, Consolas, monospace); font-size: 13px; line-height: 1.55;
    white-space: pre-wrap; max-height: 260px; overflow: auto;
}
#console-sortie.muted { color: #8FA3BC; font-style: italic; }
#console-sortie.console-erreur { color: #FF9B95; }

/* ── Tableau de résultat SQL (aperçu façon client MySQL) ── */
.bloc-table-sql {
    border: 1px solid var(--bordure); border-radius: 8px;
    padding: 10px 14px 12px; margin: 12px 0; background: var(--fond);
}
.table-sql-titre { margin: 0 0 6px; font-size: 12.5px; font-weight: 600; }
.table-sql-defilement { overflow-x: auto; }
.table-sql { font-size: 12.5px; font-family: var(--mono, Consolas, monospace); }
.table-sql th {
    background: var(--carte); border-bottom: 2px solid var(--cyan);
    white-space: nowrap; padding: 5px 10px;
}
.table-sql td { padding: 4px 10px; white-space: nowrap; border-top: 1px solid var(--bordure); }
.table-sql .cellule-null { color: var(--muted); font-style: italic; }

/* Colle au verdict : le message de reussite et la note forment un seul bloc.
   Auparavant la note arrivait APRES le tableau de resultat, donc tres bas. */
.bloc-qualite {
    border: 1px solid var(--bordure); border-top: none;
    border-radius: 0 0 8px 8px; padding: 12px 14px; margin: -8px 0 12px;
}
.qualite-entete { display: flex; justify-content: space-between; align-items: center; }
.bloc-qualite p { margin: 6px 0 0; font-size: 13.5px; }

/* ── Badges ── */
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 12px; }
.badge-rouge { background: var(--danger-soft); color: var(--danger-fort); }
.badge-bleu { background: var(--info-soft); color: var(--info-fort); }
.badge-gris { background: var(--fond); color: var(--muted); border: 1px solid var(--bordure); }
.badge-vert { background: var(--ok-soft); color: var(--ok-fort); }
.badge-lien { text-decoration: none; transition: all .15s ease; }
.badge-lien:hover { filter: brightness(.92); transform: translateY(-1px); }
.pastille-apercu { background: var(--info-soft); color: var(--info-fort); }
.enonce { font-size: 15px; margin: 0; }

/* ── Boîte Astuce (dépliable au clic) ── */
.astuce-bloc { margin: 12px 0; }
.astuce-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(0, 157, 224, 0.08);
    border: 1px solid rgba(0, 157, 224, 0.3);
    color: var(--cyan); font-size: 13.5px; font-weight: 600;
    padding: 7px 14px; border-radius: 8px; cursor: pointer;
}
.astuce-toggle:hover { background: rgba(0, 157, 224, 0.16); }
.astuce-icone { width: 18px; height: 18px; }
.astuce-chevron { font-size: 11px; }
.astuce-contenu {
    background: rgba(0, 157, 224, 0.06);
    border-left: 3px solid var(--cyan);
    border-radius: 0 8px 8px 0;
    padding: 10px 14px; margin-top: 6px; font-size: 13.5px;
    color: var(--texte);
}
.astuce-contenu code { background: var(--fond); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.astuce-ref {
    display: block; margin-top: 8px; padding-top: 8px;
    border-top: 1px dashed rgba(0, 157, 224, 0.35);
    font-size: 12.5px; color: var(--muted);
}
:root[data-theme="dark"] .astuce-icone { filter: invert(1) brightness(1.4); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .astuce-icone { filter: invert(1) brightness(1.4); }
}

.actions { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; gap: 12px; }
.actions-slides { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── Sommaire des cours web ── */
.grille-cours { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 14px; }
.carte-cours {
    display: flex; align-items: center; gap: 14px;
    text-decoration: none; color: var(--texte);
    padding: 16px 18px; margin: 0; text-align: left;
}
a.carte-cours:hover { border-color: var(--cyan); box-shadow: var(--ombre-survol); transform: translateY(-2px); }
.carte-cours .cours-num {
    flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px;
    background: var(--degrade); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700;
}
.carte-cours .cours-texte { flex: 1; min-width: 0; display: block; }
.carte-cours .cours-titre { display: block; font-weight: 600; font-size: 15px; line-height: 1.3; }
.carte-cours .cours-meta {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 12.5px; margin-top: 3px;
}
.carte-cours .cours-fleche { flex: 0 0 auto; color: var(--cyan); font-size: 13px; }
.carte-cours-verrouillee { opacity: .55; }
.carte-cours-verrouillee .cours-num { background: var(--bordure); color: var(--muted); }

/* ── Liste des séances ── */
.liste-seances { display: flex; flex-direction: column; gap: 4px; }
.seance-carte {
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    text-decoration: none; color: var(--texte); margin: 6px 0;
}
a.seance-carte:hover { border-color: var(--cyan); box-shadow: var(--ombre-survol); transform: translateY(-2px); }
.seance-verrouillee { opacity: 0.55; }
.seance-titre { font-weight: 600; display: flex; align-items: center; gap: 10px; }
.seance-meta {
    display: flex; align-items: center; gap: 16px; flex: none;
}

/* Anneau de progression : l'arc est tracé par stroke-dasharray, calculé côté
   gabarit (circonférence d'un rayon 26 = 163.4). */
.anneau { position: relative; width: 62px; height: 62px; flex: none; }
.anneau svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.anneau circle { fill: none; stroke-width: 7; }
.anneau-fond { stroke: var(--bordure); }
.anneau-arc {
    stroke: var(--cyan); stroke-linecap: round;
    transition: stroke-dasharray .6s ease;
}
.anneau-arc.complet { stroke: var(--ok-fort); }
.anneau-valeur {
    position: absolute; inset: 0; display: flex;
    align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700; color: var(--texte);
    font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.anneau-valeur i { font-style: normal; font-size: 10px; color: var(--muted); margin-left: 1px; }

.seance-chiffres {
    display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
    min-width: 106px;
}
.chiffre-fort {
    font-size: 19px; font-weight: 700; color: var(--marine);
    font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.1;
}
.chiffre-fort i { font-style: normal; font-size: 13px; color: var(--muted); font-weight: 600; }
.chiffre-quoi { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
.chiffre-etoiles {
    display: inline-flex; align-items: center; gap: 4px; margin-top: 3px;
    font-size: 13px; font-weight: 600; color: var(--warn-fort);
    font-variant-numeric: tabular-nums;
}
.chiffre-etoiles i { font-style: normal; color: var(--muted); font-weight: 500; }
.symb-etoile { width: 13px; height: 13px; flex: none; }
.pastille { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.pastille-ok { background: var(--ok-soft); color: var(--ok-fort); }
.pastille-ouverte { background: var(--info-soft); color: var(--info-fort); }
.pastille-verrou { background: var(--fond); }
.barre { height: 6px; background: var(--bordure); border-radius: 3px; margin-top: 6px; }
.barre-remplie { height: 6px; background: var(--degrade); border-radius: 3px; }

/* ── Liste des exercices ── */
.barre-progression { display: flex; gap: 4px; margin: 14px 0; }
.segment { flex: 1; height: 7px; border-radius: 4px; background: var(--bordure); transition: background .3s ease; }
.segment-ok { background: var(--ok); }
.segment-actif { background: var(--cyan); animation: pulse-segment 1.6s ease-in-out infinite; }
/* Segment cliquable : la barre ne fait que 7px de haut, la zone de clic est
   agrandie par un padding transparent (background-clip). */
.segment-lien {
    display: block; height: 19px; padding: 6px 0; margin: -6px 0;
    background-clip: content-box; cursor: pointer;
}
.segment-lien:hover, .segment-lien:focus-visible { filter: brightness(1.2); transform: scaleY(1.35); }

@keyframes pulse-segment {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* Barre de progression en tête de la page exercice */
.progression-exo { margin: 4px 0 18px; }
.progression-exo .barre-progression { margin: 0 0 6px; }
.progression-legende { font-size: 12.5px; }

.liste-exos { display: flex; flex-direction: column; gap: 6px; }
.exo-ligne {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 16px; margin: 0;
    text-decoration: none; color: var(--texte);
    border-left: 4px solid transparent;
}
a.exo-ligne:hover { border-color: var(--cyan); box-shadow: var(--ombre-survol); transform: translateY(-1px); }
.exo-verrouille { opacity: 0.55; }
.exo-num {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    background: var(--degrade); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600;
}
.exo-titre { flex: 1; font-weight: 500; }
.exo-etat { font-size: 13px; display: flex; align-items: center; gap: 10px; }

/* Progression visible au niveau exercice */
.exo-reussi { background: var(--ok-soft); border-left-color: var(--ok-fort); }
.exo-reussi .exo-num { background: var(--ok-fort); color: var(--sur-ok); }
.exo-courant { border-left-color: var(--cyan); box-shadow: var(--ombre), inset 0 0 0 1px var(--cyan); }
.badge-courant {
    background: var(--info-soft); color: var(--info-fort);
    font-weight: 600; padding: 3px 10px; border-radius: 12px;
    display: inline-flex; align-items: center; gap: 6px;
}

/* ── Admin ── */
.grille-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 16px 0; }
.kpi { background: var(--carte); border: 1px solid var(--bordure); border-radius: 12px; padding: 14px 16px; box-shadow: var(--ombre); }
.kpi-cliquable { display: block; text-decoration: none; color: inherit; cursor: pointer; transition: box-shadow .2s ease, transform .2s ease, border-color .25s ease; }
.kpi-cliquable:hover { border-color: var(--cyan); box-shadow: var(--ombre-survol); transform: translateY(-2px); }
.kpi-label { display: block; font-size: 12px; color: var(--muted); }
.kpi-valeur { font-size: 24px; font-weight: 600; }
.kpi-valeur small { font-size: 13px; color: var(--muted); font-weight: 400; }

.grille-deux { display: grid; grid-template-columns: 1.1fr 1fr; gap: 12px; align-items: start; }
/* Le tableau de deblocage (5 colonnes, dont deux interrupteurs) reclame ~840 px.
   Tant que la colonne de gauche ne peut pas les offrir, on empile : sinon la
   derniere colonne (WEB2) se retrouve coupee derriere une barre de defilement.
   Le seuil de 1750 px correspond au moment ou `.contenu` passe a 1560 px et
   ou la colonne de gauche atteint ~880 px. */
@media (max-width: 1749px) { .grille-deux { grid-template-columns: 1fr; } }
@media (min-width: 1750px) { .grille-deux { grid-template-columns: 1.45fr 1fr; } }

.tableau { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tableau th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 6px 8px; }
.tableau td { padding: 8px; border-top: 1px solid var(--bordure); color: var(--texte); }

.form-inline { display: inline; }
.lien-upload { display: inline; color: var(--cyan); cursor: pointer; font-size: 12px; margin: 0 0 0 6px; }

.interrupteur {
    width: 38px; height: 21px; border-radius: 11px; border: none; cursor: pointer;
    background: var(--bordure); position: relative; vertical-align: middle;
}
.interrupteur::after {
    content: ""; position: absolute; top: 2px; left: 2px;
    width: 17px; height: 17px; border-radius: 50%; background: #fff;
    transition: left 0.15s;
}
.interrupteur.on { background: var(--ok); }
.interrupteur.on::after { left: 19px; }

.flux { display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.flux-ligne { border-radius: 6px; }
.flux-cliquable:hover { background: rgba(0, 157, 224, 0.08); }
.flux-resume { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; padding: 2px 4px; }
.flux-resume::-webkit-details-marker { display: none; }
.flux-texte { flex: 1; }
.flux-ligne .code-soumis { margin: 4px 0 6px 4px; }

.onglets-cours {
    display: inline-flex; gap: 4px; padding: 4px;
    background: var(--fond); border: 1px solid var(--bordure); border-radius: 11px;
}
.onglets-cours .btn-secondaire {
    border: none; background: transparent; border-radius: 8px;
    padding: 6px 16px; color: var(--muted); font-weight: 500;
}
.onglets-cours .btn-secondaire:hover { color: var(--texte); background: var(--carte); }
.onglets-cours .btn-secondaire.actif {
    background: var(--degrade); color: #fff; box-shadow: 0 1px 5px rgba(0, 157, 224, 0.35);
}
.form-export { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-export label { display: flex; align-items: center; gap: 6px; margin: 0; }
.form-export input[type=date] { width: auto; }

/* ---- Champ mot de passe avec bouton « afficher » -------------------------
   Les stagiaires saisissent un code genere : pouvoir le relire evite les
   blocages a la connexion. */
.champ-mdp { position: relative; display: block; }
.champ-mdp input { width: 100%; padding-right: 44px; }
.oeil-mdp {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; padding: 0;
    background: none; border: none; border-radius: 8px;
    color: var(--muted); cursor: pointer;
    transition: color .15s ease, background .15s ease;
}
.oeil-mdp:hover { color: var(--marine); background: var(--info-soft); }
.oeil-mdp:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.oeil-mdp[aria-pressed="true"] { color: var(--cyan); }


/* ── Téléphone ───────────────────────────────────────────────────────────────
   Les onglets du haut demandaient 484 px de large : sur un écran de 375 px, ils
   poussaient la page à 768 px et créaient un défilement horizontal. En dessous
   de 720 px ils passent donc dans une barre fixe en bas, à portée de pouce. */
@media (max-width: 720px) {
    .topbar-nav { display: none; }
    .topbar { padding: 10px 14px; }
    .brand-user { display: none; }
    .contenu { padding: 18px 13px 74px; }   /* place pour la barre du bas */

    .barre-basse {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
        background: var(--carte); border-top: 1px solid var(--bordure);
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 0 -2px 12px rgba(16, 24, 40, .10);
    }
    /* Sur telephone, le symbole se suffit : a huit onglets les libelles se
       coupaient, passaient sur deux lignes et mangeaient le bas de l'ecran.
       Le texte reste dans le HTML pour les lecteurs d'ecran (aria-label). */
    .onglet-bas span { display: none; }
    .onglet-bas { padding: 11px 2px 10px; gap: 0; }
    .onglet-bas .symb { width: 24px; height: 24px; }
    .seance-carte { flex-direction: column; align-items: stretch; gap: 12px; }
    .seance-meta { justify-content: flex-start; }
    .entete-page { flex-direction: column; align-items: flex-start; gap: 12px; }
    table { font-size: 13px; }
}
/* Un tableau trop large doit défiler DANS sa carte, jamais pousser la page.
   `overflow-x` posé sur le <table> lui-même n'a aucun effet : c'est le
   conteneur qui doit défiler, et il lui faut `min-width: 0` pour accepter
   d'être plus étroit que son contenu à l'intérieur d'une grille ou d'un flex. */
.carte { min-width: 0; }
.carte:has(> .tableau), .carte:has(> table) { overflow-x: auto; }
/* Repli pour les navigateurs sans :has() — le défilement reste possible. */
@supports not selector(:has(*)) {
    .carte { overflow-x: auto; }
}
/* Pas de min-width ici : forcer max-content faisait deborder le tableau des
   qu'il etait dans une colonne etroite, coupant sa premiere colonne. Le
   defilement de la carte reste le filet de securite sur telephone. */
.tableau { width: 100%; }
.tableau td, .tableau th { overflow-wrap: anywhere; }

/* ── Vidéoprojection ─────────────────────────────────────────────────────────
   Projeté en 1080p ou plus, le contenu bloqué à 980 px se tasse au centre et
   le texte devient illisible depuis le fond de la salle. On élargit ET on
   agrandit : agrandir seul déborderait, élargir seul garderait un texte minuscule. */
@media (min-width: 1400px) {
    html { font-size: 17.5px; }
    .contenu { max-width: 1240px; padding: 30px 24px 60px; }
    .onglet { font-size: 15px; padding: 9px 14px; }
    .onglet .symb { width: 19px; height: 19px; }
    /* Tableau de bord : les chiffres cles sont ce qu'on lit de loin. */
    .kpi-valeur { font-size: 30px; }
    .kpi-label { font-size: 13px; }
}
@media (min-width: 1800px) {
    html { font-size: 19.5px; }
    .contenu { max-width: 1560px; padding: 36px 32px 72px; }
    .anneau { width: 78px; height: 78px; }
    .anneau-valeur { font-size: 20px; }
    .chiffre-fort { font-size: 23px; }
    .liste-seances { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .liste-seances .seance-carte { margin: 0; }
    .kpi-valeur { font-size: 38px; }
    .kpi { padding: 18px 22px; }
    /* Les tableaux de suivi sont lus de loin pendant le cours. */
    .tableau { font-size: 15.5px; }
    .tableau td, .tableau th { padding: 11px 14px; }
}

/* L'espace formateur porte 8 onglets : en dessous de 1450 px ils ne tiennent
   plus en toutes lettres (1038 px de large sur un ecran de 1265). Les libelles
   cedent alors la place aux seuls symboles — sauf celui de l'onglet actif, pour
   qu'on sache toujours ou l'on est. Le title prend le relais au survol. */
@media (max-width: 1450px) {
    .topbar-nav.dense .onglet { padding: 8px 10px; }
    .topbar-nav.dense .onglet span { display: none; }
    .topbar-nav.dense .onglet.actif span { display: inline; }
}
/* Filet de securite : la barre du haut ne pousse jamais la page en largeur. */
.topbar { flex-wrap: wrap; row-gap: 8px; }
.topbar-nav { flex-wrap: wrap; }

/* ── Page d'exercice : consigne en haut, code en gros bloc, notes en bas ────
   Une seule colonne : l'enonce tient en quelques lignes au-dessus de
   l'editeur, qui reste l'element dominant de la page. Les indices et
   contraintes (astuce, badges) viennent apres, pas avant. */
.exo-enonce-haut { margin-bottom: 16px; }
.exo-notes-bas {
    margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--bordure);
}
/* ── Coloration de la requete SQL ───────────────────────────────────────────
   Un textarea ne colore pas son contenu. On empile donc deux boites de MEME
   metrique : un <pre> qui porte les couleurs, et par-dessus le textarea au
   texte transparent, qui garde la saisie, la selection et le curseur.
   Toute difference de police, de taille, d'interligne ou de marge interne
   decale les lettres l'une par rapport a l'autre : ces proprietes sont donc
   ecrites une seule fois, pour les deux. */
.editeur-sql { position: relative; }
.editeur-sql > .editeur-calque,
.editeur-sql > textarea {
    font-family: Consolas, "Courier New", monospace;
    font-size: 13.5px;
    line-height: 1.5;
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    tab-size: 4;
    margin: 0;
    width: 100%;
    /* Le point critique de tout le montage. Des que le texte depasse, le champ
       affiche une barre de defilement et sa largeur utile tombe de 904 a
       889 px, alors que le calque garde 904. Les lignes longues se coupent
       alors a des endroits differents dans les deux couches : ce qu'on lit est
       decale de ce que le curseur vise, et cliquer tombe a cote. En reservant
       la gouttiere des deux cotes, la largeur utile devient identique, barre
       affichee ou non. */
    scrollbar-gutter: stable;
}
.editeur-sql > .editeur-calque {
    position: absolute; inset: 0;
    overflow: hidden;
    pointer-events: none;
    background: var(--fond);
    color: var(--texte);
}
.editeur-sql > textarea {
    position: relative;
    background: transparent;
    color: transparent;
    caret-color: var(--texte);
    border-color: var(--bordure);
    resize: vertical;
    display: block;
}
/* Le texte etant transparent, la selection ne se verrait pas sans un fond
   franc : on le prend opaque plutot que translucide. */
.editeur-sql > textarea::selection { background: rgba(0, 157, 224, .35); }

/* Boite invisible, de metrique identique : en y placant le texte qui precede
   le curseur, on lit directement ou celui-ci se trouve a l'ecran. C'est ce qui
   permet de poser la liste de propositions au bon endroit sans bibliotheque. */
.editeur-sql > .editeur-mesure {
    visibility: hidden;
    z-index: -1;
}
/* Le rappel du raccourci, sous le champ. */
.aide-saisie { font-size: 12px; margin: 6px 0 0; }
.aide-saisie kbd {
    font-family: inherit; font-size: 11px;
    padding: 1px 5px; border-radius: 4px;
    border: 1px solid var(--bordure); background: var(--fond);
    color: var(--texte);
}
.sql-propositions {
    position: absolute; z-index: 20;
    margin: 2px 0 0; padding: 4px;
    list-style: none;
    min-width: 160px; max-height: 220px; overflow-y: auto;
    background: var(--carte);
    border: 1px solid var(--bordure);
    border-radius: 8px;
    box-shadow: var(--ombre-survol);
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
}
.sql-propositions li {
    padding: 4px 10px; border-radius: 5px;
    color: var(--texte); white-space: nowrap; cursor: pointer;
}
.sql-propositions li.surligne,
.sql-propositions li:hover { background: var(--info-soft); color: var(--info-fort); }

/* Le champ de code grandit avec l'ecran : c'est la zone qu'on lit le plus, et
   le calque de coloration DOIT suivre EXACTEMENT la meme regle.

   Ce bloc est place APRES les regles de l'editeur, et ce n'est pas un hasard.
   Deux pieges s'enchainent :
     — ecrit « .editeur-calque » (0,1,0), le selecteur perdait face a
       « .editeur-sql > .editeur-calque » (0,2,0) tandis que « #code » (1,0,0)
       l'emportait : au-dela de 1400 px le champ passait a 15 px pendant que le
       calque restait a 13,5, et le decalage s'aggravait a chaque ligne ;
     — a specificite egale, c'est la regle la PLUS TARDIVE qui gagne : place
       avant, meme corrige, il aurait encore perdu.
   Le defaut ne se voyait qu'en plein ecran, la regle ne s'appliquant pas en
   dessous de 1400 px. La boite de mesure de l'autocompletion porte la meme
   classe, elle suit donc aussi. */
@media (min-width: 1400px) {
    #code,
    .editeur-sql > .editeur-calque { font-size: 15px; line-height: 1.65; }
    .enonce { font-size: 17px; }
}
@media (min-width: 1800px) {
    #code,
    .editeur-sql > .editeur-calque { font-size: 17px; }
    .enonce { font-size: 19px; }
}

.sql-mot { color: var(--sql-mot); font-weight: 600; }
.sql-fonction { color: var(--sql-fonction); }
.sql-table { color: var(--sql-table); font-weight: 600; }
.sql-colonne { color: var(--sql-colonne); }
.sql-texte { color: var(--sql-texte); }
.sql-nombre { color: var(--sql-nombre); }
.sql-commentaire { color: var(--sql-commentaire); font-style: italic; }

/* ── Marque : logo compact + nom ─────────────────────────────────────────────
   L'ancien logo embarquait une ligne de texte (« Code de formation 2 mille
   asbl ») illisible a la taille d'une barre de navigation. Le logo compact est
   lisible, et le nom est ecrit en vrai texte a cote. */
.logo-lien { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.logo { height: 34px; width: auto; display: block; }
.logo-nom {
    font-weight: 700; font-size: 16px; letter-spacing: -.02em; color: var(--marine);
}
/* Deux vraies variantes du logo, toutes deux a fond transparent : la bleue de
   la charte en clair, et une version blanche en sombre — ou seul le « 2 »
   garde sa couleur d'origine. Aucun filtre, aucune plaque derriere. */
.logo-nuit, .logo-login.logo-nuit { display: none; }
:root[data-theme="dark"] .logo-jour { display: none; }
:root[data-theme="dark"] .logo-nuit { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .logo-jour { display: none; }
    :root:not([data-theme="light"]) .logo-nuit { display: block; }
}
@media (max-width: 720px) { .logo-nom { display: none; } }

/* ── Decor de la page de connexion ───────────────────────────────────────────
   Du code du cours en filigrane, de part et d'autre du formulaire. Il ne
   s'affiche que la ou il y a de la place (>= 1200 px), reste tres en retrait,
   et disparait si l'utilisateur demande moins d'animations ou plus de
   contraste. Il n'apparait QUE sur la connexion : ailleurs l'ecran contient du
   vrai code, et un faux code derriere preterait a confusion. */
.decor-code { display: none; }
@media (min-width: 1200px) {
    .decor-code { display: block; position: fixed; inset: 0; z-index: 0;
                  pointer-events: none; user-select: none; overflow: hidden; }
    .decor-code pre {
        position: absolute; top: 50%; margin: 0;
        font-family: var(--mono, Consolas, monospace);
        font-size: 12.5px; line-height: 2.1; white-space: pre;
        color: var(--marine); opacity: .06;
    }
    .decor-code pre:first-child  { left: 3vw;  transform: translateY(-50%) rotate(-2deg); }
    .decor-code pre:last-child   { right: 3vw; transform: translateY(-50%) rotate(2deg);
                                   text-align: right; }
    .carte-login { position: relative; z-index: 1; }
}
/* En sombre, le bleu de la charte est plus clair : on baisse encore. */
:root[data-theme="dark"] .decor-code pre { opacity: .045; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .decor-code pre { opacity: .045; }
}
@media (prefers-reduced-motion: reduce), (prefers-contrast: more) {
    .decor-code { display: none; }
}

/* Logo de la carte de connexion : meme logo compact, en plus grand. */
.logo-login { height: 62px; width: auto; margin: 0 auto 14px; }
.logo-login.logo-jour { display: block; }
:root[data-theme="dark"] .logo-login.logo-jour { display: none; }
:root[data-theme="dark"] .logo-login.logo-nuit { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .logo-login.logo-jour { display: none; }
    :root:not([data-theme="light"]) .logo-login.logo-nuit { display: block; }
}

/* ── Fiches SQL ──────────────────────────────────────────────────────────────
   « Ou ca s'ecrit » porte l'information la plus utile des fiches SQL : l'ordre
   d'ecriture n'est pas l'ordre d'execution. On le distingue du reste. */
.memo-place {
    margin: 10px 0 0; padding: 10px 14px; font-size: 13.5px;
    background: var(--info-soft); color: var(--info-fort);
    border-radius: 8px; border-left: 3px solid var(--info-fort);
}
.memo-requete { margin-top: 14px; }
.memo-sql {
    margin: 0 0 10px; padding: 12px 14px; border-radius: 8px;
    background: #0F2137; color: #E6EDF6; overflow-x: auto;
    font-family: var(--mono, Consolas, monospace); font-size: 13px;
    line-height: 1.5; white-space: pre;
}
.memo-sql code { background: none; border: none; color: inherit; padding: 0; }
/* Fiches Projet : l'exemple est souvent une phrase (une carte, un message),
   pas une ligne de code : il revient à la ligne au lieu de défiler. */
.memo-exemple-projet { white-space: pre-wrap; }
.memo-aussi { margin: 4px 0 0; font-size: 13px; }
.memo-etapes { margin: 4px 0 0; padding-left: 22px; font-size: 13.5px; }
.memo-etapes li { margin: 3px 0; }
/* Le resultat est un vrai tableau : il defile dans son cadre, jamais la page. */
.memo-resultat { overflow-x: auto; border: 1px solid var(--bordure); border-radius: 8px; }
.memo-resultat .tableau { margin: 0; font-size: 13px; }
.memo-resultat .tableau th {
    background: var(--surface-2, var(--fond)); color: var(--muted);
    font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase;
}

/* ── Accès formateur en consultation ─────────────────────────────────────────
   Les collegues voient tout le suivi, mais ne pilotent pas le cours : un
   deblocage par megarde donnerait aux stagiaires un acces premature. */
.bandeau-consultation {
    margin: 0 0 16px; padding: 11px 16px; border-radius: 10px;
    background: var(--info-soft); color: var(--info-fort);
    font-size: 14px; border-left: 3px solid var(--info-fort);
}
/* Meme repere visuel que l'interrupteur, mais inerte. */
.interrupteur.fige { cursor: default; opacity: .75; }

/* ---- Mot de passe personnel ---- */
/* Retour affiche pendant la frappe : la couleur suit l'etat, le texte le dit
   aussi pour qui ne distingue pas le vert du rouge. */
.aide-mdp {
    margin: 8px 0 4px;
    font-size: 13px;
    color: var(--muted);
    min-height: 18px;
}
.aide-mdp.aide-ok { color: var(--ok-fort); font-weight: 600; }
.aide-mdp.aide-non { color: var(--danger-fort); font-weight: 600; }

/* Bouton inactif tant que les deux saisies ne concordent pas : on n'envoie pas
   un formulaire qu'on sait devoir refuser. */
.btn-principal:disabled,
.btn-principal:disabled:hover {
    opacity: 0.45;
    cursor: not-allowed;
    filter: none;
    transform: none;
    box-shadow: none;
}

/* Le nom dans la barre du haut mene au changement de mot de passe. */
.brand-user-lien { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; }

/* ── Statistiques : dynamique de classe et fiches individuelles ──────────────
   Ces pages se lisent en reunion, souvent videoprojetees : les chiffres sont
   gros, alignes en colonnes, et chaque tableau defile dans son cadre plutot
   que d'elargir la page. */

/* Les nombres se comparent de haut en bas : chiffres a chasse fixe et alignes
   a droite, sinon l'oeil ne peut pas les empiler. */
.tableau .num, .tableau th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.tableau-defilement { overflow-x: auto; }

/* Comparatif des deux classes, cote a cote. */
.comparatif {
    display: grid; gap: 18px; margin-top: 14px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.comparatif-col { border: 1px solid var(--bordure); border-radius: 10px; padding: 14px 16px; }
.comparatif-titre { font-weight: 700; letter-spacing: .04em; margin-bottom: 10px; }
.comparatif-liste { margin: 0; display: grid; gap: 9px; }
.comparatif-liste > div {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.comparatif-liste dt { color: var(--muted); font-size: 13.5px; }
.comparatif-liste dd {
    margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums;
}
.comparatif-liste dd .muted { font-weight: 400; font-size: 12.5px; }

/* Chiffres cles d'une fiche : une grille de tuiles, pas des cartes empilees.
   Chaque tuile porte sa propre bordure — un fond commun laisserait un vide
   visible quand la derniere rangee n'est pas complete. */
.fiche-chiffres {
    display: grid; gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    margin-bottom: 20px;
}
.fiche-chiffres > div {
    border: 1px solid var(--bordure); border-radius: 10px; padding: 12px 14px;
}
.fiche-chiffres .k { font-size: 12px; color: var(--muted); display: block; }
.fiche-chiffres .v {
    font-size: 25px; font-weight: 700; display: block; margin-top: 2px;
    font-variant-numeric: tabular-nums; line-height: 1.15;
}
.fiche-chiffres .c { font-size: 12.5px; color: var(--muted); display: block; margin-top: 2px; }
.fiche-chiffres.compact { margin: 14px 0 0; }
.fiche-chiffres.compact .v { font-size: 21px; }

/* La phrase qui qualifie la facon de travailler ouvre la carte : c'est la
   lecture, les chiffres en dessous ne font que l'etayer. */
.phrase-rythme { font-size: 17px; margin: 6px 0 0; }
.sous-titre { font-size: 15px; margin: 20px 0 8px; }

.encadre-conseil {
    margin: 6px 0 14px; padding: 11px 15px; border-radius: 8px;
    background: var(--info-soft); color: var(--info-fort);
    border-left: 3px solid var(--info-fort);
}

/* Barre de proportion dans une cellule : la longueur se compare d'un coup
   d'oeil la ou le pourcentage demande une lecture. */
.cellule-barre { white-space: nowrap; }
.barre-piste {
    display: inline-block; width: 110px; height: 9px; border-radius: 5px;
    background: var(--bordure); vertical-align: middle; margin-right: 8px;
    overflow: hidden;
}
.barre { display: block; height: 100%; background: var(--cyan); border-radius: 5px; }

/* Toute la ligne mene a la fiche, pas seulement le nom. */
.ligne-cliquable { cursor: pointer; }
.ligne-cliquable:hover { background: var(--survol, rgba(127, 127, 127, .08)); }
.lien-stagiaire { color: inherit; text-decoration: none; font-weight: 600; }
.ligne-cliquable:hover .lien-stagiaire { color: var(--cyan); }

/* ── Tuiles d'indicateurs avec repere de classe ──────────────────────────────
   Chaque tuile porte sa valeur, la mediane du groupe et une jauge de position.
   La couleur ne sert qu'aux indicateurs qui ont un sens pedagogique : elle
   double toujours un libelle, jamais seule. */
.kpi-grille {
    display: grid; gap: 10px; margin-bottom: 8px;
    grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
}
.kpi {
    border: 1px solid var(--bordure); border-left: 3px solid var(--bordure);
    border-radius: 10px; padding: 11px 14px 13px;
}
.kpi-libelle { font-size: 12px; color: var(--muted); display: block; }
.kpi-valeur {
    font-size: 24px; font-weight: 700; display: block; margin-top: 1px;
    font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.2;
}
.kpi-repere { font-size: 12px; color: var(--muted); display: block; }
.kpi-statut { font-size: 12px; display: block; margin-top: 5px; }

/* ── Echelle a cinq niveaux ──────────────────────────────────────────────────
   Le SENS de l'ecart est porte par la teinte, son AMPLEUR par l'intensite :
   un fond teinte ne s'allume qu'aux deux extremes, si bien qu'un grand ecart
   se repere sans rien lire. Le libelle dit « nettement » dans ces cas-la :
   la couleur ne porte jamais l'information seule. */
.niv-tres-haut {
    border-left-color: var(--niv-tres-haut); border-color: var(--niv-tres-haut);
    background: var(--niv-haut-fond);
}
.niv-tres-haut .kpi-statut { color: var(--niv-tres-haut); font-weight: 700; }
.niv-tres-haut .jauge-curseur { background: var(--niv-tres-haut); }

.niv-haut { border-left-color: var(--niv-haut); }
.niv-haut .kpi-statut { color: var(--niv-haut); font-weight: 600; }
.niv-haut .jauge-curseur { background: var(--niv-haut); }

.niv-norme .kpi-statut { color: var(--muted); }
/* Indicateur sans direction pedagogique (temps, hors cours) tant que le
   contexte ne le rend pas lisible : volontairement sans couleur. */
.niv-neutre .kpi-statut { color: var(--muted); }

.niv-bas { border-left-color: var(--niv-bas); }
.niv-bas .kpi-statut { color: var(--niv-bas); font-weight: 600; }
.niv-bas .jauge-curseur { background: var(--niv-bas); }

.niv-tres-bas, .niv-alerte {
    border-left-color: var(--niv-tres-bas); border-color: var(--niv-tres-bas);
    background: var(--niv-bas-fond);
}
.niv-tres-bas .kpi-statut, .niv-alerte .kpi-statut {
    color: var(--niv-tres-bas); font-weight: 700;
}
.niv-tres-bas .jauge-curseur, .niv-alerte .jauge-curseur { background: var(--niv-tres-bas); }
.niv-alerte .kpi-libelle, .niv-alerte .kpi-repere { color: var(--niv-tres-bas); opacity: .85; }

/* Jauge : le curseur se place entre le minimum et le maximum du groupe, le
   trait vertical marque la mediane. */
.jauge {
    position: relative; display: block; height: 6px; margin-top: 9px;
    background: var(--bordure); border-radius: 3px;
}
.jauge-mediane {
    position: absolute; top: -2px; width: 2px; height: 10px;
    background: var(--muted); transform: translateX(-1px); border-radius: 1px;
}
.jauge-curseur {
    position: absolute; top: -3px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--cyan); border: 2px solid var(--carte);
    transform: translateX(-6px);
}
.kpi-haut .jauge-curseur { background: var(--ok-fort); }
.kpi-bas .jauge-curseur { background: var(--warn-fort); }

/* ── Barre empilee de couverture du programme ── */
.barre-empilee {
    display: flex; height: 22px; border-radius: 6px; overflow: hidden;
    background: var(--bordure); margin-top: 14px;
}
.barre-empilee > span { display: block; height: 100%; }
.seg-reussis { background: var(--cyan); }
.seg-encours { background: var(--ambre); }
.seg-reste   { background: var(--bordure); }
.barre-legende {
    display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 10px; font-size: 13.5px;
}
.pastille {
    display: inline-block; width: 11px; height: 11px; border-radius: 3px;
    margin-right: 7px; vertical-align: baseline;
}
i.pastille.seg-reste { border: 1px solid var(--muted); }

/* ── Frise des seances : jusqu'ou il est arrive, sans le detail ── */
.frise-seances { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.frise-case {
    position: relative; min-width: 52px; padding: 6px 8px 7px; border-radius: 8px;
    border: 1px solid var(--bordure); text-align: center; overflow: hidden;
}
/* Le remplissage traduit le taux de reussite : la case se lit sans lire le chiffre. */
.frise-case::before {
    content: ""; position: absolute; inset: auto 0 0 0; height: var(--taux, 0%);
    background: var(--info-soft);
}
.frise-case i, .frise-case b { position: relative; }
.frise-case i { font-style: normal; font-size: 10.5px; color: var(--muted); display: block; }
.frise-case b { font-size: 14px; font-variant-numeric: tabular-nums; }
/* Seance ouverte mais jamais abordee : le trait interrompu la distingue d'une
   seance commencee et laissee a 0 %. */
.frise-vide { border-style: dashed; }
.frise-vide b { color: var(--muted); font-weight: 400; }

/* ── Face a face des deux classes ────────────────────────────────────────────
   Presentation en feuille de match : les deux valeurs se regardent, et la
   cesure de la barre dit laquelle mene. On lit la position du partage, pas
   deux nombres qu'il faudrait comparer de tete. */
.duel { margin-top: 16px; }
.duel-entete {
    display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin-bottom: 2px;
}
.duel-equipe {
    background: var(--fond); padding: 12px 16px; display: flex;
    flex-direction: column; gap: 2px;
}
.duel-g { border-radius: 10px 0 0 0; }
.duel-d { border-radius: 0 10px 0 0; align-items: flex-end; }
.duel-nom { font-family: inherit; font-size: 17px; font-weight: 700; letter-spacing: .02em; }
.duel-effectif { font-size: 12.5px; color: var(--muted); }

/* La ligne vedette : l'indicateur qui resume la comparaison. */
.duel-vedette {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    gap: 18px; padding: 14px 18px; background: var(--carte);
    border: 1px solid var(--bordure); border-radius: 0 0 4px 4px; margin-bottom: 10px;
}
.duel-score {
    font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums;
    letter-spacing: -.02em; color: var(--muted);
}
.duel-vedette :last-child { text-align: right; }
.duel-score.gagne { color: var(--texte); }
.duel-vedette-libelle {
    text-align: center; font-size: 12.5px; text-transform: uppercase;
    letter-spacing: .07em; color: var(--muted);
}
.duel-vedette-libelle i {
    display: block; font-style: normal; text-transform: none; letter-spacing: 0;
    font-size: 12px; opacity: .8;
}

.duel-lignes { display: grid; gap: 14px; }
/* Deux rangees : le libelle en haut, la jauge et ses deux valeurs en dessous.
   Sortir le libelle de la barre allege chaque ligne — au centre, il coupait la
   jauge en deux et reclamait un fond opaque pour rester lisible. */
.duel-ligne {
    display: grid; grid-template-columns: 62px 1fr 62px;
    grid-template-areas: "titre titre titre" "valg barre vald";
    align-items: center; gap: 5px 10px;
}
.duel-titre {
    grid-area: titre; text-align: center;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .07em; color: var(--muted);
}
.duel-titre i {
    font-style: normal; font-weight: 500; text-transform: none;
    letter-spacing: 0; opacity: .8; margin-left: 6px;
}
.duel-val-g { grid-area: valg; }
.duel-barre { grid-area: barre; }
.duel-val-d { grid-area: vald; }
/* La cesure suffit rarement : quand les deux valeurs sont proches (4,50
   contre 4,58), le partage reste au milieu. C'est honnete — il n'y a pas
   d'ecart reel — mais il faut alors que le camp qui mene se voie autrement.
   D'ou la valeur gagnante en gras et en couleur de texte pleine. */
.duel-val {
    font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums;
    color: var(--muted);
}
.duel-val.gagne { color: var(--texte); font-weight: 700; }
.duel-val-d { text-align: right; }
/* La barre : deux parts qui se touchent, le libelle pose par-dessus. */
.duel-barre {
    position: relative; display: flex; height: 16px; border-radius: 8px;
    overflow: hidden; background: var(--fond);
    box-shadow: inset 0 0 0 1px var(--bordure);
}
/* Deux jauges independantes, pas un partage. Chaque moitie vaut l'echelle
   entiere (100 % pour un pourcentage, la plus haute des deux valeurs sinon) et
   se remplit de sa propre valeur DEPUIS LE CENTRE : les deux longueurs partent
   d'une meme base, donc se comparent d'un coup d'oeil. La part vide reste
   visible a l'exterieur — c'est elle qui dit ce qu'il manque.
   Chaque classe garde sa teinte sur toutes les lignes ; les deux bleus sont
   assez distincts pour se separer, assez sombres pour porter du texte blanc. */
.duel-moitie { position: relative; display: block; width: 50%; height: 100%; }
.duel-remplissage { position: absolute; top: 0; bottom: 0; display: block; }
/* La jauge de gauche croit vers la gauche, celle de droite vers la droite. */
.duel-moitie-g .duel-remplissage { right: 0; }
.duel-moitie-d .duel-remplissage { left: 0; }
.duel-remplissage.part-g { background: var(--duel-g); }
.duel-remplissage.part-d { background: var(--duel-d); }
/* Un trait au centre marque la base commune des deux jauges. */
.duel-moitie-g { border-right: 1px solid var(--bordure); }
.duel-pastille {
    display: inline-block; width: 10px; height: 10px; border-radius: 3px;
    margin: 0 7px; vertical-align: baseline;
}
.duel-pastille.part-g { background: var(--duel-g); }
.duel-pastille.part-d { background: var(--duel-d); }
@media (max-width: 620px) {
    .duel-ligne { grid-template-columns: 46px 1fr 46px; gap: 5px 6px; }
    .duel-titre { font-size: 10px; }
    .duel-score { font-size: 24px; }
}

/* ── Lecture pedagogique ─────────────────────────────────────────────────────
   Un bloc de texte, pas un tableau de bord : c'est ce que le formateur lira
   avant l'entretien. Le liseré marine le distingue des cartes de chiffres
   sans en faire une alerte. */
.carte-lecture { border-left: 3px solid var(--marine); }
.lecture-portrait { font-size: 16.5px; line-height: 1.55; margin: 4px 0 18px; }
.lecture-portrait strong { color: var(--marine); }

/* Ce qui doit alerter : place AVANT les forces et le point de travail, parce
   qu'un desengagement prime sur n'importe quelle question technique. */
.lecture-alertes {
    background: var(--danger-soft); border-left: 3px solid var(--danger-fort);
    border-radius: 10px; padding: 13px 16px; margin-bottom: 16px;
}
.lecture-alertes h3 {
    font-size: 13px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--danger-fort); margin: 0 0 6px;
}
.lecture-alertes ul { margin: 0; padding-left: 18px; font-size: 14.5px; line-height: 1.6; }

.lecture-grille {
    display: grid; gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.lecture-part {
    border: 1px solid var(--bordure); border-radius: 10px; padding: 14px 16px;
}
.lecture-part h3 {
    font-size: 13px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); margin: 0 0 8px;
}
.lecture-part p { margin: 0 0 8px; font-size: 14.5px; line-height: 1.55; }
.lecture-part p:last-child { margin-bottom: 0; }
.lecture-forces { border-left: 3px solid var(--ok-fort); }
.lecture-forces ul { margin: 0; padding-left: 18px; font-size: 14.5px; line-height: 1.6; }
.lecture-travail { border-left: 3px solid var(--ambre); }
.lecture-chiffre { font-variant-numeric: tabular-nums; font-weight: 600; }
.lecture-alerte { color: var(--warn-fort); font-weight: 600; }
.lecture-exemple { color: var(--muted); }
/* L'action se detache : c'est la seule ligne qui demande de faire quelque chose. */
.lecture-action {
    background: var(--info-soft); color: var(--info-fort);
    padding: 9px 12px; border-radius: 8px; font-weight: 500;
}
.lecture-tendance, .lecture-suite {
    margin: 16px 0 0; font-size: 14.5px; line-height: 1.55;
    padding-left: 12px; border-left: 2px solid var(--bordure);
}
.tendance-hausse { border-left-color: var(--ok-fort); }
.tendance-baisse { border-left-color: var(--warn-fort); }
.lecture-suite { border-left-color: var(--marine); }

/* ── Barres de classement ── */
.barres-classe { display: grid; gap: 5px; margin-top: 14px; }
.barre-ligne {
    display: grid; grid-template-columns: 132px 1fr 40px; gap: 10px; align-items: center;
    font-size: 13.5px;
}
.barre-nom { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre-piste-longue {
    position: relative; height: 14px; background: var(--bordure); border-radius: 4px;
}
.barre-valeur { display: block; height: 100%; background: var(--cyan); border-radius: 4px; }
.barre-mediane {
    position: absolute; top: -3px; width: 2px; height: 20px;
    background: var(--muted); border-radius: 1px;
}
.barre-chiffre { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.barre-actif .barre-nom { font-weight: 700; color: var(--cyan); }
.barre-actif .barre-valeur { background: var(--marine); }

/* ── Camembert ──────────────────────────────────────────────────────────────
   Meme technique que l'anneau de progression : des arcs traces au
   stroke-dasharray, sans calcul de chemin SVG. Une seule teinte declinee du
   fonce au clair : ces familles sont les morceaux d'un total, pas des
   categories opposees — et un degrade se lit sans distinguer les couleurs. */
.donut-bloc {
    display: grid; gap: 20px; align-items: center; margin-top: 14px;
    grid-template-columns: minmax(0, 170px) minmax(0, 1fr);
}
@media (max-width: 620px) { .donut-bloc { grid-template-columns: 1fr; } }
.donut { position: relative; width: 168px; margin: 0 auto; }
.donut svg { width: 100%; height: auto; transform: rotate(-90deg); }
/* Anneau fin : le trou central porte le total, et les arcs restent des arcs
   plutot qu'un disque ou les tranches se touchent sur toute leur surface. */
.donut circle { fill: none; stroke-width: 15; }
.donut-fond { stroke: var(--bordure); }
/* Un filet de la couleur du fond separe les tranches voisines. */
.donut-part { stroke-linecap: butt; }
.donut-centre {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; font-size: 24px; font-weight: 700;
    font-variant-numeric: tabular-nums; line-height: 1.05; letter-spacing: -.02em;
}
.donut-centre i { font-style: normal; font-size: 11px; color: var(--muted); font-weight: 400; }

.donut-legende { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 9px; }
.donut-legende li {
    display: grid; grid-template-columns: 16px 1fr auto; align-items: center;
    gap: 4px; font-size: 13.5px;
}
.donut-legende span { color: var(--muted); }
.donut-legende b { font-variant-numeric: tabular-nums; font-weight: 600; }
/* Pastille ronde de 10 px, comme un point de legende : elle nomme la couleur
   sans peser autant qu'un carre plein. */
.donut-legende .pastille { width: 10px; height: 10px; border-radius: 50%; margin: 0; }

/* Declinaison d'une meme teinte, du plus gros morceau au plus petit. Les
   valeurs vivent dans les variables du theme : les trois etats (clair, sombre
   choisi, sombre systeme) sont couverts sans selecteur supplementaire. */
.part-0 { stroke: var(--part-0); background: var(--part-0); }
.part-1 { stroke: var(--part-1); background: var(--part-1); }
.part-2 { stroke: var(--part-2); background: var(--part-2); }
.part-3 { stroke: var(--part-3); background: var(--part-3); }
.part-4 { stroke: var(--part-4); background: var(--part-4); }
.part-5 { stroke: var(--part-5); background: var(--part-5); }
.part-6 { stroke: var(--part-6); background: var(--part-6); }

/* Ecart a la classe : le signe porte l'information, la couleur l'accentue. */
.ecart { font-weight: 600; }
.ecart-haut { color: var(--warn-fort); }
.ecart-bas { color: var(--ok-fort); }

/* Deux blocs cote a cote quand l'ecran le permet. */
.grille-stats {
    display: grid; gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* ── Mise en mouvement des statistiques ─────────────────────────────────────
   Principe : la page est LISIBLE des le premier rendu. Chaque animation part
   d'un etat de depart et se termine sur la valeur que porte deja le HTML —
   rien n'attend un declencheur, rien ne reste invisible si le script echoue.
   Toutes ces regles sautent si le systeme demande des animations reduites
   (voir le bloc prefers-reduced-motion plus bas). */

/* Les courbes se tracent. pathLength="1" normalise la longueur du chemin :
   un seul jeu de valeurs marche donc quelle que soit la courbe. */
@keyframes trace-courbe { from { stroke-dashoffset: 1; } }
.courbe-trace {
    stroke-dasharray: 1;
    animation: trace-courbe 1.1s cubic-bezier(.33, 1, .68, 1) both;
}
/* Les points n'apparaissent qu'une fois le trait passe sur eux. */
@keyframes surgir { from { opacity: 0; transform: scale(0); } }
.courbe-point { transform-box: fill-box; transform-origin: center;
    animation: surgir .4s ease-out .85s both; }
.courbe-fin { transform-box: fill-box; transform-origin: center;
    animation: surgir .5s cubic-bezier(.34, 1.56, .64, 1) 1.05s both; }
.graphe-etiquette { animation: apparaitre .5s ease-out 1.15s both; }

/* Les arcs du camembert se remplissent, l'un apres l'autre. Le second jeu de
   valeurs du stroke-dasharray est celui porte par l'element : l'animation
   part de zero et rejoint la valeur reelle sans que le CSS ait a la connaitre. */
@keyframes remplir-arc { from { stroke-dasharray: 0 264; } }
.donut-part { animation: remplir-arc .75s cubic-bezier(.22, 1, .36, 1) both; }
.donut-part:nth-of-type(2) { animation-delay: .05s; }
.donut-part:nth-of-type(3) { animation-delay: .15s; }
.donut-part:nth-of-type(4) { animation-delay: .25s; }
.donut-part:nth-of-type(5) { animation-delay: .35s; }
.donut-part:nth-of-type(6) { animation-delay: .45s; }
.donut-part:nth-of-type(7) { animation-delay: .55s; }
.donut-centre { animation: apparaitre .5s ease-out .5s both; }
.donut-legende li { animation: glisser .45s ease-out both; }
.donut-legende li:nth-child(2) { animation-delay: .06s; }
.donut-legende li:nth-child(3) { animation-delay: .12s; }
.donut-legende li:nth-child(4) { animation-delay: .18s; }
.donut-legende li:nth-child(5) { animation-delay: .24s; }
.donut-legende li:nth-child(6) { animation-delay: .30s; }

/* Les barres poussent depuis la gauche. Le retard de chaque ligne est pose
   dans le gabarit : le classement se construit de haut en bas. */
@keyframes pousser { from { width: 0; } }

/* Le face-a-face : chaque jauge pousse depuis le centre vers son bord, ligne
   apres ligne. C'est le mouvement que decrit la donnee elle-meme — deux
   jauges qui partent d'une base commune — et non un effet ajoute par-dessus. */
.duel-remplissage { animation: pousser .65s cubic-bezier(.22, 1, .36, 1) both; }
.barre-valeur { animation: pousser .7s cubic-bezier(.22, 1, .36, 1) both; }
.barre-empilee > span { animation: pousser .8s cubic-bezier(.22, 1, .36, 1) both; }
.barre-empilee > span:nth-child(2) { animation-delay: .15s; }

/* Les lignes du tableau arrivent du premier au dernier stagiaire. Le retard de
   chaque ligne est pose dans le gabarit : la liste se remplit sous les yeux
   au lieu de tomber d'un bloc. */
@keyframes ligne-entre { from { opacity: 0; transform: translateY(7px); } }
.ligne-animee { animation: ligne-entre .4s ease-out both; }

/* Les tuiles d'indicateurs arrivent en cascade, curseur de jauge en dernier. */
@keyframes apparaitre { from { opacity: 0; } }
@keyframes glisser { from { opacity: 0; transform: translateY(10px); } }

/* Le retard de chaque tuile est declare une seule fois, dans une variable :
   la tuile ET le curseur de sa jauge s'en servent, donc le curseur se pose
   toujours apres SA tuile, jamais apres une autre. */
.kpi:nth-child(1) { --retard: 0s; }
.kpi:nth-child(2) { --retard: .10s; }
.kpi:nth-child(3) { --retard: .20s; }
.kpi:nth-child(4) { --retard: .30s; }
.kpi:nth-child(5) { --retard: .40s; }
.kpi:nth-child(6) { --retard: .50s; }
.kpi:nth-child(7) { --retard: .60s; }
.kpi:nth-child(8) { --retard: .70s; }
.kpi:nth-child(9) { --retard: .80s; }
.kpi { animation: glisser .6s ease-out var(--retard, 0s) both; }

@keyframes poser-curseur { from { transform: translateX(-6px) scale(0); } }
.jauge-curseur {
    animation: poser-curseur .55s cubic-bezier(.34, 1.56, .64, 1)
               calc(var(--retard, 0s) + .35s) both;
}
/* Les cases de la frise se remplissent de gauche a droite. */
@keyframes monter-frise { from { height: 0; } }
.frise-case::before { animation: monter-frise .6s ease-out .2s both; }

/* ── Lecture d'une semaine : trait vertical + infobulle ── */
.survol-trait {
    stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3;
    opacity: 0; transition: opacity .12s;
}
.survol-bande.actif .survol-trait { opacity: .6; }
.survol-bande rect { cursor: crosshair; }
.graphe-defilement { position: relative; }
.graphe-bulle {
    position: absolute; z-index: 5; pointer-events: none;
    background: var(--texte); color: var(--carte);
    padding: 9px 12px; border-radius: 8px; font-size: 13px; line-height: 1.5;
    box-shadow: var(--ombre-survol); min-width: 132px;
}
.graphe-bulle strong { display: block; margin-bottom: 4px; font-size: 12px; opacity: .75; }
.graphe-bulle span { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 6px;
    align-items: center; font-variant-numeric: tabular-nums; }
.graphe-bulle b { font-weight: 700; text-align: right; }
.graphe-bulle em { font-style: normal; opacity: .7; font-size: 12px; min-width: 32px;
    text-align: right; }
.graphe-bulle i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.pastille-web1 { background: var(--cyan); }
.pastille-web2 { background: var(--ambre); }

/* ── Declenchement au defilement ─────────────────────────────────────────────
   Un bloc n'entre en scene qu'au moment ou il arrive a l'ecran : sinon tout se
   joue en haut de page et l'effet est perdu avant d'etre vu.

   La classe `js-anim` n'est posee QUE par le script, et seulement si le
   navigateur sait observer l'arrivee a l'ecran. Sans script, sans observateur
   ou en cas d'erreur, aucune de ces regles ne s'applique : la page reste
   entierement lisible. Le script leve de toute facon le rideau au bout de
   quatre secondes, quoi qu'il arrive. */
/* Pas de transition sur l'etat d'attente : le bloc NAIT invisible, il ne
   s'efface pas sous les yeux. Seule l'entree en scene est animee. */
html.js-anim [data-anim] { opacity: 0; }
html.js-anim [data-anim].vu { opacity: 1; transition: opacity .45s ease-out; }
/* Les animations internes patientent sur leur premiere image (fill-mode both)
   au lieu de se derouler dans le vide. */
html.js-anim [data-anim]:not(.vu) * { animation-play-state: paused; }

/* ── Survol d'un camembert : la tranche et sa ligne de legende ensemble ── */
.donut-part { transition: stroke-width .18s ease, opacity .18s ease; cursor: pointer; }
.donut.survole .donut-part { opacity: .28; }
.donut.survole .donut-part.actif { opacity: 1; stroke-width: 20px; }
.donut-legende li { transition: background .15s ease; border-radius: 6px;
    padding: 2px 6px; margin: -2px -6px; cursor: default; }
.donut-legende li.actif { background: var(--info-soft); }
.donut-legende li.actif span, .donut-legende li.actif b { color: var(--texte); }
tr.actif { background: var(--info-soft); }
tr.actif td { font-weight: 600; }

/* Le mouvement est un confort, jamais un passage oblige : qui demande des
   animations reduites recoit la page directement dans son etat final. */
@media (prefers-reduced-motion: reduce) {
    /* Ce reglage demande de ne pas DEPLACER le contenu a l'ecran — glissements,
       zooms, parallaxe. Il ne demande pas de figer la page. L'ancien bloc
       coupait pourtant TOUTES les animations, et c'est ce qui les rendait
       inactives sur les postes du CF2M : Windows y a les « effets d'animation »
       desactives, comme souvent sur un parc gere, en mode « meilleures
       performances » ou en bureau a distance. Le navigateur transmet alors ce
       reglage au site, qui obeissait en ne jouant plus rien.
       On ne retire donc que le deplacement : les quatre effets qui glissent
       (6 a 10 px) ou grossissent deviennent de simples fondus, et perdent leur
       rebond. Les courbes qui se tracent, les barres qui se remplissent, les
       arcs du camembert et les compteurs restent : rien ne bouge a l'ecran. */
    @keyframes surgir { from { opacity: 0; } }
    @keyframes ligne-entre { from { opacity: 0; } }
    @keyframes glisser { from { opacity: 0; } }
    @keyframes poser-curseur { from { opacity: 0; } }
    .courbe-fin, .jauge-curseur { animation-timing-function: ease-out; }
}

/* Graphiques : le SVG s'adapte en largeur, et defile sur telephone plutot que
   de se tasser au point d'etre illisible. */
.graphe-defilement { overflow-x: auto; margin-top: 14px; }
.graphe { display: block; width: 100%; min-width: 560px; height: auto; }
.graphe-axe { fill: var(--muted); font-size: 11px; font-family: Consolas, monospace; }
.graphe-etiquette { font-size: 12.5px; font-weight: 600; }
.brand-user-lien:hover { color: var(--cyan); }

/* ── Schema de la boutique, sur la page d'exercice SQL ───────────────────────
   Ecrire du SQL sans les noms de colonnes revient a travailler de memoire.
   Le panneau se replie : il doit rester a portee sans pousser l'editeur hors
   de l'ecran. En grille, les sept tables tiennent en un coup d'oeil. */
.schema {
    margin-top: 18px; border: 1px solid var(--bordure); border-radius: 12px;
    background: var(--carte);
}
.schema > summary { padding: 9px 16px; }
.schema > summary {
    cursor: pointer; padding: 12px 16px; list-style: none;
    display: flex; flex-direction: column; gap: 1px;
}
.schema > summary::-webkit-details-marker { display: none; }
/* Un chevron qui pivote : l'etat ouvert/ferme doit se voir sans lire. */
.schema > summary::before {
    content: "▸"; position: absolute; margin-left: -13px; color: var(--muted);
    transition: transform .18s ease; display: inline-block;
}
.schema[open] > summary::before { transform: rotate(90deg); }
.schema > summary:hover .schema-titre { color: var(--cyan); }
.schema-titre { font-weight: 600; font-size: 15px; }
.schema-sous { font-size: 12.5px; color: var(--muted); }

/* Aucune boite ne defile dans son coin : chaque table s'affiche en entier et
   c'est la PAGE qu'on fait defiler. Une table tronquee qui reclame son propre
   defilement empeche de voir d'un coup d'oeil ce qu'elle contient — or c'est
   exactement ce qu'on vient y chercher en ecrivant une requete. */
.schema-tables {
    display: grid; gap: 10px; padding: 0 16px 14px;
    grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
    align-items: start;
}
.schema-table {
    border: 1px solid var(--bordure); border-radius: 9px; padding: 9px 11px;
    background: var(--fond);
}
.schema-nom {
    font-family: var(--mono, Consolas, monospace); font-weight: 700; font-size: 13.5px;
    color: var(--marine); display: flex; justify-content: space-between;
    align-items: baseline; gap: 8px; margin-bottom: 5px;
}
.schema-nom .muted { font-family: inherit; font-size: 11px; font-weight: 400; }
.schema-colonnes { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.schema-colonnes li {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px;
    font-size: 12.5px; line-height: 1.5;
}
.schema-colonnes code {
    font-size: 12.5px; background: none; padding: 0; color: var(--texte);
}
.col-cle code { font-weight: 700; }
.schema-type { color: var(--muted); font-size: 11px; }
.schema-marque {
    font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
    background: var(--info-soft); color: var(--info-fort);
    padding: 0 5px; border-radius: 4px;
}
/* Le lien vers une autre table : c'est lui qui permet d'ecrire une jointure. */
.schema-lien {
    font-family: var(--mono, Consolas, monospace); font-size: 11px;
    color: var(--marine); background: var(--info-soft);
    padding: 0 5px; border-radius: 4px;
}
/* Les valeurs reelles d'une colonne enumeree : 'paid' et non 'paye'. */
.schema-valeurs { flex-basis: 100%; font-size: 11.5px; color: var(--muted); }
.schema-valeurs b {
    font-weight: 600; color: var(--ok-fort); background: var(--ok-soft);
    padding: 0 4px; border-radius: 3px;
}
@media (max-width: 620px) {
    .schema-tables { grid-template-columns: 1fr; }
}

/* ── Quiz en direct ──────────────────────────────────────────────────────────
   Les quatre réponses portent une couleur ET une forme : triangle, losange,
   cercle, carré. Rouge et vert se confondent pour un daltonien, un triangle et
   un carré jamais.
   Contrastes du texte sur tuile : rouge 5,62 · bleu 5,75 · vert 5,13 ·
   jaune 1,82. Le blanc sur jaune est un CHOIX du formateur, fait en
   connaissance de cause : il garde l'aspect de Kahoot que les stagiaires
   connaissent. Le texte foncé (9,57) avait été essayé puis écarté.
   Graisses plafonnées à 700 : Inter n'est chargée que jusqu'à 700 (base.html),
   et 800 faisait fabriquer un faux gras qui bavait sur les chiffres. */
.quiz-scene { position: relative; }
.quiz-scene:fullscreen {
    background: var(--fond-page); padding: 28px 40px; overflow: auto;
}
.quiz-barre {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; margin-bottom: 18px;
}
.quiz-titre { font-weight: 600; color: var(--muted); }
.quiz-bouton-large { display: inline-block; margin-top: 22px; padding: 12px 28px; font-size: 17px; }
/* Commandes de l'animateur : toujours en haut, toujours dans le même ordre.
   « Suivant » est le plus large, pour être trouvé du premier coup d'œil. */
.quiz-barre { flex-wrap: wrap; }
.quiz-commandes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quiz-commandes form { margin: 0; }
.quiz-suivant { padding: 10px 28px; font-size: 16px; min-width: 150px; }
.quiz-suivant:disabled { cursor: default; }
.quiz-scene:fullscreen .quiz-barre {
    position: sticky; top: 0; z-index: 2; background: var(--fond-page); padding-block: 6px;
}
.quiz-message {
    margin: 0 0 14px; padding: 8px 12px; border-radius: 8px;
    background: var(--danger-soft); color: var(--danger-fort); font-weight: 600;
}
.quiz-double {
    background: var(--degrade); color: #fff; border-radius: 6px;
    padding: 2px 10px; font-weight: 700; font-size: 14px;
}

/* Salle d'attente */
.quiz-attente { text-align: center; }
.quiz-consigne { font-size: 20px; color: var(--muted); margin: 0; }
.quiz-pin {
    font-size: clamp(56px, 11vw, 132px); font-weight: 700; letter-spacing: .06em;
    margin: 8px 0 4px; color: var(--accent); font-variant-numeric: tabular-nums;
}
.quiz-pin-petit { font-variant-numeric: tabular-nums; letter-spacing: .05em; }
.quiz-compte { font-size: 18px; font-weight: 600; }
.quiz-joueurs {
    list-style: none; padding: 0; margin: 14px auto 0; max-width: 900px;
    display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.quiz-joueurs li {
    background: var(--carte); border: 1px solid var(--bordure);
    border-radius: 999px; padding: 6px 14px; font-weight: 600;
}

/* Question */
.quiz-entete {
    display: flex; align-items: center; gap: 16px; margin-bottom: 10px;
}
.quiz-numero { font-weight: 700; color: var(--muted); }
.quiz-nb-reponses { margin-left: auto; color: var(--muted); font-weight: 600; }
.quiz-chrono {
    min-width: 64px; height: 64px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums;
    background: var(--accent); color: var(--sur-accent);
}
.quiz-chrono:empty { display: none; }
.quiz-chrono.urgent { background: var(--danger-fort); color: #fff; }
.quiz-question {
    font-size: clamp(22px, 3.2vw, 38px); line-height: 1.3;
    text-align: center; margin: 18px auto 24px; max-width: 1100px;
}

.quiz-grille {
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.quiz-tuile {
    position: relative;
    display: flex; align-items: center; gap: 16px;
    min-height: 96px; padding: 16px 20px; border: none; border-radius: 10px;
    font-size: clamp(17px, 2vw, 24px); font-weight: 600; text-align: left;
    color: #fff; font-family: inherit;
    transition: opacity .25s ease, transform .15s ease;
}
.quiz-tuile.choix-0 { background: #c62828; }
.quiz-tuile.choix-1 { background: #1565c0; }
.quiz-tuile.choix-2 { background: #f2b705; }
.quiz-tuile.choix-3 { background: #2e7d32; }
.quiz-forme { width: 34px; height: 34px; flex: none; fill: currentColor; }
.quiz-tuile-texte { overflow-wrap: anywhere; }
.quiz-compte-choix {
    margin-left: auto; font-size: 26px; font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Correction : la bonne réponse reste pleine et se marque d'une coche, les
   autres s'estompent. La coche double l'information portée par l'opacité. */
.quiz-tuile.eteinte { opacity: .35; }
.quiz-tuile.juste { box-shadow: 0 0 0 4px var(--carte), 0 0 0 8px var(--ok-fort); }
.quiz-tuile.juste .quiz-tuile-texte::before { content: "✓ "; }

.quiz-explication {
    margin: 22px auto 0; max-width: 1000px; padding: 14px 18px;
    background: var(--info-soft); color: var(--texte);
    border-left: 4px solid var(--info-fort); border-radius: 8px;
    font-size: clamp(15px, 1.5vw, 19px); line-height: 1.5;
}
.quiz-explication p { margin: 4px 0 0; }

/* Classement et podium */
.quiz-podium { list-style: none; padding: 0; margin: 10px auto 0; max-width: 760px; }
.quiz-place {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 18px; margin-bottom: 8px; border-radius: 10px;
    background: var(--carte); border: 1px solid var(--bordure);
    font-size: 20px;
}
.quiz-rang {
    width: 38px; height: 38px; border-radius: 50%; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; background: var(--fond); color: var(--texte);
}
.place-1 .quiz-rang { background: #d4a017; color: #1a1a1a; }
.place-2 .quiz-rang { background: #9ea7b3; color: #1a1a1a; }
.place-3 .quiz-rang { background: #b0703c; color: #fff; }
.place-1 { font-size: 26px; font-weight: 700; }
.quiz-nom { flex: 1; }
.quiz-score { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Écran du stagiaire : des cibles larges, faciles à toucher sans viser. */
.quiz-scene-joueur { max-width: 640px; margin: 0 auto; text-align: center; }
.quiz-question-mobile { font-size: 17px; line-height: 1.4; margin: 6px 0 16px; }
.quiz-grille-mobile .quiz-tuile {
    min-height: 118px; flex-direction: column; justify-content: center;
    text-align: center; gap: 8px; font-size: 16px; cursor: pointer;
}
.quiz-grille-mobile .quiz-forme { width: 42px; height: 42px; }
.quiz-grille-mobile .quiz-tuile:active { transform: scale(.97); }
.quiz-grille-mobile .quiz-tuile:disabled { cursor: default; }
.quiz-grille-mobile .quiz-tuile:disabled:not(.choisie) { opacity: .35; }
.quiz-grille-mobile .quiz-tuile.choisie { box-shadow: 0 0 0 4px var(--carte), 0 0 0 8px var(--accent); }
.quiz-grand { font-size: 30px; font-weight: 700; margin: 26px 0 8px; }
.quiz-points { font-size: 40px; font-weight: 700; margin: 4px 0; font-variant-numeric: tabular-nums; }
.quiz-rang-mobile { font-size: 64px; font-weight: 700; margin: 0; color: var(--accent); }
.quiz-verdict { border-radius: 12px; padding: 12px 18px 18px; margin-top: 18px; }
.verdict-juste { background: var(--ok-soft); color: var(--ok-fort); }
.verdict-faux { background: var(--danger-soft); color: var(--danger-fort); }

/* Rejoindre */
.quiz-rejoindre { max-width: 460px; margin: 30px auto; text-align: center; }
.quiz-saisie-pin {
    font-size: 40px !important; text-align: center; letter-spacing: .12em;
    font-variant-numeric: tabular-nums; margin: 14px 0 4px;
}

/* Réseau coupé : le jeu continue d'essayer, on le dit simplement. */
.quiz-alerte-reseau { display: none; color: var(--danger-fort); font-weight: 600; text-align: center; }
body.quiz-hors-ligne .quiz-alerte-reseau { display: block; }

@media (max-width: 620px) {
    .quiz-grille { gap: 10px; }
    .quiz-tuile { min-height: 80px; }
}
@media (prefers-reduced-motion: reduce) {
    .quiz-tuile { transition: none; }
    .quiz-grille-mobile .quiz-tuile:active { transform: none; }
}

/* Partie d'essai : impossible à confondre avec une vraie partie. */
.quiz-bandeau-essai {
    margin: 0 0 14px; padding: 8px 14px; border-radius: 8px; text-align: center;
    background: var(--warn-soft); color: var(--warn-fort); font-weight: 700;
}
.quiz-actions { display: flex; gap: 8px; justify-content: flex-end; }
.quiz-actions form { margin: 0; }

/* ── Code dans le quiz : l'esprit du thème Dark+ de VS Code ─────────────────
   Toujours sombre, quel que soit le thème du site : c'est l'aspect de
   l'éditeur que les stagiaires ont sous les yeux. Contrastes sur #1e1e1e :
   texte 11,3 · mots-clés 6,0 · def/None 5,7 · fonctions 11,8 · chaînes 6,3 ·
   nombres 9,8 · commentaires 5,0 · variables 11,2. */
.cc-bloc, .cc-enligne {
    font-family: "Cascadia Code", Consolas, "Courier New", monospace;
    background: #1e1e1e; color: #d4d4d4;
}
.cc-bloc {
    display: block; text-align: left; white-space: pre; tab-size: 4;
    margin: 0; padding: 16px 20px; border-radius: 10px;
    line-height: 1.55; overflow-x: auto;
    font-size: clamp(15px, 1.7vw, 23px); font-weight: 400;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}
.cc-bloc code { font-family: inherit; background: none; color: inherit; padding: 0; }
.cc-enligne {
    padding: .04em .38em; border-radius: 5px; font-size: .9em; font-weight: 500;
    white-space: pre-wrap; overflow-wrap: anywhere;
}
.cc-mot { color: #c586c0; }
.cc-decl { color: #569cd6; }
.cc-fonction { color: #dcdcaa; }
.cc-texte { color: #ce9178; }
.cc-nombre { color: #b5cea8; }
.cc-commentaire { color: #6a9955; font-style: italic; }
.cc-var { color: #9cdcfe; }

/* L'énoncé : la phrase, puis le code en dessous, aligné à gauche. */
.quiz-enonce { max-width: 1100px; margin: 12px auto 22px; }
.quiz-enonce .quiz-question { margin: 0 0 14px; }
.quiz-scene-joueur .quiz-enonce { margin: 4px 0 14px; }
.quiz-scene-joueur .quiz-question-mobile { margin: 0 0 10px; }
.quiz-scene-joueur .cc-bloc { font-size: 13px; padding: 11px 13px; border-radius: 8px; }
.quiz-tuile .cc-enligne { font-size: .88em; }
.quiz-explication .cc-enligne { font-size: .92em; }

/* ── Page « Questions » d'un quiz (formateur) ──────────────────────────────
   Un formulaire par question : on enregistre une question à la fois. Les
   champs occupent toute la largeur, comme dans les autres formulaires du
   site ; la ligne de réglages (temps, niveau, cases à cocher) se replie sous
   800 px pour rester utilisable depuis un téléphone. */
/* Les formulaires posés dans une carte sont centrés (écran de connexion) :
   ici, ce sont de longs champs de saisie, qui se lisent alignés à gauche. */
.quiz-question form, .quiz-reglages { text-align: left; }
.quiz-question label { display: block; text-align: left; font-weight: 500;
    margin: 14px 0 4px; }
.quiz-question textarea,
.quiz-question input[type="text"] { width: 100%; }
.quiz-question-tete { display: flex; align-items: center; justify-content: space-between;
    gap: 10px; flex-wrap: wrap; }
.quiz-question-tete h2 { margin: 0; }
.quiz-question-ecartee { opacity: .72; }
.quiz-reponse-ligne { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.quiz-reponse-ligne input[type="radio"] { flex: none; width: 18px; height: 18px; }
.quiz-question-reglages { display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
    margin: 14px 0 4px; }
.quiz-question-reglages label { display: inline-flex; align-items: center; gap: 6px;
    margin: 0; font-weight: 500; }
.quiz-question-reglages select { width: auto; }
.quiz-question-actions { display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin-top: 12px; }
.quiz-deplacer { display: flex; gap: 6px; }
.quiz-deplacer button { min-width: 44px; }
.quiz-reglages { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.quiz-reglages label { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
@media (max-width: 800px) {
    .quiz-question-actions { flex-direction: column; align-items: stretch; }
    .quiz-deplacer button { flex: 1; }
}
