/* ==========================================================
   game.css - Live4Ever : Biocosm
   Direction Artistique : Thème Clair (Laboratoire & Sérum Lumineux)
   Fond clair franc, zéro dégradé radial, typographie encre noire
   ========================================================== */

:root {
  /* Fond clair lumineux et noble (style sérum de culture) */
  --color-bg-base: #f8f9fa;
  --color-bg-surface: #ffffff;
  --color-bg-surface-hover: #f1f5f9;
  --color-border-subtle: #e2e8f0;
  --color-border-active: #2d6a4f;

  /* Typographie encre sombre à fort contraste */
  --color-text-primary: #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted: #94a3b8;

  /* Palette biologique naturelle (Chlorophylle, Ambre, Rubis) */
  --color-bio-leaf: #2d6a4f;
  --color-bio-leaf-light: #40916c;
  --color-bio-amber: #d97706;
  --color-bio-ruby: #be123c;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-card: 12px;
  --radius-btn: 8px;
  --radius-tag: 6px;
  --shadow-subtle: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-card-active: 0 6px 20px rgba(45, 106, 79, 0.14);
}

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

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--color-bg-base);
  color: var(--color-text-primary);
  font-family: var(--font-family);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  -webkit-font-smoothing: antialiased;
}

/* Accessibilité W3C : Masquage visuel tout en restant accessible aux lecteurs d'écran */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Conteneur plein écran */
#app {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--color-bg-base);
}

/* Canvas de jeu 60 FPS */
#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* ==========================================================
   ÉCRAN D'ACCUEIL : DÉFILEMENT NATUREL & CARNET SCIENTIFIQUE
   ========================================================== */
.screen-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 1.25rem 0 0 0;
  background-color: transparent;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.screen-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* En-tête sobre et compact */
.header-title-group {
  text-align: center;
  max-width: 680px;
  width: 100%;
  padding: 0 1.25rem;
  margin-bottom: 0.85rem;
  box-sizing: border-box;
}

.badge-tag {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  background: #ffffff;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-tag);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-bio-leaf);
  margin-bottom: 0.35rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.site-title {
  font-size: clamp(1.8rem, 3.2vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  margin-bottom: 0.2rem;
}

.site-subtitle {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  font-weight: 400;
  line-height: 1.4;
}

/* Section de sélection avec Carrousel */
.selection-section {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding: 0 1rem;
  box-sizing: border-box;
}

.selection-header {
  display: none;
  /* Masqué pour éviter d'allonger la page inutilement */
}

/* Conteneur Carrousel */
.carousel-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.carousel-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--color-border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.15s ease;
  z-index: 5;
  flex-shrink: 0;
}

.carousel-arrow:hover {
  background: var(--color-bg-surface-hover);
  border-color: var(--color-bio-leaf);
  color: var(--color-bio-leaf);
  transform: scale(1.06);
}

.carousel-arrow:active {
  transform: scale(0.96);
}

.carousel-viewport {
  width: 100%;
  max-width: 760px;
  overflow: hidden;
  position: relative;
  border-radius: var(--radius-card);
}

.carousel-track {
  display: flex;
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
  width: 100%;
}

/* Carte individuelle du Carrousel */
.character-card {
  flex: 0 0 100%;
  width: 100%;
  position: relative;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-card);
  padding: 1.2rem 1.5rem;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.character-card:focus-visible {
  outline: 2px solid var(--color-border-active);
  outline-offset: 2px;
}

/* Carte active */
.character-card.active {
  border-color: var(--color-border-active);
  border-width: 2px;
  box-shadow: 0 8px 24px rgba(45, 106, 79, 0.15);
}

/* Carte en stase / verrouillée */
.character-card.locked {
  background: #fafbfc;
  border-color: #e2e8f0;
}

.card-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 0.5rem;
}

.card-specimen-id {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* Badge de record personnel par spécimen (Points & Meilleur Temps) */
.card-record-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.18rem 0.6rem;
  border-radius: var(--radius-tag);
  white-space: nowrap;
  transition: all 0.15s ease;
}

.card-record-badge.has-record {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  box-shadow: 0 1px 3px rgba(217, 119, 6, 0.08);
}

.card-record-badge.empty {
  background: #f8fafc;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border-subtle);
  font-weight: 600;
  opacity: 0.85;
}

.card-status-badge {
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-tag);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.card-status-badge.ready {
  background: #ecfdf5;
  color: var(--color-bio-leaf);
  border: 1px solid #a7f3d0;
}

.card-status-badge.locked {
  background: #f1f5f9;
  color: var(--color-text-muted);
  border: 1px solid #e2e8f0;
}

/* Agencement en 2 colonnes confortables sur grand écran */
.card-main-content {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 1.5rem;
  width: 100%;
}

.card-hero-identity {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  border-right: 1px solid var(--color-border-subtle);
  padding-right: 1.4rem;
}

.card-hero-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  gap: 0.55rem;
}

.card-avatar-canvas {
  width: 86px;
  height: 86px;
  margin: 0 0 0.45rem 0;
  display: block;
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid var(--color-border-subtle);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.character-card:hover .card-avatar-canvas {
  transform: scale(1.04);
  border-color: var(--color-bio-leaf-light);
  box-shadow: 0 4px 14px rgba(45, 106, 79, 0.12);
}

.card-hero-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-text-primary);
  margin-bottom: 0.15rem;
  line-height: 1.25;
}

.card-hero-role {
  font-size: 0.76rem;
  color: var(--color-bio-leaf);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.card-hero-desc {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--color-text-secondary);
  margin: 0;
}

/* Badge arme de départ */
.card-weapon-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: #f8fafc;
  border: 1px solid var(--color-border-subtle);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-tag);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
  width: 100%;
}

.card-weapon-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-bio-leaf);
  white-space: nowrap;
}

/* Encart Rôle Vital & Protection */
.card-bio-benefit {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  margin: 0;
  width: 100%;
  text-align: left;
}

.bio-benefit-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--color-bio-leaf-dark);
  margin-bottom: 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bio-benefit-role {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: #166534;
  margin-bottom: 0.15rem;
}

.bio-benefit-desc {
  font-size: 0.76rem;
  line-height: 1.4;
  color: #15803d;
}

.card-stats-mini {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.82rem;
  font-weight: 600;
  border-top: 1px solid var(--color-border-subtle);
  padding-top: 0.45rem;
  margin: 0;
}

.card-stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.card-stat-label {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-stat-val {
  color: var(--color-text-primary);
  font-weight: 800;
  font-size: 0.88rem;
}

/* Bouton d'action directe intégré à la carte du spécimen */
.card-play-container {
  width: 100%;
  margin-top: auto;
  padding-top: 0.4rem;
}

.btn-card-play {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.15rem;
  background-color: var(--color-bio-leaf);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(45, 106, 79, 0.22);
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.btn-card-play:hover {
  background-color: var(--color-bio-leaf-light);
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(45, 106, 79, 0.32);
}

.btn-card-play:active {
  transform: translateY(1px);
}

.character-card:not(.active) .btn-card-play {
  background-color: #f1f5f9;
  color: var(--color-text-secondary);
  box-shadow: none;
  border: 1px solid var(--color-border-subtle);
}

.character-card:not(.active):hover .btn-card-play {
  background-color: var(--color-bio-leaf);
  color: #ffffff;
  border-color: var(--color-bio-leaf);
}

/* Couleurs signatures par spécimen cellulaire */
.btn-card-play[data-hero-id="macro"] {
  background-color: #2d6a4f;
  box-shadow: 0 4px 12px rgba(45, 106, 79, 0.28);
}

.btn-card-play[data-hero-id="macro"]:hover {
  background-color: #40916c;
  box-shadow: 0 6px 16px rgba(45, 106, 79, 0.38);
}

.btn-card-play[data-hero-id="tee"] {
  background-color: #2a526d;
  box-shadow: 0 4px 12px rgba(42, 82, 109, 0.28);
}

.btn-card-play[data-hero-id="tee"]:hover {
  background-color: #4a7c9b;
  box-shadow: 0 6px 16px rgba(42, 82, 109, 0.38);
}

.btn-card-play[data-hero-id="dendy"] {
  background-color: #b46b1f;
  box-shadow: 0 4px 12px rgba(180, 107, 31, 0.28);
}

.btn-card-play[data-hero-id="dendy"]:hover {
  background-color: #d48b38;
  box-shadow: 0 6px 16px rgba(180, 107, 31, 0.38);
}

.btn-card-play[data-hero-id="neutro"] {
  background-color: #7b2cbf;
  box-shadow: 0 4px 12px rgba(123, 44, 191, 0.28);
}

.btn-card-play[data-hero-id="neutro"]:hover {
  background-color: #9d4edd;
  box-shadow: 0 6px 16px rgba(123, 44, 191, 0.38);
}

.btn-card-play[data-hero-id="enka"] {
  background-color: #9f1239;
  box-shadow: 0 4px 12px rgba(159, 18, 57, 0.28);
}

.btn-card-play[data-hero-id="enka"]:hover {
  background-color: #be123c;
  box-shadow: 0 6px 16px rgba(159, 18, 57, 0.38);
}

.btn-card-play[data-hero-id="bea"] {
  background-color: #2b44c7;
  box-shadow: 0 4px 12px rgba(43, 68, 199, 0.28);
}

.btn-card-play[data-hero-id="bea"]:hover {
  background-color: #4361ee;
  box-shadow: 0 6px 16px rgba(43, 68, 199, 0.38);
}

/* Mode mobile sous 768px : réduction proportionnée pour petits écrans */
@media (max-width: 767px) {

  /* .selection-section {
    max-width: 440px;
  } */
  .carousel-viewport {
    max-width: 390px;
  }

  .character-card {
    padding: 0.85rem 1rem;
  }

  .card-top-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    row-gap: 0.35rem;
    margin-bottom: 0.45rem;
  }

  .card-record-badge {
    order: 3;
    width: 100%;
    justify-content: center;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
  }

  .card-main-content {
    flex-direction: column;
    gap: 0.55rem;
  }

  .card-hero-identity {
    flex: auto;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--color-border-subtle);
    padding-right: 0;
    padding-bottom: 0.55rem;
  }

  .card-avatar-canvas {
    width: 68px;
    height: 68px;
    border-radius: 14px;
    margin: 0 0 0.3rem 0;
  }

  .card-hero-name {
    font-size: 1.05rem;
    margin-bottom: 0.1rem;
  }

  .card-hero-role {
    font-size: 0.66rem;
    margin-bottom: 0.45rem;
  }

  .btn-card-play {
    font-size: 0.86rem;
    padding: 0.58rem 0.85rem;
  }

  .card-hero-details {
    width: 100%;
    gap: 0.4rem;
  }

  .card-hero-desc {
    font-size: 0.76rem;
    line-height: 1.35;
  }

  .card-weapon-badge {
    font-size: 0.7rem;
    padding: 0.22rem 0.55rem;
  }

  .card-weapon-tag {
    font-size: 0.62rem;
  }

  .card-stats-mini {
    font-size: 0.72rem;
    padding-top: 0.3rem;
  }

  .card-stat-label {
    font-size: 0.6rem;
  }

  .card-stat-val {
    font-size: 0.78rem;
  }

  .card-bio-benefit {
    padding: 0.35rem 0.55rem;
  }

  .bio-benefit-header {
    font-size: 0.62rem;
  }

  .bio-benefit-role {
    font-size: 0.7rem;
  }

  .bio-benefit-desc {
    font-size: 0.66rem;
  }
}

/* Indicateurs de pagination du carrousel */
.carousel-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cbd5e1;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.carousel-dot.active {
  width: 26px;
  border-radius: 6px;
  background: var(--color-bio-leaf);
}

.carousel-dot:hover:not(.active) {
  background: #94a3b8;
}

/* Zone des boutons de lancement et options */
.cta-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0 1.25rem;
  box-sizing: border-box;
}

.cta-buttons-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.btn-primary-launch {
  background-color: var(--color-bio-leaf);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.85rem 2.6rem;
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 12px rgba(45, 106, 79, 0.25);
}

.btn-primary-launch:hover {
  background-color: var(--color-bio-leaf-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(45, 106, 79, 0.35);
}

.btn-primary-launch:active {
  transform: translateY(1px);
}

.btn-secondary-controls {
  background-color: #ffffff;
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-btn);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.85rem 1.6rem;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn-secondary-controls:hover {
  background-color: var(--color-bg-surface-hover);
  border-color: #cbd5e1;
  transform: translateY(-2px);
}

.launch-hint {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  letter-spacing: 0.02em;
}

/* ==========================================================
   HUD DU JEU CLAIR & ÉPURÉ
   ========================================================== */
#game-hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem 1.25rem;
}

#game-hud.hidden {
  display: none;
}

/* Barre de progression ATP */
.hud-xp-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: rgba(0, 0, 0, 0.08);
}

.hud-xp-fill {
  height: 100%;
  width: 0%;
  background: var(--color-bio-amber);
  transition: width 0.15s ease-out;
}

/* Barre supérieure claire */
.hud-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 0.25rem;
}

.hud-player-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hud-hp-container {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  width: 160px;
}

.hud-hp-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: var(--radius-tag);
  overflow: hidden;
}

.hud-hp-fill {
  height: 100%;
  width: 100%;
  background: var(--color-bio-leaf);
  border-radius: var(--radius-tag);
  transition: width 0.2s ease;
}

.hud-hp-text {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--color-text-primary);
}

.hud-timer-badge {
  background: #ffffff;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-tag);
  padding: 0.35rem 0.95rem;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.home-top-actions {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 25;
}

.hud-top-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Boutons HUD texte classiques (compatibilité) */
.hud-btn {
  pointer-events: auto;
  background: #ffffff;
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-primary);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-tag);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.hud-btn:hover {
  background: var(--color-bg-surface-hover);
  border-color: #cbd5e1;
}

/* Boutons Icônes du HUD épurés (Son & Menu) */
.hud-icon-btn {
  pointer-events: auto;
  background: #ffffff;
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-primary);
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-tag);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  padding: 0;
}

.hud-icon-btn svg {
  flex-shrink: 0;
}

.hud-icon-btn:hover {
  background: var(--color-bg-surface-hover);
  border-color: #cbd5e1;
  color: #0f172a;
}

.hud-icon-btn:active {
  transform: scale(0.94);
}

.hud-icon-btn.is-muted {
  color: #94a3b8;
  background: #f1f5f9;
}

/* Conteneur et Sous-Menu Déroulant du Menu HUD */
.hud-menu-container {
  position: relative;
  pointer-events: auto;
}

.hud-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 0.4rem;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.40);
  z-index: 45;
  transform-origin: top right;
  animation: dropdownFadeIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.hud-menu-dropdown.hidden {
  display: none;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(-6px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.hud-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #f1f5f9;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.12s ease, color 0.12s ease;
  width: 100%;
}

.hud-dropdown-item svg {
  color: #94a3b8;
  flex-shrink: 0;
  transition: color 0.12s ease;
}

.hud-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
}

.hud-dropdown-item:hover svg {
  color: #52b788;
}

.hud-dropdown-item.danger:hover {
  background: rgba(225, 29, 72, 0.22);
  color: #fca5a5;
}

.hud-dropdown-item.danger:hover svg {
  color: #fca5a5;
}

.hud-dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.10);
  margin: 0.25rem 0.2rem;
}

/* ==========================================================
   BANDEAU D'ANNONCE DE NOUVELLE VAGUE (TOAST)
   ========================================================== */
.hud-wave-toast {
  position: absolute;
  top: 4.2rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-tag);
  padding: 0.55rem 1.6rem;
  color: #f8fafc;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: opacity 0.35s ease, transform 0.35s ease;
  z-index: 10;
}

.hud-wave-toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-12px);
  pointer-events: none;
}

.hud-wave-toast-title {
  color: #ffd166;
}

/* ==========================================================
   BARRE DE VIE DE BOSS / MINI-BOSS
   ========================================================== */
.hud-boss-bar-container {
  position: absolute;
  top: 4.2rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(440px, 92vw);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(239, 71, 111, 0.45);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.hud-boss-bar-container.hidden {
  display: none;
}

.hud-boss-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.hud-boss-badge {
  font-size: 0.68rem;
  font-weight: 900;
  color: #ef476f;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(239, 71, 111, 0.15);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  border: 1px solid rgba(239, 71, 111, 0.3);
}

.hud-boss-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.02em;
  flex: 1;
  text-align: left;
  margin-left: 0.4rem;
}

.hud-boss-hp-text {
  font-size: 0.78rem;
  font-weight: 800;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}

.hud-boss-hp-bar {
  height: 9px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  overflow: hidden;
}

.hud-boss-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ef476f, #e63946);
  border-radius: 5px;
  transition: width 0.15s ease-out;
}

/* Indicateur de Glissade / Dash */
.hud-dash-indicator {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  pointer-events: none;
  background: #ffffff;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-tag);
  padding: 0.5rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.dash-ready-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-text-muted);
  transition: background 0.2s ease;
}

.dash-ready-dot.ready {
  background: var(--color-bio-leaf);
}

/* Joystick tactile mobile clair */
#touch-joystick-base {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.08);
  border: 2px solid rgba(15, 23, 42, 0.2);
  pointer-events: none;
  display: none;
  transform: translate(-50%, -50%);
  z-index: 8;
}

#touch-joystick-knob {
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-bio-leaf);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

/* ==========================================================
   ACTIONS DU HUD SUPÉRIEUR
   ========================================================== */
.hud-top-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==========================================================
   MODALE DE CONFIGURATION DES COMMANDES
   ========================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-backdrop.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-card);
  max-width: 560px;
  width: 100%;
  max-height: 88vh;
  max-height: 88dvh;
  padding: 1.6rem 1.8rem;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.14);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

.modal-btn-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.modal-btn-close:hover {
  color: var(--color-text-primary);
  background-color: var(--color-bg-surface-hover);
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.45;
  margin-bottom: 1.4rem;
}

.bindings-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.binding-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
}

.binding-label-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.binding-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.binding-desc {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.binding-slots {
  display: flex;
  gap: 0.5rem;
}

.binding-key-btn {
  min-width: 90px;
  padding: 0.45rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 800;
  font-family: monospace;
  letter-spacing: 0.04em;
  background: #ffffff;
  color: var(--color-text-primary);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.15s ease;
}

.binding-key-btn:hover {
  border-color: var(--color-bio-leaf);
  background: #f0fdf4;
}

.binding-key-btn.listening {
  background: #fef3c7;
  border-color: #d97706;
  color: #92400e;
  animation: keyPulse 1.2s infinite ease-in-out;
}

.binding-key-btn.empty {
  color: var(--color-text-muted);
  border-style: dashed;
}

@keyframes keyPulse {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.4);
  }

  50% {
    transform: scale(1.03);
    box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.15);
  }
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--color-border-subtle);
}

.btn-modal-primary {
  background-color: var(--color-bio-leaf);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.65rem 1.6rem;
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.btn-modal-primary:hover {
  background-color: var(--color-bio-leaf-light);
  transform: translateY(-1px);
}

.btn-modal-secondary {
  background: none;
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-modal-secondary:hover {
  background-color: #f1f5f9;
  color: var(--color-text-primary);
  border-color: #cbd5e1;
}

/* ==========================================================
   MODALES GRAND FORMAT (BESTIAIRE & ARBRE DES CARTES)
   ========================================================== */
.modal-card-large {
  max-width: 1040px;
  width: 95%;
  height: 88vh;
  height: 88dvh;
  max-height: 88vh;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1.5rem 1.8rem;
  box-sizing: border-box;
}

.modal-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* BESTIAIRE : LAYOUT & COMPOSANTS */
.bestiary-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px 280px 1fr;
  gap: 1.25rem;
  margin-top: 1rem;
  overflow: hidden;
  align-items: stretch;
}

.bestiary-sidebar {
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bestiary-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-tag);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.bestiary-nav-item:hover {
  background: #f1f5f9;
  border-color: var(--color-bio-leaf);
}

.bestiary-nav-item.active {
  background: #ecfdf5;
  border-color: var(--color-border-active);
  border-width: 1.5px;
  box-shadow: 0 2px 8px rgba(45, 106, 79, 0.1);
}

.bestiary-item-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}

.bestiary-item-color[data-enemy="virus_capsid"] {
  background-color: #ff006e;
}

.bestiary-item-color[data-enemy="bacillus_wavy"] {
  background-color: #fb5607;
}

.bestiary-item-color[data-enemy="pollen_spore"] {
  background-color: #ffb703;
}

.bestiary-item-color[data-enemy="micro_spore"] {
  background-color: #ffe49e;
}

.bestiary-item-color[data-enemy="strepto_cluster"] {
  background-color: #9b5de5;
}

.bestiary-item-color[data-enemy="bdellovibrio_predator"] {
  background-color: #e63946;
}

.bestiary-item-color[data-enemy="microsporidia_sniper"] {
  background-color: #457b9d;
}

.bestiary-item-color[data-enemy="pseudomonas_biofilm"] {
  background-color: #2a9d8f;
}

.bestiary-item-color[data-enemy="acanthamoeba_cyst"] {
  background-color: #bc6c25;
}

.bestiary-item-color[data-enemy="toxin_slime_miniboss"] {
  background-color: #7209b7;
}

.bestiary-item-color[data-enemy="super_bacteria_boss"] {
  background-color: #ffd166;
}

.bestiary-item-color[data-enemy="trypanosoma_sleeper"] {
  background-color: #1d3557;
}

.bestiary-item-color[data-enemy="plasmodium_schizont"] {
  background-color: #540b0e;
}

.bestiary-item-color[data-enemy="merozoite_swarm"] {
  background-color: #e09f3e;
}

.bestiary-item-info {
  display: flex;
  flex-direction: column;
}

.bestiary-item-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.bestiary-item-cat {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

/* Zone d'observation microscopique Canvas */
.bestiary-view-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.canvas-reticle-container {
  position: relative;
  background: radial-gradient(circle, rgba(248, 250, 252, 0.95) 0%, rgba(226, 232, 240, 0.8) 100%);
  border: 1px solid var(--color-border-subtle);
  border-radius: 18px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.04);
}

#bestiary-canvas {
  width: 240px;
  height: 240px;
  display: block;
}

.reticle-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
}

/* Panneau de détails */
.bestiary-details-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 0.5rem;
}

.bestiary-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.bestiary-scale-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-bio-leaf);
  letter-spacing: 0.05em;
}

.bestiary-enemy-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-text-primary);
  margin-top: 0.15rem;
}

.bestiary-cat-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  background: #f1f5f9;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-tag);
  color: var(--color-text-secondary);
}

.bestiary-enemy-desc {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

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

.bestiary-stat-box {
  background: #f8fafc;
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stat-box-label {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.stat-box-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.bestiary-medical-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

.medical-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: #991b1b;
  margin-bottom: 0.4rem;
}

.medical-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.medical-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.8rem;
  line-height: 1.4;
}

.medical-label {
  font-weight: 700;
  color: #7f1d1d;
  flex-shrink: 0;
}

.medical-disease {
  font-weight: 600;
  color: #991b1b;
}

.medical-symptoms {
  color: #450a0a;
}

.bestiary-wow-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

.wow-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--color-bio-leaf-dark);
  margin-bottom: 0.35rem;
}

.wow-text {
  font-size: 0.82rem;
  line-height: 1.45;
  color: #166534;
}

.bestiary-source-bar {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.75rem;
  border-top: 1px solid var(--color-border-subtle);
  padding-top: 0.75rem;
}

.source-label {
  font-weight: 700;
  color: var(--color-text-muted);
}

.source-text {
  color: var(--color-text-secondary);
  font-style: italic;
}

@media (max-width: 900px) {
  .bestiary-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 240px 1fr;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    gap: 1rem;
  }

  .bestiary-sidebar {
    max-height: 160px;
    height: auto;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    overflow-y: auto;
  }

  .bestiary-nav-item {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 130px;
  }

  .bestiary-details-panel {
    height: auto;
    overflow: visible;
  }
}

/* ==========================================================
   ARBRE DES CARTES & SYNERGIES : LAYOUT & COMPOSANTS
   ========================================================== */
.cards-filter-bar {
  display: flex;
  gap: 0.5rem;
  margin: 1.2rem 0 1.5rem 0;
  flex-wrap: wrap;
}

.cards-filter-btn {
  background: #f8fafc;
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-secondary);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-btn);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cards-filter-btn:hover {
  background: #f1f5f9;
  color: var(--color-text-primary);
}

.cards-filter-btn.active {
  background: var(--color-bio-leaf);
  color: #ffffff;
  border-color: var(--color-bio-leaf);
}

/* ==========================================================
   ARBRE CIRCULAIRE RADIAL AVEC PAN & ZOOM (GRAB & MOVE)
   ========================================================== */
.modal-card-fullscreen {
  max-width: 96vw;
  width: 96vw;
  height: 92vh;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1.2rem 1.6rem;
}

.tree-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 0.6rem 0 0.8rem 0;
  flex-wrap: wrap;
}

.tree-legend-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.legend-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--color-border-subtle);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-pill.weapon-legend {
  border-color: #cbd5e1;
}

.legend-pill.passive-legend {
  border-color: #cbd5e1;
}

.legend-pill.supreme-legend {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}

.legend-pill.session-legend {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #047857;
  font-weight: 800;
  box-shadow: 0 1px 4px rgba(5, 150, 105, 0.12);
}

.legend-pill.session-legend.is-finished-run {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.12);
}

.tree-toolbar .cards-filter-bar {
  margin: 0;
}

.tree-controls-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tree-hint-pan {
  font-size: 0.74rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-right: 0.4rem;
}

.tree-tool-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--color-border-subtle);
  background: #ffffff;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.tree-tool-btn:hover {
  background: #f1f5f9;
  border-color: var(--color-bio-leaf);
  color: var(--color-bio-leaf);
}

.tree-tool-btn.recenter-btn {
  width: auto;
  padding: 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.tree-main-area {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.2rem;
  position: relative;
  overflow: hidden;
}

/* Viewport SVG avec Grab & Move */
.tree-viewport {
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--color-border-subtle);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  cursor: grab;
  user-select: none;
}

.tree-viewport.grabbing {
  cursor: grabbing;
}

.tree-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Nœuds interactifs SVG */
.tree-node {
  cursor: pointer;
  outline: none;
}

.tree-node circle {
  transition: transform 0.15s ease, filter 0.15s ease;
}

.tree-node:hover circle,
.tree-node:focus-visible circle {
  filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.25));
  stroke-width: 4px;
}

/* Branches actives illuminées */
.tree-active-branch {
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.2));
}

/* Nœuds acquis et allumés */
.tree-node.is-acquired circle {
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.28));
}

.tree-node.is-acquired text {
  font-weight: 900;
}

.tree-node.is-acquired:hover circle,
.tree-node.is-acquired:focus-visible circle {
  filter: drop-shadow(0 0 12px rgba(0, 0, 0, 0.45));
  stroke-width: 4.5px;
}

.tree-node.supreme-node:hover circle,
.tree-node.supreme-node:focus-visible circle {
  filter: drop-shadow(0 0 14px rgba(245, 158, 11, 0.85));
}

/* Nœud Apex Suprême Actif */
.tree-node.supreme-node.is-acquired.is-apex-evolved circle {
  animation: apexPulseGlow 2.5s infinite ease-in-out;
}

@keyframes apexPulseGlow {
  0%, 100% {
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.85));
  }
  50% {
    filter: drop-shadow(0 0 20px rgba(245, 158, 11, 1));
  }
}

/* Panneau d'inspection latéral */
.tree-inspector {
  background: #ffffff;
  border: 1px solid var(--color-border-subtle);
  border-radius: 14px;
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
  max-height: 100%;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.inspector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inspector-hero-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.inspector-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-tag);
  text-transform: uppercase;
}

/* Badges d'état de déblocage du build dans l'inspecteur */
.inspector-status-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.inspector-status-badge.acquired-active {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.inspector-status-badge.acquired-apex {
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  color: #92400e;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}

.inspector-status-badge.locked {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: #64748b;
}

.inspector-status-badge .badge-dot {
  font-size: 0.85rem;
  line-height: 1;
}

.inspector-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-text-primary);
  margin: 0;
}

.inspector-desc-main {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.45;
  margin: 0;
}

.inspector-level-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.level-box-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #166534;
  letter-spacing: 0.04em;
}

.level-box-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: #15803d;
  line-height: 1.4;
  margin: 0;
}

.inspector-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: #f8fafc;
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
}

.inspector-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stat-lbl {
  font-size: 0.68rem;
  color: var(--color-text-muted);
}

.stat-num {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

/* Boîte dorée d'Évolution Suprême */
.inspector-apex-box {
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.12);
}

.apex-tag {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #b45309;
  letter-spacing: 0.05em;
}

.apex-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #92400e;
  margin: 0;
}

.apex-formula {
  font-size: 0.78rem;
  color: #78350f;
  background: rgba(253, 230, 138, 0.45);
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  border: 1px dashed #f59e0b;
}

.apex-desc {
  font-size: 0.82rem;
  line-height: 1.45;
  color: #78350f;
  margin: 0;
}

@media (max-width: 900px) {
  .tree-main-area {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 190px;
    overflow: hidden;
  }

  .tree-inspector {
    height: 100%;
    max-height: 190px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.85rem 1rem;
    box-sizing: border-box;
  }
}

/* ==========================================================
   FOOTER SÉMANTIQUE ÉPURÉ
   ========================================================== */
.site-main-footer {
  width: 100%;
  margin-top: auto;
  border-top: 1px solid var(--color-border-subtle);
  padding: 0.85rem 1.5rem;
  background: transparent;
  color: var(--color-text-secondary);
  box-sizing: border-box;
}

.footer-bottom-bar {
  text-align: center;
  font-size: 0.76rem;
  color: var(--color-text-muted);
  width: 100%;
  margin: 0 auto;
}

.footer-bottom-bar p {
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 820px) {

  .carousel-wrapper {
    gap: 0.5rem;
  }

  .carousel-arrow {
    width: 38px;
    height: 38px;
  }
}

/* ==========================================================================
   MODALE DE MONTÉE DE NIVEAU (LEVEL UP CARDS) — THÈME CLAIR LABORATOIRE
   ========================================================================== */

.modal-card-levelup {
  max-width: 1040px;
  width: 96%;
  max-height: 90vh;
  max-height: 90dvh;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-card);
  padding: 1.15rem 1.6rem;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16), 0 4px 16px rgba(15, 23, 42, 0.04);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
}

.modal-header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0.75rem;
  gap: 0.15rem;
  flex-shrink: 0;
}

.modal-title-levelup,
.modal-title-gold {
  color: var(--color-text-primary);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.modal-card-levelup .modal-desc {
  font-size: 0.84rem;
  margin: 0;
  color: var(--color-text-secondary);
}

.levelup-cards-container {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.95rem;
  margin-bottom: 0.75rem;
  min-height: 0;
  overflow: visible;
}

.levelup-card {
  background: #ffffff;
  border: 2px solid var(--color-border-subtle);
  border-radius: 12px;
  padding: 0.95rem 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  color: inherit;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  position: relative;
  box-sizing: border-box;
}

.levelup-card:hover {
  border-color: #64748b;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.10);
}

.levelup-card[data-rarity="supreme"] {
  border-color: var(--color-bio-amber);
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.12);
}

.levelup-card[data-rarity="supreme"]:hover {
  border-color: #b45309;
  box-shadow: 0 10px 24px rgba(217, 119, 6, 0.20);
}

/* --- Styles Chromatiques par Famille d'Amélioration --- */
.levelup-card[data-family="digestion"] {
  border-color: rgba(82, 183, 136, 0.40);
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 55%);
}

.levelup-card[data-family="digestion"]:hover {
  border-color: #52b788;
  box-shadow: 0 8px 24px rgba(82, 183, 136, 0.18);
}

.levelup-card[data-family="ballistics"] {
  border-color: rgba(76, 201, 240, 0.45);
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 55%);
}

.levelup-card[data-family="ballistics"]:hover {
  border-color: #0284c7;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.18);
}

.levelup-card[data-family="chemotaxis"] {
  border-color: rgba(255, 209, 102, 0.55);
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 55%);
}

.levelup-card[data-family="chemotaxis"]:hover {
  border-color: #d97706;
  box-shadow: 0 8px 24px rgba(217, 119, 6, 0.18);
}

.levelup-card[data-family="nets"] {
  border-color: rgba(157, 78, 221, 0.40);
  background: linear-gradient(180deg, #faf5ff 0%, #ffffff 55%);
}

.levelup-card[data-family="nets"]:hover {
  border-color: #9333ea;
  box-shadow: 0 8px 24px rgba(147, 51, 234, 0.18);
}

.levelup-card[data-family="cytotoxicity"] {
  border-color: rgba(239, 71, 111, 0.40);
  background: linear-gradient(180deg, #fff1f2 0%, #ffffff 55%);
}

.levelup-card[data-family="cytotoxicity"]:hover {
  border-color: #e11d48;
  box-shadow: 0 8px 24px rgba(225, 29, 72, 0.18);
}

.levelup-card[data-family="saturation"] {
  border-color: rgba(67, 97, 238, 0.40);
  background: linear-gradient(180deg, #eef2ff 0%, #ffffff 55%);
}

.levelup-card[data-family="saturation"]:hover {
  border-color: #4338ca;
  box-shadow: 0 8px 24px rgba(67, 56, 202, 0.18);
}

.levelup-card[data-family="fever"] {
  border-color: rgba(247, 127, 0, 0.40);
  background: linear-gradient(180deg, #fff7ed 0%, #ffffff 55%);
}

.levelup-card[data-family="fever"]:hover {
  border-color: #ea580c;
  box-shadow: 0 8px 24px rgba(234, 88, 12, 0.18);
}

.levelup-card[data-family="interferon"] {
  border-color: rgba(6, 214, 160, 0.40);
  background: linear-gradient(180deg, #f0fdfa 0%, #ffffff 55%);
}

.levelup-card[data-family="interferon"]:hover {
  border-color: #0d9488;
  box-shadow: 0 8px 24px rgba(13, 148, 136, 0.18);
}

.levelup-card-action {
  width: 100%;
  margin-top: 1.25rem;
  display: flex;
}

.btn-levelup-choose {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  background: #2d6a4f;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(45, 106, 79, 0.25);
  transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-levelup-choose:hover,
.btn-levelup-choose:focus-visible {
  background: #1b4332;
  box-shadow: 0 4px 12px rgba(45, 106, 79, 0.35);
  outline: 2px solid #52b788;
  outline-offset: 2px;
}

.btn-levelup-choose:active {
  transform: scale(0.97);
}

.btn-levelup-choose[data-category="evolution"] {
  background: #b45309;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(180, 83, 9, 0.25);
}

.btn-levelup-choose[data-category="evolution"]:hover,
.btn-levelup-choose[data-category="evolution"]:focus-visible {
  background: #92400e;
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.35);
  outline: 2px solid #f59e0b;
}

/* Boutons d'action par Famille */
.btn-levelup-choose[data-family="digestion"] {
  background: #2d6a4f;
  box-shadow: 0 2px 6px rgba(45, 106, 79, 0.25);
}

.btn-levelup-choose[data-family="digestion"]:hover,
.btn-levelup-choose[data-family="digestion"]:focus-visible {
  background: #1b4332;
  outline: 2px solid #52b788;
}

.btn-levelup-choose[data-family="ballistics"] {
  background: #0284c7;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.btn-levelup-choose[data-family="ballistics"]:hover,
.btn-levelup-choose[data-family="ballistics"]:focus-visible {
  background: #0369a1;
  outline: 2px solid #38bdf8;
}

.btn-levelup-choose[data-family="chemotaxis"] {
  background: #b45309;
  box-shadow: 0 2px 6px rgba(180, 83, 9, 0.25);
}

.btn-levelup-choose[data-family="chemotaxis"]:hover,
.btn-levelup-choose[data-family="chemotaxis"]:focus-visible {
  background: #92400e;
  outline: 2px solid #fbbf24;
}

.btn-levelup-choose[data-family="nets"] {
  background: #7e22ce;
  box-shadow: 0 2px 6px rgba(126, 34, 206, 0.25);
}

.btn-levelup-choose[data-family="nets"]:hover,
.btn-levelup-choose[data-family="nets"]:focus-visible {
  background: #581c87;
  outline: 2px solid #c084fc;
}

.btn-levelup-choose[data-family="cytotoxicity"] {
  background: #be123c;
  box-shadow: 0 2px 6px rgba(190, 18, 60, 0.25);
}

.btn-levelup-choose[data-family="cytotoxicity"]:hover,
.btn-levelup-choose[data-family="cytotoxicity"]:focus-visible {
  background: #881337;
  outline: 2px solid #fb7185;
}

.btn-levelup-choose[data-family="saturation"] {
  background: #3730a3;
  box-shadow: 0 2px 6px rgba(55, 48, 163, 0.25);
}

.btn-levelup-choose[data-family="saturation"]:hover,
.btn-levelup-choose[data-family="saturation"]:focus-visible {
  background: #312e81;
  outline: 2px solid #818cf8;
}

.btn-levelup-choose[data-family="fever"] {
  background: #c2410c;
  box-shadow: 0 2px 6px rgba(194, 65, 12, 0.25);
}

.btn-levelup-choose[data-family="fever"]:hover,
.btn-levelup-choose[data-family="fever"]:focus-visible {
  background: #9a3412;
  outline: 2px solid #fb923c;
}

.btn-levelup-choose[data-family="interferon"] {
  background: #0f766e;
  box-shadow: 0 2px 6px rgba(15, 118, 110, 0.25);
}

.btn-levelup-choose[data-family="interferon"]:hover,
.btn-levelup-choose[data-family="interferon"]:focus-visible {
  background: #134e4a;
  outline: 2px solid #2dd4bf;
}

.levelup-btn-key {
  font-size: 0.72rem;
  opacity: 0.88;
  font-weight: 800;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
}

.levelup-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 0.9rem;
}

.levelup-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-secondary);
}

/* Badges de Catégorie & Famille */
.levelup-badge[data-family="digestion"] {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #166534;
}

.levelup-badge[data-family="ballistics"] {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #0369a1;
}

.levelup-badge[data-family="chemotaxis"] {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}

.levelup-badge[data-family="nets"] {
  background: #f3e8ff;
  border-color: #e9d5ff;
  color: #6b21a8;
}

.levelup-badge[data-family="cytotoxicity"] {
  background: #ffe4e6;
  border-color: #fecdd3;
  color: #9f1239;
}

.levelup-badge[data-family="saturation"] {
  background: #e0e7ff;
  border-color: #c7d2fe;
  color: #3730a3;
}

.levelup-badge[data-family="fever"] {
  background: #ffedd5;
  border-color: #fed7aa;
  color: #9a3412;
}

.levelup-badge[data-family="interferon"] {
  background: #ccfbf1;
  border-color: #99f6e4;
  color: #115e59;
}

/* Mise en valeur des cartes menant à l'Évolution Suprême du héros (Bordure dorée ambrée nette sans décalage) */
.levelup-card[data-synergy="true"] {
  border-color: #d97706;
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 65%);
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.18);
}

.levelup-card[data-synergy="true"]:hover {
  border-color: #b45309;
  box-shadow: 0 8px 22px rgba(180, 83, 9, 0.25);
}

.levelup-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--color-text-primary);
  margin: 0 0 0.25rem 0;
  line-height: 1.3;
}

.levelup-card-level {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-bio-leaf);
  margin-bottom: 0.5rem;
}

.levelup-card-level.evolution-tag {
  color: var(--color-bio-amber);
  font-weight: 800;
}

.levelup-card-desc {
  font-size: 0.83rem;
  line-height: 1.45;
  color: var(--color-text-secondary);
  margin: 0;
  flex-grow: 1;
}

.modal-footer-center {
  justify-content: center;
  border-top: 1px solid var(--color-border-subtle);
  padding-top: 0.65rem;
}

.levelup-hint-keyboard {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

/* Responsive : passage en colonne sur petit écran pour une lisibilité parfaite */
@media (max-width: 768px) {
  .modal-card-levelup {
    max-width: 480px;
    width: 92%;
    max-height: 88vh;
    overflow-y: auto;
    padding: 1.25rem 1rem;
    justify-content: flex-start;
  }

  .levelup-cards-container {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .levelup-card {
    padding: 1rem 1.1rem;
  }

  .levelup-card-title {
    font-size: 1.05rem;
  }

  .levelup-card-desc {
    font-size: 0.84rem;
  }
}

/* ==========================================================
   MODALE DU CODEX SCIENTIFIQUE & SAVOIRS DU VIVANT
   ========================================================== */
.modal-card-codex {
  max-width: 1080px;
  width: 95%;
  height: 88vh;
  height: 88dvh;
  max-height: 88vh;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-card);
  padding: 1.4rem 1.8rem;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  box-sizing: border-box;
  overflow: hidden;
}

.codex-content-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.codex-body-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 0.6rem;
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.codex-section-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 0.85rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0.4rem;
}

.codex-facts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.1rem;
}

.codex-fact-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.codex-fact-card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.07);
}

.codex-fact-topic {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #2d6a4f;
}

.codex-fact-heading {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  line-height: 1.35;
}

.codex-fact-text {
  font-size: 0.86rem;
  line-height: 1.55;
  color: #334155;
  margin: 0;
  flex-grow: 1;
}

.codex-fact-note {
  font-size: 0.79rem;
  line-height: 1.45;
  color: #475569;
  background: #f8fafc;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border-left: 3px solid #52b788;
}

.codex-sources-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-top: 0.55rem;
  border-top: 1px dashed #e2e8f0;
}

.codex-sources-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.codex-sources-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.codex-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.35;
}

.codex-source-icon {
  flex-shrink: 0;
  color: #2d6a4f;
}

@media (max-width: 768px) {
  .modal-card-codex {
    padding: 1.1rem 1rem;
    height: 92vh;
    height: 92dvh;
    width: 95%;
  }

  .codex-facts-grid {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }
}

/* ==========================================================
   MODALE DE DÉFAITE / GAME OVER (LYSE CELLULAIRE)
   ========================================================== */
.modal-card-gameover {
  max-width: 580px;
  width: 95%;
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #ffffff;
  border-radius: var(--radius-card);
  border: 1px solid rgba(230, 57, 70, 0.35);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(230, 57, 70, 0.08);
  padding: 1.8rem 2rem;
  text-align: center;
  box-sizing: border-box;
}

.badge-tag-danger {
  background: rgba(230, 57, 70, 0.12);
  color: #e63946;
  border: 1px solid rgba(230, 57, 70, 0.28);
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 0.6rem;
}

.modal-title-gameover {
  font-size: 1.75rem;
  font-weight: 900;
  color: #1e293b;
  margin: 0 0 1.2rem 0;
  letter-spacing: -0.02em;
}

/* Boîte de diagnostic du pathogène tueur */
.gameover-killer-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.killer-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.65rem;
}

.killer-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.killer-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.killer-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.killer-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
}

.killer-diagnostic {
  border-top: 1px solid #e2e8f0;
  padding-top: 0.65rem;
}

.killer-diag-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #e63946;
  margin: 0 0 0.25rem 0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.killer-diag-desc {
  font-size: 0.82rem;
  line-height: 1.45;
  color: #475569;
  margin: 0;
}

/* Grille des statistiques de survie */
.gameover-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.6rem;
}

.stat-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-val {
  font-size: 1.15rem;
  font-weight: 900;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.gameover-actions {
  display: flex;
  gap: 0.85rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-gameover-replay {
  background-color: #2d6a4f;
  color: #ffffff;
}

.btn-gameover-replay:hover {
  background-color: #40916c;
}

@media (max-width: 600px) {
  .modal-card-gameover {
    padding: 1.5rem 1.2rem;
  }

  .gameover-stats-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .gameover-actions {
    flex-direction: column;
  }
}

/* ==========================================================
   COMPTE À REBOURS IMMERSIF (3, 2, 1, IMMERSION !)
   ========================================================== */
.hud-countdown {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.hud-countdown.hidden {
  display: none;
}

.hud-countdown-box {
  background: rgba(12, 15, 20, 0.90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(82, 183, 136, 0.40);
  border-radius: 20px;
  padding: 2.2rem 3.5rem;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55), inset 0 0 20px rgba(82, 183, 136, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-width: 280px;
  text-align: center;
}

.hud-countdown-number {
  font-size: 5rem;
  font-weight: 900;
  color: #52b788;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  text-shadow: 0 0 25px rgba(82, 183, 136, 0.45);
}

.hud-countdown-number.pop {
  animation: countdownPop 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.hud-countdown-number.go {
  font-size: 3.2rem;
  color: #e09f3e;
  text-shadow: 0 0 30px rgba(224, 159, 62, 0.55);
}

.hud-countdown-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

@keyframes countdownPop {
  0% {
    transform: scale(0.60);
    opacity: 0;
  }

  65% {
    transform: scale(1.15);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}