/* Bricolage Grotesque (SIL Open Font License), served from here so no visit reaches a third party. */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 75% 100%;
  font-display: swap;
  src: url("../fonts/bricolage-grotesque-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 75% 100%;
  font-display: swap;
  src: url("../fonts/bricolage-grotesque-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

: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;
  /* The league's four divisions, in the colours they are named after. Only ever shown on the masthead. */
  --division-roja: #ec7a6c;
  --division-blanca: #f1f4ee;
  --division-azul: #7db4e6;
  --division-verde: #6fd391;
  --display: "Bricolage Grotesque", "Helvetica Neue", sans-serif;
  --body: "Bricolage Grotesque", system-ui, sans-serif;
  --radius: 4px;
  /* Focus ring: dark on the light page, ball yellow wherever the surface is dark. */
  --focus: var(--court);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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(--focus); 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 { --focus: var(--ball); }
.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;
}
/* The summary sits below the selectors: its length changes with every group and team, and anything
   above them would push them around under the pointer. */
.masthead-summary { margin: 16px 0 0; font-size: 18px; color: var(--paper); max-width: 44ch; min-height: calc(2 * 1.45em); }
.masthead-team { min-height: 0.92em; }
/* Where a long group name wraps, every title keeps two lines, for the same reason. */
@media (max-width: 720px) { .masthead-team { min-height: calc(2 * 0.92em); } }

/* Reserve the room the data will take, so the first paint does not jump. */
#standings-table:empty { min-height: 420px; }
#rounds-list:empty, #players-table:empty { min-height: 60vh; }
.masthead-summary strong { color: var(--ball); font-weight: 600; }

/* Section nav */
#nav-sentinel { height: 1px; }
.sections {
  position: sticky; top: 0; z-index: 2;
  display: flex; gap: 4px;
  scrollbar-width: none;
  padding-top: 8px; padding-bottom: 8px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.sections.stuck { box-shadow: 0 8px 24px -16px rgba(20, 36, 30, 0.35); }

/* Loading another group: the page dims a touch instead of freezing */
body.loading main, body.loading .masthead-summary { opacity: 0.55; }
main, .masthead-summary { transition: opacity 160ms ease; }

/* View transitions: a quick crossfade, nothing more */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; }
.masthead { view-transition-name: masthead; }
::view-transition-old(masthead), ::view-transition-new(masthead) { animation-duration: 240ms; }
.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); }

.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; }
/* A search that finds nobody: the corner of the court seen from above, and the ball just past the line. */
.empty.out { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px 0 8px; text-align: center; }
.empty.out strong { color: var(--ink); }
.empty.out::before {
  content: "";
  width: 112px;
  height: 46px;
  background:
    radial-gradient(circle at 92px 38px, var(--ball) 0 5px, var(--court) 5px 6.2px, transparent 6.8px),
    linear-gradient(var(--ink-2), var(--ink-2)) 0 30px / 78px 2px no-repeat,
    linear-gradient(var(--ink-2), var(--ink-2)) 76px 0 / 2px 32px no-repeat,
    linear-gradient(var(--line), var(--line)) 38px 0 / 2px 30px no-repeat;
}
.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; }
/* A won-lost pair centred on its hyphen: each half has room for two figures. */
td.tally, th.tally { text-align: center; }
td.tally span { display: inline-block; min-width: 2ch; text-align: left; }
td.tally span:first-child { text-align: right; }
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.team { font-weight: 700; }
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; }
  /* Four tabs fit on one line when they share out the width instead of each keeping a fixed margin */
  .sections { flex-wrap: wrap; justify-content: space-between; gap: 0 8px; }
  .sections a { margin-right: 0; 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; }
/* Rounds with a date but no draw yet: quieter than the real ones, and nothing to unfold */
.planned { margin-bottom: 26px; }
.planned .round-head { margin-bottom: 0; padding: 8px 0; }
.planned h3 { color: var(--ink-2); }
.planned .note { margin-top: 4px; }

.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 { padding: 16px 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.1 var(--display); font-variation-settings: "wdth" 90; }
.rival-head span { font: 700 20px/1 var(--display); color: var(--ink-2); }
.rival p { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); }
.rival-pairs { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.rival-pairs li { display: flex; justify-content: space-between; gap: 12px; }
.rival-pairs .rec { font-family: var(--display); font-size: 16px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.foot { color: var(--ink-2); font-size: 14px; }
.note { margin: 10px 0 0; }


.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; }

/* Motion: short, tied to what the person just did, off when the system asks. */
@media (prefers-reduced-motion: no-preference) {
  :root { interpolate-size: allow-keywords; }
  .sections a { transition: border-color 160ms ease, color 160ms ease; }
  .match summary, .round > summary { transition: background-color 160ms ease; }
  .match.played summary:hover { background-color: var(--paper-2); }
  .match.me.played summary:hover { background-color: var(--ball-soft); }
  .tab.refresh { animation: rise 240ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
  details::details-content {
    height: 0;
    overflow: clip;
    transition: height 220ms cubic-bezier(0.2, 0.7, 0.2, 1), content-visibility 220ms allow-discrete;
  }
  details[open]::details-content { height: auto; }
  .pairs, .roster, .round-body { animation: fade 220ms ease-out both; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
  .bar i { transition: width 400ms cubic-bezier(0.2, 0.7, 0.2, 1); }
  .search, .team-pick select { transition: border-color 160ms ease, background-color 160ms ease; }
}


/* Team picker in the masthead */
/* Three selects of one kind; fixed widths so changing them never reflows the masthead */
.picks { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 18px; }
.team-row { display: inline-flex; align-items: center; gap: 6px; }
.team-pick { display: inline-flex; align-items: center; gap: 10px; 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;
  width: 240px;
  max-width: 62vw;
  text-overflow: ellipsis;
}
#group-select { width: 160px; }
@media (max-width: 560px) {
  .picks { flex-direction: column; gap: 10px; }
}
.team-pick select:focus-visible { outline: 3px solid var(--focus); 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; }
/* The title takes the free room, so the controls sit at the right edge and the last one never moves when another appears. */
.block-head h2 { margin-right: auto; }
.filter { font-size: 14px; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
/* Next to Grupo / División both controls sit on the same centre line, not on the title's baseline. */
.block-head:has(.scope) .filter { align-self: center; }

/* "Solo mi equipo": a checkbox of our own. Checking it fills the box with court green, the tick draws
   itself from left to right and a ripple leaves the box. Colours are pairs the contrast test checks. */
.filter input[type="checkbox"] {
  appearance: none;
  position: relative;
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1.5px solid var(--ink-2);
  border-radius: 6px;
  background: var(--paper);
  cursor: pointer;
}
.filter input[type="checkbox"]::before {
  content: "";
  position: absolute;
  inset: 2px;
  background: var(--paper);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3.2L13 4.8' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3.2L13 4.8' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  clip-path: inset(0 100% 0 0);
}
/* The ball that drops on the box when it is ticked; it only exists while its animation runs. */
.filter input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  border-radius: 999px;
  background: var(--ball);
  box-shadow: 0 0 0 1px var(--court);
  opacity: 0;
  pointer-events: none;
}
.filter input[type="checkbox"]:checked { background: var(--court); border-color: var(--court); }
.filter input[type="checkbox"]:checked::before { clip-path: inset(0 0 0 0); }
.filter input[type="checkbox"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.filter:has(input[type="checkbox"]) { cursor: pointer; user-select: none; }
.filter:has(input:checked) { color: var(--ink); }
@media (hover: hover) { .filter:hover input[type="checkbox"]:not(:checked) { border-color: var(--ink); } }
@media (prefers-reduced-motion: no-preference) {
  .filter input[type="checkbox"] { transition: background-color 160ms ease, border-color 160ms ease, transform 140ms ease; }
  .filter input[type="checkbox"]::before { transition: clip-path 120ms ease; }
  .filter:active input[type="checkbox"] { transform: scale(0.86); }
  /* Ticking it plays a point: the ball drops, bounces once on the box, which gives under it, and goes in.
     Only then does the box fill and the tick draw itself. Unticking is plain and immediate.
     Only right after a click (the box has focus), not when the page loads with it already ticked. */
  .filter input[type="checkbox"]:checked:focus { transition-delay: 400ms, 0ms, 0ms; animation: check-box 620ms ease-out; }
  .filter input[type="checkbox"]:checked:focus::before { transition: clip-path 240ms cubic-bezier(0.65, 0, 0.35, 1) 430ms; }
  .filter input[type="checkbox"]:checked:focus::after { animation: check-ball 520ms linear; }
  @keyframes check-ball {
    0% { transform: translateY(-26px); opacity: 0; animation-timing-function: cubic-bezier(0.5, 0, 1, 0.6); }
    12% { opacity: 1; }
    38% { transform: translateY(0) scale(1.2, 0.8); opacity: 1; animation-timing-function: cubic-bezier(0, 0.5, 0.5, 1); }
    60% { transform: translateY(-13px) scale(1); opacity: 1; animation-timing-function: cubic-bezier(0.5, 0, 1, 0.6); }
    82% { transform: translateY(6px) scale(1); opacity: 1; }
    100% { transform: translateY(15px) scale(0.3); opacity: 0; }
  }
  @keyframes check-box {
    0%, 22% { transform: none; }
    30% { transform: translateY(1.5px) scale(1.08, 0.86); }
    46% { transform: none; }
    72% { transform: scale(1.16); }
    100% { transform: none; }
  }
}
.filter.hint { color: var(--court); text-decoration: none; }
.filter.hint:hover { text-decoration: underline; }
/* A heading that orders the table by its column. The arrow says which way it runs. */
.sort { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.sort:hover { color: var(--ink); }
.sort:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
th[aria-sort] .sort { color: var(--ink); font-weight: 700; }
th[aria-sort="descending"] .sort::after { content: " ↓"; }
th[aria-sort="ascending"] .sort::after { content: " ↑"; }
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); }
.match.me .side { font-weight: 700; }

/* 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; }
.prose .lead { margin-top: 24px; font-size: 18px; }
.prose ul { max-width: 65ch; margin: 10px 0; padding-left: 1.2em; }
.prose li { margin: 6px 0; }
.prose table { width: auto; margin: 14px 0 6px; }
.prose th, .prose td { padding-right: 20px; white-space: nowrap; }
/* A heading reached from a link elsewhere should not land flush against the top edge */
.prose h2 { scroll-margin-top: 16px; }

/* 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 var(--ink-2);
  border-radius: var(--radius);
}
.search:focus { outline: none; border-color: var(--court); background: #fafcf8; }
.search::placeholder { color: var(--ink-2); opacity: 1; }
.filter select {
  font: 500 14px var(--body);
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink-2);
  padding: 2px 0;
  max-width: 55vw;
}

/* Teams */
.roster { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 2px; font-size: 14px; }
.roster li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-top: 1px solid var(--paper-2); }
.roster li.idle { color: var(--ink-2); }
.roster .rec { font-family: var(--display); font-size: 16px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.roster li.idle .rec { font-family: var(--body); font-size: 13px; }

/* Favourites: a star by the team, and a quiet line of names below */
.fav {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  color: var(--court-2);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.fav span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.fav[aria-pressed="true"] { color: var(--ball); }
.fav[aria-pressed="true"] svg { fill: currentColor; }
.fav:hover { background: rgba(201, 220, 211, 0.12); }
.favs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-top: 14px; font-size: 14px; color: var(--court-2); }
.favs a { color: var(--paper); text-decoration: none; border-bottom: 1px solid transparent; }
.favs a:hover { border-color: var(--court-2); }
.favs a.current { color: var(--ball); }
@media (prefers-reduced-motion: no-preference) { .fav, .favs a { transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease; } }

.match .venue { font-size: 12px; color: var(--ink-2); text-align: center; margin-top: 2px; }


/* Masculina / Femenina: a compact segmented switch that sits with the selects */
.segment {
  display: inline-flex;
  align-self: center;
  background: rgba(201, 220, 211, 0.12);
  border-radius: 999px;
  padding: 3px;
}
.segment button {
  font: 500 14px/1 var(--body);
  color: var(--court-2);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.segment button[aria-checked="true"] { background: var(--paper); color: var(--ink); font-weight: 600; }
.segment button:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
@media (max-width: 560px) { .picks .segment { align-self: flex-start; } }
@media (prefers-reduced-motion: no-preference) { .segment button { transition: background-color 160ms ease, color 160ms ease; } }

/* Where and when: the club opens in a map, the team's matches go to the phone's calendar */
a.map { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
a.map:hover { color: var(--court); text-decoration-style: solid; }
.cal { margin: 0 0 10px; font-size: 14px; }
.cal summary { width: fit-content; font-weight: 600; color: var(--court); cursor: pointer; list-style: none; }
.cal summary::-webkit-details-marker { display: none; }
.cal summary::after { content: " ▾"; }
.cal[open] summary::after { content: " ▴"; }
.cal ul { margin: 8px 0 0; padding: 0 0 0 12px; list-style: none; border-left: 2px solid var(--line); }
.cal li { margin: 6px 0; }
.cal li span { color: var(--ink-2); }
.cal a, .cal button { font-weight: 600; }
.cal button { font: inherit; font-weight: 600; color: var(--court); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.cal .note { margin-top: 6px; }

/* Sharing: a quiet button, in words, wherever there is something worth sending on. */
.share { font: inherit; font-size: 14px; font-weight: 600; color: var(--court); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.share:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.actions { margin: 14px 0 0; }
.pairs .share { justify-self: center; margin-top: 6px; font-size: 13px; }

/* About the data on screen when it is a saved copy: a quiet line, not an alarm. It says how old the
   data is while there is no connection, or offers newer data once it has arrived. */
.offline { margin: 14px 0 0; font-size: 14px; color: var(--ink-2); }
.offline button { font: inherit; font-weight: 600; color: var(--ink); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

/* League-wide search in the masthead: results unfold in place, under the field */
.finder { margin-top: 14px; max-width: 420px; }
.finder input {
  width: 100%;
  font: 500 15px var(--body);
  color: var(--paper);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--court-2);
  border-radius: 0;
  padding: 6px 0;
}
.finder input::placeholder { color: var(--court-2); opacity: 1; }
.finder input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.finder ul { list-style: none; margin: 6px 0 0; padding: 0; }
.finder li a { display: block; padding: 8px 0; color: var(--paper); text-decoration: none; border-bottom: 1px solid rgba(201, 220, 211, 0.18); }
.finder li a:hover strong, .finder li a:focus-visible strong { color: var(--ball); }
.finder li strong { display: block; font-weight: 600; }
.finder li small { display: block; color: var(--court-2); font-size: 13px; }
.finder-note { padding: 8px 0; color: var(--court-2); font-size: 14px; }

/* Evolution: every team's path in grey, one of them told apart at a time */
.evolution-head { margin: 36px 0 10px; }
.evolution-chart { display: block; max-width: 100%; height: auto; overflow: visible; font-family: var(--body); }
.evolution-chart .grid { stroke: var(--line); stroke-width: 1; }
.evolution-chart .tick { fill: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.evolution-chart .series { cursor: pointer; outline: none; }
.evolution-chart .trace { fill: none; stroke: var(--ink-2); stroke-opacity: 0.38; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.evolution-chart .hit { fill: none; stroke: transparent; stroke-width: 18; pointer-events: stroke; }
.evolution-chart .name { fill: var(--ink-2); font-size: 13px; }
.evolution-chart .bead, .evolution-chart .bead-n { display: none; }
.evolution-chart .bead { fill: var(--court); stroke: var(--paper); stroke-width: 2; }
.evolution-chart .bead-n { fill: var(--paper); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; }
/* The latest round carries the ball's yellow as a rim; the rounds behind it keep the plain bead. */
.evolution-chart .bead.now { stroke: var(--ball); }
/* The play-off line: the net again, but faint, so it sits behind the paths like the grid does. */
.evolution-chart .net { stroke: var(--ink-2); stroke-opacity: 0.55; stroke-width: 1; stroke-dasharray: 3 4; }
/* In focus: the chosen team, unless another one is hovered, focused or tapped */
.evolution-chart:not(.has-hot) .series.me .trace, .evolution-chart .series.hot .trace { stroke: var(--court); stroke-opacity: 1; stroke-width: 3; }
.evolution-chart:not(.has-hot) .series.me .name, .evolution-chart .series.hot .name { fill: var(--ink); font-weight: 700; }
.evolution-chart:not(.has-hot) .series.me :is(.bead, .bead-n), .evolution-chart .series.hot :is(.bead, .bead-n) { display: inline; }
.evolution-chart .series:focus-visible .name { text-decoration: underline; }
.evolution-chart.has-hot .series:not(.hot) .trace { stroke-opacity: 0.2; }
/* Phones: the other teams step further back and the names shrink a size */
.evolution-chart.narrow .trace { stroke-width: 1.2; stroke-opacity: 0.28; }
.evolution-chart.narrow .name { font-size: 12px; }
.evolution-chart.narrow .tick { font-size: 11px; }

/* Explanations wait folded until someone wants them */
.howto { margin-top: 12px; color: var(--ink-2); font-size: 14px; }
.howto summary { width: fit-content; cursor: pointer; }
.howto .note { margin-top: 6px; }

/* Player names are links to their sheet, quiet until pointed at */
a.player { color: inherit; text-decoration: none; }
a.player:hover, a.player:focus-visible { color: var(--court); text-decoration: underline; text-underline-offset: 3px; }

/* A player's sheet */
.back { display: inline-block; margin-bottom: 10px; font-size: 14px; font-weight: 600; text-decoration: none; }
.back:hover { text-decoration: underline; }
.sheet-team { margin: -8px 0 0; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0 10px; }
.stat { padding: 10px 0; border-top: 2px solid var(--ink); }
.stat strong { display: block; font: 800 28px/1 var(--display); font-variation-settings: "wdth" 85; font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 4px; font-size: 13px; color: var(--ink-2); }
.dots.streak { display: flex; gap: 5px; margin: 0 0 6px; }
.dots.streak i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink); }
.dots.streak i.w { background: var(--ink); }
.sheet-matches { list-style: none; margin: 0; padding: 0; }
.sheet-match { padding: 12px 0; border-bottom: 1px solid var(--line); }
.sheet-match.won { box-shadow: inset 4px 0 0 var(--court); padding-left: 12px; }
.sheet-match.lost { box-shadow: inset 4px 0 0 var(--line); padding-left: 12px; }
.sheet-match .round-head { margin-bottom: 2px; }
.sheet-who { margin: 0 0 8px; font-size: 14px; }
.sheet-who small { display: block; color: var(--ink-2); font-size: 13px; }
.sheet-match .sets { display: flex; gap: 6px; }
.sheet-match .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; }
.sheet-match .set.won { border-color: var(--court); background: var(--court-2); }
.sheet-match .set.lost { border-color: var(--loss); color: var(--loss); }
@media (max-width: 560px) { .stat strong { font-size: 22px; } }

/* Dark mode. theme.js sets data-theme on <html> from the visitor's choice, or from the system when
   they have not made one. The masthead is already a court at night, so it keeps its own colours
   and only the page under it changes. */
:root { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  /* A court at dusk, not a black screen: greens with colour in them, and text tinted the same way. */
  --paper: #13281f;
  --paper-2: #1b382b;
  --ink: #d3e4d9;
  --ink-2: #8db5a1;
  --court: #58d6a4;
  --court-2: #1c5a41;
  --ball-soft: #2a3d0c;
  --loss: #f8998a;
  --line: #2a4b3b;
  --focus: var(--ball);
  --loss: #de8a80;
  --line: #34443d;
}
:root[data-theme="dark"] .masthead {
  color-scheme: light;
  --paper: #f1f4ee;
  --paper-2: #e6ebe3;
  --ink: #14241e;
  --ink-2: #4d5e57;
  --court: #1e5a47;
  --court-2: #c9dcd3;
  --ball-soft: #eef7c2;
  --line: #cfd8d1;
  border-bottom: 1px solid #22332c;
}
:root[data-theme="dark"] .search:focus { background: var(--paper-2); }

/* Theme choice, tucked in the footer */
.theme { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 4px; }
.theme button { font: inherit; color: var(--ink-2); background: none; border: 0; border-radius: var(--radius); padding: 2px 6px; cursor: pointer; }
.theme button:hover { color: var(--ink); }
.theme button[aria-checked="true"] { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* Sun or moon in the corner of the masthead, on screens with room for it */
.theme-toggle {
  position: absolute; top: -8px; right: 16px; z-index: 1;
  display: none; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  color: var(--court-2);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ball); background: rgba(201, 220, 211, 0.12); }
.theme-toggle svg { width: 20px; height: 20px; overflow: visible; }
.theme-toggle :is(.orb, .bite, .rays) { transform-origin: 12px 12px; }
.theme-toggle .orb { fill: currentColor; }
.theme-toggle .rays { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
/* Light page: a moon (the disc grown, the bite in, the rays folded). Dark page: a sun. */
.theme-toggle .orb { transform: scale(1.8); }
.theme-toggle .rays { transform: rotate(-90deg) scale(0.2); opacity: 0; }
:root[data-theme="dark"] .theme-toggle .orb { transform: none; }
:root[data-theme="dark"] .theme-toggle .bite { transform: translate(9px, -9px); }
:root[data-theme="dark"] .theme-toggle .rays { transform: none; opacity: 1; }
@media (min-width: 561px) { .theme-toggle { display: inline-flex; } }
@media (prefers-reduced-motion: no-preference) { .theme-toggle { transition: background-color 160ms ease, color 160ms ease; } }

/* A team's sheet shares the player sheet's pieces */
.rival-pairs .when { color: var(--ink-2); font-size: 13px; text-align: right; }
.sheet-results .match:first-child { border-top: 1px solid var(--line); }

/* Sheets on a phone: what is left to play stacks, and the win-rate column gives the names their room */
h2[tabindex="-1"]:focus { outline: none; }
@media (max-width: 560px) {
  .rival-pairs.pending li { flex-direction: column; gap: 0; padding: 4px 0; }
  .rival-pairs.pending .when { text-align: left; }
  td.rate, th.rate { width: 64px; }
  td.rate .bar { width: 48px; min-width: 0; }
}

/* Grupo / División: the masthead's switch, in the page's own colours */
.segment.on-page { background: var(--paper-2); }
.segment.on-page button { color: var(--ink-2); padding: 5px 12px; }
.segment.on-page button[aria-checked="true"] { background: var(--ink); color: var(--paper); }

/* The play-off line: everyone above it goes through */
/* Drawn as the net seen from above: a dashed line with a post at each end. Court green on the light
   page, where the ball's yellow would not read; yellow on the dark one. */
tr.cut td { --net: var(--court); border-bottom: 2px dashed var(--net); }
:root[data-theme="dark"] tr.cut td { --net: var(--ball); }
tr.cut td:first-child, tr.cut td:last-child { position: relative; }
tr.cut td:first-child::after, tr.cut td:last-child::after {
  content: "";
  position: absolute;
  bottom: -4px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--net);
}
tr.cut td:first-child::after { left: -3px; }
tr.cut td:last-child::after { right: -3px; }
.note.playoff { margin-top: 12px; }
.note.outlook { margin-top: 6px; }
.note.outlook strong { color: var(--ink); }
.note.playoff strong { color: var(--ink); }
.note.playoff small { white-space: nowrap; }
/* Phones: the title gets its own line, so its width never pushes the controls around; below it,
   "solo mi equipo" on the left and Grupo / División always at the right edge */
@media (max-width: 560px) {
  .block-head:has(.scope) h2 { flex-basis: 100%; }
  .block-head:has(.scope) .filter { order: 2; }
  .block-head:has(.scope) .scope { order: 3; margin-left: auto; }
  .block-head:has(.scope) .hint { order: 4; flex-basis: 100%; }
}

/* Jugadores / Parejas: the title itself is the switch, the other word waits beside it in a quieter colour */
.title-switch .kind { display: inline-flex; align-items: baseline; gap: 0.45em; }
.title-switch button { font: inherit; font-variation-settings: inherit; letter-spacing: inherit; color: var(--ink-2); background: none; border: 0; padding: 0; cursor: pointer; }
.title-switch button:hover { color: var(--ink); }
.title-switch button[aria-checked="true"] { color: var(--ink); }
.title-switch button[aria-checked="false"] { font-size: 0.62em; }
.title-switch button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) { .title-switch button { transition: color 160ms ease, font-size 200ms ease; } }

/* In the standings each team name opens its sheet: an arrow slides in on hover, and on touch screens it is always there */
#standings-table .tail { white-space: nowrap; }
#standings-table td.team .tail::after { content: "›"; display: inline-block; margin-left: 0.35em; color: var(--court); font-weight: 700; opacity: 0; transform: translateX(-4px); }
#standings-table tr:hover td.team .tail::after, #standings-table td.team a.player:focus-visible .tail::after { opacity: 1; transform: none; }
@media (hover: none) { #standings-table td.team .tail::after { opacity: 0.7; transform: none; } }
@media (prefers-reduced-motion: no-preference) { #standings-table td.team .tail::after { transition: opacity 160ms ease, transform 160ms ease; } }

/* The first screen: nobody has picked a group yet (js/welcome.js says so before the first paint). The
   masthead becomes a short cover for the site: what it is, what is inside and, last, the visitor's team,
   by searching for it or by picking a division. Picking anything leaves it. */
.welcome-only { display: none; }
html.welcome .welcome-only { display: block; }
html.welcome :is(.picks, .masthead-summary, #nav-sentinel, .sections, main) { display: none; }
html.welcome .masthead { padding-bottom: 44px; }
html.welcome .masthead-team { min-height: 0.92em; }
/* The hairlines between the lines of its lists, and the edge of its round buttons: the masthead's pale green, thinned. */
.masthead { --rule: rgba(201, 220, 211, 0.22); --chip-edge: color-mix(in srgb, var(--court-2) 60%, transparent); }

.welcome-lead { margin: 18px 0 0; max-width: 40ch; font-size: 18px; }
.cover-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin: 28px 0 0; }
/* The one filled button of the site, in the colour of the ball. */
.cta { display: inline-flex; align-items: center; height: 50px; padding: 0 24px; color: var(--ink); background: var(--ball); border-radius: 999px; font-size: 17px; font-weight: 700; text-decoration: none; }
.cta:hover { background: var(--paper); }
.cover-actions a:not(.cta) { color: var(--court-2); text-underline-offset: 3px; }
.cover-actions a:not(.cta):hover { color: var(--paper); }
.league-facts { min-height: 1.45em; margin: 22px 0 0; max-width: 62ch; font-size: 14px; color: var(--court-2); }

.cover h2 { margin: 64px 0 16px; scroll-margin-top: 20px; }
/* What is inside, a section of the site to a line: its name, and what it holds beside it. */
.inside-list { max-width: 520px; margin: 0; border-top: 1px solid var(--rule); }
.inside-list div { display: grid; grid-template-columns: 156px 1fr; align-items: baseline; gap: 4px 20px; padding: 16px 0 14px; border-bottom: 1px solid var(--rule); }
.inside-list dt { font: 800 24px/1 var(--display); font-variation-settings: "wdth" 85; }
.inside-list dd { margin: 0; font-size: 15px; color: var(--court-2); }
@media (max-width: 560px) {
  .cover h2 { margin-top: 52px; }
  .inside-list div { grid-template-columns: 1fr; padding: 12px 0 11px; }
  .inside-list dt { font-size: 22px; }
}
.inside-note { max-width: 62ch; margin: 14px 0 0; font-size: 14px; color: var(--court-2); }

html.welcome .finder { margin-top: 0; max-width: 520px; }
html.welcome .finder input { font-size: 21px; font-weight: 600; padding: 10px 0; border-bottom: 2px solid var(--paper); }
html.welcome .finder input::placeholder { font-weight: 500; }

.directory { margin-top: 36px; }
.directory-title { margin: 0 0 12px; font-size: 15px; color: var(--court-2); scroll-margin-top: 20px; }

/* The league as an index: a division to a line, its name in its colour, large but under the title.
   A line opens to show its groups; the one that is open ends in the ball, like the title above it. */
.division-index { max-width: 520px; border-top: 1px solid var(--rule); transition: opacity 160ms ease; }
/* A group on its way, or one that did not arrive: the index dims, or a line above it says so. */
body.loading .division-index { opacity: 0.55; }
.cover-error { max-width: 520px; margin: 0 0 12px; font-size: 15px; }
.division { border-bottom: 1px solid var(--rule); }
.division summary { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 14px 0 11px; cursor: pointer; list-style: none; }
.division summary::-webkit-details-marker { display: none; }
/* A division goes by its colour in the league, so its name is written in it. */
[data-division="roja"] { --division: var(--division-roja); }
[data-division="blanca"] { --division: var(--division-blanca); }
[data-division="azul"] { --division: var(--division-azul); }
[data-division="verde"] { --division: var(--division-verde); }
.division-word {
  font: 800 clamp(38px, 10.5vw, 52px)/0.92 var(--display);
  font-variation-settings: "wdth" 85, "opsz" 96;
  letter-spacing: -0.01em;
  color: var(--division, var(--paper));
}
.division[open] .division-word::after {
  content: "";
  display: inline-block;
  width: 0.26em; height: 0.26em;
  margin-left: 0.14em;
  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;
}
.division-count { font-size: 14px; color: var(--court-2); white-space: nowrap; }
/* The sign says the line opens; a screen reader already hears that from the line itself, so it is not read out. */
.division-count::after { content: " +"; content: " +" / ""; color: var(--ball); font-weight: 600; }
.division[open] .division-count::after { content: " –"; content: " –" / ""; }
.division-groups { padding: 2px 0 18px; }
.category { display: flex; align-items: center; gap: 14px; margin: 0; padding: 6px 0; }
.category-name { flex: none; width: 82px; font-size: 14px; color: var(--court-2); }
.group-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.group-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px;
  color: var(--paper);
  font-weight: 600; font-size: 15px;
  text-decoration: none;
  border: 1px solid var(--chip-edge);
  border-radius: 999px;
}
.group-chip.only { padding: 0 16px; font-weight: 500; font-size: 14px; }
.group-chip:hover, .group-chip:active { color: var(--ink); background: var(--ball); border-color: var(--ball); }
@media (hover: hover) { .division summary:hover .division-count { color: var(--paper); } }
@media (prefers-reduced-motion: no-preference) { .cta, .group-chip { transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease; } }

/* The court drawn in the masthead keeps the cover company: beside its opening lines where there is
   room, and closing the screen, under everything else, on a phone. */
@media (min-width: 720px) { html.welcome .court { top: 64px; right: -24px; bottom: auto; width: 340px; } }
@media (min-width: 1100px) { html.welcome .court { right: -170px; width: 460px; } }
@media (max-width: 719px) {
  html.welcome .directory { padding-bottom: 112px; }
  html.welcome .court { --court-ink: 0.34; right: -8vw; width: 64vw; }
}
