:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --bg: #f2f5f8;
  --surface: #ffffff;
  --border: #d9e1e8;
  --text: #1a1f24;
  --muted: #4f5b66;
  --player-tint: #eef4ff;
  --stats-tint: #f0f8f3;
  --card-tint: #fff6ea;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 0.75rem 2rem;
}

h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.subtitle {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.controls {
  margin: 1rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.controls__label {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.group-toggle {
  border: 1px solid #afc1d3;
  background: #fff;
  color: #1c3650;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.32rem 0.65rem;
  cursor: pointer;
}

.group-toggle[aria-pressed='false'] {
  background: #1c3650;
  color: #fff;
  border-color: #1c3650;
}

.filter-select {
  border: 1px solid #afc1d3;
  background: #fff;
  color: #1c3650;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.5rem;
}

.table-wrapper {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 3px 14px rgba(12, 20, 33, 0.05);
}

table {
  width: max-content;
  border-collapse: collapse;
}

th,
td {
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid #e8edf2;
  text-align: left;
  font-size: 0.8rem;
  white-space: nowrap;
}

.group-row th {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid #d8e2ea;
  padding-top: 0.42rem;
  padding-bottom: 0.42rem;
}

th button {
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

th button::after {
  content: ' ↕';
  font-size: 0.8em;
  color: #7b8794;
}

th button[data-direction='asc']::after {
  content: ' ↑';
}

th button[data-direction='desc']::after {
  content: ' ↓';
}

.col-player,
.group-player {
  background: var(--player-tint);
}

.col-stats,
.group-stats {
  background: var(--stats-tint);
}

.col-card,
.group-card {
  background: var(--card-tint);
}

tbody tr:hover td {
  background: #f9fbfe;
}

tbody tr:hover .col-player {
  background: #e4efff;
}

tbody tr:hover .col-stats {
  background: #e8f5ec;
}

tbody tr:hover .col-card {
  background: #fff0db;
}

.hide-stats .col-stats,
.hide-stats .group-stats {
  display: none;
}

.hide-card .col-card,
.hide-card .group-card {
  display: none;
}

@media (max-width: 700px) {
  .page {
    padding: 1rem 0.5rem 1.5rem;
  }

  .subtitle {
    font-size: 0.85rem;
  }

  th,
  td {
    font-size: 0.76rem;
    padding: 0.45rem;
  }

  .group-toggle {
    font-size: 0.72rem;
    padding: 0.3rem 0.55rem;
  }

  .filter-select {
    font-size: 0.72rem;
  }
}
