/* 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: 28px;
  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;
}

.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 12px;
  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;
}

.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);
}

/* ---------- 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;
}

.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);
}

.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); }

/* ---------- 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 .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;
}

.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; }

.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(4, 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) 42px 96px;
  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); }

/* ---------- records: ledger ---------- */

.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 {
  font-family: var(--font-body);
  font-weight: 800;
  font-stretch: 125%;
  font-size: 27px;
  color: var(--ink);
  text-align: right;
}

.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;
}

/* 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 {
  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-template-columns: repeat(4, 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) ---------- */

@media (max-width: 640px) {
  :root { --gutter: 16px; }

  .topbar .nav { display: none; }
  .topbar { gap: 12px; }

  .weekrail { gap: 8px; }
  .weekrail .week-btn {
    min-width: 44px;
    height: 44px;
    border: 1px solid var(--line);
  }

  .screen { padding-bottom: 74px; }

  .segment { width: 100%; }
  .segment .shiny-options-group { width: 100%; }
  .segment label { flex: 1; min-height: 40px; display: flex; align-items: center; justify-content: center; }

  .week-body,
  .team-body { grid-template-columns: 1fr; gap: 24px; }

  .scorebug {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px 0;
  }

  .scorebug .row-line {
    display: grid;
    grid-template-columns: 3px minmax(0, 1fr) 78px;
    align-items: center;
    gap: 10px;
    padding: 4px 0 4px 8px;
  }

  .scorebug .row-line.win { border-left: 3px solid var(--accent); }
  .scorebug .row-line .name { font-size: 15px; }
  .scorebug .row-line .score { font-size: 22px; }
  .scorebug .caption {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ink-mute);
    padding-left: 8px;
    margin-top: 2px;
  }

  .board-head { display: none; }

  .board-row {
    grid-template-columns: 24px 3px minmax(0, 1fr) 74px;
    min-height: 56px;
  }

  .board-row .points-stack,
  .board-row .trend { display: none; }

  .race-wrap { display: none; }

  .teamrail { display: none; }
  .team-select-mobile { display: block !important; min-height: 44px; }

  .bottombar { display: grid; }
}

.team-select-mobile { display: none; }
