/* Les lettres de Livia — feuille de style
   Cible : téléphone tenu à la verticale, doigts de 5 ans.
   Règle de base : aucune zone tactile en dessous de 64 px. */

:root {
  --ink: #46356e;
  --ink-soft: #7b6aa5;
  --purple: #8b6cff;
  --purple-dk: #6d4fe0;
  --pink: #ff7eb8;
  --mint: #6fdcb4;
  --sun: #ffd95a;
  --white: #ffffff;

  --card-r: 34px;
  --btn-r: 24px;
  --shadow-s: 0 6px 14px rgba(77, 59, 117, .16);
  --shadow-m: 0 12px 26px rgba(90, 66, 150, .20);
  --shadow-l: 0 22px 48px rgba(84, 58, 140, .28);

  --pad-top: max(12px, env(safe-area-inset-top));
  --pad-bot: max(10px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Le `display` du navigateur pour [hidden] perd contre n'importe quel sélecteur
   de classe (ex. `.slot img { display: block }`). On le réaffirme une fois pour
   toutes, sinon masquer un élément en JS ne masque rien. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 800;
}

body {
  overflow: hidden;                    /* le défilement vit dans les écrans */
  background: linear-gradient(180deg, #ded0ff 0%, #ffd9ec 46%, #d6f4ff 100%);
  background-attachment: fixed;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Ni zoom au double-tap, ni menu long-press sur les images */
img { max-width: 100%; -webkit-touch-callout: none; }
button, select { font: inherit; color: inherit; cursor: pointer; }


/* ══ Écran de départ ═════════════════════════════════════════════════════════ */
.start {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  padding: var(--pad-top) 20px var(--pad-bot);
  text-align: center;
  background: linear-gradient(180deg, #cbb6ff 0%, #ffd0e6 50%, #cdf0ff 100%);
}
.start[hidden] { display: none; }
.start-deco { font-size: 26px; letter-spacing: 10px; opacity: .7; }
.start-title {
  margin: 10px 0 0;
  font-size: clamp(38px, 12vw, 58px);
  font-weight: 900;
  line-height: 1.02;
  color: var(--white);
  text-shadow: 0 4px 0 rgba(96, 67, 158, .22), 0 14px 26px rgba(78, 50, 130, .22);
}
.start-title #titleBottom { color: var(--sun); }
.start-cats { font-size: clamp(48px, 16vw, 76px); margin: 12px 0 22px; }
.start-btn {
  min-height: 84px;
  width: min(84vw, 380px);
  border: 6px solid var(--white);
  border-radius: 30px;
  font-size: 38px;
  font-weight: 900;
  color: var(--white);
  background: linear-gradient(180deg, #ff9fca, #ff5fa6);
  box-shadow: var(--shadow-l), inset 0 -6px 0 rgba(150, 30, 90, .18);
}
.start-btn:active { transform: translateY(3px); }
.start-hint { font-size: 19px; color: #6a4f9c; opacity: .8; margin: 14px 0 0; }

/* Drapeaux : assez gros pour un doigt de 5 ans, assez discrets pour ne pas
   concurrencer le bouton Jouer. Le nom de la langue est écrit sous l'emoji —
   Windows et certains Android n'ont aucun glyphe de drapeau et n'afficheraient
   sinon qu'un code à deux lettres, ce qui a l'air d'un bogue. */
.flags { display: flex; gap: 10px; margin-top: 16px; }
.flag {
  min-width: 84px; min-height: 68px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px;
  padding: 4px 6px;
  border: 4px solid rgba(255, 255, 255, .55);
  border-radius: 20px;
  font-size: 28px; line-height: 1;
  background: rgba(255, 255, 255, .4);
  box-shadow: var(--shadow-s);
  transition: transform .14s, border-color .14s, background .14s;
}
.flag small { font-size: 12px; font-weight: 800; color: #6a56a0; }
.flag.on {
  border-color: var(--white);
  background: var(--white);
  transform: translateY(-3px) scale(1.06);
}
.flag:active { transform: scale(.94); }
/* Les mêmes drapeaux sur l'accueil : sans eux, changer de langue passe par les
   réglages parent, où une enfant de 5 ans n'ira jamais. */
.flags-hub { justify-content: center; margin: 2px 0 4px; }


/* ══ Ossature ════════════════════════════════════════════════════════════════ */
/* Deux grilles imbriquées, et une seule chose visible par rangée : la barre du
   haut est commune à l'accueil et aux jeux, les écrans et les onglets masqués
   sortent du flux (`[hidden]` plus haut), donc chaque grille ne voit jamais
   que ses deux enfants utiles. */
.shell {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;        /* barre haute / accueil ou jeu */
  padding: var(--pad-top) 12px 0;
  max-width: 520px;
  margin: 0 auto;
}
.shell[hidden] { display: none; }

.app {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;        /* écran / onglets */
}
.app[hidden] { display: none; }

.topbar { display: flex; gap: 8px; align-items: center; padding: 2px 2px 8px; }
.pill {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 13px;
  border: 3px solid var(--white);
  border-radius: 999px;
  font-size: 18px;
  font-weight: 900;
  background: rgba(255, 255, 255, .72);
  box-shadow: var(--shadow-s);
  white-space: nowrap;
}
.pill-btn { min-width: 48px; min-height: 42px; justify-content: center; margin-left: auto; font-size: 21px; }

.screen {
  min-height: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px;
}
.screen[hidden] { display: none; }
.screen-scroll {
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.instruction { margin: 0; font-size: 22px; text-align: center; color: #5d4791; }
.feedback {
  margin: 0; min-height: 34px;
  font-size: 25px; font-weight: 900; text-align: center;
  line-height: 1.15;
}
.feedback.good { color: #1c9c6d; }
.feedback.retry { color: #d2568f; }


/* ══ Accueil : la liste des jeux ═════════════════════════════════════════════ */
.hub {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column;
  gap: 12px;
  padding-bottom: var(--pad-bot);
}
.hub[hidden] { display: none; }
.hub-title {
  margin: 6px 0 0;
  font-size: 27px; font-weight: 900; text-align: center;
  color: var(--white);
  text-shadow: 0 3px 0 rgba(90, 64, 145, .2);
}
.hub-grid { display: flex; flex-direction: column; gap: 12px; }

.gamecard {
  --tint: var(--purple);
  min-height: 116px;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  text-align: left;
  border: 6px solid var(--white);
  border-radius: var(--card-r);
  background: linear-gradient(180deg, #fff, #fdf4ff);
  box-shadow: var(--shadow-m);
  transition: transform .14s;
}
.gamecard:active { transform: scale(.97); }
.gamecard-emoji {
  flex: none;
  width: 76px; height: 76px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 24px;
  font-size: 42px; line-height: 1;
  background: var(--tint);
  box-shadow: inset 0 -5px 0 rgba(255, 255, 255, .26);
}
.gamecard-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.gamecard-body strong { font-size: 25px; font-weight: 900; color: var(--ink); }
.gamecard-body small { font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.gamecard-bar {
  height: 10px; margin-top: 5px;
  border-radius: 999px;
  background: rgba(120, 96, 180, .16);
  overflow: hidden;
}
.gamecard-bar i { display: block; height: 100%; border-radius: 999px; background: var(--tint); }
.gamecard-tally { font-size: 13px; font-weight: 800; color: var(--ink-soft); }
/* Le drapeau d'un jeu qui ne parle pas encore la langue choisie. */
.gamecard { position: relative; }
.gamecard-flag {
  position: absolute; top: 8px; right: 10px;
  font-size: 17px; line-height: 1; opacity: .75;
}

/* La case vide n'est pas un oubli : d'autres jeux viendront s'y ranger. */
.gamecard-soon {
  min-height: 84px;
  border-style: dashed;
  border-color: rgba(255, 255, 255, .8);
  background: rgba(255, 255, 255, .3);
  box-shadow: none;
}
.gamecard-soon .gamecard-emoji {
  width: 58px; height: 58px; font-size: 28px;
  background: rgba(255, 255, 255, .55);
}
.gamecard-soon .gamecard-body strong { font-size: 19px; color: var(--ink-soft); }


/* ══ Onglets du bas ══════════════════════════════════════════════════════════ */
.tabbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  padding: 7px 0 var(--pad-bot);
}
.tabbar-3 { grid-template-columns: repeat(3, 1fr); }
.tabbar[hidden] { display: none; }
.tab {
  min-height: 68px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px;
  border: 3px solid rgba(255, 255, 255, .8);
  border-radius: 21px;
  background: rgba(255, 255, 255, .55);
  box-shadow: var(--shadow-s);
  transition: transform .14s, background .14s;
}
.tab span { font-size: 27px; line-height: 1; }
.tab small { font-size: 11px; font-weight: 800; color: #6a56a0; }
.tab.active {
  background: linear-gradient(180deg, #fff, #ffe6f4);
  border-color: var(--pink);
  transform: translateY(-3px);
}
.tab:active { transform: scale(.96); }


/* ══ JOUER ═══════════════════════════════════════════════════════════════════ */
.ear {
  width: min(88vw, 460px);
  min-height: 108px;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  border: 6px solid var(--white);
  border-radius: var(--card-r);
  background: linear-gradient(180deg, #8ceace, #5fd3aa);
  box-shadow: var(--shadow-m), inset 0 -6px 0 rgba(20, 120, 90, .14);
}
.ear:active { transform: scale(.97); }
.ear-emoji { font-size: 46px; line-height: 1; }
.ear-text { font-size: 33px; font-weight: 900; color: #0f5f47; }
.ear.playing { animation: earPulse .7s ease-in-out infinite alternate; }
@keyframes earPulse { to { transform: scale(1.035); } }

.choices {
  width: min(92vw, 480px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 12px;
}
.choice {
  /* Hauteur pilotée par l'écran, pas par le ratio : sinon 3 colonnes étroites
     donnent des tuiles minuscules sur un téléphone. */
  height: clamp(150px, 30dvh, 250px);
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  border: 6px solid var(--white);
  border-radius: var(--card-r);
  font-size: clamp(62px, 21vw, 118px);
  font-weight: 900;
  line-height: 1;
  color: var(--white);
  text-shadow: 0 5px 0 rgba(80, 55, 120, .16);
  box-shadow: var(--shadow-m), inset 0 -8px 0 rgba(255, 255, 255, .22);
  transition: transform .14s;
}
.choice:active { transform: scale(.95); }
.choice.wrong { animation: shake .42s ease; opacity: .45; }
.choice.right { animation: pop .45s ease; }
@keyframes shake {
  10%, 90% { transform: translateX(-7px) rotate(-3deg); }
  30%, 70% { transform: translateX(9px) rotate(3deg); }
  50%      { transform: translateX(-5px); }
}
@keyframes pop {
  40% { transform: scale(1.14) rotate(-4deg); }
  70% { transform: scale(.97) rotate(2deg); }
}


/* ══ APPRENDRE ═══════════════════════════════════════════════════════════════ */
.flipcard {
  position: relative;
  width: min(88vw, 420px);
  height: min(46dvh, 400px);
  min-height: 240px;
  display: flex; align-items: center; justify-content: center;
  border: 8px solid var(--white);
  border-radius: 42px;
  box-shadow: var(--shadow-l), inset 0 -10px 0 rgba(255, 255, 255, .2);
  overflow: hidden;
  transition: transform .16s;
}
.flipcard:active { transform: scale(.98); }
.flip-front, .flip-back {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
}
.flip-front[hidden], .flip-back[hidden] { display: none; }
.flip-letter {
  font-size: clamp(140px, 42vw, 230px);
  font-weight: 900; line-height: .84;
  color: var(--white);
  text-shadow: 0 8px 0 rgba(80, 55, 120, .14), 0 16px 26px rgba(70, 48, 110, .16);
}
.flip-lower {
  font-size: clamp(52px, 15vw, 84px);
  font-weight: 900; line-height: .9;
  color: rgba(255, 255, 255, .9);
}
.flip-emoji { font-size: clamp(96px, 30vw, 160px); line-height: 1; filter: drop-shadow(0 8px 10px rgba(71, 49, 99, .18)); }
.flip-word {
  font-size: clamp(30px, 9vw, 46px);
  font-weight: 900; color: var(--white);
  text-shadow: 0 4px 0 rgba(75, 59, 115, .18);
}
.flip-hint {
  position: absolute; bottom: 12px;
  font-size: 15px; font-weight: 800;
  color: rgba(255, 255, 255, .92);
  background: rgba(0, 0, 0, .14);
  padding: 4px 12px; border-radius: 999px;
}
.flip-hint[hidden] { display: none; }

.learn-controls {
  width: min(88vw, 420px);
  display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 12px;
}
.round {
  min-height: 74px;
  border: 5px solid var(--white);
  border-radius: var(--btn-r);
  font-size: 34px; line-height: 1;
  background: linear-gradient(180deg, #fff9c0, #ffd85a);
  box-shadow: var(--shadow-m), inset 0 -5px 0 rgba(140, 100, 20, .12);
}
.round:active { transform: scale(.95); }
.round-wide { background: linear-gradient(180deg, #8ceace, #5fd3aa); }

.alphastrip {
  width: min(92vw, 480px);
  display: grid;
  /* minmax(0, 1fr) : sans le 0, la largeur min-content des boutons fait déborder. */
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 4px;
}
.alpha {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  border: 0; border-radius: 8px;
  font-size: 13px; font-weight: 900;
  color: #6a56a0;
  background: rgba(255, 255, 255, .55);
}
.alpha.on { background: var(--purple); color: var(--white); }
.alpha.done { background: rgba(111, 220, 180, .9); color: #0f5f47; }


/* ══ PARLER ══════════════════════════════════════════════════════════════════ */
.speakcard {
  width: min(70vw, 300px);
  height: min(34dvh, 300px);
  min-height: 180px;
  display: flex; align-items: center; justify-content: center;
  border: 8px solid var(--white);
  border-radius: 42px;
  box-shadow: var(--shadow-l);
}
.micbtn {
  width: min(88vw, 420px);
  min-height: 92px;
  border: 6px solid var(--white);
  border-radius: 28px;
  font-size: 36px; font-weight: 900;
  color: var(--white);
  background: linear-gradient(180deg, #a991ff, #7d62ed);
  box-shadow: var(--shadow-m), inset 0 -6px 0 rgba(60, 35, 140, .2);
}
.micbtn:active { transform: scale(.97); }
.micbtn.on { animation: micPulse 1.1s ease-in-out infinite alternate; }
.micbtn:disabled { opacity: .5; }
@keyframes micPulse { to { transform: scale(1.04); box-shadow: 0 14px 32px rgba(124, 98, 237, .38); } }
.speak-row { display: flex; gap: 12px; }
.speak-row .round { min-width: 84px; }
.speak-row .round[hidden] { display: none; }


/* ══ ALBUM ═══════════════════════════════════════════════════════════════════ */
.album-title { margin: 4px 0 2px; font-size: clamp(23px, 7.4vw, 32px); font-weight: 900; color: var(--white); text-shadow: 0 3px 0 rgba(90, 64, 145, .2); }
.album-sub { margin: 0 0 12px; font-size: 16px; color: #5d4791; }
.album {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.slot {
  position: relative;
  aspect-ratio: 9 / 16;
  padding: 0;
  border: 4px solid var(--white);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, .4);
  box-shadow: var(--shadow-s);
  display: flex; align-items: center; justify-content: center;
}
.slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot .badge {
  position: absolute; top: 4px; left: 4px;
  z-index: 2;                        /* passe au-dessus de la carte de repli */
  min-width: 25px; padding: 1px 6px;
  border-radius: 8px;
  font-size: 15px; font-weight: 900;
  color: var(--white);
  background: rgba(60, 35, 110, .62);
  backdrop-filter: blur(3px);
}
.slot.locked { background: repeating-linear-gradient(135deg, #e6dcff 0 9px, #dccdfb 9px 18px); }
.slot.locked .lockface { font-size: 26px; opacity: .6; }
.slot.locked .badge { background: rgba(110, 85, 165, .5); }
.slot:active { transform: scale(.96); }


/* ══ CHIFFRES ════════════════════════════════════════════════════════════════ */
/* L'écran des chiffres porte plus de choses que celui des lettres (bocal,
   scène, bande numérique) : tout y est un cran plus compact. */
/* Centré tant que ça rentre, défilant quand ça ne rentre pas. `justify-content:
   center` seul rendrait le haut du contenu inatteignable dès qu'il déborde ;
   les marges automatiques sur le premier et le dernier enfant font les deux. */
.screen-num {
  gap: 8px;
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen-num > :first-child { margin-top: auto; }
.screen-num > :last-child { margin-bottom: auto; }
.screen-num .choice { height: clamp(92px, 19dvh, 168px); }
/* Une scène occupe la moitié de l'écran : les tuiles lui rendent la place. */
.screen-num.has-stage .choice { height: clamp(70px, 13dvh, 124px); }
.screen-num.has-stage .thing { font-size: clamp(20px, 6vw, 30px); }

.ear-sm { min-height: 76px; }
.ear-sm .ear-emoji { font-size: 34px; }
.ear-sm .ear-text { font-size: 26px; }

/* Le bocal de dix. */
.jar { display: flex; align-items: center; justify-content: center; gap: 5px; height: 16px; }
.jar i {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  box-shadow: inset 0 -2px 0 rgba(120, 96, 180, .14);
  transition: background .2s, transform .2s;
}
.jar i.on { background: var(--pink); transform: scale(1.15); }

/* La scène : objets à compter, panier, suite de nombres, leçon de quantité. */
.numstage {
  width: 100%; min-height: 0;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
}
.numstage[hidden] { display: none; }

/* Rangées de 5, toujours : c'est ce qui fait qu'on finit par voir 8 comme
   « 5 et 3 » au lieu de recompter depuis 1. */
.things {
  width: min(92vw, 420px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px 6px;
  justify-items: center;
}
.thing {
  font-size: clamp(24px, 7.5vw, 36px);
  line-height: 1.05;
  opacity: 0;
  transform: scale(.4);
  transition: opacity .18s ease, transform .22s cubic-bezier(.2, 1.5, .4, 1);
}
.thing.shown { opacity: 1; transform: scale(1); }
.thing-btn {
  min-height: 56px; width: 100%;
  padding: 0; border: 0; border-radius: 16px;
  background: rgba(255, 255, 255, .38);
}
.thing-btn:active { transform: scale(.9); }
.thing-btn.picked { background: none; }

.basket {
  width: min(92vw, 420px);
  min-height: 64px;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 11px;
  border: 4px dashed rgba(255, 255, 255, .92);
  border-radius: 22px;
  background: rgba(255, 255, 255, .42);
}
.basket-icon { position: relative; flex: none; font-size: 32px; line-height: 1; }
/* Le compte est écrit sur le panier : « combien j'en ai » doit être lisible
   sans recompter, c'est la moitié de l'exercice. */
.basket-icon::after {
  content: attr(data-n);
  position: absolute; right: -10px; bottom: -4px;
  min-width: 23px; padding: 0 5px;
  border-radius: 999px;
  font-size: 14px; font-weight: 900;
  color: var(--white); background: var(--purple);
}
.basket-items {
  flex: 1; min-height: 40px;
  display: flex; flex-wrap: wrap; align-content: center;
  gap: 2px 4px;
}
.basket-items .thing-btn { width: auto; min-height: 40px; padding: 0 3px; font-size: 25px; }

/* La suite de nombres. */
.seq { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.seq-cell {
  min-width: 60px; min-height: 60px;
  display: flex; align-items: center; justify-content: center;
  border: 4px solid var(--white);
  border-radius: 18px;
  font-size: 27px; font-weight: 900;
  color: var(--white);
  background: rgba(255, 255, 255, .4);
  text-shadow: 0 3px 0 rgba(80, 55, 120, .16);
}
.seq-long .seq-cell { min-width: 47px; min-height: 54px; font-size: 21px; }
.seq-cell.hole {
  color: var(--purple-dk);
  text-shadow: none;
  background: repeating-linear-gradient(135deg, #efe6ff 0 8px, #e2d4fb 8px 16px);
  animation: holePulse 1.1s ease-in-out infinite alternate;
}
@keyframes holePulse { to { transform: scale(1.08); } }

/* La leçon de quantité, après une erreur : les deux nombres l'un sous l'autre. */
.numstage-lesson { gap: 8px; }
.lesson-row {
  width: min(92vw, 420px);
  display: flex; align-items: center; gap: 9px;
  padding: 7px 11px;
  border: 3px solid var(--white);
  border-radius: 18px;
}
.lesson-row.is-wrong { background: rgba(255, 255, 255, .38); opacity: .78; }
.lesson-row.is-good { background: rgba(111, 220, 180, .45); }
.lesson-tag { flex: none; min-width: 68px; font-size: 15px; font-weight: 900; color: #5d4791; }
.lesson-row .dots { justify-content: flex-start; }

/* Une quantité dessinée. `staged` : la rangée se remplit au comptage. */
.dots {
  display: grid;
  grid-template-columns: repeat(5, auto);
  gap: 3px 5px;
  justify-content: center;
}
.dots i { font-style: normal; line-height: 1; transition: opacity .16s, transform .2s; }
.dots i:empty {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 0 rgba(80, 55, 120, .14);
}
.dots i:not(:empty) { font-size: 19px; }
.dots.staged i { opacity: 0; transform: scale(.4); }
.dots.staged i.shown { opacity: 1; transform: scale(1); }

/* Les tuiles de réponse : un nombre peut avoir deux chiffres, donc un cran
   plus petit qu'une lettre, et la quantité peut venir se ranger dessous. */
.choice-num { position: relative; flex-direction: column; gap: 5px; }
.choice-n {
  font-size: clamp(50px, 17vw, 96px);
  font-weight: 900; line-height: .95;
  color: var(--white);
  text-shadow: 0 5px 0 rgba(80, 55, 120, .16);
}
.choice-num.has-dots .choice-n { font-size: clamp(34px, 12vw, 62px); }
.choice.done { opacity: .5; }
.choice.done::after { content: '✅'; position: absolute; top: 6px; right: 8px; font-size: 21px; }

.num-done { width: min(88vw, 420px); min-height: 66px; font-size: 24px; }

/* La bande numérique : deux rangées de dix, la structure des dizaines se voit. */
.numstrip { gap: 3px; }
.numstrip .alpha { aspect-ratio: auto; min-height: 25px; border-radius: 7px; font-size: 13px; }

.numcard-back { padding: 12px; }
.numcard-back .dots { gap: 5px 9px; }
.numcard-back .dots i:not(:empty) { font-size: clamp(24px, 8vw, 42px); }

/* La carte de repli de l'album des chiffres dessine la quantité : l'album est
   consultable comme aide-mémoire avant même que les images existent. */
.noimg-dots {
  display: grid; grid-template-columns: repeat(5, auto);
  gap: 4px; justify-content: center; margin-top: 7px;
}
.noimg-dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--purple-dk); opacity: .6; }
.slot .noimg-dots { display: none; }


/* ══ Modales ═════════════════════════════════════════════════════════════════ */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 14px max(12px, env(safe-area-inset-bottom));
  background: rgba(64, 40, 96, .74);
  backdrop-filter: blur(6px);
}
.modal[hidden] { display: none; }

.reward {
  width: min(94vw, 430px);
  max-height: 100%;
  display: flex; flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 6px solid var(--white);
  border-radius: 32px;
  text-align: center;
  background: linear-gradient(180deg, #fff, #fff0f9);
  box-shadow: var(--shadow-l);
}
.reward-kicker { margin: 0; font-size: 19px; color: #7a5ba8; }
/* Le palier de dix : la seule cérémonie du jeu, et le seul moment où arrêter
   est proposé plutôt que subi. */
.reward.is-milestone { border-color: var(--sun); background: linear-gradient(180deg, #fff, #fff6de); }
.reward.is-milestone .reward-kicker { font-size: 22px; font-weight: 900; color: #b0730a; }
.reward-name { margin: 0; font-size: clamp(26px, 8vw, 36px); font-weight: 900; color: var(--purple-dk); }
.reward-imgwrap {
  position: relative;                /* ancre la carte de repli .noimg */
  min-height: 0; flex: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 22px; overflow: hidden;
  background: #efe6ff;
}
/* Sans image, le cadre n'a plus de contenu : `flex: 1` dans une carte de
   hauteur libre le réduirait à rien et la modale n'afficherait que son titre.
   On lui rend le format d'une photo de chat. */
.reward-imgwrap.has-noimg { flex: none; width: 100%; aspect-ratio: 9 / 16; max-height: 54dvh; }
.reward-img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 22px;
  display: block;
}
/* Carte de repli quand l'image d'un chat n'existe pas encore (le 27e, espagnol). */
.noimg {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  background: repeating-linear-gradient(135deg, #e6dcff 0 12px, #dccdfb 12px 24px);
}
.noimg-paw { font-size: 15vw; line-height: 1; opacity: .55; }
.noimg-letter { font-size: 9vw; font-weight: 900; color: var(--purple-dk); }
.slot .noimg-paw { font-size: 26px; }
.slot .noimg-letter { display: none; }

.cta {
  flex: none;
  min-height: 74px;
  border: 5px solid var(--white);
  border-radius: 24px;
  font-size: 28px; font-weight: 900;
  color: var(--white);
  background: linear-gradient(180deg, #ff9fca, #ff6fb0);
  box-shadow: var(--shadow-m), inset 0 -5px 0 rgba(150, 30, 90, .16);
}
.cta:active { transform: scale(.97); }
.cta-soft { background: linear-gradient(180deg, #cbbcff, #a58cf5); }
/* Action secondaire, destinée au parent : pas besoin d'un texte de 28 px. */
#resetBtn { font-size: 21px; }

.sheet {
  width: min(94vw, 430px);
  max-height: 100%; overflow-y: auto;
  display: flex; flex-direction: column; gap: 11px;
  padding: 18px;
  border: 6px solid var(--white);
  border-radius: 30px;
  background: #fff;
  box-shadow: var(--shadow-l);
}
.sheet-title { margin: 0; font-size: 25px; }
.sheet .row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 54px;
  font-size: 17px; font-weight: 700;
}
.sheet .row input[type=checkbox] { width: 30px; height: 30px; accent-color: var(--purple); flex: none; }
.sheet .row select { min-height: 46px; max-width: 62%; border-radius: 12px; border: 2px solid #ddd3f5; padding: 0 8px; font-size: 15px; font-weight: 700; }
/* Les noms de voix sont longs (« Amélie (fr-CA) ») : sur une ligne à part. */
.sheet .row-stack { flex-direction: column; align-items: stretch; gap: 6px; min-height: 0; }
.sheet .row-stack select { max-width: none; width: 100%; }
.mini {
  min-height: 48px; margin-top: -4px;
  border: 2px solid #ddd3f5; border-radius: 12px;
  font-size: 15px; font-weight: 700; color: #5d4791;
  background: #f4efff;
}
.mini:disabled { opacity: .5; }
.note { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.4; color: #6a5a90; background: #f4efff; padding: 10px 12px; border-radius: 12px; }


/* ══ Finale : l'album est complet ════════════════════════════════════════════ */
/* Plein écran plutôt qu'une carte : la vidéo est verticale comme le téléphone,
   la mettre dans une vignette n'en montrerait qu'une bande étroite. Le texte
   passe par-dessus, posé sur un dégradé qui le garde lisible quelle que soit
   l'image en dessous. */
.modal-finale { padding: 0; background: #1a0b34; }
.finale {
  position: relative;
  width: 100%; height: 100%;
  max-width: 520px;
  overflow: hidden;
  background: #1a0b34;
}
.finale-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.finale-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: clamp(34px, 12vw, 60px);
}
.finale-fallback span { animation: fireworks 1.7s ease-in-out infinite; }
.finale-fallback span:nth-child(2) { animation-delay: .22s; }
.finale-fallback span:nth-child(3) { animation-delay: .44s; }
.finale-fallback span:nth-child(4) { animation-delay: .66s; }
.finale-fallback span:nth-child(5) { animation-delay: .88s; }
@keyframes fireworks {
  0%, 100% { transform: scale(.7); opacity: .4; }
  50%      { transform: scale(1.15); opacity: 1; }
}

.finale-panel {
  position: absolute; inset: auto 0 0 0;
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
  padding: 64px 18px max(16px, env(safe-area-inset-bottom));
  text-align: center;
  background: linear-gradient(180deg,
    rgba(26, 11, 52, 0) 0%,
    rgba(26, 11, 52, .58) 34%,
    rgba(26, 11, 52, .92) 100%);
}
.finale-kicker { margin: 0; font-size: 40px; line-height: 1; }
.finale-title {
  margin: 0;
  font-size: clamp(28px, 9vw, 40px);
  font-weight: 900;
  color: var(--white);
  text-shadow: 0 3px 0 rgba(40, 18, 80, .5), 0 10px 24px rgba(0, 0, 0, .5);
}
.finale-text {
  margin: 0 0 6px;
  font-size: 19px; font-weight: 800;
  color: #ffe9b8;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .6);
}
.finale-panel .cta { width: min(84vw, 380px); }

/* Bouton « revoir la fête », sous le compte de l'album. */
.replay { flex: none; min-height: 56px; font-size: 19px; margin-bottom: 10px; }
.replay[hidden] { display: none; }


/* ══ Confettis ═══════════════════════════════════════════════════════════════ */
.confetti { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
.piece { position: absolute; top: -40px; font-size: 26px; animation: fall 1.9s linear forwards; }
@keyframes fall { to { transform: translateY(112dvh) rotate(680deg); opacity: .85; } }


/* ══ Les cinq jeux de mots ═══════════════════════════════════════════════════
   Mémo, Glouton, la chasse au trésor, la fabrique et les enquêtes. Tous
   partagent les briques du haut de ce fichier — `.screen`, `.choices`,
   `.album`, `.slot`, `.cta`, `.ear` — et n'ajoutent ici que ce qui leur est
   propre. La règle des 64 px de zone tactile tient partout. */

/* Deux onglets seulement : jouer, et son album. */
.tabbar-2 { grid-template-columns: repeat(2, 1fr); }

/* Une pastille d'album qui porte un mot plutôt qu'un numéro. */
.badge-wide {
  max-width: calc(100% - 8px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px;
}
/* Le carnet de la fabrique compte une centaine de cases : quatre colonnes,
   sinon la page devient un couloir interminable. */
.album-wide { grid-template-columns: repeat(4, 1fr); }
.album-wide .slot .badge { font-size: 10px; min-width: 0; }


/* ══ MÉMO DES MOTS ═══════════════════════════════════════════════════════════ */
.screen-memo { justify-content: flex-start; gap: 8px; padding-top: 2px; }

.memo-head {
  width: min(94vw, 480px);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.memo-theme {
  padding: 6px 14px;
  border: 3px solid var(--white); border-radius: 999px;
  font-size: 15px; font-weight: 900; color: #4a3a78;
  box-shadow: var(--shadow-s);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.memo-tally {
  flex: none;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .7);
  font-size: 17px; font-weight: 900; color: #5d4791;
}

/* La bande du haut : la carte qu'on vient de retourner, à la taille où un mot
   se déchiffre. C'est elle qui fait du mémo un exercice de lecture et pas un
   exercice de mémoire visuelle. */
.memo-zoom {
  width: min(94vw, 480px); min-height: 64px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 4px 12px;
  border: 4px solid var(--white); border-radius: 20px;
  background: rgba(255, 255, 255, .74);
  box-shadow: var(--shadow-s);
}
.memo-zoom.is-idle { font-size: 28px; opacity: .5; }
.memo-zoom-emoji { font-size: 40px; line-height: 1; }
.memo-zoom-word {
  font-size: clamp(24px, 7.5vw, 38px); font-weight: 900;
  color: var(--purple-dk);
}

.memo-grid {
  width: min(94vw, 480px);
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 9px;
}
.memocard {
  position: relative;
  min-height: 0; padding: 4px;
  display: flex; align-items: center; justify-content: center;
  border: 5px solid var(--white); border-radius: 20px;
  background: linear-gradient(180deg, #a58cf5, #8b6cff);
  box-shadow: var(--shadow-s);
  overflow: hidden;
  transition: transform .14s, background .2s;
}
.memocard:active { transform: scale(.96); }
.memo-back { font-size: clamp(22px, 7vw, 34px); opacity: .85; }
.memo-front { display: none; text-align: center; line-height: 1.05; }
.memocard.open, .memocard.done {
  background: linear-gradient(180deg, #ffffff, #fff3fb);
}
.memocard.open .memo-back, .memocard.done .memo-back { display: none; }
.memocard.open .memo-front, .memocard.done .memo-front { display: block; }
.memo-front.is-word {
  font-size: clamp(12px, 4.2vw, 22px); font-weight: 900;
  color: var(--purple-dk);
  word-break: break-word; hyphens: auto;
}
.memo-front.is-img { font-size: clamp(28px, 9.5vw, 48px); }
.memocard.done { border-color: var(--mint); opacity: .92; }
.memocard.done::after {
  content: '✅'; position: absolute; top: 2px; right: 4px; font-size: 13px;
}


/* ══ GLOUTON ═════════════════════════════════════════════════════════════════ */
.screen-glouton { justify-content: space-between; gap: 6px; padding: 2px 0 0; }

.glo-mission {
  width: min(94vw, 480px); min-height: 64px;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; text-align: left;
  border: 5px solid var(--white); border-radius: 22px;
  background: linear-gradient(180deg, #ffffff, #f3ecff);
  box-shadow: var(--shadow-s);
}
.glo-mission-emoji { flex: none; font-size: 26px; font-weight: 900; color: var(--purple-dk); }
.glo-mission-text { font-size: 18px; font-weight: 900; line-height: 1.15; color: #4a3a78; }

.glo-dots { display: flex; gap: 6px; }
.glo-dots i {
  width: 12px; height: 12px; border-radius: 50%;
  background: rgba(255, 255, 255, .7);
  transition: background .2s, transform .2s;
}
.glo-dots i.on { background: var(--mint); transform: scale(1.15); }

/* `touch-action: none` n'est pas décoratif : sans lui, le navigateur avale le
   glissement pour faire défiler la page et Glouton ne reçoit jamais rien. */
.glo-item {
  touch-action: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 20px;
  border: 5px solid var(--white); border-radius: 26px;
  background: linear-gradient(180deg, #ffffff, #fff0f7);
  box-shadow: var(--shadow-m);
  transition: box-shadow .15s;
}
.glo-item.dragging { box-shadow: var(--shadow-l); transition: none; }
.glo-item-emoji { font-size: clamp(54px, 18vw, 92px); line-height: 1; }
.glo-item-word { font-size: clamp(19px, 5.6vw, 28px); font-weight: 900; color: var(--purple-dk); }
.glo-item.eaten { animation: gloEat .6s ease forwards; }
.glo-item.tossed { animation: gloToss .6s ease forwards; }
.glo-item.spat { animation: gloSpit .6s ease; }
@keyframes gloEat  { to { transform: translateY(22vh) scale(.08) rotate(18deg); opacity: 0; } }
@keyframes gloToss { to { transform: translate(-42vw, 16vh) scale(.28) rotate(-42deg); opacity: 0; } }
@keyframes gloSpit {
  30% { transform: translateY(-42px) rotate(-14deg); }
  62% { transform: translateY(12px) rotate(9deg); }
}

.glo-how { margin: 0; font-size: 14px; font-weight: 800; color: #6a5a90; }

.glo-row {
  width: 100%;
  display: flex; align-items: flex-end; justify-content: center; gap: 18px;
  padding-bottom: 4px;
}
.glo-bin {
  flex: none; width: 76px; height: 76px;
  border: 5px solid var(--white); border-radius: 26px;
  background: linear-gradient(180deg, #ffd0de, #ff9db9);
  font-size: 36px;
  box-shadow: var(--shadow-s);
  transition: transform .14s, border-color .14s;
}
.glo-bin.hot { transform: scale(1.14); border-color: var(--sun); }
.glo-bin:active { transform: scale(.94); }

/* Glouton lui-même : dessiné en CSS, pas en image. Il pèse zéro octet, reste
   net sur n'importe quel écran, et sa bouche s'ouvre quand on approche. */
.glouton {
  position: relative; flex: none;
  width: clamp(140px, 44vw, 198px);
  height: clamp(110px, 33vw, 156px);
  padding: 0; border: 0;
  border-radius: 46% 46% 40% 40% / 52% 52% 48% 48%;
  background: radial-gradient(120% 100% at 50% 0%, #b79bff 0%, #8b6cff 55%, #6d4fe0 100%);
  box-shadow: var(--shadow-m), inset 0 -10px 0 rgba(255, 255, 255, .16);
  transition: transform .18s;
}
.glouton::before, .glouton::after {
  content: ''; position: absolute; top: -13px;
  width: 15px; height: 22px;
  border-radius: 8px 8px 0 0;
  background: #6d4fe0;
}
.glouton::before { left: 26%; transform: rotate(-13deg); }
.glouton::after  { right: 26%; transform: rotate(13deg); }
.glouton-eye {
  position: absolute; top: 19%;
  width: 26%; height: 30%;
  border-radius: 50%; background: var(--white);
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, .06);
}
.glouton-eye:nth-of-type(1) { left: 13%; }
.glouton-eye:nth-of-type(2) { right: 13%; }
.glouton-eye::after {
  content: ''; position: absolute; left: 28%; top: 32%;
  width: 44%; height: 44%;
  border-radius: 50%; background: #3a2a66;
}
.glouton-mouth {
  position: absolute; left: 50%; bottom: 9%;
  transform: translateX(-50%);
  width: 46%; height: 19%;
  border-radius: 40% 40% 62% 62%;
  background: #3a1f5e;
  box-shadow: inset 0 -6px 0 rgba(255, 120, 180, .5);
  transition: height .18s, width .18s;
}
.glouton.open { transform: scale(1.06); }
.glouton.open .glouton-mouth { height: 44%; width: 60%; }
.glouton.chomp .glouton-mouth { animation: chomp .45s ease; }
@keyframes chomp { 40% { height: 48%; width: 62%; } }
.glouton.yuck { animation: yuck .5s ease; }
@keyframes yuck {
  25% { transform: translateX(-9px) rotate(-4deg); }
  65% { transform: translateX(9px) rotate(4deg); }
}


/* ══ CHASSE AU TRÉSOR ════════════════════════════════════════════════════════ */
.screen-chasse { justify-content: center; gap: 7px; padding-top: 2px; }

.chasse-map { display: flex; gap: 6px; }
.chasse-step { font-size: 23px; opacity: .38; transition: transform .2s, opacity .2s; }
.chasse-step.done { opacity: .85; }
.chasse-step.on {
  opacity: 1; transform: scale(1.35);
  filter: drop-shadow(0 3px 5px rgba(80, 55, 120, .32));
}

.chasse-scene {
  width: min(94vw, 480px);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 12px;
  border: 4px solid var(--white); border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .82), rgba(255, 255, 255, .5));
  box-shadow: var(--shadow-s);
}
.chasse-lieu { font-size: 16px; font-weight: 900; color: #4a3a78; }
.chasse-deco { font-size: clamp(20px, 6.5vw, 28px); letter-spacing: 3px; }
.chasse-jalons { display: flex; gap: 12px; }
.chasse-jalon {
  font-size: 22px; opacity: .2; filter: grayscale(1);
  transition: opacity .25s, filter .25s, transform .25s;
}
.chasse-jalon.on { opacity: 1; filter: none; transform: scale(1.2); }
.chasse-goal { font-size: 13px; font-weight: 800; color: #6a5a90; }

.chasse-ref {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 16px;
  border: 4px solid var(--sun); border-radius: 999px;
  background: #fff8e2;
}
.chasse-ref-emoji { font-size: 32px; line-height: 1; }
.chasse-ref-word { font-size: 23px; font-weight: 900; color: var(--purple-dk); }

/* Une tuile de choix qui porte un dessin et son mot. Elle remplace la tuile à
   une seule grosse lettre des deux premiers jeux. */
.choice-mot {
  flex-direction: column; gap: 4px;
  height: clamp(102px, 20dvh, 152px);
  font-size: inherit;
  padding: 6px;
}
.choice-emoji { font-size: clamp(32px, 10.5vw, 50px); line-height: 1; }
.choice-word {
  font-size: clamp(11px, 3.4vw, 16px); font-weight: 900;
  line-height: 1.1; text-align: center;
  color: var(--white);
  text-shadow: 0 2px 0 rgba(80, 55, 120, .3);
}

.chasse-drum { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.chasse-drum-word { margin: 0; font-size: 22px; font-weight: 900; color: var(--purple-dk); }
.chasse-drum-hit {
  width: clamp(116px, 34vw, 164px); height: clamp(116px, 34vw, 164px);
  border: 6px solid var(--white); border-radius: 50%;
  background: radial-gradient(120% 100% at 50% 0%, #ffd08a, #e8893f);
  font-size: clamp(52px, 16vw, 78px); line-height: 1;
  box-shadow: var(--shadow-m);
}
.chasse-drum-hit.hit { animation: drumHit .28s ease; }
@keyframes drumHit { 40% { transform: scale(.9); } }
.chasse-drum-dots { display: flex; gap: 5px; min-height: 30px; font-size: 23px; }
.chasse-drum-dots i { font-style: normal; animation: pop .3s ease; }
.chasse-drum-ok { width: min(72vw, 320px); min-height: 58px; font-size: 20px; }


/* ══ FABRIQUE À MOTS ═════════════════════════════════════════════════════════ */
.screen-fab { justify-content: center; gap: 8px; padding-top: 2px; }

.fab-goal {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 16px;
  border: 4px solid var(--sun); border-radius: 999px;
  background: #fff8e2;
}
.fab-goal-emoji { font-size: 34px; line-height: 1; }
.fab-goal-word {
  font-size: 24px; font-weight: 900; letter-spacing: 1px;
  color: var(--purple-dk);
}

.fab-machine {
  width: min(94vw, 480px);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px;
  border: 6px solid var(--white); border-radius: 28px;
  background: linear-gradient(180deg, #dce9ff, #bcd4f5);
  box-shadow: var(--shadow-m);
}
.fab-slots { display: flex; gap: 10px; }
.fab-slot {
  min-width: clamp(90px, 25vw, 128px); min-height: 66px;
  border: 5px dashed rgba(109, 79, 224, .38); border-radius: 18px;
  background: rgba(255, 255, 255, .55);
  font-size: clamp(21px, 6.5vw, 30px); font-weight: 900;
  color: rgba(109, 79, 224, .42);
}
.fab-slot.filled {
  border-style: solid; border-color: var(--white);
  background: linear-gradient(180deg, #ffffff, #f2ecff);
  color: var(--purple-dk);
}
/* Le morceau donné par la consigne : on peut l'entendre, pas le retirer. */
.fab-slot.fixed { border-color: var(--sun); background: #fff8e2; }

.fab-gears { display: flex; gap: 14px; font-size: 21px; }
.fab-machine.working .fab-gears span { animation: spin .8s linear infinite; }
.fab-machine.working .fab-gears span:nth-child(2) { animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }

.fab-out {
  width: 100%; min-height: 76px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  border: 4px solid var(--white); border-radius: 18px;
  background: rgba(255, 255, 255, .55);
  transition: background .2s, border-color .2s;
}
.fab-out.is-empty { font-size: 21px; opacity: .45; letter-spacing: 6px; }
.fab-out.is-word { background: linear-gradient(180deg, #d7ffe9, #a9f0cd); border-color: var(--mint); }
.fab-out.is-fun  { background: linear-gradient(180deg, #fff0d4, #ffd9a6); border-color: var(--sun); }
.fab-out-emoji { font-size: clamp(36px, 10.5vw, 52px); line-height: 1; }
.fab-out-word { font-size: clamp(23px, 6.8vw, 34px); font-weight: 900; color: var(--purple-dk); }

.fab-go { width: min(80vw, 340px); min-height: 62px; font-size: 22px; }

.fab-tray {
  width: min(94vw, 480px);
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: 9px;
}
.fab-syl {
  min-height: 62px;
  border: 5px solid var(--white); border-radius: 18px;
  background: linear-gradient(180deg, #ffe08a, #ffc24d);
  font-size: clamp(18px, 5.4vw, 25px); font-weight: 900; color: #5b3d00;
  box-shadow: var(--shadow-s);
  transition: transform .12s, opacity .14s;
}
.fab-syl:active { transform: scale(.95); }
.fab-syl.used { opacity: .26; }


/* ══ LES ENQUÊTES ════════════════════════════════════════════════════════════ */
.screen-enq { justify-content: center; gap: 7px; padding-top: 2px; }

.enq-title {
  margin: 0; text-align: center;
  font-size: clamp(17px, 5.2vw, 22px); font-weight: 900;
  color: var(--white);
  text-shadow: 0 3px 0 rgba(90, 64, 145, .25);
}
.enq-steps { display: flex; gap: 7px; }
.enq-step { font-size: 19px; opacity: .32; transition: transform .2s, opacity .2s; }
.enq-step.done { opacity: .9; }
.enq-step.on { opacity: 1; transform: scale(1.3); }

.enq-lieu {
  padding: 3px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .7);
  font-size: 14px; font-weight: 900; color: #5d4791;
}

/* La scène. Les objets sont posés en pourcentage : la même enquête tient sur
   un petit iPhone et sur une tablette sans qu'aucune coordonnée change. */
.enq-scene {
  position: relative;
  width: min(94vw, 480px);
  height: clamp(200px, 33dvh, 310px);
  border: 5px solid var(--white); border-radius: 24px;
  box-shadow: var(--shadow-m);
  overflow: hidden;
}
.enq-obj {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 56px; min-height: 56px;   /* la zone tactile, pas le dessin */
  padding: 0; border: 0; background: transparent;
  border-radius: 50%;
  font-size: clamp(27px, 8.2vw, 38px); line-height: 1;
  transition: transform .16s;
}
.enq-obj:active { transform: translate(-50%, -50%) scale(.88); }
.enq-obj.found {
  background: rgba(255, 255, 255, .65);
  box-shadow: 0 0 0 4px var(--mint);
  animation: enqFound .7s ease;
}
@keyframes enqFound {
  30% { transform: translate(-50%, -50%) scale(1.42) rotate(-8deg); }
  62% { transform: translate(-50%, -50%) scale(1.14) rotate(6deg); }
}
.enq-obj.nope { animation: enqNope .45s ease; }
@keyframes enqNope {
  25% { transform: translate(-50%, -50%) rotate(-11deg); }
  70% { transform: translate(-50%, -50%) rotate(11deg); }
}

.enq-cards {
  width: min(94vw, 480px);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px;
}
.enq-card {
  position: relative;
  min-height: clamp(106px, 20dvh, 156px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  padding: 6px;
  border: 5px solid var(--white); border-radius: 22px;
  box-shadow: var(--shadow-s);
  transition: transform .14s, opacity .2s;
}
.enq-card:active { transform: scale(.95); }
.enq-card-emoji { font-size: clamp(30px, 9.5vw, 44px); line-height: 1; }
.enq-card-text {
  font-size: clamp(10px, 3.1vw, 14px); font-weight: 900;
  line-height: 1.1; text-align: center;
  color: var(--white);
  text-shadow: 0 2px 0 rgba(80, 55, 120, .32);
}
.enq-card.found { box-shadow: 0 0 0 5px var(--mint), var(--shadow-m); animation: pop .45s ease; }
.enq-card.nope { animation: shake .42s ease; opacity: .5; }
.enq-card.done { opacity: .72; }
/* Le rang s'inscrit sur la carte : sans lui, la troisième image se touche au
   hasard parce qu'on ne voit plus ce qu'on a déjà placé. */
.enq-card-rank {
  position: absolute; top: 4px; left: 5px;
  min-width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--white); color: var(--purple-dk);
  font-size: 15px; font-weight: 900;
}


/* ══ Adaptations ═════════════════════════════════════════════════════════════ */
/* Téléphones courts (iPhone SE, vieux Android) : on comprime la verticale. */
@media (max-height: 700px) {
  .flipcard { height: 38dvh; min-height: 200px; }
  .ear { min-height: 88px; }
  .ear-emoji { font-size: 38px; }
  .ear-text { font-size: 27px; }
  .choice { height: clamp(100px, 22dvh, 170px); }
  .tab { min-height: 60px; }
  .round, .cta { min-height: 64px; }
  .micbtn { min-height: 78px; }
  .instruction { font-size: 19px; }
  .feedback { font-size: 21px; min-height: 28px; }
  .gamecard { min-height: 96px; }
  .gamecard-emoji { width: 62px; height: 62px; font-size: 34px; }
  .gamecard-body strong { font-size: 21px; }
  .ear-sm { min-height: 64px; }
  .ear-sm .ear-text { font-size: 22px; }
  .screen-num .choice { height: clamp(80px, 16dvh, 130px); }
  .screen-num.has-stage .choice { height: clamp(64px, 11dvh, 100px); }
  .seq-cell { min-width: 50px; min-height: 50px; font-size: 22px; }
  .seq-long .seq-cell { min-width: 42px; min-height: 46px; font-size: 18px; }
  .thing { font-size: clamp(20px, 6vw, 28px); }
  .thing-btn { min-height: 48px; }
  .num-done { min-height: 58px; font-size: 21px; }
  .memo-zoom { min-height: 54px; }
  .memo-zoom-emoji { font-size: 32px; }
  .memo-zoom-word { font-size: clamp(20px, 6.5vw, 30px); }
  .glo-mission { min-height: 56px; }
  .glo-mission-text { font-size: 16px; }
  .glo-item { padding: 6px 14px; }
  .glo-item-emoji { font-size: clamp(44px, 15vw, 70px); }
  .glo-item-word { font-size: clamp(17px, 5vw, 23px); }
  .glo-bin { width: 64px; height: 64px; font-size: 30px; }
  .glouton { width: clamp(118px, 38vw, 160px); height: clamp(92px, 29vw, 126px); }
  .chasse-scene { padding: 5px 10px; }
  .chasse-deco { font-size: clamp(17px, 5.5vw, 23px); }
  .choice-mot { height: clamp(84px, 17dvh, 122px); }
  .choice-emoji { font-size: clamp(27px, 9vw, 40px); }
  .chasse-drum-hit { width: clamp(96px, 29vw, 128px); height: clamp(96px, 29vw, 128px); font-size: clamp(42px, 13vw, 60px); }
  .fab-slot { min-height: 56px; }
  .fab-out { min-height: 62px; }
  .fab-syl { min-height: 54px; }
  .fab-go { min-height: 54px; font-size: 19px; }
  .enq-scene { height: clamp(168px, 30dvh, 240px); }
  .enq-card { min-height: clamp(88px, 17dvh, 124px); }
  /* Le tambour est l'écran le plus haut de tout le jeu : scène, consigne,
     tambour, comptage et bouton de validation empilés. Sur un écran de
     640 px il débordait d'une centaine de pixels ; tout y est resserré. */
  .screen-chasse { gap: 5px; }
  .chasse-scene { padding: 4px 10px; gap: 1px; }
  .chasse-lieu { font-size: 14px; }
  .chasse-deco { font-size: 16px; letter-spacing: 1px; }
  .chasse-goal { font-size: 11px; }
  .chasse-step { font-size: 18px; }
  .chasse-jalon { font-size: 18px; }
  .chasse-ref { padding: 3px 12px; }
  .chasse-ref-emoji { font-size: 26px; }
  .chasse-ref-word { font-size: 19px; }
  .chasse-drum { gap: 5px; }
  .chasse-drum-word { font-size: 18px; }
  .chasse-drum-hit {
    width: clamp(86px, 25vw, 112px); height: clamp(86px, 25vw, 112px);
    font-size: clamp(38px, 11vw, 52px);
  }
  .chasse-drum-dots { min-height: 24px; font-size: 19px; }
  .chasse-drum-ok { min-height: 50px; font-size: 17px; }
  .screen-fab { gap: 5px; }
  .fab-machine { padding: 8px; gap: 4px; }
  .fab-goal { padding: 2px 12px; }
  .fab-goal-emoji { font-size: 27px; }
  .fab-goal-word { font-size: 20px; }
  .fab-gears { font-size: 17px; }
}

/* Paysage : on met la carte et les boutons côte à côte plutôt que d'écraser. */
@media (orientation: landscape) and (max-height: 560px) {
  .app { max-width: 780px; }
  .screen { flex-direction: row; flex-wrap: wrap; }
  .ear { min-height: 72px; }
  .choice { height: min(44dvh, 190px); }
  .flipcard { height: 44dvh; width: min(46vw, 320px); }
  .alphastrip { display: none; }
  /* La bande numérique disparaît aussi : en paysage il n'y a plus de place, et
     le jeu reste jouable sans son échafaudage. */
  /* Remettre un écran en colonne ne suffit pas : `.screen` porte aussi
     `flex-wrap: wrap`, et une colonne qui déborde en hauteur repart alors
     dans une SECONDE colonne, hors de l'écran. Il faut les deux. */
  .screen-num { flex-direction: column; flex-wrap: nowrap; }
  .screen-num .choice { height: min(30dvh, 130px); }
  .jar { display: none; }
  /* Les jeux de mots gardent leur colonne : leurs écrans sont déjà denses,
     les mettre en rangée ne ferait qu'écraser tout le monde.

     Ils sont pensés pour un téléphone tenu à la verticale, et c'est ainsi
     qu'ils se jouent. Un téléphone basculé par accident ne doit pourtant pas
     rendre un bouton de réponse inatteignable : on comprime tout ce qui peut
     l'être, et le défilement sert de filet pour le reste. */
  .screen-memo, .screen-glouton, .screen-chasse, .screen-fab, .screen-enq {
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-y: auto;
    gap: 5px;
  }
  .ear-sm { min-height: 54px; }
  .ear-sm .ear-emoji { font-size: 26px; }
  .ear-sm .ear-text { font-size: 19px; }

  .memo-zoom { min-height: 44px; }
  .memo-zoom-emoji { font-size: 26px; }
  .memo-zoom-word { font-size: 22px; }

  .glo-mission { min-height: 48px; }
  .glo-mission-text { font-size: 15px; }
  .glo-item { padding: 4px 12px; }
  .glo-item-emoji { font-size: 40px; }
  .glo-item-word { font-size: 17px; }
  .glo-how { display: none; }
  .glouton { width: 128px; height: 94px; }
  .glo-bin { width: 58px; height: 58px; font-size: 26px; }

  .chasse-map, .chasse-deco { display: none; }
  .chasse-scene { padding: 3px 10px; }
  .choice-mot { height: min(30dvh, 118px); }
  .chasse-drum-hit { width: 76px; height: 76px; font-size: 34px; }
  .chasse-drum-ok { min-height: 48px; font-size: 16px; }

  .fab-machine { padding: 6px; gap: 3px; }
  .fab-gears { display: none; }
  .fab-slot { min-height: 48px; }
  .fab-out { min-height: 48px; }
  .fab-syl { min-height: 46px; }
  .fab-go { min-height: 48px; font-size: 17px; }
  /* Une seule rangée de morceaux : en paysage la largeur est ce qui abonde. */
  .fab-tray { grid-template-columns: repeat(6, minmax(0, 1fr)); }

  .enq-title { font-size: 16px; }
  .enq-scene { height: 190px; }
  .enq-card { min-height: 92px; }
}

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