:root {
  --paper: #f1f4ee;
  --paper-2: #e6ebe3;
  --ink: #14241e;
  --ink-2: #4d5e57;
  --court: #1e5a47;
  --court-2: #c9dcd3;
  --ball: #d4f03a;
  --ball-soft: #eef7c2;
  --loss: #b8453c;
  --line: #cfd8d1;
  --display: "Bricolage Grotesque", "Helvetica Neue", sans-serif;
  --body: "Bricolage Grotesque", system-ui, sans-serif;
  --radius: 4px;
}

* { box-sizing: border-box; }

html { background: var(--paper); color: var(--ink); }

body {
  margin: 0;
  font: 400 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--court); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--ball); outline-offset: 2px; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* Masthead */
.masthead { position: relative; overflow: hidden; background: var(--ink); color: var(--paper); padding: 28px 0 24px; }
.masthead .wrap { position: relative; }
.court {
  position: absolute;
  right: -48px; bottom: -14px;
  width: min(340px, 48vw);
  height: auto;
  fill: none;
  stroke: var(--court-2);
  stroke-width: 0.7;
  opacity: 0.35;
  pointer-events: none;
  mask-image: linear-gradient(90deg, transparent 0%, #000 40%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 40%);
}
.court .net { stroke: var(--ball); stroke-width: 1.2; stroke-dasharray: 2 2; }
@media (max-width: 560px) { .court { width: 60vw; right: -22vw; bottom: -10px; opacity: 0.14; } }
.masthead-league { margin: 0 0 6px; color: var(--court-2); font-size: 15px; }
.masthead-team {
  margin: 0;
  font: 800 clamp(44px, 10vw, 64px)/0.92 var(--display);
  font-variation-settings: "wdth" 85, "opsz" 96;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.masthead-team::after {
  content: "";
  display: inline-block;
  width: 0.3em; height: 0.3em;
  margin-left: 0.15em;
  vertical-align: baseline;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='15' fill='%23d4f03a'/%3E%3Cpath d='M8 5c5 5 5 17 0 22M24 5c-5 5-5 17 0 22' stroke='%2314241e' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.masthead-summary { margin: 14px 0 0; font-size: 18px; color: var(--paper); max-width: 44ch; }
.masthead-summary strong { color: var(--ball); font-weight: 600; }

/* Section nav */
.sections {
  position: sticky; top: 0; z-index: 2;
  display: flex; gap: 4px;
  scrollbar-width: none;
  padding-top: 8px; padding-bottom: 8px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.sections a {
  flex: 0 0 auto;
  padding: 6px 0;
  margin-right: 18px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}
.sections a:hover { border-color: var(--line); }
.sections a.active { border-color: var(--ink); }
.sections a[hidden] { display: none; }
.tab[hidden] { display: none; }

.block { padding: 28px 0 8px; }
h2 { margin: 0 0 14px; font: 800 34px/1 var(--display); font-variation-settings: "wdth" 85; }
h3 { margin: 28px 0 10px; font: 700 22px/1 var(--display); font-variation-settings: "wdth" 90; }
.note, .empty, .foot { color: var(--ink-2); font-size: 14px; }
.note { margin: 10px 0 0; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: 13px; font-weight: 500; color: var(--ink-2); }
td.num, th.num { text-align: right; font-family: var(--display); font-size: 18px; white-space: nowrap; }
th.num { font-family: var(--body); font-size: 13px; }
td.pos { width: 2.2em; font-family: var(--display); font-size: 20px; font-weight: 700; color: var(--ink-2); }
tr.me td { background: var(--ball-soft); }
tr.me td.pos { color: var(--ink); }
tr.me td:first-child { box-shadow: inset 4px 0 0 var(--ball); }
td.team { font-weight: 500; }
.hide-s { display: none; }
@media (min-width: 560px) { .hide-s { display: table-cell; } }

/* Phones: tighter tables and a wrapping tab bar */
@media (max-width: 560px) {
  th, td { padding: 9px 5px; }
  td.num, th.num { font-size: 16px; }
  td.team { font-size: 15px; line-height: 1.25; }
  td.pos { font-size: 17px; }
  .sections { flex-wrap: wrap; gap: 0 2px; }
  .sections a { margin-right: 14px; font-size: 15px; }
  .masthead-summary { font-size: 16px; }
  .match .score { font-size: 26px; }
}

/* Rounds */
.round { margin-bottom: 22px; }
.round-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.round-head h3 { margin: 0; }
.round-head span { color: var(--ink-2); font-size: 14px; }

.match { border-bottom: 1px solid var(--line); }
.match summary {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  cursor: pointer;
}
.match summary::-webkit-details-marker { display: none; }
.match.me { box-shadow: inset 4px 0 0 var(--ball); }
.match.me summary, .match.me .pairs { padding-left: 12px; padding-right: 12px; }
.match .side { font-weight: 500; }
.match .side.away { text-align: right; }
.match .side.win { font-weight: 600; }
.match .side.lose { color: var(--ink-2); }
.match .score {
  font: 800 30px/1 var(--display);
  font-variation-settings: "wdth" 80;
  min-width: 3.6em;
  text-align: center;
  letter-spacing: 0.04em;
}
.match .score.pending { color: var(--ink-2); font-size: 14px; font-weight: 500; letter-spacing: 0; font-variation-settings: "wdth" 100; }
.match .dots { display: flex; justify-content: center; gap: 4px; margin-top: 4px; }
.match .dots i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--ink); }
.match .dots i.w { background: var(--ink); }
.match:not(.played) summary { cursor: default; }

.pairs { padding: 0 0 12px; display: grid; gap: 6px; }
.pairs .when { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); text-align: center; }
.pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  font-size: 14px;
}
.pair .names { line-height: 1.3; }
.pair .names.away { text-align: right; }
.pair .names.win { font-weight: 600; }
.pair .names.lose { color: var(--ink-2); }
.pair .sets { display: flex; gap: 6px; }
.pair .set {
  font: 700 17px/1 var(--display);
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 2.6em;
  text-align: center;
  letter-spacing: 0.02em;
}
.pair .set.won { border-color: var(--court); background: var(--court-2); }
.pair .set.lost { border-color: var(--loss); color: var(--loss); }

/* Player bars */
.bar { position: relative; height: 6px; background: var(--paper-2); border-radius: 3px; overflow: hidden; min-width: 70px; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--court); }
td.rate, th.rate { width: 120px; text-align: right; }
td.rate { font-family: var(--display); font-size: 18px; }
td.rate .pct { display: block; }
td.rate .bar { margin-top: 4px; margin-left: auto; width: 70px; }

.rival { display: grid; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rival-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.rival-head strong { font: 700 22px/1 var(--display); }
.rival-head span { color: var(--ink-2); font-size: 14px; }
.rival p { margin: 0; font-size: 14px; color: var(--ink-2); }
.rival p b { color: var(--ink); font-weight: 600; }

.foot { padding-top: 32px; padding-bottom: 40px; }
.foot p { margin: 4px 0; }
code { font-size: 13px; background: var(--paper-2); padding: 1px 5px; border-radius: 3px; }

@media (prefers-reduced-motion: no-preference) {
  .match summary, .sections a { transition: background-color 120ms ease; }
}


/* Team picker in the masthead */
.team-pick { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; font-size: 14px; color: var(--court-2); }
.team-pick select {
  font: 500 15px var(--body);
  color: var(--paper);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--court-2);
  padding: 4px 0;
  max-width: 70vw;
}
.team-pick select:focus-visible { outline: 3px solid var(--ball); outline-offset: 2px; }
.team-pick option { color: var(--ink); }

.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.filter { font-size: 14px; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.filter input { accent-color: var(--court); width: 16px; height: 16px; }
td.sub { color: var(--ink-2); font-size: 13px; }
td.team small { display: block; color: var(--ink-2); font-size: 12px; font-weight: 400; }

/* Rounds as folds: the current one open */
.round > summary { list-style: none; cursor: pointer; }
.round > summary::-webkit-details-marker { display: none; }
.round > summary .round-head { margin-bottom: 0; padding: 8px 0; }
.round > summary .round-head h3::after { content: " +"; color: var(--court); }
.round[open] > summary .round-head h3::after { content: " –"; }
.round .round-body { padding-top: 4px; }
.match.me summary { background: var(--ball-soft); }

/* Plain text pages */
.masthead-league a { color: inherit; text-decoration: none; }
.prose { max-width: 640px; padding-bottom: 48px; }
.prose h2 { margin-top: 32px; font-size: 24px; }
.prose p { max-width: 65ch; margin: 10px 0; }

/* Filters */
.search {
  width: 100%;
  margin: 0 0 12px;
  padding: 10px 12px;
  font: 500 15px var(--body);
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
}
.search:focus { outline: none; border-color: var(--court); background: #fff; }
.filter select {
  font: 500 14px var(--body);
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 2px 0;
  max-width: 55vw;
}
