:root{
  --bg:#fef9ef; --carte:#ffffff; --texte:#1f2937; --doux:#6b7280; --bord:#f1e6cf;
  --accent:#16a34a; --accent2:#0ea5e9; --ok:#16a34a; --ko:#dc2626; --okbg:#dcfce7; --kobg:#fee2e2;
  --ombre:0 4px 0 rgba(0,0,0,.06), 0 8px 24px rgba(120,80,20,.08);
  --r:22px;
}
@media (prefers-color-scheme: dark){
  :root{ --bg:#14181f; --carte:#1f2530; --texte:#f1f5f9; --doux:#9aa4b2; --bord:#2c3442; --okbg:#14361f; --kobg:#3d1717; --ombre:0 4px 0 rgba(0,0,0,.3); }
}
*{ box-sizing:border-box; }
html,body{ margin:0; background:var(--bg); color:var(--texte); font-family:Nunito,system-ui,-apple-system,"Segoe UI",sans-serif; font-size:18px; line-height:1.45; -webkit-tap-highlight-color:transparent; }
a{ color:inherit; text-decoration:none; }
button,input,textarea,select{ font:inherit; color:inherit; }
button{ cursor:pointer; }
:focus-visible{ outline:3px solid var(--accent2); outline-offset:2px; }

.tete{ position:sticky; top:0; z-index:10; display:flex; align-items:center; gap:10px; padding:10px 16px; padding-top:max(10px, env(safe-area-inset-top)); background:color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter:blur(8px); border-bottom:2px solid var(--bord); }
.tete h1{ flex:1; font-size:1.15rem; margin:0; font-weight:900; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.logo{ font-size:1.8rem; }
.compteurs{ display:flex; gap:6px; }
.pastille{ background:var(--carte); border:2px solid var(--bord); border-radius:99px; padding:2px 9px; font-weight:800; font-size:.85rem; white-space:nowrap; }
.page{ max-width:720px; margin:0 auto; padding:16px 16px 110px; }
.page.centrer{ min-height:100vh; display:grid; place-items:center; padding-bottom:16px; }
.nav{ position:fixed; bottom:0; left:0; right:0; z-index:10; display:flex; justify-content:space-around; background:var(--carte); border-top:2px solid var(--bord); padding:6px 4px; padding-bottom:max(6px, env(safe-area-inset-bottom)); }
.nav a{ display:flex; flex-direction:column; align-items:center; font-size:.75rem; font-weight:800; color:var(--doux); padding:4px 12px; border-radius:14px; min-width:64px; }
.nav a span{ font-size:1.5rem; line-height:1.2; }
.nav a.on{ color:var(--accent); background:var(--okbg); }

.carte{ background:var(--carte); border:2px solid var(--bord); border-radius:var(--r); padding:18px; margin:0 0 14px; box-shadow:var(--ombre); }
.carte h2,.carte h3{ margin:.1em 0 .4em; }
.centre{ text-align:center; }
.grosemoji{ font-size:3.6rem; line-height:1.1; }
.grand{ font-size:1.25rem; }
.aide{ color:var(--doux); font-size:.92rem; }
.titre{ margin:22px 4px 10px; font-weight:900; }
.erreur{ color:var(--ko); font-weight:700; min-height:1em; }
.petit{ font-size:.85rem; }

.btn{ display:inline-flex; align-items:center; justify-content:center; gap:6px; border:0; border-radius:16px; padding:13px 20px; font-weight:900; background:var(--accent); color:#fff; box-shadow:0 4px 0 color-mix(in srgb, var(--accent) 60%, #000); transition:transform .08s; min-height:52px; text-align:center; }
.btn:active{ transform:translateY(3px); box-shadow:0 1px 0 color-mix(in srgb, var(--accent) 60%, #000); }
.btn.second{ background:var(--carte); color:var(--texte); border:2px solid var(--bord); box-shadow:0 4px 0 var(--bord); }
.btn.danger{ background:#fff; color:var(--ko); border:2px solid #fca5a5; box-shadow:0 4px 0 #fca5a5; }
.btn:disabled{ opacity:.5; }
.rond{ width:44px; height:44px; border-radius:50%; border:2px solid var(--bord); background:var(--carte); font-size:1.2rem; display:inline-grid; place-items:center; flex:none; }
.lien{ background:none; border:0; color:var(--accent2); font-weight:800; padding:8px; text-decoration:underline; }
.rangee{ display:flex; gap:10px; align-items:center; justify-content:space-between; margin:10px 0; }
.rangee.wrap{ flex-wrap:wrap; justify-content:flex-start; }
.rangee .btn{ flex:1; }
.chip{ border:2px solid var(--bord); background:var(--carte); border-radius:99px; padding:6px 12px; font-weight:700; font-size:.85rem; }

.bonjour{ display:flex; align-items:center; gap:14px; background:linear-gradient(135deg,#22c55e,#0ea5e9); color:#fff; border-radius:var(--r); padding:16px; margin-bottom:14px; box-shadow:var(--ombre); }
.bonjour h2{ margin:0; font-size:1.35rem; }
.bonjour p{ margin:2px 0 0; opacity:.95; }
.bonjour > div:nth-child(2){ flex:1; }
.avatar{ font-size:2.6rem; width:64px; height:64px; display:grid; place-items:center; background:rgba(255,255,255,.25); border-radius:50%; flex:none; }
.anneau{ --p:0deg; width:72px; height:72px; border-radius:50%; background:conic-gradient(#fde047 var(--p), rgba(255,255,255,.3) 0); display:grid; place-items:center; flex:none; }
.anneau > div{ width:56px; height:56px; border-radius:50%; background:rgba(0,0,0,.18); display:flex; flex-direction:column; align-items:center; justify-content:center; line-height:1; }
.anneau b{ font-size:1.2rem; } .anneau small{ font-size:.6rem; }
.bulle{ background:#fff7d6; color:#5b4400; border:2px solid #fde68a; border-radius:18px; padding:12px 14px; margin:0 0 14px; }
.carte.parent,.carte.defi{ display:flex; align-items:center; gap:14px; }
.carte.parent .grosemoji,.carte.defi .grosemoji{ font-size:2.4rem; }
.carte.defi{ background:linear-gradient(135deg,#fef3c7,#fde68a); color:#5b4400; border-color:#fcd34d; }
.carte.defi.fait{ background:var(--okbg); color:inherit; border-color:#86efac; }
.carte small{ display:block; color:inherit; opacity:.8; }

.grille2{ display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:14px; }
.grille3{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:14px; }
.tuile{ --c:var(--accent); display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:4px; min-height:118px; padding:14px 8px; border-radius:var(--r); background:var(--carte); border:2px solid color-mix(in srgb, var(--c) 35%, var(--bord)); box-shadow:0 5px 0 color-mix(in srgb, var(--c) 45%, transparent); transition:transform .08s; }
.tuile:active{ transform:translateY(3px); }
.tuile .emo{ font-size:2.4rem; line-height:1.1; }
.tuile b{ font-weight:900; color:color-mix(in srgb, var(--c) 75%, var(--texte)); }
.tuile small{ color:var(--doux); font-size:.78rem; font-weight:700; }
.liste{ display:grid; gap:10px; margin-bottom:14px; }
.ligne{ --c:var(--accent); display:flex; align-items:center; gap:12px; text-align:left; background:var(--carte); border:2px solid var(--bord); border-left:8px solid var(--c); border-radius:18px; padding:12px 14px; width:100%; box-shadow:var(--ombre); }
.ligne > div{ flex:1; min-width:0; }
.ligne b{ display:block; } .ligne small{ color:var(--doux); font-size:.82rem; }
.ligne .emo{ font-size:1.8rem; } .fleche{ font-size:1.6rem; color:var(--doux); }
.etoiles{ font-size:1.5rem; letter-spacing:2px; margin:.2em 0; }

.pas{ display:flex; gap:6px; justify-content:center; margin:4px 0 12px; }
.pas i{ width:28px; height:8px; border-radius:9px; background:var(--bord); }
.pas i.on{ background:var(--accent); }
.fiche{ border-top:8px solid var(--c); }
.fichetete{ display:flex; align-items:flex-start; gap:10px; justify-content:space-between; }
.rich p{ margin:.45em 0; } .rich ul{ margin:.3em 0; padding-left:1.3em; } .rich li{ margin:.25em 0; }
.rich b{ color:color-mix(in srgb, var(--accent) 70%, var(--texte)); }

.barre{ height:14px; background:var(--bord); border-radius:99px; overflow:hidden; margin:6px 0 12px; }
.barre i{ display:block; height:100%; background:var(--accent); border-radius:99px; transition:width .3s; }
.qtete{ display:flex; align-items:center; justify-content:space-between; color:var(--doux); font-weight:800; }
.qtete .rangee{ margin:0; }
.question{ font-size:1.3rem; font-weight:800; margin:10px 0 16px; }
.question .rich p{ margin:.3em 0; }
.reponses{ display:grid; gap:10px; }
.reponses.deux{ grid-template-columns:1fr 1fr; }
.choix{ background:var(--carte); border:3px solid var(--bord); border-radius:18px; padding:14px; font-weight:800; font-size:1.1rem; text-align:left; box-shadow:0 4px 0 var(--bord); min-height:58px; }
.reponses.deux .choix{ text-align:center; }
.choix.petit{ padding:10px 14px; min-height:0; font-size:1rem; }
.choix:disabled{ opacity:.65; }
.choix.bon{ border-color:var(--ok); background:var(--okbg); opacity:1; }
.choix.faux{ border-color:var(--ko); background:var(--kobg); opacity:1; }
.saisie{ width:100%; border:3px solid var(--bord); border-radius:16px; padding:14px; font-size:1.2rem; background:var(--carte); font-weight:700; }
.saisie:focus{ border-color:var(--accent2); outline:none; }
textarea.saisie{ font-weight:600; font-size:1.05rem; resize:vertical; }
.geant{ font-size:2rem; text-align:center; }
.retour{ margin-top:14px; border-radius:18px; padding:0; }
.retour.ok,.retour.ko{ padding:14px; border:3px solid; }
.retour.ok{ background:var(--okbg); border-color:#86efac; }
.retour.ko{ background:var(--kobg); border-color:#fca5a5; }
.retour b:first-child{ font-size:1.2rem; }
.retour .btn{ width:100%; margin-top:8px; }
.expl{ font-weight:600; }
.ordreligne{ min-height:52px; display:flex; flex-wrap:wrap; gap:6px; align-items:center; padding:8px; border:3px dashed var(--bord); border-radius:16px; }
.jeton{ background:var(--accent2); color:#fff; border-radius:12px; padding:6px 10px; font-weight:800; }
.chrono{ position:sticky; top:66px; z-index:5; margin:0 auto 8px; width:max-content; background:var(--carte); border:2px solid var(--bord); border-radius:99px; padding:4px 14px; font-weight:900; }
.chrono.urgent{ color:var(--ko); border-color:#fca5a5; }
.chrono.grand{ font-size:1.4rem; }
.fin h2{ font-size:2.4rem; margin:.1em 0; }
.revoir{ text-align:left; margin-top:12px; }
.revoir summary,details.carte summary{ font-weight:800; cursor:pointer; }
.err{ border-top:2px solid var(--bord); padding:8px 0; }
.err p{ margin:.2em 0; }

.score{ text-align:center; font-size:3rem; font-weight:900; color:var(--accent); }
.calcul{ text-align:center; font-size:2.6rem; font-weight:900; margin:10px 0; transition:transform .15s; }
.calcul.flash{ transform:scale(1.15); color:var(--ok); }
.secoue{ animation:secoue .3s; }
@keyframes secoue{ 25%{ transform:translateX(-8px); } 75%{ transform:translateX(8px); } }
.motok{ color:var(--ok); font-weight:800; } .motko{ color:var(--ko); font-weight:800; text-decoration:underline wavy; }
.dicteecorr{ font-size:1.2rem; }
.corrige{ white-space:pre-wrap; background:var(--bg); border-radius:12px; padding:10px; }

.badge{ background:var(--carte); border:2px solid var(--bord); border-radius:18px; padding:12px 6px; text-align:center; opacity:.55; display:flex; flex-direction:column; gap:2px; }
.badge.on{ opacity:1; border-color:#fcd34d; background:#fffbeb; color:#5b4400; }
.badge .emo{ font-size:2rem; } .badge b{ font-size:.85rem; } .badge small{ font-size:.7rem; color:var(--doux); }

.chat{ display:flex; flex-direction:column; gap:10px; min-height:40vh; margin-bottom:10px; }
.chat.petit{ min-height:0; max-height:50vh; overflow:auto; }
.msg{ display:flex; gap:8px; align-items:flex-end; }
.msg.moi{ justify-content:flex-end; }
.msgav{ font-size:1.6rem; }
.msgbulle{ max-width:85%; border-radius:18px; padding:10px 14px; background:var(--carte); border:2px solid var(--bord); }
.msg.moi .msgbulle{ background:var(--accent); color:#fff; border-color:var(--accent); }
.msg.moi .rich b{ color:#fff; }
.msgbulle .rich p:first-child{ margin-top:0; } .msgbulle .rich p:last-child{ margin-bottom:0; }
.src{ display:block; margin-top:4px; font-size:.7rem; color:var(--doux); }
.suggest{ display:flex; gap:6px; overflow-x:auto; padding-bottom:6px; }
.suggest .chip{ white-space:nowrap; }
.envoi{ display:flex; gap:8px; align-items:flex-end; position:sticky; bottom:80px; background:var(--bg); padding:6px 0; }
.envoi .btn{ min-width:58px; }
.fond{ position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:50; display:grid; place-items:end center; padding:12px; }
.fenetre{ width:100%; max-width:640px; background:var(--carte); border-radius:var(--r); padding:14px; max-height:80vh; overflow:auto; }

.connexion{ width:100%; max-width:420px; text-align:center; }
label{ display:block; text-align:left; font-weight:800; margin:10px 0; font-size:.95rem; }
label input,label select,label textarea,form input,form select{ display:block; width:100%; margin-top:4px; border:2px solid var(--bord); border-radius:14px; padding:12px; background:var(--carte); font-weight:600; }
.interrupteur{ display:flex; align-items:center; gap:8px; font-weight:700; }
.interrupteur input{ width:22px; height:22px; margin:0; flex:none; }
fieldset{ border:2px solid var(--bord); border-radius:14px; margin:10px 0; }
legend{ font-weight:800; padding:0 6px; }
.avatars{ display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
.avatars button{ font-size:1.6rem; width:52px; height:52px; border-radius:14px; border:2px solid var(--bord); background:var(--carte); }
.avatars button.on{ border-color:var(--accent); background:var(--okbg); }
.etatia{ list-style:none; padding:0; margin:0; }
.etatia li{ display:flex; gap:10px; align-items:center; padding:8px 0; border-top:2px solid var(--bord); }
.etatia li > div{ flex:1; } .etatia small{ display:block; color:var(--doux); }
.stats .stat{ background:var(--carte); border:2px solid var(--bord); border-radius:18px; padding:12px 6px; text-align:center; }
.stat b{ display:block; font-size:1.2rem; } .stat small{ color:var(--doux); font-size:.75rem; }
.barres{ display:flex; gap:6px; align-items:flex-end; height:140px; padding-top:10px; }
.colonne{ flex:1; height:100%; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:2px; }
.colonne i{ width:100%; max-width:34px; background:linear-gradient(#22c55e,#0ea5e9); border-radius:8px 8px 3px 3px; }
.colonne small{ font-size:.7rem; color:var(--doux); } .colonne b{ font-size:.75rem; }
.matstats{ list-style:none; padding:0; margin:0; }
.matstats li{ padding:8px 0; border-top:2px solid var(--bord); }
.jauge{ height:10px; background:var(--bord); border-radius:99px; overflow:hidden; margin:4px 0; }
.jauge i{ display:block; height:100%; }

.toast{ position:fixed; left:50%; bottom:96px; transform:translate(-50%,30px); opacity:0; background:#111827; color:#fff; padding:12px 18px; border-radius:16px; font-weight:800; z-index:99; transition:.3s; max-width:90vw; text-align:center; }
.toast.on{ opacity:1; transform:translate(-50%,0); }
.confettis{ position:fixed; inset:0; pointer-events:none; z-index:98; overflow:hidden; }
.confettis i{ position:absolute; top:-12px; width:10px; height:14px; border-radius:3px; animation:tombe 2.2s ease-in forwards; }
@keyframes tombe{ to{ transform:translateY(105vh) rotate(720deg); } }
@media (prefers-reduced-motion: reduce){ .confettis{ display:none; } *{ transition:none !important; animation:none !important; } }
@media (max-width:380px){ html,body{ font-size:16px; } .compteurs .pastille:nth-child(2){ display:none; } }

/* schémas */
.fig{ margin:12px 0; display:flex; justify-content:center; overflow-x:auto; }
.fig-svg{ width:100%; height:auto; color:var(--texte); }
.fig-tab{ border-collapse:collapse; font-weight:800; text-align:center; }
.fig-tab th,.fig-tab td{ border:2px solid var(--bord); padding:5px 4px; min-width:34px; }
.fig-tab th{ font-size:.7rem; }
.fig-tab .mi{ background:#fef3c7; color:#78350f; } .fig-tab .m{ background:#dbeafe; color:#1e3a8a; } .fig-tab .u{ background:#fce7f3; color:#831843; }
.fig-tab td{ font-size:1.4rem; background:var(--carte); }
.fig-tab.conv .de{ background:#dbeafe; color:#1e3a8a; } .fig-tab.conv .vers{ background:#dcfce7; color:#14532d; }
.fig-pose{ font-family:ui-monospace,Consolas,monospace; font-size:1.6rem; font-weight:800; white-space:pre; line-height:1.25; background:var(--carte); border:2px dashed var(--bord); border-radius:14px; padding:10px 18px; }
.fig-pose .trait{ border-top:3px solid currentColor; height:4px; }
.fig-pose .res{ color:var(--accent); }
.fig-billets{ display:flex; flex-wrap:wrap; gap:8px; justify-content:center; }
.billet{ color:#111827; font-weight:900; border-radius:8px; padding:12px 14px; border:2px solid rgba(0,0,0,.2); box-shadow:inset 0 0 0 4px rgba(255,255,255,.5); }
.fig-phrase{ display:flex; flex-wrap:wrap; gap:6px; justify-content:center; }
.fig-phrase .bloc{ display:flex; flex-direction:column; align-items:center; border-radius:10px; padding:6px 10px; color:#111827; border:2px solid rgba(0,0,0,.08); }
.fig-phrase small{ font-size:.7rem; font-weight:700; opacity:.75; }
.fig-etiq{ display:flex; flex-wrap:wrap; gap:10px; justify-content:center; }
.fig-etiq > div{ display:flex; flex-direction:column; align-items:center; min-width:70px; background:var(--carte); border:2px solid var(--bord); border-radius:14px; padding:8px; }
.fig-etiq .e{ font-size:2.2rem; line-height:1.1; } .fig-etiq small{ font-weight:800; font-size:.75rem; text-align:center; }
.fig-emojis{ display:flex; flex-wrap:wrap; gap:10px; justify-content:center; font-size:2.4rem; }
.fig-etats{ display:flex; align-items:center; gap:6px; justify-content:center; flex-wrap:wrap; text-align:center; }
.fig-etats > div{ display:flex; flex-direction:column; align-items:center; }
.fig-etats .e{ font-size:2.4rem; } .fig-etats small{ font-size:.72rem; color:var(--doux); } .fig-etats .fl{ font-size:1.6rem; font-weight:900; color:var(--accent2); }
.fig-frise{ display:flex; justify-content:space-between; position:relative; width:100%; padding-top:4px; }
.fig-frise::before{ content:""; position:absolute; left:0; right:0; top:33px; height:4px; background:var(--accent2); border-radius:4px; }
.fig-frise > div{ min-width:0; padding:0 2px; display:flex; flex-direction:column; align-items:center; flex:1; text-align:center; position:relative; }
.fig-frise b{ font-size:.85rem; } .fig-frise i{ width:14px; height:14px; border-radius:50%; background:var(--accent2); border:3px solid var(--carte); margin:4px 0; z-index:1; } .fig-frise small{ font-size:.7rem; font-weight:700; overflow-wrap:anywhere; hyphens:auto; }
.question .fig{ margin:8px 0 4px; }
.fig-phrase .fleche{ align-self:center; font-weight:900; font-size:1.3rem; }
