/* ============================================
   DUAL EMPIRES - Styles du Plateau de jeu
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: linear-gradient(135deg, #0f1419 0%, #1a2332 50%, #2c1810 100%);
  height: 100vh;
  overflow: hidden;
}

/* Barres de défilement (finalisation du peaufinage) : mêmes règles que css/style.css, que le plateau ne charge pas —
   barre fine, curseur or sombre, aucune piste claire, dans toutes les fenêtres de la partie. */
html {
  scrollbar-color: rgba(201, 162, 75, 0.55) transparent;
}

* {
  scrollbar-width: thin;
}

/* Écran de jeu : [ plateau | panneau d'inspection ] (Polish P1-A) */
.ecran-jeu {
  display: flex;
  height: 100vh;
}

/* Tailles pilotées par la hauteur d'écran (contrainte principale du plateau). */
:root {
  /* Hauteur d'une carte de la main (largeur = 2/3), toujours entièrement
     visible : ~94 px de large vers 1500×880, ~115 px à 1920×1080. */
  --hauteur-carte-main: clamp(125px, 16vh, 172px);
  /* Colonnes latérales du terrain (piles d'un côté, Tactiques de l'autre),
     de même largeur des deux côtés pour garder les 5 cartes centrées. */
  --largeur-cote: clamp(150px, 11vw, 200px);
  /* Mini-cartes de Tactiques (2:3). */
  --largeur-mini-tactique: clamp(36px, 2.8vw, 52px);
}

/* Fond du plateau (barres, main) : dégradé CSS. Le tapis de jeu officiel
   (--image-tapis-jeu, alimentée par ASSETS_UI.tapisJeu) est posé sur .arene ;
   sans tapis, ce dégradé reste le fond de tout le plateau. */
.plateau {
  --image-tapis-jeu: none;
  flex: 1;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0.3rem;
  gap: 0.25rem;
  background:
    /* tapis officiel : taille/position calculées en JS (ligne de front alignée) */
    var(--image-tapis-jeu) var(--tapis-position, center) / var(--tapis-taille, cover) no-repeat,
    /* halo central : la ligne de front */
    radial-gradient(ellipse 55% 30% at 50% 50%, rgba(212, 165, 116, 0.09), transparent 70%),
    /* camp adverse : léger reflet pourpre en haut */
    radial-gradient(ellipse 90% 55% at 50% 0%, rgba(127, 29, 29, 0.22), transparent 70%),
    /* camp joueur : léger reflet bleu en bas */
    radial-gradient(ellipse 90% 55% at 50% 100%, rgba(30, 64, 120, 0.25), transparent 70%),
    /* trame très discrète */
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 12px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 12px),
    linear-gradient(180deg, #0b0f17 0%, #131b2a 50%, #0b0f17 100%);
  /* vignettage léger */
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.5);
}

/* ===== BARRES D'INFO ===== */
.barre-info {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.5rem 1rem;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(212, 165, 116, 0.25);
  border-radius: 8px;
  flex-shrink: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.barre-adversaire {
  border-color: rgba(239, 68, 68, 0.4);
  padding: 0.25rem 1rem;
  /* place pour la rangée de dos de la main adverse */
  min-height: calc(var(--largeur-dos-adverse) * 1.5 + 0.5rem);
}

/* Bandeau joueur : PV + ressources | phases | actions */
.barre-joueur {
  border-color: rgba(74, 222, 128, 0.4);
  min-height: clamp(52px, 7vh, 68px);
  padding: 0.35rem 1rem;
}

.barre-joueur .btn-evolution,
.barre-joueur .btn-protocole-omega,
.barre-joueur .btn-skills,
.barre-joueur .btn-fin-tour {
  padding: 0.55rem 1.1rem;
  font-size: 0.95rem;
}

.info-nom {
  font-size: 1rem;
  font-weight: 700;
  color: #d4a574;
  letter-spacing: 0.1em;
}

.info-deck,
.info-main {
  font-size: 0.9rem;
  color: #cbd5e1;
  font-weight: 600;
}

.info-forteresse {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 1rem;
  color: #f5e6c8;
}

.info-pv {
  font-size: 1.4rem;
  font-weight: 900;
}

.pv-adversaire {
  color: #ef4444;
}

.pv-joueur {
  color: #4ade80;
}

.info-ressources {
  font-size: 1rem;
  color: #60a5fa;
  font-weight: 700;
}

/* Les 3 colonnes de la barre : gauche, centre, droite */
.barre-gauche,
.barre-centre,
.barre-droite {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.barre-gauche {
  justify-content: flex-start;
}

.barre-centre {
  justify-content: center;
}

.barre-droite {
  justify-content: flex-end;
}

/* Ligne des 4 phases */
.phases-ligne {
  display: flex;
  gap: 0.45rem;
}

.phase-etape {
  font-size: 0.95rem;
  font-weight: 700;
  color: #a08460;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(212, 165, 116, 0.3);
  padding: 0.45rem 1.1rem;
  border-radius: 18px;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
}

/* La phase actuellement active : nettement visible, sans agressivité */
.phase-etape.active {
  color: #1a2332;
  background: linear-gradient(135deg, #d4a574 0%, #f5e6c8 100%);
  border-color: #f5e6c8;
  box-shadow:
    0 0 0 2px rgba(212, 165, 116, 0.35),
    0 0 16px rgba(212, 165, 116, 0.45);
  transform: translateY(-1px);
}

/* La phase Combat cliquable (en phase Principale) */
.phase-etape.cliquable {
  cursor: pointer;
  color: #f5e6c8;
  background: linear-gradient(135deg, #7c2d12 0%, #c2410c 100%);
  border-color: #fb923c;
}

.phase-etape.cliquable:hover {
  box-shadow: 0 0 10px rgba(251, 146, 60, 0.5);
}

.btn-phase:hover {
  box-shadow: 0 0 12px rgba(251, 146, 60, 0.5);
}

.btn-fin-tour {
  padding: 0.5rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #f5e6c8;
  background: linear-gradient(135deg, #991b1b 0%, #ef4444 100%);
  border: 1px solid #ef4444;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.btn-fin-tour:hover {
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

.btn-quitter {
  padding: 0.4rem 0.7rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #f5e6c8;
  background: rgba(239, 68, 68, 0.3);
  border: 1px solid #ef4444;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.btn-quitter:hover {
  background: rgba(239, 68, 68, 0.6);
}

/* ===== TERRAINS ===== */
.terrain {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  justify-content: center;
}

/* Conteneur de taille (P1-B) : la hauteur d'une rangée (100cqh) fixe la
   taille des cartes verticales 2:3 qu'elle contient — la hauteur d'écran
   est la contrainte principale du plateau. Piles aux bords, rangée de
   5 cartes centrée en un seul groupe. */
.rangee {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  flex: 1;
  container-type: size;
}

/* Ligne de 5 cartes : un « tapis » resserré autour des cartes.
   Hauteur de carte = hauteur de la rangée moins padding (3px) + bordure (1px)
   du tapis et padding (2px) de l'emplacement, de chaque côté (12px).
   Colonne = largeur de carte + petite marge cliquable ; ~20px entre cartes.
   Les colonnes rétrécissent si la largeur manque. */
.ligne-cartes {
  --hauteur-carte-terrain: calc(100cqh - 12px);
  --largeur-carte-terrain: calc(var(--hauteur-carte-terrain) * 2 / 3);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, calc(var(--largeur-carte-terrain) + 0.75rem)));
  /* les 5 positions s'étalent sur la largeur de la rangée */
  justify-content: space-between;
  gap: clamp(10px, 1vw, 16px);
  /* ~85 % du sol central du tapis (mesuré en JS), jamais plus que la place
     entre les colonnes latérales (flex-shrink) */
  width: min(100%, calc(var(--largeur-sol-tapis, 1100px) * 0.85));
  flex: 0 1 auto;
  min-width: 0;
  padding: 3px 0.5rem;
  border: 1px solid rgba(212, 165, 116, 0.06);
  border-radius: 10px;
  background: rgba(10, 14, 22, 0.04);
}

/* Camps subtilement distingués */
.terrain-adversaire .ligne-cartes {
  border-color: rgba(239, 68, 68, 0.16);
}

.terrain-joueur .ligne-cartes {
  border-color: rgba(96, 165, 250, 0.18);
}

/* Colonnes latérales : Deck / Défausse (bord extérieur) ou Tactiques */
.colonne-pile {
  width: var(--largeur-cote);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.rangee > .colonne-pile:first-child {
  justify-content: flex-start;
}

.rangee > .colonne-pile:last-child {
  justify-content: flex-end;
}

/* Colonne vide : réserve l'espace pour aligner les cartes */
.colonne-vide {
  visibility: hidden;
}

.pile {
  flex: none;
  width: min(100%, clamp(58px, 4.6vw, 80px));
  aspect-ratio: 2 / 3;
  max-height: 100%;
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.5);
}

.pile-deck {
  background:
    var(--image-dos-carte) center / cover no-repeat,
    linear-gradient(160deg, rgba(30, 58, 110, 0.55) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 1px solid rgba(96, 165, 250, 0.45);
}

.pile-defausse {
  background: linear-gradient(160deg, rgba(110, 30, 30, 0.45) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.pile-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #c4a57a;
}

.pile-compte {
  font-size: 1.35rem;
  font-weight: 900;
  color: #f5e6c8;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

/* Emplacement : zone de clic/ciblage/pose (toute la cellule de la grille),
   sans cadre propre — la carte verticale ou l'empreinte de case vide est
   centrée à l'intérieur et porte les surbrillances (P1-B). */
.emplacement {
  position: relative;
  border-radius: 8px;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70px;
  transition: all 0.2s ease;
}

/* Case vide : empreinte verticale 2:3 discrète, à la taille d'une carte. */
.emplacement-label {
  width: var(--largeur-carte-terrain);
  max-width: 100%;
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px dashed rgba(212, 165, 116, 0.3);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.02);
  font-size: clamp(0.55rem, 0.55vw + 0.2rem, 0.72rem);
  font-weight: 600;
  color: rgba(212, 165, 116, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: all 0.2s ease;
}

.emplacement-troupe .emplacement-label {
  border-color: rgba(212, 165, 116, 0.4);
}

.emplacement-batiment .emplacement-label {
  border-color: rgba(52, 211, 153, 0.38);
  color: rgba(52, 211, 153, 0.55);
}

/* Ligne de front entre les deux terrains */
.separateur-central {
  flex-shrink: 0;
  margin: 0 8%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(212, 165, 116, 0.85) 50%,
    transparent 100%
  );
  box-shadow: 0 0 8px rgba(212, 165, 116, 0.35);
}

/* ===== MAIN DU JOUEUR ===== */
.main-joueur {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.3rem 0.4rem 0;
  flex-shrink: 0;
  height: calc(var(--hauteur-carte-main) + 0.3rem);
  overflow: visible;
  background: none;
}

/* Carte dans la main. Largeur responsive (Lot VIS2) : clamp() entre un
   plancher lisible sur petit écran (72px) et la taille historique sur
   desktop (95px), avec une composante viewport (9vw) entre les deux —
   remplace l'ancienne largeur fixe unique. container-type:inline-size
   permet aux badges internes (coût) de se redimensionner en unités cqw,
   proportionnellement à la largeur RÉELLE de cette carte plutôt qu'au
   viewport global (utile si la carte est un jour redimensionnée par un
   contexte différent, ex. deckbuilder). */
.carte-main {
  /* Taille pilotée par la hauteur d'écran, ratio 2:3 ; flex-shrink permet de
     tenir jusqu'à 10 cartes (Main Lourde) sans défilement horizontal. */
  height: var(--hauteur-carte-main);
  width: calc(var(--hauteur-carte-main) * 2 / 3);
  flex: 0 1 auto;
  min-width: 0;
  container-type: inline-size;
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    135deg,
    var(--carte-tint, rgba(30, 41, 59, 0.7)) 0%,
    rgba(30, 41, 59, 0.6) 100%
  );
  border: 1px solid rgba(212, 165, 116, 0.4);
  border-left: 4px solid var(--carte-color, #d4a574);
  border-radius: 6px;
  padding: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.carte-main:hover {
  /* Léger soulèvement : le panneau d'inspection sert de zoom principal */
  transform: translateY(-8px) scale(1.06);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6);
  z-index: 5;
}

.carte-main-nom {
  position: relative;
  z-index: 1;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--carte-color, #f5e6c8);
  margin-bottom: 0.2rem;
  line-height: 1.1;
}

.carte-main-stats {
  position: relative;
  z-index: 1;
  font-size: 0.52rem;
  color: #e8d4b0;
  line-height: 1.3;
}

.carte-main-cout {
  position: relative;
  z-index: 1;
  font-size: 0.58rem;
  color: #60a5fa;
  font-weight: 700;
  margin-top: auto;
}

/* ===== ARTWORK OFFICIEL DES CARTES (Lot VIS1-B) ===== */
/* <img> systématiquement tenté par le rendu, invisible tant que son
   chargement n'est pas confirmé (.chargee, posé par onload) — onerror la
   retire du DOM avant tout affichage, donc jamais d'icône d'image cassée.
   pointer-events:none : ne doit jamais intercepter un clic/tap destiné à la
   carte ou à ses boutons — la sélection/le ciblage/la pose/l'attaque
   restent gérés exactement comme avant par les éléments existants. */
.carte-image {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  z-index: 0;
}

.carte-image.chargee {
  display: block;
}

/* Modificateur (Lot VIS1-C) pour les vignettes additives non "carte pleine"
   (fenêtre Skills, liste Bâtiments d'Évolution) : pas d'habillage plein-cadre
   absolute/inset:0 — un petit visuel 2:3 dans le flux normal, jamais superposé
   à rien (donc jamais de risque d'intercepter un clic, pointer-events:none
   conservé par précaution uniquement). */
.carte-image.skill-vignette {
  position: static;
  flex-shrink: 0;
  width: 34px;
  height: 51px;
  border-radius: 4px;
}

/* Une fois l'artwork chargé (Lot VIS1-B-FINAL — les PNG définitifs
   contiennent déjà nom/illustration/capacité/Vie/Attaque/Défense/Vitesse
   imprimés), l'image devient le SEUL visuel principal : le dégradé/la
   bordure teintés par civilisation s'effacent (l'art contient déjà son
   propre cadrage — voir Roi Conquérant), et le texte statique déjà présent
   sur l'image (nom, stats de base) est masqué pour ne jamais dupliquer la
   carte. Seule reste visible l'information réellement DYNAMIQUE que
   l'image ne peut pas représenter : le coût (peut être réduit par Caserne
   Royale/Usine d'Acier/Bibliothèque Arcanique même en main). Ratio 2:3,
   identique aux PNG réels (1024×1536). */
.carte-main.avec-image {
  background: none;
  border: none;
  padding: 0;
  border-radius: 7px;
}

.carte-main.avec-image .carte-main-nom,
.carte-main.avec-image .carte-main-stats {
  display: none;
}

.carte-main.avec-image .carte-main-cout {
  position: absolute;
  top: 3%;
  right: 4%;
  margin-top: 0;
  background: rgba(10, 14, 20, 0.8);
  border-radius: 4px;
  padding: 0.5cqw 1.5cqw;
  /* Plancher/plafond absolus (lisibilité garantie) + composante
     proportionnelle à la largeur réelle de LA CARTE (cqw, pas vw) entre
     les deux — le chiffre grossit/rétrécit avec la carte elle-même,
     jamais figé à une seule taille d'écran. */
  font-size: clamp(0.5rem, 9cqw, 0.75rem);
}

/* ===== FENÊTRE DE RÉPARTITION DES RESSOURCES ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.visible {
  display: flex;
}

.modal-boite {
  background: linear-gradient(135deg, #1a2332 0%, #2c1810 100%);
  border: 2px solid #d4a574;
  border-radius: 12px;
  padding: 1.5rem 2rem;
  text-align: center;
  min-width: 320px;
}

.modal-titre {
  color: #d4a574;
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

.modal-soustitre {
  color: #8b6f47;
  font-size: 0.85rem;
  margin-bottom: 1.2rem;
}

.repartition-liste {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.repartition-ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(30, 41, 59, 0.6);
  padding: 0.6rem 1rem;
  border-radius: 8px;
}

.repartition-nom {
  font-size: 1rem;
  color: #f5e6c8;
  font-weight: 600;
}

.repartition-controles {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.btn-ressource {
  width: 30px;
  height: 30px;
  font-size: 1.1rem;
  font-weight: 900;
  color: #1a2332;
  background: linear-gradient(135deg, #d4a574 0%, #f5e6c8 100%);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-family: inherit;
}

.btn-ressource:hover {
  box-shadow: 0 0 10px rgba(212, 165, 116, 0.6);
}

.repartition-valeur {
  font-size: 1.2rem;
  font-weight: 900;
  color: #60a5fa;
  min-width: 25px;
}

.modal-restant {
  color: #e8d4b0;
  font-size: 1rem;
  margin-bottom: 1rem;
}

#ressources-restantes {
  color: #d4a574;
  font-weight: 900;
  font-size: 1.2rem;
}

.repartition-boutons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}

.btn-valider-ressources {
  padding: 0.7rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  color: #1a2332;
  background: linear-gradient(135deg, #8b6f47 0%, #d4a574 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.btn-valider-ressources:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Annulation d'une répartition en mode Skill : masqué par défaut, la répartition
   normale de début de tour ne doit jamais l'afficher */
.btn-annuler-repartition {
  display: none;
  padding: 0.7rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  background: rgba(220, 38, 38, 0.2);
  border: 1px solid #ef4444;
  border-radius: 8px;
  color: #fca5a5;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-annuler-repartition.visible {
  display: inline-block;
}

.btn-annuler-repartition:hover {
  background: rgba(220, 38, 38, 0.4);
}

/* Lot R4 : fenêtre de paiement manuel d'un coût générique (mêmes lignes,
   boutons ± et validation que la répartition des ressources). */
.paiement-boite {
  max-width: min(520px, calc(100vw - 32px));
}

.paiement-ligne .repartition-nom {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.paiement-dispo {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 400;
}

.paiement-message {
  min-height: 1.1em;
  margin: 0.2rem 0 0.6rem;
  font-size: 0.85rem;
  color: #fca5a5;
  text-align: center;
}

.btn-ressource:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-annuler-paiement {
  padding: 0.7rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 700;
  background: rgba(220, 38, 38, 0.2);
  border: 1px solid #ef4444;
  border-radius: 8px;
  color: #fca5a5;
  cursor: pointer;
  font-family: inherit;
}

.btn-annuler-paiement:hover {
  background: rgba(220, 38, 38, 0.4);
}

/* Lot R1 : inspecter le terrain pendant la répartition des ressources */
.btn-inspecter-repartition {
  padding: 0.7rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 700;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(212, 165, 116, 0.55);
  border-radius: 8px;
  color: #e8d4b0;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-inspecter-repartition:hover {
  background: rgba(212, 165, 116, 0.2);
}

.btn-inspecter-repartition[hidden] {
  display: none;
}

.bandeau-inspection-repartition {
  position: fixed;
  left: calc((100vw - var(--largeur-inspection)) / 2);
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  max-width: calc(100vw - var(--largeur-inspection) - 32px);
  padding: 0.6rem 0.9rem;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(212, 165, 116, 0.6);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  color: #e8d4b0;
  font-size: 0.9rem;
}

.bandeau-inspection-repartition[hidden] {
  display: none;
}

.btn-reprendre-repartition {
  flex-shrink: 0;
  padding: 0.55rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a2332;
  background: linear-gradient(135deg, #8b6f47 0%, #d4a574 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

/* Affichage des ressources par type dans les barres, séparé de la Forteresse */
.info-ressources {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-left: 0.9rem;
  border-left: 1px solid rgba(212, 165, 116, 0.3);
}

.ressource-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 1rem;
  color: #f5e6c8;
  font-weight: 800;
}

/* Icône officielle de ressource. Les fichiers actuels sont des images hautes
   sur fond noir opaque : recadrage carré centré (où se trouve l'emblème) et
   fusion "screen" pour effacer le noir sur le fond sombre de la barre. */
.icone-ressource-plateau {
  width: clamp(20px, 1.6vw, 26px);
  height: clamp(20px, 1.6vw, 26px);
  object-fit: contain;
}

/* Fenêtres de choix (répartition, Commerce Inter-Civ, Transmutation) */
.icone-ressource-choix {
  width: clamp(28px, 2.2vw, 36px);
  height: clamp(28px, 2.2vw, 36px);
  object-fit: contain;
  vertical-align: middle;
}

/* Coûts dans un texte (badge de main, aperçu, évolution) */
.icone-ressource-cout {
  width: 1.3em;
  height: 1.3em;
  object-fit: contain;
  vertical-align: -0.32em;
}

/* Coût dans le sous-titre du panneau d'inspection */
.icone-ressource-inspection {
  width: 1.45em;
  height: 1.45em;
  object-fit: contain;
  vertical-align: -0.38em;
}

/* ===== FENÊTRE D'APERÇU D'UNE CARTE ===== */
.apercu-boite {
  background: linear-gradient(135deg, #1a2332 0%, #2c1810 100%);
  border: 2px solid #d4a574;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: min(340px, 94vw);
}

/* .tactique-preparee-carte (fenêtre "consulter ma Tactique préparée",
   TOUJOURS celle du joueur — jamais un risque d'information cachée)
   partage exactement le même habillage carte + artwork que .apercu-carte,
   simplement groupé par sélecteur plutôt que dupliqué (Lot VIS1-C, section
   "centraliser le CSS"). Ses classes internes (.apercu-nom/-type/-cout/
   -effet) sont déjà réutilisées telles quelles par ouvrirConsultationTactique(). */
.apercu-carte,
.tactique-preparee-carte {
  /* Largeur responsive (Lot VIS2) : identique à 220px sur desktop
     (55vw dépasse toujours le plafond dès ~400px de viewport), se
     resserre sur téléphone/tablette étroite. container-type:inline-size
     pour que .apercu-cout (badge dynamique) se redimensionne en cqw,
     proportionnellement à CETTE carte plutôt qu'au viewport global. */
  width: clamp(160px, 55vw, 220px);
  container-type: inline-size;
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    135deg,
    var(--carte-tint, rgba(30, 41, 59, 0.7)) 0%,
    rgba(30, 41, 59, 0.7) 100%
  );
  border: 2px solid rgba(212, 165, 116, 0.4);
  border-left: 6px solid var(--carte-color, #d4a574);
  border-radius: 10px;
  padding: 1rem;
}

/* Artwork officiel (Lot VIS1-B-FINAL) : l'image devient le SEUL visuel
   principal — nom/type/stats/effet sont déjà imprimés sur le PNG définitif
   et sont donc masqués (jamais dupliqués). Seul le coût reste affiché
   (dynamique). Ratio 2:3 identique aux PNG réels (1024×1536), pour que
   l'image occupe le maximum d'espace lisible, exactement l'objectif de ce
   lot ("évite de recouvrir l'image avec un gros bloc HTML"). */
.apercu-carte.avec-image,
.tactique-preparee-carte.avec-image {
  background: #0b0f16;
  border-left-color: transparent;
  aspect-ratio: 2 / 3;
  padding: 0;
}

.apercu-carte.avec-image .apercu-nom,
.apercu-carte.avec-image .apercu-type,
.apercu-carte.avec-image .apercu-stats,
.apercu-carte.avec-image .apercu-effet,
.tactique-preparee-carte.avec-image .apercu-nom,
.tactique-preparee-carte.avec-image .apercu-type,
.tactique-preparee-carte.avec-image .apercu-cout,
.tactique-preparee-carte.avec-image .apercu-effet {
  display: none;
}

.apercu-nom {
  position: relative;
  z-index: 1;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--carte-color, #f5e6c8);
  margin-bottom: 0.5rem;
}

.apercu-type {
  position: relative;
  z-index: 1;
  font-size: 0.8rem;
  color: #8b6f47;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.8rem;
}

.apercu-stats {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.apercu-stat {
  font-size: 0.85rem;
  color: #e8d4b0;
  background: rgba(30, 41, 59, 0.7);
  padding: 0.25rem 0.5rem;
  border-radius: 5px;
}

.apercu-cout {
  position: relative;
  z-index: 1;
  font-size: 1rem;
  font-weight: 700;
  color: #60a5fa;
  margin-bottom: 0.8rem;
}

.apercu-carte.avec-image .apercu-cout {
  position: absolute;
  bottom: 3%;
  right: 3%;
  margin-bottom: 0;
  background: rgba(10, 14, 20, 0.8);
  border-radius: 4px;
  padding: 1cqw 2.5cqw;
  font-size: clamp(0.7rem, 6cqw, 1rem);
}

.apercu-effet {
  position: relative;
  z-index: 1;
  font-size: 0.85rem;
  color: #cbd5e1;
  line-height: 1.5;
  border-top: 1px solid rgba(212, 165, 116, 0.3);
  padding-top: 0.6rem;
}

.apercu-actions {
  display: flex;
  gap: 0.8rem;
}

.btn-poser {
  padding: 0.7rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a2332;
  background: linear-gradient(135deg, #4ade80 0%, #86efac 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.btn-poser:hover {
  box-shadow: 0 0 15px rgba(74, 222, 128, 0.5);
}

.btn-poser:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Bouton Jouer (sorts et tactiques) */
.btn-jouer-sort {
  padding: 0.7rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a2332;
  background: linear-gradient(135deg, #a78bfa 0%, #c4b5fd 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.btn-jouer-sort:hover {
  box-shadow: 0 0 15px rgba(167, 139, 250, 0.5);
}

.btn-jouer-sort:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-fermer-apercu {
  padding: 0.7rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #f5e6c8;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border: 1px solid #d4a574;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

/* Emplacement libre quand on est en train de poser : toute la cellule reste
   cliquable, la surbrillance est portée par l'empreinte verticale. */
.emplacement.cible-pose {
  cursor: pointer;
}

.emplacement.cible-pose .emplacement-label {
  border-color: #4ade80;
  border-style: solid;
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}

.emplacement.cible-pose:hover .emplacement-label {
  background: rgba(74, 222, 128, 0.3);
}

/* Une carte posée sur le terrain. Largeur déjà responsive "gratuitement"
   (Lot VIS2) : chaque emplacement occupe 1fr d'une grille à 5 colonnes
   (voir .zone-troupes/.zone-batiments), donc .carte-posee (100% de son
   emplacement) suit déjà la largeur d'écran réelle sans rien changer ici.
   container-type:inline-size ajouté pour que ses badges dynamiques
   (PV/tags) se redimensionnent en cqw avec la taille réelle de CETTE
   carte, même quand elle devient très étroite sur téléphone en paysage. */
.carte-posee {
  /* P1-B : vraie carte verticale 2:3, centrée dans son emplacement, à la
     taille dictée par la hauteur de la rangée (voir .ligne-cartes). */
  width: var(--largeur-carte-terrain);
  max-width: 100%;
  aspect-ratio: 2 / 3;
  flex-shrink: 0;
  container-type: inline-size;
  position: relative;
  background: linear-gradient(
    135deg,
    var(--carte-tint, rgba(30, 41, 59, 0.7)) 0%,
    rgba(30, 41, 59, 0.7) 100%
  );
  border-radius: 6px;
  border-left: 4px solid var(--carte-color, #d4a574);
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Artwork officiel (Lot VIS1-B-FINAL) : le PNG définitif contient déjà nom
   + stats de base imprimés — .carte-posee-nom/.carte-posee-stats (texte
   complet, utilisés par le fallback sans image) sont donc masqués ici.
   Seules restent visibles les informations réellement dynamiques que
   l'image ne peut jamais représenter : PV actuels/max (change à chaque
   combat) et les tags Gardien/Stade 2 (état d'évolution runtime) —
   .carte-posee-pv-image/.carte-posee-tags-image, rendues par le moteur en
   plus du markup existant mais invisibles tant qu'aucune image n'est
   chargée (voir CSS ci-dessous). */
.carte-posee.avec-image {
  background: #0b0f16;
  border-left-color: transparent;
}

.carte-posee-nom {
  position: relative;
  z-index: 1;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--carte-color, #f5e6c8);
  line-height: 1.1;
  margin-bottom: 0.2rem;
}

.carte-posee-stats {
  position: relative;
  z-index: 1;
  font-size: 0.55rem;
  color: #e8d4b0;
  margin-top: auto;
  line-height: 1.3;
}

.carte-posee.avec-image .carte-posee-nom,
.carte-posee.avec-image .carte-posee-stats {
  display: none;
}

.carte-posee-tags-image,
.carte-posee-pv-image {
  display: none;
  position: relative;
  z-index: 1;
}

.carte-posee.avec-image .carte-posee-tags-image,
.carte-posee.avec-image .carte-posee-pv-image {
  display: inline-block;
  width: fit-content;
  font-size: clamp(0.5rem, 13cqw, 0.7rem);
  color: #e8d4b0;
  background: rgba(10, 14, 20, 0.78);
  border-radius: 3px;
  padding: 0.4cqw 2cqw;
}

.carte-posee-tags-image {
  margin-bottom: 0.15rem;
}

.carte-posee-pv-image {
  margin-top: auto;
  font-weight: 700;
}

/* P1-B : en mode image, badges positionnés sur l'illustration du PNG
   (zone ~17 %–68 % de la hauteur) — jamais sur le titre, le texte de
   capacité ni la ligne de stats imprimés. */
.carte-posee.avec-image .carte-posee-tags-image {
  position: absolute;
  top: 18%;
  left: 5%;
  max-width: 90%;
  margin: 0;
}

.carte-posee.avec-image .carte-posee-pv-image {
  position: absolute;
  right: 5%;
  bottom: 33%;
  margin: 0;
  white-space: nowrap;
}

/* Troupe sélectionnée pour attaquer */
.carte-posee.troupe-attaquante {
  border: 2px solid #fbbf24;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.7);
}

/* Forteresse ciblée par une attaque */
.cible-attaque {
  cursor: pointer;
  background: rgba(239, 68, 68, 0.2);
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
}

/* Troupe adverse ciblable (attaque / Sort ennemi) : la cellule reste la zone
   de clic, la surbrillance encadre la carte verticale elle-même (P1-B). */
.emplacement.cible-attaque {
  background: none;
  box-shadow: none;
}

.emplacement.cible-attaque .carte-posee {
  box-shadow:
    0 0 0 2px rgba(239, 68, 68, 0.9),
    0 0 12px rgba(239, 68, 68, 0.6);
}

/* ===== ÉCRAN DE FIN DE PARTIE ===== */
.fin-partie-boite {
  background: linear-gradient(135deg, #1a2332 0%, #2c1810 100%);
  border: 2px solid #d4a574;
  border-radius: 14px;
  padding: 2rem 2.5rem;
  text-align: center;
  min-width: 360px;
  max-width: 460px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.fin-partie-titre {
  font-size: 2.2rem;
  font-weight: 900;
  color: #d4a574;
  text-shadow: 0 0 25px rgba(212, 165, 116, 0.6);
  margin-bottom: 0.6rem;
}

.fin-partie-titre.defaite {
  color: #ef4444;
  text-shadow: 0 0 25px rgba(239, 68, 68, 0.6);
}

.fin-partie-soustitre {
  color: #e8d4b0;
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.fin-partie-stats {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(212, 165, 116, 0.3);
  border-radius: 10px;
  padding: 1.2rem;
  margin-bottom: 1.5rem;
}

.stats-titre {
  color: #d4a574;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(212, 165, 116, 0.3);
}

.stat-ligne {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.3rem;
  font-size: 0.95rem;
}

.stat-label {
  color: #cbd5e1;
}

.stat-valeur {
  color: #f5e6c8;
  font-weight: 900;
  font-size: 1.2rem;
}

.fin-partie-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn-rejouer,
.btn-menu {
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.btn-rejouer {
  color: #1a2332;
  background: linear-gradient(135deg, #4ade80 0%, #86efac 100%);
}

.btn-rejouer:hover {
  box-shadow: 0 0 15px rgba(74, 222, 128, 0.5);
}

.btn-menu {
  color: #f5e6c8;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border: 1px solid #d4a574;
}

.btn-menu:hover {
  background: linear-gradient(135deg, #8b6f47 0%, #d4a574 100%);
}

/* ===== CONFIRMATION QUITTER (remplace le confirm() natif) ===== */
.modal-quitter-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sans cette règle, display:flex ci-dessus écraserait [hidden]. */
.modal-quitter-overlay[hidden] {
  display: none;
}

.modal-quitter-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.2rem;
}

/* ===== BOUTON ÉVOLUTION (barre joueur) ===== */
.btn-evolution {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1a2332;
  background: linear-gradient(135deg, #8b6f47 0%, #d4a574 100%);
  border: 1px solid #d4a574;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.btn-evolution:hover {
  box-shadow: 0 0 14px rgba(212, 165, 116, 0.55);
}

/* ===== BOUTON PROTOCOLE OMEGA (barre joueur) ===== */
/* Masqué par défaut : visible uniquement quand Omega joueur est en jeu */
.btn-protocole-omega {
  display: none;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #0a0a0a;
  background: linear-gradient(135deg, #6b7280 0%, #00d4ff 100%);
  border: 1px solid #00d4ff;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.btn-protocole-omega.visible {
  display: inline-block;
}

.btn-protocole-omega:hover:not(:disabled) {
  box-shadow: 0 0 14px rgba(0, 212, 255, 0.55);
}

.btn-protocole-omega:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Tag "capacités copiées" sur la carte d'Omega posée */
.carte-posee-omega {
  position: relative;
  z-index: 1;
  font-size: 0.68rem;
  color: #00d4ff;
  margin-top: 0.15rem;
}

.carte-posee.avec-image .carte-posee-omega {
  background: rgba(10, 14, 20, 0.72);
  border-radius: 3px;
  padding: 0.05rem 0.2rem;
  display: inline-block;
  width: fit-content;
  /* P1-B : sous les tags, dans l'illustration, borné à la carte. */
  position: absolute;
  top: 27%;
  left: 5%;
  max-width: 90%;
  margin: 0;
  font-size: clamp(0.45rem, 9cqw, 0.62rem);
  line-height: 1.2;
}

/* Bouton Laboratoire Mécanique sur la carte posée : compact, en bas de la
   carte (zone décorative du PNG Bâtiment), toujours cliquable (P1-B). */
.carte-posee .btn-utiliser-skill {
  position: absolute;
  bottom: 4%;
  left: 50%;
  transform: translateX(-50%);
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.15rem 0.4rem;
  font-size: clamp(0.5rem, 10cqw, 0.72rem);
}

/* ===== FENÊTRE DE CHOIX OMEGA ===== */
.omega-choix-boite {
  background: linear-gradient(135deg, #1a2332 0%, #101820 100%);
  border: 2px solid #00d4ff;
  border-radius: 14px;
  padding: 1.5rem 1.8rem;
  width: min(420px, 95vw);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.omega-choix-titre {
  color: #00d4ff;
  font-size: 1.1rem;
  font-weight: 800;
}

.omega-choix-liste {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.omega-choix-btn {
  padding: 0.6rem 1rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #f5e6c8;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(0, 212, 255, 0.35);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.omega-choix-btn:hover {
  border-color: #00d4ff;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.4);
}

.btn-annuler-omega-choix {
  align-self: flex-end;
  padding: 0.5rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fca5a5;
  background: rgba(220, 38, 38, 0.2);
  border: 1px solid #ef4444;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
}

.btn-annuler-omega-choix:hover {
  background: rgba(220, 38, 38, 0.4);
}

/* ===== FENÊTRE ÉVOLUTION DES HÉROS ===== */
.evolution-boite {
  background: linear-gradient(135deg, #1a2332 0%, #2c1810 100%);
  border: 2px solid #d4a574;
  border-radius: 14px;
  padding: 1.5rem 1.8rem;
  width: min(560px, 95vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.evolution-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.evolution-titre {
  color: #d4a574;
  font-size: 1.3rem;
  font-weight: 800;
}

.evolution-liste {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.evolution-liste::-webkit-scrollbar {
  width: 5px;
}

.evolution-liste::-webkit-scrollbar-thumb {
  background: rgba(212, 165, 116, 0.4);
  border-radius: 3px;
}

.evolution-ligne {
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(212, 165, 116, 0.25);
  border-left: 4px solid #d4a574;
  border-radius: 9px;
  padding: 0.7rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.evolution-batiment-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.evolution-batiment-nom {
  font-size: 0.95rem;
  font-weight: 800;
  color: #f5e6c8;
}

.evolution-batiment-statut {
  font-size: 0.75rem;
  font-weight: 700;
  color: #4ade80;
}

.evolution-batiment-bonus {
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.35;
}

.btn-evolution-construire,
.btn-evolution-evoluer {
  align-self: flex-start;
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1a2332;
  background: linear-gradient(135deg, #8b6f47 0%, #d4a574 100%);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.btn-evolution-construire:disabled,
.btn-evolution-evoluer:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.evolution-hero {
  border-top: 1px dashed rgba(212, 165, 116, 0.25);
  padding-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.evolution-hero-info {
  font-size: 0.85rem;
  color: #e8d4b0;
}

.btn-fermer-evolution {
  align-self: flex-end;
  padding: 0.5rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #f5e6c8;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(212, 165, 116, 0.4);
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
}

.btn-fermer-evolution:hover {
  border-color: #d4a574;
  background: rgba(51, 65, 85, 0.8);
}

/* ===== BOUTON SKILLS (barre joueur) ===== */
.btn-skills {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1a2332;
  background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
  border: 1px solid #a78bfa;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.btn-skills:hover {
  box-shadow: 0 0 14px rgba(167, 139, 250, 0.55);
}

/* ===== FENÊTRE SKILLS ===== */
.skills-boite {
  background: linear-gradient(135deg, #1a2332 0%, #1e1040 100%);
  border: 2px solid #7c3aed;
  border-radius: 14px;
  padding: 1.5rem 1.8rem;
  width: min(680px, 95vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.skills-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.skills-titre {
  color: #a78bfa;
  font-size: 1.3rem;
  font-weight: 800;
}

.skills-compteur {
  color: #e8d4b0;
  font-size: 0.95rem;
  font-weight: 700;
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid rgba(167, 139, 250, 0.4);
  border-radius: 20px;
  padding: 0.3rem 0.9rem;
}

.skills-compteur #skills-utilises-count {
  color: #a78bfa;
  font-size: 1.15rem;
  font-weight: 900;
}

.skills-max {
  color: #8b6f47;
}

/* Liste scrollable */
.skills-liste {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.skills-liste::-webkit-scrollbar {
  width: 5px;
}

.skills-liste::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.4);
  border-radius: 3px;
}

/* Ligne d'un skill */
.skill-ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(212, 165, 116, 0.2);
  border-radius: 9px;
  padding: 0.7rem 1rem;
}

.skill-ligne.skill-passif {
  border-left: 4px solid rgba(74, 222, 128, 0.6);
  opacity: 0.85;
}

.skill-ligne.skill-actif-ligne {
  border-left: 4px solid #a78bfa;
}

.skill-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.skill-en-tete {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.skill-nom {
  font-size: 0.95rem;
  font-weight: 800;
  color: #f5e6c8;
}

.skill-categorie {
  font-size: 0.64rem;
  font-weight: 700;
  color: #e8d4b0;
  background: rgba(212, 165, 116, 0.14);
  border: 1px solid rgba(212, 165, 116, 0.4);
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.skill-effet {
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.35;
}

.skill-trigger {
  font-size: 0.75rem;
  color: #8b6f47;
  font-style: italic;
}

.skill-action {
  flex-shrink: 0;
  min-width: 110px;
  display: flex;
  justify-content: flex-end;
}

.skill-statut-auto {
  font-size: 0.78rem;
  font-weight: 700;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.35);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  white-space: nowrap;
}

.skill-statut-utilise {
  font-size: 0.78rem;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  white-space: nowrap;
}

.btn-utiliser-skill {
  position: relative;
  z-index: 1;
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1a2332;
  background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.btn-utiliser-skill:hover:not(:disabled) {
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.55);
}

.btn-utiliser-skill:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-fermer-skills {
  align-self: flex-end;
  padding: 0.5rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #f5e6c8;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(212, 165, 116, 0.4);
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
}

.btn-fermer-skills:hover {
  border-color: #d4a574;
  background: rgba(51, 65, 85, 0.8);
}

/* ===== FENÊTRE GÉNÉRIQUE DE CONSULTATION DE CARTES ===== */

.selection-cartes-boite {
  background: linear-gradient(135deg, #1a2332 0%, #2c1810 100%);
  border: 2px solid #d4a574;
  border-radius: 14px;
  padding: 1.5rem 1.8rem;
  width: min(680px, 95vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.selection-cartes-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.selection-cartes-titre {
  color: #d4a574;
  font-size: 1.3rem;
  font-weight: 800;
}

.selection-cartes-liste {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.selection-cartes-liste::-webkit-scrollbar {
  width: 5px;
}

.selection-cartes-liste::-webkit-scrollbar-thumb {
  background: rgba(212, 165, 116, 0.4);
  border-radius: 3px;
}

.selection-carte-vide {
  color: #8b6f47;
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem;
}

.selection-carte-ligne {
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(212, 165, 116, 0.2);
  border-left: 4px solid #d4a574;
  border-radius: 9px;
  padding: 0.7rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.selection-carte-en-tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.selection-carte-nom {
  font-size: 0.95rem;
  font-weight: 800;
  color: #f5e6c8;
}

.selection-carte-type {
  font-size: 0.72rem;
  font-weight: 700;
  color: #1a2332;
  background: #d4a574;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.selection-carte-meta {
  font-size: 0.78rem;
  color: #8b6f47;
}

.selection-carte-effet {
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.35;
}

/* Mode "selection" : cartes cliquables + état sélectionné */
.selection-carte-cliquable {
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.selection-carte-cliquable:hover {
  border-color: #d4a574;
}

.selection-carte-ligne.selection-carte-selectionnee {
  border-color: #4ade80;
  border-left-color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
}

.selection-cartes-compteur {
  color: #e8d4b0;
  font-size: 0.85rem;
  text-align: center;
}

.selection-cartes-boutons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
}

.btn-fermer-selection,
.btn-annuler-selection,
.btn-valider-selection {
  display: none;
  padding: 0.5rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: 7px;
  cursor: pointer;
}

.btn-fermer-selection.visible,
.btn-annuler-selection.visible,
.btn-valider-selection.visible {
  display: inline-block;
}

.btn-fermer-selection {
  color: #f5e6c8;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(212, 165, 116, 0.4);
}

.btn-fermer-selection:hover {
  border-color: #d4a574;
  background: rgba(51, 65, 85, 0.8);
}

.btn-annuler-selection {
  color: #fca5a5;
  background: rgba(220, 38, 38, 0.2);
  border: 1px solid #ef4444;
}

.btn-annuler-selection:hover {
  background: rgba(220, 38, 38, 0.4);
}

.btn-valider-selection {
  color: #1a2332;
  background: linear-gradient(135deg, #8b6f47 0%, #d4a574 100%);
  border: none;
}

.btn-valider-selection:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== SYSTÈME DE CIBLAGE (skills actifs) ===== */

.ciblage-bandeau {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;
  padding: 0.6rem 1.2rem;
  background: rgba(15, 10, 30, 0.95);
  border-bottom: 2px solid #a78bfa;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  font-size: 0.95rem;
  color: #e2e8f0;
}

.ciblage-bandeau.visible {
  display: flex;
}

.ciblage-message {
  font-weight: 600;
  color: #c4b5fd;
}

.btn-annuler-ciblage {
  padding: 0.3rem 0.9rem;
  background: rgba(220, 38, 38, 0.2);
  border: 1px solid #ef4444;
  border-radius: 6px;
  color: #fca5a5;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-annuler-ciblage:hover {
  background: rgba(220, 38, 38, 0.4);
}

/* Lot Q9 : choix de colonne d'une résurrection — même bandeau, aux couleurs
   des emplacements de pose ; pas d'annulation (l'effet est déjà engagé). */
.ciblage-bandeau.choix-resurrection {
  border-bottom-color: #4ade80;
}

.ciblage-bandeau.choix-resurrection .ciblage-message {
  color: #bbf7d0;
}

.ciblage-bandeau.choix-resurrection .btn-annuler-ciblage {
  display: none;
}

/* Pendant ce choix, la pile de notifications et l'historique passent sous
   le bandeau (hauteur mesurée au rendu) : la consigne n'est jamais masquée. */
body.choix-resurrection-en-cours .notif-historique-pastille {
  top: calc(var(--hauteur-bandeau-choix, 44px) + 8px);
}

body.choix-resurrection-en-cours #notif-container {
  top: calc(var(--hauteur-bandeau-choix, 44px) + 12px);
}

body.choix-resurrection-en-cours .notif-historique-pastille:not([hidden]) ~ #notif-container,
body.choix-resurrection-en-cours .notif-historique-panneau {
  top: calc(var(--hauteur-bandeau-choix, 44px) + 40px);
}

.emplacement.cible-skill {
  cursor: crosshair;
}

/* P1-B : la surbrillance encadre la carte verticale, pas toute la cellule. */
.emplacement.cible-skill .carte-posee {
  box-shadow:
    0 0 0 2px #a78bfa,
    0 0 12px rgba(167, 139, 250, 0.55);
}

/* ===== FENÊTRE GÉNÉRIQUE DE CONVERSION ENTRE CIVILISATIONS ===== */

.conversion-boite {
  background: linear-gradient(135deg, #1a2332 0%, #2c1810 100%);
  border: 2px solid #d4a574;
  border-radius: 14px;
  padding: 1.5rem 1.8rem;
  width: min(480px, 95vw);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.conversion-titre {
  color: #d4a574;
  font-size: 1.3rem;
  font-weight: 800;
}

.conversion-soustitre {
  color: #8b6f47;
  font-size: 0.85rem;
}

.conversion-groupe {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.conversion-etiquette {
  color: #e8d4b0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.conversion-liste {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.conversion-civ-btn {
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #f5e6c8;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(212, 165, 116, 0.3);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.conversion-civ-btn:hover:not(:disabled) {
  border-color: #d4a574;
}

.conversion-civ-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.conversion-civ-btn.conversion-civ-choisie {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.18);
  color: #4ade80;
}

.conversion-boutons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
}

.btn-annuler-conversion {
  padding: 0.5rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: 7px;
  cursor: pointer;
  color: #fca5a5;
  background: rgba(220, 38, 38, 0.2);
  border: 1px solid #ef4444;
}

.btn-annuler-conversion:hover {
  background: rgba(220, 38, 38, 0.4);
}

.btn-valider-conversion {
  padding: 0.5rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: 7px;
  cursor: pointer;
  color: #1a2332;
  background: linear-gradient(135deg, #8b6f47 0%, #d4a574 100%);
  border: none;
}

.btn-valider-conversion:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== ZONE TACTIQUES (3 slots préparés, par camp) ===== */
/* Tactiques : colonne latérale (rangée de Troupes) de mini-cartes 2:3 */
.zone-tactiques {
  flex-direction: column;
  justify-content: center;
  gap: 0.3rem;
}

.zone-tactiques-label {
  font-size: 0.6rem;
  color: #f472b6;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.tactiques-slots {
  display: flex;
  gap: 0.3rem;
}

.tactique-slot {
  position: relative;
  width: var(--largeur-mini-tactique);
  aspect-ratio: 2 / 3;
  flex: none;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  font-size: 0.5rem;
  line-height: 1.1;
  text-align: center;
  transition: all 0.2s ease;
}

.tactique-slot-vide {
  border: 1px dashed rgba(244, 114, 182, 0.35);
}

/* Tactique adverse : dos de carte en CSS — aucune information sur la carte */
.tactique-slot-cachee {
  border: 1px solid rgba(212, 165, 116, 0.6);
  background:
    var(--image-dos-carte) center / cover no-repeat,
    radial-gradient(circle at 50% 50%, rgba(244, 114, 182, 0.4) 0 16%, transparent 17%),
    repeating-linear-gradient(45deg, rgba(212, 165, 116, 0.14) 0 2px, transparent 2px 6px),
    linear-gradient(160deg, #3b1d4a 0%, #1a1030 100%);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.6);
}

/* Tactique du joueur : miniature réelle */
.tactique-slot-visible {
  border: 1px solid #f472b6;
  background: #0b0f16;
  color: #f5e6c8;
  font-weight: 700;
  cursor: pointer;
}

.tactique-slot-visible:hover {
  box-shadow: 0 0 10px rgba(244, 114, 182, 0.6);
  transform: translateY(-2px);
}

/* Nom en repli si la miniature ne charge pas */
.tactique-slot-nom {
  position: relative;
  z-index: 1;
  overflow-wrap: anywhere;
}

.tactique-slot.avec-image .tactique-slot-nom {
  display: none;
}

/* ===== FENÊTRE DE CONSULTATION D'UNE TACTIQUE PRÉPARÉE ===== */
.tactique-preparee-boite {
  background: linear-gradient(135deg, #1a2332 0%, #2c1810 100%);
  border: 2px solid #f472b6;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 340px;
}

.tactique-preparee-actions {
  display: flex;
  gap: 0.8rem;
}

.btn-defausser-tactique {
  padding: 0.5rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: 7px;
  cursor: pointer;
  color: #fca5a5;
  background: rgba(220, 38, 38, 0.2);
  border: 1px solid #ef4444;
}

.btn-defausser-tactique:hover {
  background: rgba(220, 38, 38, 0.4);
}

/* ===== FENÊTRE DE RÉACTION TACTIQUE (Activer / Passer) ===== */
.reaction-tactique-boite {
  background: linear-gradient(135deg, #1a2332 0%, #2c1810 100%);
  border: 2px solid #f472b6;
  border-radius: 14px;
  padding: 1.5rem 1.8rem;
  width: min(480px, 95vw);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.reaction-tactique-titre {
  color: #f472b6;
  font-size: 1.1rem;
  font-weight: 800;
}

.reaction-tactique-liste {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.reaction-tactique-ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(244, 114, 182, 0.3);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
}

.reaction-tactique-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.reaction-tactique-nom {
  font-size: 0.9rem;
  font-weight: 800;
  color: #f5e6c8;
}

.reaction-tactique-effet {
  font-size: 0.78rem;
  color: #cbd5e1;
}

.btn-activer-tactique {
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  color: #1a2332;
  background: linear-gradient(135deg, #db2777 0%, #f472b6 100%);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-passer-tactique {
  align-self: flex-end;
  padding: 0.5rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  color: #f5e6c8;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(244, 114, 182, 0.4);
  border-radius: 7px;
  cursor: pointer;
}

.btn-passer-tactique:hover {
  border-color: #f472b6;
  background: rgba(51, 65, 85, 0.8);
}

/* ===== QA runtime : notifications non bloquantes (notifierPlateau) =====
   Remplacent les alert() natifs pendant une partie. Empilées en haut à
   droite, jamais d'overlay plein écran, jamais de blocage des clics sur le
   plateau (pointer-events: none sur le conteneur — chaque toast n'a lui-même
   aucune interaction, donc n'a pas besoin de réactiver pointer-events). */
#notif-container {
  position: fixed;
  top: 16px;
  /* À gauche du panneau d'inspection, pour ne jamais masquer la carte inspectée. */
  right: calc(var(--largeur-inspection) + 16px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  pointer-events: none;
}

.notif-toast {
  background: #1f2430;
  color: #f5f5f5;
  border-left: 4px solid #6c7a89;
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  white-space: pre-line;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.notif-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.notif-toast--info {
  border-left-color: #4a90d9;
}

.notif-toast--succes {
  border-left-color: #3fb950;
}

.notif-toast--erreur {
  border-left-color: #e5534b;
}

.notif-toast--avertissement {
  border-left-color: #d4a72c;
}

/* Lot R1 (BP-30) : pastille d'historique au-dessus de la pile bornée. */
.notif-historique-pastille {
  position: fixed;
  top: 12px;
  right: calc(var(--largeur-inspection) + 16px);
  z-index: 10000;
  padding: 4px 10px;
  font-size: 13px;
  font-family: inherit;
  color: #f5f5f5;
  background: #2a3242;
  border: 1px solid #6c7a89;
  border-radius: 12px;
  cursor: pointer;
}

.notif-historique-pastille[hidden] {
  display: none;
}

/* Quand la pastille est visible, la pile commence juste en dessous. */
.notif-historique-pastille:not([hidden]) ~ #notif-container {
  top: 44px;
}

.notif-historique-panneau {
  position: fixed;
  top: 44px;
  right: calc(var(--largeur-inspection) + 16px);
  z-index: 10001;
  width: min(380px, calc(100vw - var(--largeur-inspection) - 32px));
  max-height: min(60vh, 480px);
  display: flex;
  flex-direction: column;
  background: #1a202b;
  border: 1px solid #6c7a89;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  color: #f5f5f5;
}

.notif-historique-panneau[hidden] {
  display: none;
}

.notif-historique-entete {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-weight: 700;
  border-bottom: 1px solid #333c4d;
}

.notif-historique-fermer {
  background: none;
  border: none;
  color: #f5f5f5;
  font-size: 16px;
  cursor: pointer;
}

.notif-historique-liste {
  margin: 0;
  padding: 6px 10px 10px;
  overflow-y: auto;
  list-style: none;
}

.notif-historique-ligne {
  white-space: pre-line;
  font-size: 13px;
  line-height: 1.35;
  padding: 6px 8px;
  margin-top: 6px;
  border-left: 3px solid #4a90d9;
  background: #232a37;
  border-radius: 3px;
}

/* Lot R2 : animation des pioches. La carte piochée reste invisible à sa
   place dans la main (opacity : elle garde sa taille et reste cliquable)
   jusqu'à l'arrivée de son double animé. */
.carte-main.carte-main--en-arrivee,
.carte-main-adverse-cachee.en-arrivee {
  opacity: 0;
}

.carte-pioche-vol {
  position: fixed;
  z-index: 95; /* au-dessus du plateau, sous les fenêtres (100) */
  pointer-events: none;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55), 0 0 10px rgba(212, 165, 116, 0.35);
  will-change: transform, opacity;
}

.carte-pioche-vol--face {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(212, 165, 116, 0.7);
}

.carte-pioche-vol--face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Lot F2 : dos remis au deck adverse (Vision du Stratège), même visuel. */
.carte-pioche-vol--dos,
.carte-pioche-vol--remise {
  border: 1px solid rgba(212, 165, 116, 0.55);
  background:
    var(--image-dos-carte) center / cover no-repeat,
    linear-gradient(160deg, #3b1d4a 0%, #1a1030 100%);
}

/* Lot R1 : carte que l'IA vient de poser, brièvement mise en évidence. */
.emplacement.apparition-ia {
  animation: apparition-ia 0.9s ease-out;
}

@keyframes apparition-ia {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.9); }
  60% { box-shadow: 0 0 14px 4px rgba(239, 68, 68, 0.55); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .emplacement.apparition-ia {
    animation: none;
  }
}

/* ===== PANNEAU D'INSPECTION (Polish P1-A) ===== */
/* Lecture seule, docké à droite, alimenté au survol (voir inspecterCarte). */
:root {
  --largeur-inspection: clamp(240px, 16vw, 280px);
}

#panneau-inspection {
  width: var(--largeur-inspection);
  flex-shrink: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0.6rem;
  background: linear-gradient(180deg, rgba(15, 20, 30, 0.92) 0%, rgba(26, 35, 50, 0.92) 100%);
  border-left: 1px solid rgba(212, 165, 116, 0.3);
  overflow: hidden;
}

.inspection-vide {
  margin: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
  opacity: 0.7;
}

/* Silhouette de carte 2:3 en pointillés (CSS seul, aucun asset). */
.inspection-vide-silhouette {
  position: relative;
  width: min(116px, 55%);
  aspect-ratio: 2 / 3;
  border: 2px dashed rgba(212, 165, 116, 0.4);
  border-radius: 8px;
  margin-bottom: 0.3rem;
}

.inspection-vide-silhouette::before {
  content: "";
  position: absolute;
  inset: 18% 18% 38% 18%;
  border: 1px solid rgba(212, 165, 116, 0.3);
  border-radius: 4px;
}

.inspection-vide-titre {
  font-size: 0.875rem;
  color: rgba(212, 165, 116, 0.8);
  letter-spacing: 0.02em;
}

.inspection-vide-texte {
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.4;
}

.inspection-contenu {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
  min-height: 0;
}

/* display:flex ci-dessus écraserait [hidden] sans ces règles. */
.inspection-vide[hidden],
.inspection-contenu[hidden] {
  display: none;
}

/* Cadre 2:3 de la carte inspectée. La largeur est aussi bornée par la
   hauteur d'écran pour laisser de la place aux détails sur petit écran. */
.inspection-carte-image {
  position: relative;
  flex-shrink: 0;
  align-self: center;
  width: min(100%, calc(55vh * 2 / 3));
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  /* Pas de boîte autour de la carte : seulement une ombre légère. Le fond
     teinté ne sert qu'au repli texte si l'image manque. */
  background: linear-gradient(
    135deg,
    var(--carte-tint, rgba(30, 41, 59, 0.7)) 0%,
    rgba(30, 41, 59, 0.7) 100%
  );
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
}

.inspection-carte-image.avec-image {
  background: none;
}

/* Repli texte si le PNG ne charge pas (même principe que le reste du plateau). */
.inspection-image-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--carte-color, #f5e6c8);
}

.inspection-carte-image.avec-image .inspection-image-fallback {
  display: none;
}

.inspection-details {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-right: 0.2rem;
}

.inspection-nom {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--carte-color, #f5e6c8);
  line-height: 1.2;
}

.inspection-sous-titre {
  font-size: 0.8rem;
  color: #8b6f47;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
}

.inspection-origine {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 0.15rem;
}

.inspection-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem;
}

.inspection-stats:empty,
.inspection-etat:empty,
.inspection-capacites:empty,
.inspection-effet:empty {
  display: none;
}

.inspection-stat {
  background: rgba(30, 41, 59, 0.7);
  border-radius: 5px;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  color: #e8d4b0;
}

.inspection-stat-libelle {
  color: #94a3b8;
  font-size: 0.72rem;
  margin-right: 0.3rem;
}

.inspection-stat-valeur {
  font-weight: 800;
  color: #f5e6c8;
}

.inspection-delta {
  font-size: 0.72rem;
  margin-left: 0.25rem;
}

.inspection-delta.positif {
  color: #4ade80;
}

.inspection-delta.negatif {
  color: #f87171;
}

.inspection-titre-section {
  font-size: 0.75rem;
  color: #8b6f47;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.3rem;
}

.inspection-etat,
.inspection-capacites {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: flex-start;
}

.inspection-etat .inspection-titre-section,
.inspection-capacites .inspection-titre-section {
  width: 100%;
  margin-bottom: 0;
}

.inspection-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #e2e8f0;
}

.inspection-badge.positif {
  background: rgba(74, 222, 128, 0.12);
  border-color: rgba(74, 222, 128, 0.4);
  color: #bbf7d0;
}

.inspection-badge.negatif {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fecaca;
}

.inspection-effet {
  font-size: 0.875rem;
  line-height: 1.5;
  color: #cbd5e1;
  border-top: 1px solid rgba(212, 165, 116, 0.25);
  padding-top: 0.5rem;
}

/* ===== CARTES POSÉES : ÉTATS ET BADGES (passage visuel plateau) ===== */
/* Mini-barre d'états : une pastille par état actif (détail au survol et dans
   le panneau d'inspection). Remplace l'ancienne pastille texte unique. */
.carte-posee.avec-image .carte-posee-tags-image {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  background: none;
  padding: 0;
}

.etat-badge {
  font-size: clamp(0.55rem, 12cqw, 0.85rem);
  line-height: 1.15;
  background: rgba(10, 14, 20, 0.82);
  border-radius: 4px;
  padding: 0.3cqw 1.2cqw;
}

/* PV actuels : un peu plus grands avec les cartes agrandies */
.carte-posee.avec-image .carte-posee-pv-image {
  font-size: clamp(0.6rem, 15cqw, 0.9rem);
  padding: 0.6cqw 2.5cqw;
}

/* Troupe ayant déjà attaqué ce tour : atténuée mais lisible */
.carte-posee.carte-a-attaque {
  filter: brightness(0.6) saturate(0.7);
}

/* Bouton Laboratoire (libellé court « 🔧 +2 ») : lisible, jamais tronqué */
.carte-posee .btn-utiliser-skill {
  font-size: clamp(0.55rem, 12cqw, 0.8rem);
  text-overflow: clip;
}

/* ===== POLISH UI DE BASE : ASSETS OFFICIELS + FENÊTRE SKILLS ===== */

/* Dos de carte cosmétique (ASSETS_UI.dosCarte) ; none = dos CSS actuel. */
:root {
  --image-dos-carte: none;
}

/* Icône Forteresse officielle (ASSETS_UI.forteresse) ; repli emoji sinon. */
.icone-forteresse {
  width: clamp(34px, 2.3vw, 40px);
  height: clamp(34px, 2.3vw, 40px);
  object-fit: contain;
  /* le PNG garde ~20 % de marge transparente : on la compense un peu */
  margin: -4px -2px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 165, 116, 0.12) 50%, transparent 72%);
  filter: brightness(1.28) saturate(1.2)
    drop-shadow(0 0 4px rgba(212, 165, 116, 0.6))
    drop-shadow(0 0 8px rgba(96, 165, 250, 0.3));
}

/* Emblème Victoire/Défaite au-dessus du titre (ASSETS_UI.victoire/defaite). */
.fin-partie-embleme {
  display: block;
  width: clamp(110px, 15vh, 160px);
  height: clamp(110px, 15vh, 160px);
  object-fit: contain;
  margin: 0 auto 0.6rem;
}

.fin-partie-embleme[hidden] {
  display: none;
}

/* Fenêtre Skills : en-tête et pied fixes, seule la liste défile. */
.skills-boite {
  max-height: 86vh;
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.skills-entete {
  padding: 1rem 1.4rem 0.8rem;
  border-bottom: 1px solid rgba(167, 139, 250, 0.25);
  background: rgba(15, 10, 30, 0.35);
  flex-shrink: 0;
}

.skills-compteur {
  font-size: 1rem;
  padding: 0.35rem 1rem;
}

.skills-compteur #skills-utilises-count {
  font-size: 1.3rem;
}

.skills-liste {
  flex: 1;
  min-height: 0;
  padding: 0.8rem 1.4rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(167, 139, 250, 0.45) transparent;
}

.btn-fermer-skills {
  flex-shrink: 0;
  margin: 0.7rem 1.4rem 1rem;
}

.btn-fermer-skills:hover {
  border-color: #d4a574;
  background: rgba(51, 65, 85, 0.9);
}

/* Titre de groupe (Actifs, Déclencheurs, Conditionnels, Passifs) */
.skills-groupe-titre {
  font-size: 0.7rem;
  font-weight: 800;
  color: #a78bfa;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.3rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid rgba(167, 139, 250, 0.2);
}

.skills-groupe-titre:first-child {
  margin-top: 0;
}

/* Ligne de Skill : petite « carte » avec artwork visible */
.skill-ligne {
  transition: border-color 0.2s ease, background 0.2s ease;
}

.skill-ligne:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(212, 165, 116, 0.4);
}

.skill-ligne .carte-image.skill-vignette {
  width: 44px;
  height: 66px;
  object-fit: contain;
  border-radius: 5px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}

/* Passif : un état, pas un bouton */
.skill-statut-auto {
  cursor: default;
}

/* Actif : bouton bien visible, désactivé propre */
.skill-action .btn-utiliser-skill {
  padding: 0.45rem 0.95rem;
  font-size: 0.85rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.skill-action .btn-utiliser-skill:hover:not(:disabled) {
  transform: translateY(-1px);
}

.skill-action .btn-utiliser-skill:disabled {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.35);
  opacity: 1;
}

/* ===== PACK VISUEL STANDARD : ARÈNE, MAIN ADVERSE, DOS DE CARTE ===== */

:root {
  /* Largeur d'un dos de carte de la main adverse (2:3) */
  --largeur-dos-adverse: clamp(30px, 2.4vw, 42px);
}

/* Arène : les deux terrains + la ligne de front, sur le tapis de jeu.
   Voile sombre léger au-dessus de l'image pour la lisibilité des cartes. */
.arene {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-radius: 10px;
  background: rgba(5, 8, 14, 0.08);
}

/* Main adverse : dos génériques, légèrement chevauchés */
.main-adversaire-cartes {
  display: flex;
  align-items: center;
  min-width: 0;
}

.carte-main-adverse-cachee {
  width: var(--largeur-dos-adverse);
  aspect-ratio: 2 / 3;
  flex-shrink: 0;
  border-radius: 3px;
  border: 1px solid rgba(212, 165, 116, 0.55);
  background:
    var(--image-dos-carte) center / cover no-repeat,
    linear-gradient(160deg, #3b1d4a 0%, #1a1030 100%);
  box-shadow: -2px 1px 4px rgba(0, 0, 0, 0.55);
}

.carte-main-adverse-cachee + .carte-main-adverse-cachee {
  margin-left: calc(var(--largeur-dos-adverse) * -0.45);
}

/* Compteur discret de la main adverse (confirmation du nombre) */
.barre-adversaire .info-main {
  font-size: 0.8rem;
  font-weight: 800;
  color: #e8d4b0;
  background: rgba(10, 14, 20, 0.6);
  border: 1px solid rgba(212, 165, 116, 0.35);
  border-radius: 10px;
  padding: 0.05rem 0.45rem;
}

/* Couleur sous le dos de carte réel (visible le temps du chargement) */
.tactique-slot-cachee,
.pile-deck {
  background-color: #1a1030;
}

/* Pile Deck : le dos officiel reste net (pas de vignettage intérieur) ;
   joueur/IA distingués seulement par la couleur de bordure existante. */
.pile-deck {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* Pile Deck sur le dos de carte : libellé et compteur lisibles */
.pile-deck .pile-label,
.pile-deck .pile-compte {
  background: none;
}

/* ===== POLISH TERRAIN FINAL : DÉFAUSSES VISUELLES, PILES TRANSPARENTES ===== */

/* Barre joueur : transparente, seuls les boutons « flottent » */
.barre-joueur {
  background: none;
  border-color: transparent;
}

/* Piles : libellé en haut, nombre en bas, lisibles par ombre portée
   (aucun fond derrière le texte) */
.pile {
  position: relative;
  overflow: hidden;
  justify-content: space-between;
  padding: 4px 0;
}

.pile-label,
.pile-compte {
  position: relative;
  z-index: 1;
  color: #f5e6c8;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.95),
    0 0 6px rgba(0, 0, 0, 0.9);
}

/* Défausse : la vraie face de la dernière carte entrée */
.pile-defausse {
  background: rgba(10, 14, 22, 0.25);
  cursor: default;
}

.pile-defausse-carte {
  position: absolute;
  inset: 0;
}

.pile-defausse-nom {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  font-size: 0.55rem;
  text-align: center;
  color: #e8d4b0;
}

.pile-defausse-carte.avec-image .pile-defausse-nom {
  display: none;
}

/* Défausse vide : simple empreinte discrète */
.pile-defausse.pile-vide {
  background: none;
  border-style: dashed;
  border-color: rgba(239, 68, 68, 0.35);
  box-shadow: none;
}

/* ===== POLISH « TERRAIN VIVANT » : LUMIÈRE, GLOW, TOUR ACTIF, PROFONDEUR ===== */
/* Décor uniquement, aucun effet sur le jeu. Calques décoratifs en
   pointer-events:none, animés seulement par transform / opacity /
   background-position. Ordre visuel : tapis → effets d'arène → cases
   vides → cartes → halos de ciblage → interface → fenêtres. */

/* --- Main : transparence native des PNG ---
   Aucun fond derrière l'image : la silhouette du PNG suffit, le tapis est
   visible autour (et à travers les zones transparentes de l'artwork).
   Ombre en drop-shadow, qui suit la silhouette (jamais un rectangle). Une
   carte sans image garde son rendu texte habituel (fond + ombre de boîte). */
.carte-main {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.55);
}

.carte-main:hover {
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(245, 230, 200, 0.18);
}

.carte-main.avec-image,
.carte-main.avec-image:hover {
  box-shadow: none;
}

.carte-main.avec-image {
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.55));
}

.carte-main.avec-image:hover {
  filter: drop-shadow(0 12px 12px rgba(0, 0, 0, 0.65));
}

/* --- Cartes posées : profondeur + léger soulèvement au survol ---
   Ombre en filter (box-shadow reste réservé aux halos de ciblage). */
.carte-posee {
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.55));
  transition:
    transform 0.2s ease,
    filter 0.2s ease;
}

.carte-posee.carte-a-attaque {
  filter: brightness(0.6) saturate(0.7) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.55));
}

.emplacement:hover .carte-posee {
  transform: translateY(-3px);
}

/* --- Cases vides : très discrètes au repos ---
   (cible-pose / cible-attaque / cible-skill les rendent bien visibles) */
.emplacement-label {
  border-color: rgba(212, 165, 116, 0.16);
  background: transparent;
  color: rgba(212, 165, 116, 0.26);
}

.emplacement-troupe .emplacement-label {
  border-color: rgba(212, 165, 116, 0.2);
}

.emplacement-batiment .emplacement-label {
  border-color: rgba(52, 211, 153, 0.18);
  color: rgba(52, 211, 153, 0.28);
}

.emplacement.cible-attaque .emplacement-label {
  border-color: rgba(239, 68, 68, 0.85);
  border-style: solid;
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.emplacement.cible-skill .emplacement-label {
  border-color: #a78bfa;
  border-style: solid;
  background: rgba(167, 139, 250, 0.12);
  color: #c4b5fd;
}

/* --- Arène vivante : halo central + énergie des murs ---
   Contexte d'empilement propre : les effets (z-index -1) restent au-dessus
   du tapis mais sous les cartes, sans toucher aux cartes elles-mêmes. */
.arene {
  position: relative;
  isolation: isolate;
}

/* Halo central sur le grand cercle du tapis (rayon des runes ≈ 0,25 ×
   largeur du sol), centré sur l'axe mesuré du tapis (--tapis-axe-x, posé
   en JS) : respiration lente et irrégulière, jamais opaque, sous les
   cartes. Hauteur bornée à celle de l'arène : rien ne déborde. */
.arene::before {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(50% + var(--tapis-axe-x, 0px));
  height: min(100%, calc(var(--largeur-sol-tapis, 1100px) * 0.6));
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(
    circle closest-side,
    rgba(165, 243, 252, 0.1) 0%,
    rgba(56, 189, 248, 0.05) 40%,
    rgba(103, 232, 249, 0.12) 78%,
    rgba(56, 189, 248, 0.04) 88%,
    transparent 100%
  );
  z-index: -1;
  pointer-events: none;
  opacity: 0.8;
  animation: tv-halo-respire 10.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

/* Ligne de front : cœur blanc/cyan fin, halo bleu, reflet doré léger,
   petit flux horizontal lent. Sa luminosité varie de façon irrégulière
   (keyframes d'intensités différentes), sans jamais disparaître. */
.separateur-central {
  position: relative;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(103, 232, 249, 0.2) 18%,
    rgba(224, 250, 255, 0.45) 50%,
    rgba(103, 232, 249, 0.2) 82%,
    transparent 100%
  );
  box-shadow: none;
  /* contexte d'empilement fixe : l'opacité animée ne fait jamais
     changer de plan le halo (::after) */
  isolation: isolate;
  animation: tv-ligne-lumiere 11.7s ease-in-out infinite;
}

/* Reflet mobile qui parcourt la ligne */
/* Finalisation du peaufinage (performances) : le reflet est un élément de 26 % de la ligne, déplacé par transform et
   fondu par opacity aux deux extrémités (avant : background-position sous un masque, redessiné à chaque image). */
.separateur-central::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 26%;
  background: linear-gradient(90deg, transparent 0%, rgba(240, 253, 255, 0.45) 50%, transparent 100%);
  pointer-events: none;
  opacity: 0;
  animation: tv-ligne-flux 9.3s linear -3.1s infinite;
}

/* Halo bleu + reflet doré très léger, sous la ligne : intensité et
   largeur varient indépendamment de la ligne. */
.separateur-central::after {
  content: "";
  position: absolute;
  inset: -6px 6%;
  background: radial-gradient(
    ellipse closest-side,
    rgba(245, 215, 150, 0.12) 0%,
    rgba(56, 189, 248, 0.2) 35%,
    rgba(56, 189, 248, 0.07) 70%,
    transparent 100%
  );
  z-index: -1;
  pointer-events: none;
  animation: tv-ligne-halo 7.9s ease-in-out -2.6s infinite;
}

/* --- Identité des camps : bordures et lueurs seulement --- */
.barre-info {
  position: relative;
  isolation: isolate;
}

/* Halo de camp (pseudo-élément sous le contenu de la barre) */
.barre-info::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  transition: opacity 0.6s ease;
}

/* Camp joueur : cyan / bleu (Forteresse, ressources, phases, actions) */
.barre-joueur {
  border-color: rgba(56, 189, 248, 0.22);
}

.barre-joueur::before {
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.5),
    0 0 18px rgba(56, 189, 248, 0.32),
    inset 0 0 16px rgba(56, 189, 248, 0.12);
}

/* Camp adverse : rouge / bordeaux (Forteresse, ressources, main, Quitter) */
.barre-adversaire {
  border-color: rgba(220, 38, 38, 0.3);
}

.barre-adversaire::before {
  box-shadow:
    0 0 0 1px rgba(220, 38, 38, 0.5),
    0 0 18px rgba(185, 28, 28, 0.35),
    inset 0 0 16px rgba(127, 29, 29, 0.18);
}

.terrain-joueur .ligne-cartes,
.terrain-adversaire .ligne-cartes {
  transition: border-color 0.6s ease;
}

/* --- Tour actif (classe camp-actif posée par majCampActif) ---
   Halo plus fort et pulsation lente sur le camp qui joue. Prévu aussi
   comme point d'accroche d'un futur bandeau « TON TOUR » (non construit). */
.barre-info.camp-actif::before {
  opacity: 1;
  animation: tv-pulse-camp 3.2s ease-in-out infinite;
}

.terrain-joueur.camp-actif .ligne-cartes {
  border-color: rgba(56, 189, 248, 0.32);
}

.terrain-adversaire.camp-actif .ligne-cartes {
  border-color: rgba(239, 68, 68, 0.3);
}

/* --- Phases : capsule légère + phase active lumineuse --- */
.phases-ligne {
  padding: 3px 5px;
  border: 1px solid rgba(212, 165, 116, 0.2);
  border-radius: 999px;
  background: rgba(10, 14, 22, 0.25);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 2px 10px rgba(0, 0, 0, 0.3);
}

.phase-etape {
  background: rgba(15, 23, 42, 0.45);
}

.phase-etape.active {
  position: relative;
}

.phase-etape.active::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  box-shadow: 0 0 14px 2px rgba(245, 215, 150, 0.55);
  pointer-events: none;
  animation: tv-pulse-phase 2.4s ease-in-out infinite;
}

/* --- Animations --- */
@keyframes tv-halo-respire {
  0%,
  100% {
    opacity: 0.6;
    scale: 0.97;
  }
  22% {
    opacity: 0.85;
    scale: 1;
  }
  41% {
    opacity: 0.7;
    scale: 0.985;
  }
  63% {
    opacity: 1;
    scale: 1.02;
  }
  82% {
    opacity: 0.75;
    scale: 0.99;
  }
}

/* Traversée de la ligne (284,6 % de sa propre largeur = d'un bout à l'autre), puis un temps éteint. */
@keyframes tv-ligne-flux {
  0% {
    transform: translateX(0);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  63% {
    opacity: 1;
  }
  75%,
  100% {
    transform: translateX(284.6%);
    opacity: 0;
  }
}

/* Luminosité pseudo-aléatoire de la ligne (cœur effectif ≈ 0,28 → 0,45) */
@keyframes tv-ligne-lumiere {
  0%,
  100% {
    opacity: 0.62;
  }
  13% {
    opacity: 0.9;
  }
  27% {
    opacity: 0.7;
  }
  44% {
    opacity: 1;
  }
  59% {
    opacity: 0.76;
  }
  73% {
    opacity: 0.93;
  }
  88% {
    opacity: 0.66;
  }
}

/* Halo de la ligne : intensité + largeur/épaisseur, rythme propre */
@keyframes tv-ligne-halo {
  0%,
  100% {
    opacity: 0.6;
    scale: 1 1;
  }
  17% {
    opacity: 0.85;
    scale: 1.03 1.12;
  }
  38% {
    opacity: 0.7;
    scale: 0.97 0.95;
  }
  56% {
    opacity: 1;
    scale: 1.04 1.18;
  }
  71% {
    opacity: 0.75;
    scale: 1 1.02;
  }
  86% {
    opacity: 0.9;
    scale: 0.98 1.1;
  }
}

@keyframes tv-pulse-camp {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

@keyframes tv-pulse-phase {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* Mouvement réduit : tous les effets restent, figés */
@media (prefers-reduced-motion: reduce) {
  .arene::before,
  .separateur-central,
  .separateur-central::before,
  .separateur-central::after,
  .barre-info.camp-actif::before,
  .phase-etape.active::after {
    animation: none;
  }

  .carte-main,
  .carte-posee,
  .emplacement,
  .emplacement-label,
  .barre-info::before {
    transition: none;
  }
}

/* ===== POLISH « TAPIS VIVANT » : ANNEAUX, FLUX, ÉCLATS, PARTICULES ===== */
/* Effets CSS seuls, au-dessus du tapis et sous tout le reste (z-index -1
   dans le contexte d'empilement de .arene), pointer-events:none.
   Positions dérivées de variables posées en JS par l'alignement du tapis :
   --largeur-sol-tapis (échelle) et --tapis-decalage-x (milieu de l'image
   par rapport au centre de l'arène), pour suivre le tapis s'il bouge.
   Médaillons mesurés sur tapis-base.png (1536×1024) à x ≈ 0,129 et 0,851
   de l'image, soit 0,563 et 0,531 × sol de part et d'autre du milieu de
   l'image ; rayon extérieur ≈ 0,047 × sol ; sur la ligne de front.
   Chaque famille d'effet a sa durée et son déphasage : rien n'est
   synchronisé, rien ne clignote. */
.terrain-adversaire,
.terrain-joueur {
  position: relative;
}

/* Anneaux : ::before = médaillon gauche, ::after = médaillon droit.
   Centre vertical = ligne de front (bas du terrain adverse + écart de
   l'arène + moitié de la ligne). Anneau principal + anneau fin intérieur,
   arcs plus lumineux (conic-gradient) que la rotation fait glisser. */
.terrain-adversaire::before,
.terrain-adversaire::after {
  --tv-sol: var(--largeur-sol-tapis, 1100px);
  --tv-anneau: clamp(44px, calc(var(--tv-sol) * 0.106), 190px);
  --tv-ecart-g: calc(var(--tv-sol) * 0.563);
  --tv-ecart-d: calc(var(--tv-sol) * 0.531);
  content: "";
  position: absolute;
  bottom: calc(-0.25rem - 1px - var(--tv-anneau) / 2);
  width: var(--tv-anneau);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    conic-gradient(
      transparent 0deg 20deg,
      rgba(186, 250, 255, 0.95) 50deg,
      transparent 85deg 160deg,
      rgba(125, 240, 255, 0.75) 195deg,
      transparent 230deg 280deg,
      rgba(186, 250, 255, 0.85) 312deg,
      transparent 345deg
    ),
    radial-gradient(
      circle closest-side,
      transparent 72%,
      rgba(56, 189, 248, 0.45) 75%,
      rgba(125, 240, 255, 0.7) 76.5%,
      rgba(56, 189, 248, 0.45) 78%,
      transparent 81% 84%,
      rgba(56, 189, 248, 0.55) 86.5%,
      rgba(165, 243, 252, 0.95) 88%,
      rgba(56, 189, 248, 0.55) 89.5%,
      transparent 92%,
      rgba(56, 189, 248, 0.3) 95%,
      transparent 100%
    );
  -webkit-mask-image: radial-gradient(circle closest-side, transparent 70%, #000 74% 95%, transparent 100%);
  mask-image: radial-gradient(circle closest-side, transparent 70%, #000 74% 95%, transparent 100%);
  filter: blur(0.6px);
  opacity: 0.25;
  z-index: -1;
  pointer-events: none;
}

/* Jamais hors de l'arène (donc jamais sur le panneau d'inspection).
   Rotations et respirations différentes à gauche et à droite. */
.terrain-adversaire::before {
  left: max(0px, calc(50% + var(--tapis-decalage-x, 0px) - var(--tv-ecart-g) - var(--tv-anneau) / 2));
  animation:
    tv-anneau-rotation 15.5s linear infinite,
    tv-anneau-souffle-g 4.1s ease-in-out infinite;
}

.terrain-adversaire::after {
  right: max(0px, calc(50% - var(--tapis-decalage-x, 0px) - var(--tv-ecart-d) - var(--tv-anneau) / 2));
  animation:
    tv-anneau-rotation 17.2s linear -6s infinite reverse,
    tv-anneau-souffle-d 5.3s ease-in-out -2.2s infinite;
}

/* Couche décorative de l'arène (plateau.html) : murs, éclats, sursauts.
   overflow:hidden = aucun débordement possible hors de l'arène. */
.arene-energie {
  --tv-sol: var(--largeur-sol-tapis, 1100px);
  /* abscisse du mur gauche / distance du mur droit au bord droit */
  --tv-mur-g: calc(50% + var(--tapis-decalage-x, 0px) - var(--tv-sol) * 0.563);
  --tv-mur-d: calc(50% - var(--tapis-decalage-x, 0px) - var(--tv-sol) * 0.531);
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.arene-energie > * {
  position: absolute;
  pointer-events: none;
}

/* Flux d'énergie cyan / bleu glace qui remonte le long des murs : deux
   traînées par mur (trait fin + lueur), en motifs répétés de tailles
   différentes, donc de vitesses différentes ; boucle sans à-coup (chaque
   motif remonte d'exactement une période). */
/* Finalisation du peaufinage (performances) : chaque traînée est un pseudo-élément haut de deux motifs, remonté d'un
   motif par transform (avant : background-position, redessiné à chaque image). Le mur ne fait que les rogner. */
.energie-mur {
  top: 3%;
  bottom: 3%;
  width: 14px;
  overflow: hidden;
}

.energie-mur::before,
.energie-mur::after {
  content: "";
  position: absolute;
  top: 0;
}

/* Trait fin : motif de 140 % de la hauteur du mur */
.energie-mur::before {
  left: 6px;
  width: 2px;
  height: 280%;
  background: linear-gradient(180deg, transparent 0%, rgba(207, 250, 254, 0.22) 18%, transparent 36%, transparent 100%) 0 0 / 100% 50% repeat-y;
}

/* Lueur : motif de 180 %, estompée vers les bords du mur */
.energie-mur::after {
  left: 0;
  width: 100%;
  height: 360%;
  background: linear-gradient(180deg, transparent 0%, rgba(56, 189, 248, 0.12) 22%, transparent 45%, transparent 100%) 0 0 / 100% 50% repeat-y;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 40%, #000 60%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 40%, #000 60%, transparent);
}

.energie-mur-gauche {
  left: calc(var(--tv-mur-g) - 7px);
  animation: tv-mur-souffle 7.3s ease-in-out -1.1s infinite;
}

.energie-mur-gauche::before,
.energie-mur-gauche::after {
  animation: tv-mur-flux 9.8s linear -3.4s infinite;
}

.energie-mur-droite {
  right: calc(var(--tv-mur-d) - 7px);
  animation: tv-mur-souffle 8.6s ease-in-out -4.7s infinite;
}

.energie-mur-droite::before,
.energie-mur-droite::after {
  animation: tv-mur-flux 12.1s linear -6.2s infinite;
}

/* Éclats : petites lueurs le long des murs, qui apparaissent et
   s'effacent lentement, chacune à son rythme (jamais ensemble). */
.energie-eclat {
  width: clamp(26px, calc(var(--tv-sol) * 0.04), 64px);
  aspect-ratio: 2 / 3;
  border-radius: 50%;
  background: radial-gradient(
    ellipse closest-side,
    rgba(165, 243, 252, 0.2) 0%,
    rgba(56, 189, 248, 0.1) 45%,
    transparent 100%
  );
  opacity: 0;
  animation: tv-eclat 11s ease-in-out infinite;
}

.eclat-1,
.eclat-2,
.eclat-3 {
  left: var(--tv-mur-g);
  translate: -50% -50%;
}

.eclat-4,
.eclat-5,
.eclat-6 {
  right: var(--tv-mur-d);
  translate: 50% -50%;
}

.eclat-1 {
  top: 16%;
  animation-duration: 9.1s;
  animation-delay: -2.3s;
}

.eclat-2 {
  top: 36%;
  animation-duration: 12.7s;
  animation-delay: -7.9s;
}

.eclat-3 {
  top: 78%;
  animation-duration: 10.4s;
  animation-delay: -5.1s;
}

.eclat-4 {
  top: 24%;
  animation-duration: 11.3s;
  animation-delay: -0.6s;
}

.eclat-5 {
  top: 65%;
  animation-duration: 13.6s;
  animation-delay: -9.2s;
}

.eclat-6 {
  top: 87%;
  animation-duration: 14.9s;
  animation-delay: -3.8s;
}

/* Sursauts d'énergie : une petite portion de la ligne s'illumine
   ~0,7 s, deux fois par cycle de 16,3 s (écarts ≈ 7,7 s et 8,6 s), à deux
   endroits différents ; la tache se déplace pendant qu'elle est éteinte. */
.energie-sursaut {
  top: 50%;
  left: 8%;
  right: 8%;
  height: 10px;
  translate: 0 -50%;
}

/* Finalisation du peaufinage (performances) : la tache est un pseudo-élément déplacé par transform (avant :
   background-position). Positions : 31 % et 66 % de la course, en multiples de sa propre largeur (9 %). */
.energie-sursaut::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 9%;
  background: radial-gradient(ellipse closest-side, rgba(224, 250, 255, 0.55) 0%, rgba(103, 232, 249, 0.22) 45%, transparent 100%);
  opacity: 0;
  animation: tv-sursaut 16.3s ease-in-out -4s infinite;
}

/* Particules : 3 points lumineux par côté (6 au total), qui montent
   lentement vers les médaillons, à des vitesses et phases différentes. */
.terrain-joueur::before,
.terrain-joueur::after {
  --tv-ecart-g: calc(var(--largeur-sol-tapis, 1100px) * 0.563);
  --tv-ecart-d: calc(var(--largeur-sol-tapis, 1100px) * 0.531);
  content: "";
  position: absolute;
  bottom: 4%;
  width: 16px;
  height: 70%;
  background:
    radial-gradient(circle, rgba(207, 250, 254, 0.9) 0 1px, rgba(103, 232, 249, 0.35) 2px, transparent 3px) 20% 88% / 6px 6px no-repeat,
    radial-gradient(circle, rgba(207, 250, 254, 0.9) 0 1px, rgba(103, 232, 249, 0.35) 2px, transparent 3px) 80% 60% / 6px 6px no-repeat,
    radial-gradient(circle, rgba(207, 250, 254, 0.9) 0 1px, rgba(103, 232, 249, 0.35) 2px, transparent 3px) 45% 30% / 6px 6px no-repeat;
  opacity: 0;
  z-index: -1;
  pointer-events: none;
}

.terrain-joueur::before {
  left: max(0px, calc(50% + var(--tapis-decalage-x, 0px) - var(--tv-ecart-g) - 8px));
  animation: tv-particules 12.7s ease-in-out -1.3s infinite;
}

.terrain-joueur::after {
  right: max(0px, calc(50% - var(--tapis-decalage-x, 0px) - var(--tv-ecart-d) - 8px));
  animation: tv-particules 15.9s cubic-bezier(0.4, 0, 0.6, 1) -7.4s infinite;
}

@keyframes tv-anneau-rotation {
  to {
    rotate: 360deg;
  }
}

@keyframes tv-anneau-souffle-g {
  0%,
  100% {
    opacity: 0.18;
    scale: 0.98;
  }
  50% {
    opacity: 0.34;
    scale: 1.02;
  }
}

@keyframes tv-anneau-souffle-d {
  0%,
  100% {
    opacity: 0.2;
    scale: 0.985;
  }
  35% {
    opacity: 0.31;
    scale: 1.015;
  }
  60% {
    opacity: 0.24;
    scale: 1;
  }
  80% {
    opacity: 0.33;
    scale: 1.02;
  }
}

/* Montée d'une période exacte : la moitié de la hauteur de la traînée (deux motifs) */
@keyframes tv-mur-flux {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-50%);
  }
}

@keyframes tv-mur-souffle {
  0%,
  100% {
    opacity: 0.6;
  }
  30% {
    opacity: 0.95;
  }
  55% {
    opacity: 0.7;
  }
  80% {
    opacity: 1;
  }
}

@keyframes tv-eclat {
  0%,
  30% {
    opacity: 0;
    scale: 0.9;
  }
  52% {
    opacity: 1;
    scale: 1.05;
  }
  74%,
  100% {
    opacity: 0;
    scale: 0.95;
  }
}

@keyframes tv-sursaut {
  0%,
  21% {
    opacity: 0;
    transform: translateX(313.4%);
  }
  23% {
    opacity: 1;
    transform: translateX(317.5%);
  }
  25.5% {
    opacity: 0;
    transform: translateX(321.5%);
  }
  26%,
  68% {
    opacity: 0;
    transform: translateX(667.3%);
  }
  70% {
    opacity: 0.8;
    transform: translateX(671.4%);
  }
  72.5% {
    opacity: 0;
    transform: translateX(675.4%);
  }
  73%,
  100% {
    opacity: 0;
    transform: translateX(313.4%);
  }
}

@keyframes tv-particules {
  0% {
    opacity: 0;
    translate: 0 0;
  }
  25% {
    opacity: 0.45;
  }
  75% {
    opacity: 0.3;
  }
  100% {
    opacity: 0;
    translate: 0 -30%;
  }
}

/* Mouvement réduit : anneaux, ligne, flux et halo visibles mais fixes ;
   particules, éclats et sursauts masqués (ils n'existent que par leur
   mouvement). */
@media (prefers-reduced-motion: reduce) {
  .terrain-adversaire::before,
  .terrain-adversaire::after,
  .energie-mur,
  .energie-mur::before,
  .energie-mur::after,
  .energie-sursaut::before {
    animation: none;
  }

  .terrain-joueur::before,
  .terrain-joueur::after,
  .energie-eclat,
  .energie-sursaut {
    animation: none;
    opacity: 0;
  }

  /* Reflet fixe, au milieu de la ligne */
  .separateur-central::before {
    transform: translateX(142.3%);
    opacity: 1;
  }
}

/* ===== BARRE ADVERSAIRE : NOM À GAUCHE, MAIN IA CENTRÉE ===== */
/* 3 zones : deux côtés de même largeur (minmax(0, 1fr)) autour d'une
   colonne centrale à sa taille : la main IA reste au centre exact de la
   barre, quels que soient les contenus de gauche et de droite. */
.barre-adversaire {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

/* Nom après Forteresse + ressources, jamais coupé en deux lignes */
.barre-adversaire .info-nom {
  white-space: nowrap;
  margin-left: 0.4rem;
}

/* Seuls les dos occupent la largeur centrée ; le compteur est posé à leur
   droite, hors du flux, sans décaler le groupe. */
.main-adversaire {
  position: relative;
  display: flex;
  align-items: center;
}

.main-adversaire .info-main {
  position: absolute;
  left: calc(100% + 0.45rem);
  top: 50%;
  translate: 0 -50%;
  white-space: nowrap;
}

/* ===== CARTES : TRANSPARENCE NATIVE DES PNG ===== */
/* Avec image chargée, aucun fond ni bordure artificiels autour du PNG :
   l'extérieur de la carte est transparent, le décor reste visible autour
   de sa silhouette. Les ombres suivent la silhouette (drop-shadow). Les
   halos de ciblage / sélection (box-shadow) ne sont pas concernés. */
.carte-posee.avec-image {
  background: transparent;
  border-left-width: 0;
}

.apercu-carte.avec-image,
.tactique-preparee-carte.avec-image {
  background: transparent;
  border: none;
}

.tactique-slot-visible.avec-image {
  background: transparent;
}

.inspection-carte-image.avec-image {
  box-shadow: none;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.55));
}

.skill-ligne .carte-image.skill-vignette {
  box-shadow: none;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5));
}

/* ===== ÉTAPE RESSOURCES OBLIGATOIRE ===== */
/* Fenêtres de répartition et de pile ou face centrées sur l'arène (le
   tapis) et non sur tout l'écran : position calculée en JS (centrerModalSurTapis), voile toujours
   plein écran, taille de la boîte inchangée. */
.modal-overlay.modal-centree-tapis .modal-boite {
  position: absolute;
  left: var(--modal-gauche);
  top: var(--modal-haut);
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}

/* Frise : Pioche faite, Ressources à cliquer, Principale / Combat bloquées */
.phase-etape.phase-terminee {
  opacity: 0.55;
  cursor: default;
}

.phase-etape.phase-verrouillee {
  opacity: 0.45;
  cursor: not-allowed;
}

.phase-etape.phase-obligatoire {
  cursor: pointer;
  border-color: #67e8f9;
  box-shadow:
    0 0 0 2px rgba(103, 232, 249, 0.35),
    0 0 16px rgba(103, 232, 249, 0.45);
}

.phase-etape.phase-obligatoire:hover {
  box-shadow:
    0 0 0 2px rgba(103, 232, 249, 0.55),
    0 0 20px rgba(103, 232, 249, 0.6);
}

/* Pulsation discrète (calque existant de la phase active), teinte cyan */
.phase-etape.phase-obligatoire.active::after {
  box-shadow: 0 0 14px 3px rgba(103, 232, 249, 0.55);
}

/* Fin du tour inactive tant que les Ressources ne sont pas validées */
.btn-fin-tour:disabled,
.btn-fin-tour:disabled:hover {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  filter: grayscale(0.4);
}

/* ===== PILE OU FACE DE DÉBUT DE PARTIE ===== */
/* Fenêtre centrée sur le tapis (même mécanisme que la répartition des
   ressources). Le gagnant est tiré en JS ; l'animation ne fait que le
   montrer : la rotation finale affiche toujours la face gagnante
   (joueur = 1800°, multiple de 360 ; adversaire = 1980°, + 180°). Durée du
   lancer transmise par le JS (--duree-lancer), une seule source. */
.coin-flip-overlay {
  background: rgba(3, 6, 12, 0.78);
}

.coin-flip-boite {
  --taille-piece: clamp(110px, 15vh, 170px);
  min-width: clamp(280px, 24vw, 380px);
  padding: 1.3rem 2rem 1.5rem;
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.96) 0%, rgba(30, 16, 24, 0.96) 100%);
}

.coin-flip-titre {
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.piece-scene {
  position: relative;
  width: var(--taille-piece);
  height: calc(var(--taille-piece) * 1.6);
  margin: 0.4rem auto 0.3rem;
  perspective: 900px;
}

.piece {
  position: absolute;
  left: 0;
  bottom: calc(var(--taille-piece) * 0.28);
  width: var(--taille-piece);
  aspect-ratio: 1;
  transform-style: preserve-3d;
}

.piece-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 6px solid #d4a574;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2%;
}

/* Face joueur dessinée : bleu nuit, cyan, or */
.face-joueur {
  background: radial-gradient(circle at 35% 30%, #1e3a5f 0%, #0b1a33 60%, #06101f 100%);
  box-shadow:
    inset 0 0 0 3px rgba(103, 232, 249, 0.55),
    inset 0 0 22px rgba(103, 232, 249, 0.35),
    0 6px 14px rgba(0, 0, 0, 0.55);
  color: #67e8f9;
}

/* Face adversaire dessinée : bordeaux, rouge sombre, or (dos de la pièce) */
.face-adversaire {
  transform: rotateX(180deg);
  background: radial-gradient(circle at 35% 30%, #5c1a24 0%, #3a0d16 60%, #22070c 100%);
  box-shadow:
    inset 0 0 0 3px rgba(239, 68, 68, 0.5),
    inset 0 0 22px rgba(239, 68, 68, 0.3),
    0 6px 14px rgba(0, 0, 0, 0.55);
  color: #fca5a5;
}

.piece-symbole {
  font-size: calc(var(--taille-piece) * 0.42);
  line-height: 1;
  color: #f5d38a;
}

.face-joueur .piece-symbole {
  text-shadow: 0 0 12px rgba(103, 232, 249, 0.8);
}

.face-adversaire .piece-symbole {
  text-shadow: 0 0 12px rgba(239, 68, 68, 0.8);
}

.piece-libelle {
  font-size: calc(var(--taille-piece) * 0.085);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Image officielle d'une face (si présente) : remplace la face dessinée */
.piece-face.avec-image {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: none;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.55);
}

.piece-face.avec-image > span {
  display: none;
}

/* Ombre au sol : rétrécit pendant la montée, revient à la chute */
.piece-ombre {
  position: absolute;
  left: 15%;
  bottom: calc(var(--taille-piece) * 0.12);
  width: 70%;
  height: calc(var(--taille-piece) * 0.12);
  border-radius: 50%;
  background: radial-gradient(ellipse closest-side, rgba(0, 0, 0, 0.6), transparent);
}

.piece.lancer-joueur {
  animation: piece-lancer-joueur var(--duree-lancer, 2200ms) linear forwards;
}

.piece.lancer-adversaire {
  animation: piece-lancer-adversaire var(--duree-lancer, 2200ms) linear forwards;
}

.coin-flip-overlay.visible .piece-ombre {
  animation: piece-ombre var(--duree-lancer, 2200ms) ease-in-out forwards;
}

/* Halo de résultat : cyan / or (joueur), rouge / or (adversaire) */
.coin-flip-halo {
  position: absolute;
  left: 50%;
  bottom: calc(var(--taille-piece) * 0.78);
  width: calc(var(--taille-piece) * 1.9);
  aspect-ratio: 1;
  translate: -50% 50%;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.coin-flip-overlay.resultat-joueur .coin-flip-halo {
  opacity: 1;
  background: radial-gradient(circle closest-side, rgba(103, 232, 249, 0.45) 0%, rgba(212, 165, 116, 0.25) 45%, transparent 100%);
}

.coin-flip-overlay.resultat-adversaire .coin-flip-halo {
  opacity: 1;
  background: radial-gradient(circle closest-side, rgba(239, 68, 68, 0.45) 0%, rgba(212, 165, 116, 0.25) 45%, transparent 100%);
}

.coin-flip-texte {
  min-height: 1.6em;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #e8d4b0;
  transition:
    color 0.3s ease,
    text-shadow 0.3s ease;
}

.coin-flip-overlay.resultat-joueur .coin-flip-texte {
  color: #a5f3fc;
  text-shadow:
    0 0 14px rgba(103, 232, 249, 0.7),
    0 0 4px rgba(212, 165, 116, 0.6);
}

.coin-flip-overlay.resultat-adversaire .coin-flip-texte {
  color: #fecaca;
  text-shadow:
    0 0 14px rgba(239, 68, 68, 0.7),
    0 0 4px rgba(212, 165, 116, 0.6);
}

/* Montée, rotations rapides, ralentissement, retombée sur la face gagnante */
@keyframes piece-lancer-joueur {
  0% { transform: translateY(0) rotateX(0deg) scale(1); }
  15% { transform: translateY(-55%) rotateX(360deg) scale(1.08); }
  50% { transform: translateY(-95%) rotateX(1080deg) scale(1.12); }
  75% { transform: translateY(-40%) rotateX(1620deg) scale(1.06); }
  90% { transform: translateY(3%) rotateX(1780deg) scale(1); }
  100% { transform: translateY(0) rotateX(1800deg) scale(1); }
}

@keyframes piece-lancer-adversaire {
  0% { transform: translateY(0) rotateX(0deg) scale(1); }
  15% { transform: translateY(-55%) rotateX(400deg) scale(1.08); }
  50% { transform: translateY(-95%) rotateX(1180deg) scale(1.12); }
  75% { transform: translateY(-40%) rotateX(1760deg) scale(1.06); }
  90% { transform: translateY(3%) rotateX(1955deg) scale(1); }
  100% { transform: translateY(0) rotateX(1980deg) scale(1); }
}

@keyframes piece-ombre {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 0.25; transform: scale(0.55); }
  90% { opacity: 0.65; transform: scale(1.05); }
}

/* Mouvement réduit : courte rotation qui révèle directement la face */
@keyframes piece-reduit-joueur {
  from { transform: rotateX(-90deg); opacity: 0.2; }
  to { transform: rotateX(0deg); opacity: 1; }
}

@keyframes piece-reduit-adversaire {
  from { transform: rotateX(90deg); opacity: 0.2; }
  to { transform: rotateX(180deg); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .piece.lancer-joueur {
    animation-name: piece-reduit-joueur;
  }

  .piece.lancer-adversaire {
    animation-name: piece-reduit-adversaire;
  }

  .coin-flip-overlay.visible .piece-ombre {
    animation: none;
  }
}

/* ===== CAPACITÉS DISPONIBLES (retour du testeur Enzo) =====
   Halo doré à pulsation lente sur ce qui peut réellement être activé
   (majCapacitesDisponibles, js/plateau.js). Uniquement box-shadow, éléments
   positionnés en absolu et sans pointeur : aucune dimension ni position ne
   change, aucun clic n'est intercepté. */
@keyframes halo-capacite {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(232, 200, 122, 0.7),
      0 0 8px 2px rgba(232, 200, 122, 0.3);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(255, 226, 150, 0.95),
      0 0 16px 5px rgba(232, 200, 122, 0.5);
  }
}

/* Finalisation du peaufinage (performances) : sur les boutons, le halo au repos est fixe et son renfort pulse par
   opacity sur un pseudo-élément (avant : box-shadow animé, redessiné à chaque image tant qu'une capacité était prête). */
.btn-skills.capacite-disponible,
.btn-evolution.capacite-disponible,
.btn-protocole-omega.capacite-disponible {
  position: relative;
  box-shadow:
    0 0 0 1px rgba(232, 200, 122, 0.7),
    0 0 8px 2px rgba(232, 200, 122, 0.3);
}

.btn-skills.capacite-disponible::after,
.btn-evolution.capacite-disponible::after,
.btn-protocole-omega.capacite-disponible::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow:
    0 0 0 2px rgba(255, 226, 150, 0.95),
    0 0 16px 5px rgba(232, 200, 122, 0.5);
  opacity: 0;
  pointer-events: none;
  animation: halo-capacite-fondu 2.4s ease-in-out infinite;
}

@keyframes halo-capacite-fondu {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

/* Étiquette lisible sans survol, au-dessus du bouton (hors flux). Jamais
   plus large que son bouton : deux étiquettes voisines ne se chevauchent
   pas (retour à la ligne si besoin). */
.etiquette-capacite {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 100%;
  padding: 1px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-align: center;
  white-space: normal;
  color: #fff3d6;
  background: rgba(26, 20, 8, 0.9);
  border: 1px solid rgba(232, 200, 122, 0.8);
  border-radius: 999px;
  box-shadow: 0 0 8px rgba(232, 200, 122, 0.35);
  pointer-events: none;
}

/* Carte posée (Protocole Omega, Laboratoire Mécanique). Pendant un ciblage,
   la surbrillance de cible garde la priorité. */
.emplacement:not(.cible-attaque):not(.cible-skill):not(.cible-pose) .carte-posee.capacite-disponible {
  animation: halo-capacite 2.4s ease-in-out infinite;
}

.badge-capacite {
  position: absolute;
  top: 2px;
  right: 3px;
  z-index: 3;
  font-size: clamp(0.65rem, 15cqw, 0.95rem);
  line-height: 1;
  color: #ffe9a8;
  text-shadow:
    0 0 6px rgba(232, 200, 122, 0.95),
    0 1px 2px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

/* Fenêtre Skills : ligne d'un Skill réellement utilisable */
.skill-ligne.skill-disponible {
  border-color: rgba(232, 200, 122, 0.75);
  box-shadow:
    inset 0 0 0 1px rgba(232, 200, 122, 0.35),
    0 0 12px rgba(232, 200, 122, 0.25);
}

.skill-dispo-etiquette {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #e8c87a;
}

@media (prefers-reduced-motion: reduce) {
  .btn-skills.capacite-disponible,
  .btn-evolution.capacite-disponible,
  .btn-protocole-omega.capacite-disponible,
  .emplacement:not(.cible-attaque):not(.cible-skill):not(.cible-pose) .carte-posee.capacite-disponible {
    animation: none;
    box-shadow:
      0 0 0 2px rgba(232, 200, 122, 0.85),
      0 0 10px 3px rgba(232, 200, 122, 0.4);
  }

  .btn-skills.capacite-disponible::after,
  .btn-evolution.capacite-disponible::after,
  .btn-protocole-omega.capacite-disponible::after {
    animation: none;
  }
}

/* ===== FORTERESSE PROTÉGÉE (refonte du combat, phase C) =====
   Pendant la sélection d'un attaquant, la Forteresse adverse n'est pas une
   cible tant qu'il reste une Troupe adverse : aucune surbrillance de cible,
   bouclier et mention « Protégée » à la place. Éléments sans pointeur, hors
   flux : aucune dimension ne change. */
.info-forteresse.forteresse-protegee {
  position: relative;
  cursor: not-allowed;
  opacity: 0.75;
  filter: saturate(0.6);
}

.info-forteresse.forteresse-protegee::after {
  content: "🛡️ Protégée";
  position: absolute;
  left: 50%;
  top: calc(100% + 4px);
  transform: translateX(-50%);
  padding: 1px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  color: #e6edf7;
  background: rgba(12, 20, 36, 0.92);
  border: 1px solid rgba(148, 178, 220, 0.75);
  border-radius: 999px;
  pointer-events: none;
  z-index: 5;
}

/* ===== PV DES BÂTIMENTS (refonte du combat, phase A1) =====
   Même badge que les PV des Troupes (.carte-posee-pv-image), teinte pierre.
   Position ajustée au gabarit Bâtiment : sur l'illustration, jamais sur le
   titre ni le texte d'effet imprimés ; aucune dimension de carte modifiée. */
.carte-posee.avec-image .carte-posee-pv-image.carte-posee-pv-batiment {
  /* Gabarit Bâtiment : texte d'effet imprimé sous ~60 % de la hauteur ;
     le badge reste sur l'illustration, au-dessus de cet encadré. */
  bottom: 43%;
  right: 4%;
  max-width: 92%;
  padding: 0.4cqw 1.6cqw;
  letter-spacing: -0.01em;
  border: 1px solid rgba(214, 196, 160, 0.55);
}

/* ===== STATISTIQUES EFFECTIVES DES TROUPES (refonte du combat, phase A2) =====
   Décision O2 : seules les statistiques qui diffèrent de la carte imprimée
   (auras, améliorations, malus…) sont rappelées en haut à droite de
   l'illustration (les icônes d'état occupent la gauche, les PV le bas),
   avec ▲ / ▼ en plus de la couleur. PNG et dimensions inchangés ; masqué
   sans image (texte complet déjà affiché). */
.carte-posee-stats-effectives {
  display: none;
}

.carte-posee.avec-image .carte-posee-stats-effectives {
  position: absolute;
  right: 5%;
  top: 17.5%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  max-width: 90%;
  pointer-events: none;
}

/* Avec des statistiques effectives, les icônes d'état (à gauche) et le
   badge (à droite) se partagent la largeur : les icônes passent à la ligne
   au lieu de chevaucher le badge sur les petites cartes (1366 × 657). */
.carte-posee.avec-image:has(.carte-posee-stats-effectives) .carte-posee-tags-image {
  max-width: 46%;
}

.carte-posee.avec-image .carte-posee-stats-effectives {
  max-width: 48%;
}

.stat-effective {
  display: inline-block;
  font-size: clamp(0.6rem, 14cqw, 0.85rem);
  font-weight: 700;
  line-height: 1.05;
  white-space: nowrap;
  padding: 0 1.4cqw;
  border-radius: 3px;
  background: rgba(10, 14, 20, 0.82);
  letter-spacing: -0.01em;
}

.stat-effective.hausse {
  color: #86efac;
  border: 1px solid rgba(134, 239, 172, 0.6);
}

.stat-effective.baisse {
  color: #fca5a5;
  border: 1px solid rgba(252, 165, 165, 0.6);
}

/* ===== CIBLAGE DES BÂTIMENTS (refonte du combat, phase B) =====
   Pendant la sélection d'un attaquant : les Bâtiments exposés reçoivent la
   même surbrillance de cible que les Troupes (.cible-attaque) ; les
   Bâtiments protégés ne sont jamais surlignés, seulement atténués avec une
   mention « Couloir » ou « Gardien » (texte + icône, détail en infobulle).
   Distinct des halos dorés des capacités ; aucune dimension modifiée. */
.emplacement.batiment-protege {
  cursor: not-allowed;
}

.emplacement.batiment-protege .carte-posee {
  filter: saturate(0.55) brightness(0.78);
}

.emplacement.batiment-protege::after {
  position: absolute;
  left: 50%;
  top: 24%;
  transform: translateX(-50%);
  z-index: 4;
  max-width: 96%;
  padding: 1px 5px;
  font-size: clamp(0.5rem, 0.55vw, 0.72rem);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  color: #e6edf7;
  background: rgba(12, 20, 36, 0.92);
  border: 1px solid rgba(148, 178, 220, 0.75);
  border-radius: 999px;
  pointer-events: none;
}

.emplacement.batiment-protege[data-protection="colonne"]::after {
  content: "🛡️ Bloqué";
}

.emplacement.batiment-protege[data-protection="gardien"]::after {
  content: "🛡️ Gardien";
}

.emplacement.batiment-protege[data-protection="kamikaze"]::after {
  content: "✖ Kamikaze";
}

/* ===== COMBAT PAR COLONNES (correction B+C) =====
   La mention de la Forteresse dépend de l'attaquant sélectionné : colonne
   bloquée par une Troupe adverse, ou protection d'un Gardien. */
.info-forteresse.forteresse-protegee[data-protection="colonne"]::after {
  content: "🛡️ Colonne bloquée";
}

.info-forteresse.forteresse-protegee[data-protection="gardien"]::after {
  content: "🛡️ Gardien";
}

/* ===== CHRONOMÈTRE STRATÉGIQUE (Lot R5) =====
   Capsule « ⏱️ MM:SS + statut » dans la barre de chaque camp. L'état ne
   repose jamais sur la seule couleur : icône (⏱️ / ⏳ / ⚠️ / ⌛) et libellé
   (En cours, En pause, Temps faible, Critique, Temps écoulé, IA). Aucun
   clignotement ; la seule animation (lueur lente du camp décompté) est
   supprimée si le système demande de réduire les animations. */
.chrono-camp {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  padding: 0.18rem 0.6rem 0.18rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 165, 116, 0.38);
  background: rgba(12, 18, 32, 0.72);
  color: #f5e6c8;
  line-height: 1.1;
  white-space: nowrap;
  position: relative; /* repère de la lueur du camp décompté (::after) */
  transition: border-color 0.4s ease, box-shadow 0.4s ease, background-color 0.4s ease;
}

.chrono-camp[hidden] {
  display: none;
}

.chrono-icone {
  font-size: 0.95rem;
}

/* Chiffres stables : largeur fixe, aucune oscillation du texte voisin */
.chrono-temps {
  font-size: 1.05rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  min-width: 3.2em;
  text-align: center;
}

.chrono-statut {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #cbd5e1;
}

/* Camp décompté : contour lumineux de son camp */
/* Finalisation du peaufinage (performances) : contour fixe, et lueur qui respire par opacity sur un pseudo-élément
   (avant : box-shadow animé, redessiné à chaque image pendant tout le tour du joueur). */
.barre-joueur .chrono-camp.chrono--actif {
  border-color: rgba(56, 189, 248, 0.85);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35), 0 0 8px rgba(56, 189, 248, 0.25);
}

.barre-joueur .chrono-camp.chrono--actif::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.2), 0 0 14px rgba(56, 189, 248, 0.4);
  opacity: 0;
  pointer-events: none;
  animation: chrono-lueur 2.4s ease-in-out infinite;
}

.chrono-camp.chrono--actif .chrono-statut {
  color: #7dd3fc;
}

/* En pause : atténué, statut explicite */
.chrono-camp.chrono--pause {
  opacity: 0.78;
}

/* IA : budget affiché, jamais décompté (décisions instantanées) */
.chrono-camp.chrono--ia {
  opacity: 0.7;
  border-style: dashed;
}

/* Seuils (camp joueur) : 60 s discret, 30 s visible, 10 s critique */
.chrono-camp.chrono--attention .chrono-temps {
  color: #fcd34d;
}

.chrono-camp.chrono--alerte {
  border-color: rgba(251, 146, 60, 0.9);
  background: rgba(67, 32, 10, 0.78);
}

.chrono-camp.chrono--alerte .chrono-temps {
  color: #fdba74;
}

.chrono-camp.chrono--critique {
  border-color: rgba(248, 113, 113, 0.95);
  background: rgba(80, 14, 14, 0.85);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.45), 0 0 14px rgba(239, 68, 68, 0.45);
}

.chrono-camp.chrono--critique .chrono-temps,
.chrono-camp.chrono--critique .chrono-statut {
  color: #fecaca;
}

.chrono-camp.chrono--expire {
  border-color: rgba(248, 113, 113, 0.95);
  background: rgba(60, 10, 10, 0.9);
  opacity: 1;
}

@keyframes chrono-lueur {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .barre-joueur .chrono-camp.chrono--actif {
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35), 0 0 12px rgba(56, 189, 248, 0.35);
  }

  .barre-joueur .chrono-camp.chrono--actif::after {
    animation: none;
  }
}

html.effets-reduits .barre-joueur .chrono-camp.chrono--actif::after,
html.effets-reduits .btn-skills.capacite-disponible::after,
html.effets-reduits .btn-evolution.capacite-disponible::after,
html.effets-reduits .btn-protocole-omega.capacite-disponible::after {
  animation: none;
}

/* Largeur réduite (jusqu'à 1700 px) : la barre du joueur peut être pleine (Forteresse, jusqu'à
   3 ressources, phases, 3 boutons). Le chronomètre du joueur sort du flux et
   se place juste au-dessus du bord gauche de la barre (comme les pastilles
   « Capacité disponible » au-dessus des boutons) : aucun élément de la barre
   n'est déplacé ni comprimé. */
@media (max-width: 1700px) {
  .barre-joueur .chrono-camp {
    position: absolute;
    left: 0.6rem;
    bottom: calc(100% + 0.3rem);
    z-index: 2;
  }
}

/* Annonces des seuils pour les lecteurs d'écran (visuellement masquées) */
.chrono-annonce {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Petites hauteurs : capsule compacte (statut masqué visuellement, l'icône
   et le libellé accessible restent) */
@media (max-height: 700px), (max-width: 1400px) {
  .chrono-camp {
    padding: 0.1rem 0.32rem 0.1rem 0.26rem;
    gap: 0.15rem;
  }
  .chrono-icone {
    font-size: 0.8rem;
  }
  .chrono-temps {
    font-size: 0.9rem;
    min-width: 2.7em;
  }
  /* Largeur réduite : le libellé cède la place à un repère non coloré
     (▶ décompté, ⏸ en pause) ; le libellé complet reste dans aria-label. */
  .chrono-statut {
    display: none;
  }
  .chrono-camp.chrono--actif::after {
    content: "▶";
    font-size: 0.7rem;
    color: #7dd3fc;
  }
  .chrono-camp.chrono--pause::after {
    content: "⏸";
    font-size: 0.7rem;
    color: #cbd5e1;
  }
}

/* ===== FENÊTRE SKILLS : ONGLETS ET SKILLS ADVERSES (Lot R6) =====
   Deux onglets classiques en tête de la fenêtre existante (mêmes cadre,
   dimensions et défilement). L'onglet adverse est en lecture seule : ses
   lignes réutilisent le rendu des Skills, avec un état public à la place
   d'un bouton. */
.skills-onglets {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
  padding: 0.2rem 1.4rem 0;
  background: rgba(15, 10, 30, 0.35);
  border-bottom: 1px solid rgba(167, 139, 250, 0.35);
}

/* L'en-tête et les onglets forment un seul bandeau : un seul filet */
.skills-entete {
  border-bottom: none;
}

.skills-compteur.skills-compteur--masque {
  visibility: hidden;
}

.skills-onglet {
  flex: 0 0 auto;
  padding: 0.45rem 1.1rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #cbd5e1;
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  margin-bottom: -1px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.skills-onglet:hover {
  color: #f5e6c8;
  background: rgba(76, 29, 149, 0.45);
}

.skills-onglet.actif {
  color: #f5e6c8;
  background: rgba(124, 58, 237, 0.42);
  border-color: rgba(167, 139, 250, 0.75);
  box-shadow: inset 0 3px 0 #d4a574;
}

.skills-onglet:focus-visible {
  outline: 2px solid #d4a574;
  outline-offset: 2px;
}

/* La liste est en flex : l'attribut hidden doit l'emporter explicitement */
.skills-liste[hidden],
.skills-compteur[hidden] {
  display: none;
}

.skills-adverses-liste:focus-visible {
  outline: 2px solid rgba(212, 165, 116, 0.6);
  outline-offset: 2px;
}

.skills-adverses-intro {
  margin: 0;
  font-size: 0.85rem;
  color: #cbd5e1;
}

/* Lignes consultables : aucun curseur d'action */
.skill-ligne.skill-consultation {
  cursor: default;
}

.skill-etat-public {
  display: inline-block;
  max-width: 11rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
}

.skill-etat-public.etat-passif {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
  border-color: rgba(74, 222, 128, 0.35);
}

.skill-etat-public.etat-utilise,
.skill-etat-public.etat-consomme {
  color: #94a3b8;
}

.skill-etat-public.etat-arme {
  color: #fcd34d;
  background: rgba(212, 165, 116, 0.16);
  border-color: rgba(212, 165, 116, 0.6);
}

.skill-etat-public.etat-non-utilise {
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.45);
}

@media (max-height: 700px) {
  .skills-onglet {
    padding: 0.35rem 0.9rem;
    font-size: 0.78rem;
  }
}

/* Lot R6 : pendant une animation bloquante (pioche), les actions de jeu
   attendent ; le curseur d'attente l'indique sur les commandes concernées. */
body.actions-en-attente :is(.btn-poser, #btn-jouer-sort, #btn-confirmer-paiement, #btn-valider-ressources, .btn-utiliser-skill, .btn-fin-tour, #phase-combat, #btn-protocole-omega, #evolution-liste button, #btn-valider-selection, .emplacement, .info-forteresse) {
  cursor: progress;
}

/* Académie (lot A1) : bulle de guidage d'une mission (plateau.html?mission=<id>).
   Mêmes classes visuelles que le tutoriel (css/tutoriel.css : .tuto-entete,
   .tuto-cible, .tuto-fin…) ; seul le conteneur a son propre identifiant pour
   que le tutoriel et l'Académie restent distincts. */
#academie-coach {
  position: fixed;
  left: 14px;
  top: 50%;
  z-index: 10000;
  width: min(340px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  padding: 0.85rem 1rem 0.9rem;
  color: #f5e6c8;
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.97) 0%, rgba(30, 41, 59, 0.96) 100%);
  border: 1px solid #d4a574;
  border-radius: 12px;
  box-shadow:
    0 0 0 1px rgba(103, 232, 249, 0.12) inset,
    0 14px 34px rgba(0, 0, 0, 0.6);
}

.academie-coach-mission {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: #fcd34d;
}

.academie-fin-remarque {
  color: #fde68a;
}

/* Académie (lot A5) : écran de fin de l'Épreuve finale (mission 17). */
.academie-fin-reussie .tuto-fin-boite {
  border-color: #fcd34d;
  box-shadow:
    0 0 0 1px rgba(252, 211, 77, 0.35) inset,
    0 0 36px rgba(252, 211, 77, 0.25),
    0 18px 44px rgba(0, 0, 0, 0.65);
}

.academie-fin-reussie .tuto-fin-titre {
  color: #fcd34d;
  letter-spacing: 0.08em;
}

.academie-fin-bravo {
  margin: 0 0 0.6rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #f5e6c8;
}

.academie-fin-badge {
  display: inline-block;
  margin: 0 0 1.1rem;
  padding: 0.3rem 0.9rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #0f172a;
  background: linear-gradient(135deg, #d4a574 0%, #fcd34d 100%);
  border-radius: 999px;
}

/* Écrans moyens (1366 × 657…) : bulle plus étroite, pour qu'elle trouve une place
   libre à côté d'une fenêtre ouverte (paiement, ressources) au lieu de la chevaucher. */
@media (max-width: 1500px) {
  #academie-coach {
    width: min(270px, calc(100vw - 28px));
    padding: 0.7rem 0.8rem 0.75rem;
    font-size: 0.92rem;
  }
}

/* Lot F3-F ter : contour doré du Léviathan (Héros des Aquatiques).
   Son illustration est la seule des 10 cartes Héros sans halo peint autour du
   cadre (même cadre que les Troupes Aquatiques normales) : sans ce contour, il
   ne se distingue pas comme Héros. Le halo est ajouté à la présentation, dans
   la marge transparente de l'image, et suit sa silhouette (drop-shadow) ;
   l'image elle-même n'est pas modifiée. Le sélecteur porte sur le fichier de
   la carte : aucune autre Troupe n'est concernée. Les filtres d'état du
   plateau portent sur les conteneurs et s'appliquent par-dessus. */
img[src$="/aquatiques_leviathan.webp"],
img[src$="/aquatiques_leviathan.png"] {
  filter: drop-shadow(0 0 1px rgba(255, 230, 155, 1)) drop-shadow(0 0 2px rgba(240, 190, 80, 0.95)) drop-shadow(0 0 5px rgba(214, 150, 40, 0.65));
}

/* Lot F3-G2A : carte Héros Stade 2 dynamique (composant CarteHeros,
   css/carte-heros.css) à la place de l'illustration d'un Héros évolué, sur le
   terrain et dans l'inspection. Même boîte que l'image officielle ; aucun
   pointeur (les clics restent ceux de l'emplacement). Le contour blanc déborde
   de quelques pixels : l'inspection ne le rogne pas. Sur le terrain, les
   badges du coin supérieur descendent sous l'insigne « STADE 2 ». */
.carte-posee > .carte-heros,
.inspection-carte-image > .carte-heros {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.inspection-carte-image.carte-heros-dynamique {
  overflow: visible;
}
.carte-posee.carte-heros-dynamique .carte-posee-tags-image,
.carte-posee.carte-heros-dynamique .carte-posee-stats-effectives {
  top: 24%;
}
.carte-posee.carte-heros-dynamique .carte-posee-omega {
  top: 33%;
}

/* ===== LOT PLATEAU-16:9 (CORRIGÉ) : TERRAIN CENTRÉ, INSPECTION CONTEXTUELLE =====
   - Plus de colonne ni de réserve pour l'inspection : le plateau occupe toute
     la largeur et les rangées (colonnes latérales de même largeur, 5 cartes au
     milieu) sont centrées sur l'écran. Decks et Défausses des deux camps à
     droite, Tactiques à gauche (plateau.html).
   - Tapis (lot PLATEAU-FOND) : tapis officiel 16:9 « tapis de base.png »,
     posé sans déformation par alignerTapisSurLigneDeFront (js/plateau.js) :
     toute la largeur couverte, ligne de front de l'image sur la séparation
     des camps, axe de symétrie sur l'axe des 5 colonnes.
   - Inspection : masquée par défaut ; au survol d'une carte, le panneau
     (position fixe, hors du flux : rien ne bouge) apparaît dans la marge
     latérale la plus appropriée, puis disparaît à la fin du survol
     (placerPanneauInspection, js/plateau.js). Jamais cliquable.
   - Hauteur rendue au terrain (inchangé depuis le premier lot) : barre du
     joueur sur une ligne, main et dos adverses un peu plus petits. */
:root {
  --largeur-inspection: clamp(200px, 16vw, 320px); /* largeur souhaitée du panneau temporaire */
  --hauteur-carte-main: clamp(112px, 14.5vh, 160px);
  --largeur-dos-adverse: clamp(26px, 2.1vw, 38px);
}

.barre-joueur {
  min-height: clamp(46px, 6vh, 60px);
  padding: 0.25rem 1rem;
}

.barre-joueur .btn-evolution,
.barre-joueur .btn-protocole-omega,
.barre-joueur .btn-skills,
.barre-joueur .btn-fin-tour {
  padding: 0.45rem 1rem;
  white-space: nowrap;
}

/* Bandeau « Inspection du terrain » (répartition, paiement) : centré sur
   l'écran, puisqu'aucune colonne n'est plus réservée à droite. */
.bandeau-inspection-repartition {
  left: 50%;
  max-width: calc(100vw - 32px);
}

/* Panneau d'inspection temporaire. Position, largeur et hauteur maximale sont
   posées en JS à chaque apparition. */
#panneau-inspection {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90; /* sous les fenêtres (100), au-dessus du plateau */
  width: var(--largeur-inspection);
  height: auto;
  max-height: calc(100vh - 16px);
  padding: 0.5rem 0.55rem;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.12s ease, visibility 0s linear 0.12s;
  background:
    linear-gradient(180deg, rgba(212, 165, 116, 0.08) 0%, transparent 18%),
    linear-gradient(180deg, rgba(10, 14, 22, 0.9) 0%, rgba(18, 25, 38, 0.86) 100%);
  border: 1px solid rgba(212, 165, 116, 0.45);
  border-radius: 12px;
  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 230, 180, 0.1);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

#panneau-inspection.inspection-visible {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.12s ease;
}

/* Illustration 2:3 bornée par la largeur du panneau et par la hauteur
   disponible (variable posée en JS), pour garder les détails lisibles. */
#panneau-inspection .inspection-carte-image {
  width: min(100%, calc(var(--hauteur-image-inspection, 44vh) * 2 / 3));
}

#panneau-inspection .inspection-contenu,
#panneau-inspection .inspection-details {
  gap: 0.45rem;
}

#panneau-inspection .inspection-details {
  overflow: hidden;
}

/* ===== LOT PLATEAU-FOND : effets du tapis vivant recalés sur le nouveau tapis =====
   Repères mesurés sur « tapis de base.png » (1672 × 941), exprimés comme les
   règles d'origine en part de la largeur du sol (0,56 × largeur de l'image) et
   par rapport au milieu de l'image : médaillons de la ligne de front à
   x ≈ 339 et 1332 (0,531 et 0,530 × sol de part et d'autre du milieu), rayon
   extérieur ≈ 45 px (anneau ≈ 0,108 × sol, même marge que l'original). Les
   règles d'origine (0,563 / 0,531 / 0,106, mesurés sur tapis-base.png) ne sont
   pas modifiées : seules leurs variables sont redéfinies ici. */
.terrain-adversaire::before,
.terrain-adversaire::after {
  --tv-anneau: clamp(44px, calc(var(--tv-sol) * 0.108), 190px);
  --tv-ecart-g: calc(var(--tv-sol) * 0.531);
  --tv-ecart-d: calc(var(--tv-sol) * 0.53);
}

.arene-energie {
  --tv-mur-g: calc(50% + var(--tapis-decalage-x, 0px) - var(--tv-sol) * 0.531);
  --tv-mur-d: calc(50% - var(--tapis-decalage-x, 0px) - var(--tv-sol) * 0.53);
}

.terrain-joueur::before,
.terrain-joueur::after {
  --tv-ecart-g: calc(var(--largeur-sol-tapis, 1100px) * 0.531);
  --tv-ecart-d: calc(var(--largeur-sol-tapis, 1100px) * 0.53);
}

/* ===== Bloc 6 (directive V1.9-N) : option « Réduire les animations » ===== */
/* Mêmes réductions que les blocs prefers-reduced-motion ci-dessus (apparition de l'IA, arène, tapis vivant),
   déclenchées par la classe effets-reduits de <html> (js/effets-reduits.js). Présentation seule. */
html.effets-reduits .emplacement.apparition-ia,
html.effets-reduits .arene::before,
html.effets-reduits .separateur-central,
html.effets-reduits .separateur-central::before,
html.effets-reduits .separateur-central::after,
html.effets-reduits .barre-info.camp-actif::before,
html.effets-reduits .phase-etape.active::after,
html.effets-reduits .terrain-adversaire::before,
html.effets-reduits .terrain-adversaire::after,
html.effets-reduits .energie-mur,
html.effets-reduits .energie-mur::before,
html.effets-reduits .energie-mur::after,
html.effets-reduits .energie-sursaut::before {
  animation: none;
}
html.effets-reduits .terrain-joueur::before,
html.effets-reduits .terrain-joueur::after,
html.effets-reduits .energie-eclat,
html.effets-reduits .energie-sursaut {
  animation: none;
  opacity: 0;
}
html.effets-reduits .separateur-central::before {
  transform: translateX(142.3%);
  opacity: 1;
}

/* ===== CHARTE DES FENÊTRES DE PARTIE (finalisation du peaufinage) ===== */
/* Même langage que les menus (css/ecrans.css, .ecran-panneau ; css/charte.css) pour tout ce qui s'ouvre pendant une
   partie : panneau d'obsidienne à filet d'or doublé, titres en Cinzel or clair, actions à cadre doré, onglet actif à
   accent saphir. Présentation seule, posée en fin de feuille : aucune dimension, aucune position et aucun comportement
   des fenêtres ne change (mêmes boîtes, mêmes boutons, mêmes identifiants) ; le plateau lui-même (tapis, cartes, barres,
   animations) n'est pas concerné, ni l'écran de fin de partie et l'aperçu des cartes, qui ont leurs illustrations.
   Les couleurs de fonction restent lisibles : rouge pour annuler ou quitter, violet discret pour les Skills. */
:root {
  --charte-obsidienne-panneau: rgba(11, 13, 20, 0.96);
  --charte-or: #c9a24b;
  --charte-or-clair: #e8c87a;
  --charte-or-sombre: #7a5f27;
  --charte-saphir: #3b6fd8;
  --charte-saphir-lueur: rgba(59, 111, 216, 0.55);
  --charte-ivoire: #f3ead6;
  --charte-titre: "Cinzel", Georgia, serif;
}

/* ----- Cadres ----- */
body :is(.modal-boite, .evolution-boite, .skills-boite, .selection-cartes-boite, .conversion-boite, .omega-choix-boite, .tactique-preparee-boite, .reaction-tactique-boite) {
  border: 2px solid var(--charte-or);
  border-radius: 4px;
  outline: 1px solid var(--charte-or-sombre);
  outline-offset: 3px;
  background: linear-gradient(180deg, rgba(16, 20, 32, 0.97) 0%, var(--charte-obsidienne-panneau) 100%);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.7);
  color: var(--charte-ivoire);
}

body :is(.journal-combat-panneau, .journal-carte-fiche, #panneau-inspection) {
  border: 1px solid var(--charte-or);
  border-radius: 4px;
  outline: 1px solid var(--charte-or-sombre);
  outline-offset: 2px;
}

/* ----- Titres ----- */
body :is(.modal-titre, .evolution-titre, .skills-titre, .omega-choix-titre, .selection-cartes-titre, .conversion-titre, .reaction-tactique-titre, .journal-entete) {
  color: var(--charte-or-clair);
  font-family: var(--charte-titre);
  letter-spacing: 0.04em;
  text-shadow: 0 0 16px rgba(201, 162, 75, 0.3);
}

body .modal-soustitre {
  color: #cdbb93;
}

/* ----- Actions : cadre doré, fond saphir sombre (bouton d'action des menus) ----- */
body :is(.btn-valider-ressources, .btn-fermer-evolution, .btn-fermer-skills, .btn-menu, .btn-reprendre-repartition, .btn-inspecter-repartition) {
  border: 1px solid var(--charte-or);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(59, 111, 216, 0.35), rgba(11, 13, 20, 0.92));
  color: var(--charte-ivoire);
  font-family: var(--charte-titre);
  letter-spacing: 0.04em;
}

body :is(.btn-valider-ressources, .btn-fermer-evolution, .btn-fermer-skills, .btn-menu, .btn-reprendre-repartition, .btn-inspecter-repartition):hover:not(:disabled) {
  border-color: var(--charte-or-clair);
  box-shadow: 0 0 14px var(--charte-saphir-lueur);
}

/* Annuler, quitter : même cadre, accent rouge */
body :is(.btn-annuler-repartition, .btn-annuler-paiement, .btn-annuler-omega-choix) {
  border-radius: 3px;
  font-family: var(--charte-titre);
  letter-spacing: 0.04em;
}

/* ----- Onglets (fenêtre des Skills) : onglet actif à accent saphir, comme les menus ----- */
body .skills-onglet {
  border-color: rgba(201, 162, 75, 0.45);
  border-radius: 3px 3px 0 0;
  font-family: var(--charte-titre);
}

body .skills-onglet.actif {
  border-color: var(--charte-or);
  background: linear-gradient(180deg, rgba(59, 111, 216, 0.5), rgba(59, 111, 216, 0.18));
  color: var(--charte-ivoire);
}

body .skills-compteur {
  border-color: rgba(201, 162, 75, 0.6);
  background: rgba(11, 13, 20, 0.7);
}

/* ----- Boutons des barres : même cadre doré, la couleur de fond garde la fonction ----- */
/* (police et largeur inchangées : les barres sont mesurées au pixel près sur les petits écrans) */
body :is(.btn-fin-tour, .btn-skills, .btn-evolution, .btn-quitter, .btn-journal-combat) {
  border-radius: 3px;
}

body :is(.btn-fin-tour, .btn-skills, .btn-evolution) {
  border-color: var(--charte-or);
}

/* ----- Stabilisation : choix du premier joueur après le pile ou face (js/plateau.js, proposerChoixPremierJoueur) ----- */
/* Deux boutons sous le résultat du tirage, à la charte des menus : « Je commence » en action principale. */
.coin-flip-choix {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.coin-flip-choix[hidden] {
  display: none;
}

.btn-coin-flip {
  padding: 0.55rem 1.1rem;
  border: 2px solid var(--charte-or);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(59, 111, 216, 0.4), rgba(11, 13, 20, 0.92));
  color: var(--charte-ivoire);
  font-family: var(--charte-titre);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.btn-coin-flip--secondaire {
  border-width: 1px;
  background: rgba(11, 13, 20, 0.85);
}

.btn-coin-flip:hover,
.btn-coin-flip:focus-visible {
  border-color: var(--charte-or-clair);
  box-shadow: 0 0 14px var(--charte-saphir-lueur);
  outline: none;
}

/* Unification du combat (22 novembre 2026) : carte de la main non jouable maintenant selon les règles du moteur
   (js/cartes-jouables.js : même règle que la main du duel, envoyée par le serveur ; même rendu que css/duel.css,
   .duel-main .duel-carte:not(.jouable)). Présentation seule : la carte reste cliquable, son aperçu s’ouvre comme avant. */
.carte-main.carte-main--injouable {
  filter: brightness(0.82);
}

.carte-main.avec-image.carte-main--injouable {
  filter: brightness(0.82) drop-shadow(0 4px 5px rgba(0, 0, 0, 0.55));
}

.carte-main.avec-image.carte-main--injouable:hover {
  filter: brightness(0.82) drop-shadow(0 12px 12px rgba(0, 0, 0, 0.65));
}
