/* Base visuelle « Arcade+ clair » — design v4 (CroqueMot, fond clair & lumineux).
 * Monde habité par Croquy 🐊 : fond lavande → crème, dégradés vifs par jeu,
 * boutons arcade 3D (ombre dure + reflet), pastilles colorées. Typo ronde Baloo 2.
 * Accessibilité (décision 6A) : cibles ≥48px, contraste soigné, tailles en rem,
 * prefers-reduced-motion coupe les animations. */
:root {
  --bg: #F4EEFF;          /* surface claire opaque (dock clavier, sheets) */
  --ink: #2B2340;         /* encre foncée */
  --muted: #8478B8;       /* texte violet doux (sous-titres, méta) */
  --line: #E0D6F2;        /* traits lavande clair */

  /* palette arcade */
  --purple: #7C3AED; --purple-d: #6D28D9;
  --cyan: #06B6D4;   --cyan-d: #0891B2;
  --pink: #EC4899;   --pink-d: #DB2777;
  --green: #84CC16;  --green-d: #65A30D;  --green-sh: #4D7C0F;   /* ombre 3D CTA */
  --gold: #FBBF24;   --gold-d: #F59E0B;   --gold-ink: #3A2400;

  /* couleurs par jeu (dérivées de la palette) */
  --croise: var(--pink);   /* mots croisés — rose */
  --meles:  var(--cyan);   /* mots mêlés — cyan */
  --ana:    var(--green);  /* anagramme — vert */
  --motus:  var(--purple); /* mot du jour — violet */

  --ok: #84CC16;          /* case résolue */
  --focus: #F0E9FF;       /* case active */
  --accent: var(--purple);

  --r-card: 20px;
  --r-chip: 12px;
  --tap: 48px;
  --sh-btn: 0 3px 0 rgba(124, 58, 237, 0.16); /* ombre 3D bouton clair */
  --shadow: 0 12px 26px -14px rgba(80, 50, 120, 0.55); /* halo doux carte */
}

* {
  box-sizing: border-box; -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;   /* jeu, pas une page à copier */
  -webkit-touch-callout: none;                     /* pas de menu au long-press */
}

html { font-size: 16px; }             /* corps ≥16px, tout en rem */

body {
  margin: 0;
  overflow-x: hidden;                 /* aucune barre horizontale : le contenu se cale sur la largeur écran */
  color: var(--ink);
  background: radial-gradient(130% 55% at 50% 0%, #E9E1FF 0%, #F1EBFF 50%, #FFF3E9 100%) fixed, var(--bg);
  font-family: "Baloo 2", "Fredoka", "Segoe UI Rounded", "Arial Rounded MT Bold", sans-serif;
  font-weight: 600;
}

button {
  font: inherit; font-weight: 800;
  min-height: var(--tap);
  min-width: var(--tap);
  border: none;
  border-radius: var(--r-chip);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  /* Supprime le délai de ~300 ms + le double-tap-zoom : le `click` part
   * immédiatement, donc la page n'a pas le temps de défiler entre le toucher
   * et le clic (cause n°1 des taps qui atterrissent sur la touche d'à-côté). */
  touch-action: manipulation;
}
button:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }

@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

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

/* --- Grille (core/grid-view.js) --------------------------------------------- */
.grid {
  --cell: min(11vw, 44px);
  display: grid;
  gap: 4px;
  justify-content: center;
  margin: 0 auto;
}
.cell {
  position: relative;
  width: var(--cell);
  height: var(--cell);
  min-width: 0; min-height: 0;          /* la cible tactile 48px est la case entière + gap */
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-weight: 800;
  font-size: calc(var(--cell) * 0.55);
  line-height: 1;
  text-transform: uppercase;
  display: flex; align-items: center; justify-content: center;
}
.cell-gap { border: none; background: transparent; visibility: hidden; }
.cell-num {
  position: absolute; top: 1px; left: 3px;
  font-size: calc(var(--cell) * 0.26); font-weight: 700; color: var(--muted);
}
.cell.hl { background: color-mix(in srgb, var(--accent) 12%, #fff); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.cell.cursor { border-color: var(--accent); background: var(--focus); }
.cell.ok {
  background: linear-gradient(180deg, var(--green), var(--green-d)); color: #fff; border-color: var(--green-d);
  box-shadow: inset 0 2px 3px rgba(255,255,255,.35), 0 3px 0 var(--green-sh);
  animation: cell-bounce 0.35s ease both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.cell.pop { animation: cell-pop 0.16s ease; }
.cell.shake { animation: cell-shake 0.3s ease; }

@keyframes cell-pop   { 0% { transform: scale(1); } 50% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes cell-bounce{ 0% { transform: scale(0.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes cell-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* --- Clavier (core/keyboard.js) --------------------------------------------- */
/* Le clavier reste collé en bas : la grille défile au-dessus, mais les touches
 * ne bougent jamais -> plus de tap qui atterrit à côté à cause de l'inertie du
 * scroll. Fond opaque lavande pour que la grille ne transparaisse pas dessous. */
.kb-dock { position: sticky; bottom: 0; z-index: 3; background: #EFE7FA; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0); }
.kb { display: flex; flex-direction: column; gap: 6px; padding: 10px 8px; max-width: 520px; margin: 0 auto; }
.kb-row { display: flex; gap: 5px; justify-content: center; }
.kb-key {
  flex: 1 1 0; height: var(--tap); min-width: 0;
  border-radius: var(--r-chip);
  background: #fff; color: var(--ink);
  box-shadow: var(--sh-btn);
  font-weight: 800; font-size: 1.05rem;
}
.kb-key:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(124,58,237,.16); }
.kb-wide { flex: 1.5 1 0; background: var(--ink); color: #fff; box-shadow: 0 3px 0 rgba(43,35,64,.3); }

/* --- Shells de jeu communs -------------------------------------------------- */
.game { max-width: 560px; margin: 0 auto; }
.clue-bar {
  position: sticky; top: 0; z-index: 2;
  margin: 2px 12px 0; border-radius: 16px;
  background: linear-gradient(150deg, var(--purple), var(--purple-d));
  color: #fff; font-weight: 700;
  padding: 10px 14px; text-align: center;
  display: flex; align-items: center; gap: 10px; justify-content: center;
  box-shadow: 0 10px 22px -12px rgba(124,58,237,.8);
}
.game-crossword { --accent: var(--croise); }
.clue-bar .nav { background: rgba(255,255,255,.25); color: #fff; min-width: 40px; min-height: 40px; font-size: 1.2rem; border-radius: 12px; }
.msg { text-align: center; min-height: 1.4em; margin: 12px 0; font-weight: 800; color: var(--green-d); }

/* Sélecteur de force (mots croisés) */
.force-bar { display: flex; gap: 8px; justify-content: center; padding: 10px; flex-wrap: wrap; }
.force-chip { padding: 6px 12px; border-radius: 20px; background: #fff; box-shadow: var(--sh-btn); font-weight: 800; letter-spacing: 2px; color: var(--gold-d); }
.force-chip.on { background: var(--croise); color: #fff; }
.board { padding: 8px 6px; }

/* Mots mêlés */
.game-wordsearch { --accent: var(--meles); padding: 12px; }
.ws-grid { --cell: min(13vw, 48px); display: grid; gap: 4px; justify-content: center; }
.ws-grid .cell { border-color: var(--line); }
.ws-grid .cell.sel { background: var(--focus); border-color: var(--accent); }
.ws-grid .cell.ok { background: linear-gradient(180deg, var(--cyan), var(--cyan-d)); color: #fff; border-color: var(--cyan-d); }
.ws-words { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; padding: 14px 0 0; font-weight: 700; }
.ws-words li.done { color: var(--muted); text-decoration: line-through; }

/* Anagramme */
.game-anagram { --accent: var(--ana); padding: 16px; text-align: center; }
.ana-clue { font-size: 1.15rem; font-weight: 700; }
.ana-scramble { display: flex; gap: 6px; justify-content: center; margin: 16px 0; flex-wrap: wrap; }
.tile { width: 44px; height: 52px; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, var(--gold), var(--gold-d)); color: var(--gold-ink); border-radius: var(--r-chip); font-weight: 900; font-size: 1.3rem; box-shadow: inset 0 2px 3px rgba(255,255,255,.5), 0 3px 0 #B45309; }
.ana-slots { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.slot { width: 44px; height: 52px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--line); border-radius: var(--r-chip); background: #fff; font-weight: 900; font-size: 1.3rem; }
.slot.cursor { border-color: var(--purple); background: var(--focus); }
.slot.ok { background: linear-gradient(180deg, var(--green), var(--green-d)); color: #fff; border-color: var(--green-d); box-shadow: inset 0 2px 3px rgba(255,255,255,.35); }

/* Motus */
.game-motus { --accent: var(--motus); padding: 12px; text-align: center; }
.motus-clue { font-weight: 700; }
/* Colonnes fluides : les cases rétrécissent pour tenir dans la largeur (mots longs
 * comme « casserole »), sans jamais dépasser 46px pour les mots courts. */
.motus-board { display: flex; flex-direction: column; gap: 5px; margin: 12px auto; width: 100%; max-width: calc(var(--n) * 46px + (var(--n) - 1) * 5px); }
.motus-row { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 5px; }
.motus-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-weight: 900; font-size: 1.3rem; text-transform: uppercase; }
.motus-cell.cursor { border-color: var(--purple); background: var(--focus); }
.motus-cell.ok { background: linear-gradient(180deg, var(--green), var(--green-d)); color: #fff; border-color: var(--green-d); box-shadow: inset 0 2px 3px rgba(255,255,255,.35); }
.motus-cell.present { background: linear-gradient(180deg, var(--gold), var(--gold-d)); color: var(--gold-ink); border-color: var(--gold-d); }
.motus-cell.absent { background: #C4B8DE; color: #fff; border-color: #C4B8DE; }
.motus-cell.flip { animation: motus-flip .26s ease; }
@keyframes motus-flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }

.shake { animation: cell-shake 0.3s ease; }

/* --- Journal du jour -------------------------------------------------------- */
/* Plus de topbar global : marque + stats vivent dans le cartouche Croquy. */
.masthead { padding: 10px 14px 4px; margin-bottom: 4px; }
.hero {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 24px;
  background: linear-gradient(150deg, var(--purple), #9333EA 55%, #C026D3);
  box-shadow: 0 14px 30px -14px rgba(124, 58, 237, 0.7);
  position: relative; overflow: hidden;
}
.hero::after {          /* halo doux en haut à droite */
  content: ""; position: absolute; top: -30px; right: -20px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.28), transparent 70%);
}
.croquy {
  flex: none; font-size: 52px; line-height: 1; position: relative;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.25));
  animation: floaty 3.5s ease-in-out infinite;
}
.hero-body { flex: 1; position: relative; min-width: 0; }
.masthead .date { display: block; color: #EDE4FF; font-weight: 700; font-size: .8rem; text-transform: capitalize; }
.jj-title { font-size: 1.4rem; font-weight: 800; color: #fff; letter-spacing: -.3px; line-height: 1.1; margin: 2px 0 0; }
.hero-stats { display: flex; gap: 6px; margin-top: 8px; }
.jj-sub { padding: 12px 4px 0; color: var(--muted); font-weight: 700; font-size: .95rem; }

.pill {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  border-radius: 14px; padding: 5px 10px; font-size: .9rem;
  font-weight: 800; color: #fff;
  transition: transform .1s ease;
}
.pill[title="Série"]   { background: linear-gradient(180deg, #FB7185, #E11D48); box-shadow: 0 2px 0 #9F1239; }
.pill[title="Crédits"] { background: linear-gradient(180deg, var(--gold), var(--gold-d)); color: var(--gold-ink); box-shadow: 0 2px 0 #B45309; }
.pill[title="Score"]   { background: linear-gradient(160deg, var(--cyan), var(--purple)); box-shadow: 0 2px 0 #4C1D95; }

.cards-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px 2px; max-width: 560px; margin: 0 auto; }
.ch-title { font-size: .95rem; font-weight: 800; color: var(--ink); letter-spacing: .3px; }

/* Grille dorée du week-end (partie spéciale) : carte premium sur le journal. */
.special { max-width: 560px; margin: 8px auto 0; width: calc(100% - 28px); display: flex; align-items: center; gap: 12px;
  position: relative; overflow: hidden; padding: 14px 16px; border-radius: var(--r-card); text-align: left;
  background: linear-gradient(135deg, #F59E0B, #FBBF24 45%, #FDE68A); color: #4A2E00;
  box-shadow: 0 12px 26px -12px rgba(245,158,11,.9); animation: floaty 3s ease-in-out infinite; }
.special .sp-glow { position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%);
  background-size: 200% 100%; animation: shimmer 2.6s linear infinite; pointer-events: none; }
.special .sp-ic { font-size: 30px; }
.special .sp-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.special .sp-name { font-weight: 900; font-size: 1rem; }
.special .sp-desc { font-weight: 700; font-size: .78rem; opacity: .85; }
.special .sp-go { font-weight: 900; white-space: nowrap; }
#game-view.golden { background: radial-gradient(120% 60% at 50% 0%, #FFF7E0, transparent), var(--bg); }
#game-view.golden .gh-mid > span:first-child { color: var(--gold-d); }

/* Quête hebdo (journal) : barre de progression + paliers réclamables. */
.quest { max-width: 560px; margin: 6px auto 0; background: #fff; border-radius: var(--r-card); padding: 14px 16px 22px; box-shadow: var(--sh-btn); }
.q-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 18px; }
.q-title { font-weight: 800; font-size: .95rem; }
.q-prog { font-weight: 800; font-size: .78rem; color: var(--muted); }
.q-track { position: relative; height: 10px; border-radius: 6px; background: #EEE7FB; margin: 0 18px; }
.q-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: linear-gradient(90deg, var(--gold), var(--gold-d)); transition: width .5s ease; }
.q-tier { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%;
  background: #fff; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.q-tier.ready { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(251,191,36,.3); animation: q-pulse 1.2s ease-in-out infinite; }
.q-tier.done { background: linear-gradient(160deg, var(--green), var(--green-d)); border-color: #fff; }
@keyframes q-pulse { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.12); } }

.cards { display: flex; flex-direction: column; gap: 12px; padding: 8px 14px 110px; max-width: 560px; margin: 0 auto; }
.card {
  display: flex; align-items: center; gap: 13px;
  border: none; text-align: left; width: 100%;
  border-radius: var(--r-card); padding: 15px;
  color: #fff;
  transition: transform .08s ease;
}
.card:active { transform: translateY(3px) scale(.99); }
.card.c-crossword  { background: linear-gradient(150deg, var(--pink), var(--pink-d)); box-shadow: 0 12px 24px -14px rgba(236,72,153,.9); }
.card.c-wordsearch { background: linear-gradient(150deg, var(--cyan), var(--cyan-d)); box-shadow: 0 12px 24px -14px rgba(6,182,212,.9); }
.card.c-anagram    { background: linear-gradient(150deg, var(--green), var(--green-d)); box-shadow: 0 12px 24px -14px rgba(132,204,22,.9); }
.card.c-motus      { background: linear-gradient(150deg, var(--purple), var(--purple-d)); box-shadow: 0 12px 24px -14px rgba(124,58,237,.95); }
.card .card-ic {
  flex: none; width: 50px; height: 50px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.22); color: #fff;
}
.card .card-badge .ic { vertical-align: -.15em; }
.card .card-body { flex: 1; min-width: 0; }
.card .card-name { font-size: 1.15rem; font-weight: 800; }
.card .card-desc { font-size: .85rem; opacity: .92; font-weight: 700; margin-top: 1px; }
.card .card-badge { font-weight: 800; font-size: .85rem; padding: 4px 11px; border-radius: 11px; background: rgba(255,255,255,.24); white-space: nowrap; }
/* Jeu terminé : carte pâle mentholée + badge vert arcade (repos visuel). */
.card.done { background: #F2FBE4; color: var(--green-sh); border: 1.5px solid #BEE68C; box-shadow: none; }
.card.done .card-ic { background: #DCF3BE; color: var(--green-d); }
.card.done .card-desc { color: #6B9130; }
.card.done .card-badge { background: linear-gradient(180deg, var(--green), var(--green-d)); color: #fff; box-shadow: 0 3px 0 var(--green-sh); }

/* --- Vue jeu (en-tête retour) ----------------------------------------------- */
.game-header {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; font-weight: 800;
}
.game-header .back { min-width: 42px; width: 42px; height: 42px; border-radius: 14px; font-size: 1.4rem; background: #fff; box-shadow: var(--sh-btn); }
.gh-mid { flex: 1; min-width: 0; }
#game-title { display: block; font-size: 1.05rem; font-weight: 800; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Pips « parties restantes » : faites en vert, courante en dégradé, restantes en gris. */
.pips { display: flex; gap: 5px; margin-top: 6px; }
.pip { width: 20px; height: 6px; border-radius: 3px; background: #D9CEF0; }
.pip.done { background: var(--green); }
.pip.cur { background: linear-gradient(90deg, var(--purple), var(--cyan)); }
.game-header .pill { min-height: 0; }
/* Indice compact « ? » rond, à droite. */
.game-header .hint-btn { min-width: 42px; width: 42px; height: 42px; padding: 0; border-radius: 14px; font-size: 1.35rem; line-height: 1; }

/* --- Célébration numéro terminé --------------------------------------------- */
.celebration { text-align: center; padding: 40px 20px; max-width: 480px; margin: 0 auto; }
.celebration .big { font-size: 3.5rem; animation: pop-in .5s ease both; }
.celebration h2 { font-size: 1.9rem; font-weight: 800; margin: 8px 0; background: linear-gradient(100deg, var(--gold-d), var(--green) 60%, var(--cyan)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.celebration .streak { display: inline-flex; align-items: center; gap: 6px; background: #fff; border-radius: 18px; padding: 8px 16px; font-weight: 800; box-shadow: 0 6px 16px -8px rgba(124,58,237,.5); margin: 10px 0; }
.celebration .next { color: var(--muted); font-weight: 700; margin: 14px 0; }
.celebration .cta {
  background: linear-gradient(180deg, var(--green), var(--green-d)); color: #fff;
  padding: 16px 26px; border-radius: var(--r-card); font-weight: 800; font-size: 1.05rem;
  box-shadow: inset 0 2px 3px rgba(255,255,255,.4), 0 8px 0 var(--green-sh);
}
.celebration .cta:active { transform: translateY(5px); box-shadow: inset 0 2px 3px rgba(255,255,255,.4), 0 3px 0 var(--green-sh); }
@keyframes pop-in { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }

.hidden { display: none !important; }

/* --- Indice + wiggle -------------------------------------------------------- */
.hint-btn { background: linear-gradient(180deg, var(--gold), var(--gold-d)); color: var(--gold-ink); font-weight: 800; padding: 10px 18px; border-radius: 20px; box-shadow: inset 0 2px 3px rgba(255,255,255,.5), 0 3px 0 #B45309; }
.hint-btn .ic { vertical-align: -.18em; }
.wiggle { animation: wiggle 0.5s ease; }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-6deg); } 40% { transform: rotate(6deg); } 60% { transform: rotate(-4deg); } 80% { transform: rotate(4deg); } }

/* --- Bottom sheet (crédit 0, indices) — « jamais de popup centrée » ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(43,35,64,.4); display: flex; align-items: flex-end; z-index: 10; }
.sheet {
  width: 100%; max-width: 560px; margin: 0 auto;
  background: #FBF7FF; border-radius: 26px 26px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 30px -12px rgba(80,50,120,.4);
  animation: sheet-up 0.22s ease both;
}
.sheet h3 { margin: 0 0 4px; font-size: 1.3rem; font-weight: 800; }
.sheet p { margin: 0 0 14px; color: var(--muted); font-weight: 700; }
.sheet .opt { display: block; width: 100%; text-align: left; padding: 16px; border-radius: 16px; margin-bottom: 10px; font-weight: 800; background: #fff; box-shadow: var(--sh-btn); }
.sheet .opt.primary { background: linear-gradient(180deg, var(--green), var(--green-d)); color: #fff; box-shadow: inset 0 2px 3px rgba(255,255,255,.4), 0 3px 0 var(--green-sh); }
.sheet .opt.ghost { background: transparent; box-shadow: none; color: var(--muted); font-weight: 700; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet { position: relative; }
/* Croix de fermeture explicite (feuilles + moments festifs) — ne pas obliger à
 * taper le fond pour fermer. */
.sheet-x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(43,35,64,.06); color: var(--muted); font-size: 1rem; font-weight: 800; line-height: 1;
  display: flex; align-items: center; justify-content: center; }
.reward-card { position: relative; }

/* --- Icônes SVG (core/icons.js) — remplacent les emojis --------------------- */
.ic { vertical-align: -0.15em; flex: none; }
.pill .ic { color: currentColor; }
.pill.bump { animation: score-bump .4s ease; }
@keyframes score-bump { 0% { transform: scale(1); } 40% { transform: scale(1.28); } 100% { transform: scale(1); } }
.celebration .big .ic { color: var(--gold); }

/* --- Barre d'onglets (bas) — maquette 4a ------------------------------------ */
.tabbar {
  position: fixed; left: 14px; right: 14px; z-index: 40;
  bottom: calc(14px + env(safe-area-inset-bottom, 0));
  max-width: 560px; margin: 0 auto;
  display: flex; padding: 8px; gap: 4px;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid rgba(124, 58, 237, 0.12); border-radius: 26px;
  box-shadow: 0 14px 30px -10px rgba(80, 50, 120, 0.28);
}
.tab {
  flex: 1; min-height: 0; background: none; border: none; box-shadow: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 0; font-family: inherit;
}
.tab .ti {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 30px; border-radius: 12px; font-size: 18px;
  filter: grayscale(.25); opacity: .55; transition: all .12s ease;
}
.tab span:last-child { font-size: 10px; font-weight: 800; color: #A99CC4; }
.tab.on .ti {
  filter: none; opacity: 1;
  background: linear-gradient(160deg, var(--purple), var(--cyan));
  box-shadow: 0 4px 12px -2px rgba(124, 58, 237, 0.5);
}
.tab.on span:last-child { color: var(--purple); }

/* --- Écran Perso (profil + skins + réglages) -------------------------------- */
.perso-scroll { max-width: 560px; margin: 0 auto; padding: 12px 16px 110px; }
.perso-head { text-align: center; padding: 8px 0 2px; }
.perso-avatar { font-size: 80px; line-height: 1; filter: drop-shadow(0 10px 14px rgba(124, 58, 237, 0.3)); animation: floaty 3.5s ease-in-out infinite; }
.perso-name { font-size: 1.3rem; font-weight: 800; margin-top: 4px; }
.perso-sub { color: var(--muted); font-weight: 700; font-size: .9rem; }
.perso-label { font-size: .75rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin: 20px 4px 10px; }
.skins { display: flex; gap: 10px; }
.skin { flex: 1; aspect-ratio: 1; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 30px; background: #fff; border: 1px solid var(--line); position: relative; }
.skin.on { background: linear-gradient(160deg, var(--cyan), var(--purple)); border: 2px solid #fff; box-shadow: 0 6px 16px -6px rgba(124, 58, 237, 0.6); }
.skin.locked { opacity: .7; }
.skin.locked span { position: absolute; bottom: 6px; right: 8px; font-size: 13px; }
.skin.buy { flex-direction: row; gap: 3px; font-size: 14px; font-weight: 800; color: var(--gold-d); background: #FFF6E4; border-color: #F3DFA6; }
.skin.buy .ic { width: 16px; height: 16px; }

/* Collection de collectibles (écran Perso). */
.collection { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.coll { aspect-ratio: 1; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: #fff; border: 1px solid var(--line); font-size: 30px; }
.coll.on { background: linear-gradient(160deg, #FFF6E4, #FFE9C7); border: 2px solid var(--gold); box-shadow: 0 6px 16px -8px rgba(245,158,11,.6); }
.coll.locked { color: var(--muted); opacity: .55; font-size: 20px; }
.coll .cn { font-size: .6rem; font-weight: 800; color: var(--gold-d); }

/* Bouton Glouton (header de jeu) — le pouvoir « mange la grille », premium rare. */
.glouton-btn { position: relative; min-width: 42px; width: 42px; height: 42px; padding: 0; border-radius: 14px; font-size: 1.3rem; line-height: 1;
  background: linear-gradient(160deg, var(--green), var(--green-d)); box-shadow: inset 0 2px 3px rgba(255,255,255,.4), 0 3px 0 var(--green-sh); }
.glouton-btn .gb-count { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 3px; border-radius: 9px;
  background: var(--pink); color: #fff; font-size: .68rem; font-weight: 800; line-height: 17px; box-shadow: 0 0 0 2px #fff; }
.settings-list { background: #fff; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: 0 5px 16px -12px rgba(80, 50, 120, 0.4); }
.set-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px 16px; background: none; border: none; border-bottom: 1px solid #F1EBFA; border-radius: 0; min-height: 0; font-weight: 700; font-size: 1rem; color: #3A3252; box-shadow: none; }
.settings-list .set-row:last-child { border-bottom: none; }
.set-ic { font-size: 20px; flex: none; }
.set-txt { flex: 1; }
.set-chev { color: #B4A9C9; font-size: 20px; }
/* Toggle façon interrupteur (appearance:none → pastille qui glisse). */
.settings-list input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; flex: none;
  width: 48px; height: 28px; border-radius: 16px; background: #D9CEF0;
  position: relative; cursor: pointer; transition: background .15s;
}
.settings-list input[type="checkbox"]::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s;
}
.settings-list input[type="checkbox"]:checked { background: linear-gradient(180deg, var(--green), var(--green-d)); }
.settings-list input[type="checkbox"]:checked::after { transform: translateX(20px); }

/* --- Overlay de victoire d'une grille (games/*.js) -------------------------- */
.win-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(43,35,64,.35); z-index: 5; }
#game-view { position: relative; }
.win-card { background: #FBF7FF; border-radius: var(--r-card); padding: 24px 32px; text-align: center; box-shadow: 0 20px 50px -20px rgba(80,50,120,.6); animation: pop-in .45s ease both; }
.win-card.won { animation: win-pop .6s cubic-bezier(.18,1.5,.4,1) both; }
.win-card.won .ic { animation: trophy-jig .7s ease .15s both; }
@keyframes win-pop { 0% { transform: scale(.3) rotate(-12deg); opacity: 0; } 60% { transform: scale(1.12) rotate(3deg); } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes trophy-jig { 0%,100% { transform: rotate(0) scale(1); } 25% { transform: rotate(-10deg) scale(1.15); } 60% { transform: rotate(8deg) scale(1.15); } }
.win-card .ic { color: var(--gold-d); }
.win-card h3 { margin: 8px 0 0; font-size: 1.4rem; font-weight: 800; }
.win-card .win-back { margin-top: 16px; background: linear-gradient(180deg, var(--green), var(--green-d)); color: #fff; font-weight: 800; padding: 13px 22px; border-radius: 16px; box-shadow: inset 0 2px 3px rgba(255,255,255,.4), 0 4px 0 var(--green-sh); }
.win-overlay.hidden { display: none; }

/* --- Moment festif (coffre, quête, cadeaux) : pictogramme qui pop + confettis - */
.reward-overlay { position: fixed; z-index: 60; background: rgba(43,35,64,.5); }
.reward-card { background: #FBF7FF; border-radius: var(--r-card); padding: 28px 30px; text-align: center;
  max-width: min(90vw, 360px); box-shadow: 0 24px 60px -20px rgba(80,50,120,.7); animation: win-pop .6s cubic-bezier(.18,1.5,.4,1) both; }
.reward-ic { font-size: 56px; line-height: 1; color: var(--gold-d); animation: trophy-jig .7s ease .15s both; }
.reward-card h3 { margin: 10px 0 2px; font-size: 1.4rem; font-weight: 800; }
.reward-card .reward-sub { margin: 0; color: var(--purple); font-weight: 700; }
.reward-card .win-back { margin-top: 18px; background: linear-gradient(180deg, var(--green), var(--green-d));
  color: #fff; font-weight: 800; padding: 13px 26px; border-radius: 16px;
  box-shadow: inset 0 2px 3px rgba(255,255,255,.4), 0 4px 0 var(--green-sh); }

/* --- Ouverture de coffre : tremblement -> explosion -> lot + aura de rareté -- */
.chest-open { --rarity: #7f8cff; }
.chest-open.r-common    { --rarity: #7f8cff; }
.chest-open.r-rare      { --rarity: var(--gold-d); }
.chest-open.r-epic      { --rarity: #a855f7; }
.chest-open.r-legendary { --rarity: #22c55e; }

.chest-stage { position: relative; width: 130px; height: 130px; margin: 2px auto 0; }
.chest-box { font-size: 92px; line-height: 130px; text-align: center; will-change: transform;
  animation: chest-shake .5s ease-in-out 2; }
.chest-open.popped .chest-box { animation: chest-burst .4s ease forwards; }

.loot { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; }
.chest-open.popped .loot { animation: loot-rise .55s cubic-bezier(.18,1.5,.4,1) .12s both; }
.loot-ic { position: relative; z-index: 1; font-size: 64px; line-height: 1;
  filter: drop-shadow(0 4px 12px var(--rarity)); }
.loot-ic svg { width: 64px; height: 64px; }
.loot-rays { position: absolute; width: 190px; height: 190px;
  background: repeating-conic-gradient(var(--rarity) 0deg 6deg, transparent 6deg 20deg);
  -webkit-mask: radial-gradient(circle, transparent 24px, #000 26px);
          mask: radial-gradient(circle, transparent 24px, #000 26px);
  opacity: .0; }
.chest-open.popped .loot-rays { opacity: .5; animation: rays-spin 9s linear infinite; }

.rarity-chip { display: inline-block; margin: 12px 0 0; padding: 3px 12px; border-radius: 999px;
  font-size: .78rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
  color: #fff; background: var(--rarity); box-shadow: 0 3px 10px -2px var(--rarity);
  opacity: 0; transform: scale(.6); }
.chest-open.popped .rarity-chip { animation: chip-pop .4s cubic-bezier(.18,1.5,.4,1) .3s both; }

@keyframes chest-shake {
  0%,100% { transform: rotate(0) translateY(0); }
  20% { transform: rotate(-8deg); } 40% { transform: rotate(7deg); }
  60% { transform: rotate(-6deg) translateY(-2px); } 80% { transform: rotate(5deg); }
}
@keyframes chest-burst {
  0% { transform: scale(1); } 40% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(.35); opacity: 0; }
}
@keyframes loot-rise {
  0% { transform: scale(.2) translateY(16px); opacity: 0; }
  60% { transform: scale(1.18) translateY(-4px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes rays-spin { to { transform: rotate(360deg); } }
@keyframes chip-pop { 0% { opacity: 0; transform: scale(.6); } 100% { opacity: 1; transform: scale(1); } }

/* Balayage Glouton : Croquy traverse le plateau en croquant. */
#stage { position: relative; }
.chomp { position: absolute; inset: 0; z-index: 15; pointer-events: none; overflow: hidden;
  animation: chomp-flash 1s ease both; }
.chomp-croc { position: absolute; top: 50%; left: -60px; font-size: 54px; line-height: 1;
  animation: chomp-run 1s cubic-bezier(.4,0,.6,1) both, chomp-bite .16s ease-in-out infinite; }
@keyframes chomp-run { from { left: -60px; } to { left: 100%; } }
@keyframes chomp-bite { 0%,100% { transform: translateY(-50%) rotate(-8deg) scaleX(1); } 50% { transform: translateY(-50%) rotate(6deg) scaleX(1.12); } }
@keyframes chomp-flash { 0%,100% { background: transparent; } 40% { background: rgba(132,204,22,.18); } }

/* Pastille « coffre à ouvrir » sur l'onglet Coffre. */
.tab.has-badge { position: relative; }
.tab.has-badge::after { content: ""; position: absolute; top: 4px; right: calc(50% - 18px);
  width: 9px; height: 9px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 0 2px #fff; }

/* --- Confettis (fin de jeu / numéro terminé) -------------------------------- */
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 20; }
.confetti i {
  position: absolute; top: -12px; left: var(--x);
  width: 10px; height: 14px; border-radius: 2px;
  animation: confetti-fall var(--dur, 1.4s) ease-in var(--delay, 0s) forwards;
}
@keyframes confetti-fall {
  0% { transform: translate(0, -10px) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx, 0), 105vh) rotate(var(--rot, 360deg)); opacity: .9; }
}
#celebration { position: relative; overflow: hidden; }

/* --- Paysage sur téléphone : on invite à revenir en portrait ----------------
 * Le seuil est la HAUTEUR (résolution) : < 500px = téléphone couché → illisible. */
.rotate-hint { display: none; }
@media (orientation: landscape) and (max-height: 500px) {
  .rotate-hint {
    display: flex; position: fixed; inset: 0; z-index: 100;
    flex-direction: column; align-items: center; justify-content: center; gap: 16px;
    background: linear-gradient(160deg, var(--purple), var(--pink));
    color: #fff; text-align: center; padding: 20px;
  }
  .rotate-hint .ic { width: 46px; height: 46px; animation: rotate-nudge 1.8s ease-in-out infinite; }
  .rotate-hint p { font-size: 1.15rem; font-weight: 800; line-height: 1.4; }
}
@keyframes rotate-nudge { 0%,15% { transform: rotate(-90deg); } 55%,100% { transform: rotate(0deg); } }

/* --- Écrans bas (téléphone en paysage) : tout se compacte -------------------- */
@media (max-height: 480px) {
  :root { --chrome-h: 235px; --cell-min: 11px; }
  .kb { gap: 3px; padding: 4px; }
  .kb-key { min-height: 0; height: 34px; font-size: .9rem; }
  .game-header { padding: 4px 10px; }
  .game-header .back { min-height: 36px; height: 36px; }
  .clue-bar { padding: 8px 12px; font-size: .9rem; margin-top: 2px; }
  .clue-bar .nav { min-width: 32px; min-height: 32px; }
  .board { padding: 6px 4px; }
  .game-header .hint-btn { height: 36px; min-height: 36px; padding: 0 12px; font-size: .9rem; }
  .game-header .glouton-btn { width: 36px; height: 36px; min-height: 36px; font-size: 1.1rem; }
}
