/* Mise en page : chemin des niveaux | scène 3D | panneau de la leçon.
   Une scène « ciel de jeu » qui met le cube en vedette, des cartes calmes autour. */
:root {
  --bg: #edf1f8;
  --surface: #ffffff;
  --surface-2: #f4f6fb;
  --ink: #1b2140;
  --muted: #586085;
  --line: #d8deeb;
  --sun: #ffc530;
  --sun-ink: #2b2100;
  --sky: #2d5bff;
  --ok: #138a4c;
  --stage-a: #dfe8f7;
  --stage-b: #c7d4ee;
  --chip: #e6ebf6;
  --cell-on: #a9bdff;

  /* les couleurs du cube */
  --c-white: #f6f6ef;
  --c-yellow: #ffd21a;
  --c-green: #00a650;
  --c-blue: #1f5fe0;
  --c-red: #e3233a;
  --c-orange: #ff7417;

  --font-display: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;

  --radius: 22px;
  --shadow: 0 1px 0 rgba(27, 33, 64, .04), 0 10px 30px -18px rgba(27, 33, 64, .35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1329;
    --surface: #181d38;
    --surface-2: #1f2546;
    --ink: #eef1ff;
    --muted: #a3abcd;
    --line: #2d3461;
    --sky: #8aa4ff;
    --ok: #4cd08a;
    --stage-a: #222a52;
    --stage-b: #121731;
    --chip: #262d55;
    --cell-on: #5d78e0;
    --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 14px 34px -20px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1329;
  --surface: #181d38;
  --surface-2: #1f2546;
  --ink: #eef1ff;
  --muted: #a3abcd;
  --line: #2d3461;
  --sky: #8aa4ff;
  --ok: #4cd08a;
  --stage-a: #222a52;
  --stage-b: #121731;
  --chip: #262d55;
  --cell-on: #5d78e0;
  --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 14px 34px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { display: block; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

.app {
  max-width: 1440px;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: 12px 28px;
}

/* ---------- Barre du haut ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 4px 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
.mascot { width: 46px; height: 46px; flex: none; }
.mascot.small { width: 52px; height: 52px; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -.01em;
  line-height: 1;
}
.modes {
  display: flex;
  background: var(--chip);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}
.mode {
  border: 0;
  background: transparent;
  padding: 8px 18px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--muted);
}
.mode[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.voice {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 14px 7px 10px;
  font-weight: 700;
}
.voice svg { width: 22px; height: 22px; }
.voice .mute { display: none; }
.voice[aria-pressed="false"] { color: var(--muted); }
.voice[aria-pressed="false"] .wave { display: none; }
.voice[aria-pressed="false"] .mute { display: block; }

/* ---------- Grille principale ---------- */
.layout {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr) minmax(340px, 420px);
  grid-template-areas: "path stage panel";
  gap: 18px;
  align-items: start;
}
.path { grid-area: path; }
.stage-wrap { grid-area: stage; min-width: 0; }
.lesson, .play { grid-area: panel; min-width: 0; }
@media (min-width: 981px) {
  /* Le panneau reste à côté du cube et défile tout seul. */
  .lesson, .play {
    position: sticky;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    max-height: calc(100vh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    scrollbar-width: thin;
  }
}
.layout[data-mode="learn"] .play { display: none; }
.layout[data-mode="play"] .lesson,
.layout[data-mode="play"] .path,
.layout[data-mode="play"] .controls { display: none; }
.layout[data-mode="play"] { grid-template-columns: minmax(0, 1fr) minmax(340px, 440px); grid-template-areas: "stage panel"; }

/* ---------- Chemin des niveaux ---------- */
.path {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
}
.path-title {
  margin: 0 0 8px 6px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.levels {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.level {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 7px 10px 7px 6px;
  border-radius: 16px;
  position: relative;
}
.level:hover { background: var(--surface-2); }
.level[aria-current="step"] { background: var(--surface); box-shadow: var(--shadow); }
.level-dot {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  color: var(--ink);
  background: var(--chip);
  border: 3px solid var(--dot, var(--line));
  position: relative;
}
.level[data-group="white"] { --dot: #c9cdd6; --dot-fill: var(--c-white); }
.level[data-group="middle"] { --dot: var(--c-green); --dot-fill: #d5f2e2; }
.level[data-group="yellow"] { --dot: #e7b400; --dot-fill: #fff2bf; }
.level[data-group] .level-dot { background: var(--dot-fill, var(--chip)); color: #1b2140; }
.level[data-group="intro"] .level-dot { background: var(--chip); color: var(--ink); }
.level-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.level-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.level-sub { font-size: 13px; color: var(--muted); }
.level-star {
  position: absolute;
  right: -6px;
  top: -6px;
  width: 20px;
  height: 20px;
  color: var(--sun);
  filter: drop-shadow(0 1px 0 rgba(27, 33, 64, .45));
}

/* ---------- Scène ---------- */
.stage {
  position: relative;
  height: clamp(360px, calc(100vh - 290px), 700px);
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 18%, var(--stage-a) 0%, var(--stage-b) 100%);
  box-shadow: inset 0 0 0 1px var(--line);
}
.stage canvas { display: block; }
.stage-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
  white-space: nowrap;
}
/* Le geste en cours, en grand, juste sous le cube */
.move-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 8px 18px 8px 8px;
  min-height: 78px;
  background: var(--surface);
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 5px 0 var(--ink);
}
.move-pill.pop { animation: pop .22s ease-out; }
.move-pill[data-idle="true"] { border-color: var(--line); box-shadow: none; }
.move-pill[data-idle="true"] strong { font-size: 18px; color: var(--muted); }
.move-pill .move-icon { width: 56px; height: 56px; flex: none; display: grid; place-items: center; }
.move-pill .move-icon > svg { width: 56px; height: 56px; }
.move-pill-text { display: flex; flex-direction: column; line-height: 1.12; min-width: 0; }
.move-pill-text strong { font-family: var(--font-display); font-weight: 800; font-size: 23px; text-wrap: balance; }
.move-pill-text small { color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.layout[data-mode="play"] .move-pill { display: none; }

/* Rappel : comment tenir le cube */
.hold {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.25;
  pointer-events: none;
  max-width: calc(100% - 140px);
}
.hold-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.hold-item { display: flex; align-items: center; gap: 7px; }
.hold-item b { font-family: var(--font-display); font-weight: 800; font-size: 16px; }
.hold-dot {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 2px solid #1b2140;
  flex: none;
  background: var(--dot, #ccc);
}
@keyframes pop { from { transform: scale(.94); opacity: .4; } to { transform: scale(1); opacity: 1; } }

.recenter {
  position: absolute;
  right: 12px;
  top: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}
.recenter svg { width: 18px; height: 18px; }
.bravo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-6deg);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(48px, 9vw, 96px);
  color: var(--sun);
  -webkit-text-stroke: 3px #1b2140;
  paint-order: stroke fill;
  text-shadow: 0 6px 0 #1b2140;
  pointer-events: none;
  animation: stamp .5s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes stamp { from { transform: translate(-50%, -50%) rotate(-6deg) scale(2.2); opacity: 0; } }

/* ---------- Commandes ---------- */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 14px;
}
.ctl {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 9px 16px 9px 12px;
  font-weight: 700;
  font-size: 16px;
}
.ctl svg { width: 22px; height: 22px; }
.ctl:hover { border-color: var(--muted); }
.ctl-main {
  background: var(--sun);
  border-color: var(--sun);
  color: var(--sun-ink);
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  padding: 10px 26px 10px 20px;
  box-shadow: 0 4px 0 #c9940a;
}
.ctl-main:hover { border-color: #e9ab12; }
.ctl-main:active { transform: translateY(2px); box-shadow: 0 2px 0 #c9940a; }
.ctl-main svg { width: 26px; height: 26px; }
.ctl-main-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.ctl-main-text small { font-family: var(--font-body); font-size: 12px; font-weight: 700; opacity: .75; }
.ctl-main-text small:empty { display: none; }
.ctl-auto .i-pause { display: none; }
.ctl-auto[data-playing="true"] .i-play { display: none; }
.ctl-auto[data-playing="true"] .i-pause { display: block; }
.ctl-auto[data-playing="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.speed {
  display: flex;
  background: var(--chip);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.speed-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}
.speed-btn svg { width: 24px; height: 18px; }
.speed-btn[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Panneau ---------- */
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.lesson-head { display: flex; gap: 14px; align-items: center; }
.level-badge {
  flex: none;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  background: var(--badge, var(--chip));
  color: #1b2140;
  border: 3px solid var(--badge-edge, var(--line));
}
.level-badge[data-group="intro"] { color: var(--ink); }
.level-badge[data-group="white"] { --badge: var(--c-white); --badge-edge: #c9cdd6; }
.level-badge[data-group="middle"] { --badge: #d5f2e2; --badge-edge: var(--c-green); }
.level-badge[data-group="yellow"] { --badge: #fff2bf; --badge-edge: #e7b400; }
.play-badge { --badge: var(--sun); --badge-edge: #e9ab12; }
.play-badge svg { width: 26px; height: 26px; }
.lesson-titles { min-width: 0; }
.eyebrow {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  line-height: 1.05;
  text-wrap: balance;
}
.subtitle { margin: 2px 0 0; color: var(--muted); }

.bubble { display: flex; gap: 10px; align-items: flex-start; }
.bubble .mascot { margin-top: 4px; }
.bubble-body {
  position: relative;
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 2px solid var(--line);
  border-radius: 6px 20px 20px 20px;
  padding: 12px 14px 10px;
}
.bubble-body p {
  margin: 0 0 8px;
  font-size: 19px;
  line-height: 1.45;
}
.listen {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--sky);
  font-weight: 700;
  font-size: 15px;
  padding: 2px 0;
}
.listen svg { width: 20px; height: 20px; }
.bubble-body .voice-help {
  margin: 8px 0 2px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--chip);
  font-size: 14px;
  line-height: 1.4;
}
.voice-help strong { display: block; font-family: var(--font-display); font-size: 15px; }

.label {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.label .count { letter-spacing: 0; text-transform: none; font-weight: 400; }
.cases { display: flex; flex-wrap: wrap; gap: 8px; }
.case {
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 15px;
}
.case:hover { border-color: var(--muted); }
.case[aria-selected="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

.recipe-card {
  background: #fff8dc;
  color: #1b2140;
  border: 2px dashed #e7b400;
  border-radius: 18px;
  padding: 12px 14px;
}
.recipe-card .label { color: #6b5a12; }
.recipe-name { margin: -2px 0 8px; font-family: var(--font-display); font-weight: 800; font-size: 20px; }
.recipe-moves { display: flex; flex-wrap: wrap; gap: 6px; }
.recipe-moves .tile { background: #fff; border-color: #f0dc8f; color: #1b2140; }
.recipe-moves .tile small { color: #6b5a12; }

/* Tuiles des gestes */
.demo { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.demo-seg { display: flex; flex-direction: column; gap: 6px; }
.demo-seg-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--muted);
}
.demo-seg[data-state="current"] .demo-seg-label { color: var(--ink); }
.demo-tiles { display: flex; flex-wrap: wrap; gap: 6px; }
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 78px;
  padding: 6px 4px 5px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: center;
  line-height: 1.1;
}
.tile .move-icon { width: 38px; height: 38px; }
.tile span { font-size: 12.5px; font-weight: 700; }
.tile small { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
button.tile:hover { border-color: var(--muted); }
.tile[data-state="done"] { opacity: .5; }
.tile[data-state="current"] {
  border-color: var(--ink);
  background: var(--sun);
  color: #1b2140;
  transform: translateY(-2px);
  box-shadow: 0 3px 0 var(--ink);
}
.tile[data-state="current"] small { color: #4a3d07; }

/* Icônes des gestes : une face 3×3 vue de devant */
.move-icon .cell { fill: var(--chip); }
.move-icon .cell.on { fill: var(--cell-on); }
.move-icon .arrow { stroke: var(--ink); fill: none; stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; }
.move-icon .head { fill: var(--ink); }
.move-icon .x2 { font: 800 13px var(--font-display); fill: #1b2140; }
.move-icon .x2bg { fill: var(--sun); stroke: var(--ink); stroke-width: 1.5; }
.tile[data-state="current"] .move-icon .cell { fill: rgba(255, 255, 255, .55); }
.tile[data-state="current"] .move-icon .cell.on { fill: #fff; }
.tile[data-state="current"] .move-icon .arrow { stroke: #1b2140; }
.tile[data-state="current"] .move-icon .head { fill: #1b2140; }
.recipe-moves .move-icon .cell { fill: #f5ecc6; }
.recipe-moves .move-icon .cell.on { fill: #ffd84d; }
.recipe-moves .move-icon .arrow { stroke: #1b2140; }
.recipe-moves .move-icon .head { fill: #1b2140; }

.tip {
  background: var(--surface-2);
  border-radius: 16px;
  padding: 12px 14px;
}
.tip strong { font-family: var(--font-display); font-size: 17px; }
.tip p { margin: 2px 0 0; }

.lesson-foot { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
}
.btn svg { width: 20px; height: 20px; }
.btn:hover { border-color: var(--muted); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.primary {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--ok) 60%, #000);
}
.btn.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 color-mix(in srgb, var(--ok) 60%, #000); }
.btn.primary svg { color: var(--sun); }

/* ---------- Mode libre ---------- */
.pad {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.pad-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 16px;
  padding: 8px 10px;
  text-align: left;
  min-width: 0;
}
.pad-btn:hover { border-color: var(--muted); }
.pad-btn:active { background: var(--sun); color: #1b2140; }
.pad-btn .move-icon { width: 42px; height: 42px; flex: none; }
.pad-btn span { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.pad-btn strong { font-size: 15px; }
.pad-btn small { color: var(--muted); font-size: 12px; }
.play-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.play-status {
  margin: 0;
  font-size: 18px;
  background: var(--surface-2);
  border-radius: 14px;
  padding: 10px 14px;
}
.play-status strong { font-family: var(--font-display); }
.play-keys { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- Bouton et fenêtre « Télécharger » ---------- */
.install-btn .i-ok { display: none; }
.install-btn[data-ready="true"] { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.install-btn[data-ready="true"] .i-dl { display: none; }
.install-btn[data-ready="true"] .i-ok { display: block; }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 13, 32, .55);
  overflow-y: auto;
}
.sheet {
  position: relative;
  width: min(100%, 480px);
  background: var(--surface);
  border-radius: 26px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .6);
  padding: 24px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: sheet-in .25s ease-out;
}
@keyframes sheet-in { from { transform: translateY(16px); opacity: 0; } }
.sheet .mascot { width: 54px; height: 54px; }
.sheet h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  line-height: 1.05;
  text-wrap: balance;
}
.sheet-lead { margin: 0; color: var(--muted); }
.sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--chip);
  display: grid;
  place-items: center;
}
.sheet-close svg { width: 20px; height: 20px; }
.sheet-steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sheet-step {
  counter-increment: step;
  position: relative;
  background: var(--surface-2);
  border-radius: 18px;
  padding: 14px 14px 14px 54px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.sheet-step::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 12px;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--surface);
  font-family: var(--font-display);
  font-weight: 800;
}
.sheet-step[data-done="true"]::before { content: "✓"; background: var(--ok); color: #fff; }
.sheet-step-title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 19px; line-height: 1.2; }
.sheet-note { margin: 0; font-size: 15px; color: var(--muted); }
.sheet-note strong { color: var(--ink); }
.progress {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: var(--chip);
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--c-green), var(--c-yellow));
  transition: width .25s ease-out;
}
.sheet-pc { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.sheet-pc a { color: var(--sky); font-weight: 700; }
.sheet-pc code { font-size: 13px; }

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* ---------- Écrans moyens : le chemin passe au-dessus ---------- */
@media (max-width: 1180px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
    grid-template-areas: "path path" "stage panel";
  }
  .path { position: static; }
  .path-title { display: none; }
  .levels { flex-direction: row; overflow-x: auto; padding: 6px 4px 8px; gap: 6px; scrollbar-width: thin; }
  .levels li { flex: none; }
  .level { width: auto; padding: 6px 12px 6px 6px; }
  .level-sub { display: none; }
  .stage { height: clamp(340px, calc(100vh - 360px), 640px); }
}

/* ---------- Tablettes en portrait : tout sur une colonne ---------- */
@media (max-width: 980px) {
  .layout,
  .layout[data-mode="play"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "path" "stage" "panel";
    gap: 12px;
  }
  .stage { height: min(60vh, 560px); }
}

/* ---------- Téléphones ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .brand-name { font-size: 24px; }
  .voice { padding: 8px 10px; }
  .voice span { display: none; }
  .sheet { padding: 20px 16px 16px; }
  .sheet h2 { font-size: 24px; }
  .mascot { width: 38px; height: 38px; }
  .topbar { gap: 10px; }
  .modes { order: 3; width: 100%; }
  .mode { flex: 1; padding: 8px 10px; }
  .level-name { font-size: 15px; }
  .level-dot { width: 32px; height: 32px; font-size: 16px; border-radius: 10px; }
  .stage { height: min(56vh, 440px); border-radius: 22px; }
  .controls { gap: 8px; }
  .ctl span { display: none; }
  .ctl { padding: 10px; }
  .ctl-main span { display: inline; }
  .ctl-main-text { display: flex; }
  .ctl-main-text small { display: block; }
  .move-pill-text strong { font-size: 18px; }
  .move-pill .move-icon { width: 46px; height: 46px; }
  .hold { font-size: 13px; }
  .speed-btn span { display: none; }
  .speed-btn[data-speed="1"] span { display: inline; }
  .panel { padding: 16px; }
  h1 { font-size: 27px; }
  .bubble-body p { font-size: 18px; }
  .tile { width: 70px; }
}

@media (prefers-reduced-motion: reduce) {
  .move-pill, .bravo { animation: none; }
  .tile[data-state="current"] { transform: none; }
}
