:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #15191f;
  --muted: #4b5563;
  --border: #c5ccd6;
  --accent: #0b5cad;
  --accent-text: #ffffff;
  --turn: #8a4b00;
  --turn-bg: #fff3dc;
  --blue: #1f5fbf;
  --red: #b3261e;
  --chip-text: #ffffff;
  --focus: #b45309;
  --good: #146c2e;
  --bad: #a31616;
  --fa: #fff7e0;
  --blue-d: #153a7a;
  --red-d: #761a14;
  --bd-dk-b: #1b2a55;
  --bd-pale-b: #bcd2f5;
  --bd-dk-r: #55201d;
  --bd-pale-r: #f3bdb7;
  --tier-gold: #d4a72c;
  --tier-silver: #8e96a1;
  --tier-bronze: #b0703c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151b;
    --surface: #1a2029;
    --surface-2: #232b37;
    --text: #e8ecf1;
    --muted: #aab3bf;
    --border: #3a4554;
    --accent: #6fb1ff;
    --accent-text: #08121f;
    --turn: #ffcf8a;
    --turn-bg: #3a2a10;
    --blue: #3b7be0;
    --red: #d0453b;
    --chip-text: #ffffff;
    --focus: #ffb454;
    --good: #6fd68a;
    --bad: #ff8a80;
    --fa: #2b2713;
    --blue-d: #1a3f80;
    --red-d: #8a2a22;
    --tier-silver: #b8bec6;
  }
}

* { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5rem; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
h4 { font-size: 0.95rem; }
a { color: var(--accent); }
p { margin: 0 0 0.6rem; }
.muted, .sub { color: var(--muted); }
.sub { font-size: 0.85em; font-weight: normal; }
.big { font-size: 1.1rem; font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip-link { position: absolute; left: 0.5rem; top: -4rem; background: var(--surface); padding: 0.4rem 0.7rem; z-index: 10; }
.skip-link:focus { top: 0.5rem; }

/* header */
.top {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; align-items: baseline;
  padding: 0.6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.top.simple { position: static; }
.top h1 a { color: inherit; text-decoration: none; }
.status { display: flex; flex-wrap: wrap; flex: 1 1 0; min-width: 0; gap: 0.2rem 1.5rem; margin: 0; }
.status div { display: flex; gap: 0.4rem; }
.status dt { color: var(--muted); }
.status dt::after { content: ":"; }
.status dd { margin: 0; font-weight: 600; }
.your-turn { color: var(--turn); background: var(--turn-bg); border-radius: 4px; padding: 0.1rem 0.4rem; font-weight: 600; }
p.your-turn { padding: 0.4rem 0.6rem; display: block; }
.conn::before { content: "\25CF  "; }
.conn.live { color: var(--good); }
.conn.connecting, .conn.reconnecting { color: var(--turn); }

/* layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 1rem; padding: 1rem; align-items: start; }
main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.lobby main { max-width: 46rem; margin: 0 auto; padding: 1rem; }
@media (max-width: 62rem) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .log-list { max-height: 14rem; }
}
.panel, .stage, .log {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.8rem 1rem;
}
.log { position: sticky; top: 4.5rem; }
.log-list { list-style: none; margin: 0; padding: 0; max-height: 70vh; overflow-y: auto; font-size: 0.88rem; }
.log-list li { padding: 0.2rem 0.4rem; border-bottom: 1px solid var(--border); }
.log-list li.ev-title { font-weight: 700; }
.log-list li.ev-season { color: var(--text); }
.log-list li.ev-bid, .log-list li.ev-draft { color: var(--muted); }

/* notices */
.notice { padding: 0.5rem 0.8rem; margin: 0.5rem 1rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); }
.notice.error { border-color: var(--bad); color: var(--bad); }
.notice-inline { font-weight: 600; }
.tie-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 700px) { .tie-note { white-space: normal; } }

/* buttons and forms */
button, .button, input, select {
  font: inherit; color: inherit;
}
button, .button {
  display: inline-block; cursor: pointer; text-decoration: none;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem 0.8rem;
}
button.primary, .button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
/* no double-tap zoom on anything you tap (pinch zoom still works: the viewport allows it) */
button, .button, a, summary, select, label, input, [role="tab"], [role="button"], .chip, .token-btn, .tab { touch-action: manipulation; }
input, select { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 0.35rem 0.5rem; }
label { display: block; font-weight: 600; margin-bottom: 0.2rem; }
.field { margin-bottom: 0.8rem; }
.bid-form { display: flex; flex-direction: column; gap: 0.5rem; align-items: stretch; }
.lobby .field select { min-width: 5rem; min-height: 44px; }
.setup { display: flex; gap: 1rem; flex-wrap: wrap; }
.setup .field { margin-bottom: 0.8rem; }
.seat-head, .seat-row { display: grid; grid-template-columns: 2rem minmax(0, 1fr) 6rem 6.5rem 6.5rem; gap: 0.5rem; align-items: center; }
.seat-head { font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.seat-row { margin: 0 0 0.5rem; }
.seat-n { font-weight: 800; text-align: center; }
.all-bots .label { display: block; font-weight: 600; margin-bottom: 0.2rem; }
.bots-seg { display: inline-flex; }
.bots-seg button { min-height: 44px; border-radius: 0; padding: 0 0.8rem; margin-left: -1px; }
.bots-seg button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.bots-seg button:last-child { border-radius: 0 6px 6px 0; }
.bots-seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 700; }
.all-stars-setup { align-items: flex-end; }
.all-stars-help { flex: 1 1 14rem; margin: 0 0 0.8rem; font-size: 0.85rem; align-self: center; }
.lobby input, .lobby select, .lobby .create-row button { min-height: 44px; }
.lobby .create-row button { padding: 0 1.2rem; }
[hidden] { display: none !important; }
.links { list-style: none; padding: 0; display: grid; gap: 0.5rem; }

/* chips */
.chip {
  display: inline-flex; align-items: center; gap: 0.2rem; min-width: 2.7rem; justify-content: center;
  padding: 0.15rem 0.4rem; color: var(--chip-text); font-weight: 700; font-size: 0.95rem; line-height: 1.2;
  border: 2px solid transparent; vertical-align: middle;
}
.chip.blue { background: var(--blue); border-radius: 999px; }
.chip.red { background: var(--red); border-radius: 4px; }
.chip.empty { background: transparent; color: var(--muted); border: 1px dashed var(--border); border-radius: 4px; }
.chip .letter { font-size: 0.75rem; opacity: 0.95; border-right: 1px solid rgba(255, 255, 255, 0.6); padding-right: 0.25rem; }
.chip .dev { background: #fff; color: #14532d; border-radius: 3px; padding: 0 0.2rem; font-size: 0.75rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; }
caption { text-align: left; color: var(--muted); font-size: 0.85rem; padding: 0.4rem 0.6rem; }
th, td { padding: 0.3rem 0.4rem; border-bottom: 1px solid var(--border); text-align: center; vertical-align: middle; }
th[scope="row"], table.plain th, table.plain td, table.boards th:first-child { text-align: left; }
table.plain .num { text-align: right; }
thead th { background: var(--surface-2); font-size: 0.85rem; }
.col-name { display: block; font-size: 0.7rem; font-weight: normal; color: var(--muted); }
.col-num { font-weight: 700; }
tr.you th[scope="row"], tr.you { box-shadow: inset 4px 0 0 var(--accent); }
tr.you { background: var(--surface-2); }
tr.champ { font-weight: 700; }
.tag { display: inline-block; margin-left: 0.4rem; padding: 0 0.35rem; border-radius: 4px; font-size: 0.72rem; font-weight: 700; border: 1px solid var(--border); }
.you-tag { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.turn-tag { background: var(--turn-bg); color: var(--turn); }
.mgr-name { font-weight: 600; }

/* draft */
.token-btn { padding: 0.15rem; background: transparent; border: 2px solid transparent; border-radius: 8px; }
.token-btn.legal { border-color: var(--accent); background: var(--surface-2); }
.token-btn.legal:hover { background: var(--turn-bg); }
.token-btn:disabled:not(.legal) { opacity: 0.4; }
.token-btn:disabled.legal { opacity: 0.6; }
.taken { color: var(--muted); }
table.draftboard th { font-size: 0.75rem; }
.choices { list-style: none; margin: 0 0 0.8rem; padding: 0; display: grid; gap: 0.5rem; }
.choice { display: inline-flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.choice.legal { border-color: var(--accent); }
.fa-entry { display: inline-flex; gap: 0.3rem; align-items: center; }
#controls.playing { display: none; }
#controls.busy { opacity: 0.8; }

/* results */
.seg { display: none; }
.res-title { font-size: 1.15rem; }
.res-replay { margin: 0.6rem 0; }
.res-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem; margin-top: 0.8rem; }
.series-list { margin: 0 0 0.5rem; padding-left: 1.1rem; }
.round { margin-bottom: 0.6rem; }

/* playback stage */
.stage-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-bottom: 0.6rem; }
.stage-bar h2 { margin: 0; flex: 1; }
.speeds { display: inline-flex; gap: 0.3rem; }
.speeds button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 700; }
.stage-body { display: grid; gap: 0.6rem; min-height: 9rem; }
.card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.9rem; }
.card.small { padding: 0.3rem 0.7rem; }
.card.banner { text-align: center; font-size: 1.15rem; border-width: 2px; border-color: var(--accent); }
.card.banner.champion { animation: glow 1.4s ease-in-out infinite alternate; }
.dice-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1.2rem; }
.d20 {
  display: grid; place-items: center; width: 4.2rem; height: 4.2rem; flex: none;
  font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--surface); border: 3px solid var(--accent); border-radius: 18% 18% 50% 50% / 14% 14% 40% 40%;
  clip-path: polygon(50% 0%, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%);
}
.d20.rolling { animation: tumble 0.55s linear infinite; }
.d20.landed { animation: land 0.45s ease-out; }
.strip { display: flex; flex-wrap: wrap; gap: 2px; max-width: 28rem; align-items: center; }
.strip .cell { width: 1.5rem; text-align: center; font-size: 0.72rem; padding: 0.1rem 0; border: 1px solid var(--border); }
.strip .cell.home { background: var(--accent); color: var(--accent-text); font-weight: 700; border-radius: 4px 4px 0 0; }
.strip .cell.away { background: var(--surface); color: var(--muted); border-style: dashed; }
.strip .cell.hit { outline: 3px solid var(--focus); outline-offset: 1px; font-weight: 900; }
.strip-label { flex-basis: 100%; font-size: 0.85rem; color: var(--muted); }
.score { font-size: 1.1rem; font-weight: 700; }
.verdict { margin: 0.4rem 0 0; min-height: 1.4rem; }
.verdict.win { font-weight: 800; color: var(--good); }
.picks, .seeding, .bids { margin: 0; padding-left: 1.2rem; }
.reveal { animation: reveal 0.35s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes tumble { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes land { 0% { transform: scale(1.35); } 60% { transform: scale(0.94); } 100% { transform: scale(1); } }
@keyframes glow { from { box-shadow: 0 0 0 0 transparent; } to { box-shadow: 0 0 18px 2px var(--accent); } }

/* select-then-confirm (all widths) */
.token-btn.sel, .choice.sel { outline: 3px solid var(--accent); outline-offset: 1px; background: var(--turn-bg); }
.choice { cursor: pointer; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem 0.8rem; text-align: left; }
.choice.sel { border-color: var(--accent); }
.dock { margin-top: 0.8rem; }
.dock.idle-dock, .dock:has(> button.idle) { display: none; }
button.confirm { min-height: 2.6rem; }

/* phone-only pieces are hidden on wider screens */
.on-phone, .tabs, .conn-banner, .mine-strip, .boards-cards, .waiting-card, .season-empty, .hd-cue, .tick, .pip, button.idle { display: none; }
.hd-full { display: inline; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 40rem) {
  .top { position: static; }
  .chip { min-width: 2.3rem; font-size: 0.85rem; }
}

/* ===================================================================================================
   Phone layout (below 700px). The page is exactly one screen tall (100dvh) and is a flex column:
   header, the current pane (which takes the free height), then the decision dock and the tab bar
   in normal flow, so a mobile browser's toolbar can never cover them. Nothing scrolls except the
   Log tab. At 700px and wider none of this applies.
   =================================================================================================== */
@media (max-width: 699px) {
  :root { --tabbar-h: calc(60px + env(safe-area-inset-bottom, 0px)); }
  .on-desktop { display: none !important; }
  .on-phone { display: inline; }
  p.on-phone { display: block; }

  body.play, body.lobby {
    display: flex; flex-direction: column; overflow: hidden;
    height: 100vh; height: 100svh; height: 100dvh;
  }
  body.play > .top, body.play > .tabs, body.play > #notice, body.play > .conn-banner { flex: none; }

  /* header: one line */
  .top { position: static; flex: none; flex-wrap: nowrap; align-items: center; gap: 8px; min-height: 48px; padding: calc(6px + env(safe-area-inset-top, 0px)) calc(12px + env(safe-area-inset-right, 0px)) 6px calc(12px + env(safe-area-inset-left, 0px)); }
  .top h1 { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); }
  .top.simple h1 { position: static; width: auto; height: auto; margin: 0; clip: auto; overflow: visible; }
  body.play .status { flex: 1; min-width: 0; flex-wrap: nowrap; gap: 8px; align-items: center; font-size: 0.85rem; }
  .status dt { display: none; }
  .status div { min-width: 0; gap: 0; }
  .status dd { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .status div:nth-child(1) { flex: none; }
  .status div:nth-child(1) dd { font-weight: 800; }
  .status div:nth-child(2) { flex: 0 1 auto; }
  .status div:nth-child(3) { flex: 1 1 0; }
  .status div:nth-child(3) dd { font-weight: 400; color: var(--muted); }
  .status div:nth-child(3) dd::before { content: "\00B7  "; }
  .status div:nth-child(3) dd.your-turn { color: var(--turn); font-weight: 700; }
  .status div:nth-child(4) { flex: none; margin-left: auto; }
  .conn { font-size: 0.78rem; font-weight: 700; }
  .conn-banner { display: none; margin: 0; padding: 8px 12px; background: var(--turn-bg); color: var(--turn); border-bottom: 1px solid var(--turn); font-weight: 700; font-size: 0.9rem; }
  body.is-reconnecting .conn-banner { display: block; }
  body.is-reconnecting .layout { opacity: 0.6; }
  body.is-reconnecting .dock { pointer-events: none; opacity: 0.6; }
  .hq { margin: -0.4rem -0.4rem -0.4rem auto; }

  /* the screen: one pane fills it */
  .layout { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; align-items: stretch; padding: 0; gap: 0; overflow: hidden; }
  main { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: 0; }
  .pane-phase, .pane-rosters, .pane-history { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
  .notice { margin: 8px; }
  #notice .notice { margin: 8px; }

  /* tabs: one pane at a time */
  body[data-tab="phase"] :is(.pane-rosters, .pane-history, .pane-log),
  body[data-tab="rosters"] :is(.pane-phase, .pane-history, .pane-log),
  body[data-tab="history"] :is(.pane-phase, .pane-rosters, .pane-log),
  body[data-tab="log"] :is(.pane-phase, .pane-rosters, .pane-history) { display: none; }
  .side { display: contents; }
  body.play:not([data-tab="phase"]) main { display: none; }
  .boards-table { display: none; }
  .boards-cards, .mine-strip { display: block; }
  #boards-heading { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); }

  .tabs {
    display: flex; position: static; flex: none; height: var(--tabbar-h);
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .tab {
    flex: 1; min-width: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    position: relative; background: none; border: 0; border-radius: 0; padding: 0; color: var(--muted); font-size: 0.78rem; font-weight: 600;
  }
  .tab[aria-current="page"] { color: var(--accent); font-weight: 800; box-shadow: inset 0 3px 0 var(--accent); }
  .ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .pip { position: absolute; top: 8px; left: calc(50% + 8px); display: block; width: 12px; height: 12px; border-radius: 50%; background: var(--turn); border: 2px solid var(--surface); font-size: 0; overflow: hidden; color: transparent; }
  .pip[hidden] { display: none; }

  /* a decision panel: body takes the free height, the dock sits at the bottom in flow */
  .panel { padding: 0; border: 0; background: none; border-radius: 0; }
  .pane-phase > .panel, .pane-history > .panel { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
  .panel > h2 { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); }
  .pbody { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 6px 8px; display: flex; flex-direction: column; gap: 6px; }
  .pbody > * { flex: none; margin-top: 0; margin-bottom: 0; }
  .dock {
    position: static; flex: none; margin: 0;
    padding: 10px calc(12px + env(safe-area-inset-right, 0px)) 10px calc(12px + env(safe-area-inset-left, 0px));
    background: var(--surface); border-top: 2px solid var(--accent); display: flex; flex-direction: column; gap: 8px;
  }
  .dock:has(> button.idle) { display: flex; border-top-color: var(--border); }
  .dock button, .dock .button { min-height: 48px; border-radius: 8px; font-size: 1rem; font-weight: 700; width: 100%; display: flex; align-items: center; justify-content: center; }
  .dock button.primary, .dock button.confirm, .dock .button.primary { min-height: 52px; }
  .dock .bid-form { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
  .dock .bid-form button.primary { min-height: 48px; }
  .dock .dock-summary { font-size: 13px; line-height: 1.25; min-height: 2.5em; display: flex; align-items: center; }
  button.idle { display: block; }
  button.idle:disabled { opacity: 0.7; }
  body.play .dock .button { text-decoration: none; }

  /* draft: the whole board on one screen */
  .lbl { font-size: 0.75rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 6px; }
  .board-wrap { border: 0; border-radius: 0; overflow: visible; }
  .draftboard { table-layout: fixed; width: 100%; border-collapse: separate; border-spacing: 2px; }
  .draftboard th, .draftboard td { padding: 0; border: 0; height: auto; }
  .draftboard thead th { height: 30px; background: none; border-radius: 5px; font-size: 0.8rem; line-height: 1.1; vertical-align: middle; }
  .draftboard thead th.filled { opacity: 0.55; }
  .draftboard .hd-num { display: inline; font-weight: 700; font-size: 0.8rem; }
  .draftboard .hd-full, .draftboard .yours { display: none; }
  .draftboard .hd-cue { display: block; font-size: 10px; font-weight: 700; color: var(--muted); }
  .draftboard .tick { display: inline; font-weight: 700; }
  .draftboard .token-btn { display: block; width: 100%; height: 38px; padding: 0; border: 0; border-radius: 0; background: transparent; }
  .draftboard .token-btn.legal { background: transparent; }
  .draftboard .chip { display: flex; flex-direction: column; justify-content: center; width: 100%; height: 100%; min-width: 0; padding: 0; gap: 1px; font-size: 1rem; line-height: 1; border: 0; }
  .draftboard .chip .letter { border: 0; padding: 0; font-size: 10px; }
  .draftboard .chip .dev { font-size: 10px; }
  .draftboard .token-btn.legal .chip { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7); }
  .draftboard .token-btn.sel { outline: 0; background: transparent; }
  .draftboard .token-btn.sel .chip { outline: 3px solid var(--accent); outline-offset: 1px; box-shadow: inset 0 0 0 2px #fff; position: relative; z-index: 1; }
  .draftboard td.filled .chip { opacity: 0.3; }
  .draftboard td.filled .token-btn:disabled { opacity: 1; }
  .draftboard .taken { display: flex; height: 38px; align-items: center; justify-content: center; border: 1px dashed var(--border); border-radius: 5px; color: var(--muted); }
  .chips.rookies { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .rookies .token-btn { padding: 2px; border: 0; background: transparent; min-width: 0; width: 100%; }
  .rookies .chip { display: flex; min-width: 0; width: 100%; max-width: 72px; margin: 0 auto; height: 48px; font-size: 1.2rem; }
  .rookies .token-btn.legal .chip { box-shadow: 0 0 0 1px var(--text); }
  .rookies .token-btn.sel { outline: 0; background: transparent; }
  .rookies .token-btn.sel .chip { outline: 3px solid var(--accent); outline-offset: 2px; }

  /* waiting state: who is up, instead of the board */
  .is-waiting .waiting-card { display: grid; gap: 8px; }
  .is-waiting .board-wrap { display: none; }
  .wait-hero { text-align: center; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
  .wait-name { font-size: 1.4rem; font-weight: 800; }
  .wait-order { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 4px 12px; }
  .order-list { list-style: none; margin: 0; padding: 0; }
  .order-list li { display: flex; align-items: center; gap: 8px; min-height: 36px; border-bottom: 1px solid var(--border); }
  .order-list li:last-child { border-bottom: 0; }
  .order-n { width: 22px; font-weight: 700; }
  .order-name { flex: 1; }
  .order-name.strong { font-weight: 700; }
  .wait-line { margin: 0; font-weight: 700; }

  /* roster strip under the board, and team rows */
  .mine-strip, .team-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; }
  .mini-strip { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 3px; }
  .mini-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px 0; border-radius: 6px; min-width: 0; }
  .mini-cell small { font-size: 10px; font-weight: 700; color: var(--muted); line-height: 1.1; }
    .mini-cell.tgt { outline: 2px solid var(--accent); }
  .chip.mini { display: flex; flex-direction: column; justify-content: center; gap: 1px; width: 100%; max-width: 36px; min-width: 0; height: 36px; padding: 0; font-size: 1rem; line-height: 1; border: 0; }
  .chip.mini .letter { border: 0; padding: 0; font-size: 10px; }
  .chip.mini .dev { position: absolute; top: -6px; right: -6px; font-size: 10px; line-height: 14px; }
  .chip.mini { position: relative; }
  .chip.mini.empty { border: 1px dashed var(--border); }

  /* teams */
  #boards { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 8px; }
  .team-cards { display: grid; gap: 6px; }
  .team-card { padding: 0; overflow: hidden; }
  .team-card.you { box-shadow: inset 4px 0 0 var(--accent); }
  .team-head { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 4px 12px; background: transparent; border: 0; border-radius: 0; text-align: left; }
  .team-id { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .team-name { font-weight: 800; font-size: 1rem; line-height: 1.2; }
  .team-name .tag { margin-left: 6px; }
  .fa-chip { display: flex; flex-direction: row; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 6px; color: var(--muted); font-size: 10px; font-weight: 800; }
  .team-val { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; min-width: 28px; }
  .team-val strong { font-size: 1.3rem; }
  .fa-chip .chip.mini { width: 34px; height: 28px; }
  .team-detail { padding: 0 12px 8px; }
  .team-detail[hidden] { display: none; }

  /* choices */
  .choices { gap: 8px; }
  .choice { display: flex; width: 100%; min-height: 64px; padding: 8px 12px; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); }
  .choice.sel { border: 3px solid var(--accent); background: var(--surface-2); outline: 0; }
  .token-btn { min-height: 44px; min-width: 44px; }
  .chips:not(.rookies) .token-btn { padding: 4px; }
  .chips:not(.rookies) .token-btn.sel { outline: 3px solid var(--accent); outline-offset: 2px; }

  /* season: playback and checkpoints */
  .stage { padding: 0; border: 0; background: none; }
  .stage-bar h2 { display: none; }
  .stage-body { order: 1; flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 8px; align-content: start; }
  .stage-body > * { min-width: 0; }
  .stage-bar {
    order: 3; flex: none; position: static; margin: 0; flex-wrap: nowrap; gap: 8px;
    padding: 10px calc(12px + env(safe-area-inset-right, 0px)) 10px calc(12px + env(safe-area-inset-left, 0px));
    background: var(--surface); border-top: 2px solid var(--accent);
  }
  .cp-bar { flex-direction: column; align-items: stretch; }
  .cp-bar .secondary { min-height: 44px; }
  .speeds { flex: 1; display: flex; gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
  .speeds button { flex: 1; min-height: 48px; border: 0; border-left: 1px solid var(--border); border-radius: 0; font-weight: 700; font-size: 1rem; background: var(--surface); }
  .speeds button:first-child { border-left: 0; }
  .stage-bar #skip { min-height: 48px; min-width: 96px; font-weight: 700; font-size: 1rem; }
  .card.series .score { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: start; margin: 0 0 6px; font-size: 1rem; }
  .sc-home { text-align: left; font-weight: 800; }
  .sc-away { text-align: right; font-weight: 800; }
  .sc-pts { font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
  .d20 { width: 104px; height: 112px; font-size: 2.2rem; }
  .strip { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 3px; max-width: none; flex: 1; min-width: 14rem; }
  .strip .cell { width: auto; height: 32px; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; padding: 0; border-radius: 4px; }
  .strip .cell.home { border-radius: 4px; }
  .strip-label { grid-column: 1 / -1; font-size: 0.8rem; }
  .card.banner { padding: 16px 12px; border-radius: 10px; }
  .panel p.winner { text-align: center; border: 2px solid var(--accent); border-radius: 10px; padding: 16px 12px; background: var(--surface-2); }

  /* results: Standings / Bracket switch */
  .results { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
  .res-title { position: static; width: auto; height: auto; margin: 0; clip: auto; padding: 10px 12px 0; font-size: 1rem; }
  .seg { display: flex; margin: 8px 12px 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex: none; }
  .seg button { flex: 1; min-height: 44px; border: 0; border-left: 1px solid var(--border); border-radius: 0; background: var(--surface); font-weight: 700; }
  .seg button:first-child { border-left: 0; }
  .seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
  .res-body { padding: 8px 12px; }
  .res-body h3, .res-history { display: none; }
  .results[data-seg="standings"] .res-bracket, .results[data-seg="bracket"] .res-standings { display: none; }
  .results table { font-size: 0.9rem; }
  .results td, .results th[scope="row"] { height: 36px; }
  .res-replay { flex: none; padding: 0 12px 8px; }
  .res-replay button { min-height: 48px; width: 100%; font-weight: 700; }
  .results.empty { padding: 12px; }

  /* log: the whole pane, the only screen that scrolls */
  body[data-tab="log"] .layout { display: block; overflow-y: auto; padding: 8px; }
  .log { position: static; border: 0; background: none; padding: 0; }
  .log-list { max-height: none; font-size: 0.95rem; overflow: visible; }
  .log-list li { padding: 8px 0; }

  /* lobby: compact seat rows, Create game in the dock */
  .lobby main { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; max-width: none; margin: 0; padding: 0; }
  #lobby-form.panel { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
  .lobby .form-title { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); }
  .lobby .setup { padding: 8px 12px 0; }
  .lobby .seat-head { padding: 8px 12px 0; }
  .lobby .seat-list { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 4px 12px 8px; }
  .lobby .create-row { flex: none; }
  .lobby .seat-row { margin: 0 0 3px; }
  /* five columns at 390px: the Level and Strategy selects are as narrow as their longest label allows */
  .lobby .seat-head, .lobby .seat-row { grid-template-columns: 1rem minmax(0, 1fr) 5.1rem 5rem 5rem; gap: 4px; font-size: 14px; }
  .lobby .seat-head { font-size: 11px; }
  .lobby .seat-row input, .lobby .seat-row select { padding: 0.2rem 0.2rem 0.2rem 0.35rem; min-width: 0; font-size: 14px; }
  .lobby .setup { gap: 8px; flex-wrap: nowrap; align-items: flex-end; }
  .lobby .setup .field { margin-bottom: 4px; }
  .lobby .setup .field select { min-width: 0; }
  .lobby .bots-seg button { padding: 0 0.6rem; }
  .lobby .all-stars-setup { flex-wrap: wrap; row-gap: 4px; }
  .lobby .all-stars-help { flex: 1 1 10rem; min-width: 0; margin: 0 0 4px; font-size: 12px; line-height: 1.3; }
  .lobby .top.simple { min-height: 48px; }
  .lobby #lobby-result { padding: 8px 12px; overflow-y: auto; }
  .lobby .links .button { min-height: 48px; display: inline-flex; align-items: center; }
  .lobby .panel .secondary { min-height: 44px; }
}


/* ===================================================================================================
   Auctions and choices: roster matrix, stepper, reveal table, bracket tree, help sheet.
   =================================================================================================== */
.cp-bar { gap: 0.5rem; }
.cp-bar button { min-height: 44px; font-weight: 700; }
.cp-bar .primary { flex: 1; min-height: 52px; }
.cp-bar .secondary { min-height: 48px; }
.cp-bar [hidden] { display: none; }

/* header help button (44x44) */
.hq { width: 44px; height: 44px; flex: none; margin: -0.4rem -0.4rem -0.4rem auto; padding: 0; background: none; border: 0; color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.hq span { width: 26px; height: 26px; border: 2px solid currentColor; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; }

/* bottom sheet */
.help[hidden] { display: none; }
.help { position: fixed; inset: 0; z-index: 50; }
.help .scrim { position: absolute; inset: 0; background: rgba(20, 25, 31, 0.55); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 80vh; max-height: 80dvh; overflow-y: auto; background: var(--surface); border-top: 2px solid var(--accent); border-radius: 16px 16px 0 0; padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35); }
.grab { width: 44px; height: 5px; border-radius: 3px; background: var(--border); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding-top: 6px; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 1.15rem; }
.sheet-head button { min-height: 44px; min-width: 44px; font-weight: 700; }
.sheet p { margin: 8px 0 0; line-height: 1.5; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(38rem, 92vw); border: 2px solid var(--accent); border-radius: 12px; }
  .grab { display: none; }
}

/* bid slider (all widths): a native range input, the amount shown large above it */
.bid-readout { display: flex; align-items: baseline; gap: 8px; }
.bid-label { font-size: 0.9rem; font-weight: 700; }
.bid-big { font-size: 30px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.bid-of { font-size: 14px; color: var(--muted); }
.bid-track { position: relative; height: 48px; --r: 0; }
.bid-slider {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 48px; margin: 0; padding: 0;
  background: transparent; border: 0; border-radius: 0; cursor: pointer;
}
.bid-slider::-webkit-slider-runnable-track {
  height: 10px; border-radius: 5px;
  background: linear-gradient(to right, var(--accent) calc(22px + (100% - 44px) * var(--r)), var(--border) 0);
}
.bid-slider::-moz-range-track { height: 10px; border-radius: 5px; background: var(--border); }
.bid-slider::-moz-range-progress { height: 10px; border-radius: 5px; background: var(--accent); }
.bid-slider::-webkit-slider-thumb {
  -webkit-appearance: none; box-sizing: border-box; width: 44px; height: 44px; margin-top: -17px; border-radius: 50%;
  background: var(--accent); border: 4px solid var(--surface); box-shadow: 0 0 0 2px var(--accent);
}
.bid-slider::-moz-range-thumb {
  box-sizing: border-box; width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); border: 4px solid var(--surface); box-shadow: 0 0 0 2px var(--accent);
}
.bid-track.drag .bid-slider::-webkit-slider-thumb { transform: scale(1.18); box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 30%, transparent), 0 0 0 2px var(--accent); }
.bid-track.drag .bid-slider::-moz-range-thumb { transform: scale(1.18); box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 30%, transparent), 0 0 0 2px var(--accent); }
.bid-slider:focus-visible { outline: none; }
.bid-slider:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--text); outline-offset: 3px; }
.bid-slider:focus-visible::-moz-range-thumb { outline: 3px solid var(--text); outline-offset: 3px; }
.bid-slider:disabled { opacity: 0.4; cursor: not-allowed; }
.bid-dot {
  position: absolute; top: 24px; left: calc(22px + (100% - 44px) * var(--f, 0)); width: 8px; height: 8px; box-sizing: border-box;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--muted); transform: translate(-50%, -50%); pointer-events: none;
}
.bid-bubble {
  display: none; position: absolute; top: -30px; left: calc(22px + (100% - 44px) * var(--r)); transform: translateX(-50%);
  min-width: 44px; height: 30px; padding: 0 8px; box-sizing: border-box; border-radius: 15px; background: var(--text); color: var(--bg);
  font: 800 17px/30px system-ui, sans-serif; text-align: center; pointer-events: none; z-index: 2;
}
.bid-bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -5px; margin-left: -5px;
  border: 5px solid transparent; border-top-color: var(--text); border-bottom: 0;
}
.bid-track.drag .bid-bubble { display: block; }
.bid-form button.primary { min-height: 52px; }
@media (min-width: 700px) {
  .bid-form { max-width: 26rem; gap: 8px; }
}
.dock-summary { margin: 0; font-weight: 700; font-size: 14px; }
.xs-note { font-size: 12px; margin: 0; }
.preview-card { padding: 8px 10px; }
.preview-card p { margin: 4px 0 0; }
.pv { color: var(--accent); font-weight: 800; }

/* roster matrix */
.mx { --nm: 9rem; --vn: 3.4rem; --fn: 3rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 5px; }
.mx-row { display: grid; grid-template-columns: var(--nm) repeat(9, minmax(0, 1fr)) var(--vn) var(--fn); gap: 2px; align-items: center; min-height: 36px; margin-bottom: 2px; border-radius: 6px; }
.mx-fa-choice .mx-row { grid-template-columns: var(--nm) repeat(6, minmax(0, 1fr)) 4.5rem repeat(2, minmax(0, 1fr)) var(--vn) var(--fn); }
.mx-head { min-height: 22px; font-size: 10px; color: var(--muted); font-weight: 800; text-align: center; }
.mx-hcol.fa { background: var(--fa); color: var(--turn); outline: 1px solid var(--turn); border-radius: 4px; line-height: 20px; }
.mx-hname { text-align: left; padding-left: 5px; }
.mx-cell { min-width: 0; height: 36px; display: flex; align-items: center; justify-content: center; }
.mx-cell.fa { background: var(--fa); }
.mx-chip { display: inline-flex; align-items: center; justify-content: center; gap: 1px; width: 100%; max-width: 3.2rem; height: 30px; min-width: 0; color: var(--chip-text); font: 800 14px/1 system-ui, sans-serif; position: relative; }
.mx-chip i { font-style: normal; font-size: 10px; font-weight: 800; }
.mx-chip.blue { background: var(--blue); border-radius: 999px; }
.mx-chip.red { background: var(--red); border-radius: 5px; }
.mx-chip.empty { background: transparent; border: 1px dashed var(--border); color: var(--muted); font-weight: 600; border-radius: 5px; }
.mx-chip u { text-decoration: none; position: absolute; top: -6px; right: -3px; background: #fff; color: #14532d; border-radius: 3px; font-size: 10px; font-weight: 800; padding: 0 2px; line-height: 12px; }
.mx-cell.fa .mx-chip { box-shadow: 0 0 0 2px var(--turn); }
.mx-name { display: flex; flex-direction: column; justify-content: center; line-height: 1.15; padding-left: 5px; min-height: 34px; min-width: 0; }
.mx-name b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-sub { font-size: 10px; font-weight: 800; color: var(--muted); }
.mx-sub.in { color: var(--good); }
.mx-sub.to { color: var(--turn); }
.mx-sub.pv { color: var(--accent); }
.mx-row.you .mx-name { box-shadow: inset 3px 0 0 var(--accent); background: var(--surface-2); border-radius: 4px; }
.mx-fan { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; font-weight: 800; font-size: 15px; height: 30px; display: flex; align-items: center; justify-content: center; }
.mx-val { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; min-width: 0; white-space: nowrap; }
.mx-val b { font-size: 12px; font-weight: 800; }
.mx-val small { font-size: 10px; font-weight: 800; color: var(--muted); }
.mx-val .chg { color: var(--accent); }
.mx-chip.pvw { outline: 2px dashed var(--accent); outline-offset: 1px; }
.mine-val { margin: 3px 0 0; font-size: 12px; font-weight: 800; text-align: center; color: var(--muted); line-height: 1.2; }
.mine-val.pv { color: var(--accent); }

/* rookie draft: order strip, pool, matrix */
.rd-strip { display: grid; grid-template-columns: repeat(var(--n, 8), minmax(0, 1fr)); gap: 2px; }
.rd-pill { height: 66px; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 2px 0; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.rd-pill .rd-n { font-size: 10px; line-height: 1; font-weight: 800; color: var(--muted); }
.rd-pill b { font-size: 11px; line-height: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-pill.cur { border: 2px solid var(--turn); background: var(--turn-bg); }
.rd-pill.cur .rd-n { color: var(--turn); }
.rd-pill.me { box-shadow: inset 0 3px 0 var(--accent); }
.rd-c { display: inline-flex; align-items: center; justify-content: center; gap: 1px; width: 36px; height: 22px; color: var(--chip-text); font: 800 12px/1 system-ui, sans-serif; }
.rd-c i { font-style: normal; font-size: 10px; font-weight: 800; }
.rd-c.blue { background: var(--blue); border-radius: 999px; }
.rd-c.red { background: var(--red); border-radius: 5px; }
.rd-c.empty { border: 1px dashed var(--border); color: var(--muted); border-radius: 5px; font-weight: 600; }
.rd-c.pvw { outline: 2px dashed var(--accent); outline-offset: 1px; }
.rd-c.big { width: 38px; height: 38px; font-size: 16px; }
.rd-lb { font-size: 10px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 2px 0; }
.rd-pool { display: grid; grid-template-columns: repeat(8, 44px); gap: 2px; justify-content: center; }
.rd-pb { position: relative; width: 44px; height: 44px; min-height: 44px; min-width: 44px; padding: 0; display: flex; align-items: center; justify-content: center; border: 2px solid var(--border); border-radius: 8px; background: var(--surface); }
.rd-pb:disabled { opacity: 0.8; }
.rd-pb.e { border-style: dashed; background: transparent; opacity: 0.5; }
.rd-pb.sel { border: 3px solid var(--accent); background: var(--surface-2); }
.rd-pb:not(:disabled):not(.sel) { border-color: var(--accent); }
.rd-ck { position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
@media (min-width: 700px) {
  .rookie-draft .rd-strip, .rookie-draft .rd-pool { max-width: 32rem; margin: 0 auto 0.5rem; width: 100%; }
  .rookie-draft .rd-pool { justify-content: start; }
}
.mx-row.dim { opacity: 0.55; }
.mx-dev-choice .mx-row.dim { opacity: 0.7; }
.mx-row.win { outline: 2px solid var(--accent); outline-offset: 1px; }
.mx-row.sel { background: var(--turn-bg); outline: 2px solid var(--accent); }
@media (max-width: 699px) {
  .mx { --nm: 38px; --vn: 38px; --fn: 24px; padding: 0; border: 0; background: none; }
  .mx-name b { font-size: 12px; }
  .mx-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mx-fan { font-size: 12px; height: 28px; border-radius: 4px; }
  .mx-fa-choice .mx-row { grid-template-columns: var(--nm) repeat(6, minmax(0, 1fr)) 44px repeat(2, minmax(0, 1fr)) var(--vn) var(--fn); }
  .mx-chip { max-width: none; }
}

/* controls inside the matrix: tap targets */
.mx-tap { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-width: 44px; height: 44px; padding: 0; gap: 0; background: transparent; border: 2px solid transparent; border-radius: 8px; color: var(--text); font: 800 10px/1.1 system-ui, sans-serif; }
.mx-tap .mx-chip { height: 26px; max-width: 2.6rem; }
.mx-cell.fa .mx-tap .mx-chip { box-shadow: none; }
button.mx-tap { cursor: pointer; border-color: var(--border); background: var(--surface); }
button.mx-tap:disabled { opacity: 0.6; cursor: not-allowed; }
.mx-tap.me { border: 1px dashed var(--border); }
.mx-tap.sel { border: 3px solid var(--accent); background: var(--surface-2); }
.tap-line { font-size: 10px; font-weight: 800; min-height: 11px; white-space: nowrap; }
.mx-fa-choice .mx-cell.fa, .mx-dev-choice .mx-row.mine .mx-cell { height: 44px; }
.mx-dev-choice .mx-row.mine { min-height: 50px; }
.mx-dev-choice .mx-tap { min-width: 0; }
.mx-dev-choice .mx-row.mine .mx-tap .mx-chip { max-width: none; }
.mx-fa-choice .mx-row { min-height: 44px; }
.keep-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 0 12px; background: var(--surface); border: 2px solid var(--border); border-radius: 10px; font-weight: 800; text-align: left; }
.keep-btn.sel { border: 3px solid var(--accent); background: var(--surface-2); }
.keep-text { flex: 1; }
.keep-btn .mx-chip { width: 44px; height: 34px; }

/* the reveal */
.reveal-banner { text-align: center; border: 2px solid var(--accent); border-radius: 10px; padding: 10px; background: var(--surface-2); margin-bottom: 8px; }
.reveal-banner.hid { visibility: hidden; }
.reveal-banner.none { border-color: var(--border); }
.reveal-banner .lbl { margin: 0 0 2px; font-size: 0.75rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.reveal-banner .sub { margin: 2px 0 0; }
.reveal-head { font-size: 1.4rem; font-weight: 800; }
/* the champion checkpoint: one line (name cut with an ellipsis, never wrapped) and tight spacing so the phone Season pane needs no scroll */
.bracket-card .reveal-banner { padding: 6px 8px; margin-bottom: 4px; }
.bracket-card .reveal-banner .lbl { margin: 0; font-size: 10px; line-height: 12px; }
.bracket-card .reveal-head { font-size: 1.15rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-table { margin-bottom: 6px; }
.rv { display: grid; grid-template-columns: minmax(0, 1fr) 2.5rem 6rem; gap: 6px; align-items: center; min-height: 44px; border-bottom: 1px solid var(--border); padding: 0 4px; }
.rv:last-child { border-bottom: 0; }
.rv.hdr { min-height: 22px; font-size: 10px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.rv .c { text-align: center; }
.rv .r { text-align: right; }
.rv.win { background: var(--turn-bg); border-radius: 6px; }
.rv.hid { visibility: hidden; }
.rv .who { font-weight: 700; }
.rv .bidv { font-size: 20px; font-weight: 800; text-align: center; }
.rv .ft { text-align: right; font-variant-numeric: tabular-nums; }

/* the bracket */
.bracket-card { padding: 8px; }
.bracket-legend { margin: 8px 0 0; font-size: 12px; }
.bx-tree { position: relative; width: 100%; max-width: 40rem; margin: 0 auto; }
.bx-head { position: absolute; top: 0; display: flex; flex-direction: column; font-size: 10px; line-height: 1.2; color: var(--muted); font-weight: 700; border-bottom: 2px solid var(--border); padding-bottom: 2px; }
.bx-head b { color: var(--text); }
.bx-head.cur { border-bottom-color: var(--accent); }
.bx-head.cur b { color: var(--accent); }
.bx-lines { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.bx-lines .ln { stroke: var(--muted); stroke-width: 2; opacity: 0.8; }
.bx-lines .ln.on { stroke: var(--accent); stroke-width: 3; opacity: 1; }
.bx { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; z-index: 1; }
.bx.cur { border: 2px solid var(--accent); }
.bx.champ { border: 3px solid var(--accent); box-shadow: 0 0 10px 1px var(--accent); }
.bx-slot { display: flex; align-items: center; gap: 3px; height: 32px; padding: 0 5px; min-width: 0; }
.bx-slot + .bx-slot { border-top: 1px solid var(--border); }
.bx-slot .d { font-size: 11px; font-weight: 800; color: var(--muted); width: 10px; flex: none; }
.bx-slot .n { flex: 1; min-width: 0; font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bx-slot .v { font-size: 10px; font-weight: 700; color: var(--muted); flex: none; }
.bx-slot .k { font-size: 11px; font-weight: 800; color: var(--good); flex: none; }
.bx-slot .s { font-size: 15px; font-weight: 800; min-width: 12px; text-align: right; flex: none; }
.bx-slot .by { font-size: 10px; font-weight: 800; border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; color: var(--muted); flex: none; }
.bx-slot.you { background: var(--surface-2); }
.bx-slot.path { box-shadow: inset 3px 0 0 var(--accent); }
.bx-slot.w .n { font-weight: 900; }
.bx-slot.out { opacity: 0.5; }
.bx-slot.tbd .n { font-size: 11px; font-weight: 700; font-style: italic; color: var(--muted); }
@media (max-width: 699px) {
  .cp-bar { flex-direction: column; align-items: stretch; }
}

@media (max-width: 699px) {
  /* 8 managers must fit 390x664 with the banner space reserved from the start: rows 30px, no label or note */
  .rv { min-height: 28px; }
  .rv.hdr { min-height: 16px; }
  .rv .bidv { font-size: 18px; }
  .rv-title { display: none; }
  .rv-table { margin-bottom: 0; }
  .reveal-banner { margin: 4px 0 0; padding: 4px 8px; }
  .reveal-banner .sub { margin: 0; font-size: 0.85em; line-height: 1.2; }
  .reveal-banner .lbl { display: none; }
  .reveal-head { font-size: 1.15rem; }
  .reveal-card { padding: 6px 8px; overflow: hidden; }
  .mx { padding: 4px; }
  .mx-row { min-height: 34px; margin-bottom: 1px; }
  .mx-cell { height: 32px; }
  .mx-chip { height: 28px; }
  .mx-head { min-height: 20px; }
  .mx-dev-choice .mx-row { min-height: 36px; }
  .mx-dev-choice .mx-row.mine { min-height: 50px; }
  .bx-slot { height: 32px; }
  .bracket-card { padding: 6px; }
}
.bx-slot { height: 32px; }
.mx-tap.me { cursor: pointer; }

@media (max-width: 699px) {
  .status div:nth-child(3) dd.your-turn::before { content: none; }
}

/* while playback shows the season, the old results are not shown under it */
.stage:not([hidden]) ~ #results { display: none; }

@media (min-width: 700px) {
  .results > .dock { display: none; }
}

/* ===================================================================================================
   Offseason checkpoints: retirement and aging, jersey sales (offseasonview.ts). Plain column numbers:
   no Free Agent highlight here. Retiring veterans are gray (and the caption says so), never struck out.
   =================================================================================================== */
.oc { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.oc-slot { min-height: 30px; display: flex; flex-direction: column; justify-content: center; }
.oc-slot.tall { min-height: 56px; }
.oc-note { margin: 0; padding: 6px 10px; font-size: 12px; }
.oc-table { --ocnm: 9rem; --ocv: 5.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 5px; }
.oc-row { display: grid; grid-template-columns: var(--ocnm) repeat(9, minmax(0, 1fr)) var(--ocv); gap: 2px; align-items: center; min-height: 36px; margin-bottom: 2px; border-radius: 6px; }
.oc-head { min-height: 20px; font-size: 10px; font-weight: 800; color: var(--muted); text-align: center; }
.oc-hcol.x { color: var(--accent); }
.oc-cell { min-width: 0; height: 32px; display: flex; align-items: center; justify-content: center; }
.oc-cell .mx-chip { max-width: none; height: 28px; }
.oc-name { display: flex; flex-direction: column; justify-content: center; line-height: 1.1; padding-left: 4px; min-width: 0; min-height: 30px; }
.oc-name b { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-mv { font-size: 10px; font-weight: 800; color: var(--muted); }
.oc-mv.up, .up { color: var(--good); }
.oc-mv.dn, .dn { color: var(--bad); }
.oc-val { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; min-width: 0; }
.oc-val b { font-size: 12px; white-space: nowrap; }
.oc-val small { font-size: 10px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.oc-val small.ch { color: var(--accent); }
.oc-row.you { background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--accent); }
.oc-row.you .oc-name b { color: var(--accent); }
.oc-row.win { background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--accent); }
.mx-chip.oc-ret { filter: grayscale(1); opacity: 0.45; }
.mx-chip.oc-spot { outline: 3px solid var(--accent); outline-offset: 1px; box-shadow: 0 0 12px 3px var(--accent); }
.oc-table.jersey .oc-row { grid-template-columns: var(--ocnm) repeat(9, minmax(0, 1fr)) var(--ocv); min-height: 38px; }
.oc-fl { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-text, #fff); font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; animation: oc-fly 0.7s ease-out both; }
.oc-fan-go { flex-direction: row; gap: 3px; }
.oc-tick b { animation: oc-pop 0.5s ease-out both; }
.mx-chip.oc-slide { animation: oc-slide 0.6s ease-out both; }
.oc-callout { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 10px; border: 2px solid var(--accent); }
.oc-bigchip .mx-chip { width: 44px; height: 38px; max-width: none; font-size: 18px; }
.oc-calltext { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12px; line-height: 1.25; }
.oc-calltext b { font-size: 13px; }
.oc-rank { text-align: center; line-height: 1.1; }
.oc-rank b { font-size: 22px; }
.oc-rank small { font-size: 11px; color: var(--muted); font-weight: 800; }
.oc-top { display: flex; align-items: center; gap: 10px; padding: 8px 10px; min-height: 58px; }
.oc-topchips { display: flex; gap: 6px; align-items: center; }
.oc-topchips .oc-big { width: 46px; height: 42px; max-width: none; font-size: 18px; }
.oc-bignum { font-size: 26px; font-weight: 800; line-height: 1; }
.oc-jtext { flex: 1; min-width: 0; font-size: 13px; line-height: 1.25; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@keyframes oc-slide { from { transform: translateX(-110%); opacity: 0.5; } to { transform: none; opacity: 1; } }
@keyframes oc-pop { from { transform: scale(1.35); } to { transform: none; } }
@keyframes oc-fly { from { transform: translate(0, -18px) scale(1.4); opacity: 0.3; } to { transform: none; opacity: 1; } }
@media (max-width: 699px) {
  .oc-table { --ocnm: 40px; --ocv: 64px; padding: 4px; }
  .oc-row { min-height: 36px; margin-bottom: 1px; }
  .oc-table.jersey .oc-row { min-height: 38px; }
}

/* integration pass: phone height budget (390x664) */
@media (max-width: 699px) {
  .pbody { padding: 4px 8px; gap: 4px; }
  .draftboard thead th { height: 26px; }
  .mine-strip { padding: 3px 8px; }
  .mine-strip .chip.mini { height: 28px; }
}


/* ===================================================================================================
   Concept D: phase tab, Rosters, History v1, trophies.
   =================================================================================================== */
.trophies { display: inline-flex; align-items: center; gap: 1px; color: var(--text); flex: none; }
.trophy { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.trophy-n { font-size: 12px; font-weight: 800; margin-left: 2px; }
.phase-cue { display: none; }
.race { list-style: none; margin: 0.6rem 0; padding: 0; display: grid; gap: 4px; }
.race li { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 2px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.race li.you { box-shadow: inset 4px 0 0 var(--accent); background: var(--surface-2); }
.race .rn { flex: 1; font-weight: 700; }

/* History (all widths) */
.hist-list { display: flex; flex-direction: column; gap: 6px; max-width: 40rem; }
.hrw { display: flex; gap: 6px; }
.hrow { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto 30px 14px; gap: 8px; align-items: center; min-height: 56px; width: 100%; padding: 6px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font: inherit; text-align: left; }
.hrw .hrow { flex: 1; min-width: 0; width: auto; }
.hrow .sn { font-size: 13px; font-weight: 800; color: var(--muted); }
.hrow .who { display: flex; flex-direction: column; min-width: 0; }
.hrow .cn { font-size: 15px; font-weight: 800; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrow .cn.you { color: var(--accent); }
.hrow .ru { font-size: 11px; font-weight: 700; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrow .vv { font-size: 15px; font-weight: 800; text-align: right; }
.hrow.off { display: flex; gap: 8px; background: transparent; border-style: dashed; color: var(--muted); }
.hrow.off .cn { font-weight: 700; font-size: 14px; }
.hrow .chev { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bk { width: 48px; min-height: 56px; flex: none; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--accent); display: flex; align-items: center; justify-content: center; padding: 0; }
.bk .ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hist-empty { margin: 0; padding: 12px 0; font-weight: 700; }
.hist-detail { display: flex; flex-direction: column; gap: 6px; max-width: 40rem; }
.hd-row { display: flex; align-items: center; gap: 8px; }
.hd-row .hback { min-height: 44px; padding: 0 12px; }
.hd-title { flex: 1; text-align: right; font-size: 15px; font-weight: 800; }
.sg { display: flex; gap: 8px; }
.sg button { flex: 1; min-height: 44px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: 800 15px system-ui, sans-serif; }
.sg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.hist-stand { padding: 4px 10px; }
.hist-stand .hr { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 28px; gap: 8px; align-items: center; min-height: 38px; border-bottom: 1px solid var(--border); font-size: 14px; }
.hist-stand .hr:last-child { border-bottom: 0; }
.hist-stand .seed { font-weight: 800; color: var(--muted); }
.hist-stand .nm { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-stand .hr.you .nm { color: var(--accent); }
.hist-stand .hr.champ .fin { font-weight: 800; }
.hist-stand .val { text-align: right; font-weight: 800; }
.hist-bracket { padding: 6px; }
.hreplay { min-height: 44px; }
@media (min-width: 700px) {
  .history { margin-top: 1rem; }
  .hist-list { max-height: 24rem; overflow-y: auto; }
}

@media (max-width: 699px) {
  .tab-label { font-size: 12px; }
  .tab.flash { background: var(--turn-bg); }
  .phase-cue {
    /* sits over the header bar, never over the draft-order strip or the board below it */
    display: flex; align-items: center; justify-content: center; position: fixed; z-index: 20; left: 0; right: 0; top: 0;
    box-sizing: border-box; height: calc(48px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 12px 0; text-align: center; font-weight: 800; font-size: 14px; background: var(--turn-bg); color: var(--turn); border-bottom: 2px solid var(--turn); pointer-events: none;
  }
  .phase-cue[hidden] { display: none; }

  /* Rosters tab */
  .pane-rosters { padding: 0; }
  #boards { padding: 6px 10px; display: flex; flex-direction: column; }
  .rosters { display: flex; flex-direction: column; gap: 1px; }
  .rr-head { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 3px; padding: 0 7px; font-size: 10px; font-weight: 800; color: var(--muted); text-align: center; line-height: 14px; }
  .rr { display: flex; flex-direction: column; gap: 2px; width: 100%; min-height: 50px; padding: 3px 6px 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font: inherit; text-align: left; }
  .rr.you { box-shadow: inset 3px 0 0 var(--accent); background: var(--surface-2); }
  .rr-top { display: flex; align-items: center; gap: 8px; font-size: 12px; line-height: 1.1; }
  .rr-name { font-size: 13px; font-weight: 800; }
  .rr.you .rr-name { color: var(--accent); }
  .rr-sp { flex: 1; }
  .rr-fan { font-weight: 800; color: var(--muted); }
  .rr-val { font-weight: 800; font-size: 13px; }
  .rr-val small { font-size: 10px; color: var(--muted); font-weight: 700; }
  .rr-chips { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 3px; }
  .rr-chips .chip.mini { height: 26px; max-width: 30px; justify-self: center; flex-direction: row; align-items: center; gap: 1px; font-size: 13px; }
  .rr.open .rr-chips .chip.mini { height: 36px; max-width: 38px; font-size: 16px; }
  .rr-chips .chip.mini .letter { font-size: 10px; }
  /* the +1 badge hangs 5px above its chip: rows that have one keep that much clear of the line above */
  .rr-chips:has(.dev) { margin-top: 3px; }
  .rr-chips .chip.mini .dev { top: -5px; right: -5px; }
  .rr-detail { font-size: 11px; color: var(--muted); font-weight: 700; padding: 0 2px; }

  /* History pane: only the list scrolls */
  .history { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
  .hist-body { overflow: hidden; padding: 8px 10px; }
  .hist-list { flex: 1 1 0; min-height: 0; max-width: none; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
  .hist-list > * { flex: none; }
  .hist-detail { max-width: none; }
  .hist-bracket { overflow: hidden; }
  .history .hist-detail .card { padding: 4px 6px; }
}

/* the checkpoint action, reachable from every tab (phones) */
.cp-away { display: none; }
@media (max-width: 699px) {
  .cp-away { display: flex; flex: none; padding: 4px calc(12px + env(safe-area-inset-right, 0px)) 4px calc(12px + env(safe-area-inset-left, 0px)); background: var(--surface); border-top: 2px solid var(--accent); }
  .cp-away[hidden] { display: none; }
  .cp-away button { width: 100%; min-height: 44px; font-weight: 700; font-size: 1rem; border-radius: 8px; }
}

/* ===== Desktop (700px and up): tokens without frames ================================================
   A token is just its chip (blue round / red rounded square, B/R letter, value). Legal tokens are full
   strength, tokens you cannot take fade, tokens in a column you already filled fade most. The selected
   token gets a ring that follows its own chip shape. */
@media (min-width: 700px) {
  .token-btn, .token-btn.legal, .token-btn.sel { border: 0; outline: 0; background: transparent; padding: 0.2rem; border-radius: 999px; }
  .token-btn.legal:hover:not(:disabled) .chip { filter: brightness(1.12); transform: scale(1.06); }
  .token-btn:disabled:not(.legal) { opacity: 0.35; }
  .token-btn:disabled.legal { opacity: 0.7; }
  .token-btn.sel .chip { outline: 3px solid var(--accent); outline-offset: 3px; }
  .draftboard td.filled .chip { opacity: 0.4; }
  .draftboard td.filled .token-btn:disabled { opacity: 1; }
  .rd-pb, .rd-pb.sel, .rd-pb:not(:disabled):not(.sel) { border: 0; background: transparent; }
  .rd-pb:disabled { opacity: 1; }
  .rd-pb:not(:disabled):hover .mx-chip, .rd-pb:not(:disabled):hover .rd-c { filter: brightness(1.12); transform: scale(1.06); }
  .rd-pb.sel .mx-chip, .rd-pb.sel .rd-c { outline: 3px solid var(--accent); outline-offset: 3px; }
}

/* ===== Desktop (700px and up): header, right column, log flyout ===================================
   Header: title, "Season 1", whose turn, titles, connection, Log, help. The phase is not named here:
   the screen itself and its heading say it.
   Right column (.side): every roster, then History. Its width scales from 15rem (800px) to 22rem; nothing is ever
   laid over the board or the bracket.
   The event log is a flyout opened by the header's Log button. */
@media (min-width: 700px) {
  .top { align-items: center; }
  .top h1 { margin: 0; font-size: 1.2rem; }
  .status dt { display: none; }
  .status .st-phase { display: none; }
  .status .st-season dd { font-weight: 800; }
  .status .st-season .sub { color: var(--muted); font-weight: 500; margin-left: 0.3rem; }
  .status .st-conn { margin-left: auto; }
  .hdr-titles { display: flex; align-items: center; gap: 0.8rem; font-size: 0.85rem; }
  .hdr-titles[hidden] { display: none; }
  .hdr-titles .tr { display: inline-flex; align-items: center; gap: 0.25rem; font-weight: 700; }
  .hdr-titles .tr.you { color: var(--accent); }
  .hdr-titles .trophy { width: 1.1rem; height: 1.1rem; vertical-align: middle; }
  .log-btn { width: 44px; height: 44px; margin: -0.4rem 0; display: inline-flex; align-items: center; justify-content: center; }
  .log-btn .ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .log-btn[aria-expanded="true"] { color: var(--accent); }
  .hq { margin: 0; }

  /* --side-w: the right column's width; the log flyout uses it too, so it never reaches the board or bracket (#48) */
  :root { --side-w: clamp(15rem, 28vw, 22rem); }
  .layout { grid-template-columns: minmax(0, 1fr) var(--side-w); }
  .side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
  .side .history { margin: 0; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  #history { min-height: 0; display: flex; flex-direction: column; }
  /* the whole History card scrolls inside the column; its list just takes its natural height */
  .side .hist-list { max-height: none; flex: none; overflow: visible; padding: 0; }
  .side .hist-body { display: flex; flex-direction: column; overflow: visible; padding: 0; }
  .side .hist-bracket { overflow-x: auto; }
  .side .hist-detail { max-width: none; }
  .side h2 { margin: 0 0 0.4rem; font-size: 1rem; }
  body.has-matrix .side-rosters { display: none; }

  /* every roster as compact cards in the column */
  .side .boards-table { display: none; }
  .side .boards-cards { display: block; }
  .side #boards { overflow: visible; }
  .side .rosters { display: flex; flex-direction: column; gap: 3px; }
  .side .rr-head { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 3px; padding: 0 7px; font-size: 10px; font-weight: 800; color: var(--muted); text-align: center; line-height: 14px; }
  .side .rr { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 3px 6px 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font: inherit; text-align: left; }
  .side .rr.you { box-shadow: inset 3px 0 0 var(--accent); background: var(--surface-2); }
  .side .rr-top { display: flex; align-items: center; gap: 8px; font-size: 12px; line-height: 1.1; }
  .side .rr-name { font-size: 13px; font-weight: 800; }
  .side .rr.you .rr-name { color: var(--accent); }
  .side .rr-sp { flex: 1; }
  .side .rr-fan { font-weight: 800; color: var(--muted); }
  .side .rr-val { font-weight: 800; font-size: 13px; }
  .side .rr-val small { font-size: 10px; color: var(--muted); font-weight: 700; }
  .side .rr-chips { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 3px; }
  .side .chip.mini { position: relative; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 1px; width: 100%; max-width: 30px; min-width: 0; height: 26px; padding: 0; border: 0; font-size: 13px; line-height: 1; justify-self: center; }
  .side .chip.mini .letter { border: 0; padding: 0; font-size: 10px; }
  .side .chip.mini .dev { position: absolute; top: -5px; right: -5px; font-size: 10px; line-height: 14px; }
  .side .chip.mini.empty { border: 1px dashed var(--border); }
  .side .rr-chips:has(.dev) { margin-top: 3px; }
  .side .rr-detail { font-size: 11px; color: var(--muted); font-weight: 700; padding: 0 2px; }

  /* wide enough: the column stays in view while the main area scrolls */
  .side { position: sticky; top: 3.6rem; max-height: calc(100vh - 4.4rem); }
  .side-rosters, .side .history { overflow: auto; }
  .side-rosters { flex: none; }

  /* the log flyout */
  /* exactly over the right column: right 1rem = the .layout padding, width = the column's width */
  .log { display: none; position: fixed; top: 3.6rem; right: 1rem; width: var(--side-w); max-height: calc(100vh - 5rem); z-index: 30; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3); flex-direction: column; }
  body.log-open .log { display: flex; }
  .log-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.4rem; }
  .log-head h2 { margin: 0; font-size: 1rem; }
  .log-list { max-height: none; flex: 1 1 auto; min-height: 0; }
}
@media (min-width: 700px) and (max-width: 1060px) {
  /* narrow desktop: short column headers so the 9-column board fits beside the right column */
  .draftboard .hd-full, .draftboard .yours { display: none; }
  .draftboard .hd-cue { display: block; font-size: 10px; font-weight: 700; color: var(--muted); }
  .draftboard th, .draftboard td { padding-left: 0.1rem; padding-right: 0.1rem; }
  /* the board column is narrow here: chips shrink to fit (never under the right column) */
  .draftboard .token-btn { padding: 0.1rem; border-width: 1px; }
  .draftboard .chip.has-face:not(.mini) { width: 100%; min-width: 34px; max-width: 44px; aspect-ratio: 1; height: auto; margin: 0 auto; }
}


/* ===================================================================================================
   Player faces, the player card, the draft ticker and the History players list.
   A face fills its chip; a value band along the bottom keeps the B/R letter and the value readable
   (shape + letter + value, never colour alone). Team colours reach the art through --team / --team-d.
   =================================================================================================== */
.chip.blue, .mx-chip.blue, .pc-face.blue, .rd-c.blue { --team: var(--blue); --team-d: var(--blue-d); --bd-dk: var(--bd-dk-b); --bd-pale: var(--bd-pale-b); }
.chip.red, .mx-chip.red, .pc-face.red, .rd-c.red { --team: var(--red); --team-d: var(--red-d); --bd-dk: var(--bd-dk-r); --bd-pale: var(--bd-pale-r); }
.fz-t { fill: var(--team); }
.fz-d { fill: var(--team-d); }
.face-lib { position: absolute; width: 0; height: 0; overflow: hidden; }
.face .bd { fill: var(--bd-pale); }
.face.bd-dark .bd { fill: var(--bd-dk); }
.has-face { position: relative; display: block; padding: 0; border: 0; --band: 11px; }
.chip.has-face:not(.mini) { width: 44px; height: 44px; min-width: 0; --band: 14px; }
.has-face .fclip { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; display: block; pointer-events: none; }
.has-face .fclip .face { position: absolute; left: 0; top: 0; width: 100%; height: calc(100% - var(--band)); display: block; }
.has-face .fclip .band { position: absolute; left: 0; right: 0; bottom: 0; height: var(--band); background: var(--team-d); color: #fff; display: flex; align-items: center; justify-content: center; gap: 1px; font: 800 11px/1 system-ui, sans-serif; }
.has-face .band .letter { border: 0; padding: 0; margin: 0; font-style: normal; font-size: 10px; opacity: 1; }
.has-face .band .val { font-size: 11px; }
.chip.has-face .dev { position: absolute; top: -6px; right: -6px; z-index: 2; font-size: 10px; line-height: 14px; }
.mx-chip.has-face { display: block; }
.mx-tap .mx-chip.has-face { height: 28px; }
[data-tid] { cursor: pointer; }
span[data-tid]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.token-btn:not(.legal) { opacity: 0.5; }
.rd-pb:not(.legal) { opacity: 0.6; }
@media (min-width: 700px) {
  .token-btn:not(.legal) { opacity: 0.45; }
}

/* roster rows: the name row toggles, the chips open cards */
.rr { position: relative; }
.rr-hit { display: block; width: 100%; padding: 0; background: none; border: 0; border-radius: 0; text-align: left; font: inherit; color: inherit; }
.rr-hit::after { content: ""; position: absolute; inset: 0; }
.rr-chips, .rr-detail { position: relative; z-index: 1; }

/* the player card (a bottom sheet on phones, a dialog on desktop) */
.card-root { z-index: 60; }
.psheet { padding-top: 0; }
.pc-head { display: flex; gap: 12px; align-items: flex-start; padding-top: 10px; }
.pc-face { position: relative; flex: none; width: 96px; height: 96px; display: block; overflow: hidden; background: var(--team); box-shadow: 0 0 0 3px var(--team); }
.pc-face.blue { border-radius: 999px; }
.pc-face.red { border-radius: 16px; }
.pc-face .face { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pc-face.nofc { display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; }
.pc-face.nofc i { font-style: normal; font-size: 18px; font-weight: 800; }
.pc-face.nofc b { font-size: 34px; line-height: 1; }
.pc-id { min-width: 0; flex: 1; }
.psheet .pc-id h2 { margin: 0; font-size: 1.3rem; overflow-wrap: anywhere; }
.psheet .pc-id p { margin: 2px 0 0; font-size: 14px; line-height: 1.3; }
.psheet .pc-num { font-weight: 800; color: var(--muted); }
.psheet .pc-sub { color: var(--muted); }
.psheet .pc-effect { color: var(--accent); font-weight: 700; }
.pc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pc-actions button { flex: 1 1 0; min-height: 48px; font-weight: 700; font-size: 1rem; }
.pc-actions .pc-act { flex: 2 1 0; }
.pc-stats { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; margin: 12px 0 0; font-size: 14px; }
.pc-stats dt { color: var(--muted); }
.pc-stats dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.psheet.full { max-height: 92dvh; }

/* the draft ticker */
.tk { margin: 0 0 6px; }
.tk[hidden] { display: none; }
.tk-strip { list-style: none; margin: 0; padding: 2px 0 3px; display: flex; gap: 4px; overflow-x: hidden; scrollbar-width: none; }
.tk-item { flex: none; }
.tk-card { display: flex; align-items: center; gap: 5px; width: 104px; height: 44px; padding: 2px 5px 2px 4px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--tc, var(--accent)); border-radius: 8px; font-size: 10px; line-height: 1.15; color: var(--text); text-align: left; }
.tk-card.you { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--accent); }
.tk-txt { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.tk-n { font-weight: 800; }
.tk-n small { font-size: 10px; color: var(--muted); font-weight: 700; }
.tk-who, .tk-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.tk-name { color: var(--muted); font-weight: 600; }
.tk-card .chip { flex: none; width: 32px; height: 32px; max-width: none; min-width: 0; font-size: 12px; }
.tk-clock .tk-slot { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 80px; height: 44px; min-height: 0; box-sizing: border-box; padding: 2px; border: 2px dashed var(--border); border-radius: 8px; font-size: 11px; text-align: center; overflow: hidden; }
.tk-slot b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.tk-slot small { color: var(--muted); font-weight: 800; font-size: 10px; text-transform: uppercase; letter-spacing: 0.03em; }
.tk-clock.you .tk-slot { border: 2px solid var(--turn); background: var(--turn-bg); }
.tk-clock.you .tk-slot small { color: var(--turn); }
.tk-new { animation: tk-in 0.28s ease-out; }
@keyframes tk-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@media (min-width: 700px) {
  .tk-card { width: 116px; height: 48px; }
  .tk-card .chip { width: 36px; height: 36px; }
  .tk-clock .tk-slot { width: 100px; height: 48px; }
}
@media (max-width: 699px) {
  .draftboard .token-btn { min-height: 39px; height: 39px; }
  .draftboard thead th { height: 26px; }
  .tk { margin: 0; }
  .tk-strip { padding: 0; }
}

/* History: Seasons / Players */
.hmodes { margin-bottom: 8px; flex: none; }
.pl-sort { margin-bottom: 6px; }
.pl-sort button { min-height: 36px; font-size: 13px; white-space: nowrap; padding-left: 0.3rem; padding-right: 0.3rem; }
.pl { display: flex; flex-direction: column; min-height: 0; flex: 1 1 0; }
.pl-list { list-style: none; margin: 0; padding: 0 4px 0 0; overflow-y: auto; flex: 1 1 0; min-height: 0; }
.pl-row { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 4px 8px; margin: 0 0 4px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); }
.pl-row.retired { opacity: 0.75; }
.pl-row .chip { flex: none; width: 36px; height: 36px; max-width: none; }
.pl-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pl-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.pl-txt small { font-size: 11px; color: var(--muted); font-weight: 700; }
.pl-st { font-size: 12px; color: var(--muted); }
.pl-team { flex: none; max-width: 5.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 700; color: var(--muted); }
.pl-omit { font-size: 12px; margin: 4px 0 0; }
/* the right column has no fixed height: the Players list must size to its rows (it collapsed to nothing) and the History panel scrolls */
.side .pl { flex: none; }
.side .pl-list { flex: none; max-height: none; overflow: visible; padding-right: 0; }

/* prospects: faces on the draft board and in the rookie pool */
.rd-c.has-face { display: block; position: relative; width: 38px; height: 38px; --band: 13px; }
.rd-c.has-face .band .val { font-size: 12px; }
.rd-pb .rd-c.has-face { width: 40px; height: 40px; }
@media (max-width: 699px) {
  .draftboard .chip.has-face { width: 100%; height: 100%; --band: 12px; }
}
@media (min-width: 700px) {
  .draftboard .chip.has-face { width: 48px; height: 48px; --band: 15px; }
}

/* draft value tiers: a small ring inside the chip's own shape (gold 5, silver 4, bronze 3); the value is still printed */
.tier-gold { --tier: var(--tier-gold); }
.tier-silver { --tier: var(--tier-silver); }
.tier-bronze { --tier: var(--tier-bronze); }
.tier .fclip::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 0 2px var(--tier), inset 0 0 0 3px rgba(0, 0, 0, 0.4); }

/* lobby: team names (a human seat can retype or re-roll; bots get generated names) */
.seat-opts { display: contents; }
.seat-opts select[hidden] { display: none; }
.name-cell { display: flex; align-items: center; gap: 6px; min-width: 0; }
.name-cell input { flex: 1; min-width: 0; }
.seat-abbr { flex: none; min-width: 2.4rem; text-align: center; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; color: var(--muted); }
.reroll { flex: none; width: 44px; min-width: 44px; height: 44px; padding: 0; font-size: 1.3rem; line-height: 1; }
.reroll[hidden] { display: none; }
@media (max-width: 699px) {
  .lobby .seat-head { display: none; }
  .lobby .seat-row { grid-template-columns: 1rem minmax(0, 1fr); row-gap: 2px; margin: 0 0 8px; }
  .lobby .seat-row .seat-n { grid-row: 1 / span 2; align-self: start; padding-top: 0.7rem; }
  .lobby .seat-opts { display: grid; grid-template-columns: 5.1rem 5rem 1fr; gap: 4px; grid-column: 2; }
  .lobby .name-cell input { min-height: 44px; }
}

/* team colours: pills, stripes, the lobby swatch picker. Never used on token chips. */
.tpill { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 2.2em; padding: 0 5px; border-radius: 4px; background: var(--tc, var(--muted)); color: var(--tc-text, #fff); font: 800 11px/16px system-ui, sans-serif; letter-spacing: 0.03em; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); }
.ttag { display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; }
.ttag .tname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ttag.short .tcity, .ttag.code .tname { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.swatch-btn { flex: none; width: 44px; height: 44px; min-width: 44px; padding: 0; border-radius: 8px; background: var(--tc, var(--muted)); border: 2px solid var(--border); box-shadow: inset 0 0 0 2px var(--surface); }
.swatch-btn:disabled { opacity: 1; cursor: default; }
.swatches { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, 44px); gap: 6px; padding: 6px 0; }
.swatches[hidden] { display: none; }
.swatch { width: 44px; height: 44px; min-width: 44px; padding: 0; border-radius: 8px; background: var(--tc); color: var(--tc-text); border: 2px solid var(--border); font-weight: 800; font-size: 1.1rem; }
.swatch.on { outline: 3px solid var(--text); outline-offset: 1px; }
.swatch:disabled { opacity: 0.25; cursor: not-allowed; }
@media (max-width: 699px) { .lobby .swatches { grid-column: 2; } }

/* header menu (44x44 button, popover under it) and the quit confirmation */
.menu-btn { width: 44px; height: 44px; flex: none; margin: -0.4rem -0.4rem -0.4rem 0; padding: 0; background: none; border: 0; color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.menu-btn .ic { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.menu-btn[aria-expanded="true"] { color: var(--accent); }
.menu-root[hidden] { display: none; }
.menu-root { position: fixed; inset: 0; z-index: 60; }
.menu-scrim { position: absolute; inset: 0; background: transparent; }
.menu {
  position: absolute; top: calc(52px + env(safe-area-inset-top, 0px)); right: calc(8px + env(safe-area-inset-right, 0px)); min-width: 13rem; max-width: calc(100vw - 16px);
  display: flex; flex-direction: column; background: var(--surface); border: 2px solid var(--accent); border-radius: 10px; padding: 4px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
.menu button { min-height: 44px; text-align: left; border: 0; background: none; border-radius: 6px; padding: 0.4rem 0.8rem; font-weight: 600; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); }
.menu button.danger { color: var(--bad, #c0392b); }
.sheet-actions { display: flex; gap: 8px; margin-top: 14px; }
.sheet-actions button { flex: 1; min-height: 48px; font-weight: 700; }
.hist-winner { margin: 0 0 6px; font-size: 0.85rem; font-weight: 700; }
.hist-winner .tag { margin-left: 4px; }
@media (min-width: 700px) {
  .menu-btn { margin: 0; }
  .menu { top: 3.6rem; right: 1rem; }
}
@media (max-width: 699px) {
  .dock.dock-pair { flex-direction: row; }
  .dock.dock-pair > * { flex: 1 1 0; }
  .dock.dock-pair .button { font-size: 0.95rem; }
}

/* desktop right column: a season row is too narrow for one line (the champion and runner-up were cut to a few letters),
   so the titles go on a second line under the name and the chevron is dropped (the whole row is the button) */
@media (min-width: 700px) {
  .side .hrow { grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-areas: "sn who vv" "sn tc tc"; row-gap: 2px; column-gap: 8px; }
  .side .hrow .sn { grid-area: sn; align-self: start; padding-top: 2px; }
  .side .hrow .who { grid-area: who; }
  .side .hrow .tcell { grid-area: tc; }
  .side .hrow .vv { grid-area: vv; }
  .side .hrow .chev { display: none; }
}

/* ===================================================================================================
   All-Stars (allstarsview.ts): before each season's playoffs, when the game has them on. BLUE left, RED right,
   best first; the top player of each colour in a taller row with a star (not gold rings: those mean draft tier).
   Your players get a neutral stripe and a "Yours" tag, the same in both columns. Every row opens the player card.
   =================================================================================================== */
.all-stars { display: grid; gap: 8px; padding: 10px 12px; }
.as-sum { margin: 0; font-weight: 700; }
.as-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.as-col { min-width: 0; }
.as-head { display: flex; align-items: center; gap: 2px; margin: 0 0 4px; padding: 0 10px; height: 30px; border-radius: 4px; background: var(--blue-d); color: #fff; font-size: 0.85rem; font-weight: 800; letter-spacing: 0.03em; }
.as-col.red .as-head { background: var(--red-d); }
.as-count { font-weight: 700; }
.as-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.as-row { display: flex; align-items: center; gap: 10px; min-width: 0; height: 48px; padding: 0 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.as-row.top { height: 72px; background: var(--surface-2); }
.as-row.yours { box-shadow: inset 4px 0 0 var(--text); }
.as-face { position: relative; flex: none; display: block; }
.as-row .chip.as-chip.has-face { width: 38px; height: 38px; --band: 12px; }
.as-row .chip.as-chip.big.has-face { width: 60px; height: 60px; --band: 16px; }
.as-star { position: absolute; top: -7px; left: -7px; width: 20px; height: 20px; z-index: 3; }
.as-star path { fill: var(--tier-gold); stroke: #5b4300; stroke-width: 1.2; stroke-linejoin: round; }
.as-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.as-lbl { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.as-name { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-row.top .as-name { font-size: 1.05rem; }
.as-sub { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 0.8rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.as-team { display: flex; min-width: 0; overflow: hidden; }
.as-num, .as-b { flex: none; }
/* team, number, then two badges on one line: selections ("★ 3rd selection", a filled "First All-Star" for a
   debut) and the year ("Year 4"); phones use "★3" / "1st ★" and "Yr 4" */
.as-b { display: inline-flex; align-items: center; padding: 0 5px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 0.75rem; font-weight: 800; line-height: 1.4; }
.as-b .lg, .as-b .sm { display: inline-flex; align-items: center; gap: 3px; }
.as-b.first { background: var(--text); border-color: var(--text); color: var(--bg); }
.as-bstar { width: 11px; height: 11px; flex: none; }
.as-bstar path { fill: var(--tier-gold); stroke: #5b4300; stroke-width: 1.5; stroke-linejoin: round; }
.as-b .sm { display: none; }
.as-val { flex: none; min-width: 2.5rem; text-align: right; font-size: 1.2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.as-val small { display: block; font-size: 0.7rem; font-weight: 700; color: var(--muted); }
.as-note { margin: 4px 0 0; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
/* the reveal: rows step in, alternating BLUE and RED, all done within 0.8s (reduced motion turns it off) */
.all-stars.reveal-in .as-row { animation: as-in 0.3s cubic-bezier(0.2, 0.7, 0.3, 1) both; animation-delay: calc(var(--i, 0) * 25ms); }
@keyframes as-in { from { opacity: 0; transform: translateY(8px) scale(0.96); } to { opacity: 1; transform: none; } }

/* phone: 44px rows, the value is on the chip's band, so the value column goes */
@media (max-width: 699px) {
  .all-stars { gap: 4px; padding: 0; background: none; border: 0; }
  .as-sum { font-size: 13px; line-height: 1.25; padding: 0 2px; }
  .as-cols { gap: 6px; }
  .as-head { height: 20px; padding: 0 8px; font-size: 11px; margin-bottom: 1px; }
  .as-list { gap: 1px; }
  .as-row { height: 44px; gap: 5px; padding: 0 3px 0 6px; }
  .as-row.top { height: 56px; gap: 4px; padding-left: 4px; }
  .as-row .chip.as-chip.has-face { width: 34px; height: 34px; --band: 11px; }
  .as-row .chip.as-chip.big.has-face { width: 40px; height: 40px; --band: 12px; }
  .as-name, .as-row.top .as-name { font-size: 13px; }
  .as-sub { font-size: 10px; gap: 2px; letter-spacing: -0.02em; overflow: hidden; }
  .as-sub .tpill { font-size: 9px; line-height: 13px; min-width: 0; padding: 0 3px; }
  .as-team { flex: none; }
  .as-team .tname { display: none; }
  .as-b { font-size: 10px; line-height: 13px; padding: 0 3px; letter-spacing: 0; }
  .as-b .lg { display: none; }
  .as-b .sm { display: inline-flex; gap: 1px; }
  .as-bstar { width: 9px; height: 9px; }
  .as-sum { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .as-val { display: none; }
  .as-note { font-size: 11px; margin-top: 2px; }
}
