/* Matchday: a night-game broadcast look. Floodlit dark pitch, chalk text, hi-vis accent,
   condensed scoreboard type, and one color per sport. */

@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-style: normal; font-display: swap; src: url(/fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-style: italic; font-display: swap; src: url(/fonts/barlow-condensed-latin-800-italic.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-style: normal; font-display: swap; src: url(/fonts/barlow-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-style: normal; font-display: swap; src: url(/fonts/barlow-latin-600-normal.woff2) format("woff2"); }

:root {
  --bg: #f1eee4;
  --bg-glow: rgba(120, 150, 0, .10);
  --surface: #fbf9f2;
  --surface-2: #e9e5d8;
  --line: #d9d4c4;
  --text: #121512;
  --muted: #6a6f66;
  --accent: #c8f31d;
  --accent-text: #4a6e00;
  --on-accent: #0b0e0c;
  --live: #e0261b;
  --football: #138a4a;
  --f1: #d81e10;
  --lol: #0a87a3;
  --chess: #8a6420;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090c0a;
    --bg-glow: rgba(200, 243, 29, .07);
    --surface: #121714;
    --surface-2: #1a211c;
    --line: #253029;
    --text: #edf2e8;
    --muted: #87948b;
    --accent-text: #c8f31d;
    --live: #ff4a3d;
    --football: #3ddc84;
    --f1: #ff3b30;
    --lol: #22c8ea;
    --chess: #e8cf94;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 16px/1.4 var(--body);
  background:
    radial-gradient(120% 60% at 50% -10%, var(--bg-glow), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

[hidden] { display: none !important; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .6; cursor: default; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

.muted { color: var(--muted); margin: 0; font-size: 14px; }
.error { color: var(--live); }

/* Each sport sets --sport for whatever sits inside it. */
[data-sport="football"] { --sport: var(--football); }
[data-sport="f1"] { --sport: var(--f1); }
[data-sport="lol"] { --sport: var(--lol); }
[data-sport="chess"] { --sport: var(--chess); }

.icon { width: 1em; height: 1em; flex: none; fill: currentColor; }

/* Team and league logos. Football crests sit on the page as they are; LoL logos are made for
   dark broadcast backgrounds (many are white), so they get a dark tile in both themes. */
.logo {
  --size: 20px;
  width: var(--size);
  height: var(--size);
  flex: none;
  object-fit: contain;
}
[data-sport="lol"] img.logo { padding: 2px; border-radius: 3px; background: #10161a; }
.logo.badge {
  display: inline-grid;
  place-items: center;
  border-radius: 3px;
  background: color-mix(in srgb, var(--sport, var(--muted)) 22%, var(--surface-2));
  color: var(--text);
  font: italic 800 calc(var(--size) * .42)/1 var(--display);
  letter-spacing: 0;
  text-transform: uppercase;
}
.logo.blank { border: 1px dashed var(--line); border-radius: 3px; }

/* ---- header ---------------------------------------------------------------------------- */

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

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px 20px;
  flex-wrap: wrap;
  padding-top: max(18px, env(safe-area-inset-top));
  padding-bottom: 14px;
}

.wordmark {
  margin: 0;
  font: italic 800 34px/0.9 var(--display);
  text-transform: uppercase;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wordmark .slash {
  width: 14px;
  height: 30px;
  background: var(--accent);
  transform: skewX(-18deg);
  flex: none;
}
.wordmark em { font-style: inherit; color: var(--accent-text); }

.title-row { display: flex; align-items: center; gap: 10px; }
.refresh {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.refresh:hover { color: var(--accent-text); border-color: currentColor; }
.refresh svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.refresh:disabled { cursor: progress; color: var(--accent-text); }
.refresh:disabled svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tz {
  margin: 6px 0 0;
  font: 600 13px/1 var(--display);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Broadcast-style slanted tabs. */
.tabs { display: flex; gap: 6px; }
.tabs button {
  border: 0;
  background: var(--surface-2);
  padding: 9px 20px 8px;
  font: italic 800 17px/1 var(--display);
  text-transform: uppercase;
  letter-spacing: .03em;
  transform: skewX(-14deg);
  border-radius: 3px;
  color: var(--muted);
}
.tabs button > span { display: inline-block; transform: skewX(14deg); }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }

/* ---- sport filter ------------------------------------------------------------------------ */

.filter-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 16px;
  margin: 0 -16px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 3px;
  padding: 6px 12px 5px;
  font: 600 15px/1 var(--display);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  transform: skewX(-12deg);
}
.chip > * { transform: skewX(12deg); }
.chip .icon { color: var(--sport, var(--accent-text)); font-size: 14px; }
.chip .count { font-size: 12px; opacity: .8; }
.chip[aria-pressed="true"] { color: var(--text); border-color: var(--sport, var(--accent)); box-shadow: inset 0 -3px 0 var(--sport, var(--accent)); }

/* ---- upcoming ---------------------------------------------------------------------------- */

#events { padding-bottom: 8px; }

/* On phones: a sticky date bar per day. On wide screens: a big date in a left column. */
.day { padding-top: 6px; }
.day-head {
  position: sticky;
  top: 51px;
  z-index: 2;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 14px -16px 8px;
  padding: 8px 16px 7px;
  background: var(--bg);
  font-family: var(--display);
  text-transform: uppercase;
}
.day-head .name { font: italic 800 24px/1 var(--display); letter-spacing: -.005em; }
.day-head .date { font-weight: 600; font-size: 15px; letter-spacing: .08em; color: var(--muted); }
.day-head .num, .day-head .mon { display: none; }
.day-head .count {
  margin-left: auto;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .08em;
  color: var(--muted);
}
.day.today .day-head .name { color: var(--accent-text); }

.blocks { display: grid; gap: 10px; }

/* A competition block: header strip, then one row per event. */
.comp {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.comp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 7px 10px;
  border-left: 4px solid var(--sport);
  background: linear-gradient(90deg, color-mix(in srgb, var(--sport) 16%, transparent), transparent 75%);
  flex-wrap: wrap;
  font-family: var(--display);
  text-transform: uppercase;
}
.comp-head .icon { color: var(--sport); font-size: 16px; }
.comp-head .logo { --size: 20px; margin: -2px 0; }
.comp-head .name { font-weight: 600; font-size: 16px; letter-spacing: .04em; min-width: 0; overflow-wrap: anywhere; }
.comp-head .sub { margin-left: auto; text-align: right; font-weight: 600; font-size: 13px; letter-spacing: .06em; color: var(--muted); }

.row {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}
.comp-head + .row { border-top: 0; }
.row.past { opacity: .5; }

.row .time {
  font: 600 22px/1 var(--display);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.row .time .tbc { display: block; margin-top: 4px; font-size: 11px; letter-spacing: .08em; color: var(--muted); }

.row .what { min-width: 0; }
.row .title { font-weight: 600; overflow-wrap: anywhere; }
.row .meta { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }

/* Head-to-head matches read like a scoreboard: one side per line. */
.teams { display: grid; gap: 4px; }
.team {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 600 18px/1.15 var(--display);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.team-name { min-width: 0; overflow-wrap: anywhere; }
.team.tbd { color: var(--muted); }
.team.mine::after {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-left: -2px;
  background: var(--accent-text);
  transform: rotate(45deg);
}

/* Results: the score sits at the end of each side's line, like a scoreboard. */
.team .score {
  order: 2;
  margin-left: auto;
  padding-left: 12px;
  font: italic 800 22px/1 var(--display);
  font-variant-numeric: tabular-nums;
}
.team.lost { color: var(--muted); }
.team.won .score { color: var(--accent-text); }

.lines { margin: 6px 0 0; padding: 0; list-style: none; font-size: 14px; }
.lines li { padding: 1px 0; overflow-wrap: anywhere; }

/* F1: a driver's headshot (or code) on a disc of their team colour. */
.driver-mark { --team: var(--sport, var(--muted)); display: inline-grid; flex: none; border-radius: 50%; overflow: hidden; background: color-mix(in srgb, var(--team) 35%, var(--surface-2)); box-shadow: inset 0 0 0 2px var(--team); }
.driver-mark .logo { --size: 26px; object-fit: cover; object-position: top; }
.driver-mark .logo.badge { --sport: var(--team); background: none; border-radius: 0; }
.standings .team-name small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }

/* A session's full classification, folded under its podium. */
.classification { grid-column: 1 / -1; margin-top: -4px; font-size: 14px; }
.classification summary { padding-left: 74px; }
.classification summary { cursor: pointer; color: var(--accent-text); font: 600 13px/1.6 var(--display); letter-spacing: .08em; text-transform: uppercase; }
.classification .standings td { padding: 5px 4px; }
.classification .standings .pos { width: 28px; padding-left: 0; }
.classification .detail { white-space: nowrap; color: var(--muted); font-size: 13px; }
.classification .pts { padding-right: 0; font-size: 15px; }
.classification tr.out .team-name { color: var(--muted); }

.f1-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }

.session {
  font: 600 18px/1.15 var(--display);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.session.headline { color: var(--sport); }

.row a {
  font: 600 13px/1 var(--display);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 7px 10px 6px;
  white-space: nowrap;
}
.row a:hover { border-color: var(--sport); }

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  padding: 3px 6px 2px;
  background: var(--live);
  color: #fff;
  border-radius: 2px;
  font: 600 11px/1 var(--display);
  letter-spacing: .12em;
}
.live-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.row.live a { background: var(--live); border-color: var(--live); color: #fff; }

/* "On now" panel above the days. */
.on-now { margin-top: 14px; }
.on-now .day-head { position: static; }
.on-now .day-head .name { color: var(--live); }
.on-now .comp { border-color: color-mix(in srgb, var(--live) 45%, var(--line)); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 56px 16px;
  font: 600 18px/1.4 var(--display);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ---- standings --------------------------------------------------------------------------- */

#standings { padding: 14px 16px 8px; }
.chip .logo { --size: 16px; margin: -2px 0; }

.table-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 12px; }
.table-head .logo { --size: 28px; }
.table-head h2 { margin: 0; font: italic 800 26px/1 var(--display); text-transform: uppercase; letter-spacing: -.005em; }
.table-head .sub { margin-left: auto; font: 600 13px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.standings { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.standings th {
  padding: 8px 6px 6px;
  font: 600 12px/1 var(--display);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
  border-bottom: 1px solid var(--line);
}
.standings abbr { text-decoration: none; }
.standings td { padding: 7px 6px; text-align: right; border-top: 1px solid var(--line); }
.standings tbody tr:first-child td { border-top: 0; }
.standings .pos { width: 34px; padding-left: 12px; text-align: left; color: var(--muted); font: 600 15px/1 var(--display); }
.standings .club { text-align: left; width: 100%; }
.standings .team { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.standings .pts { padding-right: 12px; font: 800 17px/1 var(--display); }
.standings th.pts { font: 600 12px/1 var(--display); }
.standings tr.mine td { background: color-mix(in srgb, var(--sport) 12%, transparent); }
.standings tr.mine .pos { box-shadow: inset 4px 0 0 var(--sport); color: var(--text); }
.standings .form { white-space: nowrap; }
.standings .form span {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-left: 2px;
  border-radius: 2px;
  font: 600 11px/1 var(--display);
  color: #fff;
  background: var(--muted);
}
.standings .form .f-w { background: var(--football); color: var(--on-accent); }
.standings .form .f-l { background: var(--live); }
.standings .wide { display: none; }

/* Football tables side by side on wide screens; form is left out so two fit across. */
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 24px 20px; align-items: start; }
.table-grid .table-head { margin-bottom: 8px; }
.table-grid .table-head h3 { margin: 0; font: italic 800 20px/1 var(--display); text-transform: uppercase; }
.table-grid .table-head .logo { --size: 22px; }
.table-grid .table-head .sub { font-size: 12px; }
.table-grid .standings td { padding: 6px 5px; }
.table-grid .standings .form { display: none; }
.standings .note { margin-left: auto; padding: 2px 6px; border-radius: 2px; font: 600 11px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; }
.standings .note.qualified { border: 1px solid var(--sport); background: color-mix(in srgb, var(--sport) 18%, transparent); color: var(--text); }
.standings .note.eliminated { border: 1px solid var(--line); color: var(--muted); }
.standings tr.out .team-name { color: var(--muted); }
.round-head {
  padding: 10px 16px 6px;
  border-top: 1px solid var(--line);
  font: 600 13px/1 var(--display);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.comp-head + .round-head, summary + .round-head { border-top: 0; }
details.comp > summary { cursor: pointer; list-style: none; }
details.comp > summary::-webkit-details-marker { display: none; }
details.comp > summary .sub::after { content: " ▸"; }
details.comp[open] > summary .sub::after { content: " ▾"; }
details.comp:not([open]) > summary { border-bottom: 0; }

/* Knockout bracket: one column per round, pairs joined by a line into the next round. */
.bracket {
  --gap: 16px;
  display: grid;
  grid-auto-flow: column;
  /* Narrow enough that quarters, semis and final all fit on a phone; wider screens get roomier. */
  grid-auto-columns: minmax(88px, 1fr);
  gap: var(--gap);
  padding: 12px 14px 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
/* Diagrams with drawn lines: the svg sits behind the boxes. */
.flow {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(118px, 1fr);
  gap: 22px;
  padding: 12px 14px 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
.flow > .lines { position: absolute; top: 0; left: 0; pointer-events: none; }
.flow > .lines path { fill: none; stroke: var(--line); stroke-width: 1.5; }
.flow .b-col { gap: 12px; }
.flow .b-round { min-width: 0; }
.flow .b-match, .s-box { position: relative; z-index: 1; }
/* Six rounds don't fit a phone: fixed-width columns that scroll sideways. */
.flow.swiss { grid-auto-columns: 150px; }
.s-box { padding: 5px 6px 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; }
.s-head { display: flex; justify-content: space-between; margin-bottom: 3px; font: 800 14px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.s-box.qualified { border-color: var(--sport); }
.s-box.qualified .s-head { color: var(--sport); }
.s-box.eliminated { border-style: dashed; }
.s-box.eliminated .b-team { color: var(--muted); }
.s-match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 3px; padding: 3px 0; border-top: 1px solid var(--line); font: 600 13px/1.2 var(--display); text-transform: uppercase; }
.s-head + .s-match { border-top: 0; }
.s-match.live { color: var(--live); }
.s-side { display: flex; align-items: center; gap: 4px; min-width: 0; }
.s-side.right { flex-direction: row-reverse; }
.s-side .logo { --size: 14px; flex: none; }
.s-side.lost, .s-side.tbd { color: var(--muted); }
.s-side.mine .b-name { color: var(--sport); }
.s-score { font-variant-numeric: tabular-nums; color: var(--muted); }
@media (min-width: 640px) {
  .flow { gap: 32px; grid-auto-columns: minmax(150px, 1fr); }
  .flow.swiss { gap: 14px; grid-auto-columns: minmax(150px, 1fr); }
}
.b-round { display: flex; flex-direction: column; min-width: 0; }
.b-title { margin-bottom: 8px; font: 600 13px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.b-col { flex: 1; display: flex; flex-direction: column; justify-content: space-around; }
.b-pair { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 12px; padding: 6px 0; }
/* The bracket line: from the middle of the pair's top match to the middle of its bottom one, then out to the next round. */
.b-pair:not(.final)::after {
  content: "";
  position: absolute;
  top: 25%;
  bottom: 25%;
  right: calc(var(--gap) / -2);
  width: calc(var(--gap) / 2);
  border: 1.5px solid var(--line);
  border-left: 0;
  border-radius: 0 4px 4px 0;
}
.b-pair:not(.final)::before {
  content: "";
  position: absolute;
  top: 50%;
  right: calc(var(--gap) / -2 - var(--gap) / 2);
  width: calc(var(--gap) / 2);
  border-top: 1.5px solid var(--line);
}
.b-match {
  position: relative;
  padding: 5px 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.b-match.live { border-color: var(--live); }
.b-pair.final .b-match { border-color: var(--sport); box-shadow: 0 0 0 1px var(--sport); }
.b-when { margin-bottom: 4px; font: 600 11px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.b-team { display: flex; align-items: center; gap: 5px; padding: 2px 0; font: 600 15px/1.2 var(--display); text-transform: uppercase; }
.b-team .logo { --size: 16px; flex: none; }
@media (min-width: 640px) {
  .bracket { --gap: 28px; grid-auto-columns: minmax(150px, 1fr); }
  .b-match { padding: 6px 8px; }
  .b-team .logo { --size: 18px; }
}
.b-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-score { font: 800 16px/1 var(--display); font-variant-numeric: tabular-nums; }
.b-team.tbd { color: var(--muted); }
.b-team.lost { color: var(--muted); }
.b-team.won .b-score { color: var(--accent-text); }
.b-team.mine .b-name { color: var(--sport); }

/* ---- following --------------------------------------------------------------------------- */

#follow-sections { display: grid; gap: 12px; padding-top: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px;
  border-left: 4px solid var(--sport);
  background: linear-gradient(90deg, color-mix(in srgb, var(--sport) 18%, transparent), transparent 80%);
}
.card-head .icon { color: var(--sport); font-size: 20px; }
.card-head h2 { margin: 0; font: italic 800 22px/1 var(--display); text-transform: uppercase; }
.card-head .n { margin-left: auto; font: 600 13px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.card-body { padding: 10px 14px 14px; }
.card .hint { margin: 0 0 10px; }

.followed { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.followed button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--sport) 50%, var(--line));
  background: color-mix(in srgb, var(--sport) 12%, var(--surface));
  border-radius: 3px;
  padding: 5px 10px 4px;
  font: 600 15px/1.1 var(--display);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.followed .logo { --size: 18px; margin: -2px 0; }
.followed button::after { content: "×"; color: var(--muted); font-size: 17px; line-height: .8; }
.followed button:hover::after { color: var(--live); }

.toggle { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--sport); }

input[type="search"], input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
}
input[type="search"]:focus, input[type="password"]:focus { outline: none; border-color: var(--sport, var(--accent-text)); }

.results { list-style: none; margin: 8px 0 0; padding: 0; max-height: 300px; overflow-y: auto; }
.results li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line);
}
.results li:last-child { border-bottom: 0; }
.results .logo { --size: 24px; }
.results .name { flex: 1; min-width: 0; font-weight: 600; }
.results .name small { display: block; color: var(--muted); font-weight: 400; }
.results .kind { font: 600 12px/1 var(--display); letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.results button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 3px;
  padding: 6px 10px 5px;
  font: 600 13px/1 var(--display);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.results button.on { background: var(--sport); border-color: var(--sport); color: var(--surface); }

main { padding-bottom: max(40px, env(safe-area-inset-bottom)); }

/* ---- profile sheet ----------------------------------------------------------------------- */

/* A small accent dot on the profile button while results are showing. */
.refresh.profile { position: relative; }
.refresh svg circle { fill: none; stroke: currentColor; stroke-width: 2.2; }
.profile.results-on::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg);
}

/* Full screen on phones, a drawer from the right on wider screens. */
.sheet {
  margin: 0;
  padding: 0;
  border: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  background: var(--bg);
  color: var(--text);
}
.sheet::backdrop { background: rgba(0, 0, 0, .55); }
body:has(.sheet[open]) { overflow: hidden; }

.sheet-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(16px, env(safe-area-inset-top)) 16px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.sheet-head h2 { margin: 0; font: italic 800 28px/1 var(--display); text-transform: uppercase; }
.sheet-body { padding: 0 16px max(24px, env(safe-area-inset-bottom)); }

.setting { padding: 18px 0; border-bottom: 1px solid var(--line); }
.setting-title { margin: 0; font: 600 14px/1 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch-row strong { display: block; font: italic 800 20px/1.1 var(--display); text-transform: uppercase; }
.switch-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 14px; }
.switch-row input {
  appearance: none;
  flex: none;
  position: relative;
  width: 48px;
  height: 28px;
  margin: 0;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background .15s;
}
.switch-row input::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .15s, background .15s;
}
.switch-row input:checked { background: var(--accent); border-color: var(--accent); }
.switch-row input:checked::before { transform: translateX(20px); background: var(--on-accent); }

#status { margin-top: 10px; font-size: 14px; color: var(--muted); }
.status-row { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.status-row > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.status-row > span:first-child::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--football); flex: none; }
.status-row.bad { color: var(--live); }
.status-row.bad > span:first-child::before { background: var(--live); }

.logout {
  margin-top: 20px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 3px;
  padding: 9px 14px 8px;
  font: 600 15px/1 var(--display);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.logout:hover { color: var(--live); border-color: currentColor; }

@media (min-width: 640px) {
  .sheet { margin-left: auto; width: 520px; border-left: 1px solid var(--line); }
}

/* ---- login ------------------------------------------------------------------------------- */

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 320px; display: grid; gap: 14px; justify-items: center; }
.login .wordmark { font-size: 44px; margin-bottom: 8px; }
.login .wordmark .slash { height: 40px; width: 18px; }
.login input { text-align: center; }
.login button {
  width: 100%;
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: 3px;
  padding: 11px;
  font: italic 800 20px/1 var(--display);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---- wide screens ------------------------------------------------------------------------ */

@media (min-width: 860px) {
  .wordmark { font-size: 42px; }
  .wordmark .slash { height: 36px; width: 16px; }

  .day {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 24px;
    padding-top: 22px;
  }
  .day + .day { border-top: 1px solid var(--line); margin-top: 22px; }

  /* Scoreboard-style date stack that stays in view while the day scrolls. */
  .day-head {
    position: sticky;
    top: 70px;
    align-self: start;
    display: grid;
    gap: 2px;
    margin: 0;
    padding: 0;
    background: none;
  }
  .day-head .date { display: none; }
  .day-head .num, .day-head .mon { display: block; }
  .day-head .name { font-size: 18px; letter-spacing: .02em; }
  .day-head .num { font: italic 800 64px/0.85 var(--display); }
  .day-head .mon { font-weight: 600; font-size: 15px; letter-spacing: .12em; color: var(--muted); }
  .day-head .count { margin: 6px 0 0; }
  .day.today .day-head .num { color: var(--accent-text); }

  .on-now { display: grid; grid-template-columns: 120px 1fr; gap: 24px; }
  .on-now .day-head .name { font-size: 24px; }

  .blocks { max-width: 760px; }
  .row { grid-template-columns: 72px 1fr auto; padding: 11px 16px; }
  .classification summary { padding-left: 84px; }
  .comp-head { padding-left: 12px; }
}

@media (min-width: 600px) {
  .standings .wide { display: table-cell; }
  #standings > :not(.table-grid) { max-width: 760px; }
  /* LoL diagrams get the room to show every round without scrolling. */
  #standings > :has(.flow) { max-width: 1240px; }
  #standings > :has(.f1-tables) { max-width: 1000px; }
}

/* The tabs fit next to each other on a phone. */
@media (max-width: 480px) {
  .tabs { gap: 4px; }
  .tabs button { padding: 8px 11px 7px; font-size: 15px; }
}

/* On narrow screens the profile button sits at the right edge. */
@media (max-width: 859px) {
  .top > div:first-child { width: 100%; }
  .refresh.profile { margin-left: auto; }
}
