@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Exo+2:wght@400;600;700&display=swap');

/* ─── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0a;
  --bg2: #111118;
  --bg3: #1a1a26;
  --border: #2a2a3a;
  --text: #e8e8f0;
  --text-muted: #8888b0;
  --p1: #00d4ff;
  --p2: #ff4444;
  --gold: #ffd700;
  --green: #00ff88;
  --red: #ff4466;
  --neutral: #aaaacc;
  --glow-p1: 0 0 20px rgba(0,212,255,.5);
  --glow-p2: 0 0 20px rgba(255,68,68,.5);
}

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: 'Exo 2', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

html.modal-open, body.modal-open { overflow-y: hidden; }

/* ─── SCANLINES OVERLAY ────────────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 9999;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,.06) 2px, rgba(0,0,0,.06) 4px);
  pointer-events: none;
}

/* ─── TYPOGRAPHY ───────────────────────────────────────────── */
.arcade { font-family: 'Press Start 2P', monospace; }

/* ─── SCREENS ──────────────────────────────────────────────── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ─── HEADER ───────────────────────────────────────────────── */
header {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
  background: linear-gradient(180deg, #000 0%, var(--bg2) 100%);
  border-bottom: 2px solid var(--border);
}

.main-title-link {
  display: inline-block;
  text-decoration: none;
  cursor: pointer;
  border-radius: 6px;
  transition: transform .15s ease;
}

.main-title-link:hover,
.main-title-link:focus-visible {
  transform: scale(1.04);
}

.main-title-link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 6px;
}

.main-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(1.4rem, 4.5vw, 2.6rem);
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255,215,0,.8), 0 0 40px rgba(255,215,0,.4), 3px 3px 0 #000;
  letter-spacing: .1em;
  animation: flicker 4s infinite;
}

.main-title-link:hover .main-title,
.main-title-link:focus-visible .main-title {
  text-shadow: 0 0 28px rgba(255,215,0,1), 0 0 54px rgba(255,215,0,.65), 3px 3px 0 #000;
}

.main-subtitle {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(.6rem, 1.8vw, .9rem);
  color: var(--text-muted);
  margin-top: .8rem;
  letter-spacing: .2em;
}

.insert-coin {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(.55rem, 1.4vw, .75rem);
  color: var(--p1);
  margin-top: 1.2rem;
  animation: blink 1s step-end infinite;
  letter-spacing: .15em;
}

@keyframes flicker {
  0%,19%,21%,23%,25%,54%,56%,100% { opacity: 1; }
  20%,22%,24%,55% { opacity: .6; }
}
@keyframes blink { 50% { opacity: 0; } }

/* ─── SELECT SCREEN ────────────────────────────────────────── */
#screen-select { align-items: stretch; }

.select-arena-wrap {
  position: relative;
}

.select-arena {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: stretch;
}

/* Player slots */
.player-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 2rem 1.5rem;
  min-height: 260px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  transition: background .3s;
}

.player-slot:last-of-type { border-right: none; border-left: 1px solid var(--border); }

.player-label {
  font-family: 'Press Start 2P', monospace;
  font-size: .8rem;
  letter-spacing: .15em;
  margin-bottom: 1.2rem;
}

.slot-p1 .player-label { color: var(--p1); text-shadow: var(--glow-p1); }
.slot-p2 .player-label { color: var(--p2); text-shadow: var(--glow-p2); }

.slot-portrait {
  width: 110px; height: 110px;
  border-radius: 8px;
  overflow: hidden;
  border: 3px solid var(--border);
  transition: border-color .3s, box-shadow .3s;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
}

.char-portrait img,
.slot-portrait img,
.hud-portrait img,
.modal-fighter-portrait img,
.victory-portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.slot-p1.has-candidate .slot-portrait,
.slot-p2.has-candidate .slot-portrait { border-color: var(--slot-color, var(--p1)); box-shadow: 0 0 18px var(--slot-color, var(--p1)); }

.slot-name {
  font-family: 'Press Start 2P', monospace;
  font-size: .65rem;
  text-align: center;
  margin-top: .8rem;
  line-height: 1.8;
  min-height: 2.5em;
  color: var(--text-muted);
  transition: color .3s;
}

.slot-p1.has-candidate .slot-name,
.slot-p2.has-candidate .slot-name { color: var(--slot-color, var(--p1)); }

.slot-empty-hint {
  font-size: .9rem;
  color: var(--text-muted);
  margin-top: .5rem;
  font-style: italic;
  opacity: .7;
}

/* VS divider */
.vs-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  min-width: 80px;
}

.vs-text {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.8rem;
  color: #fff;
  text-shadow: 2px 2px 0 var(--red), -2px -2px 0 var(--p1), 0 0 30px rgba(255,255,255,.4);
  animation: vs-pulse 2s ease-in-out infinite;
}

@keyframes vs-pulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Fight launch bar — desktop : overlay centré sur le VS, sans pousser la grille de
   personnages. Sur mobile (voir media query responsive), passe en flux normal et
   remplace la grille à la place de se superposer dessus. */
.fight-launch-bar {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: .8rem;
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  width: max-content;
  max-width: 92vw;
  padding: 1rem 1.4rem;
  background: var(--bg2);
  border: 2px solid var(--gold);
  border-radius: 10px;
  box-shadow: 0 0 40px rgba(255,215,0,.35), 0 12px 30px rgba(0,0,0,.6);
}

.fight-launch-bar.visible {
  display: flex;
  animation: launchBarSlam .5s cubic-bezier(.2,.85,.3,1.3) both;
}

@keyframes launchBarSlam {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(2.4) rotate(-6deg); }
  55%  { opacity: 1; transform: translate(-50%,-50%) scale(.92) rotate(2deg); }
  80%  { transform: translate(-50%,-50%) scale(1.04) rotate(-1deg); }
  100% { opacity: 1; transform: translate(-50%,-50%) scale(1) rotate(0deg); }
}

/* Variante mobile : la carte est en flux normal (plus d'overlay absolu, voir
   media query responsive), donc pas de translate(-50%,-50%) de recentrage. */
@keyframes launchBarSlamMobile {
  0%   { opacity: 0; transform: scale(2.4) rotate(-6deg); }
  55%  { opacity: 1; transform: scale(.92) rotate(2deg); }
  80%  { transform: scale(1.04) rotate(-1deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* "Changer de personnage" — mobile uniquement : la carte de lancement y remplace la
   grille de personnages (voir #screen-select.confirm-active plus bas), ce bouton
   permet d'y revenir. Sans objet sur desktop où la carte se superpose juste au VS. */
.btn-change-candidates {
  display: none;
  font-family: 'Exo 2', sans-serif;
  font-size: .7rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .4rem .9rem;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

@media (hover: hover) and (pointer: fine) {
  .btn-change-candidates:hover { border-color: var(--gold); color: var(--gold); }
}

/* Blind mode toggle */
.blind-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  cursor: pointer;
  font-family: 'Exo 2', sans-serif;
  font-size: .85rem;
  color: var(--text-muted);
  user-select: none;
  padding: .5rem 1rem .5rem .6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg3);
  transition: border-color .2s, box-shadow .2s, color .2s, background .2s;
}

.blind-mode-toggle:hover {
  border-color: #6a3a9a;
  background: #180d28;
}

.blind-mode-toggle.active {
  border-color: #b266ff;
  background: #1a0d2e;
  color: #d9b3ff;
  box-shadow: 0 0 16px rgba(178,102,255,.3);
}

/* Native checkbox kept for accessibility/keyboard focus, visually hidden */
.blind-mode-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.blind-mode-switch {
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 21px;
  border-radius: 999px;
  background: #33334a;
  transition: background .25s, box-shadow .25s;
}

.blind-mode-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #cfcfe0;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), background .25s;
}

.blind-mode-input:checked ~ .blind-mode-switch {
  background: linear-gradient(135deg, #7a2fd6, #b266ff);
  box-shadow: 0 0 12px rgba(178,102,255,.6);
}

.blind-mode-input:checked ~ .blind-mode-switch .blind-mode-knob {
  transform: translateX(17px);
  background: #fff;
}

.blind-mode-input:focus-visible ~ .blind-mode-switch {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.blind-mode-icon {
  font-size: 1rem;
  line-height: 1;
  filter: grayscale(1) opacity(.55);
  transition: filter .25s, transform .25s;
}

.blind-mode-input:checked ~ .blind-mode-icon {
  filter: none;
  transform: scale(1.1);
}

.blind-mode-label {
  letter-spacing: .02em;
  transition: color .2s;
}

.tooltip-wrap {
  position: relative;
  display: inline-flex;
  outline: none;
  margin-left: .1rem;
}

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  font-size: .65rem;
  font-family: 'Exo 2', sans-serif;
  cursor: help;
}

.tooltip-text {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  max-width: 70vw;
  padding: .6rem .75rem;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: .78rem;
  line-height: 1.45;
  text-align: left;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(4px);
  transition: opacity .15s, transform .15s, visibility .15s;
  z-index: 20;
}

.tooltip-wrap:hover .tooltip-text,
.tooltip-wrap:focus .tooltip-text,
.tooltip-wrap:focus-within .tooltip-text {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Blind mode badge — lives in the HUD center to save vertical space on mobile */
.hud-blind-badge {
  font-family: 'Press Start 2P', monospace;
  font-size: .4rem;
  letter-spacing: .05em;
  color: #cc88ff;
  white-space: nowrap;
}

.hud-blind-badge.hidden { display: none; }

.victory-blind-note {
  color: #cc88ff;
  font-size: .65rem;
  margin-top: .6rem;
}

/* Neutralise la coloration P1/P2 pendant le vote en aveugle —
   sinon la couleur seule permet de suivre un candidat malgré le
   masquage du nom/portrait et le mélange des côtés */
#screen-fight.blind-active {
  --p1: #b266ff;
  --p2: #b266ff;
  --glow-p1: 0 0 20px rgba(178,102,255,.5);
  --glow-p2: 0 0 20px rgba(178,102,255,.5);
}
#screen-fight.blind-active .hud-fighter.left  .health-bar { background: linear-gradient(90deg, #b266ff, #7a3fcc); }
#screen-fight.blind-active .hud-fighter.right .health-bar { background: linear-gradient(90deg, #7a3fcc, #b266ff); }
#screen-fight.blind-active .swipe-stamp-p1,
#screen-fight.blind-active .swipe-stamp-p2 { background: rgba(178,102,255,.15); }
#screen-fight.blind-active .swipe-vote-btn.p1.voted,
#screen-fight.blind-active .swipe-vote-btn.p2.voted { background: rgba(178,102,255,.1); }

#btn-fight {
  font-family: 'Press Start 2P', monospace;
  font-size: .8rem;
  padding: 1rem 2.5rem;
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: .1em;
  transition: transform .1s, box-shadow .1s;
  box-shadow: 0 4px 0 #886600, 0 0 20px rgba(255,215,0,.5);
  animation: ready-glow 1s ease-in-out infinite alternate;
  display: inline-flex;
  align-items: center;
  gap: .7rem;
}

/* CSS sword icon — two diagonal lines forming ⚔ shape */
.btn-icon-swords {
  display: inline-block;
  width: 16px;
  height: 16px;
  position: relative;
  flex-shrink: 0;
}
.btn-icon-swords::before,
.btn-icon-swords::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 2px;
  background: currentColor;
  top: 50%;
  left: 0;
  transform-origin: center;
  margin-top: -1px;
}
.btn-icon-swords::before { transform: rotate(45deg); }
.btn-icon-swords::after  { transform: rotate(-45deg); }

#btn-fight:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #886600, 0 0 30px rgba(255,215,0,.8); }
#btn-fight:active { transform: translateY(2px); box-shadow: 0 2px 0 #886600; }

@keyframes ready-glow {
  from { box-shadow: 0 4px 0 #886600, 0 0 10px rgba(255,215,0,.4); }
  to   { box-shadow: 0 4px 0 #886600, 0 0 30px rgba(255,215,0,.9); }
}

/* Character grid */
.char-grid-section {
  padding: 2rem 1.5rem;
  background: var(--bg);
  border-top: 2px solid var(--border);
}

.spectrum-legend {
  display: flex;
  align-items: center;
  gap: .7rem;
  max-width: 960px;
  margin: 1rem auto 0;
  padding: 0 .2rem;
}

.spectrum-legend.hidden { display: none; }

.spectrum-label {
  font-family: 'Press Start 2P', monospace;
  font-size: .5rem;
  letter-spacing: .15em;
  color: var(--text-muted);
  white-space: nowrap;
}

.spectrum-bar {
  position: relative;
  flex: 1;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.spectrum-bar::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 4px;
  border-radius: 2px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, #d8232a, #39a935, #e4003a, #3a8fd4, #004494, #1656a3);
  pointer-events: none;
}

.spectrum-cursor {
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--bg);
  box-shadow: 0 0 6px rgba(255,255,255,.8);
  transform: translate(-50%, -50%);
  transition: left .05s linear;
  pointer-events: none;
}

.spectrum-bar.dragging .spectrum-cursor { transition: none; }

.char-grid-wrap {
  display: flex;
  align-items: center;
  gap: .6rem;
  max-width: 960px;
  margin: 0 auto;
}

.char-grid-arrow {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: var(--bg2);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .2s, color .2s, transform .15s;
}

.char-grid-wrap.grid-mode .char-grid-arrow { display: none; }

.char-grid {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  /* overflow-x:auto forces overflow-y to compute as auto too, which would
     clip the cards' hover/neon glow at the container's top and bottom edges —
     this padding gives that glow room to render instead of getting cut off. */
  padding-top: 1.6rem;
  padding-bottom: 1.3rem;
}

.char-grid .char-card {
  flex: 0 0 140px;
  scroll-snap-align: start;
}

.char-grid::-webkit-scrollbar { height: 8px; }
.char-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.char-grid::-webkit-scrollbar-track { background: var(--bg2); }

/* Grid view mode (desktop, fixed 8 candidates): a real 4x2 grid rather
   than a scroll row — no snapping, no clipping of the card glow/hover. */
.char-grid-wrap.grid-mode {
  max-width: 700px;
}

.char-grid.grid-mode {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
  overflow: visible;
  scroll-snap-type: none;
}

/* Pendant un drag de la spectrum-bar : suivi 1:1 du pointeur, sans easing
   ni snap qui viendrait créer des à-coups (contrairement au swipe natif). */
.char-grid.bar-dragging {
  scroll-behavior: auto;
  scroll-snap-type: none;
}

/* Character card — full-bleed photo, name on a bottom gradient, party as a corner badge */
.char-card {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  border: 2px solid var(--card-color, var(--border));
  box-shadow: 0 0 14px color-mix(in srgb, var(--card-color, var(--border)) 55%, transparent);
  cursor: pointer;
  overflow: hidden;
  user-select: none;
  transition: border-color .2s, transform .15s, box-shadow .2s;
}

@keyframes neonPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(255,215,0,.9), 0 0 14px rgba(255,215,0,.6), 0 0 22px rgba(255,215,0,.4); }
  50%      { box-shadow: 0 0 10px rgba(255,215,0,1), 0 0 22px rgba(255,215,0,.85), 0 0 32px rgba(255,215,0,.6); }
}

.char-card.selected-p1,
.char-card.selected-p2 {
  border-color: var(--gold);
  animation: neonPulse 1.6s ease-in-out infinite;
}

.char-card.selected-p1::after { background: var(--card-color, var(--p1)); color: #fff; content: 'P1'; text-shadow: 0 0 2px #000; }
.char-card.selected-p2::after { background: var(--card-color, var(--p2)); color: #fff; content: 'P2'; text-shadow: 0 0 2px #000; }

.char-card.selected-p1::after,
.char-card.selected-p2::after {
  position: absolute; top: 8px; right: 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: .45rem;
  padding: 4px 6px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
}

.char-portrait {
  position: absolute;
  inset: 0;
}

.char-card-gradient {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 62%;
  background: linear-gradient(to top, rgba(0,0,0,.92) 0%, rgba(0,0,0,.78) 30%, rgba(0,0,0,.35) 65%, transparent 100%);
  pointer-events: none;
}

.char-acronym {
  position: absolute;
  top: 8px; left: 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: .5rem;
  letter-spacing: .03em;
  padding: 4px 7px;
  border-radius: 4px;
  background: var(--card-color, var(--border));
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
}

.char-name {
  position: absolute;
  left: .6rem; right: .6rem; bottom: .55rem;
  font-family: 'Press Start 2P', monospace;
  font-size: .55rem;
  line-height: 1.5;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
  pointer-events: none;
}

/* Hover-only refinements — souris/trackpad réels uniquement.
   Evite le hover "collé" après un tap tactile (iOS/Android WebKit). */
@media (hover: hover) and (pointer: fine) {
  .char-grid-arrow:hover {
    border-color: var(--gold);
    color: var(--gold);
    transform: scale(1.08);
  }

  .char-card:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0,0,0,.5), 0 0 20px color-mix(in srgb, var(--card-color, var(--border)) 85%, transparent);
  }
}

/* ─── FIGHT SCREEN ─────────────────────────────────────────── */
#screen-fight { align-items: stretch; }

/* HUD */
.fight-hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.5rem;
  background: var(--bg2);
  border-bottom: 3px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}

.hud-fighter {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.hud-fighter.right { flex-direction: row-reverse; }

.hud-portrait {
  width: 70px; height: 70px;
  border-radius: 6px;
  overflow: hidden;
  border: 3px solid var(--border);
  flex-shrink: 0;
}

.hud-fighter.left  .hud-portrait { border-color: var(--p1); box-shadow: var(--glow-p1); }
.hud-fighter.right .hud-portrait { border-color: var(--p2); box-shadow: var(--glow-p2); }

.hud-info { flex: 1; min-width: 0; position: relative; }
.hud-fighter.right .hud-info { text-align: right; }

.hud-name {
  font-family: 'Press Start 2P', monospace;
  font-size: .65rem;
  line-height: 1.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-fighter.left  .hud-name { color: var(--p1); }
.hud-fighter.right .hud-name { color: var(--p2); }

.hud-party {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: .2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Health bars */
.health-bar-wrap {
  flex: none;
  width: 100%;
  height: 16px;
  background: #111;
  border-radius: 3px;
  overflow: hidden;
  margin-top: .5rem;
  position: relative;
}

.health-bar {
  height: 100%;
  border-radius: 3px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

.hud-fighter.left  .health-bar { background: linear-gradient(90deg, var(--p1), #0099bb); }
.hud-fighter.right .health-bar { background: linear-gradient(90deg, #bb0022, var(--p2)); }

.health-bar.low { background: linear-gradient(90deg, #ff8800, #ff4400) !important; }

.hp-count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: .5rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.9);
  pointer-events: none;
  z-index: 2;
}

.hp-loss-float {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  font-family: 'Press Start 2P', monospace;
  font-size: .6rem;
  color: var(--red);
  text-shadow: 0 0 6px rgba(255,68,102,.8);
  pointer-events: none;
  z-index: 5;
  animation: hpLossFloat .8s ease-out forwards;
}

@keyframes hpLossFloat {
  0%   { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -22px); }
}

.hud-center {
  text-align: center;
  min-width: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
}

.fight-vs {
  font-family: 'Press Start 2P', monospace;
  font-size: 1rem;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255,215,0,.6);
}

.round-counter {
  font-family: 'Press Start 2P', monospace;
  font-size: .5rem;
  color: var(--text-muted);
  letter-spacing: .05em;
  line-height: 1.8;
}

/* ─── TOPICS GRID ──────────────────────────────────────────── */
.topics-container {
  flex: 1;
  padding: 1.5rem;
  overflow-x: hidden;
  overflow-y: auto;
}

.arrow-icon {
  font-size: 1.3rem;
  line-height: 1;
  font-weight: 700;
  flex-shrink: 0;
}

.arrow-up      { color: var(--green); }
.arrow-down    { color: var(--red); }
.arrow-neutral { color: var(--neutral); }

/* ─── SWIPE VIEW (vue rapide) ──────────────────────────────── */
.swipe-view {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.swipe-stage { order: 1; }
.swipe-progress { order: 2; }

.swipe-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  margin-top: 1.2rem;
}

.swipe-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .4rem;
}

.swipe-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg2);
  padding: 0;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s;
}

.swipe-dot:hover { transform: scale(1.2); }
.swipe-dot.current { border-color: var(--gold); box-shadow: 0 0 8px rgba(255,215,0,.6); }
.swipe-dot.voted-p1 { background: var(--p1); border-color: var(--p1); }
.swipe-dot.voted-p2 { background: var(--p2); border-color: var(--p2); }

.swipe-stage {
  display: flex;
  align-items: center;
  gap: .8rem;
  /* Not hidden: the card rotates while being dragged, which grows its
     bounding box beyond its own height — hidden here would crop the top
     of the card as soon as it starts moving. */
  overflow: visible;
  padding: .5rem 0;
}

.swipe-nav-btn {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg2);
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

.swipe-nav-btn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.swipe-nav-btn:disabled { opacity: .35; cursor: default; }

.swipe-card {
  position: relative;
  flex: 1;
  min-width: 0;
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: 12px;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
}

.swipe-card.dragging { cursor: grabbing; transition: none; }
.swipe-card.snapping { transition: transform .2s ease; }
.swipe-card.committing { transition: transform .25s ease, opacity .25s ease; }

@keyframes swipeHintWiggle {
  0%, 100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-22px) rotate(-4deg); }
  40% { transform: translateX(16px) rotate(3deg); }
  60% { transform: translateX(-12px) rotate(-2deg); }
  80% { transform: translateX(6px) rotate(1deg); }
}

.swipe-card.hint-wiggle { animation: swipeHintWiggle 1.4s ease-in-out; }

.swipe-stamp {
  position: absolute;
  top: 10px;
  z-index: 2;
  font-family: 'Press Start 2P', monospace;
  font-size: .5rem;
  padding: .4rem .6rem;
  border-radius: 4px;
  border: 2px solid;
  opacity: 0;
  pointer-events: none;
  transform: rotate(-8deg);
}

.swipe-stamp-p1 { left: 10px; color: var(--p1); border-color: var(--p1); background: rgba(0,212,255,.15); }
.swipe-stamp-p2 { right: 10px; color: var(--p2); border-color: var(--p2); background: rgba(255,68,68,.15); transform: rotate(8deg); }

.swipe-card-header {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: 1.2rem 1.5rem;
  border-bottom: 2px solid var(--border);
}

.swipe-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.swipe-half {
  padding: 1.2rem;
  position: relative;
  cursor: pointer;
}

.swipe-half.p1 { border-right: 1px solid var(--border); }

.swipe-half:hover { background: var(--bg3); }

.swipe-half.already-voted.p1 { background: #001a22; }
.swipe-half.already-voted.p2 { background: #220011; }

.swipe-voted-badge {
  position: absolute;
  top: 8px; right: 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: .4rem;
  padding: 3px 6px;
  border-radius: 3px;
  background: var(--gold);
  color: #000;
}

.swipe-half .modal-fighter-header { gap: .6rem; margin-bottom: .8rem; }
.swipe-half .modal-fighter-portrait { width: 36px; height: 36px; }
.swipe-half .modal-fighter-name { font-size: .45rem; }
.swipe-half.p1 .modal-fighter-name { color: var(--p1); }
.swipe-half.p2 .modal-fighter-name { color: var(--p2); }
.swipe-half.p1 .modal-fighter-portrait { border-color: var(--p1); }
.swipe-half.p2 .modal-fighter-portrait { border-color: var(--p2); }

.swipe-half .modal-direction { font-size: .7rem; padding: .4rem .6rem; margin-bottom: .8rem; }
.swipe-half .modal-measures li { font-size: .75rem; padding: .5rem .3rem; }

.swipe-vote-btn {
  flex-shrink: 0;
  align-self: stretch;
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: 'Press Start 2P', monospace;
  font-size: .5rem;
  letter-spacing: .05em;
  padding: .8rem .3rem;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg2);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s, transform .15s;
}

.swipe-vote-btn.p1:hover { border-color: var(--p1); color: var(--p1); }
.swipe-vote-btn.p2:hover { border-color: var(--p2); color: var(--p2); }
.swipe-vote-btn:active { transform: scale(.96); }

.swipe-vote-btn.p1.voted { border-color: var(--p1); color: var(--p1); background: rgba(0,212,255,.1); }
.swipe-vote-btn.p2.voted { border-color: var(--p2); color: var(--p2); background: rgba(255,68,68,.1); }

/* Fight controls */
.fight-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.2rem;
  background: var(--bg2);
  border-top: 2px solid var(--border);
}

#btn-share {
  font-family: 'Press Start 2P', monospace;
  font-size: .6rem;
  padding: .7rem 1.5rem;
  background: transparent;
  color: var(--gold);
  border: 2px solid var(--gold);
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: .08em;
  transition: background .2s, box-shadow .2s;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

#btn-share:hover {
  background: rgba(255,215,0,.1);
  box-shadow: 0 0 12px rgba(255,215,0,.3);
}

#btn-share.copied {
  color: var(--green);
  border-color: var(--green);
}

/* Libellé court réservé au mobile, masqué par défaut (voir @media plus bas) */
.btn-label-short { display: none; }

.btn-icon-back {
  display: inline-block;
  width: 10px;
  height: 10px;
  position: relative;
  flex-shrink: 0;
  vertical-align: middle;
}
.btn-icon-back::before {
  content: '';
  position: absolute;
  width: 7px;
  height: 7px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  top: 50%;
  left: 2px;
  transform: translateY(-50%) rotate(45deg);
}

#btn-back {
  font-family: 'Press Start 2P', monospace;
  font-size: .6rem;
  padding: .7rem 1.5rem;
  background: transparent;
  color: var(--text-muted);
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: .1em;
  transition: color .2s, border-color .2s, box-shadow .2s;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

#btn-back:hover {
  color: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(255,215,0,.3);
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-icon { font-size: 1.8rem; }

.modal-title {
  font-family: 'Press Start 2P', monospace;
  font-size: .75rem;
  color: var(--gold);
  flex: 1;
  line-height: 1.6;
}

.modal-fighter-header {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin-bottom: 1rem;
}

.modal-fighter-portrait {
  width: 44px; height: 44px;
  border-radius: 4px;
  overflow: hidden;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.modal-fighter-name {
  font-family: 'Press Start 2P', monospace;
  font-size: .5rem;
  line-height: 1.8;
}

.modal-direction {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1rem;
  padding: .5rem .8rem;
  background: var(--bg3);
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
}

/* Measure list — lecture seule */
.modal-measures { list-style: none; margin-bottom: 1rem; }

.modal-measures li {
  padding: .65rem .5rem;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
  line-height: 1.5;
  color: var(--text);
  display: flex;
  gap: .7rem;
  align-items: flex-start;
}

.modal-measures li:last-child { border-bottom: none; }

.modal-measures li::before {
  content: '▶';
  color: var(--gold);
  font-size: .65rem;
  flex-shrink: 0;
  margin-top: .18rem;
}

.modal-disclaimer {
  padding: .8rem 1.5rem;
  border-top: 2px solid var(--border);
  font-size: .75rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  border-radius: 0 0 12px 12px;
}

/* ─── VICTORY OVERLAY ──────────────────────────────────────── */
.victory-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 2000;
  width: 100vw;
  max-width: 100%;
  background: rgba(0,0,0,.95);
  backdrop-filter: blur(6px);
  align-items: center;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2rem;
  overflow-x: hidden;
  overflow-y: auto;
}

.victory-overlay.show { display: flex; animation: modal-in .3s ease; }

/* Centers short content, but degrades to a scrollable top edge instead of
   clipping the start of the content when it's taller than the viewport. */
.victory-overlay::before,
.victory-overlay::after {
  content: '';
  margin: auto 0;
}

.victory-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  width: 100%;
  max-width: 1000px;
}

.victory-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  flex: 1 1 380px;
  position: sticky;
  top: 2rem;
}

.victory-result {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.victory-fighter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .8rem;
  padding: 1.5rem;
  border-radius: 12px;
  border: 3px solid var(--border);
  min-width: 160px;
  text-align: center;
  transition: transform .3s;
}

.victory-fighter.winner {
  border-color: var(--gold);
  box-shadow: 0 0 40px rgba(255,215,0,.4);
  transform: scale(1.08);
}

.victory-fighter.loser { opacity: .5; }

.victory-portrait {
  width: 90px; height: 90px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid inherit;
}

.victory-name {
  font-family: 'Press Start 2P', monospace;
  font-size: .5rem;
  line-height: 1.8;
}

.victory-score {
  font-family: 'Press Start 2P', monospace;
  font-size: .7rem;
}

.victory-crown { font-size: 2rem; }
.victory-defeat-label {
  font-family: 'Press Start 2P', monospace;
  font-size: .45rem;
  color: var(--red);
}

.victory-subtitle {
  font-family: 'Press Start 2P', monospace;
  font-size: .55rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 2;
}

.victory-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.victory-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: .6rem;
  padding: .8rem 1.8rem;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: .08em;
  transition: transform .1s, box-shadow .1s;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-width: 240px;
}

.victory-btn.primary {
  background: var(--gold);
  color: #000;
  box-shadow: 0 4px 0 #886600;
}

.victory-btn.primary:hover { transform: translateY(-2px); }
.victory-btn.primary.copied { background: var(--green); box-shadow: 0 4px 0 #007744; }

.victory-btn.secondary {
  background: transparent;
  color: var(--text-muted);
  border: 2px solid var(--border);
}

.victory-btn.secondary:hover { color: var(--text); border-color: var(--text-muted); }

.victory-details {
  flex: 1 1 380px;
  max-width: 560px;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: .4rem 1.2rem;
  background: var(--bg2);
}

.victory-detail-item {
  border-bottom: 1px solid var(--border);
  padding: .2rem 0;
}

.victory-detail-item:last-child { border-bottom: none; }

.victory-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .6rem 0;
  cursor: pointer;
  list-style: none;
}

.victory-detail-row::-webkit-details-marker { display: none; }

.victory-detail-row::after {
  content: '▾';
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform .2s;
}

.victory-detail-item[open] .victory-detail-row::after { transform: rotate(180deg); }

.victory-detail-topic {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-muted);
  font-size: .85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.victory-detail-compare {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  padding: .5rem 0 1rem;
}

.victory-detail-program {
  flex: 1 1 220px;
  border-left: 3px solid;
  padding-left: .6rem;
}

.victory-detail-program-name {
  font-family: 'Press Start 2P', monospace;
  font-size: .5rem;
  margin-bottom: .4rem;
}

.victory-detail-program ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: .75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.victory-detail-choice {
  font-family: 'Press Start 2P', monospace;
  font-size: .5rem;
  white-space: nowrap;
  flex-shrink: 0;
  width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

/* ─── VICTORY STAGE (winner spotlight, KO fighting-game style) ─ */
.victory-flash {
  position: fixed; inset: 0;
  background: #fff;
  z-index: 1;
  pointer-events: none;
  animation: victoryFlash .5s ease-out forwards;
}

@keyframes victoryFlash {
  0%   { opacity: .85; }
  100% { opacity: 0; }
}

.victory-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  z-index: 2;
  animation: victoryShake .5s ease-out .55s both;
}

@keyframes victoryShake {
  0%,100% { transform: translate(0,0); }
  15% { transform: translate(-6px,-3px); }
  30% { transform: translate(6px,3px); }
  45% { transform: translate(-5px,3px); }
  60% { transform: translate(5px,-3px); }
  75% { transform: translate(-3px,1px); }
  90% { transform: translate(2px,-1px); }
}

.victory-rays {
  position: absolute;
  top: 45%; left: 50%;
  width: 380px; height: 380px;
  transform: translate(-50%,-50%);
  background: repeating-conic-gradient(var(--wc, var(--gold)) 0deg 6deg, transparent 6deg 18deg);
  opacity: .22;
  border-radius: 50%;
  filter: blur(1px);
  animation: raysSpin 7s linear infinite;
  z-index: 0;
}

@keyframes raysSpin { to { transform: translate(-50%,-50%) rotate(360deg); } }

.victory-winner-wrap {
  position: relative;
  z-index: 1;
  animation: winnerSlam .6s cubic-bezier(.17,.89,.32,1.49) both;
}

@keyframes winnerSlam {
  0%   { transform: scale(3) rotate(-10deg); opacity: 0; }
  55%  { transform: scale(.92) rotate(3deg); opacity: 1; }
  75%  { transform: scale(1.12) rotate(-2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.victory-winner-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  animation: winnerBob 2.2s ease-in-out .6s infinite;
}

@keyframes winnerBob {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-8px); }
}

.victory-crown {
  font-size: 2.6rem;
  animation: crownBounce 1.3s ease-in-out .6s infinite;
}

@keyframes crownBounce {
  0%,100% { transform: translateY(0) rotate(-8deg); }
  50%     { transform: translateY(-5px) rotate(8deg); }
}

.victory-portrait-lg {
  width: 140px; height: 140px;
  border-radius: 10px;
  overflow: hidden;
  border: 3px solid inherit;
  animation: winnerGlow 2.2s ease-in-out .6s infinite;
}

@keyframes winnerGlow {
  0%,100% { filter: brightness(1); }
  50%     { filter: brightness(1.15); }
}

.victory-winner-tag {
  font-size: .5rem;
  padding: .3rem .7rem;
  border-radius: 4px;
  color: #000;
  letter-spacing: .1em;
  animation: tagPulse 1.4s ease-in-out .6s infinite;
}

@keyframes tagPulse {
  0%,100% { opacity: 1; }
  50%     { opacity: .7; }
}

.victory-name-lg { font-size: .85rem; }
.victory-score-lg { font-size: 1.4rem; }

.victory-loser-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  opacity: .55;
  filter: grayscale(55%);
  transform: scale(.85);
  animation: loserDrop .5s ease-out .35s both;
}

@keyframes loserDrop {
  0%   { transform: translateY(-20px) scale(.85); opacity: 0; }
  100% { transform: translateY(0) scale(.85); opacity: .55; }
}

.victory-ko-stamp {
  font-size: .55rem;
  color: var(--red);
  border: 3px solid var(--red);
  padding: .2rem .5rem;
  border-radius: 4px;
  transform: rotate(-12deg);
  animation: koStamp .45s ease-out .8s both;
}

@keyframes koStamp {
  0%   { transform: scale(3) rotate(-25deg); opacity: 0; }
  60%  { transform: scale(.9) rotate(-8deg); opacity: 1; }
  100% { transform: scale(1) rotate(-12deg); opacity: 1; }
}

.victory-portrait-sm {
  width: 60px; height: 60px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border);
}

/* ─── PORTRAIT SVG placeholder ─────────────────────────────── */
.portrait-svg {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 1.4rem;
  background: var(--bg3);
}

/* ─── TRANSITION OVERLAY ───────────────────────────────────── */
#transition-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 5000;
  background: #000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
}

#transition-overlay.show { display: flex; }

.transition-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 100%;
}

.transition-name-wrap,
.transition-vs-col {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
}

.transition-vs-text {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(2rem, 8vw, 5rem);
  animation: explosion 0.6s ease-out forwards;
}

@keyframes explosion {
  0%   { transform: scale(0.2); opacity: 0; }
  60%  { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}

/* Blind mode reveal — masks slam down over the names/VS after they appear */
.transition-blind-mask {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: blindMaskSmash .5s cubic-bezier(.34,1.56,.64,1) 1s forwards;
}

.transition-blind-mask img {
  width: clamp(70px, 12vw, 100px);
  height: clamp(70px, 12vw, 100px);
  border-radius: 10px;
  box-shadow: 0 0 40px rgba(178,102,255,.75);
}

@keyframes blindMaskSmash {
  0%   { opacity: 0; transform: scale(2.6) rotate(18deg); }
  55%  { opacity: 1; transform: scale(.85) rotate(-6deg); }
  75%  { transform: scale(1.08) rotate(4deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.transition-blind-stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  white-space: nowrap;
  font-size: clamp(.5rem, 1.6vw, .75rem);
  color: #cc88ff;
  background: #1a0d2e;
  border: 2px solid #b266ff;
  padding: .5rem .9rem;
  border-radius: 6px;
  box-shadow: 0 0 30px rgba(178,102,255,.8);
  opacity: 0;
  animation: blindStampSmash .5s cubic-bezier(.34,1.56,.64,1) 1.15s forwards;
}

@keyframes blindStampSmash {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(3) rotate(-25deg); }
  55%  { opacity: 1; transform: translate(-50%,-50%) scale(.85) rotate(-4deg); }
  75%  { transform: translate(-50%,-50%) scale(1.06) rotate(-10deg); }
  100% { opacity: 1; transform: translate(-50%,-50%) scale(1) rotate(-8deg); }
}

/* ─── FOOTER ───────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: .8rem;
  font-size: .75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-top: auto;
}

footer a { color: var(--text-muted); text-decoration: none; }
footer a:hover { color: var(--text); }

.footer-links {
  font-size: .8rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  row-gap: .6rem;
}
.footer-links a { color: var(--text); }
.footer-links a:hover { color: var(--gold); }
.footer-sep { margin: 0 .5rem; color: var(--border); }
.footer-meta { color: var(--text-muted); }
.footer-note { color: var(--text-muted); font-size: .7rem; max-width: 560px; margin: 0 auto; }

.footer-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
}
.footer-info {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.footer-menu-toggle { display: none; }

/* ─── SUBPAGES (Contact / Contribuer / Patch Notes / A propos) ── */
.subpage-header {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.5rem;
  background: linear-gradient(180deg, #000 0%, var(--bg2) 100%);
  border-bottom: 2px solid var(--border);
}

.subpage-back {
  font-family: 'Press Start 2P', monospace;
  font-size: .6rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: .6rem 1rem;
  border: 2px solid var(--border);
  border-radius: 4px;
  letter-spacing: .05em;
  white-space: nowrap;
  transition: color .2s, border-color .2s;
}
.subpage-back:hover { color: var(--gold); border-color: var(--gold); }

.subpage-title {
  font-size: clamp(1rem, 3vw, 1.4rem);
  color: var(--gold);
  text-shadow: 0 0 16px rgba(255,215,0,.6), 2px 2px 0 #000;
  letter-spacing: .06em;
}

.subpage-content {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.subpage-intro { color: var(--text-muted); margin-bottom: 1.8rem; line-height: 1.6; }

/* Forms */
.site-form { display: flex; flex-direction: column; gap: 1.2rem; margin-bottom: 2.5rem; }

.form-field { display: flex; flex-direction: column; gap: .4rem; }

.form-field label { font-size: .8rem; color: var(--text-muted); letter-spacing: .02em; }

.form-field input,
.form-field select,
.form-field textarea {
  font-family: 'Exo 2', sans-serif;
  font-size: .95rem;
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: 4px;
  padding: .7rem .9rem;
  color: var(--text);
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.form-submit-btn {
  align-self: flex-start;
  font-size: .75rem;
  padding: .9rem 1.8rem;
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: .08em;
  box-shadow: 0 4px 0 #886600;
  transition: transform .1s, box-shadow .1s;
}
.form-submit-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #886600, 0 0 20px rgba(255,215,0,.6); }
.form-submit-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #886600; }

.form-hint { font-size: .75rem; color: var(--text-muted); }
.form-hint a { color: var(--p1); }

/* Honeypot anti-spam field — kept in the DOM/tab order out but invisible to real users */
.hp-field { position: absolute; left: -9999px; top: -9999px; }

.form-status { font-size: .8rem; min-height: 1.2em; }
.form-status.pending { color: var(--text-muted); }
.form-status.success { color: var(--green); }
.form-status.error   { color: var(--red); }

.form-submit-btn:disabled { opacity: .6; cursor: not-allowed; }

/* Donate block */
.donate-block {
  border-top: 1px solid var(--border);
  padding-top: 1.8rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  align-items: flex-start;
}
.donate-title { font-size: .75rem; color: var(--text); }
.donate-btn {
  display: inline-block;
  font-size: .85rem;
  padding: .7rem 1.2rem;
  border-radius: 4px;
  border: 2px solid var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Patch notes */
.changelog-list { list-style: none; display: flex; flex-direction: column; gap: 1.6rem; margin-bottom: 2.5rem; }
.changelog-entry { border-left: 3px solid var(--gold); padding-left: 1.1rem; }
.changelog-head { display: flex; align-items: baseline; gap: .8rem; margin-bottom: .5rem; flex-wrap: wrap; }
.changelog-version { font-size: .75rem; color: var(--gold); }
.changelog-date { font-size: .8rem; color: var(--text-muted); }
.changelog-items { list-style: disc; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .3rem; color: var(--text); line-height: 1.5; }

.upcoming-block {
  border: 2px dashed var(--p1);
  border-radius: 8px;
  padding: 1.4rem;
}
.upcoming-title { font-size: .7rem; color: var(--p1); text-align: center; margin-bottom: 1rem; }

/* About page */
.about-section { margin-bottom: 2rem; }
.about-heading { font-size: .75rem; color: var(--gold); margin-bottom: .8rem; letter-spacing: .05em; }
.about-section p { line-height: 1.65; color: var(--text); }
.about-rules { padding-left: 1.3rem; display: flex; flex-direction: column; gap: .5rem; line-height: 1.6; }
.about-legend { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .6rem; }
.about-legend-row { display: flex; align-items: center; gap: .6rem; }
.about-note { font-size: .8rem; color: var(--text-muted); }
.about-topics-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .6rem;
}
.about-topics-list li {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .5rem .7rem;
  font-size: .85rem;
}

/* Privacy / RGPD page */
#screen-privacy .about-section a { color: var(--gold); }
#screen-privacy .about-section a:hover { text-decoration-color: var(--gold); }
.privacy-cookie-settings-section { margin-top: 2.5rem; border-top: 1px solid var(--border); padding-top: 1.8rem; }
.privacy-cookie-settings-section #privacy-cookie-settings { margin-top: 1rem; }

/* ─── COOKIE BANNER ────────────────────────────────────────── */
.cookie-banner {
  position: fixed;
  left: 1rem; right: 1rem; bottom: 1rem;
  z-index: 8000;
  max-width: 760px;
  margin: 0 auto;
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 8px 30px rgba(0,0,0,.6);
  transform: translateY(150%);
  opacity: 0;
  pointer-events: none;
  transition: transform .3s ease, opacity .3s ease;
}
.cookie-banner.show { transform: translateY(0); opacity: 1; pointer-events: auto; }

.cookie-banner-text { flex: 1 1 320px; font-size: .85rem; line-height: 1.5; color: var(--text); }
.cookie-banner-text a { color: var(--gold); }

.cookie-banner-actions { display: flex; gap: .7rem; flex-wrap: wrap; }

.cookie-btn {
  font-family: 'Exo 2', sans-serif;
  font-size: .8rem;
  padding: .6rem 1.1rem;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: .02em;
  transition: transform .1s, box-shadow .1s;
}
.cookie-btn-primary {
  background: var(--gold);
  color: #000;
  border: none;
  box-shadow: 0 4px 0 #886600;
}
.cookie-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #886600, 0 0 20px rgba(255,215,0,.6); }
.cookie-btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #886600; }

.cookie-btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 2px solid var(--border);
}
.cookie-btn-secondary:hover { color: var(--text); border-color: var(--text-muted); }

/* ─── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .select-arena {
    grid-template-columns: 1fr 1fr;
  }

  .vs-divider { display: none; }

  .player-slot { padding: 1.2rem .8rem; min-height: 200px; }
  .player-slot:last-of-type { border-left: 1px solid var(--border); }

  /* Les avatars JOUEUR 1 / JOUEUR 2 restent visibles — c'est la grille de personnages
     en dessous qui cède la place à la carte de lancement (plus besoin de choisir). */
  #screen-select.confirm-active .char-grid-section { display: none; }

  .fight-launch-bar {
    position: static;
    margin: 0 auto;
    max-width: 88vw;
    padding: .8rem 1rem;
    gap: .6rem;
  }
  .fight-launch-bar.visible { animation: launchBarSlamMobile .5s cubic-bezier(.2,.85,.3,1.3) both; }

  .blind-mode-toggle { font-size: .72rem; padding: .4rem .7rem .4rem .5rem; }
  #btn-fight { font-size: .6rem; padding: .8rem 1.4rem; }
  .btn-change-candidates { display: inline-flex; }

  .player-label { font-size: .65rem; }
  .slot-name { font-size: .62rem; }
  .slot-empty-hint { font-size: .75rem; }

  .fight-hud {
    grid-template-columns: 1fr 56px 1fr;
    gap: .5rem;
    padding: .8rem;
  }

  .hud-portrait { width: 48px; height: 48px; }
  .hud-name { font-size: .58rem; }
  .hud-party { display: none; }
  .fight-vs { font-size: .75rem; }

  .char-grid-section { padding: 1.2rem .5rem; }

  .char-grid-wrap { position: relative; }

  .char-grid {
    gap: .5rem;
    padding-left: 2.3rem;
    padding-right: 2.3rem;
    scroll-padding-left: 2.3rem;
    scroll-padding-right: 2.3rem;
    mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
    /* The spectrum bar below doubles as the scrollbar — no need for a native one too */
    scrollbar-width: none;
  }
  .char-grid::-webkit-scrollbar { display: none; }

  .char-grid .char-card { flex-basis: 112px; }
  .char-name { font-size: .5rem; line-height: 1.4; }
  .char-acronym { font-size: .44rem; padding: 3px 6px; }

  .char-grid-arrow {
    position: absolute;
    top: 50%;
    margin-top: -15px;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    font-size: .75rem;
    border: 2px solid color-mix(in srgb, var(--border) 75%, transparent);
    background: color-mix(in srgb, var(--bg2) 60%, transparent);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    box-shadow: 0 2px 10px rgba(0,0,0,.4);
    z-index: 3;
  }
  .char-grid-arrow.left { left: 2px; }
  .char-grid-arrow.right { right: 2px; }

  /* Progress dots stay compact and keep a bit of breathing room below the hint */
  .swipe-progress { margin-top: .8rem; gap: .5rem; }
  .swipe-dots { gap: .3rem; }
  .swipe-dot { width: 7px; height: 7px; }

  .swipe-nav-btn { width: 30px; height: 30px; font-size: 1rem; }
  .swipe-half { padding: .7rem; }
  .swipe-card-header { padding: .8rem 1rem; }
  .swipe-half .modal-fighter-name { font-size: .52rem; }
  .swipe-half .modal-direction { font-size: .68rem; padding: .3rem .4rem; }
  .swipe-half .modal-measures li { font-size: .75rem; padding: .4rem .2rem; }
  .swipe-stamp { font-size: .5rem; padding: .3rem .4rem; }

  /* Vote buttons drop below the card instead of squeezing it sideways */
  .swipe-stage { flex-wrap: wrap; row-gap: .8rem; }
  .swipe-card { flex-basis: 100%; order: 1; }
  .swipe-vote-btn {
    order: 2;
    flex: 1 1 0;
    width: auto;
    height: 46px;
    writing-mode: horizontal-tb;
    text-orientation: initial;
  }

  .victory-overlay { padding: 1.2rem; }
  .victory-layout { flex-direction: column; align-items: stretch; }
  .victory-main { position: static; }
  .victory-result { gap: .8rem; }
  .victory-fighter { padding: 1rem; min-width: 130px; }
  .victory-details { width: 100%; max-width: none; padding: .3rem .8rem; }
  .victory-detail-topic { font-size: .75rem; }
  .victory-detail-compare { flex-direction: column; gap: .8rem; }
  .victory-detail-program { flex: 1 1 auto; }

  .victory-rays { width: 260px; height: 260px; }
  .victory-portrait-lg { width: 100px; height: 100px; }
  .victory-name-lg { font-size: .65rem; }
  .victory-score-lg { font-size: 1.1rem; }
  .victory-crown { font-size: 2rem; }
  .victory-portrait-sm { width: 46px; height: 46px; }

  .cookie-banner { left: .6rem; right: .6rem; bottom: .6rem; padding: 1rem; flex-direction: column; align-items: stretch; }
  .cookie-banner-text { flex: none; }
  .cookie-banner-actions { justify-content: stretch; }
  .cookie-btn { flex: 1; }

  /* Footer : liens repliés dans un menu burger, méta/note à gauche */
  footer { position: relative; }
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: .8rem;
  }
  .footer-info { align-items: flex-start; text-align: left; }
  .footer-note { margin: 0; max-width: none; }

  .footer-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    font-size: 1rem;
    line-height: 1;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: color .2s, border-color .2s;
  }
  .footer-menu-toggle:hover,
  .footer-menu-toggle[aria-expanded="true"] { color: var(--gold); border-color: var(--gold); }

  .footer-links {
    display: none;
    position: absolute;
    left: .8rem;
    right: .8rem;
    bottom: 100%;
    margin-bottom: .4rem;
    flex-direction: column;
    align-items: flex-start;
    gap: .6rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
    box-shadow: 0 -4px 16px rgba(0,0,0,.4);
    z-index: 5;
  }
  .footer-links.open { display: flex; }
  .footer-links a { padding: .2rem 0; }
  .footer-sep { display: none; }

  /* Barre de combat & écran de victoire : icônes seules (retour) ou compactes
     (partager), une seule ligne. L'ordre visuel retour-gauche/partager-droite
     vient directement de l'ordre du DOM (identique sur desktop) — pas de
     flex order ici. */
  .fight-controls {
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: .5rem;
  }
  .fight-controls #btn-back .btn-label { display: none; }
  #btn-back, #btn-share { padding: .7rem .9rem; flex-shrink: 0; }
  #btn-share .btn-label-full { display: none; }
  #btn-share .btn-label-short { display: inline; }
  #btn-share { min-width: 118px; justify-content: center; }

  .victory-actions { flex-direction: row; flex-wrap: nowrap; justify-content: space-between; gap: .4rem; width: 100%; }
  .victory-actions #vbtn-back .btn-label { display: none; }
  #vbtn-back, #vbtn-share { padding: .7rem .9rem; flex-shrink: 0; }
  #vbtn-back { min-width: 0; }
  #vbtn-share .btn-label-full { display: none; }
  #vbtn-share .btn-label-short { display: inline; }
  #vbtn-share { min-width: 118px; justify-content: center; }
}

@media (max-width: 400px) {
  .main-title { font-size: 1.1rem; }
  .char-grid { gap: .4rem; padding-left: 2.1rem; padding-right: 2.1rem; scroll-padding-left: 2.1rem; scroll-padding-right: 2.1rem; }
  .char-grid .char-card { flex-basis: 92px; }
  .char-name { font-size: .44rem; line-height: 1.3; }
  .char-acronym { font-size: .4rem; padding: 3px 5px; }
  .char-grid-arrow { width: 26px; height: 26px; margin-top: -13px; font-size: .65rem; }
}
