/* EasyMaths — cours SEO : charte premium alignée sur l'app (nav flottante, héros indigo + vague). */
:root {
  --primary: #2f6fe4;
  --primary-d: #1b4dc0;
  --navy: #0a2540;
  --ink: #1e2742;
  --muted: #64708c;
  --line: #e7edf7;
  --card: #fff;
  --bg: #f3f7fd;
  --accent: #2f6fe4;         /* couleur du thème — surchargée par page */
  --accent-soft: #eaf1fe;
  --gold: #e8a600;
  --green: #12a385;
  --red: #d92d20;
  --round: ui-rounded, 'SF Pro Rounded', -apple-system, 'Segoe UI', system-ui, sans-serif;
}
/* thèmes (couleur d'accent + teinte douce) */
.t-mult  { --accent: #2f6fe4; --accent-soft: #eaf1fe; }
.t-add   { --accent: #12a385; --accent-soft: #e7f8f3; }
.t-sous  { --accent: #e07000; --accent-soft: #fff1e4; }
.t-tab   { --accent: #8b46d3; --accent-soft: #f3ecfd; }
.t-div   { --accent: #d92d20; --accent-soft: #fdeceb; }
.t-frac  { --accent: #0891b2; --accent-soft: #e4f5fa; }
.t-dec   { --accent: #4f46e5; --accent-soft: #ecebfd; }
.t-aire  { --accent: #d6337d; --accent-soft: #fde9f2; }
.t-hub   { --accent: #2f6fe4; --accent-soft: #eaf1fe; }
.t-num   { --accent: #b45309; --accent-soft: #fdf0dd; }
.t-heure { --accent: #0369a1; --accent-soft: #e0f2ff; }
.t-monnaie { --accent: #a16207; --accent-soft: #fdf3d9; }
.t-comp  { --accent: #0e7490; --accent-soft: #e0f7fa; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--round);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}
a { color: var(--primary-d); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }

/* ---- nav flottante (pilule translucide, comme l'app) ---- */
.nav { position: fixed; top: 14px; left: 0; right: 0; z-index: 50; padding: 0 16px; pointer-events: none; }
.nav-in {
  pointer-events: auto; max-width: 980px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px 8px 20px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.55); border-radius: 999px;
  box-shadow: 0 12px 32px -14px rgba(20, 30, 60, 0.3), 0 2px 6px -3px rgba(47, 111, 228, 0.14);
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.05rem; color: var(--ink); letter-spacing: -0.02em; }
.brand svg { width: 30px; height: 30px; }
.nav-r { display: flex; align-items: center; gap: 6px; }
.nav-link { color: #475569; font-weight: 600; font-size: 0.9rem; padding: 8px 15px; border-radius: 999px; }
.nav-link:hover { text-decoration: none; color: var(--primary-d); background: rgba(47, 111, 228, 0.09); }
.nav-cta { background: var(--primary); color: #fff; font-weight: 800; font-size: 0.9rem; padding: 9px 18px; border-radius: 999px; }
.nav-cta:hover { text-decoration: none; background: var(--primary-d); }
@media (max-width: 560px) { .nav-link { display: none; } }

/* ---- héros indigo + vague ---- */
.hero {
  position: relative; padding: 92px 20px 0; color: #fff; overflow: hidden;
  background:
    radial-gradient(900px 520px at 12% -20%, rgba(133,178,255,0.4), transparent 62%),
    radial-gradient(700px 460px at 92% 4%, rgba(64,130,250,0.34), transparent 58%),
    linear-gradient(165deg, var(--primary) 0%, #17418f 60%, var(--navy) 130%);
}
.hero-in { max-width: 780px; margin: 0 auto; padding-bottom: 72px; position: relative; z-index: 1; }
.hero .crumb { font-size: 0.85rem; font-weight: 600; color: rgba(255,255,255,0.72); margin: 0 0 18px; }
.hero .crumb a { color: rgba(255,255,255,0.72); }
.hero .crumb a:hover { color: #fff; }
.hero .crumb b { color: #fff; }
.hero .badge { display: inline-flex; align-items: center; gap: 7px; background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.2); padding: 5px 13px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; margin-bottom: 16px; }
.hero h1 { font-size: clamp(1.9rem, 4.6vw, 2.9rem); font-weight: 850; letter-spacing: -0.03em; line-height: 1.08; margin: 0 0 14px; }
.hero .lede { font-size: 1.15rem; color: rgba(255,255,255,0.9); font-weight: 500; margin: 0; max-width: 40em; }
.hero .meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; font-size: 0.84rem; font-weight: 600; color: rgba(255,255,255,0.78); }
.hero .meta .pill { background: rgba(255,255,255,0.16); padding: 3px 11px; border-radius: 999px; }
.wave { position: absolute; left: 0; bottom: -1px; width: 100%; height: 64px; display: block; }

/* ---- corps ---- */
.wrap { max-width: 780px; margin: 0 auto; padding: 4px 20px 0; }
.article h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); font-weight: 830; letter-spacing: -0.025em; margin: 46px 0 12px; scroll-margin-top: 88px; position: relative; padding-left: 18px; }
.article h2::before { content: ''; position: absolute; left: 0; top: 0.15em; bottom: 0.15em; width: 5px; border-radius: 3px; background: var(--accent); }
.article h3 { font-size: 1.16rem; font-weight: 800; margin: 26px 0 8px; }
.article p { margin: 0 0 14px; }
.article strong { font-weight: 750; }
.article ul, .article ol { margin: 0 0 16px; padding-left: 22px; }
.article li { margin: 6px 0; }
.article a { color: var(--accent); font-weight: 600; }

/* ---- sommaire ---- */
.toc { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px 24px; margin: 6px 0 30px; box-shadow: 0 10px 30px -18px rgba(20,40,90,0.2); }
.toc p { font-size: 0.76rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); margin: 0 0 10px; }
.toc ol { margin: 0; padding: 0; list-style: none; counter-reset: t; columns: 2; column-gap: 28px; }
.toc li { margin: 5px 0; break-inside: avoid; counter-increment: t; }
.toc li a { color: var(--ink); font-weight: 600; }
.toc li a::before { content: counter(t); display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 9px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: 0.78rem; font-weight: 800; vertical-align: -3px; }
@media (max-width: 560px) { .toc ol { columns: 1; } }

/* ---- encadrés ---- */
.callout { border-radius: 16px; padding: 18px 22px 18px 20px; margin: 22px 0; border: 1px solid var(--line); background: var(--card); box-shadow: 0 8px 22px -16px rgba(20,40,90,0.22); border-left-width: 4px; }
.callout p { margin: 0; }
.callout.tip { border-color: #bfe6db; border-left-color: var(--green); background: #f2fbf9; }
.callout.warn { border-color: #f6d9a8; border-left-color: #e6a11a; background: #fff9ef; }
.callout .lbl { font-weight: 800; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 7px; margin: 0 0 6px; }
.callout.tip .lbl { color: var(--green); }
.callout.warn .lbl { color: #b8730a; }

/* ---- opération posée ---- */
.op-fig { text-align: center; margin: 22px 0 26px; }
.op {
  display: inline-grid; gap: 2px 0; justify-items: end; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff, #fbfdff); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px 26px; box-shadow: 0 14px 34px -18px rgba(20,40,90,0.28), inset 0 0 0 1px rgba(255,255,255,0.6);
}
.op-cap { font-size: 0.92rem; color: var(--muted); font-weight: 600; margin-top: 10px; }
.op .row { display: grid; grid-auto-flow: column; justify-content: end; align-items: baseline; }
.op .row.small { height: 1.1em; }
.op .d { width: 2.7rem; text-align: center; font-size: 1.95rem; font-weight: 700; }
.op .d.op-sign { color: var(--muted); font-weight: 600; }
.op .carry { color: var(--accent); font-weight: 800; font-size: 0.98rem; }
.op .hl2 { color: var(--gold); }
.op .line { grid-column: 1 / -1; height: 2.5px; background: var(--ink); border-radius: 2px; margin: 5px 0; width: 100%; }
.op .res .d { color: var(--accent); }

/* ---- étapes ---- */
.steps { list-style: none; counter-reset: s; padding: 0; margin: 14px 0 20px; display: grid; gap: 12px; }
.steps li { counter-increment: s; background: var(--card); border: 1px solid var(--line); border-radius: 15px; padding: 15px 18px 15px 56px; position: relative; box-shadow: 0 6px 18px -14px rgba(20,40,90,0.22); }
.steps li::before { content: counter(s); position: absolute; left: 15px; top: 14px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 0.9rem; }

/* ---- exercices ---- */
.article { counter-reset: exq; }
.ex { counter-increment: exq; background: var(--card); border: 1px solid var(--line); border-radius: 15px; padding: 4px 20px; margin: 12px 0; box-shadow: 0 6px 18px -15px rgba(20,40,90,0.2); }
.ex summary { cursor: pointer; font-weight: 750; padding: 14px 0; list-style: none; display: flex; align-items: center; gap: 13px; }
.ex summary::-webkit-details-marker { display: none; }
.ex summary::before { content: counter(exq); flex: none; display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 0.85rem; font-weight: 800; }
.ex summary::after { content: '+'; margin-left: auto; color: var(--accent); font-weight: 800; font-size: 1.25rem; line-height: 1; }
.ex[open] summary::after { content: '–'; }
.ex .sol { border-top: 1px solid var(--line); padding: 12px 0 14px 40px; color: #3c4a63; }

/* ---- FAQ ---- */
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 15px; margin: 10px 0; padding: 2px 20px; box-shadow: 0 6px 18px -15px rgba(20,40,90,0.2); }
.faq summary { cursor: pointer; font-weight: 750; padding: 15px 0; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; float: right; color: var(--accent); font-weight: 800; font-size: 1.2rem; line-height: 1; }
.faq details[open] summary::after { content: '–'; }
.faq details > p { padding-bottom: 14px; margin: 0; color: #3c4a63; }

/* ---- CTA ---- */
.cta { position: relative; overflow: hidden; background: linear-gradient(160deg, var(--primary) 0%, #17418f 90%, var(--navy) 140%); color: #fff; border-radius: 24px; padding: 40px 30px; text-align: center; margin: 44px 0; box-shadow: 0 28px 56px -22px rgba(27,77,192,0.55); }
.cta::after { content: ''; position: absolute; top: -40px; right: -30px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,0.08); }
.cta h2 { color: #fff; margin: 0 0 8px; padding: 0; }
.cta h2::before { display: none; }
.cta p { color: rgba(255,255,255,0.88); margin: 0 auto 20px; max-width: 34em; position: relative; z-index: 1; }
.cta a { display: inline-block; background: #fff; color: var(--primary-d); font-weight: 800; padding: 14px 30px; border-radius: 999px; box-shadow: 0 10px 24px -10px rgba(6,18,48,0.5); position: relative; z-index: 1; }
.cta a:hover { text-decoration: none; background: #f2f6ff; transform: translateY(-1px); }

/* ---- maillage interne ---- */
.related { margin: 44px 0; }
.rel-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 620px) { .rel-grid { grid-template-columns: 1fr; } }
.rel-grid a { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 20px; color: var(--ink); font-weight: 750; transition: border-color .15s, transform .15s, box-shadow .15s; box-shadow: 0 8px 22px -18px rgba(20,40,90,0.2); }
.rel-grid a:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 16px 32px -18px rgba(20,40,90,0.28); }
.rel-grid a span { display: block; font-weight: 500; font-size: 0.88rem; color: var(--muted); margin-top: 4px; }

/* ---- pied de page ---- */
.foot { border-top: 1px solid var(--line); margin-top: 34px; background: #fff; }
.foot-in { max-width: 980px; margin: 0 auto; padding: 28px 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: 0.86rem; color: var(--muted); }
.foot-in nav { display: flex; gap: 18px; flex-wrap: wrap; }
.foot-in a { color: var(--muted); font-weight: 600; }

/* ---- hub ---- */
.hub-sec { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 36px 0 6px; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 16px; margin: 12px 0; }
.hub-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 24px; color: var(--ink); transition: border-color .15s, transform .15s, box-shadow .15s; box-shadow: 0 12px 30px -20px rgba(20,40,90,0.24); overflow: hidden; }
.hub-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--ca, var(--primary)); }
.hub-card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: 0 22px 40px -20px rgba(20,40,90,0.3); border-color: var(--ca, var(--primary)); }
.hub-card h3 { margin: 12px 0 6px; font-size: 1.14rem; }
.hub-card p { color: var(--muted); font-weight: 500; font-size: 0.92rem; margin: 0; }
.hub-ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--cs, var(--accent-soft)); color: var(--ca, var(--primary)); font-weight: 800; font-size: 1.5rem; }
.hc-mult { --ca: #2f6fe4; --cs: #eaf1fe; }
.hc-add  { --ca: #12a385; --cs: #e7f8f3; }
.hc-sous { --ca: #e07000; --cs: #fff1e4; }
.hc-tab  { --ca: #8b46d3; --cs: #f3ecfd; }
.hc-div  { --ca: #d92d20; --cs: #fdeceb; }
.hc-frac { --ca: #0891b2; --cs: #e4f5fa; }
.hc-dec  { --ca: #4f46e5; --cs: #ecebfd; }
.hc-aire { --ca: #d6337d; --cs: #fde9f2; }
.hc-num  { --ca: #b45309; --cs: #fdf0dd; }
.hc-heure { --ca: #0369a1; --cs: #e0f2ff; }
.hc-monnaie { --ca: #a16207; --cs: #fdf3d9; }
.hc-comp { --ca: #0e7490; --cs: #e0f7fa; }

/* ---- division posée (potence à la française) ---- */
.pot { display: inline-flex; align-items: flex-start; gap: 14px; background: linear-gradient(180deg, #fff, #fbfdff); border: 1px solid var(--line); border-radius: 18px; padding: 22px 28px; box-shadow: 0 14px 34px -18px rgba(20,40,90,0.28), inset 0 0 0 1px rgba(255,255,255,0.6); font-variant-numeric: tabular-nums; }
.pot-l { font-size: 1.95rem; font-weight: 700; letter-spacing: 0.14em; padding-top: 2px; }
.pot-r { border-left: 2.5px solid var(--ink); padding-left: 14px; }
.pot-dr { font-size: 1.95rem; font-weight: 700; letter-spacing: 0.14em; padding: 0 4px 8px; }
.pot-q { border-top: 2.5px solid var(--ink); padding: 8px 4px 2px; font-size: 1.95rem; font-weight: 700; letter-spacing: 0.14em; color: var(--accent); }

/* ---- fraction inline (num/dén) ---- */
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1; margin: 0 2px; font-weight: 750; }
.frac > span:first-child { padding: 0 5px 2px; border-bottom: 2.5px solid currentColor; }
.frac > span:last-child { padding: 2px 5px 0; }
.frac.big { font-size: 1.6rem; color: var(--accent); }

/* ---- barre de fraction (visuel colorié) ---- */
.frac-bar { display: inline-grid; grid-auto-flow: column; border: 2px solid var(--accent); border-radius: 8px; overflow: hidden; margin: 6px 0; box-shadow: 0 8px 22px -16px rgba(20,40,90,0.25); }
.frac-bar .cell { width: 46px; height: 46px; border-right: 2px solid var(--accent); background: #fff; }
.frac-bar .cell:last-child { border-right: 0; }
.frac-bar .cell.on { background: var(--accent-soft); position: relative; }
.frac-bar .cell.on::after { content: ''; position: absolute; inset: 0; background: var(--accent); opacity: 0.55; }

/* ---- tableau de numération (décimaux) ---- */
.pv-table { border-collapse: separate; border-spacing: 0; margin: 6px auto; font-variant-numeric: tabular-nums; border-radius: 14px; overflow: hidden; box-shadow: 0 12px 30px -20px rgba(20,40,90,0.28); border: 1px solid var(--line); background: #fff; }
.pv-table th, .pv-table td { padding: 9px 14px; text-align: center; border-right: 1px solid var(--line); }
.pv-table th:last-child, .pv-table td:last-child { border-right: 0; }
.pv-table thead th { font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); background: var(--accent-soft); }
.pv-table tbody td { font-size: 1.5rem; font-weight: 700; border-top: 1px solid var(--line); }
.pv-table .comma { color: var(--accent); }
.pv-table .virg { background: var(--accent-soft); color: var(--accent); font-size: 1.9rem; font-weight: 800; width: 1.4em; }

/* ---- pièces et billets (cours monnaie) ---- */
.coin-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; margin: 20px 0; }
.coin { display: inline-flex; align-items: center; justify-content: center; width: 62px; height: 62px; border-radius: 50%; font-weight: 800; font-size: 0.92rem; color: #6b4c00; background: linear-gradient(160deg, #ffe9a8, #e8b93a); box-shadow: 0 8px 20px -12px rgba(150,110,0,0.5), inset 0 0 0 2px rgba(255,255,255,0.5); }
.coin.silver { color: #4a5266; background: linear-gradient(160deg, #f3f6fb, #c7cfdd); box-shadow: 0 8px 20px -12px rgba(60,70,90,0.4), inset 0 0 0 2px rgba(255,255,255,0.6); }
.note { display: inline-flex; align-items: center; justify-content: center; width: 92px; height: 56px; border-radius: 8px; font-weight: 800; font-size: 1rem; color: #fff; box-shadow: 0 10px 22px -12px rgba(20,40,90,0.4); }

/* ---- figure géométrique centrée ---- */
.geo-fig { text-align: center; margin: 22px 0 26px; }
.geo-fig svg { max-width: 320px; height: auto; }

/* ---- thèmes par domaine (fiches /exercices/) ---- */
.t-nc { --accent: #2f6fe4; --accent-soft: #eaf1fe; }
.t-gm { --accent: #d6337d; --accent-soft: #fde9f2; }
.t-eg { --accent: #8b46d3; --accent-soft: #f3ecfd; }

/* ---- fiche compétence : exemples réels générés par le moteur de l'app ---- */
.ex-card { background: var(--card); border: 1px solid var(--line); border-radius: 15px; padding: 18px 22px; margin: 14px 0; box-shadow: 0 6px 18px -15px rgba(20,40,90,0.2); }
.ex-q { font-weight: 750; margin: 0 0 8px; white-space: pre-line; }
.ex-choices { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ex-choices li { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; font-weight: 600; font-size: 0.92rem; }
.ex-choices li.ok { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.ex-choices .tag { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; margin-left: 4px; }
.ex-parts { font-weight: 700; color: var(--accent); margin: 0 0 10px; font-variant-numeric: tabular-nums; }
.ex-answer { margin: 0 0 10px; }
.ex-corr { margin: 0; color: #3c4a63; padding-top: 10px; border-top: 1px dashed var(--line); }
.tag-corr { display: inline-block; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 10px; margin-right: 8px; vertical-align: 2px; }

/* ---- liste des compétences couvertes par une fiche ---- */
.skill-list { list-style: none; margin: 14px 0 20px; padding: 0; display: grid; gap: 8px; }
.skill-list li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 16px; font-weight: 650; display: flex; align-items: center; gap: 10px; }
.skill-list li::before { content: '✓'; color: var(--accent); font-weight: 800; }

/* ---- badges niveau / domaine (hubs) ---- */
.lvl-badge { display: inline-block; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; border-radius: 999px; padding: 3px 11px; margin: 0 6px 6px 0; }

/* =================================================================
   EXO — widget interactif (exercice fixe, saisie réelle, correction)
   Un seul exercice par page, mêmes nombres à chaque visite ; l'enfant
   répond vraiment (pas juste un texte lu). Voir public/exercices/exo.js.

   Classes/variables PORTÉES 1:1 depuis src/styles.css (la vraie app),
   PAS depuis la palette marketing de cours.css ci-dessus — préfixe
   --app- pour ne jamais les confondre. Reproduction fidèle demandée :
   mêmes .posed/.answer-cell/.carry-mark/.choice/.ld-* que dans l'app.
   ================================================================= */
:root {
  --app-ink: #1e2742;
  --app-muted: #7b86a0;
  --app-hairline: #e2e9f6;
  --app-field: #edf3fc;
  --app-primary: #2f6fe4;
  --app-ok: #34c759;
  --app-ok-bg: #eefbf1;
  --app-ko: #ff3b30;
  --app-ko-bg: #fff0ef;
}

/* --- saisie numérique simple (kind numeric) --- */
.numeric-input { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.numeric-input input { width: 168px; font: inherit; font-size: 1.75rem; font-weight: 500; letter-spacing: -0.02em; text-align: center; background: var(--app-field); border: 1.5px solid transparent; border-radius: 16px; padding: 12px 14px; color: var(--app-ink); outline: none; transition: border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.numeric-input input::placeholder { color: #c7c7cc; font-weight: 400; }
.numeric-input input:focus { background: #fff; border-color: var(--app-primary); box-shadow: 0 0 0 4px rgba(47,111,228,0.14); }
.numeric-input.ok input { border-color: var(--app-ok); background: var(--app-ok-bg); color: #1a7a37; }
.numeric-input.bad input { border-color: var(--app-ko); background: var(--app-ko-bg); color: #c4271d; }

/* --- choix cliquables (mcq / multiselect) --- */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.choice { font: inherit; border: 1px solid rgba(30,64,140,0.09); background: #eef3fb; border-radius: 18px; padding: 18px 16px; font-size: 1.2rem; font-weight: 600; letter-spacing: -0.01em; color: var(--app-ink); cursor: pointer; box-shadow: 0 1px 3px rgba(20,40,90,0.04); transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.choice:hover:not(:disabled) { background: #e6eefb; border-color: rgba(47,111,228,0.22); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(47,111,228,0.08); }
.choice:disabled { cursor: default; }
.choice.sel { border-color: var(--app-primary); background: #e6eefb; }
.choice.correct { border-color: var(--app-ok); background: var(--app-ok-bg); color: #1a7a37; }
.choice.dim { opacity: 0.42; }
.choice.wrong { border-color: var(--app-ko); background: var(--app-ko-bg); color: #c4271d; }

/* --- calculs posés (column / long-mult) : grille de chiffres + réponse par case --- */
.column-op { display: flex; flex-direction: column; align-items: center; margin: 6px 0 4px; }
.posed { display: inline-flex; flex-direction: column; align-items: stretch; font-variant-numeric: tabular-nums; margin: 4px auto 18px; }
.posed-row { display: flex; align-items: center; justify-content: flex-end; font-size: 2rem; font-weight: 500; line-height: 1.15; }
.posed-op { width: 2.6rem; text-align: center; color: var(--app-primary); font-weight: 600; flex: 0 0 auto; }
.posed-cell { width: 2.6rem; height: 2.6rem; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; color: var(--app-ink); }
.posed-cell.posed-comma { width: 0.9rem; align-items: flex-end; justify-content: center; }
.posed-line { height: 3px; background: var(--app-ink); border-radius: 3px; margin: 10px 0 18px; align-self: stretch; }
.posed.lm .posed-op, .posed.lm .posed-cell { width: 3.1rem; }
.posed.lm .answer-cell { width: 2.25rem; }
.posed.lm .posed-row { margin: 5px 0; }
.posed.lm .carry-row { margin: 0; }
.posed.lm .carry-row .posed-cell { height: 1.5rem; }
.posed.lm .posed-row + .posed-row { margin-top: 12px; }

/* case-réponse (bouton, comme dans l'app — ouvre le clavier natif via un input caché par-dessus) */
.answer-cell { position: relative; font: inherit; font-size: 1.6rem; font-weight: 500; color: var(--app-ink); background: var(--app-field); border: 1.5px solid var(--app-hairline); border-radius: 10px; padding: 0; margin: 0; width: 2.1rem; height: 2.7rem; display: inline-flex; align-items: center; justify-content: center; }
.answer-cell:has(input:placeholder-shown) { background: #fff; border: 1.6px dashed #c7cfde; }
.answer-cell:focus-within { border-color: var(--app-primary); background: #fff; box-shadow: 0 0 0 4px rgba(47,111,228,0.14); }
.answer-cell.ok { border-color: var(--app-ok); background: var(--app-ok-bg); color: #1a7a37; }
.answer-cell.ko { border-color: var(--app-ko); background: var(--app-ko-bg); color: #c4271d; }
.answer-cell input { width: 100%; height: 100%; border: none; background: transparent; outline: none; text-align: center; font: inherit; color: inherit; padding: 0; }

/* retenues (aide non notée, cliquable pour cycler 1→9) */
.carry-row { font-size: 1rem; margin-bottom: -2px; display: flex; align-items: center; justify-content: flex-end; }
.carry-row.bottom { margin-bottom: 0; margin-top: -2px; }
.carry-row .posed-cell { height: 1.7rem; }
.carry-mark { width: 1.7rem; height: 1.7rem; border: none; background: transparent; border-radius: 8px; font: inherit; font-size: 1.05rem; font-weight: 700; color: #e0812f; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background .12s ease; }
.carry-mark:hover { background: rgba(224,129,47,0.12); }
.carry-mark:not(.set)::before { content: ''; width: .5rem; height: .5rem; border: 1.5px dashed #c7cbd6; border-radius: 50%; }

/* --- division posée (potence complète, avec les étapes) --- */
.longdiv-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.potence2 { display: flex; align-items: stretch; font-size: 2rem; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--app-ink); }
.ld-left { display: flex; flex-direction: column; border-right: 2.5px solid var(--app-ink); padding-right: 14px; }
.ld-row { display: flex; align-items: center; padding: 2px 0; }
.ld-row.line { position: relative; padding-bottom: 9px; margin-bottom: 7px; }
.ld-row.line::after { content: ''; position: absolute; left: 1.5rem; right: 0; bottom: 0; height: 2.5px; border-radius: 2px; background: var(--app-ink); }
.ld-op { width: 1.5rem; text-align: center; color: #9aa3b6; font-weight: 600; flex: 0 0 auto; }
.ld-cell { width: 2.55rem; height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ld-comma { width: 0.6rem; text-align: center; flex: 0 0 auto; }
.ld-static.bring { color: var(--app-muted); font-weight: 400; position: relative; }
.ld-static.bring::before { content: '↓'; position: absolute; top: -0.72em; left: 50%; transform: translateX(-50%); font-size: 0.56em; color: #bfc7d6; }
.ld-right { display: flex; flex-direction: column; align-items: flex-start; padding-left: 18px; }
.ld-divisor { border-bottom: 2.5px solid var(--app-ink); padding: 2px 14px 8px; }
.ld-quotient { display: flex; align-items: center; padding-top: 12px; }
.ld-quotient .ld-comma.show { align-self: flex-end; padding-bottom: 10px; font-weight: 700; }
.answer-cell.ld-ans { width: 2.25rem; height: 2.6rem; font-size: 1.4rem; }
.exo-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 26px 28px 24px; margin: 16px 0 26px; box-shadow: 0 16px 40px -22px rgba(20,40,90,0.3); }
.exo-kicker { display: flex; align-items: center; gap: 8px; font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin: 0 0 14px; }
.exo-kicker .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.exo-prompt { font-size: 1.08rem; font-weight: 700; white-space: pre-line; margin: 0 0 18px; }
.exo-figure { display: flex; justify-content: center; margin: 6px 0 20px; }

/* saisie chiffre par chiffre (posées) : mêmes dimensions que .d, mais éditable */
.op .d input, .pot .d input { width: 100%; height: 100%; border: none; background: transparent; text-align: center; font: inherit; color: inherit; padding: 0; }
.op .d.in, .pot-q .din { display: inline-grid; place-items: center; width: 2.7rem; height: 1.5em; border-radius: 8px; background: var(--bg); border: 2px solid var(--line); margin: 0 1px; }
.op .d.in:focus-within, .pot-q .din:focus-within { border-color: var(--accent); background: #fff; }
.op .d.in input, .pot-q .din input { width: 100%; text-align: center; font: inherit; font-weight: 800; color: var(--accent); border: none; background: transparent; }
.op .d.in input:focus, .pot-q .din input:focus { outline: none; }
.op .d.in.ok { background: #e7f8f3; border-color: var(--green); }
.op .d.in.ok input { color: var(--green); }
.op .d.in.bad { background: #fdeceb; border-color: var(--red); }
.op .d.in.bad input { color: var(--red); }
.pot-q { display: inline-flex; gap: 3px; }
.pot-q .din { width: 2.3rem; height: 1.3em; font-size: 1.4rem; }

/* pavé de saisie simple (numeric) */
.exo-input-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.exo-input-row input[type="text"] { font: inherit; font-weight: 800; font-size: 1.4rem; text-align: center; width: 7em; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); font-variant-numeric: tabular-nums; }
.exo-input-row input[type="text"]:focus { outline: none; border-color: var(--accent); background: #fff; }
.exo-input-row.ok input { border-color: var(--green); background: #e7f8f3; color: var(--green); }
.exo-input-row.bad input { border-color: var(--red); background: #fdeceb; color: var(--red); }

/* choix cliquables (mcq / multiselect / shapes) */
.exo-choices { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 4px 0; }
.exo-choice { font: inherit; font-weight: 700; font-size: 0.98rem; padding: 12px 20px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; transition: border-color .12s, transform .08s, background .12s; }
.exo-choice:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.exo-choice:disabled { cursor: default; }
.exo-choice.sel { border-color: var(--accent); background: var(--accent-soft); }
.exo-choice.ok { border-color: var(--green); background: #e7f8f3; color: var(--green); }
.exo-choice.bad { border-color: var(--red); background: #fdeceb; color: var(--red); }
.exo-choice.dim { opacity: 0.45; }
.exo-choice svg { display: block; width: 34px; height: 34px; }

/* objets à compter / cellules à colorier (ten-frame, décimal, fraction) */
.exo-objects { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 4px 0 18px; }
.exo-obj { font-size: 1.8rem; line-height: 1; padding: 8px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; background: var(--bg); transition: transform .08s, border-color .12s; }
.exo-obj:hover { transform: scale(1.08); }
.exo-obj.on { border-color: var(--accent); background: var(--accent-soft); }
.exo-grid-cells { display: inline-grid; grid-auto-flow: column; gap: 4px; margin: 4px 0 18px; }
.exo-grid-cells.wrap2 { grid-template-rows: repeat(2, 1fr); grid-auto-flow: column; }
.exo-cell { width: 40px; height: 40px; border-radius: 8px; border: 2px solid var(--accent); background: #fff; cursor: pointer; transition: background .1s; }
.exo-cell.on { background: var(--accent); }

/* décomposition (multi : parties étiquetées) */
.exo-part { display: inline-flex; align-items: center; gap: 6px; margin: 4px 10px; }
.exo-lead { font-weight: 800; font-size: 1.1rem; margin-right: 6px; }
.exo-mini { font: inherit; font-weight: 800; font-size: 1.1rem; text-align: center; width: 4.5em; padding: 8px 10px; border-radius: 10px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); font-variant-numeric: tabular-nums; }
.exo-mini:focus { outline: none; border-color: var(--accent); background: #fff; }
.exo-mini.exo-ok { border-color: var(--green); background: #e7f8f3; color: var(--green); }
.exo-mini.exo-bad { border-color: var(--red); background: #fdeceb; color: var(--red); }
.exo-part-label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }

/* ordonner (clic pour placer) */
.exo-order-pool, .exo-order-slots { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.exo-order-slots { margin-top: 12px; min-height: 46px; }
.exo-slot { width: 56px; height: 44px; border: 2px dashed var(--line); border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: var(--muted); }
.exo-slot.filled { border-style: solid; border-color: var(--accent); color: var(--accent); cursor: pointer; }
.exo-order-labels { display: flex; justify-content: space-between; font-size: 0.76rem; color: var(--faint, var(--muted)); font-weight: 700; margin-top: 6px; }

/* actions + feedback */
.exo-actions { display: flex; gap: 10px; justify-content: center; margin: 18px 0 4px; flex-wrap: wrap; }
.exo-btn { font: inherit; font-weight: 800; font-size: 0.94rem; padding: 12px 26px; border-radius: 999px; border: none; cursor: pointer; background: var(--accent); color: #fff; box-shadow: 0 10px 22px -12px rgba(47,111,228,0.6); }
.exo-btn:hover { background: var(--accent-d, var(--primary-d)); }
.exo-btn:disabled { opacity: 0.4; cursor: default; }
.exo-btn.ghost { background: var(--bg); color: var(--ink); box-shadow: none; border: 1px solid var(--line); }
.exo-feedback { margin-top: 16px; padding: 14px 18px; border-radius: 14px; font-weight: 650; display: none; }
.exo-feedback.show { display: block; }
.exo-feedback.ok { background: #e7f8f3; color: #0d7a63; }
.exo-feedback.bad { background: #fdeceb; color: #a82318; }
.exo-feedback .expl { display: block; font-weight: 500; margin-top: 4px; color: inherit; opacity: 0.9; }
