:root {
  --bg: #1b1410;
  --bg2: #241a14;
  --panel: #2c2019;
  --sand: #c9a26a;
  --sand-dark: #8a6a3f;
  --ink: #f1e5d3;
  --muted: #b3a08a;
  --wall: #5b4c3f;
  --acid: #7fd13b;
  --pit: #1a1a1a;
  --red: #c0392b;
  --orange: #e07b1a;
  --green: #3f9142;
  --blue: #2f7bc9;
  --accent: #d9432b;
  font-size: 15px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: radial-gradient(ellipse at center, #2a1e16 0%, var(--bg) 70%);
  color: var(--ink);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 60% 40% at 8% 10%, rgba(255,140,50,0.10), transparent 60%),
    radial-gradient(ellipse 60% 40% at 92% 90%, rgba(255,100,40,0.08), transparent 60%);
  animation: emberFlicker 7s ease-in-out infinite alternate;
}
#app { position: relative; z-index: 1; }

@keyframes emberFlicker {
  0% { opacity: 0.7; }
  30% { opacity: 1; }
  55% { opacity: 0.75; }
  100% { opacity: 0.95; }
}

#app { max-width: 1800px; margin: 0 auto; padding: 16px; }

h1, h2, h3 { font-family: "Georgia", serif; margin: 0 0 8px; }
.fiche-gold { font-size: 0.8rem; color: var(--sand); font-family: inherit; float: right; }
h1 { font-size: 1.8rem; color: var(--accent); text-shadow: 0 1px 3px #000; letter-spacing: 1px; }

/* ---------- CTA : boutons "gravés" (chanfrein + petit reflet), plus de bulles pleines ---------- */
button {
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: linear-gradient(180deg, #4e3c28 0%, #2c2019 60%, #1c130d 100%);
  color: var(--sand);
  border: 1px solid #6e5636;
  border-radius: 3px;
  padding: 10px 18px;
  cursor: pointer;
  font-size: 0.82rem;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), inset 0 -1px 0 rgba(0,0,0,0.45), 0 2px 5px rgba(0,0,0,0.5);
  transition: color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}
button:hover:not(:disabled) {
  color: #fff8ec;
  border-color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -1px 0 rgba(0,0,0,0.45), 0 3px 12px rgba(0,0,0,0.6), 0 0 0 1px rgba(217,67,43,0.4);
}
button:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 2px 5px rgba(0,0,0,0.55); }
button:disabled { opacity: 0.35; cursor: not-allowed; }
button.primary {
  background: linear-gradient(180deg, #c0432b 0%, #8a2e1c 55%, #591a0f 100%);
  border-color: #d9a35c;
  color: #fff8ec;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), inset 0 -1px 0 rgba(0,0,0,0.4), 0 3px 12px rgba(140,40,20,0.45);
}
button.primary:hover:not(:disabled) {
  border-color: #ffd9a0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), inset 0 -1px 0 rgba(0,0,0,0.4), 0 4px 18px rgba(200,60,30,0.6), 0 0 0 1px rgba(255,217,160,0.45);
}

.setup-screen {
  max-width: 640px; margin: 60px auto; background: var(--panel);
  border: 1px solid var(--sand-dark); border-radius: 6px; padding: 30px 32px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.04), inset 0 0 60px rgba(0,0,0,0.35), 0 20px 50px rgba(0,0,0,0.5);
  position: relative;
  text-align: center;
}
.setup-screen .row { margin: 18px 0; }
.setup-screen label { display: block; margin-bottom: 8px; color: var(--muted); }
/* Titres de section (Mode de jeu, Roster, Décor…) — pas les libellés de case à cocher,
   qui restent lisibles comme une phrase normale. Un petit filet de part et d'autre au lieu
   d'une barre à gauche : ça reste lisible une fois centré. */
.setup-screen .field-label {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  align-self: stretch;
  color: var(--sand); white-space: nowrap;
  font-family: 'Cinzel', Georgia, serif; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
}
.setup-screen .field-label::before, .setup-screen .field-label::after {
  content: ''; flex: 1 1 32px; max-width: 48px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--sand-dark));
}
.setup-screen .field-label::after { background: linear-gradient(90deg, var(--sand-dark), transparent); }
.setup-screen .row label:has(input[type="checkbox"]) {
  display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; color: var(--ink);
}

/* ---------- Accordéon des niveaux de folie des décors de Capture du drapeau : du plus
   calme (Pique-nique) au plus impitoyable (ENFER) — intensité de couleur croissante.
   Replié par défaut (30 décors d'un coup était bien trop imposant) : un seul niveau ouvert
   à la fois, cliquer l'en-tête bascule. ---------- */
.madness-accordion { width: 100%; display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.madness-section {
  border: 1px solid var(--sand-dark); border-radius: 4px; background: rgba(0,0,0,0.15);
  padding: 8px 10px;
}
.madness-section.open { background: rgba(0,0,0,0.28); }
.madness-tier-label {
  margin: 0; text-align: center; cursor: pointer; user-select: none;
  font-family: 'Cinzel', Georgia, serif; font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.18em;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.madness-tier-label .chevron { font-size: 0.7rem; opacity: 0.7; }
.madness-tier-label .madness-dot { font-size: 0.6rem; }
.madness-section .scenario-tabs { margin-top: 10px; }
.madness-pique-nique { color: #7fd18f; }
.madness-defi { color: #a8d15a; }
.madness-tourmente { color: #e8c25a; }
.madness-frenesie { color: #e8823c; }
.madness-demence { color: #e6533c; text-shadow: 0 0 6px rgba(230,83,60,0.5); }
.madness-enfer { color: #ff2a1a; text-shadow: 0 0 10px rgba(255,42,26,0.85); }
.setup-screen .text-input { text-align: center; }

/* Onglets/choix à encoches (au lieu de bulles arrondies) : lecture "ticket gravé", plus
   cohérent avec l'identité gladiateur/arène que des pilules pleines. */
.pill-group { display: flex; gap: 8px; flex-wrap: wrap; }
.setup-screen .pill-group { justify-content: center; }
.setup-screen .row { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.setup-screen .row > * { max-width: 100%; }
.pill {
  padding: 9px 18px;
  border: 1px solid var(--sand-dark);
  cursor: pointer;
  background: linear-gradient(180deg, #3a2c1e, #221812);
  color: var(--muted);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), inset 0 -1px 0 rgba(0,0,0,0.4);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.pill:hover { color: var(--ink); border-color: var(--accent); }
.pill.selected {
  background: linear-gradient(180deg, #d5502f, #8a2e1c);
  border-color: #ffd9a0;
  color: #fff8ec;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 0 14px rgba(217,67,43,0.4);
}

/* Champs texte assortis (nom du joueur, code de session…) — coins nets, halo à la saisie. */
.text-input {
  width: 100%; padding: 10px 12px; border-radius: 3px;
  border: 1px solid var(--sand-dark); background: #1c130d; color: var(--ink);
  font-family: inherit; font-size: 0.95rem;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.text-input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.5), 0 0 0 2px rgba(217,67,43,0.3);
}

/* ---------- Aperçu miniature d'un décor de Capture du drapeau ---------- */
.scenario-thumb { margin-top: 14px; display: inline-flex; flex-direction: column; align-items: center; }
.scenario-thumb-grid {
  display: grid; grid-template-columns: repeat(16, 16px); grid-template-rows: repeat(16, 16px);
  gap: 1px; background: #0f0b08; border: 2px solid var(--sand-dark); border-radius: 4px; padding: 6px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.55), inset 0 0 14px rgba(0,0,0,0.6);
}
.mini-cell { background: var(--sand); border-radius: 1px; }
.mini-cell.mini-camp-a { background: #e6533c; }
.mini-cell.mini-camp-b { background: #3c8ee6; }
.mini-cell.mini-wall { background: var(--wall); }
.mini-cell.mini-acid { background: var(--acid); }
.mini-cell.mini-pit { background: #050505; }
.mini-cell.mini-flag { background: #ffe08a; box-shadow: 0 0 4px 1px rgba(255,224,138,0.9); }
.mini-cell.mini-spawn-a { box-shadow: inset 0 0 0 1px #e6533c; }
.mini-cell.mini-spawn-b { box-shadow: inset 0 0 0 1px #3c8ee6; }
.scenario-thumb-caption {
  margin: 8px 0 0; font-family: 'Cinzel', Georgia, serif; font-size: 0.75rem; color: var(--sand);
  text-transform: uppercase; letter-spacing: 0.08em;
}

.game-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(420px, 640px); gap: 16px; align-items: start; }

.board-wrap { background: var(--bg2); border: 3px solid var(--sand-dark); border-radius: 8px; padding: 10px; }
.board-frame { display: grid; grid-template-columns: 26px 1fr; grid-template-rows: 26px 1fr; gap: 2px; }
.board-frame .corner { grid-column: 1; grid-row: 1; }
/* Colonnes = numéro de carte SPÉCIALE (bulle bleue), lignes = numéro de carte ARME
   (bulle rouge) : mêmes couleurs sur le plateau que sur les cartes, pour que le lien
   entre les deux soit visuellement évident.
   Même moteur de grille (repeat(16,1fr) + gap identique) que .board ci-dessous : avec du
   flexbox, la division "à parts égales" ne réserve pas l'espace du gap de la même façon
   que CSS Grid, et les numéros dérivaient peu à peu des cases réelles en s'éloignant du
   coin (0,0) — même bug que celui déjà corrigé pour les superpositions acide/météorite. */
.board-frame .col-headers { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: repeat(16, 1fr); gap: 1px; }
.board-frame .col-headers span { text-align: center; font-size: 0.7rem; color: #4f9fe0; font-weight: bold; display: flex; align-items: center; justify-content: center; }
.board-frame .row-headers { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: repeat(16, 1fr); gap: 1px; }
.board-frame .row-headers span { display: flex; align-items: center; justify-content: center; font-size: 0.7rem; color: #e0574a; font-weight: bold; }
.board-frame .board-slot { grid-column: 2; grid-row: 2; }
.board {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  grid-template-rows: repeat(16, 1fr);
  gap: 1px;
  background-color: #0f0b08;
  background-image: url('assets/decors/arena.jpg');
  background-size: cover;
  background-position: center;
  aspect-ratio: 1 / 1;
  width: 100%;
  border: 2px solid #0f0b08;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.5);
}
.cell {
  position: relative;
  background: rgba(216,189,138,0.03);
  display: flex; align-items: center; justify-content: center;
  cursor: default;
  min-width: 0; min-height: 0;
}
.cell.wall { background-image: url('assets/decors/wall.jpg'); background-size: cover; }
.cell.acid-cell { background: #4a7d1f; }
.cell.pit { background-image: url('assets/decors/pit.png'); background-size: cover; background-color: var(--pit); }
.cell.meteor { background: #1a1512; }
/* Placées comme de vrais éléments de grille (grid-column/grid-row en JS), jamais en
   position absolute avec des pourcentages : le gap de la grille fausserait le calcul
   et l'ancre dériverait des cases réelles à mesure qu'on s'éloigne du coin (0,0). */
.meteor-overlay { background-image: url('assets/decors/meteor.jpg'); background-size: 100% 100%; pointer-events: none; box-shadow: 0 0 18px 4px rgba(0,0,0,0.6) inset; z-index: 2; }
.acid-overlay.h { background-image: url('assets/decors/acid.jpg'); background-size: 100% 100%; pointer-events: none; z-index: 2; }
.acid-overlay.v { background-image: url('assets/decors/acid_v.jpg'); background-size: 100% 100%; pointer-events: none; z-index: 2; }
.cell.teleport-a { background-image: url('assets/decors/teleport_jaune.jpg'); background-size: cover; }
.cell.teleport-b { background-image: url('assets/decors/teleport_vert.jpg'); background-size: cover; }
.cell.teleport-c { background-image: url('assets/decors/teleport_rose.jpg'); background-size: cover; }

/* Aperçu de la zone d'effet en survolant une cible (armes explosives, pouvoirs de zone)
   avant de confirmer l'action — on voit ce qui va être touché avant de cliquer. */
.cell.blast-preview { outline: 2px dashed #ff8a3d; outline-offset: -2px; background: rgba(255,138,61,0.28); }

/* Flash d'impact transitoire (jamais envoyé au réseau, purement local) sur les cases
   réellement touchées : attaques en zone, pouvoir du G.I., météorite/déluge/piège... */
.impact-flash {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: radial-gradient(circle, rgba(255,190,70,0.95), rgba(255,90,20,0.5) 55%, transparent 80%);
  animation: impactBurst 0.65s ease-out forwards;
}
@keyframes impactBurst {
  0% { opacity: 0; transform: scale(0.25); }
  25% { opacity: 1; transform: scale(1.15); }
  100% { opacity: 0; transform: scale(1.5); }
}
.baliste-marker {
  position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; pointer-events: none;
  filter: drop-shadow(0 0 4px #000) drop-shadow(0 0 8px rgba(255,90,77,0.9));
  animation: balisteGlow 1.6s ease-in-out infinite;
}
@keyframes balisteGlow {
  0%, 100% { filter: drop-shadow(0 0 4px #000) drop-shadow(0 0 6px rgba(255,90,77,0.7)); }
  50% { filter: drop-shadow(0 0 4px #000) drop-shadow(0 0 12px rgba(255,90,77,1)); }
}
.ctf-base-marker {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; opacity: 0.8; filter: drop-shadow(0 1px 2px #000);
  box-shadow: inset 0 0 0 2px var(--bc, #fff);
  pointer-events: none;
}
.ctf-flag-marker {
  position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; filter: drop-shadow(0 0 3px #000) drop-shadow(0 0 8px rgba(255,224,138,0.9));
  pointer-events: none; animation: balisteGlow 1.6s ease-in-out infinite;
}
.ctf-flag-marker.carried { top: -55%; inset: auto; left: 50%; transform: translateX(-50%); }
.token.has-flag { box-shadow: 0 0 0 3px #ffe08a, 0 2px 5px rgba(0,0,0,0.6); }
.token.mounted { box-shadow: 0 0 0 3px #ff5a4d, 0 2px 5px rgba(0,0,0,0.6); }
.cell.reachable { outline: 2px solid #ffe08a; outline-offset: -2px; cursor: pointer; animation: glowYellow 1.4s ease-in-out infinite; }
.cell.reachable:hover { background: #ffe9b0aa; }
.cell.targetable { outline: 2px solid #ff5a4d; outline-offset: -2px; cursor: crosshair; animation: glowRed 1s ease-in-out infinite; }
.cell.targetable:hover { background: #ff8a7daa; }
.cell.placeable { outline: 2px dashed #7fd13b; outline-offset: -2px; cursor: pointer; animation: glowGreen 1.4s ease-in-out infinite; }

@keyframes glowYellow {
  0%, 100% { box-shadow: inset 0 0 4px 1px rgba(255,224,138,0.3); }
  50% { box-shadow: inset 0 0 12px 3px rgba(255,224,138,0.75); }
}
@keyframes glowRed {
  0%, 100% { box-shadow: inset 0 0 4px 1px rgba(255,90,77,0.35); }
  50% { box-shadow: inset 0 0 14px 4px rgba(255,90,77,0.85); }
}
@keyframes glowGreen {
  0%, 100% { box-shadow: inset 0 0 4px 1px rgba(127,209,59,0.3); }
  50% { box-shadow: inset 0 0 12px 3px rgba(127,209,59,0.7); }
}

.token {
  width: 86%; height: 86%; border-radius: 50%;
  display: flex; align-items: flex-end; justify-content: center;
  font-size: 0.55rem; font-weight: bold; color: white;
  border: 3px solid rgba(0,0,0,0.4);
  box-shadow: 0 2px 5px rgba(0,0,0,0.6), inset 0 0 0 2px rgba(255,255,255,0.15);
  position: relative;
  /* Doit toujours passer AU-DESSUS des superpositions de décor (acide/météorite,
     z-index:2) : un gladiateur sur une case d'acide ne doit jamais disparaître dessous. */
  z-index: 3;
  text-align: center;
  line-height: 1.05;
  background-size: cover;
  background-position: top center;
}
.token .token-name { display: none; }
.token.dead { opacity: 0.3; filter: grayscale(0.6); }
.token .hp-bar { position: absolute; bottom: -5px; left: 5%; width: 90%; height: 3px; background: #000a; border-radius: 2px; overflow: hidden; }
.token .hp-fill { height: 100%; background: #6fd15f; transition: width 0.4s ease-out; }
.token.invisible { opacity: 0.35; border-style: dashed; }
.token.frozen { box-shadow: 0 0 0 2px #6fd3ff; animation: frozenPulse 1.6s ease-in-out infinite; }
.token.just-moved { animation: landPulse 0.45s ease-out; }
.token.dying { animation: dieCollapse 0.7s ease-in forwards; }

@keyframes frozenPulse {
  0%, 100% { box-shadow: 0 0 0 2px #6fd3ff; }
  50% { box-shadow: 0 0 8px 3px #6fd3ffcc; }
}
@keyframes landPulse {
  0% { transform: scale(1.35); filter: brightness(1.6); }
  60% { transform: scale(0.92); }
  100% { transform: scale(1); filter: brightness(1); }
}
@keyframes dieCollapse {
  0% { transform: scale(1) rotate(0deg); opacity: 1; }
  40% { transform: scale(1.2) rotate(8deg); opacity: 1; filter: brightness(1.8) saturate(0.4); }
  100% { transform: scale(0.05) rotate(50deg); opacity: 0; }
}

.board-wrap.impact { animation: boardShake 0.4s ease-in-out; }
@keyframes boardShake {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-6px, 2px); }
  30% { transform: translate(5px, -3px); }
  45% { transform: translate(-4px, 3px); }
  60% { transform: translate(4px, -2px); }
  75% { transform: translate(-2px, 1px); }
}

.dmg-float {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, 0);
  font-size: 1.8rem; font-weight: bold; color: #ff6a5a; text-shadow: 0 2px 4px #000;
  animation: dmgFloat 1s ease-out forwards; pointer-events: none;
}
@keyframes dmgFloat {
  0% { transform: translate(-50%, 10px) scale(0.6); opacity: 0; }
  20% { transform: translate(-50%, -6px) scale(1.25); opacity: 1; }
  100% { transform: translate(-50%, -46px) scale(1); opacity: 0; }
}

.combat-recap-side { background: #201824; border: 1px solid #4a3357; border-radius: 6px; padding: 8px 10px; margin: 8px 0; font-size: 0.85rem; }
.combat-recap-label { font-weight: bold; color: var(--accent); margin-bottom: 4px; }
.combat-recap-cards { margin-bottom: 6px; opacity: 0.9; }
.combat-recap-die { text-align: center; padding: 4px 0; }

.die-face { display: inline-block; animation: diceSettle 0.5s cubic-bezier(.36,1.6,.5,1); }
@keyframes diceSettle {
  0% { transform: rotate(0deg) scale(0.3); opacity: 0; }
  60% { transform: rotate(340deg) scale(1.2); opacity: 1; }
  100% { transform: rotate(360deg) scale(1); }
}

.turn-banner {
  position: fixed; top: 18%; left: 50%; transform: translate(-50%, -20px);
  z-index: 200; padding: 14px 36px; border-radius: 10px;
  background: linear-gradient(180deg, rgba(44,32,25,0.95), rgba(20,14,10,0.95));
  border: 2px solid var(--accent); font-family: Georgia, serif; font-size: 1.4rem;
  text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,0.6);
  animation: bannerSweep 2.1s ease-in-out forwards; pointer-events: none;
}
@keyframes bannerSweep {
  0% { opacity: 0; transform: translate(-50%, -40px) scale(0.85); }
  12% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -14px) scale(0.96); }
}

.sidebar { display: flex; flex-direction: column; gap: 12px; }
.panel { background: var(--panel); border: 1px solid var(--sand-dark); border-radius: 8px; padding: 12px 14px; }
.panel h3 { color: var(--sand); font-size: 1rem; border-bottom: 1px solid var(--sand-dark); padding-bottom: 6px; }

.player-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.player-tab { padding: 4px 10px; border-radius: 12px; font-size: 0.8rem; border: 2px solid transparent; position: relative; }
.player-tab.active { border-color: var(--ink); font-weight: bold; box-shadow: 0 0 8px 1px rgba(255,224,138,0.5); }
.player-tab.mine { border-style: dashed; }
.player-tab.mine::after { content: '★'; margin-left: 4px; }

.status-bar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  background: var(--panel); border: 1px solid var(--sand-dark); border-radius: 8px;
  padding: 8px 14px; margin-bottom: 12px; font-size: 0.95rem;
}
.turn-status { padding: 4px 12px; border-radius: 6px; background: #3a2c1e; color: var(--muted); }
.turn-status.yours { background: var(--accent); color: white; font-weight: bold; animation: yourTurnPulse 1.4s ease-in-out infinite; }
@keyframes yourTurnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,67,43,0.6); }
  50% { box-shadow: 0 0 10px 4px rgba(217,67,43,0.3); }
}

.roster-you, .roster-host, .roster-bot { display: inline-block; font-size: 0.62rem; font-weight: bold; padding: 1px 5px; border-radius: 3px; background: var(--accent); color: white; vertical-align: middle; }
.roster-host { background: #5a4020; }
.roster-bot { background: #2c4a5a; }

/* ---------- Bandeau plein-largeur : les AUTRES joueurs, qui joue, leur perso actif ---------- */
.players-bar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.pbar-card {
  flex: 1 1 260px; min-width: 240px; background: var(--panel); border: 2px solid var(--sand-dark);
  border-radius: 8px; padding: 12px 14px; transition: box-shadow 0.2s, border-color 0.2s;
}
.pbar-card.turn { border-color: var(--pc, var(--accent)); box-shadow: 0 0 0 2px var(--pc, var(--accent)), 0 0 12px 2px rgba(217,67,43,0.35); }
.pbar-card.out { opacity: 0.5; }
.pbar-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pbar-dot { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; }
.pbar-name { font-weight: bold; font-size: 1.1rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbar-gold { font-size: 1.05rem; font-weight: bold; color: var(--sand); flex-shrink: 0; }
.pbar-active { display: flex; gap: 12px; align-items: center; }
.pbar-portrait { width: 58px; height: 66px; flex-shrink: 0; border-radius: 6px; background-size: cover; background-position: top center; border: 1px solid var(--sand-dark); }
.pbar-active-info { flex: 1; min-width: 0; }
.pbar-active-name { font-size: 1.05rem; font-weight: bold; }
.pbar-power-chip {
  font-size: 0.68rem; font-weight: bold; padding: 1px 7px; border-radius: 4px; margin-left: 4px;
  background: linear-gradient(180deg, #8a5fd9, #5a2fae); color: #f2ecff; border: 1px solid #3f1f80;
  vertical-align: middle; white-space: nowrap;
}
.pbar-stats { display: flex; gap: 12px; font-size: 0.95rem; color: var(--muted); margin-top: 4px; flex-wrap: wrap; }
.pbar-equip { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.pbar-equip-chip {
  font-size: 0.8rem; font-weight: bold; padding: 2px 8px; border-radius: 4px;
  background: linear-gradient(180deg, #d99a3f, #a8681c); color: #2a1a0a; border: 1px solid #6e4416;
}
.pbar-equip-chip.weapon { background: linear-gradient(180deg, #6a7d8f, #3f4d5a); color: #eef2f5; border-color: #2c3844; }
.pbar-eliminated { font-size: 0.95rem; color: var(--muted); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; text-align: center; }
.stat-box { background: #1e1610; border-radius: 6px; padding: 6px 2px; }
.stat-box .val { font-size: 1.2rem; font-weight: bold; color: var(--sand); }
.stat-box .lbl { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; }

.hp-track { height: 14px; background: #1e1610; border-radius: 7px; overflow: hidden; margin: 6px 0; border: 1px solid #000; }
.hp-track .fill { height: 100%; background: linear-gradient(90deg, #c0392b, #6fd15f); transition: width 0.2s; }

.power-box { background: #241a29; border: 1px solid #4a3357; border-radius: 6px; padding: 8px; font-size: 0.82rem; margin: 8px 0; }
.power-box.charged { border-color: #7f5aa0; }
.power-box.uncharged { opacity: 0.5; }

.action-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.action-bar button { flex: 1 1 auto; }

.hand-section { margin-top: 8px; }
.hand-section h4 { margin: 6px 0 4px; font-size: 0.85rem; color: var(--muted); }
.card-list { display: flex; flex-wrap: wrap; gap: 10px; }

/* Cartes 100% HTML/CSS (pas de photo/texture) : le numéro affiché vient toujours
   directement de card.number, donc il ne peut plus jamais désynchroniser de ce qui
   est réellement utilisé pour calculer une coordonnée. */
.card {
  width: 128px; border-radius: 8px; overflow: hidden; cursor: pointer;
  border: 2px solid var(--sand-dark); background: #241a14;
  box-shadow: 0 3px 8px rgba(0,0,0,0.5);
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 8px 18px rgba(0,0,0,0.6); }
.card.disabled:hover { transform: none; box-shadow: 0 3px 8px rgba(0,0,0,0.5); }
.card.disabled { opacity: 0.45; cursor: not-allowed; }
.card.equipped { border-color: #ffe08a; box-shadow: 0 0 0 2px #ffe08a, 0 3px 8px rgba(0,0,0,0.5); }

.card-head {
  padding: 6px 8px; font-family: Georgia, serif; font-weight: bold; text-align: center;
  color: #fff8ec; text-shadow: 0 1px 2px rgba(0,0,0,0.5); font-size: 0.8rem; line-height: 1.15;
}
.card.weapon .card-head { background: linear-gradient(180deg, #8a6a3f, #5b4326); }
.card.red .card-head { background: linear-gradient(180deg, #c0392b, #8a2416); }
.card.orange .card-head { background: linear-gradient(180deg, var(--orange), #a8531a); }
.card.green .card-head { background: linear-gradient(180deg, var(--green), #245a28); }
.card.blue .card-head { background: linear-gradient(180deg, var(--blue), #1d5390); }

.card-body {
  flex: 1; position: relative; padding: 8px 8px 26px;
  background: linear-gradient(160deg, #e9d3a3, #cfb37e); color: #2c1c0e;
  font-size: 0.74rem; line-height: 1.3; min-height: 64px;
}
.card-body .meta { color: #3a2814; }
.card-num {
  position: absolute; right: 6px; bottom: 6px; width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: bold;
  color: white; text-shadow: 0 1px 1px rgba(0,0,0,0.4);
  box-shadow: 0 1px 3px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.4);
}
.card.weapon .card-num { background: radial-gradient(circle at 35% 30%, #e0574a, #a3271b); }
.card:not(.weapon) .card-num { background: radial-gradient(circle at 35% 30%, #4f9fe0, #1d5390); }

.card-actions { display: flex; gap: 4px; padding: 5px; background: #1c140f; }
.card-actions button { flex: 1; font-size: 0.68rem; padding: 5px 2px; }
.card-actions .discard-btn { flex: 0 0 auto; padding: 5px 8px; }

.log-panel { max-height: 260px; overflow-y: auto; font-size: 0.78rem; display: flex; flex-direction: column; gap: 3px; }
.log-panel div { border-bottom: 1px solid #3a2c1e44; padding-bottom: 3px; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  animation: overlayFade 0.2s ease-out;
}
.modal {
  background: var(--panel); border: 2px solid var(--accent); border-radius: 10px; padding: 20px;
  max-width: 480px; width: 90%; max-height: 85vh; overflow-y: auto;
  animation: modalPop 0.25s cubic-bezier(.2,1.4,.4,1);
}
.modal.rules-modal { max-width: 640px; }
.rules-body h4 { margin: 14px 0 4px; color: var(--sand, #cbb98c); }
.rules-body h4:first-child { margin-top: 0; }
.rules-body p { margin: 0 0 8px; font-size: 0.88rem; line-height: 1.45; color: var(--ink); }

@keyframes overlayFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPop {
  0% { opacity: 0; transform: scale(0.88) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.badge { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 0.68rem; margin-left: 4px; }
.badge.tier1 { background: #4a3826; }
.badge.tier2 { background: #3a5a4a; }
.badge.tier3 { background: #5a3a3a; }

.hint { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }

/* Bulle d'aide générique au survol : ajouter class="tt" + data-tip="..." à n'importe quel
   élément (arme, pouvoir, carte permanente...) pour afficher son explication. */
.tt { position: relative; cursor: help; }
.tt::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px);
  background: #1b1310; color: #f0e6d8; border: 1px solid var(--sand-dark, #5a4020);
  border-radius: 6px; padding: 7px 10px; font-size: 0.72rem; font-weight: normal;
  line-height: 1.35; text-transform: none; letter-spacing: normal;
  width: max-content; max-width: 230px; white-space: normal; text-align: left;
  opacity: 0; visibility: hidden; pointer-events: none; z-index: 80;
  box-shadow: 0 6px 16px rgba(0,0,0,0.5);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.tt::before {
  content: ''; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%) translateY(2px);
  border: 6px solid transparent; border-top-color: var(--sand-dark, #5a4020);
  opacity: 0; visibility: hidden; pointer-events: none; z-index: 80;
  transition: opacity 0.15s ease, visibility 0.15s;
}
.tt:hover::after, .tt:hover::before { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

.mode-indicator { font-size: 0.8rem; padding: 6px 10px; border-radius: 6px; background: #3a2c1e; margin-bottom: 6px; }
.mode-indicator.active { background: #6a3a2c; }

.winner-banner { text-align: center; padding: 40px; }
.winner-banner h1 { font-size: 2.4rem; }

/* ---------- Choix de gladiateur (composition d'équipe / qui entre dans l'arène) ---------- */
.pick-glad-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.pick-glad-card {
  display: flex; gap: 10px; width: 260px; background: var(--panel); border: 1px solid var(--sand-dark);
  border-radius: 8px; padding: 10px; box-shadow: 0 3px 8px rgba(0,0,0,0.4);
}
.pick-glad-portrait { width: 64px; height: 74px; flex-shrink: 0; border-radius: 6px; background-size: cover; background-position: top center; border: 1px solid var(--sand-dark); }
.pick-glad-body { flex: 1; min-width: 0; }
.pick-glad-name { font-weight: bold; margin-bottom: 3px; }
.pick-glad-stats { font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; }
.pick-glad-power { font-size: 0.75rem; color: var(--ink); margin-bottom: 6px; line-height: 1.3; }
.pick-glad-card button { width: 100%; }

/* ---------- Disposition en 2 colonnes de la zone de jeu du joueur actif ----------
   Colonne gauche : fiche du gladiateur, puis les actions de tour.
   Colonne droite : ce qui est "posé à côté de la fiche" (arme, spéciales équipées),
   puis la main (cartes non encore jouées) — zone dédiée, jamais coincée sous les
   actions comme avant. */
.station-cols { display: grid; grid-template-columns: 190px 1fr; gap: 12px; align-items: start; }
.station-cols .col-left, .station-cols .col-right { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* ---------- Fiche de gladiateur, 100% HTML/CSS (valeurs réelles de GLADIATORS) ---------- */
.fiche-card { border-radius: 8px; overflow: hidden; border: 2px solid var(--sand-dark); box-shadow: 0 3px 10px rgba(0,0,0,0.5); background: linear-gradient(160deg, #e9d3a3, #cfb37e); }
.fiche-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; background: linear-gradient(180deg, #5b4326, #3a2c1e); }
.fiche-head .fiche-name { font-family: Georgia, serif; font-weight: bold; color: #fff8ec; text-shadow: 0 1px 2px rgba(0,0,0,0.5); font-size: 0.95rem; }
.fiche-head .fiche-tier { font-size: 0.75rem; }
.fiche-main { display: flex; gap: 6px; padding: 8px; }
.fiche-portrait { width: 64px; height: 74px; flex-shrink: 0; border-radius: 6px; background-size: cover; background-position: top center; border: 1px solid var(--sand-dark); box-shadow: 0 2px 5px rgba(0,0,0,0.4); }
.fiche-stats { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fiche-stat { display: flex; justify-content: space-between; align-items: baseline; background: rgba(0,0,0,0.12); border-radius: 4px; padding: 2px 6px; }
.fiche-stat .v { font-weight: bold; font-size: 1rem; color: #2c1c0e; }
.fiche-stat .l { font-size: 0.62rem; color: #5a4020; text-transform: uppercase; }
/* Un équipement permanent (carte orange posée à côté de la fiche) ressort en orange —
   il reste actif tant qu'il n'est pas retiré. Un bonus TEMPORAIRE (pouvoir, carte bleue :
   "pour ce tour") ressort en VERT — il va disparaître (fin de tour pour ATQ/PM, début du
   tour suivant pour la DÉF, qui protège pendant le tour adverse). Les deux peuvent se
   cumuler visuellement si les deux s'appliquent en même temps. */
.fiche-stat.boosted-perm { background: rgba(224,123,26,0.22); box-shadow: inset 0 0 0 1px rgba(224,123,26,0.5); }
.fiche-stat.boosted-perm .v { color: var(--orange); }
.fiche-stat.boosted-temp { background: rgba(60,196,110,0.22); box-shadow: inset 0 0 0 1px rgba(60,196,110,0.6); }
.fiche-stat.boosted-temp .v { color: #3cc46e; }
.fiche-adp { font-size: 0.62rem; color: #3a2814; background: rgba(0,0,0,0.12); border-radius: 4px; padding: 2px 6px; text-align: center; }
.life-scale { display: flex; flex-direction: column-reverse; gap: 1px; width: 20px; flex-shrink: 0; }
.life-rung { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 0.6rem; color: #5a4020; }
.life-rung.spent { opacity: 0.25; text-decoration: line-through; }
.life-rung.current { background: var(--accent); color: white; border-radius: 50%; font-weight: bold; box-shadow: 0 0 6px 1px rgba(217,67,43,0.7); }
.equip-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.equip-slot { background: var(--panel); border: 1px solid var(--sand-dark); border-radius: 8px; padding: 6px 8px; }
.equip-slot h4 { margin: 0 0 6px; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.equip-weapon-row { display: flex; align-items: center; gap: 8px; }
.equip-weapon-info .name { font-weight: bold; font-size: 0.85rem; }
.equip-weapon-info .meta { font-size: 0.72rem; color: var(--muted); }
.equip-specials-list { display: flex; flex-direction: column; gap: 6px; }
.equip-card {
  padding: 5px 8px; border-radius: 6px;
  background: linear-gradient(180deg, #d99a3f, #a8681c); color: #2a1a0a;
  border: 1px solid #6e4416; box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.equip-card .name { font-weight: bold; font-size: 0.78rem; }
.equip-card .meta { font-size: 0.7rem; color: #3a2410; }
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 2px; text-align: center; }


/* ---------- Historique : bandeau plein-largeur en bas, façon vrai plateau ---------- */
.history-strip { margin-top: 14px; }

.chat-strip { margin-top: 14px; }
.chat-messages { max-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; padding: 4px 2px; margin-bottom: 8px; }
.chat-msg { padding: 4px 8px; border-radius: 5px; background: #241a1466; word-break: break-word; }
.chat-msg.mine { background: #3a2c1e88; }
.chat-author { font-weight: bold; }
.chat-emoji-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.chat-emoji-btn { background: #241a14; border: 1px solid #5a4020; border-radius: 4px; padding: 2px 7px; font-size: 1.05rem; cursor: pointer; line-height: 1.4; }
.chat-emoji-btn:hover { background: #3a2c1e; border-color: var(--accent); }
.chat-input-row { display: flex; gap: 8px; }
.chat-input-row .text-input { flex: 1; }
.history-strip .log-panel { max-height: 130px; display: flex; flex-direction: column-reverse; }
.history-strip .log-panel div { flex-shrink: 0; }

/* ---------- Modale de résolution d'effet (rouge/vert/orange/pouvoir) ---------- */
.effect-modal ul { margin: 10px 0 0; padding-left: 18px; }
.effect-modal li { margin-bottom: 6px; }
.effect-modal li.log-damage { color: #ff8a5c; font-weight: bold; }
.effect-modal li.log-death { color: #ff4d4d; font-weight: bold; font-size: 1.08em; }

@media (max-width: 980px) {
  .game-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .station-cols { grid-template-columns: 1fr; }
}

/* ---------- Titre du jeu : GLADIATORS (pierre gravée) / ARENA (sang, trash) ---------- */
.brand-title { text-align: center; user-select: none; }
.brand-gladiators {
  display: block;
  font-family: 'New Rocker', 'Cinzel', 'Georgia', serif; font-weight: 900;
  letter-spacing: 0.12em; line-height: 1;
  background: linear-gradient(180deg, #f2e6c8 0%, #cbb98c 35%, #8a7550 60%, #6b5a3c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 1px 0 rgba(255,255,255,0.25), 0 -2px 1px rgba(0,0,0,0.6), 0 4px 6px rgba(0,0,0,0.8);
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.5));
}
.brand-arena {
  display: block;
  font-family: 'Protest Revolution', 'Rubik Wet Paint', 'Georgia', serif; line-height: 1; letter-spacing: 0.05em;
  color: #a80c0c;
  background: linear-gradient(180deg, #ff3b3b 0%, #b40e0e 55%, #6e0000 100%);
  -webkit-background-clip: text; background-clip: text;
  text-shadow: 0 0 14px rgba(180,10,10,0.55);
  filter: drop-shadow(0 3px 2px rgba(0,0,0,0.85));
  position: relative;
}
.brand-subtitle {
  display: block;
  font-family: 'Cinzel', 'Cormorant Garamond', 'Georgia', serif; color: var(--sand, #cbb98c);
  letter-spacing: 0.18em; text-transform: uppercase; opacity: 0.85;
}

/* Tailles : grand format (splash/menu) vs compact (bandeau en jeu) */
.brand-title.size-hero .brand-gladiators { font-size: clamp(2.6rem, 11vw, 6.4rem); }
.brand-title.size-hero .brand-arena { font-size: clamp(2.2rem, 9vw, 5.4rem); margin-top: -0.35em; }
.brand-title.size-hero .brand-subtitle { font-size: clamp(0.85rem, 2.2vw, 1.25rem); display: block; margin-top: 0.5em; }

.brand-title.size-menu { margin-bottom: 6px; }
.brand-title.size-menu .brand-gladiators { font-size: clamp(1.8rem, 6vw, 2.6rem); }
.brand-title.size-menu .brand-arena { font-size: clamp(1.5rem, 5vw, 2.1rem); margin-top: -0.25em; }
.brand-title.size-menu .brand-subtitle { font-size: 0.8rem; display: block; margin-top: 0.3em; }

.brand-title.size-compact { text-align: left; display: inline-flex; align-items: baseline; gap: 10px; }
.brand-title.size-compact .brand-gladiators { font-size: 1.5rem; }
.brand-title.size-compact .brand-arena { font-size: 1.5rem; margin-top: 0; }
.brand-title.size-compact .brand-subtitle { display: none; }

/* ---------- Écran splash : le titre arrive avec fracas avant le menu ---------- */
.splash-screen {
  position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(80,20,10,0.35) 0%, rgba(0,0,0,0) 55%),
    radial-gradient(ellipse at 50% 100%, rgba(0,0,0,0.9) 0%, #0a0604 70%);
  overflow: hidden; cursor: pointer;
}
.splash-screen::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image: radial-gradient(rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 3px 3px;
}
.splash-title .brand-gladiators {
  display: block; opacity: 0; transform: scale(3.2);
  animation: slamIn 0.7s cubic-bezier(.2,.9,.25,1) 0.15s forwards;
}
.splash-title .brand-arena {
  display: block; opacity: 0; transform: scaleY(0.2) translateY(-20px);
  transform-origin: top center;
  animation: dripIn 0.6s cubic-bezier(.3,1.6,.4,1) 0.85s forwards;
}
.splash-title .brand-subtitle {
  opacity: 0; animation: fadeUp 0.8s ease-out 1.5s forwards;
}
.splash-cta {
  margin-top: 2.4rem; opacity: 0;
  font-family: 'Cinzel', serif; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  font-size: clamp(0.95rem, 2.4vw, 1.15rem); color: #f2e6c8;
  background: linear-gradient(180deg, #c0392b, #7a1f16); border: 2px solid #ffd9a0;
  padding: 14px 34px; border-radius: 4px; cursor: pointer;
  box-shadow: 0 0 22px rgba(200,40,20,0.55), inset 0 1px 0 rgba(255,255,255,0.25);
  animation: fadeUp 0.7s ease-out 2s forwards, pulseCta 1.8s ease-in-out 2.8s infinite;
}
.splash-cta:hover { filter: brightness(1.15); }
.splash-hint { margin-top: 14px; opacity: 0; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; animation: fadeUp 0.7s ease-out 2.3s forwards; }

@keyframes slamIn {
  0% { opacity: 0; transform: scale(3.2); }
  60% { opacity: 1; transform: scale(0.94); }
  80% { transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes dripIn {
  0% { opacity: 0; transform: scaleY(0.2) translateY(-20px); }
  100% { opacity: 1; transform: scaleY(1) translateY(0); }
}
@keyframes fadeUp {
  0% { opacity: 0; transform: translateY(14px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes pulseCta {
  0%, 100% { box-shadow: 0 0 22px rgba(200,40,20,0.55), inset 0 1px 0 rgba(255,255,255,0.25); }
  50% { box-shadow: 0 0 34px rgba(220,60,30,0.85), inset 0 1px 0 rgba(255,255,255,0.35); }
}
