:root {
  --brand: #2f9e8f;
  --brand-dark: #1b6f64;           /* texte blanc dessus : 5,99:1 (AA) */
  --bg: #f7f5f0;
  --surface: #ffffff;
  --border: #e4e0d8;
  --text: #2b2b28;
  --text-muted: #655f54;           /* 5,81:1 sur --bg, 6,33:1 sur blanc (AA) */
  --success-bg: #e3f5ea; --success-text: #1c6b43; --success-fill: #34b46a;
  --warning-bg: #fdf3e0; --warning-text: #7d5509; --warning-fill: #e0a63a;
  --danger-bg: #fbe8e6; --danger-text: #8f3226; --danger-fill: #d9503f;
  --focus: #0b57d0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --bg: #17201f; --surface: #1f2b2a; --border: #34423f; --text: #eceae4; --text-muted: #b4b0a4;
    --brand: #4fc4b3; --brand-dark: #1b6f64;
    --success-bg: #17352a; --success-text: #8be0b0; --warning-bg: #3a2f14; --warning-text: #f0cd83;
    --danger-bg: #3a1d19; --danger-text: #f4b3aa; --focus: #8ab4f8;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg); color: var(--text); margin: 0; line-height: 1.45;
}
a { color: var(--brand-dark); }
@media (prefers-color-scheme: dark) { a { color: var(--brand); } }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.lien-evitement {
  position: absolute; inset-inline-start: 8px; top: -60px; background: var(--surface); color: var(--text);
  padding: 10px 14px; border-radius: 10px; z-index: 100; border: 2px solid var(--focus);
}
.lien-evitement:focus { top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.conteneur { max-width: 480px; margin: 0 auto; padding: 20px 16px 96px; }
.conteneur-large { max-width: 900px; margin: 0 auto; padding: 20px 16px 96px; }

.entete { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.entete h1 { flex: 1; margin: 0; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: #d9f0ec; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; color: #2b2b28; }

.carte { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.carte-info { background: #eef6f8; color: #2b2b28; }
.carte-info a { color: #1b6f64; }
.texte-discret { color: var(--text-muted); font-size: 13px; }
.centre { text-align: center; }

.btn-principal {
  display: block; width: 100%; text-align: center; padding: 14px; border-radius: 14px; min-height: 48px;
  background: var(--brand-dark); color: #fff; font-size: 16px; font-weight: 600; border: none;
  text-decoration: none; cursor: pointer; font-family: inherit;
}
.btn-principal:hover { background: #17665c; }
.btn-secondaire {
  display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px; min-height: 44px;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text);
  text-decoration: none; cursor: pointer; font-size: 14px; font-family: inherit;
}
.btn-danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid transparent; }
.btn-petit { min-height: 44px; padding: 8px 14px; }
.btn-lien { background: none; border: none; padding: 0; color: var(--brand-dark); text-decoration: underline; cursor: pointer; font: inherit; }
@media (prefers-color-scheme: dark) { .btn-lien { color: var(--brand); } }
form.en-ligne { display: inline; }

.barre-progression { height: 12px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; margin: 8px 0; }
.barre-progression > div { height: 100%; border-radius: 999px; }

.badge-statut { font-size: 12px; padding: 4px 12px; border-radius: 999px; font-weight: 600; display: inline-block; }
.statut-avance { background: var(--success-bg); color: var(--success-text); }
.statut-dans_les_temps { background: var(--warning-bg); color: var(--warning-text); }
.statut-retard { background: var(--danger-bg); color: var(--danger-text); }
.fill-avance { background: var(--success-fill); }
.fill-dans_les_temps { background: var(--warning-fill); }
.fill-retard { background: var(--danger-fill); }
.pastille { display: inline-block; min-width: 22px; padding: 2px 8px; border-radius: 999px; background: var(--danger-fill); color: #fff; font-size: 12px; font-weight: 700; text-align: center; }

.liste-eleves { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.carte-eleve { text-align: center; text-decoration: none; color: var(--text); display: block; margin-bottom: 0; }
.carte-eleve .avatar { width: 72px; height: 72px; font-size: 36px; margin: 0 auto 8px; }

.lecture-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--bg); margin-bottom: 8px; }
.lecture-item.en-attente .lecture-texte { opacity: .8; font-style: italic; }
.lecture-texte { min-width: 0; flex: 1; }
.couverture { width: 32px; height: 44px; border-radius: 4px; background: #d9d3c5; flex-shrink: 0; object-fit: cover; display: block; }
.couverture-moyenne { width: 48px; height: 64px; }
.couverture-grande { width: 72px; height: 96px; margin: 0 auto; }

label { display: block; font-size: 14px; color: var(--text-muted); margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--border); font-size: 16px; /* 16 px : évite le zoom automatique d'iOS */
  font-family: inherit; background: var(--surface); color: var(--text);
}
input[type="checkbox"], input[type="radio"] { width: auto; }
.erreur { color: var(--danger-text); font-size: 14px; margin: 4px 0; }
.message { padding: 10px 14px; border-radius: 10px; margin-bottom: 10px; }
.message.success { background: var(--success-bg); color: var(--success-text); }
.message.error { background: var(--danger-bg); color: var(--danger-text); }
.message.warning, .message.info { background: var(--warning-bg); color: var(--warning-text); }

nav.basse {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface);
  border-top: 1px solid var(--border); display: flex; justify-content: space-around;
  padding: 6px 0; padding-bottom: calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(0,0,0,0.06); z-index: 15;
}
nav.basse a, nav.basse button {
  color: var(--text-muted); text-decoration: none; font-size: 12px; text-align: center; background: none; border: none; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer;
  flex: 1; padding: 6px 2px; border-radius: 10px; min-height: 52px; justify-content: center;
}
nav.basse form { display: flex; flex: 1; }
nav.basse a:active, nav.basse button:active { background: var(--bg); }
nav.basse i { font-size: 22px; }
nav.basse a.actif { color: var(--brand-dark); font-weight: 600; background: #eaf6f3; }   /* 5,41:1 */
nav.basse a.actif i { color: var(--brand-dark); }
@media (prefers-color-scheme: dark) { nav.basse a.actif { background: #24413d; color: #bff0e8; } nav.basse a.actif i { color: #bff0e8; } }
@media (min-width: 900px) {
  nav.basse { left: 50%; right: auto; transform: translateX(-50%); width: 560px; max-width: 100%; border-radius: 18px 18px 0 0; border: 1px solid var(--border); border-bottom: none; }
}
.selecteur-langue { padding: 0; margin: 0; }
.selecteur-langue select { width: auto; padding: 6px 8px; font-size: 14px; min-height: 36px; }
.barre-marque {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.barre-marque .marque-lien {
  display: flex; align-items: center; gap: 8px; flex: 1; text-decoration: none;
  padding: 6px 8px; border-radius: 12px; margin: -6px -8px; transition: background 0.15s;
}
.barre-marque .marque-lien:hover, .barre-marque .marque-lien:active { background: var(--bg); }
.barre-marque .marque-icone { width: 28px; height: 28px; border-radius: 8px; }
.barre-marque .marque-nom { font-weight: 700; font-size: 16px; color: var(--brand-dark); }
@media (prefers-color-scheme: dark) { .barre-marque .marque-nom { color: var(--brand); } }
.barre-marque .selecteur-langue { flex-shrink: 0; }

.defilement-horizontal { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
caption { text-align: start; font-weight: 600; padding: 4px 0 8px; }

/* Champ mot de passe avec bouton afficher/masquer */
.champ-avec-bascule { position: relative; display: block; }
.champ-avec-bascule input { padding-inline-end: 48px; }
.bascule-mdp {
  position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 10px;
  color: var(--text-muted); font-size: 18px; line-height: 1; display: flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center;
}
.bascule-mdp:hover { color: var(--text); }
.aide-champ { font-size: 13px; color: var(--text-muted); margin: 4px 0 0; line-height: 1.4; }

/* Choix « livre terminé / en cours » */
.choix-etat { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.choix-etat > div { display: contents; }
.carte-choix, .choix-etat label {
  display: flex; align-items: center; gap: 12px; padding: 16px; margin: 0; color: var(--text);
  border: 2px solid var(--border); border-radius: 14px; background: var(--surface);
  cursor: pointer; font-size: 16px; font-weight: 500;
}
.carte-choix:has(input:checked), .choix-etat label:has(input:checked) { border-color: var(--brand); background: #eef8f6; color: #1f2b2a; }
.carte-choix input, .choix-etat input { width: auto; margin: 0; transform: scale(1.3); }

/* Avatars : grille de choix */
ul.choix-avatar, div.choix-avatar { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.choix-avatar li, .choix-avatar > div { margin: 0; }
.choix-avatar label { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; padding: 10px 4px; margin: 0; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; color: var(--text); text-align: center; }
.choix-avatar input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choix-avatar label:has(input:checked) { border-color: var(--brand); background: #eef8f6; color: #1f2b2a; }
.choix-avatar label:has(input:focus-visible) { outline: 3px solid var(--focus); }

/* Code secret : champ + pavé numérique */
.pave-pin { max-width: 280px; margin: 16px auto; }
.champ-pin { font-size: 30px; text-align: center; letter-spacing: 14px; padding: 12px; border-radius: 14px; }
.champ-code { font-size: 22px; text-align: center; letter-spacing: 6px; text-transform: uppercase; padding: 14px; }
.pave-numerique { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.pave-numerique button { font-size: 26px; font-weight: 600; min-height: 64px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-family: inherit; }
.pave-numerique button:active { background: var(--bg); transform: scale(.97); }
[dir="rtl"] .pave-pin .champ-pin { letter-spacing: 10px; }

/* Fiche de connexion enfant */
.fiche-connexion { text-align: center; border: 2px dashed var(--border); }
.fiche-connexion .code-gros { font-size: 30px; font-weight: 800; letter-spacing: 8px; margin: 4px 0 12px; font-variant-numeric: tabular-nums; }
.fiche-connexion img.qr { width: 160px; height: 160px; image-rendering: pixelated; background: #fff; padding: 6px; border-radius: 8px; }
.etapes { text-align: start; font-size: 14px; padding-inline-start: 20px; line-height: 1.7; }

/* Validation parent */
.validation { border-inline-start: 4px solid var(--warning-fill); }
.validation blockquote { margin: 8px 0; padding: 8px 12px; background: var(--bg); border-radius: 10px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.validation .meta { font-size: 13px; color: var(--text-muted); margin: 2px 0; }
.actions-validation { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.actions-validation .btn-vert { background: var(--brand-dark); color: #fff; border: none; font-weight: 600; flex: 1; }
.raisons-rapides { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.raisons-rapides button { font-size: 13px; padding: 6px 10px; min-height: 36px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-family: inherit; }
details.refus summary { cursor: pointer; padding: 10px 0; min-height: 44px; color: var(--danger-text); font-weight: 600; }
.commentaire-educatrice { margin: 6px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--warning-bg); color: var(--warning-text); font-size: 14px; }
.credit-photo { font-size: 12px; color: var(--text-muted); }
.image-recompense { width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; display: block; }
.grille-photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.grille-photos button { padding: 0; border: 2px solid var(--border); border-radius: 12px; background: none; cursor: pointer; overflow: hidden; width: 100%; }
.grille-photos img { width: 100%; height: 110px; object-fit: cover; display: block; }

/* Pied de page */
.pied-page { max-width: 900px; margin: 0 auto; padding: 0 16px 100px; text-align: center; font-size: 13px; color: var(--text-muted); }
.pied-page a { color: var(--text-muted); margin: 0 8px; display: inline-block; padding: 8px 0; }
.legal h2 { font-size: 18px; margin-top: 24px; }
.legal p, .legal li { line-height: 1.6; }
.bandeau-brouillon { background: var(--warning-bg); color: var(--warning-text); padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.compteur { font-size: 12px; color: var(--text-muted); text-align: end; }

@media print {
  .barre-marque, nav.basse, .pied-page, .pas-impression, .selecteur-langue, .message { display: none !important; }
  body { background: #fff; color: #000; }
  .carte { border: 1px solid #999; break-inside: avoid; }
  .conteneur, .conteneur-large { padding: 0; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── Lot 1 (v0.3) ── */
.champ-pin-parent { font-size: 22px; letter-spacing: 10px; text-align: center; max-width: 180px; }
.dates-defi { font-size: 13px; color: var(--text-muted); margin: 2px 0 6px; }
.pourcent { font-weight: 800; }

/* ── Affichage : mode lecture facile (dyslexie) et texte plus grand ── */
body.mode-dys { font-family: Verdana, Tahoma, "Trebuchet MS", sans-serif; letter-spacing: .05em; word-spacing: .16em; line-height: 1.85; }
body.mode-dys p, body.mode-dys li, body.mode-dys label { text-align: start; }
body.texte-grand { font-size: 118%; }
.case { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.case input[type="checkbox"] { width: 24px; height: 24px; }
.cloche { position: relative; text-decoration: none; font-size: 20px; padding: 6px 8px; margin-inline-start: auto; }
.cloche .pastille { position: absolute; top: -2px; inset-inline-end: -2px; font-size: 11px; min-width: 18px; padding: 1px 5px; }
.notif-nouvelle { border-inline-start: 5px solid var(--brand); }
.version { margin: 0 8px; opacity: .7; }

/* ── Motivation : mascotte, série, parcours, badges, étagère, célébration ── */
.mascotte { position: relative; display: inline-block; line-height: 1; }
.mascotte .accessoire { position: absolute; top: -.55em; inset-inline-end: -.35em; font-size: .6em; }
.mascotte-grande { overflow: visible; }
.mascotte-geante { font-size: 72px; }
.serie { display: flex; align-items: center; gap: 12px; }
.serie-flamme { font-size: 34px; }
.serie-active { border-color: var(--warning-fill); background: var(--warning-bg); color: var(--warning-text); }
.serie-active .texte-discret { color: var(--warning-text); }
.raccourcis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 16px; }
.raccourcis .btn-secondaire { padding: 10px 6px; font-size: 13px; text-align: center; }
.mini-defi { background: var(--surface); border-style: dashed; }

.parcours { list-style: none; display: flex; justify-content: space-between; gap: 2px; padding: 0; margin: 10px 0 4px; overflow-x: auto; }
.parcours .etape { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 36px; font-size: 10px; text-align: center; color: var(--text-muted); }
.parcours .etape-emoji { font-size: 22px; filter: grayscale(1); opacity: .45; }
.parcours .etape-atteinte .etape-emoji { filter: none; opacity: 1; }
.parcours .etape-courante .etape-emoji { filter: none; opacity: 1; font-size: 30px; animation: sautille 1.6s ease-in-out infinite; }
.parcours .etape-courante .etape-nom { font-weight: 700; color: var(--brand-dark); }
@keyframes sautille { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

.celebration { position: relative; overflow: hidden; background: var(--success-bg); color: var(--success-text); border-color: var(--success-fill); text-align: center; }
.celebration-info { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-fill); }
.confettis { position: absolute; inset: 0; pointer-events: none; }
.confettis i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; opacity: .9; animation: tombe 2.4s ease-in 1; }
.confettis i:nth-child(1) { left: 6%; background: #e85d75; animation-delay: .0s; } .confettis i:nth-child(2) { left: 18%; background: #f5b82e; animation-delay: .2s; }
.confettis i:nth-child(3) { left: 30%; background: #34b46a; animation-delay: .1s; } .confettis i:nth-child(4) { left: 44%; background: #4a90e2; animation-delay: .35s; }
.confettis i:nth-child(5) { left: 58%; background: #e85d75; animation-delay: .15s; } .confettis i:nth-child(6) { left: 70%; background: #f5b82e; animation-delay: .3s; }
.confettis i:nth-child(7) { left: 82%; background: #34b46a; animation-delay: .05s; } .confettis i:nth-child(8) { left: 93%; background: #4a90e2; animation-delay: .25s; }
@keyframes tombe { to { transform: translateY(190px) rotate(300deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .confettis i, .parcours .etape-courante .etape-emoji { animation: none; } .confettis { display: none; } }

.grille-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.badge-carte { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 8px; text-align: center; display: flex; flex-direction: column; gap: 3px; }
.badge-carte small { color: var(--text-muted); font-size: 12px; }
.badge-emoji { font-size: 34px; }
.badge-verrouille { opacity: .55; }
.choix-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.choix-carte { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 2px solid var(--border); border-radius: 12px; padding: 8px 4px; text-align: center; cursor: pointer; font-size: 13px; color: var(--text); margin: 0; }
.choix-carte:has(input:checked) { border-color: var(--brand-dark); background: var(--bg); }
.choix-carte input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choix-carte:focus-within { outline: 3px solid var(--focus); }
.choix-carte.verrouille { opacity: .5; cursor: not-allowed; }
.choix-emoji { font-size: 28px; }

.etagere { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 14px 10px; padding: 14px 10px 6px; background: linear-gradient(var(--surface), var(--surface)) padding-box; border: 1px solid var(--border); border-radius: 14px; border-bottom: 10px solid #b58863; }
.livre-etagere { text-align: center; }
.livre-etagere .titre-livre { font-size: 12px; margin: 6px 0 0; line-height: 1.25; }
.etoiles { color: #d99a06; margin: 2px 0 0; font-size: 14px; letter-spacing: 1px; }
.emotion { font-size: 11px; margin: 0; color: var(--text-muted); }
.coffre { font-size: 64px; }
.affichage-minuteur { font-size: 56px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 4px 0 12px; }
.actions-minuteur { display: flex; flex-direction: column; gap: 8px; }

/* Thèmes de couleurs choisis par l'enfant (contraste vérifié : texte blanc sur --brand-dark ≥ 5:1) */
body[data-palette="ocean"] { --brand: #2b86c5; --brand-dark: #1c5f94; --bg: #eef5fa; }
body[data-palette="coucher"] { --brand: #e0773f; --brand-dark: #a8431f; --bg: #fbf1ea; }
body[data-palette="espace"] { --brand: #7c6ad6; --brand-dark: #4c3f9e; --bg: #f0eefa; }
body[data-palette="bonbon"] { --brand: #d9559f; --brand-dark: #a62e78; --bg: #fcf0f6; }
@media (prefers-color-scheme: dark) {
  body[data-palette="ocean"] { --brand: #6bb6ee; --bg: #14202a; }
  body[data-palette="coucher"] { --brand: #f2a06f; --bg: #26190f; }
  body[data-palette="espace"] { --brand: #aa9bf2; --bg: #19162b; }
  body[data-palette="bonbon"] { --brand: #f08ac0; --bg: #2a1421; }
}

.btn-vert { background: var(--brand-dark); color: #fff; border: none; font-weight: 600; }
.idees-recompenses .idee { margin: 2px 2px 2px 0; text-align: start; }
.meta .etoiles { font-size: 16px; }
.grille-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.grand-chiffre { font-size: 30px; font-weight: 800; }
.histo { display: flex; gap: 6px; align-items: flex-end; height: 150px; }
.histo-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.histo-barre { flex: 1; width: 100%; display: flex; align-items: flex-end; background: var(--bg); border-radius: 6px; overflow: hidden; }
.histo-barre > div { width: 100%; background: var(--brand-dark); min-height: 2px; }
.histo-valeur, .histo-etiquette { font-size: 11px; color: var(--text-muted); }
.calendrier { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendrier .jour { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--bg); font-size: 12px; color: var(--text-muted); }
.calendrier .jour-lu { background: var(--brand-dark); color: #fff; font-weight: 700; }
.calendrier .jour-futur { opacity: .4; }
.raccourcis-classe { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filtres-classe { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
.filtres-classe select { width: auto; }

/* Liens « Mon compte » / « Déconnexion » dans l'en-tête (grands écrans) */
.haut-compte { display: none; align-items: center; gap: 4px; margin-inline-start: auto; }
.haut-compte a, .haut-compte button { background: none; border: 0; color: var(--brand-dark); font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 10px; cursor: pointer; text-decoration: none; min-height: 36px; }
.haut-compte a:hover, .haut-compte button:hover { background: var(--bg); }
.haut-compte form { margin: 0; padding: 0; }
.haut-compte + .cloche { margin-inline-start: 0; }
@media (min-width: 900px) { .haut-compte { display: flex; } }

/* ───────── Pages de suivi (parent / éducateur) : lisibles, aérées, repliables ───────── */
.suivi-retour { margin: 0 0 8px; font-size: 14px; }
.suivi-entete { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.avatar-grand { width: 60px; height: 60px; font-size: 32px; }
.suivi-identite { flex: 1; min-width: 160px; }
.suivi-identite h1 { margin: 0 0 4px; font-size: 26px; line-height: 1.15; }
.suivi-puces { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.puce { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); color: var(--text-muted); white-space: nowrap; }
.suivi-actions-haut { display: flex; gap: 8px; align-items: center; margin-inline-start: auto; }

.menu-deroulant { position: relative; }
.menu-deroulant > summary { list-style: none; cursor: pointer; }
.menu-deroulant > summary::-webkit-details-marker { display: none; }
.menu-deroulant .menu-libelle { display: none; margin-inline-start: 6px; }
@media (min-width: 560px) { .menu-deroulant .menu-libelle { display: inline; } }
.menu-liste { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 6px; display: flex; flex-direction: column; }
.menu-liste a { padding: 11px 12px; border-radius: 10px; text-decoration: none; color: var(--text); font-size: 14px; min-height: 44px; display: flex; align-items: center; gap: 8px; }
.menu-liste a:hover, .menu-liste a:focus-visible { background: var(--bg); }
.menu-liste a.menu-danger { color: var(--danger-text); }

.suivi-grille { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: start; }
@media (min-width: 960px) { .suivi-grille { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 22px; } .suivi-cote { position: sticky; top: 72px; } }
.suivi-cote { display: flex; flex-direction: column; gap: 10px; }
.suivi-principal { min-width: 0; }

.suivi-defi { padding: 18px; }
.suivi-defi-haut { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.suivi-dates { font-size: 13px; color: var(--text-muted); }
.suivi-chiffres { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; gap: 10px; }
.suivi-grand { font-size: 34px; font-weight: 800; line-height: 1; }
.suivi-sur { font-size: 16px; color: var(--text-muted); font-weight: 600; }
.suivi-pourcent { font-size: 24px; font-weight: 800; color: var(--brand-dark); }
@media (prefers-color-scheme: dark) { .suivi-pourcent { color: var(--brand); } }
.suivi-defi .barre-progression { height: 14px; margin: 10px 0 6px; }
.suivi-rythme { margin: 8px 0 0; padding: 8px 12px; border-radius: 10px; background: #eef6f8; color: #2b2b28; font-size: 14px; }
.suivi-recompense { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.suivi-recompense-img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; flex-shrink: 0; }
.suivi-recompense-texte { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.suivi-ok { color: var(--success-text); font-size: 13px; font-weight: 600; }
.suivi-defi form { margin-top: 12px; }

.suivi-titre-ligne { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.suivi-titre { font-size: 18px; margin: 0; display: flex; align-items: center; gap: 8px; }
.compteur { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); font-size: 13px; font-weight: 700; color: var(--text-muted); }
.compteur-attention { background: var(--warning-bg); border-color: var(--warning-fill); color: var(--warning-text); }

.lecture-carte { padding: 14px; }
.lecture-tete { display: flex; gap: 12px; align-items: flex-start; }
.lecture-infos { flex: 1; min-width: 0; }
.lecture-titre { font-size: 16px; display: block; overflow-wrap: anywhere; }
.lecture-avis { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: end; }
.lecture-details { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 4px; }
.lecture-details > summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; font-size: 14px; font-weight: 600; color: var(--text-muted); }
.validation-forme { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; margin-top: 10px; }
.validation-forme .petit-mot { flex: 1 1 220px; min-width: 0; }
.validation-forme .petit-mot > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-size: 14px; color: var(--text-muted); }
.validation-forme .btn-valider { flex: 0 0 auto; min-width: 150px; order: 2; }
@media (max-width: 559px) { .validation-forme .btn-valider { width: 100%; } }
.lecture-carte details.refus { margin-top: 2px; }
.lecture-carte details.refus summary { font-size: 14px; font-weight: 500; }

.vide-gentil { text-align: center; padding: 22px 12px; color: var(--text-muted); }
.vide-gentil > span { font-size: 36px; display: block; }
.vide-gentil p { margin: 6px 0 12px; }
.vide-gentil .btn-principal { display: inline-block; width: auto; padding-inline: 24px; }

details.pli { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; margin-bottom: 12px; }
details.pli > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; min-height: 52px; font-weight: 700; font-size: 15px; }
details.pli > summary::-webkit-details-marker { display: none; }
details.pli > summary::after { content: "▾"; margin-inline-start: 6px; color: var(--text-muted); transition: transform .15s; }
details.pli[open] > summary::after { transform: rotate(180deg); }
details.pli > summary > span:first-child { flex: 1; }
.pli-corps { padding: 0 16px 16px; }
.suivi-cote details.pli { margin-bottom: 0; }
.histo-ligne { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.histo-ligne:last-child { border-bottom: 0; }
.liste-acces { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; overflow-wrap: anywhere; }

/* Vue de classe : cartes d'élèves */
.classe-resume { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.liste-eleves { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 700px) { .liste-eleves { grid-template-columns: 1fr 1fr; } }
.eleve-ligne { display: flex; gap: 12px; align-items: center; padding: 14px; margin: 0; text-decoration: none; color: var(--text); }
.eleve-ligne:hover { border-color: var(--brand); }
.eleve-corps { flex: 1; min-width: 0; }
.eleve-nom { font-weight: 700; font-size: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.eleve-meta { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.eleve-ligne .barre-progression { margin: 8px 0 4px; height: 10px; }
.eleve-fleche { font-size: 20px; color: var(--text-muted); }

/* ===================================================================
   Habillage « bibliothèque enchantée » (v0.3.4)
   Étagère de livres en bandeau, fond à motifs de livres et d'étoiles,
   boutons « tranche de livre », pied de page et barre du bas façon bois sombre.
   =================================================================== */
:root {
  --bg: #eaf5f2;
  --titre: #14574e;
  --or: #F4B740; --or-texte: #3a2a05; --corail: #e8765f; --nuit: #0f4a43;
  --police-titre: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) { --bg: #10201e; --titre: #bff0e8; --nuit: #0a2f2b; }
}
body {
  background-color: var(--bg);
  background-image: url("../img/fond-motif.552fa5f94456.svg");
  background-size: 220px 220px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) body { background-image: url("../img/fond-motif-sombre.90f6a2dec880.svg"); }
}
h1, h2, h3 { font-family: var(--police-titre); color: var(--titre); letter-spacing: -.01em; }
h1 { font-weight: 800; }

/* --- Bandeau : ciel étoilé + étagère --- */
.barre-marque {
  position: relative; top: auto; z-index: 20; border-bottom: 0;
  padding: 10px 12px 44px;
  background: linear-gradient(180deg, var(--brand-dark), color-mix(in srgb, var(--brand-dark) 72%, var(--brand)));
  color: #fff;
}
.barre-marque::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 35px; pointer-events: none;
  background: url("../img/etagere.aeceec0e3b70.svg") repeat-x left bottom / 300px 35px;
}
.barre-marque .marque-lien:hover, .barre-marque .marque-lien:active { background: rgba(255,255,255,.14); }
.barre-marque .marque-icone { width: 38px; height: 38px; border-radius: 11px; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.barre-marque .marque-nom, :root:not([data-theme="clair"]) .barre-marque .marque-nom { color: #fff; font-family: var(--police-titre); font-size: 20px; font-weight: 800; letter-spacing: .2px; }
.barre-marque .cloche { background: rgba(255,255,255,.18); border-radius: 999px; padding: 6px 9px; }
.barre-marque .cloche:hover { background: rgba(255,255,255,.3); }
.barre-marque .selecteur-langue select { background: rgba(255,255,255,.95); color: #1f2b29; border-color: transparent; }
.haut-compte a, .haut-compte button { color: #fff; }
.haut-compte a:hover, .haut-compte button:hover { background: rgba(255,255,255,.16); }

/* --- Cartes --- */
.carte {
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--border));
  box-shadow: 0 3px 0 color-mix(in srgb, var(--brand) 16%, transparent), 0 10px 22px rgba(15, 74, 67, .07);
}
.carte-info { background: #e3f3f0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) .carte { box-shadow: 0 3px 0 rgba(0,0,0,.25); }
  :root:not([data-theme="clair"]) .carte-info { background: #1b3532; color: var(--text); }
  :root:not([data-theme="clair"]) .carte-info a { color: var(--brand); }
}

/* --- Boutons « tranche de livre » --- */
.btn-principal {
  border-radius: 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand-dark) 88%, #fff), var(--brand-dark));
  box-shadow: 0 4px 0 color-mix(in srgb, var(--brand-dark) 55%, #000), 0 8px 14px rgba(15, 74, 67, .18);
  transition: transform .08s, box-shadow .08s;
}
.btn-principal:hover { background: linear-gradient(180deg, color-mix(in srgb, var(--brand-dark) 80%, #fff), color-mix(in srgb, var(--brand-dark) 92%, #000)); }
.btn-principal:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--brand-dark) 55%, #000); }
.btn-secondaire { border-radius: 14px; border: 1.5px solid color-mix(in srgb, var(--brand) 45%, var(--border)); }
.btn-secondaire:hover { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.btn-danger { border: 1px solid transparent; }

/* --- Avatars : médaillon doré --- */
.avatar { background: radial-gradient(circle at 30% 25%, #fff, #d9f0ec); box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--or); }
.carte-eleve { transition: transform .12s; }
.carte-eleve:hover { transform: translateY(-3px); }

/* --- Progression : reflet --- */
.barre-progression { height: 14px; }
.barre-progression > div { background-image: linear-gradient(rgba(255,255,255,.32), rgba(255,255,255,0) 60%); }

/* --- Barre du bas : bois sombre, onglet actif doré --- */
nav.basse { background: var(--nuit); border-top: 3px solid color-mix(in srgb, var(--nuit) 60%, #000); box-shadow: 0 -4px 14px rgba(0,0,0,.18); }
nav.basse a, nav.basse button { color: #cfe7e2; }
nav.basse a:active, nav.basse button:active { background: rgba(255,255,255,.1); }
nav.basse a.actif, :root:not([data-theme="clair"]) nav.basse a.actif { background: var(--or); color: var(--or-texte); font-weight: 700; }
nav.basse a.actif i { color: var(--or-texte); }

/* --- Pied de page : plinthe sombre --- */
.pied-page {
  max-width: none; margin: 28px 0 0; padding: 22px 16px 92px;
  background: var(--nuit); color: #9fc9c1; border-radius: 22px 22px 0 0;
}
.pied-page a { color: #cfe7e2; }
.pied-page .version { color: #7fb0a7; }

/* --- Scènes d'illustration --- */
.hero-accueil { display: block; width: 100%; height: auto; border-radius: 22px; box-shadow: 0 4px 0 color-mix(in srgb, var(--nuit) 70%, transparent), 0 12px 24px rgba(15,74,67,.16); }
.hero-court { height: 120px; object-fit: cover; object-position: center 35%; margin-bottom: 14px; }
.titre-accueil { text-align: center; margin: 14px 0 14px; }
.titre-accueil h1 { margin: 0 0 4px; font-size: 34px; }
.titre-accueil p { margin: 0; font-size: 16px; color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
  .btn-principal, .carte-eleve { transition: none; }
}
@media print { body { background-image: none; } }
.lecture-item { background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 14%, var(--border)); }

/* --- v0.4 : statut des lectures, lien discret --- */
.statut-lecture-en_attente { background: var(--warning-bg); color: var(--warning-text); }
.statut-lecture-validee { background: var(--success-bg); color: var(--success-text); }
.statut-lecture-rejetee { background: var(--danger-bg); color: var(--danger-text); }
.lien-discret { font-size: 13px; display: inline-block; padding: 6px 0; }
.lecture-carte .lecture-details { margin-top: 8px; }
