/* ============================================================
   AniBattle — Direction Artistique v2 + UI Kit ImageGen v2.
   Keyart : assets/home-keyart-v2.webp (module par ecran).
   Kit UI : assets/ui-kit-v2/ (logo, frames de boutons, panneaux,
   backplates de titres, ornements). Les TEXTES restent en HTML/CSS
   par-dessus les assets. Gameplay sobre, resultats theatraux.
   ============================================================ */

:root {
  --bg: #08090d;
  --panel: #14161d;
  --panel-2: #1d2029;
  --ink: #f3f0e8;
  --muted: #8f929c;
  --dim: #565a64;
  --red: #ff1f3d;
  --red-deep: #a80f2b;
  --cyan: #13dff2;
  --gold: #f6c744;
  --gold-deep: #b98d1e;
  --ok: #58d96f;
  --line: #30323b;
  --radius: 8px;
  --font: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --kit: 'assets/ui-kit-v2';
}

* { box-sizing: border-box; }

/* L'attribut hidden doit TOUJOURS gagner, meme si un display est defini
   en CSS (sinon un .pr-count { display:flex } rend hidden inoperant). */
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: var(--font); -webkit-font-smoothing: antialiased;
}
body {
  background-image:
    radial-gradient(circle at 50% -8%, #12141c 0%, rgba(8,9,13,0) 55%),
    url('assets/texture-halftone.png');
}

#app { min-height: 100vh; display: flex; align-items: stretch; }

/* ============================================================
   KEYART — module par ecran, vignette de lisibilite au centre.
   ============================================================ */
.keyart {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url('assets/home-keyart-v2.webp') center / cover no-repeat;
  opacity: .55;
  transition: opacity .25s ease, filter .25s ease;
}
.keyart::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 62% 72% at 50% 52%,
    rgba(8,9,13,.86) 0%, rgba(8,9,13,.45) 48%, rgba(8,9,13,0) 78%);
}
#app[data-screen="screen-home"] .keyart { opacity: 1; }
#app[data-screen="screen-home"] .keyart::after {
  background: linear-gradient(90deg, rgba(8,9,13,0) 30%, rgba(8,9,13,.42) 50%, rgba(8,9,13,0) 70%);
}
#app[data-screen="screen-lobby"] .keyart { opacity: .68; }
#app[data-screen="screen-round-result"] .keyart { opacity: .5; }
#app[data-screen="screen-match-result"] .keyart { opacity: .65; }
#app[data-screen="screen-countdown"] .keyart { opacity: .35; }
/* Manche : personnages perceptibles en PERIPHERIE seulement — le centre
   (zone de jeu) reste sombre et protege, glow rouge/cyan lateral. */
#app[data-screen="screen-round"] .keyart { opacity: .38; filter: saturate(.8); }
#app[data-screen="screen-round"] .keyart::after {
  background:
    linear-gradient(90deg, rgba(255,31,61,.10), transparent 16%),
    linear-gradient(270deg, rgba(19,223,242,.09), transparent 16%),
    linear-gradient(90deg,
      rgba(8,9,13,.30) 0%,
      rgba(8,9,13,.93) 17%,
      rgba(8,9,13,.97) 50%,
      rgba(8,9,13,.93) 83%,
      rgba(8,9,13,.30) 100%);
}

.screen {
  display: none; flex: 1; flex-direction: column; align-items: center; justify-content: center;
  padding: 26px 20px; gap: 18px; animation: fade .16s ease;
  position: relative; z-index: 1;
}
.screen.active { display: flex; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.muted { color: var(--muted); letter-spacing: .12em; font-size: 12px; text-transform: uppercase; }
.small { font-size: 11px; }
.error-text { color: var(--red); min-height: 18px; font-size: 13px; margin: 4px 0 0; }

/* ============================================================
   LOGO (asset kit) — texte alt en fallback si l'image manque
   ============================================================ */
.logo-wrap { margin: 0; line-height: 0; }
.logo-img { display: block; height: auto; filter: drop-shadow(0 6px 24px rgba(0,0,0,.6)); }
.logo-home { width: min(480px, 72vw); }
.logo-lobby { width: 240px; }
.logo-mr { width: 210px; }
.logo-hud { width: 120px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.6)); }

/* ============================================================
   BOUTONS — frames du kit, texte HTML par-dessus
   ============================================================ */
/* Frame cyan (action secondaire "Rejoindre") : button-frame-cyan-a */
.btn-cyan {
  appearance: none; cursor: pointer; border: none;
  background: transparent url('assets/ui-kit-v2/buttons/button-frame-cyan-a.webp') center / 100% 100% no-repeat;
  color: var(--cyan);
  font-weight: 900; letter-spacing: .18em; text-transform: uppercase; font-size: 13px;
  padding: 17px 46px;
  text-shadow: 0 2px 4px rgba(0,0,0,.8);
  transition: transform .08s ease, filter .12s ease;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,.5));
}
.btn-cyan:hover { filter: drop-shadow(0 3px 10px rgba(0,0,0,.5)) brightness(1.3); color: #aef4fb; }
.btn-cyan:active { transform: translateY(1px); }

/* Frame or (CTA principal) : button-frame-gold-a, pointes laterales ~13% */
.btn-gold {
  appearance: none; cursor: pointer; border: none;
  background: transparent url('assets/ui-kit-v2/buttons/button-frame-gold-a.webp') center / 100% 100% no-repeat;
  color: var(--gold);
  font-weight: 900; letter-spacing: .24em; text-transform: uppercase; font-size: 15px;
  padding: 20px 74px;
  text-shadow: 0 0 12px rgba(246,199,68,.35), 0 2px 4px rgba(0,0,0,.8);
  transition: transform .08s ease, filter .12s ease;
  filter: drop-shadow(0 4px 14px rgba(0,0,0,.5));
}
.btn-gold:hover { filter: drop-shadow(0 4px 14px rgba(0,0,0,.5)) brightness(1.25); color: #ffe9a8; }

/* Variante or secondaire (frame gold-b du kit) */
.btn-gold-b {
  appearance: none; cursor: pointer; border: none;
  background: transparent url('assets/ui-kit-v2/buttons/button-frame-gold-b.webp') center / 100% 100% no-repeat;
  color: var(--gold);
  font-weight: 900; letter-spacing: .18em; text-transform: uppercase; font-size: 13px;
  padding: 18px 58px;
  text-shadow: 0 2px 4px rgba(0,0,0,.8);
  transition: transform .08s ease, filter .12s ease;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,.5));
}
.btn-gold-b:hover { filter: drop-shadow(0 3px 10px rgba(0,0,0,.5)) brightness(1.25); color: #ffe9a8; }
.btn-gold-b:active { transform: translateY(1px); }

/* Etat "recherche d'adversaire" du bouton Partie rapide */
.btn-gold.searching { animation: searchpulse 1.4s ease-in-out infinite; color: #ffe9a8; }
@keyframes searchpulse {
  0%, 100% { filter: drop-shadow(0 4px 14px rgba(0,0,0,.5)); }
  50% { filter: drop-shadow(0 4px 14px rgba(0,0,0,.5)) brightness(1.45); }
}
.btn-gold:active { transform: translateY(1px); }
.btn-gold:disabled { opacity: .45; cursor: not-allowed; }
.btn-wide { min-width: 320px; }

/* Frame rouge (action forte) : button-frame-red-a */
.btn-red {
  appearance: none; cursor: pointer; border: none;
  background: transparent url('assets/ui-kit-v2/buttons/button-frame-red-a.webp') center / 100% 100% no-repeat;
  color: #fff;
  font-weight: 900; letter-spacing: .2em; text-transform: uppercase; font-size: 15px;
  padding: 20px 70px;
  text-shadow: 0 2px 4px rgba(0,0,0,.8);
  transition: transform .08s ease, filter .12s ease;
  filter: drop-shadow(0 4px 14px rgba(0,0,0,.5));
}
.btn-red:hover { filter: drop-shadow(0 4px 14px rgba(0,0,0,.5)) brightness(1.25); }
.btn-red:active { transform: translateY(1px); }

/* Inputs sombres integres a la DA (plus de blanc web) */
.text-input {
  background: rgba(14,16,22,.92); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 16px; font-size: 16px; font-weight: 600; outline: none; width: 280px; text-align: center;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.text-input::placeholder { color: var(--dim); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; font-size: 13px; }
.text-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan) inset, 0 0 16px rgba(19,223,242,.12); }
.code-input { width: 140px; text-transform: uppercase; letter-spacing: .3em; font-weight: 800; }

/* ---- Aide : pastille OR bien visible "? AIDE" (agrandie 2026-07-09) ---- */
.help-btn {
  position: fixed; top: 16px; right: 18px; z-index: 5;
  display: inline-flex; align-items: center; gap: 8px;
  appearance: none; cursor: pointer; padding: 9px 15px 9px 9px;
  background: rgba(20,22,29,.92); border: 1.5px solid var(--gold); color: var(--gold);
  font-weight: 900; letter-spacing: .12em; text-transform: uppercase; font-size: 13px;
  border-radius: 24px;
  transition: transform .1s ease, background .2s ease;
  animation: helppulse 2.4s ease-in-out infinite;
}
.help-btn .help-q {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--gold); color: #241a00; font-size: 16px; font-weight: 900;
}
.help-btn:hover { background: rgba(52,42,8,.92); transform: translateY(-1px); }
@keyframes helppulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(246,199,68,0); }
  50% { box-shadow: 0 0 16px 2px rgba(246,199,68,.4); }
}
@media (prefers-reduced-motion: reduce) { .help-btn { animation: none; } }

/* ---- Bouton "Quitter" (lobby / solo) : coin haut-gauche ---- */
.corner-back {
  position: fixed; top: 16px; left: 16px; z-index: 6;
  appearance: none; cursor: pointer; padding: 9px 16px;
  background: rgba(20,22,29,.88); border: 1px solid var(--line); color: var(--muted);
  font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 12px;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 88% 100%, 0 100%);
  transition: color .12s ease, border-color .12s ease;
}
.corner-back:hover { color: var(--red); border-color: var(--red); }

/* ---- Bonus ROMAJI : le texte validé "brille" (titre romaji complet) ---- */
.field.romaji-shine { overflow: hidden; }
.field.romaji-shine input { color: var(--gold) !important; text-shadow: 0 0 10px rgba(246,199,68,.75); }
.field.romaji-shine::after {
  content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: linear-gradient(105deg, transparent 32%, rgba(246,199,68,.6) 50%, transparent 68%);
  transform: translateX(-120%); animation: romajisweep 1s ease-out;
}
@keyframes romajisweep { to { transform: translateX(120%); } }
@media (prefers-reduced-motion: reduce) { .field.romaji-shine::after { animation: none; } }
/* Badge +romaji au reveal (tirets pour le distinguer du flat conditionnel) */
.badge-romaji {
  display: inline-block; margin-left: 8px; padding: 1px 7px;
  background: transparent; color: var(--gold); border: 1px dashed var(--gold);
  font-size: 10px; font-weight: 900; font-style: normal; letter-spacing: .04em;
}
.help-overlay {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(8,9,13,.82);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.help-panel {
  max-width: 640px; background: rgba(10,11,16,.96); border: 1px solid rgba(246,199,68,.45);
  padding: 34px 40px 30px;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  clip-path: polygon(20px 0, calc(100% - 20px) 0, 100% 20px, 100% calc(100% - 20px), calc(100% - 20px) 100%, 20px 100%, 0 calc(100% - 20px), 0 20px);
}
.help-title { font-size: 20px; font-weight: 900; font-style: italic; letter-spacing: .2em; color: var(--gold); }
.help-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 12px; }
.help-steps li { font-size: 14px; line-height: 1.5; color: var(--ink); }
.help-steps b { color: var(--ink); }
.hl-gold { color: var(--gold); font-weight: 800; }
.hl-red { color: var(--red); font-weight: 800; }

/* ---- Moment RARE (teaser en pleine manche, palier seulement) ---- */
.rare-dim {
  position: fixed; inset: 0; z-index: 4; pointer-events: none;
  background: rgba(8,9,13,.45); opacity: 0;
}
.rare-dim.play { animation: raredim .9s ease both; }
@keyframes raredim { 0% { opacity: 0; } 25% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
.slot.rare-glow { position: relative; z-index: 5; }
.slot.rare-glow .field {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 1px var(--gold) inset, 0 0 26px rgba(246,199,68,.5) !important;
  animation: rarepop .5s cubic-bezier(.2,.9,.3,1.25);
}
@keyframes rarepop { 0% { transform: scale(1.03); } 100% { transform: none; } }
.rare-float {
  position: absolute; right: 12px; top: -26px; z-index: 6; pointer-events: none;
  font-size: 15px; font-weight: 900; font-style: italic; letter-spacing: .14em;
  color: var(--gold); text-shadow: 0 0 14px rgba(246,199,68,.6), 0 2px 4px rgba(0,0,0,.9);
  animation: rarefloat 1.2s ease both;
}
@keyframes rarefloat {
  0% { opacity: 0; transform: translateY(8px) scale(1.4); }
  20% { opacity: 1; transform: translateY(0) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-14px); }
}

/* ---- Lettre comeback x2 (secrete, joueur mene uniquement) ----
   Pre-round : chip sur la tuile. En manche : badge ancre au SLOT (la tuile a
   un clip-path qui rognait l'ancien badge -> il etait a peine visible). */
.x2-chip {
  position: absolute; top: -10px; right: -10px; z-index: 3;
  background: var(--gold); color: #241a00;
  font-size: 14px; font-weight: 900; font-style: italic; letter-spacing: 0;
  padding: 3px 10px; text-shadow: none;
  clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
  box-shadow: 0 0 14px rgba(246,199,68,.6);
}
.tile.is-x2, .pr-tile.is-x2 { filter: drop-shadow(0 0 10px rgba(246,199,68,.55)); }

/* Badge ×2 en manche : gros, dore, pulse, pose SUR le coin haut de la tuile
   mais hors de son clip-path (ancre au slot). */
.slot.has-x2 .tile {
  border-color: var(--gold); color: var(--gold);
  box-shadow: 0 0 16px rgba(246,199,68,.45);
}
.x2-flag {
  position: absolute; top: -11px; left: 34px; z-index: 6;
  background: var(--gold); color: #241a00;
  font-size: 15px; font-weight: 900; font-style: italic; letter-spacing: 0;
  padding: 3px 11px; text-shadow: none;
  clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%);
  box-shadow: 0 0 16px rgba(246,199,68,.75);
  animation: x2pulse 1.1s ease-in-out infinite;
}
@keyframes x2pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.13); } }
@media (prefers-reduced-motion: reduce) { .x2-flag { animation: none; } }

/* ---- Lettres bonus conditionnelles (5 par manche, communes aux 2 joueurs).
   La chip vit A DROITE de la lettre : gain flat + condition. Elle s'allume
   (hit, or) ou s'eteint (miss) a la validation du slot. ---- */
.cond-tag {
  box-sizing: border-box; width: 96px; max-width: 96px;
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
  min-height: 46px; max-height: 58px; padding: 5px 12px 6px 10px; overflow: hidden;
  /* Frames UI kit v2 (Codex) : off = en attente, on = condition remplie.
     Le TEXTE reste en HTML par-dessus l'asset (regle du kit). */
  background: url('assets/ui-kit-v2/banners/bonus-chip-frame-off.svg') center / 100% 100% no-repeat;
  transition: opacity .15s ease, filter .15s ease;
}
.cond-tag.none { visibility: hidden; }
.cond-pts { font-size: 15px; font-weight: 900; font-style: italic; color: var(--gold); line-height: 1; }
.cond-label {
  font-size: 8px; font-weight: 800; letter-spacing: 0; text-transform: uppercase;
  color: var(--muted); line-height: 1.12; white-space: normal; word-break: break-word;
  overflow: hidden; /* excedent clipe par .cond-tag (max-height) — jamais hors cadre */
}
.cond-tag.hit {
  background-image: url('assets/ui-kit-v2/banners/bonus-chip-frame-on.svg');
  filter: drop-shadow(0 0 10px rgba(246,199,68,.45));
}
.cond-tag.hit .cond-label { color: var(--gold); }
.cond-tag.miss { opacity: .3; }
/* Mini chip +pts sur les tuiles du pre-round (memorisation) */
.cond-mini {
  position: absolute; bottom: -7px; right: -7px; z-index: 2;
  background: var(--gold); color: #241a00;
  font-size: 10px; font-weight: 900; font-style: normal; letter-spacing: 0;
  padding: 1px 6px; text-shadow: none;
  clip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%);
}
/* Badge +flat dans les tableaux de resultat (condition en tooltip) */
.badge-cond {
  display: inline-block; margin-left: 8px; padding: 1px 7px;
  background: transparent; color: var(--gold); border: 1px solid var(--gold);
  font-size: 10px; font-weight: 900; font-style: normal; letter-spacing: .04em;
}
/* ---- Bouton son on/off (pack audio v1) — coin bas-gauche, tous ecrans.
   Icones haut-parleur en SVG inline (mask -> currentColor), aucun emoji. */
.mute-btn {
  position: fixed; bottom: 16px; left: 16px; z-index: 9;
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: rgba(10,11,16,.85); border: 1px solid var(--line); color: var(--muted);
  cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 80% 100%, 0 100%);
  transition: color .12s ease, border-color .12s ease;
}
.mute-btn:hover { color: var(--gold); border-color: var(--gold); }
.mute-icon {
  width: 20px; height: 20px; background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3zm13.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4zM14 3.2v2.1a7 7 0 0 1 0 13.4v2.1a9 9 0 0 0 0-17.6z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3zm13.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4zM14 3.2v2.1a7 7 0 0 1 0 13.4v2.1a9 9 0 0 0 0-17.6z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.mute-btn.muted { color: var(--red); }
.mute-btn.muted .mute-icon {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3zm18.6 3 2.1-2.1-1.4-1.4-2.1 2.1-2.1-2.1-1.4 1.4 2.1 2.1-2.1 2.1 1.4 1.4 2.1-2.1 2.1 2.1 1.4-1.4-2.1-2.1z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3zm18.6 3 2.1-2.1-1.4-1.4-2.1 2.1-2.1-2.1-1.4 1.4 2.1 2.1-2.1 2.1 1.4 1.4 2.1-2.1 2.1 2.1 1.4-1.4-2.1-2.1z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Alerte HUD : l'adversaire detient la lettre comeback x2 (lettre inconnue) */
.opp-x2 {
  margin-left: 8px; padding: 1px 7px;
  background: var(--gold); color: #241a00;
  font-size: 10px; font-weight: 900;
  clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
  animation: lowpulse 1.6s ease-in-out infinite;
}

.badge-x2 {
  display: inline-block; margin-left: 8px; padding: 1px 7px;
  background: var(--gold); color: #241a00; border: 1px solid var(--gold);
  font-size: 10px; font-weight: 900; letter-spacing: .08em;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  vertical-align: middle;
}

/* ---- Badge MIROIR (reveal : meme anime choisi par les deux joueurs) ---- */
.badge-mirror {
  display: inline-block; margin-left: 8px; padding: 1px 7px;
  border: 1px solid var(--muted); color: var(--ink);
  font-size: 10px; font-weight: 900; letter-spacing: .12em;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  vertical-align: middle; opacity: .9;
}

/* Tableau par manche sur l'ecran final (pills cliquables) */
.mr-round-table { max-width: 720px; }
.mr-round-table:empty { display: none; }
.mr-pill { cursor: pointer; transition: filter .12s ease; }
.mr-pill:hover { filter: brightness(1.35); }
.mr-pill.active { background: rgba(246,199,68,.14); box-shadow: 0 0 0 1px var(--gold) inset; }

/* Mode solo : chips de difficulte + CTA */
.solo-block { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.solo-diffs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.diff-chip {
  appearance: none; cursor: pointer;
  background: rgba(20,22,29,.85); border: 1px solid var(--line); color: var(--muted);
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  padding: 8px 13px;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  transition: color .12s ease, border-color .12s ease, background .12s ease;
}
.diff-chip:hover { color: var(--ink); border-color: var(--muted); }
.diff-chip.sel { border-color: var(--gold); color: var(--gold); background: rgba(246,199,68,.10); }

/* Dividers ornementaux du kit */
.divider { width: 320px; height: 28px; background: center / contain no-repeat; opacity: .9; }
.div-gold { background-image: url('assets/ui-kit-v2/banners/divider-gold-long.webp'); }
.div-ivory { background-image: url('assets/ui-kit-v2/banners/divider-ivory-long.webp'); }

/* ============================================================
   ACCUEIL
   ============================================================ */
#screen-home { gap: 26px; }
.home-menu { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.format-reminder { margin-top: 2px; color: var(--cyan); letter-spacing: .35em; font-weight: 800; font-size: 12px; text-shadow: 0 0 8px rgba(0,0,0,.9); }
.join-row { display: flex; gap: 10px; align-items: center; }

/* ============================================================
   LOBBY — backplate panel-duel-large + cartes rouge/cyan du kit
   ============================================================ */
.lobby-sub { color: var(--ink); letter-spacing: .35em; font-weight: 800; font-size: 15px; text-transform: uppercase; }
.lobby-panel {
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  background: url('assets/ui-kit-v2/panels/panel-duel-large.webp') center / 100% 100% no-repeat;
  background-color: transparent;
  padding: 74px 88px 66px; /* marge genereuse : les ornements du cadre (couronnes haut/bas) ne touchent plus les textes */
}
.lobby-head { text-align: center; }
.room-code { font-size: 50px; font-weight: 900; letter-spacing: .18em; color: var(--ink); margin: 4px 0; font-style: italic; }
.players-row { display: flex; align-items: center; gap: 26px; }
.player-card {
  width: 216px; min-height: 158px;
  padding: 24px 20px; text-align: center; display: flex; flex-direction: column; justify-content: center; gap: 8px;
  background: center / 100% 100% no-repeat;
}
.player-card.p-red { background-image: url('assets/ui-kit-v2/panels/panel-card-red.webp'); }
.player-card.p-cyan { background-image: url('assets/ui-kit-v2/panels/panel-card-cyan.webp'); }
.player-card.ready { filter: drop-shadow(0 0 12px rgba(246,199,68,.55)); }
.player-tag { font-size: 10px; letter-spacing: .22em; font-weight: 800; }
.p-red .player-tag { color: var(--red); }
.p-cyan .player-tag { color: var(--cyan); }
.player-name { font-size: 19px; font-weight: 800; }
.player-state { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.player-state.on { color: var(--gold); }
.rules-reminder { color: var(--muted); font-size: 12px; text-align: center; max-width: 420px; }

/* VS dans un emblème du kit (texte HTML au centre) */
.vs, .rr-vs {
  font-size: 22px; font-weight: 900; font-style: italic; color: var(--ink);
  text-shadow: 2px 2px 0 rgba(0,0,0,.8);
}
.vs-framed {
  width: 86px; height: 90px; display: flex; align-items: center; justify-content: center;
  background: url('assets/ui-kit-v2/panels/emblem-vs-frame.webp') center / contain no-repeat;
}

/* ============================================================
   PRE-ROUND : VS -> annonce des lettres -> memorisation -> 3/2/1
   (assets/pre-round-v1 ; textes en HTML ; timer demarre au GO)
   ============================================================ */
#screen-preround {
  justify-content: center; gap: 24px;
  background: url('assets/pre-round-v1/pre-round-background-v1.webp') center / cover no-repeat;
}
#app[data-screen="screen-preround"] .keyart { opacity: 0; }

.pr-round-label { font-size: 14px; letter-spacing: .3em; color: var(--muted); font-weight: 800; text-transform: uppercase; }

.pr-vs-row {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px;
  width: 100%; max-width: 940px;
}
.pr-name { font-size: 24px; font-weight: 900; font-style: italic; text-shadow: 0 2px 6px rgba(0,0,0,.9); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-name.me { color: var(--red); text-align: right; }
.pr-name.op { color: var(--cyan); }
.pr-vs {
  width: min(360px, 46vw); aspect-ratio: 1646 / 743;
  background: url('assets/pre-round-v1/vs-impact-v1.webp') center / contain no-repeat;
  display: flex; align-items: center; justify-content: center;
  animation: vsimpact .4s cubic-bezier(.2,.9,.3,1.25) both;
}
.pr-vs-text { font-size: clamp(40px, 6vw, 62px); font-weight: 900; font-style: italic; color: var(--ink); text-shadow: 0 3px 8px rgba(0,0,0,.9); }
@keyframes vsimpact { 0% { opacity: 0; transform: scale(1.6); } 100% { opacity: 1; transform: scale(1); } }

.pr-letters { display: grid; grid-template-columns: repeat(5, minmax(60px, 84px)); gap: 12px; }
.pr-tile {
  position: relative; aspect-ratio: 1177 / 1141;
  background: url('assets/pre-round-v1/letter-tile-frame-v1.webp') center / contain no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(24px, 4vw, 36px); font-weight: 900; color: var(--ink);
  text-shadow: 0 2px 5px rgba(0,0,0,.9);
  opacity: 0;
}
.pr-tile.show { opacity: 1; } /* reveal instantane (prefers-reduced-motion) */
.pr-tile.in { animation: tiledrop .34s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes tiledrop {
  0% { opacity: 0; transform: translateY(-70px) scale(1.3); }
  60% { opacity: 1; transform: translateY(4px) scale(.97); }
  100% { opacity: 1; transform: none; }
}
/* Trainee de chute pendant l'arrivee de la lettre */
.pr-tile.in::after {
  content: ''; position: absolute; left: -20%; right: -20%; top: -55%; bottom: -10%;
  background: url('assets/pre-round-v1/letter-drop-trail-v1.webp') center / contain no-repeat;
  pointer-events: none;
  animation: trailfade .42s ease-out both;
}
@keyframes trailfade { 0% { opacity: .95; transform: translateY(-22%); } 100% { opacity: 0; transform: translateY(8%); } }

/* Countdown 3/2/1 : COMPACT, ancre en BAS de l'ecran (hors de la grille) pour
   que les 10 lettres restent 100% visibles et memorisables (preshot). */
.pr-count {
  position: absolute; left: 0; right: 0; bottom: 6%; z-index: 5;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
}
.pr-burst {
  width: min(340px, 50vw); aspect-ratio: 1247 / 1200;
  background: url('assets/pre-round-v1/countdown-burst-v1.webp') center / contain no-repeat;
  display: flex; align-items: center; justify-content: center;
}
/* Version reduite du burst/chiffre pour le decompte (le GO plein ecran garde
   sa grande taille via .go-flash .pr-burst). */
.pr-count .pr-burst { width: min(148px, 34vw); }
.pr-count-num {
  font-size: clamp(46px, 8vw, 68px); font-weight: 900; font-style: italic; color: var(--ink);
  text-shadow: 0 4px 14px rgba(0,0,0,.95); animation: pop .45s ease;
}

/* Flash GO au demarrage reel du timer (ecran de manche) */
.go-flash { position: fixed; inset: 0; z-index: 9; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.go-text { font-size: clamp(80px, 12vw, 120px); font-weight: 900; font-style: italic; color: var(--gold); text-shadow: 0 0 34px rgba(246,199,68,.6), 0 4px 12px rgba(0,0,0,.95); }
.go-flash.play .pr-burst { animation: gopop .6s ease both; }
@keyframes gopop {
  0% { opacity: 0; transform: scale(.5); }
  22% { opacity: 1; transform: scale(1.06); }
  70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.18); }
}

/* ============================================================
   COUNTDOWN (mort subite uniquement)
   ============================================================ */
#screen-countdown { gap: 8px; }
.countdown-round { font-size: 22px; font-weight: 800; letter-spacing: .1em; }
.countdown-score { font-size: 16px; color: var(--muted); letter-spacing: .2em; }
.countdown-number {
  font-size: clamp(120px, 26vw, 240px); font-weight: 900; font-style: italic; color: var(--red);
  line-height: 1; transform: skewX(-7deg); animation: pop .5s ease;
  text-shadow: 0 0 40px rgba(255,31,61,.35);
}
.countdown-hint { color: var(--dim); letter-spacing: .2em; font-size: 12px; text-transform: uppercase; }
@keyframes pop { from { transform: skewX(-7deg) scale(.4); opacity: 0; } to { transform: skewX(-7deg) scale(1); opacity: 1; } }

/* ============================================================
   MANCHE ACTIVE — sobre ; coins slash discrets en peripherie
   ============================================================ */
#screen-round { justify-content: flex-start; gap: 16px; padding-top: 18px; }
/* Coins slash en z-index NEGATIF : sous le contenu de l'ecran, au-dessus du
   keyart. Surtout PAS de regle "#screen-round > * { position: relative }" :
   elle ecraserait le position:fixed des overlays (Abandonner, GO, time-drain,
   toast rush, attaque) a cause de la specificite de l'id. */
#screen-round::before, #screen-round::after {
  content: ''; position: fixed; bottom: 0; width: 300px; height: 170px;
  pointer-events: none; z-index: -1; opacity: .35;
  background: center / contain no-repeat;
}
#screen-round::before { left: 0; background-image: url('assets/ui-kit-v2/panels/corner-slash-red.webp'); background-position: left bottom; }
#screen-round::after { right: 0; background-image: url('assets/ui-kit-v2/panels/corner-slash-cyan.webp'); background-position: right bottom; }

/* Barre de temps qui draine */
.time-drain { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: #000; z-index: 6; }
.time-drain-fill { height: 100%; width: 100%; transform-origin: left center; background: linear-gradient(90deg, var(--cyan), #0aa9b8); }
.time-drain-fill.low { background: linear-gradient(90deg, var(--red), var(--red-deep)); }

/* HUD : panneau unique borde, timer en trapeze central */
.round-hud {
  width: 100%; max-width: 1080px;
  display: grid; grid-template-columns: auto 1fr auto 1fr; align-items: center; gap: 20px;
  background: rgba(10,11,16,.78); border: 1px solid var(--line);
  padding: 10px 18px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 12px));
}
.hud-logo { line-height: 1; }
.hud-jp { margin-top: 6px; font-size: 10px; letter-spacing: .18em; color: var(--muted); }

.hud-prog { display: flex; flex-direction: column; gap: 6px; }
.hud-prog.self { align-items: flex-end; }
.hud-prog.opp { align-items: flex-start; }
.prog-head { display: flex; align-items: center; gap: 10px; }
.prog-crown {
  width: 22px; height: 18px; display: inline-block;
  background: url('assets/ui-kit-v2/banners/emblem-crown-red.webp') center / contain no-repeat;
}
.prog-label { font-size: 12px; letter-spacing: .16em; font-weight: 800; }
.self .prog-label { color: var(--red); }
.opp .prog-label { color: var(--cyan); }
.prog-count { font-weight: 900; font-size: 15px; }
.prog-count b { font-size: 28px; font-style: italic; }
.prog-count i { color: var(--muted); font-style: normal; font-size: 14px; }
.self .prog-count b { color: var(--red); }
.opp .prog-count b { color: var(--cyan); }

.chevrons {
  display: flex; gap: 3px; width: 100%; max-width: 340px;
  background: rgba(0,0,0,.45); border: 1px solid var(--line); padding: 5px 7px;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%);
}
.opp .chevrons { clip-path: polygon(9px 0, 100% 0, 100% 100%, 9px 100%, 0 50%); }
.chev-seg {
  flex: 1; height: 13px; background: #23262f;
  clip-path: polygon(0 0, 78% 0, 100% 50%, 78% 100%, 0 100%, 22% 50%);
  transition: background .12s ease;
}
.self .chev-seg.on { background: var(--red); box-shadow: 0 0 8px rgba(255,31,61,.5); }
.opp .chev-seg.on { background: var(--cyan); box-shadow: 0 0 8px rgba(19,223,242,.5); }

.hud-center {
  position: relative; text-align: center; padding: 6px 44px 12px;
  background: #0c0d13; border: 1px solid var(--line); border-top: none;
  clip-path: polygon(0 0, 100% 0, 86% 100%, 14% 100%);
  margin-bottom: -22px; align-self: start;
}
.hud-center::before, .hud-center::after {
  content: ''; position: absolute; top: 10px; width: 14px; height: 52px;
}
.hud-center::before {
  left: 12px;
  background: repeating-linear-gradient(180deg, var(--red) 0 10px, transparent 10px 16px);
  clip-path: polygon(0 0, 100% 8%, 100% 92%, 0 100%);
}
.hud-center::after {
  right: 12px;
  background: repeating-linear-gradient(180deg, var(--cyan) 0 10px, transparent 10px 16px);
  clip-path: polygon(100% 0, 0 8%, 0 92%, 100% 100%);
}
.hud-bo3-label { font-size: 10px; letter-spacing: .3em; color: var(--muted); font-weight: 800; }
.timer {
  font-size: clamp(44px, 6vw, 64px); font-weight: 900; line-height: 1; color: var(--ink);
  font-variant-numeric: tabular-nums; letter-spacing: .01em;
}
/* Dernieres secondes : pulse FLUIDE (ease) — plus le steps() saccade */
.timer.low {
  color: var(--red);
  animation: lowpulse 1s ease-in-out infinite;
  text-shadow: 0 0 22px rgba(255,31,61,.45);
}
@keyframes lowpulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .55; transform: scale(1.045); }
}
@keyframes blink { 50% { opacity: .5; } } /* conserve pour .forfeit.armed */
.hud-bo3-dots { display: flex; gap: 6px; justify-content: center; margin-top: 4px; }
.bo3-dot { width: 9px; height: 9px; border-radius: 50%; background: #2a2d36; border: 1px solid #3a3d47; }
.bo3-dot.win-me { background: var(--red); border-color: var(--red); box-shadow: 0 0 6px rgba(255,31,61,.5); }
.bo3-dot.win-opp { background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 6px rgba(19,223,242,.5); }
.bo3-dot.draw { background: var(--gold); border-color: var(--gold); }

/* Grille : UNE colonne large, champ = zone la plus lisible (AUCUN asset dessous) */
.grid { width: 100%; max-width: 1080px; display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
/* Colonne 2 = lettre bonus conditionnelle (chip invisible sinon, pour
   conserver l'alignement vertical des champs). position:relative -> ancre le
   badge ×2 (qui doit sortir de la tuile rognee par son clip-path). */
.slot { position: relative; display: grid; grid-template-columns: 58px 96px 22px 1fr 138px; align-items: center; gap: 10px; }

.tile {
  width: 58px; height: 58px; display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 900; color: var(--ink);
  background: linear-gradient(180deg, #22252f, #171a22);
  border: 1px solid #4a4e5a;
  clip-path: polygon(0 0, 100% 0, 100% 80%, 84% 100%, 0 100%);
  transition: border-color .12s ease, color .12s ease;
}
.chev { text-align: center; color: var(--dim); font-size: 16px; transition: color .12s ease; }

.field {
  position: relative; display: grid; grid-template-columns: 1fr 44px; align-items: center;
  background: rgba(20,22,29,.92); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.field input {
  border: none; outline: none; background: transparent; color: var(--ink);
  font-size: 18px; font-weight: 600; width: 100%; padding: 14px 14px;
}
.field input::placeholder { color: #494d57; font-weight: 500; }
.field .status {
  width: 28px; height: 28px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 900; border-radius: 5px;
  border: 1px solid transparent;
}
.slot.validated .field .status { border-color: var(--ok); background: rgba(88,217,111,.10); }
.slot.error .field .status { border-color: var(--red); background: rgba(255,31,61,.10); }

.action {
  border: 1px solid var(--line); background: rgba(20,22,29,.92); color: var(--muted);
  font-weight: 800; letter-spacing: .05em; text-transform: uppercase; font-size: 13px;
  padding: 13px 10px; cursor: pointer; white-space: nowrap;
  clip-path: polygon(0 0, 100% 0, 100% 74%, 90% 100%, 0 100%);
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.action:hover { border-color: var(--cyan); color: var(--cyan); }

.slot.active .tile { border-color: var(--cyan); color: var(--cyan); }
.slot.active .chev { color: var(--cyan); }
.slot.active .field { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan) inset, 0 0 20px rgba(19,223,242,.14); }
.slot.active .action { background: var(--cyan); border-color: var(--cyan); color: #04252a; }

.slot.validating .field { border-color: var(--cyan); }
.slot.validating .action { opacity: .55; }

.slot.validated .field { border-color: rgba(88,217,111,.55); background: rgba(14,23,18,.92); }
.slot.validated input { color: var(--ok); font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }
.slot.validated .status { color: var(--ok); }
.slot.validated .action { background: rgba(20,22,29,.92); border-color: var(--line); color: var(--muted); cursor: default; }
/* Cadenas en SVG inline (mask -> herite de currentColor). Aucun emoji. */
.slot.validated .action::before {
  content: ''; display: inline-block; width: 12px; height: 13px; margin-right: 7px;
  vertical-align: -1px; background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a5 5 0 0 0-5 5v3H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2h-1V7a5 5 0 0 0-5-5zm-3 8V7a3 3 0 0 1 6 0v3H9z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a5 5 0 0 0-5 5v3H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2h-1V7a5 5 0 0 0-5-5zm-3 8V7a3 3 0 0 1 6 0v3H9z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.slot.error .field { border-color: var(--red); }
.slot.error .status { color: var(--red); }
.slot.error .action { background: var(--red); border-color: var(--red); color: #fff; }

.slot.expired { opacity: .4; }
.slot.rejected { animation: shake .18s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 30%{transform:translateX(-4px)} 70%{transform:translateX(4px)} }

.round-hint { color: var(--dim); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }

/* Toast RUSH : -30 s quand une grille est completee */
.rush-note {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 7; padding: 10px 22px;
  background: rgba(10,11,16,.95); border: 1px solid var(--red); color: var(--red);
  font-weight: 900; font-size: 14px; letter-spacing: .1em; text-transform: uppercase;
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%);
  animation: rushin .18s ease;
}
.rush-note.mine { border-color: var(--gold); color: var(--gold); }
@keyframes rushin { from { transform: translateX(-50%) scale(1.3); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

/* ---- Animation "attaque subie" (rush -30s, cote victime) ---- */
.atk { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
.atk-flash {
  position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(255,31,61,.22) 0%, rgba(168,15,43,.42) 100%);
}
.atk.play .atk-flash { animation: atkflash .55s ease-out both; }
@keyframes atkflash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }

.atk-slash {
  position: absolute; left: -30%; width: 160%; height: 3px; opacity: 0;
  background: linear-gradient(90deg, transparent, #ff5c73 28%, #fff 50%, var(--red) 72%, transparent);
  box-shadow: 0 0 18px rgba(255,31,61,.85);
  transform: rotate(var(--r, -18deg));
}
.atk-slash.s1 { top: 36%; --r: -18deg; }
.atk-slash.s2 { top: 50%; --r: -23deg; height: 4px; }
.atk-slash.s3 { top: 63%; --r: -14deg; }
.atk.play .atk-slash { animation: atkslash .38s ease-out both; }
.atk.play .s2 { animation-delay: .07s; }
.atk.play .s3 { animation-delay: .14s; }
@keyframes atkslash {
  0% { opacity: 0; transform: translateX(-14%) rotate(var(--r, -18deg)) scaleX(.5); }
  22% { opacity: 1; }
  100% { opacity: 0; transform: translateX(14%) rotate(var(--r, -18deg)) scaleX(1.05); }
}

.atk-dmg {
  position: absolute; top: 120px; left: 50%; transform: translateX(-50%);
  font-size: 48px; font-weight: 900; font-style: italic; color: var(--red);
  text-shadow: 0 0 20px rgba(255,31,61,.75), 0 3px 5px rgba(0,0,0,.9);
  opacity: 0; white-space: nowrap;
}
.atk.play .atk-dmg { animation: atkdmg 1s ease-out both; }
@keyframes atkdmg {
  0% { opacity: 0; transform: translateX(-50%) scale(2.1); }
  16% { opacity: 1; transform: translateX(-50%) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-28px); }
}

/* Secousse de l'ecran a l'impact (n'affecte pas le focus/la saisie) */
#screen-round.shake { animation: atkshake .4s ease-out; }
@keyframes atkshake {
  0%, 100% { transform: none; }
  15% { transform: translate(-6px, 3px); }
  30% { transform: translate(5px, -4px); }
  45% { transform: translate(-4px, 2px); }
  60% { transform: translate(3px, -2px); }
  75% { transform: translate(-2px, 1px); }
}

/* Bouton abandonner : rouge, bien visible, confirmation au 2e clic */
.forfeit {
  position: fixed; bottom: 16px; right: 18px; z-index: 5;
  appearance: none; cursor: pointer;
  background: rgba(168,15,43,.22); border: 1px solid var(--red-deep); color: var(--red);
  font-size: 12px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase;
  padding: 11px 20px;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 92% 100%, 0 100%);
  transition: color .12s ease, border-color .12s ease, background .12s ease;
}
.forfeit:hover { color: #fff; background: rgba(168,15,43,.5); border-color: var(--red); }
.forfeit.armed { color: #fff; background: var(--red-deep); border-color: var(--red); animation: blink 1s steps(2) infinite; }

/* Impact rush sur le timer : blink rouge + punch */
.timer.hit { color: var(--red) !important; animation: timerhit .9s ease-out; }
@keyframes timerhit {
  0% { opacity: 1; transform: scale(1.22); }
  15% { opacity: .15; }
  30% { opacity: 1; }
  45% { opacity: .15; }
  60% { opacity: 1; transform: scale(1); }
  100% { opacity: 1; }
}

/* ============================================================
   RESULTAT DE MANCHE — backplates du kit derriere les titres
   ============================================================ */
#screen-round-result { justify-content: flex-start; padding-top: 24px; gap: 16px; }
.rr-banner { text-align: center; }
.rr-title {
  font-size: clamp(30px, 4.6vw, 46px); font-weight: 900; font-style: italic; margin: 0;
  animation: slamin .26s cubic-bezier(.2,.9,.3,1.2);
  background: center / 100% 100% no-repeat;
  padding: 34px 130px 40px;
  line-height: 1;
}
/* Win : backplate or (couronne + lauriers integres) */
.rr-title.win {
  background-image: url('assets/ui-kit-v2/banners/title-backplate-gold-large.webp');
  color: var(--gold);
  text-shadow: 0 2px 6px rgba(0,0,0,.9), 0 0 30px rgba(246,199,68,.3);
}
/* Lose / nulle : backplate duel rouge-cyan */
.rr-title.lose {
  background-image: url('assets/ui-kit-v2/banners/title-backplate-duel-red-cyan.webp');
  color: var(--ink);
  text-shadow: 0 2px 6px rgba(0,0,0,.9);
  padding: 26px 120px 30px;
}
.rr-title.draw {
  background-image: url('assets/ui-kit-v2/banners/title-backplate-duel-red-cyan.webp');
  color: var(--gold);
  text-shadow: 0 2px 6px rgba(0,0,0,.9);
  padding: 26px 120px 30px;
}
.rr-reason { color: var(--muted); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; margin-top: 6px; }
@keyframes slamin { from { transform: scale(1.25); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.rr-versus { display: flex; align-items: center; gap: 22px; }
/* Score cards sur les panneaux du kit (rouge = toi, cyan = adversaire) */
.rr-side {
  min-width: 220px; min-height: 156px; text-align: center;
  padding: 26px 24px 20px;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  background: center / 100% 100% no-repeat;
}
.rr-side.me { background-image: url('assets/ui-kit-v2/panels/panel-card-red.webp'); }
.rr-side.op { background-image: url('assets/ui-kit-v2/panels/panel-card-cyan.webp'); }
.rr-side.winner { filter: drop-shadow(0 0 14px rgba(246,199,68,.55)); }
.rr-side.loser { opacity: .9; }
.rr-pname { font-size: 14px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.rr-side.me .rr-pname { color: var(--red); }
.rr-side.op .rr-pname { color: var(--cyan); }
.rr-total { font-size: 46px; font-weight: 900; font-style: italic; font-variant-numeric: tabular-nums; line-height: 1.1; }
.rr-bonus { font-size: 13px; font-weight: 700; color: var(--gold); min-height: 18px; }
.rr-bonus.none { color: var(--dim); }

/* Anime rare : REWARD CARD doree (panel-highlight-gold du kit) */
.rr-rare {
  background: url('assets/ui-kit-v2/panels/panel-highlight-gold.webp') center / 100% 100% no-repeat;
  min-width: 360px; padding: 16px 72px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-align: center;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,.5));
}
.rw-label {
  font-size: 10px; letter-spacing: .32em; text-transform: uppercase;
  color: var(--gold); font-weight: 800; opacity: .85;
}
.rw-body { display: flex; align-items: center; gap: 10px; max-width: 100%; }
.rw-title {
  font-size: 19px; font-weight: 900; font-style: italic; color: var(--ink);
  text-shadow: 0 2px 4px rgba(0,0,0,.8);
  max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rw-meta { font-size: 12px; font-weight: 800; letter-spacing: .08em; }

/* Echelle de rarete sur les POINTS — ecrans de resultat uniquement.
   Escalade monochrome or (conforme DA : pas d'arc-en-ciel). */
.pts-popular { color: var(--muted); }
.pts-known { color: var(--ink); }
.pts-rare { color: #e9d585; }
.pts-epic { color: var(--gold); }
.pts-legendary { color: var(--gold); text-shadow: 0 0 10px rgba(246,199,68,.65); }

/* Tableau comparatif "duel" : moitie TOI teintee rouge / moitie ADV teintee
   cyan, chips de lettres, headers colores — plus une table web. */
.result-table {
  width: 100%; max-width: 800px; background: rgba(8,9,13,.92); border: 1px solid var(--line);
  overflow: hidden;
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 16px, 100% calc(100% - 16px), calc(100% - 16px) 100%, 16px 100%, 0 calc(100% - 16px), 0 16px);
  background-image: url('assets/texture-grunge.png');
  background-blend-mode: overlay;
}
.rt-row { display: grid; grid-template-columns: 56px 1fr 58px 1fr 58px; align-items: center; font-size: 14px; }
.rt-row:not(.head) {
  border-top: 1px solid rgba(48,50,59,.45);
  background: linear-gradient(90deg, rgba(255,31,61,.055) 0 52%, rgba(19,223,242,.055) 52% 100%);
}
.rt-row.head {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  background: #0b0c11; border-bottom: 1px solid var(--line);
}
.rt-row.head > div { padding: 10px; color: var(--muted); }
.rt-h-me { color: var(--red) !important; font-weight: 900; }
.rt-h-op { color: var(--cyan) !important; font-weight: 900; }
.rt-row.reveal { animation: rowin .18s ease both; }
@keyframes rowin { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.rt-row > div { padding: 7px 10px; }
.rt-letter { display: flex; align-items: center; justify-content: center; padding: 5px !important; }
.rt-chip {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 15px; color: var(--ink);
  background: linear-gradient(180deg, #22252f, #14161d);
  border: 1px solid #4a4e5a;
  clip-path: polygon(0 0, 100% 0, 100% 78%, 78% 100%, 0 100%);
}
.rt-pts { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.rt-name { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-miss { color: var(--dim); font-style: italic; }
.rt-rare { color: var(--gold); }
.badge-rare {
  display: inline-block; margin-left: 8px; padding: 1px 7px;
  border: 1px solid var(--gold); color: var(--gold);
  font-size: 10px; font-weight: 900; letter-spacing: .12em;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  vertical-align: middle;
}
.result-bo3 { font-size: 18px; font-weight: 800; letter-spacing: .1em; }

/* ============================================================
   RESULTAT DE MATCH
   ============================================================ */
#screen-match-result { gap: 12px; }
.match-title {
  font-size: clamp(34px, 5.4vw, 58px); font-weight: 900; font-style: italic; margin: 0;
  animation: slamin .3s ease;
  background: center / 100% 100% no-repeat;
  padding: 40px 150px 48px;
  line-height: 1;
}
.match-title.win {
  background-image: url('assets/ui-kit-v2/banners/title-backplate-gold-large.webp');
  color: var(--gold);
  text-shadow: 0 2px 6px rgba(0,0,0,.9), 0 0 40px rgba(246,199,68,.35);
}
.match-title.lose {
  background-image: url('assets/ui-kit-v2/banners/title-backplate-duel-red-cyan.webp');
  color: var(--ink);
  text-shadow: 0 2px 6px rgba(0,0,0,.9);
  padding: 30px 140px 36px;
}
.match-jp { font-size: 17px; letter-spacing: .6em; color: var(--muted); margin-top: -8px; }
.match-sub { color: var(--muted); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; }
.match-score { font-size: 52px; font-weight: 900; font-style: italic; }
.match-score .ms-me { color: var(--red); }
.match-score .ms-sep { color: var(--muted); font-size: 38px; padding: 0 10px; }
.match-score .ms-op { color: var(--cyan); }

.scoreboard {
  width: 100%; max-width: 720px; background: rgba(8,9,13,.92); border: 1px solid var(--line);
  overflow: hidden;
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 16px, 100% calc(100% - 16px), calc(100% - 16px) 100%, 16px 100%, 0 calc(100% - 16px), 0 16px);
  background-image: url('assets/texture-grunge.png'); background-blend-mode: overlay;
}
.sb-row { display: grid; grid-template-columns: 1.3fr 70px 70px 80px 1.5fr; align-items: center; border-top: 1px solid rgba(48,50,59,.45); font-size: 14px; }
.sb-row.sb-me { box-shadow: inset 4px 0 0 var(--red); }
.sb-row.sb-op { box-shadow: inset 4px 0 0 var(--cyan); }
.sb-row.head { border-top: none; background: #0b0c11; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.sb-row > div { padding: 12px; }
.sb-row.winner { background: linear-gradient(90deg, rgba(246,199,68,.14), rgba(246,199,68,0)); }
.sb-row.winner .sb-name { color: var(--gold); }
.sb-name { font-weight: 800; display: flex; align-items: center; }
.sb-num { text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.sb-pts { text-align: center; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--ink); }
.sb-rare { color: var(--gold); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-crown {
  width: 20px; height: 16px; margin-right: 8px; flex: none;
  background: url('assets/ui-kit-v2/banners/emblem-crown-gold.webp') center / contain no-repeat;
}

.match-rounds { display: flex; gap: 10px; }
.mr-pill {
  border: 1px solid var(--line); background: rgba(20,22,29,.9);
  padding: 7px 16px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%);
}
.mr-pill.p-win { border-color: var(--red); color: var(--red); }
.mr-pill.p-lose { border-color: var(--cyan); color: var(--cyan); }
.mr-pill.p-draw { border-color: var(--gold); color: var(--gold); }

/* ============ RESPONSIVE ============ */
@media (max-width: 820px) {
  .round-hud { grid-template-columns: 1fr 1fr; gap: 12px; }
  .hud-logo { grid-column: 1 / -1; text-align: center; }
  .logo-hud { margin: 0 auto; }
  .hud-center { grid-column: 1 / -1; order: -1; margin-bottom: 0; }
  .hud-prog.self { align-items: flex-start; }
  .slot { grid-template-columns: 48px 64px 1fr 108px; }
  .slot .chev { display: none; }
  .cond-tag { min-height: 40px; padding: 3px 6px; }
  .cond-label { display: none; } /* mobile : le gain reste, la condition en tooltip */
  .tile { width: 48px; height: 48px; font-size: 24px; }
  .players-row { flex-direction: column; gap: 12px; }
  .lobby-panel { padding: 34px 22px; background-size: cover; }
  .rr-versus { gap: 12px; }
  .rr-side { min-width: 130px; padding: 12px; }
  .rr-title, .rr-title.lose, .rr-title.draw { padding: 22px 40px 26px; background-size: cover; }
  .match-title, .match-title.lose { padding: 24px 40px 30px; background-size: cover; }
  .rt-row { grid-template-columns: 30px 1fr 46px; }
  .rt-row .rt-p2-name, .rt-row .rt-p2-pts { display: none; }
  .sb-row { grid-template-columns: 1.2fr 60px 74px; }
  .sb-found, .sb-rare { display: none; }
  #screen-round::before, #screen-round::after { display: none; }
}

/* ============ ACCESSIBILITE ============ */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
