/* Éloquence. Une seule famille (Bricolage Grotesque), un seul accent (cobalt), un seul rayon (14px, pilules pour les puces). */
@font-face {
  font-family: 'Bricolage';
  src: url('fonts/bricolage.woff2') format('woff2');
  font-weight: 200 800; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bricolage';
  src: url('fonts/bricolage-ext.woff2') format('woff2');
  font-weight: 200 800; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f3f4f7;
  --surface: #fdfdfe;
  --sunken: #eceef3;
  --ink: #12141a;
  --ink-2: #555b69;
  --ink-3: #7b8190;
  --line: #e1e4ea;
  --accent: #2f45e8;
  --accent-hover: #2537d0;
  --accent-ink: #f7f8ff;
  --accent-soft: #e7eafd;
  --accent-text: #2437c9;
  --ok: #157a3c;
  --ok-strong: #1d9a4f;
  --ok-bg: #e2f4e8;
  --bad: #b8302d;
  --bad-strong: #d9443f;
  --bad-bg: #fbe7e5;
  --shadow-sm: 0 1px 2px rgb(18 20 26 / .05);
  --shadow: 0 1px 2px rgb(18 20 26 / .04), 0 8px 24px -8px rgb(30 40 90 / .12);
  --shadow-up: 0 -10px 30px -12px rgb(30 40 90 / .22);
  --r: 14px;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);
  --font: 'Bricolage', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --col: 600px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e12;
    --surface: #16181d;
    --sunken: #1d2027;
    --ink: #eceef2;
    --ink-2: #a2a8b5;
    --ink-3: #7d8391;
    --line: #262a33;
    --accent: #6c7cff;
    --accent-hover: #8290ff;
    --accent-ink: #0d0e12;
    --accent-soft: #1b2045;
    --accent-text: #9aa5ff;
    --ok: #5fd08c;
    --ok-strong: #3fb873;
    --ok-bg: #12261a;
    --bad: #ff8b84;
    --bad-strong: #ef5a54;
    --bad-bg: #2d1615;
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgb(255 255 255 / .04);
    --shadow-up: 0 -10px 30px -12px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  scrollbar-color: var(--line) transparent;
}
body {
  margin: 0; min-height: 100dvh;
  background: var(--bg); color: var(--ink);
  font: 400 17px/1.55 var(--font);
  
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; background: none; border: 0; padding: 0; }
input, textarea { caret-color: var(--accent); font-size: max(16px, 1em); }
h1, h2, h3 { margin: 0; font-weight: 640; letter-spacing: -.022em; line-height: 1.15; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
.i { width: 22px; height: 22px; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 54px; padding: 0 22px; border-radius: var(--r);
  font-weight: 600; font-size: 1.02rem; letter-spacing: -.01em; white-space: nowrap;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 0 rgb(255 255 255 / .15) inset, 0 6px 16px -6px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn.ghost { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line) inset; }
.btn.ok { background: var(--ok-strong); color: #fff; }
.btn.bad { background: var(--bad-strong); color: #fff; }
.btn.block { width: 100%; }
@media (hover: hover) and (pointer: fine) {
  .btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
  .btn.ghost:hover:not(:disabled) { box-shadow: 0 0 0 1px var(--ink-3) inset; }
}
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2);
  transition: background-color 160ms ease, transform 140ms var(--ease-out);
}
.icon-btn:active { transform: scale(.94); }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: var(--sunken); color: var(--ink); } }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 999px; background: var(--sunken); color: var(--ink-2); font-size: .9rem; font-weight: 500;
  transition: transform 140ms var(--ease-out), background-color 160ms ease;
}
.chip .i { width: 18px; height: 18px; }
.chip:active { transform: scale(.96); }
.textlink { color: var(--ink-2); font-size: .92rem; font-weight: 500; padding: 8px 4px; }
@media (hover: hover) and (pointer: fine) { .textlink:hover { color: var(--ink); } }

/* ---------- Champs ---------- */
.field {
  width: 100%; height: 54px; padding: 0 16px; border-radius: var(--r);
  border: 0; background: var(--surface); box-shadow: 0 0 0 1.5px var(--line) inset;
  font-size: 1.1rem; outline: none; transition: box-shadow 160ms ease;
}
textarea.field { height: auto; min-height: 170px; padding: 14px 16px; line-height: 1.6; resize: vertical; }
.field:focus { box-shadow: 0 0 0 2px var(--accent) inset; }
.field::placeholder { color: var(--ink-3); }
.field.is-ok { box-shadow: 0 0 0 2px var(--ok-strong) inset; }
.field.is-bad { box-shadow: 0 0 0 2px var(--bad-strong) inset; }
.label { display: block; font-size: .9rem; font-weight: 550; color: var(--ink-2); margin: 0 0 8px; }
.accents { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.accents button {
  min-width: 42px; height: 40px; border-radius: 10px; background: var(--surface);
  box-shadow: 0 0 0 1px var(--line) inset; font-size: 1.05rem;
  transition: transform 120ms var(--ease-out);
}
.accents button:active { transform: scale(.92); }
@media (pointer: coarse) { .accents { display: none; } }

/* ---------- Accueil ---------- */
.home { max-width: var(--col); margin: 0 auto; padding: 0 20px calc(48px + env(safe-area-inset-bottom)); }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 0 10px;
}
.wordmark { font-weight: 700; font-size: 1.15rem; letter-spacing: -.03em; }
.wordmark span { color: var(--accent); }
.topbar .right { display: flex; align-items: center; gap: 4px; }
.streak {
  display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px 0 9px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line) inset; font-weight: 600; font-size: .95rem;
}
.streak .i { width: 19px; height: 19px; color: #f0712c; }
.streak.cold .i { color: var(--ink-3); }

.greet { padding: 26px 0 22px; }
.greet .date { color: var(--ink-2); font-size: .95rem; margin-bottom: 6px; }
.greet h1 { font-size: clamp(1.9rem, 6.5vw, 2.4rem); }

.today {
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow), 0 0 0 1px var(--line) inset;
  padding: 22px 20px 20px;
}
.today-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.today-head h2 { font-size: 1.3rem; }
.today-head .t { color: var(--ink-2); font-size: .92rem; white-space: nowrap; }
.today .lead { color: var(--ink-2); font-size: .97rem; margin-bottom: 14px; }
.steps { list-style: none; margin: 0 0 18px; padding: 0; }
.steps li { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 12px; padding: 7px 0; }
.steps .ico {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: var(--sunken); color: var(--ink-2);
}
.steps .ico .i { width: 19px; height: 19px; }
.steps .name { font-weight: 550; font-size: .98rem; line-height: 1.3; }
.steps .name small { display: block; font-weight: 400; color: var(--ink-2); font-size: .85rem; }
.steps .state { color: var(--ink-3); font-size: .85rem; }
.steps li.done .ico { background: var(--ok-bg); color: var(--ok); }
.steps li.done .name { color: var(--ink-2); }
.steps li.cur .ico { background: var(--accent); color: var(--accent-ink); }
.today.finished { text-align: left; }
.today.finished .badge-done {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: var(--ok-bg); color: var(--ok); margin-bottom: 14px;
}
.today.finished .badge-done .i { width: 28px; height: 28px; }

.section { margin-top: 36px; }
.section > h2 { font-size: 1.15rem; margin-bottom: 14px; }
.figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.figure { padding: 4px 0; }
.figure b { display: block; font-size: 1.7rem; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.figure span { color: var(--ink-2); font-size: .85rem; line-height: 1.3; display: block; margin-top: 4px; }

.rulegrid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.rulegrid button {
  aspect-ratio: 1; border-radius: 6px; background: var(--sunken); box-shadow: 0 0 0 1px var(--line) inset;
  transition: transform 140ms var(--ease-out);
}
.rulegrid button:active { transform: scale(.88); }
.rulegrid button.s-learning { background: color-mix(in srgb, var(--accent) 38%, var(--surface)); box-shadow: none; }
.rulegrid button.s-known, .rulegrid button.s-mastered { background: var(--accent); box-shadow: none; }
.rulegrid button.en { border-radius: 50%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; color: var(--ink-2); font-size: .84rem; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; background: var(--sunken); box-shadow: 0 0 0 1px var(--line) inset; }
.legend i.l { background: color-mix(in srgb, var(--accent) 38%, var(--surface)); box-shadow: none; }
.legend i.k { background: var(--accent); box-shadow: none; }

.phases { display: grid; gap: 4px; }
.phase { display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 12px 0; }
.phase .n {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 650; font-size: .88rem; background: var(--sunken); color: var(--ink-2);
}
.phase.cur .n { background: var(--accent); color: var(--accent-ink); }
.phase.done .n { background: var(--ok-bg); color: var(--ok); }
.phase h3 { font-size: 1rem; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.phase h3 span { color: var(--ink-3); font-weight: 450; font-size: .85rem; white-space: nowrap; }
.phase p { color: var(--ink-2); font-size: .9rem; margin-top: 3px; }
.meter { height: 4px; border-radius: 2px; background: var(--line); margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transform-origin: left; }

.list { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-sm), 0 0 0 1px var(--line) inset; overflow: hidden; }
.row {
  width: 100%; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px;
  padding: 12px 14px 12px 14px; text-align: left; position: relative;
  transition: background-color 140ms ease;
}
.row + .row::before { content: ''; position: absolute; top: 0; left: 64px; right: 0; height: 1px; background: var(--line); }
.row .ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.row .ico .i { width: 20px; height: 20px; }
.row b { display: block; font-weight: 560; font-size: .99rem; }
.row small { display: block; color: var(--ink-2); font-size: .85rem; }
.row .chev { color: var(--ink-3); width: 18px; height: 18px; }
.row:active { background: var(--sunken); }
@media (hover: hover) and (pointer: fine) { .row:hover { background: var(--sunken); } }
.row-form { padding: 4px 14px 16px; display: grid; gap: 10px; }

/* ---------- Écran d'exercice ---------- */
.ex { min-height: 100dvh; display: flex; flex-direction: column; }
.xbar {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: calc(8px + env(safe-area-inset-top)) 12px 6px;
}
.xbar-in { max-width: calc(var(--col) + 24px); margin: 0 auto; }
.xbar .line { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 10px; }
.pbar { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transform-origin: left; transition: transform 520ms var(--ease-out); }
.xbar .meta { display: flex; justify-content: space-between; align-items: center; padding: 2px 6px 0 58px; height: 34px; }
.xbar .meta span { color: var(--ink-2); font-size: .88rem; font-weight: 500; }
.xbar .meta button { color: var(--ink-3); font-size: .88rem; padding: 6px 0; }
@media (hover: hover) and (pointer: fine) { .xbar .meta button:hover { color: var(--ink); } }

.stage { flex: 1; width: 100%; max-width: var(--col); margin: 0 auto; padding: 18px 20px calc(130px + env(safe-area-inset-bottom)); }
.enter { animation: enter 300ms var(--ease-out) both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }
.prompt { font-size: clamp(1.35rem, 4.6vw, 1.6rem); margin-bottom: 8px; }
.hint { color: var(--ink-2); font-size: .96rem; margin-bottom: 22px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-text); font-size: .82rem; font-weight: 600; margin-bottom: 14px;
}
.tag.en { background: var(--sunken); color: var(--ink-2); }

.sentence { font-size: clamp(1.35rem, 5vw, 1.6rem); line-height: 1.75; letter-spacing: -.01em; font-weight: 450; margin: 6px 0 4px; }
.gap {
  display: inline-block; width: 7.5em; max-width: 60vw; height: 1.7em; vertical-align: baseline;
  border: 0; border-bottom: 2.5px solid var(--accent); border-radius: 6px 6px 2px 2px;
  background: var(--accent-soft); padding: 0 8px; text-align: center; font-weight: 600; font-size: inherit; outline: none;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.gap.is-ok { border-color: var(--ok-strong); background: var(--ok-bg); color: var(--ok); }
.gap.is-bad { border-color: var(--bad-strong); background: var(--bad-bg); color: var(--bad); }
mark { background: none; color: inherit; font-weight: 650; border-radius: 5px; padding: 0 3px; }
mark.ok { background: var(--ok-bg); color: var(--ok); }
mark.bad { background: var(--bad-bg); color: var(--bad); text-decoration: line-through; text-decoration-thickness: 2px; }
mark.acc { background: var(--accent-soft); color: var(--accent-text); }

.spot { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; }
.spot .w {
  font-size: inherit; font-weight: inherit; letter-spacing: inherit; line-height: 1.45;
  padding: 1px 6px; border-radius: 8px; box-shadow: 0 2px 0 var(--line);
  transition: background-color 140ms ease, transform 140ms var(--ease-out), box-shadow 140ms ease;
}
.spot .w:active { transform: scale(.95); }
@media (hover: hover) and (pointer: fine) { .spot .w:hover { background: var(--sunken); } }
.spot .w.found { background: var(--accent-soft); color: var(--accent-text); box-shadow: 0 2px 0 var(--accent); }
.spot .w.miss { background: var(--bad-bg); color: var(--bad); box-shadow: none; }
.spot .w.was { background: var(--ok-bg); color: var(--ok); box-shadow: none; }
.spot .w:disabled { cursor: default; }
.spot .p { padding: 1px 0; }
.fix { margin-top: 22px; animation: enter 260ms var(--ease-out) both; }

.listen { display: flex; align-items: center; gap: 12px; margin: 4px 0 22px; }
.play {
  width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: transform 140ms var(--ease-out);
}
.play .i { width: 28px; height: 28px; }
.play:active { transform: scale(.94); }
.play.speaking { animation: speak 1.1s ease-in-out infinite; }
@keyframes speak { 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 16%, transparent); } }

.conj-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.conj-head .verb { font-size: clamp(2rem, 8vw, 2.6rem); font-weight: 680; letter-spacing: -.035em; }
.conj-row { display: flex; align-items: center; gap: 12px; }
.conj-row .pro { font-size: 1.35rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.conj-row .field { font-size: 1.25rem; font-weight: 550; }

.def { font-size: 1.05rem; color: var(--ink-2); margin-bottom: 16px; }
.word { font-size: clamp(2.2rem, 9vw, 3rem); font-weight: 680; letter-spacing: -.04em; line-height: 1.05; margin: 2px 0 10px; }
.quote { font-size: 1.2rem; line-height: 1.6; padding: 16px 18px; background: var(--surface); border-radius: var(--r); box-shadow: 0 0 0 1px var(--line) inset; margin: 18px 0 14px; }
.syns { display: flex; flex-wrap: wrap; gap: 6px; }
.syns span { height: 30px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 999px; background: var(--sunken); color: var(--ink-2); font-size: .88rem; }

.rule-text { font-size: 1.12rem; line-height: 1.6; margin: 14px 0 18px; }
.trick { display: grid; grid-template-columns: 24px 1fr; gap: 10px; padding: 14px 16px; border-radius: var(--r); background: var(--accent-soft); color: var(--ink); font-size: 1rem; }
.trick .i { color: var(--accent-text); width: 22px; height: 22px; margin-top: 1px; }
.examples { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 8px; }
.examples li { font-size: 1.08rem; padding: 12px 16px; border-radius: var(--r); background: var(--surface); box-shadow: 0 0 0 1px var(--line) inset; }
.small-title { font-size: .92rem; color: var(--ink-2); font-weight: 550; margin-top: 26px; }

/* Barre d'action et feuille de correction */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  padding: 18px 20px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 62%, color-mix(in srgb, var(--bg) 0%, transparent));
}
.dock-in { max-width: var(--col); margin: 0 auto; display: flex; gap: 10px; }
.dock-in .btn { flex: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  transform: translateY(105%); visibility: hidden;
  transition: transform 420ms var(--ease-drawer), visibility 0s linear 420ms;
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-up);
  padding: 22px 20px calc(16px + env(safe-area-inset-bottom));
  max-height: 78dvh; overflow-y: auto; overscroll-behavior: contain;
}
.sheet.open { transform: none; visibility: visible; transition: transform 420ms var(--ease-drawer), visibility 0s; }
.sheet.ok { background: var(--ok-bg); }
.sheet.bad { background: var(--bad-bg); }
.sheet-in { max-width: var(--col); margin: 0 auto; }
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.sheet-head .badge { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.sheet.ok .badge { background: var(--ok-strong); color: #fff; }
.sheet.bad .badge { background: var(--bad-strong); color: #fff; }
.sheet .badge .i { width: 22px; height: 22px; stroke-width: 2.5; }
.sheet.open .badge { animation: pop 380ms var(--ease-out) 120ms both; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.sheet-head h3 { font-size: 1.25rem; }
.sheet.ok h3 { color: var(--ok); }
.sheet.bad h3 { color: var(--bad); }
.sheet-body { font-size: 1rem; line-height: 1.55; display: grid; gap: 10px; margin-bottom: 16px; }
.sheet-body .answer { font-size: 1.15rem; font-weight: 500; }
.sheet-body .rule b { display: block; margin-bottom: 2px; }
.sheet-body .rule { color: var(--ink); }
.sheet-body .tip { display: grid; grid-template-columns: 20px 1fr; gap: 8px; }
.sheet-body .tip .i { width: 20px; height: 20px; margin-top: 2px; }

.diff { font-size: 1.12rem; line-height: 1.9; }
.diff .miss { background: color-mix(in srgb, var(--bad-strong) 18%, transparent); color: var(--bad); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.diff del { color: var(--ink-3); margin-right: 3px; }

/* Écriture */
.wc { color: var(--ink-3); font-size: .88rem; margin-top: 8px; text-align: right; }
.result { margin-top: 26px; animation: enter 300ms var(--ease-out) both; }
.result h2 { font-size: 1.2rem; margin-bottom: 12px; }
.marked { font-size: 1.08rem; line-height: 1.75; padding: 16px 18px; background: var(--surface); border-radius: var(--r); box-shadow: 0 0 0 1px var(--line) inset; }
.marked .err { background: var(--bad-bg); color: var(--bad); border-radius: 4px; padding: 0 2px; text-decoration: underline wavy var(--bad-strong); text-underline-offset: 4px; text-decoration-thickness: 1px; }
.errs { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.errs li { padding: 12px 16px; border-radius: var(--r); background: var(--surface); box-shadow: 0 0 0 1px var(--line) inset; }
.errs .from { color: var(--bad); text-decoration: line-through; }
.errs .to { color: var(--ok); font-weight: 600; }
.errs small { display: block; color: var(--ink-2); font-size: .88rem; margin-top: 3px; }
.coach { margin-top: 18px; padding: 18px; border-radius: var(--r); background: var(--accent-soft); white-space: pre-wrap; font-size: .97rem; line-height: 1.6; }
.coach .head { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--accent-text); margin-bottom: 8px; white-space: normal; }
.skeleton { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--line), var(--sunken), var(--line)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; margin: 8px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Oral */
.read-text { font-size: clamp(1.3rem, 4.8vw, 1.55rem); line-height: 1.6; font-weight: 450; letter-spacing: -.01em; margin: 6px 0 20px; }
.read-text .miss { color: var(--bad); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.mic-wrap { display: grid; justify-items: center; gap: 12px; margin: 26px 0 10px; }
.mic {
  width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 12px 28px -10px color-mix(in srgb, var(--accent) 75%, transparent);
  transition: transform 160ms var(--ease-out), background-color 200ms ease;
}
.mic .i { width: 36px; height: 36px; }
.mic:active { transform: scale(.94); }
.mic.live { background: var(--bad-strong); animation: live 1.5s ease-in-out infinite; }
@keyframes live { 50% { box-shadow: 0 0 0 16px color-mix(in srgb, var(--bad-strong) 14%, transparent); } }
.mic-wrap p { color: var(--ink-2); font-size: .92rem; text-align: center; }
.transcript { min-height: 56px; padding: 14px 16px; border-radius: var(--r); background: var(--sunken); color: var(--ink-2); font-size: 1rem; margin-top: 12px; }
.score { display: flex; align-items: baseline; gap: 10px; margin-top: 16px; }
.score b { font-size: 2.4rem; font-weight: 680; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.ring { position: relative; width: 168px; height: 168px; margin: 8px auto 0; }
.ring > svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: var(--line); }
.ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 300ms linear; }
.ring.live .val { stroke: var(--bad-strong); }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; }
.ring .center b { font-size: 2.6rem; font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.talk-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0 12px; }
.talk-stats div { padding: 14px 12px; border-radius: var(--r); background: var(--surface); box-shadow: 0 0 0 1px var(--line) inset; }
.talk-stats b { display: block; font-size: 1.6rem; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.talk-stats span { font-size: .82rem; color: var(--ink-2); }
audio { width: 100%; margin-top: 12px; }

/* Fin de séance */
.finish { max-width: var(--col); margin: 0 auto; padding: calc(40px + env(safe-area-inset-top)) 20px calc(40px + env(safe-area-inset-bottom)); text-align: center; }
.finish .ring { width: 190px; height: 190px; }
.finish .ring .val { stroke: var(--ok-strong); transition: stroke-dashoffset 1100ms var(--ease-out) 150ms; }
.finish .ring .center .i { width: 64px; height: 64px; color: var(--ok-strong); stroke-width: 2.25; animation: pop 500ms var(--ease-out) 900ms both; }
.finish h1 { font-size: clamp(1.8rem, 6vw, 2.2rem); margin: 22px 0 8px; }
.finish .lead { color: var(--ink-2); max-width: 44ch; margin: 0 auto; }
.finish .figures { margin: 28px 0; text-align: center; }
.finish .stack { display: grid; gap: 10px; text-align: left; }

/* Accueil : premier lancement */
.intro { padding-top: 22px; }
.intro h1 { font-size: clamp(2.1rem, 8vw, 2.8rem); letter-spacing: -.04em; line-height: 1.08; }
.intro .lead { color: var(--ink-2); font-size: 1.08rem; margin: 14px 0 26px; max-width: 46ch; }
.science { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.science li { display: grid; grid-template-columns: 38px 1fr; gap: 14px; padding: 12px 0; }
.science .ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.science .ico .i { width: 20px; height: 20px; }
.science b { display: block; font-weight: 600; }
.science span { color: var(--ink-2); font-size: .93rem; }
.cta-stack { display: grid; gap: 10px; margin-top: 26px; }

/* Bibliothèque, réglages */
.page-head { display: flex; align-items: center; gap: 6px; padding: calc(10px + env(safe-area-inset-top)) 0 8px; margin-left: -10px; }
.page-head h1 { font-size: 1.5rem; }
.group-title { font-size: .92rem; color: var(--ink-2); font-weight: 550; margin: 26px 4px 10px; }
.status { font-size: .8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--sunken); color: var(--ink-3); white-space: nowrap; }
.status.learning { background: var(--accent-soft); color: var(--accent-text); }
.status.known, .status.mastered { background: var(--ok-bg); color: var(--ok); }
.settings-block { padding: 18px; }
.settings-block p { color: var(--ink-2); font-size: .94rem; margin-bottom: 12px; }
.settings-block .rowbtns { display: flex; gap: 10px; flex-wrap: wrap; }
.settings-block .rowbtns .btn { flex: 1; height: 48px; }

.toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px;
  font-size: .95rem; font-weight: 500; max-width: calc(100% - 40px); width: max-content;
  transition: opacity 220ms ease, transform 280ms var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* Conversation */
.chat { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 16px; }
.msg { max-width: 86%; padding: 12px 15px; border-radius: 18px; font-size: 1.02rem; line-height: 1.5; animation: enter 260ms var(--ease-out) both; }
.msg.ai { align-self: flex-start; background: var(--surface); box-shadow: 0 0 0 1px var(--line) inset; border-bottom-left-radius: 6px; cursor: pointer; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.msg.fix { align-self: flex-end; max-width: 80%; padding: 10px 14px; border-radius: 14px; background: var(--ok-bg); color: var(--ok); font-size: .93rem; margin-top: -4px; }
.msg.fix span { display: block; color: var(--ink-2); margin-top: 3px; }
.msg.typing { display: flex; gap: 5px; padding: 16px 18px; }
.msg.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: dot 1.1s ease-in-out infinite; }
.msg.typing i:nth-child(2) { animation-delay: .15s; }
.msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 30% { transform: translateY(-4px); opacity: .5; } }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer .field { min-height: 56px; height: 56px; padding: 15px 16px; resize: none; }
.mic-mini { width: 56px; height: 56px; border-radius: var(--r); background: var(--accent-soft); color: var(--accent-text); flex: none; }
.mic-mini.live { background: var(--bad-strong); color: #fff; animation: live 1.5s ease-in-out infinite; }
