@font-face {
  font-family: "Barlow Condensed";
  src: url("/fonts/barlow-condensed-bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f0f2f6;
  --surface: #ffffff;
  --soft: #f5f7fa;
  --ink: #17243c;
  --muted: #526078;
  --line: #d9e0ea;
  --control-line: #8794a9;
  --navy: #17243c;
  --court: #1e2f4c;
  --on-court: #f7f9ff;
  --court-muted: #bac7dc;
  --court-line: #49607e;
  --accent: #963919;
  --accent-pale: #fcece1;
  --accent-bright: #ffb38a;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
h1, h2, h3, p, ul, dl, dd { margin: 0; }
button, select { font: inherit; }
button, select, summary { cursor: pointer; }
button, a, select, summary { transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease; }
a { color: inherit; text-underline-offset: .22em; }
::selection { color: var(--ink); background: var(--accent-bright); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.frame { width: min(1344px, calc(100% - 96px)); margin-inline: auto; }
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.masthead, .mast-links, .brand, .overview, .sync { display: flex; align-items: center; }
.masthead { justify-content: space-between; min-height: 66px; gap: 18px; }
.brand { gap: 10px; font-weight: 750; line-height: 1.1; text-decoration: none; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: .75rem; font-weight: 600; }
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--on-court);
  background: var(--navy);
  border-radius: 5px 5px 12px 5px;
  font: 700 1.35rem/1 var(--display);
  letter-spacing: .025em;
}
.mast-links { gap: 24px; color: var(--muted); font-size: .875rem; font-weight: 600; }
.mast-links a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.mast-links a:hover { color: var(--accent); text-decoration: underline; }

main.frame { padding-block: 27px 64px; }
.overview { justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 16px 24px; margin-bottom: 23px; }
h1, .workspace h2, .club h2, .group-link { font-family: var(--display); font-weight: 700; line-height: .97; }
h1 { font-size: 4.4rem; letter-spacing: -.015em; }
.intro p { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); font-size: .93rem; }
.season { border-left: 1px solid var(--control-line); padding-left: 10px; font-weight: 700; }
.sync { flex-wrap: wrap; gap: 8px 13px; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
#status { overflow-wrap: anywhere; }
#refresh {
  min-height: 44px;
  padding-inline: 15px;
  border: 1px solid var(--navy);
  border-radius: 6px;
  color: var(--surface);
  background: var(--navy);
  font-weight: 650;
}
#refresh:hover:not(:disabled) { background: var(--court-line); border-color: var(--court-line); }
#refresh:disabled { border-color: var(--line); color: var(--muted); background: var(--soft); cursor: default; }

.rota {
  display: grid;
  grid-template-columns: minmax(225px, .95fr) minmax(0, 3fr);
  background: var(--navy);
  color: var(--on-court);
  border-radius: 12px;
  overflow: clip;
  box-shadow: 0 6px 22px #17243c18;
}
.rota :focus-visible { outline-color: var(--accent-bright); }
.club {
  position: relative;
  isolation: isolate;
  padding: 24px;
  background: var(--court);
}
.club::before {
  position: absolute;
  z-index: -1;
  inset: 14px 0 auto auto;
  width: 52%;
  aspect-ratio: 2 / 1;
  border: 1px solid currentColor;
  background: linear-gradient(to right, transparent calc(50% - 1px), currentColor 50%, transparent calc(50% + 1px));
  color: #8ba1c72a;
  content: "";
  pointer-events: none;
}
.club h2 { font-size: 2.7rem; letter-spacing: -.01em; }
.club p { margin-top: 4px; color: var(--court-muted); font-size: .86rem; }
.club-stats { display: flex; flex-wrap: wrap; gap: 12px 18px; margin-top: 14px; }
.club-stats div { display: flex; flex-direction: column-reverse; }
.club-stats dt { color: var(--court-muted); font-size: .75rem; }
.club-stats dd { margin: 0; font-size: 1.25rem; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.2; }
.club .control { margin-top: 15px; }
.club .control span { color: var(--court-muted); }
.club .control select { color: var(--on-court); background-color: var(--navy); border-color: #778aa8; }
.club .control select:hover { background-color: #253858; }
.path { display: grid; grid-template-columns: 1.12fr .92fr 1fr; padding: 24px 0; min-width: 0; }
.path > p { grid-column: 1 / -1; padding-inline: 24px; }
.path-step { min-width: 0; padding-inline: 22px; }
.path-step + .path-step { border-inline-start: 1px solid var(--court-line); }
.path-step h3 { color: var(--court-muted); font-size: .875rem; font-weight: 650; }
.path-step ul { padding: 0; list-style: none; }
.group-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  margin: 2px 0 3px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-bright);
  text-align: left;
  font-size: 2.6rem;
}
.group-link::after { width: 10px; height: 10px; border-top: 2px solid; border-right: 2px solid; transform: rotate(45deg); content: ""; }
.group-link:hover { color: var(--on-court); }
.opponents li { font-size: .84rem; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.opponents li + li { margin-top: 6px; }
.route-list { margin-top: 8px; font-size: .87rem; }
.route-list li { display: grid; gap: 2px; padding-block: 9px; }
.route-list li + li { border-top: 1px solid var(--court-line); }
.route-list span { color: var(--court-muted); font-size: .8rem; }
.route-list strong { font-weight: 700; }

.stages {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-block: 24px 25px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.stages button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 7px 15px;
  background: transparent;
  color: var(--muted);
  font-size: .91rem;
  font-weight: 650;
}
.stages button:hover { color: var(--ink); background: var(--soft); }
.stages button[aria-pressed="true"] { border-color: #f0c9b6; color: var(--accent); background: var(--accent-pale); }

.workspace h2 { font-size: 2.75rem; letter-spacing: -.01em; }
.description { max-width: 72ch; margin: 7px 0 17px; color: var(--muted); font-size: .91rem; }
.groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; gap: 16px; }
.group-card { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.group-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
  border-radius: 7px 7px 0 0;
  background: var(--soft);
}
.group-card h3 { scroll-margin-block: 20px; font: 700 1.55rem/1.1 var(--display); }
.group-card header span { color: var(--accent); font-size: .75rem; font-weight: 700; }
.group-card.rota-group { border-color: #cc9275; }
.rota-group header { border-color: #e7b69d; background: var(--accent-pale); }
.teams { padding: 0; list-style: none; }
.teams > li { display: flex; flex-direction: column; justify-content: center; min-height: 65px; padding: 8px 13px; border-bottom: 1px solid var(--line); }
.teams strong { font-size: .84rem; line-height: 1.3; overflow-wrap: anywhere; }
.teams small, th small { display: block; margin-top: 3px; color: var(--muted); font-size: .76rem; font-weight: 400; }
.rota-team { background: #fff4ed; }
.rota-team strong { color: var(--accent); }
.control { display: grid; gap: 4px; min-width: 0; }
.control span { color: var(--muted); font-size: .78rem; font-weight: 650; }
.control select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding-inline: 7px;
  border: 1px solid var(--control-line);
  border-radius: 5px;
  color: var(--ink);
  background-color: var(--surface);
  font-size: .83rem;
  text-overflow: ellipsis;
}
.control select:hover { background-color: var(--soft); }
.group-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 9px 13px 12px; }
.group-controls + .matches { border-top: 1px solid var(--line); }
.matches summary { min-height: 44px; padding: 11px 13px; border-radius: 0 0 7px 7px; }
.matches summary, .candidates summary { color: var(--muted); font-size: .84rem; font-weight: 650; }
.matches summary:hover, .candidates summary:hover { color: var(--accent); }
.matches summary:hover { background: var(--soft); }
.matches summary:focus-visible { outline-offset: -4px; }
.matches ul, .candidates ul { margin: 0; padding: 0 13px 12px; list-style: none; }
.matches li { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; padding-block: 8px; border-top: 1px solid var(--line); font-size: .75rem; overflow-wrap: anywhere; }
.matches li span:last-child { text-align: right; }
.candidates { margin-top: 3px; color: var(--muted); font-size: .8rem; }
.candidates summary { padding-block: 8px; }
.candidates li + li { margin-top: 4px; }
.candidates ul { padding-block: 3px; }
.standings .control { width: min(100%, 230px); margin-bottom: 16px; }
.table-scroll { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
table { border-collapse: collapse; min-width: 555px; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: right; }
th:nth-child(2) { width: 50%; text-align: left; }
thead { background: var(--navy); color: var(--on-court); }
tbody th { font-weight: 600; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr.rota-team th, tbody tr.rota-team td { color: var(--accent); font-weight: 750; }

.site-footer {
  padding: 0 16px 24px;
  color: #626e82;
  font-size: .8125rem;
  text-align: center;
}
.site-footer a:hover { color: var(--accent); }

@media (max-width: 1100px) {
  .frame { width: calc(100% - 64px); }
  .groups { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .path-step { padding-inline: 16px; }
}
@media (max-width: 840px) {
  .frame { width: calc(100% - 40px); }
  h1 { font-size: 3.8rem; }
  .rota { grid-template-columns: 1fr; }
  .club { display: grid; grid-template-columns: 1fr minmax(165px, 225px); align-items: end; column-gap: 18px; }
  .club p, .club-stats { grid-column: 1; }
  .club .control { grid-column: 2; grid-row: 1 / span 3; margin-top: 0; }
  .club::before { width: 32%; }
  .path { padding-block: 18px; }
  .groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 540px) {
  .frame { width: calc(100% - 28px); }
  .masthead { flex-wrap: wrap; padding-top: 10px; gap: 1px 14px; }
  .mast-links { gap: 14px; font-size: .8rem; }
  .brand { min-height: 44px; }
  main.frame { padding-top: 22px; }
  h1 { font-size: 3.35rem; }
  .workspace h2 { font-size: 2.45rem; }
  .club { display: block; padding: 17px 18px; }
  .club .control { max-width: 240px; margin-top: 13px; }
  .path { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding-top: 0; }
  .path-step { padding: 13px 13px 0; }
  .path-step.opponents { grid-column: 1 / -1; padding: 14px 18px; border-bottom: 1px solid var(--court-line); }
  .path-step.opponents + .path-step { border-inline-start: 0; padding-inline-start: 18px; }
  .group-link { font-size: 2.35rem; }
  .stages { gap: 2px; margin-block: 19px 22px; justify-content: space-between; }
  .stages button { padding-inline: 5px; font-size: .8rem; }
  .groups { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  button, a, select, summary { transition: none; }
}
