/* Jeu « devine le joueur ».

   Trois couleurs disent le verdict, et elles seules : vert exact, jaune « on chauffe », rouge
   à côté. L'identité du jeu est donc bleue : quand elle était rouge comme les cases fausses,
   bandeau, niveau, champ et grille criaient « faux » ensemble (HOUDAED, 27/10/2026 :
   « l'interface et les couleurs ne sont pas bien choisies »). Les cases sont pleines, texte
   blanc ou foncé, lisibles d'un coup d'œil sur tous les décors ; chacune porte en plus un
   symbole (✓ ~ ✕ ?) : rouge et vert sont la confusion de couleurs la plus répandue, et une
   grille lisible seulement par ceux qui les distinguent serait une grille ratée. */

:root {
  --jeu-marque: #2f5bea;
  --jeu-marque-vif: #5b3df0;
  --jeu-marque-fond: rgba(47, 91, 234, 0.12);
  --jeu-exact: #178a4b;
  --jeu-exact-fond: rgba(23, 138, 75, 0.14);
  --jeu-proche: #f2bf1d;
  --jeu-proche-texte: #2e2400;  /* sur une case jaune */
  --jeu-proche-encre: #8a6200;  /* du jaune écrit sur le fond de la page */
  --jeu-proche-fond: rgba(242, 191, 29, 0.18);
  --jeu-faux: #c23b45;
  --jeu-faux-fond: rgba(194, 59, 69, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --jeu-marque: #6b8cff;
    --jeu-marque-vif: #8a6cff;
    --jeu-marque-fond: rgba(107, 140, 255, 0.18);
    --jeu-exact: #1f9d57;
    --jeu-exact-fond: rgba(31, 157, 87, 0.2);
    --jeu-proche: #f5c83a;
    --jeu-proche-encre: #f5c83a;
    --jeu-proche-fond: rgba(245, 200, 58, 0.18);
    --jeu-faux: #cf4550;
    --jeu-faux-fond: rgba(207, 69, 80, 0.16);
  }
}

/* En jeu, la barre du haut passe au bleu nuit du stade : une barre claire au-dessus d'un
   stade de nuit faisait deux applications collées l'une à l'autre. */
body.en-jeu header {
  --text: #f2f5fb;
  --muted: #a7b2c8;
  --accent: #8fa6ff;
  --accent-wash: rgba(143, 166, 255, 0.16);
  --border-soft: rgba(255, 255, 255, 0.08);
  --jeu-marque: #a9baff;
  --jeu-marque-fond: rgba(143, 166, 255, 0.18);
  background: rgba(7, 12, 26, 0.94);
  color: var(--text);
}

/* ------------------------------------------------------------------ onglets */
.onglets { display: flex; gap: 4px; }
.onglet {
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13.5px;
  padding: 6px 14px;
}
.onglet:hover { color: var(--text); background: var(--accent-wash); }
.onglet.actif { color: var(--accent); background: var(--accent-wash); font-weight: 550; }

/* L'onglet du jeu porte sa couleur dès qu'il est actif : on sait où on est. */
#onglet-jeu.actif { color: var(--jeu-marque); background: var(--jeu-marque-fond); }
#onglet-jeu:hover { background: var(--jeu-marque-fond); color: var(--jeu-marque); }

.vue { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.vue[hidden] { display: none; }
/* Dans le jeu, un bloc caché l'est vraiment : la discussion du salon (display: flex) s'affichait en
   partie libre comme au joueur du jour (vu le 07/11/2026). */
#vue-jeu [hidden] { display: none !important; }

/* -------------------------------------------------------------------- écran */
.jeu {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 26px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Bandeau d'en-tête : la seule surface pleinement colorée de l'écran, hors des cases. */
.jeu-entete {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 20px 22px;
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse at 100% 0%, rgba(255, 255, 255, 0.18), transparent 55%),
    linear-gradient(135deg, var(--jeu-marque) 0%, var(--jeu-marque-vif) 100%);
  color: #fff;
  box-shadow: 0 10px 28px rgba(47, 91, 234, 0.3);
}
.jeu-titre h2 { margin: 0; font-size: 23px; font-weight: 650; letter-spacing: -0.02em; }
.jeu-titre p { margin: 5px 0 0; font-size: 13.5px; color: rgba(255, 255, 255, 0.85); }

.jeu-modes { display: flex; gap: 4px; }
.jeu-modes .onglet { color: rgba(255, 255, 255, 0.82); border-color: rgba(255, 255, 255, 0.28); }
.jeu-modes .onglet:hover { color: #fff; background: rgba(255, 255, 255, 0.14); }
.jeu-modes .onglet.actif { color: var(--jeu-marque-vif); background: #fff; font-weight: 600; border-color: #fff; }

/* ---------------------------------------------------------------- recherche */
.jeu-recherche { position: relative; }
#jeu-input {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 15px 17px;
  color: var(--text);
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#jeu-input:focus-visible {
  outline: none;
  border-color: var(--jeu-marque);
  box-shadow: 0 0 0 3px var(--jeu-marque-fond);
}
#jeu-input:disabled { opacity: 0.55; cursor: default; }
#jeu-input::placeholder { color: var(--muted); }

.jeu-restants { margin: 8px 2px 0; font-size: 12.5px; color: var(--muted); }
.jeu-restants strong { color: var(--jeu-marque); font-weight: 650; }

.suggestions {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px);
  list-style: none; margin: 0; padding: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 320px; overflow-y: auto;
}
.suggestion {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 14.5px;
}
.suggestion.survol { background: var(--jeu-marque-fond); color: var(--jeu-marque); }
.suggestion .portrait { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; object-fit: cover; background: var(--bubble-user); }

/* ------------------------------------------------------------------ grille */
/* Le tableau des propositions est opaque : la foule et la pelouse du décor passaient sous
   les cases et brouillaient la lecture. */
.jeu-grille-conteneur {
  overflow-x: auto;
  padding: 14px;
  border-radius: 18px;
  background: var(--panel-plein, var(--panel));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}
.jeu-legende, .jeu-ligne {
  display: grid;
  grid-template-columns: minmax(148px, 1.5fr) repeat(6, minmax(84px, 1fr));
  gap: 6px;
  min-width: 730px;
}
.jeu-legende {
  margin-bottom: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted);
}
.jeu-legende span { padding: 0 8px; }

.jeu-ligne { margin-bottom: 6px; }
.jeu-ligne:last-child { margin-bottom: 0; }
/* La dernière proposition se dévoile case par case, de gauche à droite, comme des tablettes
   qu'on retourne : le verdict se lit au rythme où il tombe. Une case juste rebondit une fois
   retournée ; quand c'est le bon joueur, toute la ligne saute, case après case. Le son de
   chaque case (jeu.js, sonnerLigne) suit le même écart de 140 ms. */
.jeu-ligne.nouvelle .cellule.joueur { animation: glisse 0.3s ease-out both; }
@keyframes glisse { from { opacity: 0; transform: translateX(-12px); } }
.jeu-ligne.nouvelle .cellule:not(.joueur) {
  animation: retourne 0.5s cubic-bezier(0.3, 0.7, 0.4, 1) both;
  animation-delay: calc(var(--i, 0) * 140ms + 200ms);
}
@keyframes retourne {
  0% { opacity: 0; transform: perspective(600px) rotateX(-95deg); }
  55% { opacity: 1; transform: perspective(600px) rotateX(14deg); }
  100% { opacity: 1; transform: none; }
}
.jeu-ligne.nouvelle .cellule.exact {
  animation: retourne 0.5s cubic-bezier(0.3, 0.7, 0.4, 1) both, rebond 0.35s ease-out both;
  animation-delay: calc(var(--i, 0) * 140ms + 200ms), calc(var(--i, 0) * 140ms + 700ms);
}
@keyframes rebond { 50% { transform: scale(1.08); } }
.jeu-ligne.trouvee.nouvelle .cellule:not(.joueur) {
  animation: retourne 0.5s cubic-bezier(0.3, 0.7, 0.4, 1) both, saute 0.5s ease-out both;
  animation-delay: calc(var(--i, 0) * 140ms + 200ms), calc(var(--i, 0) * 80ms + 1300ms);
}
@keyframes saute { 35% { transform: translateY(-16px); } 65% { transform: translateY(4px); } }
.jeu-ligne.trouvee .cellule:not(.joueur) { box-shadow: 0 0 0 2px var(--jeu-exact-fond), 0 6px 18px color-mix(in srgb, var(--jeu-exact) 40%, transparent); }

.cellule {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 56px; padding: 10px 7px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  font-size: 13px; text-align: center; line-height: 1.25;
}
.cellule > span { overflow: hidden; text-overflow: ellipsis; }

/* Le symbole porte le verdict aussi sûrement que la couleur. Il se loge dans le coin : au fil
   du texte, il coupait les mots (« Barcel… », « Attaqu… »). */
.cellule .marque { position: absolute; top: 3px; right: 6px; font-size: 10.5px; font-weight: 800; opacity: 0.85; }
.cellule.inconnu .marque { display: none; }

/* Des cases pleines, avec un liseré sombre en bas : des tablettes, pas des étiquettes. */
.cellule.exact, .cellule.proche, .cellule.faux { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2); }
.cellule.exact { background: var(--jeu-exact); color: #fff; font-weight: 650; }
.cellule.proche { background: var(--jeu-proche); color: var(--jeu-proche-texte); font-weight: 650; }
.cellule.faux { background: var(--jeu-faux); color: #fff; font-weight: 600; }
.cellule.inconnu {
  background: transparent;
  border-style: dashed; border-color: var(--border);
  color: var(--muted);
}

.cellule.joueur {
  justify-content: flex-start; gap: 10px;
  background: var(--panel); border-color: var(--border);
  color: var(--text);
}
.cellule.joueur .portrait {
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: 50%; object-fit: cover;
  background: var(--bubble-user);
  border: 1.5px solid var(--jeu-marque-fond);
}
/* Le nom passe sur deux lignes plutôt que d'être coupé (« Lamine Ya… »). */
.cellule.joueur .player-name {
  font-weight: 600; text-align: left; line-height: 1.15; white-space: normal;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.fleche { font-size: 10px; opacity: 0.95; }

/* ----------------------------------------------------------------- message */
.jeu-message {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 15px 17px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--panel);
  font-size: 15px;
}
.jeu-message.gagne {
  border-color: color-mix(in srgb, var(--jeu-exact) 55%, transparent);
  background: var(--jeu-exact-fond);
}
.jeu-message.perdu {
  border-color: color-mix(in srgb, var(--jeu-faux) 55%, transparent);
  background: var(--jeu-faux-fond);
}
.jeu-message.erreur { border-color: var(--jeu-faux); color: var(--jeu-faux); }
.jeu-message[hidden] { display: none; }

/* Le bouton Rejouer prend la couleur du jeu, pas celle de la discussion. */
.jeu-message .primary { background: var(--jeu-marque); color: #fff; }
.jeu-message .primary:hover { background: var(--jeu-marque-vif); }

.jeu-aide {
  margin: 4px 0 0; padding: 8px 12px; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  border-radius: 12px; background: var(--panel);
}
.pastille {
  width: 15px; height: 15px; border-radius: 4px;
  display: inline-grid; place-items: center;
  font-size: 9px; font-weight: 700; color: #fff;
}
.pastille.exact { background: var(--jeu-exact); }
.pastille.proche { background: var(--jeu-proche); }
.pastille.faux { background: var(--jeu-faux); }
.pastille.inconnu { background: none; border: 1.5px dashed var(--muted); color: var(--muted); }

body.en-jeu #status { display: none; }

/* ------------------------------------------------------------------ numéro */
.jeu-numero {
  display: inline-block; vertical-align: middle;
  margin-left: 6px; padding: 2px 9px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.2);
  font-size: 13px; font-weight: 600; letter-spacing: 0;
}
.jeu-numero[hidden] { display: none; }

/* ------------------------------------------------------------------ profil */
.jeu-profil {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.jeu-rang { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.jeu-rang-icone {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  border-radius: 50%; background: var(--jeu-marque-fond);
  font-size: 19px;
}
.jeu-rang-texte { display: flex; flex-direction: column; line-height: 1.2; }
.jeu-rang-texte strong { font-size: 14.5px; }
.jeu-rang-texte span { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.jeu-progression { flex: 1 1 160px; display: flex; flex-direction: column; gap: 4px; }
.jeu-progression small { font-size: 11.5px; color: var(--muted); }
.jeu-jauge {
  height: 8px; border-radius: 999px; overflow: hidden;
  background: var(--border-soft);
}
.jeu-jauge > div {
  height: 100%; width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--jeu-marque) 0%, var(--jeu-proche) 100%);
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.jeu-jauge.grande { height: 10px; margin-top: 10px; }
.jeu-serie {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 11px; border-radius: 999px;
  background: var(--jeu-proche-fond); color: var(--jeu-proche-encre);
  font-size: 13px; white-space: nowrap;
}
.jeu-serie strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.jeu-serie.eteinte { background: var(--border-soft); color: var(--muted); }
.jeu-serie.eteinte span { filter: grayscale(1); opacity: 0.6; }
.jeu-bouton-stats {
  border-radius: 999px; padding: 7px 13px; font-size: 13px;
  border: 1px solid var(--border); background: none; color: var(--text);
}
.jeu-bouton-stats:hover { border-color: var(--jeu-marque); color: var(--jeu-marque); }

/* ------------------------------------------------------------------ niveaux */
.jeu-niveaux { display: flex; gap: 6px; flex-wrap: wrap; }
.jeu-niveaux[hidden] { display: none; }
.jeu-niveaux button {
  border-radius: 999px; padding: 6px 14px; font-size: 13.5px;
  border: 1.5px solid var(--border); background: var(--panel); color: var(--muted);
}
.jeu-niveaux button small { opacity: 0.75; margin-left: 2px; }
.jeu-niveaux button:hover { color: var(--text); border-color: var(--jeu-marque); }
.jeu-niveaux button.actif { color: #fff; background: var(--jeu-marque); border-color: var(--jeu-marque); font-weight: 600; }

/* -------------------------------------------------------------- sous le champ */
.jeu-sous-recherche { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.jeu-sous-recherche .jeu-restants { margin: 0; }
.jeu-en-jeu { margin: 0; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.jeu-en-jeu strong { color: var(--jeu-exact); }
.jeu-bouton-indice {
  margin-left: auto;
  border-radius: 999px; padding: 6px 13px; font-size: 13px;
  border: 1.5px dashed var(--jeu-proche-encre); background: none; color: var(--jeu-proche-encre);
}
.jeu-bouton-indice:hover:not(:disabled) { background: var(--jeu-proche-fond); }
.jeu-bouton-indice:disabled { opacity: 0.45; cursor: default; border-style: solid; }
.jeu-bouton-indice[hidden] { display: none; }

.jeu-indices { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.jeu-indices[hidden] { display: none; }
.jeu-indices li {
  display: flex; flex-direction: column; gap: 1px;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  background: var(--jeu-proche-fond);
  border: 1px solid color-mix(in srgb, var(--jeu-proche) 40%, transparent);
  font-size: 13.5px;
}
.jeu-indices li span { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.jeu-indices li strong { color: var(--text); }
.jeu-indices li.nouveau { animation: retourne 0.45s ease-out both; }

#jeu-input.secoue { animation: secoue 0.35s ease-in-out; }
@keyframes secoue {
  0%, 100% { transform: none; }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.jeu-message .secondaire { background: none; border: 1.5px solid currentColor; color: var(--text); border-radius: var(--radius-sm); }
.jeu-message .secondaire:hover { border-color: var(--jeu-marque); color: var(--jeu-marque); }
.jeu-message span { flex: 1 1 auto; }

/* ------------------------------------------------------------------ fenêtre */
.jeu-fenetre {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(20, 18, 16, 0.55);
  backdrop-filter: blur(3px);
  animation: fondu 0.2s ease-out;
}
.jeu-fenetre[hidden] { display: none; }
@keyframes fondu { from { opacity: 0; } }
body.fenetre-ouverte { overflow: hidden; }
/* Le jeu forme sa propre pile d'affichage (isolation) : sa fenêtre, si haut que soit son z-index,
   restait sous l'en-tête du site, qui cachait la croix des statistiques (29/10/2026). Fenêtre
   ouverte, tout le jeu passe devant l'en-tête. */
body.fenetre-ouverte #vue-jeu { z-index: 6; }
.jeu-fenetre-carte {
  position: relative;
  width: min(460px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);   /* sans la barre d'adresse du téléphone, là où on le sait */
  /* C'est le contenu qui défile, pas la carte : la croix reste en haut, à portée du doigt. */
  display: flex; flex-direction: column; overflow: hidden;
  padding: 26px 24px 22px;
  background: var(--panel); color: var(--text);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: monte 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes monte { from { opacity: 0; transform: translateY(18px) scale(0.97); } }
#jeu-fenetre-contenu { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.jeu-fermer {
  position: absolute; top: 12px; right: 12px; z-index: 1;
  width: 32px; height: 32px; padding: 0;
  border-radius: 50%; border: none; background: var(--border-soft); color: var(--muted);
}
.jeu-fermer:hover { color: var(--text); }

.fenetre-titre { margin: 0; font-size: 24px; letter-spacing: -0.02em; text-align: center; }
.fenetre-sous-titre { margin: 4px 0 16px; text-align: center; color: var(--muted); font-size: 14px; }
.fenetre-intertitre { margin: 20px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.fenetre-note { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }

.fenetre-solution {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1.5px solid color-mix(in srgb, var(--jeu-faux) 45%, transparent);
  background: var(--jeu-faux-fond);
}
.fenetre-solution.gagne { border-color: color-mix(in srgb, var(--jeu-exact) 50%, transparent); background: var(--jeu-exact-fond); }
.fenetre-solution > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fenetre-solution strong { font-size: 17px; }
.fenetre-photo { width: 56px; height: 56px; flex: 0 0 56px; border-radius: 50%; object-fit: cover; background: var(--bubble-user); }
.fenetre-club { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.fenetre-logo { width: 18px; height: 18px; object-fit: contain; }

.fenetre-score { display: flex; flex-direction: column; align-items: center; margin: 18px 0 6px; }
.fenetre-points {
  font-size: 46px; line-height: 1; font-weight: 750; letter-spacing: -0.03em;
  color: var(--jeu-exact); font-variant-numeric: tabular-nums;
}
.fenetre-score span { font-size: 13px; color: var(--muted); }
.fenetre-score small { margin-top: 4px; font-size: 12px; color: var(--muted); }

.fenetre-annonce {
  margin: 10px 0 0; padding: 8px 12px;
  text-align: center; font-weight: 650;
  border-radius: var(--radius-sm);
  background: var(--jeu-proche-fond); color: var(--jeu-proche-encre);
  animation: monte 0.5s 0.6s both;
}
.fenetre-rang { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.fenetre-rang-icone {
  width: 42px; height: 42px; flex: 0 0 42px;
  display: grid; place-items: center;
  border-radius: 50%; background: var(--jeu-marque-fond); font-size: 21px;
}
.fenetre-rang div { display: flex; flex-direction: column; }
.fenetre-rang span { font-size: 12.5px; color: var(--muted); }
.fenetre-serie { margin: 14px 0 0; text-align: center; font-weight: 600; color: var(--jeu-proche-encre); }

.fenetre-trophees { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; }
.fenetre-trophees .fenetre-note { width: 100%; margin: 0; }
.trophee-gagne {
  padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--jeu-exact-fond); color: var(--jeu-exact);
  animation: monte 0.5s 0.9s both;
}

.fenetre-jour {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  margin-top: 14px; padding: 10px;
  border-radius: var(--radius-sm); background: var(--border-soft);
  font-size: 12.5px; color: var(--muted); text-align: center;
}
.fenetre-jour strong { color: var(--text); font-size: 13.5px; }

.fenetre-actions { display: flex; gap: 8px; margin-top: 18px; }
.fenetre-actions button { flex: 1; padding: 11px 12px; border-radius: var(--radius-sm); font-weight: 600; }
.fenetre-actions .primary { background: var(--jeu-marque); color: #fff; border: none; }
.fenetre-actions .primary:hover { background: var(--jeu-marque-vif); }
.fenetre-actions .secondaire { background: none; border: 1.5px solid var(--border); color: var(--text); }
.fenetre-actions .secondaire:hover { border-color: var(--jeu-marque); color: var(--jeu-marque); }
.fenetre-minuteur { margin: 12px 0 0; text-align: center; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.fenetre-chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.fenetre-chiffres div {
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 4px; border-radius: var(--radius-sm); background: var(--border-soft);
}
.fenetre-chiffres strong { font-size: 21px; font-variant-numeric: tabular-nums; }
.fenetre-chiffres span { font-size: 11px; color: var(--muted); text-align: center; }

.fenetre-repartition { display: flex; flex-direction: column; gap: 4px; }
.repartition-ligne { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.repartition-ligne > span { width: 14px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.repartition-barre {
  padding: 2px 7px; border-radius: 4px; text-align: right;
  background: var(--jeu-exact); color: #fff; font-weight: 600; font-size: 12px;
}
.repartition-barre.perdu { background: var(--jeu-faux); }

.fenetre-vitrine { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.trophee {
  display: grid; grid-template-columns: auto 1fr; column-gap: 9px; align-items: center;
  padding: 9px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); opacity: 0.55;
}
.trophee.obtenu { opacity: 1; border-color: color-mix(in srgb, var(--jeu-exact) 45%, transparent); background: var(--jeu-exact-fond); }
.trophee-icone { grid-row: span 2; font-size: 21px; }
.trophee strong { font-size: 13px; }
.trophee small { font-size: 11px; color: var(--muted); }

/* ---------------------------------------------------------------- en groupe */
.jeu-salon { display: flex; flex-direction: column; gap: 12px; }
.jeu-salon[hidden], .jeu-profil[hidden] { display: none; }

.salon-accueil { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
/* Ni collée en bas d'écran par la règle « form » du chat : sur un petit téléphone, la carte
   « Rejoindre » glissait sur « Créer » et cachait son bouton (320 px, 29/10/2026). */
.salon-carte {
  position: static;
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.salon-carte h3 { margin: 0; font-size: 17px; }
.salon-carte p { margin: 0; font-size: 13px; color: var(--muted); }
.salon-carte .primary { background: var(--jeu-marque); color: #fff; border: none; padding: 10px; border-radius: var(--radius-sm); font-weight: 600; margin-top: auto; }
.salon-carte .primary:hover { background: var(--jeu-marque-vif); }
.salon-champ { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.salon-champ input {
  font: inherit; font-size: 15px; color: var(--text);
  padding: 10px 12px;
  background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
}
.salon-champ input:focus-visible { outline: none; border-color: var(--jeu-marque); box-shadow: 0 0 0 3px var(--jeu-marque-fond); }
.salon-code-saisie { text-transform: uppercase; letter-spacing: 0.3em; font-weight: 700; }

.salon-tete { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.salon-code { display: flex; align-items: baseline; gap: 8px; }
.salon-code span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.salon-code strong { font-size: 24px; letter-spacing: 0.18em; color: var(--jeu-marque); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.salon-manche { padding: 3px 10px; border-radius: 999px; background: var(--border-soft); font-size: 12.5px; color: var(--muted); }
.salon-inviter, .salon-quitter { border-radius: 999px; padding: 6px 13px; font-size: 13px; border: 1px solid var(--border); background: var(--panel); color: var(--text); }
.salon-inviter { margin-left: auto; border-color: var(--jeu-marque); color: var(--jeu-marque); }
.salon-inviter:hover { background: var(--jeu-marque-fond); }
.salon-quitter:hover { color: var(--jeu-marque); }
.salon-fermer { border-color: color-mix(in srgb, var(--jeu-faux) 55%, transparent); color: var(--jeu-faux); }
.salon-fermer:hover { background: var(--jeu-faux-fond); color: var(--jeu-faux); }

.salon-joueurs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.salon-joueur {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px;
  background: var(--panel); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
}
.salon-joueur.moi { border-color: color-mix(in srgb, var(--jeu-marque) 45%, transparent); }
.salon-joueur.choisit { background: var(--jeu-proche-fond); border-color: color-mix(in srgb, var(--jeu-proche) 50%, transparent); }
.salon-joueur.trouve { background: var(--jeu-exact-fond); border-color: color-mix(in srgb, var(--jeu-exact) 55%, transparent); }
.salon-joueur.absent { opacity: 0.5; }
.salon-nom { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.salon-nom strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.salon-points { font-size: 13px; font-weight: 700; color: var(--jeu-marque); font-variant-numeric: tabular-nums; white-space: nowrap; }
.salon-joueur small { font-size: 12px; color: var(--muted); }
.salon-cases { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.salon-cases div { display: flex; gap: 2px; }
.salon-cases i { width: 10px; height: 10px; border-radius: 2px; background: var(--jeu-faux); }
.salon-cases i.case-exact { background: var(--jeu-exact); }
.salon-cases i.case-proche { background: var(--jeu-proche); }
.salon-cases i.case-inconnu { background: var(--border); }

.salon-bandeau {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--panel);
  font-size: 14.5px;
}
.salon-bandeau p { margin: 0; }
.salon-bandeau .fenetre-solution { width: 100%; }
.salon-bandeau.gagne { border-color: color-mix(in srgb, var(--jeu-exact) 55%, transparent); background: var(--jeu-exact-fond); }
.salon-bandeau.perdu { border-color: color-mix(in srgb, var(--jeu-faux) 45%, transparent); background: var(--jeu-faux-fond); }
.salon-resultat { font-size: 16px; font-weight: 650; }
.salon-bandeau .primary { background: var(--jeu-marque); color: #fff; border: none; padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 600; }
.salon-bandeau .primary:hover { background: var(--jeu-marque-vif); }
.salon-bandeau .secondaire { background: none; border: 1.5px solid var(--border); color: var(--text); padding: 8px 14px; border-radius: var(--radius-sm); }

/* Réglages de la partie (minuteur, nombre de manches), le compte à rebours, le podium. */
.salon-reglages { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; color: var(--muted); }
.salon-reglage { display: flex; align-items: center; gap: 6px; }
.salon-reglage select {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 10px;
}
.salon-reglage select:focus-visible { outline: none; border-color: var(--jeu-marque); box-shadow: 0 0 0 3px var(--jeu-marque-fond); }
.salon-nombre {
  width: 3.4em; font: inherit; text-align: center; color: var(--text); background: var(--panel);
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 8px;
}
.salon-nombre:focus-visible { outline: none; border-color: var(--jeu-marque); box-shadow: 0 0 0 3px var(--jeu-marque-fond); }
.salon-valider {
  border-radius: 999px; padding: 5px 12px; font: inherit; font-weight: 600;
  border: none; background: var(--jeu-marque); color: #fff;
}
.salon-valider:hover { background: var(--jeu-marque-vif); }
.salon-minuteur {
  font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--jeu-marque); letter-spacing: 0.02em;
}
.salon-minuteur.urgent { color: var(--jeu-faux); animation: salon-pouls 1s ease-in-out infinite; }
@keyframes salon-pouls { 50% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .salon-minuteur.urgent { animation: none; } }
.salon-podium { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 6px; }
.salon-podium li {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-radius: var(--radius-sm); background: var(--panel); border: 1px solid var(--border);
}
.salon-podium li.moi { border-color: var(--jeu-marque); }
.salon-podium li strong { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.salon-podium-rang { font-size: 20px; width: 28px; text-align: center; }
.salon-podium li small, .salon-classement li small { color: var(--muted); font-size: 12px; }
.salon-bloc-classement { border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--panel); padding: 8px 12px; }
.salon-bloc-classement summary { cursor: pointer; font-weight: 650; font-size: 14px; }
.salon-classement { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.salon-classement li { display: flex; align-items: baseline; gap: 8px; }
.salon-classement li.moi strong { color: var(--jeu-marque); }
.salon-classement li strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.salon-classement .salon-podium-rang { font-size: 16px; width: 24px; }

/* La discussion du salon. */
.salon-discussion {
  display: flex; flex-direction: column; gap: 8px; margin-top: 14px;
  padding: 12px 14px; border-radius: var(--radius); border: 1.5px solid var(--border); background: var(--panel);
}
.salon-discussion h3 { margin: 0; font-size: 15px; }
.salon-messages {
  list-style: none; margin: 0; padding: 2px 2px 4px; display: flex; flex-direction: column; gap: 6px;
  max-height: 300px; overflow-y: auto; overscroll-behavior: contain; font-size: 14px;
}
/* Comme sur une messagerie : à droite ce que j'écris, à gauche les autres, au centre le jeu. */
.salon-message { display: flex; line-height: 1.35; overflow-wrap: anywhere; }
.salon-message.moi { justify-content: flex-end; }
.salon-message.autre { justify-content: flex-start; }
.salon-message.suite { margin-top: -2px; }
.salon-message .bulle {
  max-width: 78%; display: flex; flex-direction: column; gap: 1px;
  padding: 6px 11px 4px; border-radius: 16px;
  background: color-mix(in srgb, var(--text) 9%, var(--panel)); color: var(--text);
}
.salon-message.autre .bulle { border-bottom-left-radius: 4px; }
.salon-message.moi .bulle { background: var(--jeu-marque); color: #fff; border-bottom-right-radius: 4px; }
.salon-message .bulle strong { font-size: 12px; font-weight: 700; }
.salon-message .bulle time {
  align-self: flex-end; font-size: 10.5px; opacity: 0.7; font-variant-numeric: tabular-nums; margin-top: 1px;
}
.salon-message.systeme { justify-content: center; }
.salon-message.systeme span {
  max-width: 90%; text-align: center; font-size: 12px; font-style: italic; color: var(--muted);
  background: color-mix(in srgb, var(--text) 5%, transparent); padding: 3px 10px; border-radius: 999px;
}
/* La règle générale « form » de app.css colle le formulaire du chat en bas de l'écran : ici, il
   reste sous les messages. */
.salon-ecrire { display: flex; gap: 8px; position: static; padding: 0; margin: 0; max-width: none; background: none; }
.salon-ecrire input {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--text); background: var(--bg, var(--panel));
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px;
}
.salon-ecrire input:focus-visible { outline: none; border-color: var(--jeu-marque); box-shadow: 0 0 0 3px var(--jeu-marque-fond); }
.salon-ecrire .primary { background: var(--jeu-marque); color: #fff; border: none; padding: 9px 14px; border-radius: var(--radius-sm); font-weight: 600; }
.salon-ecrire .primary:hover { background: var(--jeu-marque-vif); }
.salon-ecrire .primary:disabled { opacity: 0.6; }
.salon-bandeau .secondaire:hover { border-color: var(--jeu-marque); color: var(--jeu-marque); }

/* ---------------------------------------------------------------- confettis */
.confettis { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
.confettis i {
  position: absolute; top: -14px;
  width: 8px; height: 13px; border-radius: 2px;
  animation-name: tombe; animation-timing-function: cubic-bezier(0.3, 0.6, 0.6, 1); animation-fill-mode: forwards;
}
@keyframes tombe { to { transform: translate(var(--derive), 108vh) rotate(var(--tour)); } }

/* Les animations sont un agrément, pas une information. */
@media (prefers-reduced-motion: reduce) {
  .jeu-ligne.nouvelle .cellule, .jeu-ligne.nouvelle .cellule.exact, .jeu-ligne.trouvee.nouvelle .cellule:not(.joueur),
  .jeu-indices li.nouveau, #jeu-input.secoue,
  .jeu-fenetre, .jeu-fenetre-carte, .fenetre-annonce, .trophee-gagne { animation: none; }
  .jeu-jauge > div { transition: none; }
}

@media (max-width: 620px) {
  .jeu { padding: 16px 16px 32px; gap: 14px; }
  .jeu-entete { padding: 16px 17px; }
  .jeu-titre h2 { font-size: 19px; }
  .onglets { order: 3; width: 100%; justify-content: center; }
  .onglets .onglet { white-space: nowrap; padding: 6px 11px; }
  #vue-jeu .jeu-titre h2 { font-size: 20px; }
  .jeu-titre p { font-size: 12.5px; }
  /* Sept colonnes ne tiennent pas sur 390 px : la grille débordait, on n'en voyait que trois.
     Chaque proposition devient une carte, le joueur en haut et ses six cases sur deux
     rangées ; la légende des colonnes passe dans chaque case. */
  .jeu-grille-conteneur { overflow: visible; padding: 10px; }
  .jeu-legende { display: none; }
  .jeu-ligne { grid-template-columns: repeat(3, minmax(0, 1fr)); min-width: 0; gap: 5px;
               margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border-soft); }
  .jeu-ligne:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
  .cellule.joueur { grid-column: 1 / -1; min-height: 0; padding: 2px 2px 4px; background: none; border-color: transparent; }
  .cellule:not(.joueur) { flex-direction: column; gap: 2px; min-height: 54px; padding: 6px 4px; font-size: 12.5px; }
  .cellule[data-libelle]::before {
    content: attr(data-libelle);
    font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.8;
  }
  .cellule .marque { right: 5px; font-size: 10px; }
  .cellule .valeur { max-width: 100%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .cellule.joueur .portrait { width: 30px; height: 30px; flex-basis: 30px; }
  .jeu-profil { gap: 10px; padding: 10px 12px; }
  .jeu-progression { order: 5; flex-basis: 100%; }
  .jeu-bouton-stats { margin-left: auto; }
  .jeu-bouton-indice { margin-left: 0; }
  .jeu-fenetre-carte { padding: 22px 16px 18px; }
  .fenetre-points { font-size: 40px; }
  .fenetre-vitrine { grid-template-columns: 1fr; }
  .salon-accueil { grid-template-columns: 1fr; }
  .salon-inviter { margin-left: 0; }
  .jeu-modes { flex-wrap: wrap; }
}

/* Sous 16 px, l'iPhone zoome sur le champ touché et la page reste agrandie : même jeu, mêmes
   champs, mais lisibles sans zoom sur tous les écrans tactiles (29/10/2026). */
@media (pointer: coarse), (max-width: 620px) {
  #vue-jeu input, #vue-jeu select, #vue-jeu textarea { font-size: 16px; }
}

.jeu-mentions { text-align: center; font-size: 12px; margin: 18px 0 4px; opacity: 0.75; }
.jeu-mentions a { color: inherit; }
