@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap");

:root {
  color-scheme: light;
  --ink: #171b22;
  --muted: #68737e;
  --paper: #f2f4f6;
  --card: #ffffff;
  --wine: #1e73be;
  --wine-deep: #185b96;
  --wine-soft: #eaf3fb;
  --gold: #8aba79;
  --gold-soft: #edf6e9;
  --green: #4f853e;
  --green-soft: #e8f3e4;
  --blue: #1e73be;
  --blue-soft: #e5f1fa;
  --line: #dce2e7;
  --shadow: 0 8px 28px rgba(24, 91, 150, 0.08);
  font-family: Nunito, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #fff 0, var(--paper) 280px);
  min-height: 100vh;
}

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

.hero {
  background: linear-gradient(118deg, #2b62d1, var(--wine) 68%, #168fca);
  color: white;
  border-bottom: 4px solid var(--gold);
  box-shadow: 0 5px 22px rgba(17, 72, 127, 0.18);
}

.hero__inner, main, footer {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.hero__inner {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand { display: flex; align-items: center; gap: 16px; }
.brand__logo { width: 166px; height: 56px; object-fit: cover; object-position: center; border-radius: 2px; background: #fff; box-shadow: 0 2px 9px rgba(0,0,0,.12); }
.brand__copy { min-width: 118px; }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font: 800 clamp(20px, 3vw, 28px)/1 Nunito, sans-serif; letter-spacing: .01em; }
h2 { margin-bottom: 0; font: 800 clamp(22px, 3vw, 31px)/1.15 Nunito, sans-serif; }
.eyebrow { margin-bottom: 4px; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: .82; }

.hero__status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 3px;
  background: rgba(255,255,255,.08);
  font-size: 14px;
}

.site-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.site-nav a { padding: 12px 13px; border-radius: 0; color: rgba(255,255,255,.82); font-size: 13px; font-weight: 700; letter-spacing: .04em; text-decoration: none; }
.site-nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.site-nav a.is-active { color: #fff; background: transparent; box-shadow: inset 0 -3px var(--gold); }

.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #67e8a7; box-shadow: 0 0 0 5px rgba(103,232,167,.15); }
.live-dot--archive { background: var(--gold); box-shadow: 0 0 0 5px rgba(138,186,121,.2); }
.is-error .live-dot { background: #ff9a9a; box-shadow: 0 0 0 5px rgba(255,154,154,.15); }

main { padding: 32px 0 72px; }
.toolbar { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 22px; }
.toolbar .eyebrow { color: var(--wine); }
.toolbar__actions { display: flex; align-items: center; gap: 12px; }
.countdown { color: var(--muted); font-size: 13px; white-space: nowrap; }

.refresh-button {
  border: 0;
  border-radius: 3px;
  padding: 11px 16px;
  background: var(--wine);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(24,91,150,.18);
}
.refresh-button:hover { background: var(--wine-deep); }
.refresh-button:disabled { opacity: .55; cursor: wait; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.summary-card {
  min-height: 102px;
  padding: 18px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--wine);
  border-radius: 3px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.summary-card strong { display: block; margin-bottom: 6px; color: var(--wine); font: 900 31px/1 Nunito, sans-serif; }
.summary-card span { color: var(--muted); font-size: 13px; font-weight: 650; }
.skeleton { background: linear-gradient(100deg, #e7ebee 20%, #f7f9fa 38%, #e7ebee 55%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position-x: -200%; } }

.filters { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 20px; padding-bottom: 2px; }
.filter {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 9px 15px;
  background: var(--card);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.filter.is-active { border-color: var(--wine); background: var(--wine); color: white; box-shadow: inset 0 -3px rgba(0,0,0,.08); }

.notice { margin: 14px 0; padding: 14px 16px; border-left: 4px solid var(--gold); border-radius: 2px; background: var(--gold-soft); color: #365d2d; }
.competitions { display: grid; gap: 24px; }
.competition {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.competition__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  border-top: 5px solid var(--wine);
  background: linear-gradient(100deg, var(--wine-soft), #fff 70%);
}
.competition__header h3 { margin-bottom: 7px; font: 800 clamp(20px, 3vw, 27px)/1.1 Nunito, sans-serif; }
.competition__meta { display: flex; flex-wrap: wrap; gap: 8px 15px; color: var(--muted); font-size: 13px; }
.source-link { color: var(--wine); font-weight: 800; white-space: nowrap; text-underline-offset: 3px; }

.combined-strip { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 24px 0; }
.combined-card { padding: 10px 13px; border: 1px solid #bfd9b5; border-radius: 3px; background: var(--gold-soft); }
.combined-card strong { color: var(--wine); }
.combined-card span { margin-left: 7px; font-size: 13px; }

.event-list { display: grid; gap: 12px; padding: 20px 24px 24px; }
.event-card { border: 1px solid var(--line); border-radius: 3px; background: white; overflow: hidden; }
.event-card[open] { border-color: #9fc4e4; box-shadow: 0 8px 24px rgba(24,91,150,.07); }
.event-card > summary { list-style: none; cursor: pointer; padding: 16px 18px; }
.event-card > summary::-webkit-details-marker { display: none; }
.event-summary { display: grid; grid-template-columns: 82px minmax(180px, 1fr) minmax(180px, .85fr) auto; align-items: center; gap: 14px; }
.event-time { color: var(--wine); font: 900 19px/1 Nunito, sans-serif; }
.event-name { font-weight: 850; }
.event-name small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 600; }
.club-result { color: var(--muted); font-size: 13px; }
.club-result strong { color: var(--ink); }
.club-result-item { display: inline-block; margin-right: 12px; vertical-align: top; }
.club-record-change { display: block; margin-top: 3px; color: var(--green); font-size: 11px; font-weight: 800; }
.top-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; margin-top: 5px; }
.top-badges--compact { justify-content: flex-start; margin-top: 4px; }
.top-badge { display: inline-flex; align-items: center; padding: 3px 7px; border-radius: 10px; font-size: 10px; font-weight: 900; line-height: 1.2; white-space: nowrap; }
.top-badge--season { background: #e3f1dc; color: #326224; }
.top-badge--alltime { background: #fff0c9; color: #765200; }

.status { display: inline-flex; align-items: center; justify-content: center; border-radius: 3px; padding: 6px 10px; font-size: 11px; font-weight: 850; white-space: nowrap; }
.status--Progress { background: var(--green-soft); color: var(--green); }
.status--Official { background: #edf0f2; color: #566068; }
.status--Allocated { background: var(--blue-soft); color: var(--blue); }
.status--Unallocated { background: var(--gold-soft); color: #426b35; }

.event-statistics { padding: 15px 18px 18px; border-top: 1px solid var(--line); background: #f8fafb; }
.event-statistics__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.event-statistics__header strong { display: block; color: var(--wine-deep); font-size: 14px; }
.event-statistics__header span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.statistics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.statistics-panel { overflow: hidden; border: 1px solid #c8d9e7; border-radius: 3px; background: #fff; }
.statistics-panel--alltime { border-color: #dfcf9d; }
.statistics-panel > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; cursor: pointer; list-style-position: inside; }
.statistics-panel > summary strong { display: block; color: var(--wine-deep); font-size: 12px; }
.statistics-panel--alltime > summary strong { color: #755700; }
.statistics-panel > summary small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.statistics-leader { overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 750; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.statistics-table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.statistics-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.statistics-table td { padding: 7px 6px; border-top: 1px solid #edf0f2; vertical-align: top; }
.statistics-table tr:first-child td { border-top: 0; }
.statistics-table td:first-child { width: 28px; padding-left: 10px; color: var(--muted); text-align: right; }
.statistics-table td:nth-child(2) { width: 60px; color: var(--wine-deep); font-variant-numeric: tabular-nums; }
.statistics-table td:nth-child(3) { min-width: 132px; }
.statistics-table td:nth-child(3) small { display: block; color: var(--muted); }
.statistics-table td:last-child { padding-right: 10px; color: var(--muted); text-align: right; }
.statistics-source { display: block; padding: 8px 10px; border-top: 1px solid var(--line); color: var(--wine); font-size: 10px; font-weight: 800; text-align: right; }

.round { border-top: 1px solid var(--line); }
.round__bar { display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: #f5f7f8; font-size: 13px; }
.round__bar strong { margin-right: auto; }
.heat-label { padding: 9px 18px 6px; color: var(--muted); font-size: 12px; font-weight: 750; }
.result-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.result-table th, .result-table td { padding: 10px 12px; text-align: left; border-top: 1px solid #e7ebee; }
.result-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.result-table th:first-child, .result-table td:first-child { padding-left: 18px; width: 56px; text-align: center; }
.result-table th:last-child, .result-table td:last-child { padding-right: 18px; text-align: right; }
.result-table tr.is-club { background: linear-gradient(90deg, var(--wine-soft), #fff 70%); box-shadow: inset 4px 0 var(--wine); }
.result-table tr.is-new { animation: new-result 2.8s ease-out; }
@keyframes new-result { 0%, 25% { background: #d9efd1; } }
.athlete-name { font-weight: 800; }
.club-name { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.result-value { font-weight: 850; font-variant-numeric: tabular-nums; }
.result-cell { display: inline-block; max-width: 100%; }
.result-line { white-space: nowrap; }
.record-change { display: block; margin-top: 4px; color: var(--green); font-size: 11px; font-weight: 800; line-height: 1.3; white-space: normal; }
.record-badge, .new-badge { display: inline-block; margin-left: 7px; padding: 3px 6px; border-radius: 6px; font-size: 10px; font-weight: 900; }
.record-badge { background: var(--green); color: white; }
.new-badge { background: var(--gold); color: #24471d; }
.attempts { margin-top: 5px; color: var(--muted); font-size: 11px; }

.weekly-kicker { margin-bottom: 5px; color: var(--wine); font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.weekly-table-wrap { overflow-x: auto; padding: 10px 24px 24px; }
.weekly-table th:first-child, .weekly-table td:first-child { width: 115px; text-align: left; }
.weekly-table th:nth-child(2) { width: 210px; }
.weekly-table th:nth-child(4), .weekly-table td:nth-child(4) { width: 70px; text-align: center; }
.weekly-table tr { background: linear-gradient(90deg, rgba(234,243,251,.82), rgba(255,255,255,0) 68%); }
.weekly-date { color: var(--wine); font-weight: 800; text-transform: capitalize; }
.weekly-event { font-weight: 800; text-underline-offset: 3px; }

.loading-panel, .empty-state { min-height: 260px; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; color: var(--muted); }
.loading-panel p, .empty-state p { margin-bottom: 0; font-weight: 750; color: var(--ink); }
.spinner { width: 36px; height: 36px; border: 4px solid #dce5ec; border-top-color: var(--wine); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

footer { padding: 0 0 38px; color: var(--muted); font-size: 12px; }

@media (max-width: 820px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .event-summary { grid-template-columns: 64px 1fr auto; }
  .club-result { grid-column: 2 / -1; }
  .statistics-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .hero__inner { min-height: 112px; }
  .brand { width: 100%; }
  .brand__logo { width: 146px; height: 50px; }
  .brand__copy { min-width: 0; }
  .hero__inner { flex-wrap: wrap; padding-block: 18px; }
  .hero__status { display: none; }
  .site-nav { order: 3; width: 100%; margin-left: 0; }
  .site-nav a { flex: 1; text-align: center; }
  .toolbar { align-items: start; flex-direction: column; }
  .toolbar__actions { width: 100%; justify-content: space-between; }
  .competition__header { align-items: start; flex-direction: column; }
  .source-link { align-self: stretch; text-align: center; padding: 9px; border: 1px solid #9fc4e4; border-radius: 3px; }
  .event-list { padding: 12px; }
  .event-summary { grid-template-columns: 56px 1fr; }
  .event-summary .status { grid-column: 1 / -1; justify-self: start; }
  .club-result { grid-column: 1 / -1; }
  .event-statistics { padding: 12px; }
  .statistics-panel > summary { align-items: flex-start; flex-direction: column; }
  .statistics-leader { width: 100%; text-align: left; }
  .result-table th:nth-child(3), .result-table td:nth-child(3) { display: none; }
  .result-table th, .result-table td { padding-inline: 8px; }
  .weekly-table-wrap { padding: 8px 12px 16px; overflow: visible; }
  .weekly-table thead { display: none; }
  .weekly-table, .weekly-table tbody, .weekly-table tr, .weekly-table td { display: block; width: 100%; }
  .weekly-table tr { margin-bottom: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
  .weekly-table td, .weekly-table td:first-child, .weekly-table td:nth-child(4), .weekly-table td:last-child { display: grid; grid-template-columns: 78px 1fr; gap: 8px; width: 100%; padding: 5px 0; border: 0; text-align: left; }
  .weekly-table td:nth-child(3) { display: grid; grid-template-columns: 78px 1fr; gap: 2px 8px; width: 100%; padding: 5px 0; border: 0; text-align: left; }
  .weekly-table td:nth-child(3)::before { grid-column: 1; grid-row: 1 / span 2; }
  .weekly-table td:nth-child(3) .weekly-event { grid-column: 2; grid-row: 1; }
  .weekly-table td:nth-child(3) .club-name { grid-column: 2; grid-row: 2; margin-top: 0; }
  .weekly-table td:last-child .result-cell { grid-column: 2; min-width: 0; }
  .weekly-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; }
}
