:root {
  --fond: #f6f7f9;
  --carte: #ffffff;
  --texte: #1b1f24;
  --doux: #5a6370;
  --bord: #d4d9e0;
  --accent: #176b87;
  --accent-texte: #ffffff;
  --ok: #1b7f3b;
  --ok-fond: #e6f4ea;
  --ko: #b3261e;
  --ko-fond: #fbe9e7;
  --danger-fond: #ffe1dc;
  --avert-fond: #fff3cd;
  --rayon: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #121417;
    --carte: #1d2126;
    --texte: #e8eaed;
    --doux: #a3acb8;
    --bord: #3a414a;
    --accent: #5cb8d6;
    --accent-texte: #0b1a20;
    --ok: #6fd28d;
    --ok-fond: #183323;
    --ko: #ff8a80;
    --ko-fond: #3a1d1b;
    --danger-fond: #4a1f1a;
    --avert-fond: #3d3415;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 760px; margin: 0 auto; padding: 12px 16px 48px; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.4rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 1rem 0 .5rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
[tabindex="-1"]:focus { outline: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
img { max-width: 100%; height: auto; border-radius: 6px; }
a { color: var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.info { color: var(--doux); }
.erreur { color: var(--ko); font-weight: 600; }

/* En-tête */
.entete { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-bottom: 1px solid var(--bord); margin-bottom: 12px; padding-bottom: 6px; }
.entete .marque { font-weight: 700; text-decoration: none; color: var(--texte); min-height: 44px;
  display: inline-flex; align-items: center; }

/* Boutons et champs */
button, .bouton {
  font: inherit; min-height: 44px; padding: 8px 16px; border-radius: var(--rayon);
  border: 1px solid var(--bord); background: var(--carte); color: var(--texte); cursor: pointer;
}
button.principal { background: var(--accent); color: var(--accent-texte); border-color: var(--accent); font-weight: 600; }
button.lien { border: none; background: none; color: var(--accent); text-decoration: underline; padding: 8px 4px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.actions > button { flex: 1 1 140px; }
input[type="password"], input[type="number"] {
  font: inherit; min-height: 44px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--bord); background: var(--carte); color: var(--texte);
}
input[type="number"] { width: 6.5em; }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; }
fieldset { border: 1px solid var(--bord); border-radius: var(--rayon); background: var(--carte); margin: 0 0 12px; padding: 8px 12px; }
legend { font-weight: 700; padding: 0 4px; }
.choix { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.ligne { display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* Connexion */
.connexion { display: grid; gap: 8px; max-width: 360px; }

/* Reprise */
.encart { background: var(--carte); border: 2px solid var(--accent); border-radius: var(--rayon); padding: 8px 12px; margin-bottom: 12px; }

/* Arbre */
.arbre ul { list-style: none; margin: 0; padding-left: 18px; }
.arbre > ul { padding-left: 0; }
.arbre li.cours { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 8px; }
.arbre .compte { color: var(--doux); }
.global { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.total { font-weight: 700; font-size: 1.1rem; }

/* Question */
.progres { display: flex; justify-content: space-between; color: var(--doux); font-size: .95rem; }
progress { width: 100%; height: 8px; accent-color: var(--accent); }
.contexte { color: var(--doux); font-size: .9rem; margin: .5rem 0 0; }
.badges { display: flex; gap: 6px; margin: 6px 0; }
.badge { font-size: .8rem; border: 1px solid var(--bord); border-radius: 999px; padding: 1px 8px; color: var(--doux); }
.enonce { font-size: 1.05rem; margin-bottom: 8px; }
.prop { border: 1px solid var(--bord); border-radius: var(--rayon); background: var(--carte); padding: 6px 12px; margin: 8px 0; }
.prop.choix { padding: 10px 12px; }
.prop:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.kprim .vf { display: flex; gap: 8px; margin-top: 4px; }
.kprim .vf label { flex: 1; justify-content: center; border: 1px solid var(--bord); border-radius: 8px; }
.kprim .vf label:has(input:checked) { border-color: var(--accent); background: var(--fond); font-weight: 600; }

/* Correction */
.correction .props { list-style: none; padding: 0; }
.correction .props li {
  display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: start;
  border-radius: var(--rayon); padding: 8px 12px; margin: 8px 0;
  border: 1px solid var(--bord); background: var(--carte);
}
.correction li.vraie { background: var(--ok-fond); border-color: var(--ok); }
.correction li.rate { box-shadow: inset 6px 0 0 var(--ko); padding-left: 18px; }
.marque-eleve { font-size: 1.2rem; line-height: 1.3; min-width: 1.2em; text-align: center; font-weight: 700; }
.verite { font-size: .8rem; font-weight: 700; white-space: nowrap; border-radius: 999px; padding: 1px 8px; border: 1px solid; }
.vraie .verite { color: var(--ok); }
.fausse .verite { color: var(--doux); }
.verdict { grid-column: 2 / -1; font-size: .9rem; color: var(--doux); }
.rate .verdict { color: var(--ko); font-weight: 700; }
.points { font-size: 1.1rem; font-weight: 700; }
.alerte-danger { background: var(--danger-fond); border-left: 4px solid var(--ko); padding: 8px 12px; font-weight: 700; border-radius: 6px; }
.infos { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 8px 12px; }
mark { color: inherit; border-radius: 4px; padding: 0 2px; }
mark.danger { background: var(--danger-fond); font-weight: 700; }
mark.modif, mark.nonconf { background: var(--avert-fond); }
.sources { font-size: .85rem; color: var(--doux); }
.pages img { display: block; margin: 8px 0; border: 1px solid var(--bord); }

/* Bilan */
.note { font-size: 2.2rem; font-weight: 800; margin: .2rem 0; }
table { border-collapse: collapse; width: 100%; background: var(--carte); font-size: .95rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--bord); vertical-align: top; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.faible td { background: var(--ko-fond); }
tr.fort td { background: var(--ok-fond); }
.tableau { overflow-x: auto; }
details.revoir { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); margin: 8px 0; padding: 4px 12px; }
details.revoir summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }

fieldset.nu { border: none; background: none; padding: 0; margin: 0; }
