/* Univers du cahier d'écolier : encre bleue, correction en vert (comme sur la copie), erreurs en rouge. */
:root {
  --fond: #eef1f8; --feuille: #fff; --encre: #17213a; --doux: #4d5a78; --trait: #c9d1e4;
  --bleu: #1f4fb2; --bleu-fonce: #173d8c; --sur-bleu: #fff;
  --vert: #11693a; --vert-fond: #e5f4ea; --rouge: #a4222f; --rouge-fond: #fcebec; --jaune-fond: #fdf2cf;
  --grille: #c3cbe0;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #101522; --feuille: #181f31; --encre: #e8ecf7; --doux: #aab4cf; --trait: #35415f;
    --bleu: #8fb0ff; --bleu-fonce: #b3c9ff; --sur-bleu: #0d1430;
    --vert: #7fdca4; --vert-fond: #122c20; --rouge: #ff9da6; --rouge-fond: #3a181e; --jaune-fond: #362d10;
    --grille: #37435f;
  }
}
* { box-sizing: border-box; }
html { font-size: 112.5%; }
body { margin: 0; background: var(--fond); color: var(--encre); font-family: ui-rounded, "SF Pro Rounded", system-ui, sans-serif; line-height: 1.55; }
::selection { background: var(--bleu); color: var(--sur-bleu); }
input, textarea { caret-color: var(--bleu); }
header { display: flex; flex-wrap: wrap; gap: .5rem 1rem; justify-content: space-between; align-items: center; padding: .75rem max(1rem, calc((100% - 50rem) / 2)); border-bottom: 1px solid var(--trait); background: var(--feuille); }
#compte { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; font-size: .85rem; }
.marque { font-weight: 800; font-size: 1.15rem; color: var(--bleu); text-decoration: none; }
main { max-width: 52rem; margin: 0 auto; padding: 1.25rem 1rem 5rem; }
h1, h2, h3 { line-height: 1.25; text-wrap: balance; }
h1 { font-size: 1.6rem; margin: .75rem 0; }
h2 { font-size: 1.25rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1.05rem; margin: 0; }
p { margin: .5rem 0; max-width: 70ch; white-space: pre-line; }
a { color: var(--bleu); text-underline-offset: .15em; }
.doux { color: var(--doux); font-size: .9rem; }
:focus-visible { outline: 3px solid var(--bleu); outline-offset: 2px; }
[hidden] { display: none !important; }

.feuille { background: var(--feuille); border: 1px solid var(--trait); border-radius: 14px; padding: 1.25rem; margin: 1rem 0; }
.feuille > h2:first-child, .feuille > h1:first-child { margin-top: 0; }
.etroit { max-width: 26rem; margin-inline: auto; }
.entete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }
.retour { display: inline-block; padding: .4rem 0; font-weight: 600; text-decoration: none; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; align-items: center; }

.bouton { display: inline-block; font: inherit; font-weight: 700; line-height: 1.3; padding: .65rem 1.2rem; min-height: 2.75rem; border: 2px solid var(--bleu); border-radius: 10px; background: transparent; color: var(--bleu); text-decoration: none; text-align: center; cursor: pointer; transition: background-color .15s, transform .15s cubic-bezier(.2, .8, .2, 1); }
.bouton:hover { background: color-mix(in srgb, var(--bleu) 12%, transparent); }
.bouton:active { transform: scale(.97); }
.bouton:disabled { opacity: .45; cursor: not-allowed; }
.principal { background: var(--bleu); color: var(--sur-bleu); }
.principal:hover { background: var(--bleu-fonce); }
.vert { border-color: var(--vert); color: var(--vert); }
.vert:hover { background: var(--vert-fond); }
.discret { border-color: var(--trait); font-weight: 600; }
.danger { border-color: var(--rouge); color: var(--rouge); }

.liste { list-style: none; padding: 0; margin: 1rem 0; background: var(--feuille); border: 1px solid var(--trait); border-radius: 14px; }
.liste > li { display: grid; grid-template-columns: minmax(0, 1fr) 13rem auto; gap: .75rem 1.25rem; align-items: center; padding: 1rem 1.25rem; }
.liste > li + li { border-top: 1px solid var(--trait); }
.liste h2 { margin: 0; font-size: 1.1rem; }
.liste p { margin: 0; }
.titre-lien { color: inherit; }
@media (max-width: 40rem) { .liste > li { grid-template-columns: 1fr; } .liste > li > .bouton { justify-self: start; } }

.jauge { display: grid; gap: .2rem; font-size: .85rem; color: var(--doux); font-variant-numeric: tabular-nums; max-width: 20rem; }
progress { appearance: none; width: 100%; height: .6rem; border: 0; border-radius: 99px; overflow: hidden; background: var(--trait); }
progress::-webkit-progress-bar { background: var(--trait); }
progress::-webkit-progress-value { background: var(--vert); transition: width .25s; }
progress::-moz-progress-bar { background: var(--vert); }
.avancee { height: .4rem; }

label { display: block; font-weight: 600; margin-top: .9rem; }
label > span:first-child { display: block; }
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea { font: inherit; width: 100%; max-width: 26rem; padding: .6rem .8rem; min-height: 2.75rem; color: var(--encre); background: var(--fond); border: 2px solid var(--trait); border-radius: 10px; font-variant-numeric: tabular-nums; }
textarea { max-width: 100%; }
input[type=file] { font: inherit; max-width: 100%; padding: .5rem 0; }
input::file-selector-button { font: inherit; font-weight: 600; margin-right: .75rem; padding: .5rem 1rem; border: 2px solid var(--bleu); border-radius: 10px; background: transparent; color: var(--bleu); cursor: pointer; }
input:read-only { opacity: .6; }
fieldset { border: 1px solid var(--trait); border-radius: 10px; margin: 1rem 0 0; padding: .5rem 1rem 1rem; min-width: 0; }
details { margin-top: 1rem; }
summary { cursor: pointer; font-weight: 700; padding: .5rem 0; }

.enonce { font-size: 1.15rem; }
.champ { margin-top: 1rem; }
fieldset.champ { border: 0; padding: 0; }
.champ legend { font-weight: 600; padding: 0; }
.ligne { display: flex; align-items: center; gap: .5rem; margin-top: .3rem; }
.unite { font-weight: 700; }
.choix { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .4rem; }
.choix label { margin: 0; cursor: pointer; }
.choix input { position: absolute; opacity: 0; }
.choix label > span { display: grid; place-items: center; min-width: 3.5rem; min-height: 2.75rem; padding: .4rem 1rem; border: 2px solid var(--trait); border-radius: 10px; font-weight: 700; }
.choix input:checked + span { border-color: var(--bleu); background: var(--bleu); color: var(--sur-bleu); }
.choix input:focus-visible + span { outline: 3px solid var(--bleu); outline-offset: 2px; }
.note { display: block; font-weight: 800; font-size: .9rem; }
.champ.juste .note { color: var(--vert); }
.champ.faux .note { color: var(--rouge); }
.champ.juste input[type=text] { border-color: var(--vert); background: var(--vert-fond); }
.champ.faux input[type=text] { border-color: var(--rouge); background: var(--rouge-fond); }
.verdict { font-weight: 800; font-size: 1.15rem; border-radius: 10px; }
.verdict:empty { display: none; }
.verdict.juste, .verdict.faux { padding: .7rem 1rem; }
.verdict.juste { color: var(--vert); background: var(--vert-fond); }
.verdict.faux { color: var(--rouge); background: var(--rouge-fond); }

.aide { background: var(--vert-fond); border: 2px solid var(--vert); border-radius: 14px; padding: 1.25rem; }
.aide h2 { margin: 0 0 .5rem; color: var(--vert); }
.aide h2 ~ h2 { margin-top: 1.5rem; }
.regle { padding-left: 1.2rem; margin: 0; font-weight: 600; }
.regle p { margin: .3rem 0; }
.etapes { padding-left: 1.6rem; margin: 0; }
.etapes li { margin-top: .75rem; animation: apparait .25s cubic-bezier(.16, 1, .3, 1); }
.etapes li::marker { font-weight: 800; color: var(--vert); }
.etapes p { margin: .2rem 0; }
@keyframes apparait { from { opacity: .2; transform: translateY(6px); } }
.reponses { margin-top: 1.25rem; background: var(--feuille); border-radius: 10px; padding: 1rem; }
.reponses ul { margin: .5rem 0 0; padding-left: 1.2rem; }
.reponses strong { color: var(--vert); }
pre { font: 600 1rem/1.5 ui-monospace, Menlo, monospace; background: var(--feuille); border-radius: 8px; padding: .6rem .8rem; margin: .5rem 0; overflow-x: auto; width: fit-content; max-width: 100%; }

.fraction { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; line-height: 1.15; margin: 0 .15em; font-size: .92em; white-space: nowrap; }
.fraction > span:first-child { border-bottom: 2px solid currentColor; padding: 0 .2em; }

.message { font-weight: 600; }
.message:empty { display: none; }
.message.erreur { color: var(--rouge); background: var(--rouge-fond); border-radius: 10px; padding: .75rem 1rem; }
.message.attention { background: var(--jaune-fond); border-radius: 10px; padding: .75rem 1rem; margin: 1rem 0; }
.message.attention ul { margin: 0; padding-left: 1.2rem; }
.score { font-size: 1.35rem; font-weight: 800; }

/* ---------- figures ---------- */
.zone-figure { text-align: center; }
.zone-figure:empty { display: none; }
.zone-figure .bouton { margin-top: .5rem; }
.figure { display: block; width: 100%; height: auto; margin: .75rem auto 0; background: var(--feuille); border-radius: 10px; }
.figure.cliquable { cursor: crosshair; touch-action: manipulation; }
.figure line, .figure path, .figure circle { stroke: var(--encre); stroke-width: 2; fill: none; }
.figure .fin, .figure .fin line { stroke-width: 1; }
.figure .grille { stroke: var(--grille); stroke-width: 1; }
.figure .plein { fill: var(--encre); }
.figure .secteur { fill: color-mix(in srgb, var(--bleu) 35%, transparent); stroke: none; }
.figure .fond-rapporteur { fill: color-mix(in srgb, var(--bleu) 8%, transparent); stroke: var(--bleu); stroke-width: 1; }
.figure .rapporteur line, .figure .rapporteur circle { stroke: var(--bleu); stroke-width: 1; }
.figure .aide-trait { stroke: var(--vert); stroke-width: 2.5; }
.figure .vide { fill: none; }
.figure .disque { fill: color-mix(in srgb, var(--vert) 18%, transparent); stroke: var(--vert); stroke-dasharray: 6 4; }
.figure .pointille { stroke-dasharray: 5 5; stroke-width: 1.5; }
.figure line.choisi, .figure circle.choisi { stroke: var(--rouge); stroke-width: 3.5; }
.figure circle.choisi { fill: var(--rouge); }
.figure text { fill: var(--encre); font-family: inherit; }
.figure text.nom { font-size: 20px; font-weight: 700; }
.figure text.petit { font-size: 15px; font-weight: 600; }
.figure text.grad { font-size: 10px; font-weight: 700; }
.figure text.interieur { fill: var(--bleu); }
.figure text.aide-trait { fill: var(--vert); stroke: none; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
