/* CODALP — Feuille de style du prototype */
:root {
  --ink: #111827; --ink-2: #374151; --muted: #6b7280; --line: #e5e7eb; --bg: #f7f8fb; --card: #fff;
  --brand: #4338ca; --brand-2: #6366f1; --brand-soft: #eef2ff; --red: #e11d2e;
  --ok: #15803d; --ok-soft: #dcfce7; --ko: #b91c1c; --ko-soft: #fee2e2; --warn: #b45309; --warn-soft: #fef3c7;
  --r: 14px; --r-s: 9px;
  --shadow: 0 1px 2px rgba(17,24,39,.05), 0 6px 20px rgba(17,24,39,.06);
  --mono: "Cascadia Code", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); min-height: 100vh; display: flex; flex-direction: column; overflow-wrap: break-word; }
/* Longs mots composés allemands : césure automatique sur petit écran */
@media (max-width: 520px) { :lang(de) h1, :lang(de) h2, :lang(de) h3, :lang(de) .stats span, :lang(de) .kpis span, :lang(de) .btn { hyphens: auto; -webkit-hyphens: auto; } }
main { flex: 1; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid #a5b4fc; outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; border: 0; border-radius: var(--r-s); background: var(--ink); color: #fff; font: 600 .95rem var(--sans); cursor: pointer; transition: top .15s; }
.skip-link:focus { top: 12px; }
main:focus { outline: none; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; letter-spacing: -.015em; }
p { margin: 0 0 .8em; }
small, .small { font-size: .875rem; color: var(--muted); }
code { font-family: var(--mono); font-size: .9em; background: #eef0f6; color: #312e81; padding: .08em .36em; border-radius: 5px; white-space: nowrap; }
@media (max-width: 520px) { :not(pre) > code { white-space: normal; overflow-wrap: anywhere; } }
sub { font-size: .7em; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 22px; }
.page { padding-top: 34px; padding-bottom: 64px; }
.etroit { max-width: 820px; }
.centre { text-align: center; }
.h-page { font-size: clamp(1.7rem, 3.2vw, 2.4rem); font-weight: 800; margin-bottom: 8px; }
.sous { color: var(--muted); font-size: 1.06rem; margin-bottom: 24px; }
.lead { font-size: 1.12rem; color: var(--ink-2); }
.h-sec { font-size: clamp(1.45rem, 2.6vw, 2rem); font-weight: 800; margin-bottom: 24px; }
.h-groupe { font-size: 1.25rem; font-weight: 750; margin: 32px 0 14px; }
.h-partie { font-size: 1.25rem; font-weight: 750; margin: 34px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--line); }
.section { padding-top: 54px; padding-bottom: 54px; }
.vide { color: var(--muted); }
.liste { padding-left: 20px; }

/* Boutons et badges */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: var(--r-s); border: 1px solid transparent; font: inherit; font-weight: 650; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; text-decoration: none !important; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn:focus-visible, .opt:focus-visible, .input:focus-visible, .rb:focus-visible, .editor:focus-visible { outline: 3px solid #a5b4fc; outline-offset: 1px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #3730a3; }
.btn-ghost { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: #c7cbd6; background: #fafafa; }
.btn-dark { background: #1f2937; color: #fff; }
.btn-dark:hover:not(:disabled) { background: #111827; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-light { background: #fff; color: var(--brand); }
.btn-sm { padding: 6px 12px; font-size: .9rem; }
.btn-lg { padding: 13px 24px; font-size: 1.05rem; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; background: #eef0f4; color: var(--ink-2); font-size: .76rem; font-weight: 600; white-space: nowrap; }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-mute { background: #f1f2f5; color: var(--muted); }
.input { width: 100%; padding: 10px 13px; border: 1px solid #d1d5db; border-radius: var(--r-s); font: inherit; background: #fff; color: var(--ink); }
.input:focus { border-color: var(--brand-2); outline: none; box-shadow: 0 0 0 3px #e0e7ff; }
.input.mini { width: 112px; padding: 5px 8px; font-size: .9rem; }
.shake { animation: shake .3s; border-color: var(--ko); }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* En-tête */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.93); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; gap: 22px; height: 62px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 850; letter-spacing: .05em; color: var(--ink); text-decoration: none !important; }
.logo svg { width: 30px; height: 30px; }
.nav { display: flex; gap: 3px; flex: 1; }
.nav a { padding: 6px 11px; border-radius: 7px; color: var(--ink-2); font-size: .94rem; font-weight: 550; text-decoration: none; white-space: nowrap; }
.nav a:hover { background: #f1f2f6; }
.nav a.actif { background: var(--brand-soft); color: var(--brand); }
.nav-toggle { display: none; margin-left: auto; font-size: 1.3rem; background: none; border: 0; cursor: pointer; padding: 6px 10px; color: var(--ink); }
.xp-pill { padding: 5px 13px; border-radius: 999px; background: var(--ink); color: #fff; font-size: .84rem; white-space: nowrap; text-decoration: none !important; }
.demo-banner { background: #1e1b4b; color: #e0e7ff; text-align: center; font-size: .82rem; padding: 4px 12px; }
.footer { border-top: 1px solid var(--line); background: #fff; padding: 20px 0; font-size: .86rem; color: var(--muted); }
.footer .container { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 8px 18px; border-radius: 999px; font-weight: 700; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Accueil */
.hero { background: radial-gradient(1000px 460px at 85% -10%, #e0e7ff 0, transparent 70%), radial-gradient(700px 360px at 0 0, #fff1f2 0, transparent 65%), #fff; border-bottom: 1px solid var(--line); }
.hero-grid { display: grid; grid-template-columns: 1.08fr .92fr; gap: 48px; align-items: center; padding-top: 58px; padding-bottom: 58px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 650; color: var(--ink-2); margin-bottom: 18px; }
.croix { width: 18px; height: 18px; }
.hero h1 { font-size: clamp(2.3rem, 5.2vw, 3.9rem); font-weight: 850; letter-spacing: -.03em; line-height: 1.04; margin-bottom: 18px; }
.grad { background: linear-gradient(92deg, var(--brand) 0, #7c3aed 55%, var(--red) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 11px; margin: 22px 0 18px; }
.hero-checks { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 0; font-size: .9rem; color: var(--ink-2); }
.hero-checks li::before { content: "✓ "; color: var(--ok); font-weight: 800; }
.hero-demo { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 50px rgba(67,56,202,.13); padding: 20px; }
.demo-t { font-weight: 750; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: baseline; }
.demo-t span { font-size: .8rem; color: var(--muted); font-weight: 500; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding-top: 26px; }
.stats > div { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 15px 18px; }
.stats b { display: block; font-size: 1.75rem; font-weight: 850; color: var(--brand); line-height: 1.1; }
.stats span { font-size: .87rem; color: var(--muted); }
.niveaux-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.niveau-card { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: var(--r); padding: 16px; color: var(--ink); text-decoration: none !important; transition: transform .12s, box-shadow .12s; }
.niveau-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.niveau-card strong { display: block; font-size: 1.1rem; margin: 2px 0 6px; }
.niveau-card p { font-size: .86rem; color: var(--muted); margin: 0; line-height: 1.45; }
.nc-deg { font-size: .76rem; font-weight: 700; color: var(--c); }
.band { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px 32px; }
.feature .f-n { font-family: var(--mono); font-size: .8rem; color: var(--red); font-weight: 700; }
.feature h3 { font-size: 1.1rem; margin: 3px 0 5px; }
.feature p { color: var(--muted); font-size: .94rem; margin: 0; }
.audience { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.audience > div { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.audience h3 { font-size: 1.05rem; margin-bottom: 6px; }
.audience p { font-size: .91rem; color: var(--muted); margin: 0; }
.cta-band { background: linear-gradient(100deg, #312e81, var(--brand) 60%, #7c3aed); color: #fff; padding: 46px 0; }
.cta-band .container { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.cta-band h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 800; }

/* Programme */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; }
.tab { flex: 1; min-width: 132px; padding: 9px 13px; background: #fff; border: 1px solid var(--line); border-bottom: 3px solid var(--line); border-radius: 10px; color: var(--ink-2); text-decoration: none !important; }
.tab b { display: block; font-size: .94rem; }
.tab small { font-size: .74rem; }
.tab.actif { border-bottom-color: var(--c); box-shadow: var(--shadow); color: var(--ink); }
.niveau-tete { display: flex; justify-content: space-between; gap: 20px; background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: var(--r); padding: 18px 22px; margin-bottom: 18px; }
.niveau-tete h2 { font-size: 1.35rem; margin-bottom: 6px; }
.niveau-tete h2 small { font-weight: 500; }
.niveau-tete p { margin: 0 0 3px; }
.nt-compte { text-align: right; white-space: nowrap; font-size: .9rem; }
.nt-compte b { font-size: 1.6rem; color: var(--c); }
.nt-compte span { color: var(--muted); font-size: .8rem; }
.modules { display: grid; gap: 14px; }
.module { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.module header { display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: #fafbfd; border-bottom: 1px solid var(--line); font-size: 1.2rem; }
.module h3 { font-size: 1.04rem; }
.module header small { font-size: .78rem; }
.module ul { list-style: none; margin: 0; padding: 0; }
.module li + li { border-top: 1px solid #f1f2f5; }
.ch { display: flex; align-items: center; gap: 12px; padding: 9px 18px; color: var(--ink); text-decoration: none !important; }
.ch:not(.dispo) { opacity: .72; }
.ch.dispo:hover { background: var(--brand-soft); }
.ch-etat { width: 20px; text-align: center; color: var(--brand); font-size: .85rem; }
.ch-txt { flex: 1; min-width: 0; }
.ch-txt b { display: block; font-weight: 620; font-size: .96rem; }
.ch-txt small { display: block; line-height: 1.35; }
.ch-tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 240px; }

/* Leçon */
.lecon { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; align-items: start; }
.toc { position: sticky; top: 82px; max-height: calc(100vh - 100px); overflow: auto; font-size: .86rem; }
.toc-t { font-weight: 750; margin-bottom: 7px; }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.toc button { all: unset; display: block; padding: 4px 11px; color: var(--muted); cursor: pointer; line-height: 1.35; }
.toc button:hover, .toc button:focus-visible { color: var(--brand); }
.lecon-corps { max-width: 800px; min-width: 0; }
.fil { font-size: .86rem; color: var(--muted); margin-bottom: 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 18px; }
.objectifs { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--c, var(--brand)); border-radius: var(--r-s); padding: 13px 18px; margin: 16px 0 8px; }
.objectifs ul { margin: 5px 0 0; padding-left: 19px; font-size: .95rem; }
.lsec { margin-top: 30px; }
.lsec > h2 { font-size: 1.42rem; font-weight: 780; margin-bottom: 12px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 .8em; }
.prose li { margin-bottom: 3px; }
.prose > :last-child { margin-bottom: 0; }
.calc { font-family: var(--mono); font-size: .95rem; background: #f3f4f8; border-radius: 7px; padding: 8px 12px; overflow-x: auto; }
.nb { font-family: var(--mono); font-weight: 650; white-space: nowrap; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.compare > div { background: #fff; border: 1px solid var(--line); border-radius: var(--r-s); padding: 12px 15px; font-size: .94rem; }
.callout { border-radius: var(--r-s); padding: 13px 17px; margin: 16px 0; border: 1px solid; }
.callout-t { font-weight: 750; margin-bottom: 5px; }
.callout.retenir { background: var(--brand-soft); border-color: #c7d2fe; }
.callout.attention { background: var(--warn-soft); border-color: #fcd34d; }
.callout.astuce { background: #ecfeff; border-color: #a5f3fc; }
.callout.prof { background: #fdf4ff; border-color: #f0abfc; }
.fin-lecon { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); }

/* Code */
pre.code { font-family: var(--mono); font-size: .9rem; line-height: 1.55; background: #161b2e; color: #e6e9f5; padding: 13px 16px; border-radius: var(--r-s); overflow-x: auto; margin: 9px 0; tab-size: 4; }
.t-k { color: #c4a7ff; } .t-s { color: #9ee6a8; } .t-c { color: #7f8aa8; font-style: italic; } .t-n { color: #ffc28a; } .t-b { color: #7cd4fd; }
.exemple-bar { display: flex; align-items: center; gap: 10px; }
.legende { font-size: .87rem; color: var(--muted); margin-top: 7px; }
.py-statut { font-size: .82rem; color: var(--muted); }
.console { font-family: var(--mono); font-size: .87rem; background: #0b0f1c; color: #d6f5dc; padding: 11px 15px; border-radius: var(--r-s); margin: 9px 0; white-space: pre-wrap; word-break: break-word; max-height: 300px; overflow: auto; }
.console.err { color: #ffc9c9; }
.exos { display: grid; gap: 18px; }
.exo { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 17px 19px; }
.exo-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.exo-head h4 { font-size: 1.08rem; }
.diff { color: #f59e0b; font-size: .88rem; letter-spacing: 1px; }
.exo-ok { color: var(--ok); font-weight: 700; font-size: .88rem; margin-left: auto; }
.editor-wrap { border-radius: var(--r-s); overflow: hidden; border: 1px solid #272d45; margin-top: 8px; }
.editor-bar { display: flex; justify-content: space-between; padding: 5px 13px; background: #232945; color: #aab2d3; font: .78rem var(--mono); }
.editor-bar .py-statut { color: #c7d2fe; }
.editor { display: block; width: 100%; border: 0; resize: vertical; background: #161b2e; color: #e6e9f5; caret-color: #fff; font: .9rem/1.55 var(--mono); padding: 12px 15px; tab-size: 4; white-space: pre; overflow-x: auto; }
.editor:focus { outline: none; }
.exo-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.hint { background: var(--warn-soft); border-radius: 7px; padding: 7px 12px; margin-top: 7px; font-size: .92rem; }
.tests { list-style: none; padding: 0; margin: 9px 0; font-size: .92rem; }
.tests li { padding: 4px 10px; border-radius: 6px; margin-bottom: 3px; }
.tests li.ok { background: var(--ok-soft); color: #14532d; }
.tests li.ko { background: var(--ko-soft); color: #7f1d1d; }
.tests small { display: block; color: inherit; font-family: var(--mono); font-size: .78rem; }
.solution { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 11px; }
.corr-t { font-weight: 750; font-size: .92rem; margin-bottom: 6px; }

/* Quiz */
.quiz { display: grid; gap: 13px; }
.quiz-q { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 15px 18px; }
.quiz-n { font-size: .77rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.quiz-enonce { font-weight: 560; margin-bottom: 9px; }
.quiz-opts { display: grid; gap: 7px; }
.opt { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 12px; background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-s); font: inherit; color: var(--ink); cursor: pointer; transition: border-color .12s, background .12s; }
.opt:hover:not(:disabled) { border-color: var(--brand-2); background: var(--brand-soft); }
.opt:disabled { cursor: default; color: var(--ink); }
.opt-k { flex: none; width: 24px; height: 24px; display: grid; place-items: center; background: #f0f1f5; border-radius: 6px; font-size: .78rem; font-weight: 750; }
.opt.juste { border-color: var(--ok); background: var(--ok-soft); }
.opt.faux { border-color: var(--ko); background: var(--ko-soft); }
.opt.choisi { border-color: var(--brand); background: var(--brand-soft); }
.opt.choisi .opt-k { background: var(--brand); color: #fff; }
.quiz-expl { margin-top: 9px; padding: 8px 12px; border-radius: 7px; font-size: .93rem; }
.quiz-expl.ok { background: var(--ok-soft); } .quiz-expl.ko { background: var(--ko-soft); }
.quiz-score { background: var(--ink); color: #fff; border-radius: var(--r-s); padding: 11px 16px; text-align: center; }

/* Séries d'exercices */
.practice { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 17px 19px; }
.practice.compact { border: 0; padding: 0; }
.practice-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: .88rem; color: var(--muted); }
.flamme { color: #ea580c; font-weight: 700; }
.practice-q { font-size: 1.05rem; margin-bottom: 11px; }
.practice-form { display: flex; flex-wrap: wrap; gap: 7px; }
.practice-form .input { flex: 1 1 170px; width: auto; font-family: var(--mono); }
.practice-fb { padding: 8px 13px; border-radius: 7px; margin-top: 3px; }
.practice-fb.ok { background: var(--ok-soft); color: #14532d; }
.practice-fb.ko { background: var(--ko-soft); color: #7f1d1d; }
.practice-corr { margin-top: 10px; background: #f8f9fc; border: 1px solid var(--line); border-radius: var(--r-s); padding: 11px 15px; font-size: .94rem; overflow-x: auto; }
.practice-corr ol { padding-left: 20px; margin: 0 0 .6em; }
.practice-corr > :last-child { margin-bottom: 0; }
.practice-next { margin-top: 11px; text-align: right; }
.bilan { text-align: center; padding: 18px 0; }
.bilan-n { font-size: 2.6rem; font-weight: 850; color: var(--brand); }
.seg { display: inline-flex; background: #eceef3; border-radius: 9px; padding: 3px; margin-bottom: 16px; }
.seg a { padding: 5px 15px; border-radius: 7px; color: var(--ink-2); font-size: .9rem; font-weight: 620; text-decoration: none; }
.seg a.actif { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* Tableaux */
.tbl-wrap { overflow-x: auto; margin: 9px 0 12px; }
.tbl { border-collapse: collapse; font-size: .9rem; background: #fff; }
.tbl.large { width: 100%; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 5px 11px; text-align: left; }
.tbl th { background: #f3f4f8; font-weight: 680; }
.tbl-bits td, .tbl-bits th, .tbl-add td { text-align: center; font-family: var(--mono); }
.tbl-bits th { font-family: var(--sans); }
.tbl-bits td.on { background: var(--brand-soft); color: var(--brand); font-weight: 750; }
.tbl-alpha { font-size: .73rem; }
.tbl-alpha th, .tbl-alpha td { padding: 2px 4px; text-align: center; font-family: var(--mono); }
.tbl-add td { border: 0; padding: 1px 6px; white-space: pre; }
.tbl-add .carry td { color: var(--red); font-size: .78rem; }
.tbl-add .res td { border-top: 2px solid var(--ink); font-weight: 800; }

/* Robot */
.robot { --cs: 54px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 15px 17px; }
.robot-niveaux { display: flex; gap: 6px; margin-bottom: 12px; }
.lvl { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; font: inherit; font-weight: 750; cursor: pointer; color: var(--ink-2); }
.lvl.fait { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.lvl.actif { background: var(--brand); border-color: var(--brand); color: #fff; }
.robot-main { display: flex; gap: 20px; flex-wrap: wrap; }
.robot-plateau-wrap { overflow-x: auto; flex: none; max-width: 100%; }
.robot-plateau { position: relative; display: grid; grid-auto-rows: var(--cs); width: max-content; background: #f4f6fb; border: 2px solid #cbd2e1; border-radius: 9px; }
.rc { width: var(--cs); height: var(--cs); box-shadow: inset 0 0 0 .5px #d9deea; display: grid; place-items: center; }
.rc.mur { background: repeating-linear-gradient(45deg, #475069, #475069 5px, #3d4560 5px, #3d4560 10px); }
.rc.eau { background: linear-gradient(160deg, #7dd3fc, #38bdf8); }
.rc.depart { background: #e6e9ff; }
.star { font-size: 1.75rem; color: #f59e0b; line-height: 1; transition: transform .25s, opacity .25s; }
.star.prise { transform: scale(1.7); opacity: 0; }
.robot-bot { position: absolute; left: 0; top: 0; width: var(--cs); height: var(--cs); padding: 6px; transform: translate(calc(var(--x, 0) * var(--cs)), calc(var(--y, 0) * var(--cs))); transition: transform .34s ease; pointer-events: none; }
.bot-corps { width: 100%; height: 100%; transition: transform .3s ease; }
.bot-corps svg { display: block; width: 100%; height: 100%; }
.robot-bot.choc .bot-corps { animation: shake .3s 2; }
.robot-panneau { flex: 1 1 280px; min-width: 0; }
.robot-titre { font-size: 1.04rem; margin-bottom: 3px; }
.robot-consigne { font-size: .93rem; color: var(--ink-2); }
.robot-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.rb-boucle { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.rb { padding: 6px 11px; border-radius: 7px; border: 0; font: inherit; font-size: .87rem; font-weight: 650; cursor: pointer; color: #fff; }
.rb-av { background: #2563eb; } .rb-tour { background: #0d9488; } .rb-rep { background: #9333ea; } .rb-fin { background: #6b21a8; }
.rb-mini { width: 27px; height: 31px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; font-weight: 800; }
.robot-prog-tete { display: flex; justify-content: space-between; font-size: .85rem; font-weight: 650; margin-bottom: 4px; }
.robot-prog-tete small { font-weight: 400; font-size: .76rem; }
.robot-prog { list-style: none; margin: 0 0 9px; padding: 7px; min-height: 58px; max-height: 210px; overflow: auto; background: #f4f6fb; border-radius: 8px; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.robot-prog .vide { font-size: .85rem; color: var(--muted); padding: 3px 6px; }
.bloc { padding: 2px 10px; border-radius: 5px; color: #fff; font-size: .82rem; font-weight: 620; cursor: pointer; }
.bloc-av { background: #2563eb; } .bloc-g, .bloc-d { background: #0d9488; } .bloc-rep { background: #9333ea; } .bloc-fin { background: #6b21a8; }
.bloc.exec { outline: 2px solid #f59e0b; outline-offset: 1px; }
.robot-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.robot-msg { margin-top: 9px; font-size: .9rem; padding: 6px 11px; border-radius: 7px; background: #f4f6fb; }
.robot-msg.ok { background: var(--ok-soft); color: #14532d; font-weight: 650; }
.robot-msg.ko { background: var(--ko-soft); color: #7f1d1d; }

/* Cartes */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.cards.deux { grid-template-columns: repeat(2, 1fr); }
.card-gen { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 15px 17px; color: var(--ink); text-decoration: none !important; transition: transform .12s, box-shadow .12s; }
.card-gen:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-gen h3 { font-size: 1.04rem; margin-bottom: 4px; }
.card-gen p { font-size: .88rem; color: var(--muted); flex: 1; }
.cg-pied { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.cg-st { margin-left: auto; font-size: .78rem; color: var(--ok); font-weight: 650; }
.exam-card { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: var(--r); padding: 19px; }
.exam-card h3 { font-size: 1.15rem; margin: 3px 0 7px; }
.exam-card p { color: var(--muted); font-size: .93rem; }

/* Examen */
.consignes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin: 16px 0; }
.consignes > div { background: #fff; border: 1px solid var(--line); border-radius: var(--r-s); padding: 11px; text-align: center; }
.consignes b { display: block; font-size: 1.35rem; color: var(--brand); }
.consignes span { font-size: .82rem; color: var(--muted); }
.exam-bar { position: sticky; top: 62px; z-index: 20; background: #1f2340; color: #fff; }
.exam-bar .container { display: flex; align-items: center; gap: 16px; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.exam-bar strong { flex: 1; font-size: .92rem; min-width: 180px; }
.exam-rep { font-size: .84rem; color: #c7d2fe; }
.exam-temps { font: 800 1.15rem var(--mono); }
.exam-temps.alerte { color: #fca5a5; }
.exam-q { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 15px 18px; margin-bottom: 12px; }
.exam-q .exo { border: 0; padding: 0; }
.exam-q-t { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.exam-q > .input { max-width: 340px; font-family: var(--mono); }
.exam-fin { text-align: center; margin-top: 22px; }
.attente { text-align: center; padding: 70px 0; font-size: 1.15rem; color: var(--muted); }
.res-tete { display: flex; align-items: center; gap: 22px; padding: 22px; border-radius: var(--r); margin-bottom: 18px; }
.res-tete.ok { background: var(--ok-soft); } .res-tete.ko { background: var(--ko-soft); }
.res-tete h1 { font-size: 1.5rem; margin-bottom: 4px; }
.res-tete p { margin: 0; color: var(--ink-2); }
.res-note { flex: none; width: 92px; height: 92px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 2rem; font-weight: 850; box-shadow: var(--shadow); }
.res-tete.ok .res-note { color: var(--ok); } .res-tete.ko .res-note { color: var(--ko); }
.parties { display: grid; gap: 9px; margin-bottom: 16px; }
.parties > div { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(70px, 1fr) 72px; align-items: center; gap: 12px; font-size: .92rem; }
.parties b { text-align: right; }
.barre { height: 9px; background: #e8eaf1; border-radius: 99px; overflow: hidden; }
.barre i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #7c3aed); border-radius: 99px; }
.revoir, .res-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.exam-q.corr { border-left: 4px solid var(--line); }
.exam-q.corr.ok { border-left-color: var(--ok); } .exam-q.corr.ko { border-left-color: var(--ko); } .exam-q.corr.partiel { border-left-color: #f59e0b; }

/* Progression */
.kpis { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 15px 18px; }
.kpi span { font-size: .84rem; color: var(--muted); display: block; }
.kpi b { font-size: 1.55rem; font-weight: 850; display: block; margin-bottom: 5px; }
.raz { margin-top: 28px; }

/* Enseignant */
.panneau { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; margin-bottom: 16px; }
.panneau h2 { font-size: 1.22rem; margin-bottom: 8px; }
.form-ligne { display: grid; grid-template-columns: 2.2fr 1fr 1fr 1fr; gap: 10px; margin: 12px 0; }
.form-ligne label { font-size: .84rem; font-weight: 620; }
.check { display: inline-flex; align-items: center; gap: 7px; margin: 5px 0 11px; font-size: .92rem; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ep-msg { margin: 8px 0 0; }
.heat td:not(:first-child) { text-align: center; font-weight: 650; }
.h-h { background: #bbf7d0; } .h-m { background: #fef08a; } .h-b { background: #fecaca; }
.feuille { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 30px 34px; margin-top: 16px; }
.feuille header { display: flex; justify-content: space-between; gap: 18px; border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 15px; }
.feuille h2 { font-size: 1.2rem; margin-bottom: 3px; }
.feuille header p { margin: 0; font-size: .88rem; }
.f-id { font-size: .85rem; line-height: 2; white-space: nowrap; }
.f-q { margin-bottom: 15px; break-inside: avoid; }
.f-q-t { display: flex; justify-content: space-between; }
.f-pts { font-size: .8rem; color: var(--muted); }
.f-rep { height: 46px; border-bottom: 1px dotted #9ca3af; }

/* Tarifs */
.plans { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; align-items: stretch; }
.plan { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 22px 19px; }
.plan.top { border: 2px solid var(--brand); box-shadow: 0 12px 34px rgba(67,56,202,.16); }
.plan-tag { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: .74rem; font-weight: 700; padding: 2px 11px; border-radius: 99px; }
.plan h3 { font-size: 1.08rem; }
.plan-p { font-size: 1.85rem; font-weight: 850; margin-top: 7px; line-height: 1.15; }
.plan ul { list-style: none; padding: 0; margin: 14px 0 18px; flex: 1; font-size: .91rem; }
.plan li { padding: 3px 0 3px 21px; position: relative; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }
.faq { max-width: 760px; margin: 0 auto; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: var(--r-s); padding: 11px 16px; margin-bottom: 7px; }
.faq summary { font-weight: 650; cursor: pointer; }
.faq p { margin: 7px 0 0; color: var(--ink-2); font-size: .95rem; }

/* Une longue ligne de code défile dans son bloc au lieu d'élargir la page */
.quiz, .quiz-opts, .exos, .modules { grid-template-columns: minmax(0, 1fr); }
.opt > span:last-child { min-width: 0; overflow-wrap: anywhere; }

/* Adaptation écrans */
@media (max-width: 1120px) {
  .nav-toggle { display: block; order: 3; margin-left: 0; }
  .xp-pill { margin-left: auto; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 62px; flex-direction: column; background: #fff; border-bottom: 1px solid var(--line); padding: 9px 16px 13px; box-shadow: var(--shadow); }
  body.menu-ouvert .nav { display: flex; }
  .niveaux-grid { grid-template-columns: repeat(3, 1fr); }
  .plans { grid-template-columns: repeat(2, 1fr); }
  .audience { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; padding-top: 36px; padding-bottom: 36px; }
  .lecon { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { display: none; }
  .features, .cards { grid-template-columns: repeat(2, 1fr); }
  .cards.deux { grid-template-columns: 1fr; }
  .stats, .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi.large { grid-column: span 2; }
  .form-ligne { grid-template-columns: 1fr 1fr; }
  .ch { flex-wrap: wrap; }
  .ch-tags { width: 100%; max-width: none; justify-content: flex-start; padding-left: 32px; }
}
@media (max-width: 560px) {
  .container { padding: 0 15px; }
  .niveaux-grid, .features, .cards, .plans, .audience, .compare { grid-template-columns: 1fr; }
  .niveau-tete { flex-direction: column; }
  .nt-compte { text-align: left; }
  .robot { --cs: 44px; padding: 12px; }
  .parties > div { grid-template-columns: minmax(0, 1fr) 62px; }
  .parties .barre { grid-column: 1 / -1; grid-row: 2; }
  .feuille { padding: 18px; }
  .feuille header { flex-direction: column; }
  code, .badge { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Comptes, tarifs, paywall */
.lang-switch { display: inline-flex; background: #eef0f4; border-radius: 8px; padding: 2px; flex: none; }
.lang-switch button { border: 0; background: none; font: inherit; font-size: .78rem; font-weight: 750; color: var(--muted); padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.lang-switch button.actif { background: #fff; color: var(--brand); box-shadow: 0 1px 2px rgba(0,0,0,.14); }
.btn-compte { flex: none; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.btn-danger { background: var(--ko); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #991b1b; }
.footer a { color: inherit; text-decoration: underline; }
.auth { max-width: 440px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 28px; box-shadow: var(--shadow); }
.auth .h-page { font-size: 1.6rem; }
.auth .sous { font-size: .95rem; margin-bottom: 16px; }
.auth form { display: grid; gap: 13px; }
.auth form .btn { width: 100%; }
.champ { display: grid; gap: 4px; font-size: .88rem; font-weight: 620; margin-bottom: 8px; }
.auth .champ { margin-bottom: 0; }
.champ small { font-weight: 400; font-size: .8rem; }
.auth-pied { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; margin-top: 15px; font-size: .87rem; color: var(--muted); }
.check { align-items: flex-start; }
.check input { margin-top: 4px; flex: none; }
.form-msg { margin: 0; padding: 8px 12px; border-radius: 7px; font-size: .9rem; }
.form-msg.ok { background: var(--ok-soft); color: #14532d; }
.form-msg.ko { background: var(--ko-soft); color: #7f1d1d; }
.panneau form { max-width: 420px; display: grid; gap: 4px; }
.panneau form .btn { justify-self: start; margin-top: 4px; }
#f-suppr { margin-top: 13px; }
.acces-etat { border-left: 4px solid var(--line); }
.acces-etat.ok { border-left-color: var(--ok); background: #f6fef9; }
.paywall { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 34px 30px; text-align: center; box-shadow: var(--shadow); }
.pw-ic { font-size: 2.2rem; line-height: 1; margin-bottom: 8px; }
.pw-sur { font-size: .8rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; color: var(--brand); margin-bottom: 5px; }
.pw-liste { list-style: none; padding: 0; display: inline-block; text-align: left; margin: 2px 0 16px; }
.pw-liste li { padding: 2px 0 2px 22px; position: relative; }
.pw-liste li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }
.pw-actions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin-bottom: 11px; }
.accord { display: flex; gap: 8px; max-width: 620px; margin: 20px auto 6px; font-size: .9rem; }
.bande-offres { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.bande-offres > div { background: #fff; border: 1px solid var(--line); border-radius: var(--r-s); padding: 12px 16px; font-size: .9rem; }
.bande-offres b { display: block; }
.bande-offres span { color: var(--muted); }
.legal-avis { background: var(--warn-soft); border: 1px solid #fcd34d; border-radius: var(--r-s); padding: 9px 14px; font-size: .88rem; margin-bottom: 18px; }
.legal h2 { font-size: 1.1rem; margin: 20px 0 6px; }
@media (max-width: 1120px) {
  .lang-switch { margin-left: auto; }
  .xp-pill { margin-left: 0; }
}
@media (max-width: 560px) {
  .topbar-in { gap: 7px; }
  .logo span { display: none; }
  .xp-pill { display: none; }
  .btn-compte { max-width: 110px; }
  .bande-offres { grid-template-columns: 1fr; }
  .auth { padding: 20px; }
}

/* Laboratoires */
.labo { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 15px 18px; }
.labo-t { font-weight: 750; margin-bottom: 9px; }
.circ-ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 10px; }
.circ-entrees, .circ-sorties { display: flex; flex-wrap: wrap; gap: 8px; }
.circ-fleche { font-size: 1.4rem; color: var(--muted); }
.interrupteur { display: grid; place-items: center; min-width: 58px; padding: 6px 10px; border-radius: 10px; border: 2px solid #cbd2e1; background: #f4f6fb; font: inherit; cursor: pointer; }
.interrupteur b { font-size: 1rem; } .interrupteur span { font: 700 1.1rem var(--mono); color: var(--muted); }
.interrupteur.on { border-color: var(--brand); background: var(--brand-soft); } .interrupteur.on span { color: var(--brand); }
.lampe { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 10px; background: #f4f6fb; }
.lampe code { font-size: .78rem; }
.ampoule { width: 20px; height: 20px; border-radius: 50%; background: #cbd2e1; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.lampe.on .ampoule { background: #fbbf24; box-shadow: 0 0 14px #fbbf24; }
.circ-table tr.actif td { outline: 2px solid var(--brand); outline-offset: -2px; }
.circ-table td.on, .defi-table td.on { color: var(--brand); font-weight: 800; }
.defi-table td.ok { background: var(--ok-soft); } .defi-table td.ko { background: var(--ko-soft); }
.defi .practice-form { margin: 8px 0; } .defi-sol { margin-top: 9px; font-size: .92rem; }
.cpu-grille { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; }
.registres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 9px; }
.registres div { background: #161b2e; color: #e6e9f5; border-radius: 8px; padding: 6px 10px; }
.registres span { display: block; font-size: .72rem; color: #aab2d3; } .registres b { font: 800 1.05rem var(--mono); }
.memoire { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; font: .68rem var(--mono); }
.memoire span { background: #f4f6fb; border-radius: 3px; padding: 2px 1px; text-align: center; color: #9aa1b4; position: relative; min-width: 0; overflow: hidden; }
.memoire span small { display: block; font-size: .55rem; color: #b6bccb; }
.memoire span.nz { color: var(--ink); background: #e9ecf6; } .memoire span.pc { background: var(--brand); color: #fff; } .memoire span.pc small { color: #c7d2fe; }
.web-grille { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
.web-apercu { border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; background: #fff; min-height: 180px; }
.web-apercu iframe.bac { width: 100%; height: 100%; border: 0; display: block; }
.apercu[hidden] iframe { display: none; }
.schema { font-size: .9rem; margin-bottom: 8px; } .schema ul { margin: 5px 0 0; padding-left: 20px; }
.resultat-sql td, .resultat-sql th { font-family: var(--mono); font-size: .84rem; }
.lien-signal { all: unset; cursor: pointer; display: inline-block; margin-top: 10px; font-size: .8rem; color: var(--muted); }
.lien-signal:hover, .lien-signal:focus-visible { color: var(--ko); text-decoration: underline; }
.dialogue { border: 0; border-radius: var(--r); padding: 0; width: min(520px, 92vw); box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.dialogue::backdrop { background: rgba(17,24,39,.45); }
.dialogue form { padding: 22px; display: grid; gap: 10px; } .dialogue h2 { font-size: 1.25rem; }
.attente-carte { background: linear-gradient(120deg, #eef2ff, #fdf2f8); border: 1px solid #c7d2fe; border-radius: var(--r); padding: 22px 24px; }
.attente-carte h2 { font-size: 1.35rem; margin-bottom: 6px; }
.attente-carte form { display: grid; gap: 8px; margin-top: 10px; }
.attente-ligne { display: grid; grid-template-columns: 2fr 1fr .8fr auto; gap: 8px; }
.zone-attente { max-width: 760px; margin: 22px auto 0; }
.fiche-module { margin-top: 22px; } .fiche-module > h2 { font-size: 1.3rem; border-bottom: 2px solid var(--line); padding-bottom: 6px; margin-bottom: 10px; }
.fiche { background: #fff; border: 1px solid var(--line); border-radius: var(--r-s); padding: 12px 16px; margin-bottom: 10px; break-inside: avoid; }
.fiche h3 { font-size: 1.02rem; margin-bottom: 6px; } .fiche-entete { display: none; }
.kpis-admin { grid-template-columns: repeat(3, 1fr); } .kpis-admin .kpi small { display: block; color: var(--muted); }
.signal { border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 14px; margin-bottom: 9px; }
.signal-t { font-size: .82rem; color: var(--muted); } .signal p { margin: 5px 0; }
@media (max-width: 860px) {
  .cpu-grille, .web-grille { grid-template-columns: minmax(0, 1fr); }
  .attente-ligne { grid-template-columns: 1fr 1fr; }
  .attente-ligne .input[type=email] { grid-column: span 2; }
  .kpis-admin { grid-template-columns: repeat(2, 1fr); }
}
@media print {
  .fiches .fiche { border: 1px solid #bbb; }
  .fiche-entete { display: block !important; font-size: 10pt; margin-bottom: 8px; }
  .lien-signal { display: none !important; }
}

/* Impression des épreuves */
@media print {
  body { background: #fff; display: block; font-size: 11pt; }
  .no-print, .topbar, .footer, .demo-banner, #toast { display: none !important; }
  .page { padding: 0; }
  .container { max-width: none; padding: 0; }
  .feuille { border: 0; border-radius: 0; padding: 0; margin: 0; break-after: page; }
  .feuille:last-child { break-after: auto; }
  pre.code { background: #f4f4f4 !important; color: #000 !important; border: 1px solid #bbb; }
  pre.code span { color: #000 !important; font-style: normal !important; }
  code { background: none; color: #000; }
  .practice-corr { background: #fff; }
}

/* Rabais frères et sœurs */
.fratrie-achat { max-width: 620px; margin: 18px auto 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 16px; }
.fratrie-achat summary { font-weight: 650; cursor: pointer; }
.ligne-code { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ligne-code .input { flex: 1 1 160px; min-width: 0; font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.code-fratrie b { font-family: var(--mono); font-size: 1.25rem; letter-spacing: .1em; }
