:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  --ink: #101828;
  --muted: #667085;
  --line: #d9e2ec;
  --page: #eef4f7;
  --panel: #ffffff;
  --green: #0f766e;
  --blue: #1d4ed8;
  --gold: #d99a22;
  --silver: #94a3b8;
  --bronze: #b76e37;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.16), rgba(29, 78, 216, 0.11)),
    var(--page);
}

button {
  font: inherit;
}

.screen {
  width: min(1720px, calc(100vw - 42px));
  margin: 0 auto;
  padding: 26px 0 36px;
}

.hero,
.section-title,
.top-grid,
.list-grid {
  display: grid;
  gap: 16px;
}

.hero {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.6rem, 5vw, 5.7rem);
  line-height: 0.95;
}

h2 {
  font-size: clamp(1.45rem, 2vw, 2.2rem);
}

h3 {
  font-size: 1.25rem;
}

.view-switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  max-width: min(680px, 100%);
}

.view-switch button {
  border: 0;
  padding: 0.8rem 1rem;
  color: #344054;
  background: #fff;
  font-weight: 900;
  cursor: pointer;
  min-width: 84px;
}

.view-switch button small {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.66rem;
  line-height: 1;
  font-weight: 800;
  opacity: 0.82;
}

.view-switch button.day-status-complete {
  color: #067647;
  background: #ecfdf3;
}

.view-switch button.day-status-ongoing {
  color: #175cd3;
  background: #eff8ff;
}

.view-switch button.day-status-upcoming {
  color: #475467;
  background: #f8fafc;
}

.view-switch button.active {
  color: #fff;
  background: #101828;
}

.scoreboard {
  display: none;
}

.scoreboard.active {
  display: block;
}

.scoreboard.active[data-panel="day"] {
  display: block;
}

.section-title {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 18px;
}

.section-title p,
.subtle {
  color: var(--muted);
}

.live-pill {
  display: inline-block;
  border: 1px solid rgba(15, 118, 110, 0.26);
  border-radius: 999px;
  padding: 0.52rem 0.85rem;
  color: var(--green);
  background: #effcf8;
  font-weight: 900;
  text-decoration: none;
}

.live-pill:hover,
.live-pill:focus-visible {
  border-color: var(--green);
  background: #dff8f1;
}

.section-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.archive-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.52rem 0.85rem;
  color: var(--ink);
  background: #fff;
  font-weight: 900;
  text-decoration: none;
}

.archive-link:hover,
.archive-link:focus-visible {
  border-color: var(--green);
  color: var(--green);
  background: #effcf8;
}

.top-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.top-grid .club-card {
  order: 1;
}

.top-grid .athlete-card {
  order: 2;
}

.top-grid .medals-card {
  order: 3;
}

.feature-card,
.rank-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 22px 55px rgba(16, 24, 40, 0.12);
}

.feature-card {
  min-height: 250px;
  padding: 20px;
}

.label {
  display: block;
  margin-bottom: 14px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile,
.club-hero {
  display: flex;
  gap: 14px;
  align-items: center;
}

.portrait,
.badge,
.club-logo {
  flex: 0 0 auto;
  width: 86px;
  height: 86px;
  border-radius: 50%;
}

.portrait {
  object-fit: cover;
  object-position: center 25%;
  border: 3px solid #fff;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.18);
}

.club-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  padding: 5px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.12);
}

.badge {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 2.2rem;
  font-weight: 950;
}

.badge.b1 {
  background: conic-gradient(from 35deg, #0f766e, #16a34a, #1d4ed8, #0f766e);
}

.badge.b2 {
  background: conic-gradient(from 35deg, #1d4ed8, #7c3aed, #0f766e, #1d4ed8);
}

.big-number {
  margin-top: 18px;
  font-size: clamp(3rem, 6vw, 5.1rem);
  line-height: 0.95;
  font-weight: 950;
}

.medal-row {
  display: grid;
  grid-template-columns: 1fr repeat(3, 48px);
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid #edf1f7;
  padding: 10px 0;
}

.medal-row span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  font-weight: 950;
}

.medal-row span:nth-child(2) {
  background: #fff4d8;
  color: #9a6700;
}

.medal-row span:nth-child(3) {
  background: #eef2f6;
  color: #475467;
}

.medal-row span:nth-child(4) {
  background: #fff0e6;
  color: #9c4a1a;
}

.legend {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-align: right;
}

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

/* Remove hide-mvp from <body> in index.html to show MVP again. */
.hide-mvp .athlete-card,
.hide-mvp .mvp-panel {
  display: none;
}

.hide-mvp .top-grid,
.hide-mvp .list-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.list-grid .rank-panel:nth-child(2) {
  order: 1;
}

.list-grid .rank-panel:nth-child(1) {
  order: 2;
}

.list-grid .rank-panel:nth-child(3) {
  order: 3;
}

.rank-panel {
  overflow: hidden;
}

.rank-panel h3 {
  padding: 16px 18px 12px;
}

ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rank-panel li {
  display: grid;
  grid-template-columns: 36px 42px 1fr auto;
  gap: 10px;
  align-items: center;
  border-top: 1px solid #edf1f7;
  padding: 10px 14px;
}

.rank-panel li:has(.mini-face) {
  grid-template-columns: 36px 42px 1fr auto;
}

.rank-panel li:not(:has(.mini-face)) {
  grid-template-columns: 36px 1fr auto;
}

.rank {
  color: var(--muted);
  font-weight: 950;
  text-align: right;
}

.mini-badge,
.mini-face,
.mini-logo {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-size: 0.85rem;
  font-weight: 950;
}

.mini-face {
  object-fit: cover;
  object-position: center 25%;
  background: #e2e8f0;
}

.mini-logo {
  object-fit: contain;
  padding: 3px;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.name {
  min-width: 0;
}

.name strong,
.name span {
  display: block;
  max-width: none;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

.club-card h3,
.medal-row strong,
.rank-panel li .name strong {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

.name span {
  color: var(--muted);
  font-size: 0.82rem;
}

.score {
  font-size: 1.08rem;
  font-weight: 950;
}

.counted-races {
  display: grid;
  gap: 12px;
}

.empty-races,
.counted-race {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 35px rgba(16, 24, 40, 0.08);
}

.empty-races {
  padding: 24px;
  color: var(--muted);
  font-weight: 800;
}

.counted-race {
  overflow: hidden;
}

.counted-race summary {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
}

.counted-race summary::-webkit-details-marker {
  display: none;
}

.race-number {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-weight: 950;
}

.race-copy strong,
.race-copy small {
  display: block;
}

.race-copy small,
.race-starters {
  color: var(--muted);
}

.race-points {
  min-width: 72px;
  text-align: right;
  font-size: 1.2rem;
  font-weight: 950;
}

.race-table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.race-points-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.race-points-table th,
.race-points-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #edf1f7;
  text-align: left;
  white-space: nowrap;
}

.race-points-table th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.race-points-table th:nth-last-child(-n + 2),
.race-points-table td:nth-last-child(-n + 2) {
  text-align: right;
  font-weight: 900;
}

.race-club-summary {
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.race-club-summary > strong {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.race-club-summary > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.race-club-summary span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  white-space: nowrap;
}

.race-club-summary b {
  margin-right: 4px;
}

@media (max-width: 1050px) {
  .hero,
  .section-title,
  .top-grid,
  .list-grid {
    grid-template-columns: 1fr;
  }

  .hide-mvp .top-grid,
  .hide-mvp .list-grid {
    grid-template-columns: 1fr;
  }

  .view-switch {
    width: 100%;
    justify-content: stretch;
  }

  .section-actions {
    justify-content: flex-start;
  }

  .view-switch button {
    flex: 1;
  }

  .counted-race summary {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }

  .race-starters {
    display: none;
  }
}
