:root {
  --bg: #0f1117;
  --bg-gradient: radial-gradient(ellipse at 30% 0%, #161b2e 0%, #0f1117 60%);
  --panel: #181b24;
  --panel-soft: #202432;
  --text: #edf0f5;
  --muted: #8b8fa3;
  --border: #2a2e3d;
  --border-glow: rgba(100, 180, 255, 0.08);
  --accent: #6c8cff;
  --accent-glow: rgba(108, 140, 255, 0.25);
  --win: #2ecc5f;
  --win-glow: rgba(46, 204, 95, 0.2);
  --loss: #e74c3c;
  --loss-glow: rgba(231, 76, 60, 0.2);
  --dota: #48c774;
  --dota-glow: rgba(72, 199, 116, 0.15);
  --valorant: #ff4655;
  --valorant-glow: rgba(255, 70, 85, 0.15);
  --gold: #f0c040;
  --gold-glow: rgba(240, 192, 64, 0.2);
  --header-bg: rgba(15, 17, 23, 0.92);
  --card-radius: 10px;
}

* {
  box-sizing: border-box;
}

/* The `hidden` attribute must always win. Several components set display:flex/grid
   (e.g. .winrate-bar, .field, .match-grid), which would otherwise override the
   UA `[hidden]{display:none}` rule and leak empty/zero-state UI before data loads. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text);
}

::selection {
  background: var(--accent);
  color: #fff;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #2a2e3d;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3a3f52;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}


.banner-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  background: #0a0c12;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.banner-img {
  width: min(100%, 1240px);
  height: auto;
  max-height: 160px;
  object-fit: contain;
  display: block;
}


.subtitle,
.muted {
  color: var(--muted);
}

h1, h2, h3, p { margin: 0; }

.stat-pill,
.result-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12px;
  white-space: nowrap;
}

.stat-pill {
  backdrop-filter: blur(4px);
}

.stat-pill span:first-child {
  color: var(--text);
  font-weight: 700;
}

main {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 40px;
}

.toolbar-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 22px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}

.toolbar-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
}

.toolbar-panel-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.toolbar-panel-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

#toggle-filters {
  background: var(--panel-soft);
  border-color: var(--border);
  font-size: 12px;
}

.toolbar-panel.collapsed .toolbar {
  display: none;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 16px 20px 18px;
}

.toolbar-column {
  display: grid;
  gap: 12px;
}

.toolbar-column--filters {
  display: grid;
  gap: 12px;
}

.toolbar-column--players {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}


.flatpickr-day.has-matches {
  position: relative;
  padding-bottom: 14px;
}

.flatpickr-calendar .flatpickr-day {
  height: 46px;
  line-height: 32px;
}

.flatpickr-day-count {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 12px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
}

.game-toggles,
.player-toggles {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.game-toggle {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.game-toggle:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text);
  border-color: #3a3f52;
}

.game-toggle[data-game="dota"].active {
  background: var(--dota);
  color: #fff;
  border-color: var(--dota);
  box-shadow: 0 0 12px var(--dota-glow);
}

.game-toggle[data-game="dota"].active:hover {
  background: #3db868;
}

.game-toggle[data-game="valorant"].active {
  background: var(--valorant);
  color: #fff;
  border-color: var(--valorant);
  box-shadow: 0 0 12px var(--valorant-glow);
}

.game-toggle[data-game="valorant"].active:hover {
  background: #e63f4d;
}

/* Make the "off" state of the game toggles read as genuinely off: dim the
   inactive ones so the selected games clearly stand out. Full opacity on hover
   keeps them obviously clickable. */
.game-toggles .game-toggle:not(.active) {
  opacity: 0.45;
}

.game-toggles .game-toggle:not(.active):hover {
  opacity: 1;
}

/* Player and hero/agent chips reuse .game-toggle but have no data-game, so the
   colour rules above never apply — on and off looked identical. Give them an
   unmistakable selected state: accent fill, glow, and a leading checkmark. */
.player-toggles .game-toggle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 10px var(--accent-glow);
}

.player-toggles .game-toggle.active:hover {
  background: #5a78f0;
  color: #fff;
}

.player-toggles .game-toggle.active::before {
  content: '✓';
  font-weight: 800;
  margin-right: 5px;
}

.player-field {
  min-height: auto;
}

.actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 8px;
}

@media (max-width: 980px) {
  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .player-field,
  .actions,
  .field-game {
    grid-column: span 2;
  }
  .player-field, .actions { justify-self: stretch; }
  .actions { justify-content: flex-end; }
}

@media (max-width: 680px) {
  .section-heading,
  .match-header,
  .match-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .toolbar,
  .teams-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }
  .player-field,
  .actions,
  .field-game {
    grid-column: auto;
  }
  .player-field, .actions { justify-self: stretch; }
  .actions { justify-content: flex-end; }
}

label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input, select, button {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font: inherit;
}

input, select {
  width: 100%;
  padding: 8px 10px;
}

select[multiple] {
  min-height: 88px;
  padding: 4px;
}

select[multiple] option {
  padding: 5px 7px;
  border-radius: 4px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid var(--accent-glow);
  outline-offset: 1px;
}

button {
  padding: 0 13px;
  cursor: pointer;
  background: var(--panel-soft);
  font-weight: 700;
  transition: all 0.15s;
}

button:hover {
  background: #2a2e3d;
}

#refresh {
  background: var(--accent);
  border-color: var(--accent);
}

.matches-shell {
  display: grid;
  gap: 14px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px;
}

.section-heading-actions {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.section-heading-actions button {
  width: max-content;
}

.match-day-group {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.2);
}

.match-day-heading {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.match-group-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.match-card { min-width: 0; width: 100%; }

@media (max-width: 1120px) {
  .match-group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .match-group-grid { grid-template-columns: 1fr; }
}

h2 { font-size: 17px; }

.muted { margin-top: 3px; font-size: 12px; }

.match-grid {
  display: grid;
  gap: 14px;
}

.match-grid[hidden],
#calendar-view[hidden] { display: none; }

.match-card,
.empty-state,
.loading {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid #3a3f52;
  border-radius: var(--card-radius);
}

.match-card {
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.match-card:hover {
  border-color: #3a3f52;
  box-shadow: 0 0 16px var(--border-glow);
}

.spotlight-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.7);
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.match-card.spotlight {
  position: relative;
  z-index: 1000;
  box-shadow: 0 0 30px var(--accent-glow);
  transition: box-shadow 0.2s;
}

.match-card.tracked-win {
  border-left-color: var(--win);
}

.match-card.tracked-win:hover {
  box-shadow: 0 0 20px var(--win-glow);
}

.match-card.tracked-loss {
  border-left-color: var(--loss);
}

.match-card.tracked-loss:hover {
  box-shadow: 0 0 20px var(--loss-glow);
}

.match-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  padding: 13px 16px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.match-header h3 {
  margin-top: 3px;
  font-size: 15px;
  line-height: 1.3;
}

.match-header h3 a {
  color: inherit;
  text-decoration: none;
}

.match-header h3 a:hover {
  text-decoration: underline;
}

.result-pill {
  color: var(--text);
  font-weight: 700;
}

.result-pill.game-dota { background: rgba(72, 199, 116, 0.1); border-color: var(--dota); }
.result-pill.game-valorant { background: rgba(255, 70, 85, 0.1); border-color: var(--valorant); }

.teams-grid,
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
}

.team-column,
.embed-field,
.tracked-list {
  background: var(--panel);
  padding: 13px 16px;
}

.team-title {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.team-list,
.tracked-list {
  display: grid;
  gap: 7px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.player-row.win .player-name { color: #b8f0c8; }
.player-row.loss .player-name { color: #fcc; }

.player-row.tracked-player {
  background: rgba(108, 140, 255, 0.1);
  border: 1px solid rgba(108, 140, 255, 0.15);
  border-radius: 6px;
  padding: 3px 6px;
  margin: 0 -6px;
}

.player-row.tracked-player .player-name {
  color: #bcc6ff;
}

.hero-icon {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  overflow: hidden;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.emoji-icon,
.fallback-icon {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
}

.player-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.player-name,
.hero-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-name {
  font-size: 13px;
  font-weight: 700;
}

.hero-name {
  color: var(--muted);
  font-size: 11px;
}

.kda {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.embed-field pre {
  margin: 0;
  color: var(--text);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.empty-team {
  color: var(--muted);
  font-size: 12px;
}

.match-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid var(--border);
}

.match-footer span:last-child {
  text-align: right;
  overflow-wrap: anywhere;
}

.empty-state,
.loading {
  padding: 28px;
  text-align: center;
}

.empty-state h3 { margin-bottom: 6px; }

.empty-state p,
.loading { color: var(--muted); }

/* ── View toggle ─────────────────────────────────────────────────────────── */

.view-toggle {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.view-btn {
  min-height: 32px;
  padding: 0 14px;
  border: none;
  border-radius: 0;
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s;
}

.view-btn + .view-btn {
  border-left: 1px solid var(--border);
}

.view-btn.view-active {
  background: var(--accent);
  color: #fff;
  box-shadow: inset 0 0 12px rgba(255,255,255,0.08);
}

.view-btn:hover:not(.view-active) {
  background: rgba(255,255,255,0.07);
  color: var(--text);
}

/* ── Big calendar ────────────────────────────────────────────────────────── */

.cal-grid { display: grid; gap: 18px; }

.cal-month-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0,0,0,0.2);
}

.cal-month-heading {
  padding: 13px 18px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
}

.cal-weekday-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}

.cal-weekday-cell {
  padding: 8px 0;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.cal-day-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 110px;
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  vertical-align: top;
  transition: background 0.1s;
}

.cal-day-cell:hover {
  background: rgba(255,255,255,0.02);
}

.cal-day-cell:nth-child(7n) { border-right: none; }

.cal-day-cell.cal-day-empty { background: rgba(0,0,0,.08); }

.cal-day-number {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  flex: 0 0 auto;
  line-height: 1;
  margin-bottom: 2px;
}

.cal-day-cell.cal-day-today .cal-day-number {
  color: var(--accent);
}

/* ── Mini match card ─────────────────────────────────────────────────────── */

.mini-card {
  border-radius: 5px;
  border: 1px solid var(--border);
  border-left: 3px solid #3a3f52;
  background: var(--panel-soft);
  padding: 4px 6px;
  cursor: pointer;
  font-size: 10px;
  line-height: 1.3;
  min-width: 0;
  transition: all 0.1s;
  overflow: hidden;
}

.mini-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: #3a3f52;
}

.mini-card.tracked-win {
  border-left-color: var(--win);
}

.mini-card.tracked-loss {
  border-left-color: var(--loss);
}

.mini-card-eyebrow {
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-card-title {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-card-icons {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.mini-card-icons .hero-img {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

.mini-card-icons .fallback-icon,
.mini-card-icons .emoji-icon {
  font-size: 8px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
}

.mini-card-more {
  font-size: 8px;
  color: var(--muted);
  align-self: center;
  white-space: nowrap;
}

/* ── Match detail modal ──────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  backdrop-filter: blur(6px);
}

.modal-overlay[hidden] { display: none; }

.modal-box {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 720px;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 20px;
  display: grid;
  gap: 0;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: none;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
}

.modal-close:hover {
  background: rgba(255,255,255,0.12);
  color: var(--text);
}

.modal-content .match-card {
  border-radius: var(--card-radius);
  border-left-width: 4px;
}

/* ── Graph view ──────────────────────────────────────────────────────────── */

#graph-view {
  display: grid;
  gap: 16px;
}

#graph-view[hidden] { display: none; }

.graph-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bucket-toggles {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.bucket-btn {
  min-height: 32px;
  padding: 0 14px;
  border: none;
  border-radius: 0;
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.bucket-btn + .bucket-btn {
  border-left: 1px solid var(--border);
}

.bucket-btn.active {
  background: var(--accent);
  color: #fff;
}

.bucket-btn:hover:not(.active) {
  background: rgba(255,255,255,0.07);
  color: var(--text);
}

.chart-wrapper {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  min-height: 400px;
  position: relative;
  box-shadow: 0 2px 16px rgba(0,0,0,0.2);
}

#match-chart {
  width: 100%;
  height: 100%;
  max-height: 500px;
}

.pictograph {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0;
  height: 320px;
  position: relative;
}

.picto-yaxis {
  position: relative;
  width: 32px;
  flex-shrink: 0;
}

.picto-ytick {
  position: absolute;
  right: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  transform: translateY(50%);
  line-height: 1;
}

.picto-body {
  position: relative;
  height: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.picto-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.picto-gridline {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255,255,255,0.05);
}

.picto-cols {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 100%;
  padding: 0 4px;
  position: relative;
  z-index: 1;
}

.picto-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 48px;
  position: relative;
}

.picto-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  width: 100%;
  min-height: 20px;
}

.picto-icon {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  flex-shrink: 0;
  object-fit: cover;
}

.picto-fallback {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.05);
  font-size: 9px;
  font-weight: 800;
  color: var(--muted);
}

.picto-overflow {
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(0,0,0,0.25);
  padding: 1px 5px;
  border-radius: 3px;
  line-height: 1.4;
}

.picto-xlabel {
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  padding: 5px 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (max-width: 980px) {
  .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .player-field, .actions { grid-column: span 2; }
  .actions { justify-content: flex-end; }
}

@media (max-width: 680px) {
  .section-heading, .match-header, .match-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .toolbar, .teams-grid, .field-grid { grid-template-columns: 1fr; }
  .player-field, .actions { grid-column: auto; }
  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .match-footer span:last-child { text-align: left; }
  .graph-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .bucket-toggles { width: 100%; }
  .bucket-btn { flex: 1; text-align: center; }
  .pictograph { height: 240px; }
  .picto-col { min-width: 36px; }
  .picto-icon, .picto-fallback { width: 18px; height: 18px; }
  .picto-xlabel { font-size: 8px; }
}

/* ── Win rate bar ────────────────────────────────────────────────────────── */

.winrate-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.winrate-wins { color: var(--win); }
.winrate-losses { color: var(--loss); }
.winrate-pct {
  color: var(--muted);
  font-weight: 600;
}

/* ── Sort toggle ─────────────────────────────────────────────────────────── */

.heading-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sort-toggle {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.sort-btn {
  min-height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: 0;
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.sort-btn + .sort-btn {
  border-left: 1px solid var(--border);
}

.sort-btn.sort-active {
  background: var(--panel-soft);
  color: var(--text);
}

.sort-btn:hover:not(.sort-active) {
  background: rgba(255,255,255,0.07);
  color: var(--text);
}

/* ── Jump to today ───────────────────────────────────────────────────────── */

.jump-today-btn {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(108, 140, 255, 0.12);
  border-color: rgba(108, 140, 255, 0.3);
  color: var(--accent);
}

.jump-today-btn:hover {
  background: rgba(108, 140, 255, 0.22);
}

/* ── Stats popup ─────────────────────────────────────────────────────────── */

.stats-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  background: #1a1d28;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  min-width: 200px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.stats-popup-header {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #fff;
}

.stats-popup-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 3px 0;
  font-size: 12px;
  color: var(--muted);
}

.stats-popup-row span:last-child {
  color: var(--text);
  font-weight: 600;
}

.stats-popup-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.player-name-clickable {
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

.player-name-clickable:hover {
  color: var(--accent) !important;
}

/* ── Sessions ────────────────────────────────────────────────────────────── */

.session-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.session-header .session-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.session-header .session-wl {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-left: auto;
}

/* ── CSV + Session buttons ───────────────────────────────────────────────── */

.section-heading-actions .btn-secondary {
  background: rgba(255,255,255,0.04);
  border-color: var(--border);
  font-size: 12px;
  min-height: 32px;
}

.section-heading-actions .btn-secondary:hover {
  background: rgba(255,255,255,0.08);
}

/* ── Footer / Affiliate links ────────────────────────────────────────────── */

.site-footer {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
  text-align: center;
}

.footer-disclosure {
  font-size: 11px;
  color: rgba(139, 143, 163, 0.5);
  margin-bottom: 10px;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.footer-links a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.footer-sep {
  color: var(--border);
  font-size: 13px;
  padding: 0 4px;
}

/* ── Manage page (control plane) ─────────────────────────────────────────── */

.manage-shell { margin-top: 24px; }

.manage-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.manage-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

#user-chip { color: var(--muted); font-size: 13px; white-space: nowrap; }
#user-chip a { color: var(--accent); text-decoration: none; }

.manage-panel { padding: 18px 20px; display: grid; gap: 16px; }

.discord-login-btn {
  display: inline-block;
  justify-self: start;
  background: #5865f2;
  color: #fff;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 8px;
  text-decoration: none;
}
.discord-login-btn:hover { background: #4956d8; }

.manage-section-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 6px;
}

.manage-channel-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 10px;
  display: grid;
  gap: 6px;
}

.manage-channel-name { font-weight: 700; font-size: 13px; color: var(--accent); }

.manage-sub-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.manage-sub-game {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  flex: 0 0 auto;
}
.manage-sub-game.game-dota { background: rgba(72,199,116,0.15); color: var(--dota); }
.manage-sub-game.game-val { background: rgba(255,70,85,0.15); color: var(--valorant); }

.manage-sub-alias { font-weight: 700; font-size: 14px; }
.manage-sub-detail { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.manage-remove-btn {
  margin-left: auto;
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  background: rgba(231,76,60,0.12);
  border-color: rgba(231,76,60,0.35);
  color: #f0a9a2;
}
.manage-remove-btn:hover { background: rgba(231,76,60,0.25); }

.add-form { display: grid; gap: 12px; }

.add-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.add-form-actions { display: flex; align-items: center; gap: 12px; }
#add-submit { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Ad slots ────────────────────────────────────────────────────────────── */

.ad-slot {
  display: flex;
  justify-content: center;
  align-items: center;
}

.ad-slot-bottom {
  padding: 16px 0 40px;
  min-height: 120px;
}

.ad-placeholder {
  background: rgba(255,255,255,0.03);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px 40px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
