/* =========================================================
   Ahouéfa — application d'éloquence
   Design inspiré de Duolingo : boutons en relief, couleurs vives,
   parcours en zigzag. Couleurs dans les variables ci-dessous.
   ========================================================= */

:root {
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --bg: #FFFFFF;
  --bg-soft: #F8F5FD;
  --surface: #FFFFFF;
  --surface-2: #F6F2FF;
  --line: #E8E2F0;
  --line-strong: #D8CFE5;
  --text: #3B2E4A;
  --text-soft: #75698A;
  --text-faint: #A398B3;
  --primary: #8A3FFC;
  --primary-dark: #6929C4;
  --primary-soft: #F1E8FF;
  --primary-line: #D4BBFF;
  --primary-text: #6E2BD9;
  --green: #58CC02;
  --green-dark: #46A302;
  --green-soft: #D7FFB8;
  --green-text: #3D8B00;
  --red: #FF4B4B;
  --red-dark: #EA2B2B;
  --red-soft: #FFDFE0;
  --red-text: #D32C2C;
  --gold: #FFC800;
  --gold-dark: #E5A400;
  --orange: #FF9600;
  --blue: #1CB0F6;
  --blue-dark: #1899D6;
  --pink: #FF4B91;
  --locked: #E5E0EB;
  --locked-dark: #CEC5DA;
  --locked-icon: #AA9FBA;
  --overlay: rgba(28, 15, 48, .55);
  --radius: 16px;
  --side-w: 256px;
  --top-h: 0px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15101C; --bg-soft: #1C1626; --surface: #1C1626; --surface-2: #251D31;
    --line: #342A42; --line-strong: #443757; --text: #F2ECFA; --text-soft: #B6A9C8; --text-faint: #7F7392;
    --primary: #9D5CFF; --primary-dark: #6D28D9; --primary-soft: #2C1F43; --primary-line: #5A3D8C; --primary-text: #C9A6FF;
    --green-soft: #1C3510; --green-text: #7BE33C; --red-soft: #3B171C; --red-text: #FF7D7D;
    --locked: #2C2438; --locked-dark: #211A2B; --locked-icon: #605472; --overlay: rgba(0, 0, 0, .65);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15101C; --bg-soft: #1C1626; --surface: #1C1626; --surface-2: #251D31;
  --line: #342A42; --line-strong: #443757; --text: #F2ECFA; --text-soft: #B6A9C8; --text-faint: #7F7392;
  --primary: #9D5CFF; --primary-dark: #6D28D9; --primary-soft: #2C1F43; --primary-line: #5A3D8C; --primary-text: #C9A6FF;
  --green-soft: #1C3510; --green-text: #7BE33C; --red-soft: #3B171C; --red-text: #FF7D7D;
  --locked: #2C2438; --locked-dark: #211A2B; --locked-icon: #605472; --overlay: rgba(0, 0, 0, .65);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 800; }
p { margin: 0 0 .6em; }
button { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--primary-text); }
strong { font-weight: 800; }
img, svg { display: block; }
.ic { width: 1em; height: 1em; flex: none; display: inline-block; vertical-align: middle; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--primary-line); outline-offset: 2px; border-radius: 12px; }
.btn:focus-visible { outline-offset: 3px; border-radius: 16px; }
.muted { color: var(--text-soft); }
.small { font-size: 14px; }
.center { text-align: center; }
.hidden { display: none !important; }
mark { background: transparent; color: inherit; }
mark.filler { background: var(--red-soft); color: var(--red-text); border-radius: 6px; padding: 0 3px; font-weight: 800; }

/* ---------- Boutons en relief ---------- */
.btn {
  --b: var(--primary); --s: var(--primary-dark); --t: #fff;
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 20px;
  border-radius: 16px;
  background: var(--b); color: var(--t);
  box-shadow: 0 4px 0 var(--s);
  font-weight: 800; font-size: 15px; letter-spacing: .06em; text-transform: uppercase;
  transition: transform .06s, box-shadow .06s, filter .15s, opacity .15s;
  user-select: none; -webkit-user-select: none;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--s); }
.btn[disabled], .btn.is-disabled {
  --b: var(--locked); --s: var(--locked-dark); --t: var(--locked-icon);
  cursor: default; filter: none;
}
.btn[disabled]:active { transform: none; box-shadow: 0 4px 0 var(--s); }
.btn.block { width: 100%; }
.btn.green { --b: var(--green); --s: var(--green-dark); }
.btn.red { --b: var(--red); --s: var(--red-dark); }
.btn.gold { --b: var(--gold); --s: var(--gold-dark); --t: #4A3500; }
.btn.blue { --b: var(--blue); --s: var(--blue-dark); }
.btn.ghost {
  --b: var(--surface); --s: var(--line); --t: var(--primary-text);
  border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line);
}
.btn.ghost:active { box-shadow: 0 0 0 var(--line); }
.btn.flat {
  background: transparent; box-shadow: none; color: var(--primary-text); min-height: 44px; padding: 8px 12px;
}
.btn.flat:active { transform: none; }
.btn.sm { min-height: 40px; padding: 8px 14px; font-size: 13px; border-radius: 12px; box-shadow: 0 3px 0 var(--s); }
.btn.ghost.sm { box-shadow: 0 3px 0 var(--line); }
.btn .ic { width: 20px; height: 20px; }
.btn.icon-only { width: 50px; padding: 0; }

.icon-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  color: var(--text-faint);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text-soft); }
.icon-btn .ic { width: 24px; height: 24px; }

/* ---------- Mascotte ---------- */
.ah { display: block; overflow: visible; max-width: 100%; height: auto; }
.ah .ah-brows, .ah .ah-eyes-happy, .ah .ah-mouth, .ah .ah-arms-up { display: none; }
.ah .ah-brows-n, .ah .ah-m-smile { display: inline; }
.ah .ah-arm-l { transform: rotate(8deg); }
.ah .ah-arm-r { transform: rotate(-8deg); }
.ah .ah-eyes-open { transform-box: fill-box; transform-origin: center; animation: ah-blink 5s infinite; }
@keyframes ah-blink { 0%, 93%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }
.ah .ah-all { animation: ah-bob 3.2s ease-in-out infinite; }
@keyframes ah-bob { 50% { transform: translateY(-3px); } }
.ah[data-mood=talk] .ah-m-smile { display: none; }
.ah[data-mood=talk] .ah-m-talk { display: inline; }
.ah[data-mood=talk] .ah-talk-a { transform-box: fill-box; transform-origin: center; animation: ah-talk .22s ease-in-out infinite alternate; }
@keyframes ah-talk { from { transform: scaleY(.35); } to { transform: scaleY(1); } }
.ah[data-mood=happy] .ah-m-smile, .ah[data-mood=celebrate] .ah-m-smile, .ah[data-mood=wave] .ah-m-smile { display: none; }
.ah[data-mood=happy] .ah-m-grin, .ah[data-mood=celebrate] .ah-m-grin, .ah[data-mood=wave] .ah-m-grin { display: inline; }
.ah[data-mood=happy] .ah-eyes-open, .ah[data-mood=celebrate] .ah-eyes-open { display: none; }
.ah[data-mood=happy] .ah-eyes-happy, .ah[data-mood=celebrate] .ah-eyes-happy { display: inline; }
.ah[data-mood=happy] .ah-all { animation: ah-hop .6s ease-in-out infinite alternate; }
@keyframes ah-hop { to { transform: translateY(-6px); } }
.ah[data-mood=celebrate] .ah-arm-l, .ah[data-mood=celebrate] .ah-arm-r { display: none; }
.ah[data-mood=celebrate] .ah-arms-up { display: inline; }
.ah[data-mood=celebrate] .ah-arm-ul { transform: rotate(150deg); animation: ah-cheer-l .4s ease-in-out infinite alternate; }
.ah[data-mood=celebrate] .ah-arm-ur { transform: rotate(-150deg); animation: ah-cheer-r .4s ease-in-out infinite alternate; }
@keyframes ah-cheer-l { to { transform: rotate(165deg); } }
@keyframes ah-cheer-r { to { transform: rotate(-165deg); } }
.ah[data-mood=celebrate] .ah-all { animation: ah-jump .8s ease-in-out infinite; }
@keyframes ah-jump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-12px); } }
.ah[data-mood=wave] .ah-arm-r { display: none; }
.ah[data-mood=wave] .ah-arms-up { display: inline; }
.ah[data-mood=wave] .ah-arm-ul { display: none; }
.ah[data-mood=wave] .ah-arm-ur { transform: rotate(-150deg); animation: ah-wave .5s ease-in-out infinite alternate; }
@keyframes ah-wave { from { transform: rotate(-135deg); } to { transform: rotate(-165deg); } }
.ah[data-mood=wow] .ah-m-smile, .ah[data-mood=wow] .ah-brows-n { display: none; }
.ah[data-mood=wow] .ah-m-o, .ah[data-mood=wow] .ah-brows-up { display: inline; }
.ah[data-mood=think] .ah-m-smile, .ah[data-mood=think] .ah-brows-n { display: none; }
.ah[data-mood=think] .ah-m-hmm, .ah[data-mood=think] .ah-brows-think { display: inline; }
.ah[data-mood=think] .ah-pupils { transform: translate(4px, -4px); }
.ah[data-mood=sad] .ah-m-smile, .ah[data-mood=sad] .ah-brows-n { display: none; }
.ah[data-mood=sad] .ah-m-sad, .ah[data-mood=sad] .ah-brows-sad { display: inline; }
.ah[data-mood=sad] .ah-pupils { transform: translateY(2px); }
.ah-wrap { display: inline-block; line-height: 0; }

.ah-says { display: flex; align-items: flex-end; gap: 12px; }
.ah-says .ah-wrap { flex: none; }
.bubble {
  position: relative; background: var(--surface); border: 2px solid var(--line); border-radius: 16px;
  padding: 12px 16px; font-weight: 700; font-size: 17px; margin-bottom: 18px;
}
.bubble::before, .bubble::after {
  content: ''; position: absolute; left: -12px; bottom: 18px; border: 10px solid transparent; border-right-color: var(--line); border-left: 0;
}
.bubble::after { left: -9px; border-right-color: var(--surface); }

/* ---------- Structure générale ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
.side {
  position: fixed; top: 0; bottom: 0; left: 0; width: var(--side-w);
  border-right: 2px solid var(--line); background: var(--bg);
  padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 12px 22px; text-decoration: none; color: var(--primary); }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; overflow: hidden; background: var(--primary-soft); display: grid; place-items: end center; }
.brand-mark .ah { width: 40px; height: 48px; margin-bottom: -6px; }
.brand-name { font-size: 28px; font-weight: 900; letter-spacing: -.02em; }
.nav-item {
  display: flex; align-items: center; gap: 16px; padding: 10px 14px; min-height: 52px;
  border-radius: 14px; border: 2px solid transparent; text-decoration: none; color: var(--text-soft);
  font-weight: 800; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; position: relative;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary-text); }
.nav-item .ic { width: 28px; height: 28px; }
.nav-dot { position: absolute; top: 10px; left: 34px; width: 12px; height: 12px; border-radius: 50%; background: var(--red); border: 2px solid var(--bg); }

.main { margin-left: var(--side-w); display: flex; justify-content: center; gap: 48px; padding: 24px 24px 64px; }
.content { width: 100%; max-width: 600px; min-width: 0; }
.aside { width: 340px; flex: none; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 24px; align-self: flex-start; }

.topbar { display: none; }
.bottomnav { display: none; }

@media (max-width: 1180px) { .aside { display: none; } }
@media (max-width: 1023px) {
  :root { --side-w: 88px; }
  .side { padding: 24px 12px; align-items: center; }
  .brand-name, .nav-item .nav-lbl { display: none; }
  .brand { padding: 0 0 22px; }
  .nav-item { justify-content: center; padding: 10px; }
}
@media (max-width: 767px) {
  :root { --side-w: 0px; --top-h: 60px; }
  .side { display: none; }
  .main { padding: 0 16px 100px; }
  .topbar {
    display: flex; position: sticky; top: 0; z-index: 20; height: var(--top-h);
    align-items: center; justify-content: space-between; gap: 8px;
    background: var(--bg); border-bottom: 2px solid var(--line); padding: 0 12px;
  }
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--bg); border-top: 2px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .bottomnav .nav-item { flex-direction: column; gap: 0; padding: 6px; min-height: 52px; width: 64px; justify-content: center; border-radius: 12px; }
  .bottomnav .nav-item .nav-lbl { display: none; }
  .bottomnav .nav-dot { left: 38px; top: 6px; }
}

/* Statistiques (barre du haut et colonne de droite) */
.stats { display: flex; align-items: center; gap: 4px; }
.stat {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 12px;
  font-weight: 800; font-size: 16px; background: none; border: 0; cursor: pointer; color: var(--text-soft); text-decoration: none;
}
.stat:hover { background: var(--surface-2); }
.stat .ic { width: 26px; height: 26px; }
.stat.flame { color: var(--orange); }
.stat.flame.off { color: var(--text-faint); }
.stat.gem { color: #A855F7; }
.stat.lvl { color: var(--primary-text); }
.lvl-badge {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 10px;
  background: var(--primary); color: #fff; font-size: 15px; font-weight: 900; box-shadow: 0 3px 0 var(--primary-dark);
}

/* ---------- Cartes ---------- */
.card { border: 2px solid var(--line); border-radius: var(--radius); padding: 20px; background: var(--surface); }
.card h3 { font-size: 20px; margin-bottom: 12px; }
.card-row { display: flex; align-items: center; gap: 14px; }
.card + .card { margin-top: 16px; }
.section-title { font-size: 24px; font-weight: 900; margin: 8px 0 16px; }
.page-head { display: flex; align-items: center; gap: 16px; margin: 20px 0 24px; }
.page-head h1 { font-size: 28px; font-weight: 900; }
.page-head .ah-wrap { flex: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; background: var(--surface-2); color: var(--text-soft); }

.bar { height: 16px; border-radius: 999px; background: var(--line); overflow: hidden; position: relative; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--gold); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.bar > i::after { content: ''; position: absolute; left: 8px; right: 8px; top: 4px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .35); }
.bar.purple > i { background: var(--primary); }
.bar.green > i { background: var(--green); }
.bar-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 900; color: var(--text); text-shadow: 0 0 3px var(--bg), 0 0 2px var(--bg), 0 0 1px var(--bg); }

/* ---------- Parcours ---------- */
.unit { margin-bottom: 12px; }
.unit-banner {
  position: sticky; top: calc(var(--top-h) + 12px); z-index: 6;
  background: var(--uc); color: #fff; border-radius: 16px; padding: 16px 16px 16px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  box-shadow: 0 4px 0 var(--ud);
  margin-top: 12px;
}
.unit-banner h2 { font-size: 21px; font-weight: 900; }
.unit-banner .over { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.unit-banner .desc { font-size: 15px; font-weight: 700; opacity: .92; margin-top: 2px; }
.unit-guide {
  appearance: none; cursor: pointer; flex: none;
  border: 2px solid rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .08); color: #fff;
  border-radius: 14px; padding: 10px 12px; font-weight: 800; font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 3px 0 rgba(0, 0, 0, .15);
}
.unit-guide .ic { width: 20px; height: 20px; }
.unit-guide:hover { background: rgba(255, 255, 255, .16); }

.path { position: relative; display: flex; flex-direction: column; align-items: center; padding: 84px 0 28px; }
.node-wrap { position: relative; margin: 9px 0; display: flex; justify-content: center; z-index: 1; }
.node-wrap.has-pop { z-index: 30; }
.node-wrap.is-current { margin-top: 80px; }
.node-wrap.is-current:first-child { margin-top: 9px; }
.node {
  position: relative; width: 74px; height: 68px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--uc); color: #fff; box-shadow: 0 8px 0 var(--ud);
  display: grid; place-items: center; transition: transform .08s, box-shadow .08s;
}
.node .ic { width: 34px; height: 34px; }
.node:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--ud); }
.node::after { /* reflet */
  content: ''; position: absolute; top: 9px; left: 15px; width: 18px; height: 9px; border-radius: 50%;
  background: rgba(255, 255, 255, .28); transform: rotate(-25deg);
}
.node.locked { background: var(--locked); box-shadow: 0 8px 0 var(--locked-dark); color: var(--locked-icon); }
.node.locked::after { display: none; }
.node.done { background: var(--uc); }
.node.current { outline: 0; }
.node-ring {
  position: absolute; width: 98px; height: 98px; border-radius: 50%; top: -12px; left: 50%; margin-left: -49px;
  border: 7px solid var(--line); pointer-events: none;
}
.node-wrap.is-current .node-ring { border-color: color-mix(in srgb, var(--uc) 28%, var(--bg)); animation: ring-breathe 2.4s ease-in-out infinite; }
@keyframes ring-breathe { 50% { transform: scale(1.06); border-color: color-mix(in srgb, var(--uc) 42%, var(--bg)); } }
.node.chest-node, .node.review-node { background: transparent; box-shadow: none; width: 80px; height: 76px; }
.node.chest-node::after, .node.review-node::after { display: none; }
.node.chest-node .ic { width: 76px; height: 70px; }
.node.chest-node.locked .ch-a { fill: var(--locked); }
.node.chest-node.locked .ch-b { fill: var(--locked-dark); }
.node.chest-node.locked .ch-c, .node.chest-node.locked .ch-k { fill: var(--locked-icon); }
.node.chest-node.locked .ch-d { fill: var(--surface-2); }
.node.chest-node.locked .ch-h { stroke: #fff; opacity: .6; }
.node.chest-node.open .ic { animation: chest-wiggle 2.4s ease-in-out infinite; }
@keyframes chest-wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-8deg); } 90% { transform: rotate(8deg); } 95% { transform: rotate(-4deg); } }
.node.review-node { background: var(--uc); box-shadow: 0 8px 0 var(--ud); border-radius: 50%; width: 80px; height: 74px; }
.node.review-node.locked { background: var(--locked); box-shadow: 0 8px 0 var(--locked-dark); }
.node.review-node.done { background: var(--gold); box-shadow: 0 8px 0 var(--gold-dark); overflow: hidden; }
.node.review-node.done::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .55) 50%, transparent 65%) -120% 0 / 250% 100% no-repeat; animation: shine 3.5s ease-in-out infinite; }
@keyframes shine { 60%, 100% { background-position: 120% 0; } }
.node.review-node .ic { width: 38px; height: 38px; }

.start-bubble {
  position: absolute; bottom: calc(100% + 20px); left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 2px solid var(--line); color: var(--uc);
  padding: 10px 14px; border-radius: 14px; font-weight: 900; font-size: 15px; letter-spacing: .06em; text-transform: uppercase;
  white-space: nowrap; animation: bubble-bounce 1.6s ease-in-out infinite; pointer-events: none; z-index: 2;
}
.start-bubble::after {
  content: ''; position: absolute; top: 100%; left: 50%; margin-left: -9px; border: 9px solid transparent; border-top-color: var(--line);
}
.start-bubble::before {
  content: ''; position: absolute; top: 100%; left: 50%; margin-left: -7px; margin-top: -3px; border: 7px solid transparent; border-top-color: var(--surface); z-index: 1;
}
@keyframes bubble-bounce { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -6px); } }

.path-mascot { position: absolute; pointer-events: none; }
.path-mascot .ah { width: 120px; height: 144px; }

.popover {
  position: absolute; top: calc(100% + 18px); left: 50%; transform: translateX(calc(-50% - var(--px, 0px)));
  width: min(320px, calc(100vw - 32px)); z-index: 10;
  background: var(--uc); color: #fff; border-radius: 16px; padding: 18px; text-align: left;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
  animation: pop-in .18s ease-out;
}
.popover::before {
  content: ''; position: absolute; bottom: 100%; left: calc(50% + var(--px, 0px)); margin-left: -10px; border: 10px solid transparent; border-bottom-color: var(--uc);
}
.popover.locked { background: var(--surface); color: var(--text-soft); border: 2px solid var(--line); }
.popover.locked::before { border-bottom-color: var(--line); }
.popover h3 { font-size: 19px; font-weight: 900; margin-bottom: 4px; }
.popover p { font-weight: 700; opacity: .92; margin-bottom: 14px; }
.popover .btn { --b: #fff; --s: rgba(0, 0, 0, .18); --t: var(--uc); width: 100%; }
.popover.locked .btn { --b: var(--locked); --s: var(--locked-dark); --t: var(--locked-icon); }
@keyframes pop-in { from { opacity: 0; margin-top: -6px; } to { opacity: 1; margin-top: 0; } }

.path-end { text-align: center; padding: 24px 0 40px; color: var(--text-soft); font-weight: 700; }

/* ---------- Colonne de droite ---------- */
.aside .card { padding: 18px 20px; }
.aside h3 { font-size: 19px; display: flex; align-items: center; justify-content: space-between; }
.aside h3 a { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; text-decoration: none; }
.goal-row { display: flex; align-items: center; gap: 14px; }
.goal-row .ic { width: 40px; height: 40px; }
.goal-row .bar { flex: 1; }
.quest-mini { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.quest-mini > span:first-child .ic { width: 30px; height: 30px; color: var(--primary); }
.quest-mini > span:last-child .ic { width: 24px; height: 24px; }
.quest-mini .grow { flex: 1; min-width: 0; }
.quest-mini .t { font-weight: 800; font-size: 15px; margin-bottom: 6px; }
.word-card .w { font-size: 26px; font-weight: 900; color: var(--primary-text); }
.word-card .d { font-weight: 700; margin: 4px 0 8px; }
.word-card .ex { color: var(--text-soft); font-style: italic; font-size: 15px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; font-weight: 800; color: var(--text-faint); padding: 0 8px; }
.footer-links a { color: inherit; text-decoration: none; }

/* ---------- Leçon ---------- */
.lesson {
  position: fixed; inset: 0; z-index: 40; background: var(--bg);
  display: flex; flex-direction: column;
}
.lesson-top { width: 100%; max-width: 1040px; margin: 0 auto; padding: 18px 20px 6px; display: flex; align-items: center; gap: 14px; }
.lesson-progress { flex: 1; height: 16px; background: var(--line); border-radius: 999px; overflow: hidden; position: relative; }
.lesson-progress > i {
  position: absolute; left: 0; top: 0; bottom: 0; background: var(--primary); border-radius: 999px;
  transition: width .5s cubic-bezier(.2, .9, .3, 1.2); min-width: 16px;
}
.lesson-progress > i::after { content: ''; position: absolute; left: 8px; right: 8px; top: 4px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .3); }
.combo { font-weight: 900; color: var(--orange); font-size: 15px; display: flex; align-items: center; gap: 2px; min-width: 44px; justify-content: flex-end; }
.combo .ic { width: 22px; height: 22px; }
.combo.pop { animation: combo-pop .4s; }
@keyframes combo-pop { 50% { transform: scale(1.35); } }

.lesson-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.lesson-inner { max-width: 620px; margin: 0 auto; padding: 18px 20px 32px; min-height: 100%; display: flex; flex-direction: column; }
.step { display: flex; flex-direction: column; gap: 18px; animation: step-in .28s ease-out; }
@keyframes step-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.step-title { font-size: 25px; font-weight: 900; line-height: 1.25; }
.step-sub { color: var(--text-soft); font-weight: 700; margin-top: -8px; }
.tag-new { display: inline-flex; align-items: center; gap: 6px; color: var(--primary-text); font-weight: 900; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.tag-new .ic { width: 18px; height: 18px; }

.lesson-foot { border-top: 2px solid var(--line); background: var(--bg); transition: background .2s; }
.lesson-foot-in { max-width: 1040px; margin: 0 auto; padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 104px; }
.lesson-foot .btn { min-width: 160px; }
.lesson-foot.ok { background: var(--green-soft); border-top-color: transparent; }
.lesson-foot.ko { background: var(--red-soft); border-top-color: transparent; }
.feedback { display: flex; align-items: center; gap: 16px; min-width: 0; animation: fb-in .25s ease-out; }
@keyframes fb-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.fb-icon { width: 64px; height: 64px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex: none; }
.ok .fb-icon { color: var(--green); }
.ko .fb-icon { color: var(--red); }
.fb-icon .ic { width: 34px; height: 34px; }
.fb-title { font-size: 22px; font-weight: 900; }
.ok .fb-title, .ok .fb-text { color: var(--green-text); }
.ko .fb-title, .ko .fb-text { color: var(--red-text); }
.fb-text { font-weight: 700; font-size: 15px; margin-top: 2px; }
.fb-text strong { font-weight: 900; }

@media (max-width: 640px) {
  .lesson-top { padding: 14px 14px 4px; gap: 10px; }
  .lesson-inner { padding: 12px 16px 24px; }
  .step-title { font-size: 22px; }
  .lesson-foot-in { flex-direction: column; align-items: stretch; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); min-height: 0; gap: 12px; }
  .lesson-foot .btn { width: 100%; }
  .lesson-foot .btn.flat { order: 2; }
  .lesson-foot .foot-alt { order: 2; display: flex; justify-content: center; gap: 8px; }
  .lesson-foot .foot-alt .btn { width: auto; min-width: 0; flex: 0 1 auto; white-space: nowrap; padding: 10px 12px; font-size: 14px; letter-spacing: .04em; }
  .lesson-foot .foot-alt { justify-content: space-evenly; }
  .fb-icon { display: none; }
  .fb-title { font-size: 20px; }
  .feedback { align-items: flex-start; }
}

/* Choix multiples */
.choices { display: grid; gap: 12px; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choice {
  appearance: none; cursor: pointer; text-align: left; width: 100%;
  background: var(--surface); color: var(--text);
  border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 14px;
  padding: 14px 16px; font-weight: 700; font-size: 17px; line-height: 1.35;
  display: flex; align-items: center; gap: 14px; transition: background .12s, border-color .12s, transform .06s;
}
.choice:hover { background: var(--surface-2); }
.choice:active { transform: translateY(2px); border-bottom-width: 2px; margin-bottom: 2px; }
.choice .key {
  flex: none; width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--line);
  display: grid; place-items: center; font-size: 14px; font-weight: 900; color: var(--text-faint);
}
.choice.sel { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary-text); }
.choice.sel .key { border-color: var(--primary-line); color: var(--primary-text); }
.choice.right { background: var(--green-soft); border-color: var(--green); color: var(--green-text); }
.choice.right .key { border-color: var(--green); color: var(--green-text); }
.choice.wrong { background: var(--red-soft); border-color: var(--red); color: var(--red-text); }
.choice.wrong .key { border-color: var(--red); color: var(--red-text); }
.choice[disabled] { cursor: default; }
.choice.big { justify-content: center; text-align: center; font-size: 20px; font-weight: 900; padding: 24px 12px; flex-direction: column; gap: 6px; }
.choice.big .ic { width: 34px; height: 34px; }
@media (max-width: 640px) { .choice .key { display: none; } .choice { font-size: 16px; padding: 13px 14px; } }

.quote-card {
  background: var(--surface-2); border-radius: 14px; padding: 16px 18px; border-left: 5px solid var(--primary);
  font-size: 18px; font-weight: 700; line-height: 1.45;
}
.quote-card .who { display: block; margin-top: 8px; font-size: 14px; color: var(--text-soft); font-weight: 800; }

/* Texte à trou */
.fill-sentence { font-size: 22px; font-weight: 800; line-height: 2; padding: 6px 0; }
.blank {
  display: inline-block; min-width: 110px; border-bottom: 3px solid var(--line-strong); text-align: center;
  padding: 0 8px; color: var(--primary-text); line-height: 1.4; vertical-align: baseline;
}
.blank.filled { border-bottom-color: var(--primary); }
.blank.right { color: var(--green-text); border-bottom-color: var(--green); }
.blank.wrong { color: var(--red-text); border-bottom-color: var(--red); }

/* Jetons (mots / ordre) */
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip {
  appearance: none; cursor: pointer; background: var(--surface); color: var(--text);
  border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 14px;
  padding: 10px 14px; font-weight: 800; font-size: 17px; transition: transform .06s;
}
.chip:active { transform: translateY(2px); }
.chip.used { visibility: hidden; }
.chip.sel { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary-text); }
.chip.long { width: 100%; text-align: left; font-size: 16px; font-weight: 700; line-height: 1.35; }
.answer-zone {
  min-height: 64px; padding: 10px 0; display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start;
  border-top: 2px solid var(--line); border-bottom: 2px solid var(--line);
  background-image: repeating-linear-gradient(transparent 0 61px, var(--line) 61px 63px);
}
.answer-zone.cards { flex-direction: column; flex-wrap: nowrap; background-image: none; border: 2px dashed var(--line-strong); border-radius: 14px; padding: 10px; min-height: 80px; }
.answer-zone .chip .n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 13px; margin-right: 8px; }
.answer-zone.right .chip { border-color: var(--green); background: var(--green-soft); color: var(--green-text); }
.answer-zone.wrong .chip { border-color: var(--red); background: var(--red-soft); color: var(--red-text); }
.zone-hint { color: var(--text-faint); font-weight: 700; font-size: 15px; padding: 10px 4px; }

/* Associer les paires */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match .col { display: flex; flex-direction: column; gap: 12px; }
.match .choice { justify-content: center; text-align: center; min-height: 60px; font-size: 16px; }
.match .choice.done { opacity: .35; pointer-events: none; background: var(--surface); border-color: var(--line); color: var(--text-faint); }
.match .choice.flash-ok { background: var(--green-soft); border-color: var(--green); color: var(--green-text); }
.match .choice.flash-ko { background: var(--red-soft); border-color: var(--red); color: var(--red-text); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* Toucher les mots */
.tap-text { font-size: 21px; font-weight: 700; line-height: 2.1; }
.tw {
  appearance: none; cursor: pointer; border: 0; background: transparent; color: inherit; font: inherit;
  padding: 2px 4px; margin: 0 -1px; border-radius: 8px; border-bottom: 2px dashed var(--line-strong);
}
.tw:hover { background: var(--surface-2); }
.tw.sel { background: var(--primary-soft); color: var(--primary-text); border-bottom-color: var(--primary); }
.tw.right { background: var(--green-soft); color: var(--green-text); border-bottom-color: var(--green); }
.tw.missed { outline: 2px solid var(--green); color: var(--green-text); }
.tw.wrong { background: var(--red-soft); color: var(--red-text); border-bottom-color: var(--red); text-decoration: line-through; }
.tw[disabled] { cursor: default; }

/* Infos */
.info-card { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.info-card .ah-wrap .ah { width: 150px; height: 180px; }
.info-text { font-size: 19px; font-weight: 600; line-height: 1.55; text-align: left; width: 100%; }
.info-text strong { color: var(--primary-text); }
.info-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; width: 100%; text-align: left; }
.info-list li { display: flex; gap: 12px; align-items: flex-start; font-size: 17px; font-weight: 700; background: var(--surface-2); border-radius: 14px; padding: 12px 14px; }
.info-list li::before { content: ''; flex: none; width: 10px; height: 10px; margin-top: 8px; border-radius: 50%; background: var(--primary); }

/* Parole */
.speak-card { display: flex; align-items: flex-end; gap: 10px; }
.speak-card .ah-wrap .ah { width: 104px; height: 125px; }
.speak-card .bubble { flex: 1; margin-bottom: 26px; font-size: 20px; line-height: 1.5; }
.speak-text .w { border-radius: 6px; transition: color .2s, background .2s; }
.speak-text .w.ok { color: var(--green-text); }
.speak-text .w.miss { color: var(--red-text); text-decoration: underline wavy; text-underline-offset: 5px; }
.speak-text .pz { color: var(--primary); font-weight: 900; opacity: .8; }
.speak-text em, .read-text em { font-style: normal; font-weight: 900; color: var(--primary-text); }
.listen-row { display: flex; gap: 8px; margin-top: 10px; }
.round-mini {
  appearance: none; cursor: pointer; border: 0; width: 44px; height: 44px; border-radius: 12px;
  background: var(--blue); color: #fff; box-shadow: 0 3px 0 var(--blue-dark); display: grid; place-items: center;
}
.round-mini:active { transform: translateY(3px); box-shadow: none; }
.round-mini .ic { width: 22px; height: 22px; }
.round-mini.slow { background: var(--surface); color: var(--blue); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); }
.hint { color: var(--text-soft); font-weight: 700; font-size: 15px; }

.mic-zone { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 8px 0; }
.mic-btn {
  appearance: none; cursor: pointer; border: 0; position: relative;
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--primary); color: #fff; box-shadow: 0 6px 0 var(--primary-dark);
  display: grid; place-items: center; transition: transform .06s, box-shadow .06s, background .2s;
}
.mic-btn .ic { width: 42px; height: 42px; }
.mic-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--primary-dark); }
.mic-btn.rec { background: var(--red); box-shadow: 0 6px 0 var(--red-dark); }
.mic-btn.rec::before, .mic-btn.rec::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 4px solid var(--red); opacity: .5; animation: ripple 1.4s ease-out infinite;
}
.mic-btn.rec::after { animation-delay: .7s; }
@keyframes ripple { from { transform: scale(1); opacity: .5; } to { transform: scale(1.5); opacity: 0; } }
.mic-btn[disabled] { background: var(--locked); box-shadow: 0 6px 0 var(--locked-dark); color: var(--locked-icon); cursor: default; }
.mic-label { font-weight: 800; color: var(--text-soft); text-align: center; }
.live-text { min-height: 26px; font-weight: 700; color: var(--text-soft); text-align: center; font-style: italic; max-width: 100%; }
.score-pill { font-weight: 900; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); }
.alert {
  display: flex; gap: 12px; align-items: flex-start; background: var(--surface-2); border-radius: 14px; padding: 12px 14px;
  font-weight: 700; font-size: 15px; color: var(--text-soft);
}
.alert .ic { width: 22px; height: 22px; color: var(--orange); margin-top: 1px; }

.level-meter { display: flex; align-items: center; gap: 4px; height: 44px; }
.level-meter i { display: block; width: 6px; border-radius: 4px; background: var(--primary); height: 6px; transition: height .08s; }

/* Respiration */
.breath { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 8px 0; }
.breath-circle {
  --scale: .55; width: 240px; height: 240px; border-radius: 50%; position: relative; display: grid; place-items: center;
}
.breath-circle::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #C9A6FF, var(--primary) 70%);
  transform: scale(var(--scale)); transition: transform var(--dur, 1s) ease-in-out;
  box-shadow: 0 0 0 14px var(--primary-soft);
}
.breath-circle::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 3px dashed var(--primary-line); }
.breath-label { position: relative; color: #fff; text-align: center; font-weight: 900; text-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.breath-label .big { font-size: 46px; line-height: 1; }
.breath-label .what { font-size: 18px; letter-spacing: .04em; }
.breath-count { font-weight: 800; color: var(--text-soft); }

/* Étapes minutées */
.timed-list { display: grid; gap: 10px; }
.timed-item {
  display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; border: 2px solid var(--line);
  font-weight: 700; font-size: 17px; transition: background .2s, border-color .2s, opacity .2s;
}
.timed-item .num {
  flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-soft); font-weight: 900; position: relative;
}
.timed-item.active { border-color: var(--primary-line); background: var(--primary-soft); }
.timed-item.active .num { background: var(--primary); color: #fff; }
.timed-item.done { opacity: .55; }
.timed-item.done .num { background: var(--green); color: #fff; }
.timed-item .num svg.ring { position: absolute; inset: -4px; width: 48px; height: 48px; transform: rotate(-90deg); }

/* Parole libre */
.topic-card { border: 2px solid var(--line); border-radius: 16px; padding: 18px; background: var(--surface); }
.topic-card .lbl { font-size: 13px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--primary-text); }
.topic-card .topic { font-size: 21px; font-weight: 800; margin-top: 6px; }
.topic-card .words { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.topic-card .words span { background: var(--primary); color: #fff; font-weight: 900; padding: 6px 12px; border-radius: 10px; box-shadow: 0 3px 0 var(--primary-dark); }
.read-text { font-size: 20px; font-weight: 700; line-height: 1.7; }
.read-text .pz { color: var(--primary); font-weight: 900; }
.read-src { font-size: 14px; color: var(--text-soft); font-weight: 800; margin-top: 10px; }
.tips { display: flex; flex-wrap: wrap; gap: 8px; }
.tips span { font-size: 14px; font-weight: 800; background: var(--surface-2); color: var(--text-soft); padding: 6px 10px; border-radius: 10px; }
.timer-ring { position: relative; width: 150px; height: 150px; }
.timer-ring svg { width: 150px; height: 150px; transform: rotate(-90deg); }
.timer-ring .t { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; font-weight: 900; }
.timer-ring .t small { display: block; font-size: 13px; color: var(--text-soft); font-weight: 800; text-align: center; margin-top: -6px; }
.prep-big { font-size: 72px; font-weight: 900; color: var(--primary); line-height: 1; }
.live-box {
  width: 100%; max-height: 140px; overflow-y: auto; border-radius: 14px; background: var(--surface-2); padding: 12px 14px;
  font-weight: 700; color: var(--text-soft); font-size: 16px; min-height: 52px;
}
.live-fillers { font-weight: 900; color: var(--red-text); }

/* Rapport d'analyse */
.report { display: flex; flex-direction: column; gap: 16px; }
.report-head { display: flex; align-items: center; gap: 18px; }
.score-ring { position: relative; width: 112px; height: 112px; flex: none; }
.score-ring svg { width: 112px; height: 112px; transform: rotate(-90deg); }
.score-ring .v { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 900; font-size: 32px; line-height: 1; }
.score-ring .v small { display: block; font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.metric { border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.metric .k { font-size: 13px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; color: var(--text-soft); }
.metric .v { font-size: 24px; font-weight: 900; margin-top: 2px; }
.metric .v small { font-size: 14px; color: var(--text-soft); }
.metric .s { font-size: 13px; font-weight: 800; margin-top: 2px; }
.metric.good .s { color: var(--green-text); }
.metric.mid .s { color: var(--orange); }
.metric.bad .s { color: var(--red-text); }
.fb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fb-list li { display: flex; gap: 10px; align-items: flex-start; font-weight: 700; font-size: 15px; }
.fb-list li .ic { width: 20px; height: 20px; margin-top: 2px; }
.fb-list li.g .ic { color: var(--green); }
.fb-list li.t .ic { color: var(--gold-dark); }
.pitch-svg { width: 100%; height: 90px; border-radius: 12px; background: var(--surface-2); }
.audio-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
details.transcript { border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; }
details.transcript summary { cursor: pointer; font-weight: 800; color: var(--text-soft); }
details.transcript p { margin: 10px 0 0; font-weight: 600; }
.self-rate { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.self-rate .choice { justify-content: center; text-align: center; flex-direction: column; gap: 4px; font-size: 15px; padding: 12px 8px; }
.self-rate .choice .e { font-size: 26px; line-height: 1; }
.counter-big { font-size: 54px; font-weight: 900; color: var(--red-text); line-height: 1; }

/* ---------- Écrans de fin ---------- */
.screen {
  position: fixed; inset: 0; z-index: 45; background: var(--bg); display: flex; flex-direction: column;
}
.screen-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px 20px; text-align: center; }
.screen-title { font-size: clamp(26px, 7vw, 32px); font-weight: 900; color: var(--gold-dark); }
.screen-title.purple { color: var(--primary-text); }
.screen-title.orange { color: var(--orange); }
.screen-sub { font-size: 18px; font-weight: 700; color: var(--text-soft); max-width: 420px; }
.screen .ah { width: 170px; height: 204px; }
.result-cards { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.rcard { width: 104px; border-radius: 16px; border: 2px solid var(--rc); background: var(--rc); overflow: hidden; animation: pop-up .4s backwards; }
.rcard .h { color: #fff; font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; padding: 5px 4px 3px; }
.rcard .b { background: var(--bg); border-radius: 13px; margin: 0 2px 2px; padding: 12px 4px; font-size: 19px; white-space: nowrap; font-weight: 900; color: var(--rc); display: flex; align-items: center; justify-content: center; gap: 6px; }
.rcard .b .ic { width: 18px; height: 18px; }
.rcard:nth-child(2) { animation-delay: .12s; }
.rcard:nth-child(3) { animation-delay: .24s; }
@keyframes pop-up { from { opacity: 0; transform: translateY(16px) scale(.9); } to { opacity: 1; transform: none; } }
.big-flame { width: 150px; height: 150px; animation: flame-pulse 1.4s ease-in-out infinite; }
.big-flame .ic { width: 150px; height: 150px; }
@keyframes flame-pulse { 50% { transform: scale(1.06); } }
.streak-num { font-size: 96px; font-weight: 900; color: var(--orange); line-height: .9; animation: pop-up .5s; }
.week { display: flex; gap: 8px; justify-content: center; border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.week .d { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; color: var(--text-faint); }
.week .d i { width: 30px; height: 30px; border-radius: 50%; background: var(--line); display: grid; place-items: center; color: #fff; }
.week .d i .ic { width: 18px; height: 18px; }
.week .d.on { color: var(--orange); }
.week .d.on i { background: var(--orange); }
.week .d.frozen i { background: #38BDF8; }
.week .d.today { color: var(--text); }
.badge-big { width: 130px; height: 130px; border-radius: 36px; display: grid; place-items: center; color: #fff; box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .2), inset 0 6px 0 rgba(255, 255, 255, .18); animation: pop-up .5s; }
.badge-big .ic { width: 70px; height: 70px; }
.screen-foot { border-top: 2px solid var(--line); }
.screen-foot-in { max-width: 1040px; margin: 0 auto; padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); display: flex; justify-content: flex-end; gap: 12px; }
.screen-foot .btn { min-width: 180px; }
@media (max-width: 640px) { .screen-foot .btn { width: 100%; } .screen-foot-in { flex-direction: column-reverse; } }

/* Confettis */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

/* ---------- Modale, toast ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 70; background: var(--overlay); display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fade .15s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); border-radius: 20px; padding: 24px; text-align: center; animation: pop-up .2s;
}
.modal.wide { max-width: 560px; text-align: left; }
.modal h2 { font-size: 24px; font-weight: 900; margin-bottom: 8px; }
.modal p { color: var(--text-soft); font-weight: 700; }
.modal .ah-wrap { margin: 0 auto 8px; }
.modal-actions { display: grid; gap: 12px; margin-top: 18px; }
@media (max-width: 640px) {
  .modal-back { align-items: flex-end; padding: 0; }
  .modal { border-radius: 20px 20px 0 0; max-height: 92vh; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}
.guide-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; counter-reset: g; }
.guide-list li { counter-increment: g; display: flex; gap: 12px; font-weight: 700; color: var(--text); }
.guide-list li::before {
  content: counter(g); flex: none; width: 28px; height: 28px; border-radius: 9px; background: var(--uc, var(--primary)); color: #fff;
  display: grid; place-items: center; font-weight: 900; font-size: 14px;
}

.toasts { position: fixed; top: calc(var(--top-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: stretch; pointer-events: none; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--surface); color: var(--text); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 16px;
  padding: 10px 14px 10px 10px; font-weight: 800; font-size: 15px; box-shadow: 0 10px 30px rgba(28, 15, 48, .14);
  animation: toast-in .25s ease-out;
}
.toasts.low { top: auto; bottom: calc(150px + env(safe-area-inset-bottom)); }
@media (min-width: 641px) { .toasts.low { bottom: 130px; } }
.toast-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.toast .ic { width: 26px; height: 26px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } }

/* ---------- Entraînement ---------- */
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 340px) { .tools { grid-template-columns: 1fr; } }
.tool {
  appearance: none; cursor: pointer; text-align: left; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 18px;
  background: var(--surface); padding: 16px; display: flex; flex-direction: column; gap: 10px; color: var(--text);
  transition: transform .06s, background .12s;
}
.tool:hover { background: var(--surface-2); }
.tool:active { transform: translateY(2px); border-bottom-width: 2px; margin-bottom: 2px; }
.tool .ti { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--tc, var(--primary)); box-shadow: 0 4px 0 var(--td, var(--primary-dark)); }
.tool .ti .ic { width: 28px; height: 28px; }
.tool h3 { font-size: 18px; font-weight: 900; }
.tool p { margin: 0; color: var(--text-soft); font-weight: 700; font-size: 14px; }
.tool.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; }
.tool.wide .grow { flex: 1; }

.list { display: grid; gap: 10px; }
.row-item {
  display: flex; align-items: center; gap: 14px; padding: 14px; border: 2px solid var(--line); border-radius: 16px; background: var(--surface);
}
.row-item .grow { flex: 1; min-width: 0; }
.row-item .t { font-weight: 800; }
.row-item .s { color: var(--text-soft); font-weight: 700; font-size: 14px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--pink); }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--text-soft); text-decoration: none; margin-top: 16px; text-transform: uppercase; font-size: 14px; letter-spacing: .06em; }
.back-link .ic { width: 20px; height: 20px; }

/* Miroir */
.mirror { position: relative; border-radius: 18px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; max-height: 60vh; width: 100%; }
.mirror video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.mirror video.playback { transform: none; }
.mirror .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; opacity: .7; font-weight: 800; text-align: center; padding: 20px; }
.mirror .rec-dot { position: absolute; top: 12px; left: 12px; background: var(--red); color: #fff; font-weight: 900; padding: 4px 10px; border-radius: 999px; font-size: 13px; }

/* ---------- Quêtes et badges ---------- */
.quest { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 2px solid var(--line); }
.quest:last-child { border-bottom: 0; }
.quest > span:first-child .ic { width: 42px; height: 42px; color: var(--primary); }
.quest .grow { flex: 1; min-width: 0; }
.quest .t { font-weight: 800; font-size: 17px; margin-bottom: 8px; }
.quest .reward { display: inline-flex; align-items: center; gap: 4px; font-weight: 900; color: #A855F7; }
.quest .reward .ic { width: 22px; height: 22px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.badge {
  border: 2px solid var(--line); border-radius: 16px; padding: 14px 12px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.badge .bi { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; color: #fff; position: relative; box-shadow: 0 4px 0 rgba(0, 0, 0, .15); }
.badge .bi .ic { width: 36px; height: 36px; }
/* Sur un fond coloré, les icônes multicolores deviennent des silhouettes blanches */
.badge .bi .ic [fill]:not([fill="none"]), .badge-big .ic [fill]:not([fill="none"]) { fill: #fff; }
.badge .bi .ic [stroke], .badge-big .ic [stroke] { stroke: #fff; }
.badge .bi .ic [opacity], .badge-big .ic [opacity] { opacity: 1; }
.badge .lv { position: absolute; bottom: -8px; right: -8px; background: var(--surface); color: var(--text); border: 2px solid var(--line); border-radius: 10px; font-size: 12px; font-weight: 900; padding: 1px 6px; }
.badge.off .bi { filter: grayscale(1); opacity: .35; }
.badge .n { font-weight: 900; }
.badge .d { font-size: 13px; color: var(--text-soft); font-weight: 700; }
.badge .bar { height: 10px; width: 100%; }

/* ---------- Profil ---------- */
.profile-head { display: flex; align-items: center; gap: 18px; padding: 8px 0 20px; border-bottom: 2px solid var(--line); margin-bottom: 20px; }
.avatar { width: 92px; height: 92px; border-radius: 50%; background: var(--primary-soft); display: grid; place-items: center; flex: none; border: 3px dashed var(--primary-line); font-size: 42px; font-weight: 900; color: var(--primary-text); text-transform: uppercase; }
.profile-head h1 { font-size: 26px; font-weight: 900; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-box { border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.stat-box .ic { width: 30px; height: 30px; }
.stat-box .v { font-size: 20px; font-weight: 900; line-height: 1.1; }
.stat-box .k { font-size: 13px; color: var(--text-soft); font-weight: 800; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { fill: var(--text-soft); font-size: 13px; font-weight: 800; font-family: var(--font); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .val { fill: var(--text); font-size: 13px; font-weight: 900; font-family: var(--font); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; font-weight: 800; color: var(--text-soft); margin-top: 8px; }
.legend i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }

/* ---------- Boutique ---------- */
.shop-item { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 2px solid var(--line); }
.shop-item:last-child { border-bottom: 0; }
.shop-item .si { width: 64px; height: 64px; flex: none; display: grid; place-items: center; border-radius: 16px; background: var(--surface-2); }
.shop-item .si .ic { width: 40px; height: 40px; }
.shop-item .si .ah { width: 56px; height: 67px; }
.shop-item .grow { flex: 1; min-width: 0; }
.shop-item .t { font-weight: 900; font-size: 17px; }
.shop-item .s { color: var(--text-soft); font-weight: 700; font-size: 14px; }
.price { display: inline-flex; align-items: center; gap: 4px; }
.price .ic { width: 20px; height: 20px; }

/* ---------- Réglages ---------- */
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label, .field .lbl { font-weight: 900; font-size: 15px; }
.input, select.input {
  width: 100%; border: 2px solid var(--line); border-radius: 14px; background: var(--surface-2); color: var(--text);
  padding: 12px 14px; font: inherit; font-weight: 700; font-size: 17px;
}
.input:focus { outline: none; border-color: var(--primary-line); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 2px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .t { font-weight: 800; }
.switch-row .s { color: var(--text-soft); font-weight: 600; font-size: 14px; }
.switch { position: relative; width: 56px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; position: absolute; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--locked); transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(24px); }
.switch input:focus-visible + span { outline: 3px solid var(--primary-line); outline-offset: 2px; }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 8px; }
.seg .choice { justify-content: center; text-align: center; font-size: 15px; padding: 10px 6px; }
@media (max-width: 420px) { .seg .choice { font-size: 14px; padding: 10px 4px; } }

/* ---------- Accueil / onboarding ---------- */
.onb { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; }
.onb-top { max-width: 1040px; width: 100%; margin: 0 auto; padding: 18px 20px 0; display: flex; align-items: center; gap: 14px; }
.onb-body { flex: 1; overflow-y: auto; }
.onb-inner { max-width: 600px; margin: 0 auto; padding: 24px 20px; display: flex; flex-direction: column; gap: 22px; }
.onb-hero { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 20px; padding: 32px 20px; }
.onb-hero .ah { width: 200px; height: 240px; }
.onb-hero h1 { font-size: 34px; font-weight: 900; color: var(--primary-text); max-width: 520px; }
.onb-hero p { font-size: 19px; font-weight: 700; color: var(--text-soft); max-width: 440px; margin: 0; }
.onb-hero .btns { display: grid; gap: 12px; width: 100%; max-width: 340px; margin-top: 8px; }
.opt-icon { font-size: 26px; line-height: 1; flex: none; width: 34px; text-align: center; }
.opt-tile { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--tc, var(--primary)); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }
.opt-tile .ic { width: 24px; height: 24px; }
.opt-tile.emoji { background: var(--surface-2); box-shadow: none; font-size: 26px; line-height: 1; }
.choice.sel .opt-tile.emoji { background: var(--surface); }
.choice.multi .check { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line-strong); display: grid; place-items: center; color: transparent; transition: background .12s, border-color .12s; }
.choice.multi .check .ic { width: 16px; height: 16px; }
.choice.multi.sel .check { background: var(--primary); border-color: var(--primary); color: #fff; }
.choice .grow { flex: 1; }
.choice .sub { display: block; font-size: 14px; color: var(--text-soft); font-weight: 700; }
.choice.sel .sub { color: var(--primary-text); }

/* =========================================================
   Retouches et nouveaux éléments (revue graphique et UX)
   ========================================================= */

/* --- Pied de page : le span vide ne crée plus d'écart sur mobile --- */
@media (max-width: 640px) { .lesson-foot-in > span:empty { display: none; } }

/* --- Accueil --- */
.onb .lesson-foot.bare { border-top-color: transparent; }
@media (max-width: 640px) { .onb .lesson-foot .btn.ghost, .onb .lesson-foot .btn.flat { order: 2; } }
.onb-top .icon-btn { margin-left: -12px; }
.onb .ah-says { align-items: center; }
.onb .bubble { flex: 1; margin-bottom: 0; }
.onb .bubble::before, .onb .bubble::after { bottom: auto; top: 50%; margin-top: -10px; }
.onb-inner, .onb-hero, .onb-final { animation: step-in .28s ease-out; }
.onb-hero h1 { text-wrap: balance; line-height: 1.15; }
.onb-hero .ah-wrap, .onb-final .ah-wrap { position: relative; isolation: isolate; }
.onb-hero .ah-wrap::before, .onb-final .ah-wrap::before {
  content: ''; position: absolute; left: 50%; top: 52%; width: 230px; height: 230px; transform: translate(-50%, -50%);
  border-radius: 50%; background: radial-gradient(closest-side, var(--primary-soft) 70%, transparent); z-index: -1;
}
.onb-hint { display: flex; align-items: center; gap: 8px; margin: -6px 0 0; font-weight: 800; color: var(--primary-text); font-size: 15px; }
.onb-hint .ic { width: 18px; height: 18px; }
.onb-note { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 0 4px; font-size: 14px; font-weight: 700; color: var(--text-soft); }
.onb-note .ic { width: 18px; height: 18px; color: var(--text-faint); margin-top: 2px; flex: none; }
.onb-mic { border: 2px solid var(--line); border-radius: var(--radius); padding: 24px 16px 18px; }
.mic-btn.ok { background: var(--green); box-shadow: 0 6px 0 var(--green-dark); }
.mic-btn.ko { background: var(--surface-2); color: var(--red-text); box-shadow: 0 6px 0 var(--line); }
.onb-mic-msg { margin: 0; min-height: 22px; }
.onb-mic-msg.ok { color: var(--green-text); }
.onb-mic-msg.ko { color: var(--red-text); }
.onb-heard { margin: 0; font-weight: 800; color: var(--primary-text); min-height: 20px; text-align: center; }
.level-meter { gap: 5px; }
.level-meter i { background: var(--primary-line); }
.level-meter.live i { background: var(--primary); }
.level-meter.ok i { background: var(--green); }
.goal-lvl { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding-bottom: 10px; }
.goal-lvl i { width: 5px; border-radius: 3px; background: var(--line-strong); }
.goal-lvl i:nth-child(1) { height: 8px; } .goal-lvl i:nth-child(2) { height: 13px; } .goal-lvl i:nth-child(3) { height: 18px; } .goal-lvl i:nth-child(4) { height: 24px; }
.goal-lvl i.on { background: var(--primary); }
.choice.sel .goal-lvl { background: var(--surface); }
.choice.sel .goal-lvl i.on { animation: bar-pop .3s cubic-bezier(.2, .9, .3, 1.4) backwards; transform-origin: bottom; }
.choice.sel .goal-lvl i:nth-child(2) { animation-delay: .06s; } .choice.sel .goal-lvl i:nth-child(3) { animation-delay: .12s; } .choice.sel .goal-lvl i:nth-child(4) { animation-delay: .18s; }
@keyframes bar-pop { from { transform: scaleY(.15); } }
.xp-pill { flex: none; font-weight: 900; color: var(--text); }
.xp-pill .ic { width: 16px; height: 16px; }
.onb-final { max-width: 560px; margin: 0 auto; padding: 24px 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.onb-final h1 { font-size: 30px; font-weight: 900; color: var(--text); text-wrap: balance; }
.onb-name { color: var(--primary-text); background: linear-gradient(transparent 62%, var(--primary-soft) 62%); padding: 0 4px; border-radius: 6px; }
.plan-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; width: 100%; text-align: left; }
.plan-list li { display: flex; gap: 12px; align-items: flex-start; background: var(--surface-2); border-radius: 14px; padding: 12px 14px; font-weight: 700; }
.plan-list li > span:first-child { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; }
.plan-list li > span:first-child .ic { width: 16px; height: 16px; }
.onb-extras { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
@media (max-height: 700px) {
  .onb-inner .ah-says .ah { width: 64px; height: 77px; }
  .onb-inner { gap: 14px; padding-top: 12px; }
  .onb-final .ah { width: 110px; height: 132px; }
}
.reduce-motion .ah[data-mood=talk] .ah-m-talk { display: none; }
.reduce-motion .ah[data-mood=talk] .ah-m-smile { display: inline; }
@media (prefers-reduced-motion: reduce) {
  .ah[data-mood=talk] .ah-m-talk { display: none; }
  .ah[data-mood=talk] .ah-m-smile { display: inline; }
}

/* --- Parcours : bannières collantes propres, compactes sur mobile --- */
.unit-banner::before { content: ''; position: absolute; left: -6px; right: -6px; bottom: 100%; height: 14px; background: var(--bg); }
.unit-banner::after { content: ''; position: absolute; left: 0; right: 0; top: calc(100% + 4px); height: 18px; background: linear-gradient(var(--bg), transparent); pointer-events: none; }
.unit-text { min-width: 0; }
.unit-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; flex: none; }
.unit-banner .crown-done { width: 22px; height: 22px; color: #FFC800; vertical-align: -3px; }
@media (max-width: 767px) {
  .unit-banner { padding: 12px 8px 12px 16px; gap: 10px; }
  .unit-banner h2 { font-size: 19px; }
  .unit-banner .over { font-size: 12px; }
  .unit-banner .desc { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  .unit-actions { align-self: stretch; justify-content: center; }
  .unit-guide { height: 100%; padding: 0 8px 0 14px; border: 0; border-left: 2px solid rgba(255, 255, 255, .3); border-radius: 0; background: none; box-shadow: none; }
  .unit-guide span { display: none; }
  .unit-guide .ic { width: 26px; height: 26px; }
}
.jump-bubble {
  position: absolute; bottom: calc(100% + 18px); left: 50%; transform: translateX(-50%); z-index: 2;
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  background: var(--surface); color: var(--uc); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line);
  border-radius: 14px; padding: 9px 14px 9px 10px; font: 900 14px/1 var(--font); letter-spacing: .06em; text-transform: uppercase;
}
.jump-bubble .ic { width: 18px; height: 18px; }
.jump-bubble::after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -8px; border: 8px solid transparent; border-top-color: var(--line); }
.jump-bubble:active { transform: translate(-50%, 3px); box-shadow: 0 1px 0 var(--line); }
.popover.locked::after { content: ''; position: absolute; bottom: 100%; left: calc(50% + var(--px, 0px)); margin-left: -7px; margin-bottom: -3px; border: 7px solid transparent; border-bottom-color: var(--surface); }
.path-end {
  display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 360px; margin: 8px auto 0; padding: 24px 20px 28px;
  border: 2px dashed var(--line-strong); border-radius: 20px; background: var(--bg-soft); color: var(--text-soft); font-weight: 700; text-align: center;
}
.path-end h3 { color: var(--text); font-size: 19px; }
.path-end p { margin: 0; }
.diploma-node {
  appearance: none; cursor: pointer; border: 0; width: 92px; height: 92px; border-radius: 28px; display: grid; place-items: center;
  background: var(--locked); box-shadow: 0 8px 0 var(--locked-dark); color: var(--locked-icon);
}
.diploma-node .ic { width: 58px; height: 58px; filter: grayscale(1) opacity(.5); }
.diploma-node.earned { background: var(--gold); box-shadow: 0 8px 0 var(--gold-dark); animation: pop-up .5s; }
.diploma-node.earned .ic { filter: none; }
.diploma-node:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--locked-dark); }
.diploma-img { width: 100%; height: auto; border-radius: 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, .15); margin: 4px 0 12px; }

/* Cartes en haut du parcours */
.top-card {
  display: flex; align-items: center; gap: 14px; margin: 14px 0 0; padding: 14px 16px; border: 2px solid var(--line); border-radius: 18px; background: var(--surface);
}
.top-card.assess { border-color: var(--primary-line); background: var(--primary-soft); }
.top-card .grow { flex: 1; min-width: 0; }
.top-card .t { font-weight: 900; }
.top-card .s { color: var(--text-soft); font-weight: 600; font-size: 14px; margin-top: 2px; }
.top-card .ah-wrap { flex: none; }
.top-ic { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--tc); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .15); }
.top-ic .ic { width: 26px; height: 26px; }
.top-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }
@media (max-width: 520px) {
  .top-card { flex-wrap: wrap; }
  .top-card .grow { flex-basis: calc(100% - 80px); }
  .top-actions { flex-direction: row; width: 100%; }
  .top-actions .btn { flex: 1; }
}

/* Guide d'unité */
.modal.guide h2 { font-size: 26px; }
.guide-head { position: relative; margin: 4px 0 16px; padding: 14px 92px 14px 16px; border-radius: 16px; background: var(--uc); color: #fff; box-shadow: 0 4px 0 var(--ud); min-height: 84px; }
.guide-head .over { font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.modal .guide-head p { color: #fff; margin: 2px 0 0; }
.guide-head .ah-wrap { position: absolute; right: 10px; bottom: 0; margin: 0; }
.guide-list li { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; font-weight: 600; color: var(--text-soft); line-height: 1.4; }
.guide-list li strong { color: var(--text); font-weight: 900; }
.guide-list li::before { border-radius: 50%; box-shadow: 0 3px 0 var(--ud, var(--primary-dark)); }

/* Coffre ouvert */
.chest-reward { position: relative; isolation: isolate; width: 140px; height: 128px; margin: 4px auto 8px; }
.chest-reward .ic { width: 100%; height: 100%; }
.chest-reward::before { content: ''; position: absolute; inset: -36px; z-index: -1; border-radius: 50%; background: repeating-conic-gradient(rgba(255, 200, 0, .25) 0 12deg, transparent 12deg 30deg); -webkit-mask: radial-gradient(closest-side, #000 35%, transparent); mask: radial-gradient(closest-side, #000 35%, transparent); }
.gem-gain { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 34px; font-weight: 900; color: #A855F7; margin: 4px 0 6px; }
.gem-gain .ic { width: 36px; height: 36px; }

/* --- Barre du haut et navigation --- */
.lvl-badge { border-radius: 999px; min-width: 30px; height: 30px; padding: 0 9px; clip-path: none; background: linear-gradient(170deg, #A66BFF, var(--primary) 60%, var(--primary-dark)); box-shadow: var(--lift-sm), inset 0 1.5px 0 rgba(255,255,255,.45); font-size: 14px; }
@media (max-width: 767px) { .topbar .stats { flex: 1; justify-content: space-evenly; } }
.aside .stats { width: 100%; justify-content: space-between; }
.nav-item[href="#/apprendre"] { --nc: #8A3FFC; }
.nav-item[href="#/entrainement"] { --nc: #FF4B91; }
.nav-item[href="#/quetes"] { --nc: #FF9600; }
.nav-item[href="#/profil"] { --nc: #1CB0F6; }
.nav-item[href="#/boutique"] { --nc: #E5A400; }
.nav-item[href="#/reglages"] { --nc: var(--text-soft); }
.nav-item .ic { color: var(--nc, currentColor); }
.nav-item .ic > :first-child { fill: currentColor; fill-opacity: .18; }
.nav-item.active .ic > :first-child { fill-opacity: .35; }
@media (min-width: 768px) and (max-width: 1180px) {
  :root { --top-h: 64px; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 19; height: var(--top-h); margin-left: var(--side-w); padding: 0 24px; align-items: center; justify-content: flex-end; background: var(--bg); border-bottom: 2px solid var(--line); }
  .topbar .brand { display: none; }
}
.goal-row .bar { height: 22px; }
.goal-row .bar > i::after { display: none; }
.goal-row .bar-label { font-size: 13px; }
.quest-mini .bar { height: 16px; }

/* --- Entraînement : recommandations --- */
.tool-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.for-you-pill { background: var(--primary-soft); color: var(--primary-text); white-space: nowrap; flex-shrink: 0; font-size: 12px; padding: 3px 8px; gap: 4px; }
.for-you-pill .ic { width: 12px; height: 12px; }
.tool.for-you { border-color: var(--primary-line); }

/* --- Profil : objectifs, progression, diplôme --- */
.goal-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 18px; }
.goal-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px 6px 6px; border-radius: 12px; background: var(--surface-2); font-weight: 800; font-size: 13px; }
.goal-chip .ic { width: 24px; height: 24px; padding: 4px; border-radius: 8px; background: var(--tc); color: #fff; }
.compare { display: grid; gap: 6px; }
.compare-head, .compare-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; align-items: center; }
.compare-head { font-size: 12px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--text-soft); padding: 0 10px; }
.compare-row { background: var(--surface-2); border-radius: 12px; padding: 10px; font-weight: 800; }
.compare-row .k { color: var(--text-soft); font-size: 14px; }
.compare-row .v { font-variant-numeric: tabular-nums; }
.compare-row .now { display: inline-flex; align-items: center; gap: 4px; }
.compare-row.up .now { color: var(--green-text); }
.compare-row.down .now { color: var(--orange); }
.compare-row .now .ic { width: 16px; height: 16px; }
.diploma-card { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, var(--surface)); margin-top: 16px; }
.diploma-ic .ic { width: 56px; height: 56px; }
.alert.good { color: var(--green-text); }
.alert.good .ic { color: var(--green); }

/* --- Réglages --- */
.chips.left { justify-content: flex-start; }
.chip.sm-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; padding: 8px 12px; }
.chip.sm-chip .ic { width: 18px; height: 18px; }

@media print { .side, .topbar, .bottomnav, .aside { display: none !important; } .main { margin: 0; } }

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

/* Badges gagnés en fin de leçon */
.badge-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; font-size: 22px; font-weight: 900; color: var(--text); }
.badge-name .pill { background: var(--primary-soft); color: var(--primary-text); }
.badge-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; width: min(440px, 100%); text-align: left; }
.badge-list li { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 18px; background: var(--surface); animation: pop-up .45s both; animation-delay: var(--d, 0s); }
.badge-list .bl-ic { flex: none; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; color: #fff; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .2), inset 0 4px 0 rgba(255, 255, 255, .18); }
.badge-list .bl-ic .ic { width: 30px; height: 30px; }
.badge-list .bl-ic .ic [fill]:not([fill="none"]) { fill: #fff; }
.badge-list .bl-ic .ic [stroke] { stroke: #fff; }
.badge-list .bl-ic .ic [opacity] { opacity: 1; }
.badge-list .grow { flex: 1; min-width: 0; }
.badge-list strong { display: block; font-size: 17px; font-weight: 900; }
.badge-list .grow span { display: block; font-size: 14px; font-weight: 700; color: var(--text-soft); }
.badge-list .pill { flex: none; background: var(--primary-soft); color: var(--primary-text); }

/* Jour protégé par un gel de série : le flocon doit ressortir sur le disque bleu */
.week .d.frozen i .ic [stroke] { stroke: #fff; }
.week .d.frozen i .ic [fill]:not([fill="none"]) { fill: #fff; }


/* ================================================================
   IDENTITÉ VISUELLE D'AHOUÉFA
   Rondeurs pleines, pierres polies, reliefs lumineux et palette propre.
   Ces règles passent après le socle : elles remplacent l'allure
   empruntée au départ (ombres dures, majuscules, palette tierce).
   ================================================================ */
:root {
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display: 'Fredoka', 'Poppins', system-ui, sans-serif;
  --primary: #7B2FF2; --primary-dark: #5312B8; --primary-soft: #F2E9FF; --primary-line: #CFB2FF; --primary-text: #5F1FD1;
  --green: #12A174; --green-dark: #0C7A57; --green-soft: #D6F5E9; --green-text: #0A6B4D;
  --red: #E0315E; --red-dark: #B21F46; --red-soft: #FDE3EA; --red-text: #B21F46;
  --gold: #F0B429; --gold-dark: #C4890C; --orange: #EE7E2E; --blue: #3E6FE3; --blue-dark: #2A51B8; --pink: #D63FA0;
  --bg-soft: #F7F3FD; --surface-2: #F4EEFF; --line: #E7DEF5; --line-strong: #D2C2EA;
  --text: #2E2440; --text-soft: #6B6082; --text-faint: #9A90AE;
  --radius: 20px;
  --gloss: radial-gradient(120% 95% at 32% 12%, rgba(255,255,255,.55), rgba(255,255,255,.12) 42%, rgba(0,0,0,.14) 78%, rgba(0,0,0,.26));
  --lift: 0 12px 26px -12px rgba(46, 20, 90, .5), 0 2px 6px -2px rgba(46, 20, 90, .22);
  --lift-sm: 0 7px 16px -9px rgba(46, 20, 90, .42);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --primary: #A775FF; --primary-dark: #6D28D9; --primary-soft: #2E1F4A; --primary-line: #5F3FA0; --primary-text: #CDB0FF;
  --green: #26C193; --green-soft: #10352A; --green-text: #5BE2B6; --red: #F2577C; --red-soft: #3A1622; --red-text: #FF8FA8;
  --line: #352B47; --line-strong: #4A3C61; --text: #F3EEFB; --text-soft: #B5A8CA; --text-faint: #80748F;
  --lift: 0 14px 30px -14px rgba(0, 0, 0, .8), 0 2px 8px -3px rgba(0, 0, 0, .6);
  --lift-sm: 0 9px 18px -11px rgba(0, 0, 0, .72);
} }
:root[data-theme="dark"] {
  --primary: #A775FF; --primary-dark: #6D28D9; --primary-soft: #2E1F4A; --primary-line: #5F3FA0; --primary-text: #CDB0FF;
  --green: #26C193; --green-soft: #10352A; --green-text: #5BE2B6; --red: #F2577C; --red-soft: #3A1622; --red-text: #FF8FA8;
  --line: #352B47; --line-strong: #4A3C61; --text: #F3EEFB; --text-soft: #B5A8CA; --text-faint: #80748F;
  --lift: 0 14px 30px -14px rgba(0, 0, 0, .8), 0 2px 8px -3px rgba(0, 0, 0, .6);
  --lift-sm: 0 9px 18px -11px rgba(0, 0, 0, .72);
}

/* Titres : la ronde Fredoka, chaleureuse, pour les grands moments */
h1, h2, .screen-title, .unit-banner h2, .page-head h1, .onb-hero h1, .onb-final h1, .step-title, .fb-title, .big-num {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -.005em;
}
.screen-title { font-weight: 700; line-height: 1.14; }

/* Boutons : galet poli. Dégradé, liseré lumineux en haut, ombre portée douce, bas-de-casse. */
.btn {
  background: linear-gradient(176deg, color-mix(in srgb, var(--b) 86%, #fff) 0%, var(--b) 50%, color-mix(in srgb, var(--b) 80%, var(--s)) 100%);
  box-shadow: var(--lift), inset 0 1.5px 0 rgba(255, 255, 255, .5), inset 0 -2px 0 rgba(0, 0, 0, .12);
  text-transform: none; letter-spacing: .005em; font-size: 16px; font-weight: 600;
  border-radius: 999px; padding: 13px 24px;
  transition: transform .14s cubic-bezier(.2, .8, .3, 1), box-shadow .14s, filter .15s, opacity .15s;
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1.5px); }
.btn:active { transform: translateY(1px) scale(.985); box-shadow: var(--lift-sm), inset 0 2px 6px rgba(0, 0, 0, .22); }
.btn[disabled], .btn.is-disabled { background: var(--locked); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .07); }
.btn[disabled]:active { transform: none; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .07); }
.btn.ghost { background: var(--surface); border: 2px solid var(--primary-line); box-shadow: var(--lift-sm); }
.btn.ghost:active, .btn.ghost.sm { box-shadow: var(--lift-sm); }
.btn.gold { --t: #3B2A00; }
.btn.sm { box-shadow: var(--lift-sm), inset 0 1px 0 rgba(255, 255, 255, .4); font-size: 14px; padding: 9px 18px; }
.btn.flat { box-shadow: none; font-weight: 600; border-radius: 999px; }
.icon-btn { border-radius: 999px; }

/* Étapes du parcours : perles rondes et lumineuses, posées sur un sentier pointillé */
.node {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--gloss), var(--uc); background-blend-mode: soft-light, normal;
  box-shadow: var(--lift), inset 0 -4px 10px rgba(0, 0, 0, .22), inset 0 3px 8px rgba(255, 255, 255, .4), 0 0 0 3px color-mix(in srgb, var(--uc) 28%, transparent);
  transition: transform .16s cubic-bezier(.2, .8, .3, 1), box-shadow .16s;
}
.node:hover { transform: translateY(-2px); }
.node:active { transform: translateY(2px) scale(.96); box-shadow: var(--lift-sm), inset 0 3px 10px rgba(0, 0, 0, .3); }
.node::after { /* reflet haut, comme sur une perle */
  content: ''; position: absolute; top: 9px; left: 17px; width: 24px; height: 13px; border-radius: 50%;
  background: rgba(255, 255, 255, .5); transform: rotate(-22deg); filter: blur(.4px);
}
.node.locked { background: var(--gloss), var(--locked); box-shadow: var(--lift-sm), inset 0 -3px 8px rgba(0, 0, 0, .14), 0 0 0 3px color-mix(in srgb, var(--locked) 40%, transparent); }
.node.locked::after { opacity: .35; }
/* Réponses : galets doux, arête colorée à gauche, numéro en pastille ronde */
.choice {
  border: 2px solid var(--line); border-bottom-width: 2px; border-radius: 18px;
  box-shadow: var(--lift-sm); background: var(--surface);
  position: relative; overflow: hidden;
}
.choice::before {
  content: ''; position: absolute; left: 0; top: 10%; bottom: 10%; width: 5px; border-radius: 0 4px 4px 0;
  background: var(--line-strong); transition: background .15s, top .15s, bottom .15s;
}
.choice:active { transform: translateY(1px); border-bottom-width: 2px; margin-bottom: 0; }
.choice.sel::before, .choice.ok::before, .choice.ko::before { top: 0; bottom: 0; width: 6px; }
.choice.sel::before { background: linear-gradient(180deg, var(--primary), var(--primary-dark)); }
.choice.ok::before { background: var(--green); }
.choice.ko::before { background: var(--red); }
.choice .key { border-radius: 50%; border-color: var(--line-strong); }

/* Correction : bandeau clair à liseré, avec une lueur de la couleur du résultat */
.lesson-foot.ok, .lesson-foot.ko { background: var(--surface); border-top: 3px solid var(--line); }
.lesson-foot.ok { border-top-color: var(--green); box-shadow: inset 0 16px 30px -24px var(--green); }
.lesson-foot.ko { border-top-color: var(--red); box-shadow: inset 0 16px 30px -24px var(--red); }

/* Cartes de fin : pastilles serties */
.rcard { border: 0; border-radius: 20px; background: var(--surface); box-shadow: var(--lift), inset 0 0 0 2px var(--rc); }
.rcard .h { background: var(--rc); letter-spacing: .03em; text-transform: none; font-size: 12.5px; padding: 6px 4px 5px; font-weight: 600; }
.rcard .b { background: var(--surface); margin: 0; border-radius: 0 0 18px 18px; }

/* Surfaces : relief doux plutôt que traits épais */
.card { border-radius: var(--radius); box-shadow: var(--lift-sm); }
.unit-banner { border-radius: 24px; box-shadow: var(--lift); }
.modal { border-radius: 28px; box-shadow: var(--lift); }
.toast { border-radius: 999px; box-shadow: var(--lift); padding-right: 18px; }
.tool { border-radius: 22px; box-shadow: var(--lift-sm); }
.tool .ti { border-radius: 50%; box-shadow: var(--lift-sm), inset 0 2px 0 rgba(255, 255, 255, .4); background-image: var(--gloss); background-blend-mode: soft-light; }
.badge-big, .badge .bi { background-image: var(--gloss); background-blend-mode: soft-light; }
.mic-btn { background-image: var(--gloss); background-blend-mode: soft-light; box-shadow: var(--lift); }
.start-bubble { border-radius: 999px; box-shadow: var(--lift-sm); letter-spacing: 0; text-transform: none; font-weight: 600; }
.pill, .chip { border-radius: 999px; }
.lesson-progress, .lesson-progress i { border-radius: 999px; }
.lesson-progress i { background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--pink))); }
.bar, .bar i { border-radius: 999px; }
.stat { border-radius: 999px; }
.nav-item { border-radius: 16px; }

/* ================================================================
   ACCUEIL : la séance du jour, puis les unités en lignes lisibles
   ================================================================ */
.today { position: relative; border-radius: 28px; overflow: hidden; color: #fff; box-shadow: var(--lift); margin-bottom: 26px;
  background: radial-gradient(135% 110% at 12% 0%, color-mix(in srgb, var(--uc) 70%, #fff) 0%, var(--uc) 45%, var(--ud) 100%); }
.today::after { content: ''; position: absolute; left: -30%; right: -30%; bottom: -62%; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .09); }
.today-in { position: relative; z-index: 1; padding: 22px 20px 20px; max-width: 460px; }
.today-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; background: rgba(255, 255, 255, .2); padding: 5px 12px; border-radius: 999px; margin-bottom: 12px; }
.today h2 { font-size: clamp(21px, 5.6vw, 26px); line-height: 1.18; margin-bottom: 6px; color: #fff; }
.today p { font-size: 14.5px; font-weight: 500; opacity: .88; margin: 0 0 16px; max-width: 34ch; }
.today-go { --b: #fff; --s: rgba(0, 0, 0, .25); --t: #5F1FD1; width: 100%; max-width: 330px; justify-content: space-between; padding-left: 22px; }
.today-go .ic { width: 30px; height: 30px; padding: 7px; border-radius: 50%; background: var(--primary); color: #fff; box-sizing: content-box; }
.today-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: 12.5px; font-weight: 600; opacity: .9; }
.today-meta span { position: relative; padding-left: 13px; }
.today-meta span::before { content: ''; position: absolute; left: 0; top: 6px; width: 6px; height: 6px; border-radius: 2px; background: rgba(255, 255, 255, .8); transform: rotate(45deg); }
.today-ah { position: absolute; right: -6px; bottom: -8px; opacity: .95; pointer-events: none; z-index: 0; }
@media (max-width: 420px) { .today-ah { display: none; } }

.unit { margin-bottom: 30px; }
.uhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.uhead .over { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.uhead h2 { font-size: 19px; color: var(--text); display: flex; align-items: center; gap: 7px; }
.uhead h2 .ic { width: 19px; height: 19px; color: var(--gold); }
.unit-guide { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--text-soft); border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.unit-guide:hover { border-color: var(--primary-line); color: var(--primary-text); }
.unit-guide .ic { width: 16px; height: 16px; }
.umeter { height: 7px; border-radius: 999px; background: var(--line); overflow: hidden; margin-bottom: 14px; }
.umeter i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--uc), color-mix(in srgb, var(--uc) 55%, var(--pink))); transition: width .4s; }

.lrows { display: grid; gap: 9px; }
.lrow { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; cursor: pointer; font: inherit; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 18px; padding: 11px 13px;
  box-shadow: 0 7px 16px -14px rgba(46, 20, 90, .6); transition: transform .12s, border-color .12s, box-shadow .12s; position: relative; }
.lrow:hover { border-color: var(--primary-line); transform: translateY(-1px); }
/* La barre du haut est fixe : on garde de la place quand on amène une ligne à l'écran */
.lrow, .jump-bubble, .uhead { scroll-margin-top: 96px; }
.lrow:active { transform: translateY(1px); }
.lrow.done { background: transparent; border-style: dashed; box-shadow: none; }
.lrow.locked { opacity: .62; }
.lrow.current { border: 2px solid var(--uc); box-shadow: var(--lift-sm); }
.lrow .node-wrap { flex: none; margin: 0; }
.lrow .node { width: 44px; height: 44px; border-radius: 15px; box-shadow: inset 0 -3px 7px rgba(0, 0, 0, .18), inset 0 2px 5px rgba(255, 255, 255, .35); }
.lrow .node::after { display: none; }
.lrow .node .ic { width: 22px; height: 22px; }
.lrow-t { flex: 1; min-width: 0; }
.lrow-t b { display: block; font-weight: 600; font-size: 15.5px; line-height: 1.25; }
.lrow-t small { color: var(--text-soft); font-weight: 500; font-size: 12.5px; }
.lrow-k { flex: none; font-size: 11.5px; font-weight: 700; color: var(--text-faint); background: var(--surface-2); padding: 5px 10px; border-radius: 999px; }
.lrow.done .lrow-k { color: var(--green-text); background: var(--green-soft); }
.lrow.current .lrow-k { color: #fff; background: var(--uc); }
/* La bulle d'une ligne s'ouvre sous la ligne entière, sur toute sa largeur */
.lrow.has-pop { z-index: 30; }
.lrow .popover { position: absolute; left: 0; right: 0; top: calc(100% + 10px); width: auto; transform: none; border-radius: 20px; }
.lrow .popover::before, .lrow .popover::after { left: 42px; }
/* « Sauter ici ? » : un bouton posé dans l'en-tête de l'unité, plus une bulle flottante */
.jump-bubble { position: relative; bottom: auto; left: auto; transform: none; display: inline-flex; margin: 0 0 12px;
  box-shadow: var(--lift-sm); border-radius: 999px; text-transform: none; letter-spacing: 0; font: 600 14px/1 var(--font);
  padding: 10px 16px 10px 12px; border-color: var(--primary-line); }
.jump-bubble::after { display: none; }
.jump-bubble:active { transform: translateY(1px); box-shadow: var(--lift-sm); }
