:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #1f2433;
  --muted: #6b7183;
  --line: #e7e2d9;
  --brand: #2f4bd8;
  --brand-soft: #e8ecff;
  --accent: #e2574c;
  --good: #1f9d63;
  --good-soft: #e3f6ec;
  --bad: #d64545;
  --bad-soft: #fde8e8;
  --warn-soft: #fff4dc;
  --gold-soft: #fff8e6;
  --on-brand: #ffffff;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(31, 36, 51, 0.07);
  color-scheme: light;
}

/* Mode sombre : suit le téléphone, sauf si on a choisi avec le bouton 🌙 / ☀️ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161f;
    --surface: #1f2230;
    --ink: #eceef5;
    --muted: #9aa1b5;
    --line: #343a4d;
    --brand: #8a9dff;
    --brand-soft: #283161;
    --accent: #ff6f63;
    --good: #3ccf8e;
    --good-soft: #163527;
    --bad: #ff7f7f;
    --bad-soft: #3f2023;
    --warn-soft: #3a3019;
    --gold-soft: #352d18;
    --on-brand: #10142e;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14161f;
  --surface: #1f2230;
  --ink: #eceef5;
  --muted: #9aa1b5;
  --line: #343a4d;
  --brand: #8a9dff;
  --brand-soft: #283161;
  --accent: #ff6f63;
  --good: #3ccf8e;
  --good-soft: #163527;
  --bad: #ff7f7f;
  --bad-soft: #3f2023;
  --warn-soft: #3a3019;
  --gold-soft: #352d18;
  --on-brand: #10142e;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Nunito", "PingFang TC", "PingFang SC", "Microsoft JhengHei", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.45;
}

button { font: inherit; color: inherit; cursor: pointer; }
input, select { background: var(--surface); color: var(--ink); }

#app { max-width: 920px; margin: 0 auto; padding: 0 16px 48px; }

/* En-tête */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 0 12px;
}
header h1 { margin: 0; font-size: 1.7rem; font-weight: 800; }
header h1 span { color: var(--accent); }
header p { margin: 2px 0 0; color: var(--muted); }
header p small { display: block; }
.header-tools { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.stars { font-weight: 800; white-space: nowrap; }
.script-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}
.script-toggle button { border: 0; background: none; padding: 6px 12px; }
.script-toggle button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }
.theme-toggle {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  width: 36px;
  height: 34px;
  font-size: 1rem;
}

/* Onglets */
nav.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  position: sticky;
  top: 8px;
  z-index: 10;
  gap: 6px;
  margin: 8px 0 20px;
  background: var(--surface);
  padding: 6px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
nav.tabs button {
  border: 0;
  background: none;
  border-radius: 12px;
  padding: 8px 4px;
  font-weight: 600;
  line-height: 1.2;
}
nav.tabs button small { display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; }
nav.tabs button[aria-selected="true"] { background: var(--brand-soft); color: var(--brand); }
nav.tabs button[aria-selected="true"] small { color: var(--brand); }

/* Puces de catégories */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 14px;
}
.chip small { color: var(--muted); margin-left: 4px; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip[aria-pressed="true"] small { color: inherit; opacity: 0.75; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--muted);
}
.progress-wrap { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 200px; }
.progress { flex: 1; height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress div { height: 100%; background: var(--good); transition: width 0.3s; }
.toggle {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 14px;
}
.toggle[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }

.tip {
  background: var(--warn-soft);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.tip .zh { display: block; color: var(--muted); }

/* Cartes de vocabulaire */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.card { position: relative; perspective: 800px; cursor: pointer; }
.card-inner {
  position: relative;
  height: 130px;
  transition: transform 0.45s;
  transform-style: preserve-3d;
}
.card.flipped .card-inner { transform: rotateY(180deg); }
.face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px 12px 34px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  backface-visibility: hidden;
}
.face.back { transform: rotateY(180deg); background: var(--brand-soft); }
.card.known .face { border-color: var(--good); }
.face .fr { font-size: 1.15rem; font-weight: 800; }
.face .zh { font-size: 1.35rem; }
.card-actions {
  position: absolute;
  bottom: 6px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  z-index: 2;
}
.icon {
  border: 0;
  background: none;
  font-size: 1.1rem;
  width: 34px;
  height: 30px;
  border-radius: 8px;
}
.icon:hover { background: rgba(0, 0, 0, 0.06); }
.known-btn { color: var(--muted); font-weight: 800; }
.card.known .known-btn { color: var(--good); }

/* Phrases */
.phrases { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.phrase {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--surface);
  padding: 12px 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.phrase p { margin: 0; }
.phrase .fr { font-weight: 700; font-size: 1.05rem; }
.phrase .zh { color: var(--muted); }

/* Conjugaison */
.verb-title { margin: 0 0 12px; font-size: 1.4rem; }
.verb-title small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.conj {
  width: 100%;
  max-width: 420px;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.conj td { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.conj tr:last-child td { border-bottom: 0; }
.conj .pro { color: var(--muted); width: 40%; }
.conj .form { font-weight: 800; }
.conj .say { width: 44px; text-align: right; }

/* Quiz */
.modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 20px; }
.mode {
  text-align: left;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
}
.mode b { display: block; font-size: 1.05rem; }
.mode span { color: var(--muted); }
.mode[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
h3 { margin: 0 0 10px; }
h3 small { color: var(--muted); font-weight: 400; }

.btn {
  border: 0;
  background: var(--brand);
  color: var(--on-brand);
  border-radius: 12px;
  padding: 12px 22px;
  font-weight: 800;
}
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }

.quiz-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.quiz-head { display: flex; justify-content: space-between; color: var(--muted); margin-bottom: 8px; }
.question { font-size: 1.6rem; font-weight: 800; text-align: center; margin: 18px 0 22px; }
.question small { display: block; font-size: 0.95rem; color: var(--muted); font-weight: 400; }
.big-say { font-size: 2.4rem; width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--brand-soft); }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option {
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 14px;
  font-size: 1.05rem;
}
.option.right { border-color: var(--good); background: var(--good-soft); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.answer-row { display: flex; gap: 8px; }
.answer-row input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1.15rem;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
}
.answer-row input:focus { outline: none; border-color: var(--brand); }
.accents { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.accents button {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 8px;
  min-width: 36px;
  padding: 6px;
}
.feedback { margin-top: 16px; padding: 12px 14px; border-radius: 12px; }
.feedback.good { background: var(--good-soft); color: var(--good); }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }
.feedback.warn { background: var(--warn-soft); }
.quiz-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.result { text-align: center; padding: 20px 0; }
.result .score { font-size: 3rem; font-weight: 800; color: var(--brand); }

/* Motivation */
.pill {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font-weight: 800;
  white-space: nowrap;
}
.tab-icon { display: block; font-size: 1.25rem; }
.hint { color: var(--muted); margin: 0 0 14px; }
.hint small, .motivation small, .tip small, .hero-goal small, .result-msg small { display: block; }
.zh { color: var(--muted); }
.practice { display: flex; justify-content: center; margin-top: 22px; }

.hero {
  background: linear-gradient(135deg, #2f4bd8, #6a3fd0 60%, #e2574c);
  color: #fff;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(47, 75, 216, 0.25);
}
.hero .zh, .hero small { color: rgba(255, 255, 255, 0.78); }
.hero-level { display: flex; align-items: center; gap: 14px; }
.hero-level b { font-size: 1.35rem; }
.hero-level small { display: block; }
.lv-icon {
  font-size: 2rem;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 16px;
}
.xpbar { height: 12px; background: rgba(255, 255, 255, 0.25); border-radius: 999px; margin: 16px 0 8px; overflow: hidden; }
.xpbar div { height: 100%; background: #ffd34d; border-radius: 999px; transition: width 0.6s; }
.hero-next { margin: 0; }
.hero-goal { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.25); font-weight: 600; }

.motivation { text-align: center; margin: 18px 0 12px; font-weight: 600; }
.motivation small { color: var(--muted); font-weight: 400; }

.mission {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  border: 0;
  border-radius: 20px;
  padding: 18px 20px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 0 #b8423a;
  margin-bottom: 20px;
  transition: transform 0.1s, box-shadow 0.1s;
  animation: pulse 2.4s ease-in-out infinite;
}
.mission:active { transform: translateY(4px); box-shadow: 0 2px 0 #b8423a; }
.mission.done { background: var(--good); box-shadow: 0 6px 0 #167349; animation: none; }
.mission-icon {
  font-size: 1.5rem;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
}
.mission-text b { display: block; font-size: 1.3rem; }
.mission-text small { opacity: 0.9; }
@keyframes pulse { 50% { transform: scale(1.015); } }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.stat {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 8px;
  text-align: center;
}
.stat b { display: block; font-size: 0.9rem; margin-top: 6px; }
.stat > small { color: var(--muted); font-size: 0.8rem; }
.stat .big { font-size: 1.6rem; font-weight: 800; height: 64px; display: grid; place-items: center; }
.stat .big small { font-size: 0.9rem; color: var(--muted); }
.ring {
  --p: 0;
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--good) calc(var(--p) * 1%), var(--line) 0);
  display: grid;
  place-items: center;
}
.ring span {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--surface);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  line-height: 1;
}
.ring span small { font-size: 0.7rem; color: var(--muted); font-weight: 400; }

.wotd {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  margin-bottom: 24px;
  border-left: 5px solid #f2b134;
}
.wotd > small { color: var(--muted); }
.wotd > small small { display: inline; margin-left: 6px; }
.wotd-row { display: flex; justify-content: space-between; align-items: center; }
.wotd-row b { font-size: 1.4rem; margin-right: 10px; }
.wotd-row .zh { font-size: 1.15rem; }
.icon.big { font-size: 1.6rem; width: 50px; height: 50px; }

.ladder { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 20px; scroll-snap-type: x mandatory; }
.rung {
  flex: 0 0 112px;
  scroll-snap-align: start;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
}
.rung span { font-size: 1.6rem; display: block; }
.rung b { display: block; font-size: 0.85rem; line-height: 1.2; margin: 4px 0; }
.rung small { color: var(--muted); font-size: 0.75rem; }
.rung.passed { background: var(--good-soft); }
.rung.current { border-color: var(--brand); background: var(--brand-soft); }
.rung.locked { opacity: 0.55; }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 24px; }
.badge {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0.5;
  filter: grayscale(1);
}
.badge.got { opacity: 1; filter: none; background: var(--gold-soft); }
.badge span { font-size: 1.8rem; display: block; }
.badge b { display: block; font-size: 0.85rem; }
.badge small { color: var(--muted); font-size: 0.75rem; }

.voice-row { display: flex; gap: 8px; margin-bottom: 8px; }
.voice-row select {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.lock {
  max-width: 360px;
  margin: 12vh auto 0;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 28px 24px;
  text-align: center;
  display: grid;
  gap: 12px;
}
/* Chat de l'écran de connexion */
.cat-btn { border: 0; background: none; padding: 0; margin: -8px auto -4px; width: 150px; }
.cat { width: 100%; height: auto; display: block; overflow: visible; }
.cat-fur { fill: #f4a259; }
.cat-belly, .cat-paw { fill: #fde7cf; }
.cat-ear, .cat-nose { fill: #f7a1b0; }
.cat-cheek { fill: #f7a1b0; opacity: 0.55; }
.cat-stripe { stroke: #d9803a; stroke-width: 4; stroke-linecap: round; fill: none; }
.cat-eyes { fill: #2a2a35; }
.cat-shine { fill: #fff; }
.cat-line { stroke: #2a2a35; stroke-width: 2; stroke-linecap: round; fill: none; }
.cat-tail {
  fill: none;
  stroke: #f4a259;
  stroke-width: 13;
  stroke-linecap: round;
  transform-origin: 140px 168px;
  animation: tail 2.2s ease-in-out infinite;
}
.cat-eyes { transform-box: fill-box; transform-origin: center; animation: blink 4s infinite; }
.cat-heart { fill: var(--accent); opacity: 0; transform-box: fill-box; transform-origin: center; animation: heart 4s ease-out infinite 1s; }
.cat-btn.petted .cat { animation: hop 0.5s ease-out; }
.cat-btn.petted .cat-heart { animation: heart 1.2s ease-out; }
@keyframes tail { 50% { transform: rotate(-14deg); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
@keyframes heart {
  0% { opacity: 0; transform: translateY(10px) scale(0.6); }
  25% { opacity: 1; transform: translateY(0) scale(1); }
  70%, 100% { opacity: 0; transform: translateY(-26px) scale(1.1); }
}
@keyframes hop { 40% { transform: translateY(-14px) rotate(-3deg); } 70% { transform: translateY(2px); } }
@media (prefers-reduced-motion: reduce) {
  .cat-tail, .cat-eyes, .cat-heart { animation: none; }
}

/* Transition après le bon mot de passe */
.lock.unlocking { animation: lock-out 1.1s ease-in forwards; }
.lock.unlocking .cat { animation: hop 0.45s ease-out 2; }
.lock.unlocking .cat-heart { animation: heart 0.9s ease-out 2; }
.lock.unlocking input { border-color: var(--good); }
.lock.unlocking .btn { background: var(--good); color: var(--on-brand); }
@keyframes lock-out {
  0%, 55% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-24px) scale(0.94); }
}
#app.entering > * { animation: enter-up 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
#app.entering > nav { animation-delay: 0.08s; }
#app.entering > main { animation-delay: 0.16s; }
@keyframes enter-up {
  from { opacity: 0; transform: translateY(18px); }
}
.lock h1 { margin: 0; font-size: 1.6rem; }
.lock h1 span { color: var(--accent); }
.lock p { margin: 0; }
.lock p small { display: block; color: var(--muted); }
.lock input {
  font: inherit;
  font-size: 1.1rem;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  text-align: center;
}
.lock input:focus { outline: none; border-color: var(--brand); }
.lock-error { color: var(--bad); }
.lock-progress { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.lock-progress span {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 700;
  font-size: 0.9rem;
}
.combo { margin-left: 6px; font-weight: 800; color: var(--accent); }
.result-emoji { font-size: 3.5rem; }
.result-msg { font-size: 1.15rem; font-weight: 700; }
.result-msg small { color: var(--muted); font-weight: 400; font-size: 0.95rem; }
.result-xp { font-size: 1.3rem; font-weight: 800; color: #c98a00; }
.result-xp small { color: var(--muted); font-weight: 400; font-size: 0.9rem; }
.goal-mini { max-width: 320px; margin: 0 auto 10px; }
.goal-mini small { color: var(--muted); }
.quiz-foot.center { justify-content: center; }
.quiz-box > .progress { margin-bottom: 4px; }

.confetti {
  position: fixed;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  z-index: 100;
  pointer-events: none;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); }
}
.toasts {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 101;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  animation: pop 0.3s ease-out;
}
@keyframes pop { from { transform: translateY(20px) scale(0.9); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .mission { animation: none; }
}

/* ---------- Nouveautés : leçons, révision, entretien, micro, calendrier… ---------- */
.bz { font-size: 0.85em; opacity: 0.8; font-weight: 600; }
h4 { margin: 14px 0 6px; }
h4 small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.center { text-align: center; }
.link { border: 0; background: none; color: var(--brand); padding: 6px 0; font-weight: 700; }
.btn.small { padding: 8px 14px; font-size: 0.95rem; }

/* Genre des mots */
.g-m { color: #3b82f6; }
.g-f { color: #e0457b; }
:root[data-theme="dark"] .g-m { color: #7fb0ff; }
:root[data-theme="dark"] .g-f { color: #ff8db5; }
.legend { margin: 0; color: var(--muted); }
.legend small { display: block; }

/* Points de maîtrise ●●●○○ */
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--good); }

/* Prochaine leçon et liste des leçons */
.next-lesson {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  border: 2px solid var(--brand);
  background: var(--brand-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.nl-icon { font-size: 1.8rem; }
.nl-text { flex: 1; min-width: 0; }
.nl-text small { display: block; color: var(--muted); }
.nl-text small small { display: inline; margin-left: 6px; }
.nl-text .progress { display: block; margin-top: 8px; height: 6px; }
.nl-text .progress span { display: block; height: 100%; background: var(--good); }
.nl-go { font-size: 1.4rem; font-weight: 800; color: var(--brand); }
.lesson-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.lesson-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 2px solid transparent;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.lesson-row.current { border-color: var(--brand); }
.lesson-row.locked { opacity: 0.5; cursor: default; }
.lr-num {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 800;
}
.lr-text { flex: 1; min-width: 0; }
.lr-text small { display: block; color: var(--muted); }
.lr-text .progress { display: block; margin-top: 6px; height: 5px; }
.lr-text .progress span { display: block; height: 100%; background: var(--good); }
.lr-status { font-size: 1.2rem; }
.lesson-title { margin: 4px 0 14px; font-size: 1.4rem; }
.lesson-title small { display: block; font-size: 0.9rem; color: var(--muted); font-weight: 400; }
.lesson-title small small { display: inline; margin-left: 6px; }
.card-actions span:first-child { display: inline-flex; }
.card-actions { align-items: center; }

/* Phrases avec 🔊 🐢 🎙️ */
.phrase-btns { display: flex; flex-direction: column; flex-shrink: 0; }
.phrase-body { flex: 1; min-width: 0; }
.phrase-body .dots { margin-top: 6px; }
.icon.mic.listening { background: var(--bad-soft); animation: pulse 1s infinite; }
.mic-result {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--brand-soft);
  font-size: 0.95rem;
}
.mic-result small { display: block; color: var(--muted); }
.mic-result.good { background: var(--good-soft); }
.mic-result.warn { background: var(--warn-soft); }
.mic-result.bad { background: var(--bad-soft); }

/* Entretien */
.qa {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  overflow: hidden;
}
.qa summary {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary small { display: block; color: var(--muted); font-weight: 400; }
.qa[open] summary { border-bottom: 1px solid var(--line); }
.qa-num {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
}
.qa-body { padding: 4px 16px 16px; }
.qa-body .fr { font-weight: 600; margin: 0 0 4px; }
.qa-body .zh { margin: 0; }
.qa-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.qa-line .hint { margin: 0; }
textarea {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  resize: vertical;
}
textarea:focus { outline: none; border-color: var(--brand); }

/* Exercices */
.review-btn {
  width: 100%;
  border: 2px dashed var(--accent);
  background: none;
  border-radius: var(--radius);
  padding: 12px;
  font-weight: 700;
  margin: -8px 0 20px;
}
.q-say, .fb-say { display: inline-flex; vertical-align: middle; }
.big-say.slow { width: 60px; height: 60px; font-size: 1.6rem; margin-left: 8px; }
.feedback b small, .feedback small { display: inline; margin-left: 4px; }
.feedback .fr { font-size: 1em; }
.lesson-verdict { font-weight: 700; }
.lesson-verdict.good { color: var(--good); }
.lesson-verdict.bad { color: var(--accent); }
.lesson-verdict small { display: block; font-weight: 400; }
.recap { text-align: left; background: var(--bg); border-radius: var(--radius); padding: 12px 16px; margin: 16px 0 4px; }
.recap h4 { margin-top: 0; }
.recap ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.recap li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.recap li > span:last-child { display: inline-flex; flex-shrink: 0; }

/* Calendrier façon GitHub */
.calendar {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  max-width: 420px;
  margin-bottom: 6px;
}
.calendar i { aspect-ratio: 1; border-radius: 4px; background: var(--line); }
.calendar i.l1 { background: #8fd8b2; }
.calendar i.l2 { background: var(--good); }
.calendar i.future { background: transparent; }
.calendar i.today { outline: 2px solid var(--brand); outline-offset: 1px; }
.cal-legend { color: var(--muted); font-size: 0.85rem; display: flex; align-items: center; gap: 6px; margin: 0 0 20px; }
.cal-legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--line); display: inline-block; }
.cal-legend i.l1 { background: #8fd8b2; }
.cal-legend i.l2 { background: var(--good); }

/* Badges avec progression */
.next-badge { margin: -4px 0 12px; font-weight: 600; }
.next-badge small { display: block; font-weight: 400; color: var(--muted); }
.badge-bar { display: block; height: 4px; background: var(--line); border-radius: 999px; margin: 6px 4px 2px; overflow: hidden; }
.badge-bar span { display: block; height: 100%; background: var(--brand); }

/* Installer l'appli */
.install {
  background: var(--surface);
  border: 2px dashed var(--brand);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.install-head small { display: block; font-weight: 400; color: var(--muted); }
.install p { margin: 8px 0; }
.install p small { display: block; color: var(--muted); }

/* Petits mots de Sho */
.letters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.letter-chip { border: 1px solid var(--line); background: var(--gold-soft); border-radius: 999px; padding: 8px 14px; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 12, 20, 0.6);
  animation: fade-in 0.25s ease-out;
}
.modal-card {
  max-width: 380px;
  width: 100%;
  background: var(--surface);
  border-radius: 22px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  animation: pop 0.35s ease-out;
}
.modal-card h2 { margin: 4px 0; font-size: 1.3rem; }
.modal-card h2 small { display: block; font-size: 0.9rem; color: var(--muted); font-weight: 400; }
.letter-cat { width: 110px; margin: -10px auto 0; }
.letter-level { color: var(--muted); }
.letter-text { font-size: 1.1rem; line-height: 1.55; margin: 14px 0 6px; }
.letter-zh { color: var(--muted); margin: 0 0 18px; }
@keyframes fade-in { from { opacity: 0; } }

/* Chats */
.hero { position: relative; margin-top: 44px; }
.hero-cat {
  position: absolute;
  top: -46px;
  right: 14px;
  width: 78px;
  cursor: pointer;
}
.bubble {
  position: absolute;
  top: -14px;
  right: 70px;
  white-space: nowrap;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 14px 14px 2px 14px;
  box-shadow: var(--shadow);
  animation: pop 0.3s ease-out;
}
.cat-btn { position: relative; }
.cat-btn .bubble { top: 0; right: auto; left: 70%; border-radius: 14px 14px 14px 2px; }
.confetti.paw { background: none; width: auto; height: auto; font-size: 18px; }

@media (max-width: 560px) {
  .header-tools { width: 100%; }
  .header-tools .script-toggle { margin-left: auto; }
  header { flex-direction: column; align-items: flex-start; padding-top: 16px; }
  header h1 { font-size: 1.4rem; }
  nav.tabs { gap: 2px; padding: 4px; }
  nav.tabs button { font-size: 0.8rem; padding: 6px 2px; }
  nav.tabs button small { font-size: 0.78rem; }
  .stat b { font-size: 0.8rem; }
  .stat > small { font-size: 0.82rem; }
  .mission-text b { font-size: 1.15rem; }
  .cards { grid-template-columns: 1fr 1fr; }
  .options { grid-template-columns: 1fr; }
  .question { font-size: 1.35rem; }
  .hero { margin-top: 40px; }
  .hero-cat { width: 66px; top: -40px; }
}
