/* ---------- theme tokens ------------------------------------------------
   Colour carries meaning here: a team's identity, a position group, whether
   a number is notable. Nothing is tinted just to be tinted.

   Three selectors, in this order, so an explicit choice always beats the OS:
     :root                          -> light, the default
     @media (prefers-color-scheme)  -> follow the OS when set to "system"
     :root[data-theme=...]          -> what the toggle stamps on the document
   ---------------------------------------------------------------------- */
:root {
  --paper: #F1F3EF;
  --panel: #FFFFFF;
  --ink: #121A15;
  --field: #23503B;
  --clay: #B0563A;
  --muted: #67766D;
  --rule: #C9D2CB;
  --rule-soft: #E0E6E0;
  --chip: #E7EDE8;

  --team-0:  #C1443B;  --team-1:  #D0772B;  --team-2:  #B8951F;
  --team-3:  #6E9B3A;  --team-4:  #2F8B57;  --team-5:  #1F8A8A;
  --team-6:  #2E6FA7;  --team-7:  #4C56A8;  --team-8:  #7B4FA0;
  --team-9:  #A8437A;  --team-10: #8C5A3C;  --team-11: #55707F;

  --pos-c:  #A8437A;
  --pos-if: #2E6FA7;
  --pos-of: #2F8B57;
  --pos-dh: #8C5A3C;
  --pos-sp: #C1443B;
  --pos-rp: #D0772B;
  --pos-bn: #55707F;

  --good: #2F8B57;
  --bad:  #C1443B;
  --gold: #B8951F;
  --elite-wash: rgba(184, 149, 31, 0.14);

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
  --paper: #0D1310;
  --panel: #141C17;
  --ink: #E4EAE4;
  --field: #7FB79C;
  --clay: #D9825F;
  --muted: #8C9C92;
  --rule: #2C3A32;
  --rule-soft: #1E2822;
  --chip: #1C2620;

  --team-0:  #E8776C;  --team-1:  #E9A05C;  --team-2:  #D8BA4E;
  --team-3:  #9CC469;  --team-4:  #5CBB86;  --team-5:  #4FB8B8;
  --team-6:  #6BA3D6;  --team-7:  #8189D6;  --team-8:  #AE87D2;
  --team-9:  #D4779F;  --team-10: #BE8A6A;  --team-11: #8AA3B2;

  --pos-c:  #D4779F;
  --pos-if: #6BA3D6;
  --pos-of: #5CBB86;
  --pos-dh: #BE8A6A;
  --pos-sp: #E8776C;
  --pos-rp: #E9A05C;
  --pos-bn: #8AA3B2;

  --good: #5CBB86;
  --bad:  #E8776C;
  --gold: #D8BA4E;
  --elite-wash: rgba(216, 186, 78, 0.16);

    color-scheme: dark;
  }
}

/* An explicit pick wins over the OS in both directions. */
:root[data-theme="dark"] {
  --paper: #0D1310;
  --panel: #141C17;
  --ink: #E4EAE4;
  --field: #7FB79C;
  --clay: #D9825F;
  --muted: #8C9C92;
  --rule: #2C3A32;
  --rule-soft: #1E2822;
  --chip: #1C2620;

  --team-0:  #E8776C;  --team-1:  #E9A05C;  --team-2:  #D8BA4E;
  --team-3:  #9CC469;  --team-4:  #5CBB86;  --team-5:  #4FB8B8;
  --team-6:  #6BA3D6;  --team-7:  #8189D6;  --team-8:  #AE87D2;
  --team-9:  #D4779F;  --team-10: #BE8A6A;  --team-11: #8AA3B2;

  --pos-c:  #D4779F;
  --pos-if: #6BA3D6;
  --pos-of: #5CBB86;
  --pos-dh: #BE8A6A;
  --pos-sp: #E8776C;
  --pos-rp: #E9A05C;
  --pos-bn: #8AA3B2;

  --good: #5CBB86;
  --bad:  #E8776C;
  --gold: #D8BA4E;
  --elite-wash: rgba(216, 186, 78, 0.16);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --paper: #F1F3EF;
  --panel: #FFFFFF;
  --ink: #121A15;
  --field: #23503B;
  --clay: #B0563A;
  --muted: #67766D;
  --rule: #C9D2CB;
  --rule-soft: #E0E6E0;
  --chip: #E7EDE8;

  --team-0:  #C1443B;  --team-1:  #D0772B;  --team-2:  #B8951F;
  --team-3:  #6E9B3A;  --team-4:  #2F8B57;  --team-5:  #1F8A8A;
  --team-6:  #2E6FA7;  --team-7:  #4C56A8;  --team-8:  #7B4FA0;
  --team-9:  #A8437A;  --team-10: #8C5A3C;  --team-11: #55707F;

  --pos-c:  #A8437A;
  --pos-if: #2E6FA7;
  --pos-of: #2F8B57;
  --pos-dh: #8C5A3C;
  --pos-sp: #C1443B;
  --pos-rp: #D0772B;
  --pos-bn: #55707F;

  --good: #2F8B57;
  --bad:  #C1443B;
  --gold: #B8951F;
  --elite-wash: rgba(184, 149, 31, 0.14);

  color-scheme: light;
}


* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.94rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1220px; margin: 0 auto; padding: 0 1.1rem 4rem; }

/* Says plainly that the numbers are invented. Dismissable, because you only
   need to be told once, but it comes back on a new browser. */
.databanner {
  position: relative;
  background: color-mix(in srgb, var(--gold) 14%, var(--panel));
  border-bottom: 1px solid color-mix(in srgb, var(--gold) 45%, transparent);
  color: var(--ink); font-size: 0.82rem; line-height: 1.5;
  padding: 0.6rem 2.4rem 0.6rem 1.1rem;
}
.databanner strong { font-family: var(--mono); }
.databanner em { font-style: normal; color: var(--clay); font-weight: 600; }
.databanner code {
  font-family: var(--mono); font-size: 0.94em;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  padding: 0.05rem 0.28rem; border-radius: 2px;
}
.databanner-x {
  position: absolute; right: 0.7rem; top: 0.45rem;
  border: 0; background: none; cursor: pointer; color: var(--muted);
  font-size: 1.1rem; line-height: 1; padding: 0.1rem 0.3rem;
}
.databanner-x:hover { color: var(--ink); }
.hidden { display: none !important; }

/* ---------- app bar ---------- */
.appbar {
  display: flex; align-items: baseline; gap: 1.3rem;
  padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--rule);
  background: var(--panel); flex-wrap: wrap;
  position: sticky; top: 0; z-index: 20;
}
.brand {
  font-family: var(--mono); font-weight: 700; letter-spacing: -0.03em;
  cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.brand-mark { display: block; border-radius: 4px; flex: 0 0 auto; }
.brand:hover .brand-mark { opacity: 0.85; }
.brand:hover .brand-sub { color: var(--ink); }
.brand-sub { font-weight: 400; color: var(--muted); }
.brand-year {
  color: var(--clay); font-size: 0.7em; vertical-align: super;
  margin-left: 0.15em; letter-spacing: 0;
}
.code-chip {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.14em;
  background: var(--chip); padding: 0.16rem 0.5rem; border-radius: 2px;
  color: var(--muted);
}
.code-chip:empty { display: none; }

nav { display: flex; gap: 1.05rem; font-family: var(--mono); font-size: 0.78rem; flex-wrap: wrap; }
nav button {
  background: none; border: 0; padding: 0 0 3px; cursor: pointer;
  color: var(--muted); font: inherit; border-bottom: 2px solid transparent;
}
nav button:hover { color: var(--ink); }
nav button.on { color: var(--ink); border-bottom-color: var(--clay); }
nav button:disabled { opacity: 0.35; cursor: not-allowed; }
.spacer { margin-left: auto; }

/* The clubhouse's own row, a level down from the main nav. Quieter than it
   and set apart, so it reads as "inside My team" rather than as more tabs. */
.subnav {
  gap: 1.3rem; margin: 0 0 1.5rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}
.subnav button { font-size: 0.76rem; letter-spacing: 0.02em; }

/* ---------- dragging a lineup ---------- */
.lineup-row { cursor: grab; }
.lineup-row:active { cursor: grabbing; }
.lineup-row.dragging { opacity: 0.45; }
/* The line shows where he'd land, on the side of the row you're over. Drawn
   as an inset shadow rather than an inserted element so nothing jumps. */
.lineup-row.drop-above { box-shadow: inset 0 2px 0 var(--clay); }
.lineup-row.drop-below { box-shadow: inset 0 -2px 0 var(--clay); }

.grip {
  color: var(--muted); font-size: 0.95rem; line-height: 1;
  padding: 0 0.15rem; cursor: grab; user-select: none;
  /* The only part of the row that gives up scrolling to the drag. Put this
     on the whole row and a finger could no longer scroll the page. */
  touch-action: none;
}
.grip:active { cursor: grabbing; }

/* A photo is natively draggable, and a picture drag starting mid-gesture
   fights the one we're running. */
.lineup-row img { -webkit-user-drag: none; user-select: none; }
/* Nothing in the card is worth selecting, and a stray selection while
   dragging swallows the gesture. */
#lineupCard, #lineupBench { user-select: none; }

/* ---------- theme switch ---------- */
.theme-switch {
  display: inline-flex; border: 1px solid var(--rule); border-radius: 3px;
  overflow: hidden; margin-left: 0.9rem;
}
.theme-switch button {
  font-family: var(--mono); font-size: 0.8rem; line-height: 1;
  padding: 0.3rem 0.5rem; cursor: pointer; border: 0;
  background: transparent; color: var(--muted);
}
.theme-switch button + button { border-left: 1px solid var(--rule); }
.theme-switch button:hover { color: var(--ink); background: var(--chip); }
.theme-switch button.on { background: var(--field); color: var(--paper); }

/* ---------- typography ---------- */
h1 { font-family: var(--mono); font-size: 2.1rem; letter-spacing: -0.03em; margin: 0 0 0.6rem; }
h2 { font-family: var(--mono); font-size: 1.28rem; letter-spacing: -0.02em; margin: 2.2rem 0 0.9rem; }
h3 { font-family: var(--mono); font-size: 1rem; margin: 1.6rem 0 0.5rem; }
.lede { color: var(--muted); max-width: 62ch; }

.pane-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  font-family: var(--mono); font-size: 0.69rem; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 0.6rem;
}

/* ---------- panels ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--rule);
  border-radius: 4px; padding: 1.05rem;
}
.stack { display: flex; flex-direction: column; gap: 1.1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- forms ---------- */
label {
  display: block; font-family: var(--mono); font-size: 0.7rem;
  letter-spacing: 0.11em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 0.28rem;
}
input, select {
  font: inherit; padding: 0.42rem 0.55rem; border: 1px solid var(--rule);
  background: var(--panel); color: var(--ink); border-radius: 3px; width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--clay); outline-offset: 2px;
}
.field { margin-bottom: 0.9rem; }
.row { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 150px; }

.check {
  display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.7rem;
  font-family: var(--sans); font-size: 0.82rem; text-transform: none;
  letter-spacing: 0; color: var(--ink); cursor: pointer;
}
.check input { width: auto; margin: 0; accent-color: var(--field); }

button.btn {
  font-family: var(--mono); font-size: 0.73rem; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 0.44rem 0.85rem; cursor: pointer;
  border: 1px solid var(--field); color: var(--field); background: transparent;
  border-radius: 2px; white-space: nowrap;
}
button.btn:hover:not(:disabled) { background: var(--chip); }
button.solid { background: var(--field); color: var(--paper); }
button.solid:hover:not(:disabled) { opacity: 0.88; background: var(--field); }
button.clay { border-color: var(--clay); background: var(--clay); color: #fff; }
button.clay:hover:not(:disabled) { opacity: 0.88; background: var(--clay); }
button.btn:disabled { opacity: 0.32; cursor: not-allowed; }

button.icon-btn {
  font-family: var(--mono); font-size: 0.8rem; line-height: 1;
  padding: 0.24rem 0.42rem; cursor: pointer; border: 1px solid var(--rule);
  background: transparent; color: var(--muted); border-radius: 2px;
}
button.icon-btn:hover:not(:disabled) { color: var(--field); border-color: var(--field); }
button.icon-btn:disabled { opacity: 0.25; cursor: not-allowed; }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th {
  font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--muted); text-align: left;
  font-weight: 500; padding: 0 0.5rem 0.4rem 0;
  border-bottom: 1px solid var(--rule); white-space: nowrap;
}
td {
  padding: 0.38rem 0.5rem 0.38rem 0; border-bottom: 1px solid var(--rule-soft);
  font-size: 0.84rem; white-space: nowrap;
}
td.num, th.num { text-align: right; font-family: var(--mono); }
.pname { font-weight: 600; }
.meta { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }

th button.sort {
  font: inherit; color: inherit; background: none; border: 0; padding: 0;
  cursor: pointer; letter-spacing: inherit; text-transform: inherit;
}
th button.sort:hover { color: var(--ink); }
th button.sort.on { color: var(--clay); }
th button.sort .arrow { font-size: 0.85em; margin-left: 0.22em; }
th.num button.sort { float: right; }

/* ---------- draft ---------- */
.draft-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.1rem; }
@media (max-width: 900px) { .draft-grid { grid-template-columns: 1fr; } }

.clock {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 0.9rem; border: 1px solid var(--rule);
  border-left: 4px solid var(--rule); border-radius: 3px; margin-bottom: 1rem;
}
.clock.mine { border-color: var(--clay); border-left-color: var(--clay); }
.clock-sub {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--muted);
}
.clock.mine .clock-sub { color: var(--clay); }
.clock-team { font-family: var(--mono); font-weight: 700; font-size: 0.95rem; }
.timer {
  font-family: var(--mono); font-size: 1.7rem; font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1; color: var(--muted);
}
.clock.mine .timer, .timer.low { color: var(--clay); }

.filters {
  display: flex; gap: 0.5rem; margin-bottom: 0.75rem;
  flex-wrap: wrap; row-gap: 0.35rem;
}
.filters input { flex: 1 1 160px; }
.filters button {
  font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.08em; padding: 0.3rem 0.6rem; cursor: pointer;
  border: 1px solid var(--rule); background: transparent; color: var(--muted);
  border-radius: 2px;
}
.filters button.on { border-color: var(--field); color: var(--field); background: var(--chip); }

.row-actions { display: flex; gap: 0.3rem; justify-content: flex-end; }

.feed { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.feed li {
  display: grid; grid-template-columns: 3.2rem 1fr; gap: 0.55rem;
  padding: 0.34rem 0; border-bottom: 1px solid var(--rule-soft); font-size: 0.8rem;
}
.feed .pk { font-family: var(--mono); font-size: 0.71rem; color: var(--muted); }
.auto-tag { font-family: var(--mono); font-size: 0.64rem; color: var(--clay); }

.managers { display: flex; flex-wrap: wrap; gap: 0.32rem; }
.mgr {
  font-family: var(--mono); font-size: 0.69rem; padding: 0.18rem 0.48rem;
  background: var(--chip); border-radius: 2px; color: var(--muted);
}
.mgr.live { color: var(--field); }
.mgr.onclock { color: var(--clay); font-weight: 700; }
.mgr.cpu { color: var(--ink); border: 1px dashed var(--rule); background: transparent; }
.mgr.cpu::before { content: "\25A3 "; color: var(--muted); font-size: 0.9em; }

.needs { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.need {
  font-family: var(--mono); font-size: 0.69rem; padding: 0.16rem 0.45rem;
  border: 1px solid var(--rule); border-radius: 2px;
  color: var(--pc, var(--muted));
  border-color: color-mix(in srgb, var(--pc, var(--rule)) 40%, transparent);
}
.need.done { opacity: 0.32; }

button.cpu-toggle {
  font-family: var(--mono); font-size: 0.68rem; padding: 0.18rem 0.45rem;
  border: 1px dashed var(--rule); background: transparent; color: var(--muted);
  border-radius: 2px; cursor: pointer;
}
button.cpu-toggle.on { border-style: solid; border-color: var(--field); color: var(--field); }
button.cpu-toggle:disabled { opacity: 0.3; cursor: not-allowed; }

/* ---------- queue ---------- */
.qrow {
  display: grid; grid-template-columns: 1.4rem 1fr auto; gap: 0.5rem;
  align-items: center; padding: 0.32rem 0;
  border-bottom: 1px solid var(--rule-soft); font-size: 0.83rem;
}
.qrow:last-child { border-bottom: 0; }
.qnum { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.qacts { display: flex; gap: 0.22rem; }
.qrow.blocked .pname { text-decoration: line-through; opacity: 0.55; }
.blocked-why { color: var(--clay); }

/* ---------- misc ---------- */
.notice {
  font-family: var(--mono); font-size: 0.76rem; padding: 0.6rem 0.8rem;
  border-left: 3px solid var(--clay); background: var(--chip);
  border-radius: 0 2px 2px 0; margin-bottom: 1rem;
}
.notice.ok { border-left-color: var(--field); }

.progress {
  height: 3px; background: var(--rule-soft); border-radius: 2px;
  overflow: hidden; margin-top: 0.5rem;
}
.progress > div { height: 100%; background: var(--field); width: 0; transition: width 0.2s; }

.bracket-round { margin-bottom: 1.4rem; }
.series {
  border: 1px solid var(--rule); border-left: 3px solid var(--tc, var(--field));
  border-radius: 3px; padding: 0.7rem 0.9rem; margin-bottom: 0.7rem;
}
.series-head { font-family: var(--mono); font-weight: 700; font-size: 0.88rem; }
.series-games { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); margin-top: 0.3rem; }

.champion {
  border: 1px solid var(--gold); border-top: 3px solid var(--gold);
  background: color-mix(in srgb, var(--gold) 8%, var(--panel));
  border-radius: 3px; padding: 1.1rem; text-align: center; margin-top: 1.2rem;
}
.champion .name {
  font-family: var(--mono); font-size: 1.5rem; font-weight: 700; color: var(--ink);
}
.champion .label {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--gold);
}

.pbp { max-height: 460px; overflow-y: auto; font-size: 0.8rem; }
.pbp .inning-head {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
  margin: 0.8rem 0 0.3rem; padding-top: 0.5rem; border-top: 1px solid var(--rule-soft);
}
.pbp .play {
  display: grid; grid-template-columns: 10rem 2.4rem 1fr 5rem;
  gap: 0.5rem; padding: 0.16rem 0;
}
.pbp .play .p { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.pbp .play .sc { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); text-align: right; }
.pbp .scored { color: var(--clay); font-weight: 600; }

/* ---------- lobby hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 5px;
  border: 1px solid var(--rule); background: var(--panel);
  padding: 2.4rem 2rem 2.2rem; margin-bottom: 1.6rem;
}
.hero h1, .hero .lede { position: relative; z-index: 1; }
/* A faint infield arc, drawn rather than decorated onto. */
.hero::after {
  content: ""; position: absolute; right: -90px; top: -110px;
  width: 340px; height: 340px; border-radius: 50%;
  border: 44px solid color-mix(in srgb, var(--field) 9%, transparent);
  border-right-color: color-mix(in srgb, var(--clay) 13%, transparent);
  pointer-events: none;
}
.hero-strip {
  display: flex; gap: 3px; margin-bottom: 1.3rem;
  position: relative; z-index: 1;
}
.hero-strip span { height: 4px; flex: 1; border-radius: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- position chips need their base rule back ---------- */
.pos-chip {
  font-family: var(--mono); font-size: 0.68rem; font-weight: 600;
  padding: 0.1rem 0.34rem; border-radius: 2px; letter-spacing: 0.03em;
}

/* ---------- team identity ---------- */
.team-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 2px;
  background: var(--tc, var(--muted)); margin-right: 0.45rem;
  vertical-align: baseline; flex: 0 0 auto;
}
tr.team-row td:first-child { box-shadow: inset 3px 0 0 var(--tc, transparent); padding-left: 0.55rem; }
.mgr[style*="--tc"] { color: var(--tc); }

/* ---------- position chips, coloured by group ---------- */
.pos-chip {
  color: var(--pc, var(--field));
  background: color-mix(in srgb, var(--pc, var(--field)) 14%, transparent);
}
/* Bound to the bare .pos-* class, not to .pos-chip, so anything that wants a
   position's colour -- chips, avatars, group headings -- picks up the same
   one. Position colour means the same thing everywhere or it means nothing. */
.pos-C  { --pc: var(--pos-c); }
.pos-1B, .pos-2B, .pos-3B, .pos-SS { --pc: var(--pos-if); }
.pos-LF, .pos-CF, .pos-RF { --pc: var(--pos-of); }
.pos-DH { --pc: var(--pos-dh); }
.pos-SP { --pc: var(--pos-sp); }
.pos-RP, .pos-CL { --pc: var(--pos-rp); }
.pos-BN { --pc: var(--pos-bn); }

.filters button[data-slot="C"].on  { border-color: var(--pos-c);  color: var(--pos-c); }
.filters button[data-slot="1B"].on, .filters button[data-slot="2B"].on,
.filters button[data-slot="3B"].on, .filters button[data-slot="SS"].on {
  border-color: var(--pos-if); color: var(--pos-if);
}
.filters button[data-slot="LF"].on, .filters button[data-slot="CF"].on,
.filters button[data-slot="RF"].on { border-color: var(--pos-of); color: var(--pos-of); }
.filters button[data-slot="DH"].on { border-color: var(--pos-dh); color: var(--pos-dh); }
.filters button[data-slot="SP"].on { border-color: var(--pos-sp); color: var(--pos-sp); }
.filters button[data-slot="RP"].on { border-color: var(--pos-rp); color: var(--pos-rp); }

/* needs chips take the position colour, and dim once filled */
.need { color: var(--pc, var(--muted)); border-color: color-mix(in srgb, var(--pc, var(--rule)) 40%, transparent); }
.need.done { opacity: 0.32; }

/* ---------- standings semantics ---------- */
.badge {
  font-family: var(--mono); font-size: 0.6rem; font-weight: 700;
  padding: 0.06rem 0.28rem; border-radius: 2px; margin-left: 0.35rem;
  letter-spacing: 0.06em; vertical-align: 1px;
}
.badge.z { background: var(--gold); color: #1a1508; }
.badge.y { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--good); }
td.pos-diff { color: var(--good); }
td.neg-diff { color: var(--bad); }
td.streak-w { color: var(--good); }
td.streak-l { color: var(--bad); }

/* ---------- leader heat ---------- */
td.elite { background: var(--elite-wash); font-weight: 650; }
td.league-best { color: var(--gold); font-weight: 700; }

/* ---------- champion ---------- */
.champion {
  border: 1px solid var(--gold);
  border-top: 3px solid var(--gold);
  background: color-mix(in srgb, var(--gold) 8%, var(--panel));
}
.champion .label { color: var(--gold); }
.champion .name { color: var(--ink); }
.series { border-left-color: var(--tc, var(--field)); }

/* ---------- lobby hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 5px;
  border: 1px solid var(--rule); background: var(--panel);
  padding: 2.4rem 2rem 2.2rem; margin-bottom: 1.6rem;
}
.hero h1 { position: relative; z-index: 1; }
.hero .lede { position: relative; z-index: 1; }
/* A faint infield arc, drawn rather than decorated onto. */
.hero::after {
  content: ""; position: absolute; right: -90px; top: -110px;
  width: 340px; height: 340px; border-radius: 50%;
  border: 44px solid color-mix(in srgb, var(--field) 9%, transparent);
  border-right-color: color-mix(in srgb, var(--clay) 13%, transparent);
  pointer-events: none;
}
.hero-strip { display: flex; gap: 3px; margin-bottom: 1.3rem; }
.hero-strip span { height: 4px; flex: 1; border-radius: 2px; }

@media (prefers-reduced-motion: no-preference) {
  .badge, .pos-chip { transition: background 0.15s, color 0.15s; }
}

/* ---------- gamecast ---------- */
.gc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
@media (max-width: 900px) { .gc-grid { grid-template-columns: 1fr; } }

.gc-score {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 1rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--rule-soft);
}
.gc-team { display: flex; align-items: baseline; gap: 0.6rem; }
.gc-team:last-child { justify-content: flex-end; }
.gc-team .nm { font-family: var(--mono); font-size: 0.82rem; }
.gc-team .rn {
  font-family: var(--mono); font-size: 1.9rem; font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.gc-team.batting .nm { color: var(--clay); font-weight: 700; }
.gc-mid { text-align: center; }
.gc-inning {
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
}
.gc-outs { display: flex; gap: 4px; justify-content: center; margin-top: 0.35rem; }
.gc-outs span {
  width: 8px; height: 8px; border-radius: 50%;
  border: 1px solid var(--rule); background: transparent;
}
.gc-outs span.on { background: var(--clay); border-color: var(--clay); }

.gc-diamond { width: 100%; max-width: 260px; margin: 0.6rem auto 0; display: block; color: var(--muted); }
.gc-base, .gc-plate {
  fill: var(--panel); stroke: var(--rule); stroke-width: 1.5;
  transition: fill 0.18s, stroke 0.18s;
}
.gc-plate { fill: var(--chip); }
.gc-base.occupied { fill: var(--clay); stroke: var(--clay); }

.gc-runners {
  display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: center;
  min-height: 1.5rem; margin-top: 0.2rem;
}
.gc-runners span {
  font-family: var(--mono); font-size: 0.68rem; color: var(--clay);
  background: color-mix(in srgb, var(--clay) 12%, transparent);
  padding: 0.1rem 0.4rem; border-radius: 2px;
}

.gc-matchup {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem;
  margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid var(--rule-soft);
}
.gc-matchup > div { display: flex; flex-direction: column; gap: 0.15rem; }
.gc-label {
  font-family: var(--mono); font-size: 0.63rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
}
.gc-matchup span:not(.gc-label) { font-weight: 600; font-size: 0.9rem; }

.gc-last {
  margin-top: 0.8rem; padding: 0.55rem 0.7rem; border-radius: 3px;
  background: var(--chip); font-size: 0.86rem; min-height: 2.2rem;
}
.gc-last.scored { background: color-mix(in srgb, var(--clay) 16%, transparent); font-weight: 600; }

.gc-controls { display: flex; gap: 0.45rem; margin: 0.9rem 0 0.5rem; flex-wrap: wrap; }
.gc-controls select { flex: 0 0 auto; width: auto; }

.gc-log { max-height: 460px; overflow-y: auto; font-size: 0.82rem; }
.gc-log .gc-half {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
  margin: 0.7rem 0 0.25rem; padding-top: 0.45rem;
  border-top: 1px solid var(--rule-soft);
}
.gc-log .gc-row {
  display: grid; grid-template-columns: 1fr auto; gap: 0.6rem; padding: 0.16rem 0;
}
.gc-log .gc-row.scored { color: var(--clay); font-weight: 600; }
.gc-log .gc-row .st { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
#gcBar { height: 100%; background: var(--clay); width: 0; transition: width 0.15s; }

/* ---------- player avatars ----------------------------------------------
   A real photo when one has been supplied, initials otherwise. The tint is
   the player's position colour, so a roster reads as position groups at a
   glance rather than as a wall of identical discs. */
.avatar {
  --pc: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  overflow: hidden; vertical-align: middle;
  background: color-mix(in srgb, var(--pc) 15%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--pc) 34%, transparent);
  font-family: var(--mono); font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.02em; color: var(--pc); user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.lg { width: 40px; height: 40px; font-size: 0.82rem; }

/* Name cells that carry an avatar need to line the two up. */
.who { display: flex; align-items: center; gap: 0.5rem; }
.who .pname { font-weight: 600; }

/* ---------- my team ----------------------------------------------------- */
.team-head {
  display: flex; align-items: baseline; gap: 0.9rem; flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.team-head h2 { margin: 0; }
.team-head .spacer { flex: 1 1 auto; }
.team-head select { width: auto; min-width: 13rem; flex: 0 0 auto; }

.team-groups { display: flex; flex-direction: column; gap: 1.1rem; }
.tg-head {
  display: flex; align-items: baseline; gap: 0.6rem;
  margin-bottom: 0.55rem; padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule-soft);
}
.tg-head h3 {
  margin: 0; font-size: 0.78rem; letter-spacing: 0.11em;
  text-transform: uppercase; font-family: var(--mono);
}
.tg-head .meta { margin-left: auto; }

/* The batting-order / rotation-turn number. It's the point of the table, so
   it gets the mono face and a fixed width rather than blending into a stat. */
.slotno {
  font-family: var(--mono); font-size: 0.72rem; color: var(--muted);
  width: 1.6rem; text-align: right;
}

/* ---------- player links ------------------------------------------------
   A name is a control now. It still has to read as a name in a table, so it
   borrows the surrounding type and only declares itself on hover. */
.plink {
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; font-weight: 600; color: inherit; text-align: left;
  cursor: pointer; border-bottom: 1px dotted transparent;
}
.plink:hover, .plink:focus-visible {
  color: var(--clay); border-bottom-color: currentColor;
}
.plink:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; }

/* ---------- player card ---------- */
.pmodal {
  border: 1px solid var(--rule); border-radius: 5px; padding: 0;
  background: var(--panel); color: var(--ink);
  width: min(760px, calc(100vw - 2rem)); max-height: calc(100vh - 4rem);
  overflow: auto;
}
.pmodal::backdrop { background: rgba(0, 0, 0, 0.45); }

.pm-head {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 1rem 1.1rem; border-bottom: 1px solid var(--rule-soft);
  position: sticky; top: 0; background: var(--panel); z-index: 1;
}
.pm-id { min-width: 0; }
.pm-head h3 {
  margin: 0; font-family: var(--mono); font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.pm-head .meta { display: block; line-height: 1.7; }
.pm-head .pos-chip { margin-right: 0.35rem; }
.pm-head .icon-btn { margin-left: auto; align-self: flex-start; flex: 0 0 auto; }

#pmBody { padding: 0.4rem 1.1rem 1.2rem; }
.pm-sec { margin-top: 1.1rem; }
.pm-sec .tg-head { margin-bottom: 0.5rem; }

/* Says plainly that the numbers above it are inputs, not results. */
.pm-note {
  margin: 0.55rem 0 0; font-size: 0.78rem; line-height: 1.55;
  color: var(--muted); border-left: 2px solid var(--rule);
  padding-left: 0.65rem;
}

.pm-ranks { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.rankchip {
  display: inline-flex; align-items: baseline; gap: 0.4rem;
  border: 1px solid var(--rule); border-radius: 3px;
  padding: 0.25rem 0.5rem; font-size: 0.78rem;
}
.rankchip .rk-stat {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.08em;
  color: var(--muted);
}
.rankchip .rk-val { font-weight: 700; }
.rankchip .rk-pos { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.rankchip.best {
  border-color: color-mix(in srgb, var(--gold) 55%, transparent);
  background: var(--elite-wash);
}
.rankchip.best .rk-pos { color: var(--gold); font-weight: 700; }

/* ---------- club crests -------------------------------------------------
   Square rather than round: the crest artwork already carries its own
   roundel, and an uploaded photo shouldn't be clipped into a circle. */
.crest {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 4px;
  overflow: hidden; vertical-align: middle;
}
.crest img { width: 100%; height: 100%; object-fit: cover; display: block; }
.crest.lg { width: 54px; height: 54px; border-radius: 8px; }
/* Shown only when the image fails: the club colour, so a row never
   collapses to an empty gap. */
.crest.blank { background: var(--tc, var(--chip)); }

.team-head .th-id { min-width: 0; }
.team-head { align-items: center; }
.team-head .btn { flex: 0 0 auto; }

/* ---------- crest picker ---------- */
.crest-grid {
  display: grid; gap: 0.5rem;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
}
.crest-opt {
  padding: 0.3rem; border: 1px solid var(--rule); border-radius: 5px;
  background: var(--panel); cursor: pointer; line-height: 0;
}
.crest-opt img { width: 100%; height: auto; display: block; border-radius: 4px; }
.crest-opt:hover { border-color: var(--field); }
.crest-opt.on {
  border-color: var(--clay); box-shadow: 0 0 0 2px
    color-mix(in srgb, var(--clay) 28%, transparent);
}

#teamEdit input[type="file"] {
  font-size: 0.82rem; padding: 0.4rem 0; border: 0; background: none;
}


/* ================================================================ accounts
   The sign-in chip sits in the appbar next to the theme switch, and stays
   out of the way entirely when no Supabase project is configured. */
.account { display: flex; align-items: center; }

button.btn.tiny {
  font-size: 0.68rem; padding: 0.28rem 0.55rem; letter-spacing: 0.06em;
}
button.btn.wide { width: 100%; margin-top: 0.5rem; }

.account-chip {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer;
  background: var(--chip); border: 1px solid var(--rule);
  border-radius: 999px; padding: 0.2rem 0.6rem 0.2rem 0.24rem;
  color: var(--ink); font: inherit; font-size: 0.74rem;
}
.account-chip:hover { border-color: var(--field); }

/* The picture as it appears in the account card: big enough to see what you
   actually chose, which the 20px chip is not. */
.account-edit {
  display: flex; align-items: center; gap: 1rem; margin: 0.9rem 0 0.4rem;
  flex-wrap: wrap;
}
.account-shot {
  width: 72px; height: 72px; border-radius: 50%; flex: 0 0 auto;
  overflow: hidden; display: grid; place-items: center;
  background: var(--chip); border: 1px solid var(--rule);
}
.account-shot img { width: 100%; height: 100%; object-fit: cover; }
.account-shot .account-initials {
  width: 100%; height: 100%; border-radius: 50%; font-size: 1.4rem;
}
.account-chip img { width: 20px; height: 20px; border-radius: 50%; }
.account-initials {
  width: 20px; height: 20px; border-radius: 50%; background: var(--field);
  color: #fff; font-size: 0.6rem; font-weight: 700;
  display: grid; place-items: center;
}
.account-name { max-width: 12ch; overflow: hidden; text-overflow: ellipsis;
                white-space: nowrap; }

/* The sign-in sheet. Deliberately plain -- it appears once. */
.modal-back {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  display: grid; place-items: center; z-index: 60; padding: 1rem;
}
.modal {
  background: var(--panel); border: 1px solid var(--rule); border-radius: 4px;
  padding: 1.4rem; width: min(24rem, 100%);
}
.modal h3 { margin: 0 0 0.4rem; }
.modal .meta { display: block; margin-bottom: 0.9rem; }
.modal-or {
  text-align: center; color: var(--muted); font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.12em; margin: 0.9rem 0 0.2rem;
}

/* ---------- my teams ---------- */
.my-teams {
  display: grid; gap: 0.6rem;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}
.my-team {
  display: flex; gap: 0.6rem; align-items: center; text-align: left;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 3px;
  padding: 0.6rem 0.7rem; cursor: pointer; color: var(--ink); font: inherit;
}
.my-team:hover { border-color: var(--field); background: var(--chip); }
.my-team img { width: 34px; height: 34px; flex: 0 0 auto; }
.my-team-body { min-width: 0; }
.my-team-name { font-weight: 700; font-size: 0.86rem; }
.my-team-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.3rem; }
/* A league you set up and haven't joined has no crest to show, so it is set
   apart by a dashed edge rather than left looking like a club with a missing
   logo. */
/* ---------- toasts ---------- */
.toasts {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
  display: flex; flex-direction: column; gap: 0.5rem;
  max-width: min(24rem, calc(100vw - 2rem));
}
.toast {
  display: flex; align-items: flex-start; gap: 0.6rem;
  background: var(--panel); border: 1px solid var(--rule);
  border-left: 3px solid var(--field);
  border-radius: 4px; padding: 0.65rem 0.75rem;
  font-size: 0.86rem; color: var(--ink);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
}
.toast.bad { border-left-color: var(--clay); }
.toast-x {
  background: none; border: 0; cursor: pointer; color: var(--muted);
  font-size: 1.1rem; line-height: 1; padding: 0; margin-left: auto;
}
.toast-x:hover { color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in 160ms ease-out; }
  @keyframes toast-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
  }
}

.my-team.unseated { border-style: dashed; }
.my-team.unseated .my-team-name { font-weight: 600; color: var(--muted); }

.tag {
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 0.1rem 0.35rem; border-radius: 2px;
  background: var(--chip); color: var(--muted); border: 1px solid var(--rule-soft);
}
.tag.live { background: var(--clay); color: #fff; border-color: transparent; }
.tag.warn { background: var(--gold); color: #fff; border-color: transparent; }

/* ================================================================== trades */
.tab-badge {
  display: inline-grid; place-items: center; min-width: 1.05rem; height: 1.05rem;
  margin-left: 0.3rem; padding: 0 0.2rem; border-radius: 999px;
  background: var(--clay); color: #fff; font-size: 0.6rem; font-weight: 700;
  font-family: var(--mono);
}

.trade-builder { gap: 1rem; }
.trade-pool {
  max-height: 22rem; overflow-y: auto; border: 1px solid var(--rule-soft);
  border-radius: 3px; padding: 0.2rem;
}
.trade-player {
  display: flex; align-items: center; gap: 0.45rem; width: 100%;
  background: none; border: 0; border-radius: 2px; cursor: pointer;
  padding: 0.3rem 0.4rem; color: var(--ink); font: inherit; font-size: 0.78rem;
  text-align: left;
}
.trade-player:hover { background: var(--chip); }
/* Selected players are the whole point of the panel, so they get the
   strongest treatment on the page rather than a subtle tint. */
.trade-player.on { background: var(--field); color: #fff; }
.trade-player.on .slot-chip { background: rgba(255, 255, 255, 0.22); color: #fff; }
.trade-player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.slot-chip {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.04em;
  background: var(--chip); color: var(--muted); border-radius: 2px;
  padding: 0.05rem 0.28rem; flex: 0 0 auto; min-width: 2.1rem; text-align: center;
}

.trade-actions {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  margin-top: 0.9rem;
}

.trade-card {
  border: 1px solid var(--rule); border-radius: 3px; padding: 0.8rem 0.9rem;
  margin-bottom: 0.7rem; background: var(--panel);
}
/* A resolved trade is history: readable, but visibly not asking for anything. */
.trade-card.state-declined, .trade-card.state-withdrawn,
.trade-card.state-vetoed { opacity: 0.62; }
.trade-card.state-accepted { border-left: 3px solid var(--gold); }
.trade-card.state-executed { border-left: 3px solid var(--field); }

.trade-card-head {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.trade-card-body {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem;
}
.trade-side { margin-top: 0.25rem; }
.trade-side-row {
  display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem;
  padding: 0.12rem 0;
}
.trade-review {
  display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 0.7rem;
  padding-top: 0.6rem; border-top: 1px dashed var(--rule-soft);
}
.tag.state-accepted { background: var(--gold); color: #fff; border-color: transparent; }
.tag.state-executed { background: var(--field); color: #fff; border-color: transparent; }
.tag.state-vetoed, .tag.state-declined { background: var(--clay); color: #fff; border-color: transparent; }

@media (max-width: 640px) {
  .trade-card-body { grid-template-columns: 1fr; }
  .account-name { display: none; }
}

/* ============================================================ star of the game
   Sits above the line score. The club's colour comes in as --tc from
   withTeamColor, so the card reads as belonging to the winning team without
   needing a second lookup here. */
.star-card {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--tc, var(--field));
  border-radius: 3px;
  background: var(--panel);
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
}

.star-head {
  display: flex; align-items: baseline; gap: 0.6rem;
  margin-bottom: 0.55rem;
}
.star-label {
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--tc, var(--muted)); font-weight: 700;
}
.star-team {
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.06em;
  color: var(--muted); margin-left: auto;
}

.star-body { display: flex; align-items: center; gap: 0.7rem; }
.star-who { min-width: 0; }
.star-who .pname { font-size: 1rem; font-weight: 700; }
.star-line {
  font-family: var(--mono); font-size: 0.76rem; color: var(--muted);
  margin-top: 0.15rem;
}
.star-decision {
  display: inline-block; margin-left: 0.4rem; padding: 0.02rem 0.3rem;
  border-radius: 2px; background: var(--tc, var(--field)); color: #fff;
  font-size: 0.64rem; font-weight: 700;
}

/* A won row in a line score is worth spotting without reading the numbers. */
.team-row.won .pname { font-weight: 700; }
td.num.strong { font-weight: 700; }

/* ============================================================== leaderboards
   One card per category, above the sortable season table. The table answers
   "show me everyone"; these answer "who led the league", which no single
   ordering of one table can do. */
.leader-grid {
  display: grid; gap: 0.7rem; margin-bottom: 1.6rem;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}

.leader-card {
  background: var(--panel); border: 1px solid var(--rule);
  border-radius: 3px; padding: 0.6rem 0.7rem;
}

.leader-head {
  display: flex; align-items: baseline; gap: 0.4rem;
  padding-bottom: 0.4rem; margin-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule-soft);
}
.leader-stat {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink);
}
.leader-note {
  font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.04em;
  color: var(--muted); margin-left: auto;
}

.leader-list { list-style: none; margin: 0; padding: 0; }
.leader-row {
  display: flex; align-items: baseline; gap: 0.45rem;
  padding: 0.16rem 0; font-size: 0.8rem;
}
.leader-rank {
  font-family: var(--mono); font-size: 0.64rem; color: var(--muted);
  width: 1ch; flex: 0 0 auto;
}
/* The leader is the answer to the question; the rest are context. */
.leader-row.top { font-weight: 700; }
.leader-row.top .leader-rank { color: var(--field); }

.leader-who {
  min-width: 0; flex: 1 1 auto; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.leader-team {
  font-family: var(--mono); font-size: 0.6rem; color: var(--tc, var(--muted));
  margin-left: 0.35rem;
}
.leader-value {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  flex: 0 0 auto; margin-left: auto;
}

h3.section-head {
  font-size: 0.74rem; font-family: var(--mono); letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
  margin: 0 0 0.6rem;
}

/* ==================================================================== gate
   Covers the app until a code is redeemed. The real gate is the server
   refusing the data; this only explains why the page is empty. */
.gate-back { backdrop-filter: blur(3px); }
.gate-error {
  font-family: var(--mono); font-size: 0.72rem; color: var(--clay);
  min-height: 1.1rem; margin: 0.35rem 0 0.2rem;
}

/* ================================================================== footer
   Attribution, not decoration. Retrosheet asks that anything built on their
   data carry their notice, and the CC BY / CC BY-SA photographs require
   credit -- so this is a licence condition and deliberately not dismissible. */
.sitefoot {
  max-width: 1220px; margin: 2.5rem auto 1.5rem; padding: 1rem 1.2rem 0;
  border-top: 1px solid var(--rule-soft);
  color: var(--muted); font-size: 0.72rem; line-height: 1.55;
}
.sitefoot p { margin: 0 0 0.4rem; }
.sitefoot a { color: var(--muted); text-decoration: underline; }
.sitefoot a:hover { color: var(--field); }
/* The notice itself is required verbatim; set smaller, still legible. */
.foot-notice { display: block; margin-top: 0.2rem; opacity: 0.85; }

/* ======================================================= gamecast faces
   The batter, the pitcher and anyone on base get a photograph where one
   exists. `avatar` falls back to initials, so partial coverage reads as
   deliberate rather than broken. */
.gc-who { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.gc-who .gc-label { flex: 0 0 auto; }
.gc-face { flex: 0 0 auto; display: inline-flex; }
.gc-who > span:last-child {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ==================================================== runners on the bases
   The face replaces the coloured square. Slots are placed from the same
   viewBox coordinates the <rect>s use, expressed as percentages of the
   200x180 box, so they track the diamond as it scales:
     1st (152,100)  2nd (100,48)  3rd (48,100) */
.gc-field-wrap {
  position: relative; width: 100%; max-width: 260px; margin: 0.6rem auto 0;
}
.gc-field-wrap .gc-diamond { margin: 0; }

.gc-onbase { position: absolute; inset: 0; pointer-events: none; }
.gc-onbase-slot {
  position: absolute; transform: translate(-50%, -50%);
  opacity: 0; transition: opacity 0.18s;
}
.gc-onbase-slot.on { opacity: 1; }
.gc-at1 { left: 76%; top: 55.6%; }
.gc-at2 { left: 50%; top: 26.7%; }
.gc-at3 { left: 24%; top: 55.6%; }

/* Sized to sit on the base without swamping it, and ringed so it still reads
   as "occupied" the way the filled square did. */
.gc-onbase-slot .avatar {
  width: 30px; height: 30px; font-size: 0.6rem;
  box-shadow: 0 0 0 2px var(--clay), 0 1px 3px rgba(0, 0, 0, 0.35);
  background: var(--panel);
}

/* ============================================================== team links
   A club's name opens its roster. Rendered as a button for keyboard and
   screen-reader users, so the browser's own button styling has to come off
   first -- otherwise it arrives with a border, a background and the wrong
   font in the middle of a table row. */
.team-link {
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; text-align: left;
  cursor: pointer; border-bottom: 1px solid transparent;
}
.team-link:hover,
.team-link:focus-visible { border-bottom-color: currentColor; }
.team-link:focus-visible { outline: 2px solid var(--field); outline-offset: 2px; }

/* The whole standings row is a target; the underline on hover is what says
   so, since a bare pointer on a table row is easy to miss. */
tr.team-row.clickable { cursor: pointer; }
tr.team-row.clickable:hover { background: var(--chip); }
tr.team-row.clickable:hover .team-link { border-bottom-color: currentColor; }
