/* ============================================================
   La Pâtisserie des fractions — feuille de style
   Couleurs de macarons, formes rondes, trait brun chocolat, tout à plat.
   ============================================================ */
:root {
  --trait: #5B3A29;
  --creme: #FFF6E6;
  --blanc: #FFFDF8;
  --vanille: #FFE9B8;
  --beurre: #F6C453;
  --framboise: #E0527A;
  --rose: #F7A8B8;
  --rose-clair: #FDE3E8;
  --pistache: #A8CF8E;
  --pistache-clair: #DDEFD0;
  --caramel: #E2A65B;
  --choco: #8A5A3C;
  --ciel: #9FD3E8;
  --ciel-clair: #DDF1F8;
  --sable: #F1E2C8;
  --police: 'Fredoka', 'Baloo 2', ui-rounded, 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 20px; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--police); font-weight: 500; color: var(--trait);
  background-color: var(--creme);
  background-image: radial-gradient(#F6E7CC 3px, transparent 3.5px);
  background-size: 34px 34px;
  touch-action: manipulation; overflow-x: hidden;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
h1, h2, p { margin: 0; }
svg { display: block; }
.chargement { text-align: center; padding: 4rem 1rem; }
#app { min-height: 100vh; min-height: 100dvh; }
.ecran { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35em;
  min-height: 54px; padding: .35em 1.5em; border-radius: 999px;
  border: 3px solid var(--trait); background: var(--framboise); color: #fff;
  font-weight: 600; font-size: 1.2rem; letter-spacing: .01em;
  box-shadow: 0 5px 0 var(--trait); transition: transform .08s, box-shadow .08s;
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--trait); }
.btn:disabled { background: #E9DCC6; color: #A8937F; box-shadow: 0 5px 0 #B8A592; border-color: #B8A592; }
.btn.geant { font-size: 1.6rem; min-height: 68px; padding: .3em 2.4em; }
.btn.petit { font-size: 1rem; min-height: 48px; padding: .2em 1.1em; box-shadow: 0 4px 0 var(--trait); }
.btn.petit:disabled { box-shadow: 0 4px 0 #B8A592; }
.btn.vert { background: var(--pistache); color: var(--trait); }
.btn.gris { background: var(--blanc); color: var(--trait); }
.btn .piece { width: 22px; height: 22px; }
.rond {
  width: 52px; height: 52px; flex: none; border-radius: 50%; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 3px solid var(--trait); background: var(--blanc);
  box-shadow: 0 4px 0 var(--trait); transition: transform .08s, box-shadow .08s;
}
.rond:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--trait); }
.rond:disabled { opacity: .35; }
.rond .picto { width: 30px; height: 30px; }
.rond.grand { width: 64px; height: 64px; }
.rond.grand .picto { width: 38px; height: 38px; }

/* ---------- Fractions (toujours en écriture verticale) ---------- */
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 .22em; font-weight: 600; line-height: 1.12; }
.frac .fn, .frac .fd { padding: 0 .22em; }
.frac .fb { align-self: stretch; height: .11em; min-height: 3px; background: currentColor; border-radius: 3px; margin: .06em 0; }
.mixte { display: inline-flex; align-items: center; vertical-align: middle; }
.ent { font-weight: 600; }
.op { margin: 0 .3em; font-weight: 600; }
.gros { font-size: 2.3rem; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; }
.mots { font-weight: 600; color: var(--framboise); }
.mots.petit { font-size: 1.1rem; margin-right: 1.2em; }
.entre { font-size: 1.5rem; font-weight: 500; }
.entre b { font-size: 2.1rem; font-weight: 600; margin: 0 .1em; }
.astuce {
  margin: .4rem auto; padding: .5rem 1.1rem; border-radius: 16px; max-width: 34rem; text-align: center;
  background: var(--vanille); border: 3px dashed var(--caramel); font-size: 1.1rem;
}

/* ---------- Bulles ---------- */
.bulle {
  position: relative; background: var(--blanc); border: 3px solid var(--trait); border-radius: 22px;
  padding: .6rem 1.1rem; font-size: 1.25rem; line-height: 1.35; box-shadow: 0 4px 0 var(--sable);
}
.bulle .frac { font-size: 1.15em; }

/* ---------- Barre du haut ---------- */
.barre {
  width: 100%; display: flex; align-items: center; gap: .6rem;
  padding: calc(.55rem + env(safe-area-inset-top)) calc(.8rem + env(safe-area-inset-right)) .55rem calc(.8rem + env(safe-area-inset-left));
  background: var(--blanc); border-bottom: 3px solid var(--trait); position: sticky; top: 0; z-index: 5;
}
.barre-titre { flex: 1; font-size: 1.35rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pieces, .total-etoiles, .combo {
  display: inline-flex; align-items: center; gap: .3rem; height: 46px; padding: 0 .75rem 0 .45rem; flex: none;
  border: 3px solid var(--trait); border-radius: 999px; background: var(--vanille); font-size: 1.15rem;
}
.pieces .piece, .total-etoiles .etoile { width: 28px; height: 28px; }
.combo { background: var(--rose-clair); }
.combo .four { width: 32px; height: 32px; }
.progression { flex: 1; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-width: 0; }
.progression i {
  width: 26px; height: 19px; border-radius: 13px / 10px; border: 2.5px solid var(--trait);
  background: linear-gradient(var(--blanc) 0 38%, var(--sable) 38% 60%, var(--blanc) 60%);
}
.progression i.fait { background: linear-gradient(var(--pistache) 0 38%, var(--blanc) 38% 60%, var(--pistache) 60%); }
.progression i.ici { background: linear-gradient(var(--rose) 0 38%, var(--blanc) 38% 60%, var(--rose) 60%); transform: scale(1.18); }

/* ============================================================
   Écran titre
   ============================================================ */
.titre { justify-content: center; gap: 1rem; padding: 1rem; text-align: center; position: relative; }
.coin-haut { position: absolute; top: .8rem; right: .8rem; display: flex; gap: .5rem; }
.enseigne {
  display: flex; flex-direction: column; align-items: center; padding: .5rem 2.4rem .7rem;
  background: var(--blanc); border: 4px solid var(--trait); border-radius: 28px; box-shadow: 0 7px 0 var(--trait);
  transform: rotate(-1.5deg);
}
.enseigne-petit { font-size: 1.3rem; font-weight: 500; color: var(--choco); }
.enseigne-nom { font-size: clamp(2.4rem, 8vw, 4.2rem); font-weight: 700; color: var(--framboise); line-height: 1; }
.titre-scene { position: relative; width: min(640px, 92vw); }
.facade { width: 100%; height: auto; }
.titre-moka { position: absolute; right: -4%; bottom: -2%; width: 27%; animation: flotte 3s ease-in-out infinite; }
.titre-bulle { max-width: 34rem; }

/* ============================================================
   La carte des mondes
   ============================================================ */
.carte, .vitrine { justify-content: flex-start; }
.mondes { width: 100%; max-width: 1240px; padding: 1rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 1rem; }
.monde { background: var(--blanc); border: 3px solid var(--trait); border-radius: 26px; padding: .9rem; box-shadow: 0 6px 0 var(--trait); display: flex; flex-direction: column; gap: .8rem; }
.monde.m1 { background: var(--rose-clair); }
.monde.m2 { background: var(--pistache-clair); }
.monde.m3 { background: var(--vanille); }
.monde.m4 { background: var(--ciel-clair); }
.monde.m5 { background: #F9E3D0; }
.monde.defi { background: var(--blanc); grid-column: 1 / -1; }
.monde.ferme { background: #F3EADB; box-shadow: 0 6px 0 #B8A592; border-color: #B8A592; }
.monde.ferme .monde-icone, .monde.ferme .monde-texte { opacity: .5; }
.monde-haut { display: flex; align-items: center; gap: .8rem; }
.monde-icone { width: 78px; height: 78px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--blanc); border: 3px solid var(--trait); border-radius: 22px; padding: 6px; }
.monde-icone svg { width: 100%; height: 100%; }
.monde-icone .unites { gap: 0; }
.monde-icone .tarte { width: 60px; }
.monde-icone .boite-bloc .boite-compte { display: none; }
.monde-texte { flex: 1; min-width: 0; }
.monde-texte h2 { font-size: 1.3rem; font-weight: 600; line-height: 1.15; }
.monde-texte p { font-size: 1rem; color: var(--choco); }
.niveaux { display: flex; flex-wrap: wrap; gap: .55rem; }
.niveau {
  width: 62px; padding: 6px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--blanc); border: 3px solid var(--trait); border-radius: 18px; box-shadow: 0 4px 0 var(--trait);
  transition: transform .08s, box-shadow .08s;
}
.niveau:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--trait); }
.niveau.fait { background: var(--vanille); }
.niveau.ferme { background: #EFE6D6; border-color: #B8A592; box-shadow: 0 4px 0 #B8A592; }
.niveau-num { font-size: 1.5rem; font-weight: 600; height: 34px; display: flex; align-items: center; }
.niveau-num .cadenas { width: 24px; height: 26px; opacity: .6; }
.etoiles { display: inline-flex; gap: 1px; }
.niveau .etoile { width: 16px; height: 16px; }
.monde-verrou { display: flex; align-items: center; gap: .6rem; font-size: 1rem; color: var(--choco); }
.monde-verrou .cadenas { width: 34px; height: 38px; flex: none; }

/* ============================================================
   Ma vitrine (boutique)
   ============================================================ */
.etagere {
  width: min(1100px, 94vw); margin: 1.2rem 0 .6rem; min-height: 150px; padding: 1rem 1rem .4rem;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: .6rem;
  background: var(--ciel-clair); border: 4px solid var(--trait); border-radius: 26px; border-bottom-width: 14px;
}
.etagere-vide { align-self: center; font-size: 1.15rem; text-align: center; }
.etagere-gateau .gateau { width: 104px; height: 104px; animation: pop .4s both; }
.boutique { width: min(1100px, 94vw); display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; padding-bottom: 2rem; }
.article { background: var(--blanc); border: 3px solid var(--trait); border-radius: 22px; padding: .6rem; display: flex; flex-direction: column; align-items: center; gap: .3rem; box-shadow: 0 4px 0 var(--sable); }
.article .gateau { width: 84px; height: 84px; }
.article.pris { background: var(--pistache-clair); }
.article-pris { font-size: .9rem; min-height: 48px; display: flex; align-items: center; }

/* ============================================================
   Fenêtres (réglages, leçons, explications)
   ============================================================ */
.voile { position: fixed; inset: 0; z-index: 20; background: rgba(91, 58, 41, .5); display: flex; align-items: center; justify-content: center; padding: .7rem; }
.fenetre {
  width: 100%; max-width: 900px; max-height: calc(100dvh - 1.4rem); overflow: auto;
  background: var(--creme); border: 4px solid var(--trait); border-radius: 30px; padding: 1rem 1.2rem;
  box-shadow: 0 8px 0 var(--trait); animation: arrive .25s ease-out both;
}
.reglages { max-width: 460px; display: flex; flex-direction: column; gap: .9rem; }
.reglages h2 { font-size: 1.5rem; }
.champ { display: flex; flex-direction: column; gap: .2rem; }
.champ input { font: inherit; font-size: 1.3rem; color: inherit; padding: .4rem .8rem; border: 3px solid var(--trait); border-radius: 16px; background: var(--blanc); -webkit-user-select: text; user-select: text; }
.ligne { display: flex; align-items: center; gap: .6rem; min-height: 48px; }
.ligne input { width: 28px; height: 28px; accent-color: var(--framboise); }
.ligne.discret { font-size: .85rem; color: var(--choco); }
.reglages-bas { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }

.fenetre.expl { display: flex; flex-direction: column; gap: .7rem; min-height: min(560px, 90dvh); }
.expl-titre { align-self: flex-start; background: var(--framboise); color: #fff; font-weight: 600; padding: .15rem 1rem; border-radius: 999px; border: 3px solid var(--trait); font-size: 1.05rem; }
.expl-haut { display: flex; align-items: flex-start; gap: .6rem; }
.expl-moka { width: 104px; flex: none; }
.expl-haut .bulle { flex: 1; margin-top: .4rem; }
.expl-haut .bulle::before { content: ''; position: absolute; left: -13px; top: 26px; width: 20px; height: 20px; background: var(--blanc); border-left: 3px solid var(--trait); border-bottom: 3px solid var(--trait); transform: rotate(45deg); }
.ma-reponse { align-self: center; text-align: center; background: var(--blanc); border: 3px dashed var(--framboise); border-radius: 20px; padding: .3rem 1.4rem .5rem; }
.ma-reponse small { color: var(--framboise); font-size: .95rem; font-weight: 600; }
.expl-fig { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; min-height: 150px; }
.expl-fig > * { max-width: 100%; }
.expl-fig .droite { width: min(820px, 100%); }
.expl-fig .plaque { width: 190px; }
.expl-bas { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.points { display: flex; gap: 7px; }
.points i { width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--trait); background: var(--blanc); }
.points i.ici { background: var(--framboise); }
.fois { gap: .2rem; }
.fleches { display: inline-flex; flex-direction: column; align-items: center; margin: 0 .5rem; line-height: 1; }
.pastille { font-size: 1.05rem; font-weight: 600; background: var(--beurre); border: 2.5px solid var(--trait); border-radius: 999px; padding: .1rem .6rem; animation: pop .4s .3s both; }
.fleche { font-size: 1.8rem; margin: -.1rem 0; }
.vide { width: 1.4rem; }

/* ============================================================
   Le jeu
   ============================================================ */
.jeu { align-items: stretch; }
.scene { flex: 1; width: 100%; max-width: 1020px; margin: 0 auto; padding: .7rem calc(.8rem + env(safe-area-inset-right)) .4rem calc(.8rem + env(safe-area-inset-left)); display: flex; flex-direction: column; gap: .7rem; }
.annonce { align-self: center; background: var(--beurre); border: 3px solid var(--trait); border-radius: 999px; padding: .15rem 1.1rem; font-weight: 600; font-size: 1.05rem; animation: pop .4s both; }
.client { display: flex; align-items: center; gap: .7rem; }
.client-tete { width: 88px; flex: none; animation: arrive .35s ease-out both; }
.client-tete .animal, .fin-tete .animal { width: 100%; height: auto; }
.consigne { flex: 1; font-size: 1.35rem; }
.consigne::before { content: ''; position: absolute; left: -13px; top: 50%; margin-top: -10px; width: 20px; height: 20px; background: var(--blanc); border-left: 3px solid var(--trait); border-bottom: 3px solid var(--trait); transform: rotate(45deg); }
#zone-figure:empty { display: none; }
#zone-figure, #zone-entree { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.pied { position: sticky; bottom: 0; z-index: 4; display: flex; justify-content: center; padding: .6rem .8rem calc(.8rem + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--creme) 30%); }
.attente { font-size: 1.1rem; color: var(--choco); text-align: center; padding: .5rem 1rem; background: var(--blanc); border: 3px dashed var(--sable); border-radius: 18px; }
.attente.alerte { border-color: var(--framboise); color: var(--trait); animation: secoue .35s; }

/* --- bandeau « Bravo » --- */
#retour:empty { display: none; }
.bandeau {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; align-items: center; gap: .8rem;
  padding: .6rem 1rem calc(.8rem + env(safe-area-inset-bottom)); background: var(--pistache-clair); border-top: 4px solid var(--trait);
  animation: glisse .25s ease-out both;
}
.bandeau-moka { width: 84px; flex: none; margin-top: -40px; }
.bandeau-texte { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bandeau-texte b { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.bandeau-texte span { font-size: 1.05rem; }
.bandeau-gain { display: flex; align-items: center; gap: .2rem; font-size: 1.5rem; font-weight: 700; animation: pop .45s .15s both; }
.bandeau-gain .piece { width: 34px; height: 34px; }

/* ---------- Tartes et barres ---------- */
.unites { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .8rem 1rem; }
.unite { border-radius: 22px; padding: 4px; border: 4px solid transparent; max-width: 100%; }
.unite.surligne { border: 4px dashed var(--framboise); background: var(--rose-clair); }
.tarte { width: 158px; height: auto; }
.tablette { width: calc(var(--w) * 1.15px); max-width: 100%; height: auto; }
.unites.inter .tarte { width: 184px; }
.unites.inter .tablette { width: calc(var(--w) * 1.5px); }
.unites.inter .part { cursor: pointer; }
.unites.inter .part:active { opacity: .7; }
.unites.petit { gap: .3rem .5rem; }
.unites.petit .tarte { width: 96px; }
.unites.petit .tablette { width: calc(var(--w) * .72px); }
.expl-fig .tarte { width: 140px; }
.num { font-family: var(--police); font-size: 21px; font-weight: 700; fill: var(--trait); paint-order: stroke; stroke: var(--blanc); stroke-width: 5px; stroke-linejoin: round; pointer-events: none; animation: apparait .3s both; }

/* ---------- Macarons et boîtes ---------- */
.mac {
  --c: var(--rose);
  display: inline-block; width: 30px; height: 22px; border-radius: 15px / 11px; border: 2.5px solid var(--trait);
  background: linear-gradient(var(--c) 0 38%, var(--blanc) 38% 60%, var(--c) 60%);
}
.mac.c1 { --c: var(--pistache); }
.mac.c2 { --c: var(--beurre); }
.mac.c3 { --c: var(--caramel); }
[data-pop] { animation: pop .35s both; }
.rangement { display: flex; flex-direction: column; align-items: center; gap: .6rem; width: 100%; }
.plateau { width: 100%; max-width: 760px; background: var(--blanc); border: 3px solid var(--trait); border-radius: 22px; padding: .5rem .7rem .7rem; display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.plateau-titre { font-size: 1.05rem; }
.plateau-titre b { font-size: 1.35rem; color: var(--framboise); }
.plateau-macs { display: flex; flex-wrap: wrap; justify-content: center; gap: 0; min-height: 12px; }
.mac-btn { border: 0; background: none; padding: 9px 5px; min-width: 48px; min-height: 48px; display: flex; align-items: center; justify-content: center; }
.mac-btn:active .mac { transform: scale(.85); }
.plateau-boutons { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.boites { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: .5rem .7rem; }
.boite-bloc { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.boite { display: grid; gap: 4px; padding: 7px; background: var(--blanc); border: 3px solid var(--trait); border-radius: 14px; box-shadow: 0 4px 0 var(--sable); }
.boite.pleine { background: var(--pistache-clair); box-shadow: 0 4px 0 var(--pistache); }
.trou { width: 34px; height: 26px; border-radius: 17px / 13px; background: var(--sable); display: flex; align-items: center; justify-content: center; }
.trou .mac { width: 34px; height: 26px; border-radius: 17px / 13px; }
.boite.petit { padding: 4px; gap: 2px; border-radius: 10px; }
.boite.petit .trou, .boite.petit .trou .mac { width: 22px; height: 17px; border-width: 2px; }
.boite-compte { min-width: 2.2em; text-align: center; font-size: 1.15rem; font-weight: 700; color: var(--framboise); line-height: 1.2; }
.boite-compte.vu { background: var(--blanc); border: 2.5px solid var(--framboise); border-radius: 999px; padding: 0 .5em; }
.boite.fermee {
  position: relative; width: 84px; height: 74px; display: flex; align-items: center; justify-content: center; padding: 0;
  background: var(--rose); border: 3px solid var(--trait); border-radius: 14px; box-shadow: 0 5px 0 var(--trait); overflow: hidden;
}
.boite.fermee:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--trait); }
.boite.fermee .ruban { position: absolute; left: 50%; top: 0; bottom: 0; width: 16px; margin-left: -8px; background: var(--blanc); border-left: 3px solid var(--trait); border-right: 3px solid var(--trait); }
.boite.fermee b { position: relative; width: 44px; height: 44px; border-radius: 50%; background: var(--blanc); border: 3px solid var(--trait); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 700; }
.vrac { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; max-width: 190px; min-height: 48px; }
.vrac .op { font-size: 1.8rem; }
.icone-macs .trou, .icone-macs .trou .mac { width: 24px; height: 18px; border-width: 2px; }

/* ---------- L'échelle des boîtes ---------- */
.echelle-titre { font-size: 1rem; color: var(--choco); }
.echelle { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 6px; }
.barreau { min-width: 62px; display: flex; flex-direction: column; align-items: center; padding: .2rem .4rem .25rem; background: var(--blanc); border: 3px solid var(--trait); border-radius: 14px; position: relative; }
.barreau small { font-size: .72rem; color: var(--choco); white-space: nowrap; }
.barreau b { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.barreau.trop { background: #EFE6D6; border-style: dashed; }
.barreau.trop b { text-decoration: line-through; text-decoration-color: var(--framboise); text-decoration-thickness: 3px; }
.barreau em { font-style: normal; font-size: .75rem; font-weight: 600; color: var(--framboise); }
.echelle .ici { display: flex; flex-direction: column; align-items: center; padding: .2rem .7rem; background: var(--framboise); color: #fff; border: 3px solid var(--trait); border-radius: 14px; }
.echelle .ici b { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.echelle .ici small { font-size: .75rem; }
.echelle.anim .barreau, .echelle.anim .ici { animation: monte .4s both; }

/* ---------- La route de livraison ---------- */
.droite-boite { position: relative; width: 100%; max-width: 1000px; }
.droite { width: 100%; height: auto; overflow: visible; }
.droite text { font-family: var(--police); font-weight: 600; fill: var(--trait); }
.borne { font-size: 42px; }
.borne.petite { font-size: 26px; }
.droite .note { font-size: 25px; fill: var(--framboise); font-weight: 700; }
.droite .saut-num { font-size: 22px; fill: var(--framboise); font-weight: 700; animation: apparait .25s both; }
.saut { animation: apparait .25s both; }
.scooter.attente { opacity: .45; }
.capteur { position: absolute; inset: 0; touch-action: none; cursor: pointer; }
.placer-boutons { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.placer-boutons span { font-size: 1rem; color: var(--choco); text-align: center; max-width: 16rem; }
.placer-boutons .saut-dix { font-family: inherit; font-weight: 700; font-size: 1.15rem; color: var(--choco); }
.icone-scooter { width: 100%; height: 100%; }

/* ---------- La plaque de 100 ---------- */
.plaque-boite { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.plaque { width: 200px; height: auto; }
.plaque-note { font-size: 1rem; color: var(--choco); }
.carre { animation: apparait .3s both; }

/* ---------- Saisie ---------- */
.saisie-ligne { gap: .1rem; min-height: 150px; }
.frac.saisie .fb { height: 5px; margin: 6px 0; }
.frac.saisie .fn, .frac.saisie .fd { padding: 0 4px; }
.case {
  min-width: 84px; height: 66px; padding: 0 .3em; border: 3px solid var(--trait); border-radius: 16px; background: var(--blanc);
  font-size: 2.2rem; font-weight: 600; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.case.active { border-color: var(--framboise); background: var(--rose-clair); box-shadow: 0 0 0 4px var(--rose); }
.case.active::after { content: ''; width: 3px; height: 1em; margin-left: 2px; background: var(--framboise); border-radius: 2px; animation: clignote 1s steps(2) infinite; }
.fixe { display: inline-flex; min-width: 84px; height: 66px; align-items: center; justify-content: center; }
.apres { font-size: 1.3rem; font-weight: 500; margin-left: .5rem; }
.pave { display: grid; grid-template-columns: repeat(6, minmax(48px, 68px)); gap: 7px; justify-content: center; width: 100%; }
.touche {
  height: 58px; border: 3px solid var(--trait); border-radius: 16px; background: var(--blanc); font-size: 1.7rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; padding: 0; box-shadow: 0 4px 0 var(--trait); transition: transform .06s, box-shadow .06s;
}
.touche:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--trait); background: var(--vanille); }
.touche.outil { background: var(--vanille); }
.touche .picto { width: 32px; height: 32px; }

/* ---------- Choix ---------- */
.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; width: 100%; max-width: 760px; }
.option {
  min-height: 96px; min-width: 0; overflow: hidden; padding: .5rem; background: var(--blanc); border: 3px solid var(--trait); border-radius: 22px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 5px 0 var(--trait); transition: transform .08s, box-shadow .08s;
}
.option:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--trait); }
.option.choisie { background: var(--rose-clair); border-color: var(--framboise); box-shadow: 0 5px 0 var(--framboise); }
.option .mots { font-size: 1.25rem; text-align: center; color: var(--trait); }
.option .gros { font-size: 2rem; }

/* ---------- Relier ---------- */
.relier { display: flex; gap: 1.2rem; width: 100%; max-width: 780px; }
.relier-col { flex: 1; display: flex; flex-direction: column; gap: .6rem; }
.relier-col:first-child { flex: 0 0 34%; }
.relier-item { min-height: 82px; padding: .3rem .6rem; background: var(--blanc); border: 3px solid var(--trait); border-radius: 20px; box-shadow: 0 4px 0 var(--trait); font-size: 1.2rem; font-weight: 600; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--trait); }
.relier-item .gros { font-size: 1.8rem; }
.relier-item.choisie { background: var(--rose-clair); border-color: var(--framboise); box-shadow: 0 4px 0 var(--framboise); }
.relier-item.lie { box-shadow: none; opacity: 1; }
.relier-item.l0 { background: var(--pistache-clair); }
.relier-item.l1 { background: var(--ciel-clair); }
.relier-item.l2 { background: var(--vanille); }

/* ============================================================
   Fin de niveau
   ============================================================ */
.fin { justify-content: center; padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom)); position: relative; }
.fin-carte { position: relative; z-index: 2; width: 100%; max-width: 620px; background: var(--blanc); border: 4px solid var(--trait); border-radius: 32px; box-shadow: 0 8px 0 var(--trait); padding: 1.2rem; display: flex; flex-direction: column; align-items: center; gap: .6rem; text-align: center; animation: arrive .3s ease-out both; }
.fin-tete { width: 130px; }
.fin-tete .moka { animation: saute 1s ease-in-out infinite; }
.fin-carte h1 { font-size: 2.1rem; font-weight: 700; color: var(--framboise); line-height: 1.1; }
.fin-carte h2 { font-size: 1.2rem; font-weight: 600; margin-top: .4rem; }
.fin-nom { color: var(--choco); }
.fin-carte .etoiles { gap: .4rem; }
.fin-carte .etoile { width: 74px; height: 74px; }
.etoiles.tombent .etoile-boite { animation: tombe .55s cubic-bezier(.3, 1.5, .6, 1) both; }
.fin-mot { font-size: 1.15rem; }
.fin-gain { display: flex; align-items: center; gap: .3rem; font-size: 1.7rem; font-weight: 700; }
.fin-gain .piece { width: 38px; height: 38px; }
.fin-boutons { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; margin-top: .4rem; }
.note-defi { display: flex; align-items: baseline; gap: .4rem; }
.note-defi b { font-size: 4.2rem; font-weight: 700; color: var(--framboise); line-height: 1; }
.note-defi span { font-size: 1.4rem; }
.bilan { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: .4rem; text-align: left; }
.bilan li { background: var(--vanille); border: 3px solid var(--trait); border-radius: 16px; padding: .4rem .8rem; display: flex; flex-direction: column; }
.bilan span { font-size: .95rem; color: var(--choco); }
.confettis { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.confettis i { position: absolute; top: -24px; width: 11px; height: 15px; animation: chute linear both; }

.moka { width: 100%; height: auto; }

/* ============================================================
   Animations
   ============================================================ */
@keyframes pop { 0% { transform: scale(0); opacity: 0; } 70% { transform: scale(1.18); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes apparait { from { opacity: 0; } to { opacity: 1; } }
@keyframes monte { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes arrive { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes glisse { from { transform: translateY(100%); } to { transform: none; } }
@keyframes tombe { from { opacity: 0; transform: translateY(-90px) rotate(-40deg) scale(.4); } to { opacity: 1; transform: none; } }
@keyframes chute { from { transform: translateY(-5vh) rotate(0); } to { transform: translateY(110vh) rotate(540deg); } }
@keyframes flotte { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes saute { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-10px); } }
@keyframes clignote { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes secoue { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; animation-delay: 0s !important; transition: none !important; }
}

/* ============================================================
   Téléphone en vertical (à partir de 360 px de large)
   ============================================================ */
@media (max-width: 640px) {
  html { font-size: 17px; }
  .barre { gap: .4rem; flex-wrap: wrap; padding-bottom: .45rem; }
  .barre-titre { font-size: 1.1rem; flex-basis: 100%; order: -1; text-align: center; }
  .rond { width: 48px; height: 48px; }
  .pieces, .total-etoiles, .combo { height: 44px; padding: 0 .55rem 0 .3rem; font-size: 1rem; }
  .carte .barre, .vitrine .barre, .jeu .barre { justify-content: space-between; }
  .jeu .progression { order: 10; flex-basis: 100%; justify-content: center; }
  .progression i { width: 20px; height: 15px; border-width: 2px; }
  .mondes { grid-template-columns: 1fr; padding: .7rem; }
  .monde-icone { width: 64px; height: 64px; }
  .niveau { width: 54px; }
  .coin-haut { top: calc(.6rem + env(safe-area-inset-top)); }
  .titre { padding-top: calc(4rem + env(safe-area-inset-top)); justify-content: flex-start; }
  .enseigne { padding: .4rem 1.4rem .6rem; }
  .scene { gap: .55rem; padding-top: .5rem; }
  .client-tete { width: 58px; }
  .bulle { padding: .5rem .8rem; font-size: 1.15rem; border-radius: 18px; }
  .consigne { font-size: 1.15rem; }
  .gros { font-size: 1.9rem; }
  .case, .fixe { min-width: 62px; height: 56px; font-size: 1.9rem; }
  .op { margin: 0 .18em; }
  .saisie-ligne { min-height: 128px; }
  .pave { gap: 6px; }
  .touche { height: 54px; border-radius: 14px; }
  .options { gap: .55rem; }
  .options.dessins { grid-template-columns: 1fr; }
  .option { min-height: 78px; }
  .option .mots { font-size: 1.1rem; }
  .relier { gap: .6rem; }
  .relier-item { font-size: 1.02rem; min-height: 76px; padding: .3rem .4rem; }
  .tarte { width: 128px; }
  .tablette { width: calc(var(--w) * 1px); }
  .unites.inter .tarte { width: 230px; }
  .unites.inter .tablette { width: calc(var(--w) * 1.42px); }
  .trou, .trou .mac { width: 30px; height: 23px; }
  .barreau { min-width: 56px; }
  .fenetre { padding: .7rem .7rem .8rem; border-radius: 24px; }
  .fenetre.expl { min-height: min(520px, 92dvh); }
  .expl-moka { width: 66px; }
  .expl-haut .bulle { font-size: 1.08rem; }
  .expl-fig .tarte { width: 112px; }
  .bandeau { gap: .5rem; padding-left: .7rem; padding-right: .7rem; }
  .bandeau-moka { display: none; }
  .bandeau-texte b { font-size: 1.35rem; }
  .bandeau .btn { padding: .3em 1em; }
  .placer-boutons span { display: none; }
  .placer-boutons { gap: 3rem; }
  .placer-boutons.avec-dix { gap: .9rem; }
  .fin-carte .etoile { width: 58px; height: 58px; }
  .fin-carte { padding: 1rem .8rem; }
  .btn.geant { font-size: 1.4rem; min-height: 60px; padding: .3em 1.8em; }
  .etagere-gateau .gateau { width: 80px; height: 80px; }
  .boutique { grid-template-columns: repeat(2, 1fr); }
}
/* Téléphone tourné en paysage : peu de hauteur, on laisse tout défiler */
@media (max-height: 500px) {
  .barre { position: static; padding-top: calc(.3rem + env(safe-area-inset-top)); padding-bottom: .3rem; }
  .pied { position: static; background: none; }
  .scene { gap: .5rem; }
  .saisie-ligne { min-height: 110px; }
  .titre { justify-content: flex-start; gap: .6rem; }
  .titre-scene { width: min(380px, 60vw); }
  .fenetre.expl { min-height: 0; }
  .expl-moka { width: 70px; }
  .fin { justify-content: flex-start; }
  .fin-tete { width: 84px; }
}
@media (min-width: 1300px) {
  html { font-size: 22px; }
  .scene { max-width: 1100px; }
}
