:root {
  --fond: #f7f5f0;
  --surface: #ffffff;
  --texte: #1f2a26;
  --discret: #5f6b66;
  --accent: #2f5d50;
  --accent-texte: #ffffff;
  --bord: #dcd8cf;
  --ok: #2e7d4f;
  --ko: #b3401f;
  --etoile: #e0a100;
  --ok-fond: #e3f2e8;
  --ko-fond: #fbe6df;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #161a19;
    --surface: #1f2523;
    --texte: #e8ece9;
    --discret: #9aa6a1;
    --accent: #7fbfa9;
    --accent-texte: #10201a;
    --bord: #33403b;
    --ok: #7fd19f;
    --ko: #f08c6c;
    --etoile: #f2c14e;
    --ok-fond: #1d3527;
    --ko-fond: #3d2219;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--fond);
  color: var(--texte);
  padding-bottom: env(safe-area-inset-bottom);
}
header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--accent); color: var(--accent-texte);
}
h1 { font-size: 1.15rem; margin: 0; }
h2 { font-size: 1.3rem; margin: 0 0 8px; }
h3 { font-size: 1.05rem; margin: 24px 0 8px; }
.enfant { display: flex; gap: 6px; }
nav { display: flex; background: var(--surface); border-bottom: 1px solid var(--bord); position: sticky; top: 0; z-index: 1; }
nav button {
  flex: 1; min-width: 0; padding: 12px 2px; border: 0; border-radius: 0; background: none; color: var(--discret);
  font-weight: 600; font-size: .95rem; justify-content: center; border-bottom: 3px solid transparent;
}
nav button.actif { color: var(--accent); border-bottom-color: var(--accent); }
main { max-width: 720px; margin: 0 auto; padding: 16px; }
button, .bouton {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 16px;
  font: inherit; font-weight: 600; border-radius: 10px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-texte); cursor: pointer;
}
button.secondaire, .bouton.secondaire, button.discret { background: transparent; color: var(--accent); }
header button.discret { color: var(--accent-texte); border-color: var(--accent-texte); min-height: 36px; }
button:disabled { opacity: .5; cursor: wait; }
input, select, textarea {
  font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--bord);
  border-radius: 8px; padding: 8px 10px; max-width: 100%;
}
textarea { width: 100%; }
header select { background: transparent; color: var(--accent-texte); border-color: var(--accent-texte); }
header select option { color: #000; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.aide { color: var(--discret); font-size: .92rem; margin: 6px 0; }
.etat { min-height: 1.5em; color: var(--discret); }
.etat.erreur { color: var(--ko); }
.liste { list-style: none; padding: 0; margin: 0; }
.liste li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--bord); border-radius: 10px; margin-bottom: 6px;
}
.liste .detail { color: var(--discret); font-size: .88rem; }
.mot { font-weight: 600; }
.liste li > .mot:first-child { flex: 1; }
#liste-mots li { flex-wrap: nowrap; }
#liste-mots .discret { min-height: 36px; padding: 4px 10px; }
.etoiles { position: relative; display: inline-block; color: var(--bord); letter-spacing: 1px; white-space: nowrap; }
.etoiles .plein { position: absolute; inset: 0 auto 0 0; overflow: hidden; color: var(--etoile); }
.etiquette { display: inline-block; font-size: .8rem; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--bord); color: var(--discret); }
.etiquette.attente { border-color: var(--etoile); }
.compte { color: var(--discret); font-size: .85rem; margin-left: 4px; }
.barre { display: flex; height: 6px; width: 100%; border-radius: 3px; overflow: hidden; background: var(--bord); }
.barre .ok { background: var(--ok); }
.barre .ko { background: var(--ko); }
.phrases { font-size: 1.2rem; line-height: 1.8; background: var(--surface); border: 1px solid var(--bord); border-radius: 10px; padding: 12px 14px; }
mark { background: none; color: var(--accent); font-weight: 700; text-decoration: underline; }
.groupe { font-size: 1.4rem; font-weight: 600; min-height: 2em; color: var(--accent); }
.reglage { display: flex; align-items: center; gap: 8px; margin: 6px 0; color: var(--discret); }
.reglage input { flex: 1; }
.juste { color: var(--ok); }
.faux { color: var(--ko); background: var(--ko-fond); border-radius: 4px; padding: 0 3px; }
.faux s { opacity: .7; }
.verdict { min-width: 110px; justify-content: center; }
.verdict.reussi { background: var(--ok-fond); color: var(--ok); border-color: var(--ok); }
.verdict.erreur { background: var(--ko-fond); color: var(--ko); border-color: var(--ko); }
.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.chiffres div { background: var(--surface); border: 1px solid var(--bord); border-radius: 10px; padding: 10px 12px; }
.chiffres strong { display: block; font-size: 1.6rem; }
.criteres { list-style: none; padding: 0; margin: 4px 0 0; font-size: .85rem; width: 100%; }
.criteres .ok::before { content: "✓ "; color: var(--ok); }
.criteres .ko { color: var(--ko); }
.criteres .ko::before { content: "✗ "; }
.formulaire label { display: block; margin: 8px 0; }
.formulaire input:not([type=checkbox]), .formulaire textarea { width: 100%; display: block; margin-top: 4px; }
.formulaire .case { display: flex; gap: 8px; align-items: center; }
#connexion form { display: flex; gap: 8px; flex-wrap: wrap; }
input.court { width: 4.5em; }
.alerte { color: var(--ko); }
.phrases-liste { padding-left: 1.4em; margin: 8px 0; }
.phrases-liste li { margin-bottom: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--bord); background: var(--surface); }
.phrases-liste li.en-cours { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.phrases-liste li.dictee { opacity: .75; }
.phrases-liste .texte-phrase { font-size: 1.15rem; line-height: 1.7; display: block; }
.phrases-liste .actions { margin: 6px 0 0; }
.phrases-liste button { min-height: 36px; padding: 4px 12px; }
.verdict.a_verifier { background: transparent; color: var(--etoile); border-color: var(--etoile); }
details summary { cursor: pointer; color: var(--discret); margin: 16px 0 8px; }
