/* Plume — styles (GPL-3.0-or-later) */
:root {
  --fond: #f7f5f0;
  --surface: #ffffff;
  --texte: #1f2421;
  --texte-doux: #5c635f;
  --bord: #e2ddd3;
  --accent: #2f5d50;
  --accent-texte: #ffffff;
  --accent-doux: #e3eee9;
  --ok: #1e7b4a;
  --ok-fond: #e4f4ea;
  --ko: #b3261e;
  --ko-fond: #fbe9e7;
  --marque: #fff1b8;
  --ombre: 0 1px 3px rgba(0, 0, 0, .08);
  --rayon: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #151917;
    --surface: #1f2522;
    --texte: #e9ece9;
    --texte-doux: #a3aca7;
    --bord: #343c38;
    --accent: #7cc3a9;
    --accent-texte: #0f1a16;
    --accent-doux: #24352f;
    --ok: #74d39c;
    --ok-fond: #1d3428;
    --ko: #ff8a80;
    --ko-fond: #3d2220;
    --marque: #5a4b10;
    --ombre: none;
  }
}
:root[data-theme="dark"] {
  --fond: #151917; --surface: #1f2522; --texte: #e9ece9; --texte-doux: #a3aca7; --bord: #343c38;
  --accent: #7cc3a9; --accent-texte: #0f1a16; --accent-doux: #24352f; --ok: #74d39c; --ok-fond: #1d3428;
  --ko: #ff8a80; --ko-fond: #3d2220; --marque: #5a4b10; --ombre: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.6rem; line-height: 1.25; margin: .2em 0 .4em; }
h2 { font-size: 1.15rem; margin: 0; }
main { max-width: 760px; margin: 0 auto; padding: 16px 16px 120px; outline: none; }

/* Barre du haut */
.barre {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 760px; margin: 0 auto; padding: 12px 16px;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; color: var(--texte); text-decoration: none; white-space: nowrap; flex: none; }
.serie { font-weight: 600; white-space: nowrap; min-width: 3em; text-align: right; }

/* Onglets : dans l'en-tête sur grand écran, en bas de l'écran sur mobile */
.onglets { display: flex; gap: 4px; }
.onglets a {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px;
  color: var(--texte-doux); text-decoration: none; font-weight: 600; font-size: .95rem;
}
.onglets a:hover { background: var(--accent-doux); color: var(--accent); }
.onglets a.actif { background: var(--accent-doux); color: var(--accent); }
.onglet-icone { display: inline-flex; }
.onglet-icone svg { display: block; }
body.en-session .onglets { display: none; }
@media (max-width: 719px) {
  .onglets {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    justify-content: space-around; gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--bord);
  }
  .onglets a { flex-direction: column; gap: 2px; padding: 4px 6px; font-size: .7rem; min-width: 56px; }
  .onglet-icone svg { width: 24px; height: 24px; }
  main { padding-bottom: 110px; }
}

/* Fil d'Ariane, étiquettes, filtres, recherche */
.ariane { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .9rem; color: var(--texte-doux); margin-bottom: 10px; }
.ariane a { text-decoration: none; font-weight: 600; }
.ariane .sep { opacity: .6; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.tag { font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--fond); color: var(--texte-doux); border: 1px solid var(--bord); }
.tag.niveau-lycee { color: var(--accent); }
.tag.niveau-superieur { color: #8a5a00; }
.tag.st-acquise { background: var(--ok-fond); color: var(--ok); border-color: transparent; }
.filtres { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 18px; }
.puce {
  font: inherit; font-size: .9rem; font-weight: 600; padding: 6px 14px; border-radius: 99px; cursor: pointer;
  border: 1.5px solid var(--bord); background: var(--surface); color: var(--texte-doux);
}
.puce.active { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.recherche input {
  width: 100%; min-height: 46px; padding: 10px 14px; margin-top: 8px;
  font: inherit; color: var(--texte); background: var(--surface);
  border: 1.5px solid var(--bord); border-radius: 12px;
}
.recherche input:focus { outline: 3px solid var(--accent); outline-offset: 1px; }
.lien-discret { font-size: .9rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.titre-section { margin: 28px 0 6px; }

/* Accueil */
.carte-continuer {
  padding: 18px; border-radius: var(--rayon); background: var(--surface); border: 1.5px solid var(--accent);
  box-shadow: var(--ombre); display: grid; gap: 8px;
}
.carte-continuer h1 { margin: 0; }
.carte-continuer .regle-resume { margin: 0; color: var(--texte-doux); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.stat {
  display: grid; gap: 2px; text-align: center; padding: 12px 6px; border-radius: var(--rayon);
  background: var(--surface); border: 1px solid var(--bord); color: var(--texte); text-decoration: none;
}
.stat strong { font-size: 1.3rem; }
.stat span { font-size: .8rem; color: var(--texte-doux); }
.encart { padding: 16px; border-radius: var(--rayon); background: var(--accent-doux); margin: 16px 0; }
.encart h2 { margin-bottom: 6px; }
.encart p { margin: 0 0 12px; }
.parcours { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 4px; }
.parcours a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--texte); }
.parcours a:hover { background: var(--surface); }
.parcours .courante a { background: var(--surface); border: 1.5px solid var(--accent); }
.pastille {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: .8rem; font-weight: 700; background: var(--surface); border: 1.5px solid var(--bord); color: var(--texte-doux);
}
.parcours .st-acquise .pastille, .parcours .st-test .pastille { background: var(--ok-fond); border-color: var(--ok); color: var(--ok); }
.parcours .courante .pastille { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.parcours-titre { display: grid; }
.parcours-titre small { color: var(--texte-doux); font-size: .78rem; }

/* Cours : catégories */
.grille-categories { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.carte-categorie {
  display: grid; gap: 6px; align-content: start; padding: 16px; border-radius: var(--rayon);
  background: var(--surface); border: 1px solid var(--bord); box-shadow: var(--ombre);
  color: var(--texte); text-decoration: none;
}
.carte-categorie:hover { border-color: var(--accent); }
.carte-categorie p { margin: 0; color: var(--texte-doux); font-size: .92rem; }
.carte-categorie.compacte { grid-template-columns: auto 1fr auto; align-items: center; }
.carte-categorie.compacte .jauge { grid-column: 1 / -1; }
.cat-icone { font-size: 1.8rem; }
.cat-meta { font-size: .85rem; font-weight: 600; color: var(--accent); }
.categorie > .jauge { margin: 4px 0 14px; }
.sous-categorie { margin: 24px 0; }
.sous-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }

/* Fiche : règles voisines et liées */
.voisines { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 28px 0 12px; }
.voisine {
  display: grid; gap: 2px; padding: 12px; border-radius: 12px; border: 1px solid var(--bord);
  background: var(--surface); text-decoration: none; color: var(--texte); font-weight: 600; font-size: .92rem;
}
.voisine small { color: var(--texte-doux); font-weight: 600; }
.voisine.suivante { text-align: right; }
.liees ul { padding-left: 1.2em; }
.liees li { margin: 4px 0; }
.chapeau { font-size: 1.1rem; color: var(--texte-doux); }

/* Règles : sommaire et listes de lecture */
.sommaire { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.sommaire a { padding: 6px 12px; border-radius: 99px; background: var(--accent-doux); text-decoration: none; font-weight: 600; font-size: .9rem; }
.bloc-regles { margin: 24px 0; scroll-margin-top: 16px; }
.bloc-regles h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--texte-doux); margin: 16px 0 6px; }
.liste-lecture { list-style: none; padding: 0; margin: 0; border: 1px solid var(--bord); border-radius: var(--rayon); background: var(--surface); overflow: hidden; }
.liste-lecture li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-right: 12px; border-top: 1px solid var(--bord); }
.liste-lecture li:first-child { border-top: 0; }
.liste-lecture a { flex: 1; display: grid; padding: 12px 14px; text-decoration: none; color: var(--texte); }
.liste-lecture a:hover { background: var(--accent-doux); }
.lecture-titre { font-weight: 600; }

/* Réviser et Progrès */
.liste-erreurs { padding-left: 1.2em; margin: 0 0 12px; }
.compte { font-size: .8rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--ko-fond); color: var(--ko); }
.progres-cat { margin: 14px 0; }
.progres-tete { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 6px; }
.progres-tete a { text-decoration: none; }
.progres-sous { list-style: none; padding: 0; margin: 6px 0 0; font-size: .9rem; color: var(--texte-doux); }
.progres-sous li { display: flex; justify-content: space-between; padding: 2px 0; }
@media (max-width: 480px) {
  .stats { gap: 6px; }
  .stat strong { font-size: 1.1rem; }
}

/* Boutons */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px;
  border: 1.5px solid var(--bord); border-radius: 12px;
  background: var(--surface); color: var(--texte);
  font: inherit; font-weight: 600; text-decoration: none; text-align: center;
  cursor: pointer; transition: transform .05s, background .15s;
}
.bouton:hover { border-color: var(--accent); }
.bouton:active { transform: translateY(1px); }
.bouton.principal { background: var(--accent); color: var(--accent-texte); border-color: var(--accent); }
.bouton.petit { min-height: 40px; padding: 6px 14px; font-size: .9rem; }
.bouton.danger { color: var(--ko); }
.bouton:focus-visible, .mot:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.ligne-boutons { display: flex; flex-wrap: wrap; gap: 8px; }

.actions-principales { display: flex; flex-direction: column; gap: 10px; margin: 20px 0 28px; }
.sous-titre, .note, .palier-desc { color: var(--texte-doux); }
.note { font-size: .9rem; }
.bravo { font-weight: 600; color: var(--ok); }

/* Jauge */
.jauge { height: 8px; border-radius: 99px; background: var(--bord); overflow: hidden; }
.jauge span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }

/* Paliers et règles */
.palier { margin: 28px 0; }
.palier-tete { display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.pct { font-weight: 700; color: var(--accent); }
.etiquette { display: inline-block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.regles { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.regle a {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
  padding: 14px 16px; border-radius: var(--rayon);
  background: var(--surface); border: 1px solid var(--bord); box-shadow: var(--ombre);
  color: var(--texte); text-decoration: none;
}
.regle a:hover { border-color: var(--accent); }
.regle-titre { font-weight: 600; grid-column: 1; }
.regle-resume { grid-column: 1; font-size: .9rem; color: var(--texte-doux); }
.regle .jauge { grid-column: 1; margin-top: 6px; }
.badge {
  grid-column: 2; grid-row: 1 / span 3; align-self: center;
  font-size: .75rem; font-weight: 700; padding: 4px 10px; border-radius: 99px;
  background: var(--fond); color: var(--texte-doux); white-space: nowrap;
}
.st-acquise .badge { background: var(--ok-fond); color: var(--ok); }
.st-test .badge, .st-en-cours .badge { background: var(--accent-doux); color: var(--accent); }

.outils { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--bord); }
.outils p { margin: 8px 0; }

/* Fiche */
.retour { display: inline-block; margin-bottom: 12px; text-decoration: none; font-weight: 600; }
.fiche .jauge { margin: 4px 0 20px; }
.fiche-texte { margin-bottom: 24px; }
.fiche-texte h2 { margin: 1.2em 0 .4em; }
.fiche-texte ul { padding-left: 1.2em; }
.fiche-texte li { margin: .3em 0; }
.exemples {
  margin: .6em 0 1em; padding: 10px 14px;
  border-left: 4px solid var(--accent); border-radius: 0 10px 10px 0;
  background: var(--accent-doux); font-style: italic;
}
.exemples p { margin: .2em 0; }

/* Session */
.session-tete { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.session-tete .jauge { flex: 1; height: 12px; }
.quitter { font-size: 1.3rem; text-decoration: none; color: var(--texte-doux); padding: 4px 8px; }
.session-regle { font-size: .85rem; font-weight: 700; color: var(--accent); margin: 0; text-transform: uppercase; letter-spacing: .04em; }
.consigne { color: var(--texte-doux); margin: 4px 0 16px; }
.phrase {
  font-size: 1.35rem; line-height: 2.1;
  padding: 18px 16px; margin: 0 0 18px;
  background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre);
}
.mot {
  font: inherit; color: inherit; background: none; border: 0; padding: 0 3px; margin: 0 -1px;
  border-radius: 6px; cursor: pointer; line-height: 1.4;
}
.mot:hover:not(:disabled) { background: var(--accent-doux); }
.mot:disabled { cursor: default; color: inherit; }
.mot.est-faute { background: var(--ko-fond); color: var(--ko); text-decoration: line-through; }
.mot.bon { background: var(--ok-fond); color: var(--ok); text-decoration: none; outline: 2px solid var(--ok); }
.mot.mauvais { outline: 2px solid var(--ko); }
.trou { display: inline-block; min-width: 4em; border-bottom: 2px solid var(--accent); color: transparent; }
.choix-bas { display: flex; justify-content: center; }
.aucune { min-width: 60%; }
.options { display: grid; gap: 10px; }
.option { justify-content: flex-start; }
.option kbd {
  font: .75rem/1 ui-monospace, monospace; padding: 4px 7px; border-radius: 6px;
  border: 1px solid var(--bord); color: var(--texte-doux);
}
.bouton.bon { background: var(--ok-fond); border-color: var(--ok); color: var(--ok); }
.bouton.mauvais { background: var(--ko-fond); border-color: var(--ko); color: var(--ko); }
.bouton:disabled { cursor: default; }

/* Conjugaison */
.phrase.conj { font-size: 1.6rem; text-align: center; }
.pronom { color: var(--texte-doux); }

/* Correction à saisir */
mark.a-corriger { background: var(--ko-fond); color: var(--ko); font-weight: 600; text-decoration: underline wavy; text-underline-offset: 4px; }
.saisie { display: flex; gap: 10px; flex-wrap: wrap; }
.saisie input {
  flex: 1 1 200px; min-height: 48px; padding: 10px 14px;
  font: inherit; font-size: 1.1rem; color: var(--texte); background: var(--surface);
  border: 1.5px solid var(--bord); border-radius: 12px;
}
.saisie input:focus { outline: 3px solid var(--accent); outline-offset: 1px; }
.saisie input.bon { border-color: var(--ok); background: var(--ok-fond); }
.saisie input.mauvais { border-color: var(--ko); background: var(--ko-fond); }

/* Tri en deux colonnes */
.tri { display: grid; gap: 10px; margin-bottom: 16px; }
.tri-ligne {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--bord);
}
.tri-ligne.ok { border-color: var(--ok); }
.tri-ligne.ko { border-color: var(--ko); }
.tri-texte { font-size: 1.05rem; flex: 1 1 180px; }
.tri-choix { display: flex; gap: 6px; flex-wrap: wrap; }
.tri-btn.choisi { background: var(--accent); color: var(--accent-texte); border-color: var(--accent); }
.tri-btn.bon { outline: 2px solid var(--ok); outline-offset: 1px; }
.valider-tri { width: 100%; }
.bouton:disabled:not(.bon):not(.mauvais):not(.choisi) { opacity: .55; }
.source { font-size: .8rem; color: var(--texte-doux); margin: 0 0 10px; }

/* Panneau de correction */
.retour-panneau { display: none; }
.retour-panneau.visible {
  display: block; margin-top: 20px; padding: 16px; border-radius: var(--rayon);
  border: 1.5px solid var(--bord); background: var(--surface);
}
.retour-panneau.ok { border-color: var(--ok); }
.retour-panneau.ko { border-color: var(--ko); }
.verdict { font-weight: 700; font-size: 1.1rem; margin: 0 0 8px; }
.ok .verdict { color: var(--ok); }
.ko .verdict { color: var(--ko); }
.corrige { font-size: 1.1rem; margin: 0 0 8px; }
mark { background: var(--marque); color: inherit; padding: 0 3px; border-radius: 4px; font-weight: 600; }
.explication { margin: 0 0 12px; }
.rappel { margin: 0 0 16px; }
.rappel summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.rappel .fiche-texte { margin: 10px 0 0; font-size: .95rem; }
.retour-panneau .bouton.principal { width: 100%; }

/* Bilan */
.score { font-size: 1.4rem; font-weight: 700; }
.liste-test { list-style: none; padding: 0; }
.liste-test li { padding: 4px 0; }
.liste-test .ok { color: var(--ok); }
.liste-test .ko { color: var(--texte-doux); }
.bilan .jauge { margin: 8px 0 12px; }

@media (min-width: 600px) {
  .actions-principales { flex-direction: row; flex-wrap: wrap; }
  .actions-principales .bouton { flex: 1 1 auto; }
}

/* Aller plus loin */
.plus-loin { border: 1.5px dashed var(--accent); background: var(--surface); }
.plus-loin .jauge { margin: 0 0 12px; }

/* Volet « Approfondir » */
.volet-plus-loin { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--bord); scroll-margin-top: 16px; }
.volet-plus-loin h3 { margin: 0 0 8px; font-size: 1.05rem; }
.sous-titre-volet { font-weight: 700; margin: 14px 0 6px; }
.exemples-plus-loin { margin: 0 0 12px; padding-left: 1.2em; }
.exemples-plus-loin li { margin: 4px 0; }
.chevron { display: inline-block; transition: transform .2s; }
[aria-expanded="true"] .chevron { transform: rotate(180deg); }

/* Numéro de l'exercice sous la correction */
.num-exo { font-size: .78rem; color: var(--texte-doux); margin: 0 0 10px; }
.num-fichier { opacity: .75; }

/* Relecture */
.relecture-choix { display: grid; gap: 8px; margin: 18px 0 6px; }
.relecture-choix select { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--bord); background: var(--surface); color: var(--texte); width: 100%; margin-top: 4px; }
.carte-relecture { padding: 14px 16px; margin: 12px 0; border-radius: var(--rayon); background: var(--surface); border: 1.5px solid var(--bord); border-left-width: 5px; }
.carte-relecture.st-valide { border-left-color: var(--ok); }
.carte-relecture.st-a-corriger { border-left-color: var(--ko); }
.relecture-tete { font-size: .9rem; color: var(--texte-doux); margin-bottom: 6px; }
.apercu { font-size: 1.05rem; margin: 4px 0 8px; }
.apercu del { color: var(--ko); }
.apercu-tri { margin: 0 0 8px; padding-left: 1.2em; }
.tag.statut-valide { background: var(--ok-fond); color: var(--ok); border-color: transparent; }
.tag.statut-a-corriger { background: var(--ko-fond); color: var(--ko); border-color: transparent; }
.commentaire { width: 100%; font: inherit; font-size: .92rem; padding: 8px 10px; margin: 6px 0 10px; border-radius: 10px; border: 1.5px solid var(--bord); background: var(--fond); color: var(--texte); resize: vertical; }
.bouton.danger-plein { background: var(--ko); border-color: var(--ko); color: #fff; }
