:root {
  color-scheme: dark;
  --ink: #eefaff;
  --muted: #9db5bf;
  --deep: #04131b;
  --panel: #0a2531;
  --panel-soft: #103441;
  --line: rgba(185, 226, 239, 0.16);
  --aqua: #61d9df;
  --lime: #c9f273;
  --orange: #ffb263;
  --danger: #ff8a80;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% -10%, rgba(42, 160, 174, 0.25), transparent 38rem),
    linear-gradient(150deg, #071c27 0%, var(--deep) 60%);
}

a { color: inherit; }
button, input { font: inherit; }

.site-header,
main,
footer {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  border: 1px solid rgba(97, 217, 223, 0.55);
  border-radius: 0.85rem;
  color: #06202a;
  background: linear-gradient(135deg, var(--lime), var(--aqua));
  font-weight: 900;
  letter-spacing: -0.08em;
}

.brand strong,
.brand small { display: block; }
.brand strong { font-size: 1rem; letter-spacing: 0.02em; }
.brand small { margin-top: 0.1rem; color: var(--muted); font-size: 0.75rem; }

.connection {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(3, 17, 24, 0.65);
  font-size: 0.78rem;
}

.connection-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0.8rem currentColor;
}
.connection.online .connection-dot { background: var(--lime); }
.connection.offline .connection-dot { background: var(--danger); }

main { min-height: calc(100vh - 12rem); padding: 2.5rem 0 5rem; }

.hero { max-width: 760px; margin-bottom: 3rem; }
.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--aqua);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 1rem; font-size: clamp(2.4rem, 7vw, 5.4rem); line-height: 0.95; letter-spacing: -0.06em; }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); letter-spacing: -0.025em; }
h3 { font-size: 1rem; }
.lede { max-width: 620px; color: var(--muted); font-size: clamp(1rem, 2.2vw, 1.2rem); line-height: 1.65; }

.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
  gap: 1rem;
}

.card,
.data-panel,
.empty,
.error-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(16, 52, 65, 0.85), rgba(7, 28, 39, 0.9));
  box-shadow: 0 1rem 4rem rgba(0, 0, 0, 0.14);
}

.event-card { display: flex; min-height: 220px; flex-direction: column; padding: 1.35rem; text-decoration: none; transition: 160ms ease; }
.event-card:hover, .event-card:focus-visible { border-color: rgba(97, 217, 223, 0.7); transform: translateY(-3px); }
.event-card .date { color: var(--lime); font-size: 0.8rem; font-weight: 750; text-transform: uppercase; }
.event-card h2 { margin: 0.8rem 0; }
.event-card .revisions { margin-top: auto; color: var(--muted); font-size: 0.8rem; }

.breadcrumb { display: inline-flex; margin-bottom: 1.5rem; color: var(--aqua); text-decoration: none; }
.event-heading { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-bottom: 2rem; }
.event-heading h1 { margin-bottom: 0.4rem; font-size: clamp(2rem, 6vw, 4rem); }
.event-meta { color: var(--muted); }

.tabs { display: flex; gap: 0.55rem; overflow-x: auto; margin-bottom: 1.5rem; padding-bottom: 0.25rem; }
.tab { padding: 0.72rem 1rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.tab[aria-current="page"] { border-color: var(--aqua); color: #05212b; background: var(--aqua); font-weight: 800; }

.data-panel { overflow: hidden; margin-bottom: 1rem; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.panel-heading h2, .panel-heading h3 { margin: 0; }
.badge { padding: 0.25rem 0.55rem; border-radius: 999px; color: var(--lime); background: rgba(201, 242, 115, 0.1); font-size: 0.72rem; }

.race { padding: 1.15rem 1.2rem; border-bottom: 1px solid var(--line); }
.race:last-child { border-bottom: 0; }
.race-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.race-title h3 { margin-bottom: 0.3rem; }
.race-title time { color: var(--aqua); font-weight: 800; }
.heat { margin-top: 1rem; padding-top: 0.9rem; border-top: 1px dashed var(--line); }
.heat-label { color: var(--muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; }

.lane-list, .result-list { margin: 0.6rem 0 0; padding: 0; list-style: none; }
.lane, .result-row { display: grid; grid-template-columns: 3rem minmax(9rem, 1fr) minmax(7rem, 0.8fr) auto; gap: 0.75rem; align-items: baseline; padding: 0.65rem 0; }
.lane + .lane, .result-row + .result-row { border-top: 1px solid rgba(185, 226, 239, 0.08); }
.lane-number, .place { color: var(--lime); font-variant-numeric: tabular-nums; font-weight: 850; }
.club { color: var(--muted); }
.time { color: var(--aqua); font-variant-numeric: tabular-nums; font-weight: 800; text-align: right; }
.status { color: var(--orange); font-size: 0.82rem; text-align: right; }

.empty, .error-panel { padding: 2rem; text-align: center; }
.empty p, .error-panel p { color: var(--muted); }
.error-panel { border-color: rgba(255, 138, 128, 0.3); }
.retry { padding: 0.65rem 1rem; border: 0; border-radius: 999px; color: #09202a; background: var(--aqua); cursor: pointer; font-weight: 800; }

.stale-note { margin: 0 0 1rem; padding: 0.8rem 1rem; border: 1px solid rgba(255, 178, 99, 0.3); border-radius: 0.8rem; color: #ffd2a3; background: rgba(255, 178, 99, 0.08); font-size: 0.85rem; }
.loading { display: grid; min-height: 50vh; place-items: center; align-content: center; color: var(--muted); }
.spinner { width: 2.2rem; height: 2.2rem; margin-bottom: 1rem; border: 3px solid var(--line); border-top-color: var(--aqua); border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

footer { padding: 1.5rem 0 2.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.8rem; }
footer p { margin: 0; }

@media (max-width: 640px) {
  .site-header { align-items: flex-start; }
  .brand small { display: none; }
  .connection > span:last-child { max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  main { padding-top: 1.5rem; }
  .event-heading { display: block; }
  .lane, .result-row { grid-template-columns: 2.2rem minmax(0, 1fr) auto; }
  .lane .club, .result-row .club { grid-column: 2 / -1; }
  .status { grid-column: 3; }
}

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