/* =============================================================================
   SHARED STYLESHEET - /partials/styles.css
   Used across all pages (leaderboards, matches, profiles, etc).
   Depends on the "Inter" Google Font being linked in <head>:
     <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700;800&display=swap" rel="stylesheet">
   ============================================================================= */

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Design tokens ────────────────────────────────────────────────────────────
   Central place for colors/spacing/fonts. Change a value here and it updates
   everywhere the variable is used, across every page that links this file. */
:root {
  /* backgrounds */
  --bg:       #0a0d10;  /* page background */
  --surface:  #141a1e;  /* card / panel background */
  --surface2: #1a2126;  /* slightly lighter surface, e.g. table headers */

  /* borders */
  --border:   rgba(255,255,255,.07);  /* standard hairline border */
  --border2:  rgba(255,255,255,.05);  /* subtler border, e.g. table row dividers */

  /* text */
  --text:     #e6f2f5;  /* primary text */
  --muted:    #7c96a0;  /* secondary text */
  --muted2:   #4e6771;  /* tertiary / label text */

  /* accent + status colors */
  --accent:        #ffff00;
  --accent-dim:    rgba(255,204,0,.12);
  --accent-border: rgba(255,204,0,.3);
  --green:  #6fcf97;  /* positive values, e.g. K/D ratio */
  --gold:   #c5922a;  /* rank #1 */
  --silver: #7a8898;  /* rank #2 */
  --bronze: #8a5c2e;  /* rank #3 */

  /* shape */
  --r: 8px;  /* standard border-radius for cards/panels */

  /* fonts */
  /* NOTE: --mono is no longer an actual monospace stack. It used to be
     (ui-monospace, SFMono-Regular, Menlo, Consolas, monospace), but every
     one of those renders "0" with a diagonal slash through it, which reads
     as a typo/ugly at the sizes we use it (table headers, stat numbers,
     player IDs, timestamps, etc). Rather than hunt down and edit the 90+
     `font-family: var(--mono)` rules across this file one by one, we just
     point the variable at Inter instead - same variable name so nothing
     else has to change, but zeros are now plain zeros everywhere.
     Do NOT point this back at a real monospace font. If a specific rule
     ever genuinely needs monospace/tabular alignment, set that font-family
     explicitly on that one rule - don't reintroduce it here. */
  --mono: 'Inter', sans-serif;  /* used for numbers, labels, codes */
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
html {
  font-size: 15px;
  scroll-behavior: smooth;
  height: 100%;
}
body {
  position: relative;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* =============================================================================
   TOP NAV
   Sticky bar loaded via /partials/nav.js into #nav-placeholder.
   ============================================================================= */
.topbar-outer {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(19,21,26,.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.topbar {
  height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 24px; /* matches .page's side padding so content lines up */
  width: 100%;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 30px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}
.brand-name {
  font-weight: 620;
  font-size: 1.24rem;
  color: var(--text);
  letter-spacing: -.01em;
}
.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  overflow-x: auto;
}
.nav-links::-webkit-scrollbar { height: 0; } /* hide scrollbar, keep swipe on mobile */
.nav-link {
  padding: 0 16px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  font-size: .98rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,.05); }
.nav-link.active { color: var(--text); font-weight: 500; }

/* ── Nav dropdowns (Leaderboards, Updates) ─────────────────────────────────── */
.nav-dropdown { position: relative; flex-shrink: 0; }
.nav-link-dd {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  gap: 5px;
}
.nav-dd-caret { transition: transform .15s; flex-shrink: 0; width: 11px; height: 11px; }
.nav-dropdown.open .nav-dd-caret { transform: rotate(180deg); }
.nav-dd-menu {
  display: none;
  position: fixed;
  min-width: 178px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 12px 28px rgba(0,0,0,.35);
  padding: 6px;
  flex-direction: column;
  gap: 2px;
  z-index: 200;
}
.nav-dropdown.open .nav-dd-menu { display: flex; }

/* ── Hamburger toggle (mobile only — hidden on desktop below) ── */
.nav-hamburger {
  display: none;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-direction: column;
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  margin-left: auto;
  padding: 0;
}
.nav-hamburger-bar {
  width: 17px;
  height: 2px;
  background: var(--muted);
  border-radius: 2px;
  transition: transform .18s ease, opacity .18s ease, background .18s ease;
}
.nav-hamburger:hover .nav-hamburger-bar { background: var(--text); }
.nav-hamburger.open .nav-hamburger-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open .nav-hamburger-bar:nth-child(2) { opacity: 0; }
.nav-hamburger.open .nav-hamburger-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-dd-item {
  padding: 10px 13px;
  border-radius: 5px;
  font-size: .9rem;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s, background .15s;
}
.nav-dd-item:hover { color: var(--text); background: rgba(255,255,255,.05); }
.nav-dd-item.active { color: var(--text); font-weight: 500; background: var(--accent-dim); }
/* =============================================================================
   PAGE SHELL
   Every page's main content should sit inside <main class="page">.
   ============================================================================= */
.page {
    max-width: 1060px;
    margin: 0 auto;
    padding: 28px 24px 60px;
    animation: fadeUp .22s ease;
    flex: 1 0 auto;   /* grow to push footer down, never shrink below content */
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.page-header { margin-bottom: 20px; }
.page-eyebrow {
  font-family: var(--mono); font-size: .68rem; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 6px;
}
.page-title {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -.01em;
  margin-bottom: 3px;
}
.page-sub { font-size: .78rem; color: var(--muted); }

/* =============================================================================
   SERVER FILTER BAR
   Row of pill buttons for filtering by server. Hidden by default (.visible
   is toggled on via JS once there's more than one server to filter by).
   ============================================================================= */
.server-bar {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.server-bar.visible { display: flex; }
.server-bar-label {
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.server-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.server-pill {
  padding: 4px 12px;
  font-size: .74rem;
  font-family: var(--mono);
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  transition: all .15s;
}
.server-pill:hover { color: var(--text); border-color: rgba(255,255,255,.15); }
.server-pill.active {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-dim);
}

/* =============================================================================
   TABS
   Generic tab-row pattern, reusable anywhere (leaderboard categories, profile
   sections, etc).
   ============================================================================= */
.tab-row {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  overflow-x: auto;
  flex-wrap: wrap;
}
.tab-row::-webkit-scrollbar { height: 0; }
.tab-btn {
  padding: 0 14px;
  height: 34px;
  font-size: .78rem;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  color: var(--muted);
  border-radius: 5px;
  white-space: nowrap;
  transition: color .15s, background .15s, border-color .15s;
}
.tab-btn:hover { color: var(--text); border-color: rgba(255,255,255,.15); }
.tab-btn.active {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-dim);
  font-weight: 500;
}

/* =============================================================================
   PANEL / CARD (e.g. leaderboard wrapper, any boxed content section)
   ============================================================================= */
.lb-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.lb-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border2);
  flex-wrap: wrap;
  gap: 8px;
  background: var(--surface2);
}
.lb-meta-title {
  font-size: .82rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -.01em;
}
.lb-meta-note { font-family: var(--mono); font-size: .74rem; color: var(--muted); }
.lb-meta-refresh { font-family: var(--mono); font-size: .72rem; color: var(--muted); }

/* =============================================================================
   TABLE
   Generic data table styling - used for leaderboards, and reusable for any
   other tabular data (match history, player lists, etc).
   ============================================================================= */
.table-scroll { overflow-x: auto; flex: 1; display: flex; flex-direction: column; }
.table-scroll > table { flex-shrink: 0; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
thead tr { background: var(--surface2); }
th {
  padding: 10px 16px;
  text-align: left;
  font-family: var(--mono);
  font-size: .63rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted2);
  border-bottom: 1px solid var(--border2);
  white-space: nowrap;
}
th.num, td.num { text-align: right; white-space: nowrap; }
th.center, td.center { text-align: center; white-space: nowrap; }
tr.row-click { cursor: pointer; }
tr.row-click:hover { background: rgba(255,255,255,.03); }

/* Stat columns (Matches/Rank/Level/Achievements) on the player search table:
   no fixed widths, so a long rank name (e.g. "Lieutenant") or a large XP/
   achievement number can grow the column instead of wrapping or truncating.
   Separated by generous spacing, not ruled lines - vertical gridlines between
   every column is what made this read as a spreadsheet rather than a page. */
.stat-th, td.stat-td {
  text-align: center;
  white-space: nowrap;
  padding-left: 22px;
  padding-right: 22px;
}
td.stat-td-platform .platform-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  padding: 0;
}
td.stat-td-platform .platform-icon.platform-unknown { font-size: .8rem; border: 1px dashed rgba(255,255,255,.18); }
/* Steam is the only clickable variant here — at rest it should look
   identical to the inert (non-clickable) icons next to it: no border, no
   background. Only on hover does it reveal the clickable affordance.
   Border must stay 1px solid transparent (not `none`) at rest so the
   existing a.platform-icon.steam:hover rule — which only swaps
   border-color/background, not border-width — has something to reveal
   without the icon jumping size on hover. */
td.stat-td-platform a.platform-icon.steam {
  border: 1px solid transparent;
  background: transparent;
}
td.stat-td-platform a.platform-icon.steam:hover {
  border-color: rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
}
td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border2);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.025); }

/* Rank column + medal badges for top 3 */
td.rank {
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--muted2);
  width: 52px;
  text-align: center;
}
.rank-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-family: var(--mono);
  font-weight: 500;
  font-size: .74rem;
}
.rank-1 { background: rgba(197,146,42,.12); color: var(--gold);   border: 1px solid rgba(197,146,42,.35); }
.rank-2 { background: rgba(122,136,152,.1);  color: var(--silver); border: 1px solid rgba(122,136,152,.3); }
.rank-3 { background: rgba(138,92,46,.12);   color: var(--bronze); border: 1px solid rgba(138,92,46,.3); }

/* Player cell: avatar + name + hover-revealed action buttons.
   Reusable anywhere a player needs to be displayed inline (tables, lists). */
.player-cell {
  display: flex;
  align-items: center;
  gap: 16px;
}
.lb-wrap .player-cell { gap: 10px; }
.list-av {
  width: 44px;
  height: 44px;
  /* No rounded corners on avatars anywhere in the product — keep this square. */
  border-radius: 0;
  border: 1px solid rgba(255,255,255,.1);
  background: var(--surface2);
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}
.lb-wrap .list-av { width: 44px; height: 44px; }
@media (max-width: 640px) {
  .list-av { width: 32px; height: 32px; }
  .pid-mini-wrap { width: 115px; }
}
.player-name {
  font-weight: 500;
  font-size: .86rem;
  color: var(--text);
  text-decoration: none;
  transition: color .15s;
  /* Was unset, inheriting the browser's default line-height (~1.5), which
     padded extra whitespace under the text on top of player-id-block's own
     gap below — the id/icon row read as farther from the name than the
     gap value alone suggested. 1.2 matches what .results-panel already
     sets on this same element (see override further down); pulled up here
     so every use of .player-name gets it, not just the search results panel. */
  line-height: 1.2;
}

/* Player identity block: name on top, platform ID + copy/steam buttons
   underneath as a quiet secondary line. Buttons stay small and low-contrast
   at rest, matching the row's baseline chrome, and only sharpen on hover -
   same principle as .act-btns but permanently visible (not hover-revealed),
   since the ID is core identifying info, not an incidental action. */
.player-id-block {
  display: flex;
  flex-direction: column;
  /* Was 3px. .results-panel already tightens this exact relationship to
     1px (see override further down) — brought the base value in line so
     every page showing a name-over-id/icon block gets the same tight
     spacing, not just the search results panel. */
  gap: 1px;
  min-width: 0;
}
.player-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.results-panel .act-btn-mini {
  width: 32px;
  height: 32px;
  padding: 4px;
  position: relative;
  top: -1px;
}
.results-panel .act-btn-mini svg { width: 24px; height: 24px; }
.results-panel .player-sub { gap: 12px; }
.pid-mini-wrap {
  /* Fixed-width column so the platform icon that follows always starts at
     the same x on every row, regardless of that row's ID string length -
     the pill itself (.pid-mini, nested inside) still hugs its own text
     rather than stretching to fill this.
     NOTE: this only lines up correctly because .pid-mini has
     font-variant-numeric: tabular-nums - if that's ever removed, same-length
     IDs will render at different pixel widths (Inter is proportional) and
     this fixed width will stop being reliable. Width bumped up from the old
     158px: tabular digits in Inter render wider per-character than the
     previous monospace font did, so the full "SteamNWI:xxxxxxxxxxxxxxxxx"
     string was landing right at (sometimes past) the old box edge, leaving
     ~0px of breathing room before the platform icon that follows. */
  display: inline-block;
  width: 186px;
  flex-shrink: 0;
}
.pid-mini {
  font-family: var(--mono);
  /* Inter is proportional (a "1" is narrower than an "8"), unlike the old
     monospace stack --mono used to point to. The platform icon after this
     pill relies on every same-length ID rendering at the same pixel width
     (see .pid-mini-wrap's fixed width below) to line up consistently -
     tabular-nums forces Inter's digits to a uniform width so that still
     holds, without reintroducing a real monospace font (and its slashed
     zeros). */
  font-variant-numeric: tabular-nums;
  font-size: .68rem;
  color: var(--muted2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: color .12s, background .12s;
  max-width: 100%;
  width: max-content;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 4px;
  padding: 1px 6px;
}
.pid-mini:hover { color: var(--text); background: rgba(255,255,255,.07); }
.pid-mini.copied { color: #6fcf97; }
.act-btn-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 4px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted2);
  cursor: pointer;
  flex-shrink: 0;
  transition: color .12s, border-color .12s, background .12s;
}
.act-btn-mini:hover {
  color: var(--text);
  border-color: rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
}
.act-btn-mini.copy.copied { color: #6fcf97; border-color: rgba(111,207,151,.35); background: rgba(111,207,151,.08); }
.act-btn-mini svg { width: 15px; height: 15px; }
a.act-btn-mini.steam:hover { color: #a0b8cc; border-color: rgba(160,184,204,.3); background: rgba(160,184,204,.08); }


/* Numeric cell color variants - apply alongside td.num */
td.num {
  font-family: var(--mono);
  font-size: .86rem;
  font-weight: 500;
  letter-spacing: -.01em;
}
td.num.hi, td.center.hi { color: var(--text); }   /* primary stat, e.g. kills */
td.num.lo, td.center.lo { color: var(--muted); }  /* secondary stat, e.g. deaths */
td.num.em, td.center.em { color: var(--text); font-weight: 600; }  /* emphasized-but-neutral stat */
td.num.kd, td.center.kd { color: var(--green); }  /* ratio-style positive stat */

/* Level badge (e.g. XP leaderboard) */
.level-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--accent);
}
.title-str { font-family: var(--mono); font-size: .72rem; color: var(--muted); }

/* Rank icon (chevron/star badge) + level pill, shown together in tables.
   Icon source assets are arbitrary native resolution (pre-generated webp,
   see build_rank_assets.py) - always constrain display size here, never
   rely on the asset's own dimensions. */
.rank-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.rank-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
@media (max-width: 640px) {
  .rank-icon { width: 18px; height: 18px; }
}

/* Rank display: two rows, no box/border - icon + tier name on top,
   level/xp underneath. Sits inline in the table like any other cell.
   Tier name and level/xp share the same mono font as the rest of the
   table (.pid, td.num, etc.) rather than a heavier display font. */
.rank-block {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.rank-block-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.rank-inline-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
.rank-inline-tier {
  font-family: var(--mono);
  font-size: .86rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}
.rank-inline-meta {
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--muted);
  line-height: 1;
}
.level-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.level-lv {
  font-weight: 700;
  font-size: .98rem;
  letter-spacing: -.01em;
  color: var(--text);
  line-height: 1.2;
}
.level-xp {
  font-size: .96rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}

/* Achievements cell: count / total on one line, small progress bar below -
   replaces the old bare "X / 128" text so partial progress reads at a glance. */
.ach-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
  text-align: center;
}
.ach-count {
  display: block;
  width: 100%;
  text-align: center;
  font-weight: 700;
  font-size: .98rem;
  color: var(--text);
  line-height: 1;
}
.ach-count small {
  font-weight: 500;
  font-size: .78rem;
  color: var(--muted2);
  margin-left: 1px;
}
.ach-bar {
  display: block;
  width: 52px;
  height: 5px;
  border-radius: 2.5px;
  background: var(--surface2);
  overflow: hidden;
}
.ach-bar i {
  display: block;
  height: 100%;
  background: var(--green);
}
@media (max-width: 640px) {
  .rank-inline-icon { width: 22px; height: 22px; }
  .rank-inline-tier { font-size: .76rem; }
  .rank-inline-meta { font-size: .62rem; }
}

/* Platform ID cell: platform icon (links out where possible) + copyable ID.
   Icon is a link for platforms we can deep-link (Steam); a plain non-link
   glyph otherwise, so the column layout stays consistent either way. */
.platform-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.platform-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.platform-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  color: var(--text);
  flex-shrink: 0;
  transition: color .15s, border-color .15s, background .15s;
}
.platform-icon img,
.act-btn-mini img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 3px;
}
a.platform-icon.steam {
  border: 1px solid rgba(255,255,255,.14);
  background: var(--surface2);
}
a.platform-icon.steam:hover {
  border-color: rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
}
/* Non-Steam platforms (Epic/Windows today) show their real icon but can't
   deep-link anywhere yet - keep them visually quiet and non-interactive
   rather than styled like a clickable control. Still carries the same
   transparent 1px border as the Steam variant above so the icon box is the
   exact same size either way and every row's badge lines up in the same
   spot instead of the borderless ones sitting inset. */
span.platform-icon.not-clickable,
span.act-btn-mini.not-clickable {
  cursor: default;
  opacity: .75;
  border: 1px solid transparent;
}
span.platform-icon.not-clickable:hover,
span.act-btn-mini.not-clickable:hover {
  border-color: transparent;
  background: transparent;
  opacity: .75;
}
.platform-icon.platform-unknown {
  font-family: var(--mono);
  font-size: .7rem;
  border: 1px dashed rgba(255,255,255,.18);
}

/* =============================================================================
   LOADING / EMPTY / ERROR STATES
   Generic centered state box - reuse for any async content area.
   ============================================================================= */
@keyframes spin { to { transform: rotate(-360deg); } }
.state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 52px 20px;
  gap: 10px;
  flex: 1;
  min-height: min(60vh, 480px);
}
/* Accent-filled spinner: solid accent color masked to spinner_thumb.webp's
   shape, rather than a bordered ring. Using mask-image (not a plain <img>
   or background-image) so the glyph's fill tracks var(--accent) instead of
   being baked into the asset's own pixel colors - same trick as any other
   single-color icon that needs to follow the theme. */
.spinner {
  width: 20px;
  height: 20px;
  background-color: var(--accent);
  -webkit-mask-image: url('https://api.joinambush.com/static/misc/spinner_thumb.webp');
          mask-image: url('https://api.joinambush.com/static/misc/spinner_thumb.webp');
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  -webkit-mask-size: contain;
          mask-size: contain;
  animation: spin .7s linear infinite;
}
.state-icon { font-size: 1.4rem; color: var(--muted2); }
.state-msg { font-family: var(--mono); font-size: .76rem; color: var(--muted); text-align: center; }
.state-err .state-msg { color: #e05555; } /* error variant, add class="state-box state-err" */

/* =============================================================================
   FOOTER
   Loaded via /partials/footer.js into #footer-placeholder.
   ============================================================================= */
footer {
    border-top: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--mono);
    font-size: .68rem;
    color: var(--muted2);
    flex-shrink: 0;
}
footer a { color: var(--muted2); text-decoration: none; transition: color .15s; }
footer a:hover { color: var(--accent); }

/* ── Shared animations ───────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =============================================================================
   ACTION BUTTONS (e.g. "open Steam profile", "copy ID")
   Small icon buttons that appear inline with a row, revealed on hover by
   default; add .always to keep them visible without hovering.
   ============================================================================= */
.act-btns {
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s;
}
tr:hover .act-btns { opacity: 1; pointer-events: auto; }
.act-btns.always { opacity: 1; pointer-events: auto; }

.act-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 26px;
  width: 26px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,.14);
  background: var(--surface2);
  color: var(--text);
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .02em;
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: color .12s, border-color .12s, background .12s;
  white-space: nowrap;
}
.act-btn:hover { color: var(--text); border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.08); }
.act-btn.steam:hover { color: #a0b8cc; border-color: rgba(160,184,204,.35); background: rgba(160,184,204,.08); }
.act-btn.copy.copied { color: #6fcf97; border-color: rgba(111,207,151,.4); background: rgba(111,207,151,.1); }

/* =============================================================================
   RESPONSIVE
   Add page-specific breakpoints below this shared block, or in a page's own
   <style> if truly one-off - keep this file for rules shared across pages.
   ============================================================================= */
/* Below this width the nav items (Home / Matches / Profiles / Leaderboards ▾
   / Updates ▾ / About) no longer comfortably fit as a horizontal scroll
   strip, so it collapses into a hamburger-triggered drawer instead. */
@media (max-width: 780px) {
  /* .nav-links is positioned against .topbar-outer (already a positioned
     element via position:sticky), not .topbar itself, so the drawer sits
     flush against the viewport edges instead of inheriting .topbar's
     side padding. */
  .nav-hamburger { display: inline-flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 2px;
    overflow-x: visible;
    overflow-y: auto;
    max-height: calc(100vh - 68px);
    background: rgba(15,16,20,.98);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 16px 32px rgba(0,0,0,.35);
    padding: 8px 16px 16px;
  }
  .nav-links.open { display: flex; }
  .nav-link { width: 100%; height: 46px; padding: 0 12px; font-size: .96rem; }
  .nav-dropdown { position: static; width: 100%; }
  .nav-link-dd { width: 100%; justify-content: space-between; }
  .nav-dd-menu {
    display: none;
    position: static;
    width: 100%;
    min-width: 0;
    flex-direction: column;
    background: rgba(255,255,255,.03);
    border: none;
    box-shadow: none;
    border-radius: 7px;
    padding: 3px;
    margin: 0 0 4px;
  }
  .nav-dropdown.open .nav-dd-menu { display: flex; }
  .nav-dd-item { padding: 11px 12px; border-radius: 6px; }
}

@media (max-width: 640px) {
  .page { padding: 18px 12px 40px; }
  .topbar { padding: 0 16px; height: 68px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-name { font-size: 1.08rem; }
  th, td { padding: 9px 10px; }
  .list-av { width: 22px; height: 22px; }
}

/* =============================================================================
   MATCHES PAGE  (body[data-page="matches"])
   Page-specific rules only - resets, topbar/nav, .page, spinner, state-box,
   and fadeUp are already defined above and are reused as-is.
   ============================================================================= */

/* .page-title / .page-sub are already defined globally (used by leaderboards),
   but this page wants a bigger, bolder header - scope the override to this page
   only so leaderboards is untouched. */
body[data-page="matches"] .page-title {
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -.4px;
  line-height: 1;
}
body[data-page="matches"] .page-sub {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  margin-top: 5px;
}

/* ── Section label ── */
.section-label {
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted2);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label::after { content:''; flex:1; height:1px; background:var(--border); }

/* ── Views ── */
#view-detail { display: none; }

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: .78rem;
  color: var(--muted);
}
.breadcrumb a { color: var(--muted); text-decoration: none; cursor: pointer; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { opacity: .4; }
.breadcrumb .cur { color: var(--text); }

/* ════════════════════════════════
   LIVE CARDS
════════════════════════════════ */
@keyframes dotPulse { 0%,100%{opacity:1} 50%{opacity:.3} }

.live-section { margin-bottom: 24px; }
.live-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 12px;
}
.lmc {
  display: block;
  position: relative;
  border-radius: var(--r);
  overflow: hidden;
  min-height: 80px;
  text-decoration: none;
  color: inherit;
  transition: transform .15s;
}
/* Border drawn as its own top layer instead of on .lmc itself. When the
   border lives on the same box that overflow:hidden clips the bg/overlay
   to, the border curve and the clip curve are computed a hair differently
   and the corner ends up looking unfilled. A pseudo-element with
   border-radius: inherit sitting above everything shares the exact same
   curve as the clip, so it always lines up. */
.lmc::after {
  content: '';
  position: absolute; inset: 0; z-index: 2;
  border-radius: inherit;
  border: 1px solid rgba(111,207,151,.3);
  transition: border-color .15s;
  pointer-events: none;
}
.lmc:hover { transform: translateY(-2px); }
.lmc:hover::after { border-color: rgba(111,207,151,.6); }
.lmc-bg {
  position: absolute; inset: 0; z-index: 0;
  background-size: 170% auto; background-repeat: no-repeat; background-position: center;
  background-color: var(--bg);
  filter: brightness(.55) saturate(1);
}
.lmc-overlay {
  position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(100deg, rgba(19,21,26,.65), rgba(19,21,26,.3));
}
.lmc-content {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 16px;
  padding: 18px 22px; min-height: 108px; flex-wrap: wrap;
}
.lmc-server { font-weight: 800; font-size: 1.3rem; letter-spacing: -.3px; color: #fff; flex-shrink: 0; min-width: 300px; }
/* The stripe art fades to flat color at a fixed ~75% mark, purpose-built
   as a legible zone for the round/player block. The separator is pinned
   there (not placed via flex order) so it always lines up with that
   fade regardless of how long the server/mode/map text is. */
.lmc-vsep {
  position: absolute;
  left: 75%;
  top: 18px; bottom: 18px;
  width: 1px;
  background: rgba(255,255,255,.16);
}
.lmc-info {
  position: absolute;
  left: calc(75% + 20px);
  right: 100px;
  top: 18px; bottom: 18px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
}
.lmc-mode {
  font-family: 'Inter', sans-serif; font-weight: 700; font-size: 1rem;
  color: rgba(255,255,255,.88); letter-spacing: -.1px;
}
.lmc-map { font-weight: 600; font-size: .92rem; color: rgba(255,255,255,.55); letter-spacing: -.1px; display: flex; align-items: center; gap: 5px; }
.lmc-night-icon { width: 20px; height: 20px; flex-shrink: 0; display: block; }
.lmc-meta { order: 4; display:flex; flex-direction:column; align-items:flex-end; gap:4px; flex-shrink:0; margin-left: auto; }
.lmc-round { font-family: 'Inter', sans-serif; font-weight:600; font-size:.92rem; letter-spacing:normal; color:rgba(255,255,255,.6); white-space:nowrap; }
.lmc-players { font-weight: 800; font-size: 1.6rem; letter-spacing: -.5px; color: #fff; white-space: nowrap; }

/* ════════════════════════════════
   CARD / TABLE  (matches variant - .lb-wrap/.table-scroll already exist for
   leaderboards; this page uses its own lighter-weight .card pattern which is
   reused across list + detail views, so it earns its own name)
════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
}
.card-hd {
  font-family: var(--mono); font-size: .63rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted2);
  margin-bottom: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-hd::after { content:''; flex:1; height:1px; background:var(--border); min-width:20px; }

.table-wrap { overflow-x: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.table-wrap thead tr { background: var(--surface2); }
.table-wrap th {
  padding: 9px 10px; text-align: left;
  font-family: var(--mono); font-size: .6rem; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted2);
  border-bottom: 1px solid var(--border2); white-space: nowrap;
}
.table-wrap th.th-group-start { border-left: 1px solid var(--border); }
.table-wrap td { padding: 8px 10px; border-bottom: 1px solid var(--border2); vertical-align: middle; }
.table-wrap td.td-group-start { border-left: 1px solid var(--border); }
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tr.clickable { cursor: pointer; }
.table-wrap tr.clickable:hover td { background: rgba(255,255,255,.025); }
.table-wrap td.num { font-family: var(--mono); font-weight: 500; font-size: .84rem; }

.th-group {
  background: rgba(255,255,255,.02);
  font-family: var(--mono); font-size: .56rem; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted2);
  padding: 5px 10px; text-align: center; border-bottom: 1px solid var(--border2);
}
.th-group.th-group-start { border-left: 1px solid var(--border); }

.map-cell { display: flex; align-items: center; gap: 12px; text-align: left; }
.map-thumb { width:46px; height:26px; border-radius:4px; object-fit:cover; flex-shrink:0; background:var(--surface2); border:1px solid var(--border2); display:block; }
.map-thumb-ph { width:46px; height:26px; border-radius:4px; flex-shrink:0; background:var(--surface2); border:1px solid var(--border2); }
.map-thumb-lg { width:56px; height:34px; border-radius:5px; }
.map-text { display: flex; flex-direction: column; gap: 1px; }
.map-text .sub { font-family: var(--mono); font-size: .63rem; color: var(--muted); }

.mode-cell { display: inline-flex; align-items: center; justify-content: center; }

/* Match-history table: map column is snapped left (thumbnail always at a
   fixed x, header left-aligned to match); mode/score/date/duration/state
   stay centered under their headers. */
.mh-history-table th:not(:first-child),
.mh-history-table td:not(:first-child) { text-align: center; }
.mh-history-table th:first-child,
.mh-history-table td:first-child { text-align: left; }
.mh-history-table td.num { text-align: center; }

.badge { display:inline-block; padding:2px 7px; border-radius:3px; font-family:var(--mono); font-size:.62rem; font-weight:500; letter-spacing:.06em; text-transform:uppercase; white-space:nowrap; }
.badge-muted { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }

.num-zero { color: var(--muted2) !important; opacity: .5; }
.num-warn { color: var(--yellow) !important; }
.num-bad  { color: var(--red)    !important; }

/* ════════════════════════════════
   BROWSE BAR
════════════════════════════════ */
.browse-bar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:14px; }
.browse-bar .input { max-width:200px; flex:1; min-width:140px; }
.input {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 8px 12px;
  color: var(--text); font-family: var(--mono); font-size: .82rem;
  outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--accent-border); }
.input::placeholder { color: var(--muted2); opacity: .6; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r); font-family: var(--mono);
  font-size: .78rem; cursor: pointer; transition: border-color .15s, color .15s; border: none; white-space: nowrap;
}
.btn-secondary { background: var(--surface2); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { border-color: rgba(255,255,255,.15); }
.browse-count { font-family: var(--mono); font-size: .7rem; color: var(--muted2); margin-left: auto; white-space: nowrap; }

/* ════════════════════════════════
   PAGINATION
════════════════════════════════ */
.pagination { display:flex; gap:6px; align-items:center; justify-content:center; padding:14px 0 0; }
.page-btn {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 6px 12px; color: var(--muted); font-family: var(--mono); font-size: .72rem;
  cursor: pointer; transition: border-color .15s, color .15s;
}
.page-btn:hover:not(:disabled) { border-color: rgba(255,255,255,.15); color: var(--text); }
.page-btn:disabled { opacity: .3; cursor: not-allowed; }
.page-cur { padding: 6px 10px; font-family: var(--mono); font-size: .72rem; color: var(--muted2); }

/* ════════════════════════════════
   MATCH DETAIL HERO
════════════════════════════════ */
.mh-hero {
  position: relative; border-radius: var(--r); overflow: hidden;
  min-height: 200px; margin-bottom: 20px; border: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: center;
}
.mh-bg {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
  filter: brightness(.22) saturate(.6);
}
.mh-content {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 28px;
  padding: 24px 32px; width: 100%; flex-wrap: wrap; justify-content: center;
}
.mh-mapimg-wrap {
  width: 107px; border-radius: 6px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.1); flex-shrink: 0;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
}
.mh-mapimg-wrap img { width:100%; height:107px; object-fit:cover; display:block; }
.mh-mapimg-wrap .ph { width:100%; height:107px; display:flex; align-items:center; justify-content:center; color:var(--muted2); font-size:.72rem; }

/* Players / Rounds detail tables: every column's values centered under its
   header, Player/Winner/Reason (identity & prose columns) stay left. */
.mh-stat-table th,
.mh-stat-table td { text-align: center; }
.mh-stat-table th:first-child,
.mh-stat-table td:first-child { text-align: left; }
.mh-stat-table td.mh-text-cell { text-align: left; }
/* th.num/td.num (global, line ~331) forces text-align:right, which would
   otherwise fight this table's centered layout depending on source order.
   Pin every numeric cell here explicitly so K:A:D and friends always sit
   centered under their headers regardless of rule order elsewhere. */
.mh-stat-table th.num,
.mh-stat-table td.num { text-align: center; }
.mh-info { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 160px; }
.mh-map-name { font-weight: 800; font-size: 1.5rem; letter-spacing: -.4px; color: var(--text); }
.mh-mode-line {
  font-family: var(--mono); font-size: .68rem;
  letter-spacing: .04em; color: var(--muted);
}
.mh-meta { display: flex; gap: 14px; flex-wrap: wrap; font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.mh-score {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px; padding: 14px 28px; flex-shrink: 0;
}
.mh-score-val { font-weight: 800; font-size: 2.2rem; letter-spacing: -.5px; line-height: 1; color: var(--text); font-family: var(--mono); }
.mh-score-lbl { font-family: var(--mono); font-size: .58rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted2); margin-top: 4px; }

/* ── Detail tabs ── */
.mh-tabs { display: flex; border-bottom: 1px solid var(--border2); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
.mh-tabs::-webkit-scrollbar { display: none; height: 0; }
.mh-tab {
  padding: 0 16px; height: 40px; background: none; border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--mono); font-size: .7rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); cursor: pointer; white-space: nowrap;
  transition: color .15s, border-color .15s; margin-bottom: -1px;
}
.mh-tab:hover { color: var(--text); }
.mh-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.mh-tabcontent { display: none; }
.mh-tabcontent.active { display: block; }

/* ── Round pips ── */
.round-pip-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.round-pip {
  width: 30px; height: 30px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: .78rem;
  flex-shrink: 0; border: 1px solid var(--border);
}
.round-pip.t1   { background: rgba(74,158,255,.15); color: var(--blue); border-color: rgba(74,158,255,.3); }
.round-pip.t2   { background: rgba(224,85,85,.15);  color: var(--red);  border-color: rgba(224,85,85,.3); }
.round-pip.draw { background: var(--surface2); color: var(--muted); }

/* ── Player link (distinct from .player-name used in leaderboards' hover-card) ── */
.player-link { color: var(--text); text-decoration: none; }
.player-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ── Session lines ──
   One "start > end" pair per session, stacked vertically in a single
   Session column. A player present the whole match gets one line; a player
   who reconnected gets one line per session, so each gap reads as its own
   self-contained pair rather than two ambiguous "start" labels split across
   separate Join/Leave columns. */
.session-stack { display: flex; flex-direction: column; gap: 3px; align-items: center; }
.session-line {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-family: var(--mono); font-size: .72rem; white-space: nowrap;
}
.session-line-main { display: inline-flex; align-items: baseline; gap: 6px; }
.sc-join { font-weight: 600; color: var(--green); }
.sc-leave { font-weight: 600; color: var(--red); }
.sc-arrow { color: var(--muted2); font-weight: 400; }
.sc-dur { display: block; color: var(--muted2); font-weight: 400; font-size: .82em; }
.sc-dur .sc-dur-lbl { text-transform: uppercase; letter-spacing: .04em; font-size: .92em; margin-right: 3px; }
.reconnect-note {
  font-family: var(--mono); font-size: .58rem; color: var(--muted2);
  letter-spacing: .04em; text-transform: uppercase; margin-top: 2px;
}

/* ── Legend ── */

/* accent colors used only on this page */
:root {
  --blue:   #4a9eff;
  --red:    #e05555;
  --yellow: #f2c94c;
}

@media (max-width: 640px) {
  .live-cards-grid { grid-template-columns: 1fr; }

  /* The desktop .lmc layout pins .lmc-vsep/.lmc-info at "75% across" and
     .lmc-info's right edge 100px from the card edge - both assume a card
     that's at least ~360px wide. Below that, those fixed/percentage
     offsets crush the map/mode text into a sliver and can even force
     .lmc-players off the visible card. Mobile drops the absolute
     positioning entirely and stacks everything as a normal flex column
     instead. */
  .lmc-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 14px 16px;
    min-height: 0;
  }
  .lmc-server { min-width: 0; font-size: 1.1rem; }
  .lmc-vsep { display: none; }
  .lmc-info {
    position: static;
    left: auto; right: auto; top: auto; bottom: auto;
    width: 100%;
  }
  .lmc-meta {
    order: 0;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-left: 0;
    width: 100%;
  }
  .lmc-players { font-size: 1.15rem; }
  .lmc-round { font-size: .8rem; }

  .mh-content { padding: 16px; gap: 16px; }
  .mh-replay-row { padding: 0 16px 16px; }
  .mh-mapimg-wrap { width: 90px; }
  .mh-mapimg-wrap img { height: 68px; }
  .mh-mapimg-wrap .ph { height: 68px; }

  /* ── Match history table (index.html) ──
     .table-wrap already scrolls horizontally, but at phone widths that
     forces every visitor to swipe just to see the Date/Duration/State
     columns. Trim the least essential columns (Duration, State) out of
     the flow and shrink what's left, so the map/mode/score/date — the
     part people actually glance at — fits without scrolling on a common
     ~375–414px phone screen. */
  .mh-history-table th:nth-child(5), .mh-history-table td:nth-child(5), /* Duration */
  .mh-history-table th:nth-child(6), .mh-history-table td:nth-child(6) { /* State */
    display: none;
  }
  .table-wrap table { font-size: .76rem; }
  .table-wrap th, .table-wrap td { padding: 7px 6px; }
  .map-thumb.map-thumb-lg { width: 44px; height: 28px; }
  .map-text .sub, .mutator-chip { font-size: .56rem; }
  .mh-search-form { padding: 10px 12px !important; }
}

/* =============================================================================
   LIVE MATCH PAGE  (body[data-page="live"])
   Reuses .breadcrumb, .state-box, .spinner, .state-icon, .state-msg,
   .state-err, and the dotPulse/fadeUp/spin keyframes already defined above.
   ============================================================================= */

/* This page wants a slightly wider, tighter-padded .page than the matches
   list page - scoped so it doesn't affect index.html, which shares the
   generic .page rule. */
body[data-page="live"] .page {
    max-width: 1320px;
    padding: 12px 28px 8px;
    display: flex; flex-direction: column;
}

/* ── Topbar live indicator ── */
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Colors sampled directly from server_online.png / server_offline.png
   (the check-circle / x-circle badges baked into the status thumbs), so the
   ring and offline label match the artwork exactly instead of the site's
   generic --green/--red accents. */
.live-chip {
  display: inline-flex; align-items: center;
}
/* Fixed-size wrapper keeps the ring+thumb from nudging the topbar layout
   on every countdown tick - only the ring's dash-offset animates. */
.chip-img-wrap {
  position: relative;
  width: 34px; height: 34px;
  flex-shrink: 0;
}
.live-chip-dot {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 22px; height: 22px; object-fit: contain;
}
.chip-ring {
  position: absolute; inset: 0;
  width: 34px; height: 34px;
  transform: rotate(-90deg); /* start the fill at 12 o'clock, sweep clockwise */
}
.chip-ring-bg {
  fill: none;
  stroke: rgba(75,171,80,.18);
  stroke-width: 2.5;
}
.chip-ring-progress {
  fill: none;
  stroke: #4bab50; /* server_online.png check-circle green */
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 100.53; /* 2 * PI * r(16) */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}

.offline-chip {
  display: inline-flex; align-items: center; gap: 8px;
  color: #c94242; /* server_offline.png x-circle red */
  font-family: var(--mono); font-size: .64rem;
  letter-spacing: .12em; text-transform: uppercase;
}
.offline-chip-dot {
  width: 22px; height: 22px; object-fit: contain;
}

/* ══════════════════════════════
   MATCH HERO
══════════════════════════════ */
.match-hero {
  position: relative; overflow: hidden;
  border: 1px solid var(--border); border-radius: 0;
  background: var(--surface);
  display: flex; flex-direction: column;
  flex: 1;
  margin-bottom: 12px;
  min-height: 0; /* flex-fills .page instead of guessing viewport math */
}
.match-hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
  filter: brightness(.22) saturate(.7) blur(4px);
  transform: scale(1.05);
  pointer-events: none;
}

/* ── Hero top bar ── */
.hero-topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 20px; background: #000;
  border-bottom: 1px solid rgba(255,255,255,.07);
  gap: 12px; flex-wrap: wrap; min-height: 46px;
}
.ht-left {
  flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0;
  font-family: 'Inter', sans-serif; font-weight: 500; font-size: .78rem; color: #fff;
}
.ht-left #ht-left-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ht-back {
  display: inline-flex; align-items: center; flex-shrink: 0;
  color: rgba(255,255,255,.4); text-decoration: none;
  transition: color .15s ease, transform .15s ease;
}
.ht-back svg { width: 15px; height: 15px; display: block; }
.ht-back:hover { color: #fff; transform: translateX(-2px); }
.ht-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 120px; text-align: center; }
.ht-center .map-name { font-weight: 800; font-size: 1.1rem; letter-spacing: -.02em; color: #fff; line-height: 1.1; }
.ht-center .map-mode { font-family: 'Inter', sans-serif; font-size: .72rem; font-weight: 500; color: #fff; letter-spacing: .04em; margin-top: 2px; }
.ht-right {
  flex: 1; display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  text-align: right; font-family: var(--mono); font-size: .7rem; color: var(--muted2); white-space: nowrap;
}

/* ── Match ID chip (click-to-copy) sitting under the server/map info on
   the right of the hero topbar ── */
.match-id-wrap { display: inline-flex; align-items: center; gap: 6px; }
.match-id-chip {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
  font-family: 'Inter', sans-serif; font-weight: 500; font-size: .81rem; color: #fff;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px; padding: 3px 8px;
  transition: background .15s ease, color .15s ease;
  user-select: none;
}
.match-id-chip:hover { background: rgba(255,255,255,.08); color: #e6e8ea; }
.match-id-chip.copied { color: #4ade80; border-color: #4ade8055; }
.match-id-chip.no-id { cursor: default; color: rgba(255,255,255,.35); }
.match-id-chip.no-id:hover { background: rgba(255,255,255,.04); color: rgba(255,255,255,.35); }
.match-id-chip svg { width: 12px; height: 12px; flex-shrink: 0; }

/* ── Hero body: 4-column grid ── */
.hero-body {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 1fr 220px 1fr;
  grid-template-rows: 1fr;
  flex: 1;
  min-height: 0;
}

/* ── Team panels ── */
.team-panel { display: flex; flex-direction: column; background: rgba(0,0,0,.55); height: 100%; min-height: 0; }
.team-panel.insurgents { border-right: 1px solid var(--border); }
.team-panel.security   { border-left: 1px solid var(--border); }

.team-panel .team-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 14px 18px; flex-shrink: 0;
  position: relative; overflow: hidden; background: transparent; min-height: 80px;
}
.team-panel .team-header::before {
  content: ''; position: absolute; inset: 0;
  background: url('https://api.joinambush.com/static/misc/scoreboard_stripe.webp') center/cover no-repeat;
  opacity: .04; pointer-events: none;
}
.team-panel .team-header::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to right, rgba(0,0,0,.85) 0%, rgba(0,0,0,.85) 45%, rgba(0,0,0,.15) 100%);
  pointer-events: none;
}
.team-panel.insurgents .team-header { border-top: 4px solid #ff5050; }
.team-panel.security   .team-header { border-top: 4px solid #4a8cff; }

.team-left { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; }
.team-icon { width: 38px; height: 38px; border-radius: 7px; object-fit: cover; flex-shrink: 0; }
.team-label { display: flex; flex-direction: column; }
.team-name  { font-weight: 800; font-size: 1.65rem; letter-spacing: -.5px; line-height: 1.1; color: #fff; }
.team-role  { font-size: .85rem; text-transform: uppercase; letter-spacing: .12em; color: rgba(255,255,255,.65); font-weight: 500; }

.team-wins { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.team-wins-val {
  font-weight: 400; font-size: 2.9rem; letter-spacing: -1px; line-height: 1; color: #fff;
  margin-top: 4px;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), color .3s;
}
.team-wins-val.bumped { transform: scale(1.35); color: var(--green); }
.team-wins-lbl { font-family: 'Inter', sans-serif; font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: rgba(255,255,255,.45); margin-bottom: 1px; }

/* ── Player list ── */
.team-players-wrap { flex: 1; overflow-y: auto; padding: 0 0 4px; display: flex; flex-direction: column; }
.team-players-wrap::-webkit-scrollbar { width: 3px; }
.team-players-wrap::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.team-players-header {
  display: grid; grid-template-columns: 1fr 60px 40px 40px 70px;
  padding: 9px 10px 9px 12px;
  font-family: 'Inter', sans-serif; font-size: .64rem; font-weight: 600; text-transform: uppercase; letter-spacing: .09em;
  color: #fff; background: #000;
  border-top: 1px solid #e63946; border-bottom: 1px solid #e63946;
}
.team-player-row {
  display: grid; grid-template-columns: 1fr 60px 40px 40px 70px;
  padding: 5px 10px 5px 12px; align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.03);
  transition: background .1s; font-size: .88rem;
}
.team-player-row:last-child { border-bottom: none; }
.team-player-row:hover { background: rgba(255,255,255,.04); }

@keyframes statFlash { 0%{color:var(--accent)} 100%{color:var(--text)} }
.team-player-row.stat-changed .tp-stat,
.team-player-row.stat-changed .tp-kda { animation: statFlash .8s ease forwards; }

.tp-name { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text); }
.tp-name-col { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.tp-name-col span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tp-name-link { color: inherit; text-decoration: none; display: block; }
.tp-name-link:hover { color: var(--accent); }
.tp-av {
  width: 30px; height: 30px; border-radius: 6px; object-fit: cover; flex-shrink: 0;
  background: var(--surface2); border: 1px solid rgba(255,255,255,.1); display: block;
}
.tp-stat { font-family: var(--mono); font-weight: 500; font-size: .78rem; text-align: center; color: var(--text); }
.tp-kda  { font-family: var(--mono); font-size: .64rem; color: rgba(255,255,255,.45); text-align: center; letter-spacing: -.2px; }
.tp-kda b { color: var(--text); font-weight: 500; }
.team-empty-row { padding: 18px 14px; font-size: .75rem; color: var(--muted); text-align: center; opacity: .5; flex: 1; display: flex; align-items: center; justify-content: center; }
.team-players-body { flex: 1; display: flex; flex-direction: column; }

/* ── Center column ── */
.hero-center {
  display: flex; flex-direction: column; align-items: stretch;
  background: rgba(0,0,0,.45); backdrop-filter: blur(2px);
  border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  height: 100%; min-height: 0;
}

.hero-state-block {
  flex-shrink: 0;
  position: relative;
  background: linear-gradient(180deg, rgba(232,103,58,.14), rgba(232,103,58,.02) 70%);
  border-bottom: 1px solid rgba(232,103,58,.2);
  box-shadow: inset 0 -1px 0 rgba(232,103,58,.15), inset 0 1px 0 rgba(255,255,255,.03);
  padding: 10px 12px; text-align: center;
  min-height: 58px; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.hero-state-name {
  font-family: var(--mono); font-size: .72rem; text-transform: uppercase;
  letter-spacing: .18em; color: var(--accent);
  display: inline-flex; align-items: center; gap: 7px;
  text-shadow: 0 0 12px rgba(232,103,58,.35);
}
.hero-state-name::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px 1px rgba(232,103,58,.7);
  animation: dotPulse 1.4s ease infinite;
  flex-shrink: 0;
}
.hero-match-timer {
  font-family: var(--mono); font-size: .58rem; color: rgba(232,103,58,.55);
  letter-spacing: .1em; margin-top: 3px;
}

.hero-center-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  padding: 10px 10px 8px; gap: 2px; overflow-y: auto;
}
.hero-round {
  font-weight: 400; font-size: 3.7rem; letter-spacing: -1.5px; line-height: 1;
  color: var(--text); transition: transform .25s cubic-bezier(.34,1.56,.64,1);
  margin-top: 6px;
}
.hero-round.bumped { transform: scale(1.18); }
.hero-round-label {
  font-family: 'Inter', sans-serif; font-size: .78rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .15em; color: rgba(255,255,255,.3); margin-top: 10px;
}
.hero-round-timer {
  font-family: var(--mono); font-size: .88rem; font-weight: 500;
  color: rgba(255,255,255,.4); letter-spacing: .05em; margin-top: 4px;
  transition: color .3s;
}
.hero-round-timer.active { color: var(--green); }
.hero-round-timer.hidden { opacity: 0; }

.hero-mode-img-wrap {
  width: 100%; margin-top: 28px;
  display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0;
}
.hero-mode-img-wrap img { display: block; width: 100%; height: auto; object-fit: cover; object-position: center; }
.hero-mode-img-wrap .ph {
  padding: 12px 10px; display: flex; align-items: center; justify-content: center;
  color: var(--muted2); font-size: .68rem; background: var(--surface2); border-radius: 8px;
}

/* ── Short gamemode description under the mode illustration ── */
.hero-mode-desc {
  width: 100%; padding: 10px 18px 0;
  font-family: 'Inter', sans-serif; font-size: .68rem; font-weight: 400; color: rgba(255,255,255,.45);
  text-align: left; line-height: 1.6; flex-shrink: 0;
}
.mode-desc-item { display: flex; align-items: flex-start; }
.mode-desc-item + .mode-desc-item { margin-top: 10px; }
.mode-desc-bullet { flex: 0 0 auto; width: 14px; }
.mode-desc-text { flex: 1 1 auto; min-width: 0; }

/* ── Platform column: just the platform icon, pushed to the far right of
   its column. The platform ID itself now renders as a second line under
   the player name (see .tp-name-col / .tp-pid-copy). ── */
.tp-platform { display: flex; align-items: center; justify-content: center; min-width: 0; transform: translateX(-14px); }
.tp-pid-copy {
  font-family: var(--mono); font-size: .62rem; color: var(--muted2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; cursor: pointer; transition: color .12s, background .12s;
  /* Same gray pill treatment as .pid-mini in the profiles search list — keep
     the platform ID visually consistent everywhere it's shown. */
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 4px;
  padding: 1px 6px;
  width: max-content;
}
.tp-pid-copy:hover { color: var(--text); background: rgba(255,255,255,.07); }
.tp-pid-copy.copied { color: #4ade80; }

.hero-spec-mini {
  width: 100%; margin-top: 8px; padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.06); flex-shrink: 0;
}
.spec-mini-hd {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: .58rem; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; justify-content: center;
}
.spec-mini-hd img { width: 13px; height: 13px; border-radius: 3px; object-fit: cover; }
.spec-row {
  display: flex; align-items: center; gap: 6px; padding: 2px 6px;
  border-radius: 4px; font-size: .68rem; color: var(--muted); justify-content: center;
}

/* ── No live / error states (page-specific empty state, distinct from the
   generic .state-box which is reused above for loading/error) ── */
.no-live-box {
  border: 1px dashed var(--border); border-radius: var(--r);
  padding: 48px 20px; text-align: center;
}
.no-live-icon { font-size: 2rem; color: var(--muted2); margin-bottom: 10px; }
.no-live-msg  { font-family: var(--mono); font-size: .82rem; color: var(--muted); margin-bottom: 4px; }
.no-live-sub  { font-family: var(--mono); font-size: .7rem; color: var(--muted2); }
.back-link    { display: inline-block; margin-top: 16px; font-family: var(--mono); font-size: .74rem; color: var(--accent); text-decoration: none; }
.back-link:hover { text-decoration: underline; }

@media (max-width: 760px) {
  body[data-page="live"] .page { padding: 16px 12px 40px; }
  .hero-body { grid-template-columns: 1fr; }
  .team-panel.insurgents { border-right: none; border-bottom: 1px solid var(--border); }
  .team-panel.security   { border-left: none; border-top: 1px solid var(--border); }
  .hero-center { border-left: none; border-right: none; order: -1; } /* score/round block first, teams below */
  .hero-topbar { padding: 8px 14px; flex-wrap: wrap; }
  .ht-left, .ht-right { flex: 1 1 auto; min-width: 0; }
  .ht-center { flex: 1 1 100%; order: 3; }
  .hero-round  { font-size: 1.8rem; }

  /* Team header: smaller icon/name so it doesn't crowd a narrow viewport */
  .team-panel .team-header { padding: 10px 14px; min-height: 60px; }
  .team-icon { width: 28px; height: 28px; }
  .team-name { font-size: 1.2rem; }
  .team-role { font-size: .68rem; }
  .team-wins-val { font-size: 2rem; }
  .team-wins-lbl { font-size: .64rem; }

  /* Roster grid: the JS emits an inline grid-template-columns on both the
     header row and each player row (see playerRowHtml/playerHeadersHtml in
     live.html) — those inline styles win over a plain class rule, so this
     override needs !important to actually take effect on mobile. Score/OBJ/
     K:A:D columns shrink, and the platform id text (already truncated to 26
     chars server-side) is hidden here since even truncated it doesn't fit
     next to a real name column at this width — the platform icon (still
     inside .tp-platform) stays visible. */
  .team-players-header,
  .team-player-row {
    grid-template-columns: 1fr 26px 34px 34px 56px !important;
    gap: 4px !important;
    padding: 6px 6px 6px 8px !important;
  }
  .team-players-header { padding-top: 8px !important; padding-bottom: 8px !important; }
  .tp-av { width: 24px; height: 24px; }
  .tp-name-col span { font-size: .78rem; }
  .tp-pid-copy { display: none; }
  .tp-platform { transform: none; justify-content: center; }
  .team-players-header > span:nth-child(2) { transform: none; font-size: .58rem; }
  .tp-stat { font-size: .72rem; }
  .tp-kda { font-size: .58rem; }

  /* Mode illustration / description column shrinks along with the rest of
     the center column once it's no longer squeezed between two side rails */
  .hero-mode-img-wrap { max-width: 160px; }
  .hero-mode-desc { font-size: .64rem; padding: 8px 14px 0; }
}

@media (max-width: 420px) {
  /* At the very narrowest widths, drop the OBJ column too rather than
     crushing K:A:D and score into illegible slivers. */
  .team-players-header,
  .team-player-row {
    grid-template-columns: 1fr 34px 56px !important;
  }
  .team-players-header > span:nth-child(3),
  .team-player-row > .tp-stat[data-f="captures"] { display: none; }
  .team-name { font-size: 1.05rem; }
  .team-wins-val { font-size: 1.7rem; }
}

/* =============================================================================
   PLAYER SEARCH PAGE  (body[data-page="profiles"])
   Reuses .page/.page-header/.page-title/.page-sub, .server-bar/.server-pill(s),
   .lb-wrap/.lb-meta/.lb-meta-title/.lb-meta-note, .table-scroll, .player-cell,
   .list-av, .player-name, td.num(.lo/.hi/.kd/.em), .level-badge, .act-btns/
   .act-btn, .state-box/.spinner/.state-icon/.state-msg/.state-err - all
   already defined above. Only the search bar, platform-id text, and this
   page's pagination variant are new.
   ============================================================================= */

/* Same treatment as the matches page: bigger, bolder header. */
body[data-page="profiles"] .page-title {
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -.4px;
  line-height: 1;
  color: var(--text);
}

/* ── Search ──
   One seamless pill: icon, input, and button share a single rounded
   boundary with no internal seam - the button is visually just the
   "hot end" of the same field, not a separate control bolted on. */
.search-wrap {
  display: flex; align-items: stretch; gap: 0; margin-bottom: 16px;
  border: 1px solid var(--border); border-radius: 999px; overflow: hidden;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(0,0,0,.2);
  transition: border-color .15s, box-shadow .15s;
  height: 46px;
}
.search-wrap:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.search-icon {
  flex-shrink: 0;
  align-self: center;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 18px; color: var(--muted2);
  transition: color .15s;
}
.search-icon svg { display: block; width: 100%; height: 100%; }
.search-wrap:focus-within .search-icon { color: var(--accent); }
.search-input {
  flex: 1; background: transparent; border: none; outline: none;
  -webkit-appearance: none; appearance: none;
  padding: 0 14px 0 10px; margin: 0;
  height: 100%;
  font-family: 'Inter', sans-serif; font-size: .84rem; font-weight: 400; line-height: normal;
  color: var(--text);
  letter-spacing: normal;
}
.search-input::placeholder { color: var(--muted2); }
.search-btn {
  padding: 0 26px; margin: 0; background: var(--accent); border: none; cursor: pointer;
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: .8rem; line-height: normal;
  color: #06171c; transition: background .15s; flex-shrink: 0; border-radius: 0;
  display: flex; align-items: center; justify-content: center;
  height: 100%;
}
.search-btn:hover { background: #9ce3ef; }

/* Match-history filter bar: same seamless pill as the profiles search, but
   with two stacked text fields (map + gamemode) separated by a hairline
   instead of one. */
.mh-search-form { margin-bottom: 6px; }
.mh-search-wrap { margin-bottom: 0; }
.mh-search-sep { flex-shrink: 0; width: 1px; align-self: stretch; margin: 8px 0; background: var(--border2); }
.mh-search-wrap .search-input { flex: 1; min-width: 0; }

.pid {
  font-family: var(--mono); font-size: .78rem; color: var(--text);
}

/* ── Results panel polish ──
   The plain bordered box read as flat, so this gives it an accent top edge,
   a subtle lift off the page, and a bit more texture in the rows. Scoped to
   .results-panel (search page only) so it can't affect other .lb-wrap uses. */
.results-panel {
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  position: relative;
}
.results-panel thead tr { background: transparent; }
.results-panel th { border-bottom: 1px solid var(--border); padding-top: 10px; padding-bottom: 10px; }
.results-panel td { padding-top: 14px; padding-bottom: 14px; }
.results-panel .player-cell { gap: 12px; }
.results-panel .player-id-block { gap: 6px; min-height: 44px; justify-content: flex-start; padding-top: 1px; }
.results-panel .player-name { font-size: .92rem; line-height: 1.2; margin-top: 0; display: inline-block; }
.results-panel .player-sub { line-height: 1; }
.results-panel tr:hover td { background: rgba(255,204,0,.05); }

/* Avatar gets a subtle ring instead of sitting flat against the row bg */
.results-panel .list-av {
  box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 0 0 3px rgba(0,0,0,.15);
  width: 44px;
  height: 44px;
}

/* Matches/Level/Achievements as soft chips instead of bare table cells,
   matching Rank - the whole row reads as grouped stat pills, not ruled
   spreadsheet columns. */


/* Secondary line under a state message (e.g. "Try a different name or ID").
   Used in the markup but was never actually styled before - without this it
   rendered as plain unstyled inline text. */
.state-sub {
  font-family: var(--mono); font-size: .68rem; color: var(--muted2); text-align: center;
}

/* The generic .state-err rule only reddens the message text; give the icon
   the same treatment for a consistent error state. */
.state-err .state-icon { color: #e05555; }

/* This page's pagination looks different from the matches page's (numbered
   page buttons with an .active state, vs prev/next + "Page N"), so it's
   scoped to avoid colliding with the unscoped .pagination/.page-btn rules
   matches/index.html already relies on. */
body[data-page="profiles"] .pagination {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 18px; border-top: 1px solid var(--border2);
}
body[data-page="profiles"] .page-btn {
  padding: 5px 12px;
  font-family: var(--mono); font-size: .72rem;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); cursor: pointer; border-radius: 4px;
  transition: all .15s;
}
body[data-page="profiles"] .page-btn:hover { border-color: rgba(255,255,255,.15); color: var(--text); }
body[data-page="profiles"] .page-btn.active { border-color: var(--accent-border); color: var(--accent); background: var(--accent-dim); }
body[data-page="profiles"] .page-btn:disabled { opacity: .3; cursor: not-allowed; }
.page-info { font-family: var(--mono); font-size: .68rem; color: var(--muted2); padding: 0 6px; }

/* =============================================================================
   PLAYER PROFILE PAGE  (body[data-page="profiles"], player detail view)
   Page-specific rules only - resets, tokens, topbar/nav, .server-bar/
   .server-bar-label/.server-pill(s), generic table/th/td, .state-box/
   .spinner/.state-msg/.state-err, .act-btns/.act-btn, and the spin/fadeUp
   keyframes are already defined above and reused as-is.

   NOTE: the search page (index.html, immediately above) and this detail
   page (player/index.html) share body[data-page="profiles"], so that
   attribute alone can't tell them apart. The detail page's <main> is the
   only element with id="page-main" - used below to scope rules that must
   NOT leak onto the search page (like the tighter .page padding). The
   search page has no .tab-btn at all, so scoping .tab-btn just to
   body[data-page="profiles"] is safe on its own - it can't collide with
   the pill-style .tab-btn used elsewhere (leaderboards/matches), which
   lives on unscoped .tab-row .tab-btn. Do NOT unscope this block - that's
   what used to make it a same-specificity, source-order hack; scoping is
   what makes it robust instead.
   ============================================================================= */

/* This page uses a tighter, no-bottom-padding .page (community strip below
   supplies its own spacing) instead of the shared default. Scoped via
   #page-main (unique to player/index.html) so it doesn't leak onto the
   profiles search page, which also carries body[data-page="profiles"]. */
body[data-page="profiles"] #page-main.page {
  max-width: 1060px; margin: 0 auto;
  padding: 24px 24px 0;
  animation: fadeUp .22s ease;
}

body[data-page="profiles"] .profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 16px;
}

body[data-page="profiles"] .hero { padding: 16px 20px; }
body[data-page="profiles"] .hero-top {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
}

/* Slim header: just avatar + identity + level box, no stat cards (those
   live on the Stats tab now). Avatar is a fixed square (not stretched to
   row height, or the taller level-box row skews it into a rectangle). */
body[data-page="profiles"] .avatar-wrap {
  position: relative;
  width: 96px;
  aspect-ratio: 1 / 1;
  align-self: center;
  flex-shrink: 0;
  /* No rounded corners on avatars anywhere in the product — keep this square. */
  border-radius: 0;
  overflow: hidden;
  background: var(--surface2);
}
body[data-page="profiles"] .avatar {
  width: 100%; height: 100%;
  border: 1px solid rgba(255,255,255,.1);
  background: var(--surface2);
}
body[data-page="profiles"] img.avatar { display: block; object-fit: cover; position: absolute; inset: 0; }
body[data-page="profiles"] .avatar-fb {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 24px; font-weight: 500; color: var(--accent);
}

/* Middle column: name/id/streak on top, a compact level bar underneath.
   Stretches to match the avatar segment / stats panel height, with the
   level box taking whatever vertical room name-block doesn't use. */
body[data-page="profiles"] .identity-col {
  display: flex; flex-direction: row; align-items: stretch; gap: 16px;
  flex: 1 1 auto;
  min-width: 0;
}
body[data-page="profiles"] .identity-col .name-block { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
body[data-page="profiles"] .identity-col .level-box { flex: 0 1 480px; min-width: 280px; }

body[data-page="profiles"] .name-block { min-width: 0; }
body[data-page="profiles"] .profile-name {
  font-size: 1.25rem; font-weight: 500; color: var(--text);
  line-height: 1; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body[data-page="profiles"] .profile-meta-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 5px;
}
body[data-page="profiles"] .meta-item { font-size: .74rem; color: var(--muted); font-family: var(--mono); }
body[data-page="profiles"] .tier-badge {
  background: var(--accent-dim); color: var(--accent); font-size: .68rem; font-weight: 500;
  padding: 2px 8px; border-radius: 20px; border: 1px solid var(--accent-border);
  font-family: var(--mono);
}

body[data-page="profiles"] .xp-strip { padding: 12px 24px; border-top: 1px solid var(--border2); display: flex; align-items: center; gap: 12px; }
body[data-page="profiles"] .xp-left  { font-size: .74rem; color: var(--muted); white-space: nowrap; font-family: var(--mono); }
body[data-page="profiles"] .xp-track { flex: 1; height: 3px; background: rgba(255,255,255,.07); border-radius: 2px; }
body[data-page="profiles"] .xp-fill  { height: 100%; border-radius: 2px; background: var(--accent); transition: width .5s ease; }
body[data-page="profiles"] .xp-right { font-size: .72rem; color: var(--muted2); white-space: nowrap; font-family: var(--mono); }

/* ── Shared profile header extras ─────────────────────────────────────
   Level box, rank chip, streak chip, click-to-copy PID, and the meta-row
   platform icon treatment. This is the single source of truth for these
   rules — used by every profile sub-page regardless of whether its header
   markup comes from the /partials/profile-header.html partial (via
   initProfileHeader) or is still hand-authored, so nothing should be
   redefining these locally. */
body[data-page="profiles"] .profile-name { line-height: 1.25; padding-bottom: 2px; }

.pid-copy {
  font-family: var(--mono); font-size: .74rem; color: var(--muted); cursor: pointer; transition: color .12s, background .12s;
  /* Same gray pill treatment as .pid-mini in the profiles search list — keep
     the platform ID visually consistent everywhere it's shown. */
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 4px;
  padding: 1px 6px;
}
.pid-copy:hover { color: var(--text); background: rgba(255,255,255,.07); }
body[data-page="profiles"] .pid-copy.copied { color: #6fcf97; }

.profile-meta-row .platform-icon { width: 32px; height: 32px; padding: 4px; border: none; background: none; border-radius: 0; margin-left: 4px; }
.profile-meta-row a.platform-icon.steam,
.profile-meta-row a.platform-icon.steam:hover { border: none; background: none; }

.profile-streak-row:empty { display: none; }
.profile-streak-row { margin-top: 5px; }
.streak-chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: .74rem; color: var(--muted); }
.streak-chip svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--accent); }
.streak-chip b { color: var(--text); font-weight: 600; }

body[data-page="profiles"] .tabs { scrollbar-width: none; -ms-overflow-style: none; }
body[data-page="profiles"] .tabs::-webkit-scrollbar { display: none; height: 0; }

body[data-page="profiles"] .stat-card-val,
.level-box-num { font-family: 'Inter', sans-serif; font-weight: 800; }

.level-box {
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  padding: 4px 0 4px 20px; border: none; border-left: 1px solid var(--border2); border-radius: 0;
  background: transparent; min-width: 0;
}
.level-box-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.level-box-num { font-size: 1.05rem; line-height: 1; color: var(--text); letter-spacing: -.02em; }
.level-box-pct { font-family: 'Inter', sans-serif; font-size: .72rem; font-weight: 600; color: var(--text); letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.level-box-pct .pct-num { color: var(--muted); font-weight: 500; }
.level-box-track { height: 3px; background: rgba(255,255,255,.07); border-radius: 2px; }
.level-box-fill { height: 100%; border-radius: 2px; background: var(--accent); transition: width .5s ease; }
.level-box-next { display: none; }

.level-box-rank { display: flex; align-items: center; gap: 7px; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--border2); }
.level-box-rank img { width: 22px; height: 22px; object-fit: contain; display: block; flex-shrink: 0; }
.level-box-rank-name { font-family: 'Inter', sans-serif; font-size: .8rem; font-weight: 600; color: var(--muted); letter-spacing: -.01em; text-transform: uppercase; }

/* Underline-style tabs - deliberately distinct from the shared pill .tab-row
   .tab-btn used by leaderboards/matches. Scoped to this page so both can
   coexist in one stylesheet without relying on source order. */
body[data-page="profiles"] .tabs {
  display: flex;
  gap: 0;
  padding: 0;
  background: var(--surface2);
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--border2);
  overflow-x: auto;
}
body[data-page="profiles"] .tabs::-webkit-scrollbar { height: 0; }
body[data-page="profiles"] .tabs .tab-btn {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 10px;
  border-radius: 0;
  font-family: 'Inter', sans-serif;
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: 0;
  border: none;
  border-right: 1px solid var(--border2);
  border-bottom: 2px solid transparent;
  box-sizing: border-box;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .15s, background .15s, border-color .15s;
}
body[data-page="profiles"] .tabs .tab-btn:last-child { border-right: none; }
body[data-page="profiles"] .tabs .tab-btn-icon { flex-shrink: 0; }
body[data-page="profiles"] .tabs .tab-btn span { overflow: hidden; text-overflow: ellipsis; }
body[data-page="profiles"] .tabs .tab-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,.03);
}
body[data-page="profiles"] .tabs .tab-btn.active {
  color: var(--text);
  background: var(--accent-dim);
  border-bottom-color: var(--accent);
}
/* Tabs size to content and scroll horizontally when they don't fit -
   avoids the equal-width flex squashing long labels ("Achievements",
   "Rankings") into an ellipsis on narrower desktop widths too. */

body[data-page="profiles"] .section-panel { display: none; }
body[data-page="profiles"] .section-panel.active { display: block; }

/* ── Day/Night filter toolbar ──────────────────────────────────────────
   Shared by every profile sub-tab that filters by lighting (stats, maps,
   modes, patterns, weapons). Previously each page duplicated this block
   in its own inline <style>; now defined once here.
   Wrapped in .lighting-toolbar, which is what actually separates it from
   the tab bar above: its own background + top/bottom border read as
   "start of a filter row" rather than more tabs, and the padding keeps it
   from butting up against the underline tabs. No rounded corners on the
   segmented control itself, matching the square-cornered treatment used
   elsewhere on this page. */
body[data-page="profiles"] .lighting-toolbar {
  padding: 14px 20px;
  background: var(--surface2);
  border-top: 1px solid var(--border2);
  border-bottom: 1px solid var(--border2);
  border-radius: 0;
}
body[data-page="profiles"] .lighting-toggle {
  display: flex;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
}
body[data-page="profiles"] .lighting-toggle-seg {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-left: 1px solid var(--border); border-radius: 0; background: transparent; cursor: pointer;
  padding: 9px 6px;
  font-family: var(--mono); font-size: .72rem; font-weight: 500;
  letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  transition: color .15s ease, background .15s ease;
  -webkit-appearance: none; appearance: none;
}
body[data-page="profiles"] .lighting-toggle-seg:first-child { border-left: none; }
body[data-page="profiles"] .lighting-toggle-seg svg { width: 14px; height: 14px; flex-shrink: 0; }
body[data-page="profiles"] .lighting-toggle-seg:hover { color: var(--text); }
body[data-page="profiles"] .lighting-toggle-seg[data-value="day"][data-selected="true"] {
  color: #f2c94c; background: rgba(242,201,76,.12);
}
body[data-page="profiles"] .lighting-toggle-seg[data-value="night"][data-selected="true"] {
  color: #7d9bd8; background: rgba(91,141,238,.14);
}
body[data-page="profiles"] .lighting-toggle-seg[data-value=""][data-selected="true"] {
  color: #a9bce0; background: rgba(169,188,224,.1);
}

body[data-page="profiles"] .stat-section { border-top: 1px solid var(--border2); }
body[data-page="profiles"] .table-scroll thead tr { border-top: 1px solid var(--border2); }
body[data-page="profiles"] .stat-section-head {
  padding: 10px 20px 8px;
  font-size: .65rem; font-weight: 500; color: var(--muted2);
  text-transform: uppercase; letter-spacing: .09em;
  border-bottom: 1px solid var(--border2);
  background: var(--surface2); font-family: var(--mono);
}
body[data-page="profiles"] .stat-grid { display: grid; grid-template-columns: repeat(4,1fr); }
body[data-page="profiles"] .stat-card { padding: 14px 18px; border-right: 1px solid var(--border2); border-bottom: 1px solid var(--border2); }
body[data-page="profiles"] .stat-card:nth-child(4n) { border-right: none; }
body[data-page="profiles"] .stat-grid.cols-3 { grid-template-columns: repeat(3,1fr); }
body[data-page="profiles"] .stat-grid.cols-3 .stat-card { border-right: 1px solid var(--border2); }
body[data-page="profiles"] .stat-grid.cols-3 .stat-card:nth-child(3n) { border-right: none; }
body[data-page="profiles"] .stat-grid.cols-2 { grid-template-columns: repeat(2,1fr); }
body[data-page="profiles"] .stat-grid.cols-2 .stat-card:nth-child(2n) { border-right: none; }
body[data-page="profiles"] .stat-grid.cols-6 { grid-template-columns: repeat(6,1fr); }
body[data-page="profiles"] .stat-grid.cols-6 .stat-card:nth-child(6n) { border-right: none; }
body[data-page="profiles"] .stat-last .stat-card { border-bottom: none; }
body[data-page="profiles"] .stat-card-val { font-size: 1.2rem; font-weight: 500; color: var(--text); line-height: 1; letter-spacing: -.02em; font-family: var(--mono); }
body[data-page="profiles"] .stat-card-label { font-size: .65rem; color: var(--muted2); margin-top: 5px; text-transform: uppercase; letter-spacing: .07em; }

/* Right-aligned header cells use .r (data cells use the shared .num, which
   already covers alignment + mono/weight/size styling - no need to redefine
   it here). */
body[data-page="profiles"] th.r, body[data-page="profiles"] td.r { text-align: right; }
body[data-page="profiles"] .map-name-cell { font-weight: 500; }
body[data-page="profiles"] .mode-cell   { font-size: .76rem; color: var(--muted); font-family: var(--mono); }
body[data-page="profiles"] .server-cell { font-size: .72rem; color: var(--muted2); font-family: var(--mono); }

body[data-page="profiles"] .breakdown { display: flex; align-items: center; gap: 14px; padding: 11px 20px; border-bottom: 1px solid var(--border2); }
body[data-page="profiles"] .breakdown:last-child { border-bottom: none; }
body[data-page="profiles"] .bd-label { width: 110px; flex-shrink: 0; font-size: .8rem; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body[data-page="profiles"] .bd-track { flex: 1; height: 3px; background: rgba(255,255,255,.07); border-radius: 2px; }
body[data-page="profiles"] .bd-fill  { height: 100%; border-radius: 2px; background: var(--accent); opacity: .6; }
body[data-page="profiles"] .bd-stats { display: flex; gap: 18px; flex-shrink: 0; }
body[data-page="profiles"] .bd-s     { text-align: right; }
body[data-page="profiles"] .bd-sv { font-size: .84rem; font-weight: 500; color: var(--text); display: block; font-family: var(--mono); }
body[data-page="profiles"] .bd-sl { font-size: .62rem; color: var(--muted2); text-transform: uppercase; letter-spacing: .07em; margin-top: 2px; display: block; }

/* ── Achievements ── */
body[data-page="profiles"] .ach-wrap { display: flex; flex-direction: column; }

body[data-page="profiles"] .ach-toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0,0,0,.15);
}
body[data-page="profiles"] .ach-cats-row { position: relative; }
body[data-page="profiles"] .ach-cats {
  display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
  overflow-x: auto; scrollbar-width: none;
  padding: 10px 20px 8px;
}
body[data-page="profiles"] .ach-cats::-webkit-scrollbar { display: none; }
body[data-page="profiles"] .ach-cats-fade {
  position: absolute; top: 0; right: 0; bottom: 8px; width: 56px;
  cursor: pointer; display: flex; align-items: center; justify-content: flex-end;
  padding: 0 6px 0 0; margin: 0; opacity: 1; transition: opacity .15s;
  background: linear-gradient(to right, transparent, var(--surface) 30%);
  border: none; font: inherit;
}
body[data-page="profiles"] .ach-cats-fade-left {
  right: auto; left: 0;
  justify-content: flex-start;
  padding: 0 0 0 6px;
  background: linear-gradient(to left, transparent, var(--surface) 30%);
}
body[data-page="profiles"] .ach-cats-fade.hidden { opacity: 0; pointer-events: none; }
body[data-page="profiles"] .ach-cats-fade svg { width: 20px; height: 20px; color: var(--muted); pointer-events: none; stroke-width: 3.5; }
body[data-page="profiles"] .ach-cats-fade:hover svg { color: var(--text); }
body[data-page="profiles"] .ach-cat-btn {
  padding: 3px 10px; font-size: .71rem; font-family: 'Inter', sans-serif;
  cursor: pointer; border-radius: 3px; flex: none;
  border: 1px solid var(--border); background: transparent; color: var(--text);
  transition: all .12s; white-space: nowrap;
}
body[data-page="profiles"] .ach-cat-btn:hover { color: var(--text); border-color: rgba(255,255,255,.18); }
body[data-page="profiles"] .ach-cat-btn.active { border-color: var(--accent-border); color: var(--accent); background: var(--accent-dim); }

body[data-page="profiles"] .ach-summary {
  display: flex; align-items: center; gap: 14px;
  padding: 4px 20px 12px;
  font-family: 'Inter', sans-serif; font-size: .7rem; color: var(--muted);
}
body[data-page="profiles"] .ach-sum-track { flex: 1; height: 2px; background: rgba(255,255,255,.07); border-radius: 2px; }
body[data-page="profiles"] .ach-sum-fill  { height: 100%; border-radius: 2px; background: var(--accent); opacity: .55; }
body[data-page="profiles"] .ach-sum-count { flex-shrink: 0; color: var(--muted2); }

body[data-page="profiles"] .ach-section { border-top: 1px solid var(--border2); }
body[data-page="profiles"] .ach-section:first-child { border-top: none; }
body[data-page="profiles"] .ach-section-head {
  padding: 9px 20px 7px;
  font-size: .64rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .1em;
  border-bottom: 1px solid var(--border2);
  background: var(--surface2); font-family: 'Inter', sans-serif;
  display: flex; align-items: center; gap: 8px;
}
body[data-page="profiles"] .ach-section-count {
  font-size: .6rem; color: var(--muted);
  background: rgba(255,255,255,.07); border: 1px solid var(--border2);
  border-radius: 3px; padding: 1px 5px;
}

body[data-page="profiles"] .ach-subhead {
  padding: 10px 20px 4px;
  font-size: .64rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .09em;
  font-family: 'Inter', sans-serif;
}
body[data-page="profiles"] .ach-grid { display: grid; grid-template-columns: 1fr 1fr; }
body[data-page="profiles"] .ach-card {
  display: flex; align-items: center; gap: 10px;
  align-self: start;
  padding: 12px 18px;
  border-right: 1px solid var(--border2); border-bottom: 1px solid var(--border2);
  transition: background .1s; min-width: 0;
}
body[data-page="profiles"] .ach-card:nth-child(2n) { border-right: none; }
body[data-page="profiles"] .ach-card:last-child,
body[data-page="profiles"] .ach-card:nth-last-child(2):nth-child(2n+1) { border-bottom: none; }
body[data-page="profiles"] .ach-card.locked { opacity: .38; }
body[data-page="profiles"] .ach-card.secret.locked { opacity: .22; }
body[data-page="profiles"] .ach-card:hover { background: rgba(255,255,255,.02); }
body[data-page="profiles"] .ach-card:not(.locked) {
  background: rgba(111,207,151,.07);
  box-shadow: inset 3px 0 0 0 #6fcf97;
}
body[data-page="profiles"] .ach-card:not(.locked):hover { background: rgba(111,207,151,.12); }

body[data-page="profiles"] .tp-wood     { background: #a67c4e; }
body[data-page="profiles"] .tp-iron     { background: #5a6070; }
body[data-page="profiles"] .tp-bronze   { background: #8a5c2e; }
body[data-page="profiles"] .tp-silver   { background: #7a8898; }
body[data-page="profiles"] .tp-gold     { background: #c5922a; }
body[data-page="profiles"] .tp-platinum { background: #6ab3c8; }
body[data-page="profiles"] .tp-diamond  { background: #7c9cf5; }
body[data-page="profiles"] .tp-warlord  { background: #c44f4f; }
body[data-page="profiles"] .tp-secret   { background: #8860d0; }

body[data-page="profiles"] .ach-info { min-width: 0; flex: 1; }
body[data-page="profiles"] .ach-label { font-size: .8rem; font-weight: 500; color: var(--text); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body[data-page="profiles"] .ach-card.locked .ach-label { color: var(--muted); }
body[data-page="profiles"] .ach-card.secret.locked .ach-label { font-style: italic; }
body[data-page="profiles"] .ach-desc { font-size: .67rem; color: var(--muted); margin-top: 3px; line-height: 1.4; }
body[data-page="profiles"] .ach-footer { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
body[data-page="profiles"] .ach-xp { font-size: .67rem; color: var(--accent); font-family: 'Inter', sans-serif; }
body[data-page="profiles"] .ach-tier-chip {
  font-size: .6rem; font-weight: 600; font-family: 'Inter', sans-serif;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 7px; border-radius: 4px; border: 1px solid; line-height: 1.5;
}
body[data-page="profiles"] .ach-meta {
  margin-top: 16px; padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
}
body[data-page="profiles"] .ach-unlocked-date {
  font-size: .7rem; color: #6fcf97; font-family: 'Inter', sans-serif;
}
body[data-page="profiles"] .ach-pct {
  font-size: .7rem; color: var(--muted); font-family: 'Inter', sans-serif;
}
body[data-page="profiles"] .ach-meta-sep {
  font-size: .7rem; color: var(--muted); opacity: .5;
}
body[data-page="profiles"] .ach-unlocked-badge {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(111,207,151,.18); border: 1px solid rgba(111,207,151,.5);
  box-shadow: 0 0 8px rgba(111,207,151,.35);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-left: auto;
}
body[data-page="profiles"] .ach-unlocked-badge svg { color: #6fcf97; }
body[data-page="profiles"] .ach-lock-badge {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,.04); border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-left: auto;
}
body[data-page="profiles"] .ach-lock-badge svg { width: 15px; height: 15px; color: var(--muted2); }

/* Full-screen loader shown before the profile shell is revealed - distinct
   from the shared inline .state-box (which is used for per-tab loading). */
#loading-screen {
  position: fixed; inset: 0; z-index: 999; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
#loading-screen .spinner { width: 24px; height: 24px; }
#loading-screen .msg { font-size: .74rem; color: var(--muted); font-family: var(--mono); }

body[data-page="profiles"] .community-strip {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; padding: 24px 0 32px;
}
body[data-page="profiles"] .community-text .cs-title { font-size: .9rem; font-weight: 500; color: var(--text); margin-bottom: 3px; }
body[data-page="profiles"] .community-text .cs-sub   { font-size: .76rem; color: var(--muted); }
body[data-page="profiles"] .community-btns { display: flex; gap: 10px; flex-wrap: wrap; }
body[data-page="profiles"] .cs-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; font-family: 'Inter', sans-serif; font-size: .78rem; font-weight: 500;
  border-radius: 6px; text-decoration: none;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: background .15s, border-color .15s;
}
body[data-page="profiles"] .cs-btn:hover { background: var(--surface2); border-color: rgba(255,255,255,.12); }
body[data-page="profiles"] .cs-btn svg { flex-shrink: 0; }
body[data-page="profiles"] .cs-btn.discord { color: #7c8df0; border-color: rgba(124,141,240,.2); background: rgba(124,141,240,.05); }
body[data-page="profiles"] .cs-btn.discord:hover { background: rgba(124,141,240,.1); }
body[data-page="profiles"] .cs-btn.steam   { color: #a0b0c0; border-color: rgba(160,176,192,.15); background: rgba(160,176,192,.04); }
body[data-page="profiles"] .cs-btn.steam:hover { background: rgba(160,176,192,.08); }

/* ── Weapons tab ── */
body[data-page="profiles"] .weapons-hero {
  display: grid; grid-template-columns: 1fr 1fr 280px;
  border-top: 1px solid var(--border2);
}
body[data-page="profiles"] .sig-panel { padding: 20px 24px; border-right: 1px solid var(--border2); }
body[data-page="profiles"] .wpn-sec-lbl {
  font-size: .62rem; font-weight: 500; color: var(--muted2);
  text-transform: uppercase; letter-spacing: .09em; font-family: var(--mono); margin-bottom: 10px;
}
body[data-page="profiles"] .sig-name {
  font-size: 1.4rem; font-weight: 500; color: var(--text);
  letter-spacing: -.02em; font-family: var(--mono); line-height: 1;
}
body[data-page="profiles"] .wpn-stat-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  column-gap: 20px; row-gap: 16px; margin-top: 16px;
}
body[data-page="profiles"] .wpn-stat-l {
  font-size: .62rem; color: var(--muted2); text-transform: uppercase;
  letter-spacing: .07em; margin-bottom: 4px;
}
body[data-page="profiles"] .wpn-stat-v {
  font-size: 1.3rem; font-weight: 500; color: var(--text); font-family: var(--mono);
  line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
body[data-page="profiles"] .wpn-stat-v-count { font-size: .85em; color: var(--muted2); font-weight: 400; }
/* Third stat (Weapons Used / First Blood Weapon) spans the full row so its
   divider runs the whole card width, but its own text still starts flush
   with column 1 above it — same left edge, so the two rows read as one
   aligned column instead of two differently-shaped blocks. */
body[data-page="profiles"] .wpn-stat-full {
  grid-column: 1 / -1;
  padding-top: 16px; border-top: 1px solid var(--border2);
}
body[data-page="profiles"] .sig-chips { display: flex; gap: 7px; margin-top: 12px; flex-wrap: wrap; }
body[data-page="profiles"] .sig-chip {
  font-size: .66rem; font-family: var(--mono); padding: 2px 8px; border-radius: 3px;
  background: rgba(255,255,255,.04); border: 1px solid var(--border); color: var(--muted);
}
body[data-page="profiles"] .sig-chip.hi { border-color: var(--accent-border); color: var(--accent); background: var(--accent-dim); }
/* Nemesis panel reuses the exact sig-panel look — same component, different
   data (deaths-to instead of kills-with) — so the two read as a matched
   pair either side of the donut instead of two unrelated widgets. */
body[data-page="profiles"] .nem-panel { border-right: 1px solid var(--border2); }

body[data-page="profiles"] .donut-panel {
  padding: 18px 16px; display: flex; flex-direction: column; align-items: center;
}
body[data-page="profiles"] .donut-outer { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
body[data-page="profiles"] .donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
body[data-page="profiles"] .donut-center-val { font-size: 1.15rem; font-weight: 500; color: var(--text); font-family: var(--mono); }
body[data-page="profiles"] .donut-center-lbl { font-size: .64rem; color: var(--muted2); text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
body[data-page="profiles"] .cat-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-top: 14px; width: 100%; }
body[data-page="profiles"] .cat-li { display: flex; align-items: center; gap: 6px; min-width: 0; }
body[data-page="profiles"] .cat-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
body[data-page="profiles"] .cat-li-name { font-size: .74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
body[data-page="profiles"] .cat-li-val { font-size: .72rem; color: var(--muted2); font-family: var(--mono); flex-shrink: 0; }

body[data-page="profiles"] .wpn-list-title {
  padding: 16px 20px 14px; text-align: center; position: relative;
  border-top: 1px solid var(--border2);
  background: linear-gradient(180deg, var(--surface2), rgba(255,255,255,0));
}
body[data-page="profiles"] .wpn-list-title-text {
  font-size: .8rem; font-weight: 700; color: var(--text);
  text-transform: uppercase; letter-spacing: .14em; font-family: var(--mono);
}
body[data-page="profiles"] .wpn-list-header {
  display: flex; align-items: center; gap: 32px; padding: 8px 20px;
  background: var(--surface2); border-bottom: 1px solid var(--border2);
  font-size: .6rem; color: var(--muted2); text-transform: uppercase; letter-spacing: .08em; font-family: var(--mono);
}
body[data-page="profiles"] .wpn-row {
  display: flex; align-items: center; gap: 32px;
  padding: 9px 20px; border-bottom: 1px solid var(--border2);
}
body[data-page="profiles"] .wpn-row:last-child { border-bottom: none; }
body[data-page="profiles"] .wpn-rank { font-family: var(--mono); font-size: .68rem; color: var(--muted2); width: 16px; flex-shrink: 0; text-align: right; }
body[data-page="profiles"] .wpn-name { flex: 1; font-size: .83rem; font-weight: 500; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body[data-page="profiles"] .wpn-tk { width: 38px; flex-shrink: 0; text-align: center; }
body[data-page="profiles"] .wpn-tk-v { font-family: var(--mono); font-size: .72rem; font-weight: 400; color: var(--muted); }
body[data-page="profiles"] .wpn-kills { font-family: var(--mono); font-size: .78rem; font-weight: 500; color: var(--text); width: 46px; text-align: center; flex-shrink: 0; }
body[data-page="profiles"] .wpn-pct { font-family: var(--mono); font-size: .67rem; color: var(--muted2); width: 42px; text-align: center; flex-shrink: 0; }
body[data-page="profiles"] .wpn-deaths { width: 56px; }
body[data-page="profiles"] .wpn-assists { width: 50px; }
body[data-page="profiles"] .wpn-deaths,
body[data-page="profiles"] .wpn-assists { font-family: var(--mono); font-size: .72rem; color: var(--muted); text-align: center; flex-shrink: 0; }
body[data-page="profiles"] .wpn-lbrank { font-family: var(--mono); font-size: .68rem; color: var(--muted2); width: 64px; text-align: center; flex-shrink: 0; }
body[data-page="profiles"] .wpn-lbrank a { color: inherit; text-decoration: none; }
body[data-page="profiles"] .wpn-rank-num { color: var(--muted2); }
body[data-page="profiles"] .wpn-lbrank a:hover .wpn-rank-num { text-decoration: underline; }
/* Header row reuses the same width/hide classes as the body cells (see
   weapons.html) purely for alignment and for the mobile column-hiding
   rule below - reset the typography back to the header's own small,
   muted, uppercase label look instead of the body row's styling. */
body[data-page="profiles"] .wpn-list-header .wpn-rank,
body[data-page="profiles"] .wpn-list-header .wpn-name,
body[data-page="profiles"] .wpn-list-header .wpn-kills,
body[data-page="profiles"] .wpn-list-header .wpn-pct,
body[data-page="profiles"] .wpn-list-header .wpn-deaths,
body[data-page="profiles"] .wpn-list-header .wpn-assists,
body[data-page="profiles"] .wpn-list-header .wpn-tk,
body[data-page="profiles"] .wpn-list-header .wpn-sb,
body[data-page="profiles"] .wpn-list-header .wpn-lbrank {
  font-size: inherit; color: inherit; font-weight: inherit; font-family: inherit;
  text-align: center; white-space: normal; overflow: visible; text-overflow: clip;
}
body[data-page="profiles"] .wpn-list-header .wpn-name { text-align: left; }
@media (max-width: 900px) {
  body[data-page="profiles"] .wpn-deaths,
  body[data-page="profiles"] .wpn-assists,
  body[data-page="profiles"] .wpn-tk,
  body[data-page="profiles"] .wpn-sb { display: none; }
}

/* ── Patterns tab ── */
body[data-page="profiles"] .pat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border2);
}
body[data-page="profiles"] .pat-wide { grid-column: 1 / -1; }
body[data-page="profiles"] .pat-panel {
  padding: 18px 22px; border-right: 1px solid var(--border2); border-bottom: 1px solid var(--border2);
  display: flex; flex-direction: column; justify-content: center; min-height: 92px;
}
body[data-page="profiles"] .pat-panel.no-right { border-right: none; }
body[data-page="profiles"] .pat-panel.no-bottom { border-bottom: none; }
/* Belt-and-suspenders in case a caller ever supplies a different panel
   count: the 4th column and the final visible row still lose their
   trailing border even without the explicit no-right/no-bottom flag. */
body[data-page="profiles"] .pat-grid > .pat-panel:nth-child(4n) { border-right: none; }
body[data-page="profiles"] .pat-lbl {
  font-size: .64rem; font-weight: 500; color: var(--muted2);
  text-transform: uppercase; letter-spacing: .09em; font-family: var(--mono); margin-bottom: 10px;
}
body[data-page="profiles"] .pat-v { font-size: 1.5rem; font-weight: 600; color: var(--text); font-family: var(--mono); line-height: 1; letter-spacing: -.01em; }
body[data-page="profiles"] a.pat-v-link { text-decoration: none; }
body[data-page="profiles"] a.pat-v-link:hover { color: var(--accent); text-decoration: underline; }
body[data-page="profiles"] .pat-l { font-size: .68rem; color: var(--muted); margin-top: 6px; }

body[data-page="profiles"] .dth-bar { display: flex; height: 7px; border-radius: 4px; overflow: hidden; margin: 8px 0 6px; background: rgba(255,255,255,.05); }
body[data-page="profiles"] .dth-seg { height: 100%; }
body[data-page="profiles"] .dth-legend { display: flex; gap: 10px; flex-wrap: wrap; }
body[data-page="profiles"] .dth-li { display: flex; align-items: center; gap: 4px; font-size: .64rem; color: var(--muted); }
body[data-page="profiles"] .dth-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* Best teammates panel — reuses the same avatar/name/pid-mini/platform-icon
   "player cell" component as the players list & search results, spread
   across a row alongside three stat columns instead of cramming them into
   small subtext next to the name. */
body[data-page="profiles"] .tm-list { display: flex; flex-direction: column; margin-top: 6px; }
body[data-page="profiles"] .tm-row {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 8px; margin: 0 -8px; border-radius: 4px; cursor: pointer;
}
body[data-page="profiles"] .tm-row:hover { background: rgba(255,255,255,.04); }
body[data-page="profiles"] .tm-row:hover .player-name { color: var(--accent); }
body[data-page="profiles"] .tm-avatar-wrap { position: relative; width: 40px; aspect-ratio: 1/1; flex-shrink: 0; background: var(--surface2); overflow: hidden; }
body[data-page="profiles"] .tm-avatar-wrap img.list-av { width: 100%; height: 100%; object-fit: cover; display: block; border: none; }
body[data-page="profiles"] .tm-avatar-wrap .avatar-fb { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--accent); }
body[data-page="profiles"] .tm-id-block { flex: 1 1 240px; min-width: 0; }
body[data-page="profiles"] .tm-id-block .platform-icon { width: 26px; height: 26px; padding: 3px; border: none; background: none; border-radius: 0; }
body[data-page="profiles"] .tm-id-block a.platform-icon.steam,
body[data-page="profiles"] .tm-id-block a.platform-icon.steam:hover { border: none; background: none; }
body[data-page="profiles"] .tm-stat { flex: 0 0 auto; width: 110px; text-align: center; }
body[data-page="profiles"] .tm-stat-v { font-family: var(--mono); font-size: .95rem; color: var(--text); line-height: 1; }
body[data-page="profiles"] .tm-stat-l { font-size: .57rem; color: var(--muted2); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
body[data-page="profiles"] .tm-stat-total .tm-stat-v { color: var(--accent); font-weight: 500; }
body[data-page="profiles"] .tm-row + .tm-row { border-top: 1px solid var(--border2); }
@media (max-width: 760px) {
  body[data-page="profiles"] .tm-row { flex-wrap: wrap; }
  body[data-page="profiles"] .tm-id-block { flex-basis: 100%; order: -1; margin-bottom: 4px; }
  body[data-page="profiles"] .tm-stat { flex: 1 1 0; width: auto; min-width: 0; text-align: left; }
}

@media (max-width: 640px) {
  body[data-page="profiles"] .rounds-table th,
  body[data-page="profiles"] .rounds-table td { padding: 8px 12px; }
}

/* Day vs. night panel — each side is its own padded, bordered card so the
   K/D headline and the kills/deaths breakdown underneath both get real
   room, instead of stacking flush against each other in one cramped column. */
body[data-page="profiles"] .dn-row { display: flex; margin-top: 8px; border: 1px solid var(--border2); border-radius: 4px; overflow: hidden; }
body[data-page="profiles"] .dn-side { flex: 1 1 0; padding: 16px 20px; }
body[data-page="profiles"] .dn-side + .dn-side { border-left: 1px solid var(--border2); }
body[data-page="profiles"] .dn-lbl { font-size: .64rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--muted2); font-family: var(--mono); }
body[data-page="profiles"] .dn-kd { font-family: var(--mono); font-size: 1.6rem; font-weight: 600; color: var(--text); margin-top: 10px; letter-spacing: -.01em; }
body[data-page="profiles"] .dn-sub { font-size: .62rem; color: var(--muted); margin-top: 4px; }
body[data-page="profiles"] .dn-stat-row { display: flex; gap: 22px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border2); }
body[data-page="profiles"] .dn-stat { display: flex; flex-direction: column; }
body[data-page="profiles"] .dn-stat-v { font-family: var(--mono); font-size: .9rem; color: var(--text); line-height: 1; }
body[data-page="profiles"] .dn-stat-l { font-size: .6rem; color: var(--muted2); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
@media (max-width: 640px) {
  body[data-page="profiles"] .dn-row { flex-direction: column; }
  body[data-page="profiles"] .dn-side + .dn-side { border-left: none; border-top: 1px solid var(--border2); }
}


body[data-page="profiles"] .peak-bars { display: flex; align-items: flex-end; gap: 2px; height: 42px; }
body[data-page="profiles"] .peak-b { flex: 1; border-radius: 2px 2px 0 0; min-height: 2px; background: var(--accent); opacity: .45; cursor: default; transition: opacity .1s; position: relative; }
body[data-page="profiles"] .peak-b:hover { opacity: .85; }
body[data-page="profiles"] .peak-b[title]:hover::after {
  content: attr(title);
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--border); border-radius: 3px;
  font-size: .6rem; color: var(--text); font-family: var(--mono); white-space: nowrap; padding: 2px 5px;
  pointer-events: none; z-index: 10;
}
body[data-page="profiles"] .peak-lbl-row {
  display: flex; justify-content: space-between; margin-top: 3px;
  font-size: .57rem; color: var(--muted2); font-family: var(--mono);
}

/* ── Round drill-down ── */
body[data-page="profiles"] tr.match-row { cursor: pointer; }
body[data-page="profiles"] tr.match-row.open td { background: rgba(255,255,255,.03); }
body[data-page="profiles"] tr.rounds-row td { padding: 0; border-bottom: 1px solid var(--border2); }
body[data-page="profiles"] tr.rounds-row.hidden { display: none; }
body[data-page="profiles"] .rounds-inner { padding: 8px 16px 12px; width: 100%; box-sizing: border-box; overflow-x: auto; -webkit-overflow-scrolling: touch; }
body[data-page="profiles"] .rounds-table { width: auto; border-collapse: collapse; font-size: .78rem; }
body[data-page="profiles"] .rounds-table th,
body[data-page="profiles"] .rounds-table td { white-space: nowrap; }
body[data-page="profiles"] .rounds-table th {
  padding: 8px 26px; text-align: center; font-size: .6rem; font-weight: 500;
  color: var(--muted2); text-transform: uppercase; letter-spacing: .08em;
  font-family: var(--mono); border-bottom: 1px solid var(--border2);
}
body[data-page="profiles"] .rounds-table th:first-child { text-align: left; }
body[data-page="profiles"] .rounds-table td { padding: 8px 26px; border-bottom: 1px solid rgba(255,255,255,.04); color: var(--text); font-family: var(--mono); }
body[data-page="profiles"] .rounds-table tr:last-child td { border-bottom: none; }
body[data-page="profiles"] .rounds-table td:first-child { text-align: left; color: var(--muted2); }
body[data-page="profiles"] .rounds-table td.num { text-align: center; }
body[data-page="profiles"] .r-badge { display: inline-block; font-size: .55rem; font-weight: 600; padding: 1px 4px;
           border-radius: 2px; margin-left: 4px; vertical-align: middle; letter-spacing: .04em; }
body[data-page="profiles"] .r-badge.fb   { background: rgba(242,201,76,.15); color: #f2c94c; }
body[data-page="profiles"] .r-badge.perf { background: rgba(111,207,151,.15); color: #6fcf97; }
body[data-page="profiles"] .rounds-loading { padding: 12px 16px; color: var(--muted2); font-size: .75rem; font-family: var(--mono); }

@media (max-width: 640px) {
  body[data-page="profiles"] #page-main.page { padding: 14px 12px 0; }
  body[data-page="profiles"] .hero { padding: 14px 14px; }
  /* Below this width, name and level box stack instead of sitting side
     by side in identity-col. */
  body[data-page="profiles"] .avatar-wrap { width: 68px; }
  body[data-page="profiles"] .identity-col { flex-direction: column; align-items: stretch; gap: 8px; }
  body[data-page="profiles"] .identity-col .level-box { flex: 1 1 auto; min-width: 0; padding: 10px 0 0; border-left: none; border-top: 1px solid var(--border2); }
  body[data-page="profiles"] .xp-strip { padding: 11px 16px; }
  body[data-page="profiles"] .stat-grid        { grid-template-columns: repeat(2,1fr); }
  body[data-page="profiles"] .stat-grid.cols-3 { grid-template-columns: repeat(2,1fr); }
  body[data-page="profiles"] .stat-grid.cols-3 .stat-card:nth-child(3n) { border-right: 1px solid var(--border2); }
  body[data-page="profiles"] .stat-grid.cols-3 .stat-card:nth-child(2n) { border-right: none; }
  body[data-page="profiles"] .stat-grid.cols-6 { grid-template-columns: repeat(2,1fr); }
  body[data-page="profiles"] .stat-card:nth-child(2n) { border-right: none; }
  body[data-page="profiles"] .ach-grid { grid-template-columns: 1fr; }
  body[data-page="profiles"] .ach-card { border-right: none; }
  body[data-page="profiles"] .ach-card:last-child { border-bottom: none; }
  body[data-page="profiles"] .bd-label { width: 80px; }
  body[data-page="profiles"] .bd-stats { gap: 10px; }
  body[data-page="profiles"] .community-strip { flex-direction: column; align-items: flex-start; }
  body[data-page="profiles"] .weapons-hero { grid-template-columns: 1fr; }
  body[data-page="profiles"] .sig-panel { border-right: none; border-bottom: 1px solid var(--border2); }
  body[data-page="profiles"] .nem-panel { border-right: none; border-bottom: 1px solid var(--border2); }
  body[data-page="profiles"] .donut-panel { flex-direction: row; gap: 16px; align-items: flex-start; }
  body[data-page="profiles"] .pat-grid { grid-template-columns: 1fr 1fr; }
  body[data-page="profiles"] .pat-panel { border-right: 1px solid var(--border2); min-height: 78px; padding: 14px 16px; }
  body[data-page="profiles"] .pat-grid > .pat-panel:nth-child(4n) { border-right: 1px solid var(--border2); }
  body[data-page="profiles"] .pat-grid > .pat-panel:nth-child(2n) { border-right: none; }
  body[data-page="profiles"] .pat-panel.no-bottom { border-bottom: 1px solid var(--border2); }
  body[data-page="profiles"] .pat-grid > .pat-panel:nth-child(11),
  body[data-page="profiles"] .pat-grid > .pat-panel:nth-child(12) { border-bottom: none; }
  body[data-page="profiles"] .dn-row { flex-direction: column; gap: 14px; }
}


/* =============================================================================
   LEADERBOARD CONTROLS BAR
   Replaces the old standalone .tab-row of 15 pill buttons with a single
   grouped <select> plus the rank search, laid out side by side. Reuses
   .search-wrap/.search-input/.search-btn and .rank-search-result already
   defined above; only the dropdown itself and the row layout are new.
   ============================================================================= */
.lb-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  margin-bottom: 14px;
}
.lb-controls-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
}
.category-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}
.category-select-label {
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.category-select {
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: .84rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.category-select:hover { border-color: rgba(255,255,255,.15); }
.category-select:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.category-select optgroup {
  font-family: var(--mono);
  font-style: normal;
  color: var(--muted2);
  background: var(--surface2);
}
.category-select option {
  color: var(--text);
  background: var(--surface2);
}
.lb-controls .rank-search {
  width: 100%;
  max-width: none;
  margin-bottom: 0;
}
.lb-controls .rank-search .search-input { flex: 1; }

/* "Find your rank" result - was plain unstyled textContent dropped onto
   the page (no card, no icon, no color), which read as a debug string
   next to an otherwise fully-designed page. Now a small pill matching the
   card language used elsewhere (accent-tinted on a hit, neutral on a miss),
   with an icon so the state reads at a glance without parsing the sentence. */
.rank-search-result {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin: 12px 0 4px;
  border-radius: 0;
  border: 1px solid var(--border2);
  background: var(--surface);
  font-family: 'Inter', sans-serif;
  font-size: .84rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.4;
}
.rank-search-result.visible { display: flex; }
.rank-search-result strong { font-weight: 600; color: var(--text); }
.rank-search-result .rsr-icon {
  flex-shrink: 0;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
}
.rank-search-result .rsr-icon svg { width: 100%; height: 100%; display: block; }
.rank-search-result .rsr-rank {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  font-family: var(--mono); font-size: .72rem; font-weight: 600;
  background: rgba(255,255,255,.08); color: var(--text);
  margin: 0 1px;
}
.rank-search-result.hit {
  color: var(--text);
  background: var(--accent-dim);
  border-color: var(--accent-border);
}
.rank-search-result.hit .rsr-icon { color: var(--accent); }
.rank-search-result.hit .rsr-rank { background: var(--accent); color: #06171c; }
.rank-search-result.miss .rsr-icon { color: var(--muted2); }
.rank-search-result.loading { color: var(--muted2); font-style: italic; }

@media (max-width: 640px) {
  .lb-controls-top { flex-direction: column; align-items: stretch; }
  .category-select-wrap { min-width: 0; }
}


@keyframes rankPulse { 0%,100% { background: rgba(255,204,0,.16); } 50% { background: rgba(255,204,0,.05); } }
tr.rank-hit td { animation: rankPulse 1.4s ease 2; }




/* ============================================================================
   RANKINGS TAB  (profiles/player/leaderboard.html)
   Reuses .profile-card/.hero/.tabs/.tab-btn/.state-box/.spinner/.rank-medal
   already defined above.
   ============================================================================= */
body[data-page="profiles"] .rk-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border2);
}
body[data-page="profiles"] .rk-card {
  background: var(--surface);
  position: relative;
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background .12s;
}
body[data-page="profiles"] .rk-card:hover { background: var(--surface2); }
/* Top-3 highlight is a separate absolutely-positioned frame drawn flush
   over the card's own edges (inset -1px reaches into the shared 1px grid
   gap), so it fully replaces the neutral gray line on all 4 sides instead
   of stacking a second border next to it. Stacked by rank so gold always
   wins the corner where two different medal colors would otherwise meet. */
body[data-page="profiles"] .rk-card.rk-top3::after {
  content: '';
  position: absolute;
  inset: -1px;
  border: 1px solid;
  pointer-events: none;
}
body[data-page="profiles"] .rk-card.rk-rank-1::after { border-color: #cf9f35; z-index: 3; }
body[data-page="profiles"] .rk-card.rk-rank-2::after { border-color: #aab3bf; z-index: 2; }
body[data-page="profiles"] .rk-card.rk-rank-3::after { border-color: #b5723f; z-index: 1; }
body[data-page="profiles"] .rk-standalone { margin-top: 12px; }
body[data-page="profiles"] .rk-standalone .rk-card {
  border: 1px solid var(--border2);
  border-radius: var(--r);
  overflow: hidden;
}
body[data-page="profiles"] .rk-standalone .rk-card.rk-top3::after { inset: -1px; border-radius: var(--r); }
body[data-page="profiles"] .rk-standalone .rk-card.rk-rank-1::after { border-color: #cf9f35; }
body[data-page="profiles"] .rk-standalone .rk-card.rk-rank-2::after { border-color: #aab3bf; }
body[data-page="profiles"] .rk-standalone .rk-card.rk-rank-3::after { border-color: #b5723f; }
body[data-page="profiles"] .rk-card-top { display: flex; align-items: center; justify-content: space-between; }
body[data-page="profiles"] .rk-card-label { font-family: 'Inter', sans-serif; font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted2); }
body[data-page="profiles"] .rk-rank-num { font-family: var(--mono); font-weight: 500; font-size: .8rem; color: var(--accent); }
body[data-page="profiles"] .rk-card-mid { flex: 1; }
body[data-page="profiles"] .rk-card-value { font-size: 1.15rem; font-weight: 500; color: var(--text); letter-spacing: -.01em; }
body[data-page="profiles"] .rk-unranked-msg { font-family: var(--mono); font-size: .78rem; color: var(--muted2); }
body[data-page="profiles"] .rk-card.rk-unranked { opacity: .6; }
body[data-page="profiles"] .rk-card-foot { display: flex; align-items: center; justify-content: space-between; font-family: 'Inter', sans-serif; font-weight: 500; font-size: .7rem; color: var(--muted2); }
body[data-page="profiles"] .rk-pctile { color: var(--green); background: rgba(111,207,151,.1); border: 1px solid rgba(111,207,151,.25); border-radius: 3px; padding: 1px 6px; font-weight: 600; }
body[data-page="profiles"] .rk-card-note { font-family: var(--mono); font-size: .6rem; color: var(--muted2); font-style: italic; }

@media (max-width: 640px) {
  body[data-page="profiles"] .rk-grid { grid-template-columns: 1fr; }
}


/* ============================================================================
    REPLAYS DOWNLOAD BUTTON
   ============================================================================= */
.mh-replay-row {
  display: flex;
  justify-content: flex-end;
  padding: 0 32px 20px;
}
.btn-disabled-muted {
  opacity: .5;
  cursor: default;
}


.team-panel .team-header{
  position: relative;
  padding-left: 100px; /* room for the icon watermark */
}
.team-icon-lg{
  position: absolute !important;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 74px !important;
  height: 74px !important;
  object-fit: contain;
  z-index: 2; /* above ::before/::after overlays */
  flex-shrink: 0;
}
.team-left{
  padding-left: 0;
}
