:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --sidebar: #fbfcfd;
  --text: #181c24;
  --text-soft: #485467;
  --muted: #7b8799;
  --border: #e3e7ed;
  --border-strong: #d6dce5;
  --blue: #1769e8;
  --blue-soft: #edf4ff;
  --blue-hover: #0e5cda;
  --red: #e12d39;
  --red-soft: #fff1f2;
  --amber: #a56809;
  --amber-soft: #fff7e7;
  --font-body: "Aptos", "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-numeric: "DIN Alternate", "Aptos Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 960px;
  background: var(--bg);
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  color: inherit;
}

button {
  border: 0;
}

button,
select,
.wordmark {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
select:focus-visible,
.wordmark:focus-visible,
.competition-source:focus-visible,
.skip-link:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  transform: translateY(-150%);
  padding: 8px 12px;
  border-radius: 5px;
  color: #fff;
  background: var(--blue);
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100vh;
  border-right: 1px solid var(--border);
  background: var(--sidebar);
}

.wordmark {
  display: inline-block;
  margin: 32px 30px 38px;
  color: var(--text);
  font-family: "Aptos Display", var(--font-body);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.9px;
  line-height: 1;
  text-decoration: none;
}

.wordmark-accent {
  color: var(--blue);
}

.sport-nav {
  display: grid;
  gap: 4px;
}

.sport-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 0 28px 0 30px;
  gap: 14px;
  border-radius: 0;
  color: var(--text-soft);
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  text-align: left;
  transition: color 140ms ease, background-color 140ms ease;
}

.sport-nav-item::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: transparent;
}

.sport-nav-item:hover {
  color: var(--text);
  background: #f3f5f8;
}

.sport-nav-item.is-active {
  color: var(--blue);
  background: var(--blue-soft);
}

.sport-nav-item.is-active::before {
  background: var(--blue);
}

.sport-nav-item svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.sport-nav-item[data-sport="all"] svg {
  fill: currentColor;
  stroke: none;
}

.sport-nav-chevron {
  width: 16px !important;
  height: 16px !important;
  margin-left: auto;
  opacity: 0.58;
  stroke-width: 1.8 !important;
}

.sport-subnav {
  position: relative;
  display: grid;
  gap: 2px;
  margin: 3px 14px 8px 42px;
  padding: 3px 0 3px 13px;
}

.sport-subnav::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 1px;
  background: var(--border-strong);
}

.sport-subnav-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  min-height: 38px;
  padding: 5px 9px;
  gap: 7px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  transition: color 140ms ease, background-color 140ms ease;
}

.sport-subnav-item::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -13px;
  width: 7px;
  height: 1px;
  background: var(--border-strong);
}

.sport-subnav-item:hover {
  color: var(--text);
  background: #f1f4f8;
}

.sport-subnav-item.is-active {
  color: var(--blue);
  background: var(--blue-soft);
}

.sport-subnav-item.is-active::before {
  height: 15px;
  border-radius: 2px;
  background: var(--blue);
  transform: translateY(-50%);
}

.sport-subnav-code {
  color: currentColor;
  font-family: var(--font-numeric);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-align: center;
  opacity: 0.82;
}

.data-update {
  padding: 26px 30px 30px;
  color: var(--muted);
  font-size: 13px;
}

.data-update-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.data-update-label svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.data-update time {
  display: block;
  color: #687487;
  font-family: var(--font-numeric);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.main {
  min-width: 0;
}

.main-inner {
  width: 100%;
  padding: 29px 38px 56px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(155px, auto) minmax(320px, 1fr) 150px;
  align-items: start;
  gap: 26px;
  min-height: 56px;
  margin-bottom: 25px;
}

.page-heading h1 {
  margin: 0;
  color: var(--text);
  font-family: "Aptos Display", var(--font-body);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.65px;
  line-height: 1.08;
}

.page-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  font-family: var(--font-numeric);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

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

.segmented-control {
  display: inline-flex;
  height: 42px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
}

.date-option {
  min-width: 72px;
  padding: 0 20px;
  border-right: 1px solid var(--border);
  color: var(--text-soft);
  background: transparent;
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease;
}

.date-option:last-child {
  border-right: 0;
}

.date-option:hover:not(.is-active) {
  color: var(--text);
  background: #f7f9fb;
}

.date-option.is-active {
  color: #fff;
  background: var(--blue);
}

.calendar-picker {
  position: relative;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: var(--text-soft);
  background: var(--surface);
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.icon-button:hover {
  color: var(--blue);
  border-color: #b8cdf0;
}

.icon-button.is-active {
  color: var(--blue);
  border-color: #a9c4f0;
  background: var(--blue-soft);
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.visually-hidden-date {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.status-filter {
  position: relative;
  display: flex;
  align-items: center;
  width: 150px;
  height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: var(--text-soft);
  background: var(--surface);
}

.status-filter > svg:first-child {
  position: absolute;
  left: 13px;
  width: 17px;
  height: 17px;
  pointer-events: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.status-filter select {
  width: 100%;
  height: 100%;
  padding: 0 37px 0 38px;
  border: 0;
  outline: 0;
  appearance: none;
  color: var(--text-soft);
  background: transparent;
  cursor: pointer;
}

.select-chevron {
  position: absolute;
  right: 12px;
  width: 16px;
  height: 16px;
  pointer-events: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.match-groups {
  display: grid;
  gap: 17px;
}

.competition-group {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.competition-header {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 0 22px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}

.competition-mark {
  width: 4px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 2px;
  background: var(--blue);
}

.competition-mark[data-sport="basketball"] {
  background: #e2762f;
}

.competition-mark[data-sport="lol"],
.competition-mark[data-sport="valorant"],
.competition-mark[data-sport="cs2"],
.competition-mark[data-sport="honor-of-kings"],
.competition-mark[data-sport="dota2"] {
  background: #8155c7;
}

.competition-mark[data-sport="racing"] {
  background: #d43c3c;
}

.competition-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.1px;
}

.competition-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.competition-source {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  text-decoration: none;
}

.competition-source::after {
  content: "↗";
  margin-left: 4px;
}

.competition-source:hover {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  scrollbar-color: #c1c8d2 transparent;
  scrollbar-width: thin;
}

.table-scroll::-webkit-scrollbar {
  height: 6px;
}

.table-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.table-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #c1c8d2;
}

.matches-table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
  table-layout: fixed;
}

.matches-table th,
.matches-table td {
  padding-right: 18px;
  padding-left: 18px;
  text-align: left;
  vertical-align: middle;
}

.matches-table thead th {
  height: 45px;
  color: var(--muted);
  background: #fcfcfd;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.matches-table tbody tr {
  height: 64px;
  border-top: 1px solid var(--border);
}

.matches-table tbody tr:first-child {
  border-top: 0;
}

.matches-table tbody tr:hover {
  background: #fbfcfe;
}

.col-time {
  width: 10%;
}

.col-meta {
  width: 24%;
}

.col-side {
  width: 21%;
}

.col-score {
  width: 11%;
  text-align: center !important;
}

.col-status {
  width: 13%;
  text-align: right !important;
}

.match-time {
  color: #526075;
  font-family: var(--font-numeric);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.match-meta {
  min-width: 0;
  color: var(--text-soft);
  white-space: nowrap;
}

.match-stage {
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.team,
.race-entry {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.team-logo {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  object-fit: contain;
}

.team-name,
.race-name,
.race-venue {
  overflow: visible;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
}

.race-venue {
  color: var(--text-soft);
}

.score {
  color: var(--text);
  font-family: var(--font-numeric);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.015em;
  white-space: nowrap;
}

.score.is-versus,
.score.is-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.match-status {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.status-scheduled {
  color: var(--blue);
}

.status-finished {
  color: var(--muted);
}

.status-live {
  align-items: flex-end;
  color: var(--red);
}

.live-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border: 1px solid #f2bdc2;
  border-radius: 4px;
  background: var(--red-soft);
  font-family: var(--font-numeric);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.live-label::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.live-caption {
  font-size: 11px;
}

.status-postponed,
.status-cancelled {
  color: var(--amber);
}

.view-state {
  display: flex;
  min-height: 360px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  text-align: center;
}

.view-state > svg {
  width: 30px;
  height: 30px;
  margin-bottom: 12px;
  fill: none;
  stroke: #98a4b5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.45;
}

.view-state h2 {
  margin: 0;
  color: var(--text-soft);
  font-size: 17px;
  font-weight: 600;
}

.view-state p {
  margin: 7px 0 0;
  font-size: 13px;
}

.state-dot {
  width: 7px;
  height: 7px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--blue);
}

.secondary-button {
  margin-top: 18px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--text-soft);
  background: var(--surface);
  cursor: pointer;
}

.secondary-button:hover {
  color: var(--blue);
  border-color: #b8cdf0;
}

code {
  font-family: var(--font-numeric);
  font-size: 0.95em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .wordmark {
    margin-right: 24px;
    margin-left: 24px;
  }

  .sport-nav-item {
    padding-right: 22px;
    padding-left: 24px;
  }

  .data-update {
    padding-right: 24px;
    padding-left: 24px;
  }

  .main-inner {
    padding-right: 28px;
    padding-left: 28px;
  }

  .toolbar {
    grid-template-columns: 145px minmax(300px, 1fr) 146px;
    gap: 18px;
  }

  .date-option {
    min-width: 64px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .status-filter {
    width: 146px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
