/* =====================================================
   AIM TRAINER — thème inspiré de l'univers Valorant
   (bleu nuit, rouge vif, coins coupés, majuscules espacées).
   Tout est dessiné ici : aucun visuel du jeu n'est utilisé.
   ===================================================== */

/* Les couleurs et la police sont définies UNE fois ici, puis réutilisées partout */
:root {
  --noir: #0f1923;          /* fond principal */
  --surface: #17212b;       /* fond des cartes */
  --surface-2: #1f2b36;     /* fond des boutons et des champs */
  --rouge: #ff4655;         /* couleur principale */
  --rouge-clair: #ff6573;
  --blanc: #ece8e1;
  --texte: #ece8e1;
  --texte-2: #c3c8cc;       /* texte secondaire */
  --discret: #8d98a1;       /* étiquettes, axes */
  --grille: #26323d;        /* lignes de grille (très discrètes) */
  --axe: #3a4854;
  --bord: rgba(236, 232, 225, 0.12);
  --serie: #3987e5;         /* couleur des courbes et barres des graphiques */
  --serie-clair: #5598e7;
  --bien: #0ca30c;
  --attention: #fab219;
  --mal: #d03b3b;
  --police: Bahnschrift, "Arial Narrow", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* Un élément avec l'attribut "hidden" disparaît toujours, même si son style lui donne un "display" */
[hidden] { display: none !important; }

body {
  margin: 0;
  overflow: hidden;          /* pas de barre de défilement */
  background: var(--noir);
  font-family: var(--police);
  color: var(--texte);
}

canvas { display: block; }   /* le canvas est la zone où Three.js dessine */

h1, h2, h3 { text-transform: uppercase; letter-spacing: 0.08em; margin: 0; }

/* ---------- Boutons : coins coupés ---------- */
.bouton {
  padding: 10px 22px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--blanc);
  background: var(--surface-2);
  border: none;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.bouton:hover { background: #2a3947; }
.bouton.principal { background: var(--rouge); }
.bouton.principal:hover { background: var(--rouge-clair); }
.bouton.grand { padding: 16px 34px; font-size: 20px; }
.bouton:disabled { background: #3a4854; color: var(--discret); cursor: not-allowed; }
.bouton-danger {
  margin-top: 12px;
  padding: 8px 14px;
  background: transparent;
  color: #ec835a;
  border: 1px solid #ec835a;
  cursor: pointer;
}

/* ---------- Cartes ---------- */
.carte {
  background: var(--surface);
  border: 1px solid var(--bord);
  border-left: 3px solid var(--rouge);
  padding: 14px 16px;
}
.carte h3 { font-size: 17px; color: var(--texte); }
.carte p { margin: 6px 0; font-size: 14px; color: var(--texte-2); }
.sous-titre { margin: 2px 0 10px; font-size: 13px; color: var(--texte-2); }
.legende { font-size: 13px; color: var(--texte-2); margin: 8px 0 0; }
.vide { color: var(--texte-2); padding: 10px 0; }
.note { margin: 0; font-size: 13px; color: var(--texte-2); }

/* ---------- Chiffres clés ---------- */
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tuile { background: var(--surface); border: 1px solid var(--bord); padding: 12px; }
.tuile-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--discret); }
.tuile-valeur { font-size: 28px; font-weight: 700; color: var(--texte); margin-top: 4px; }
.tuile-delta { font-size: 12px; color: var(--texte-2); margin-top: 4px; }
.tuile-delta.haut { color: var(--bien); }
.tuile-delta.bas { color: #ec835a; }

/* =====================================================
   EN JEU : HUD, viseur, annonce, pause
   ===================================================== */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #00ffd5;
  pointer-events: none;
  z-index: 4;
  /* la couleur, la taille et la forme sont réglées par main.js */
}

#hud {
  position: fixed;
  top: 14px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 28px;
  pointer-events: none;
  z-index: 5;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}
#hud-gauche, #hud-droite { width: 230px; display: flex; flex-direction: column; padding-top: 8px; }
#hud-gauche { align-items: flex-end; }
#hud-droite { align-items: flex-start; }
.hud-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.2em; color: var(--rouge); }
#score, #combo { font-size: 34px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
#multiplicateur { font-size: 18px; font-weight: 700; color: var(--rouge); }

/* Le grand chrono central */
#hud-centre {
  min-width: 210px;
  padding: 6px 28px 10px;
  text-align: center;
  background: rgba(15, 25, 35, 0.78);
  clip-path: polygon(0 0, 100% 0, calc(100% - 16px) 100%, 16px 100%);
  text-shadow: none;
}
#timer { font-size: 58px; font-weight: 700; line-height: 1; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
#barre-temps { height: 4px; margin-top: 6px; background: rgba(236, 232, 225, 0.18); }
#barre-temps-remplie { height: 100%; width: 100%; background: var(--blanc); }
/* Dans les 10 dernières secondes : rouge et qui clignote doucement */
#hud-centre.urgent #timer { color: var(--rouge); animation: clignote 1s ease-in-out infinite; }
#hud-centre.urgent #barre-temps-remplie { background: var(--rouge); }
@keyframes clignote { 50% { opacity: 0.55; } }

/* Le temps de réaction, sous le viseur, qui s'estompe */
#reaction {
  position: fixed;
  top: calc(50% + 36px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 22px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}
#reaction.visible { animation: fondu 1.1s ease-out forwards; }
@keyframes fondu {
  0% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -14px); }
}

/* L'étape en cours pendant un échauffement */
#etape-hud {
  position: fixed;
  top: 112px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--blanc);
  pointer-events: none;
  z-index: 5;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}

/* Annonce + compte à rebours 3, 2, 1 */
#transition {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  background: rgba(15, 25, 35, 0.86);
  pointer-events: none;
}
#transition-etape { font-size: 18px; text-transform: uppercase; letter-spacing: 0.25em; color: var(--rouge); }
#transition-mode { font-size: 76px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
#transition-desc { font-size: 18px; max-width: 560px; color: var(--texte-2); }
#transition-compte { font-size: 130px; font-weight: 700; line-height: 1.1; }

/* Pause */
#pause {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 25, 35, 0.93);
}
#pause-boite {
  width: min(760px, 94vw);
  max-height: 94vh;
  overflow-y: auto;
  padding: 26px;
  background: var(--surface);
  border-left: 3px solid var(--rouge);
}
#pause-boite h2 { font-size: 34px; }
#pause-boite h3 { margin: 18px 0 10px; font-size: 16px; }
#pause-info { margin: 6px 0 16px; color: var(--texte-2); }
#pause-boutons { display: flex; flex-wrap: wrap; gap: 10px; }
#pause-message { min-height: 20px; margin: 10px 0 0; color: var(--attention); font-size: 14px; }

/* =====================================================
   LOBBY
   ===================================================== */
#start {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(135deg, rgba(255, 70, 85, 0.10) 0%, transparent 38%),
    repeating-linear-gradient(135deg, rgba(236, 232, 225, 0.018) 0 2px, transparent 2px 16px),
    var(--noir);
}

#barre-haut {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 64px;
  padding: 0 24px;
  background: rgba(15, 25, 35, 0.92);
  border-bottom: 1px solid var(--bord);
}
#logo { font-size: 22px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.16em; white-space: nowrap; }
#logo span { color: var(--rouge); }

#onglets { display: flex; gap: 2px; margin-left: 16px; height: 100%; }
.onglet {
  padding: 0 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--discret);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}
.onglet:hover { color: var(--blanc); }
.onglet.actif { color: var(--blanc); border-bottom-color: var(--rouge); }

#mini-profil { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.mini-texte { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.mini-texte strong { font-size: 15px; }
.mini-texte span { font-size: 12px; color: var(--discret); text-transform: uppercase; letter-spacing: 0.1em; }

#contenu {
  flex: 1;
  width: min(1060px, 100%);
  margin: 0 auto;
  padding: 24px;
  overflow-y: auto;
}
#accueil, #modes-panneau, #scenario, #echauffement, #diagnostic, #reglages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ----- Accueil ----- */
.profil { display: flex; align-items: center; gap: 22px; }
.profil-pseudo {
  width: 260px;
  padding: 2px 0;
  font-family: inherit;
  font-size: 26px;
  font-weight: 700;
  color: var(--blanc);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--bord);
}
.profil-pseudo:focus { outline: none; border-bottom-color: var(--rouge); }
.profil-niveau { margin: 8px 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--rouge); }
.profil-xp { margin-top: 4px; font-size: 12px; color: var(--discret); }
.profil-rang { margin-left: auto; text-align: right; display: flex; flex-direction: column; }
.profil-rang strong { font-size: 24px; text-transform: uppercase; letter-spacing: 0.06em; }
.barre { width: 280px; height: 6px; background: var(--grille); }
.barre.petite { width: 110px; height: 4px; margin-left: auto; }
.barre-remplie { height: 100%; background: var(--rouge); }

#accueil-actions { display: flex; flex-wrap: wrap; gap: 12px; }
#accueil-stats { display: flex; flex-direction: column; gap: 16px; }

.liste-rangs { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.ligne-rang { display: flex; align-items: center; gap: 14px; }
.ligne-rang-mode { width: 110px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--texte-2); }
.ligne-rang-nom { width: 120px; font-size: 18px; font-weight: 700; }

/* Résultats de la dernière partie */
#resultats h3 span { color: var(--rouge); }
.res-grille { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 16px; margin: 12px 0; }
.res-label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--discret); }
.res-grille > div > span:last-child { display: block; margin-top: 2px; font-size: 20px; font-weight: 700; }
.res-gros > span:last-child { font-size: 44px !important; color: var(--rouge); line-height: 1.1; }
#resultats p { margin: 4px 0; }
#res-rang { font-weight: 700; color: var(--blanc) !important; }
#res-xp { color: var(--rouge) !important; font-weight: 700; }
#res-rejouer { margin-top: 10px; }

/* ----- Page Modes ----- */
#grille-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.carte-mode {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 190px;
  padding: 18px;
  text-align: left;
  font-family: inherit;
  color: var(--blanc);
  background: var(--surface);
  border: 1px solid var(--bord);
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}
.carte-mode:hover { border-color: var(--rouge); }
.carte-mode.actif { border-color: var(--rouge); background: var(--surface-2); box-shadow: inset 4px 0 0 var(--rouge); }
.carte-nom { font-size: 24px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.carte-desc { flex: 1; font-size: 13px; color: var(--texte-2); }
.carte-stats { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--texte-2); }
.carte-rang { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--blanc); }
#mode-desc { margin: 0; color: var(--texte-2); }
#jouer { align-self: flex-start; }

/* ----- Playlists ----- */
.grille-playlists { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 10px; }
.carte-playlist {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px;
  background: var(--surface-2);
  border-left: 3px solid var(--rouge);
}
.carte-playlist strong { font-size: 17px; text-transform: uppercase; letter-spacing: 0.06em; }
.carte-playlist .bouton { margin-top: auto; }
.etapes { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.etape-choix { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface-2); font-size: 15px; cursor: pointer; }
.etape-choix input { width: 18px; height: 18px; accent-color: var(--rouge); }
.etape-choix small { margin-left: auto; color: var(--discret); }
.ecart-haut { color: var(--bien); }
.ecart-bas { color: #ec835a; }

/* ----- Réglages (dans le lobby, et dans la pause) ----- */
#reglages-bloc { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
#pause-reglages #reglages-bloc { grid-template-columns: 1fr; }
#reglages-bloc.en-pause .reglages-jeu { display: none; }   /* en pause, on ne change pas les réglages de la partie en cours */
.formulaire .carte { display: flex; flex-direction: column; gap: 4px; }
.formulaire label { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; font-size: 15px; }
.formulaire input, .formulaire select {
  width: 120px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 15px;
  color: var(--blanc);
  background: var(--surface-2);
  border: 1px solid var(--axe);
}
.formulaire input[type="color"] { width: 60px; height: 32px; padding: 0; }
.formulaire input[type="range"] { width: 150px; padding: 0; accent-color: var(--rouge); }
.formulaire input:focus, .formulaire select:focus { outline: 1px solid var(--rouge); }
.formulaire small { color: var(--discret); font-size: 12px; }
#cm360 { color: var(--rouge) !important; font-weight: 700; }

/* =====================================================
   DIAGNOSTIC ET BILANS
   ===================================================== */
.filtres { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
.groupe { display: flex; gap: 6px; flex-wrap: wrap; }
.puce {
  padding: 6px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--texte-2);
  background: var(--surface-2);
  border: 1px solid transparent;
  cursor: pointer;
}
.puce:hover { background: #2a3947; }
.puce.actif { border-color: var(--rouge); color: var(--blanc); }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .duo { grid-template-columns: 1fr; } }

/* Graphiques (SVG) */
.graphique { position: relative; }
.svg-graphique { display: block; width: 100%; height: auto; outline: none; }
.svg-graphique:focus-visible { outline: 2px solid var(--blanc); outline-offset: 2px; }
.g-grille { stroke: var(--grille); stroke-width: 1; }
.g-axe { stroke: var(--axe); stroke-width: 1; }
.g-texte { fill: var(--discret); font-size: 11px; }
.g-valeur { fill: var(--texte); font-size: 12px; font-weight: 600; }
.g-ligne { fill: none; stroke: var(--serie); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.g-aire { fill: var(--serie); opacity: 0.1; }
.g-point { fill: var(--serie); stroke: var(--surface); stroke-width: 2; }   /* anneau de la couleur du fond */
.g-point.leger { opacity: 0.75; }
.g-point.survol { fill: var(--serie-clair); opacity: 1; }
.g-barre { fill: var(--serie); }
.g-barre.survol { fill: var(--serie-clair); }
.g-croix { stroke: var(--discret); stroke-width: 1; }
.g-moyenne { fill: none; stroke: var(--texte); stroke-width: 2; }
.g-zone { fill: transparent; outline: none; }
.g-zone:focus-visible { stroke: var(--blanc); stroke-width: 2; }

/* Infobulle */
.infobulle {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  color: var(--texte-2);
  white-space: nowrap;
}
.infobulle strong { display: block; font-size: 16px; color: var(--texte); }
.infobulle-ligne { margin-top: 2px; }
.cle { display: inline-block; width: 12px; height: 2px; background: var(--serie); margin-right: 6px; vertical-align: middle; }

/* Tableaux */
details.donnees { margin-top: 10px; font-size: 13px; color: var(--texte-2); }
details.donnees summary { cursor: pointer; }
#diagnostic table, #echauffement table { border-collapse: collapse; width: 100%; margin-top: 8px; font-size: 13px; }
#diagnostic th, #echauffement th { text-align: left; color: var(--discret); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--axe); }
#diagnostic td, #echauffement td { padding: 6px 8px; color: var(--texte-2); border-bottom: 1px solid var(--grille); font-variant-numeric: tabular-nums; }

/* Conseils (diagnostic et bilan d'échauffement) */
.conseils { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.conseil { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--bord); }
.conseil .badge { flex: 0 0 120px; display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--texte-2); }
.conseil .icone { font-size: 15px; }
.conseil.bien .icone { color: var(--bien); }
.conseil.attention .icone { color: var(--attention); }
.conseil.mal .icone { color: var(--mal); }
.conseil.info .icone { color: var(--discret); }
.conseil strong { color: var(--texte); }
.conseil p { margin: 2px 0 0; font-size: 14px; color: var(--texte-2); }

/* =====================================================
   ARMES : munitions, lunette, marqueur de touche
   ===================================================== */
#hud-arme {
  position: fixed;
  right: 28px;
  bottom: 24px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}
#arme-nom { font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.2em; color: var(--rouge); }
#arme-etat { min-height: 20px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--blanc); }

/* Lunette (zoom ×2,5 et plus) : tout est noir sauf un cercle au centre, avec un réticule fin */
#lunette {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(#000, #000) center / 1px 100% no-repeat,
    linear-gradient(#000, #000) center / 100% 1px no-repeat,
    radial-gradient(circle at center, transparent 0, transparent 33vh, #000 33.4vh);
}

/* Marqueur de touche : une petite croix qui apparaît une fraction de seconde au centre */
#hitmarker { position: fixed; top: 50%; left: 50%; width: 0; height: 0; z-index: 4; pointer-events: none; opacity: 0; }
#hitmarker::before, #hitmarker::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 2px;
  left: -11px;
  top: -1px;
  background: var(--blanc);
}
#hitmarker::before { transform: rotate(45deg); }
#hitmarker::after { transform: rotate(-45deg); }
#hitmarker.visible { animation: marqueur 0.22s ease-out forwards; }
@keyframes marqueur { 0% { opacity: 1; transform: scale(0.8); } 100% { opacity: 0; transform: scale(1.3); } }

/* Choix de l'arme (page Modes) */
.titre-section { margin-top: 8px; font-size: 16px; color: var(--discret); }
.grille-armes-cat { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 6px; }
.arme-cat { margin: 12px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--discret); }
.arme {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  text-align: left;
  font-family: inherit;
  color: var(--blanc);
  background: var(--surface);
  border: 1px solid var(--bord);
  cursor: pointer;
}
.arme strong { font-size: 18px; text-transform: uppercase; letter-spacing: 0.08em; }
.arme span { font-size: 12px; color: var(--texte-2); }
.arme:hover { border-color: var(--rouge); }
.arme.actif { border-color: var(--rouge); background: var(--surface-2); box-shadow: inset 3px 0 0 var(--rouge); }
#arme-desc { margin: 0; color: var(--texte-2); }

/* =====================================================
   PRÉPARATION (choix du mode et de l'arme avant de lancer)
   ===================================================== */
#preparation {
  position: fixed;
  inset: 0;
  z-index: 11;                      /* au-dessus du lobby (10), sous la pause (12) */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 25, 35, 0.92);
}
#prep-boite {
  width: min(860px, 94vw);
  max-height: 94vh;
  overflow-y: auto;
  padding: 26px;
  background: var(--surface);
  border-left: 3px solid var(--rouge);
}
#prep-boite h2 { font-size: 32px; }
#prep-boite h3 { margin: 18px 0 10px; font-size: 15px; color: var(--discret); }
#prep-sous-titre { margin: 6px 0 0; color: var(--texte-2); }
#prep-modes { display: flex; flex-wrap: wrap; gap: 8px; }
#prep-desc { min-height: 42px; margin: 12px 0 0; color: var(--texte-2); }
#prep-boutons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }

/* Aperçu 3D de l'arme (écran de préparation) */
#prep-apercu {
  display: block;
  width: 100%;
  max-width: 640px;
  height: auto;
  margin: 0 auto 10px;
  background: radial-gradient(circle at 50% 60%, #243241 0, #121a23 70%);
  border: 1px solid var(--bord);
}

/* =====================================================
   SCÉNARIO DÉFENSE : interface en jeu
   ===================================================== */
#def-hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; font-family: var(--police); }
#def-hud > * { position: absolute; }

#def-minimap {
  top: 14px;
  left: 14px;
  border: 1px solid var(--bord);
  background: #0b121a;
  opacity: 0.92;
}

#def-haut { top: 12px; left: 50%; transform: translateX(-50%); text-align: center; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
#def-timer { font-size: 52px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
#def-timer.spike { color: var(--rouge); }
#def-timer.urgent { animation: clignote 1s ease-in-out infinite; }
#def-info { margin-top: 4px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--blanc); }

#def-sante { left: 28px; bottom: 26px; display: flex; flex-direction: column; gap: 8px; }
.def-barre {
  position: relative;
  width: 260px;
  height: 22px;
  background: rgba(15, 25, 35, 0.8);
  border: 1px solid var(--bord);
}
.def-barre > div { height: 100%; }
.def-barre span {
  position: absolute;
  right: 8px;
  top: 0;
  line-height: 22px;
  font-size: 15px;
  font-weight: 700;
  text-shadow: 0 1px 3px #000;
}
.def-barre.vie > div { background: #3fbf6a; width: 100%; }
.def-barre.bouclier > div { background: #4aa8e8; width: 100%; }

#def-messages {
  top: 150px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}
#def-messages div { margin-bottom: 6px; color: var(--blanc); }

#def-defuse { left: 50%; top: 62%; transform: translateX(-50%); width: 320px; text-align: center; }
#def-defuse span { display: block; margin-bottom: 6px; font-size: 16px; font-weight: 700; text-shadow: 0 1px 6px #000; }
.def-defuse-barre { height: 10px; background: rgba(15, 25, 35, 0.85); border: 1px solid var(--bord); }
#def-defuse-remplie { height: 100%; width: 0; background: var(--rouge); }

#def-flux {
  top: 14px;
  right: 18px;
  text-align: right;
  font-size: 15px;
  text-shadow: 0 1px 4px #000;
}
#def-flux div { margin-bottom: 4px; padding: 3px 10px; background: rgba(15, 25, 35, 0.7); border-right: 3px solid var(--rouge); }

/* Le flash rouge quand on est touché */
#def-flash {
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at center, transparent 35%, rgba(255, 30, 40, 0.55) 100%);
}
#def-flash.actif { animation: degats 0.5s ease-out; }
@keyframes degats { 0% { opacity: 1; } 100% { opacity: 0; } }

/* La flèche qui montre d'où vient le tir (on la fait pivoter autour du centre de l'écran) */
#def-dir {
  top: 50%;
  left: 50%;
  width: 240px;
  height: 240px;
  margin: -120px 0 0 -120px;
  opacity: 0;
}
#def-dir::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: -16px;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-bottom: 34px solid var(--rouge);
}
#def-dir.actif { animation: degats 1.1s ease-out; }

/* Écran de résultats */
#defense-fin {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 25, 35, 0.93);
}
#defense-fin-boite { width: min(560px, 94vw); padding: 28px; background: var(--surface); border-left: 3px solid var(--rouge); }
#defense-fin-titre { font-size: 48px; }
#defense-fin-titre.victoire { color: var(--bien); }
#defense-fin-titre.defaite { color: var(--rouge); }
#defense-fin-raison { margin: 6px 0 18px; font-size: 18px; color: var(--texte-2); }
#defense-fin-stats div { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--grille); font-size: 16px; }
#defense-fin-stats span { color: var(--discret); }
#defense-fin-boutons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }

/* Onglet Scénario */
.touches-aide { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.touches-aide > div { display: flex; align-items: center; gap: 14px; font-size: 15px; color: var(--texte-2); }
.touches-aide kbd {
  min-width: 190px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  color: var(--blanc);
  background: var(--surface-2);
  border: 1px solid var(--axe);
}
.historique { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.historique th { text-align: left; color: var(--discret); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--axe); }
.historique td { padding: 6px 8px; color: var(--texte-2); border-bottom: 1px solid var(--grille); }

/* =====================================================
   SCÉNARIO DÉFENSE : lieu, score, phase d'achat
   ===================================================== */
#def-lieu {
  top: 248px;
  left: 14px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  background: rgba(15, 25, 35, 0.8);
  border-left: 3px solid var(--rouge);
  text-shadow: 0 1px 3px #000;
}
#def-score { margin-top: 2px; font-size: 13px; letter-spacing: 0.1em; color: var(--texte-2); text-transform: uppercase; }

#achat {
  position: fixed;
  inset: 0;
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 25, 35, 0.78);
}
#achat-boite {
  width: min(900px, 95vw);
  max-height: 94vh;
  overflow-y: auto;
  padding: 24px 28px;
  background: var(--surface);
  border-left: 3px solid var(--rouge);
}
#achat-boite h2 { font-size: 32px; }
.achat-score { margin: 6px 0 0; color: var(--texte-2); }
.achat-credits { margin: 8px 0 2px; font-size: 26px; font-weight: 700; color: var(--rouge); }
.achat-credits.bas { color: var(--attention); }
.achat-alerte { margin: 8px 0; padding: 8px 12px; background: rgba(250, 178, 25, 0.12); border-left: 3px solid var(--attention); color: var(--blanc); }
.achat-boutons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.arme:disabled { opacity: 0.4; cursor: not-allowed; }
.arme:disabled:hover { border-color: var(--bord); }

/* Les dégâts infligés, à côté du viseur */
#degats-pop {
  top: calc(50% - 14px);
  left: calc(50% + 28px);
  font-size: 22px;
  font-weight: 700;
  color: var(--blanc);
  opacity: 0;
  text-shadow: 0 1px 4px #000;
}
#degats-pop.tete { color: var(--rouge); font-size: 28px; }
#degats-pop.visible { animation: degatsPop 0.9s ease-out forwards; }
@keyframes degatsPop {
  0% { opacity: 1; transform: translate(0, 0); }
  100% { opacity: 0; transform: translate(14px, -22px); }
}

/* Les deux armes (principale et secondaire), en bas au centre */
#def-armes { bottom: 26px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; }
.def-arme {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--discret);
  background: rgba(15, 25, 35, 0.78);
  border-left: 3px solid var(--bord);
  text-shadow: 0 1px 3px #000;
}
.def-arme.en-main { border-left-color: var(--rouge); color: var(--blanc); }
.def-arme.vide { opacity: 0.45; }
.def-arme-touche { min-width: 20px; padding: 1px 6px; text-align: center; font-weight: 700; color: var(--blanc); background: var(--surface-2); }
.achat-equipement { margin: 4px 0 2px; font-size: 16px; color: var(--blanc); }

/* Le compteur en bas au centre : éliminations, bouclier, vie */
#def-vitalite {
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 250px;
  text-align: center;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}
#def-elims { min-height: 22px; font-size: 14px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--rouge); }
#def-vital-rangee { display: flex; align-items: flex-end; justify-content: center; gap: 22px; }
#def-vital-vie #def-vie { font-size: 64px; font-weight: 700; line-height: 0.95; font-variant-numeric: tabular-nums; }
#def-vital-bouclier { display: flex; align-items: center; gap: 6px; padding-bottom: 6px; font-size: 26px; font-weight: 700; color: #7cc4ff; }
.def-icone-bouclier { font-size: 22px; }
#def-vitalite .def-barres { display: flex; gap: 4px; margin-top: 6px; }
#def-vitalite .def-barre { position: relative; flex: 1; height: 6px; background: rgba(15, 25, 35, 0.8); border: none; }
#def-vitalite .def-barre.bouclier { flex: 0.5; }
#def-vitalite .def-barre > div { height: 100%; }
#def-vitalite.critique #def-vie { color: var(--rouge); animation: clignote 0.8s ease-in-out infinite; }

/* Les deux armes : en bas à droite, au-dessus du nom de l'arme */
#def-armes { bottom: 92px !important; left: auto !important; right: 28px; transform: none !important; flex-direction: column; align-items: flex-end; gap: 6px; }

/* ===== Le bas de l'écran façon Valorant ===== */
/* Vie et bouclier à gauche du centre, capacités à droite du centre, munitions en bas à droite */
#def-vitalite { left: calc(50% - 130px) !important; transform: translateX(-50%) !important; min-width: 220px !important; }
#def-capacites { bottom: 22px; left: calc(50% + 10px); display: flex; gap: 8px; }
.def-cap { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 46px; opacity: 0.55; }
.def-cap b { width: 100%; padding: 8px 0; text-align: center; font-size: 18px; color: var(--blanc); background: rgba(15, 25, 35, 0.85); border-bottom: 2px solid var(--bord); }
.def-cap.def-ulti b { border-bottom-color: var(--rouge); }
.def-pastilles { display: flex; gap: 3px; height: 6px; font-style: normal; }
.def-pastilles u { width: 6px; height: 6px; transform: rotate(45deg); background: var(--discret); }
.def-cap.def-ulti .def-pastilles u { width: 5px; height: 5px; }
#def-credits { bottom: 94px; left: calc(50% + 10px); font-size: 18px; font-weight: 700; letter-spacing: 0.08em; color: #9be4a8; text-shadow: 0 1px 4px #000; }
#def-mun { bottom: 22px; right: 28px; min-width: 150px; text-align: right; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9); }
#def-mun-nom { font-size: 14px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--discret); }
#def-mun-chiffres { display: flex; justify-content: flex-end; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; }
#def-mun-ch { font-size: 54px; font-weight: 700; line-height: 1; color: var(--blanc); }
.def-mun-sep { font-size: 26px; color: var(--discret); }
#def-mun-res { font-size: 26px; font-weight: 700; color: var(--discret); }
#def-mun.bas #def-mun-ch { color: var(--rouge); }
#def-mun-recharge { margin-top: 4px; font-size: 12px; letter-spacing: 0.2em; color: var(--blanc); }
.def-mun-barre { height: 4px; margin-top: 3px; background: rgba(15, 25, 35, 0.85); }
#def-mun-recharge-barre { height: 100%; width: 0; background: var(--blanc); }

/* Le compteur de FPS (réglage « Afficher les FPS ») */
#fps { position: fixed; top: 8px; right: 10px; z-index: 50; padding: 2px 8px; font-size: 13px; font-weight: 700; color: #9be4a8; background: rgba(15, 25, 35, 0.7); pointer-events: none; }

/* ===== Agents et capacités ===== */
.def-cap { width: 74px !important; opacity: 0.5 !important; position: relative; }
.def-cap.pret { opacity: 1 !important; }
.def-cap.pret b { border-bottom-color: var(--blanc); }
.def-cap.actif b { background: var(--rouge); }
.def-cap em { font-style: normal; font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--texte-2); text-align: center; line-height: 1.1; min-height: 22px; text-shadow: 0 1px 3px #000; }
.def-cap-etat { font-size: 13px; font-weight: 700; color: var(--blanc); text-shadow: 0 1px 3px #000; }
#def-capacites { left: calc(50% + 6px) !important; }
.agent-grille { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.agent-carte { display: flex; flex-direction: column; align-items: flex-start; min-width: 104px; padding: 8px 12px; color: var(--blanc); background: var(--surface-2); border: 1px solid var(--bord); border-top: 3px solid var(--bord); cursor: pointer; }
.agent-carte span { font-size: 12px; color: var(--texte-2); }
.agent-carte:hover { background: #2a3947; }
.agent-carte.actif { border-color: var(--rouge); background: rgba(255, 70, 85, 0.14); }
.agent-capacites { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.agent-cap { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: rgba(15, 25, 35, 0.7); border-left: 3px solid var(--bord); }
.agent-cap kbd { min-width: 28px; padding: 4px 8px; text-align: center; font-weight: 700; color: var(--blanc); background: var(--surface-2); }
.agent-cap-texte { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.agent-cap-texte span { font-size: 13px; color: var(--texte-2); }
.agent-cap-achat { display: flex; align-items: center; gap: 8px; min-width: 190px; justify-content: flex-end; font-size: 13px; color: var(--texte-2); }
.agent-btn { width: 28px; height: 28px; font-size: 18px; line-height: 1; color: var(--blanc); background: var(--surface-2); border: 1px solid var(--bord); cursor: pointer; }
.agent-btn:disabled { opacity: 0.35; cursor: default; }

/* Les effets plein écran des capacités */
#def-ecran { inset: 0; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
#def-ecran[class^="ecran-"] { opacity: 1; }
.ecran-scan { box-shadow: inset 0 0 200px 50px rgba(60, 200, 255, 0.35); }
.ecran-soin { box-shadow: inset 0 0 170px 35px rgba(80, 255, 140, 0.32); }
.ecran-buff { box-shadow: inset 0 0 170px 35px rgba(255, 170, 60, 0.28); }
.ecran-dash { box-shadow: inset 0 0 220px 70px rgba(255, 255, 255, 0.22); }
.ecran-retour { box-shadow: inset 0 0 200px 60px rgba(255, 140, 40, 0.4); }

/* Aveuglé par une flash ennemie */
#def-ecran.ecran-aveugle { background: #fff; }

.agent-haut { display: flex; gap: 16px; align-items: flex-start; }
.agent-haut .agent-grille { flex: 1; }
.agent-vue { flex: 0 0 220px; height: 300px; background: rgba(15, 25, 35, 0.6); border: 1px solid var(--bord); }
.agent-vue canvas { display: block; width: 220px; height: 300px; }

/* =====================================================
   FINITIONS : accessibilité, notifications, aide, environnement
   ===================================================== */

/* Le focus au clavier est toujours visible (Tab) */
:focus-visible { outline: 2px solid var(--rouge-clair); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }
::selection { background: rgba(255, 70, 85, 0.35); }

/* Des barres de défilement discrètes */
* { scrollbar-width: thin; scrollbar-color: #3a4854 transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #3a4854; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #4c5c6b; }

/* Pour les personnes sensibles aux animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

.bouton.petit { padding: 5px 12px; font-size: 13px; }
.bouton.danger { background: #5a1f27; }
.bouton.danger:hover { background: #7a2a35; }

/* L'écran d'attente au chargement */
#chargement {
  position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--noir); transition: opacity 0.4s;
}
#chargement.fini { opacity: 0; pointer-events: none; }
#chargement-logo { font-size: 34px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
#chargement-logo span { color: var(--rouge); }
#chargement-barre { width: 220px; height: 4px; background: var(--surface-2); overflow: hidden; }
#chargement-barre i { display: block; height: 100%; width: 40%; background: var(--rouge); animation: chargement 1s ease-in-out infinite; }
#chargement p { margin: 0; font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--discret); }
@keyframes chargement { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

/* Le message d'erreur lisible */
#erreur-globale { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(8, 12, 18, 0.9); }
#erreur-boite { width: min(680px, 100%); max-height: 90vh; overflow: auto; padding: 26px 30px; background: var(--surface); border-top: 4px solid var(--rouge); }
#erreur-boite h2 { font-size: 22px; margin-bottom: 8px; }
#erreur-boite p { color: var(--texte-2); }
#erreur-detail { max-height: 200px; overflow: auto; margin: 12px 0; padding: 10px 12px; font: 12px/1.45 Consolas, monospace; color: #ffb4bb; background: #0b121a; white-space: pre-wrap; word-break: break-word; }
#erreur-boutons { display: flex; flex-wrap: wrap; gap: 10px; }

/* Les notifications (toasts) */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 1500; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { padding: 10px 16px; font-size: 14px; color: var(--blanc); background: #223140; border-left: 3px solid var(--serie); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45); animation: entree-toast 0.25s ease-out; }
.toast.ok { border-left-color: var(--bien); }
.toast.erreur { border-left-color: var(--mal); }
.toast.sortie { opacity: 0; transform: translateX(20px); transition: all 0.3s; }
@keyframes entree-toast { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* Premiers pas */
#premiers-pas { margin-bottom: 16px; }
.pp-tete { display: flex; align-items: baseline; justify-content: space-between; }
.pp-compte { font-size: 14px; color: var(--discret); }
.pp-ligne { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--bord); }
.pp-ligne.fait .pp-texte { color: var(--discret); text-decoration: line-through; }
.pp-coche { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; font-size: 14px; color: var(--blanc); border: 2px solid var(--bord); }
.pp-ligne.fait .pp-coche { background: var(--bien); border-color: var(--bien); }
.pp-texte { flex: 1; font-size: 15px; }
#premiers-pas > .bouton { margin-top: 10px; }

/* Aide */
.glossaire { margin: 0; display: grid; grid-template-columns: 170px 1fr; gap: 8px 18px; }
.glossaire dt { font-weight: 700; color: var(--blanc); }
.glossaire dd { margin: 0; color: var(--texte-2); font-size: 14px; }
#raccourcis { position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(8, 12, 18, 0.82); }
#raccourcis-boite { width: min(640px, 100%); max-height: 88vh; overflow: auto; padding: 24px 28px; background: var(--surface); border-top: 4px solid var(--rouge); }
#raccourcis-boite .bouton { margin-top: 16px; }

/* Modes : texte d'aide sur plusieurs lignes */
#mode-desc { white-space: pre-line; line-height: 1.5; }

/* Environnement */
.env-carte canvas { display: block; width: 100%; height: auto; margin-bottom: 10px; border: 1px solid var(--bord); }
.env-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.env-presets .puce { display: inline-flex; align-items: center; gap: 7px; }
.env-presets .puce i { display: inline-block; width: 18px; height: 18px; border: 1px solid var(--bord); }
.env-titre { margin: 14px 0 4px; font-size: 14px; color: var(--texte-2); text-transform: uppercase; letter-spacing: 0.08em; }
.reglages-jeu > small:first-of-type { display: block; margin-top: 6px; }

/* =====================================================
   RÉGLAGES PAR CATÉGORIES
   ===================================================== */
#reglages-bloc { display: block; }
.reg-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; align-items: start; }
.reg-menu { position: sticky; top: 8px; display: flex; flex-direction: column; gap: 3px; }
.reg-menu button {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; text-align: left; font: inherit; font-size: 15px;
  letter-spacing: 0.07em; text-transform: uppercase; color: var(--texte-2); background: transparent; cursor: pointer;
  border: 0; border-left: 3px solid transparent; transition: background 0.15s, color 0.15s;
}
.reg-menu button:hover { background: var(--surface-2); color: var(--blanc); }
.reg-menu button.actif { background: var(--surface); color: var(--blanc); border-left-color: var(--rouge); }
.reg-menu button.sans-resultat { opacity: 0.35; }
.reg-icone { width: 18px; text-align: center; color: var(--rouge); }
.reg-contenu { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.reg-barre input { width: 100%; padding: 10px 14px; font: inherit; font-size: 15px; color: var(--texte); background: var(--surface); border: 1px solid var(--bord); }
.reg-panneau { display: flex; flex-direction: column; gap: 14px; }
.reg-panneau .carte { max-width: 780px; }
.reg-entete { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--bord); }
.reg-titre { font-size: 26px; }
.reg-desc { margin: 2px 0 0; font-size: 14px; color: var(--discret); }

/* Le résumé */
.hub-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 8px; }
.hub-tuile {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; text-align: left; font: inherit; color: var(--texte);
  background: var(--surface-2); border: 1px solid var(--bord); border-top: 3px solid var(--bord); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.hub-tuile:hover { background: #2a3947; border-top-color: var(--rouge); }
.hub-titre { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--discret); }
.hub-valeur { font-size: 22px; color: var(--blanc); }
.hub-detail { font-size: 13px; color: var(--texte-2); }

/* Les touches */
.touche-ligne { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--bord); }
.touche-nom { flex: 1; font-size: 15px; }
.touche-bouton {
  min-width: 140px; padding: 6px 12px; font: inherit; font-size: 14px; font-weight: 700; letter-spacing: 0.05em; text-align: center;
  color: var(--blanc); background: var(--surface-2); border: 1px solid var(--bord); cursor: pointer;
}
.touche-bouton:hover { background: #2a3947; }
.touche-bouton.modifiee { border-color: var(--attention); }
.touche-bouton.attente { color: var(--noir); background: var(--attention); animation: clignote 0.8s ease-in-out infinite; }
.touche-reset { width: 30px; height: 30px; font-size: 16px; color: var(--texte-2); background: transparent; border: 1px solid var(--bord); cursor: pointer; }
.touche-reset:hover { color: var(--blanc); background: var(--surface-2); }

/* En pause : le menu passe en haut, et les réglages du jeu en cours ne se changent pas */
.en-pause .reg-layout { grid-template-columns: 1fr; gap: 12px; }
.en-pause .reg-menu { position: static; flex-direction: row; flex-wrap: wrap; }
.en-pause .reg-menu button { padding: 8px 12px; font-size: 13px; }
.en-pause .reg-menu button[data-cat="jeu"], .en-pause .reg-panneau[data-cat="jeu"], .en-pause .reg-panneau[data-cat="donnees"], .en-pause .reg-menu button[data-cat="donnees"] { display: none; }
@media (max-width: 860px) {
  .reg-layout { grid-template-columns: 1fr; gap: 12px; }
  .reg-menu { position: static; flex-direction: row; flex-wrap: wrap; }
  .reg-menu button { padding: 8px 12px; font-size: 13px; }
}

/* Le niveau des bots : curseurs du mode personnalisé */
.diff-curseurs { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding: 10px 14px; background: rgba(15, 25, 35, 0.6); border-left: 3px solid var(--rouge); }
.diff-curseurs label { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; }
.diff-curseurs input[type="range"] { width: 180px; accent-color: var(--rouge); }
#prep-bloc-diff .sous-titre { margin: 4px 0 0; }

/* Le bandeau de crédits (Riot Games) en bas du lobby, et la section crédits de l'aide */
#credits-bas { padding: 14px 28px; font-size: 13px; letter-spacing: 0.04em; color: var(--texte-2); text-align: center; border-top: 1px solid var(--bord); background: rgba(15, 25, 35, 0.6); }
#credits-bas strong { color: var(--blanc); }
#credits-bas a { color: var(--rouge-clair); text-decoration: none; }
#credits-bas a:hover { text-decoration: underline; }
.credits-riot { margin: 10px 0; padding: 12px 16px; border-left: 3px solid var(--rouge); background: rgba(255, 70, 85, 0.07); }
.credits-riot h4 { margin: 0 0 6px; font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; }
.credits-riot .bouton { display: inline-block; margin-top: 8px; text-decoration: none; }

/* =====================================================
   DESIGN SYSTEM — une seule échelle pour tout le site
   (espacements, tailles de texte, cartes, boutons, champs).
   Ce bloc vient en dernier : il harmonise les styles plus anciens au-dessus.
   ===================================================== */
:root {
  --e1: 4px; --e2: 8px; --e3: 12px; --e4: 16px; --e5: 24px; --e6: 32px;     /* les espacements */
  --rayon: 4px;                                                                 /* un seul arrondi, discret */
  --surface: #141e28;
  --surface-2: #1b2732;
  --surface-3: #233140;
  --bord: rgba(236, 232, 225, 0.09);
  --bord-fort: rgba(236, 232, 225, 0.18);
  --ombre: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.25);
  --transition: 140ms ease;
}
body { font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }

/* ---- Le fond du lobby : un dégradé calme, sans rayures ---- */
#start {
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(255, 70, 85, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(57, 135, 229, 0.08), transparent 60%),
    var(--noir) !important;
}

/* ---- La barre du haut ---- */
#barre-haut {
  height: 60px; padding: 0 var(--e5); gap: var(--e5);
  background: rgba(10, 17, 24, 0.82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bord);
}
#logo { font-size: 18px; letter-spacing: 0.2em; }
#onglets { gap: 0; margin-left: var(--e4); }
.onglet {
  position: relative; padding: 0 var(--e4); font-size: 13px; letter-spacing: 0.14em;
  border-bottom: 0 !important; transition: color var(--transition);
}
.onglet::after {
  content: ''; position: absolute; left: var(--e4); right: var(--e4); bottom: 0; height: 2px;
  background: var(--rouge); transform: scaleX(0); transition: transform var(--transition);
}
.onglet:hover::after { transform: scaleX(0.4); }
.onglet.actif::after { transform: scaleX(1); }

/* ---- Le contenu et le titre de chaque page ---- */
#contenu { width: min(1180px, 100%); padding: var(--e6) var(--e5) 48px; }
#page-entete { margin-bottom: var(--e5); }
#page-titre { font-size: 34px; line-height: 1.1; letter-spacing: 0.06em; }
#page-sous-titre { margin: var(--e2) 0 0; color: var(--discret); font-size: 15px; }
#accueil, #modes-panneau, #scenario, #echauffement, #diagnostic, #reglages, #aide { gap: var(--e5) !important; }

/* ---- Les cartes : sobres, toutes pareilles. Le rouge est réservé à ce qui est actif ou important ---- */
.carte {
  padding: var(--e5) !important;
  background: linear-gradient(180deg, var(--surface-2), var(--surface)) !important;
  border: 1px solid var(--bord) !important;
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
}
.carte > h3:first-child, .carte > .reg-entete:first-child { margin-bottom: var(--e3); }
.carte h3 { font-size: 15px; letter-spacing: 0.12em; color: var(--blanc); }
.carte p { font-size: 14px; line-height: 1.55; color: var(--texte-2); }
.titre-section, h3.titre-section {
  margin: var(--e5) 0 var(--e2) !important; font-size: 12px !important; letter-spacing: 0.16em; color: var(--discret) !important;
}
.sous-titre { color: var(--discret) !important; line-height: 1.5; }
h4.arme-cat { margin: var(--e5) 0 var(--e2); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--discret); }

/* ---- Les boutons : deux styles seulement (principal et secondaire), même hauteur ---- */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--e2);
  min-height: 40px; padding: 0 var(--e5); font-size: 13px; letter-spacing: 0.14em;
  background: var(--surface-3); border: 1px solid var(--bord-fort); border-radius: var(--rayon);
  clip-path: none; transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.bouton:hover { background: #2c3c4c; border-color: rgba(236, 232, 225, 0.3); }
.bouton:active { transform: translateY(1px); }
.bouton.principal { background: var(--rouge); border-color: var(--rouge); }
.bouton.principal:hover { background: var(--rouge-clair); border-color: var(--rouge-clair); }
.bouton.grand { min-height: 52px; padding: 0 var(--e6); font-size: 15px; }
.bouton.petit { min-height: 30px; padding: 0 var(--e3); font-size: 11px; }
.bouton.danger { background: transparent; color: #ff8a94; border-color: rgba(255, 70, 85, 0.45); }
.bouton.danger:hover { background: rgba(255, 70, 85, 0.12); }

/* ---- Les puces (choix rapides) ---- */
.groupe { gap: var(--e2); }
.puce {
  min-height: 34px; padding: 0 var(--e4); border-radius: var(--rayon) !important;
  background: var(--surface-3) !important; border: 1px solid var(--bord-fort) !important;
  transition: background var(--transition), border-color var(--transition);
}
.puce:hover { background: #2c3c4c !important; }
.puce.actif { background: rgba(255, 70, 85, 0.14) !important; border-color: var(--rouge) !important; color: var(--blanc); }

/* ---- Les cartes de choix (modes du scénario) ---- */
.choix-cartes { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--e3); margin-top: var(--e3); }
.choix-carte {
  display: flex; flex-direction: column; gap: var(--e1); padding: var(--e4); text-align: left; font: inherit; color: var(--texte-2);
  background: var(--surface-3); border: 1px solid var(--bord-fort); border-top: 3px solid transparent; border-radius: var(--rayon); cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.choix-carte strong { font-size: 17px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--blanc); }
.choix-carte span { font-size: 13px; line-height: 1.45; }
.choix-carte:hover { background: #2c3c4c; transform: translateY(-2px); }
.choix-carte.actif { border-color: var(--rouge); border-top-color: var(--rouge); background: rgba(255, 70, 85, 0.10); }

/* ---- Les cartes de la page Modes ---- */
#grille-modes { gap: var(--e4) !important; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important; }
.carte-mode {
  min-height: 170px !important; padding: var(--e5) !important; clip-path: none !important;
  background: linear-gradient(180deg, var(--surface-2), var(--surface)) !important;
  border: 1px solid var(--bord) !important; border-top: 3px solid transparent !important; border-radius: var(--rayon);
  box-shadow: var(--ombre) !important; transition: transform var(--transition), border-color var(--transition);
}
.carte-mode:hover { transform: translateY(-2px); border-color: var(--bord-fort) !important; }
.carte-mode.actif { border-color: var(--rouge) !important; border-top-color: var(--rouge) !important; background: linear-gradient(180deg, rgba(255, 70, 85, 0.10), var(--surface)) !important; box-shadow: var(--ombre) !important; }
.carte-nom { font-size: 20px !important; }
#mode-desc { padding: var(--e4) var(--e5); background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); }

/* ---- Les cartes d'armes, d'agents, de playlists ---- */
.arme, .agent-carte, .carte-playlist, .hub-tuile, .tuile {
  border-radius: var(--rayon) !important; clip-path: none !important;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.carte-playlist { background: var(--surface-3) !important; border: 1px solid var(--bord-fort) !important; border-left: 1px solid var(--bord-fort) !important; padding: var(--e4) !important; }
.arme:hover, .agent-carte:hover, .carte-playlist:hover { transform: translateY(-1px); }

/* ---- Les champs de formulaire ---- */
.formulaire input, .formulaire select, .reg-barre input, select, input[type="number"], input[type="text"], input[type="search"] {
  min-height: 36px; border-radius: var(--rayon); border: 1px solid var(--bord-fort) !important; background: var(--noir) !important;
  transition: border-color var(--transition);
}
.formulaire input:focus, .formulaire select:focus, .reg-barre input:focus { outline: none !important; border-color: var(--rouge) !important; }
.formulaire label { padding: var(--e2) 0 !important; border-bottom: 1px solid var(--bord); }
.formulaire label:last-of-type { border-bottom: 0; }

/* ---- Les tableaux ---- */
table.historique { width: 100%; border-collapse: collapse; font-size: 14px; }
table.historique th { padding: var(--e2) var(--e3); text-align: left; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--discret); border-bottom: 1px solid var(--bord-fort); }
table.historique td { padding: var(--e2) var(--e3); border-bottom: 1px solid var(--bord); }
table.historique tbody tr:hover { background: rgba(255, 255, 255, 0.025); }

/* ---- Les réglages ---- */
.reg-menu button { border-radius: var(--rayon); }
.reg-titre { font-size: 22px !important; }

/* ---- Le bandeau de crédits ---- */
#credits-bas { font-size: 12px; color: var(--discret); background: transparent; }

/* ---- Écrans moyens et petits ---- */
@media (max-width: 900px) {
  #barre-haut { overflow-x: auto; }
  #contenu { padding: var(--e5) var(--e4) 40px; }
  #page-titre { font-size: 26px; }
}

/* =====================================================
   SÉLECTION D'AGENT (plein écran, avant le match)
   ===================================================== */
#selection {
  --agent: #ff4655; --agent-sombre: #1b2732;
  position: fixed; inset: 0; z-index: 60; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden;
  background:
    radial-gradient(900px 700px at 30% 45%, color-mix(in srgb, var(--agent) 32%, transparent), transparent 65%),
    linear-gradient(160deg, color-mix(in srgb, var(--agent-sombre) 70%, #05080c), #070b10 70%);
  animation: sel-entree 0.35s ease-out;
}
@keyframes sel-entree { from { opacity: 0; } to { opacity: 1; } }
.sel-haut { display: flex; justify-content: space-between; align-items: center; padding: 20px 40px; text-transform: uppercase; letter-spacing: 0.2em; font-size: 13px; color: var(--texte-2); }
.sel-etape { font-weight: 700; color: var(--blanc); }
.sel-centre { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(320px, 1.1fr); align-items: center; gap: 40px; padding: 0 60px; min-height: 0; }
.sel-vue { position: relative; display: flex; justify-content: center; align-items: center; height: 100%; min-height: 0; }
.sel-vue canvas:not(.sel-embleme) { position: relative; z-index: 1; max-height: 100%; }
.sel-embleme { position: absolute; width: min(420px, 90%); height: auto; opacity: 0.16; filter: blur(1px); animation: sel-tourne 30s linear infinite; }
@keyframes sel-tourne { to { transform: rotate(360deg); } }
.sel-infos { max-width: 560px; }
.sel-role { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px; font-size: 13px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; background: rgba(0, 0, 0, 0.35); border-left: 3px solid var(--agent); }
.sel-role-icone { color: var(--agent); font-size: 16px; }
.sel-nom { margin: 14px 0 6px; font-size: clamp(54px, 8vw, 104px); line-height: 0.9; letter-spacing: 0.04em; color: var(--blanc); text-shadow: 0 6px 40px color-mix(in srgb, var(--agent) 40%, transparent); }
.sel-desc { margin: 0 0 22px; font-size: 16px; line-height: 1.55; color: var(--texte-2); }
.sel-caps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sel-cap { display: flex; gap: 12px; padding: 12px 14px; background: rgba(5, 9, 13, 0.55); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 4px; }
.sel-cap.ulti { border-color: color-mix(in srgb, var(--agent) 60%, transparent); }
.sel-cap kbd { flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; font-weight: 700; color: #05080c; background: var(--agent); border-radius: 3px; }
.sel-cap strong { display: block; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--blanc); }
.sel-cap span { display: block; margin-top: 2px; font-size: 12px; line-height: 1.4; color: var(--texte-2); }
.sel-bas { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 40px 26px; background: linear-gradient(0deg, rgba(0, 0, 0, 0.55), transparent); }
.sel-grille { display: flex; flex-wrap: wrap; gap: 8px; }
.sel-tuile {
  position: relative; width: 74px; height: 92px; padding: 0; overflow: hidden; cursor: pointer;
  background: linear-gradient(180deg, color-mix(in srgb, var(--agent) 35%, #10161d), #0b1016);
  border: 2px solid rgba(255, 255, 255, 0.08); border-radius: 4px; transition: transform 140ms ease, border-color 140ms ease;
}
.sel-tuile img { width: 100%; height: 100%; object-fit: cover; }
.sel-tuile span { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--blanc); background: rgba(0, 0, 0, 0.6); }
.sel-tuile:hover { transform: translateY(-3px); border-color: rgba(255, 255, 255, 0.35); }
.sel-tuile.actif { border-color: var(--agent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--agent) 40%, transparent), 0 8px 20px rgba(0, 0, 0, 0.5); }
.sel-actions { display: flex; gap: 12px; flex: 0 0 auto; }
.sel-lock { min-width: 220px; font-size: 20px !important; letter-spacing: 0.3em !important; background: var(--agent) !important; border-color: var(--agent) !important; color: #05080c !important; }
#selection.verrouille .sel-lock { animation: sel-lock 0.9s ease; }
#selection.verrouille::after { content: 'LOCKED IN'; position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(48px, 9vw, 120px); font-weight: 700; letter-spacing: 0.2em; color: var(--blanc); background: color-mix(in srgb, var(--agent) 22%, transparent); animation: sel-flash 0.9s ease forwards; pointer-events: none; }
@keyframes sel-lock { 0% { transform: scale(1); } 30% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes sel-flash { 0% { opacity: 0; transform: scale(1.3); } 30% { opacity: 1; transform: scale(1); } 100% { opacity: 1; } }
@media (max-width: 1000px) {
  .sel-centre { grid-template-columns: 1fr; padding: 0 20px; gap: 10px; overflow-y: auto; }
  .sel-vue { height: 300px; }
  .sel-bas { flex-direction: column; padding: 12px 20px 20px; }
  .sel-caps { grid-template-columns: 1fr; }
}

/* Le résumé de l'agent dans la phase d'achat */
.agent-resume { display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: linear-gradient(90deg, color-mix(in srgb, var(--agent) 22%, transparent), transparent); border-left: 3px solid var(--agent); border-radius: 4px; }
.agent-resume img { width: 64px; height: 72px; object-fit: cover; border-radius: 3px; background: rgba(0, 0, 0, 0.3); }
.agent-resume strong { display: block; font-size: 22px; letter-spacing: 0.06em; text-transform: uppercase; }
.agent-resume span { font-size: 13px; color: var(--texte-2); }
.agent-resume .bouton { margin-left: auto; }
.agent-haut { display: block !important; }

/* =====================================================
   LA BANNIÈRE D'ACCUEIL (Lobby)
   ===================================================== */
#hero {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr); gap: 32px; align-items: center;
  padding: 40px 44px; overflow: hidden; border: 1px solid var(--bord); border-radius: 6px;
  background:
    radial-gradient(700px 400px at 100% 0%, rgba(255, 70, 85, 0.28), transparent 65%),
    linear-gradient(135deg, #182432, #0d141c 70%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
#hero::after { content: ''; position: absolute; right: -60px; bottom: -40px; width: 340px; height: 340px; border: 2px solid rgba(236, 232, 225, 0.07); border-radius: 50%; pointer-events: none; }
#hero-etiquette { display: inline-block; padding: 4px 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--rouge-clair); background: rgba(255, 70, 85, 0.12); border-radius: 3px; }
#hero-titre { margin: 16px 0 12px; font-size: clamp(32px, 4.4vw, 54px); line-height: 1.02; letter-spacing: 0.03em; text-transform: uppercase; }
#hero-titre span { color: var(--rouge); }
#hero-desc { max-width: 600px; margin: 0 0 24px; font-size: 16px; line-height: 1.6; color: var(--texte-2); }
#hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
#hero-points { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; padding: 0; list-style: none; position: relative; z-index: 1; }
#hero-points li { padding: 16px 18px; background: rgba(5, 9, 13, 0.5); border: 1px solid var(--bord); border-radius: 4px; }
#hero-points strong { display: block; font-size: 34px; line-height: 1; color: var(--blanc); }
#hero-points span { display: block; margin-top: 6px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--discret); }
@media (max-width: 860px) {
  #hero { grid-template-columns: 1fr; padding: 28px 22px; }
}

/* =====================================================
   LE VISEUR (canvas au centre) ET SON ÉDITEUR
   ===================================================== */
#crosshair.viseur-canvas { position: fixed; top: 50%; left: 50%; width: 160px; height: 160px; margin: -80px 0 0 -80px; background: none !important; border-radius: 0 !important; pointer-events: none; z-index: 4; }
#crosshair.viseur-canvas canvas { width: 160px; height: 160px; image-rendering: pixelated; }
#viseur-editeur { display: flex; flex-direction: column; gap: 14px; }
.viseur-code label { display: block !important; padding: 0 !important; border: 0 !important; margin-bottom: 6px; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--discret); }
.viseur-code-ligne { display: flex; gap: 8px; }
.viseur-code-ligne input { flex: 1; width: auto !important; font-family: Consolas, monospace; font-size: 13px; }
.viseur-code small { display: block; margin-top: 6px; }
.viseur-apercu { width: 100%; height: auto; border-radius: 4px; border: 1px solid var(--bord); image-rendering: pixelated; }
.viseur-groupe { padding: 12px 14px; background: rgba(0, 0, 0, 0.18); border: 1px solid var(--bord); border-radius: 4px; }
.viseur-groupe h4 { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--discret); }
.viseur-ligne { display: grid !important; grid-template-columns: 1fr 160px 64px; align-items: center; gap: 10px; }
.viseur-ligne.viseur-check, label.viseur-check { grid-template-columns: 1fr auto; display: grid !important; }
.viseur-ligne input[type="range"] { width: 100% !important; }
.viseur-nombre { width: 64px !important; }
.viseur-couleurs { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 6px; }
.viseur-pastille { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.15); cursor: pointer; }
.viseur-pastille.actif { border-color: var(--blanc); box-shadow: 0 0 0 3px rgba(255, 70, 85, 0.6); }
