:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #888;
  --border: rgba(0, 0, 0, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111;
    --surface: #1a1a1a;
    --text: #f0f0f0;
    --muted: #888;
    --border: rgba(255, 255, 255, 0.1);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 3rem 1.5rem 5rem;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.container {
  max-width: 1100px;
  margin: 0 auto;
}
header {
  margin-bottom: 2.5rem;
}
.back,
.back:visited,
.back:hover,
.back:active {
  display: inline-block;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 1rem;
}
.back:hover {
  color: var(--text);
}
h1 {
  font-size: 18px;
  font-weight: 500;
  margin: 0 0 0.25rem;
}
.sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}
.plain-link,
.plain-link:link,
.plain-link:visited,
.plain-link:hover,
.plain-link:active,
.plain-link:focus {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.controls {
  margin-bottom: 1.5rem;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch-track {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  transition: background 0.25s ease;
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.switch input:checked + .switch-track {
  background: #fc4c02;
}
.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(16px);
}
.switch input:checked ~ .switch-label {
  color: var(--text);
}
.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--muted);
  outline-offset: 2px;
}
.grid.races-only .card:not(.race) {
  display: none;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.25s;
  animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform 0.1s ease;
}
.card.race:hover {
  transform: translateY(-1px);
}
.card.race {
  border-color: #fc4c02;
  box-shadow: 0 0 0 1px #fc4c02;
}
.race-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: #fc4c02;
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: 2px;
  margin-left: 6px;
}
.map-wrap {
  position: relative;
  aspect-ratio: 5 / 3;
  background: var(--bg);
  overflow: hidden;
}
.map {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.55) brightness(0.92);
}
@media (prefers-color-scheme: dark) {
  .map {
    filter: saturate(0.55) brightness(0.78);
  }
}
.map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.map.empty {
  aspect-ratio: 5 / 3;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}
.body {
  padding: 14px 16px 16px;
}
.title {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meta {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.stat-label {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}
.stat-value {
  font-size: 15px;
  font-weight: 500;
  margin: 2px 0 0;
}
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
}
