/* =========================================================
   EdgeFun — feuille de style
   Basée sur l'export Claude Design « Refonte design »
   ========================================================= */

/* ---------- Polices (auto-hébergées) ---------- */
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../fonts/fredoka-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('../fonts/nunito-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('../fonts/nunito-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Thème sombre (par défaut, celui du design) ---------- */
:root {
  color-scheme: dark;
  --bg: #0A0D14;
  --bg-elev: #0E121B;
  --surface: #121722;
  --surface-2: #1A2130;
  --border: #252D3F;
  --divider: #1A2130;
  --text: #EEF1F7;
  --muted: #96A0B8;
  --faint: #6F7A93;
  --disabled: #5E6880;

  --blue: #2A62F0;
  --blue-press: #1B45B5;
  --blue-bright: #4C8DFF;
  --blue-soft: #172444;
  --blue-text: #7FAEFF;
  --blue-text-2: #A9C8FF;

  --gold: #F5B93A;
  --gold-text: #F5B93A;
  --gold-soft: #33230B;
  --on-gold: #2B1C00;

  --orange: #FF9A4D;
  --orange-text: #FF9A4D;
  --orange-soft: #2E1A0A;
  --on-orange: #2B1300;

  --green: #2FCB7C;
  --green-text: #2FCB7C;
  --green-press: #1B8A52;
  --green-soft: #0E2A1C;
  --on-green: #062014;

  --red: #FF6B6B;
  --red-text: #FF8585;
  --red-press: #B83A3A;
  --red-line: #7A2E2E;
  --red-soft: #2E1216;

  --bronze: #D99A6C;
  --bronze-soft: #3A2415;

  --node-locked: radial-gradient(circle at 34% 26%, #3A4561 0%, #262F45 50%, #1C2333 100%);
  --node-locked-shadow: inset 0 3px 0 rgba(255,255,255,0.1), inset 0 -6px 0 rgba(0,0,0,0.25), 0 8px 0 #0F141E, 0 14px 20px rgba(0,0,0,0.45);
  --node-locked-color: #6F7A93;
  --chest-bg: linear-gradient(180deg, #3A4561 0%, #262F45 55%, #1C2333 100%);
  --path-track: #1A2130;
  --path-todo: #3A4560;
  --shadow-pop: 0 24px 60px rgba(0, 0, 0, 0.5);
  --logo-filter: none;
}

/* ---------- Thème clair ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F4F6FB;
  --bg-elev: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #E8ECF4;
  --border: #DCE2ED;
  --divider: #E4E8F0;
  --text: #131926;
  --muted: #5B6480;
  --faint: #8790A6;
  --disabled: #A3ABBE;

  --blue-bright: #3D7BFF;
  --blue-soft: #E4ECFF;
  --blue-text: #2557D6;
  --blue-text-2: #1B45B5;

  --gold: #F2B12C;
  --gold-text: #9A6400;
  --gold-soft: #FFF1D2;

  --orange: #FF8A3D;
  --orange-text: #C2560F;
  --orange-soft: #FFE9DA;

  --green: #22B46B;
  --green-text: #11804A;
  --green-press: #168A51;
  --green-soft: #DDF6E8;

  --red: #E5484D;
  --red-text: #CF3439;
  --red-press: #A8282C;
  --red-line: #F0B4B6;
  --red-soft: #FDE6E7;

  --bronze: #B0703F;
  --bronze-soft: #F6E3D3;

  --node-locked: radial-gradient(circle at 34% 26%, #F2F4F9 0%, #DCE1EB 55%, #C9D0DE 100%);
  --node-locked-shadow: inset 0 3px 0 rgba(255,255,255,0.8), inset 0 -6px 0 rgba(0,0,0,0.06), 0 8px 0 #AEB7C9, 0 14px 20px rgba(20,30,60,0.12);
  --node-locked-color: #8A93A8;
  --chest-bg: linear-gradient(180deg, #F2F4F9 0%, #DCE1EB 55%, #C9D0DE 100%);
  --path-track: #E2E7F0;
  --path-todo: #C3CADA;
  --shadow-pop: 0 24px 60px rgba(20, 30, 60, 0.18);
  --logo-filter: invert(1) hue-rotate(180deg) saturate(1.4);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ol, ul { margin: 0; }
a { color: var(--blue-text); }
a:hover { color: var(--blue-text-2); }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
svg { flex: none; }
:focus-visible { outline: 3px solid var(--blue-bright); outline-offset: 2px; }

.display { font-family: 'Fredoka', Nunito, sans-serif; font-weight: 600; letter-spacing: 0.3px; }
.num { font-family: 'Fredoka', Nunito, sans-serif; font-weight: 600; }
.muted { color: var(--muted); }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.logo { height: 46px; width: auto; filter: var(--logo-filter); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px;
  border: 0; border-radius: 12px;
  background: var(--blue); box-shadow: 0 3px 0 var(--blue-press);
  color: #FFFFFF; font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
}
.btn:hover { color: #FFFFFF; filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--blue-press); }
.btn:disabled { cursor: not-allowed; background: var(--surface-2); box-shadow: 0 3px 0 var(--border); color: var(--disabled); filter: none; transform: none; }
.btn--lg { height: 58px; padding: 0 32px; border-radius: 16px; font-size: 17px; box-shadow: 0 4px 0 var(--blue-press); }
.btn--lg:active { transform: translateY(4px); }
.btn--md { height: 56px; padding: 0 48px; border-radius: 14px; font-size: 17px; box-shadow: 0 4px 0 var(--blue-press); }
.btn--md:active { transform: translateY(4px); }
.btn--green { background: var(--green); box-shadow: 0 4px 0 var(--green-press); color: var(--on-green); }
.btn--green:hover { color: var(--on-green); }
.btn--green:active { box-shadow: 0 0 0 var(--green-press); }
.btn--red { background: var(--red); box-shadow: 0 4px 0 var(--red-press); color: #FFFFFF; }
.btn--red:active { box-shadow: 0 0 0 var(--red-press); }
.btn--ghost { background: transparent; box-shadow: none; border: 1px solid var(--border); color: var(--blue-text); font-weight: 600; }
.btn--ghost:hover { color: var(--blue-text-2); background: var(--surface); filter: none; }
.btn--ghost:active { transform: translateY(1px); }
.btn--text { background: transparent; box-shadow: none; color: var(--blue-text); font-weight: 600; padding: 0 16px; }
.btn--text:hover { color: var(--blue-text-2); filter: none; }
.btn--text:active { transform: none; }
.btn--danger { background: transparent; box-shadow: none; color: var(--red-text); font-weight: 600; padding: 0 12px; }
.btn--danger:hover { color: var(--red-text); filter: none; text-decoration: underline; }
.btn--danger:active { transform: none; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; }

/* ---------- Pastilles ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 8px; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 14px; }
.stat { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
a.stat:hover { border-color: var(--blue-bright); color: var(--text); }
.stat--streak { color: var(--orange-text); }
.stat--streak.is-off { color: var(--muted); }
.stat--xp { color: var(--gold-text); }
a.stat--streak:hover { color: var(--orange-text); }
a.stat--xp:hover { color: var(--gold-text); }

.tag { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag--green { background: var(--green); color: var(--on-green); }
.tag--gold { background: var(--gold); color: var(--on-gold); }
.tag--sm { font-size: 11px; padding: 3px 8px; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { font-size: 14px; font-weight: 600; padding: 7px 14px; border-radius: 999px; background: var(--blue-soft); color: var(--blue-text-2); text-decoration: none; }
a.pill:hover { color: var(--blue-text-2); filter: brightness(1.15); }

/* ---------- Barres de progression ---------- */
.progress { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress--sm { height: 6px; }
.progress--lg { height: 12px; }
.progress__bar { height: 100%; width: 0; border-radius: 999px; background: var(--gold); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.progress__bar--green { background: var(--green); }
.progress__bar--blue { background: var(--blue-bright); }
.progress__bar--done { background: var(--green-press); }

/* =========================================================
   Coquille de l'app (barre latérale + en-tête)
   ========================================================= */
.app { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  padding: 20px 14px;
  border-right: 1px solid var(--divider);
  background: var(--bg-elev);
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar__logo { padding: 4px 12px 18px; }
.sidebar__logo a { display: inline-block; border-radius: 8px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav__link {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px; border-radius: 12px;
  color: var(--muted); font-weight: 600; font-size: 15px; text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.nav__link:hover { background: var(--surface); color: var(--text); }
.nav__link[aria-current="page"] { background: var(--blue-soft); color: var(--blue-text-2); font-weight: 700; }
.nav__dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

.app__main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 32px; border-bottom: 1px solid var(--divider); }
.topbar__left { display: flex; align-items: center; gap: 14px; }
.topbar__logo { display: none; }
.topbar__title { font-size: 1.625rem; }
.page { width: 100%; max-width: 1160px; padding: 28px 32px 40px; }

/* =========================================================
   Parcours
   ========================================================= */
.parcours { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px; }
.parcours__main { flex: 3 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.parcours__side { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 20px; }

.banner { background: var(--blue); border-radius: 24px; padding: 24px 28px; display: flex; align-items: center; gap: 20px; color: #FFFFFF; }
.banner__body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.banner__eyebrow { font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #DCE7FF; }
.banner__title { font-size: 1.625rem; color: #FFFFFF; }
.banner__text { font-size: 15px; line-height: 1.45; }

.path { position: relative; width: min(420px, 100%); margin: 12px auto 0; }
.path__svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.path__svg polyline { vector-effect: non-scaling-stroke; }

.node {
  position: absolute; z-index: 2;
  width: 80px; height: 74px; margin-left: -40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.node--done {
  background: radial-gradient(circle at 34% 26%, #FFE7A3 0%, #F8C24A 38%, #E7A322 78%, #D18F12 100%);
  box-shadow: inset 0 3px 0 rgba(255,255,255,0.55), inset 0 -7px 0 rgba(120,70,0,0.28), 0 9px 0 #9C6C06, 0 16px 22px rgba(0,0,0,0.35);
  color: #5A3A00;
}
.node--current {
  width: 88px; height: 82px; margin-left: -44px;
  background: radial-gradient(circle at 34% 26%, #9DBDFF 0%, #4F84FF 36%, #2A62F0 72%, #1F4FD6 100%);
  box-shadow: inset 0 3px 0 rgba(255,255,255,0.5), inset 0 -7px 0 rgba(10,30,110,0.35), 0 9px 0 #163A9E, 0 16px 26px rgba(42,98,240,0.45);
  color: #FFFFFF;
}
.node--locked { background: var(--node-locked); box-shadow: var(--node-locked-shadow); color: var(--node-locked-color); }
a.node:hover { transform: translateY(-2px); color: inherit; }
a.node--done:hover { color: #5A3A00; }
a.node--current:hover { color: #FFFFFF; }
a.node:active { transform: translateY(6px); }
a.node--done:active { box-shadow: inset 0 3px 0 rgba(255,255,255,0.55), inset 0 -7px 0 rgba(120,70,0,0.28), 0 3px 0 #9C6C06, 0 6px 10px rgba(0,0,0,0.3); }
a.node--current:active { box-shadow: inset 0 3px 0 rgba(255,255,255,0.5), inset 0 -7px 0 rgba(10,30,110,0.35), 0 3px 0 #163A9E, 0 6px 12px rgba(42,98,240,0.4); }
.node--chest { width: 100px; height: 92px; margin-left: -50px; border-radius: 28px; background: var(--chest-bg); box-shadow: var(--node-locked-shadow); color: #D9B061; }

.node__label { position: absolute; z-index: 1; width: 180px; margin-left: -90px; text-align: center; font-weight: 700; font-size: 14px; line-height: 1.3; color: var(--text); }
.node__label--current { color: var(--blue-text-2); }
.node__label--locked { color: var(--muted); }
.node__label--chest { width: 220px; margin-left: -110px; display: flex; flex-direction: column; gap: 2px; }
.node__label--chest strong { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 15px; color: var(--text); }
.node__label--chest span { font-size: 13px; color: var(--muted); }

.node__ring { position: absolute; z-index: 1; width: 112px; height: 112px; margin-left: -56px; border-radius: 50%; border: 4px solid #4F84FF; opacity: .5; animation: ring 2.4s ease-out infinite; pointer-events: none; }
.node__bubble {
  position: absolute; z-index: 3; width: 124px; height: 34px; margin-left: -62px;
  border-radius: 10px;
  background: linear-gradient(180deg, #FFFFFF 0%, #DDE5F5 100%);
  box-shadow: 0 4px 0 #A9B6D3, 0 8px 14px rgba(0,0,0,0.35);
  color: #1B45B5;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 14px; letter-spacing: 1px;
  pointer-events: none;
  animation: bob 2.2s ease-in-out infinite;
}

.side-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.side-card--quests { gap: 14px; }
.side-card__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.side-card__title { font-weight: 700; font-size: 16px; }
.side-card__link { font-size: 13px; font-weight: 600; text-decoration: none; }
.side-card__note { font-size: 13px; line-height: 1.45; color: var(--muted); }
.mini-quest { display: flex; flex-direction: column; gap: 6px; }
.mini-quest__row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.mini-quest__title { font-weight: 600; }
.mini-quest__count { font-family: 'Fredoka', sans-serif; font-size: 12px; color: var(--muted); }
.mini-quest__count--done { color: var(--green-text); }
.rank-line { display: flex; align-items: baseline; gap: 10px; }
.rank-big { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 36px; line-height: 1; color: var(--blue-text); }

/* =========================================================
   Leçon
   ========================================================= */
.lesson { min-height: 100vh; display: flex; flex-direction: column; }
.lesson__header { width: 100%; max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 20px 32px; }
.icon-btn { width: 44px; height: 44px; margin-left: -12px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 12px; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--surface); color: var(--text); }
.lesson__progress { flex: 1; }
.lesson__main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 32px 32px 40px; display: flex; flex-wrap: wrap; align-items: center; gap: 40px; }
.lesson__main--solo { justify-content: center; }
.lesson__main--solo .lesson__qa { flex-basis: 560px; max-width: 640px; }
.lesson__visual { flex: 1 1 420px; min-width: 0; padding: 24px 24px 16px; border-radius: 24px; }
.lesson__visual svg { display: block; width: 100%; height: auto; }
.lesson__qa { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.lesson__eyebrow { color: var(--blue-text); }

.speech { display: flex; align-items: flex-end; gap: 14px; }
.speech__bubble { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 18px 18px 18px 4px; padding: 16px 18px; font-family: 'Fredoka', sans-serif; font-weight: 500; font-size: 1.25rem; letter-spacing: 0.3px; line-height: 1.4; }

.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 14px;
  min-height: 58px; padding: 10px 18px;
  border-radius: 14px; border: 2px solid var(--border);
  background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 17px; line-height: 1.3; text-align: left;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, transform .08s ease;
}
.choice__key { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-family: 'Fredoka', sans-serif; font-size: 13px; color: var(--muted); }
.choice__text { flex: 1; }
.choice__mark { flex: none; display: none; }
.choice:hover:not(:disabled) { border-color: var(--blue-bright); background: var(--blue-soft); }
.choice:active:not(:disabled) { transform: translateY(2px); }
.choice:disabled { cursor: default; }
.choice.is-dim { color: var(--muted); }
.choice.is-correct { border-color: var(--green); background: var(--green-soft); color: var(--text); font-weight: 700; animation: pop .3s ease; }
.choice.is-correct .choice__key { display: none; }
.choice.is-correct .choice__mark--ok { display: block; color: var(--green); }
.choice.is-wrong { border-color: var(--red); background: var(--red-soft); color: var(--text); animation: shake .35s ease; }
.choice.is-wrong .choice__key { display: none; }
.choice.is-wrong .choice__mark--ko { display: block; color: var(--red); }

.feedback { border-top: 1px solid var(--divider); }
.feedback--ok { background: var(--green-soft); border-top-color: transparent; }
.feedback--ko { background: var(--red-soft); border-top-color: transparent; }
.feedback__inner { max-width: 1040px; margin: 0 auto; padding: 24px 32px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; min-height: 104px; }
.feedback__body { flex: 1 1 320px; display: flex; flex-direction: column; gap: 6px; }
.feedback--ok .feedback__body, .feedback--ko .feedback__body { animation: slideUp .25s ease; }
.feedback__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.feedback__title { font-size: 1.5rem; }
.feedback--ok .feedback__title { color: var(--green-text); }
.feedback--ko .feedback__title { color: var(--red-text); }
.feedback__text { font-size: 16px; line-height: 1.45; }
.feedback__hint { font-size: 15px; color: var(--muted); }

/* =========================================================
   Fin de leçon
   ========================================================= */
.result { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 32px; }
.result__inner { width: 100%; max-width: 1000px; display: flex; flex-wrap: wrap; align-items: stretch; gap: 32px; }
.result__main { flex: 1 1 400px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.result__hero { display: flex; align-items: center; gap: 20px; }
.result__hero svg { animation: hop 1s ease .1s both; }
.result__heading { display: flex; flex-direction: column; gap: 6px; }
.result__title { font-size: 2.625rem; line-height: 1.1; color: var(--gold-text); }
.kpis { display: flex; flex-wrap: wrap; gap: 12px; }
.kpi { flex: 1 1 110px; border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.kpi__label { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi__value { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 32px; line-height: 1.1; }
.kpi__value--gold { color: var(--gold-text); }
.kpi__value--green { color: var(--green-text); }
.kpi__value--blue { color: var(--blue-text); }
.flags { display: flex; flex-wrap: wrap; gap: 12px; }
.flag { flex: 1 1 180px; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 16px; border-radius: 14px; font-weight: 700; font-size: 15px; }
.flag--orange { background: var(--orange-soft); color: var(--orange-text); }
.flag--green { background: var(--green-soft); color: var(--green-text); }
.flag--blue { background: var(--blue-soft); color: var(--blue-text-2); }
.flag--muted { background: var(--surface-2); color: var(--muted); }
.result__actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 12px; }
.result__actions .btn { flex: 1 1 180px; height: 56px; border-radius: 14px; font-size: 17px; }
.result__actions .btn--ghost { font-size: 16px; }
.recap { flex: 1 1 360px; min-width: 0; border-radius: 24px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.recap__title { font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.recap__text { font-size: 18px; line-height: 1.6; }
.recap__text strong { color: var(--blue-text); }
.recap__new { margin-top: auto; border-top: 1px solid var(--border); padding-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.recap__new h2 { font-size: 15px; font-weight: 700; }

/* =========================================================
   Quêtes
   ========================================================= */
.two-col { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px; max-width: 1100px; }
.streak-card { flex: 1 1 340px; min-width: 0; padding: 28px; border-radius: 24px; display: flex; flex-direction: column; gap: 24px; }
.streak-card__top { display: flex; align-items: center; gap: 18px; }
.streak-card__num { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 72px; line-height: 1; color: var(--orange-text); }
.streak-card__num.is-off { color: var(--muted); }
.streak-card__label { font-weight: 700; font-size: 20px; }
.streak-card__hint { font-size: 14px; line-height: 1.45; color: var(--muted); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); list-style: none; padding: 0; }
.week__day { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.week__dot { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.week__day--done .week__dot { background: var(--orange); color: var(--on-orange); }
.week__day--today { color: var(--text); font-weight: 700; }
.week__day--today:not(.week__day--done) .week__dot { background: transparent; border: 2px dashed var(--blue-text); }

.quests { flex: 2 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.quest { border-radius: 18px; padding: 18px 20px; display: flex; align-items: center; gap: 20px; }
.quest--ready { border-color: var(--green); }
.quest__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.quest__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.quest__title { font-weight: 700; font-size: 17px; }
.quest--claimed .quest__title { color: var(--muted); }
.quest__count { font-family: 'Fredoka', sans-serif; font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.quest__side { flex: none; width: 96px; display: flex; justify-content: flex-end; }
.quest__reward { font-family: 'Fredoka', sans-serif; font-size: 14px; font-weight: 700; color: var(--gold-text); }
.quest__claim { width: 96px; height: 46px; padding: 0; border-radius: 12px; box-shadow: 0 3px 0 var(--green-press); font-family: 'Fredoka', sans-serif; font-size: 14px; animation: glow 1.6s ease-in-out infinite; }
.quest__done { font-size: 14px; font-weight: 700; color: var(--green-text); }
.page-note { margin-top: 8px; font-size: 14px; color: var(--muted); }

/* =========================================================
   Classement
   ========================================================= */
.league-card { flex: 1 1 300px; min-width: 0; padding: 28px; border-radius: 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.league-card h2 { font-size: 1.5rem; }
.league-card__info { font-size: 15px; line-height: 1.5; color: var(--muted); }
.league-card__rank { width: 100%; border-top: 1px solid var(--border); padding-top: 16px; display: flex; align-items: baseline; gap: 10px; }
.ranking { flex: 2 1 460px; min-width: 0; list-style: none; margin: 0; padding: 10px 14px; border-radius: 24px; display: flex; flex-direction: column; font-size: 16px; }
.rank { display: flex; align-items: center; gap: 14px; height: 52px; padding: 0 12px; }
.rank__pos { width: 26px; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 15px; color: var(--muted); }
.rank--top .rank__pos { color: var(--gold-text); }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.rank__name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank__xp { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; }
.rank--me { height: 56px; border-radius: 14px; background: var(--blue-soft); border: 1px solid var(--blue); }
.rank--me .rank__pos, .rank--me .rank__xp { color: var(--blue-text-2); }
.rank--me .avatar { background: var(--blue); color: #FFFFFF; }
.rank--me .rank__name { font-weight: 700; }
.zone { display: flex; align-items: center; gap: 12px; height: 32px; padding: 0 12px; font-size: 12px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--green-text); }
.zone::before, .zone::after { content: ""; flex: 1; height: 1px; background: var(--green-press); }
.zone--down { color: var(--red-text); }
.zone--down::before, .zone--down::after { background: var(--red-line); }

/* =========================================================
   Bibliothèque
   ========================================================= */
.lib { display: flex; flex-direction: column; gap: 20px; }
.lib__progress { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.lib__progress .progress { flex: 1 1 240px; }
.lib__count { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 14px; color: var(--muted); }
.lib__count span { color: var(--text); }
.lib__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.search { flex: 1 1 260px; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.search:focus-within { border-color: var(--blue-bright); }
.search input { flex: 1; min-width: 0; height: 44px; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px; }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter { height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; }
.filter:hover { color: var(--text); border-color: var(--blue-bright); }
.filter[aria-pressed="true"] { border-color: var(--blue); background: var(--blue); color: #FFFFFF; font-weight: 700; }
.notions { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.notion {
  width: 100%; padding: 20px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
  text-align: left; color: var(--text); cursor: pointer;
  transition: border-color .15s ease, transform .12s ease;
}
.notion:hover { border-color: var(--blue-bright); transform: translateY(-2px); }
.notion--new { border-color: var(--blue); }
.notion__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.notion__cat { font-size: 12px; font-weight: 600; color: var(--muted); }
.notion__title { display: block; font-weight: 700; font-size: 19px; }
.notion__def { display: block; font-size: 15px; line-height: 1.5; }
.notion__ex { display: block; margin-top: auto; font-size: 13px; line-height: 1.45; color: var(--muted); }
.notion--locked { border: 1px dashed var(--border); background: transparent; padding: 16px 20px; flex-direction: row; align-items: center; gap: 14px; color: var(--muted); cursor: default; }
.notion--locked:hover { transform: none; border-color: var(--border); }
.notion--locked .notion__title { font-size: 17px; }
.notion--locked .notion__hint { font-size: 13px; line-height: 1.4; }
.empty { grid-column: 1 / -1; padding: 40px 20px; border: 1px dashed var(--border); border-radius: 20px; text-align: center; color: var(--muted); }

/* =========================================================
   Profil
   ========================================================= */
.profile { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 32px; }
.profile__col { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; }
.profile__col--badges { flex-basis: 420px; }
.identity { display: flex; align-items: center; gap: 18px; }
.identity h2 { font-size: 1.75rem; }
.avatar--xl { width: 80px; height: 80px; background: var(--blue); color: #FFFFFF; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 36px; }
.level-card { margin-top: 20px; border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.level-card__head { display: flex; justify-content: space-between; align-items: baseline; }
.section-label { margin: 28px 0 12px; }
.profile__col--badges .section-label { margin-top: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat-tile { border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.stat-tile__value { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 24px; }
.stat-tile__label { font-size: 13px; color: var(--muted); }
.c-gold { color: var(--gold-text); }
.c-orange { color: var(--orange-text); }
.c-green { color: var(--green-text); }
.c-blue { color: var(--blue-text); }
.settings { border-radius: 16px; padding: 0 18px; display: flex; flex-direction: column; }
.setting { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 0; }
.setting + .setting { border-top: 1px solid var(--border); }
.setting__label { font-weight: 700; font-size: 15px; }
.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; }
.seg:hover { color: var(--text); }
.seg[aria-pressed="true"] { border: 2px solid var(--blue-bright); background: var(--blue-soft); color: var(--blue-text-2); font-weight: 700; }
.seg--num { padding: 0 12px; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 13px; }
.profile__actions { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.profile__actions .btn--ghost { height: 46px; }
.badges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; text-align: center; list-style: none; padding: 0; }
.badge { border-radius: 18px; padding: 20px 8px; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.badge--earned { border-color: var(--gold); }
.badge__icon { width: 52px; height: 52px; border-radius: 50%; background: var(--surface-2); color: var(--disabled); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.badge--earned .badge__icon { background: var(--gold-soft); color: var(--gold-text); }
.badge__name { font-weight: 700; font-size: 15px; color: var(--muted); }
.badge--earned .badge__name { color: var(--text); }
.badge__desc { font-size: 13px; line-height: 1.35; color: var(--muted); }

/* =========================================================
   Dialogues & notifications
   ========================================================= */
.dialog {
  border: 1px solid var(--border); border-radius: 24px;
  background: var(--surface); color: var(--text);
  padding: 28px; width: min(480px, calc(100vw - 32px));
  box-shadow: var(--shadow-pop);
}
.dialog[open] { animation: dialogIn .2s ease; }
.dialog::backdrop { background: rgba(5, 8, 14, 0.7); backdrop-filter: blur(2px); }
.dialog__form { display: flex; flex-direction: column; gap: 20px; }
.dialog__head { display: flex; align-items: center; gap: 14px; }
.dialog__title { font-size: 1.5rem; line-height: 1.2; }
.dialog__text { font-size: 15px; line-height: 1.5; color: var(--muted); }
.dialog__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.dialog__actions .btn { flex: 1 1 140px; }
.field { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; margin: 0; }
.field__label { font-weight: 700; font-size: 15px; padding: 0; }
.input { height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: 16px; }
.input:focus { outline: none; border-color: var(--blue-bright); }
.goal-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.goal-opt { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); cursor: pointer; }
.goal-opt input { position: absolute; opacity: 0; pointer-events: none; }
.goal-opt strong { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 16px; }
.goal-opt span { font-size: 13px; color: var(--muted); }
.goal-opt:has(input:checked) { border: 2px solid var(--blue-bright); background: var(--blue-soft); padding: 11px 13px; }
.goal-opt:has(input:focus-visible) { outline: 3px solid var(--blue-bright); outline-offset: 2px; }
/* Comptes : fenêtre de connexion et encart du profil */
.dialog--auth { width: min(440px, calc(100vw - 32px)); }
.auth__hint { font-size: 13px; color: var(--muted); }
.auth__msg { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--red-soft); color: var(--red-text); font-size: 14px; line-height: 1.45; font-weight: 600; }
.auth__msg--ok { background: var(--blue-soft); color: var(--blue-text); }
.auth__links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: -8px; }
.auth__link { background: none; border: 0; padding: 6px 0; font: inherit; font-size: 14px; font-weight: 700; color: var(--blue-text); cursor: pointer; }
.auth__link:hover { text-decoration: underline; }
.auth__link--center { align-self: center; margin-top: -8px; }
.dialog__fine a { color: inherit; }
.account { border-radius: 16px; padding: 16px 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.account__row { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 240px; }
.account__icon { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.account__icon--ok { background: var(--blue-soft); color: var(--blue-text); }
.account__icon--gold { background: var(--gold-soft, rgba(245, 185, 58, .16)); color: var(--gold-text, #F5B93A); }
.account + .account { margin-top: 10px; }
.account__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; }
.account__text strong { font-size: 15px; overflow-wrap: anywhere; }
.account__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.account__actions .btn, .account__btn { height: 44px; }

.notion-dialog__cat { font-size: 13px; font-weight: 700; color: var(--blue-text); }
.notion-dialog__def { font-size: 17px; line-height: 1.55; }
.notion-dialog__ex { padding: 14px 16px; border-radius: 14px; background: var(--surface-2); font-size: 15px; line-height: 1.5; }
.notion-dialog__src { font-size: 13px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop);
  font-weight: 700; color: var(--text);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast--gold { color: var(--gold-text); }

/* =========================================================
   Animations
   ========================================================= */
@keyframes ring { 0% { transform: scale(.92); opacity: .55; } 70% { transform: scale(1.12); opacity: 0; } 100% { opacity: 0; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes float { 0%, 100% { transform: translate(258px, 12px) scale(1.5); } 50% { transform: translate(258px, 4px) scale(1.5); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.03); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes hop { 0% { transform: translateY(16px) scale(.92); } 50% { transform: translateY(-8px) scale(1.04); } 100% { transform: none; } }
@keyframes glow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.12); } }
@keyframes dialogIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); padding-bottom: 76px; }
  .sidebar {
    position: fixed; inset: auto 0 0 0; z-index: 50; height: auto;
    flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--divider);
  }
  .sidebar__logo { display: none; }
  .nav { flex: 1; flex-direction: row; justify-content: space-around; gap: 2px; }
  .nav__link { flex: 1; flex-direction: column; justify-content: center; gap: 3px; min-height: 58px; padding: 4px 2px; font-size: 11px; }
  .nav__dot { position: absolute; margin: 0 0 0 22px; transform: translateY(-14px); }
  .nav__link { position: relative; }
  .topbar { padding: 14px 16px; }
  .topbar__logo { display: block; border-radius: 8px; }
  .topbar__logo .logo { height: 34px; }
  .topbar__title { font-size: 1.375rem; }
  .page { padding: 20px 16px 32px; }
  .parcours__side { position: static; }
  .lesson__header { padding: 14px 16px; }
  .lesson__main { padding: 16px 16px 28px; gap: 24px; }
  .lesson__visual { padding: 16px 16px 10px; }
  .feedback__inner { padding: 18px 16px; }
  .feedback__inner .btn { width: 100%; }
  .result { padding: 32px 16px; align-items: flex-start; }
  .result__title { font-size: 2.125rem; }
  .streak-card, .league-card, .recap { padding: 22px; }
  .week__dot { width: 34px; height: 34px; }
  .toast { bottom: 92px; }
}
@media (max-width: 520px) {
  .badges, .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .node__label { width: 140px; margin-left: -70px; font-size: 13px; }
  .speech__bubble { font-size: 1.125rem; }
  .quest { gap: 12px; padding: 16px; }
  .quest__side, .quest__claim { width: 84px; }
  .topbar__logo { display: none; }
}

/* =========================================================
   Intégration du programme complet (11 chapitres, widgets)
   ========================================================= */

/* ---------- Mascotte animée ---------- */
.mascot { flex: none; overflow: visible; }
.mascot__body { animation: m-bounce 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
.mascot__eye { animation: m-blink 4.2s infinite; transform-box: fill-box; transform-origin: center; }
.mascot--happy .mascot__body { animation: m-jump .5s ease 2, m-bounce 2.4s ease-in-out 1s infinite; }
.mascot--sad .mascot__body { animation: m-shake .4s ease 2; }
@keyframes m-bounce { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-3px) rotate(-2deg); } }
@keyframes m-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes m-jump { 50% { transform: translateY(-12px) scale(1.04); } }
@keyframes m-shake { 25% { transform: rotate(-7deg); } 75% { transform: rotate(7deg); } }

/* ---------- Navigation : compteur de nouvelles notions ---------- */
.nav__count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: var(--on-gold); font-family: 'Fredoka', sans-serif; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.dialog__fine { font-size: 12px; line-height: 1.45; color: var(--muted); }

/* ---------- Leçon ---------- */
.lesson-loading { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; color: var(--muted); padding: 32px; }
.lesson__main--flow { align-items: flex-start; justify-content: center; }
.lesson__col { width: 100%; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.lesson__main--flow.is-in .lesson__col { animation: lessonIn .28s ease; }
@keyframes lessonIn { from { transform: translateX(16px); } to { transform: none; } }
.lesson__eyebrow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lesson__title { color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 600; }
.retry-tag { display: inline-flex; align-items: center; gap: 5px; color: var(--gold-text); }
.speech__bubble { font-size: 1.125rem; }
.speech__bubble strong, .speech__bubble b { color: var(--blue-text); font-weight: 600; }
.lesson__ef { width: 100%; }
.lesson__ef > .vis, .lesson__ef > .sim { width: 100%; }
.choice.is-selected { border-color: var(--blue-bright); background: var(--blue-soft); color: var(--text); }
.choice.is-selected .choice__key { border-color: var(--blue-bright); color: var(--blue-text-2); }
.choices--two { flex-direction: row; }
.choices--two .choice { flex: 1; justify-content: center; }
.choice__text b, .choice__text strong { color: inherit; }
.feedback__hint { display: flex; align-items: center; gap: 8px; }
.feedback__text b { color: inherit; }

/* ---------- Fin de leçon ---------- */
.kpi__value--small { font-size: 24px; padding-top: 6px; }
.flag--gold { background: var(--gold-soft); color: var(--gold-text); }
.recap__list { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 10px; font-size: 17px; line-height: 1.55; }
.recap__list b, .recap__list strong { color: var(--blue-text); }
.result__inner--narrow { max-width: 640px; }
.comeback__text { font-size: 17px; line-height: 1.6; color: var(--muted); }
.comeback__next { padding: 18px 20px; border-radius: 18px; display: flex; flex-direction: column; gap: 6px; }
.comeback__title { font-size: 1.25rem; }
.comeback__timer .num { font-size: 16px; letter-spacing: .5px; }

@media (max-width: 860px) {
  .choices--two { flex-direction: column; }
  .speech__bubble { font-size: 1.0625rem; }
}

/* ---------- Parcours : chapitres, nœuds-boutons, fiche des mini-leçons ---------- */
.chapter { display: flex; flex-direction: column; gap: 16px; }
.chapter + .chapter { margin-top: 12px; }
.banner__side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex: none; }
.banner__toggle { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.14); color: #FFFFFF; font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; }
.banner__toggle:hover { background: rgba(255,255,255,.22); }
.banner__toggle svg { transition: transform .2s ease; }
.banner__toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.banner--done, .banner--open, .banner--locked { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.banner--done .banner__eyebrow, .banner--open .banner__eyebrow, .banner--locked .banner__eyebrow { color: var(--muted); }
.banner--done .banner__title, .banner--open .banner__title, .banner--locked .banner__title { color: var(--text); }
.banner--done .banner__text, .banner--open .banner__text, .banner--locked .banner__text { color: var(--muted); }
.banner--done .banner__toggle, .banner--open .banner__toggle, .banner--locked .banner__toggle { border-color: var(--border); background: var(--surface-2); color: var(--text); }
.banner--locked { opacity: .78; }
.banner__hint { font-weight: 700; }
.banner .tag { gap: 5px; }

button.node { border: 0; padding: 0; font: inherit; cursor: pointer; }
button.node:hover { transform: translateY(-2px); }
button.node:active { transform: translateY(6px); }
button.node--done:active { box-shadow: inset 0 3px 0 rgba(255,255,255,0.55), inset 0 -7px 0 rgba(120,70,0,0.28), 0 3px 0 #9C6C06, 0 6px 10px rgba(0,0,0,0.3); }
button.node--current:active { box-shadow: inset 0 3px 0 rgba(255,255,255,0.5), inset 0 -7px 0 rgba(10,30,110,0.35), 0 3px 0 #163A9E, 0 6px 12px rgba(42,98,240,0.4); }
button.node--locked:active { transform: translateY(3px); }
.node__medal { position: absolute; right: 0; bottom: 2px; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--bg); box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.node__bubble--wait { color: var(--muted); }
.node--chest-done { background: radial-gradient(circle at 34% 26%, #FFE7A3 0%, #F8C24A 40%, #D18F12 100%); box-shadow: inset 0 3px 0 rgba(255,255,255,0.5), 0 9px 0 #9C6C06, 0 16px 22px rgba(0,0,0,0.35); color: #5A3A00; }

.dialog--sheet { width: min(580px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
.sheet { gap: 16px; }
.sheet__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet__head .dialog__title { margin-top: 4px; }
.sheet__head .icon-btn { margin: -6px -10px 0 0; }
.sheet__sub { margin-top: 6px; font-size: 14px; color: var(--muted); }
.sheet__note { display: flex; align-items: flex-start; gap: 8px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); color: var(--muted); font-size: 14px; line-height: 1.45; }
.sheet__note svg { flex: none; margin-top: 1px; }
.sheet__note--ok { background: var(--gold-soft); color: var(--gold-text); font-weight: 600; }
.sheet__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sheet__item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); }
.sheet__item--next { border-color: var(--blue); background: var(--blue-soft); }
.sheet__item--locked { opacity: .62; }
.sheet__icon { flex: none; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--muted); }
.sheet__item--done .sheet__icon { background: var(--gold-soft); color: var(--gold-text); }
.sheet__item--next .sheet__icon { background: var(--blue); color: #FFFFFF; }
.sheet__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sheet__name { font-weight: 700; font-size: 15px; line-height: 1.35; }
.sheet__name .num { color: var(--muted); font-size: 13px; margin-right: 2px; }
.sheet__meta { font-size: 13px; color: var(--muted); }
.sheet__btn { flex: none; height: 40px; padding: 0 16px; font-size: 14px; }
.sheet__lock { flex: none; color: var(--muted); padding: 0 8px; }

@media (max-width: 860px) {
  .banner { flex-wrap: wrap; padding: 20px; }
  .banner__side { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .sheet__item { flex-wrap: wrap; }
  .sheet__btn { margin-left: 46px; }
}

/* ---------- Quêtes : principe bonus ---------- */
.quest__icon { flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--gold-soft); color: var(--gold-text); display: flex; align-items: center; justify-content: center; }
.quest--bonus.quest--ready .quest__icon { background: var(--green-soft); color: var(--green-text); }
.quest__text { font-size: 14px; line-height: 1.45; color: var(--muted); }

/* ---------- Classement : ligues ---------- */
.league-result { margin-bottom: 20px; max-width: 1100px; }
.ladder { list-style: none; margin: 6px 0 0; padding: 0; width: 100%; display: flex; justify-content: space-between; gap: 6px; }
.ladder__step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--muted); opacity: .55; }
.ladder__step.is-past { opacity: .8; }
.ladder__step.is-current { opacity: 1; color: var(--text); }
.league-card__fine { font-size: 12px; line-height: 1.45; color: var(--muted); border-top: 1px solid var(--border); padding-top: 12px; width: 100%; }
.ranking { max-height: none; }

/* ---------- Bibliothèque : sections et chapitres à venir ---------- */
.lib .filters { margin-top: -8px; }
.lib__section { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 1.125rem; margin: 8px 0 12px; display: flex; align-items: center; gap: 8px; }
.lib__section span { font-family: Nunito, sans-serif; font-size: 13px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
#notions > .notions + .lib__section, #notions > .lib__later { margin-top: 20px; }
#notions > .empty + .lib__section { margin-top: 20px; }
.notions--compact { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.notions--compact .notion--locked { padding: 12px 16px; }
.lib__later { display: flex; flex-direction: column; gap: 10px; }
.later { border-radius: 16px; padding: 0; }
.later summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; cursor: pointer; font-weight: 700; }
.later summary::-webkit-details-marker { display: none; }
.later__count { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.later__count svg { transition: transform .2s ease; }
.later[open] .later__count svg { transform: rotate(90deg); }
.later__hint { display: flex; align-items: center; gap: 6px; padding: 0 18px; font-size: 13px; color: var(--muted); }
.later__list { list-style: none; margin: 0; padding: 12px 18px 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.later__list li { font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 999px; border: 1px dashed var(--border); color: var(--muted); }

/* ---------- Profil : badges de chapitre ---------- */
.badge__num { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 22px; }
.flags--stack { flex-direction: column; }
.flags--stack .flag { flex: none; }
@media (max-width: 860px) {
  .nav__count { position: absolute; top: 2px; left: 50%; margin-left: 6px; min-width: 20px; height: 18px; font-size: 11px; }
}
@media (max-width: 520px) {
  .node__bubble { display: none; }
}

/* ---------- Révisions espacées ---------- */
.review-intro { display: flex; align-items: center; gap: 18px; padding: 20px 22px; border-radius: 20px; }
.review-intro__count { font-size: 56px; line-height: 1; color: var(--gold-text); }
.review-intro__title { font-weight: 700; font-size: 17px; margin-bottom: 2px; }
.review-intro__rule { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.review-intro__rule svg { flex: none; margin-top: 2px; }
.review-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.review-list__item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; }
.review-list__item svg { flex: none; }
.review-list__item--ok svg { color: var(--green-text); }
.review-list__item--ko svg { color: var(--red-text); }
.review-list__name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-list__when { flex: none; font-size: 13px; color: var(--muted); }
.review-list__item--ko .review-list__when { color: var(--red-text); font-weight: 700; }
.side-card__btn { align-self: flex-start; height: 40px; padding: 0 16px; font-size: 14px; }

/* =========================================================
   Animations (pilotées par assets/js/motion.js)
   Sans JavaScript ou avec « réduire les animations », rien n'est caché ni animé.
   ========================================================= */
.reveal-ready [data-reveal] {
  opacity: 0; translate: 0 16px;
  transition: opacity .6s cubic-bezier(.2,.7,.2,1), translate .6s cubic-bezier(.2,.7,.2,1), scale .5s cubic-bezier(.2,.7,.2,1);
  transition-delay: var(--d, 0ms);
}
.reveal-ready [data-reveal="pop"] { translate: none; scale: .86; }
.reveal-ready [data-reveal="fade"] { translate: none; }
.reveal-ready [data-reveal].is-in { opacity: 1; translate: none; scale: none; }

/* Gain d'XP : la pastille rebondit et un « +10 » s'envole */
.stat { position: relative; }
.is-bump { animation: bump .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes bump { 40% { scale: 1.14; } 100% { scale: 1; } }
.float-gain { position: absolute; right: 4px; top: -6px; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 13px; color: var(--gold-text); pointer-events: none; animation: floatGain .9s ease-out forwards; }
@keyframes floatGain { from { opacity: 1; translate: 0 0; } to { opacity: 0; translate: 0 -24px; } }

/* Micro-interactions au survol (uniquement avec une souris) */
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled) { transition: transform .08s ease, box-shadow .08s ease, filter .15s ease, translate .15s ease; }
  .btn:not(:disabled):hover { translate: 0 -1px; }
  a.stat { transition: border-color .15s ease, translate .15s ease; }
  a.stat:hover { translate: 0 -1px; }
  .nav__link svg { transition: translate .2s ease; }
  .nav__link:hover svg { translate: 2px 0; }
  .filter { transition: background .15s ease, border-color .15s ease, color .15s ease, translate .15s ease; }
  .filter:hover { translate: 0 -1px; }
  a.pill { transition: filter .15s ease, translate .15s ease; }
  a.pill:hover { translate: 0 -1px; }
  .badge__icon { transition: rotate .35s cubic-bezier(.3,1.6,.5,1), scale .35s cubic-bezier(.3,1.6,.5,1); }
  .badge--earned:hover .badge__icon { rotate: -8deg; scale: 1.08; }
  .choice .choice__key { transition: border-color .12s ease, color .12s ease; }
  .choice:hover:not(:disabled) .choice__key { border-color: var(--blue-bright); color: var(--blue-text-2); }
  .sheet__item { transition: border-color .15s ease; }
  .sheet__item--done:hover, .sheet__item--next:hover { border-color: var(--blue-bright); }
  .rank { border-radius: 12px; transition: background .15s ease; }
  .rank:not(.rank--me):hover { background: var(--surface-2); }
  .quest--ready { transition: box-shadow .2s ease; }
  .quest--ready:hover { box-shadow: 0 0 0 4px var(--green-soft); }
  .node__label { transition: color .15s ease; }
  button.node:hover + .node__label { color: var(--blue-text-2); }
  .banner__toggle { transition: background .15s ease, translate .15s ease; }
  .banner__toggle:hover { translate: 0 -1px; }
}

/* ---------- Profil : réglages ajoutés et liens légaux ---------- */
.setting__note { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.setting__note svg { color: var(--green-text); }
.profile__legal { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.profile__legal a { color: var(--muted); text-decoration: none; }
.profile__legal a:hover { color: var(--text); text-decoration: underline; }
