/* ============================================================
   Battle mode HUD — clean rebuild.
   Every bm-* rule sets its own margin/padding/font/color so the
   host page's global styles cannot bleed through.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700;800&display=swap");

:root {
  --bm-font: "Outfit", "Segoe UI", system-ui, sans-serif;
  --bm-bg: #0a0e16;
  --bm-card: #151d2e;
  --bm-panel: #0d1420;
  --bm-border: #2a3850;
  --bm-border-soft: #1e2a3e;
  --bm-white: #ffffff;
  --bm-text: #e9eef7;
  --bm-dim: #9db0cc;
  --bm-faint: #6b7d99;
  --bm-red: #fe2c55;
  --bm-teal: #2dd4bf;
  --bm-gold: #fbbf24;
  /* Feed fills remaining card height; denser rows for 720p / multi-player */
  --bm-feed-gap: 0.22rem;
  --bm-feed-scale: 1;
}

html.battle-mode-open {
  overflow: hidden;
}

/* ---------- Modal root ---------- */
.bm-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  margin: 0;
  padding: 0;
  background: var(--bm-bg);
  color: var(--bm-text);
  font-family: var(--bm-font);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  letter-spacing: normal;
}
.bm-modal[hidden] { display: none !important; }
.bm-modal * { box-sizing: border-box; }

.bm-modal.bm-enter { animation: bm-fade-in 0.25s ease-out; }

@keyframes bm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bm-score-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.bm-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0.65rem clamp(0.75rem, 1.6vw, 1.25rem) 0.75rem;
  gap: 0.65rem;
  --bm-feed-scale: 1;
}

/* ---------- Header ---------- */
.bm-header {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  background: none;
  border: 0;
  /* Defend against host-page global `header {}` rules */
  position: static;
  max-height: none;
  min-height: 0;
  overflow: visible;
  z-index: auto;
  flex-wrap: nowrap;
  align-items: stretch;
}

.bm-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  min-height: 2.6rem;
}

.bm-header-left,
.bm-header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.bm-header-actions { flex-shrink: 0; }

.bm-badge {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 0;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1;
  background: var(--bm-teal);
  color: #04302b;
  white-space: nowrap;
}
.bm-badge[data-mode="full"] {
  background: var(--bm-red);
  color: var(--bm-white);
}

.bm-format {
  display: inline-block;
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--bm-white);
  white-space: nowrap;
}

.bm-gift-mode {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--bm-gold) 55%, transparent);
  background: color-mix(in srgb, var(--bm-gold) 16%, transparent);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
  color: var(--bm-gold);
  white-space: nowrap;
  max-width: min(18rem, 42vw);
  overflow: hidden;
  text-overflow: ellipsis;
}
.bm-gift-mode[hidden] { display: none !important; }

.bm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.55rem 1.05rem;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: normal;
  text-transform: none;
  background: #243149;
  color: var(--bm-white);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
  text-shadow: none;
}
.bm-btn:hover { background: #2e3d5a; }
.bm-btn.ghost {
  background: transparent;
  border: 1px solid #3d4d6b;
  color: var(--bm-text);
}
.bm-btn.ghost.is-audio-off {
  border-color: #9f1d2e;
  color: #fecaca;
  background: rgba(159, 29, 46, 0.18);
}
.bm-btn.ghost.is-audio-off:hover {
  background: rgba(159, 29, 46, 0.28);
}
.bm-btn.danger { background: #9f1d2e; }
.bm-btn.danger:hover { background: #b82438; }
.bm-btn.primary { background: var(--bm-red); }
.bm-btn.primary:hover { background: #ff4368; }

.bm-feed-scale {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0.15rem;
  border: 1px solid #3d4d6b;
  border-radius: 10px;
  background: rgba(21, 29, 46, 0.65);
  flex-shrink: 0;
}

.bm-scale-btn {
  min-width: 2.1rem;
  padding: 0.35rem 0.55rem;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

.bm-scale-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.bm-feed-scale-label {
  min-width: 3.1rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--bm-dim);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

/* Timer band — remaining clock + active power-ups */
.bm-header-timer {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.1rem;
  margin: 0;
  padding: 0.4rem 1rem 0.5rem;
  border: 1px solid var(--bm-border);
  border-radius: 14px;
  background: var(--bm-card);
  position: relative;
  overflow: visible;
  z-index: 5;
}

.bm-timer-main {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: center;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
}

.bm-timer-label {
  display: block;
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bm-dim);
  line-height: 1;
}

.bm-timer {
  display: block;
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  line-height: 1;
  letter-spacing: 0.03em;
  color: var(--bm-gold);
  text-shadow: none;
}

.bm-timer-fx {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  min-width: 0;
  max-width: min(100%, 42rem);
}
.bm-timer-fx[hidden] { display: none !important; }
.bm-timer-fx .bm-fx-chip {
  width: auto;
  min-width: 4.4rem;
  flex-direction: row;
  gap: 0.35rem;
  padding: 0.28rem 0.45rem;
}
.bm-timer-fx .bm-fx-meta {
  align-items: flex-start;
}

/* ---------- Stage ---------- */
.bm-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
}

.bm-players {
  display: grid;
  gap: 0.75rem;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0;
  align-content: stretch;
  align-items: stretch;
  list-style: none;
}
.bm-players[hidden],
.bm-shell.is-ended .bm-players { display: none !important; }

.bm-shell.is-ended .bm-scoreboard-bar,
.bm-shell.is-ended #bmTeamTabs {
  display: none !important;
}
.bm-shell.is-ended .bm-header-timer {
  display: none !important;
}
.bm-shell.is-ended {
  gap: 0.45rem;
}
.bm-shell.is-ended .bm-header {
  gap: 0;
}
.bm-shell.is-ended .bm-stage,
.bm-shell.is-ended .bm-end {
  flex: 1 1 auto;
  min-height: 0;
}

.bm-players[data-count="1"] {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
.bm-players[data-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
}
.bm-players[data-count="3"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
}
.bm-players[data-count="4"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

/* Multi-team columns / quarters — host first (top-left for 4) */
.bm-players.is-teams,
.bm-players[data-layout="teams"] {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
}
.bm-players.is-teams[data-team-count="2"],
.bm-players[data-layout="teams"][data-team-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
}
.bm-players.is-teams[data-team-count="3"],
.bm-players[data-layout="teams"][data-team-count="3"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
}
.bm-players.is-teams[data-team-count="4"],
.bm-players[data-layout="teams"][data-team-count="4"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}
.bm-team {
  display: flex;
  flex-direction: column;
  position: relative;
  gap: 0;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 0.45rem;
  border: 1px solid var(--bm-border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--bm-card) 88%, transparent);
  overflow: visible;
  align-items: stretch;
  --bm-team-accent: var(--bm-border);
}
.bm-team[data-team-index="0"] { --bm-team-accent: var(--bm-red); }
.bm-team[data-team-index="1"] { --bm-team-accent: #38bdf8; }
.bm-team[data-team-index="2"] { --bm-team-accent: #a78bfa; }
.bm-team[data-team-index="3"] { --bm-team-accent: #34d399; }
.bm-team:not(.is-host-team) {
  border-color: color-mix(in srgb, var(--bm-team-accent) 55%, var(--bm-border));
}
.bm-team[data-side="home"] { order: 0; }
.bm-team[data-side="away"] { order: 1; }
.bm-team.is-host-team {
  border-color: var(--bm-red);
  border-width: 2px;
  padding: calc(0.45rem - 1px);
}
.bm-team-main {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  min-height: 0;
  /* Content-sized roster only — do not steal height from the activity feed */
  flex: 0 0 auto;
  overflow: hidden;
}
.bm-team-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  padding: 0.25rem 0.45rem 0.35rem;
  border-bottom: 1px solid color-mix(in srgb, var(--bm-team-accent) 35%, transparent);
  position: relative;
  z-index: 1;
}
.bm-team-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
}
.bm-team-score {
  font-size: clamp(1.55rem, 3.2vw, 2.35rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--bm-white);
}
.bm-team-score.is-hidden {
  letter-spacing: 0.12em;
  opacity: 0.85;
}
.bm-team-players {
  display: grid;
  gap: 0.4rem;
  flex: 0 0 auto;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: repeat(2, auto);
}
.bm-team-players[data-members="1"] {
  grid-template-rows: auto;
}
.bm-team-players[data-members="2"] {
  grid-template-rows: repeat(2, auto);
}
.bm-team-players[data-members="3"] {
  grid-template-rows: repeat(3, auto);
}
.bm-team.is-solo-hero .bm-team-players[data-members="1"] {
  flex: 1 1 auto;
  grid-template-rows: minmax(0, 1fr);
}
.bm-team.is-solo-hero .bm-team-players[data-members="1"] .bm-player {
  min-height: 100%;
}
.bm-team.is-solo-hero .bm-player.is-team-slot .bm-avatar,
.bm-team.is-solo-hero .bm-player.is-team-slot .bm-avatar-wrap .bm-avatar {
  width: 64px;
  height: 64px;
  min-width: 64px;
  min-height: 64px;
}
.bm-team.is-solo-hero .bm-player.is-team-slot .bm-name {
  font-size: clamp(1.15rem, 2vw, 1.45rem);
}
.bm-team.is-solo-hero .bm-player.is-team-slot .bm-score {
  font-size: clamp(1.45rem, 2.6vw, 2rem);
}
.bm-team-players .bm-player {
  height: auto;
  min-height: 0;
  gap: 0.2rem;
  padding: 0.3rem 0.45rem;
}
.bm-team-players .bm-player.is-host {
  padding: calc(0.3rem - 1px) calc(0.45rem - 1px);
}
.bm-team-players[data-members="3"] .bm-player.is-team-slot {
  padding: 0.22rem 0.35rem;
}
.bm-team-players[data-members="3"] .bm-player.is-team-slot .bm-avatar,
.bm-team-players[data-members="3"] .bm-player.is-team-slot .bm-avatar-wrap .bm-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
}
.bm-team-players[data-members="3"] .bm-player.is-team-slot .bm-name {
  font-size: clamp(0.8rem, 1.1vw, 0.95rem);
}
.bm-team-players[data-members="3"] .bm-player.is-team-slot .bm-score {
  font-size: clamp(0.95rem, 1.4vw, 1.15rem);
}
/* Compact player header in team columns — individual score beside the team total */
.bm-player.is-team-slot .bm-player-hero {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.35rem;
  align-items: center;
}
.bm-player.is-team-slot .bm-avatar,
.bm-player.is-team-slot .bm-avatar-wrap .bm-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
}
.bm-player.is-team-slot .bm-avatar-fallback {
  font-size: 0.85rem;
}
.bm-player.is-team-slot .bm-name {
  font-size: clamp(0.88rem, 1.2vw, 1.05rem);
  line-height: 1.15;
}
.bm-player.is-team-slot .bm-handle {
  font-size: 0.68rem;
  margin-top: 0.02rem;
}
.bm-player.is-team-slot .bm-host-tag,
.bm-player.is-team-slot .bm-mist-tag {
  font-size: 0.58rem;
  padding: 0.06rem 0.3rem;
}
.bm-player.is-team-slot .bm-score {
  display: block;
  font-size: clamp(1rem, 1.6vw, 1.3rem);
  line-height: 1;
  min-width: 3.2ch;
}

/* Tap points live in the unified activity feed — no separate taps strip */
.bm-taps-block { display: none !important; }

.bm-team-feed {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0.15rem;
  padding: 0.35rem 0.4rem 0.45rem;
  border-top: 1px solid var(--bm-border-soft);
  overflow: hidden;
}
.bm-team-feed[hidden] { display: none !important; }
.bm-team-feed .bm-feed {
  flex: 1;
  min-height: 0;
}
/* Roster stays content-sized; activity feed takes the remaining column height */
.bm-team.is-feeds-merged .bm-team-main {
  flex: 0 0 auto;
}
.bm-team.is-feeds-merged .bm-team-players,
.bm-team.is-feeds-merged .bm-team-players[data-members="1"],
.bm-team.is-feeds-merged .bm-team-players[data-members="2"],
.bm-team.is-feeds-merged .bm-team-players[data-members="3"] {
  flex: 0 0 auto;
  grid-template-rows: none;
  grid-auto-rows: auto;
}
.bm-team.is-feeds-merged .bm-team-feed {
  flex: 1 1 auto;
  min-height: 0;
}
.bm-team.is-feeds-merged .bm-player-body,
.bm-player.is-feed-merged .bm-player-body {
  display: none !important;
}
.bm-team.is-solo-hero.is-feeds-merged .bm-team-players[data-members="1"] {
  flex: 0 1 auto;
  max-height: 38%;
}

/* ---------- Player card ---------- */
.bm-player {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
  margin: 0;
  padding: clamp(0.85rem, 1.2vw, 1.15rem);
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: var(--bm-card);
  border: 1px solid var(--bm-border);
  border-radius: 16px;
  overflow: visible;
  align-items: stretch;
}
.bm-player-main {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.bm-players[data-count="2"] .bm-player > .bm-side-fx {
  display: none !important;
}
.bm-player.is-team-slot {
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
  height: auto !important;
  min-height: 0 !important;
  flex: 0 0 auto;
  border-color: color-mix(in srgb, var(--bm-player-accent, var(--bm-border)) 55%, var(--bm-border));
}
.bm-player.is-team-slot .bm-avatar,
.bm-player.is-team-slot .bm-avatar-wrap .bm-avatar {
  border-color: color-mix(in srgb, var(--bm-player-accent, #3d4d6b) 80%, #3d4d6b);
}
.bm-player.is-team-slot > .bm-side-fx { display: none !important; }
.bm-player.is-team-slot > .bm-player-main {
  flex: 0 0 auto;
  min-height: 0;
}
.bm-player.is-lite-opp .bm-player-body {
  /* lite opponents still show tap feed; gifts/chat filtered in JS */
}
.bm-lite-opp-chip {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  margin: 0 0 0.35rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--bm-teal) 45%, var(--bm-border));
  background: color-mix(in srgb, var(--bm-teal) 12%, var(--bm-panel));
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--bm-teal);
  line-height: 1.2;
}
.bm-lite-opp-chip[hidden] { display: none !important; }
.bm-player-body[hidden] {
  display: none !important;
}
.bm-player.is-host {
  border-color: var(--bm-red);
  border-width: 2px;
  padding: calc(clamp(0.85rem, 1.2vw, 1.15rem) - 1px);
}
.bm-player.is-mist { opacity: 0.92; }

.bm-player-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}

.bm-avatar-wrap { margin: 0; padding: 0; flex-shrink: 0; }

.bm-avatar {
  display: block;
  width: clamp(72px, 6.5vw, 96px);
  height: clamp(72px, 6.5vw, 96px);
  min-width: clamp(72px, 6.5vw, 96px);
  min-height: clamp(72px, 6.5vw, 96px);
  margin: 0;
  padding: 0;
  border-radius: 50%;
  object-fit: cover;
  background: #22304a;
  border: 2px solid #3d4d6b;
  flex-shrink: 0;
}
.bm-avatar-sm {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-width: 1px;
}
.bm-avatar-fallback {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(1.4rem, 2vw, 1.85rem);
  color: var(--bm-text);
  text-align: center;
  line-height: 1;
}
.bm-avatar-sm.bm-avatar-fallback { font-size: 0.85rem; }

.bm-player-meta { margin: 0; padding: 0; min-width: 0; }

.bm-name-row {
  display: flex;
  align-items: center;
  gap: 0.35rem 0.5rem;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.bm-name {
  display: block;
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  line-height: 1.15;
  color: var(--bm-white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.bm-handle {
  display: block;
  margin: 0.2rem 0 0;
  padding: 0;
  font-family: inherit;
  font-size: clamp(0.95rem, 1.2vw, 1.1rem);
  font-weight: 600;
  color: var(--bm-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bm-score {
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--bm-white);
  text-align: right;
  min-width: 5rem;
}
.bm-score.bm-score-bump { animation: bm-score-bump 0.28s ease; }
.bm-score.is-hidden {
  letter-spacing: 0.14em;
  color: var(--bm-faint);
  filter: blur(1.5px);
}

.bm-host-tag,
.bm-mist-tag {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 0;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1;
}
.bm-host-tag { background: var(--bm-red); color: var(--bm-white); }
.bm-mist-tag { background: #5a6b85; color: var(--bm-white); }
/* `display` above beats the UA [hidden] rule — force hide */
.bm-host-tag[hidden],
.bm-mist-tag[hidden] {
  display: none !important;
}

/* Active booster chips — below team header so scores stay visible */
.bm-team-fx-toasts {
  position: static;
  z-index: 1;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.35rem;
  margin: 0;
  padding: 0 0.45rem 0.4rem;
  max-width: none;
  max-height: none;
  overflow: visible;
  pointer-events: none;
}
.bm-team.is-host-team .bm-team-fx-toasts,
.bm-team[data-side="home"] .bm-team-fx-toasts {
  justify-content: flex-start;
}
.bm-team[data-side="away"] .bm-team-fx-toasts {
  justify-content: flex-end;
}
.bm-team-fx-toasts[hidden] { display: none !important; }
.bm-team-fx-toasts .bm-fx-chip {
  pointer-events: auto;
  width: auto;
  min-width: 3.1rem;
  flex-direction: row;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
  background: color-mix(in srgb, var(--bm-panel) 94%, transparent);
}
.bm-team-fx-toasts .bm-fx-senders {
  pointer-events: none;
}

/* 1v1 / flat: booster row under avatar + score */
.bm-hero-fx {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.2rem 0 0;
  justify-content: flex-end;
}
.bm-player.is-host .bm-hero-fx,
.bm-player.is-host-side .bm-hero-fx {
  justify-content: flex-start;
}
.bm-hero-fx[hidden] { display: none !important; }
.bm-hero-fx .bm-fx-chip {
  width: auto;
  min-width: 3.1rem;
  flex-direction: row;
}
.bm-hero-fx .bm-fx-label { display: none; }

/* Legacy side strips — kept for DOM migration, hidden in 1v1 */
.bm-players[data-count="2"] .bm-player > .bm-side-fx[hidden] {
  display: none !important;
}

/* Active effect side strips — 1v1 flat cards only (team mode uses overlay toasts) */
.bm-side-fx,
.bm-active-fx {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0.25rem 0.2rem;
  flex-shrink: 0;
  width: clamp(4.6rem, 7vw, 5.6rem);
  min-height: 0;
  overflow: visible;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bm-panel) 88%, transparent);
  border: 1px solid var(--bm-border-soft);
  align-self: stretch;
}
.bm-side-fx[hidden],
.bm-active-fx[hidden] { display: none !important; }

.bm-fx-senders {
  position: absolute;
  left: calc(100% + 0.35rem);
  top: 0;
  right: auto;
  z-index: 40;
  width: min(14rem, 42vw);
  margin: 0;
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
  background: #0b1220;
  border: 1px solid var(--bm-border);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  text-align: left;
  pointer-events: none;
  transform: none;
  animation: bm-fade-in 0.18s ease;
}
/* Portaled onto .bm-modal — sits above teams, feed, timer, overflow clips */
.bm-fx-senders.bm-fx-senders--portal {
  position: fixed;
  left: 0;
  top: 0;
  right: auto;
  z-index: 100070;
  display: flex;
  flex-direction: column;
  width: min(15rem, 46vw);
  max-height: min(50vh, 16rem);
  overflow: hidden;
  pointer-events: auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}
.bm-fx-senders.bm-fx-senders--portal .bm-fx-senders-title {
  flex-shrink: 0;
}
.bm-fx-senders.bm-fx-senders--portal .bm-fx-senders-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}
.bm-fx-senders.bm-fx-senders--portal .bm-fx-senders-list::-webkit-scrollbar {
  width: 5px;
}
.bm-fx-senders.bm-fx-senders--portal .bm-fx-senders-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}
.bm-team[data-side="away"] .bm-fx-senders,
.bm-players[data-count="2"] .bm-player:last-child .bm-fx-senders {
  left: auto;
  right: calc(100% + 0.35rem);
}

/* FFA 3+: compact boosters beside the player name */
.bm-name-fx {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.28rem;
  margin: 0;
  padding: 0;
  max-width: 100%;
}
.bm-name-fx[hidden] { display: none !important; }
.bm-name-fx .bm-fx-chip {
  width: auto;
  min-width: 0;
  flex-direction: row;
  gap: 0.25rem;
  padding: 0.18rem 0.32rem;
}
.bm-name-fx .bm-fx-label { display: none; }
.bm-name-fx .bm-fx-icon,
.bm-name-fx .bm-fx-glyph {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 0.85rem;
}
.bm-name-fx .bm-fx-senders {
  left: 50%;
  right: auto;
  top: calc(100% + 0.3rem);
  transform: translateX(-50%);
  width: min(14rem, 70vw);
}

.bm-fx-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  margin: 0;
  padding: 0.3rem 0.25rem;
  border-radius: 10px;
  background: #0d1420;
  border: 1px solid var(--bm-gold);
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  cursor: pointer;
  font: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
}
.bm-fx-chip.bm-fx-side {
  gap: 0.12rem;
  padding: 0.28rem 0.28rem 0.32rem;
}
.bm-fx-amt {
  display: block;
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  color: var(--bm-gold);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.bm-fx-chip .bm-fx-time {
  display: block;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.1;
  color: var(--bm-dim);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.bm-fx-sender-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  min-width: 0;
  flex: 1;
}
.bm-fx-sender-meta strong {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bm-fx-sender-count {
  flex-shrink: 0;
  font-style: normal;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--bm-gold);
}
.bm-viewers {
  display: block;
  margin: 0.12rem 0 0;
  padding: 0;
  font-family: inherit;
  font-size: clamp(0.72rem, 1vw, 0.85rem);
  font-weight: 650;
  color: var(--bm-dim);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.bm-viewers[hidden] { display: none !important; }
.bm-player.is-team-slot .bm-viewers {
  font-size: 0.65rem;
  margin-top: 0.02rem;
}
.bm-feed-item.bm-feed-no-owner {
  grid-template-columns: auto auto minmax(0, 1fr);
}
.bm-fx-chip:hover,
.bm-fx-chip:focus-visible {
  border-color: var(--bm-white);
  outline: none;
  background: #152038;
}
.bm-fx-chip[data-kind="smoke"],
.bm-fx-chip[data-kind="mist"] { border-color: #7d8ea9; }
.bm-fx-chip[data-kind="extra_time"] { border-color: var(--bm-teal); }
.bm-fx-chip[data-kind="vault_glove"] { border-color: var(--bm-red); }

.bm-fx-icon,
.bm-fx-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
  background: #22304a;
  pointer-events: none;
}
.bm-fx-glyph { font-size: 1.05rem; line-height: 1; }

.bm-fx-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  margin: 0;
  padding: 0;
  min-width: 0;
  width: 100%;
  pointer-events: none;
}
.bm-fx-top {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
}
.bm-fx-label {
  display: block;
  margin: 0;
  font-family: inherit;
  font-size: 0.62rem;
  font-weight: 750;
  color: var(--bm-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.1;
}
.bm-fx-time-row {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
}
.bm-fx-time {
  display: inline-block;
  margin: 0;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--bm-gold);
  line-height: 1.1;
}
.bm-fx-mult {
  display: inline-block;
  margin: 0;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--bm-teal);
}
.bm-fx-user { display: none; }

.bm-fx-senders-title {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bm-dim);
}
.bm-fx-senders-empty {
  margin: 0;
  font-size: 0.78rem;
  color: var(--bm-faint);
}
.bm-fx-senders-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  max-height: 10rem;
  overflow: auto;
}
.bm-fx-senders-list li {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  margin: 0;
  padding: 0;
  font-size: 0.74rem;
  color: var(--bm-text);
  min-width: 0;
}
.bm-fx-senders-list .bm-avatar-xs {
  width: 14px;
  height: 14px;
  border-width: 1px;
  flex-shrink: 0;
}
.bm-fx-senders-list .bm-avatar-xs.bm-avatar-fallback {
  font-size: 0.48rem;
}
.bm-fx-senders-list span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bm-fx-senders-list em {
  font-style: normal;
  color: var(--bm-dim);
  font-size: 0.9em;
}

.bm-avatar-xs {
  width: 18px;
  height: 18px;
  border-width: 1px;
}
.bm-avatar-xs.bm-avatar-fallback { font-size: 0.6rem; }

/* ---------- Card body: single activity feed ---------- */
.bm-player-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.bm-feed-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  flex: 1;
  margin: 0;
  padding: 0.4rem 0.5rem 0.45rem;
  background: var(--bm-panel);
  border: 1px solid var(--bm-border-soft);
  border-radius: 12px;
}

.bm-panel-title,
.bm-section-label {
  display: block;
  margin: 0 0 0.3rem;
  padding: 0 0 0.25rem;
  border-bottom: 1px solid var(--bm-border-soft);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bm-dim);
  line-height: 1.2;
  flex-shrink: 0;
}

.bm-feed {
  display: flex;
  flex-direction: column;
  gap: calc(var(--bm-feed-gap) * var(--bm-feed-scale, 1));
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.bm-feed::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.bm-feed-item {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: calc(0.55rem * var(--bm-feed-scale, 1));
  margin: 0;
  padding: calc(0.4rem * var(--bm-feed-scale, 1)) calc(0.5rem * var(--bm-feed-scale, 1));
  font-family: inherit;
  font-size: calc(clamp(0.95rem, 1.2vw, 1.12rem) * var(--bm-feed-scale, 1));
  font-weight: 550;
  line-height: 1.35;
  color: var(--bm-text);
  min-width: 0;
  max-width: 100%;
  list-style: none;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bm-player-accent, #6b7d99) 12%, rgba(28, 39, 64, 0.62));
  border: 1px solid color-mix(in srgb, var(--bm-player-accent, transparent) 42%, transparent);
  border-left: 4px solid var(--bm-player-accent, var(--bm-border));
  overflow: visible;
  --bm-player-accent: var(--bm-border);
}

.bm-feed-item.bm-feed-row,
.bm-feed-item.bm-feed-compact,
.bm-feed-item.bm-feed-hero {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: start;
  gap: calc(0.55rem * var(--bm-feed-scale, 1));
  padding: calc(0.4rem * var(--bm-feed-scale, 1)) calc(0.5rem * var(--bm-feed-scale, 1));
  font-size: calc(clamp(0.95rem, 1.2vw, 1.12rem) * var(--bm-feed-scale, 1));
  border-width: 1px;
  border-left-width: 4px;
  flex-shrink: 0;
  box-sizing: border-box;
}
.bm-feed-gift-slot {
  display: inline-grid;
  place-items: center;
  align-self: stretch;
  flex-shrink: 0;
  min-height: calc(50px * var(--bm-feed-scale, 1));
}
.bm-feed-gift-slot .bm-rank {
  font-size: 0.78em;
  font-weight: 800;
  opacity: 0.8;
}
.bm-feed-item.bm-type-gift {
  /* player accent owns the tint; keep a light gift cue */
  box-shadow: inset 0 0 0 1px rgba(232, 121, 249, 0.12);
}
.bm-feed-item.bm-type-gift.is-new,
.bm-feed-item.bm-type-gift.bm-feed-hero.is-new {
  animation: bm-feed-flash-gift 3.4s ease-in-out 1;
}
.bm-feed-item.bm-type-booster {
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.16);
}
.bm-feed-item.bm-type-booster.is-new,
.bm-feed-item.bm-type-booster.bm-feed-hero.is-new {
  animation: bm-feed-flash-boost 3.4s ease-in-out 1;
}
.bm-feed-item.bm-type-chat {
  opacity: 1;
}

.bm-feed-item.bm-type-army {
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.1);
}
.bm-feed-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  padding-top: 0.1rem;
  overflow: visible;
  color: var(--bm-text);
}
.bm-feed-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.35rem;
  min-width: 0;
  line-height: 1.3;
}
.bm-feed-verb {
  flex-shrink: 0;
  font-weight: 600;
  font-size: 0.92em;
  color: var(--bm-dim);
}
.bm-feed-target {
  font-weight: 750;
  color: var(--bm-player-accent, var(--bm-white));
  overflow-wrap: anywhere;
}
.bm-feed-inline {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.28rem;
  white-space: normal;
  overflow: visible;
}
.bm-feed-who {
  display: inline;
  flex-shrink: 1;
  min-width: 0;
  max-width: 100%;
  font-weight: 750;
  font-size: 1em;
  color: var(--bm-white);
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
}
.bm-feed-handle {
  flex-shrink: 1;
  min-width: 0;
  max-width: 8rem;
  font-weight: 600;
  font-size: 0.88em;
  color: var(--bm-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bm-feed-sep {
  flex-shrink: 0;
  opacity: 0.45;
  font-weight: 600;
}
.bm-feed-detail {
  display: block;
  min-width: 0;
  font-weight: 600;
  font-size: 0.95em;
  color: var(--bm-text);
  line-height: 1.4;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-overflow: unset;
}
.bm-gift-boost {
  display: inline-block;
  margin: 0 0 0 0.15rem;
  padding: 0;
  font-size: 1.05em;
  line-height: 1;
  vertical-align: -0.05em;
}
.bm-gift-mult {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 0 0.2rem;
  padding: 0.06rem 0.35rem;
  border-radius: 999px;
  font-size: 0.78em;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--bm-gold);
  background: color-mix(in srgb, var(--bm-gold) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--bm-gold) 42%, transparent);
  vertical-align: 0.05em;
}
.bm-feed-item.has-boost .bm-feed-detail {
  color: var(--bm-gold);
}
.bm-feed-chat-text {
  display: inline;
  word-break: break-word;
}
.bm-feed-chat-text .emote-inline {
  height: 1.35em;
  width: auto;
  max-width: 1.35em;
  max-height: 1.35em;
  vertical-align: middle;
  object-fit: contain;
  margin: 0 0.08em;
  display: inline-block;
}
.bm-feed-main strong {
  font-weight: 750;
  color: var(--bm-white);
}
.bm-feed-meta {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  font-size: 1em;
  color: var(--bm-white);
}

.bm-feed-owner {
  display: inline-flex;
  flex-shrink: 0;
  margin: 0;
  padding: 0.02rem 0.28rem;
  border-radius: 999px;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.8;
  background: rgba(255, 255, 255, 0.08);
  max-width: 5.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bm-feed-owner.is-host {
  color: var(--bm-red);
  opacity: 0.95;
  background: color-mix(in srgb, var(--bm-red) 18%, transparent);
}

.bm-tag {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.2;
}
.bm-feed-hero .bm-tag {
  min-width: 2.6rem;
  padding: 0.18rem 0.4rem;
  font-size: 0.65rem;
}
.bm-tag-gift { background: #3b1d4a; color: #f0abfc; }
.bm-tag-chat { background: #1e3a5f; color: #93c5fd; }
.bm-tag-booster { background: #3f2a12; color: #fbbf24; }
.bm-tag-army { background: #3f3510; color: #fde68a; min-width: 2rem; }

.bm-avatar-md {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  border-width: 1px;
}
.bm-avatar-md.bm-avatar-fallback { font-size: 0.65rem; }

.bm-feed-item .bm-avatar-sm,
.bm-feed-item .bm-feed-army,
.bm-feed-item .bm-feed-player {
  width: calc(50px * var(--bm-feed-scale, 1));
  height: calc(50px * var(--bm-feed-scale, 1));
  min-width: calc(50px * var(--bm-feed-scale, 1));
  min-height: calc(50px * var(--bm-feed-scale, 1));
  flex-shrink: 0;
  margin-top: 0;
  align-self: start;
  border-width: 2px;
}
.bm-top10-row.bm-feed-row .bm-avatar-sm {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-width: 1px;
}
.bm-feed-item .bm-feed-player {
  border-color: color-mix(in srgb, var(--bm-player-accent, #3d4d6b) 85%, #3d4d6b);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bm-player-accent, transparent) 35%, transparent);
}
.bm-feed-item .bm-avatar-sm.bm-avatar-fallback,
.bm-feed-item .bm-feed-army.bm-avatar-fallback,
.bm-feed-item .bm-feed-player.bm-avatar-fallback {
  font-size: calc(1.15rem * var(--bm-feed-scale, 1));
}

.bm-gift-icon,
.bm-feed-item .bm-event-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(40px * var(--bm-feed-scale, 1));
  height: calc(40px * var(--bm-feed-scale, 1));
  min-width: calc(40px * var(--bm-feed-scale, 1));
  min-height: calc(40px * var(--bm-feed-scale, 1));
  margin: 0;
  padding: 0.1rem;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 10px;
  background: #22304a;
  font-size: calc(1.1rem * var(--bm-feed-scale, 1));
  line-height: 1;
}
.bm-top10-row.bm-feed-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.4rem;
}
.bm-gift-icon-lg,
.bm-boost-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(20px * var(--bm-feed-scale, 1));
  height: calc(20px * var(--bm-feed-scale, 1));
  min-width: calc(20px * var(--bm-feed-scale, 1));
  min-height: calc(20px * var(--bm-feed-scale, 1));
  margin: 0;
  padding: 0.05rem;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 5px;
  background: #1a2438;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: calc(0.75rem * var(--bm-feed-scale, 1));
  line-height: 1;
}
.bm-boost-icon-sm {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  font-size: 0.7rem;
}
.bm-gift-fallback {
  color: #f0abfc;
}
.bm-boost-icon.bm-fx-glyph,
span.bm-boost-icon {
  background: #2a2110;
  border-color: rgba(251, 191, 36, 0.35);
}

@keyframes bm-feed-flash {
  0% {
    background: rgba(96, 165, 250, 0.38);
    border-color: rgba(147, 197, 253, 0.55);
  }
  35% {
    background: rgba(96, 165, 250, 0.22);
    border-color: rgba(147, 197, 253, 0.35);
  }
  70% {
    background: rgba(96, 165, 250, 0.12);
    border-color: rgba(147, 197, 253, 0.2);
  }
  100% {
    background: rgba(28, 39, 64, 0.55);
    border-color: transparent;
  }
}
@keyframes bm-feed-flash-army {
  0% {
    background: rgba(251, 191, 36, 0.42);
    border-color: rgba(251, 191, 36, 0.55);
  }
  40% {
    background: rgba(251, 191, 36, 0.22);
    border-color: rgba(251, 191, 36, 0.3);
  }
  100% {
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.18);
  }
}
@keyframes bm-feed-flash-gift {
  0% {
    background: rgba(232, 121, 249, 0.45);
    border-color: rgba(240, 171, 252, 0.75);
  }
  40% {
    background: rgba(168, 85, 247, 0.22);
    border-color: rgba(232, 121, 249, 0.45);
  }
  100% {
    background: rgba(168, 85, 247, 0.14);
    border-color: rgba(232, 121, 249, 0.35);
  }
}
@keyframes bm-feed-flash-boost {
  0% {
    background: rgba(251, 191, 36, 0.5);
    border-color: rgba(253, 224, 71, 0.85);
  }
  40% {
    background: rgba(251, 191, 36, 0.25);
    border-color: rgba(251, 191, 36, 0.5);
  }
  100% {
    background: rgba(251, 191, 36, 0.14);
    border-color: rgba(251, 191, 36, 0.4);
  }
}
.bm-feed-item.is-new {
  animation: bm-feed-flash 3.4s ease-in-out 1;
}
.bm-feed-item.bm-type-army.is-new {
  animation: bm-feed-flash-army 3.4s ease-in-out 1;
}

.bm-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 4rem;
  margin: 0;
  padding: 0.85rem 0.35rem;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--bm-faint);
  list-style: none;
  text-align: center;
}

/* Legacy army row helpers (end screen still uses similar markup) */
.bm-army-item {
  display: grid;
  grid-template-columns: 1.9rem auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.2rem 0.25rem;
  font-family: inherit;
  font-size: 0.95rem;
  border-radius: 7px;
  list-style: none;
}
.bm-army-item:first-child {
  background: rgba(251, 191, 36, 0.12);
  font-size: 1.02rem;
}
.bm-army-item:first-child .bm-rank { color: var(--bm-gold); }

.bm-rank {
  margin: 0;
  font-family: inherit;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--bm-dim);
}
.bm-army-name {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--bm-white);
  font-weight: 650;
}
.bm-army-score {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  color: var(--bm-white);
}

/* ---------- End screen (fit viewport — no page scroll) ---------- */
.bm-end {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
  width: 100%;
  margin: 0;
  padding: 0;
}
.bm-end[hidden] { display: none !important; }

.bm-end-card {
  width: 100%;
  margin: 0;
  padding: 1rem 1.15rem 1.1rem;
  background: var(--bm-card);
  border: 1px solid var(--bm-border);
  border-radius: 18px;
  text-align: center;
}
.bm-end-card.bm-end-enter {
  animation: bm-fade-in 0.3s ease;
}
.bm-end-card.bm-end-fit {
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.bm-end-hero {
  margin: 0 0 0.75rem;
  padding: 0;
  flex-shrink: 0;
}

.bm-end-title {
  display: block;
  margin: 0 0 0.25rem;
  padding: 0;
  font-family: inherit;
  font-size: clamp(1.65rem, 3.5vw, 2.35rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--bm-white);
}
.bm-end-reason {
  display: block;
  margin: 0 0 0.2rem;
  padding: 0;
  font-size: 0.95rem;
  color: var(--bm-dim);
}
.bm-winners {
  display: block;
  margin: 0;
  padding: 0;
  font-size: 1.02rem;
  color: var(--bm-text);
}
.bm-winners strong { color: var(--bm-gold); font-weight: 800; }

.bm-end-tabbar {
  display: none;
}

.bm-end-tabs,
.bm-end-subtabs {
  display: flex;
  align-items: stretch;
  gap: 0.12rem;
  min-width: 0;
}

.bm-end-subtabs {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.bm-end-subtabs::-webkit-scrollbar { display: none; }

.bm-end-tab,
.bm-end-subtab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 1.75rem;
  padding: 0.18rem 0.45rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  touch-action: manipulation;
}

.bm-end-subtab {
  flex: 1 0 auto;
  min-width: 4.5rem;
  font-size: 0.68rem;
}

.bm-end-tab[aria-selected="true"],
.bm-end-subtab[aria-selected="true"] {
  background: color-mix(in srgb, var(--bm-teal, #5eead4) 20%, var(--bm-panel));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bm-teal, #5eead4) 42%, transparent);
}

html.light-mode .bm-end-tab[aria-selected="true"],
html.light-mode .bm-end-subtab[aria-selected="true"] {
  background: color-mix(in srgb, var(--bm-teal, #0f766e) 16%, #fff);
}

.bm-end-tabbar[hidden],
.bm-end-subtabs[hidden],
.bm-end-col[hidden],
.bm-end-team-pane[hidden],
.bm-top10-group[hidden] {
  display: none !important;
}

.bm-end-team-pane {
  display: contents;
}
.bm-end-team-score {
  display: none;
}

.bm-end-tab-name,
.bm-end-tab-score {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bm-end-tab-score {
  font-size: 0.62rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  opacity: 0.78;
}

.bm-end-roster-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--bm-border-soft);
  background: color-mix(in srgb, var(--bm-panel) 80%, #000);
  font-size: 0.72rem;
  color: var(--bm-text);
}
.bm-end-roster-chip strong {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}
.bm-end-roster-chip.is-winner,
.bm-end-roster-chip.is-winner strong {
  color: var(--bm-gold);
  border-color: color-mix(in srgb, var(--bm-gold) 45%, var(--bm-border));
}

html.light-mode .bm-end-roster-chip {
  background: #eef0f4;
  color: var(--bm-text);
}

.bm-end-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(200px, 0.85fr) minmax(0, 1.35fr);
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  text-align: left;
  overflow: hidden;
}

.bm-end-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
  margin: 0;
  padding: 0;
  text-align: left;
}
.bm-end-grid-single {
  grid-template-columns: 1fr;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.bm-end-col {
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0.6rem 0.7rem;
  background: var(--bm-panel);
  border: 1px solid var(--bm-border-soft);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.bm-end-col.bm-end-supporters {
  overflow: hidden;
}
.bm-end-col.bm-end-supporters .bm-top10-groups,
.bm-end-col.bm-end-supporters .bm-top10-list {
  overflow: auto;
}

.bm-scoreboard {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
}
.bm-score-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.4rem 0.2rem;
  border-bottom: 1px solid var(--bm-border-soft);
  font-size: 1rem;
  color: var(--bm-text);
  list-style: none;
}
.bm-score-row:last-child { border-bottom: 0; }
.bm-score-row strong { font-weight: 800; color: var(--bm-white); margin-left: auto; }
.bm-score-row em {
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bm-faint);
}
.bm-score-row.is-winner,
.bm-score-row.is-winner strong,
.bm-score-row.is-winner em { color: var(--bm-gold); }

.bm-muted { color: var(--bm-faint); font-weight: 500; }

/* Army — full roster, scroll within the end column */
.bm-top10-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.55rem;
  max-height: none;
  overflow: auto;
  margin: 0;
  padding: 0 0.15rem 0.15rem 0;
  flex: 1;
  min-height: 0;
  align-content: start;
  scrollbar-width: thin;
}
.bm-top10-group {
  margin: 0;
  padding: 0.4rem 0.5rem;
  border-radius: 11px;
  background: #101828;
  border: 1px solid var(--bm-border-soft);
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
}
.bm-top10-group.is-host { border-color: var(--bm-red); }

.bm-award-group-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.35rem;
  padding: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--bm-white);
  flex-shrink: 0;
}
.bm-award-group-head strong { font-weight: 800; }
.bm-award-group-head .bm-muted {
  margin-left: auto;
  font-size: 0.75rem;
}

.bm-top10-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
  min-height: 0;
  flex: 1;
  scrollbar-width: thin;
}
.bm-top10-row {
  display: grid;
  grid-template-columns: 1.6rem auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.15rem 0.25rem;
  border-radius: 7px;
  font-size: 0.88rem;
  color: var(--bm-text);
  list-style: none;
  flex-shrink: 0;
}
.bm-top10-row.is-first {
  background: rgba(251, 191, 36, 0.12);
  font-size: 0.95rem;
}
.bm-top10-row.is-first .bm-rank { color: var(--bm-gold); }
.bm-top10-row strong { color: var(--bm-white); }
.bm-army-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bm-end-card .bm-btn {
  margin-top: 0.75rem;
  min-width: 9rem;
  font-size: 1rem;
  padding: 0.55rem 1.2rem;
  flex-shrink: 0;
  align-self: center;
}

.bm-end-multi .bm-end-layout {
  grid-template-columns: minmax(240px, 1fr) minmax(0, 1.2fr);
}
.bm-team-score-block {
  list-style: none;
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--bm-border-soft);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bm-panel) 70%, transparent);
}
.bm-team-score-block.is-winner {
  border-color: color-mix(in srgb, var(--bm-gold) 55%, var(--bm-border));
}
.bm-team-score-block.is-host-team {
  border-color: color-mix(in srgb, var(--bm-red) 45%, var(--bm-border));
}
.bm-team-score-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.92rem;
  font-weight: 700;
}
.bm-team-score-head strong {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}
.bm-team-score-head em {
  font-style: normal;
  font-size: 0.75rem;
  text-transform: uppercase;
  opacity: 0.7;
}
.bm-scoreboard-nested {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.bm-score-row-nested {
  font-size: 0.85rem;
  opacity: 0.95;
}
.bm-end-multi .bm-top10-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.45rem;
  overflow: auto;
  min-height: 0;
}

/* ---------- FAB ---------- */
.bm-fab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 99999;
  margin: 0;
  padding: 0.8rem 1.3rem;
  border: 0;
  border-radius: 999px;
  font-family: var(--bm-font);
  font-size: 1rem;
  font-weight: 800;
  background: var(--bm-red);
  color: var(--bm-white);
  box-shadow: 0 10px 26px rgba(254, 44, 85, 0.35);
  cursor: pointer;
}
.bm-fab[hidden] { display: none !important; }

/* Remote / TV shell — larger D-pad hit targets */
body.bm-tv .bm-btn,
body.bm-tv .bm-scale-btn,
body.bm-tv .bm-fab {
  min-height: 48px;
  min-width: 48px;
  padding: 0.7rem 1.15rem;
  font-size: 1rem;
}

body.bm-tv .bm-scale-btn {
  min-width: 48px;
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}

body.bm-tv .bm-fab {
  width: auto;
  padding: 0.85rem 1.25rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 1250px) {
  .bm-players[data-count="3"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .bm-avatar { width: clamp(64px, 7vw, 80px); height: clamp(64px, 7vw, 80px); }
  .bm-name { font-size: clamp(1.2rem, 2.2vw, 1.45rem); }
  .bm-score { font-size: clamp(2.1rem, 4.5vw, 2.8rem); }
  /* Keep compact team roster — don't inherit flat-card sizes */
  .bm-player.is-team-slot .bm-avatar,
  .bm-player.is-team-slot .bm-avatar-wrap .bm-avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
  }
  .bm-player.is-team-slot .bm-name {
    font-size: clamp(0.88rem, 1.2vw, 1.05rem);
  }
  .bm-player.is-team-slot .bm-score {
    font-size: clamp(1rem, 1.6vw, 1.3rem);
  }
}

@media (max-width: 980px) {
  .bm-end-grid,
  .bm-end-layout { grid-template-columns: 1fr; }
  body.bm-tv .bm-players[data-count="3"],
  body.bm-tv .bm-players[data-count="4"] {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    overflow: auto;
  }
  body.bm-tv .bm-players.is-teams,
  body.bm-tv .bm-players[data-layout="teams"],
  body.bm-tv .bm-players.is-teams[data-team-count="2"],
  body.bm-tv .bm-players.is-teams[data-team-count="3"],
  body.bm-tv .bm-players.is-teams[data-team-count="4"],
  body.bm-tv .bm-players[data-layout="teams"][data-team-count="2"],
  body.bm-tv .bm-players[data-layout="teams"][data-team-count="3"],
  body.bm-tv .bm-players[data-layout="teams"][data-team-count="4"] {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    overflow: auto;
  }
  body.bm-tv .bm-players.is-teams .bm-team,
  body.bm-tv .bm-players[data-layout="teams"] .bm-team {
    height: auto;
    min-height: min(42vh, 24rem);
    order: unset !important;
  }
  body.bm-tv .bm-players.is-teams .bm-team.is-host-team {
    order: -1 !important;
  }
  body.bm-tv .bm-players[data-count="3"] .bm-player,
  body.bm-tv .bm-players[data-count="4"] .bm-player {
    height: auto;
    min-height: min(52vh, 28rem);
  }
  body.bm-tv .bm-players.is-teams .bm-player.is-team-slot,
  body.bm-tv .bm-players[data-layout="teams"] .bm-player.is-team-slot {
    min-height: 0 !important;
    height: auto !important;
  }
}


/* Short viewports (720p and similar) — keep feed avatars readable, pack gaps */
@media (max-height: 820px) {
  :root { --bm-feed-gap: 0.14rem; }
  .bm-feed-block { padding: 0.25rem 0.35rem 0.3rem; }
  .bm-panel-title { font-size: 0.58rem; margin-bottom: 0.15rem; padding-bottom: 0.12rem; }
  .bm-feed-item,
  .bm-feed-item.bm-feed-compact,
  .bm-feed-item.bm-feed-hero,
  .bm-feed-item.bm-type-chat {
    padding: calc(0.28rem * var(--bm-feed-scale, 1)) calc(0.4rem * var(--bm-feed-scale, 1));
    font-size: calc(0.88rem * var(--bm-feed-scale, 1));
    gap: calc(0.4rem * var(--bm-feed-scale, 1));
  }
  .bm-feed-item .bm-avatar-sm,
  .bm-feed-item .bm-feed-army,
  .bm-feed-item .bm-feed-player {
    width: calc(44px * var(--bm-feed-scale, 1));
    height: calc(44px * var(--bm-feed-scale, 1));
    min-width: calc(44px * var(--bm-feed-scale, 1));
    min-height: calc(44px * var(--bm-feed-scale, 1));
  }
  .bm-feed-gift-slot {
    min-height: calc(44px * var(--bm-feed-scale, 1));
  }
  .bm-gift-icon,
  .bm-feed-item .bm-event-icon {
    width: calc(36px * var(--bm-feed-scale, 1));
    height: calc(36px * var(--bm-feed-scale, 1));
    min-width: calc(36px * var(--bm-feed-scale, 1));
    min-height: calc(36px * var(--bm-feed-scale, 1));
    font-size: calc(1rem * var(--bm-feed-scale, 1));
  }
  .bm-gift-icon-lg,
  .bm-boost-icon,
  .bm-boost-icon-sm {
    width: calc(20px * var(--bm-feed-scale, 1));
    height: calc(20px * var(--bm-feed-scale, 1));
    min-width: calc(20px * var(--bm-feed-scale, 1));
    min-height: calc(20px * var(--bm-feed-scale, 1));
    font-size: calc(0.7rem * var(--bm-feed-scale, 1));
  }
  .bm-team-feed { padding: 0.2rem 0.25rem 0.25rem; }
}

/* ---------- Light mode (Full + Lite share this HUD) ---------- */
html.light-mode {
  --bm-bg: #e6e8ee;
  --bm-card: #f5f6f9;
  --bm-panel: #eef0f4;
  --bm-border: #c5cbd6;
  --bm-border-soft: #d5dae3;
  --bm-white: #ffffff;
  --bm-text: #1a1f2c;
  --bm-dim: #4b5568;
  --bm-faint: #6b7280;
  --bm-red: #e11d48;
  --bm-teal: #0f766e;
  --bm-gold: #b45309;
}

html.light-mode .bm-btn {
  background: #d8dde7;
  color: var(--bm-text);
}
html.light-mode .bm-btn:hover {
  background: #c9d0dc;
}
html.light-mode .bm-btn.ghost {
  border-color: var(--bm-border);
  color: var(--bm-text);
}
html.light-mode .bm-btn.ghost.is-audio-off {
  border-color: #be123c;
  color: #9f1239;
  background: rgba(225, 29, 72, 0.1);
}
html.light-mode .bm-btn.ghost.is-audio-off:hover {
  background: rgba(225, 29, 72, 0.18);
}
html.light-mode .bm-btn.danger {
  background: #be123c;
  color: #fff;
}
html.light-mode .bm-btn.danger:hover {
  background: #e11d48;
}
html.light-mode .bm-btn.primary {
  color: #fff;
}
html.light-mode .bm-btn.primary:hover {
  background: #fb7185;
}

html.light-mode .bm-feed-scale {
  border-color: var(--bm-border);
  background: rgba(255, 255, 255, 0.72);
}

html.light-mode .bm-format,
html.light-mode .bm-timer,
html.light-mode .bm-name,
html.light-mode .bm-score,
html.light-mode .bm-team-score,
html.light-mode .bm-feed-who,
html.light-mode .bm-feed-detail strong,
html.light-mode .bm-feed-meta,
html.light-mode .bm-feed-coins,
html.light-mode .bm-end-title,
html.light-mode .bm-end-sub,
html.light-mode .bm-award-group-head,
html.light-mode .bm-score-row strong,
html.light-mode .bm-top10-row strong,
html.light-mode .bm-army-name,
html.light-mode .bm-army-score,
html.light-mode .bm-fx-label,
html.light-mode .bm-fx-time,
html.light-mode .bm-fx-mult,
html.light-mode .bm-panel-title {
  color: var(--bm-text);
}

html.light-mode .bm-badge[data-mode="full"] {
  color: #fff;
}

html.light-mode .bm-host-tag,
html.light-mode .bm-mist-tag,
html.light-mode .bm-fab {
  color: #fff;
}

html.light-mode .bm-avatar {
  background: #d5dae3;
  border-color: var(--bm-border);
}

html.light-mode .bm-fx-senders,
html.light-mode .bm-fx-senders.bm-fx-senders--portal {
  background: #f8f9fc;
  border-color: var(--bm-border);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}

html.light-mode .bm-fx-chip {
  background: #e8ebf2;
}
html.light-mode .bm-fx-chip:hover,
html.light-mode .bm-fx-chip:focus-visible {
  background: #dde2ec;
  border-color: var(--bm-text);
}
html.light-mode .bm-fx-icon,
html.light-mode .bm-fx-glyph {
  background: #d8dde7;
}
html.light-mode .bm-fx-amt,
html.light-mode .bm-fx-sender-count {
  color: #b45309;
}
html.light-mode .bm-viewers {
  color: var(--bm-dim);
}

html.light-mode .bm-feed-item {
  background: color-mix(in srgb, var(--bm-player-accent, #64748b) 12%, rgba(255, 255, 255, 0.94));
}

html.light-mode .bm-feed-owner {
  background: rgba(15, 23, 42, 0.06);
  color: var(--bm-dim);
}

html.light-mode .bm-tag-gift {
  background: #f3e8ff;
  color: #7e22ce;
}
html.light-mode .bm-tag-chat {
  background: #dbeafe;
  color: #1d4ed8;
}
html.light-mode .bm-tag-booster {
  background: #fef3c7;
  color: #b45309;
}
html.light-mode .bm-tag-army {
  background: #fef9c3;
  color: #a16207;
}

html.light-mode .bm-gift-icon,
html.light-mode .bm-boost-icon,
html.light-mode .bm-feed-item .bm-event-icon {
  background: #e8ebf2;
  border-color: rgba(15, 23, 42, 0.08);
}
html.light-mode .bm-gift-fallback {
  color: #9333ea;
}
html.light-mode .bm-boost-icon.bm-fx-glyph,
html.light-mode span.bm-boost-icon {
  background: #fff7ed;
  border-color: rgba(180, 83, 9, 0.35);
}

html.light-mode .bm-top10-group {
  background: #f8f9fc;
}

html.light-mode .bm-fab {
  box-shadow: 0 10px 26px rgba(225, 29, 72, 0.28);
}

html.light-mode .bm-feed-item.is-new,
html.light-mode .bm-feed-item.bm-feed-hero.is-new {
  animation-name: bm-feed-flash-light;
}
html.light-mode .bm-feed-item.bm-type-army.is-new {
  animation-name: bm-feed-flash-army;
}
html.light-mode .bm-feed-item.bm-type-gift.is-new,
html.light-mode .bm-feed-item.bm-type-gift.bm-feed-hero.is-new {
  animation-name: bm-feed-flash-gift;
}
html.light-mode .bm-feed-item.bm-type-booster.is-new,
html.light-mode .bm-feed-item.bm-type-booster.bm-feed-hero.is-new {
  animation-name: bm-feed-flash-boost;
}

@keyframes bm-feed-flash-light {
  0% {
    background: rgba(59, 130, 246, 0.28);
    border-color: rgba(37, 99, 235, 0.45);
  }
  35% {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(37, 99, 235, 0.28);
  }
  70% {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(37, 99, 235, 0.16);
  }
  100% {
    background: color-mix(in srgb, var(--bm-player-accent, #64748b) 12%, rgba(255, 255, 255, 0.94));
    border-color: color-mix(in srgb, var(--bm-player-accent, transparent) 42%, transparent);
  }
}

/* ---------- Score strip + mobile team swipe ---------- */
.bm-scoreboard-bar {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 0 0 auto;
  min-width: 0;
}

.bm-scoreboard-bar[hidden] {
  display: none !important;
}

.bm-score-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 0.35rem 0.5rem;
  padding: 0.35rem 0.55rem;
  border-radius: 12px;
  border: 1px solid var(--bm-border);
  background: color-mix(in srgb, var(--bm-card) 92%, #000);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-variant-numeric: tabular-nums;
}

.bm-score-strip-part {
  font-size: clamp(1.15rem, 4.5vw, 1.75rem);
  font-weight: 800;
  color: var(--bm-white);
  white-space: nowrap;
}

.bm-score-strip-sep {
  font-size: clamp(0.85rem, 3vw, 1rem);
  font-weight: 700;
  color: var(--bm-dim);
  padding: 0 0.1rem;
}

.bm-team-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.1rem;
}

.bm-team-tabs[hidden] {
  display: none !important;
}

.bm-team-tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--bm-border);
  border-radius: 999px;
  background: var(--bm-panel);
  color: var(--bm-text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.bm-team-tab[aria-selected="true"] {
  border-color: color-mix(in srgb, var(--bm-teal) 55%, var(--bm-border));
  background: color-mix(in srgb, var(--bm-teal) 14%, var(--bm-panel));
}

@media (max-width: 980px) {
  .bm-modal {
    height: 100dvh;
    max-height: 100dvh;
    padding-top: max(0.35rem, env(safe-area-inset-top, 0px));
    padding-bottom: max(0.35rem, env(safe-area-inset-bottom, 0px));
  }

  .bm-shell {
    padding-left: max(0.55rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.55rem, env(safe-area-inset-right, 0px));
  }

  .bm-header-actions .bm-feed-scale {
    display: none !important;
  }

  .bm-btn.ghost,
  .bm-btn.danger,
  .bm-scale-btn {
    min-height: 44px;
    min-width: 44px;
  }

  .bm-fab {
    bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
    right: max(0.85rem, env(safe-area-inset-right, 0px));
  }

  /* Phone: icon-only — the word “Battle” does not fit a 3rem round control. */
  body:not(.bm-tv) .bm-fab {
    width: 3rem;
    height: 3rem;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    line-height: 0;
    display: grid;
    place-items: center;
  }

  body:not(.bm-tv) .bm-fab::before {
    content: '⚔️';
    font-size: 1.4rem;
    line-height: 1;
  }

  .bm-players.bm-mobile-swipe {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    grid-template-columns: unset !important;
    grid-template-rows: unset !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    gap: 0.5rem;
  }

  .bm-players.bm-mobile-swipe > .bm-team,
  .bm-players.bm-mobile-swipe > .bm-player {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
    min-height: 0 !important;
    height: auto !important;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .bm-players.bm-mobile-swipe .bm-player .bm-score,
  .bm-players.bm-mobile-swipe .bm-player.is-team-slot .bm-score {
    display: none !important;
  }

  .bm-players[data-count="2"] {
    grid-template-columns: unset;
    grid-template-rows: unset;
    overflow: auto;
  }

  .bm-players[data-count="2"] .bm-player {
    min-height: 0;
  }

  /* Stream Base phone layout — single 799px breakpoint, swipe panes (not 980px stack) */
  body:not(.bm-tv) .bm-modal { font-size: 16px; }

  body:not(.bm-tv) .bm-header-bar {
    flex-wrap: nowrap;
    gap: 0.45rem;
  }
  body:not(.bm-tv) .bm-header-left {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    justify-content: flex-start;
  }
  body:not(.bm-tv) .bm-header-actions {
    flex: 0 0 auto;
    width: auto;
    gap: 0.35rem;
    justify-content: flex-end;
  }
  body:not(.bm-tv) .bm-format,
  body:not(.bm-tv) .bm-gift-mode {
    display: none !important;
  }
  body:not(.bm-tv) .bm-header-timer {
    padding: 0.28rem 0.65rem 0.35rem;
  }
  body:not(.bm-tv) .bm-timer {
    font-size: clamp(1.75rem, 9vw, 2.4rem);
  }
  body:not(.bm-tv) #bmMinimizeBtn,
  body:not(.bm-tv) #bmCancelBtn {
    font-size: 0;
    padding: 0.45rem;
    min-width: 44px;
    min-height: 44px;
    position: relative;
  }
  body:not(.bm-tv) #bmMinimizeBtn::after {
    content: '−';
    font-size: 1.15rem;
    line-height: 1;
  }
  body:not(.bm-tv) #bmCancelBtn::after {
    content: '✕';
    font-size: 0.95rem;
    line-height: 1;
  }

  body:not(.bm-tv) .bm-players.bm-mobile-swipe[data-count="3"],
  body:not(.bm-tv) .bm-players.bm-mobile-swipe[data-count="4"],
  body:not(.bm-tv) .bm-players.bm-mobile-swipe.is-teams,
  body:not(.bm-tv) .bm-players.bm-mobile-swipe[data-layout="teams"],
  body:not(.bm-tv) .bm-players.bm-mobile-swipe.is-teams[data-team-count="2"],
  body:not(.bm-tv) .bm-players.bm-mobile-swipe.is-teams[data-team-count="3"],
  body:not(.bm-tv) .bm-players.bm-mobile-swipe.is-teams[data-team-count="4"],
  body:not(.bm-tv) .bm-players.bm-mobile-swipe[data-layout="teams"][data-team-count="2"],
  body:not(.bm-tv) .bm-players.bm-mobile-swipe[data-layout="teams"][data-team-count="3"],
  body:not(.bm-tv) .bm-players.bm-mobile-swipe[data-layout="teams"][data-team-count="4"] {
    grid-template-columns: unset !important;
    grid-template-rows: unset !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }
  body:not(.bm-tv) .bm-players.bm-mobile-swipe .bm-team,
  body:not(.bm-tv) .bm-players.bm-mobile-swipe[data-count="3"] .bm-player,
  body:not(.bm-tv) .bm-players.bm-mobile-swipe[data-count="4"] .bm-player {
    height: auto !important;
    min-height: 0 !important;
    order: unset !important;
  }

  body:not(.bm-tv) .bm-player-hero {
    grid-template-columns: auto minmax(0, 1fr);
  }
  body:not(.bm-tv) .bm-players:not(.bm-mobile-swipe) .bm-score {
    grid-column: 1 / -1;
    text-align: left;
    margin-top: 0.15rem;
    font-size: clamp(2rem, 9vw, 2.6rem);
  }
  body:not(.bm-tv) .bm-player.is-team-slot .bm-score {
    grid-column: auto;
    text-align: right;
    margin-top: 0;
    font-size: clamp(1rem, 1.6vw, 1.3rem);
  }
  body:not(.bm-tv) .bm-avatar { width: 64px; height: 64px; }
  body:not(.bm-tv) .bm-player.is-team-slot .bm-avatar,
  body:not(.bm-tv) .bm-player.is-team-slot .bm-avatar-wrap .bm-avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
  }
  body:not(.bm-tv) .bm-avatar-sm { width: 22px; height: 22px; }
  body:not(.bm-tv) .bm-feed-item .bm-avatar-sm,
  body:not(.bm-tv) .bm-feed-item .bm-feed-army,
  body:not(.bm-tv) .bm-feed-item .bm-feed-player {
    width: calc(42px * var(--bm-feed-scale, 1));
    height: calc(42px * var(--bm-feed-scale, 1));
    min-width: calc(42px * var(--bm-feed-scale, 1));
    min-height: calc(42px * var(--bm-feed-scale, 1));
  }
  body:not(.bm-tv) .bm-feed-gift-slot {
    min-height: calc(42px * var(--bm-feed-scale, 1));
  }
  body:not(.bm-tv) .bm-gift-icon,
  body:not(.bm-tv) .bm-feed-item .bm-event-icon {
    width: calc(34px * var(--bm-feed-scale, 1));
    height: calc(34px * var(--bm-feed-scale, 1));
    min-width: calc(34px * var(--bm-feed-scale, 1));
    min-height: calc(34px * var(--bm-feed-scale, 1));
    font-size: calc(0.95rem * var(--bm-feed-scale, 1));
  }
  body:not(.bm-tv) .bm-gift-icon-lg,
  body:not(.bm-tv) .bm-boost-icon {
    width: calc(24px * var(--bm-feed-scale, 1));
    height: calc(24px * var(--bm-feed-scale, 1));
    min-width: calc(24px * var(--bm-feed-scale, 1));
    min-height: calc(24px * var(--bm-feed-scale, 1));
    font-size: calc(0.85rem * var(--bm-feed-scale, 1));
  }
  body:not(.bm-tv) .bm-feed-item {
    font-size: calc(0.85rem * var(--bm-feed-scale, 1));
    padding: calc(0.3rem * var(--bm-feed-scale, 1)) calc(0.4rem * var(--bm-feed-scale, 1));
  }
  body:not(.bm-tv) .bm-feed-item.bm-feed-hero {
    font-size: calc(0.88rem * var(--bm-feed-scale, 1));
    padding: calc(0.3rem * var(--bm-feed-scale, 1)) calc(0.4rem * var(--bm-feed-scale, 1));
  }

  body:not(.bm-tv) .bm-fx-senders.bm-fx-senders--portal.bm-fx-senders--sheet {
    left: max(0.5rem, env(safe-area-inset-left, 0px)) !important;
    right: max(0.5rem, env(safe-area-inset-right, 0px)) !important;
    bottom: max(0.5rem, env(safe-area-inset-bottom, 0px)) !important;
    top: auto !important;
    width: auto !important;
    max-width: none;
    max-height: min(45vh, 18rem);
    border-radius: 14px;
  }

  body:not(.bm-tv) .bm-shell.is-ended {
    gap: 0.3rem;
    padding-top: max(0.35rem, env(safe-area-inset-top, 0px));
    padding-bottom: max(0.35rem, env(safe-area-inset-bottom, 0px));
  }
  body:not(.bm-tv) .bm-shell.is-ended .bm-header-bar {
    min-height: 0;
  }
  body:not(.bm-tv) .bm-shell.is-ended .bm-end,
  body:not(.bm-tv) .bm-shell.is-ended .bm-end-card {
    flex: 1 1 auto;
    height: 100%;
    max-height: 100%;
    min-height: 0;
  }
  body:not(.bm-tv) .bm-end-card {
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
    padding: 0.65rem 0.7rem 0.55rem;
  }
  body:not(.bm-tv) .bm-end-tabbar {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
    flex: 0 0 auto;
    margin: 0 0 0.45rem;
  }
  body:not(.bm-tv) .bm-end-tabs,
  body:not(.bm-tv) .bm-end-subtabs {
    padding: 0.14rem;
    border: 1px solid var(--bm-border);
    border-radius: 10px;
    background: color-mix(in srgb, var(--bm-panel) 88%, #000);
  }
  html.light-mode body:not(.bm-tv) .bm-end-tabs,
  html.light-mode body:not(.bm-tv) .bm-end-subtabs {
    background: #eef0f4;
  }
  body:not(.bm-tv) .bm-end-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 2.2rem;
    padding: 0.18rem 0.28rem;
    white-space: normal;
    line-height: 1.15;
  }
  body:not(.bm-tv) .bm-end-subtabs {
    flex-wrap: wrap;
    overflow: visible;
    gap: 0.1rem;
  }
  body:not(.bm-tv) .bm-end-subtab {
    flex: 1 1 calc(50% - 0.1rem);
    min-width: 0;
    max-width: calc(50% - 0.1rem);
    min-height: 1.7rem;
    font-size: 0.62rem;
    padding: 0.14rem 0.28rem;
  }
  body:not(.bm-tv) .bm-end-layout,
  body:not(.bm-tv) .bm-end-multi .bm-end-layout {
    display: flex;
    flex-direction: column;
    grid-template-columns: unset;
    overflow: hidden;
    flex: 1;
    min-height: 0;
    gap: 0;
  }
  body:not(.bm-tv) .bm-end-col {
    flex: 1;
    min-height: 0;
    padding: 0.45rem 0.5rem;
  }
  body:not(.bm-tv) .bm-end-tabbed .bm-section-label {
    display: none;
  }
  body:not(.bm-tv) .bm-end-team-pane {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }
  body:not(.bm-tv) .bm-end-team-score {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin: 0 0 0.4rem;
    flex: 0 0 auto;
  }
  body:not(.bm-tv) .bm-end-supporters .bm-top10-groups,
  body:not(.bm-tv) .bm-end-multi .bm-top10-groups {
    display: flex;
    flex-direction: column;
    grid-template-columns: unset;
    overflow: hidden;
  }
  body:not(.bm-tv) .bm-end-supporters .bm-top10-groups.is-subtabbed .bm-top10-group {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    height: auto;
  }
  body:not(.bm-tv) .bm-end-hero {
    margin-bottom: 0.4rem;
  }
  body:not(.bm-tv) .bm-end-title {
    font-size: clamp(1.25rem, 5.5vw, 1.65rem);
  }
  body:not(.bm-tv) #bmCloseEndBtn {
    position: sticky;
    bottom: 0;
    margin-top: 0.45rem;
    z-index: 2;
    align-self: stretch;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
  }
}

