:root {
  --bg: #fbf7f2; --card: #ffffff; --text: #1f1a17; --muted: #756c66; --line: #ece4dc;
  --primary: #e8544f; --primary-ink: #ffffff; --accent: #1f9e8c; --warn: #e0a100; --danger: #d33a3a; --info: #3a7bd5;
  --ok-bg: #e4f6ec; --ok-ink: #17703f; --ko-bg: #fde9e7; --ko-ink: #a8231f;
  --radius: 18px; --shadow: 0 2px 10px rgba(40, 20, 10, .06);
  --nav-h: 64px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #141114; --card: #211c20; --text: #f3ece7; --muted: #a79d97; --line: #332b31;
  --ok-bg: #163b28; --ok-ink: #8fe0b0; --ko-bg: #4a1f1d; --ko-ink: #ffb3ae; --shadow: 0 2px 12px rgba(0,0,0,.35);
} }
:root[data-theme="dark"] {
  --bg: #141114; --card: #211c20; --text: #f3ece7; --muted: #a79d97; --line: #332b31;
  --ok-bg: #163b28; --ok-ink: #8fe0b0; --ko-bg: #4a1f1d; --ko-ink: #ffb3ae; --shadow: 0 2px 12px rgba(0,0,0,.35);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans Thai", "Sarabun", "Noto Sans", sans-serif;
  line-height: 1.45; overscroll-behavior-y: contain; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
.page { max-width: 640px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
.page.no-nav { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

/* --- barre de navigation --- */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,.82); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); display: flex; justify-content: space-around; z-index: 20; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bottom-nav { background: rgba(33,28,32,.82); } }
:root[data-theme="dark"] .bottom-nav { background: rgba(33,28,32,.82); }
.bottom-nav svg { width: 24px; height: 24px; }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .72rem; color: var(--muted); }
.bottom-nav a .ico { display: grid; place-items: center; height: 26px; transition: transform .15s; }
.bottom-nav a.active .ico { transform: translateY(-2px); }
.bottom-nav a.active { color: var(--primary); font-weight: 600; }

/* --- entêtes --- */
.topbar { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 8px; margin-bottom: 12px; position: sticky; top: 0; background: var(--bg); padding: 6px 0; z-index: 5; }
.topbar h1 { font-size: 1.15rem; text-align: center; }
.back { font-size: 2rem; line-height: 1; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; }
.back:active { background: var(--line); }
.home-head { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 16px; }
.home-head h1 { font-size: 1.6rem; }
.eyebrow { color: var(--muted); font-size: .85rem; }
.avatar { min-width: 56px; height: 56px; padding: 0 10px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 1.3rem; line-height: 1; gap: 2px; }
.avatar small { font-size: .6rem; color: var(--muted); }
.howto { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 14px; border-left: 4px solid var(--accent); }
.howto h2 { font-size: 1rem; margin-bottom: 6px; }
.howto ol { margin: 0; padding-left: 20px; }
.howto li { margin: 6px 0; font-size: .92rem; }

/* --- cartes & stats --- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 8px; text-align: center; }
.stat b { display: block; font-size: 1.5rem; }
.stat span { font-size: .72rem; color: var(--muted); }
.card { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card .emoji { font-size: 1.8rem; }
.card > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.card small { color: var(--muted); font-size: .78rem; }
.card .chev { font-size: 1.6rem; color: var(--muted); }
.card.continue { background: linear-gradient(135deg, var(--primary), #f28a5a); color: #fff; }
.card.continue small, .card.continue .chev { color: rgba(255,255,255,.85); }
.card.review-banner.muted { opacity: .75; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 0 6px; }
.section-title h2 { font-size: 1.1rem; }
.progress-text { color: var(--muted); font-size: .8rem; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }

/* --- liste des leçons --- */
.lesson-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.lesson-row { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.lesson-row .num { width: 26px; height: 26px; border-radius: 50%; background: var(--line); font-size: .78rem; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.lesson-row.passed .num { background: var(--accent); color: #fff; }
.lesson-row .emoji { font-size: 1.5rem; }
.lesson-row .txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lesson-row .txt small { color: var(--muted); font-size: .75rem; }
.lesson-row.locked { opacity: .55; }
.stars { color: var(--warn); letter-spacing: 1px; }
.stars .dim { color: var(--line); }
.badge { font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--line); }
.badge.warn { background: #fff1c9; color: #7a5a00; }

/* --- boutons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 600; cursor: pointer; background: var(--line); transition: transform .08s, filter .1s; min-height: 48px; text-align: center; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.success { background: var(--accent); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.warn { background: var(--warn); color: #fff; }
.btn.info { background: var(--info); color: #fff; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.danger-outline { background: transparent; border: 1.5px solid var(--danger); color: var(--danger); }
.btn.small { padding: 8px 14px; min-height: 38px; font-size: .9rem; }
.btn.wide { width: 100%; }
.btn.disabled, .btn:disabled { opacity: .45; pointer-events: none; }
.btn small { display: block; font-weight: 400; font-size: .7rem; opacity: .85; width: 100%; }
.btn-icon { border: 0; background: var(--line); width: 40px; height: 40px; border-radius: 50%; font-size: 1.15rem; cursor: pointer; display: inline-grid; place-items: center; flex-shrink: 0; }
.btn-icon:active { transform: scale(.92); }
.btn-icon svg { width: 21px; height: 21px; }
.btn-icon.big svg { width: 28px; height: 28px; }
.btn-icon.huge svg { width: 46px; height: 46px; }
.btn-icon.slow { color: var(--accent); }
.btn-icon.big { width: 56px; height: 56px; font-size: 1.6rem; }
.btn-icon.huge { width: 96px; height: 96px; font-size: 3rem; background: var(--primary); color: #fff; box-shadow: 0 6px 20px rgba(232,84,79,.35); }
.row { display: flex; gap: 10px; margin: 14px 0; }
.row > * { flex: 1; }
.row.center { justify-content: center; }
.row.center > * { flex: 0 0 auto; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.center { text-align: center; color: var(--muted); }
.center-box { text-align: center; padding: 28px 8px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.center-box p { margin: 0; }
.big-emoji { font-size: 3.5rem; line-height: 1; }
.notice { background: #fff4d6; color: #6b4d00; border-radius: 12px; padding: 12px 14px; font-size: .9rem; margin: 8px 0 12px; line-height: 1.4; }
@media (prefers-color-scheme: dark) { .notice { background: #3f3116; color: #ffd98a; } }
.hint { color: var(--muted); font-size: .85rem; }
.intro { color: var(--muted); margin: 0 0 12px; }

/* --- onglets --- */
.tabs { display: flex; background: var(--line); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 9px 4px; border-radius: 9px; font-weight: 600; font-size: .9rem; color: var(--muted); cursor: pointer; }
.tabs button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* --- vocabulaire --- */
.vocab { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.vocab-row { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 12px; }
.vocab-row .vt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.vocab-row .va { display: flex; gap: 6px; }
.target { font-size: 1.35rem; font-weight: 600; line-height: 1.35; }
.roman { color: var(--accent); font-size: .9rem; font-style: italic; }
.meaning { color: var(--muted); }
.ex { font-size: .85rem; color: var(--muted); margin-top: 4px; border-left: 3px solid var(--line); padding-left: 8px; }
.grammar { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.grammar h4 { margin: 18px 0 6px; font-size: 1.05rem; color: var(--primary); }
.grammar h4:first-child { margin-top: 0; }
.grammar p { margin: 6px 0; }
.grammar ul { margin: 6px 0; padding-left: 20px; }
.grammar li { margin: 4px 0; }
.test-box { margin-top: 22px; padding: 14px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; }
.test-stat { color: var(--muted); font-size: .85rem; margin-bottom: 10px; }

/* --- cartes flash --- */
.practice-count { text-align: center; color: var(--muted); font-size: .85rem; margin: 6px 0 10px; }
.flashcard { position: relative; min-height: 240px; perspective: 1000px; cursor: pointer; }
.flashcard .front, .flashcard .back { position: absolute; inset: 0; background: var(--card); border-radius: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 20px; text-align: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .45s; }
.flashcard .front .target { font-size: 2rem; }
.flashcard .front small { position: absolute; bottom: 12px; color: var(--muted); font-size: .75rem; }
.flashcard .back { transform: rotateY(180deg); }
.flashcard .back .meaning { font-size: 1.4rem; color: var(--text); font-weight: 600; }
.flashcard.flipped .front { transform: rotateY(180deg); }
.flashcard.flipped .back { transform: rotateY(360deg); }
.flashcard.static { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; cursor: default; }
.flashcard.static .target { font-size: 2rem; }
.flashcard.static .meaning { font-size: 1.2rem; }
.flashcard.static .meaning.solo { font-size: 1.6rem; color: var(--text); font-weight: 600; }
.grade-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.grade-row .btn { flex-direction: column; padding: 10px 4px; gap: 0; font-size: .85rem; }

/* --- quiz --- */
.quiz-top { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; }
.quiz-top .progress { flex: 1; }
.quiz-top .qcount { color: var(--muted); font-size: .85rem; min-width: 40px; text-align: right; }
.qtitle { font-size: 1.05rem; color: var(--muted); font-weight: 600; margin-bottom: 14px; }
.prompt { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.prompt-target { display: flex; flex-direction: column; }
.prompt .target { font-size: 1.7rem; }
.meaning-big { font-size: 1.35rem; font-weight: 600; }
.listen-prompt { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px 0 22px; }
.listen-prompt small { color: var(--muted); }
.options { display: flex; flex-direction: column; gap: 10px; }
.option { border: 2px solid var(--line); background: var(--card); border-radius: 14px; padding: 14px; font-size: 1.05rem; text-align: left; cursor: pointer; display: flex; flex-direction: column; min-height: 52px; justify-content: center; }
.option small { color: var(--accent); font-style: italic; font-size: .8rem; }
.option:active { border-color: var(--primary); }
.option.sel { border-color: var(--primary); background: #fff0ef; }
@media (prefers-color-scheme: dark) { .option.sel { background: #3a2321; } }
.option.ok { border-color: var(--accent); background: var(--ok-bg); color: var(--ok-ink); }
.option.ko { border-color: var(--danger); background: var(--ko-bg); color: var(--ko-ink); }
.option.small { padding: 10px; font-size: .95rem; min-height: 56px; }
.type-form input, .search { width: 100%; font: inherit; font-size: 1.15rem; padding: 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); color: var(--text); outline: none; }
.type-form input:focus, .search:focus { border-color: var(--primary); }
.build-answer { min-height: 64px; border-bottom: 2px dashed var(--line); display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 12px; margin-bottom: 14px; align-items: center; }
.build-answer .placeholder { color: var(--muted); }
.build-answer.ok .tile { background: var(--ok-bg); color: var(--ok-ink); }
.build-answer.ko .tile { background: var(--ko-bg); color: var(--ko-ink); }
.build-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tile { border: 0; background: var(--card); box-shadow: var(--shadow); border-radius: 12px; padding: 10px 14px; font-size: 1.1rem; cursor: pointer; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match .col { display: flex; flex-direction: column; gap: 10px; }
.match.shake { animation: shake .3s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.feedback { position: fixed; left: 0; right: 0; bottom: 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; box-shadow: 0 -4px 24px rgba(0,0,0,.12); z-index: 30; animation: up .25s; }
.feedback.ok { background: var(--ok-bg); color: var(--ok-ink); }
.feedback.ko { background: var(--ko-bg); color: var(--ko-ink); }
.feedback strong { display: block; font-size: 1.15rem; margin-bottom: 6px; }
.feedback .fb-answer { margin-bottom: 12px; display: flex; flex-direction: column; }
.feedback .fb-answer .target { font-size: 1.3rem; color: inherit; }
.feedback .fb-answer .meaning, .feedback .fb-answer .roman { color: inherit; opacity: .85; }
.feedback .btn-icon { background: rgba(255,255,255,.6); margin-top: 6px; }
@media (prefers-color-scheme: dark) { .feedback .btn-icon { background: rgba(255,255,255,.15); } }
@keyframes up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.page:has(.feedback) { padding-bottom: 260px; }

/* --- résultats --- */
.result { text-align: center; padding: 24px 12px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.result h1 { font-size: 3rem; margin: 6px 0; }
.result.pass h1 { color: var(--accent); }
.result.fail h1 { color: var(--primary); }
.result .score-line { color: var(--muted); }
.result p { margin: 10px 0; }
.result .xp { display: inline-block; background: #fff1c9; color: #7a5a00; padding: 4px 12px; border-radius: 99px; font-weight: 700; }
h3 { margin: 12px 0 6px; font-size: 1rem; }

/* --- dictionnaire --- */
.dict-count { color: var(--muted); font-size: .8rem; margin: 8px 2px; }
.dict-lesson { margin: 16px 0 4px; font-size: .95rem; color: var(--primary); }

/* --- réglages --- */
.settings-group { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; }
.settings-group h3 { margin: 0 0 2px; }
.settings-group select { font: inherit; padding: 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); color: var(--text); max-width: 100%; }
.range-row, .switch-row, .select-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.range-row { flex-direction: column; align-items: stretch; gap: 4px; }
.range-row input { width: 100%; accent-color: var(--primary); }
.switch-row input { width: 22px; height: 22px; accent-color: var(--primary); }
.settings-group .row { margin: 0; }
.about p { margin: 0; color: var(--muted); font-size: .9rem; }

/* --- profil --- */
.profile-page { display: flex; flex-direction: column; gap: 14px; min-height: 100vh; justify-content: center; }
.hero { text-align: center; margin-bottom: 12px; }
.hero .logo { font-size: 4rem; }
.hero h1 { font-size: 2rem; }
.hero p { color: var(--muted); margin: 4px 0 0; }
.profile-page h2 { font-size: 1rem; color: var(--muted); text-align: center; }
.profile-card { display: flex; align-items: center; gap: 16px; background: var(--card); border: 2px solid var(--line); border-radius: 20px; padding: 18px; text-align: left; cursor: pointer; box-shadow: var(--shadow); }
.profile-card:active { border-color: var(--primary); }
.profile-card .flag { font-size: 1.6rem; white-space: nowrap; }
.profile-card > span:nth-child(2) { display: flex; flex-direction: column; }
.profile-card strong { font-size: 1.1rem; }
.profile-card small { color: var(--muted); }

/* --- toast / mise à jour --- */
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 600; opacity: 0; transition: .25s; z-index: 50; pointer-events: none; white-space: nowrap; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.update-bar { position: fixed; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); background: var(--card); box-shadow: 0 4px 20px rgba(0,0,0,.2); border-radius: 14px; padding: 10px 14px; display: flex; gap: 12px; align-items: center; z-index: 60; }

/* --- pictogrammes --- */
.pic { font-size: 1.9rem; line-height: 1; width: 44px; text-align: center; flex-shrink: 0; }
.pic.big { font-size: 3.2rem; margin-bottom: 6px; width: auto; }
.prompt .pic { font-size: 2.4rem; width: auto; margin-right: 10px; }
.prompt-target { flex-direction: row; align-items: center; gap: 10px; flex: 1; }
.prompt-target .pic { width: auto; }
.prompt-target > .target ~ .roman { margin-left: 0; }
.prompt-target { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "pic target" "pic roman"; column-gap: 12px; }
.prompt-target .pic { grid-area: pic; }
.prompt-target .target { grid-area: target; }
.prompt-target .roman { grid-area: roman; }
.btn-icon.add { background: transparent; border: 1.5px dashed var(--line); color: var(--muted); font-size: 1.3rem; }
.in-srs { width: 40px; height: 40px; display: inline-grid; place-items: center; color: var(--accent); font-weight: 700; }
.dict-section { font-size: 1rem; margin: 22px 0 4px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.dict-lesson small { margin-left: 8px; color: var(--muted); font-weight: 400; }

/* --- ateliers --- */
.workshops { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 8px 0 4px; }
.workshop { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 8px; text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.workshop .emoji { font-size: 1.8rem; }
.workshop strong { font-size: .85rem; }
.workshop small { color: var(--muted); font-size: .72rem; }
.tabs.five button { font-size: .8rem; padding: 9px 2px; }
/* dialogue */
.dialogue { display: flex; flex-direction: column; gap: 10px; }
.line { display: flex; gap: 10px; align-items: flex-start; }
.line .who { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; color: #fff; background: var(--accent); margin-top: 4px; }
.line.b .who { background: var(--primary); }
.line .bubble { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 10px 12px; flex: 1; display: flex; flex-direction: column; }
.line.b .bubble { background: #fff0ef; }
@media (prefers-color-scheme: dark) { .line.b .bubble { background: #3a2321; } }
.line .bubble .target { font-size: 1.15rem; }
.line .bubble .meaning { font-size: .9rem; }
.line .bubble .meaning.hidden { display: none; }
.line .va { display: flex; flex-direction: column; gap: 6px; }
/* parler */
.speak-box { text-align: center; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 14px; margin-bottom: 14px; }
.speak-box .target { font-size: 1.8rem; display: block; }
.mic { width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; font-size: 2.4rem; box-shadow: 0 6px 20px rgba(232,84,79,.35); margin: 14px auto; display: grid; place-items: center; cursor: pointer; }
.mic.listening { animation: pulse 1s infinite; background: var(--danger); }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.heard { font-size: 1rem; color: var(--muted); margin-top: 6px; }
.meter { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px auto; max-width: 260px; }
.meter > div { height: 100%; border-radius: 99px; background: var(--accent); }
.meter.ko > div { background: var(--danger); }
.btn-icon.rec { background: transparent; border: 1.5px dashed var(--line); font-size: 1rem; }
.btn-icon.rec.has { border-style: solid; border-color: var(--accent); }
.btn-icon.rec.on { background: var(--danger); color: #fff; border-color: var(--danger); animation: pulse 1s infinite; }
/* alphabet */
.letters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.letter { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 6px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; border: 0; font: inherit; color: inherit; }
.letter .glyph { font-size: 2.2rem; line-height: 1.2; }
.letter .name { font-size: .85rem; }
.letter small { color: var(--muted); font-size: .72rem; }
.letter .cls { font-size: .65rem; padding: 1px 6px; border-radius: 99px; background: var(--line); }
.cls.M { background: #dbeafe; color: #1e3a8a; } .cls.H { background: #fee2e2; color: #7f1d1d; } .cls.L { background: #dcfce7; color: #14532d; }
.step-list { display: flex; flex-direction: column; gap: 8px; }
.gap-sentence { font-size: 1.4rem; font-weight: 600; line-height: 1.5; }
.gap-sentence .blank { display: inline-block; min-width: 3ch; border-bottom: 3px solid var(--primary); margin: 0 4px; }
.gap-sentence .blank.filled { border-bottom-color: var(--accent); color: var(--accent); }
.drill-row { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px; margin-bottom: 8px; cursor: pointer; }
.drill-row .answer { color: var(--accent); font-weight: 700; }
.drill-row .note { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.tone-badge { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--line); font-size: .8rem; margin-left: 6px; }
.small-note { color: var(--muted); font-size: .85rem; margin: 6px 0; }

/* --- objectif, mot du jour, statistiques --- */
.goal { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.goal .goal-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .9rem; }
.goal .goal-head b { font-size: 1rem; }
.goal.done .progress > div { background: var(--warn); }
.wod { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 12px; display: flex; align-items: center; gap: 12px; border-left: 4px solid var(--warn); }
.wod .vt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.wod .label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 140px; padding: 10px 4px 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.chart .bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.chart .bar > div { width: 70%; background: var(--accent); border-radius: 6px 6px 0 0; min-height: 3px; transition: height .3s; }
.chart .bar.today > div { background: var(--primary); }
.chart .bar small { font-size: .65rem; color: var(--muted); }
.chart .bar b { font-size: .7rem; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0; }
.stat-grid .stat b { font-size: 1.3rem; }
.numpad { width: 100%; font: inherit; font-size: 1.6rem; text-align: center; padding: 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); color: var(--text); letter-spacing: 2px; }
.numpad:focus { border-color: var(--primary); outline: none; }
.digits { font-size: 2.6rem; font-weight: 700; letter-spacing: 1px; }
.stats-link { text-decoration: none; }

/* --- polish --- */
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page { animation: fadein .2s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: scale(1); } }
.option.ok { animation: pop .3s ease; }
.option:active { transform: scale(.985); }
.lesson-row .emoji { width: 42px; height: 42px; border-radius: 12px; background: var(--bg); display: grid; place-items: center; font-size: 1.35rem; }
.card, .lesson-row, .workshop, .stat { transition: transform .12s, box-shadow .12s; }
.card:active, .lesson-row:active, .workshop:active { transform: scale(.985); }
.greet { color: var(--muted); font-size: .95rem; margin-bottom: 2px; }
.howto { position: relative; }
.howto .btn { align-self: flex-end; margin-top: 8px; }
.install-card { display: flex; align-items: center; gap: 10px; background: linear-gradient(135deg, #1f9e8c, #2bb3a3); color: #fff; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-size: .9rem; }
.install-card a { flex: 1; color: #fff; }
.install-card button { background: rgba(255,255,255,.25); border: 0; color: #fff; width: 30px; height: 30px; border-radius: 50%; font-size: 1rem; cursor: pointer; }
.wod.love { border-left-color: var(--primary); }
.challenge { background: linear-gradient(135deg, #3a7bd5, #6a5ae0); color: #fff; }
.challenge small, .challenge .chev { color: rgba(255,255,255,.85); }
.challenge.done { background: var(--card); color: var(--text); }
.challenge.done small, .challenge.done .chev { color: var(--muted); }
.confetti { position: fixed; top: -10px; width: 10px; height: 14px; border-radius: 2px; z-index: 100; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .2; } }
.role-line { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 12px 0; text-align: center; border: 2px solid var(--accent); }
.role-line .label { color: var(--accent); font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.role-line .meaning-big { display: block; margin: 8px 0; }
.name-form { display: flex; flex-direction: column; gap: 12px; }
.name-form input { font: inherit; font-size: 1.2rem; padding: 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); color: var(--text); text-align: center; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.vocab-row .src { color: var(--muted); font-size: .72rem; margin-top: 2px; }
.name-form h3 { margin: 0; }
