/*
 * Bubble Shooter : pages où l'on joue (classique, contre la montre, défi du
 * jour, entraînement, duels) et zone de jeu.
 *
 * Contraintes du réseau :
 *   - #app reste à 800 px : au-delà, les blocs latéraux fixes des autres pages
 *     recouvriraient le contenu dès 1280 px.
 *   - padding horizontal de #app jamais sous 24 px : le banner partagé sort
 *     du conteneur avec des marges négatives calées sur cette valeur.
 *
 * Pendant une partie (.bs-jeu.visible), la zone de jeu occupe toute la
 * fenêtre, au-dessus de la barre de compte : le plateau se cale sur la
 * hauteur disponible et rien ne le recouvre, sur tous les écrans.
 */

* { box-sizing: border-box; }

body.page-bubble-shooter {
  margin: 0;
  background: radial-gradient(120% 80% at 50% 0%, #10243a 0%, #0f1722 55%, #0e1014 100%);
  color: #e6edf5;
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

.page-bubble-shooter #app {
  max-width: 800px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.page-bubble-shooter h1 { font-size: 1.6rem; color: #6ee7b7; margin: 8px 0 12px; text-align: center; }
.page-bubble-shooter h2 { font-size: 1.1rem; color: #67e8f9; margin: 20px 0 8px; }
.page-bubble-shooter #app a { color: #7dd3fc; }
.page-bubble-shooter footer { text-align: center; font-size: 0.82rem; color: #94a3b8; margin-top: 30px; line-height: 1.7; }
.page-bubble-shooter #app footer a { color: #cbd5e1; }

.setup-intro {
  color: #cbd5e1;
  line-height: 1.6;
  font-size: 0.95rem;
  text-align: center;
  margin: 0 auto 18px;
  max-width: 62ch;
}
.message-partie { min-height: 1.2em; text-align: center; color: #fde68a; font-size: 0.92rem; margin: 10px 0; }
.date-titre { text-align: center; color: #6ee7b7; margin: 0 0 16px; font-weight: 600; }
.liens-modes { text-align: center; margin: 22px 0 6px; line-height: 1.9; font-size: 0.93rem; }
.bs-etat { text-align: center; font-size: 1rem; margin: 6px 0; line-height: 1.5; }
.bs-etat strong { color: #fde68a; }
.bs-pseudo-visiteur { text-align: center; color: #94a3b8; font-size: 0.85rem; margin: 0 0 12px; }

.bs-regles { margin: 16px auto; padding: 0 0 0 20px; max-width: 60ch; line-height: 1.6; color: #cbd5e1; font-size: 0.95rem; }
.bs-regles li { margin: 5px 0; }
.bs-texte { line-height: 1.65; color: #cbd5e1; font-size: 0.96rem; }
.bs-texte strong { color: #e6edf5; }

/* ---- Tableaux (malus du duel) ---------------------------------------------- */
.bs-tableau-cadre { overflow-x: auto; margin: 12px 0; }
.bs-tableau { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.bs-tableau th, .bs-tableau td { padding: 9px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); text-align: left; vertical-align: top; }
.bs-tableau th { color: #67e8f9; font-weight: 700; white-space: nowrap; }
.bs-tableau td { color: #cbd5e1; }

/* ---- Boutons ------------------------------------------------------------- */
.bs-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 12px 0 0; }
.bs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 20px;
  border: 0;
  border-radius: 12px;
  background: #0891b2;
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}
.page-bubble-shooter #app a.bs-btn, .bs-jeu a.bs-btn { color: #fff; }
.bs-btn.secondaire { background: rgba(255, 255, 255, 0.12); }
.bs-btn-grand { min-height: 56px; padding: 12px 34px; font-size: 1.15rem; }
.bs-btn:focus-visible { outline: 3px solid #fde68a; outline-offset: 2px; }
.bs-btn[hidden] { display: none; }
.bs-btn:disabled { opacity: 0.55; cursor: default; }

/* ---- Statistiques personnelles --------------------------------------------- */
#mes-stats[hidden] { display: none; }
.bs-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 10px 0 0; }
.bs-stats div { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.07); }
.bs-stats dt { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; color: #94a3b8; }
.bs-stats dd { margin: 3px 0 0; font-weight: 800; color: #fde68a; font-variant-numeric: tabular-nums; }

/* ---- Choix du niveau de l'ordinateur, salon du duel ------------------------- */
.bs-difficultes { display: grid; gap: 12px; max-width: 460px; margin: 14px auto; }
.bs-difficulte {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 14px 18px; border-radius: 14px; border: 0; color: #fff; font: inherit; cursor: pointer;
}
.bs-difficulte strong { font-size: 1.05rem; }
.bs-difficulte span { font-size: 0.85rem; opacity: 0.92; }
.bs-difficulte.facile { background: linear-gradient(135deg, #059669, #10b981); }
.bs-difficulte.normal { background: linear-gradient(135deg, #0891b2, #0e7490); }
.bs-difficulte.difficile { background: linear-gradient(135deg, #7c3aed, #5b21b6); }
.bs-difficulte:focus-visible { outline: 3px solid #fde68a; outline-offset: 2px; }

.bs-salon { max-width: 460px; margin: 0 auto; padding: 18px; border-radius: 16px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); text-align: center; }
.bs-salon-statut { min-height: 1.5em; margin: 0 0 12px; line-height: 1.5; font-weight: 600; }
/* minmax(0, 1fr) : sans lui la colonne prend la largeur naturelle du champ et déborde sur téléphone. */
.bs-salon-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.bs-salon-actions[hidden], .bs-salon-prive[hidden] { display: none; }
.bs-salon-code { display: flex; gap: 8px; }
.bs-salon-code input {
  flex: 1 1 0; min-width: 0; width: 100%; text-align: center; text-transform: uppercase; letter-spacing: 0.2em;
  font: inherit; font-weight: 800; font-size: 1.05rem; padding: 10px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(0, 0, 0, 0.3); color: #fde68a;
}
.bs-salon-code .bs-btn { flex: 1 1 0; min-width: 0; background: #059669; }
.bs-salon-prive { margin: 6px 0 12px; }
.bs-code { display: inline-block; font-size: 2rem; font-weight: 900; letter-spacing: 0.25em; color: #fde68a; background: rgba(251, 191, 36, 0.12); padding: 8px 18px 8px 24px; border-radius: 12px; }

/* Encadré explicatif du défi et cadre du classement du jour (convention des pages de défi) */
.defi-intro {
  margin: 18px 0; padding: 14px 18px; border-radius: 14px;
  background: rgba(6, 182, 212, 0.07); border: 1px solid rgba(255, 255, 255, 0.08);
  line-height: 1.55; font-size: 0.95rem;
}
.defi-intro h2 { margin-top: 0; }
.defi-intro ul { padding-left: 20px; margin: 8px 0 0; }
.defi-intro li { margin: 4px 0; }
.defi-compte { text-align: center; margin: 14px 0 20px; line-height: 1.5; }
.classement-section {
  max-width: 800px; margin: 24px auto 10px; padding: 16px 18px;
  background: rgba(148, 163, 184, 0.09); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.classement-section[hidden] { display: none; }
.classement-section h3 { margin: 0 0 10px; text-align: center; color: #6ee7b7; }
.classement-invite, .classement-lien { text-align: center; font-size: 0.9rem; margin: 10px 0 0; }

/* ========================================================================== */
/* Zone de jeu                                                                */

.bs-jeu { display: none; }
body.bs-en-partie { overflow: hidden; }
.bs-jeu.visible {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  z-index: 2000;               /* au-dessus de la barre de compte (1000), sous les annonces du site */
  background: #0b0f17;
  color: #e6edf5;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.bs-hud {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 54px;
  padding: max(4px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 4px max(12px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.bs-stat { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.bs-stat[hidden] { display: none; }
.bs-lib { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; white-space: nowrap; }
.bs-stat strong { font-size: 1.08rem; color: #fde68a; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bs-outils { display: flex; gap: 6px; flex: none; margin-left: auto; }
.bs-outils button {
  width: 44px; height: 44px; padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 12px;
  background: rgba(255, 255, 255, 0.06); color: #fff; font-size: 19px; line-height: 1; cursor: pointer;
}
.bs-outils button[hidden] { display: none; }
.bs-outils button[aria-pressed="true"]#btn-motifs { background: rgba(103, 232, 249, 0.25); border-color: #67e8f9; }
.bs-outils button:focus-visible, .bs-btn-outil:focus-visible { outline: 3px solid #fde68a; outline-offset: 2px; }

/* Le plateau : centré, calé en hauteur par le script. */
.bs-zone {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}
.bs-jeu canvas {
  display: block;
  border-radius: 10px;
  background: #0f172a;
  touch-action: none;
  cursor: crosshair;
  outline: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.bs-barre {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 4px 10px max(8px, env(safe-area-inset-bottom));
}
.bs-btn-outil {
  min-height: 44px; padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 12px;
  background: rgba(255, 255, 255, 0.07); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
}
.bs-btn-outil:disabled { opacity: 0.4; cursor: default; }
.bs-btn-outil kbd, .bs-commandes kbd {
  display: inline-block; min-width: 1.5em; padding: 1px 5px; border-radius: 5px; border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08); font: inherit; font-size: 0.8em; text-align: center;
}
.bs-jeu.mode-tactile .bs-btn-outil kbd { display: none; }
.bs-rangee, .bs-serie { font-size: 0.86rem; font-weight: 600; color: #94a3b8; font-variant-numeric: tabular-nums; }
.bs-rangee.proche { color: #fca5a5; }

/* Annonce au milieu du plateau (palier, malus) : elle ne prend jamais le clic. */
.bs-annonce {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%);
  max-width: 88%; margin: 0; padding: 10px 18px; border-radius: 12px;
  background: rgba(15, 23, 42, 0.92); border: 1px solid rgba(103, 232, 249, 0.6); color: #e0f2fe;
  font-weight: 800; text-align: center; pointer-events: none; z-index: 2;
}
.bs-annonce.malus { border-color: #f87171; color: #fecaca; }
.bs-annonce.envoi { border-color: #4ade80; color: #bbf7d0; }
.bs-annonce[hidden] { display: none; }
.bs-annonce-adv { font-size: 0.75rem; padding: 4px 8px; top: 50%; }

/* Consigne de la première partie : sous le plateau, sans rien cacher. */
.bs-tuto {
  flex: none; margin: 0 auto 8px; padding: 8px 14px; max-width: min(520px, 94vw);
  border-radius: 12px; background: rgba(103, 232, 249, 0.12); border: 1px solid rgba(103, 232, 249, 0.4);
  color: #e0f2fe; font-size: 0.9rem; line-height: 1.45; text-align: center;
}
.bs-tuto[hidden] { display: none; }

.bs-revoir {
  position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); z-index: 4;
  min-height: 44px; padding: 8px 18px; border: 0; border-radius: 12px;
  background: linear-gradient(135deg, #06b6d4, #0891b2); color: #fff; font: inherit; font-weight: 800; cursor: pointer;
}
.bs-revoir[hidden] { display: none; }

/* ---- Écrans par-dessus le plateau (pause, fin, décompte) ---------------------- */
.bs-voile {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  padding: 14px; background: rgba(5, 8, 14, 0.74); overflow: auto;
}
.bs-voile[hidden] { display: none; }
.bs-carte {
  position: relative; width: min(440px, 100%); max-height: 100%; overflow: auto;
  padding: 26px 20px 20px; border-radius: 16px; text-align: center;
  background: #131c2b; border: 1px solid rgba(255, 255, 255, 0.14);
  -webkit-user-select: text; user-select: text;
}
.bs-carte h2 { margin: 0 0 8px; font-size: 1.5rem; color: #e6edf5; }
.bs-fin-titre.gagne { color: #6ee7b7; }
.bs-fin-titre.perdu { color: #fca5a5; }
.bs-fermer {
  position: absolute; top: 4px; right: 6px; width: 44px; height: 44px;
  border: 0; background: none; color: #cbd5e1; font-size: 1.7rem; line-height: 1; cursor: pointer; border-radius: 10px;
}
.bs-fermer:hover, .bs-fermer:focus-visible { background: rgba(255, 255, 255, 0.1); outline: none; }
.bs-note { color: #94a3b8; font-size: 0.9rem; line-height: 1.5; margin: 6px 0; }
.bs-commandes { color: #cbd5e1; font-size: 0.9rem; line-height: 1.6; margin: 10px 0; }
.bs-tactile-seul { display: none; }
.bs-jeu.mode-tactile .bs-tactile-seul { display: block; }
.bs-jeu.mode-tactile .bs-clavier-seul { display: none; }
.bs-fin-score { margin: 4px 0; font-size: 2.2rem; font-weight: 900; color: #fde68a; font-variant-numeric: tabular-nums; }
.bs-fin-score small { font-size: 0.95rem; font-weight: 600; color: #cbd5e1; }
.bs-fin-detail { margin: 4px 0 10px; color: #94a3b8; font-size: 0.88rem; line-height: 1.5; }
.bs-fin-statut { min-height: 1.4em; margin: 10px 0; font-size: 0.93rem; line-height: 1.55; color: #cbd5e1; }
.bs-fin-statut.attente { color: #fde68a; }
.bs-fin-statut.erreur { color: #fca5a5; }
.bs-fin-statut a { color: #7dd3fc; }
.bs-record { color: #6ee7b7; font-weight: 800; }
.bs-fin-duel { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 8px 0; }
.bs-fin-duel span { display: flex; flex-direction: column; min-width: 0; }
.bs-fin-duel small { color: #94a3b8; font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.bs-fin-duel strong { font-size: 1.6rem; color: #fde68a; font-variant-numeric: tabular-nums; }
.bs-fin-contre { color: #64748b; font-size: 0.85rem; }
.bs-decompte .bs-carte { background: none; border: 0; }
.bs-affiche { font-size: 1.15rem; font-weight: 800; color: #e6edf5; margin: 0 0 6px; }
.bs-chiffre { font-size: 6rem; font-weight: 900; line-height: 1; margin: 0 0 10px; color: #6ee7b7; }

/* ---- Duel : deux plateaux ----------------------------------------------------- */
.bs-hud-duel { gap: 10px; }
.bs-camp { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 1 1 0; }
.bs-camp.adv { justify-content: flex-end; }
.bs-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 0.9rem; }
.bs-camp.moi .bs-nom { color: #6ee7b7; }
.bs-camp.adv .bs-nom { color: #fca5a5; }
.bs-points { font-size: 1.15rem; color: #fde68a; font-variant-numeric: tabular-nums; }
.bs-centre { display: flex; flex-direction: column; align-items: center; flex: none; line-height: 1.2; }
.bs-chrono { font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.bs-plateaux { flex: 1 1 auto; min-height: 0; display: flex; gap: 14px; justify-content: center; padding: 0 6px; }
.bs-plateaux .bs-zone { flex: 1 1 0; }
.bs-zone-adv { position: relative; flex: 1 1 0; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 6px; }
.bs-zone-adv canvas { cursor: default; }

@media (max-width: 760px) {
  /* Écran étroit : le plateau adverse devient une vignette au-dessus du sien. */
  .bs-plateaux { flex-direction: column-reverse; gap: 0; }
  .bs-zone-adv { flex: none; height: 96px; padding: 4px; }
  .bs-hud { gap: 8px; }
  .bs-stat strong { font-size: 0.98rem; }
  .bs-outils button { width: 40px; height: 40px; font-size: 17px; }
  .bs-hud-duel .bs-camp { flex-direction: column-reverse; align-items: flex-start; gap: 0; line-height: 1.15; }
  .bs-hud-duel .bs-camp.adv { flex-direction: column; align-items: flex-end; }
  .bs-nom { font-size: 0.72rem; max-width: 100%; }
  .bs-points { font-size: 1.05rem; }
  .bs-hud-duel .bs-rangee { font-size: 0.74rem; }
}

@media (max-width: 420px) {
  #btn-motifs { display: none; }
  .bs-lib { font-size: 0.6rem; }
  .bs-hud { gap: 7px; padding-left: 8px; }
}

/* Téléphone couché : la barre d'état passe à gauche, le plateau prend toute la hauteur. */
@media (orientation: landscape) and (max-height: 520px) {
  .bs-jeu.visible { flex-direction: row; flex-wrap: nowrap; }
  .bs-hud { flex-direction: column; align-items: stretch; justify-content: flex-start; width: 132px; min-height: 0; gap: 8px; padding: 8px; border-bottom: 0; border-right: 1px solid rgba(255, 255, 255, 0.08); }
  .bs-outils { margin: auto 0 0; flex-wrap: wrap; }
  .bs-barre { flex-direction: column; justify-content: center; width: 128px; padding: 8px; }
  .bs-tuto { display: none; }
  .bs-hud-duel .bs-camp { flex: none; flex-direction: column; align-items: flex-start; gap: 0; }
  .bs-hud-duel .bs-camp.adv { align-items: flex-start; }
  .bs-plateaux { flex-direction: row; }
  .bs-zone-adv { flex: 0 0 22%; height: auto; }
}

/* Écran tactile sans souris : pas de rappel de touche, et les consignes du doigt d'emblée. */
@media (hover: none) and (pointer: coarse) {
  .bs-btn-outil kbd { display: none; }
  .bs-tactile-seul { display: block; }
  .bs-clavier-seul { display: none; }
}

@media (max-width: 480px) {
  .page-bubble-shooter #app { padding: 18px 24px 28px; }
  .page-bubble-shooter h1 { font-size: 1.35rem; }
}

/* En-tête réseau (01/11/2026) : page de partie plein écran, le jeu garde tout l'écran.
   Pas de bande en haut ; la barre de compte reste en surimpression, comme avant.
   Sélecteurs préfixés par html : ils l'emportent sur head-common.css quel que soit
   l'ordre de chargement. */
html:root {
  --entete-reseau: 0px;
}
html .net-entete {
  display: none;
}
html .net-entete + .auth-nav {
  position: fixed;
  top: 6px;
  right: 6px;
  background: var(--surface-1);
  border-color: var(--line-forte);
}
html .net-entete + .auth-nav::before {
  background: var(--surface-1);
  border-color: var(--line-forte);
}

/* Le bouton de repli de la barre reste utile ici (téléphone et tablette) */
@media (max-width: 768px) {
  html .net-entete + .auth-nav:not(.no-collapse) .auth-nav-toggle {
    display: inline-flex;
  }
}
