:root {
  --bg: #f6f3ed;
  --surface: #fffdf9;
  --surface-2: #f0ece4;
  --ink: #1f1d1a;
  --ink-2: #4a463f;
  --muted: #736d63;
  --line: #e3ddd1;
  --accent: #d4442a;
  --accent-ink: #ffffff;
  --accent-soft: #f7e4dd;
  --good: #3a8a58;
  --good-soft: #e3f1e7;
  --bad: #c9392d;
  --bad-soft: #f9e2de;
  --gold: #c99a22;
  --shadow: 0 1px 2px rgba(40, 30, 20, .04), 0 6px 24px rgba(40, 30, 20, .05);
  --radius: 18px;
  --font: "Inter", "Zen Kaku Gothic New", system-ui, -apple-system, "Segoe UI", sans-serif;
  --jp: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --jp-hand: "Klee One", "Zen Kaku Gothic New", "Yu Mincho", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141311; --surface: #1d1b19; --surface-2: #292723; --ink: #f2eee7; --ink-2: #d4cec4; --muted: #a29b90;
    --line: #34312c; --accent: #e8603f; --accent-soft: #3a221b; --good: #5bb37c; --good-soft: #1c2e22;
    --bad: #ef6a5c; --bad-soft: #3a1f1c; --gold: #e0b544;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:disabled { cursor: default; }
svg { display: block; }
.jp { font-family: var(--jp); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
kbd { font-family: var(--font); }

/* ── Barre du haut ── */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 12px max(20px, calc((100vw - 880px) / 2 + 20px)); border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-family: var(--jp-hand); font-size: 19px; font-weight: 600; }
.top-title { flex: 1; font-weight: 600; font-size: 15px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-stats { display: flex; align-items: center; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 11px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.pill svg { width: 16px; height: 16px; }
.pill.lit { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.pill.lit svg { fill: var(--accent); }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: var(--ink-2); flex: none; transition: background .15s; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 9px; }
.icon-btn.sm svg { width: 17px; height: 17px; }

.wrap { max-width: 880px; margin: 0 auto; padding: 8px 20px 72px; }
.wrap.narrow { max-width: 720px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-title { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 32px 4px 12px; }
.section-title.sm { margin-top: 24px; }
.foot-note { color: var(--muted); font-size: 12.5px; text-align: center; margin-top: 36px; }

/* ── Boutons ── */
.btn { height: 46px; padding: 0 22px; border-radius: 14px; font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .08s, background .15s, opacity .15s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover:not(:disabled) { opacity: .9; }
.btn.primary:disabled { opacity: .25; }
.btn.ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.lg { height: 52px; padding: 0 28px; font-size: 16px; }
.btn svg { width: 18px; height: 18px; }
.link { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: 13px; margin-top: 6px; }
.link:hover { color: var(--ink); }

/* ── Anneaux ── */
.ring-bg { fill: none; stroke: var(--line); }
.ring-fg { fill: none; stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }

/* ── Accueil ── */
.hero { display: flex; gap: 24px; align-items: center; padding: 24px; margin-top: 8px; }
.hero-goal { position: relative; flex: none; }
.hero-goal-txt { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.hero-goal-txt b { font-size: 22px; letter-spacing: -.02em; }
.hero-goal-txt span { font-size: 11.5px; color: var(--muted); }
.hero-main { flex: 1; min-width: 0; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.hero h1 { font-size: 21px; margin: 2px 0 12px; letter-spacing: -.02em; font-weight: 700; }
.level-line { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.lv-bar { flex: 1; height: 6px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.lv-bar i { display: block; height: 100%; background: var(--ink); border-radius: 9px; }
.week { display: flex; gap: 8px; margin-top: 14px; align-items: flex-end; height: 56px; }
.wd { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.wd i { width: 100%; max-width: 22px; border-radius: 5px; background: var(--surface-2); }
.wd.ok i { background: var(--accent); }
.wd span { font-size: 10.5px; color: var(--muted); font-weight: 600; }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.quick-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-align: left; transition: transform .12s, border-color .15s; }
.quick-card:hover:not(:disabled) { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); transform: translateY(-1px); }
.quick-card:disabled { opacity: .6; }
.quick-card.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.quick-card.accent .qc-txt span { color: color-mix(in srgb, var(--accent-ink) 80%, transparent); }
.quick-card.accent .qc-icon { background: rgba(255, 255, 255, .18); color: #fff; }
.qc-icon { width: 42px; height: 42px; flex: none; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 20px; font-weight: 700; }
.qc-icon svg { width: 21px; height: 21px; }
.qc-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.qc-txt b { font-size: 15.5px; }
.qc-txt span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lessons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lesson-card { display: flex; align-items: center; gap: 16px; padding: 18px 18px 18px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: transform .12s, border-color .15s, box-shadow .15s; }
.lesson-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--ink) 22%, var(--line)); box-shadow: var(--shadow); }
.lesson-card.crowned { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); }
.lc-badge { position: relative; flex: none; }
.lc-n { position: absolute; inset: 0; display: grid; place-items: center; font-size: 21px; font-weight: 700; letter-spacing: -.03em; }
.lc-badge.big .lc-n { font-size: 28px; }
.lc-badge .crown { position: absolute; top: -9px; right: -7px; }
.lc-body { flex: 1; min-width: 0; }
.lc-label { font-size: 12.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.lc-fr { font-size: 17px; font-weight: 650; letter-spacing: -.01em; line-height: 1.3; }
.lc-jp { font-size: 14.5px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.lc-stat span { display: block; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .02em; margin-bottom: 3px; }
.lc-track { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.lc-track i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.lc-pct { flex: none; font-size: 15px; font-weight: 700; color: var(--ink-2); align-self: flex-start; margin-top: 2px; }
.lc-pct small { font-size: 11px; color: var(--muted); }
.crown svg { width: 22px; height: 22px; color: var(--gold); fill: color-mix(in srgb, var(--gold) 30%, transparent); }

/* ── Leçon ── */
.lesson-head { display: flex; align-items: center; gap: 20px; padding: 16px 4px 22px; }
.lh-text { flex: 1; min-width: 0; }
.lh-fr { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin: 2px 0 2px; }
.lh-jp { font-size: 16px; color: var(--muted); }
.lh-nav { display: flex; gap: 4px; flex: none; }
.tabs { display: flex; gap: 4px; padding: 5px; background: var(--surface-2); border-radius: 16px; margin-bottom: 24px; position: sticky; top: 64px; z-index: 5; }
.tabs a { flex: 1; text-align: center; padding: 10px 6px; border-radius: 12px; font-size: 15px; font-weight: 600; color: var(--muted); transition: background .15s, color .15s; }
.tabs a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.actions.single { grid-template-columns: 1fr; }
.action { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: left; transition: transform .12s, border-color .15s; }
.action svg { width: 20px; height: 20px; margin-bottom: 8px; color: var(--muted); }
.action b { font-size: 15px; }
.action small { font-size: 12.5px; color: var(--muted); }
.action:hover:not(:disabled) { transform: translateY(-1px); border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.action:disabled { opacity: .5; }
.action.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.action.primary svg, .action.primary small { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.progress-line { display: flex; align-items: center; gap: 12px; margin: 16px 4px 8px; font-size: 13px; color: var(--muted); font-weight: 500; }
.pl-bar { flex: 1; height: 5px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.pl-bar i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.search input { width: 100%; height: 44px; padding: 0 16px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14.5px; outline: none; margin-top: 8px; }
.search input:focus { border-color: color-mix(in srgb, var(--ink) 35%, var(--line)); }

.vcat h3, .kgroup h3 { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .04em; margin: 24px 4px 8px; }
.vlist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.vlist li { display: grid; grid-template-columns: auto minmax(0, 1.1fr) minmax(0, 1.4fr) auto; align-items: center; gap: 14px; padding: 13px 16px 13px 10px; border-top: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.vlist li:first-child { border-top: 0; }
.vlist li:hover { background: var(--surface-2); }
.v-jp { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.v-jp .jp { font-size: 19px; font-weight: 500; overflow-wrap: anywhere; }
.v-kanji { font-size: 14.5px !important; color: var(--muted); font-weight: 400 !important; }
.v-fr { font-size: 15.5px; color: var(--ink-2); line-height: 1.4; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--accent); }

/* Kana & kanji */
.rules { margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.rules summary { padding: 14px 18px; cursor: pointer; font-weight: 600; font-size: 14.5px; list-style: none; display: flex; justify-content: space-between; }
.rules summary::after { content: '＋'; color: var(--muted); }
.rules[open] summary::after { content: '－'; }
.rules .prose { padding: 0 18px 14px; }
.kgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.kgrid.wide { grid-template-columns: repeat(6, 1fr); }
.kcell, .jcell { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px 4px 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); transition: transform .12s, border-color .15s; position: relative; }
.kcell:hover, .jcell:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.kcell .jp { font-family: var(--jp-hand); font-size: 26px; line-height: 1.2; }
.kcell small { font-size: 11.5px; color: var(--muted); }
.kcell.seen, .jcell.seen { border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }
.kcell.learned, .jcell.learned { background: var(--accent-soft); border-color: transparent; }
.jgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-top: 16px; }
.jcell { padding: 16px 6px 12px; gap: 2px; }
.jcell .jp { font-family: var(--jp-hand); font-size: 40px; line-height: 1.15; }
.jcell small { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.25; min-height: 2.5em; }

/* Grammaire */
.glist { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.glist a { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; transition: transform .12s, border-color .15s; }
.glist a:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.g-num { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.g-num.big { width: 44px; height: 44px; font-size: 17px; background: var(--accent); color: var(--accent-ink); }
.g-body { flex: 1; min-width: 0; }
.g-jp { font-size: 15px; color: var(--muted); order: 2; }
.g-title { font-size: 16.5px; font-weight: 600; color: var(--ink); }
.g-title .muted { font-weight: 400; font-size: 14.5px; }
.g-body { display: flex; flex-direction: column; }
.g-score { font-size: 13px; font-weight: 700; color: var(--muted); }
.g-score.done { width: 28px; height: 28px; border-radius: 50%; background: var(--good-soft); color: var(--good); display: grid; place-items: center; }
.g-score svg { width: 16px; height: 16px; }
.g-head { display: flex; gap: 16px; align-items: flex-start; margin: 12px 0 20px; }
.g-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.xl2 { font-size: 15px; color: var(--accent); font-weight: 700; }
.prose { padding: 26px 28px; font-size: 16.5px; line-height: 1.7; color: var(--ink-2); }
.prose p { margin: 0 0 12px; }
.prose ul { margin: 0 0 12px; padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.prose h3 { font-size: 15px; color: var(--ink); margin: 18px 0 6px; }
.prose h3:first-child { margin-top: 4px; }
.prose b { color: var(--ink); }
.prose .jp { font-size: 1.06em; }
.prose table { width: 100%; border-collapse: collapse; margin: 6px 0 14px; font-size: 14.5px; }
.prose td, .prose th { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.prose td.jp { white-space: nowrap; font-size: 17px; color: var(--ink); }
.prose td { font-size: 15.5px; }
.prose table.grid4 td:nth-child(odd) { color: var(--muted); width: 1%; white-space: nowrap; }
.prose .muted { font-size: 13.5px; }
.examples { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.examples li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.examples .jp { font-size: 17px; }
.examples .muted { font-size: 13.5px; }
.g-cta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 28px 0 8px; }
.g-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; border-top: 1px solid var(--line); padding-top: 16px; }
.g-nav a { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); max-width: 48%; }
.g-nav a:hover { color: var(--ink); }
.g-nav svg { width: 18px; height: 18px; flex: none; }

/* Examen */
.exam { text-align: center; padding: 36px 28px; }
.exam h2 { margin: 12px 0 8px; letter-spacing: -.02em; }
.exam p { max-width: 460px; margin: 0 auto 16px; font-size: 15px; }
.exam-crown { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.exam-crown svg { width: 36px; height: 36px; }
.exam-crown.won { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }
.exam-crown.won svg { fill: color-mix(in srgb, var(--gold) 35%, transparent); }

/* Profil */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; }
.stat b { font-size: 22px; letter-spacing: -.02em; }
.stat b small { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat span { font-size: 12.5px; color: var(--muted); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 16px 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); opacity: .45; filter: grayscale(1); }
.badge.on { opacity: 1; filter: none; }
.badge b { font-size: 13.5px; margin-top: 8px; }
.badge small { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.badge-glyph { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-family: var(--jp-hand); font-size: 22px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.badge:not(.on) .badge-glyph { background: var(--surface-2); color: var(--muted); }
.settings { padding: 4px 20px; }
.setting-row, .toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.settings > :first-child { border-top: 0; }
.setting-row > div:first-child, .toggle > div { display: flex; flex-direction: column; }
.setting-row small, .toggle small { color: var(--muted); font-size: 12.5px; }
.seg { display: flex; background: var(--surface-2); padding: 3px; border-radius: 11px; flex: none; }
.seg button { padding: 6px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.row-btns { display: flex; gap: 8px; flex: none; }
.row-btns .btn, .settings .btn { height: 38px; padding: 0 14px; font-size: 14px; }
.toggle { cursor: pointer; }
.toggle input { display: none; }
.sw { width: 44px; height: 26px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s; }
.toggle input:checked + .sw { background: var(--good); }
.toggle input:checked + .sw::after { transform: translateX(18px); }

/* ═════ Session ═════ */
body.in-session { background: var(--surface); }
.session { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.s-top { display: flex; align-items: center; gap: 14px; padding: 14px max(16px, calc((100vw - 680px) / 2)); }
.s-bar { flex: 1; height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.s-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .4s cubic-bezier(.3, .7, .3, 1); }
.s-combo { min-width: 54px; display: flex; justify-content: flex-end; }
.combo-pill { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 14px; color: var(--accent); animation: pop .3s; }
.combo-pill svg { width: 17px; height: 17px; fill: var(--accent); }
.s-body { flex: 1; width: 100%; max-width: 680px; margin: 0 auto; padding: 16px 16px 40px; display: flex; flex-direction: column; animation: fadeUp .25s ease; }
.s-label { font-size: 13px; font-weight: 600; letter-spacing: .04em; color: var(--muted); margin: 8px 0 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.label-tag { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); letter-spacing: 0; }
.s-prompt { margin-bottom: 28px; }
.s-prompt .big { font-size: 38px; font-weight: 500; line-height: 1.25; display: block; }
.kanji-sub { display: block; font-size: 18px; color: var(--muted); margin-top: 4px; }
.gloss { color: var(--muted); font-size: 14.5px; margin-top: 6px; }
.fr-prompt { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.3; }
.fr-prompt.small { font-size: 21px; }
.sentence { font-size: 28px; line-height: 1.6; }
.blank { display: inline-block; width: 2.2em; border-bottom: 2.5px solid var(--accent); margin: 0 .12em; transform: translateY(-.15em); }
.num { font-size: 44px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.num.romaji { font-size: 52px; font-weight: 600; }
.kana-xl { font-family: var(--jp-hand); font-size: 108px; line-height: 1.1; }
.kanji-xl { font-family: var(--jp-hand); font-size: 120px; line-height: 1.1; }
.word-xl { font-family: var(--jp-hand); font-size: 64px; line-height: 1.2; }
.listen-btn { width: 96px; height: 96px; border-radius: 28px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 6px 0 color-mix(in srgb, var(--accent) 70%, #000); transition: transform .08s, box-shadow .08s; }
.listen-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 color-mix(in srgb, var(--accent) 70%, #000); }
.listen-btn svg { width: 44px; height: 44px; }

.choices { display: grid; grid-template-columns: 1fr; gap: 10px; }
.choices.four { grid-template-columns: 1fr 1fr; }
.choices.big { grid-template-columns: repeat(4, 1fr); }
.choice { position: relative; display: flex; align-items: center; gap: 12px; padding: 16px 16px; min-height: 60px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--line); border-bottom-width: 4px; text-align: left; font-size: 16px; line-height: 1.35; transition: border-color .12s, background .12s, transform .08s; }
.choice.jp { font-size: 19px; }
.choices.big .choice { justify-content: center; font-family: var(--jp-hand); font-size: 40px; padding: 18px 8px; min-height: 96px; }
.choices.big .choice kbd { position: absolute; top: 8px; left: 10px; }
.choice:hover:not(:disabled) { border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); background: var(--bg); }
.choice:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 2px; }
.choice kbd { flex: none; width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; color: var(--muted); font-weight: 600; }
.choice.right { border-color: var(--good); background: var(--good-soft); }
.choice.right kbd { border-color: var(--good); color: var(--good); }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .35s; }
.choice:disabled:not(.right):not(.wrong) { opacity: .5; }

.input-wrap { display: flex; flex-direction: column; gap: 8px; }
.answer-input { width: 100%; height: 64px; padding: 0 20px; border-radius: 16px; border: 1.5px solid var(--line); border-bottom-width: 4px; background: var(--bg); color: var(--ink); font-size: 24px; outline: none; transition: border-color .15s; }
.answer-input:not(.jp) { font-family: var(--font); }
.answer-input:focus { border-color: color-mix(in srgb, var(--ink) 40%, var(--line)); }
.answer-input:disabled { opacity: .85; }
.ime-hint { font-size: 12.5px; color: var(--muted); padding-left: 4px; }

.order-line { min-height: 62px; padding: 8px 0 10px; border-bottom: 2px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; margin-bottom: 20px; }
.order-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tile { padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--line); border-bottom-width: 4px; font-size: 18px; transition: transform .08s, opacity .15s; animation: pop .18s; }
.tile:active { transform: translateY(2px); }
.order-bank .tile.used { opacity: 0; pointer-events: none; }

.s-foot { position: sticky; bottom: 0; border-top: 1px solid var(--line); background: var(--surface); }
.foot-inner { max-width: 680px; margin: 0 auto; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.foot-inner .btn.primary { min-width: 150px; }
.hint { font-size: 12.5px; color: var(--muted); }
.fb { animation: slideUp .22s ease; }
.fb.good { background: var(--good-soft); }
.fb.bad { background: var(--bad-soft); }
.fb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.fb-title { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.fb-title svg { width: 24px; height: 24px; padding: 3px; border-radius: 50%; color: #fff; stroke-width: 2.6; }
.fb.good .fb-title { color: var(--good); }
.fb.good .fb-title svg { background: var(--good); }
.fb.bad .fb-title { color: var(--bad); }
.fb.bad .fb-title svg { background: var(--bad); }
.fb-answer { margin-top: 4px; font-size: 16px; }
.fb-answer .jp { font-size: 18px; font-weight: 500; }
.fb-note { margin-top: 4px; font-size: 13.5px; color: var(--ink-2); }
.fb-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.fb.good .btn.primary { background: var(--good); color: #fff; }
.fb.bad .btn.primary { background: var(--bad); color: #fff; }

.intro-card { text-align: center; padding: 28px 20px; border-radius: 22px; background: var(--bg); border: 1px solid var(--line); }
.intro-card .xl { font-size: 46px; font-weight: 500; line-height: 1.25; }
.intro-kanji { font-size: 22px; color: var(--muted); margin-top: 4px; }
.intro-fr { font-size: 22px; font-weight: 600; margin-top: 14px; letter-spacing: -.01em; }
.intro-ro { font-size: 34px; font-weight: 600; margin-top: 8px; }
.tags { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.speak-inline { margin: 16px auto 0; display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 12px; color: var(--ink-2); font-weight: 600; font-size: 14px; border: 1px solid var(--line); align-self: center; }
.speak-inline:hover { background: var(--surface-2); }
.speak-inline svg { width: 18px; height: 18px; }
.kana-intro .stroke-wrap { width: 200px; height: 200px; margin: 0 auto; }
.kanji-intro { display: flex; gap: 24px; text-align: left; align-items: center; }
.kanji-intro .stroke-wrap { width: 190px; height: 190px; flex: none; }
.kanji-info { flex: 1; min-width: 0; }
.kanji-info .intro-fr { margin-top: 0; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 12px 0; font-size: 15px; }
dt { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; }
dd { margin: 0; font-size: 16px; }
.ex-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.ex-list li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ex-list .jp { font-size: 17px; }
.ex-list .jp.muted { font-size: 14px; }

/* Ordre des traits */
.stroke-box { position: relative; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.stroke-box svg { width: 100%; height: 100%; }
.stroke-fallback { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--jp-hand); font-size: 120px; line-height: 1; }
.sk-grid line { stroke: var(--line); stroke-width: .5; stroke-dasharray: 2 2; }
.sk-bg path { fill: none; stroke: var(--surface-2); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.sk-fg path { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.sk-num { font-size: 7px; fill: var(--accent); font-family: var(--font); font-weight: 700; opacity: 0; }
.sk-replay { position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); background: var(--surface); border: 1px solid var(--line); }
.sk-replay svg { width: 16px; height: 16px; }
@keyframes sk-draw { to { stroke-dashoffset: 0; } }
@keyframes sk-fade { to { opacity: 1; } }

/* Résultats */
.result { text-align: center; padding-top: 24px; display: flex; flex-direction: column; align-items: center; }
.result-ring { position: relative; }
.result-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 1px; font-size: 34px; font-weight: 700; letter-spacing: -.03em; }
.result-pct small { font-size: 16px; color: var(--muted); }
.result h2 { margin: 18px 0 4px; font-size: 26px; letter-spacing: -.02em; }
.result p { max-width: 420px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 460px; margin: 20px 0 12px; }
.result-stats div { padding: 14px 8px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); display: flex; flex-direction: column; }
.result-stats b { font-size: 22px; letter-spacing: -.02em; }
.result-stats span { font-size: 12px; color: var(--muted); }
.result-msg { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 14px; background: var(--accent-soft); color: var(--ink); font-size: 14.5px; margin-top: 8px; animation: pop .35s; }
.result-msg svg { width: 18px; height: 18px; color: var(--accent); fill: var(--accent); }
.result-msg .badge-glyph { width: 30px; height: 30px; font-size: 15px; }

/* Fenêtre */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(20, 16, 12, .4); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .2s; }
.modal.show { opacity: 1; }
.modal-card { position: relative; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 24px; padding: 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .2); transform: translateY(12px); transition: transform .2s; }
.modal.show .modal-card { transform: none; }
.modal-x { position: absolute; top: 12px; right: 12px; }
.mi-v { text-align: center; padding: 8px 0; }
.mi-v .xl { font-size: 42px; font-weight: 500; }
.mi-foot { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 20px; flex-wrap: wrap; }
.mi-k { display: grid; grid-template-columns: 180px 1fr; gap: 24px; align-items: center; }
.mi-left .stroke-wrap { width: 180px; height: 180px; }
.mi-left .kana-xl { text-align: center; }
.mi-right .intro-fr { margin-top: 0; }
.mi-right .intro-ro { margin: 0 0 4px; }
.mi-right .btn { margin: 10px 0; height: 38px; font-size: 14px; }
.trace { grid-column: 1 / -1; }
.trace-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.trace-head b { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.trace-head b svg { width: 16px; height: 16px; }
.trace-pad { position: relative; height: 240px; border-radius: 18px; border: 1px dashed var(--line); background: var(--bg); overflow: hidden; touch-action: none; }
.trace-ghost { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--jp-hand); font-size: 190px; line-height: 1; color: var(--ink); opacity: .08; pointer-events: none; }
.trace-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 500; opacity: 0; transition: opacity .25s, transform .25s; z-index: 60; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { 0% { transform: scale(.85); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ── Mobile ── */
@media (max-width: 600px) {
  .hero { flex-direction: column; align-items: stretch; text-align: left; padding: 20px; gap: 16px; }
  .hero-goal { align-self: center; }
  .hero h1 { text-align: center; }
  .eyebrow { text-align: center; }
  .quick { grid-template-columns: 1fr; }
  .lessons { grid-template-columns: 1fr; }
  .lh-fr { font-size: 22px; }
  .lesson-head { gap: 14px; }
  .lc-badge.big svg { width: 60px; height: 60px; }
  .tabs a { font-size: 13.5px; padding: 9px 4px; }
  .prose { padding: 20px 18px; font-size: 16px; }
  .wrap { padding-left: 16px; padding-right: 16px; }
  .actions { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .action { padding: 12px; }
  .action small { font-size: 11.5px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .vlist li { grid-template-columns: auto 1fr auto; }
  .vlist .v-fr { grid-column: 2 / 4; grid-row: 2; margin-top: -6px; }
  .vlist .dots { grid-column: 3; grid-row: 1; }
  .kgrid.wide { grid-template-columns: repeat(3, 1fr); }
  .choices.four { grid-template-columns: 1fr; }
  .choices.big { grid-template-columns: 1fr 1fr; }
  .s-prompt .big { font-size: 32px; }
  .fr-prompt { font-size: 22px; }
  .sentence { font-size: 23px; }
  .kanji-intro { flex-direction: column; text-align: center; }
  .kanji-intro dl { justify-content: center; }
  .ex-list li { justify-content: center; }
  .mi-k { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .mi-k dl { text-align: left; }
  .foot-inner .btn.primary { min-width: 120px; }
  .fb .foot-inner { flex-direction: column; align-items: stretch; }
  .fb-actions { justify-content: flex-end; }
  .fb-actions .btn.primary { flex: 1; }
  .setting-row { flex-direction: column; align-items: flex-start; }
  .top-title { display: none; }
}
