:root {
  --bg: #fdf8f0;
  --card: #ffffff;
  --ink: #2b2d42;
  --muted: #7a7d94;
  --primary: #5b5bd6;
  --primary-dark: #4343b8;
  --good: #2fa56b;
  --good-bg: #e6f7ee;
  --bad: #e0524b;
  --bad-bg: #fdecea;
  --line: #ece6db;
  --warn: #b7791f;
  --warn-bg: #fdf3dc;
  --gold: #f2b01e;
  --gold-dark: #c98d0c;
  --radius: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Nunito", system-ui, -apple-system, sans-serif;
  font-size: 18px;
}

a { color: inherit; }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

header.top .logo {
  font-weight: 900;
  font-size: 22px;
  text-decoration: none;
}

header.top .logo span { color: var(--primary); }

.back {
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 16px;
}

h1 { font-size: 30px; margin: 0 0 6px; font-weight: 900; }
.subtitle { color: var(--muted); margin: 0 0 28px; }

/* ---------- Accueil ---------- */
.section-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 800;
  margin: 28px 0 12px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.tile {
  display: block;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  transition: transform .12s, border-color .12s;
}

.tile:hover { transform: translateY(-2px); border-color: var(--primary); }
.tile .emoji { font-size: 32px; }
.tile .name { font-weight: 800; margin-top: 8px; }
.tile .desc { color: var(--muted); font-size: 15px; margin-top: 2px; }

.tile.soon { opacity: .5; pointer-events: none; }
.tile.soon .desc::after { content: " · bientôt"; }

/* ---------- Réglages ---------- */
.settings {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.settings .label { font-weight: 800; margin: 0 0 10px; }
.settings .group + .label { margin-top: 20px; }

.group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
}

.chip[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn {
  display: inline-block;
  border: 0;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 20px;
  padding: 14px 28px;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--primary-dark);
  transition: transform .06s, box-shadow .06s;
}

.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--primary-dark); }
.btn.full { width: 100%; margin-top: 24px; }

.best { color: var(--muted); text-align: center; margin-top: 14px; font-size: 16px; }

/* ---------- Exercice ---------- */
.progress {
  height: 12px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress > div {
  height: 100%;
  width: 0;
  background: var(--primary);
  transition: width .3s;
}

.meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 20px;
}

.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 20px 28px;
  text-align: center;
  transition: background .2s, border-color .2s;
}

.card.good { background: var(--good-bg); border-color: var(--good); }
.card.bad { background: var(--bad-bg); border-color: var(--bad); }

.question {
  font-size: clamp(40px, 12vw, 64px);
  font-weight: 900;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 24px;
}

.answer {
  width: 100%;
  max-width: 260px;
  font: inherit;
  font-size: 40px;
  font-weight: 800;
  text-align: center;
  padding: 10px;
  border: 3px solid var(--line);
  border-radius: 16px;
  outline: none;
  font-variant-numeric: tabular-nums;
  background: #fff;
  color: var(--ink);
}

.answer:focus { border-color: var(--primary); }

.feedback {
  min-height: 56px;
  margin-top: 18px;
  font-weight: 800;
  font-size: 20px;
}

.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }
.feedback small { display: block; font-weight: 600; color: var(--muted); font-size: 15px; margin-top: 4px; }

/* ---------- Résultats ---------- */
.result-score {
  font-size: 64px;
  font-weight: 900;
  color: var(--primary);
  margin: 8px 0;
}

.mistakes {
  text-align: left;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.mistakes li {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bg);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.mistakes .wrong { color: var(--bad); text-decoration: line-through; margin-left: 8px; }
.mistakes .right { color: var(--good); font-weight: 800; }

.row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 24px; }
.btn.ghost { background: #fff; color: var(--primary); border: 2px solid var(--primary); box-shadow: none; }

[hidden] { display: none !important; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
.shake { animation: shake .25s 2; }

/* ---------- Leçons ---------- */
.highlight {
  background: var(--card);
  border: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 20px;
}
.highlight .tag { font-size: 14px; font-weight: 800; color: var(--primary); text-transform: uppercase; letter-spacing: .06em; }
.highlight .hl-title { font-size: 24px; font-weight: 900; margin-top: 4px; }
.highlight .best { text-align: left; }

.lessons { list-style: none; margin: 0; padding: 0; }
.lesson {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 16px;
}
.lesson:hover, .lesson:focus { border-color: var(--primary); outline: none; }
.lesson .num {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--line);
  font-weight: 800; font-size: 14px;
}
.lesson.st-mastered .num { background: var(--good-bg); color: var(--good); }
.lesson.st-open .num { background: var(--primary); color: #fff; }
.lesson.st-open { border-color: var(--primary); }
.lesson.st-passed .num { background: var(--warn-bg); color: var(--warn); }
.lesson.st-rework .num { background: var(--bad-bg); color: var(--bad); }
.lesson.st-rework { border-color: var(--bad); }
.lesson.st-locked { opacity: .55; cursor: default; }
.lesson.st-locked:hover { border-color: var(--line); }
.lesson .lt { flex: 1; font-weight: 700; }
.lesson .lb { flex: none; color: var(--muted); font-size: 14px; font-weight: 700; }

.lesson-name { color: var(--muted); font-weight: 800; margin-bottom: 10px; }

.question.long { font-size: clamp(26px, 7vw, 40px); }

/* ---------- Choix (oui/non, estimations) ---------- */
.choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.choice {
  min-width: 110px;
  font: inherit;
  font-size: 26px;
  font-weight: 800;
  padding: 12px 20px;
  border-radius: 16px;
  border: 3px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.choice:hover:not(:disabled) { border-color: var(--primary); }
.choice.right { border-color: var(--good); background: var(--good); color: #fff; }
.choice.wrong { border-color: var(--bad); background: var(--bad); color: #fff; }
.choice:disabled { cursor: default; }

.mistakes li.head { background: none; padding-left: 0; font-weight: 800; }

/* ---------- Progression ---------- */
.row.left { justify-content: flex-start; margin-top: 14px; }
.hint { color: var(--muted); font-size: 15px; margin: 12px 0 0; }
.hint:empty { display: none; }
.btn.gold { background: var(--gold); color: #3b2a00; box-shadow: 0 4px 0 var(--gold-dark); }
.btn.gold:active { box-shadow: 0 1px 0 var(--gold-dark); }
.btn.ghost { font-size: 17px; padding: 10px 18px; }
.boost { margin-top: 18px; }

.offline {
  background: var(--warn-bg); color: var(--warn); font-weight: 700; font-size: 15px;
  padding: 10px 14px; border-radius: 12px; margin-bottom: 16px;
}

.mission {
  background: var(--warn-bg);
  border: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.mission .tag { font-size: 14px; font-weight: 800; color: var(--warn); text-transform: uppercase; letter-spacing: .06em; }
.mission .m-note { font-size: 20px; font-weight: 900; margin: 4px 0; }
.mission .m-lessons { color: var(--muted); font-size: 15px; margin-bottom: 12px; }

.linklike { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; margin-bottom: 14px; }
.lesson-card { text-align: left; padding: 24px; }
.lesson-card h1 { font-size: 26px; margin: 10px 0 12px; }
.tip { background: var(--bg); border-radius: 12px; padding: 12px 14px; margin: 0; }
.lesson-card .best { text-align: left; }

.badge {
  display: inline-block; font-size: 14px; font-weight: 800; padding: 4px 10px;
  border-radius: 999px; background: var(--line); color: var(--ink);
}
.badge.st-open { background: #e8e8fb; color: var(--primary-dark); }
.badge.st-passed { background: var(--warn-bg); color: var(--warn); }
.badge.st-mastered { background: var(--good-bg); color: var(--good); }
.badge.st-rework { background: var(--bad-bg); color: var(--bad); }

.end-emoji { font-size: 56px; }
.end-msg { font-weight: 800; font-size: 20px; }

/* =================================================================== Application */
.wrap { max-width: 720px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.small { font-size: 14px; }
.desc.small { margin-top: 4px; }
a.btn { text-decoration: none; }

.tile .mini { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.tile .mini > div { height: 100%; background: var(--good); border-radius: 999px; }
.tile .desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.highlight { margin-bottom: 16px; }
.highlight .row.left { gap: 10px; }

/* Rappels, vacances, objectif */
.card-row, .vacation, .goal {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 16px;
}
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-row .tag, .vacation .tag { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); }
.cr-text { font-weight: 700; margin: 4px 0 10px; }
.cr-text.small { color: var(--muted); font-weight: 700; margin: 6px 0 0; }
.reviews { border-color: #c9c9f5; background: #f4f4ff; }
.reviews .cr-text { margin-bottom: 0; }

.vacation { background: #e9f7fb; border-color: #9fd6e6; }
.vacation .tag { color: #1f7896; }
.vdots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.vdot {
  width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 2px solid #9fd6e6;
  display: grid; place-items: center; font-size: 14px; font-weight: 900; color: #fff;
}
.vdot.done { background: var(--good); border-color: var(--good); }
.vdot.today { border-color: #1f7896; border-width: 3px; }
.vdot.missed { background: var(--line); border-color: var(--line); }

.goal-top { display: flex; justify-content: space-between; font-weight: 800; gap: 12px; }
.goal-bar { height: 12px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.goal-bar > div { height: 100%; background: var(--gold); border-radius: 999px; transition: width .4s; }

/* Carte du programme */
.map { position: relative; margin-top: 12px; }
.map-path { position: absolute; left: 0; top: 0; }
.map-path .road { fill: none; stroke: var(--line); stroke-width: 10; stroke-linecap: round; }
.map-path .road.lit { stroke: #c9c9f5; }
.node { position: absolute; width: 60px; height: 60px; text-decoration: none; color: var(--ink); }
.node .dot {
  width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card); border: 4px solid var(--line); font-weight: 900; font-size: 20px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .06); position: relative; z-index: 1;
}
.node.st-open .dot { border-color: var(--primary); color: var(--primary); }
.node.st-passed .dot { border-color: var(--gold); background: var(--warn-bg); }
.node.st-mastered .dot { background: var(--gold); border-color: var(--gold-dark); color: #fff; font-size: 26px; }
.node.st-rework .dot { border-color: var(--bad); color: var(--bad); }
.node.st-locked .dot { font-size: 18px; opacity: .6; }
.node.current .dot { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(91, 91, 214, .45); } 50% { box-shadow: 0 0 0 10px rgba(91, 91, 214, 0); } }
.nlabel {
  position: absolute; top: 50%; transform: translateY(-50%); width: min(210px, 42vw);
  font-size: 14px; line-height: 1.25; background: rgba(253, 248, 240, .92); padding: 4px 6px; border-radius: 8px;
}
.nlabel.r { left: 70px; }
.nlabel.l { right: 70px; text-align: right; }
.nlabel b { display: block; font-weight: 800; }
.nlabel small { color: var(--muted); font-weight: 700; }
.node.st-locked .nlabel { opacity: .6; }
a.node:hover .dot { transform: scale(1.06); }

.lesson-card .module-name { color: var(--muted); font-weight: 700; font-size: 14px; margin-left: 8px; }

/* Questions : figures, fractions, dictée */
.figure:empty { display: none; }
.figure { margin: -10px 0 14px; }
.fig { width: min(100%, 300px); height: auto; }
.fig .shape { fill: #eef0ff; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.fig .fill { fill: var(--primary); stroke: #fff; stroke-width: 2; }
.fig .cell { fill: #fff; stroke: var(--ink); stroke-width: 2; }
.fig .stroke { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.fig .thin { stroke-width: 1.6; }
.fig .accent { stroke: var(--bad); stroke-width: 4; }
.fig .dot { fill: var(--ink); }
.fig .lbl { font: 700 15px Nunito, sans-serif; fill: var(--ink); }

.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; line-height: 1.05; margin: 0 .08em; }
.frac > span:first-child { border-bottom: .07em solid currentColor; padding: 0 .12em; }
.frac > span { font-size: .72em; }
.choice .frac > span { font-size: .8em; }

.question.xlong { font-size: clamp(20px, 5.4vw, 28px); line-height: 1.3; }
.speak { display: flex; gap: 10px; justify-content: center; margin: -8px 0 18px; }
.speak .btn { font-size: 16px; padding: 8px 14px; }
.answer.text { max-width: 420px; font-size: 28px; }
.answer.sentence { max-width: 100%; font-size: 22px; text-align: left; }
.feedback .how { display: block; margin-top: 8px; background: var(--bg); color: var(--ink); border-radius: 12px; padding: 10px 12px; font-size: 16px; text-align: left; }
.feedback mark { background: var(--bad-bg); color: var(--bad); border-radius: 4px; padding: 0 2px; }
.feedback { min-height: 40px; }

.progress.timer > div { background: var(--gold); transition: width .2s linear; }
.end { text-align: center; }

@media (max-width: 480px) {
  body { font-size: 17px; }
  h1 { font-size: 26px; }
  .btn { font-size: 18px; padding: 12px 20px; }
  .btn.ghost { font-size: 16px; padding: 9px 14px; }
  .choice { min-width: 90px; font-size: 22px; padding: 10px 14px; }
  .card { padding: 26px 14px 22px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px; }
  .nlabel { font-size: 13px; }
}

.recall {
  display: inline-block; background: #f4f4ff; color: var(--primary-dark); border: 2px dashed #c9c9f5;
  border-radius: 999px; padding: 6px 14px; font-size: 15px; font-weight: 800; margin: -14px 0 16px;
}
.more { margin-top: 26px; border-top: 2px solid var(--line); padding-top: 6px; }
.more .section-title { margin-top: 12px; }
.more .btn { font-size: 16px; padding: 10px 16px; }

/* Origine de l'erreur */
.cause { margin-top: 14px; text-align: center; }
.cause-q { font-size: 17px; font-weight: 900; color: var(--ink); margin-bottom: 10px; }
.cause-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cause-btn {
  font: inherit; font-size: 15px; font-weight: 800; color: var(--ink); background: #fff; cursor: pointer;
  border: 2px solid var(--line); border-radius: 14px; padding: 10px 8px; line-height: 1.25;
}
.cause-btn:hover:not(:disabled) { border-color: var(--primary); }
.cause-btn:disabled { cursor: default; opacity: .45; }
.cause-btn.picked { opacity: 1; border-color: var(--primary); background: #eef0ff; }

/* Leçon développée (« On fait le point ») */
.helpcard { text-align: left; padding: 26px 22px; }
.helpcard.center { text-align: center; }
.helpcard .tag { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); margin-bottom: 8px; }
.helpcard h1 { margin-bottom: 4px; }
.helpcard h3 { font-size: 18px; font-weight: 900; margin: 22px 0 8px; }
.helpcard .steps { margin: 0; padding-left: 24px; }
.helpcard .steps li { margin-bottom: 8px; line-height: 1.45; }
.helpcard .mistakes .how, .how.big { display: block; margin-top: 6px; background: #fff; border-radius: 10px; padding: 8px 10px; font-size: 15px; }
.how.big { background: var(--bg); font-size: 18px; padding: 14px 16px; margin: 8px 0 4px; text-align: left; line-height: 1.5; }
.answer-line { font-size: 20px; margin: 10px 0 0; }
.help-note {
  margin-top: 14px; background: #eef0ff; color: var(--primary-dark); border-radius: 12px;
  padding: 12px 14px; font-weight: 800; font-size: 16px;
}
.feel { display: flex; justify-content: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.feel-btn {
  display: grid; justify-items: center; gap: 4px; font-size: 40px; background: #fff; cursor: pointer;
  border: 3px solid var(--line); border-radius: 18px; padding: 12px 18px; min-width: 100px;
}
.feel-btn span { font: 800 15px Nunito, sans-serif; color: var(--ink); }
.feel-btn:hover { border-color: var(--primary); }

/* Niveau de compréhension */
.level-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -4px 0 14px; font-size: 15px; color: var(--muted); }
.level-line b { color: var(--ink); }
.gauge { display: inline-flex; gap: 4px; }
.gauge i { width: 22px; height: 10px; border-radius: 999px; background: var(--line); }
.gauge i.on { background: var(--good); }
details.course { margin: 12px 0 0; background: var(--bg); border-radius: 12px; padding: 10px 14px; }
details.course summary { cursor: pointer; font-weight: 800; }
details.course ol { margin: 10px 0 2px; padding-left: 22px; }
details.course li { margin-bottom: 6px; }

/* Tables de multiplication */
.tables-card {
  background: #fff4e5; border: 3px solid var(--gold); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px;
}
.tables-card.done { background: var(--good-bg); border-color: var(--good); }
.tables-card .tag { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--warn); }
.tables-card.done .tag { color: var(--good); }
.tables-card .row.left { margin-top: 10px; gap: 10px; }
.tgrid { border-collapse: separate; border-spacing: 4px; margin: 6px auto 10px; font-variant-numeric: tabular-nums; }
.tgrid th { font-weight: 900; color: var(--muted); width: 36px; height: 30px; font-size: 15px; }
.tgrid td { width: 38px; height: 34px; text-align: center; border-radius: 8px; font-weight: 800; font-size: 15px; }
.b0 { background: var(--line); color: var(--muted); }
.b1 { background: #f7c6c2; color: #8f2620; }
.b2 { background: #fbd9a8; color: #7a4a00; }
.b3 { background: #fbecaa; color: #6b5600; }
.b4 { background: #c9edd8; color: #1f6b43; }
.b5 { background: var(--good); color: #fff; }
.tlegend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: 14px; color: var(--muted); font-weight: 700; }
.tlegend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 6px; vertical-align: -2px; }
.pair { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 34px; font-weight: 900; }
.pair input { width: 90px; font: inherit; font-size: 36px; text-align: center; padding: 8px; border: 3px solid var(--line); border-radius: 16px; background: #fff; color: var(--ink); }
.pair input:focus { border-color: var(--primary); outline: none; }
@media (max-width: 480px) {
  .tgrid { border-spacing: 3px; }
  .tgrid td { width: 32px; height: 30px; font-size: 13px; }
  .tgrid th { width: 24px; font-size: 13px; }
}
.feedback .slow { display: block; font-size: 14px; color: var(--muted); font-weight: 700; margin-top: 4px; }

/* Devoirs « à savoir pour le … » */
.mission.homework { background: #eef6ff; border-color: #6aa6e8; }
.mission.homework .tag { color: #1f5fa8; }
.mission.homework.done { border-style: dashed; }
.choice.long { font-size: 19px; line-height: 1.3; padding: 10px 14px; width: 100%; }
@media (max-width: 480px) { .choice.long { font-size: 16px; } }

/* Animation de l'enveloppe en fin de série */
#tables-anim { margin-top: 18px; }
#tables-anim .section-title { margin-top: 0; }
.tgrid td { transition: background-color .5s, color .5s; }
.tgrid td.pop { animation: pop .6s ease-out; }
.tgrid td.star { animation: pop .6s ease-out, glow 1.2s ease-out .1s; }
.tgrid td.dip { animation: dip .5s ease-in-out; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.45); } 100% { transform: scale(1); } }
@keyframes glow { 0% { box-shadow: 0 0 0 0 rgba(47, 165, 107, .7); } 100% { box-shadow: 0 0 0 14px rgba(47, 165, 107, 0); } }
@keyframes dip { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
.moves { list-style: none; padding: 0; margin: 4px 0 0; text-align: left; display: grid; gap: 6px; }
.moves li { padding: 8px 12px; border-radius: 10px; font-size: 16px; opacity: 0; transform: translateX(-8px); transition: opacity .4s, transform .4s; }
.moves li.shown { opacity: 1; transform: none; }
.moves li.up { background: var(--good-bg); }
.moves li.down { background: var(--bg); color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  .tgrid td, .moves li { transition: none; animation: none !important; }
}

/* Géométrie : chemins, quadrillage, équerre */
.fig .path { stroke-dasharray: 6 5; stroke-width: 2; }
.fig .grid { stroke: #d9dcf5; stroke-width: 1; }
.fig .lbl.it { font-style: italic; font-size: 14px; }
.fig .tool { fill: rgba(91, 91, 214, .18); stroke: var(--primary); stroke-width: 2; }
.fig .equerre { display: none; }
.fig .equerre polygon { fill: rgba(242, 176, 30, .35); stroke: #c98d0c; stroke-width: 2; }
.fig.show-eq .equerre { display: inline; animation: eqIn .35s ease-out; }
@keyframes eqIn { from { opacity: 0; } to { opacity: 1; } }
.tools { display: flex; justify-content: center; margin: -6px 0 16px; }
.tools .btn { font-size: 16px; padding: 8px 14px; }
@media (prefers-reduced-motion: reduce) { .fig.show-eq .equerre { animation: none; } }

/* Enveloppe des tables : une seule teinte (bleu), du clair au foncé, avec de grands écarts de
   luminosité, + des repères sans couleur (rayures, pointillés, contour, ⚡), lisibles par les
   personnes daltoniennes. Remplace l'ancienne échelle rouge → vert. */
.b0 { background: #ffffff; color: #4b5563; box-shadow: inset 0 0 0 2px #9ca3af; border: 0; }
.tgrid td.b0 { background-image: none; outline: 2px dashed #9ca3af; outline-offset: -4px; box-shadow: none; }
.b1 { background: repeating-linear-gradient(135deg, #eef3fb 0 5px, #c3d1e8 5px 7px); color: #111827; }
.b2 { background: #a9c3ea; color: #111827; }
.b3 { background: #6b93d6; color: #0b1220; }
.b4 { background: #2f5aa8; color: #ffffff; }
.b5 { background: #0f2257; color: #ffffff; box-shadow: inset 0 0 0 2px #f2b01e; }
.tgrid td.b5::after { content: '⚡'; font-size: 9px; vertical-align: super; margin-left: 1px; }
.tgrid td { position: relative; }
.tlegend i.b0 { outline: 2px dashed #9ca3af; outline-offset: -3px; background: #fff; box-shadow: none; }

/* Calendrier des tables (admin) : fait = foncé avec ✓, pas fait = clair rayé avec ✗ */
.tcal .ok { background: #0f2257; color: #fff; }
.tcal .ok::after { content: ' ✓'; font-size: 10px; }
.tcal .ko { background: repeating-linear-gradient(135deg, #f3f4f6 0 5px, #d1d5db 5px 7px); color: #374151; }
.tcal .ko::after { content: ' ✗'; font-size: 10px; }
.tcal span { width: auto; min-width: 30px; padding: 0 4px; }

/* Bonnes / mauvaises réponses : un symbole en plus de la couleur */
.choice.right::after { content: ' ✓'; }
.choice.wrong::after { content: ' ✗'; }

/* Niveau lisible sans aucune couleur : petits points en bas de la case
   (à apprendre = rayé · ça vient • · je la sais •• · presque automatique ••• · automatique ⚡) */
.tgrid td { line-height: 1.05; padding-bottom: 6px; }
.tgrid td::before { position: absolute; left: 0; right: 0; bottom: 1px; font-size: 9px; line-height: 1; letter-spacing: 1px; }
.tgrid td.b2::before { content: '•'; }
.tgrid td.b3::before { content: '••'; }
.tgrid td.b4::before { content: '•••'; }
.tgrid td.b1::before { content: '–'; font-weight: 900; }
.tlegend i { position: relative; }
.tlegend .mk { color: var(--ink); font-size: 12px; letter-spacing: 1px; }

/* « Ça vient » ↔ « Je la sais » bien séparés : clair + chiffres noirs + contour  →  bleu soutenu + chiffres blancs */
.b2 { background: #d3e1f5; color: #111827; box-shadow: inset 0 0 0 2px #4a76c6; }
.b3 { background: #4a76c6; color: #ffffff; box-shadow: none; }
.b4 { background: #22448c; color: #ffffff; }
.b5 { background: #0a1638; color: #ffffff; box-shadow: inset 0 0 0 2px #f2b01e; }
