/*
 * Fais 10 ! — styles du MVP.
 * Les couleurs et tailles viennent de js/config.js (injectées en variables CSS au démarrage).
 */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: 'Baloo 2', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* Taille d'un bloc : 80 px, réduite sur les très petits écrans. */
:root {
  --b: min(calc(var(--bloc) * 1), 21vw);
  --police-b: calc(var(--b) * 0.65);
  --rayon-b: calc(var(--b) * 0.225);
}

#app {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  height: 100dvh;
  position: relative;
  overflow: hidden;
  background: var(--fond);
}

/* Sur ordinateur : l'app s'affiche dans un cadre de téléphone (390 × 844). */
@media (min-width: 560px) and (min-height: 600px) {
  body {
    display: grid; place-items: center; min-height: 100dvh;
    background:
      radial-gradient(circle at 20% 15%, rgba(140,108,255,.18) 0 140px, transparent 141px),
      radial-gradient(circle at 85% 80%, rgba(255,196,46,.22) 0 180px, transparent 181px),
      var(--page);
  }
  #app {
    width: 390px; max-width: none; margin: 0;
    height: min(844px, calc(100dvh - 48px));
    border: 10px solid var(--ink); border-radius: 52px;
    box-shadow: 0 0 0 3px #4A4470, 14px 18px 0 rgba(31,26,61,.28), 0 30px 60px rgba(31,26,61,.25);
    transform: translateZ(0); /* clippe les enfants arrondis */
  }
  #app::before { /* encoche */
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 70;
    width: 110px; height: 22px; background: var(--ink); border-radius: 0 0 16px 16px; pointer-events: none;
  }
  .ecran { padding-top: 34px; }
}
#couche-drag { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

.ecran {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
}
.ecran.clair { background: var(--fondClair); }
.ecran-jeu { touch-action: none; }

/* ---------- Éléments communs ---------- */
.titre { font-weight: 800; font-size: 44px; line-height: 1.05; text-align: center; margin: 0; }
.texte { font-weight: 700; font-size: 24px; text-align: center; margin: 0; }
.espace { flex: 1; }

.btn {
  width: 100%; min-height: 72px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--bouton); border: var(--contour) solid var(--ink); border-radius: 22px;
  box-shadow: 0 var(--ombre) 0 var(--ink);
  font-weight: 800; font-size: 30px; padding: 4px 16px 0;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.btn.vert { background: var(--boutonVert); }
.btn:disabled { opacity: .45; }
.btn svg { width: 30px; height: 30px; flex: none; }

.rond {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  background: #fff; border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
  display: grid; place-items: center; padding: 0;
}
.rond svg { width: 26px; height: 26px; }

.chip {
  background: #fff; border: 3px solid var(--ink); border-radius: 999px;
  padding: 2px 16px 0; font-weight: 800; font-size: 20px; box-shadow: 0 3px 0 var(--ink);
}
.pastille {
  display: inline-block; background: var(--cible); border: 3px solid var(--ink); border-radius: 999px;
  padding: 0 14px; font-weight: 800;
}

/* ---------- Blocs ---------- */
.bloc {
  width: var(--b); height: var(--b); flex: none; position: relative;
  border-radius: var(--rayon-b); background: var(--c);
  border: var(--contour) solid var(--ink); box-shadow: 0 var(--ombre) 0 var(--ink);
  display: grid; place-items: center;
  font-weight: 800; font-size: var(--police-b); line-height: 1; padding-top: calc(var(--b) * .08);
  touch-action: none;
}
.bloc.verrou { border-width: var(--contourVerrou); }
.bloc .cadenas {
  position: absolute; top: -14px; right: -14px; width: 30px; height: 30px; padding: 0;
  background: #fff; border: 3px solid var(--ink); border-radius: 50%; display: grid; place-items: center;
}
.bloc .cadenas svg { width: 17px; height: 17px; }
.bloc.tenu { position: fixed; margin: 0; box-shadow: 6px 14px 0 var(--ink); transform: rotate(-6deg) scale(1.06); z-index: 60; }

/* ---------- Écran de jeu ---------- */
.entete { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.cible {
  margin-top: 6px;
  background: var(--cible); border: var(--contour) solid var(--ink); border-radius: 999px;
  padding: 2px 30px 0; font-weight: 800; font-size: 44px; line-height: 62px; box-shadow: 0 var(--ombre) 0 var(--ink);
}
.chrono {
  width: 78%; height: 14px; margin-top: 12px; flex: none;
  background: #fff; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden;
}
.chrono i { display: block; height: 100%; width: 100%; background: var(--zone); }
.chrono.urgent i { background: #E8590C; }

.bande {
  width: calc(100% + 32px); margin: 18px -16px 0;
  height: calc(var(--b) + 34px); flex: none; position: relative; overflow: hidden;
  background: var(--bande); border-top: 4px solid var(--bandeBord); border-bottom: 4px solid var(--bandeBord);
}
.bande .bloc { position: absolute; left: 0; top: 13px; will-change: transform; }

.milieu { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 0; }
.message { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.calcul { display: flex; align-items: center; justify-content: center; }
.op { width: 26px; text-align: center; font-weight: 800; font-size: 44px; flex: none; }
.case {
  padding: 6px; border-radius: calc(var(--rayon-b) + 8px); border: 4px solid transparent; flex: none;
  transition: background-color .12s;
}
.case .vide {
  width: var(--b); height: var(--b); border-radius: var(--rayon-b);
  border: 4px dashed #6F99BA; background: rgba(255,255,255,.6);
}
.apparait { animation: apparait .35s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes apparait { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.drag-actif .case.libre { border: 4px dashed var(--zone); background: rgba(43,138,62,.13); }
.drag-actif .case.libre.proche { background: rgba(43,138,62,.32); }

.total {
  margin-top: 14px;
  background: #fff; border: var(--contour) solid var(--ink); border-radius: 20px;
  padding: 2px 28px 0; font-weight: 800; font-size: 44px; box-shadow: 0 5px 0 var(--ink);
}
.total.juste { background: var(--juste); }
.total.trop { background: var(--trop); }
.bas { width: 100%; min-height: 96px; display: flex; align-items: flex-end; }

/* Main fantôme du niveau 1 */
.main-fantome {
  position: absolute; left: 0; top: 0; width: 60px; pointer-events: none; z-index: 40; opacity: .9;
  animation: geste 2.4s ease-in-out infinite;
}
@keyframes geste {
  0%, 12% { transform: translate(var(--x0), var(--y0)); opacity: 0; }
  20% { opacity: .9; }
  75% { transform: translate(var(--x1), var(--y1)); opacity: .9; }
  90%, 100% { transform: translate(var(--x1), var(--y1)); opacity: 0; }
}

/* ---------- Choix de l'âge ---------- */
.ages { display: grid; grid-template-columns: repeat(3, 84px); gap: 18px 26px; margin-top: 26px; }
.ages button {
  width: 84px; height: 84px; border-radius: 20px; background: #fff; border: var(--contour) solid var(--ink);
  box-shadow: 0 var(--ombre) 0 var(--ink); font-weight: 800; font-size: 46px; padding-top: 6px;
}
.ages button.choisi { background: var(--cible); outline: 6px solid rgba(255,196,46,.5); outline-offset: 3px; }

/* ---------- Profils ---------- */
.profils { display: grid; grid-template-columns: repeat(2, 140px); gap: 20px; margin-top: 28px; }
.tuile-profil {
  height: 170px; border-radius: 24px; background: #fff; border: var(--contour) solid var(--ink);
  box-shadow: 0 var(--ombre) 0 var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 0 0;
}
.tuile-profil:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.tuile-profil .age { font-weight: 800; font-size: 24px; line-height: 1; }
.tuile-profil .niveau { font-weight: 700; font-size: 16px; color: var(--gris); }
.tuile-profil .niveau .etoile { width: 22px; height: 22px; }
.tuile-profil.ajout { background: transparent; border-style: dashed; box-shadow: none; }
.tuile-profil.ajout svg { width: 48px; height: 48px; }
#profil svg.mascotte { margin-top: 6px; }
#profil { overflow: hidden; }

.liste-profils { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.profil-ligne {
  display: flex; flex-direction: column; align-items: stretch; gap: 8px; width: 100%;
  background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 6px 10px;
}
.profil-ligne .infos { flex: 1; display: flex; flex-direction: column; align-items: center; }
.profil-ligne .niveau { font-weight: 700; font-size: 15px; color: var(--gris); }
.pas { display: flex; align-items: center; gap: 4px; }
.pas span { min-width: 70px; text-align: center; font-weight: 800; font-size: 22px; padding-top: 3px; }
.rond.petit { width: 44px; height: 44px; box-shadow: 0 2px 0 var(--ink); }
.rond.petit svg { width: 22px; height: 22px; }
.rond:disabled { opacity: .35; }
.rond.confirmer { background: var(--trop); }
.aide { min-height: 26px; margin: 10px 0 0; font-weight: 700; font-size: 18px; color: var(--gris); }

/* ---------- Chemin ---------- */
.chemin { position: relative; width: 100%; flex: 1; }
.chemin svg.trace { position: absolute; inset: 0; width: 100%; height: 100%; }
.noeud {
  position: absolute; width: 58px; height: 58px; transform: translate(-50%, -50%);
  border-radius: 50%; border: var(--contour) solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  display: grid; place-items: center; font-weight: 800; font-size: 26px; padding: 4px 0 0;
}
.noeud.fait { background: var(--boutonVert); }
.noeud.encours { width: 74px; height: 74px; background: var(--cible); font-size: 34px; outline: 6px solid rgba(255,196,46,.45); outline-offset: 4px; }
.noeud.ferme { background: #fff; color: var(--gris); }
.chemin .repere-mascotte { position: absolute; transform: translate(0, -60%); pointer-events: none; }
.chapitre {
  display: flex; align-items: center; gap: 10px;
  background: #E2E6EE; border: 4px dashed var(--gris); border-radius: 20px;
  padding: 6px 18px 2px; font-weight: 800; font-size: 28px; color: var(--gris);
}
.chapitre.ouvert { background: #fff; color: var(--ink); border-style: solid; box-shadow: 0 5px 0 var(--ink); }
.chapitre svg { width: 30px; height: 30px; }

/* ---------- Médaille, chapitre fermé ---------- */
.medaille { position: relative; width: 300px; height: 300px; }
.medaille .etoile { position: absolute; width: 34px; height: 34px; }
.tuiles { display: grid; grid-template-columns: repeat(5, 52px); gap: 12px; margin-top: 20px; }
.tuiles.chapitres { grid-template-columns: repeat(4, 64px); }
.tuile {
  height: 52px; border-radius: 14px; background: #E2E6EE; border: 3px solid var(--gris);
  display: grid; place-items: center; font-weight: 800; font-size: 22px; color: var(--gris); padding-top: 3px;
}
.tuiles.chapitres .tuile { border-style: dashed; height: 44px; font-size: 20px; }

/* ---------- Parents ---------- */
.enonce { background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 8px 16px 4px; font-weight: 800; font-size: 26px; text-align: center; line-height: 1.15; margin-top: 8px; }
.saisie { display: flex; gap: 12px; margin-top: 24px; }
.saisie span { width: 64px; height: 76px; border-radius: 14px; background: #fff; border: 4px solid var(--ink); display: grid; place-items: center; font-weight: 800; font-size: 44px; padding-top: 6px; }
.saisie span:empty { border-style: dashed; }
.saisie.erreur { animation: secoue .35s; }
@keyframes secoue { 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
.clavier { display: grid; grid-template-columns: repeat(3, 88px); gap: 12px; margin-top: auto; }
.clavier button {
  height: 62px; border-radius: 16px; background: #fff; border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  font-weight: 800; font-size: 30px; display: grid; place-items: center; padding: 4px 0 0;
}
.clavier button.ok { background: var(--boutonVert); }
.clavier svg { width: 30px; height: 30px; }
.haut-parent { width: 100%; display: flex; align-items: center; gap: 12px; }

.offre { position: relative; width: 100%; background: #fff; border: var(--contour) solid var(--ink); border-radius: 24px; box-shadow: 0 var(--ombre) 0 var(--ink); padding: 14px 20px; margin-top: 26px; }
.offre.mise-en-avant { background: #FFF6D9; }
.offre h3 { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.1; }
.offre p { margin: 2px 0 0; font-size: 19px; font-weight: 600; color: var(--gris); }
.offre .prix { display: inline-block; margin-top: 10px; border: 3px dashed var(--gris); border-radius: 12px; padding: 2px 12px 0; font-weight: 800; color: var(--gris); }
.offre .badge { position: absolute; top: -18px; right: 18px; background: var(--mascotte); color: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 1px 12px 0; font-weight: 800; font-size: 16px; }
.lien { background: none; border: none; text-decoration: underline; font-weight: 700; font-size: 19px; min-height: 44px; }

/* ---------- Confettis ---------- */
.confettis { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 30; }
.confettis i {
  position: absolute; top: -30px; width: 12px; height: 20px; border: 2px solid var(--ink); border-radius: 3px;
  animation: tombe linear forwards;
}
@keyframes tombe { to { transform: translateY(110dvh) rotate(540deg); } }
@media (prefers-reduced-motion: reduce) {
  .confettis { display: none; }
  .main-fantome { animation-duration: 4s; }
}

/* ---------- Habillage de l'écran de jeu ---------- */
.ecran-jeu {
  background:
    radial-gradient(circle, rgba(255,255,255,.55) 2.5px, transparent 3px) 0 0 / 28px 28px,
    var(--fond);
}

.ecran-jeu > :not(.main-fantome):not(.confettis):not(.sol) { position: relative; z-index: 1; }
.ecran-jeu .bande { position: relative; box-shadow: 0 6px 0 rgba(31,26,61,.12) inset, 0 5px 0 rgba(31,26,61,.15); }
.ecran-jeu .cible { position: relative; }
.ecran-jeu .cible::before { /* reflet */
  content: ''; position: absolute; left: 22px; right: 22px; top: 6px; height: 8px; border-radius: 999px; background: rgba(255,255,255,.55);
}
.ecran-jeu .calcul {
  background: rgba(255,255,255,.75); border: 4px solid var(--ink); border-radius: 30px;
  box-shadow: 0 6px 0 var(--ink); padding: 18px 14px; margin-bottom: 4px;
}
.ecran-jeu .calcul .case .vide { border-color: #5F8BAE; background: #fff; }
.ecran-jeu .total { box-shadow: 0 5px 0 var(--ink); transition: background-color .2s, transform .2s; }
.ecran-jeu .total.juste { transform: scale(1.08); }
.ecran-jeu .bloc { box-shadow: 0 var(--ombre) 0 var(--ink), inset 0 6px 0 rgba(255,255,255,.35); }
.ecran-jeu .bloc.tenu { box-shadow: 6px 14px 0 var(--ink), inset 0 6px 0 rgba(255,255,255,.35); }
.ecran-jeu .chip, .ecran-jeu .rond { transition: transform .1s; }
.ecran-jeu .rond:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.ecran-jeu .bas { position: relative; z-index: 1; }

/* ---------- Décor du chemin ---------- */
.decor { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.ecran-chemin > :not(.decor) { position: relative; z-index: 1; }
.ecran-chemin .chemin { position: relative; container-type: size; }
.ecran-chemin .chemin svg.trace polyline { stroke: #fff; opacity: .9; }
.ecran-chemin .chapitre:not(.ouvert) { background: rgba(255,255,255,.9); }

/* ---------- Niveaux en relief (pierres rondes 3D) ---------- */
.ecran-chemin .noeud {
  --haut: #F4F8FF; --base: #C9D6EA; --cote: #8296BB; --txt: #4A5680;
  --d: clamp(34px, 6.6cqh, 52px);
  width: var(--d); height: var(--d); border-radius: 50%;
  border: 3px solid rgba(255,255,255,.9);
  background: radial-gradient(circle at 34% 26%, var(--haut) 0 18%, var(--base) 62%, var(--cote) 130%);
  color: var(--txt); font-size: calc(var(--d) * .46);
  box-shadow: 0 6px 0 var(--cote), 0 11px 10px rgba(7,32,82,.38), inset 0 -5px 0 rgba(0,0,0,.1), inset 0 4px 0 rgba(255,255,255,.6);
  transition: transform .12s, box-shadow .12s;
}
.ecran-chemin .noeud:active:not(:disabled) { transform: translate(-50%, calc(-50% + 5px)); box-shadow: 0 3px 0 var(--cote), 0 6px 8px rgba(7,32,82,.35), inset 0 4px 0 rgba(255,255,255,.6); }
.ecran-chemin .noeud:disabled { opacity: 1; }
.ecran-chemin .noeud.fait { --haut: #B9F7C9; --base: #2FCB6B; --cote: #138449; --txt: #0E3B22; }
.ecran-chemin .noeud.fait::after { /* étoile de réussite */
  content: ''; position: absolute; top: -9px; right: -9px; width: 20px; height: 20px; background: #FFD23F;
  clip-path: polygon(50% 0, 63% 33%, 98% 36%, 71% 58%, 80% 92%, 50% 73%, 20% 92%, 29% 58%, 2% 36%, 37% 33%);
  filter: drop-shadow(0 2px 0 #B27A00);
}
.ecran-chemin .noeud.encours {
  --haut: #FFF2A0; --base: #FFB81F; --cote: #C46F00; --txt: #4A2600;
  --d: clamp(40px, 7.8cqh, 62px); font-size: calc(var(--d) * .5); outline: none; z-index: 3;
  border-color: #fff; animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 6px 0 var(--cote), 0 12px 12px rgba(7,32,82,.38), inset 0 -4px 0 rgba(0,0,0,.1), inset 0 4px 0 rgba(255,255,255,.65), 0 0 0 4px rgba(255,255,255,.7), 0 0 0 8px rgba(255,226,122,.55); }
  50% { box-shadow: 0 6px 0 var(--cote), 0 12px 12px rgba(7,32,82,.38), inset 0 -4px 0 rgba(0,0,0,.1), inset 0 4px 0 rgba(255,255,255,.65), 0 0 0 4px rgba(255,255,255,.7), 0 0 0 16px rgba(255,226,122,0); }
}
.ecran-chemin .noeud span, .ecran-chemin .noeud { text-shadow: 0 2px 0 rgba(255,255,255,.4); }
.ecran-chemin .repere-mascotte svg { filter: drop-shadow(0 6px 4px rgba(7,32,82,.35)); }
.ecran-chemin .rond { box-shadow: 0 4px 0 #8296BB, 0 8px 8px rgba(7,32,82,.3); border-color: #fff; }
.ecran-chemin .chapitre { border: 4px solid #fff; box-shadow: 0 5px 0 rgba(7,32,82,.35); }
@media (prefers-reduced-motion: reduce) { .ecran-chemin .noeud.encours { animation: none; } }

/* ---------- Surnom (facultatif, saisi par le parent) ---------- */
.surnom-champ {
  flex: 1 0 100%; min-height: 44px; font: inherit; font-weight: 700; font-size: 20px; color: var(--ink);
  border: 3px solid var(--ink); border-radius: 12px; padding: 4px 12px 0; background: #F4F8FF;
  user-select: text; -webkit-user-select: text;
}
.surnom-champ::placeholder { color: #6B7090; font-weight: 600; }
.surnom-champ:focus { outline: 3px solid var(--cible); outline-offset: 2px; }
.tuile-profil .surnom { font-weight: 800; font-size: 22px; line-height: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 8px; }
.tuile-profil .surnom + .age { font-size: 16px; color: var(--gris); }

.profil-haut, .profil-controles { display: flex; align-items: center; gap: 10px; width: 100%; }
.profil-haut svg { flex: none; display: block; }
.profil-haut .surnom-champ { flex: 1; min-width: 0; width: auto; text-align: center; }
.profil-haut .niveau { flex: none; font-weight: 700; font-size: 15px; color: var(--gris); padding-top: 3px; }
.profil-controles { justify-content: space-between; }
.profil-controles .pas { gap: 6px; }
.profil-controles .pas span { min-width: 64px; line-height: 1; }
.rond.petit svg { display: block; }

/* ---------- Jeu : objectif en haut, bande de blocs juste au-dessus du calcul ---------- */
.ecran-jeu .cible { margin: 22px 0 0; font-size: 46px; padding: 0 34px; line-height: 64px; }
.ecran-jeu .chrono { width: 78%; margin-top: 14px; height: 14px; }
.ecran-jeu .bande { margin: auto -16px; }            /* centrée entre « Fais n ! » et le calcul */
.ecran-jeu .milieu { flex: 0 0 auto; }
.ecran-jeu:has(.message:not(:empty)) .milieu { flex: 1; } /* fin de manche : le message prend la place */

/* ---------- Décor du bas de l'écran de jeu ---------- */
.ecran-jeu .sol { position: absolute; left: 0; right: 0; bottom: 0; height: 190px; z-index: 0; pointer-events: none; overflow: hidden; }
.ecran-jeu .sol svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ecran-jeu .bas { z-index: 2; }

/* ---------- Offres ---------- */
.ecran-offres .offre { margin-top: 24px; padding: 12px 20px; }
.ecran-offres .offre:first-of-type { margin-top: 28px; }
.ligne-prix { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.prix-grand { font-weight: 800; font-size: 38px; line-height: 1; padding-top: 6px; }
.btn.acheter { width: auto; min-height: 56px; font-size: 24px; padding: 4px 24px 0; border-radius: 18px; }

/* ---------- Objectif sous le calcul : « Fais n ! » puis « Bravo ! n » ---------- */
.ecran-jeu .cible { margin: 10px 0 0; perspective: 500px; transition: background-color .2s; font-size: 52px; padding: 0 40px; line-height: 72px; }
.ecran-jeu .cible.gagne { background: var(--juste); }
.ecran-jeu .cible.gagne::before { display: none; }


/* ---------- Carte du calcul : l'équation, puis « Encore n » ---------- */
.ecran-jeu .calcul { background: none; border: 0; box-shadow: none; padding: 0; margin: 0; }
.carte {
  width: 100%; flex: none; display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 8px;
  background: rgba(255,255,255,.9); border: 4px solid var(--ink); border-radius: 30px; box-shadow: 0 6px 0 var(--ink); padding: 20px 12px 14px;
}
.carte { position: relative; padding: 22px 8px 18px; }
.carte .case { padding: 3px; }
.carte .op { width: 22px; }
.carte { background: #F4FAFF; margin-top: 30px; } /* place pour l'onglet */
.reste { /* micro-aide : onglet « = 6 » collé au bord haut de la carte */
  --onglet: #F4FAFF;
  position: absolute; top: -34px; right: 30px; height: 34px; min-width: 74px; padding: 5px 16px 0; text-align: center;
  font-weight: 800; font-size: 21px; line-height: 26px; color: #7C86A8;
  background: var(--onglet); border: 4px solid var(--ink); border-bottom: 0; border-radius: 14px 14px 0 0;
  transition: color .2s, background-color .2s;
}
.reste::after { /* efface le trait de la carte sous l'onglet */
  content: ''; position: absolute; left: 0; right: 0; bottom: -4px; height: 4px; background: var(--onglet); transition: background-color .2s;
}
.reste.juste { --onglet: var(--juste); color: #1F6B36; }
.reste.trop { --onglet: var(--trop); color: #A12A2A; }
.reste.pop { animation: pop .3s ease-out; }
@keyframes pop { 0% { transform: scale(.8); } 100% { transform: scale(1); } }

/* « Fais n ! » sous la carte du calcul : la consigne est juste à côté de ce qu'on manipule */
.ecran-jeu .cible { margin: 22px 0 0; font-size: 46px; padding: 0 36px; line-height: 64px; }
.carte { margin-bottom: 0; }
