/* Couleurs et mise en page du site de dictées. Pensé d'abord pour téléphone et tablette, utilisable par un enfant seul. */
:root{--bg:#f4f6ff;--surface:#fff;--ink:#1b1d2a;--muted:#5b6078;--line:#dde1f0;--soft:#e9edff;--accent:#3d6cff;--accent-ink:#fff;--ok:#16834a;--faute:#d93a3a;--fautebg:#ffe3e3;--warnbg:#fff4d6;
--f:ui-rounded,"SF Pro Rounded","Nunito","Segoe UI",system-ui,-apple-system,sans-serif}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--bg:#11131c;--surface:#1a1d29;--ink:#eceefa;--muted:#a3a8c3;--line:#2b2f42;--soft:#232843;--accent:#7f9cff;--accent-ink:#0c1230;--ok:#4fcf8a;--faute:#ff7b7b;--fautebg:#4a1f25;--warnbg:#3a3015;color-scheme:dark}}
:root[data-theme="dark"]{--bg:#11131c;--surface:#1a1d29;--ink:#eceefa;--muted:#a3a8c3;--line:#2b2f42;--soft:#232843;--accent:#7f9cff;--accent-ink:#0c1230;--ok:#4fcf8a;--faute:#ff7b7b;--fautebg:#4a1f25;--warnbg:#3a3015;color-scheme:dark}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:18px/1.5 var(--f)}
button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation}
.wrap{max-width:760px;margin:0 auto;padding:10px 16px calc(28px + env(safe-area-inset-bottom))}
.top{display:flex;justify-content:space-between;align-items:center;padding:4px 0}
.brand{font-weight:800;font-size:21px;color:var(--ink);text-decoration:none}.brand span{color:var(--accent)}
.ghost{background:none;border:1px solid var(--line);border-radius:99px;padding:6px 14px;font-size:15px;color:var(--muted)}
h1{font-size:clamp(28px,7vw,42px);line-height:1.12;margin:14px 0 8px;letter-spacing:-.01em}h1 em{font-style:normal;color:var(--accent)}
h2{font-size:22px;margin:0 0 10px}
.lead{color:var(--muted);margin:0 0 16px;font-size:18px}
.muted{color:var(--muted);font-size:15px}
.card{background:var(--surface);border:1px solid var(--line);border-radius:20px;padding:18px;margin:22px 0 0}
.proof{display:flex;flex-wrap:wrap;gap:6px 16px;padding:0;margin:8px 0;list-style:none;font-size:16px}
.proof li:before{content:"✓ ";color:var(--ok);font-weight:800}

/* Niveaux */
.niveaux{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px}
.niv{border:0;border-radius:22px;padding:18px 10px;min-height:112px;background:var(--c);color:#1b1d2a;font-weight:800;font-size:34px;display:flex;flex-direction:column;align-items:center;justify-content:center;box-shadow:0 4px 0 rgba(0,0,0,.15);transition:transform .08s}
.niv small{font-size:15px;font-weight:600;opacity:.8}
.niv:active{transform:translateY(3px);box-shadow:0 1px 0 rgba(0,0,0,.15)}
.niveaux.mini{grid-template-columns:repeat(5,1fr);gap:6px;margin-bottom:16px}
.niveaux.mini .niv{min-height:56px;font-size:18px;padding:6px;border-radius:14px;opacity:.55}
.niveaux.mini .niv.on{opacity:1;outline:3px solid var(--ink)}
.petit-titre{font-weight:700;margin:0 0 6px}

/* Listes */
.liste{display:grid;gap:10px;margin-top:14px}
.item{display:flex;align-items:center;gap:12px;text-align:left;width:100%;background:var(--surface);border:2px solid var(--line);border-radius:18px;padding:14px 16px;font-size:20px;font-weight:700}
.item small{display:block;font-size:14px;font-weight:500;color:var(--muted)}
.item .pastille{flex:none;width:44px;height:44px;border-radius:50%;display:grid;place-items:center;background:var(--c,var(--soft));font-size:15px;color:#1b1d2a}
.item:active{border-color:var(--accent)}

/* Boutons */
.gros{display:block;width:100%;border:0;border-radius:20px;padding:18px;font-size:22px;font-weight:800;text-align:center;margin:10px 0}
.principal{background:var(--accent);color:var(--accent-ink);box-shadow:0 4px 0 rgba(0,0,0,.18)}
.secondaire{background:var(--soft);color:var(--ink)}
.retour{background:none;border:0;color:var(--accent);font-weight:700;padding:8px 0;font-size:17px}
.lien{background:none;border:0;color:var(--accent);font-weight:700;padding:10px 6px;font-size:16px}
.fichier{position:relative;overflow:hidden;cursor:pointer}
.fichier input{position:absolute;inset:0;opacity:0;cursor:pointer}

/* Prêt */
.pret{text-align:center}
.crayon{font-size:64px;margin-top:10px}
.options{margin-top:18px;text-align:left;background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:10px 16px}
.options summary{font-weight:700;cursor:pointer;color:var(--muted)}
.switch{display:flex;gap:10px;align-items:flex-start;margin:12px 0;font-size:16px}
.switch input{width:22px;height:22px;flex:none;accent-color:var(--accent)}
.seg{border:0;padding:0;margin:8px 0;display:flex;flex-wrap:wrap;gap:8px;font-size:16px}.seg legend{font-weight:600;margin-bottom:6px}
.seg label{border:1px solid var(--line);border-radius:99px;padding:8px 12px;display:flex;gap:6px;align-items:center}
.seg input{accent-color:var(--accent)}
.alerte{background:var(--warnbg);border-radius:14px;padding:12px 14px;font-size:16px;text-align:left}

/* Dictée */
#ecran-dictee{text-align:center;padding-top:8px}
.etape{font-size:24px;font-weight:800;margin-top:10px}
.barre{height:12px;background:var(--soft);border-radius:99px;overflow:hidden;margin:12px 0}
.barre span{display:block;height:100%;width:0;background:var(--accent);border-radius:99px;transition:width .3s}
.consigne{color:var(--muted);min-height:2.6em;margin:6px 0 10px;font-size:19px}
.play{width:min(62vw,250px);aspect-ratio:1;border-radius:50%;border:0;background:var(--accent);color:var(--accent-ink);display:flex;flex-direction:column;align-items:center;justify-content:center;margin:6px auto 22px;box-shadow:0 8px 0 rgba(0,0,0,.18);transition:transform .08s}
.play span{font-size:min(22vw,92px);line-height:1}
.play small{font-size:20px;font-weight:800;margin-top:4px}
.play:active{transform:translateY(5px);box-shadow:0 3px 0 rgba(0,0,0,.18)}
.play.pause{background:#ff8a3d;color:#1b1d2a}
.play.ecoute{animation:pulse 1.6s ease-in-out infinite}
@keyframes pulse{50%{box-shadow:0 8px 0 rgba(0,0,0,.18),0 0 0 14px color-mix(in srgb,var(--accent) 20%,transparent)}}
@media (prefers-reduced-motion:reduce){.play.ecoute{animation:none}}
.actions{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.act{border:0;border-radius:20px;background:var(--surface);border:2px solid var(--line);padding:14px 8px;font-size:18px;font-weight:700;line-height:1.2}
.act span{display:block;font-size:34px;margin-bottom:4px}
.act:active{border-color:var(--accent)}
.act:disabled{opacity:.4}
.actions.petites{display:flex;justify-content:space-between;margin-top:14px}

/* Correction */
.texte{background:var(--surface);border:1px solid var(--line);border-radius:20px;padding:18px;font-size:clamp(22px,5.4vw,28px);line-height:1.9}
.mot{display:inline;border:0;background:none;padding:2px 1px;border-radius:6px;font-size:inherit;line-height:inherit}
.mot.faute{background:var(--fautebg);color:var(--faute);text-decoration:underline wavy;text-underline-offset:5px}
.ecoute-phrase{border:0;background:var(--soft);border-radius:99px;width:38px;height:38px;font-size:18px;vertical-align:middle;margin-right:4px}
.score{font-size:20px;font-weight:700;text-align:center;margin:14px 0 4px}
.premium p{margin:0 0 10px}

/* Photo */
#photo-apercu{display:block;max-width:100%;max-height:240px;margin:10px auto;border-radius:14px}
.attente{text-align:center;font-weight:700}
.spin{display:inline-block;width:18px;height:18px;border:3px solid var(--soft);border-top-color:var(--accent);border-radius:50%;animation:tourne 1s linear infinite;vertical-align:-3px}
@keyframes tourne{to{transform:rotate(360deg)}}
.faute-ligne{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:10px 14px;margin:8px 0;font-size:17px}
.faute-ligne s{color:var(--faute)}.faute-ligne b{color:var(--ok)}

.pied{text-align:center;color:var(--muted);font-size:14px;margin-top:30px}.pied a{color:var(--muted)}
@media (min-width:700px){.play{width:260px}}
.ligne-code{display:flex;gap:8px;margin-top:8px}
.ligne-code input{flex:1;min-width:0;font:inherit;padding:12px;border-radius:14px;border:1px solid var(--line);background:var(--bg);color:var(--ink)}
.ligne-code button{flex:none;border:0;border-radius:14px;padding:12px 20px;font-weight:800}
a.achat{text-decoration:none}
.bloc-photo{margin-top:14px}
.carte-photo{display:flex;gap:14px;align-items:center;width:100%;text-align:left;background:var(--surface);border:2px dashed var(--accent);border-radius:22px;padding:16px}
.carte-photo .ico{font-size:40px;flex:none}
.carte-photo b{display:block;font-size:20px}
.carte-photo small{display:block;color:var(--muted);font-size:15px;line-height:1.35;margin-top:2px}
.code-achat{font:800 28px ui-monospace,Menlo,monospace;letter-spacing:.06em;text-align:center;background:var(--soft);border-radius:14px;padding:14px;margin:10px 0}
.petit{font-size:14px;margin-top:4px}
.carte-lien{color:var(--ink);text-decoration:none;border-style:solid;border-color:var(--line)}
