/* Player profile page -- built on top of the shared tokens/components in
   styles.css (dark/light custom properties, tier colors, header, footer).
   This file only adds the profile-specific layout. */

.back-link {
  color: var(--text-dim);
  font-size: 14px;
  white-space: nowrap;
}
/* Profile header: brand on the far left, "All players" right beside the
   search bar, and the search bar itself centered on the page. */
.profile-header-inner {
  display: grid;
  grid-template-columns: 1fr minmax(0, 480px) 1fr;
  align-items: center;
  gap: 16px;
}
.header-left {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}
.profile-header-inner .global-search { max-width: none; width: 100%; }
.back-link:hover { color: var(--text); }

#profile-main {
  flex: 1 1 auto;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

/* ---------- Profile header ---------- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.profile-portrait {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  flex: 0 0 auto;
}
.profile-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.profile-id { flex: 1 1 220px; min-width: 0; }
.profile-id h1 {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-region {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 6px;
}
.profile-flag { font-size: 16px; line-height: 1; }
.profile-region:empty { display: none; }

.profile-aliases {
  color: var(--text-faint);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-aliases:empty { display: none; }

.tier-card {
  flex: 0 0 auto;
  text-align: center;
  padding: 10px 20px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  min-width: 140px;
}
.tier-card-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.tier-card-value {
  font-size: 20px;
  font-weight: 800;
  margin: 2px 0;
}
.tier-card-sub {
  font-size: 12px;
  color: var(--text-dim);
}

/* Tier color: see the shared [data-tier] rules in styles.css. */
.tier-card-value[data-tier] { color: var(--tc); }

/* ---------- Stat tiles ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-tile {
  padding: 14px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.stat-value {
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.stat-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.stat-toggle {
  margin-top: 4px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 999px;
}
.stat-toggle:hover { background: var(--accent-dim); }

/* ---------- Chart ---------- */
.chart-section {
  padding: 16px 16px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.chart-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.chart-header h2 { margin: 0; font-size: 16px; font-weight: 700; }
.chart-summary {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.chart-summary strong { color: var(--text); font-weight: 700; }
.chart-container { position: relative; width: 100%; }
.chart-container svg { display: block; width: 100%; height: auto; }
.chart-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 30px 0;
  font-size: 13px;
}

.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis-label {
  fill: var(--text-faint);
  font-size: 11px;
  font-family: inherit;
}
.chart-dot { fill: var(--accent); opacity: 0; }
.chart-guide { stroke: var(--text-faint); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-overlay { cursor: crosshair; }

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  transform: translate(-50%, -100%);
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 0.08s ease;
  z-index: 5;
}
.chart-tooltip.visible { opacity: 1; }
.chart-tooltip .tt-date { font-weight: 700; color: var(--text); }
.chart-tooltip .tt-row { color: var(--text-dim); }
.chart-tooltip .tt-row strong { color: var(--text); font-weight: 600; }

/* ---------- Best wins ---------- */
.bestwins-section {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.bestwins-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.bestwins-header h2 { margin: 0; font-size: 16px; font-weight: 700; }
.bestwins-hint { font-size: 12px; color: var(--text-faint); }
.bestwins-list { display: flex; flex-direction: column; gap: 6px; }
.bestwin-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.bestwin-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.bestwin-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800;
  color: var(--tier-grandmaster);
  background: color-mix(in srgb, var(--tier-grandmaster) 15%, transparent);
}
.bestwin-avg {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.bestwin-main { min-width: 0; }
.bestwin-opponents { font-weight: 700; font-size: 14px; }
.bestwin-opponents a, .bestwin-sub a { color: inherit; }
.bestwin-opponents a:hover, .bestwin-sub a:hover { color: var(--accent); }
.bestwin-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.bestwin-score {
  font-size: 16px;
  font-weight: 800;
  color: #4caf7d;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Strongest teammates ---------- */
.teammates-section {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.teammates-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.teammate-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 14px 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 0;
}
a.teammate-card:hover { border-color: var(--accent); }
.teammate-num {
  position: absolute;
  top: 8px; left: 10px;
  font-size: 12px; font-weight: 800;
  color: var(--text-faint);
}
.teammate-portrait {
  width: 56px; height: 56px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--bg-card);
  margin-bottom: 6px;
}
.teammate-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.teammate-tag {
  font-weight: 700; font-size: 14px;
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.teammate-rank { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.teammate-pct { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.teammate-pct.positive { color: #4caf7d; }
.teammate-pct.negative { color: #e2635b; }
.teammate-pct-label { font-size: 11px; color: var(--text-faint); margin-bottom: 4px; }
.teammate-record { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.teammate-best { font-size: 11px; color: var(--text-faint); margin-top: 3px; line-height: 1.35; }
.teammate-best:empty { display: none; }

/* ---------- Achievements ---------- */
.achievements-section {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.achievements-count { font-size: 13px; font-weight: 700; color: var(--text-dim); margin-left: 6px; }
.ach-carousel { position: relative; }
/* Horizontal pages of achievements: 5 rows x 3 columns visible on desktop,
   the rest one arrow-click away. */
.achievements-list {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(5, auto);
  grid-auto-columns: calc((100% - 16px) / 3);
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.achievements-list::-webkit-scrollbar { display: none; }
.achievements-list > .achievement { scroll-snap-align: start; }
.ach-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.ach-arrow:hover { border-color: var(--accent); color: var(--accent); }
.ach-arrow.next { right: -12px; }
.ach-arrow.prev { left: -12px; }
.achievement {
  --ach: var(--text-faint);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.achievement.earned { border-color: color-mix(in srgb, var(--ach) 45%, var(--border)); }
.achievement.common    { --ach: #4caf7d; }
.achievement.rare      { --ach: #3aa0c9; }
.achievement.epic      { --ach: #7c6ee8; }
.achievement.legendary { --ach: #e6b800; }
.achievement.locked { opacity: 0.5; }
.achievement-icon {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 17px; font-weight: 800;
  color: var(--ach);
  background: color-mix(in srgb, var(--ach) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--ach) 40%, transparent);
}
.achievement-body { min-width: 0; }
.achievement-name { font-weight: 800; font-size: 14px; }
.achievement.earned .achievement-name { color: var(--ach); }
.achievement-desc { font-size: 12px; color: var(--text-dim); line-height: 1.35; }
.achievement-detail { font-size: 11px; color: var(--text); margin-top: 4px; line-height: 1.35; overflow-wrap: anywhere; }
.achievement-rarity { font-size: 11px; color: var(--text-faint); margin-top: 3px; }

/* ---------- Players you may team well with ---------- */
.recs-section {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.recs-list { display: flex; flex-direction: column; gap: 6px; }
.rec-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.rec-portrait { width: 44px; height: 44px; flex: 0 0 auto; margin: 0; }
.rec-body { min-width: 0; }
.rec-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.rec-name { font-weight: 800; font-size: 14px; }
a.rec-name:hover { color: var(--accent); }
.rec-rank { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.rec-tier {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  color: var(--tc, var(--text-dim));
  background: color-mix(in srgb, var(--tc, var(--text-dim)) 15%, var(--bg-elevated));
}
.rec-reason { font-size: 13px; color: var(--text-dim); line-height: 1.45; margin-top: 3px; }

/* ---------- Head-to-heads ---------- */
.h2h-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.h2h-toggle {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.h2h-toggle:hover { background: var(--bg-card-hover); }
.h2h-toggle-title { font-size: 16px; font-weight: 700; }
.h2h-toggle-hint { font-size: 12px; color: var(--text-faint); flex: 1 1 auto; }
.h2h-toggle-chev { color: var(--text-faint); transition: transform 0.12s ease; }
.h2h-toggle.open .h2h-toggle-chev { transform: rotate(180deg); }
.h2h-panel { padding: 0 16px 16px; }
.h2h-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
#h2h-search {
  flex: 1 1 220px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
#h2h-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.h2h-modes { display: flex; gap: 4px; }
.h2h-mode {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.h2h-mode[aria-selected="true"] { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.h2h-count { font-size: 12px; color: var(--text-faint); }
.h2h-list { display: flex; flex-direction: column; }
.h2h-row {
  display: grid;
  grid-template-columns: 1fr 120px 56px;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.h2h-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h2h-name { font-weight: 700; color: var(--text); }
.h2h-person { white-space: nowrap; }
.h2h-rank {
  margin-left: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
a.h2h-name[href]:hover { color: var(--accent); }
.h2h-bar {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, #e2635b 35%, transparent);
  overflow: hidden;
}
.h2h-bar span { display: block; height: 100%; background: #4caf7d; }
.h2h-record { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.h2h-record.win { color: #4caf7d; }
.h2h-record.loss { color: #e2635b; }
.h2h-record.even { color: var(--text-dim); }
.h2h-more {
  margin: 10px auto 0;
  display: block;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.h2h-more:hover { color: var(--accent); border-color: var(--accent); }
.h2h-more[hidden], .h2h-panel[hidden] { display: none; }

/* ---------- Header search on profile pages ---------- */
.global-search { position: relative; flex: 1 1 auto; max-width: 420px; }
#global-search {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
#global-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.global-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  z-index: 30;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.global-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 14px;
}
.global-result img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.global-result:hover, .global-result.active { background: var(--bg-card-hover); }
.global-name { font-weight: 700; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-meta { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.global-empty { padding: 10px 12px; font-size: 13px; color: var(--text-dim); }

/* ---------- Tournaments list ---------- */
.tournaments-section {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tournaments-header h2 { margin: 0 0 10px; font-size: 16px; font-weight: 700; }

.tournaments-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tourney-search-wrap { flex: 1 1 200px; min-width: 160px; }
#tourney-search {
  width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
#tourney-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.year-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.year-tab {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.year-tab:hover { color: var(--text); }
.year-tab[aria-selected="true"] {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.lan-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
}

.sort-toggle {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.sort-toggle:hover { color: var(--text); border-color: var(--accent-dim); }

.tournaments-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tourney-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.tourney-item.open { border-color: var(--accent-dim); }
.tourney-row {
  cursor: pointer;
  display: grid;
  grid-template-columns: 44px 36px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
}
.tourney-row:hover { background: var(--bg-card-hover); }
.tourney-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tourney-chevron {
  display: inline-block;
  width: 14px;
  color: var(--text-faint);
  transition: transform 0.12s ease;
}
.tourney-item.open .tourney-chevron { transform: rotate(90deg); }

.tourney-matches {
  border-top: 1px solid var(--border);
  padding: 8px 12px 10px;
  font-size: 13px;
  color: var(--text-dim);
}
.match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
}
.match-row + .match-row { border-top: 1px dashed var(--border); }
.match-teams { min-width: 0; color: var(--text); line-height: 2; }
.match-player { color: var(--text); }
a.match-player:hover { color: var(--accent); }
.match-person { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.match-elo {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  font-variant-numeric: tabular-nums;
}
.match-vs { color: var(--text-faint); }
.match-result {
  flex: 0 0 auto;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.match-result.win { color: #4caf7d; background: color-mix(in srgb, #4caf7d 15%, transparent); }
.match-result.loss { color: #e2635b; background: color-mix(in srgb, #e2635b 15%, transparent); }

.tourney-delta {
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  padding: 3px 0;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.tourney-delta.positive { color: #4caf7d; background: color-mix(in srgb, #4caf7d 15%, transparent); }
.tourney-delta.negative { color: #e2635b; background: color-mix(in srgb, #e2635b 15%, transparent); }
.tourney-delta.neutral  { color: var(--text-faint); background: color-mix(in srgb, var(--text-faint) 12%, transparent); }

.tourney-main { min-width: 0; }
.tourney-name {
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tourney-sub {
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tourney-meta {
  text-align: right;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}
.tourney-meta .tourney-placement { color: var(--text); font-weight: 700; }

.tourney-view {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.tourney-view:hover { color: var(--accent); border-color: var(--accent); }
.tourney-view.disabled { opacity: 0.4; pointer-events: none; }

.tournaments-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 24px 0;
  font-size: 13px;
}

@media (max-width: 640px) {
  .achievements-list { grid-template-rows: repeat(4, auto); grid-auto-columns: 100%; }
  .ach-arrow.next { right: -8px; }
  .ach-arrow.prev { left: -8px; }
  .h2h-row { grid-template-columns: 1fr 60px 48px; }
  .profile-header-inner { grid-template-columns: 1fr; gap: 10px; }
  .header-right { justify-content: stretch; }
  .header-right .site-nav { width: 100%; margin-left: 0; }
  .header-right .nav-tile { flex: 1 1 0; justify-content: center; }
  .header-right .nav-tile span { display: inline; }
  .bestwin-row { grid-template-columns: 52px 1fr auto; gap: 8px; }
  .teammates-list { gap: 6px; }
  .teammate-card { padding: 12px 4px 10px; }
  .teammate-pct { font-size: 17px; }
  .profile-header { justify-content: center; text-align: center; }
  .profile-id { flex-basis: 100%; }
  .profile-region { justify-content: center; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .tourney-row {
    grid-template-columns: 36px 32px minmax(0, 1fr);
    grid-template-areas: "delta icon main" "delta icon meta" "view view view";
  }
  .tourney-delta { grid-area: delta; }
  .tourney-row .tourney-icon { grid-area: icon; width: 32px; height: 32px; }
  .tourney-main { grid-area: main; }
  .tourney-meta { grid-area: meta; text-align: left; }
  .tourney-view { grid-area: view; text-align: center; }
}

.teammate-team-link { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--accent); cursor: pointer; }
.teammate-team-link:hover { text-decoration: underline; }

.tourney-icon { width: 36px; height: 36px; border-radius: 8px; overflow: hidden; background: var(--bg); border: 1px solid var(--border);
  display: grid; place-items: center; }
.tourney-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tourney-icon.letter { font-size: 15px; font-weight: 800; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg-card)); }
/* Safety net: if a cached older script builds rows without the icon, keep the old
   layout instead of squeezing the title into the icon's slot. */
.tourney-row:not(:has(.tourney-icon)) { grid-template-columns: 44px minmax(0, 1fr) auto auto; }
@media (max-width: 640px) {
  .tourney-row:not(:has(.tourney-icon)) { grid-template-columns: 36px minmax(0, 1fr); grid-template-areas: "delta main" "delta meta" "view view"; }
}

/* ---------- Teams (all partners) ---------- */
.teams-search {
  flex: 1 1 220px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.teams-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.teams-sort {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}
.player-teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
  padding-top: 4px;
}
.player-teams-grid .tournaments-empty { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .player-teams-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
}

/* Bracket link at the bottom of an opened tournament's matches */
.match-bracket-link { padding-top: 10px; margin-top: 6px; border-top: 1px dashed var(--border); text-align: right; }
.match-bracket-link a { font-size: 12px; font-weight: 700; color: var(--accent); text-decoration: none; }
.match-bracket-link a:hover { text-decoration: underline; }

/* Tournament rows: title -> Events page, View button -> matches */
.tourney-row { cursor: default; }
.tourney-title-link { color: inherit; text-decoration: none; }
a.tourney-title-link:hover { color: var(--accent); text-decoration: underline; }
button.tourney-view { background: transparent; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.tourney-item.open .tourney-view { color: var(--accent); border-color: var(--accent); }

/* Round name above each match (reconstructed bracket rounds) */
.match-round { font-size: 11px; font-weight: 700; letter-spacing: 0.02em; color: var(--text-faint); line-height: 1.4; }

/* Match names: winners green, losers red */
.match-person.won .match-player { color: #3fae6f; }
.match-person.lost .match-player { color: #e2635b; }
a.match-player:hover { text-decoration: underline; }

/* Player name links to their start.gg profile */
.profile-tag-link { color: inherit; text-decoration: none; }
.profile-tag-link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Skill Class tile opens the skill classes page */
.tier-card-link { cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.tier-card-link:hover, .tier-card-link:focus-visible { border-color: var(--accent); transform: translateY(-1px); }

/* Clickable achievements */
.achievement-link { cursor: pointer; }
.achievement-link:hover { filter: brightness(1.12); }

/* Section titles that open their own page */
.section-title-link { color: inherit; text-decoration: none; }
.section-title-link:hover, .section-title-link:focus-visible { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }

/* Hover underline for linked names; clickable ranks keep their own look */
.teammate-card:hover .teammate-tag { text-decoration: underline; text-underline-offset: 3px; }
.card-rank.go-link, .dr-rank.go-link, .h2h-rank.go-link, .rec-rank.go-link, .teammate-rank.go-link { cursor: pointer; }
.stat-label.go-link:hover, .stat-sub.go-link:hover, .stat-value.go-link:hover { color: var(--accent); }
.profile-flag.go-link { cursor: pointer; text-decoration: none; }

#stat-elo.go-link, #stat-elo.go-link:hover { text-decoration: none; }
#stat-elo.go-link, #stat-elo.go-link:hover, #stat-elo.go-link:focus, #stat-elo.go-link:active { color: inherit; text-decoration: none; outline: none; }

/* Desktop: the top bar is one centred row, every item the same distance apart as the nav buttons. */
@media (min-width: 641px) {
  .profile-header-inner { display: flex; justify-content: center; align-items: center; gap: 6px; }
  .profile-header-inner .header-left, .profile-header-inner .header-right, .profile-header-inner .site-nav { display: contents; }
  .profile-header-inner .global-search { flex: 0 1 480px; width: auto; max-width: none; min-width: 160px; }
  .profile-header-inner .brand, .profile-header-inner .back-link, .profile-header-inner .nav-tile, .profile-header-inner .login-wrap { flex: none; margin: 0; }
}

/* Tournament name in the chart's hover box: clickable, jumps to that tournament below. */
.chart-tooltip .tt-link { pointer-events: auto; color: inherit; text-decoration: none; cursor: pointer; }
.chart-tooltip .tt-link:hover { color: var(--text); text-decoration: underline; }
.chart-tooltip:not(.visible) .tt-link { pointer-events: none; }
.tourney-item.flash { animation: tourney-flash 1.6s ease-out; }
@keyframes tourney-flash { 0%, 40% { box-shadow: 0 0 0 2px var(--accent); } 100% { box-shadow: 0 0 0 2px transparent; } }

/* Either clickable line lights up as soon as the cursor is level with it anywhere across the box. */
.chart-tooltip .tt-link { display: block; margin: 0 -10px; padding: 0 10px; }
.chart-tooltip .tt-link:hover { background: var(--accent-dim); }
.chart-tooltip .tt-day { color: var(--text); }

/* Best wins "Show more" and the strongest-teammates arrows. */
.bestwin-row[hidden], .teammate-card[hidden], .mate-arrow[hidden] { display: none; }
.teammates-list.has-arrows { position: relative; }
/* Phones and other touch screens: the date and tournament in the chart's box are plain text, not links. */
@media (hover: none), (max-width: 640px) {
  .chart-tooltip .tt-link, .chart-tooltip.visible .tt-link { pointer-events: none !important; cursor: default; background: none; text-decoration: none; }
}

/* ---------- Things a verified player adds to their own profile ---------- */
.profile-bio { margin: 8px 0 0; max-width: 560px; font-size: 14px; line-height: 1.45; color: var(--text-dim); font-style: italic; overflow-wrap: anywhere; }
.profile-bio[hidden], .profile-socials[hidden] { display: none; }
.profile-socials { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.social-box { display: block; width: 32px; height: 32px; padding: 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); box-sizing: border-box; background: none; cursor: pointer; transition: transform 0.1s ease, border-color 0.1s ease; }
.social-box img { display: block; width: 100%; height: 100%; }
.social-box:hover { border-color: var(--accent); transform: translateY(-1px); }
.social-box.copied { border-color: var(--tier-competent); }
@media (max-width: 640px) {
  .profile-bio { margin-left: auto; margin-right: auto; }
  .profile-socials { justify-content: center; }
  .social-box { width: 36px; height: 36px; }
}
/* Profile accent colour: tints the chart line (through --accent) and the section borders. */
#profile-main.accented .profile-header, #profile-main.accented .stat-card, #profile-main.accented .chart-section,
#profile-main.accented .bestwins-section, #profile-main.accented .teammates-section, #profile-main.accented .h2h-section,
#profile-main.accented .achievements-section, #profile-main.accented .recs-section, #profile-main.accented .tournaments-section,
#profile-main.accented .follow-card { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
#profile-main.accented .profile-portrait { border-color: var(--accent); }

/* Best wins: pinned win, caption, and the owner's two-dot menu */
.bestwin-row.has-menu { grid-template-columns: 64px 1fr auto auto; }
.bestwin-row.pinned { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.bestwin-pin { margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); border: 1px solid var(--accent); vertical-align: middle; }
.bestwin-caption { margin-top: 4px; font-size: 13px; font-style: italic; color: var(--text-dim); overflow-wrap: anywhere; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bestwin-caption[hidden] { display: none; }
.caption-input { flex: 1 1 220px; min-width: 0; padding: 6px 9px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text); font: inherit; font-style: normal; }
.caption-save, .caption-cancel { padding: 6px 11px; border-radius: 8px; border: 1px solid var(--border); background: none; color: var(--text-dim); font: inherit; font-style: normal; font-weight: 700; font-size: 12px; cursor: pointer; }
.caption-save { border-color: var(--accent); color: var(--accent); }
.dots-wrap { position: relative; }
.dots-btn { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 26px; height: 30px; border-radius: 8px; border: 1px solid transparent; background: none; cursor: pointer; }
.dots-btn span { width: 4px; height: 4px; border-radius: 50%; background: var(--text-dim); }
.dots-btn:hover { border-color: var(--border); }
.dots-btn:hover span { background: var(--text); }
.dots-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 170px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); overflow: hidden; }
.dots-menu[hidden] { display: none; }
.dots-menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; background: none; border: none; color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.dots-menu button:hover { background: var(--bg-card-hover); }
@media (max-width: 640px) { .bestwin-row.has-menu { grid-template-columns: 52px 1fr auto auto; } }

/* Rivals in the head-to-heads */
.h2h-row.rival { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.rival-badge { margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); border: 1px solid var(--accent); }
.h2h-row.has-star { grid-template-columns: 1fr 120px 60px 30px; }
.rival-star { width: 28px; height: 28px; border: none; background: none; color: var(--text-faint); font-size: 18px; line-height: 1; cursor: pointer; border-radius: 6px; }
.rival-star:hover, .rival-star.on { color: var(--accent); }
@media (max-width: 640px) { .h2h-row.has-star { grid-template-columns: 1fr 60px 48px 28px; } }

/* Collapsible Tournaments section */
.section-collapse { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0; margin: 0 0 10px; background: none; border: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.section-collapse h2 { margin: 0; font-size: 16px; font-weight: 700; }
.section-collapse-count { flex: 1 1 auto; font-size: 12px; color: var(--text-faint); }
.section-collapse .h2h-toggle-chev { transform: rotate(0deg); }
.section-collapse.open .h2h-toggle-chev { transform: rotate(180deg); }
.section-collapse:not(.open) { margin-bottom: 0; }
#tournaments-panel[hidden] { display: none; }

/* Status line in the profile header */
.profile-status { margin-top: 12px; font-size: 16px; font-style: italic; color: var(--text); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 9px; }
.profile-status[hidden] { display: none; }
.status-value { font-style: italic; }
.status-pick { padding: 1px 0; border: none; background: none; color: var(--text-dim); font: inherit; font-style: italic; cursor: pointer; }
.status-pick:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.status-pick.status-value, .status-pick.on { color: var(--text); }
.status-pick.on { font-weight: 700; }
.status-pick.status-none { font-size: 13px; font-style: normal; opacity: 0.75; }
.status-x { margin-left: 2px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); background: none; color: var(--text-dim); font-size: 15px; font-style: normal; line-height: 1; cursor: pointer; }
.status-x:hover { color: var(--text); border-color: var(--text-dim); }
@media (max-width: 640px) {
  .profile-header > .profile-status { flex-basis: 100%; justify-content: center; margin-top: 4px; text-align: center; }
}

.profile-emoji { margin-left: 10px; font-size: 0.9em; }
.profile-emoji[hidden] { display: none; }

/* ----- Full-list pages (?view=bestwins / ?view=teammates): only that section, under a description ----- */
#profile-content.view-mode > *:not(.keep-view) { display: none !important; }
.view-intro { margin: 0 0 16px; }
.view-back { display: inline-block; margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--text-dim); text-decoration: none; }
.view-back:hover { color: var(--accent); }
.view-intro h1 { margin: 0 0 8px; font-size: 26px; font-weight: 800; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.view-intro p { margin: 0; max-width: 760px; font-size: 14px; line-height: 1.55; color: var(--text-dim); }
.teammates-list.all-mates { row-gap: 10px; }

/* Singles vs. Doubles link at the bottom of a profile, above the follow box */
.svd-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 18px 0; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); }
.svd-card p { flex: 1 1 260px; margin: 0; color: var(--text-dim); font-size: 14px; }
.svd-open { display: inline-block; padding: 9px 14px; border: 1px solid var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--accent) 12%, var(--bg-card)); color: var(--accent); font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; }
.svd-open:hover { background: color-mix(in srgb, var(--accent) 22%, var(--bg-card)); }

/* ---------- Secondaries (processor option 44) ---------- */
.portrait-stack { position: relative; flex: 0 0 auto; width: 96px; height: 96px; margin-left: 34px; }
.portrait-stack .profile-portrait { position: relative; z-index: 3; }
.portrait-back { position: absolute; border-radius: 50%; overflow: hidden; background: var(--bg-elevated);
  border: 2px solid var(--border); opacity: .92; cursor: pointer; }
.portrait-back img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait-back.one { left: -34px; top: 10px; width: 76px; height: 76px; z-index: 2; }
.portrait-back.two-a { left: -30px; top: -6px; width: 64px; height: 64px; z-index: 2; }
.portrait-back.two-b { left: -30px; top: 40px; width: 56px; height: 56px; z-index: 1; }
#profile-main.accented .portrait-back { border-color: var(--accent); }
.main-cycle { display: inline-flex; align-items: center; gap: 4px; justify-content: center; max-width: 100%; }
.cyc { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-elevated);
  color: var(--text-dim); font: inherit; font-size: 13px; line-height: 1; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; }
.cyc:hover { border-color: var(--accent); color: var(--accent); }
.cyc.off { visibility: hidden; }
.cyc-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ----- Melee doubles / Project+ singles switch and the P+ character picker ----- */
.game-switch { display: inline-flex; gap: 4px; margin: 8px 0 2px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-elevated); }
.game-switch-btn { padding: 5px 11px; border-radius: 7px; font-size: 13px; font-weight: 700; color: var(--text-dim); text-decoration: none; white-space: nowrap; }
.game-switch-btn:hover { color: var(--text); }
.game-switch-btn.active { background: var(--accent); color: #fff; }
/* the switch shows each game's small logo (the same pictures as the home page's phone switch) */
.game-switch { align-items: center; gap: 6px; padding: 4px; }
.game-switch-btn[data-game="melee"] { --gp: #d8344a; }
.game-switch-btn[data-game="pplus"] { --gp: #22c995; }
.game-switch-btn[data-game="rivals2"] { --gp: #8f73e8; }
.game-switch-btn { display: inline-grid; place-items: center; height: 30px; padding: 0 9px; border: 1.5px solid transparent; transition: background .15s, border-color .15s, transform .15s; }
.game-switch-btn img { height: 20px; width: 37px; object-fit: contain; display: block; transition: opacity .15s, filter .15s; }
.game-switch-btn:not(.active) img { opacity: .55; filter: grayscale(.6); }
.game-switch-btn:not(.active):hover { background: var(--bg-card); border-color: var(--gp); transform: translateY(-1px); }
.game-switch-btn:not(.active):hover img { opacity: 1; filter: none; }
.game-switch-btn.active { background: color-mix(in srgb, var(--gp) 13%, var(--bg-card)); border-color: var(--gp); box-shadow: 0 1px 5px color-mix(in srgb, var(--gp) 35%, transparent); }
@media (max-width: 640px) { .game-switch { flex-wrap: wrap; max-width: 100%; } .game-switch-btn { padding: 5px 8px; font-size: 12px; } }
.pplus-edit-btn { display: inline-block; margin-top: 8px; padding: 6px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.pplus-edit-btn:hover { border-color: var(--accent); }
.pp-pick-back { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.6); }
.pp-pick { width: min(720px, 100%); max-height: 86vh; overflow: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); padding: 14px; }
.pp-pick-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-size: 16px; }
.pp-pick-close { border: none; background: none; color: var(--text-dim); font-size: 26px; line-height: 1; cursor: pointer; }
.pp-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.pp-pick-tile { padding: 3px; border: 2px solid transparent; border-radius: 50%; background: var(--bg-elevated); cursor: pointer; aspect-ratio: 1; }
.pp-pick-tile img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.pp-pick-tile:hover, .pp-pick-tile.active { border-color: var(--accent); }
.pp-pick-clear { grid-column: 1 / -1; justify-self: start; margin-top: 4px; padding: 6px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.pp-pick-msg { margin-top: 8px; font-size: 13px; color: var(--text-dim); min-height: 1em; }

/* PMRank badges (P+ profiles) */
.profile-badges { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 10px 0 4px; }
.pm-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-badge {
  display: inline-flex; align-items: stretch; border-radius: 999px; overflow: hidden;
  border: 1px solid var(--border); background: var(--bg-elevated); font-size: 12px; line-height: 1;
  font-weight: 700; white-space: nowrap; cursor: default;
}
.pm-badge-name { padding: 5px 8px 5px 10px; color: var(--text-dim); }
.pm-badge-rank { padding: 5px 10px 5px 8px; background: var(--bg-card-hover); color: var(--text); font-variant-numeric: tabular-nums; }
.pm-badge.top10 { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.pm-badge.top10 .pm-badge-rank { background: color-mix(in srgb, var(--accent) 28%, var(--bg-card)); }
.pm-badge.first { border-color: color-mix(in srgb, var(--tier-grandmaster) 70%, var(--border)); }
.pm-badge.first .pm-badge-name { color: var(--tier-grandmaster); }
.pm-badge.first .pm-badge-rank { background: var(--tier-grandmaster); color: #1a1400; }
.pm-badge.hm .pm-badge-rank { color: var(--text-dim); font-weight: 600; }
@media (max-width: 640px) {
  .profile-badges { gap: 5px; align-items: center; }
  .pm-row { gap: 5px; justify-content: center; }
  .pm-badge { font-size: 11px; }
  .pm-badge-name { padding: 4px 6px 4px 8px; }
  .pm-badge-rank { padding: 4px 8px 4px 6px; }
}

/* ----- Best Wins: List / Players switch and the Players grid (singles profiles) ----- */
.bw-toggle { display: inline-flex; gap: 2px; padding: 2px; margin-right: auto; margin-left: 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-elevated); align-self: center; }
.bw-toggle button { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 0; border-radius: 7px; background: none; color: var(--text-dim); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.bw-toggle button svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.bw-toggle button:hover { color: var(--text); }
.bw-toggle button.active { background: var(--accent); color: #fff; }
.bestwins-section.bw-grid #bestwins-list, .bestwins-section.bw-grid #bestwins-more, .bestwins-section.bw-grid #bestwins-empty { display: none !important; }
.bwg { background: none; border: 0; padding: 0; }   /* follows the site theme (light / dark) like the List rows */
.bwg-status { color: var(--text-dim); font-size: 13px; padding: 14px; text-align: center; }
.bwg-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.bwg-card { position: relative; display: block; height: 80px; padding: 9px 10px; border-radius: 14px; background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text);
  text-decoration: none; overflow: hidden; transition: transform .15s, box-shadow .15s, background .15s; }
.bwg-card:hover { background: var(--bg-card-hover); border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.bwg-char { position: absolute; right: -4px; bottom: -10px; height: 112%; width: auto; max-width: 48%; object-fit: contain; object-position: right bottom; pointer-events: none; }
.bwg-char.flip { transform: scaleX(-1); }
.bwg-name { position: relative; z-index: 1; display: flex; align-items: baseline; max-width: 100%; font-family: inherit;
  font-weight: 800; font-size: 16px; line-height: 1.15; text-transform: uppercase; letter-spacing: -.01em; white-space: nowrap;
  text-shadow: 0 1px 2px color-mix(in srgb, var(--bg-elevated) 80%, transparent); }
.bwg-tag { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.bwg-x { flex: none; font-size: .78em; text-transform: none; }
.bwg-line { position: relative; z-index: 1; display: flex; align-items: center; gap: 7px; margin-top: 8px; }
.bwg-flag { height: 21px; width: auto; display: block; border-radius: 2px; box-shadow: 0 0 0 1px var(--border); }
.bwg-flag-emoji { font-size: 24px; line-height: 1; }
.bwg-box { font-family: inherit; font-weight: 800; font-size: 15px; line-height: 1; padding: 4px 6px 5px; border-radius: 6px; }
.bwg-box.gold { background: #f2c21b; color: #1b1400; }
.bwg-box.silver { background: #6D8196; color: #0d1117; }
.bwg-rank { font-family: inherit; font-weight: 800; font-size: 16px; line-height: 1; color: var(--tc, #c9ccd3); }
.bwg-foot { position: relative; display: flex; justify-content: center; align-items: center; min-height: 34px; margin-top: 10px; }
.bwg-less { position: absolute; right: 0; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); cursor: pointer; }
.bwg-less svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bwg-less:hover { background: var(--bg-card-hover); }
.bwg-more { display: block; margin: 0 auto; padding: 6px 14px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.bwg-more:hover { background: var(--bg-card-hover); }
/* desktop: a long name stops (with "...") before the character instead of running over it */
@media (min-width: 761px) { .bwg-card.has-char .bwg-name { max-width: calc(100% - 72px); } }
@media (max-width: 760px) {
  .bwg-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .bwg-card { height: 84px; padding: 8px 10px; }
  .bwg-name { font-size: 15px; }
  .bwg-flag { height: 20px; }
  .bwg-box { font-size: 14px; }
  .bwg-rank { font-size: 15px; }
}
@media (max-width: 380px) { .bwg-name { font-size: 13px; } .bw-toggle button span { display: none; } }

/* Best Wins rows open the head-to-head */
.bestwin-row.bw-click { cursor: pointer; transition: border-color .15s, background .15s; }
.bestwin-row.bw-click:hover { border-color: var(--accent); }

/* PMRank Europe / Australia lists (years with separate regional lists, like 2013): orange */
.pm-badge.pm-reg { border-color: color-mix(in srgb, #f0892a 70%, var(--border)); }
.pm-badge.pm-reg .pm-badge-name { color: #f0892a; }
.pm-badge.pm-reg .pm-badge-rank { background: #f0892a; color: #1f0e00; }
.bwg-box.orange { background: #f0892a; color: #1f0e00; }
.bwg-box.silver-orange { background: color-mix(in srgb, #6D8196 55%, #f0892a); color: #120c06; }

/* Game switch: in the middle of the profile card on desktop (bigger logos), under the profile details on phones */
.gs-slot { display: flex; justify-content: center; }
.gs-slot .game-switch { margin: 0; }
@media (min-width: 641px) {
  /* picture | name column | switch | Skill Class: the switch sits evenly between the end of the name column
     (its PMRank labels, two per row) and the Skill Class card */
  .profile-header.has-gs { flex-wrap: nowrap; }
  .profile-header.has-gs .profile-id { flex: 0 1 auto; min-width: 0; max-width: 380px; }
  /* the switch never shrinks under its own width (so it can't slide over the labels); the name column gives way instead */
  .profile-header.has-gs .gs-slot { flex: 1 0 auto; }
  .profile-header.has-gs .tier-card { margin-left: 0; flex: none; }
  .gs-slot .game-switch { gap: 8px; padding: 6px; border-radius: 14px; }
  .gs-slot .game-switch-btn { height: 50px; padding: 0 12px; border-radius: 10px; border-width: 2px; }
  .gs-slot .game-switch-btn img { height: 32px; width: 60px; }
}
@media (max-width: 640px) {
  .gs-slot { flex: 0 0 100%; }
}
/* tablets and phones turned sideways: not enough room for picture, labels, switch and Skill Class in one row,
   so the switch moves to its own row under them (centred) */
@media (min-width: 641px) and (max-width: 1023px) {
  .profile-header.has-gs { flex-wrap: wrap; row-gap: 14px; }
  .profile-header.has-gs .profile-id { flex: 1 1 220px; max-width: none; }
  .profile-header.has-gs .tier-card { margin-left: auto; }
  .profile-header.has-gs .gs-slot { flex: 0 0 100%; order: 5; }
  /* with the switch below, the labels spread across the freed-up width instead of two per row */
  .profile-header.has-gs .profile-badges { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .profile-header.has-gs .pm-row { display: contents; }
}

/* PMRank Australia lists: green (labels and Best Wins boxes) */
.pm-badge.pm-au { border-color: color-mix(in srgb, #2fb36b 70%, var(--border)); }
.pm-badge.pm-au .pm-badge-name { color: #2fb36b; }
.pm-badge.pm-au .pm-badge-rank { background: #2fb36b; color: #04170c; }
.bwg-box.green { background: #2fb36b; color: #04170c; }
.bwg-box.silver-green { background: color-mix(in srgb, #6D8196 55%, #2fb36b); color: #06120b; }
