/* Polices embarquées (licence SIL OFL, voir fonts/) */
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/fraunces-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/fraunces-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }

/* Thème « carnet de voyage » : nuit sarcelle, crème, or.
   --theme change selon la langue ou la leçon (fond, reflets, lueurs). */
:root {
  --theme: #e3b35a;
  --bg: #0e1a20;
  --surface: #16292f;
  --surface-2: #1d363e;
  --surface-3: #27464f;
  --border: rgb(255 255 255 / 8%);
  --text: #f1ece1;
  --muted: #a3b4b6;
  --faint: #6c868b;
  --wave: #2f5a60;
  --gold: #f4c76b;
  --gold-deep: #d79a3a;
  --on-gold: #241706;
  --good: #9fd68b;
  --bad: #f08c6c;
  --hard: #e9c75e;
  --easy: #86bfe3;
  --radius: 20px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --script: "Noto Sans Devanagari", "Kohinoor Devanagari", "Noto Naskh Arabic", "Geeza Pro", "Damascus", var(--sans);
  --theme-12: color-mix(in srgb, var(--theme) 12%, transparent);
  --theme-25: color-mix(in srgb, var(--theme) 25%, transparent);
  --theme-50: color-mix(in srgb, var(--theme) 50%, transparent);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background: transparent;
  color: var(--text);
  font: 17px/1.5 var(--sans);
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(86px + env(safe-area-inset-bottom));
}

/* Fond d'ambiance : deux halos discrets à la couleur du thème. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(110% 60% at 50% -12%, var(--theme-25), transparent 62%),
    radial-gradient(70% 45% at 110% 105%, var(--theme-12), transparent 70%),
    radial-gradient(60% 40% at -15% 60%, rgb(255 255 255 / 3%), transparent 70%),
    var(--bg);
  transition: background 0.6s ease;
}

a { color: var(--gold); }
.container { max-width: 660px; margin: 0 auto; padding: 0 18px 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.center { text-align: center; justify-content: center; }
.gold { color: var(--gold); }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
kbd { font: 0.66rem ui-monospace, monospace; opacity: 0.5; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; }
@media (hover: none) { kbd { display: none; } }
[lang="ne"], [lang="ar"] { font-family: var(--script); }
[dir="rtl"] { unicode-bidi: isolate; }

.ico { width: 1.25em; height: 1.25em; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.flag-svg { display: block; width: 100%; height: auto; border-radius: 4px; }

/* Lueurs : réservées à ce qui compte vraiment. */
.glow { text-shadow: 0 0 22px var(--theme-50), 0 0 2px color-mix(in srgb, var(--theme) 30%, transparent); }
.glow-gold { color: var(--gold); text-shadow: 0 0 26px rgb(244 199 107 / 55%), 0 0 3px rgb(244 199 107 / 40%); }

/* ---------- Panneaux « verre » avec liseré lumineux ---------- */
.glass {
  position: relative;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 5.5%), rgb(255 255 255 / 1.5%)),
    color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 7%), 0 10px 30px rgb(0 0 0 / 22%);
}
/* Liseré : lumière rasante sur l'arête haut-gauche, à la couleur du thème. */
.glass::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--rim, var(--theme)) 75%, transparent) 0%,
    color-mix(in srgb, var(--rim, var(--theme)) 12%, transparent) 30%,
    transparent 55%,
    rgb(255 255 255 / 10%) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
a.glass, .deck.glass { transition: transform 0.18s ease, box-shadow 0.18s ease; }
a.glass:hover, .deck.glass:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 9%), 0 14px 36px rgb(0 0 0 / 30%), 0 0 30px color-mix(in srgb, var(--rim, var(--theme)) 18%, transparent);
}

/* Pastille d'icône lumineuse */
.orb {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 40px; height: 40px; border-radius: 14px;
  color: var(--hue, var(--theme));
  background: radial-gradient(120% 120% at 30% 20%, color-mix(in srgb, var(--hue, var(--theme)) 30%, transparent), color-mix(in srgb, var(--hue, var(--theme)) 8%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hue, var(--theme)) 35%, transparent), 0 0 18px color-mix(in srgb, var(--hue, var(--theme)) 22%, transparent);
}
.orb .ico { width: 22px; height: 22px; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--hue, var(--theme)) 60%, transparent)); }
.orb.big { width: 50px; height: 50px; border-radius: 16px; }
.orb.big .ico { width: 26px; height: 26px; }

/* ---------- Bandeau : drapeaux et thèmes au-dessus de la vague ---------- */
.banner { position: relative; height: 150px; margin: 0 -18px; overflow: hidden; pointer-events: none; }
.banner.compact { height: 92px; }
.banner .wave { position: absolute; left: 0; bottom: 16px; width: 100%; height: 40px; }
.banner .wave path { fill: none; stroke: color-mix(in srgb, var(--theme) 45%, var(--wave)); stroke-width: 2; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 6px var(--theme-50)); }
.floaty {
  position: absolute; display: block; transform: rotate(var(--r));
  animation: bob 7s ease-in-out infinite alternate;
}
.floaty.is-flag { filter: drop-shadow(0 4px 10px rgb(0 0 0 / 40%)); }
.floaty .orb { width: 100%; height: auto; aspect-ratio: 1; border-radius: 30%; }
.floaty .orb .ico { width: 58%; height: 58%; }
@keyframes bob { to { transform: translateY(-7px) rotate(calc(var(--r) * -0.4)); } }

/* ---------- En-têtes ---------- */
.page-head { margin: 2px 0 24px; }
.eyebrow { display: flex; align-items: center; gap: 12px; color: var(--muted); letter-spacing: 0.06em; font-size: 0.98rem; margin-bottom: 6px; }
.eyebrow .ring {
  width: 40px; height: 40px; border: 2px solid var(--gold); border-radius: 50%;
  display: grid; place-items: center; color: var(--gold); overflow: hidden;
  box-shadow: 0 0 16px rgb(244 199 107 / 30%);
}
.eyebrow .ring .ico { width: 20px; height: 20px; }
.eyebrow .ring .flag-svg { width: 26px; border-radius: 3px; }
h1 { font-family: var(--serif); font-weight: 700; font-size: clamp(2.3rem, 10vw, 3rem); line-height: 1.06; letter-spacing: -0.01em; margin: 0; }
h1, h2, h3, strong { text-wrap: balance; }
.lede { color: var(--muted); font-size: 1.1rem; margin: 10px 0 0; }
.lede b { color: var(--text); }
.saved { display: flex; align-items: center; gap: 10px; color: var(--good); margin: 16px 0 0; }
.back { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; color: var(--muted); padding: 4px 0; margin-bottom: 10px; }
.back:hover { color: var(--gold); }
.section-title { font: 500 0.98rem/1.3 var(--sans); color: var(--muted); margin: 30px 0 12px; letter-spacing: 0.02em; }
.level-title { display: flex; align-items: center; gap: 10px; }
.level {
  font: 700 0.8rem var(--sans); color: var(--on-gold); background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  padding: 3px 9px; border-radius: 8px; box-shadow: 0 0 14px rgb(244 199 107 / 35%);
}
.kicker { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.74rem; color: var(--gold); font-weight: 500; }
.notice { display: flex; gap: 12px; align-items: flex-start; background: var(--theme-12); border: 1px solid var(--theme-25); border-radius: 16px; padding: 12px 14px; margin: 0 0 16px; font-size: 0.92rem; color: var(--text); }
.notice .ico { color: var(--theme); margin-top: 2px; }

/* ---------- Accueil ---------- */
.hero { display: flex; align-items: center; gap: 16px; padding: 18px; color: inherit; text-decoration: none; margin-bottom: 8px; }
.hero-body { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 2px; }
.hero-body strong { font-family: var(--serif); font-size: 1.4rem; }
.hero-go { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(180deg, var(--gold), var(--gold-deep)); color: var(--on-gold); box-shadow: 0 0 22px rgb(244 199 107 / 45%); }
.lang-list { display: grid; gap: 12px; }
.lang-card { display: flex; align-items: center; gap: 14px; padding: 16px; color: inherit; text-decoration: none; }
.lang-flag { width: 46px; flex-shrink: 0; filter: drop-shadow(0 3px 8px rgb(0 0 0 / 35%)); }
.lang-flag.sm { width: 28px; display: inline-block; vertical-align: middle; }
.lang-info { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 1px; }
.lang-info strong { font-family: var(--serif); font-size: 1.22rem; }
.lang-info [dir="rtl"] { align-self: flex-start; }
.badges { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.badge { font-size: 0.78rem; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.due { background: rgb(244 199 107 / 15%); color: var(--gold); box-shadow: 0 0 12px rgb(244 199 107 / 20%); }
.method-link { display: flex; align-items: center; gap: 14px; padding: 16px; margin-top: 22px; color: inherit; text-decoration: none; }
.method-link > .ico { color: var(--muted); }

/* ---------- Page langue ---------- */
.cta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px;
  border-radius: var(--radius); text-decoration: none; color: var(--on-gold);
  background: linear-gradient(180deg, #f8d489, var(--gold) 45%, var(--gold-deep));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 50%), 0 10px 30px rgb(215 154 58 / 30%), 0 0 40px rgb(244 199 107 / 22%);
}
.cta strong { display: block; font-family: var(--serif); font-size: 1.35rem; }
.cta .ico { width: 28px; height: 28px; stroke-width: 2.2; }
.cta.idle { background: var(--surface); color: var(--text); box-shadow: none; border: 1px solid var(--border); }
.cta.idle .ico { color: var(--gold); }
.quick-row { display: flex; gap: 10px; margin-top: 12px; }
.chip-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 16px; color: var(--text); text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.chip-btn .ico { color: var(--theme); }

.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }
.deck { display: flex; flex-direction: column; gap: 6px; padding: 16px 14px 12px; min-width: 0; }
.deck-hit { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
.deck-hit .orb { margin-bottom: 6px; }
.deck strong { font-family: var(--serif); font-size: 1.1rem; line-height: 1.2; }
.deck .desc { color: var(--muted); font-size: 0.84rem; line-height: 1.35; }
.deck .meta { color: var(--muted); font-size: 0.8rem; }
.deck .due-text { color: var(--gold); font-weight: 500; }
.deck-links { display: flex; gap: 12px; align-items: center; font-size: 0.82rem; margin-top: 2px; }
.deck-links a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.deck-links a:hover { color: var(--gold); }
.deck-links .ico { width: 15px; height: 15px; }
.progress { display: block; height: 5px; background: rgb(255 255 255 / 7%); border-radius: 99px; overflow: hidden; margin: 6px 0 2px; }
.progress > span { display: block; height: 100%; border-radius: 99px; transition: width 0.4s ease; background: linear-gradient(90deg, color-mix(in srgb, var(--hue, var(--theme)) 70%, #fff 0%), var(--hue, var(--theme))); box-shadow: 0 0 10px color-mix(in srgb, var(--hue, var(--theme)) 60%, transparent); }
.progress.wide { flex: 1; margin: 0; height: 7px; }
.progress.wide > span { background: linear-gradient(90deg, var(--gold-deep), var(--gold)); box-shadow: 0 0 12px rgb(244 199 107 / 60%); }

button.link { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
button.link:hover { color: var(--gold); }
.center-link { display: flex; margin: 0 auto 10px; }

/* ---------- Formulaires ---------- */
.import { margin-top: 28px; padding: 16px 18px; }
.import summary { cursor: pointer; font-weight: 500; display: flex; align-items: center; gap: 10px; list-style: none; }
.import summary::-webkit-details-marker { display: none; }
.import summary .ico { color: var(--gold); }
.import form { display: grid; gap: 16px; margin-top: 12px; }
.import label { display: grid; gap: 8px; color: var(--muted); }
input, textarea, select {
  font: inherit; color: var(--text); background: rgb(0 0 0 / 22%); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px; width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus { border-color: var(--theme); outline: none; box-shadow: 0 0 0 3px var(--theme-25); }
button:focus-visible, a:focus-visible, .bar-col:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 500 1rem var(--sans); padding: 13px 20px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); text-decoration: none;
}
.btn.primary {
  background: linear-gradient(180deg, #f8d489, var(--gold) 45%, var(--gold-deep)); color: var(--on-gold); border-color: transparent;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 50%), 0 6px 20px rgb(215 154 58 / 28%);
}
.btn.danger { color: var(--bad); }
.btn.full { width: 100%; padding: 17px; font-size: 1.05rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.icon-btn { display: inline-grid; place-items: center; background: rgb(255 255 255 / 6%); border: 0; border-radius: 50%; width: 44px; height: 44px; cursor: pointer; color: var(--theme); flex-shrink: 0; }
.icon-btn:hover { background: var(--theme-25); }
.icon-btn.small { width: 30px; height: 30px; vertical-align: middle; }
.icon-btn.small .ico { width: 15px; height: 15px; }
.icon-btn.ghost { color: var(--muted); background: transparent; }

/* ---------- Séance ---------- */
.session-head { display: flex; align-items: center; gap: 12px; padding-top: 8px; }
.counter { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.kind-chip { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 8px; color: var(--theme); font-weight: 500; margin: 0 0 12px; font-size: 0.95rem; text-align: center; }
.kind-chip > span { white-space: nowrap; }
.form-note { margin: 10px 0 0; }
.kind-chip .sep { color: var(--faint); }
.kind-chip .muted { font-weight: 400; }
.exercise { padding: 28px 20px 22px; text-align: center; margin-bottom: 16px; transition: box-shadow 0.3s ease; }
.exercise.is-ok { box-shadow: inset 0 1px 0 rgb(255 255 255 / 7%), 0 0 0 1px rgb(159 214 139 / 35%), 0 0 40px rgb(159 214 139 / 18%); }
.exercise.is-ko { box-shadow: inset 0 1px 0 rgb(255 255 255 / 7%), 0 0 0 1px rgb(240 140 108 / 35%), 0 0 40px rgb(240 140 108 / 14%); }
.prompt { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.term { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.term-text { font-family: var(--serif); font-size: clamp(1.8rem, 8vw, 2.5rem); font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.term-text[lang="ne"], .term-text[lang="ar"] { font-family: var(--script); font-weight: 600; }
.term.small .term-text { font-size: 1.5rem; color: var(--theme); }
.prompt-fr { font-family: var(--serif); font-size: clamp(1.5rem, 7vw, 2.1rem); font-weight: 700; line-height: 1.2; }
.translit { color: var(--muted); font-style: italic; font-size: 0.95rem; }
.fr { font-size: 1.1rem; margin-top: 6px; }
.big-fr { font-family: var(--serif); font-size: 1.35rem; color: var(--gold); margin: 10px 0 4px; }
.new-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold); margin-bottom: 14px; }
.new-badge .ico { width: 14px; height: 14px; fill: var(--gold); }

.example { margin: 16px auto 0; max-width: 34em; }
.example p { margin: 0; }
.example p:first-child { font-size: 1.02rem; }
.example .translit { margin-top: 2px; }
.example-fr { color: var(--muted); font-size: 0.92rem; margin-top: 4px !important; }
mark { background: none; color: var(--theme); font-weight: 500; text-shadow: 0 0 14px var(--theme-50); }
.note { display: flex; gap: 8px; align-items: flex-start; text-align: left; background: rgb(255 255 255 / 4%); border-radius: 12px; padding: 10px 12px; margin: 14px 0 0; font-size: 0.9rem; }
.note .ico { color: var(--gold); width: 18px; height: 18px; margin-top: 1px; }

.result { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); animation: rise 0.25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.verdict { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; border-radius: 12px; padding: 7px 14px; margin: 0 0 14px; }
.verdict.ok { color: var(--good); background: rgb(159 214 139 / 12%); }
.verdict.ko { color: var(--bad); background: rgb(240 140 108 / 12%); }

.cloze .sentence { font-size: 1.3rem; line-height: 1.5; margin: 0; }
.blank {
  display: inline-block; min-width: 3.2em; margin: 0 4px; padding: 0 8px; border-radius: 8px;
  color: var(--theme); background: var(--theme-12); border-bottom: 2px solid var(--theme); text-align: center;
}
.listen .play {
  width: 96px; height: 96px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  color: var(--on-gold); background: radial-gradient(circle at 35% 30%, #fbe0a4, var(--gold) 50%, var(--gold-deep));
  box-shadow: 0 0 0 8px rgb(244 199 107 / 12%), 0 0 40px rgb(244 199 107 / 40%);
}
.listen .play .ico { width: 42px; height: 42px; stroke-width: 2; }

.choices { display: grid; gap: 10px; margin-top: 22px; text-align: left; }
.choice {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; width: 100%; padding: 14px 16px; cursor: pointer;
  font: 500 1.02rem var(--sans); color: var(--text); text-align: left;
  background: rgb(255 255 255 / 4%); border: 1px solid var(--border); border-radius: 16px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.2s;
}
.choice:hover:not([disabled]) { border-color: var(--theme-50); background: var(--theme-12); }
.choice span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.choice span[dir="rtl"] { text-align: right; }
.choice small { width: 100%; padding-left: 30px; }
.choice[disabled] { cursor: default; opacity: 0.55; }
.choice.right { opacity: 1; border-color: var(--good); background: rgb(159 214 139 / 12%); box-shadow: 0 0 22px rgb(159 214 139 / 22%); }
.choice.wrong { opacity: 1; border-color: var(--bad); background: rgb(240 140 108 / 12%); }

.type-form { display: flex; gap: 8px; width: 100%; margin-top: 20px; }
.type-form input { font-size: 1.12rem; text-align: center; }
.type-form .btn { padding: 0 18px; }
.hint { color: var(--muted); font-size: 0.92rem; margin: 10px 0 0; }
.hint b { color: var(--gold); }
#hint { margin-top: 10px; }

.controls { display: grid; gap: 4px; }
body.in-session { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
body.in-session .tabbar { display: none; }
body.in-session .controls {
  position: sticky; bottom: 0; z-index: 5; margin: 0 -18px; padding: 14px 18px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgb(14 26 32 / 92%) 30%);
}
body.in-session .controls:empty { display: none; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grade {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 4px;
  font: 500 0.9rem var(--sans); border-radius: 16px; cursor: pointer;
  background: rgb(255 255 255 / 4%); border: 1px solid var(--border); color: var(--text);
}
.grade small { color: var(--muted); font-size: 0.74rem; }
.grade.g0 span { color: var(--bad); }
.grade.g1 span { color: var(--hard); }
.grade.g2 span { color: var(--good); }
.grade.g3 span { color: var(--easy); }
.grade:hover { background: rgb(255 255 255 / 8%); }

.score { font-family: var(--serif); font-size: 5rem; font-weight: 700; line-height: 1; margin: 6px 0 4px !important; }
.score small { font-size: 2rem; }

/* ---------- Liste de mots ---------- */
.word-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.word-list li { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; }
.word-top { display: flex; align-items: center; gap: 10px; }
.word-top strong { font-family: var(--serif); font-size: 1.2rem; color: var(--theme); }
.word-top strong[lang="ne"], .word-top strong[lang="ar"] { font-family: var(--script); }
.word-top .chip { margin-left: auto; }
.word-fr { font-size: 1rem; }
.word-list .example { margin: 8px 0 0; text-align: left; }
.word-list .example p:first-child { font-size: 0.95rem; }
.word-list .note { margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 0.74rem; padding: 3px 10px; border-radius: 99px; background: rgb(255 255 255 / 6%); color: var(--muted); white-space: nowrap; }
.chip .ico { width: 13px; height: 13px; }
.chip.maitrise { background: rgb(159 214 139 / 13%); color: var(--good); }
.chip.en-cours { background: rgb(244 199 107 / 13%); color: var(--gold); }

/* ---------- Écrans vides / fin ---------- */
.empty { text-align: center; padding: 0 8px 30px; display: grid; gap: 10px; justify-items: center; }
.empty p { margin: 0; max-width: 40ch; }
.empty .btn-row { margin-top: 16px; }

/* ---------- Statistiques ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { padding: 16px; display: flex; flex-direction: column; }
.tile-value { font-family: var(--serif); font-size: 2.1rem; font-weight: 700; line-height: 1.1; }
.tile-value small { font-size: 1.1rem; }
.tile-label { color: var(--muted); font-size: 0.86rem; }

.chart { margin: 0; padding: 18px 14px 12px; }
.bars { display: flex; align-items: stretch; gap: 2px; height: 150px; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; cursor: default; }
.bar { width: 70%; max-width: 22px; min-height: 2px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--gold), var(--gold-deep)); box-shadow: 0 0 12px rgb(244 199 107 / 30%); }
.forecast .bar { background: linear-gradient(180deg, #a9d4f0, var(--easy)); box-shadow: 0 0 12px rgb(134 191 227 / 30%); }
.bar-val { font-size: 0.68rem; color: var(--muted); height: 1.2em; font-variant-numeric: tabular-nums; }
.bar-col:hover .bar, .bar-col:focus .bar { filter: brightness(1.15); }
.bar-label { font-size: 0.7rem; color: var(--muted); margin-top: 4px; height: 1.2em; }
.bar-col[data-tip]:hover::after, .bar-col[data-tip]:focus::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-size: 0.75rem; padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 2;
}
.bar-col:first-child[data-tip]::after { left: 0; transform: none; }
.bar-col:last-child[data-tip]::after { left: auto; right: 0; transform: none; }
.chart figcaption { margin-top: 10px; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 0.82rem; color: var(--muted); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
/* Étapes ordonnées : une seule teinte, du plus clair (maîtrisé) au plus sombre (pas vu). */
.maitrise.sw, .seg.maitrise { background: #f4c76b; }
.jeune.sw, .seg.jeune { background: #b98a3e; }
.apprentissage.sw, .seg.apprentissage { background: #7a5a2a; }
.neuf.sw, .seg.neuf { background: #33434a; }
.stage-list { display: grid; gap: 10px; margin-bottom: 14px; }
.stage-row { padding: 12px 14px; }
.stage-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.stage-head .muted { margin-left: auto; }
.stack { display: flex; gap: 2px; height: 12px; border-radius: 4px; overflow: hidden; }
.seg { display: block; min-width: 2px; }

.stats-table { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; font-size: 0.86rem; }
.stats-table th, .stats-table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.stats-table th { color: var(--muted); font-weight: 500; font-size: 0.76rem; }
.stats-table td:not(:first-child), .stats-table th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.stats-table tr:last-child td { border-bottom: 0; }

/* ---------- Méthode ---------- */
.principles { display: grid; gap: 12px; }
.principle { display: flex; gap: 14px; padding: 16px; align-items: flex-start; }
.principle h3 { font-family: var(--serif); font-size: 1.15rem; margin: 0 0 4px; }
.principle p { margin: 0; color: var(--muted); font-size: 0.94rem; }
.principles + .notice { margin-top: 18px; }
.sources { list-style: none; margin: 0; padding: 6px 16px; font-size: 0.86rem; color: var(--muted); }
.sources li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.sources li:last-child { border-bottom: 0; }

/* ---------- Réglages ---------- */
.settings { display: grid; gap: 18px; padding: 18px; }
.settings fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.settings legend { color: var(--muted); margin-bottom: 8px; }
.settings .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.settings .row input[type="number"] { width: 90px; text-align: center; }
.settings input[type="radio"], .settings input[type="checkbox"] { width: auto; accent-color: var(--gold); transform: scale(1.25); }
.voices { list-style: none; margin: 0; padding: 6px 14px; }
.voices li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.voices li:last-child { border-bottom: 0; }
.voices .chip { margin-left: auto; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.about { margin-top: 34px; text-align: center; }

/* ---------- Barre d'onglets « verre liquide » ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + env(safe-area-inset-bottom));
  width: min(calc(100% - 48px), 360px); display: flex; gap: 2px; padding: 4px; border-radius: 26px; z-index: 10;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 16%), rgb(255 255 255 / 4%) 55%, rgb(255 255 255 / 7%)),
    rgb(20 38 45 / 45%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgb(255 255 255 / 16%);
  box-shadow:
    inset 0 1px 1px rgb(255 255 255 / 40%),
    inset 0 -1px 1px rgb(255 255 255 / 8%),
    inset 0 -10px 20px rgb(0 0 0 / 12%),
    0 14px 40px rgb(0 0 0 / 45%);
  overflow: hidden;
}
/* Reflet spéculaire en haut, comme une goutte de verre. */
.tabbar::before {
  content: ""; position: absolute; left: 8%; right: 8%; top: 1px; height: 45%;
  border-radius: 24px 24px 50% 50% / 24px 24px 10px 10px;
  background: linear-gradient(180deg, rgb(255 255 255 / 18%), rgb(255 255 255 / 0%));
  pointer-events: none;
}
.tabbar a {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: 0.66rem; color: rgb(241 236 225 / 72%); text-decoration: none; padding: 5px 2px 4px; border-radius: 22px;
  transition: color 0.2s, background 0.2s, box-shadow 0.2s;
}
.tabbar a .ico { width: 20px; height: 20px; stroke-width: 1.8; }
.tabbar a:hover { color: var(--text); }
.tabbar a.active {
  color: var(--gold); font-weight: 500;
  background: radial-gradient(120% 140% at 50% 0%, rgb(244 199 107 / 30%), rgb(244 199 107 / 8%) 70%);
  box-shadow: inset 0 0 0 1px rgb(244 199 107 / 45%), inset 0 1px 0 rgb(255 240 200 / 35%), 0 0 24px rgb(244 199 107 / 35%);
  text-shadow: 0 0 12px rgb(244 199 107 / 70%);
}
.tabbar a.active .ico { filter: drop-shadow(0 0 6px rgb(244 199 107 / 85%)); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tabbar { background: rgb(22 41 47 / 96%); }
}

.toast {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 0.9rem;
  z-index: 20; max-width: calc(100% - 32px); animation: pop 0.2s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Alphabet, phrases, oral ---------- */
.tag { align-self: flex-start; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); background: rgb(244 199 107 / 12%); border-radius: 6px; padding: 2px 7px; }
.level.alt { display: inline-grid; place-items: center; padding: 3px 7px; }
.level.alt .ico { width: 15px; height: 15px; stroke-width: 2.2; }

.term.is-letter .term-text { font-size: clamp(4rem, 22vw, 6rem); line-height: 1.1; }
.term.small.is-letter .term-text { font-size: 2.6rem; }
.term.is-sentence .term-text { font-size: clamp(1.35rem, 6vw, 1.8rem); }
.choice .letter { font-size: 2rem; line-height: 1.1; }

.tips { padding: 14px 16px 6px; margin: 0 0 16px; }
.tips h2 { display: flex; align-items: center; gap: 8px; font: 600 1.05rem var(--serif); margin: 0 0 6px; color: var(--gold); }
.tips ul, .tips-mini ul { margin: 0; padding-left: 18px; color: var(--text); font-size: 0.92rem; }
.tips li, .tips-mini li { margin: 0 0 8px; }
.tips-mini { text-align: left; margin-top: 14px; background: rgb(244 199 107 / 7%); border: 1px solid rgb(244 199 107 / 20%); border-radius: 12px; padding: 10px 12px; }
.tips-mini summary { cursor: pointer; color: var(--gold); display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 0.92rem; }
.tips-mini ul { margin-top: 10px; }

.order-answer {
  min-height: 58px; margin: 22px 0 14px; padding: 8px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  border-radius: 14px; border: 1px dashed var(--theme-50); background: var(--theme-12);
}
.order-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tile {
  font: 500 1.05rem var(--sans); color: var(--text); cursor: pointer; padding: 9px 14px; border-radius: 12px;
  background: rgb(255 255 255 / 7%); border: 1px solid var(--border); box-shadow: 0 2px 0 rgb(0 0 0 / 25%);
}
.tile[lang="ne"], .order-bank[lang="ne"] .tile, .order-bank[lang="ar"] .tile, .order-answer[lang="ne"] .tile, .order-answer[lang="ar"] .tile { font-family: var(--script); font-size: 1.15rem; }
.tile:hover:not([disabled]) { border-color: var(--theme-50); }
.order-bank .tile[disabled] { opacity: 0.25; cursor: default; box-shadow: none; }
.tile.placed { background: var(--theme-25); border-color: var(--theme-50); }
.order-answer.locked .tile { cursor: default; }

.speak-ex .fr { color: var(--gold); }
.mic {
  width: 84px; height: 84px; margin: 10px auto 0; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  color: var(--on-gold); background: radial-gradient(circle at 35% 30%, #fbe0a4, var(--gold) 50%, var(--gold-deep));
  box-shadow: 0 0 0 8px rgb(244 199 107 / 12%), 0 0 30px rgb(244 199 107 / 35%);
}
.mic .ico { width: 36px; height: 36px; stroke-width: 2; }
.mic.listening { animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { box-shadow: 0 0 0 16px rgb(244 199 107 / 18%), 0 0 44px rgb(244 199 107 / 55%); } }
.heard { margin: 10px 0 0; color: var(--muted); }
.heard.ok { color: var(--good); }
.heard.ko { color: var(--bad); }
.self-eval { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- Dialogues ---------- */
.dialogue-list { display: grid; gap: 10px; }
.dialogue-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; color: inherit; text-decoration: none; }
.dialogue-card strong { font-family: var(--serif); font-size: 1.1rem; }
.dialogue { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.bubble {
  max-width: 86%; padding: 10px 14px; border-radius: 18px; position: relative;
  background: rgb(255 255 255 / 5%); border: 1px solid var(--border); transition: box-shadow 0.25s, border-color 0.25s;
}
.bubble.left { align-self: flex-start; border-bottom-left-radius: 6px; }
.bubble.right { align-self: flex-end; border-bottom-right-radius: 6px; background: var(--theme-12); border-color: var(--theme-25); }
.bubble .who { font-size: 0.74rem; color: var(--theme); font-weight: 500; letter-spacing: 0.04em; }
.bubble .line { margin: 2px 0 0; font-size: 1.05rem; }
.bubble .line[lang="ne"], .bubble .line[lang="ar"] { font-size: 1.2rem; }
.bubble .translit { margin: 2px 0 0; font-size: 0.86rem; }
.bubble .line-fr { display: none; margin: 6px 0 0; color: var(--muted); font-size: 0.9rem; }
.dialogue.show-fr .line-fr { display: block; }
.bubble.speaking { border-color: var(--gold); box-shadow: 0 0 22px rgb(244 199 107 / 30%); }
button.chip-btn { font: 500 0.95rem var(--sans); cursor: pointer; }
button.chip-btn[aria-pressed="true"] { color: var(--gold); box-shadow: inset 0 0 0 1px rgb(244 199 107 / 45%); }
.dia-q { padding: 16px; }
.dia-q .q { font-family: var(--serif); font-size: 1.2rem; margin: 4px 0 0; }
.dia-q .choices { margin-top: 14px; }
.dia-score { padding: 18px; text-align: center; display: grid; justify-items: center; gap: 6px; }
.dia-score p { margin: 0; }
.settings .row.switch small { display: block; font-size: 0.8rem; margin-top: 2px; }

/* ---------- Parcours ---------- */
.path-card { padding: 16px; margin: 14px 0 0; display: grid; gap: 10px; }
.path-card-head { display: flex; justify-content: space-between; align-items: baseline; }
.path-card .progress > span { background: linear-gradient(90deg, var(--gold-deep), var(--gold)); box-shadow: 0 0 12px rgb(244 199 107 / 55%); }
.path-next { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; padding: 10px; margin: 0 -4px; border-radius: 16px; background: rgb(255 255 255 / 4%); }
.path-next:hover { background: rgb(255 255 255 / 7%); }
.path-next strong { font-family: var(--serif); font-size: 1.15rem; }
.path-next .hero-go { width: 40px; height: 40px; }
.path-all { justify-self: end; display: inline-flex; align-items: center; gap: 4px; font-size: 0.88rem; color: var(--muted); text-decoration: none; }
.path-all:hover { color: var(--gold); }
.path-all .ico { width: 16px; height: 16px; }

.unit { margin: 26px 0 8px; }
.unit-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.unit-title { display: flex; flex-direction: column; flex: 1; line-height: 1.25; }
.unit-title strong { font-family: var(--serif); font-size: 1.2rem; }
.unit-quiz { margin: 6px auto 0; max-width: 260px; }

/* Sentier : les étapes serpentent de part et d'autre d'un fil central. */
.trail { list-style: none; margin: 0; padding: 8px 0; position: relative; display: grid; gap: 6px; }
.trail::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; transform: translateX(-50%);
  background: repeating-linear-gradient(180deg, var(--wave) 0 6px, transparent 6px 12px);
}
.stop { position: relative; display: flex; }
.stop.left { justify-content: flex-start; padding-right: 50%; }
.stop.right { justify-content: flex-end; padding-left: 50%; }
.stop-link { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; padding: 6px; border-radius: 18px; width: 100%; }
.stop.right .stop-link { flex-direction: row-reverse; text-align: right; }
.stop-link:hover { background: rgb(255 255 255 / 4%); }
.stop-node { position: relative; width: 58px; height: 58px; flex-shrink: 0; display: grid; place-items: center; }
.ring-progress {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--hue) calc(var(--p) * 1%), rgb(255 255 255 / 8%) 0);
  -webkit-mask: radial-gradient(circle, transparent 24px, #000 25px);
  mask: radial-gradient(circle, transparent 24px, #000 25px);
}
.stop-node .orb { width: 44px; height: 44px; border-radius: 50%; --hue: var(--hue); }
.stop-text { display: flex; flex-direction: column; min-width: 0; }
.stop-text strong { font-family: var(--serif); font-size: 1rem; line-height: 1.2; }
.stop.todo .stop-node .orb { filter: grayscale(0.6); opacity: 0.6; }
.stop.todo .stop-text { opacity: 0.7; }
.stop.done .stop-node .orb { background: radial-gradient(circle at 35% 30%, #fbe0a4, var(--gold) 55%, var(--gold-deep)); color: var(--on-gold); box-shadow: 0 0 16px rgb(244 199 107 / 40%); }
.stop.done .stop-node .orb .ico { filter: none; stroke-width: 2.4; }
.stop.done .ring-progress { background: var(--gold); }
.stop.current .stop-node { animation: glowpulse 2.2s ease-in-out infinite alternate; border-radius: 50%; }
@keyframes glowpulse { from { box-shadow: 0 0 0 0 rgb(244 199 107 / 0%); } to { box-shadow: 0 0 0 6px rgb(244 199 107 / 12%), 0 0 26px rgb(244 199 107 / 45%); } }
.go-badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 0.8rem; font-weight: 500; color: var(--on-gold); background: linear-gradient(180deg, #f8d489, var(--gold-deep)); border-radius: 99px; padding: 3px 10px; }
.stop.right .go-badge { align-self: flex-end; }
.go-badge .ico { width: 14px; height: 14px; }

.step-done { padding: 16px; margin-top: 12px; display: grid; gap: 8px; justify-items: center; width: 100%; max-width: 420px; }
.step-done strong { font-family: var(--serif); font-size: 1.2rem; }
.step-done .kicker { display: inline-flex; align-items: center; gap: 6px; }
.step-done .progress { width: 100%; }

/* ---------- Ajouter un mot ---------- */
.add-word { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-top: 12px; color: inherit; text-decoration: none; }
.add-word > .ico { color: var(--muted); }
.add-word strong { font-family: var(--serif); font-size: 1.12rem; }
.add-form { display: grid; gap: 14px; padding: 16px; margin-bottom: 14px; }
.add-form label { display: grid; gap: 6px; color: var(--muted); font-size: 0.92rem; }
.add-form input { font-size: 1.08rem; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: rgb(0 0 0 / 22%); border: 1px solid var(--border); }
.segmented button { font: 500 0.95rem var(--sans); color: var(--muted); background: none; border: 0; border-radius: 10px; padding: 9px 6px; cursor: pointer; }
.segmented button[aria-checked="true"] { color: var(--on-gold); background: linear-gradient(180deg, #f8d489, var(--gold-deep)); box-shadow: 0 0 14px rgb(244 199 107 / 30%); }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.suggest .chip-btn { flex: 0 1 auto; padding: 8px 12px; }
.chip-btn.picked { color: var(--gold); box-shadow: inset 0 0 0 1px rgb(244 199 107 / 55%); }
.online { display: grid; gap: 4px; }
.online .chip-btn { justify-self: start; }
.online p { margin: 0; }
.found { display: grid; gap: 4px; padding: 14px 16px; margin-bottom: 10px; }
.found .word-top strong { font-family: var(--serif); font-size: 1.2rem; color: var(--gold); }
.found .btn { justify-self: start; margin-top: 8px; }
#add-result .verdict { margin-bottom: 8px; }
.verdict:not(.ok):not(.ko) { color: var(--gold); background: rgb(244 199 107 / 10%); }
