/* Fantasy dashboard -- dark broadcast look.
 *
 * Bootstrap 5.3 ships a native dark mode, switched on by data-bs-theme="dark"
 * in app.py. That gives every stock component a sane dark baseline for free;
 * this file redefines the --bs-* variables it reads so the baseline lands on
 * our palette, then styles the pieces bslib does not cover.
 *
 * Colors are duplicated in web/theme.py because Plotly renders to canvas and
 * cannot read CSS variables. Change both together.
 *
 * One ground, hairline rules for depth -- no cards, no --surface. --raised
 * is used for hover and the season select only. */

:root {
  --ground:      #0E1116;
  --raised:      #14181E;
  --line:        #1E242D;
  --line-strong: #2A313B;
  --ink:         #F2F5F8;
  --ink-dim:     #98A4B3;
  --ink-mute:    #5E6A78;
  --accent:      #F0631E;
  --win:         #4CB782;
  --loss:        #E4574C;

  --font-body: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  --gutter: 32px;
}

/* Hand our palette to every stock Bootstrap and bslib component. */
:root,
[data-bs-theme="dark"] {
  --bs-body-bg: var(--ground);
  --bs-body-color: var(--ink-dim);
  --bs-emphasis-color: var(--ink);
  --bs-secondary-color: var(--ink-mute);
  --bs-border-color: var(--line-strong);
  --bs-card-bg: var(--ground);
  --bs-card-border-color: var(--line);
  --bs-primary: var(--accent);
  --bs-link-color: var(--accent);
  --bs-link-hover-color: var(--accent);
  --bs-body-font-family: var(--font-body);
  --bs-border-radius: 6px;
}

/* Inputs given no label still emit an empty one, which reserves a line of
 * blank space above every control. */
label.shiny-label-null { display: none !important; }

body {
  background: var(--ground);
  color: var(--ink-dim);
  font-family: var(--font-body);
  /* Digits must not change width between renders -- a score ticking from
   * 99.8 to 100.2 should not shift the label beside it. */
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

html, body { height: auto; overflow-y: auto; }

.bslib-page-fill, .html-fill-container { overflow: visible; }

main, .bslib-page-fill > .container-fluid { max-width: 1600px; margin: 0 auto; padding: 0; }

button { font-family: inherit; }

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 60px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
}

.topbar .mark {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.topbar .mark-block {
  width: 10px;
  height: 20px;
  border-radius: 2px;
  background: var(--accent);
}

.topbar .wordmark {
  font-family: var(--font-body);
  font-weight: 800;
  font-stretch: 118%;
  font-size: 15.5px;
  letter-spacing: 0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.topbar .nav {
  display: flex;
  align-items: center;
  gap: 4px;
  /* Bootstrap's .nav sets flex-wrap: wrap, and a sub-pixel rounding of the
     flexed width is enough to fold the last item onto a second line. */
  flex-wrap: nowrap;
}

.topbar .nav-item {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-mute);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 20px 9px;
  white-space: nowrap;
  cursor: pointer;
  line-height: 1;
}

.topbar .nav-item:hover { color: var(--ink-dim); }

.topbar .nav-item.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.topbar .spacer { flex: 1 1 auto; }

.topbar .season-pick .shiny-input-container,
.topbar .season-pick .form-group { width: auto; max-width: none; margin: 0; }

.topbar .season-pick select {
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  padding: 5px 26px 5px 10px;
  display: inline-block;
  width: auto;
  /* The season-choices sync rebuilds this select mid-session, and the
     rebuilt one can collapse to its padding under width:auto -- a four-digit
     year plus the chevron needs at least this much. */
  min-width: 72px;
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: 14px;
}

.topbar-links a {
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-decoration: none;
  white-space: nowrap;
}

.topbar-links a:hover { color: var(--ink-dim); }

.topbar .synced {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  white-space: nowrap;
}

.topbar .synced::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--win);
}

/* ---------- week rail ---------- */

.weekrail {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px var(--gutter);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.weekrail .eyebrow {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  flex: 0 0 auto;
  margin-right: 4px;
}

.weekrail .week-btn {
  flex: 0 0 auto;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: none;
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.weekrail .week-btn:hover { color: var(--ink-dim); background: var(--raised); }

.weekrail .week-btn.active {
  background: var(--raised);
  border-color: var(--line-strong);
  color: var(--ink);
}

.weekrail .week-btn.round {
  min-width: auto;
  padding: 0 10px;
  font-size: 11px;
}

/* A playoff round reuses the weekly scorebug, with each side's week-by-week
   split under its name -- the round total is what decided the game, and the
   split is what a reader wants next. */
.scorebug .round-weeks {
  display: flex;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  white-space: nowrap;
}

.scorebug .side.lose .round-weeks { opacity: 0.75; }

/* ---------- generic screen scaffolding ---------- */

.screen { padding: 30px var(--gutter) 60px; }

.title-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.screen-title {
  font-family: var(--font-body);
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.04em;
  color: var(--ink);
  margin: 0;
}

.screen-title.wk { font-size: 46px; }
.screen-title.board { font-size: 38px; }

.stamp {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.headline {
  font-size: 21px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--ink);
  max-width: 46ch;
  text-wrap: pretty;
  margin: 14px 0 26px;
}

.screen-note {
  font-size: 16px;
  color: var(--ink-dim);
  max-width: 62ch;
  margin: 10px 0 26px;
}

.screen-note b { color: var(--ink); font-weight: 600; }

/* ---------- segmented controls (scope / sort) ---------- */

.controlrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

#scope-sort-wrap,
#draft-controls-wrap {
  padding: 30px var(--gutter) 0;
}

#draft-controls-wrap { display: none; }

.controlrow .left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.range-note {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.control {
  display: flex;
  align-items: center;
  gap: 9px;
}

.control-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  white-space: nowrap;
}

.segment {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--ground);
}

.segment .shiny-input-container,
.segment .form-group { width: auto; max-width: none; margin: 0; }

.segment .shiny-options-group {
  display: inline-flex;
  gap: 2px;
}

.segment .radio,
.segment .form-check { margin: 0; padding: 0; min-height: 0; }

.segment input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }

.segment label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 7px 14px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}

.segment label:hover { color: var(--ink-dim); }

.segment label:has(input[type="radio"]:checked) {
  background: var(--raised);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.segment label:has(input[type="radio"]:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---------- This week: body grid ---------- */

.week-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 40px;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 6px;
}

.results { margin-bottom: 30px; }

.scorebug {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 20px 96px minmax(0, 1fr) 104px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  gap: 6px;
}

.scorebug:hover { background: var(--raised); }
.scorebug:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.scorebug .side { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.scorebug .side.left { align-items: flex-end; text-align: right; }
.scorebug .side.right { align-items: flex-start; text-align: left; }

.scorebug .name {
  font-size: 16.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.scorebug .side.win .name { color: var(--ink); }
.scorebug .side.lose .name { color: var(--ink-mute); }

.scorebug .score {
  font-family: var(--font-body);
  font-weight: 800;
  font-stretch: 125%;
  font-size: 28px;
  text-align: center;
}

.scorebug .side.win .score { color: var(--ink); }
.scorebug .side.lose .score { color: var(--ink-mute); }

.scorebug .delta {
  font-family: var(--font-mono);
  font-size: 9.5px;
  opacity: 0.75;
}

.scorebug .delta.over { color: var(--win); }
.scorebug .delta.under { color: var(--loss); }

.scorebug .dash { text-align: center; color: var(--line-strong); font-size: 20px; }

.scorebug .margin {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  text-align: right;
}

.scorebug .margin.nailbiter { color: var(--accent); }

/* ---------- team logos ---------- */

/* One class everywhere a logo appears; the variants only change size.
   Every team has an image -- a stored logo or the generated monogram -- so
   rows never mix a logo'd team with a logo-less one at different indents. */
.team-logo {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--raised);
}

.name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.pill-logo { width: 16px; height: 16px; }

.profile-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.profile-logo { width: 44px; height: 44px; }

.h2h-logo { width: 16px; height: 16px; }

.h2h-head-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ---------- next up ---------- */

/* No cards -- each matchup is a block closed by the same hairline the
   scorebug rows use, with the bug's own rule turned off so the probability
   bar and series note sit inside the block. */
.nextup-list { display: flex; flex-direction: column; }

.nextup-card {
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--line);
}

.nextup-card .scorebug { border-bottom: 0; }

/* Neither side has won yet, so both names stay full-ink. */
.nu-bug .side .name { color: var(--ink); cursor: pointer; }
.nu-bug .score { color: var(--ink); }

.nu-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-mute);
  white-space: nowrap;
}

.nu-pips { margin-top: 2px; }

.nu-prob { padding: 2px 0 0; }

.nu-prob-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
}

.nu-prob-num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-mute);
}

.nu-prob-num.left { text-align: right; }
.nu-prob-num.right { text-align: left; }

.nu-prob-track {
  position: relative;
  height: 5px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--loss) 35%, transparent);
  overflow: hidden;
}

.nu-prob-fill {
  height: 100%;
  background: var(--win);
  border-radius: 3px 0 0 3px;
}

.nu-rivalry { margin-top: 8px; }

/* Every past meeting, one pip each, grouped under its season. */
.nu-series {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
  margin-top: 6px;
}

.nu-series-season { display: inline-flex; align-items: center; gap: 5px; }

.nu-series-year {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-mute);
}

.nu-series .pip { width: 9px; height: 9px; cursor: help; }

/* A postseason meeting carries a ring. */
.nu-series .pip.post { outline: 1.5px solid var(--ink); outline-offset: 1px; }

.nu-rivalry-detail {
  max-width: 62ch;
  margin: 6px auto 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-mute);
}

.profile-lineage {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ink-mute);
}

.nu-h2h {
  margin: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ---------- against their own average ---------- */

.avgrows { display: flex; flex-direction: column; }

.avgrow {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr) 62px;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.avgrow .team {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avgrow .track {
  position: relative;
  height: 8px;
}

.avgrow .track::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line-strong);
}

.avgrow .bar {
  position: absolute;
  top: 0;
  height: 8px;
  border-radius: 2px;
}

.avgrow .bar.over { left: 50%; background: var(--win); }
.avgrow .bar.under { right: 50%; background: var(--loss); }

.avgrow .value {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-align: right;
}

.avgrow .value.over { color: var(--win); }
.avgrow .value.under { color: var(--loss); }

/* ---------- right rail: movers / week bests ---------- */

.rail-block { margin-bottom: 30px; }

.moverrow {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.moverrow:hover { background: var(--raised); }

.moverrow .rank {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.moverrow .name {
  font-size: 13.5px;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.moverrow .move {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

.moverrow .move.up { color: var(--win); }
.moverrow .move.down { color: var(--loss); }
.moverrow .move.mute { color: var(--ink-mute); }

.bestrow {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bestrow:hover { background: var(--raised); }

.bestrow .stack { min-width: 0; }

.bestrow .label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  display: block;
}

.bestrow .team {
  font-size: 13.5px;
  color: var(--ink);
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bestrow .value {
  font-family: var(--font-body);
  font-weight: 800;
  font-stretch: 125%;
  font-size: 21px;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}

/* ---------- league: standings board ---------- */

.board-head,
.board-row {
  display: grid;
  grid-template-columns: 44px 1fr 92px 108px 216px 128px;
  align-items: center;
  gap: 8px;
}

.board-head {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-strong);
}

.board-head .col {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.board-row {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.board-row:hover { background: var(--raised); }

.board-row .seed {
  font-family: var(--font-body);
  font-weight: 800;
  font-stretch: 125%;
  font-size: 21px;
  color: var(--ink-mute);
}

.board-row.seed-1 .seed { color: var(--accent); }

.board-row .team-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }

.board-row .colorbar { width: 3px; height: 26px; border-radius: 2px; flex: 0 0 auto; }

.board-row .team-name {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.streak-chip {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

.streak-chip.w { background: rgba(76, 183, 130, 0.14); color: var(--win); }
.streak-chip.l { background: rgba(228, 87, 76, 0.13); color: var(--loss); }

.board-row .record {
  font-family: var(--font-body);
  font-weight: 800;
  font-stretch: 125%;
  font-size: 21px;
  color: var(--ink);
  text-align: right;
  padding-right: 18px;
}

.form-pips { display: flex; gap: 3px; }

.form-pips .pip {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.form-pips .pip.w { background: var(--win); }
.form-pips .pip.l { background: var(--loss); }
.form-pips .pip.t { background: var(--ink-mute); }

.points-stack { display: flex; gap: 14px; }

.points-stack .pair { display: flex; flex-direction: column; gap: 2px; }

.points-stack .plabel {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.points-stack .pvalue {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-dim);
}

.points-stack .pvalue.pos { color: var(--win); }
.points-stack .pvalue.neg { color: var(--loss); }

.board-row .trend { display: flex; justify-content: flex-end; }

/* ---------- draft board ---------- */

.draft-search .shiny-input-container,
.draft-search .form-group { width: auto; max-width: none; margin: 0; }

.draft-search input[type="text"] {
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 6px 10px;
  width: 180px;
}

.draft-search input[type="text"]::placeholder { color: var(--ink-mute); }

.draft-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.draft-table { min-width: 720px; }

.draft-head,
.draft-row {
  display: grid;
  grid-template-columns: var(--draft-cols);
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}

.draft-head {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-strong);
}

.draft-head .col {
  background: none;
  border: none;
  padding: 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  cursor: pointer;
  white-space: nowrap;
}

.draft-head .col:nth-child(2) { text-align: left; }

.draft-head .col.active { color: var(--accent); }

.draft-head .col:hover { color: var(--ink-dim); }

.draft-row {
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
}

.draft-row:hover { background: var(--raised); }

.draft-row .dcell {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-dim);
  text-align: right;
  white-space: nowrap;
}

.draft-row .dcell.player { text-align: left; min-width: 0; }

.draft-row .dcell.club {
  text-align: left;
  font-family: var(--font-body);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.draft-row .dcell.rk {
  font-family: var(--font-body);
  font-weight: 800;
  font-stretch: 125%;
  font-size: 16px;
  color: var(--ink-mute);
}

.draft-row .dcell.fpts {
  font-weight: 600;
  color: var(--ink);
  font-size: 13.5px;
}

.dcell .delta-pos { color: var(--win); }
.dcell .delta-neg { color: var(--loss); }

/* ---------- draft: steals & reaches chips ---------- */

.draft-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 22px;
}

.draft-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12.5px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.tag.steal { color: var(--win); }
.tag.reach { color: var(--loss); }

.pick-name { color: var(--ink); font-weight: 600; }

.pick-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  white-space: nowrap;
}

/* ---------- draft: board grid ---------- */

.draft-grid-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 40px;
}

.draft-grid {
  display: grid;
  grid-template-columns: var(--grid-cols);
  gap: 4px;
  min-width: 1000px;
}

.gcell { min-width: 0; }

.gcell.ghead {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line-strong);
}

.gcell.ghead .gclub {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.glogo { width: 18px; height: 18px; border-radius: 4px; flex: 0 0 auto; }

.gcell.gr-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-mute);
}

.gcell.gplayer {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 4px;
}

.gcell.gempty { border: 1px dashed var(--line); border-radius: 4px; }

.gtop {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
}

.gpick {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-mute);
}

.gname {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The position's color as the cell's left edge, so runs read as stripes
 * of color down the board. Hexes match .pos-badge above. */
.gcell.gpos-qb { border-left-color: #66CCEE; }
.gcell.gpos-rb { border-left-color: #EE9944; }
.gcell.gpos-wr { border-left-color: #6699DD; }
.gcell.gpos-te { border-left-color: #44BB77; }
.gcell.gpos-k { border-left-color: #DDCC55; }
.gcell.gpos-dst { border-left-color: #AAAAAA; }

/* ---------- draft: club report cards ---------- */

.club-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 30px;
}

.club-cards.single { grid-template-columns: minmax(240px, 420px); }

.club-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
}

.card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.card-rank {
  font-family: var(--font-body);
  font-weight: 800;
  font-stretch: 125%;
  font-size: 18px;
  color: var(--ink-mute);
}

.card-club {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-projrow { display: flex; align-items: baseline; gap: 8px; }

.card-proj {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}

.card-proj-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
}

.card-shape {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-dim);
  margin: 6px 0 10px;
}

.card-pick {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
  padding: 3px 0;
  min-width: 0;
}

.card-pick .pick-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.player-cell .pname {
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inj {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(228, 87, 76, 0.13);
  color: var(--loss);
  flex: 0 0 auto;
}

.pos-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.pos-badge.pos-qb { color: #66CCEE; }
.pos-badge.pos-rb { color: #EE9944; }
.pos-badge.pos-wr { color: #6699DD; }
.pos-badge.pos-te { color: #44BB77; }
.pos-badge.pos-k { color: #DDCC55; }
.pos-badge.pos-dst { color: #AAAAAA; }

.cutoff-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.cutoff-row::before,
.cutoff-row::after {
  content: "";
  flex: 1 1 auto;
  border-top: 1px dashed var(--accent);
}

.cutoff-row .label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

.race-wrap { padding: 0 var(--gutter) 60px; margin-top: 34px; }

/* ---------- teams: team rail ---------- */

.teamrail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.team-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: none;
  color: var(--ink-mute);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.team-pill .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }

.team-pill.active {
  background: var(--raised);
  border-color: var(--line-strong);
  color: var(--ink);
}

.team-pill:hover:not(.active) { color: var(--ink-dim); }

/* ---------- teams: profile header ---------- */

.profile {
  border-top: 3px solid var(--accent);
  margin-bottom: 24px;
}

.profile-head {
  padding: 28px var(--gutter) 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.profile-head .eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  display: block;
  margin-bottom: 6px;
}

.profile-head .team-name {
  font-family: var(--font-body);
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: -0.035em;
  font-size: 44px;
  color: var(--ink);
  text-wrap: balance;
  margin: 0;
}

.profile-head .record-streak {
  font-family: var(--font-body);
  font-weight: 800;
  font-stretch: 125%;
  font-size: 34px;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
}

.profile-stats .cell {
  padding: 20px var(--gutter);
  border-left: 1px solid var(--line);
}

.profile-stats .cell:first-child { border-left: 0; padding-left: var(--gutter); }

.profile-stats .k {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  display: block;
  margin-bottom: 6px;
}

.profile-stats .v {
  font-family: var(--font-body);
  font-weight: 800;
  font-stretch: 125%;
  font-size: 32px;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.profile-stats .sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  display: block;
  margin-top: 4px;
}

/* ---------- teams: body ---------- */

.team-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 40px;
  padding: 0 var(--gutter) 60px;
}

.gamelog-row {
  display: grid;
  grid-template-columns: 40px 26px minmax(0, 1fr) 74px 74px 84px;
  align-items: center;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.gamelog-row .wk {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
}

.gamelog-row .res {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
}

.gamelog-row .res.win { color: var(--win); }
.gamelog-row .res.loss { color: var(--loss); }
.gamelog-row .res.mute { color: var(--ink-mute); }

.gamelog-row .opp {
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gamelog-row .score {
  font-family: var(--font-body);
  font-weight: 800;
  font-stretch: 125%;
  font-size: 17px;
  color: var(--ink);
  text-align: right;
}

.gamelog-row .oscore {
  font-family: var(--font-mono);
  color: var(--ink-mute);
  text-align: right;
  font-size: 12px;
}

.gamelog-row .delta {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.8;
  text-align: right;
}

.gamelog-row .delta.over { color: var(--win); }
.gamelog-row .delta.under { color: var(--loss); }

/* ---------- teams: range vs the league ---------- */

.range-block { margin: 4px 0 24px; }

.range-track {
  position: relative;
  height: 44px;
}

.range-track .line {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
}

.range-track .band {
  position: absolute;
  top: 14px;
  height: 16px;
  border-radius: 2px;
}

.range-track .tick {
  position: absolute;
  top: 8px;
  width: 2px;
  height: 28px;
}

.range-track .tick.mine { background: var(--ink); }
.range-track .tick.league { background: var(--ink-mute); }

.range-values {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 6px;
}

.range-legend {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
}

.range-legend .item { display: flex; align-items: center; gap: 6px; }

.range-legend .swatch { width: 10px; height: 10px; border-radius: 2px; }

/* ---------- teams: head to head ---------- */

.h2h-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px 96px 48px;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.h2h-row .opp {
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.h2h-row .record {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
}

.h2h-row .bar-track {
  position: relative;
  height: 10px;
}

.h2h-row .bar-track::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -4px;
  bottom: -4px;
  width: 1px;
  background: var(--line-strong);
}

.h2h-row .bar {
  position: absolute;
  top: 0;
  height: 10px;
  border-radius: 2px;
}

.h2h-row .bar.pos { left: 50%; background: var(--win); }
.h2h-row .bar.neg { right: 50%; background: var(--loss); }

/* ---------- head-to-head matrix (league + team screens) ---------- */

/* ---------- League: trade ledger ---------- */

.trades-section { margin-top: 34px; }

.trade-row {
  display: flex;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.trade-date {
  flex: 0 0 64px;
  padding-top: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.trade-sides {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 28px;
  min-width: 0;
}

.trade-team {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  min-width: 0;
}

.trade-team:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.trade-team-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trade-recv {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.trade-player {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 0;
  font-size: 13px;
}

.trade-pos {
  flex: 0 0 28px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-mute);
}

.trade-player-name { color: var(--ink-dim); }

.h2h-section { margin-top: 34px; }

.h2h-matrix {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.h2h-grid-row {
  display: grid;
  grid-template-columns: 120px repeat(var(--h2h-cols), minmax(64px, 1fr));
}

.h2h-grid-row.dim { opacity: 0.4; }
.h2h-grid-row.raised { opacity: 1; }

.h2h-corner,
.h2h-col-head,
.h2h-row-head {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  padding: 8px 6px;
  /* Flex rather than plain ellipsed text, so the logo keeps its size and
     only the name span truncates. */
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

/* Centred over the cells they head. Left-aligned labels above centred
   records read as a grid that has slipped a column, which it has not. */
.h2h-col-head { justify-content: center; }

.h2h-row-head {
  position: sticky;
  left: 0;
  background: var(--ground);
  border-right: 1px solid var(--line);
}

.h2h-col-head.raised,
.h2h-row-head.raised { color: var(--ink); font-weight: 700; }

.h2h-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.h2h-cell.raised { box-shadow: inset 0 0 0 1px var(--accent); }

.h2h-cell.blank,
.h2h-cell.empty {
  background: var(--ground);
  cursor: default;
}

.h2h-cell-record {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
}

.h2h-cell-margin {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-mute);
}

/* ---------- records: ledger ---------- */

.records-section-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 34px 0 6px;
}

.records-section-title:first-of-type { margin-top: 10px; }

.records-alltime-note {
  text-transform: none;
  letter-spacing: normal;
  font-size: 12px;
  color: var(--ink-mute);
  max-width: 68ch;
  margin-bottom: 10px;
}

.ledger-group { margin-bottom: 30px; }

.ledger-heading {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 6px;
}

.ledger-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 170px 96px;
  align-items: center;
  gap: 16px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.ledger-row:hover { background: var(--raised); }

.ledger-row .glyph { font-size: 21px; text-align: center; }

.ledger-row .stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.ledger-row .award {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.ledger-row .team {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ledger-row .scoreline {
  font-size: 13px;
  color: var(--ink-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ledger-row .value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--font-body);
  font-weight: 800;
  font-stretch: 125%;
  font-size: 27px;
  line-height: 1.05;
  color: var(--ink);
  text-align: right;
}

.ledger-row .value .unit {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  font-stretch: normal;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 3px;
  white-space: nowrap;
}

.ledger-row .meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.ledger-row .weekbadge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.ledger-row .arrow { color: var(--ink-mute); }

/* ---------- plotly ---------- */

.chart-wrap { min-height: 380px; }
.chart-wrap .js-plotly-plot { width: 100% !important; }

.modebar { background: transparent !important; }
.modebar-btn path { fill: var(--ink-mute) !important; }
.modebar-btn:hover path { fill: var(--ink) !important; }

.modebar-btn--logo,
.modebar-btn[data-title="Lasso Select"],
.modebar-btn[data-title="Box Select"],
.modebar-btn[data-title="Zoom in"],
.modebar-btn[data-title="Zoom out"],
.modebar-btn[data-title="Autoscale"] { display: none !important; }

/* ---------- misc ---------- */

.empty-note {
  font-size: 0.92rem;
  color: var(--ink-dim);
  margin: 0.15rem 0 0.9rem;
}

.footnote {
  font-size: 0.76rem;
  line-height: 1.6;
  color: var(--ink-mute);
  max-width: 46rem;
  padding: 0 var(--gutter);
  margin: 1rem auto 2.5rem;
}

.footnote-links { display: none; }

.footnote-links a {
  color: var(--ink-mute);
  text-decoration: underline;
}

/* Focus is always visible, everywhere -- the same treatment the trophy
 * cards used before the redesign. */
.scorebug:focus-visible,
.moverrow:focus-visible,
.bestrow:focus-visible,
.board-row:focus-visible,
.team-pill:focus-visible,
.ledger-row:focus-visible,
.nav-item:focus-visible,
.week-btn:focus-visible,
.draft-head .col:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- mobile bottom bar ---------- */

.bottombar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #0E1116;
  border-top: 1px solid var(--line-strong);
  padding-bottom: 10px;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  z-index: 40;
}

.bottombar .bb-item {
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
}

.bottombar .bb-bar {
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: var(--line-strong);
}

.bottombar .bb-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.bottombar .bb-item.active .bb-bar { background: var(--accent); }
.bottombar .bb-item.active .bb-label { color: var(--ink); }

/* ---------- narrow screens (640px breakpoint) ---------- */

/* ---------- small screens ----------
 *
 * Every desktop row here is a wide fixed-column grid, and a phone has no
 * room for the same tracks. The rule each block follows is that the team
 * name survives: it is the one column a reader cannot reconstruct from the
 * others, and collapsing it was how the standings and the record book both
 * ended up rendering rows with no idea who they were about.
 */
/* Six nav items no longer share a 60px bar with the outbound links on a
   middle-width window; the links live in the footnote too, so they go first. */
@media (max-width: 1080px) {
  .topbar-links { display: none; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }

  .topbar .nav { display: none; }
  .topbar-links { display: none; }
  .topbar { gap: 10px; }
  .topbar .mark { min-width: 0; overflow: hidden; }
  .topbar .wordmark { font-size: 13px; }
  .topbar .synced { font-size: 9px; letter-spacing: 0.06em; }
  .topbar .synced::before { width: 5px; height: 5px; }
  .topbar .synced-word { display: none; }
  .topbar .season-pick select {
    padding: 5px 18px 5px 7px;
    font-size: 11px;
    min-width: 58px;
    background-position: right 4px center;
  }

  .footnote-links { display: block; }

  .weekrail { gap: 8px; }
  .weekrail .week-btn {
    min-width: 44px;
    height: 44px;
    border: 1px solid var(--line);
  }

  .screen { padding-bottom: 74px; }
  .screen-title.wk { font-size: 34px; }
  .screen-title.board { font-size: 30px; }

  .controlrow { margin-bottom: 14px; }
  .control { width: 100%; }
  .draft-search { width: 100%; }
  .draft-search input[type="text"] { width: 100%; }
  .bottombar .bb-label { font-size: 8px; letter-spacing: 0.04em; }
  .control-label { flex: 0 0 auto; }
  .segment { flex: 1 1 auto; }
  .segment .shiny-options-group { width: 100%; }
  .segment label { flex: 1; min-height: 40px; display: flex; align-items: center; justify-content: center; }

  /* minmax(0, 1fr) rather than 1fr: a bare 1fr track refuses to shrink
     below its widest child, so one un-wrappable string anywhere in the
     column widened the whole screen. */
  .week-body,
  .team-body { grid-template-columns: minmax(0, 1fr); gap: 24px; }

  /* Scorebug: winner's line, loser's line, margin underneath. The desktop
     six-track grid is placed by meaning rather than by child order, since
     two of the six children share the .score class. */
  .scorebug {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
    padding: 12px 0;
  }

  .scorebug .side.left { grid-area: 1 / 1; align-items: flex-start; text-align: left; }
  .scorebug .side.left + .score { grid-area: 1 / 2; }
  .scorebug .dash { display: none; }
  .scorebug .dash + .score { grid-area: 2 / 2; }
  .scorebug .score + .side.right { grid-area: 2 / 1; }
  .scorebug .margin { grid-area: 3 / 1 / auto / -1; text-align: left; }

  .scorebug .name { font-size: 15px; }
  .scorebug .score { font-size: 22px; text-align: right; }

  .avgrow { grid-template-columns: minmax(0, 1fr) 84px 56px; gap: 8px; }
  .avgrow .track { grid-column: 2; }

  .bestrow .value { font-size: 18px; }

  /* Standings: seed, name, record, last five. The desktop template has six
     tracks for six children, but points and trend are hidden here -- leaving
     the four remaining children to land on the first four tracks, which put
     the team name on a 3px sliver meant for the colour bar. */
  .board-head { display: none; }

  .board-row {
    grid-template-columns: 24px minmax(0, 1fr) 56px 72px;
    gap: 8px;
    min-height: 56px;
  }

  .board-row .team-name { font-size: 15px; }
  .board-row .record { font-size: 18px; padding-right: 0; }
  .board-row .streak-chip { display: none; }

  .board-row .points-stack,
  .board-row .trend { display: none; }

  /* Charts stay, but at a width they can actually be read at -- eight bump
     lines squeezed into 343px is a scribble. The wrapper scrolls instead. */
  .chart-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .chart-wrap .js-plotly-plot { min-width: 780px; }

  .teamrail { display: none; }
  .teamrail.draft-clubs { display: flex; flex-wrap: wrap; }
  .team-select-mobile { display: block !important; min-height: 44px; }

  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .profile-stats .cell { padding: 14px var(--gutter); border-top: 1px solid var(--line); }
  .profile-stats .cell:nth-child(odd) { border-left: 0; }
  .profile-stats .v { font-size: 26px; }

  /* Game log: week, result, opponent and this team's score on one line;
     the opponent's score and the projection delta on the next. */
  .gamelog-row {
    grid-template-columns: 38px 20px minmax(0, 1fr) 58px;
    gap: 2px 8px;
  }

  .gamelog-row .oscore { grid-column: 3; text-align: left; }
  .gamelog-row .oscore::before { content: "vs "; }
  .gamelog-row .delta { grid-column: 4; }

  .scorebug .round-weeks { gap: 8px; font-size: 10px; }

  /* Record book: glyph and award text on one line with the value, the week
     badge on the next. The desktop tracks alone add up to more than a phone
     is wide, which collapsed the award text to nothing. */
  .ledger-row {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 4px 10px;
  }

  .ledger-row .value { font-size: 21px; }
  .ledger-row .meta { grid-column: 2 / -1; justify-content: flex-start; }
  .ledger-row .scoreline { white-space: normal; }

  .h2h-grid-row { grid-template-columns: 96px repeat(var(--h2h-cols), minmax(58px, 1fr)); }

  .bottombar { display: grid; }
}

.team-select-mobile { display: none; }

/* ---------- This week: recap ---------- */

/* Prose from the Tuesday recap job. Measured for reading, not for the
   1600px grid the results sit on. */
.recap-section { margin-top: 44px; max-width: 760px; }

.recap-title {
  font-family: var(--font-body);
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: -0.03em;
  font-size: 30px;
  line-height: 1.15;
  color: var(--ink);
  text-wrap: balance;
  margin: 0 0 16px;
}

.recap-body {
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-dim);
  text-wrap: pretty;
}

.recap-body p { margin: 0 0 14px; }

/* The lead paragraph carries the week; it reads at headline weight. */
.recap-body > p:first-child { font-size: 18.5px; line-height: 1.5; color: var(--ink); }

.recap-body h2 {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 28px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.recap-body h3 { font-size: 15px; font-weight: 700; color: var(--ink); margin: 18px 0 6px; }
.recap-body strong { color: var(--ink); font-weight: 600; }
.recap-body ul, .recap-body ol { padding-left: 20px; margin: 0 0 14px; }
.recap-body li { margin-bottom: 6px; }
.recap-body a { color: var(--accent); }

/* ---------- Teams: week by week ---------- */

.team-strip { padding: 0 var(--gutter); margin-bottom: 34px; }

/* --n is the number of played weeks, set inline, so three early-season
   bars do not each stretch to a third of the screen. */
.weekbars-block { --n: 14; max-width: calc(var(--n) * 80px); }

.weekbars-wrap { position: relative; height: 150px; margin-top: 18px; }

.weekbars { display: flex; align-items: flex-end; gap: 8px; height: 100%; }

.weekbar { position: relative; flex: 1 1 0; height: 100%; min-width: 0; }

.weekbar .bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 3px 3px 0 0;
  background: var(--line-strong);
}

/* A tint with a solid top edge, like the head-to-head cells: fourteen
   fully saturated bars in a row shouted over the rest of the page. */
.weekbar .bar.win { background: color-mix(in srgb, var(--win) 34%, transparent); border-top: 2px solid var(--win); }
.weekbar .bar.loss { background: color-mix(in srgb, var(--loss) 34%, transparent); border-top: 2px solid var(--loss); }

.weekbar .bar-val {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-dim);
}

.weekbars-avg {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed var(--ink-mute);
  pointer-events: none;
}


.weekbars-weeks { display: flex; gap: 8px; margin-top: 6px; }

.weekbars-weeks .bar-wk {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-mute);
}

.weekbars-weeks .bar-wk.win { color: var(--win); }
.weekbars-weeks .bar-wk.loss { color: var(--loss); }

/* ---------- Teams: head to head list ---------- */

.h2h-list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px 96px 48px;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-strong);
}

.h2h-list-head .col {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.h2h-list-head .col:nth-child(2) { text-align: center; }

.h2h-row { cursor: pointer; }
.h2h-row:hover { background: var(--raised); }
.h2h-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.h2h-row .opp { display: flex; align-items: center; gap: 8px; min-width: 0; }

.h2h-row .opp-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.h2h-row .margin {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  text-align: right;
  color: var(--ink-mute);
}

.h2h-row .margin.pos { color: var(--win); }
.h2h-row .margin.neg { color: var(--loss); }

.h2h-unplayed {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  margin: 10px 0 0;
}

@media (max-width: 640px) {
  .recap-title { font-size: 24px; }
  .recap-body > p:first-child { font-size: 17px; }

  .weekbars-block { max-width: none; }
  .weekbars-wrap { height: 110px; }
  .weekbars, .weekbars-weeks { gap: 3px; }
  .weekbar .bar-val { display: none; }

  .h2h-list-head,
  .h2h-row { grid-template-columns: minmax(0, 1fr) 36px 64px 44px; gap: 6px; }
}

/* ---------- League: moves ledger, power rankings ---------- */

.ledgers {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 40px;
}

.moves-section { margin-top: 34px; }

.move-group { padding: 8px 0 4px; border-bottom: 1px solid var(--line); }

.move-day {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  margin-bottom: 4px;
}

.move-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) 58px minmax(0, 1.2fr) 32px;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
  cursor: pointer;
}

.move-row:hover { background: var(--raised); }
.move-logo { width: 16px; height: 16px; }
.move-team { color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.move-verb { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.move-verb.add { color: var(--win); }
.move-verb.drop { color: var(--loss); }
.move-player { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.move-pos { font-family: var(--font-mono); font-size: 10px; color: var(--ink-mute); text-align: right; }

.power-section .recap-body ol { padding-left: 24px; }
.power-section .recap-body li { margin-bottom: 10px; }
.power-section .recap-body li::marker { font-family: var(--font-mono); color: var(--accent); font-weight: 700; }

/* ---------- Teams: manager's log ---------- */

.managers-log { margin-top: 30px; }

.log-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.log-when { font-family: var(--font-mono); font-size: 10px; color: var(--ink-mute); padding-top: 2px; }
.log-stack { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.log-what { font-size: 13.5px; color: var(--ink); }
.log-why { font-size: 12.5px; color: var(--ink-dim); line-height: 1.4; }

@media (max-width: 640px) {
  .ledgers { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .move-row { grid-template-columns: 16px minmax(0, 1fr) 52px minmax(0, 1fr); }
  .move-pos { display: none; }
}

/* ---------- Chat ---------- */

.chat-screen { display: none; }

.chat-gate { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0 24px; }
.chat-gate .form-group { margin: 0; }
.chat-gate input.form-control { min-width: 260px; }

.btn-accent {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-accent:hover { filter: brightness(1.1); }

/* The chat component ships its own light styling; keep it on our ground. */
shiny-chat-container {
  --shiny-chat-border: 1px solid var(--line);
  --shiny-chat-user-message-bg: var(--raised);
  background: transparent;
  font-family: var(--font-body);
  margin-top: 16px;
}

shiny-chat-container .message { font-size: 15px; line-height: 1.55; }
shiny-chat-container table { font-size: 13.5px; }
shiny-chat-container th, shiny-chat-container td { padding: 4px 10px; border-bottom: 1px solid var(--line); }
shiny-chat-container th { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-mute); }

/* ---------- League analytics: luck, odds, projection ---------- */

.analytics-wrap { display: none; }
.screen-top { padding-bottom: 0; }
.screen-bottom { padding-top: 0; }

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  margin-top: 14px;
}

.chart-square { min-height: 460px; }
.chart-short { min-height: 300px; }

.luck-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px 64px 68px 56px;
  gap: 8px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.luck-row:hover { background: var(--raised); }
.luck-head { cursor: default; border-bottom: 1px solid var(--line-strong); }
.luck-head:hover { background: none; }
.luck-head .col { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute); text-align: right; }
.luck-head .col:first-child { text-align: left; }
.luck-team { color: var(--ink); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.luck-num { font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim); text-align: right; }
.luck-num.luck-pos { color: var(--win); font-weight: 700; }
.luck-num.luck-neg { color: var(--loss); font-weight: 700; }

/* ---------- Teams: bench regrets ---------- */

.regrets-block { margin-top: 30px; }
.regret-summary { font-size: 14px; color: var(--ink-dim); margin: 0 0 8px; line-height: 1.45; }

.regret-row {
  display: grid;
  grid-template-columns: 40px 52px 16px 52px 52px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
}

.regret-row .wk { color: var(--ink-mute); font-size: 10px; }
.regret-row .started { color: var(--ink-dim); text-align: right; }
.regret-row .arrow { color: var(--ink-mute); text-align: center; }
.regret-row .optimal { color: var(--ink); font-weight: 600; text-align: right; }
.regret-row .regret { color: var(--loss); text-align: right; }
.regret-row .flip { font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); padding-left: 6px; }

/* ---------- Draft return ---------- */

.dr-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-top: 18px; }

.dr-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr) 56px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 13.5px;
}

.dr-row:hover { background: var(--raised); }
.dr-pick { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); }
.dr-player { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-team { color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.dr-delta { font-family: var(--font-mono); font-size: 12px; font-weight: 700; text-align: right; }
.dr-delta.steal { color: var(--win); }
.dr-delta.bust { color: var(--loss); }

/* ---------- Players ---------- */

.pl-table { margin-top: 8px; }

.pl-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1.6fr) 40px minmax(0, 1.4fr) 60px 72px 56px 88px 52px 52px;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.pl-row:hover { background: var(--raised); }
.pl-head { cursor: default; border-bottom: 1px solid var(--line-strong); }
.pl-head:hover { background: none; }
.pl-head .col { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute); text-align: right; }
.pl-head .col:nth-child(-n+4) { text-align: left; }
.pl-rank { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); }
.pl-name { color: var(--ink); font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-pos { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-mute); }
.pl-team { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--ink-dim); font-size: 13px; }
.pl-logo { width: 16px; height: 16px; }
.pl-team-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-num { font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim); text-align: right; }
.pl-points { color: var(--ink); font-weight: 700; font-size: 13px; }
.pl-sub { font-size: 9.5px; color: var(--ink-mute); }
.pl-boom { color: var(--win); }
.pl-bust { color: var(--loss); }

/* ---------- Records: bracket ---------- */

.bracket-section { margin-top: 40px; }

.bracket { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 24px; overflow-x: auto; }

.bk-game { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; }
.bk-game.final { border-color: var(--accent); }
.bk-game.consolation { opacity: 0.6; }
.bk-kind { display: block; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 4px; }
.bk-game.final .bk-kind { color: var(--accent); }

.bk-side { display: grid; grid-template-columns: 16px 20px minmax(0, 1fr) 52px; gap: 6px; align-items: center; padding: 4px 0; cursor: pointer; color: var(--ink-dim); }
.bk-side.win { color: var(--ink); font-weight: 600; }
.bk-logo { width: 16px; height: 16px; }
.bk-seed { font-family: var(--font-mono); font-size: 10px; color: var(--ink-mute); }
.bk-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.bk-score { font-family: var(--font-mono); font-size: 12.5px; text-align: right; }

@media (max-width: 640px) {
  .analytics-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .chart-square { min-height: 360px; }
  .luck-row { grid-template-columns: minmax(0, 1fr) 46px 56px 56px 48px; gap: 4px; }
  .dr-lists { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .pl-row { grid-template-columns: 22px minmax(0, 1.5fr) minmax(0, 1fr) 64px; gap: 6px; }
  .pl-row > :nth-child(3), .pl-row > :nth-child(5), .pl-row > :nth-child(7), .pl-row > :nth-child(8),
  .pl-row > :nth-child(9), .pl-row > :nth-child(10) { display: none; }
  .regret-row { grid-template-columns: 36px 48px 14px 48px 48px minmax(0, 1fr); gap: 4px; }
}

.draftret-wrap { padding-top: 30px; padding-bottom: 20px; margin-top: 0; }
.draftret-wrap .screen-title { margin-bottom: 4px; }
