:root {
  --page-bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eef2f5;
  --text: #19232d;
  --muted: #63707c;
  --border: #d9e0e6;
  --accent: #55458a;
  --accent-dark: #3d3169;
  --accent-soft: #ece9f5;
  --sidebar: #18222c;
  --sidebar-text: #e8edf2;
  --sidebar-muted: #a9b5c0;
  --best-bg: #f4f0fb;
  --best-border: #d6cbea;
  --shadow: 0 16px 42px rgba(23, 33, 43, 0.08);
  --radius: 18px;
  --content-width: 1220px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: inherit;
}

a:focus-visible {
  outline: 3px solid #8c7bc4;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fff;
  color: #111;
  transform: translateY(-160%);
}

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

.site-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 255px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  align-self: start;
  display: flex;
  flex-direction: column;
  padding: 30px 20px;
  background: var(--sidebar);
  color: var(--sidebar-text);
}

.sidebar-header {
  padding: 0 8px 22px;
  border-bottom: 1px solid rgba(255,255,255,.13);
}

.brand {
  display: inline-block;
  color: #fff;
  font-size: 1.12rem;
  font-weight: 750;
  line-height: 1.25;
  text-decoration: none;
}

.credentials {
  margin-top: 6px;
  color: var(--sidebar-muted);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .06em;
}

.site-nav {
  display: grid;
  gap: 5px;
  margin-top: 22px;
}

.site-nav a {
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--sidebar-muted);
  font-size: .93rem;
  font-weight: 620;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: rgba(255,255,255,.10);
  color: #fff;
}

.breadcrumbs {
  margin-top: 24px;
  padding: 18px 10px 0;
  border-top: 1px solid rgba(255,255,255,.13);
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--sidebar-muted);
  font-size: .78rem;
}

.breadcrumbs li + li::before {
  content: "›";
  margin-right: 5px;
  color: #7e8993;
}

.breadcrumbs a {
  color: #d9e1e8;
  text-decoration: none;
}

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

.sidebar-links {
  display: grid;
  gap: 7px;
  margin-top: auto;
  padding: 20px 10px 0;
  border-top: 1px solid rgba(255,255,255,.13);
}

.sidebar-links a {
  color: var(--sidebar-muted);
  font-size: .82rem;
  text-decoration: none;
}

.sidebar-links a:hover {
  color: #fff;
}

.content {
  width: min(100%, var(--content-width));
  margin: 0 auto;
  padding: 48px clamp(24px, 4.5vw, 60px) 30px;
}

.page-header {
  padding: clamp(30px, 5vw, 54px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.eyebrow,
.section-label {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

h1,
h2 {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.6rem, 6vw, 4.8rem);
  line-height: 1;
  letter-spacing: -.045em;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.15;
  letter-spacing: -.025em;
}

.lead {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.header-meta span {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.section {
  padding-top: clamp(52px, 7vw, 80px);
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading > p:not(.section-label) {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
}

.best-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.best-card {
  display: grid;
  gap: 4px;
  padding: 20px;
  border: 1px solid var(--best-border);
  border-radius: 14px;
  background: var(--best-bg);
}

.best-distance {
  color: var(--accent-dark);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.best-card strong {
  font-size: 1.75rem;
  line-height: 1.1;
  letter-spacing: -.02em;
}

.best-card span:last-child {
  color: var(--muted);
  font-size: .82rem;
}

.history-heading {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: end;
}

.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font-size: .84rem;
  font-weight: 750;
  text-decoration: none;
}

.button:hover {
  background: var(--surface-soft);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(23,33,43,.035);
}

.race-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

.race-table th,
.race-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.race-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #24313d;
  color: #fff;
  font-size: .77rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.race-table tr:last-child td {
  border-bottom: 0;
}

.race-table tbody tr:nth-child(even) {
  background: #f8fafb;
}

.race-table tbody tr:hover {
  background: #f1f4f7;
}

.race-table .best-row {
  box-shadow: inset 4px 0 0 var(--accent);
}

.race-table .best-row td:first-child::before {
  content: "★";
  margin-right: 6px;
  color: var(--accent);
  font-size: .72rem;
}

.race-table td:first-child,
.race-table td:nth-child(3),
.race-table td:nth-child(4),
.race-table td:nth-child(5),
.race-table td:nth-child(6),
.race-table td:nth-child(7) {
  white-space: nowrap;
}

.race-table td:nth-child(2) {
  min-width: 260px;
}

.race-table a {
  color: var(--accent-dark);
  font-weight: 650;
  text-decoration: none;
}

.race-table a:hover {
  text-decoration: underline;
}

.table-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: .82rem;
}

.note-section {
  padding: 28px;
  margin-top: clamp(52px, 7vw, 80px);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.note-section h2 {
  margin-bottom: 8px;
}

.note-section p:last-child {
  max-width: 900px;
  margin-bottom: 0;
  color: var(--muted);
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 70px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .82rem;
}

.footer a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

@media (max-width: 1020px) {
  .site-layout {
    grid-template-columns: 215px minmax(0, 1fr);
  }

  .best-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-heading {
    display: block;
  }

  .data-actions {
    margin-top: 16px;
  }
}

@media (max-width: 720px) {
  .site-layout {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
    padding: 18px;
  }

  .site-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-links {
    display: flex;
    flex-wrap: wrap;
    margin-top: 18px;
  }

  .content {
    padding: 18px 14px 28px;
  }

  .page-header {
    padding: 24px;
  }

  .best-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
