/* strat-tracker UI — docs/ui/0001-ui-design.md.
 *
 * A scorekeeper's desk: flat surfaces, hairline rules, one warm accent
 * reserved for "action required here" (--die-red; task 0017 uses it at
 * full strength — the read-only board only hints with it). The palette is
 * the design doc's two fixed themes as custom properties; data-theme on
 * .app selects light/dark, and "system" follows prefers-color-scheme.
 *
 * Fonts: the design doc names Barlow / Barlow Semi Condensed / IBM Plex
 * Mono, self-hosted. The font files are not vendored yet, so each stack
 * ends in a metric-similar system fallback and simply upgrades when the
 * @font-face declarations land.
 */

/* ---- Palette ---------------------------------------------------------- */

.app,
.app[data-theme="light"] {
  --paper:     #F6F5F0;
  --surface:   #FFFFFF;
  --card-face: #FBFAF5;
  --ink:       #232823;
  --ink-muted: #6A6F68;
  --line:      #D8D6CE;
  --field:     #33684B;
  --die-red:   #B3372F;
}

.app[data-theme="dark"] {
  --paper:     #141A16;
  --surface:   #1D2420;
  --card-face: #FBFAF5;
  --ink:       #E7E5DC;
  --ink-muted: #9AA198;
  --line:      #313A34;
  --field:     #4E8B6A;
  --die-red:   #E05C4F;
}

@media (prefers-color-scheme: dark) {
  .app[data-theme="system"] {
    --paper:     #141A16;
    --surface:   #1D2420;
    --card-face: #FBFAF5;
    --ink:       #E7E5DC;
    --ink-muted: #9AA198;
    --line:      #313A34;
    --field:     #4E8B6A;
    --die-red:   #E05C4F;
  }
}

/* ---- Base ------------------------------------------------------------- */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
}

.app {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

.app button {
  font: inherit;
  color: inherit;
  background: none;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px 8px;
  cursor: pointer;
}

/* Condensed-caps display register: region labels, scoreboard words. */
.panel-label,
.drawer-title,
.drawer-section-title,
.situation-label,
.drawer-tab,
.status-badge,
.defense-chip {
  font-family: "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* Every numeral that must align or be scanned. */
.line-score,
.out-dot,
.inning-now,
.slot-number,
.runner-ratings,
.roster-card-id,
.log-id {
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

/* ---- Shell ------------------------------------------------------------- */

.error-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface);
  border-bottom: 2px solid var(--die-red);
  color: var(--ink);
}

.home, .not-found, .game-loading {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 16px;
}

/* ---- Board frame -------------------------------------------------------- */

.board {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.board-body {
  flex: 1;
  min-height: 0;
  position: relative;            /* the drawer overlays inside this frame */
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(280px, 1fr) minmax(220px, 320px);
  gap: 0;
}

.board-column {
  padding: 12px;
  min-width: 0;
  overflow-y: auto;
}

.board-column--center {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

/* ---- Scoreboard strip ---------------------------------------------------- */

.scoreboard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.line-score { border-collapse: collapse; }

.line-score th, .line-score td {
  padding: 1px 6px;
  text-align: center;
  font-weight: 400;
}

.line-score thead th {
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 400;
}

.team-name {
  font-family: "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  padding-right: 12px;
}

.team-name-button {
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  background: none;
  border: none;
  color: inherit;
  padding: 0;
  cursor: default;
}

.team-name--editable { cursor: pointer; }
.team-name--editable:hover { text-decoration: underline; }

.team-name-edit { display: inline-flex; flex-direction: column; }

.team-name-input {
  font: inherit;
  /* Override the ancestor .team-name th's uppercase — text-transform
     inherits by default, so merely omitting it here still uppercases
     what the manager types. */
  text-transform: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  width: 12em;
}

.team-name-error { color: var(--die-red); font-size: 11px; }

.inning-cell { color: var(--ink-muted); min-width: 20px; }

.tally-cell {
  border-left: 1px solid var(--line);
  font-size: 15px;
  color: var(--ink);
}

.situation {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.inning-now { font-size: 22px; white-space: nowrap; }

.outs { display: flex; align-items: center; gap: 6px; }

.situation-label { color: var(--ink-muted); font-size: 11px; }

.out-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--ink-muted);
  display: inline-block;
}

.out-dot--filled { background: var(--ink); border-color: var(--ink); }

.defense-chip {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--field);
  border-radius: 3px;
  color: var(--field);
  white-space: nowrap;
}

.status-badge {
  font-size: 14px;
  padding: 2px 10px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  white-space: nowrap;
}

/* ---- Player panels -------------------------------------------------------- */

.panel-label {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--ink-muted);
}

.player-name { margin: 0; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }

.player-meta {
  margin: 2px 0 10px;
  color: var(--ink-muted);
  text-transform: capitalize;
}

/* Loading state of the card slot (task 0018): name-only placeholder. */
.card-placeholder {
  background: var(--card-face);
  border: 1px solid var(--line);
  border-radius: 4px;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6A6F68;                 /* card internals are theme-invariant */
}

.card-placeholder-hint { font-size: 12px; }

/* ---- Card rendering (task 0018) -------------------------------------------- */

/* The card body is theme-invariant (design doc: in dark mode the page is
 * the felt table and the cards stay paper-light), so everything inside
 * .card uses literal light-palette values, never the theme variables. */
.card {
  background: var(--card-face);
  border: 1px solid #D8D6CE;
  border-radius: 4px;
  padding: 8px;
  color: #232823;
}

.card-ratings {
  margin: 0 0 6px;
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: #6A6F68;
}

.card-grid {
  width: 100%;
  border-collapse: collapse;
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

.card-col-number, .card-row-number {
  color: #6A6F68;
  font-weight: 400;
}

.card-col-number { padding-bottom: 2px; }

.card-row-number { padding-right: 5px; text-align: right; }

.card-cell {
  border: 1px solid #D8D6CE;
  padding: 2px 4px;
  vertical-align: top;
  overflow-wrap: anywhere;
}

/* The cell the last :pa/roll read — the one accent use on the board
 * proper. Literal light-theme red: it sits on the invariant card face. */
.card-cell--rolled {
  outline: 2px solid #B3372F;
  outline-offset: -2px;
  background: #F6E3E1;
}

/* A d20 split cell: its sub-ranges as stacked mini-rows. */
.card-split-row { display: flex; gap: 5px; }

.split-range { color: #6A6F68; white-space: nowrap; }

.card-empty { color: #6A6F68; text-align: center; }

/* Fetch failure: a visible error chip on the card slot, never a silent
 * blank. */
.card-error {
  border: 1px solid var(--die-red);
  border-radius: 4px;
  padding: 12px;
  text-align: center;
}

.card-error-text { margin: 0; color: var(--die-red); font-weight: 600; }

.card-error-id {
  margin: 4px 0 8px;
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10px;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}

/* ---- Diamond -------------------------------------------------------------- */

.diamond-region { padding-top: 8px; }

.diamond {
  position: relative;
  width: 150px;
  height: 120px;
  margin: 0 auto;
}

.base {
  position: absolute;
  width: 26px;
  height: 26px;
  transform: rotate(45deg);
  border: 2px solid var(--field);
  border-radius: 3px;
  background: transparent;
}

.base--occupied { background: var(--field); }

.base--second { top: 0;    left: 62px; }
.base--third  { top: 47px; left: 8px; }
.base--first  { top: 47px; right: 8px; }

.base--home-plate {
  position: absolute;
  bottom: 0;
  left: 66px;
  width: 18px;
  height: 18px;
  transform: rotate(45deg);
  border: 2px solid var(--ink-muted);
  border-radius: 2px;
}

.runners {
  list-style: none;
  margin: 14px auto 0;
  padding: 0;
  max-width: 320px;
}

.runner {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid var(--line);
}

.runner-base { color: var(--field); font-weight: 600; }

.runner-name { flex: 1; font-weight: 500; }

.runner-ratings { color: var(--ink-muted); font-size: 11px; white-space: nowrap; }

.runners-empty {
  text-align: center;
  color: var(--ink-muted);
  margin: 14px 0 0;
}

/* ---- Pending banner (the prompt-panel region) ------------------------------ */

/* The dice-tray well (design doc "signature element"): a felt-toned inset.
 * Read-only in 0016, so the accent stays a quiet edge, not full strength. */
.pending-banner {
  margin-top: 16px;               /* directly under the diamond, per the wireframe */
  padding: 14px 16px;
  background: color-mix(in srgb, var(--field) 12%, var(--paper));
  border: 1px solid var(--line);
  border-left: 3px solid var(--die-red);
  border-radius: 4px;
}

.pending-text { font-size: 15px; }

/* The last roll's reading (task 0018) — always visible in the prompt
 * region, so on phones the acting manager never needs the card tab. */
.roll-summary {
  margin: 6px 0 0;
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink-muted);
}

/* ---- Prompt panel (task 0017): the dice tray ------------------------------- */

/* The signature element: a felt-toned inset well holding the entry chips —
 * the only place the red action accent appears at full strength (U4). */
.prompt-panel {
  margin-top: 16px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--field) 16%, var(--paper));
  border: 1px solid var(--line);
  border-left: 3px solid var(--die-red);
  border-radius: 6px;
  box-shadow: inset 0 1px 4px color-mix(in srgb, var(--ink) 18%, transparent);
}

.prompt-widget { outline: none; }        /* focusable for keys, no focus ring box */

.prompt-context { margin: 0 0 8px; font-size: 15px; }

.helper-line {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ink-muted);
}

.prompt-error {
  margin: 8px 0 0;
  color: var(--die-red);
  font-weight: 600;
}

.prompt-muted { color: var(--ink-muted); margin: 8px 0 0; }

.acting-badge {
  display: inline-block;
  font-family: "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  font-size: 11px;
  padding: 1px 8px;
  border: 1px solid var(--die-red);
  border-radius: 3px;
  color: var(--die-red);
  margin-bottom: 8px;
}

/* Dice chips: the white column die and the red-dice row total. Every value
 * that can be tapped is a die-face-shaped chip in the tray. */
.dice-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0;
}

.dice-row-label {
  font-family: "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  font-size: 11px;
  color: var(--ink-muted);
  width: 56px;
}

.app .die-chip,
.app .d20-chip {
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
  min-width: 30px;
  min-height: 30px;
  padding: 0 4px;
  border-radius: 5px;
  border: 1px solid var(--line);
}

.app .die-chip--white { background: #FFFFFF; color: #232823; }

.app .die-chip--red {
  background: color-mix(in srgb, var(--die-red) 12%, #FFFFFF);
  color: #232823;
}

.app .die-chip--selected,
.app .d20-chip--selected {
  border: 2px solid var(--die-red);
  font-weight: 700;
  color: var(--die-red);
}

/* The derived reading / result preview shown between entry and submit. */
.roll-reading {
  margin: 8px 0 0;
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.prompt-submit { margin-top: 10px; background: var(--surface); }

/* The shared d20 grid: 4 rows of 5 value chips. */
.d20-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(30px, 44px));
  gap: 4px;
  margin: 4px 0;
}

.app .d20-chip { background: #FFFFFF; color: #232823; }

/* Safe side of the marked threshold (steal/throw), and a split option's
 * first value — the boundaries drawn on the grid itself. */
.app .d20-chip--under {
  background: color-mix(in srgb, var(--field) 18%, #FFFFFF);
}

.app .d20-chip--range-start { border-left: 3px solid var(--die-red); }

/* Two-button decisions (send/hold, throw/no-throw). */
.decision-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0;
}

.app .decision-secondary { padding: 6px 14px; background: var(--surface); }

/* The idle declarations: slim and secondary to the roll entry (U7). */
.secondary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.app .secondary-action {
  font-size: 12px;
  color: var(--ink-muted);
  background: var(--surface);
}

.app .secondary-action--open {
  color: var(--ink);
  border-color: var(--ink-muted);
}

.prompt-idle--defense .pending-text { display: block; margin: 0; }

.prompt-section + .prompt-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* Substitution picker: out/in selects, matching the builder's controls. */
.sub-widget, .sub-label { display: flex; flex-direction: column; gap: 3px; }

.sub-widget { gap: 8px; margin-top: 8px; }

.sub-label {
  font-family: "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  font-size: 11px;
  color: var(--ink-muted);
}

.sub-widget select {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 5px 8px;
  max-width: 100%;
}

/* Undo: quiet, under the panel, only for the latest event's author. */
.undo-row { margin-top: 8px; }

.app .undo-button {
  border: none;
  color: var(--ink-muted);
  font-size: 12px;
  text-decoration: underline;
  padding: 2px 0;
}

/* ---- Drawers ---------------------------------------------------------------- */

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(340px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.drawer-title { margin: 0; font-size: 13px; }

.drawer-content { padding: 8px 12px; }

.drawer-section { margin-bottom: 16px; }

.drawer-section-title {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--ink-muted);
}

.drawer-empty, .drawer-note { color: var(--ink-muted); }

.note-input {
  display: block;
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  resize: vertical;
}

.note-submit-row { text-align: right; margin-top: 6px; }

.lineup { list-style: none; margin: 0; padding: 0; }

.lineup-slot {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 2px;
  border-bottom: 1px solid var(--line);
}

.lineup-slot--due-up { background: color-mix(in srgb, var(--field) 14%, transparent); }

.slot-number { color: var(--ink-muted); width: 14px; text-align: right; }

.slot-position { color: var(--ink-muted); width: 24px; }

.slot-name { font-weight: 500; }

.slot-rating { margin-left: auto; color: var(--ink-muted); }

.lineup-pitcher { margin: 6px 0 0 22px; color: var(--ink-muted); }

.roster { list-style: none; margin: 0; padding: 0; }

.roster-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 4px 2px;
  border-bottom: 1px solid var(--line);
}

.roster-name { font-weight: 500; white-space: nowrap; }

.roster-card-id {
  color: var(--ink-muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.play-by-play { list-style: none; margin: 0; padding: 0; }

.log-row {
  display: flex;
  gap: 8px;
  padding: 4px 2px;
  border-bottom: 1px solid var(--line);
}

.log-id { color: var(--ink-muted); }

.log-type { flex: 1; }

.log-actor { color: var(--ink-muted); }

/* ---- Bottom bar --------------------------------------------------------------- */

.bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  min-height: 36px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 0 8px;
}

.bottom-bar-ambient {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-muted);
  font-size: 12px;
}

.conn-status { display: flex; align-items: center; gap: 5px; }

.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-muted);
  display: inline-block;
}

.conn-dot--connected { background: var(--field); }

.conn-dot--reconnecting, .conn-dot--disconnected { background: var(--die-red); }

/* The stale-board warning (task 0019) — unmissable, full width, above
 * the scoreboard. */
.conn-banner {
  padding: 6px 12px;
  background: var(--die-red);
  color: #FFFFFF;
  text-align: center;
  font-weight: 600;
}

.theme-toggle { border: none; color: var(--ink-muted); }

.sheet-download,
.sg005-download { color: var(--ink-muted); text-decoration: underline; }

.bottom-bar-tabs {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
}

.drawer-tab {
  border: none;
  border-radius: 0;
  padding: 0 14px;
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.drawer-tab--active {
  color: var(--ink);
  background: var(--paper);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.drawer-tab--phone { display: none; }

/* ---- Create-game screen ------------------------------------------ */

.home { max-width: 720px; }

.create-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
  margin-top: 16px;
}

.create-panel h2 { margin: 0 0 12px; font-size: 17px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 12px;
}

.field-label {
  font-family: "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  font-size: 11px;
  color: var(--ink-muted);
}

.create-form input,
.create-form select,
.setup select {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 5px 8px;
  max-width: 100%;
}

.charts-note { margin: 0; color: var(--ink-muted); }

.form-error, .lineup-error { color: var(--die-red); font-weight: 600; }

.create-actions { margin-top: 14px; display: flex; gap: 8px; }

/* The one accent use on the setup screens: the act-here button (U4). */
.app .primary-action {
  border: 2px solid var(--die-red);
  color: var(--die-red);
  font-weight: 600;
  padding: 6px 14px;
}

.app .primary-action:disabled {
  border-color: var(--line);
  color: var(--ink-muted);
  cursor: not-allowed;
}

.library-empty p { margin: 0 0 6px; }

/* The links panel — the tokens' one showing. */
.link-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.link-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.link-label {
  font-family: "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  font-size: 12px;
}

.link-hint { color: var(--ink-muted); font-size: 12px; }

.link-line { display: flex; gap: 6px; align-items: center; }

.link-url {
  flex: 1;
  min-width: 0;
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--ink-muted);
}

.link-open { color: var(--field); font-weight: 600; white-space: nowrap; }

/* ---- Setup / lineup builder (task 0020) --------------------------------------- */

.setup {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.setup-title { margin: 0; font-size: 22px; }

.setup-matchup { margin: 2px 0 0; font-size: 15px; }

.setup-phase { margin: 4px 0 0; color: var(--ink-muted); }

.setup-muted { color: var(--ink-muted); }

.side-note { margin: 14px 0 10px; color: var(--ink-muted); }

.setup-columns {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(320px, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 12px;
}

.setup-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px 14px;
}

/* Roster list: name + ratings line, card detail expands beneath. */
.setup-roster { list-style: none; margin: 8px 0 0; padding: 0; }

.setup-roster-row { border-bottom: 1px solid var(--line); padding: 5px 0; }

.setup-roster-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.setup-roster-line .roster-name { flex-shrink: 0; }

.setup-roster-line .roster-meta {
  flex: 1;
  color: var(--ink-muted);
  font-size: 11px;
}

.roster-detail-toggle { font-size: 11px; white-space: nowrap; }

.setup-roster-card { margin: 8px 0 4px; }

/* Batting-order editor: slot number + two selects per row. */
.lineup-edit { list-style: none; margin: 8px 0 0; padding: 0; }

.lineup-edit-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.lineup-edit-slot select:first-of-type { flex: 1; min-width: 0; }

.position-select { width: 76px; }

.sp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.sp-row select { flex: 1; min-width: 0; }

.lineup-issues {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--ink-muted);
}

.lineup-issues li { padding: 1px 0; }

.lineup-ok { color: var(--field); font-weight: 600; }

.builder-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Confirm step: the read-back plus the this-is-final copy. */
.confirm-panel { max-width: 560px; margin-top: 12px; }

.final-copy {
  margin: 12px 0 0;
  padding: 8px 10px;
  border-left: 3px solid var(--die-red);
  background: color-mix(in srgb, var(--die-red) 8%, var(--surface));
  font-weight: 500;
}

.lineup-review { margin-top: 8px; }

/* Waiting on the opponent. */
.waiting-panel { max-width: 560px; margin-top: 12px; }

.waiting-copy { font-size: 15px; }

.ready-badge {
  display: inline-block;
  font-family: "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--ink-muted);
  border-radius: 3px;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.ready-badge--ready { border-color: var(--field); color: var(--field); }

/* Combined-manager side switcher (U2). */
.setup-tabs {
  display: flex;
  gap: 4px;
  margin-top: 14px;
  border-bottom: 1px solid var(--line);
}

.app .setup-tab {
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 3px 3px 0 0;
  padding: 6px 16px;
  color: var(--ink-muted);
  font-family: "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.app .setup-tab--active {
  color: var(--ink);
  background: var(--surface);
}

.observer-setup { margin-top: 14px; }

/* Laptop/tablet targeted (U10) — on phones the columns just stack. */
@media (max-width: 760px) {
  .setup-columns { grid-template-columns: 1fr; }
}

/* ---- Phone collapse (design doc "Phone collapse") ---------------------------- */

@media (max-width: 760px) {
  body { font-size: 15px; }

  .board { height: 100dvh; }

  .board-body { display: flex; flex-direction: column; }

  /* Cards collapse behind the phone-only tabs. */
  .board-column--batter, .board-column--pitcher { display: none; }

  .board-column--center { border: none; flex: 1; }

  .drawer-tab--phone { display: block; }

  .drawer { width: 100%; border-left: none; }

  .drawer-tab { min-height: 44px; }

  .line-score .inning-cell { display: none; }  /* condensed: R/H/E only */

  .scoreboard { flex-wrap: wrap; }

  .pending-banner { margin-top: 12px; }

  /* Prompt panel is the phone's primary region: full width, ≥44px targets. */
  .prompt-panel { margin-top: 12px; padding: 12px; }

  .app .die-chip, .app .d20-chip {
    min-width: 44px;
    min-height: 44px;
    font-size: 15px;
  }

  .d20-grid { grid-template-columns: repeat(5, 1fr); }

  .app .primary-action, .app .decision-secondary, .app .secondary-action {
    min-height: 44px;
  }
}
