/* Chat (chat.js), ecran de match coupe en deux (arena.js) et ecran de fin de match.
   Les reglages telephone (html.mobile) sont dans style.css. */

/* ===================== CHAT ===================== */
.app-shell { flex: 1; min-height: 0; display: flex; position: relative; }
.app-shell > main#app { flex: 1; min-width: 0; }
.chat-dock {
  display: none;
  position: relative;
  width: 300px;
  flex-shrink: 0;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(12,15,17,0.86), rgba(8,10,12,0.9));
  backdrop-filter: blur(8px);
  z-index: 20;
}
body.chat-on .chat-dock { display: flex; animation: chatDockIn 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
body.chat-on.chat-collapsed .chat-dock { display: none; }
@keyframes chatDockIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 14px 12px 8px; }
.chat-tabs {
  flex: 1; min-width: 0; display: flex; gap: 3px; padding: 3px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 11px;
}
.chat-tab {
  flex: 1; min-width: 0; position: relative; border: 0; background: transparent; cursor: pointer;
  color: var(--text-dim); font: 700 12.5px 'Space Grotesk', sans-serif; padding: 7px 6px; border-radius: 8px;
  white-space: nowrap; transition: background 0.15s ease, color 0.15s ease;
}
.chat-tab[hidden] { display: none; }
.chat-tab:hover { color: var(--text); }
.chat-tab.active { background: rgba(23,184,209,0.15); color: var(--text); box-shadow: inset 0 0 0 1px rgba(23,184,209,0.4); }
.chat-tab[data-chat-tab="traders"].active { background: rgba(255,209,102,0.12); box-shadow: inset 0 0 0 1px rgba(255,209,102,0.4); }
.chat-tab[data-chat-tab="match"].active { background: rgba(255,77,109,0.13); box-shadow: inset 0 0 0 1px rgba(255,77,109,0.4); }
.chat-dock.single .chat-tab { cursor: default; text-align: left; padding-left: 10px; letter-spacing: 0.3px; }
.chat-unread {
  position: absolute; top: -6px; right: -2px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--red); color: #fff; font: 800 10px/17px 'Space Grotesk', sans-serif;
  box-shadow: 0 0 0 2px #0b0d0f;
}
.chat-unread[hidden] { display: none; }
.chat-collapse {
  flex-shrink: 0; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer;
  border-radius: 9px; border: 1px solid var(--border); background: transparent; color: var(--text-dim);
}
.chat-collapse:hover { color: var(--text); border-color: var(--green); }
.chat-collapse svg { width: 16px; height: 16px; }
.chat-sub { margin: 0 14px 4px; font-size: 11px; color: var(--text-dim); letter-spacing: 0.2px; min-height: 14px; }
.chat-list {
  flex: 1; min-height: 0; overflow-y: auto; padding: 6px 8px 10px; display: flex; flex-direction: column;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.chat-list::-webkit-scrollbar { width: 6px; }
.chat-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
.chat-msg { position: relative; display: flex; flex-wrap: wrap; column-gap: 9px; row-gap: 3px; padding: 7px 6px 3px; border-radius: 10px; }
.chat-msg.fresh { animation: chatIn 0.22s ease; }
.chat-msg.cont { padding-top: 0; }
.chat-msg.cont .chat-av { visibility: hidden; height: 0; }
.chat-msg.cont .chat-meta { display: none; }
.chat-msg.act { background: rgba(255,255,255,0.03); }
@media (hover: hover) { html:not(.mobile) .chat-msg:hover { background: rgba(255,255,255,0.03); } }
@keyframes chatIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* Quelqu'un te repond (jaune) ; message auquel tu es en train de repondre (cyan). */
.chat-msg.ping { background: rgba(255,209,102,0.07); box-shadow: inset 2px 0 0 #ffd166; border-radius: 0 10px 10px 0; }
.chat-msg.replying { background: rgba(23,184,209,0.09); box-shadow: inset 2px 0 0 var(--green); border-radius: 0 10px 10px 0; }
.chat-msg.flash { animation: chatFlash 1.6s ease; }
@keyframes chatFlash { 0%, 35% { background: rgba(23,184,209,0.22); } 100% { background: transparent; } }
.chat-top { margin: 2px auto 10px; padding: 0 10px; text-align: center; font-size: 11px; color: var(--text-dim); opacity: 0.75; }

/* Message cite au-dessus d'une reponse, relie a la photo par un trait (Discord). */
.chat-quote {
  position: relative; flex: 0 0 calc(100% - 37px); margin-left: 37px; min-width: 0;
  display: flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none; cursor: pointer;
  font: 500 12px 'Space Grotesk', sans-serif; color: var(--text-dim); text-align: left;
}
.chat-quote::before {
  content: ''; position: absolute; left: -23px; top: 50%; width: 18px; height: calc(50% + 4px);
  border: 2px solid rgba(138,149,152,0.45); border-right: 0; border-bottom: 0; border-top-left-radius: 7px;
}
.chat-quote-av { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--bg-card); }
.chat-quote-name { flex-shrink: 0; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: #63ddef; }
.chat-quote-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.85; }
.chat-quote:hover .chat-quote-text { color: var(--text); opacity: 1; }

/* Boutons « Repondre » et « Supprimer » (ses messages) : au survol
   (ordinateur), en touchant le message (telephone). */
.chat-actions {
  position: absolute; top: 4px; right: 4px; z-index: 1; display: flex; gap: 4px;
  opacity: 0; visibility: hidden; transition: opacity 0.12s ease, visibility 0.12s;
}
.chat-reply-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 7px; border-radius: 8px; border: 1px solid var(--border); background: #12171b; cursor: pointer;
  color: var(--text-dim); font: 700 11.5px 'Space Grotesk', sans-serif;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.chat-reply-btn svg { width: 14px; height: 14px; }
.chat-reply-btn span { display: none; }
.chat-msg.act .chat-actions, .chat-actions:focus-within { opacity: 1; visibility: visible; }
@media (hover: hover) { html:not(.mobile) .chat-msg:hover .chat-actions { opacity: 1; visibility: visible; } }
.chat-reply-btn:hover { color: var(--text); border-color: var(--green); }
.chat-del-btn:hover { color: var(--red); border-color: var(--red); }
.chat-quote-text.deleted { font-style: italic; opacity: 0.6; }
@media (hover: hover) { html:not(.mobile) .chat-msg:hover .chat-time { visibility: hidden; } }

/* Barre « Reponse a @pseudo » au-dessus du champ de texte. */
.chat-replybar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 6px 12px 0; padding: 6px 7px 6px 12px; border-radius: 10px 10px 0 0;
  background: rgba(23,184,209,0.08); border: 1px solid rgba(23,184,209,0.3); border-bottom: 0;
  font-size: 12px; color: var(--text-dim);
}
.chat-replybar-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-replybar-text b { color: var(--text); }
.chat-replybar + .chat-form { border-top-color: transparent; padding-top: 0; }
.chat-replybar.hidden + .chat-form { border-top-color: var(--border); padding-top: 10px; }
.chat-replybar-x {
  flex-shrink: 0; width: 22px; height: 22px; display: grid; place-items: center; cursor: pointer;
  border: 0; border-radius: 50%; background: rgba(255,255,255,0.08); color: var(--text-dim);
}
.chat-replybar-x:hover { color: var(--text); background: rgba(255,255,255,0.14); }
.chat-replybar-x svg { width: 12px; height: 12px; }
.chat-av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--bg-card); }
.chat-body { flex: 1; min-width: 0; }
.chat-meta { display: flex; align-items: baseline; gap: 6px; margin-bottom: 1px; }
.chat-name { font-weight: 700; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.chat-msg.chat-a .chat-name { color: #63ddef; }
.chat-msg.chat-b .chat-name { color: #ff8197; }
.chat-msg.me .chat-name::after {
  content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; margin-left: 5px; vertical-align: middle; opacity: 0.7;
}
.chat-role {
  font: 800 9px 'Space Grotesk', sans-serif; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--text-dim); border: 1px solid var(--border); border-radius: 4px; padding: 1px 4px;
}
.chat-time { margin-left: auto; font: 400 10px var(--font-mono); color: rgba(138,149,152,0.65); flex-shrink: 0; }
.chat-text { font-size: 13.5px; line-height: 1.4; color: #d5dee0; overflow-wrap: anywhere; }
.chat-msg.me .chat-text { color: #fff; }
.chat-empty { margin: auto; padding: 24px 18px; text-align: center; color: var(--text-dim); font-size: 13px; line-height: 1.5; }
.chat-new {
  position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%); z-index: 2;
  border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer;
  background: var(--green); color: #031417; font: 700 12px 'Space Grotesk', sans-serif;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}
.chat-form { display: flex; gap: 8px; padding: 10px 12px 14px; border-top: 1px solid var(--border); }
.chat-form input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; outline: none;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  font: 500 13.5px 'Space Grotesk', sans-serif;
}
.chat-form input:focus { border-color: rgba(23,184,209,0.6); box-shadow: 0 0 0 3px rgba(23,184,209,0.12); }
.chat-send {
  flex-shrink: 0; width: 40px; border: 0; border-radius: 10px; cursor: pointer; display: grid; place-items: center;
  background: var(--green); color: #031417; transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.chat-send:hover { box-shadow: 0 0 16px rgba(23,184,209,0.45); }
.chat-send:active { transform: scale(0.94); }
.chat-send svg { width: 17px; height: 17px; }
.chat-dock[data-channel="traders"] .chat-send { background: var(--yellow); }
.chat-dock[data-channel="match"] .chat-send { background: var(--red); color: #fff; }
.chat-error { margin: -6px 12px 12px; font-size: 12px; color: var(--red); }
.chat-login {
  margin: 10px 12px 14px; padding: 11px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--green); background: rgba(23,184,209,0.08); color: var(--green);
  font: 700 13px 'Space Grotesk', sans-serif;
}
.chat-reopen {
  position: fixed; left: 16px; bottom: 18px; z-index: 45; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; border: 1px solid rgba(23,184,209,0.5);
  background: rgba(10,12,14,0.92); color: var(--green);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 18px rgba(23,184,209,0.2);
}
.chat-reopen svg { width: 22px; height: 22px; }
/* Pendant un match, la barre du haut est vide : le bouton du chat y va, il ne
   cache plus les cartes des joueurs en bas a gauche. */
body.in-match .chat-reopen { top: 17px; bottom: auto; left: 236px; }
.chat-reopen-badge {
  position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: var(--red); color: #fff; font: 800 11px/19px 'Space Grotesk', sans-serif;
}
.chat-reopen-badge[hidden] { display: none; }
.chat-scrim { display: none; }
@media (max-width: 1000px) {
  body.chat-on .chat-dock {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(320px, 88vw); z-index: 70;
    box-shadow: 18px 0 40px rgba(0,0,0,0.55);
  }
}

/* Telephone : le chat s'ouvre en panneau qui monte du bas de l'ecran, par un
   bouton rond au-dessus des onglets (dans la barre du haut pendant un match).
   --kb et --vvh (chat.js) le gardent au-dessus du clavier. */
html.mobile body.chat-on .chat-dock {
  position: fixed; left: 0; right: 0; top: auto; bottom: var(--kb, 0px); width: auto; z-index: 90;
  height: min(76svh, calc(var(--vvh, 100svh) - 16px));
  border: 1px solid var(--border); border-bottom: 0; border-radius: 18px 18px 0 0;
  background: #0b0e10; backdrop-filter: none;
  box-shadow: 0 -20px 50px rgba(0,0,0,0.65);
  animation: chatSheetIn 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes chatSheetIn { from { opacity: 0; transform: translateY(35%); } to { opacity: 1; transform: none; } }
html.mobile .chat-dock::before {
  content: ''; position: absolute; top: 7px; left: 50%; width: 38px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.18); transform: translateX(-50%);
}
html.mobile .chat-head { padding: 18px 12px 6px; }
html.mobile .chat-tab { font-size: 13px; padding: 8px 6px; }
html.mobile .chat-collapse { width: 36px; height: 36px; }
html.mobile .chat-collapse svg { transform: rotate(-90deg); } /* fleche vers le bas : refermer */
html.mobile .chat-list { overscroll-behavior: contain; }
html.mobile .chat-name { max-width: 190px; }
html.mobile .chat-actions { top: 2px; }
html.mobile .chat-reply-btn { padding: 6px 10px; font-size: 12.5px; }
html.mobile .chat-reply-btn span { display: inline; }
html.mobile .chat-msg.act .chat-time { visibility: hidden; }
html.mobile .chat-replybar { font-size: 13px; padding: 8px 8px 8px 12px; }
html.mobile .chat-replybar-x { width: 28px; height: 28px; }
html.mobile .chat-form { padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
html.mobile .chat-form input { font-size: 16px; } /* 16 px : iPhone ne zoome pas en tapant */
html.mobile .chat-login { margin-bottom: calc(14px + env(safe-area-inset-bottom)); }
html.mobile body.chat-on:not(.chat-collapsed) .chat-scrim {
  display: block; position: fixed; inset: 0; z-index: 89; pointer-events: auto; touch-action: none;
  background: rgba(0,0,0,0.55); animation: chatScrimIn 0.25s ease;
}
@keyframes chatScrimIn { from { opacity: 0; } to { opacity: 1; } }
html.mobile .chat-reopen {
  left: auto; right: 14px; top: auto; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 61;
  width: 50px; height: 50px;
}
html.mobile body.in-match .chat-reopen { top: 10px; bottom: auto; right: auto; left: var(--chat-btn-left, 132px); width: 38px; height: 38px; z-index: 41; }
html.mobile body.in-match .chat-reopen svg { width: 19px; height: 19px; }
html.mobile body.in-match .chat-reopen.below-bar { top: 70px; left: 12px; }

/* ===================== MATCH : DUEL COUPE EN DEUX ===================== */
main#app:has(#matchScreen.active) { max-width: none; padding: 0; }
.duel { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #040506; isolation: isolate; }
.duel-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
.duel-vs {
  position: absolute; top: 56%; left: 50%; z-index: 0; pointer-events: none; user-select: none;
  transform: translate(-50%, -50%) skewX(-10deg);
  font: italic 800 clamp(110px, 15vw, 230px)/1 'Space Grotesk', sans-serif; letter-spacing: -8px;
  color: rgba(255,255,255,0.035);
  text-shadow: -7px 0 rgba(23,184,209,0.07), 7px 0 rgba(255,77,109,0.07);
}
.side-a { --rgb: 23,184,209; }
.side-b { --rgb: 255,77,109; }
.duel-tags-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.duel-tag {
  position: absolute; left: 0; top: 0; will-change: transform;
  display: flex; align-items: center; gap: 6px; padding: 4px 11px 4px 4px; border-radius: 999px;
  background: rgba(5,7,8,0.8); border: 1px solid color-mix(in srgb, var(--c) 60%, transparent);
  box-shadow: 0 0 20px color-mix(in srgb, var(--c) 28%, transparent);
  font: 700 13px var(--font-mono); color: #fff; white-space: nowrap;
}
.duel-tag.solo { padding: 6px 13px; font-size: 17px; }
.duel-tag.me { border-color: #fff; }
.duel-tag-avatar { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.duel-tag-name {
  font: 700 12px 'Space Grotesk', sans-serif; color: rgba(255,255,255,0.78);
  max-width: 110px; overflow: hidden; text-overflow: ellipsis;
}
.duel-tag-val { color: var(--c); font-variant-numeric: tabular-nums; }
.duel-tag.solo .duel-tag-val { color: #fff; text-shadow: 0 0 12px var(--c); }
.duel-pop {
  position: absolute; left: 50%; bottom: 100%; margin-bottom: 2px; pointer-events: none;
  font: 800 12px var(--font-mono); animation: duelPop 1.2s ease-out forwards;
}
.duel-pop.up { color: var(--green); }
.duel-pop.down { color: var(--red); }
@keyframes duelPop {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.9); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -22px) scale(1); }
}
.duel-head { position: absolute; top: 26px; z-index: 3; max-width: calc(50% - 110px); }
.duel-head.side-a { left: 30px; text-align: left; }
.duel-head.side-b { right: 30px; text-align: right; }
.duel-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.duel-head.side-b .duel-title { flex-direction: row-reverse; }
.duel-name { display: inline-flex; align-items: center; gap: 10px; min-width: 0; font-size: 21px; font-weight: 800; color: #fff; }
.duel-head.side-b .duel-name { flex-direction: row-reverse; }
.duel-avatar {
  width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #111;
  box-shadow: 0 0 0 2px rgba(var(--rgb),0.8), 0 0 24px rgba(var(--rgb),0.45);
}
.duel-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.duel-team-label { font: 800 15px 'Space Grotesk', sans-serif; letter-spacing: 4px; text-transform: uppercase; color: rgb(var(--rgb)); }
.duel-you {
  font: 800 10px 'Space Grotesk', sans-serif; letter-spacing: 1.5px; padding: 3px 7px; border-radius: 6px;
  background: #fff; color: #050607;
}
.duel-lead {
  display: none; font: 800 10px 'Space Grotesk', sans-serif; letter-spacing: 1.5px; padding: 3px 8px; border-radius: 6px;
  color: var(--yellow); background: rgba(255,209,102,0.12); border: 1px solid rgba(255,209,102,0.45);
}
.duel-head.leading .duel-lead { display: inline-block; animation: leadIn 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes leadIn { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
.duel-pnl {
  margin-top: 12px; font: 700 64px/1 var(--font-mono); letter-spacing: -2px; white-space: nowrap;
  color: #fff; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 2px rgba(var(--rgb),0.9), 0 0 30px rgba(var(--rgb),0.6);
}
.duel-tags { margin-top: 10px; }
.duel-head.side-b .duel-tags { justify-content: flex-end; }
.duel-center {
  position: absolute; top: 20px; left: 50%; z-index: 4; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; pointer-events: none;
}
.duel-center .timer-ring {
  background: radial-gradient(circle, rgba(10,12,14,0.95) 60%, rgba(10,12,14,0.8));
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 0 0 6px rgba(4,5,6,0.55), 0 0 36px rgba(255,255,255,0.08);
}
.duel-center .mode-label {
  white-space: nowrap; padding: 4px 11px; border-radius: 999px; margin-top: 10px;
  background: rgba(4,5,6,0.78); border: 1px solid rgba(255,255,255,0.08);
}
.duel-center .spec-count { margin-top: 6px; white-space: nowrap; padding: 3px 10px; border-radius: 999px; background: rgba(4,5,6,0.7); }
/* 2v2 a 5v5 : une rangee de cartes en bas de chaque moitie, le meilleur de
   l'equipe cote bord, les suivants vers le centre. */
.duel-roster {
  position: absolute; bottom: 18px; z-index: 3; display: grid; gap: 8px;
  width: calc(50% - 40px); grid-template-columns: repeat(var(--cols, 2), minmax(0, 210px));
}
.duel[data-size="3"] .duel-roster { --cols: 3; }
.duel[data-size="4"] .duel-roster { --cols: 4; }
.duel[data-size="5"] .duel-roster { --cols: 3; } /* 3 + 2 */
@media (min-width: 1700px) { .duel[data-size="5"] .duel-roster { --cols: 5; } }
.duel-roster[hidden] { display: none; }
.duel-roster.side-a { left: 22px; }
.duel-roster.side-b { right: 22px; direction: rtl; } /* rempli depuis le bord droit */
.duel-chip {
  direction: ltr; min-width: 0;
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "dot name" "pnl pnl" "tags tags";
  align-items: center; column-gap: 7px; row-gap: 4px;
  padding: 8px 11px; border-radius: 12px;
  background: rgba(5,7,8,0.8); border: 1px solid color-mix(in srgb, var(--c) 22%, rgba(255,255,255,0.06));
  backdrop-filter: blur(4px);
  box-shadow: inset 0 2px 0 color-mix(in srgb, var(--c) 70%, transparent);
}
.duel-chip.me { border-color: rgba(255,255,255,0.55); }
.duel-chip-dot { grid-area: dot; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.duel-chip .duel-name { grid-area: name; min-width: 0; font-size: 13px; gap: 6px; flex-direction: row !important; }
.duel-chip .duel-avatar { width: 20px; height: 20px; box-shadow: none; }
.duel-chip .duel-name-text { max-width: none; }
.duel-chip-pnl { grid-area: pnl; font: 700 17px/1.1 var(--font-mono); color: var(--c); font-variant-numeric: tabular-nums; white-space: nowrap; }
.duel-chip-tags { grid-area: tags; margin-top: 0; flex-wrap: nowrap; overflow: hidden; }
.duel-chip-tags:empty { display: none; }
.duel-roster.side-b .duel-chip { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name dot" "pnl pnl" "tags tags"; text-align: right; }
.duel-roster.side-b .duel-chip .duel-name { flex-direction: row-reverse !important; justify-self: end; max-width: 100%; }
.duel-roster.side-b .duel-chip-tags { justify-content: flex-end; }

/* Meilleur joueur de chaque equipe (MVP) : carte doree, pastille sur son
   bord, couronne sur l'avatar de son etiquette de courbe. */
.mvp-crown {
  display: inline-block; flex-shrink: 0; width: 12px; height: 8px; background: currentColor;
  clip-path: polygon(0 100%, 0 22%, 26% 58%, 50% 0, 74% 58%, 100% 22%, 100% 100%);
}
.duel-chip { position: relative; transition: border-color 0.3s ease, box-shadow 0.3s ease; }
.duel-mvp {
  position: absolute; top: -9px; right: 10px; z-index: 1; display: none; align-items: center; gap: 4px;
  padding: 2px 7px 2px 6px; border-radius: 999px; pointer-events: none;
  font: 800 9.5px/1.25 'Space Grotesk', sans-serif; letter-spacing: 1.2px; color: #1c1400;
  background: linear-gradient(180deg, #ffe7a3, #ffc23d); box-shadow: 0 0 14px rgba(255,194,61,0.55);
}
.duel-roster.side-b .duel-mvp { right: auto; left: 10px; }
.duel-chip.mvp {
  border-color: rgba(255,209,102,0.8);
  box-shadow: inset 0 2px 0 var(--yellow), 0 0 22px rgba(255,209,102,0.2);
}
.duel-chip.mvp .duel-mvp { display: inline-flex; animation: mvpIn 0.5s cubic-bezier(0.2, 1.5, 0.4, 1); }
@keyframes mvpIn { from { opacity: 0; transform: translateY(6px) scale(0.5); } to { opacity: 1; transform: none; } }
.duel-tag-crown {
  position: absolute; left: 8px; top: -8px; width: 14px; height: 9px; display: none;
  background: var(--yellow);
  clip-path: polygon(0 100%, 0 22%, 26% 58%, 50% 0, 74% 58%, 100% 22%, 100% 100%);
}
.duel-tag.mvp .duel-tag-crown { display: block; animation: crownPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
.duel-tag.mvp .duel-tag-avatar { box-shadow: 0 0 0 1.5px var(--yellow), 0 0 10px rgba(255,209,102,0.6); }
/* Son etiquette a soi : au-dessus des autres, liseré blanc, « TOI ». */
.duel-tag-you {
  font: 800 9px/1.3 'Space Grotesk', sans-serif; letter-spacing: 1.2px; padding: 1px 5px; border-radius: 5px;
  background: #fff; color: #050607;
}
/* Tag « BOT » dans les etiquettes des courbes (duel et Battle Royale) : l'ecart
   vient deja du flex. */
.duel-tag .bot-tag, .br-tag .bot-tag { margin-right: 0; padding: 0 4px; font-size: 8.5px; line-height: 1.5; }
.duel-tag.me:not(.solo) {
  z-index: 1; background: rgba(12,15,17,0.95);
  box-shadow: 0 0 0 1px #fff, 0 0 26px color-mix(in srgb, var(--c) 55%, transparent);
}
.duel-chip.me { background: rgba(14,17,19,0.9); }

/* ===================== BATTLE ROYALE : LA COURSE ===================== */
/* Tout le monde part du meme point a gauche (cf. br-arena.js) ; les
   etiquettes des survivants suivent leur courbe, en colonne a droite. */
main#app:has(#brMatchScreen.active) { max-width: none; padding: 0; }
.br-arena { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #040506; isolation: isolate; }
.br-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
.br-tags { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.br-tag {
  position: absolute; left: 0; top: 0; will-change: transform; pointer-events: auto;
  display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px;
  background: rgba(5,7,8,0.84); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--c) 20%, transparent);
  font: 700 12.5px var(--font-mono); color: #fff; white-space: nowrap;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.br-tag-rank { min-width: 15px; text-align: center; font: 800 10.5px 'Space Grotesk', sans-serif; color: rgba(255,255,255,0.45); }
.br-tag-avbox { position: relative; display: inline-flex; flex-shrink: 0; }
.br-tag-av { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; background: #111; }
.br-tag .duel-tag-crown { left: 3px; top: -9px; }
.br-tag-name { font: 700 12px 'Space Grotesk', sans-serif; color: rgba(255,255,255,0.8); max-width: 112px; overflow: hidden; text-overflow: ellipsis; }
.br-tag-val { color: var(--c); font-variant-numeric: tabular-nums; }
.br-tag-warn {
  display: none; width: 15px; height: 15px; border-radius: 50%; text-align: center;
  background: var(--yellow); color: #111; font: 800 10px/15px 'Space Grotesk', sans-serif;
}
.br-tag.warn .br-tag-warn { display: inline-block; }
.br-tag.lead { border-color: rgba(255,209,102,0.85); box-shadow: 0 0 18px rgba(255,209,102,0.3); }
.br-tag.lead .br-tag-rank { color: var(--yellow); }
.br-tag.lead .duel-tag-crown { display: block; animation: crownPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
.br-tag.lead .br-tag-av { box-shadow: 0 0 0 1.5px var(--yellow), 0 0 10px rgba(255,209,102,0.6); }
/* Le dernier : le prochain elimine si rien ne change. */
.br-tag.danger { border-color: rgba(255,77,109,0.95); background: rgba(38,6,12,0.9); animation: brDanger 1.1s ease-in-out infinite; }
.br-tag.danger .br-tag-rank { color: var(--red); }
@keyframes brDanger {
  0%, 100% { box-shadow: 0 0 8px rgba(255,77,109,0.25); }
  50% { box-shadow: 0 0 24px rgba(255,77,109,0.65); }
}
.br-tag.me { z-index: 1; background: rgba(12,15,17,0.96); box-shadow: 0 0 0 1px #fff, 0 0 24px color-mix(in srgb, var(--c) 50%, transparent); }
.br-tag.me.danger { animation: none; box-shadow: 0 0 0 1px #fff, 0 0 24px rgba(255,77,109,0.65); }

.br-hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3; pointer-events: none;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; padding: 20px 30px 0;
}
.br-hud-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.br-title { font: 800 13px 'Space Grotesk', sans-serif; letter-spacing: 4px; text-transform: uppercase; color: var(--yellow); }
.br-alive-count { font: 600 14px 'Space Grotesk', sans-serif; color: var(--text-dim); }
.br-alive-count strong { font: 700 32px/1 var(--font-mono); color: #fff; letter-spacing: -1px; margin-right: 2px; text-shadow: 0 0 22px rgba(255,209,102,0.35); }
.br-hud-center { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.br-clock {
  font: 700 34px/1 var(--font-mono); color: #fff; font-variant-numeric: tabular-nums;
  padding: 10px 20px; border-radius: 16px; background: rgba(10,12,14,0.92);
  border: 1px solid rgba(255,255,255,0.14); box-shadow: 0 0 0 6px rgba(4,5,6,0.55), 0 0 36px rgba(255,255,255,0.06);
}
.br-next {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 12px 8px; border-radius: 12px;
  font: 600 12px 'Space Grotesk', sans-serif; color: #ff8197; white-space: nowrap;
  background: rgba(4,5,6,0.8); border: 1px solid rgba(255,77,109,0.25);
}
.br-next-bar { position: relative; width: 180px; height: 4px; border-radius: 2px; background: rgba(255,77,109,0.15); overflow: hidden; }
.br-next-bar i { position: absolute; inset: 0; background: linear-gradient(90deg, #ff4d6d, #ffa08f); transform-origin: left center; transition: transform 0.5s linear; }
.br-next-bar.urgent i { background: #ff4d6d; animation: brBlink 0.5s steps(2) infinite; }
@keyframes brBlink { 50% { opacity: 0.45; } }
.br-pot { font: 700 13px var(--font-mono); color: var(--yellow); }
.br-pot[hidden] { display: none; }
.br-hud .spec-count { margin-top: 0; }

/* Bouton « Mini-fenetre » (cf. minihud.js) : sous le chrono, en duel comme en
   Battle Royale. Cache sur les navigateurs qui ne savent pas l'ouvrir. */
.mini-toggle {
  pointer-events: auto; margin-top: 8px; display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px 5px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  font: 600 12px 'Space Grotesk', sans-serif; color: rgba(255,255,255,0.75);
  background: rgba(4,5,6,0.78); border: 1px solid rgba(255,255,255,0.12);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.mini-toggle:hover { color: #fff; border-color: rgba(23,184,209,0.6); background: rgba(10,14,16,0.92); }
.mini-toggle.on { color: var(--green); border-color: rgba(23,184,209,0.5); }
.mini-toggle[hidden] { display: none; }
.mini-ico { position: relative; width: 14px; height: 10px; border: 1.5px solid currentColor; border-radius: 2px; flex-shrink: 0; }
.mini-ico::after { content: ''; position: absolute; right: 1px; bottom: 1px; width: 6px; height: 4px; border-radius: 1px; background: currentColor; }
.br-hud-center .mini-toggle { margin-top: 0; }
html.mobile .mini-toggle { display: none; }

/* Annonce d'une elimination. */
.br-toasts {
  position: absolute; top: 148px; left: 50%; transform: translateX(-50%); z-index: 4; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.br-toast {
  display: flex; align-items: center; gap: 9px; padding: 7px 15px 7px 12px; border-radius: 999px; white-space: nowrap;
  background: rgba(32,6,11,0.94); border: 1px solid rgba(255,77,109,0.65); color: #fff;
  font: 700 13px 'Space Grotesk', sans-serif;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45), 0 0 20px rgba(255,77,109,0.3);
  animation: brToastIn 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.br-toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes brToastIn { from { opacity: 0; transform: translateY(10px) scale(0.85); } to { opacity: 1; transform: none; } }
.br-toast-x { position: relative; width: 11px; height: 11px; flex-shrink: 0; }
.br-toast-x::before, .br-toast-x::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 13px; height: 2.4px; border-radius: 2px; background: #ff4d6d;
  transform: translate(-50%, -50%) rotate(45deg);
}
.br-toast-x::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* ===================== FENETRE DE MISE ===================== */
/* Tient toujours dans l'ecran : joueurs sur deux colonnes, boutons toujours
   visibles ; seule la liste defilerait dans un cas extreme (BR de 15). */
.modal.stake-modal {
  width: 540px; padding: 24px 28px 22px; max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; overflow: hidden;
}
.stake-modal > * { flex-shrink: 0; }
.stake-modal h3 { margin: 0 0 12px; }
.stake-modal .cash-real-warning { margin: 0 0 6px; }
.stake-modal .hint { margin: 6px 0; }
.stake-modal .hint:empty, .stake-modal .form-error:empty { display: none; }
.stake-modal .cash-lobby-list {
  flex: 0 1 auto; min-height: 0; overflow-y: auto; margin: 8px 0 4px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.stake-modal .cash-lobby-list:empty { display: none; }
.stake-modal .cash-lobby-row { padding: 6px 10px; gap: 8px; font-size: 12.5px; }
.stake-modal .cash-lobby-row > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stake-modal .cash-lobby-row > span:last-child { white-space: nowrap; }
.stake-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
html.mobile .modal.stake-modal { padding: 20px 16px; }


/* ===================== FIN DE MATCH : ECRAN DE VICTOIRE ===================== */
/* Ordinateur : l'ecran de fin ne defile jamais. Il occupe la hauteur
   disponible, centre ; les tailles suivent la hauteur de la fenetre et, en
   dernier recours, fitVictory() reduit l'ensemble pour qu'il tienne. */
main#app:has(#resultsScreen.active) { max-width: 1240px; padding-top: 8px; padding-bottom: 10px; }
.victory {
  position: relative; isolation: isolate; flex: 1; margin: 0; padding: 0 8px;
  display: flex; flex-direction: column; justify-content: center; overflow: hidden;
}
.victory-fit { flex: none; width: 100%; }
/* Telephone : la page defile normalement ; les rayons (1100 px) ne l'elargissent pas. */
html.mobile .results-box.victory { display: block; overflow-x: hidden; overflow-x: clip; overflow-y: visible; }
.victory > * { position: relative; z-index: 1; }
.victory-rays {
  position: absolute; left: 50%; top: 120px; width: 1100px; height: 1100px; z-index: 0; pointer-events: none;
  transform: translate(-50%, -50%); opacity: 0;
  background: repeating-conic-gradient(from 0deg, rgba(23,184,209,0.11) 0deg 5deg, transparent 5deg 15deg);
  -webkit-mask: radial-gradient(circle, #000 0, rgba(0,0,0,0.6) 25%, transparent 58%);
  mask: radial-gradient(circle, #000 0, rgba(0,0,0,0.6) 25%, transparent 58%);
}
.victory > .victory-rays { position: absolute; }
.victory.is-win .victory-rays { opacity: 1; animation: raysIn 1.2s ease both, raysSpin 60s linear infinite; }
.victory.is-loss .victory-rays {
  opacity: 0.6; background: radial-gradient(circle, rgba(255,77,109,0.14), transparent 50%);
  -webkit-mask: none; mask: none;
}
@keyframes raysIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes raysSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.victory-kicker {
  margin: 0 0 clamp(4px, 1vh, 8px); font: 700 12px var(--font-mono); letter-spacing: 3px; text-transform: uppercase;
  color: var(--text-dim); animation: vUp 0.5s ease both;
}
.victory-title { margin: 0; font-size: clamp(48px, min(8.4vw, 11.5vh), 112px); line-height: 0.95; letter-spacing: -3px; font-weight: 800; color: #fff; }
.victory.is-win .victory-title {
  background: linear-gradient(100deg, #fff 0%, #fff 38%, #9ff1ff 46%, #17b8d1 50%, #9ff1ff 54%, #fff 62%, #fff 100%);
  background-size: 300% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 34px rgba(23,184,209,0.5));
  animation: titleIn 0.75s cubic-bezier(0.2, 1.35, 0.4, 1) both, titleShine 2.4s ease 0.75s both;
}
.victory.is-loss .victory-title { color: var(--red); text-shadow: 0 0 36px rgba(255,77,109,0.35); animation: titleDrop 0.6s ease both; }
.victory.is-spectator .victory-title, .victory.is-neutral .victory-title { animation: titleDrop 0.6s ease both; }
.victory.is-spectator.winner-a .victory-title { color: #bff4fb; text-shadow: 0 0 34px rgba(23,184,209,0.45); }
.victory.is-spectator.winner-b .victory-title { color: #ffd2da; text-shadow: 0 0 34px rgba(255,77,109,0.45); }
.victory-title.long { font-size: clamp(26px, min(3.2vw, 5vh), 40px); letter-spacing: -0.5px; line-height: 1.15; max-width: 820px; margin: 0 auto; }
@keyframes titleIn { 0% { opacity: 0; transform: scale(1.7); filter: blur(12px); } 60% { opacity: 1; filter: blur(0); } 100% { transform: scale(1); } }
@keyframes titleShine { from { background-position: 100% 0; } to { background-position: 0% 0; } }
@keyframes titleDrop { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes vUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.victory-sub { margin: clamp(4px, 1.3vh, 12px) 0 0; font-size: 17px; color: var(--text-dim); animation: vUp 0.5s ease 0.2s both; }
.victory-sub[hidden] { display: none; }
.victory-gain {
  margin: clamp(6px, 2vh, 20px) auto 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
  animation: gainIn 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) 0.25s both;
}
.victory-gain-amount {
  font: 700 clamp(34px, min(5.6vw, 7.6vh), 68px)/1 var(--font-mono); letter-spacing: -2px; font-variant-numeric: tabular-nums;
  color: var(--yellow); text-shadow: 0 0 34px rgba(255,209,102,0.55);
}
.victory-gain.done .victory-gain-amount { animation: gainPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
.victory-gain-usd { font: 700 15px var(--font-mono); color: rgba(255,209,102,0.72); min-height: 18px; }
@keyframes gainIn { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@keyframes gainPop { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
.victory-duel {
  display: grid; grid-template-columns: 210px minmax(0, 1fr) 210px; align-items: center; gap: 16px;
  max-width: 1080px; margin: clamp(10px, 2.8vh, 28px) auto 0;
}
.victory-duel.team { grid-template-columns: 280px minmax(0, 1fr) 280px; max-width: 1200px; }
.victory-chart {
  display: block; width: 100%; height: clamp(130px, 25vh, 230px); border-radius: 18px; background: #040506;
  border: 1px solid rgba(255,255,255,0.07); box-shadow: 0 20px 50px rgba(0,0,0,0.45);
  animation: vUp 0.5s ease 0.3s both;
}
.victory-side {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 12px 16px; border-radius: 18px;
  opacity: 0.5; filter: saturate(0.5); animation: vUp 0.5s ease 0.4s both;
}
.victory-side.won { opacity: 1; filter: none; background: radial-gradient(circle at 50% 35%, rgba(var(--rgb),0.2), transparent 70%); }
.victory.is-neutral .victory-side { opacity: 1; filter: none; }
.victory-avatars { position: relative; display: flex; justify-content: center; }
.victory-avatar {
  width: 68px; height: 68px; border-radius: 50%; object-fit: cover; background: #111; margin-left: -16px;
  border: 3px solid rgb(var(--rgb)); box-shadow: 0 0 22px rgba(var(--rgb),0.4);
}
.victory-avatar:first-child { margin-left: 0; }
.victory-avatars:has(.victory-avatar:nth-child(2)) .victory-avatar { width: 46px; height: 46px; margin-left: -12px; border-width: 2px; }
.victory-avatars:has(.victory-avatar:nth-child(2)) .victory-avatar:first-child { margin-left: 0; }
.victory-crown {
  position: absolute; left: 50%; top: -24px; width: 32px; height: 22px; transform: translateX(-50%);
  background: var(--yellow); filter: drop-shadow(0 0 10px rgba(255,209,102,0.85));
  clip-path: polygon(0 100%, 0 22%, 26% 58%, 50% 0, 74% 58%, 100% 22%, 100% 100%);
  animation: crownDrop 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) 1.1s both;
}
@keyframes crownDrop { from { opacity: 0; transform: translate(-50%, -26px) rotate(-18deg); } to { opacity: 1; transform: translateX(-50%); } }
.victory-name {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px;
  font-size: 17px; font-weight: 800; max-width: 100%; overflow-wrap: anywhere;
}
.victory-pnl { font: 700 30px/1 var(--font-mono); color: #fff; text-shadow: 0 0 20px rgba(var(--rgb),0.6); letter-spacing: -1px; }
/* 2v2 a 5v5 : les joueurs de l'equipe sous son nom, a cote des courbes. */
.victory-duel.team .victory-side { padding: 12px 10px; gap: 6px; }
.victory-duel.team .victory-pnl { font-size: 24px; }
.victory-crown.inline {
  position: static; display: inline-block; width: 22px; height: 15px; transform: none;
  animation: crownPop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1) 1.1s both;
}
@keyframes crownPop { from { opacity: 0; transform: scale(0.3) rotate(-18deg); } to { opacity: 1; transform: none; } }
.victory-roster { display: flex; flex-direction: column; gap: 3px; width: 100%; margin-top: 4px; text-align: left; }
.victory-row {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; grid-template-areas: "av name pnl" "av gain pnl";
  align-items: center; column-gap: 7px; padding: 4px 8px; border-radius: 9px; background: rgba(255,255,255,0.03);
}
.victory-row.me { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35); }
.victory-row.dq { opacity: 0.5; }
.victory-row-av { grid-area: av; width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.victory-row-name { grid-area: name; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; }
.victory-row-name .tag { font-size: 9.5px; padding: 1px 5px; margin-left: 4px; }
.victory-row-pnl { grid-area: pnl; font: 700 13px var(--font-mono); font-variant-numeric: tabular-nums; }
.victory-row-pnl.up { color: var(--green); }
.victory-row-pnl.down { color: var(--red); }
.victory-row-gain { grid-area: gain; font: 700 11px var(--font-mono); color: var(--yellow); white-space: nowrap; }
.victory-row.mvp {
  background: linear-gradient(90deg, rgba(255,209,102,0.17), rgba(255,209,102,0.03));
  box-shadow: inset 0 0 0 1px rgba(255,209,102,0.55);
}
.victory-row.mvp.me { box-shadow: inset 0 0 0 1px #ffe7a3; }
.victory-mvp {
  display: inline-flex; align-items: center; gap: 3px; margin-right: 5px; vertical-align: 1px;
  padding: 1px 6px 1px 5px; border-radius: 999px;
  font: 800 9px/1.35 'Space Grotesk', sans-serif; letter-spacing: 1px; color: #1c1400;
  background: linear-gradient(180deg, #ffe7a3, #ffc23d);
  animation: crownPop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1) 1.3s both;
}
.victory-mvp .mvp-crown { width: 10px; height: 7px; }
.victory-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin: clamp(10px, 2.6vh, 26px) auto 0; }
.victory-stats[hidden] { display: none; }
.victory-stat {
  min-width: 150px; padding: clamp(8px, 1.5vh, 14px) 18px; border-radius: 14px; display: flex; flex-direction: column; gap: 5px;
  background: rgba(15,18,19,0.85); border: 1px solid var(--border);
  animation: vUp 0.45s ease calc(0.6s + var(--i) * 0.08s) both;
}
.victory-stat-value { font: 700 clamp(18px, 2.9vh, 23px) var(--font-mono); font-variant-numeric: tabular-nums; }
.victory-stat.up .victory-stat-value { color: var(--green); }
.victory-stat.down .victory-stat-value { color: var(--red); }
.victory-stat.gold { border-color: rgba(255,209,102,0.35); }
.victory-stat.gold .victory-stat-value { color: var(--yellow); }
.victory-stat-label { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-dim); }
.victory-note { margin: clamp(6px, 1.6vh, 16px) auto 0; max-width: 720px; font-size: 13px; }
.victory-note[hidden] { display: none; }
.victory-actions {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 14px;
  margin-top: clamp(10px, 2.2vh, 22px);
}
.victory-actions .defi-promo-card { width: auto; flex: 0 1 470px; margin: 0; padding: 12px 16px; font-size: 14px; }
.victory-again { animation: vUp 0.45s ease 0.95s both; }
.victory.is-win .victory-again { box-shadow: 0 0 0 1px rgba(23,184,209,0.5), 0 10px 36px rgba(23,184,209,0.35); }

/* ===================== FIN DE BATTLE ROYALE ===================== */
/* Meme ecran que les duels (titre, gain, chiffres), aux couleurs du podium :
   or pour la victoire, argent et bronze pour les 2e et 3e. */
main#app:has(#brResultsScreen.active) { max-width: 1240px; padding-top: 8px; padding-bottom: 10px; }
.br-victory .victory-rays { background: repeating-conic-gradient(from 0deg, rgba(255,209,102,0.1) 0deg 5deg, transparent 5deg 15deg); }
.br-victory.is-win .victory-title {
  background-image: linear-gradient(100deg, #fff 0%, #fff 38%, #fff3cf 46%, #ffd166 50%, #fff3cf 54%, #fff 62%, #fff 100%);
  filter: drop-shadow(0 0 34px rgba(255,209,102,0.5));
}
.br-victory.is-win .victory-again { box-shadow: 0 0 0 1px rgba(255,209,102,0.5), 0 10px 36px rgba(255,209,102,0.28); }
.br-victory.is-place .victory-title, .br-victory.is-spectator .victory-title { animation: titleDrop 0.6s ease both; }
.br-victory.place-2 .victory-title { color: #f1f4f8; text-shadow: 0 0 34px rgba(223,229,238,0.45); }
.br-victory.place-3 .victory-title { color: #f3c493; text-shadow: 0 0 34px rgba(224,162,106,0.45); }
.br-victory.is-spectator .victory-title { color: #ffe7a3; text-shadow: 0 0 34px rgba(255,209,102,0.4); }
.br-victory.place-2 .victory-rays, .br-victory.place-3 .victory-rays {
  opacity: 0.7; -webkit-mask: none; mask: none;
  background: radial-gradient(circle, rgba(var(--glow),0.13), transparent 50%);
}
.br-victory.place-2 { --glow: 223,229,238; }
.br-victory.place-3 { --glow: 224,162,106; }

/* Podium a gauche, replay de la course a droite. */
.brv-stage {
  display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); align-items: end; gap: 24px;
  max-width: 1120px; margin: clamp(12px, 3vh, 30px) auto 0;
}
.brv-stage.no-chart { grid-template-columns: minmax(0, 500px); justify-content: center; }
.brv-stage:has(.brp[hidden]) { grid-template-columns: minmax(0, 1fr); }
.brv-stage [hidden] { display: none; }
.brv-chart { height: clamp(150px, 27vh, 250px); }

.brp { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 10px; }
.brp-slot { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; --m: 255,209,102; }
.brp-slot.gold { --m: 255,209,102; --h: clamp(78px, 13vh, 122px); --ds: 0.65s; --d: 1s; }
.brp-slot.silver { --m: 223,229,238; --h: clamp(56px, 9.5vh, 90px); --ds: 0.5s; --d: 0.85s; }
.brp-slot.bronze { --m: 224,162,106; --h: clamp(40px, 7vh, 66px); --ds: 0.35s; --d: 0.7s; }
.brp-slot > :not(.brp-step) { animation: vUp 0.45s ease var(--d) both; }
.brp-head { position: relative; margin-bottom: 5px; }
.brp-slot > .brp-head { animation: brpPop 0.6s cubic-bezier(0.2, 1.5, 0.4, 1) var(--d) both; }
.brp-av {
  display: block; width: 62px; height: 62px; border-radius: 50%; object-fit: cover; background: #111;
  border: 3px solid rgb(var(--m)); box-shadow: 0 0 26px rgba(var(--m),0.45);
}
.brp-slot.gold .brp-av { width: 86px; height: 86px; box-shadow: 0 0 34px rgba(var(--m),0.6); }
.brp-slot.me .brp-av { outline: 2px solid rgba(255,255,255,0.85); outline-offset: 3px; }
.brp-crown {
  position: absolute; left: 50%; top: -25px; width: 34px; height: 23px; z-index: 1;
  background: var(--yellow); filter: drop-shadow(0 0 10px rgba(255,209,102,0.85));
  clip-path: polygon(0 100%, 0 22%, 26% 58%, 50% 0, 74% 58%, 100% 22%, 100% 100%);
  transform: translateX(-50%); animation: crownDrop 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) 1.45s both;
}
.brp-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 800; }
.brp-name .duel-you { margin-left: 5px; vertical-align: 1px; }
.brp-pnl { font: 700 19px/1.1 var(--font-mono); letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.brp-slot.gold .brp-pnl { font-size: 25px; }
.brp-pnl.up { color: var(--green); text-shadow: 0 0 18px rgba(23,184,209,0.45); }
.brp-pnl.down { color: var(--red); text-shadow: 0 0 18px rgba(255,77,109,0.4); }
.brp-gain { font: 700 13px var(--font-mono); color: var(--yellow); text-shadow: 0 0 14px rgba(255,209,102,0.5); }
.brp-step {
  width: 100%; height: var(--h); margin-top: 8px; padding-top: 8px; display: flex; justify-content: center;
  border-radius: 14px 14px 3px 3px; border: 1px solid rgba(var(--m),0.55); border-bottom: 0;
  background: linear-gradient(180deg, rgba(var(--m),0.32), rgba(var(--m),0.07) 70%, rgba(var(--m),0.02));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 -12px 40px rgba(var(--m),0.12);
  transform-origin: bottom; animation: brpRise 0.6s cubic-bezier(0.2, 1.15, 0.4, 1) var(--ds) both;
}
.brp-step span { font: 800 clamp(26px, 4.6vh, 44px)/1 'Space Grotesk', sans-serif; color: rgb(var(--m)); text-shadow: 0 0 22px rgba(var(--m),0.65); }
.brp-slot.empty .brp-step { opacity: 0.35; }
@keyframes brpRise { from { opacity: 0; transform: scaleY(0); } to { opacity: 1; transform: none; } }
@keyframes brpPop { from { opacity: 0; transform: translateY(18px) scale(0.55); } to { opacity: 1; transform: none; } }

/* Le reste du classement : petites cartes, sa ligne en evidence. */
.brv-ranking {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 10px;
  max-width: 1120px; margin: clamp(12px, 2.4vh, 24px) auto 0; text-align: left;
}
.brv-ranking[hidden] { display: none; }
.brv-row {
  display: grid; grid-template-columns: 30px 22px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.06);
  animation: vUp 0.4s ease calc(1.1s + var(--i) * 0.035s) both;
}
.brv-row.me { background: linear-gradient(90deg, rgba(23,184,209,0.18), rgba(23,184,209,0.03)); border-color: rgba(23,184,209,0.55); }
.brv-row.dq { opacity: 0.5; }
.brv-row.dq .brv-pnl { text-decoration: line-through; }
.brv-rank { font: 700 12px var(--font-mono); color: var(--text-dim); }
.brv-av { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; background: #111; }
.brv-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; }
.brv-name .duel-you { margin-left: 5px; }
.brv-pnl { font: 700 13px var(--font-mono); font-variant-numeric: tabular-nums; }
.brv-pnl.up { color: var(--green); }
.brv-pnl.down { color: var(--red); }

html.mobile .brv-stage { grid-template-columns: minmax(0, 1fr); gap: 16px; }
html.mobile .brv-chart { height: 170px; }
html.mobile .brp { gap: 6px; }
html.mobile .brp-av { width: 50px; height: 50px; border-width: 2px; }
html.mobile .brp-slot.gold .brp-av { width: 66px; height: 66px; }
html.mobile .brp-name { font-size: 13px; }
html.mobile .brp-pnl { font-size: 15px; }
html.mobile .brp-slot.gold .brp-pnl { font-size: 18px; }
html.mobile .brp-slot.gold { --h: 92px; }
html.mobile .brp-slot.silver { --h: 68px; }
html.mobile .brp-slot.bronze { --h: 50px; }
html.mobile .brv-ranking { grid-template-columns: minmax(0, 1fr); }

@media (prefers-reduced-motion: reduce) {
  .victory *, .victory-rays { animation: none !important; }
}
