:root {
  color-scheme: light dark;

  --blue-dark: #123b7a;
  --blue: #1f5fbf;
  --blue-mid: #174a96;
  --blue-light: #dce9ff;

  --bg: #f5f8fe;
  --card: #ffffff;
  --card-soft: #eef4ff;
  --text: #1a2740;
  --text-muted: #556b8e;
  --link: #144aa0;
  --line: #9fb6df;
  --table-hover: #f2f7ff;
  --top3: #eef4ff;
  --hero-text: #ffffff;
  --logo-bg: #ffffff;
  --hero-inner-line: rgba(255, 255, 255, 0.14);
  --hero-shadow: rgba(10, 32, 80, 0.18);
}

:root[data-theme="dark"] {
  --blue-dark: #0d2347;
  --blue: #4f8cff;
  --blue-mid: #16376d;
  --blue-light: #18345f;

  --bg: #0f1726;
  --card: #162033;
  --card-soft: #1a2942;
  --text: #e7eefc;
  --text-muted: #a8b8d6;
  --link: #7fb0ff;
  --line: #2d436c;
  --table-hover: #1b2940;
  --top3: #1f2f4b;
  --hero-text: #ffffff;
  --logo-bg: #ffffff;
  --hero-inner-line: rgba(255, 255, 255, 0.08);
  --hero-shadow: rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.breadcrumbs {
  margin-bottom: 14px;
  font-size: 14px;
}

.breadcrumbs a,
.toplink {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
}

.breadcrumbs a:hover,
.toplink:hover,
a:hover {
  text-decoration: underline;
}

.toplink {
  display: inline-block;
  margin-bottom: 14px;
}

.hero {
  background: var(--blue-dark);
  color: var(--hero-text);
  padding: 18px 20px;
  border-radius: 10px 10px 0 0;
  border-bottom: 3px solid var(--blue);
  box-shadow: 0 8px 18px var(--hero-shadow);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 1px solid var(--hero-inner-line);
  pointer-events: none;
}

.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.hero-main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.hero-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  background: var(--logo-bg);
  border-radius: 10px;
  padding: 6px;
  flex: 0 0 auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.14);
}

.hero-text {
  min-width: 0;
}

.hero-kicker {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
  margin-bottom: 4px;
  font-weight: 700;
}

.hero h1 {
  margin: 0 0 4px;
  font-size: 28px;
  line-height: 1.15;
}

.hero h2 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 600;
}

.hero p {
  margin: 0;
  font-size: 14px;
  opacity: 0.92;
}

.theme-toggle {
  border: 1px solid rgba(255,255,255,0.20);
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  width: 38px;
  height: 34px;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  flex: 0 0 auto;
  padding: 0;
}

.theme-toggle:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.30);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.section {
  margin-top: 24px;
}

.section:first-child {
  margin-top: 0;
}

.section-title {
  margin: 0 0 10px;
  font-size: 18px;
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
}

th, td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  font-size: 14px;
  white-space: nowrap;
  vertical-align: top;
  color: var(--text);
}

th {
  background: var(--blue-light);
  color: var(--text);
}

.table-sort {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.table-sort:hover {
  text-decoration: underline;
}

.sort-indicator {
  display: inline-block;
  min-width: 10px;
  margin-left: 4px;
}

tbody tr:hover {
  background: var(--table-hover);
}

tbody tr.top3 {
  background: var(--top3);
}

a {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
}

table a {
  color: var(--text);
  font-weight: 400;
}

.navbox {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.navbox a,
.navbox span.current {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--card-soft);
  border-radius: 6px;
  text-decoration: none;
  color: var(--link);
  font-size: 14px;
  font-weight: 600;
}

.navbox a:hover {
  filter: brightness(1.03);
}

.selectors {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

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

.selector label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.selector select {
  min-width: 220px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--text);
}

.meta {
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-muted);
}

.page-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.78;
}

.muted {
  color: var(--text-muted);
  font-size: 14px;
}

.nav-title {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--text);
  font-weight: 700;
}

.result-col {
  text-align: center;
  font-weight: 700;
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-soft);
  font-size: 12px;
  font-weight: 700;
}

.status-pill.absent {
  background: #ffe8dc;
  border-color: #f3c3aa;
  color: #8b3e1b;
}

:root[data-theme="dark"] .status-pill.absent {
  background: #3a2418;
  border-color: #6a3c27;
  color: #ffbf9b;
}

.empty-cell {
  color: var(--text-muted);
}

.reason-col {
  white-space: normal;
}

.groups-table th,
.groups-table td {
  vertical-align: middle;
}

.clickable-row {
  cursor: pointer;
  transition: background 0.12s ease;
}

.clickable-row:hover {
  background: var(--table-hover);
}

.arrow-col {
  text-align: right;
  width: 1%;
  white-space: nowrap;
}

.row-arrow {
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
  display: inline-block;
  transition: transform 0.12s ease, color 0.12s ease;
}

.clickable-row:hover .row-arrow {
  color: var(--link);
  transform: translateX(2px);
}

.player-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.player-score-main {
  min-width: 170px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(145deg, var(--card-soft), var(--card));
  padding: 12px 14px;
}

.player-score-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}

.player-score-value {
  margin-top: 4px;
  font-size: 34px;
  line-height: 1;
  color: var(--link);
  font-weight: 800;
}

.player-stats-grid {
  flex: 1;
  min-width: 260px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.player-stat-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-soft);
  padding: 10px 12px;
}

.player-stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
}

.player-stat-value {
  margin-top: 3px;
  font-size: 24px;
  line-height: 1;
  color: var(--text);
  font-weight: 800;
}

@media (max-width: 700px) {
  .page {
    padding: 16px 10px 28px;
  }

  .hero-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-main {
    width: 100%;
    align-items: flex-start;
  }

  .hero-logo {
    width: 58px;
    height: 58px;
  }

  .hero h1 {
    font-size: 22px;
  }

  .hero h2 {
    font-size: 18px;
  }

  .selector select {
    min-width: 100%;
  }

  .groups-table th.desktop-only,
  .groups-table td.desktop-only {
    display: none !important;
  }

  .groups-table th,
  .groups-table td {
    font-size: 13px;
    padding: 8px 8px;
  }

  .row-arrow {
    font-size: 18px;
  }

  .player-score-main {
    width: 100%;
    min-width: 0;
  }

  .player-stats-grid {
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .player-score-value {
    font-size: 30px;
  }

  .player-stat-value {
    font-size: 20px;
  }
}