/* ============ Formation Poker Pro — thème sombre ============ */
:root {
  --fond: #0f1419;
  --fond2: #171e26;
  --fond3: #1f2833;
  --carte-fond: #f8f6f0;
  --bordure: #2c3947;
  --texte: #e8e6e1;
  --texte2: #9aa7b5;
  --or: #d4af37;
  --or-clair: #f0d060;
  --vert: #35a860;
  --vert-fonce: #1e5c38;
  --rouge: #d84c4c;
  --bleu: #4c9fd8;
  --feutre: #1d5c3a;
  --feutre-fonce: #14432a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--fond);
  color: var(--texte);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
#app { display: flex; min-height: 100vh; }

/* ---------- Barre latérale ---------- */
#barre-laterale {
  width: 290px; min-width: 290px;
  background: var(--fond2);
  border-right: 1px solid var(--bordure);
  padding: 18px 14px;
  height: 100vh;
  overflow-y: auto;
  position: sticky; top: 0;
}
.logo-titre { font-size: 22px; font-weight: 800; color: var(--or); line-height: 1.15; }
.logo-sous-titre { font-size: 12px; color: var(--texte2); margin: 6px 0 16px; }
.nav-lien {
  display: block; padding: 9px 12px; margin-bottom: 4px;
  color: var(--texte); text-decoration: none; border-radius: 8px; font-weight: 600;
}
.nav-lien:hover { background: var(--fond3); }
.nav-lien.actif { background: var(--fond3); color: var(--or-clair); }

#nav-modules { margin-top: 18px; }
.nav-module { margin-bottom: 6px; }
.nav-module-titre {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-radius: 8px; cursor: pointer;
  font-weight: 700; font-size: 13.5px; color: var(--texte);
}
.nav-module-titre:hover { background: var(--fond3); }
.nav-module-titre .pct { font-size: 11px; color: var(--texte2); font-weight: 600; }
.nav-module-titre.complet .pct { color: var(--vert); }
.nav-sessions { display: none; padding-left: 6px; }
.nav-module.ouvert .nav-sessions { display: block; }
.nav-session {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; margin: 2px 0; border-radius: 6px;
  color: var(--texte2); text-decoration: none; font-size: 12.8px;
}
.nav-session:hover { background: var(--fond3); }
.nav-session.actif { background: var(--fond3); color: var(--or-clair); }
.nav-session.terminee { color: var(--texte); }
.nav-session.verrouillee { opacity: 0.45; cursor: not-allowed; }
.nav-session .puce { font-size: 11px; }

/* ---------- Contenu principal ---------- */
#contenu { flex: 1; padding: 26px 34px 60px; max-width: 1050px; }
h1 { font-size: 26px; margin-bottom: 4px; }
h2 { font-size: 20px; margin: 22px 0 10px; color: var(--or-clair); }
h3 { font-size: 16.5px; margin: 18px 0 8px; color: var(--texte); }
p { margin-bottom: 10px; }
ul, ol { margin: 0 0 12px 22px; }
li { margin-bottom: 5px; }
.sous-titre { color: var(--texte2); margin-bottom: 18px; }
a { color: var(--bleu); }

/* ---------- Cartes / boîtes ---------- */
.boite {
  background: var(--fond2); border: 1px solid var(--bordure);
  border-radius: 12px; padding: 18px 20px; margin-bottom: 16px;
}
.encadre {
  background: rgba(212, 175, 55, 0.07); border-left: 4px solid var(--or);
  border-radius: 8px; padding: 12px 16px; margin: 14px 0;
}
.encadre .titre-encadre { font-weight: 800; color: var(--or-clair); margin-bottom: 4px; }
.exemple {
  background: rgba(76, 159, 216, 0.08); border-left: 4px solid var(--bleu);
  border-radius: 8px; padding: 12px 16px; margin: 14px 0;
}
.exemple .titre-encadre { font-weight: 800; color: var(--bleu); margin-bottom: 4px; }
.attention {
  background: rgba(216, 76, 76, 0.08); border-left: 4px solid var(--rouge);
  border-radius: 8px; padding: 12px 16px; margin: 14px 0;
}
.attention .titre-encadre { font-weight: 800; color: var(--rouge); margin-bottom: 4px; }

table.tableau { border-collapse: collapse; margin: 12px 0; width: 100%; }
table.tableau th, table.tableau td {
  border: 1px solid var(--bordure); padding: 7px 12px; text-align: left; font-size: 14px;
}
table.tableau th { background: var(--fond3); color: var(--or-clair); }
table.tableau tr:nth-child(even) td { background: rgba(255,255,255,0.02); }

/* cartes inline dans les textes */
.crt {
  display: inline-block; background: var(--carte-fond); color: #111;
  border-radius: 4px; padding: 0 4px; font-weight: 800; font-size: 13.5px;
  margin: 0 1px; border: 1px solid #ccc;
}
.crt.r { color: #c62828; }
.crt.b { color: #1565c0; }
.crt.g { color: #2e7d32; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-block; padding: 9px 18px; border-radius: 9px; border: none;
  background: var(--fond3); color: var(--texte); font-weight: 700; font-size: 14px;
  cursor: pointer; text-decoration: none; transition: transform 0.06s, background 0.15s;
}
.btn:hover { background: #2a3644; }
.btn:active { transform: scale(0.97); }
.btn.principal { background: var(--or); color: #1a1a1a; }
.btn.principal:hover { background: var(--or-clair); }
.btn.vert { background: var(--vert); color: #fff; }
.btn.vert:hover { background: #3fc472; }
.btn.rouge { background: var(--rouge); color: #fff; }
.btn.discret { background: transparent; border: 1px solid var(--bordure); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rangee-btn { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }

/* ---------- Tableau de bord ---------- */
.grille-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.stat {
  background: var(--fond2); border: 1px solid var(--bordure); border-radius: 12px;
  padding: 14px 16px; text-align: center;
}
.stat .valeur { font-size: 26px; font-weight: 800; color: var(--or-clair); }
.stat .libelle { font-size: 12px; color: var(--texte2); margin-top: 2px; }

.carte-module {
  background: var(--fond2); border: 1px solid var(--bordure); border-radius: 12px;
  padding: 14px 18px; margin-bottom: 10px; cursor: pointer;
}
.carte-module:hover { border-color: var(--or); }
.carte-module .entete { display: flex; justify-content: space-between; align-items: center; }
.carte-module .nom { font-weight: 800; font-size: 15.5px; }
.carte-module .detail { font-size: 12.5px; color: var(--texte2); }
.barre-prog { height: 7px; background: var(--fond3); border-radius: 4px; margin-top: 9px; overflow: hidden; }
.barre-prog .remplissage { height: 100%; background: linear-gradient(90deg, var(--or), var(--or-clair)); border-radius: 4px; }
.barre-prog .remplissage.vert { background: var(--vert); }

/* ---------- Vue session ---------- */
.onglets { display: flex; gap: 6px; margin: 18px 0 0; border-bottom: 2px solid var(--bordure); }
.onglet {
  padding: 10px 20px; cursor: pointer; font-weight: 700; color: var(--texte2);
  border-radius: 9px 9px 0 0; border: none; background: transparent; font-size: 14.5px;
}
.onglet:hover { color: var(--texte); background: var(--fond2); }
.onglet.actif { color: var(--or-clair); background: var(--fond2); border-bottom: 2px solid var(--or); margin-bottom: -2px; }
.onglet .coche { color: var(--vert); }
.panneau-onglet { background: var(--fond2); border: 1px solid var(--bordure); border-top: none; border-radius: 0 0 12px 12px; padding: 22px 26px; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700;
  background: var(--fond3); color: var(--texte2);
}
.badge.ok { background: rgba(53,168,96,0.18); color: var(--vert); }
.badge.attente { background: rgba(212,175,55,0.15); color: var(--or-clair); }

/* ---------- Quiz ---------- */
.quiz-question { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.quiz-compteur { color: var(--texte2); font-size: 12.5px; margin-bottom: 8px; }
.quiz-choix { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.quiz-choix button {
  text-align: left; padding: 11px 15px; border-radius: 9px;
  border: 1px solid var(--bordure); background: var(--fond3); color: var(--texte);
  font-size: 14.5px; cursor: pointer;
}
.quiz-choix button:hover:not(:disabled) { border-color: var(--or); }
.quiz-choix button.bonne { border-color: var(--vert); background: rgba(53,168,96,0.15); }
.quiz-choix button.mauvaise { border-color: var(--rouge); background: rgba(216,76,76,0.12); }
.quiz-explication { margin-top: 4px; }
.quiz-score { text-align: center; padding: 20px; }
.quiz-score .gros { font-size: 42px; font-weight: 800; color: var(--or-clair); }

/* ---------- Grille de range 13x13 ---------- */
.grille-range-conteneur { margin: 14px 0; }
.grille-range-titre { font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.grille-range {
  display: grid; grid-template-columns: repeat(13, 1fr); gap: 2px;
  max-width: 560px; user-select: none;
}
.grille-range .cellule {
  aspect-ratio: 1.35; display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700; border-radius: 3px;
  background: var(--fond3); color: var(--texte2);
}
.grille-range .cellule.dans-range { background: var(--vert-fonce); color: #d8f5e3; }
.grille-range .cellule.mixte { background: repeating-linear-gradient(45deg, var(--vert-fonce), var(--vert-fonce) 4px, var(--fond3) 4px, var(--fond3) 8px); color: #d8f5e3; }
.grille-range .cellule.valeur2 { background: #7a3131; color: #ffd9d9; }
.grille-range .cellule.surligne { outline: 3px solid var(--or-clair); z-index: 2; }
.legende-range { display: flex; gap: 16px; font-size: 12px; color: var(--texte2); margin-top: 6px; flex-wrap: wrap; }
.legende-range .pastille { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Drill ---------- */
.drill-zone { text-align: center; padding: 10px 0; }
.drill-main-affichee { display: flex; gap: 8px; justify-content: center; margin: 18px 0; }
.drill-contexte { font-size: 16px; margin-bottom: 6px; }
.drill-position { font-size: 20px; font-weight: 800; color: var(--or-clair); }
.drill-feedback { margin: 12px auto; max-width: 620px; }
.drill-score-ligne { color: var(--texte2); font-size: 13px; margin-top: 10px; }

/* ---------- Table de poker ---------- */
.zone-table { position: relative; width: 100%; max-width: 920px; margin: 0 auto; }
.table-poker {
  position: relative; width: 100%; aspect-ratio: 1.85;
  background: radial-gradient(ellipse at center, var(--feutre) 0%, var(--feutre-fonce) 75%);
  border: 12px solid #3d2b1f;
  border-radius: 46% / 58%;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.5), 0 8px 30px rgba(0,0,0,0.6);
}
.siege {
  position: absolute; transform: translate(-50%, -50%);
  text-align: center; min-width: 110px; z-index: 3;
}
.siege .pastille-joueur {
  background: rgba(10, 14, 18, 0.88); border: 2px solid var(--bordure);
  border-radius: 12px; padding: 5px 10px 7px; display: inline-block; min-width: 108px;
}
.siege.au-tour .pastille-joueur { border-color: var(--or-clair); box-shadow: 0 0 14px rgba(240, 208, 96, 0.5); }
.siege.gagnant .pastille-joueur { border-color: var(--vert); box-shadow: 0 0 16px rgba(53, 168, 96, 0.65); }
.siege.couche { opacity: 0.45; }
.siege .nom-joueur { font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.siege .profil-joueur { font-size: 10px; color: var(--texte2); }
.siege .stack-joueur { font-size: 12px; color: var(--or-clair); font-weight: 700; }
.siege .position-joueur {
  display: inline-block; background: var(--fond3); border-radius: 8px;
  font-size: 9.5px; padding: 0 6px; color: var(--texte2); margin-left: 4px;
}
.siege .cartes-joueur { display: flex; gap: 3px; justify-content: center; margin-bottom: 3px; min-height: 44px; align-items: flex-end; }
.siege .derniere-action {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: -20px; font-size: 11px; font-weight: 700; color: var(--or-clair);
  background: rgba(10,14,18,0.85); padding: 1px 8px; border-radius: 8px; white-space: nowrap;
}
.jeton-mise {
  position: absolute; transform: translate(-50%, -50%);
  background: rgba(10, 14, 18, 0.85); color: var(--or-clair); font-weight: 800;
  font-size: 12px; padding: 3px 10px; border-radius: 14px; z-index: 2;
  border: 1px solid rgba(212, 175, 55, 0.5);
}
.bouton-dealer {
  position: absolute; transform: translate(-50%, -50%);
  width: 22px; height: 22px; background: #fff; color: #222; border-radius: 50%;
  font-weight: 800; font-size: 11px; display: flex; align-items: center; justify-content: center;
  z-index: 4; box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}
.zone-board {
  position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%);
  display: flex; gap: 6px; z-index: 1;
}
.zone-pot {
  position: absolute; left: 50%; top: 62%; transform: translate(-50%, -50%);
  color: #fff; font-weight: 800; font-size: 14.5px; z-index: 1;
  background: rgba(0,0,0,0.35); padding: 2px 14px; border-radius: 14px;
}
.message-table {
  position: absolute; left: 50%; top: 26%; transform: translate(-50%, -50%);
  color: var(--or-clair); font-weight: 800; font-size: 15px; z-index: 5;
  background: rgba(10,14,18,0.85); padding: 6px 18px; border-radius: 12px;
  max-width: 70%; text-align: center;
}

/* cartes à jouer */
.carte-jeu {
  width: 42px; height: 58px; background: var(--carte-fond); border-radius: 5px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; box-shadow: 0 2px 4px rgba(0,0,0,0.45); color: #111;
}
.carte-jeu .rang { font-size: 18px; line-height: 1; }
.carte-jeu .symb { font-size: 15px; line-height: 1.1; }
.carte-jeu.r { color: #c62828; }
.carte-jeu.b { color: #1565c0; }
.carte-jeu.g { color: #2e7d32; }
.carte-jeu.dos {
  background: repeating-linear-gradient(45deg, #7a1f2b, #7a1f2b 6px, #8d2836 6px, #8d2836 12px);
  border: 2px solid #f0e6d0;
}
.carte-jeu.petite { width: 34px; height: 47px; }
.carte-jeu.petite .rang { font-size: 14px; }
.carte-jeu.petite .symb { font-size: 12px; }

/* barre d'action */
.barre-action {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center;
  background: var(--fond2); border: 1px solid var(--bordure); border-radius: 12px;
  padding: 14px 16px; margin-top: 14px; min-height: 64px;
}
.barre-action .info-a-payer { width: 100%; text-align: center; color: var(--texte2); font-size: 13px; }
.btn-action { padding: 11px 22px; font-size: 15px; border-radius: 10px; border: none; font-weight: 800; cursor: pointer; }
.btn-action.se-coucher { background: var(--rouge); color: #fff; }
.btn-action.parole { background: var(--fond3); color: var(--texte); border: 1px solid var(--bordure); }
.btn-action.suivre { background: var(--vert); color: #fff; }
.btn-action.miser { background: var(--or); color: #1a1a1a; }
.btn-action:hover { filter: brightness(1.12); }
.zone-sizing { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.zone-sizing input[type="range"] { width: 180px; accent-color: var(--or); }
.zone-sizing .montant-mise { font-weight: 800; color: var(--or-clair); min-width: 70px; text-align: center; font-size: 15px; }
.preset-mise {
  background: var(--fond3); border: 1px solid var(--bordure); color: var(--texte2);
  border-radius: 7px; padding: 5px 9px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.preset-mise:hover { color: var(--or-clair); border-color: var(--or); }

/* panneau coach + journal */
.dessous-table { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 900px) { .dessous-table { grid-template-columns: 1fr; } }
.panneau-coach {
  background: var(--fond2); border: 1px solid var(--bordure); border-radius: 12px; padding: 14px 16px;
}
.panneau-coach h3 { margin-top: 0; color: var(--or-clair); font-size: 14.5px; }
.panneau-coach .ligne-coach { font-size: 13.5px; margin-bottom: 6px; }
.panneau-coach .ligne-coach b { color: var(--or-clair); }
.conseils-lecon { font-size: 12.8px; color: var(--texte2); margin-top: 8px; border-top: 1px solid var(--bordure); padding-top: 8px; }
.journal-main {
  background: var(--fond2); border: 1px solid var(--bordure); border-radius: 12px;
  padding: 12px 16px; max-height: 240px; overflow-y: auto; font-size: 12.8px;
  font-family: Consolas, monospace; color: var(--texte2);
}
.journal-main .titre-journal { font-weight: 800; color: var(--texte); font-family: inherit; margin-bottom: 6px; }
.journal-main div { margin-bottom: 2px; }
.journal-main .rue-marque { color: var(--or-clair); font-weight: 700; margin-top: 5px; }

.bandeau-objectif {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  background: var(--fond2); border: 1px solid var(--bordure); border-radius: 12px;
  padding: 10px 16px; margin-bottom: 12px; font-size: 13.5px;
}
.bandeau-objectif .obj-titre { font-weight: 700; color: var(--or-clair); }

/* ---------- Historique ---------- */
.entree-historique {
  background: var(--fond2); border: 1px solid var(--bordure); border-radius: 10px;
  padding: 10px 14px; margin-bottom: 8px; font-family: Consolas, monospace;
  font-size: 12.5px; white-space: pre-wrap; color: var(--texte2);
}
.entree-historique .titre-entree { color: var(--texte); font-weight: 700; }

/* ---------- Réglages ---------- */
.ligne-reglage {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--bordure); gap: 16px;
}
.ligne-reglage .desc { font-size: 12.5px; color: var(--texte2); }
textarea.zone-json {
  width: 100%; min-height: 120px; background: var(--fond3); color: var(--texte);
  border: 1px solid var(--bordure); border-radius: 8px; padding: 10px;
  font-family: Consolas, monospace; font-size: 12px;
}
/* Tous les champs de saisie texte, pas seulement type="text" : sans cela, le
   champ de courriel et celui de mot de passe tombaient sur l'apparence par
   défaut du navigateur — fond blanc, bordure grise, hauteur de 22 px — au
   milieu d'un écran sombre. Mesuré avant correction : 22 px de haut. */
input[type="text"].champ, input[type="email"].champ,
input[type="password"].champ, input[type="number"].champ {
  background: var(--fond3); color: var(--texte); border: 1px solid var(--bordure);
  border-radius: 8px; padding: 8px 12px; font-size: 14px;
}

/* table compacte sur petites fenêtres */
@media (max-width: 1150px) {
  .siege { min-width: 76px; }
  .siege .pastille-joueur { min-width: 74px; padding: 3px 6px 4px; border-radius: 9px; }
  .siege .nom-joueur { font-size: 10.5px; }
  .siege .profil-joueur { display: none; }
  .siege .stack-joueur { font-size: 10.5px; }
  .siege .position-joueur { font-size: 8.5px; padding: 0 4px; }
  .siege .cartes-joueur { min-height: 34px; }
  .siege .derniere-action { font-size: 9.5px; bottom: -16px; }
  .carte-jeu { width: 34px; height: 47px; }
  .carte-jeu .rang { font-size: 14px; }
  .carte-jeu .symb { font-size: 12px; }
  .carte-jeu.petite { width: 26px; height: 36px; }
  .carte-jeu.petite .rang { font-size: 11px; }
  .carte-jeu.petite .symb { font-size: 9.5px; }
  .jeton-mise { font-size: 10px; padding: 2px 7px; }
  .zone-pot { font-size: 12px; }
  .message-table { font-size: 12.5px; padding: 4px 12px; }
  .bouton-dealer { width: 17px; height: 17px; font-size: 9px; }
}
@media (max-width: 860px) {
  #barre-laterale { width: 220px; min-width: 220px; padding: 12px 8px; }
  #contenu { padding: 18px 16px 50px; }
}

/* ---------- Sélecteur de parcours ---------- */
#selecteur-mode { margin-bottom: 14px; }
.choix-parcours {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  background: var(--fond3); border: 1px solid var(--bordure);
  border-radius: 11px; padding: 5px;
}
.parcours-onglet {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 4px; border: none; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--texte2); font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.parcours-onglet:hover:not(:disabled) { background: rgba(255,255,255,0.05); color: var(--texte); }
.parcours-onglet.actif { background: var(--fond); color: var(--or-clair); box-shadow: 0 1px 4px rgba(0,0,0,0.4); }
.parcours-onglet:disabled { opacity: 0.45; cursor: not-allowed; }
.parcours-emoji { font-size: 17px; line-height: 1.1; }
.parcours-nom { font-size: 12.5px; font-weight: 800; }
.parcours-compte { font-size: 10.5px; opacity: 0.8; }

.bandeau-parcours {
  display: inline-block; background: var(--fond2); border: 1px solid var(--bordure);
  border-radius: 20px; padding: 4px 14px; font-size: 12.5px; margin-bottom: 10px;
}
.carte-autre-parcours { border-style: dashed; }

/* ---------- Range Trainer ---------- */
.rt-bloc {
  background: var(--fond2); border: 1px solid var(--bordure);
  border-radius: 12px; padding: 14px 18px; margin-bottom: 12px;
}
.rt-titre-bloc { font-weight: 800; color: var(--or-clair); margin-bottom: 8px; font-size: 14.5px; }
.rt-groupe { margin-bottom: 10px; }
.rt-groupe-nom { font-size: 12px; color: var(--texte2); text-transform: uppercase; letter-spacing: 0.5px; margin: 8px 0 4px; }
.rt-case { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; cursor: pointer; }
.rt-case input { accent-color: var(--or); }
.rt-case input:disabled + span { opacity: 0.5; }
.rt-pastille { font-size: 13px; }
.rt-profondeurs { display: flex; flex-wrap: wrap; gap: 7px; }
.rt-chip {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  background: var(--fond3); border: 1px solid var(--bordure); border-radius: 8px;
  padding: 5px 11px; font-size: 13px; font-weight: 700;
}
.rt-chip:hover { border-color: var(--or); }
.rt-chip input { accent-color: var(--or); }

.rt-entete { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.rt-progression { flex: 1 1 180px; height: 6px; background: var(--fond3); border-radius: 4px; overflow: hidden; }
.rt-progression-barre { height: 100%; background: linear-gradient(90deg, var(--or), var(--or-clair)); }
.rt-compteur { font-size: 13px; color: var(--texte2); white-space: nowrap; }
.rt-quitter { padding: 5px 12px; font-size: 12.5px; }

.rt-question {
  background: var(--fond2); border: 1px solid var(--bordure);
  border-radius: 12px; padding: 18px; text-align: center; margin-bottom: 14px;
}
.rt-situation-nom { font-weight: 800; font-size: 15.5px; color: var(--or-clair); }
.rt-contexte { color: var(--texte2); font-size: 13.5px; margin: 6px 0; }
.rt-profondeur-badge {
  display: inline-block; background: var(--fond3); border-radius: 20px;
  padding: 3px 14px; font-size: 13px; margin-top: 4px;
}
.rt-freq {
  display: inline-block; background: var(--fond3); border-radius: 7px;
  padding: 2px 10px; margin: 2px 4px 2px 0; font-size: 13px;
}
.rt-provenance {
  background: var(--fond2); border: 1px solid var(--bordure);
  border-radius: 10px; padding: 10px 14px; margin: 12px 0; font-size: 13px;
}
.rt-provenance summary { cursor: pointer; }
.rt-provenance table.tableau { margin-top: 8px; }
.rt-provenance td:first-child { color: var(--texte2); width: 32%; }

/* couleurs d'action sur la grille */
.grille-range .cellule.rt-a0 { background: #8a6d1f; color: #fff6d8; }   /* action agressive */
.grille-range .cellule.rt-a1 { background: var(--vert-fonce); color: #d8f5e3; }
.grille-range .cellule.rt-a2 { background: var(--fond3); color: var(--texte2); }
.grille-range .cellule.rt-mixte { outline: 1px dashed rgba(255,255,255,0.45); outline-offset: -2px; }
.pastille.rt-leg-a0 { background: #8a6d1f; }
.pastille.rt-leg-a1 { background: var(--vert-fonce); }
.pastille.rt-leg-a2 { background: var(--fond3); }
.pastille.rt-leg-mixte { background: #8a6d1f; outline: 1px dashed #fff; outline-offset: -2px; }

/* carte de chaleur des erreurs */
.grille-range .cellule.rt-chaud-0 { background: #1e5c38; color: #d8f5e3; }
.grille-range .cellule.rt-chaud-1 { background: #7a6a1f; color: #fff6d8; }
.grille-range .cellule.rt-chaud-2 { background: #8a4a1f; color: #ffe6d8; }
.grille-range .cellule.rt-chaud-3 { background: #8a2626; color: #ffd9d9; }
.pastille.rt-leg-chaud0 { background: #1e5c38; }
.pastille.rt-leg-chaud1 { background: #7a6a1f; }
.pastille.rt-leg-chaud3 { background: #8a2626; }

/* ---------- Alerte de sauvegarde ---------- */
.alerte-sauvegarde {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 999; max-width: 720px; width: calc(100% - 40px);
  background: #4a1f1f; border: 1px solid var(--rouge); color: #ffe0e0;
  border-radius: 12px; padding: 12px 18px; font-size: 13.5px; line-height: 1.5;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55);
}
.alerte-sauvegarde b { color: #fff; }

/* ---------- Divers ---------- */
.centre { text-align: center; }
.espace-haut { margin-top: 18px; }
.texte-vert { color: var(--vert); }
.texte-rouge { color: var(--rouge); }
.texte-or { color: var(--or-clair); }
.texte-discret { color: var(--texte2); font-size: 13px; }
.gros-emoji { font-size: 44px; }
hr.separateur { border: none; border-top: 1px solid var(--bordure); margin: 18px 0; }
::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-thumb { background: var(--bordure); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================================
   AJOUTS 2026-12-02 — adaptation mobile et correctifs de balisage
   Tout ce qui suit est ajouté à la fin du fichier : aucune règle existante
   n'est modifiée, le rendu sur ordinateur reste donc identique sauf pour les
   deux correctifs ci-dessous, qui réparent des éléments actuellement invisibles.
   ============================================================================ */

/* ---------- Correctifs de balisage (valables aussi sur ordinateur) ----------
   js/ui/tableau-bord.js émet <div class="barre-prog"><span style="width:X%">
   alors que la feuille cible .barre-prog .remplissage : le <span> n'avait
   aucune hauteur, les barres d'avancement par module étaient invisibles. */
.barre-prog > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--or), var(--or-clair));
  border-radius: 4px;
}
/* Même fichier : <div class="stat"><div class="gros">…</div><div>…</div></div>
   alors que la feuille cible .stat .valeur / .stat .libelle. */
.stat .gros { font-size: 26px; font-weight: 800; color: var(--or-clair); line-height: 1.2; }
.stat .gros + div { font-size: 12px; color: var(--texte2); margin-top: 2px; }

/* ---------- Range Trainer : détail d'une case et légende des provenances ---- */
.rt-detail-case {
  margin-top: 8px; padding: 8px 12px; min-height: 40px;
  background: var(--fond3); border: 1px solid var(--bordure); border-radius: 8px;
  font-size: 13px; color: var(--texte2);
}
.rt-detail-case b { color: var(--or-clair); }
.grille-range .cellule[data-detail] { cursor: pointer; }
.grille-range .cellule.rt-choisie { outline: 2px solid var(--or-clair); outline-offset: -1px; z-index: 2; }
.rt-legende-sources {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  margin: 8px 0 2px; font-size: 12.5px; color: var(--texte2);
}
.rt-legende-sources .pastille-src { margin-right: 4px; }

/* ---------- Chaînes insécables longues (valable aussi sur ordinateur) -------
   L'écran Réglages affiche le chemin complet du fichier de progression, et
   l'écran de synchronisation affichera une adresse de courriel : ce sont des
   chaînes sans espace, qu'aucun navigateur ne coupe par défaut. Mesuré à
   375 px : l'écran Réglages débordait de 109 px (page de 484 px) à cause du
   seul chemin, qui faisait 443 px à lui tout seul. Le défaut est invisible
   chez un utilisateur dont le chemin est court, mais il est réel.

   « break-word » ne coupe un mot QUE s'il ne tient pas : pour tout le contenu
   actuel, qui tient, le rendu reste rigoureusement identique. C'est pour cela
   que la règle n'est pas limitée au mobile — un débordement est un défaut à
   toutes les largeurs. */
#contenu p, #contenu li, #contenu td, #contenu th,
#contenu .encadre, #contenu .boite, #contenu .texte-discret,
#contenu code, #contenu .journal-main, #contenu .entree-historique {
  overflow-wrap: break-word;
  word-break: break-word;      /* repli pour les Safari antérieurs à 15.4 */
}

/* ---------- Piles de polices : « Consolas » n'existe pas sur iOS ----------
   Les trois déclarations monospace d'origine restent en place (lignes 335,
   351, 365) ; cette règle leur ajoute les polices présentes sur iOS et macOS. */
.journal-main, .entree-historique, textarea.zone-json {
  font-family: Consolas, ui-monospace, Menlo, "SF Mono", monospace;
}

/* ============================================================================
   PALIER MOBILE — jusqu'à 820 px
   ============================================================================ */
@media (max-width: 820px) {
  /* --- B1 : la barre latérale devient un en-tête empilé ---
     Choix : la barre reste au-dessus du contenu (flex-direction: column) mais
     sa hauteur est plafonnée à 42 vh avec défilement interne, et la navigation
     principale devient une bande horizontale défilante. Sans cela, 9 liens +
     le sélecteur de parcours + 11 modules + 65 sessions s'empileraient avant
     la leçon. C'est du CSS pur : index.html n'est pas touché. */
  #app { flex-direction: column; }
  #barre-laterale {
    width: 100%; min-width: 0;
    height: auto; max-height: 42vh;
    position: static; top: auto;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    /* zone sûre du haut : la barre d'état d'iOS passe par-dessus la page
       quand index.html déclare viewport-fit=cover + status-bar black-translucent */
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
    border-right: none; border-bottom: 1px solid var(--bordure);
  }
  #contenu {
    flex: 1 1 auto; min-width: 0; width: 100%; max-width: 100%;
    padding: 16px 12px calc(60px + env(safe-area-inset-bottom, 0px));
  }
  .logo-titre { font-size: 18px; }
  .logo-sous-titre { font-size: 11px; margin: 4px 0 10px; }
  #nav-principale {
    display: flex; flex-wrap: nowrap; gap: 6px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 4px; scrollbar-width: thin;
  }
  .nav-lien {
    flex: 0 0 auto; white-space: nowrap;
    display: flex; align-items: center; min-height: 44px;
    padding: 9px 14px; margin-bottom: 0;
  }
  #nav-modules { margin-top: 12px; }
  .nav-module-titre { min-height: 44px; padding: 10px 12px; font-size: 14px; }
  .nav-session { min-height: 44px; padding: 8px 10px; font-size: 13.5px; }

  /* --- B8 : zoom automatique d'iOS. Sous 16 px, Safari zoome à chaque focus. */
  input, select, textarea,
  input[type="text"].champ, input[type="email"].champ,
  input[type="password"].champ, input[type="number"].champ,
  textarea.zone-json { font-size: 16px; }
  /* un <select> prend la largeur de sa plus longue option : sans plafond il
     élargit la page (mesuré : 456 px sur le Simulateur Expresso). */
  select, input.champ, input[type="text"].champ { max-width: 100%; min-width: 0; }

  /* Un champ de saisie est une cible tactile comme une autre : 36 px mesurés
     au doigt, c'est trop peu. On ne touche pas à la police (déjà à 16 px pour
     empêcher le zoom d'iOS), seulement à la hauteur utile. */
  input[type="text"].champ, input[type="email"].champ,
  input[type="password"].champ,
  input[type="number"].champ, select.champ, select {
    min-height: 44px;
  }

  /* --- B9 : cibles tactiles. Les cases et boutons radio passent de 13 px à
     26 px ; leur étiquette (qui est la vraie zone tapable, un clic dessus
     bascule la case) fait au moins 44 px de haut. */
  input[type="checkbox"], input[type="radio"] {
    width: 26px; height: 26px; min-width: 26px; flex: 0 0 auto; margin: 0;
  }
  .btn {
    min-height: 44px; display: inline-flex; align-items: center;
    justify-content: center; padding: 10px 18px;
  }
  .btn-action { min-height: 48px; padding: 12px 20px; }
  .rt-case { min-height: 44px; padding: 7px 0; gap: 10px; }
  .rt-chip { min-height: 44px; padding: 7px 13px; }
  .rt-quitter { min-height: 44px; padding: 8px 14px; font-size: 13px; }
  .preset-mise { min-height: 44px; padding: 8px 13px; font-size: 13px; }
  .rt-provenance summary {
    min-height: 44px; display: flex; align-items: center; flex-wrap: wrap;
  }
  .quiz-choix button { min-height: 44px; }
  .parcours-onglet { min-height: 52px; }
  .ligne-reglage { flex-wrap: wrap; }

  /* --- Suppression du délai de 300 ms au tap --- */
  body { touch-action: manipulation; }

  /* --- B2 : le défilement reste dans le tableau, la page ne s'élargit plus. */
  table.tableau {
    display: block; width: 100%; max-width: 100%;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  table.tableau th, table.tableau td { padding: 6px 9px; font-size: 13px; }

  /* --- B7 : les onglets de session passent à la ligne au lieu de déborder. */
  .onglets { flex-wrap: wrap; gap: 4px; }
  .onglet { min-height: 44px; padding: 10px 14px; font-size: 13.5px; border-radius: 9px; }
  .onglet.actif { margin-bottom: 0; }
  .panneau-onglet { padding: 16px 14px; border-radius: 12px; border-top: 1px solid var(--bordure); }

  /* --- B6 : le curseur de mise était figé à 180 px. --- */
  .zone-sizing { width: 100%; }
  .zone-sizing input[type="range"] { width: 100%; flex: 1 1 140px; min-height: 34px; }
  .barre-action { padding: 12px 10px; }

  /* --- B5 : table de poker compacte. overflow-x: clip protège la largeur de
     la page sans rogner verticalement les sièges du haut et du bas. --- */
  .table-poker { overflow-x: clip; overflow-clip-margin: 10px; border-width: 7px; }
  .siege { min-width: 52px; }
  .siege .pastille-joueur { min-width: 50px; padding: 2px 4px 3px; border-radius: 7px; }
  .siege .nom-joueur {
    font-size: 9.5px; max-width: 66px; overflow: hidden; text-overflow: ellipsis;
  }
  .siege .stack-joueur { font-size: 9.5px; }
  .siege .position-joueur { font-size: 8px; padding: 0 3px; margin-left: 2px; }
  .siege .cartes-joueur { min-height: 26px; gap: 2px; }
  .siege .derniere-action { font-size: 9px; bottom: -14px; padding: 0 5px; }
  .carte-jeu { width: 24px; height: 33px; border-radius: 4px; }
  .carte-jeu .rang { font-size: 11px; }
  .carte-jeu .symb { font-size: 9px; }
  .carte-jeu.petite { width: 19px; height: 26px; }
  .carte-jeu.petite .rang { font-size: 9px; }
  .carte-jeu.petite .symb { font-size: 7.5px; }
  .zone-board { gap: 3px; }
  .zone-pot { font-size: 11px; padding: 1px 9px; }
  .jeton-mise { font-size: 9px; padding: 1px 5px; }
  .bouton-dealer { width: 15px; height: 15px; font-size: 8px; }
  .message-table { font-size: 11.5px; padding: 3px 9px; max-width: 86%; }
  .drill-main-affichee .carte-jeu { width: 38px; height: 52px; }
  .drill-main-affichee .carte-jeu .rang { font-size: 17px; }
  .drill-main-affichee .carte-jeu .symb { font-size: 14px; }

  /* --- B3 : grille 13x13. Des cases de 44 px sont géométriquement
     impossibles en portrait (13 colonnes dans 350 px) : on vise la lisibilité,
     et le détail de chaque case est désormais accessible au doigt (voir
     .rt-detail-case et le gestionnaire de clic du Range Trainer). --- */
  .grille-range-conteneur { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .grille-range { gap: 1px; max-width: 100%; min-width: 0; }
  .grille-range .cellule { aspect-ratio: 1; font-size: 9px; border-radius: 2px; }
  .legende-range { gap: 8px 12px; font-size: 11.5px; }

  /* --- Tableau de bord : le plancher de 160 px forçait deux colonnes trop
     larges sur un écran de 375 px. --- */
  .grille-stats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 9px; }
  .stat { padding: 11px 9px; }
  .stat .gros { font-size: 22px; }

  /* --- Divers confort / largeurs --- */
  h1 { font-size: 22px; }
  h2 { font-size: 18px; }
  .boite { padding: 14px 13px; }
  .rt-bloc { padding: 12px 13px; }
  .rt-entete { gap: 8px; }
  .zone-table { max-width: 100%; }
  .dessous-table { grid-template-columns: 1fr; }
  .journal-main { max-height: 180px; }
  .encadre, .exemple, .attention { padding: 11px 13px; }
  pre, code, .entree-historique { word-break: break-word; }

  /* --- Alerte de sauvegarde : zone sûre du bas (iPhone sans bouton) --- */
  .alerte-sauvegarde {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    width: calc(100% - 20px); font-size: 13px; padding: 11px 14px;
  }
}

/* ============================================================================
   PALIER TRÈS PETIT ÉCRAN — jusqu'à 480 px
   ============================================================================ */
@media (max-width: 480px) {
  #barre-laterale { max-height: 38vh; }
  #contenu { padding: 14px 10px calc(54px + env(safe-area-inset-bottom, 0px)); }
  .grille-stats { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
  .stat .gros { font-size: 20px; }
  .grille-range .cellule { font-size: 8px; }
  .panneau-onglet { padding: 14px 11px; }
  .onglet { padding: 10px 11px; font-size: 13px; }
  h1 { font-size: 20px; }
}

/* ---------- Indicateur de synchronisation ----------
   Règle 08 du projet : un échec de sauvegarde silencieux est une perte de
   données invisible. L'état est donc lisible en permanence dans la barre
   latérale, et il annonce aussi « Synchronisé » — de sorte qu'un indicateur
   vide ou absent se remarque comme une anomalie. */
.etat-synchro {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 7px;
  margin: 0 0 12px; padding: 7px 10px;
  border: 1px solid var(--bordure); border-left-width: 3px; border-radius: 8px;
  background: var(--fond3); font-size: 12px; line-height: 1.35;
}
.etat-synchro:empty { display: none; }
.etat-synchro .sync-puce { font-size: 13px; line-height: 1; }
.etat-synchro .sync-texte { color: var(--texte2); }
.etat-synchro .sync-detail {
  flex-basis: 100%; color: var(--texte2); opacity: 0.8; font-size: 11.5px;
  overflow-wrap: break-word; word-break: break-word;
}
.etat-synchro.sync-inactif { border-left-color: var(--bordure); }
.etat-synchro.sync-inactif .sync-puce { color: var(--texte2); }
.etat-synchro.sync-ajour { border-left-color: var(--vert); }
.etat-synchro.sync-ajour .sync-puce { color: var(--vert); }
.etat-synchro.sync-ajour .sync-texte { color: var(--vert); }
.etat-synchro.sync-envoi { border-left-color: var(--or-clair); }
.etat-synchro.sync-envoi .sync-puce { color: var(--or-clair); }
.etat-synchro.sync-attente { border-left-color: var(--or); }
.etat-synchro.sync-attente .sync-puce { color: var(--or); }
.etat-synchro.sync-erreur {
  border-left-color: var(--rouge); background: #3a1c1c;
}
.etat-synchro.sync-erreur .sync-puce,
.etat-synchro.sync-erreur .sync-texte { color: #ffb4b4; }

@media (max-width: 820px) {
  /* Sur un écran d'iPhone la barre latérale devient un en-tête défilant :
     l'indicateur reste sur une seule ligne pour ne pas voler de hauteur. */
  .etat-synchro { margin-bottom: 8px; padding: 5px 9px; font-size: 11.5px; }
  .etat-synchro .sync-detail { font-size: 11px; }
}
