/* public/style.css — écran enfant : grosses cibles tactiles, Andika, thème clair/sombre. */
:root {
  --fond: #f4f1fb; --carte: #ffffff; --encre: #22183b; --doux: #5f5578; --ligne: #ddd5f0;
  --accent: #5b3fa0; --accent-doux: #ece6fb; --sur-accent: #ffffff;
  --ok: #1a7842; --ok-doux: #e2f4e9; --indice: #9a5a00; --indice-doux: #fff1d6; --erreur: #b23a2b; --erreur-doux: #fbe6e2;
  --trou: #c76f1a; --trou-doux: #fbeedd; --partie: #6b7f89;
  --fond-avatar: #ece6fb; --or-texte: #7a5200;
  --f-titre: "Baloo 2", "Trebuchet MS", system-ui, sans-serif; --f-texte: "Andika", Verdana, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #15111f; --carte: #211a33; --encre: #f0ebfb; --doux: #b8aed3; --ligne: #3a3052;
    --accent: #b39cf0; --accent-doux: #2e2547; --sur-accent: #15111f;
    --ok: #5fd08f; --ok-doux: #163326; --indice: #f0b45a; --indice-doux: #3a2a12; --erreur: #f08a7a; --erreur-doux: #3a1f1b;
    --trou: #f0a456; --trou-doux: #3a2915; --partie: #7d8f99; --fond-avatar: #9a8fd0; --or-texte: #e0a800; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #15111f; --carte: #211a33; --encre: #f0ebfb; --doux: #b8aed3; --ligne: #3a3052;
  --accent: #b39cf0; --accent-doux: #2e2547; --sur-accent: #15111f;
  --ok: #5fd08f; --ok-doux: #163326; --indice: #f0b45a; --indice-doux: #3a2a12; --erreur: #f08a7a; --erreur-doux: #3a1f1b;
  --trou: #f0a456; --trou-doux: #3a2915; --partie: #7d8f99; --fond-avatar: #9a8fd0; --or-texte: #e0a800; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--encre); }
body { font-family: var(--f-texte); font-size: 20px; line-height: 1.5; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); overflow-x: hidden; }
.ecran { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
h1, h2 { font-family: var(--f-titre); line-height: 1.15; margin: 0; }
h1 { font-size: 1.8rem; } h2 { font-size: 1.3rem; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 4px solid var(--accent); outline-offset: 3px; }
.btn { font-family: var(--f-titre); font-weight: 800; font-size: 1.15rem; min-height: 56px; padding: 10px 24px; border-radius: 999px; border: 3px solid var(--accent); background: var(--accent); color: var(--sur-accent); cursor: pointer; }
.btn.grand { width: 100%; font-size: 1.3rem; min-height: 68px; }
.btn.secondaire { background: transparent; color: var(--accent); }
.btn:disabled, .touche:disabled, .lien:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.6); }
.touche:disabled:active { transform: none; }
.lien { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 10px 4px; min-height: 48px; font-size: 1rem; }
.petit { font-size: .9rem; color: var(--doux); }
.centre { text-align: center; align-items: center; }
.carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.chargement { text-align: center; color: var(--doux); padding: 40px 0; }
.accueil { display: flex; flex-direction: column; gap: 16px; align-items: center; text-align: center; }
.avatar-accueil { width: min(240px, 60vw); }
.avatar { width: 100%; height: auto; display: block; aspect-ratio: 200 / 264; }
.etoiles { color: var(--or-texte); font-size: 1.4rem; letter-spacing: 2px; word-break: break-all; }
.liens { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.sur-titre { font-size: .85rem; letter-spacing: .06em; text-transform: uppercase; color: var(--doux); font-weight: 700; }
.progression { height: 12px; background: var(--accent-doux); border-radius: 99px; overflow: hidden; }
.progression span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.question, .lecture, .atelier { display: flex; flex-direction: column; gap: 16px; }
.consigne { display: flex; gap: 12px; align-items: flex-start; }
.enonce { font-family: var(--f-titre); font-weight: 600; font-size: 1.35rem; flex: 1; }
.ecouter { min-width: 52px; min-height: 52px; border-radius: 50%; border: 2px solid var(--ligne); background: var(--carte); cursor: pointer; font-size: 1.3rem; }
.eq { font-family: var(--f-titre); font-weight: 800; font-size: 1.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.eq.grande { font-size: 2rem; }
.trou { display: inline-block; min-width: 2.2em; padding: 0 .3em; border: 3px dashed var(--trou); border-radius: 10px; color: var(--trou); background: var(--trou-doux); text-align: center; }
.defi { font-family: var(--f-titre); font-weight: 800; color: var(--or-texte); }
.aide { background: var(--indice-doux); border-radius: 14px; padding: 12px 16px; }
.saisie { margin: 0 auto; min-width: 9ch; min-height: 72px; padding: 8px 20px; border: 4px dashed var(--trou); border-radius: 16px; background: var(--trou-doux); font-family: var(--f-titre); font-weight: 800; font-size: 2.2rem; display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.saisie:focus .curseur { display: inline-block; width: 3px; height: 1.1em; background: var(--encre); margin-left: 2px; animation: clignote 1s steps(1) infinite; }
.curseur { display: none; }
@keyframes clignote { 50% { opacity: 0; } }
.pave { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 360px; width: 100%; margin: 0 auto; }
.touche { min-height: 64px; border-radius: 16px; border: 2px solid var(--ligne); background: var(--carte); font-family: var(--f-titre); font-weight: 800; font-size: 1.6rem; cursor: pointer; touch-action: manipulation; }
.touche.valider { background: var(--accent); color: var(--sur-accent); border-color: var(--accent); font-size: 1.1rem; }
.touche:active { transform: scale(.96); }
.options { display: flex; flex-direction: column; gap: 12px; }
.option { min-height: 60px; text-align: left; padding: 12px 18px; border-radius: 16px; border: 3px solid var(--ligne); background: var(--carte); cursor: pointer; font-size: 1.15rem; }
.option.bonne { border-color: var(--ok); background: var(--ok-doux); }
.option.choisie-fausse, .option.eliminee { border-color: var(--erreur); background: var(--erreur-doux); }
.option:disabled { cursor: default; }
.retour { border-radius: 16px; padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.retour.bravo { background: var(--ok-doux); }
.retour.indice { background: var(--indice-doux); }
.retour.correction { background: var(--accent-doux); }
.felicitation { font-family: var(--f-titre); font-weight: 800; font-size: 1.5rem; color: var(--ok); animation: saut .5s ease-out; }
@keyframes saut { 0% { transform: scale(.7); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
.fete { background: var(--accent-doux); border-radius: 16px; padding: 14px 18px; font-family: var(--f-titre); font-weight: 800; font-size: 1.2rem; animation: saut .6s ease-out; }
.aides-enfant { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: center; border-top: 1px dashed var(--ligne); padding-top: 8px; }
.fini { align-self: center; }
.blocs { display: flex; flex-direction: column; gap: 14px; }
.piege { background: var(--erreur-doux); border-radius: 14px; padding: 12px 16px; }
.piege::before { content: "Attention : "; font-weight: 700; }
.astuce { background: var(--accent-doux); border-radius: 14px; padding: 12px 16px; }
.astuce::before { content: "Astuce : "; font-weight: 700; }
.resolu { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; background: var(--carte); border: 1px solid var(--ligne); border-radius: 14px; padding: 12px 16px; }
.resolu dt { font-family: var(--f-titre); font-weight: 600; color: var(--accent); font-size: .9rem; text-transform: uppercase; }
.resolu dd { margin: 0; }
@media (max-width: 480px) { .resolu { grid-template-columns: 1fr; } }
.methode { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 8px; }
figure { margin: 0; display: flex; flex-direction: column; gap: 6px; align-items: center; }
figcaption { font-size: .9rem; color: var(--doux); text-align: center; }
figure svg { width: 100%; max-width: 480px; }
figure svg text { font-family: var(--f-titre); font-weight: 600; font-size: 20px; fill: var(--encre); }
.b-pied { fill: var(--doux); } .b-fleau { stroke: var(--encre); stroke-width: 6; stroke-linecap: round; } .b-axe { fill: var(--accent); }
.b-fil { stroke: var(--doux); stroke-width: 2; } .b-plateau { fill: var(--accent-doux); stroke: var(--accent); stroke-width: 2; }
svg text.b-egal { font-size: 28px; fill: var(--accent); }
.g-boite { fill: var(--trou-doux); stroke: var(--trou); stroke-width: 2; }
.p-point { fill: var(--accent); }
.barres { width: 100%; align-items: stretch; }
.bm-ligne { display: flex; gap: 3px; height: 48px; border-radius: 10px; overflow: hidden; }
.bm-ligne > div { display: grid; place-items: center; color: #fff; padding: 0 4px; text-align: center; font-family: var(--f-titre); font-weight: 600; font-size: .95rem; min-width: 0; }
.bm-tout { background: var(--accent); color: var(--sur-accent) !important; }
.bm-partie { background: var(--partie); }
.bm-trou { background: var(--trou-doux); color: var(--trou) !important; border: 3px dashed var(--trou); }
.niveaux { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.niveau { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 48px; }
.niveau.a-venir { color: var(--doux); }
.gains { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-family: var(--f-titre); font-weight: 600; }
.apercu { width: min(220px, 55vw); align-self: center; }
.onglets { display: flex; flex-wrap: wrap; gap: 6px; }
.onglets button { flex: 0 1 auto; min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--ligne); background: var(--carte); cursor: pointer; }
.onglets button[aria-selected="true"] { background: var(--accent); color: var(--sur-accent); border-color: var(--accent); }
.choix { display: flex; flex-wrap: wrap; gap: 10px; }
.choix-item { min-height: 52px; min-width: 52px; padding: 6px 14px; border-radius: 14px; border: 3px solid var(--ligne); background: var(--carte); cursor: pointer; display: flex; align-items: center; gap: 8px; }
.choix-item.actif { border-color: var(--accent); background: var(--accent-doux); }
.pastille { width: 30px; height: 30px; border-radius: 50%; display: inline-block; border: 2px solid var(--ligne); }
.icone { width: 1.2em; height: 1.2em; vertical-align: -.2em; flex: none; }
.encouragement { font-family: var(--f-titre); font-weight: 600; color: var(--accent); }
#panne:empty { display: none; }
#retour, #actions, #panne { scroll-margin-bottom: 12px; }
.question { padding-bottom: 12px; }
#panne .retour .btn { margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Espace parent */
body.parent { font-size: 17px; }
.ligne { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.niveaux-parent, .liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.niveau-parent { border: 1px solid var(--ligne); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.niveau-parent > .ligne { width: 100%; }
.badge { font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 99px; background: var(--accent-doux); color: var(--accent); }
.badge.enAttenteParent { background: var(--erreur-doux); color: var(--erreur); }
.badge.maitrise { background: var(--ok-doux); color: var(--ok); }
.badge.guide { background: var(--indice-doux); color: var(--indice); }
.guide, .phrase-soir { background: var(--accent-doux); border-radius: 12px; padding: 10px 14px; }
.phrase-soir { font-family: var(--f-titre); font-weight: 600; font-size: 1.2rem; border: 2px solid var(--accent); }
.urgent { border: 2px solid var(--erreur); }
.alerte { background: var(--erreur-doux); color: var(--encre); border-radius: 12px; padding: 10px 14px; }
.message { position: sticky; top: 8px; z-index: 2; border-radius: 12px; padding: 10px 14px; background: var(--ok-doux); }
.message.erreur { background: var(--erreur-doux); }
.message[hidden] { display: none; }
.champ { display: flex; flex-direction: column; gap: 4px; font-weight: 700; }
.champ input, .champ select { font: inherit; padding: 10px 12px; min-height: 48px; border-radius: 12px; border: 2px solid var(--ligne); background: var(--carte); color: var(--encre); }
.qr { width: min(260px, 70vw); background: #fff; padding: 8px; border-radius: 12px; }
.qr svg { width: 100%; height: auto; display: block; }
.lien-brut { word-break: break-all; font-size: .85rem; color: var(--doux); }
.btn.danger { background: var(--erreur); border-color: var(--erreur); color: var(--sur-accent); }
.confirmer { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 700; }
.btn.petit-btn { min-height: 40px; padding: 6px 14px; }
.carte.danger { border-color: var(--erreur); }
h3 { font-family: var(--f-titre); margin: 8px 0 0; }
