/* Organizer workspace: header band, section tabs, Match Queue, match cards, boards and teams. */
/* The bottom padding keeps the end of the page clear of the fixed bars on phones. When a section follows the workspace
   (the Test Bracket save options), that section takes the room instead, so the gap between them stays a normal one. */
.workspace { display: grid; gap: var(--space-4); padding-bottom: calc(2 * var(--nav-h) + var(--space-6)); }
.in-workspace .workspace { padding-bottom: calc(var(--nav-h) + var(--space-6)); }
.workspace:not(:last-child) { padding-bottom: 0; }
.workspace ~ .page-section:last-child { padding-bottom: calc(2 * var(--nav-h) + var(--space-6)); }
.workspace > * { min-width: 0; }
/* While the Undo toast is showing, the page scrolls clear of it so it never sits on the last match controls. */
.workspace.has-toast { padding-bottom: calc(2 * var(--nav-h) + var(--space-6) + 5rem); }
.in-workspace .workspace.has-toast { padding-bottom: calc(var(--nav-h) + var(--space-6) + 5rem); }
@media (min-width: 1024px) { .workspace.has-toast, .in-workspace .workspace.has-toast { padding-bottom: calc(var(--space-6) + 4.5rem); } }

/* Header band: the tournament command header. Emblem, title and status, one segmented statistic bar and the controls. */
.status-strip {
  position: relative; overflow: hidden; display: grid; gap: var(--space-2) var(--space-4); align-items: center; padding: var(--space-4) var(--space-5);
  border: 1px solid var(--bq-edge-strong); border-radius: var(--radius-lg); background: var(--bq-band);
  box-shadow: var(--bq-highlight), var(--bq-shadow-3);
  grid-template-columns: minmax(0, 1fr); grid-template-areas: "crumb" "head" "stats" "champ";
}
/* Left edge light and one diagonal streak: static, painted once. */
.status-strip::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--bq-crimson-fill); }
.status-strip::after {
  content: ""; position: absolute; top: -40%; bottom: -40%; left: 62%; width: 2px; transform: rotate(18deg); pointer-events: none;
  background: linear-gradient(180deg, transparent, var(--bq-streak), transparent); opacity: .3;
}
.status-strip > * { position: relative; z-index: 1; min-width: 0; }
.status-strip .breadcrumb { grid-area: crumb; margin: 0; font-size: var(--text-sm); }
.status-head { grid-area: head; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-3) var(--space-4); }
.status-emblem {
  display: none; place-items: center; width: 56px; height: 56px; border-radius: 50%; color: var(--text);
  border: 1px solid var(--bq-edge-metal); box-shadow: inset 0 1px 0 rgb(255 255 255 / .16), 0 0 0 4px color-mix(in srgb, var(--brand-fill) 12%, transparent);
  background: radial-gradient(circle at 35% 30%, var(--bq-surface-3), var(--bq-surface-1) 75%);
}
.status-title { display: grid; gap: var(--space-1); min-width: 0; }
.status-strip h1 { margin: 0; overflow-wrap: anywhere; font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.25rem); }
.status-strip .tournament-card-meta { align-items: center; row-gap: var(--space-1); }
.status-strip .button-row { margin: 0; flex-wrap: nowrap; }
.status-strip .stat-row { grid-area: stats; margin: 0; gap: 0; border: 1px solid var(--bq-edge-strong); border-radius: var(--radius); background: var(--bq-well); box-shadow: var(--bq-inset); overflow: hidden; }
.status-strip .stat-tile { padding: var(--space-2) var(--space-3); gap: var(--space-2); border: 0; border-radius: 0; background: none; box-shadow: none; }
.status-strip .stat-tile + .stat-tile { border-left: 1px solid var(--bq-edge-strong); }
.status-strip .stat-tile-icon { width: 32px; height: 32px; background: none; }
.status-strip .stat-tile-value { font-size: var(--text-xl); }
.status-strip .stat-tile-label { font-size: var(--text-xs); line-height: 1.2; }
.status-strip .champion-pill { grid-area: champ; }
.champion-pill {
  display: inline-flex; align-items: center; gap: var(--space-2); justify-self: start; padding: var(--space-2) var(--space-3);
  border: 1px solid var(--brand-fill); border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--text); font-weight: 700;
}
.champion-pill .icon { color: var(--brand); }
.match-winner { color: var(--brand); font-weight: 700; }
/* Phones: the four statistics share one compact row (2 x 2 on the narrowest screens) and the title row stays short. */
@media (max-width: 599px) {
  .status-strip { padding: var(--space-3) var(--space-4); }
  .status-head { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
  .status-strip .stat-tile { flex-direction: column; align-items: flex-start; gap: 0; padding: var(--space-2); }
  .status-strip .stat-tile-icon { display: none; }
  .status-strip .stat-tile-value { font-size: var(--text-lg); }
}
@media (max-width: 719px) {
  .status-strip .stat-row.compact-sm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-strip .stat-tile:nth-child(3) { border-left: 0; }
  .status-strip .stat-tile:nth-child(n+3) { border-top: 1px solid var(--bq-edge-strong); }
}
/* Tablet and up: emblem on, stats under the title; very wide desktops: stats join the title row (with the sidebar open, narrower widths leave the title too little room). */
@media (min-width: 760px) {
  .status-emblem { display: grid; }
}
@media (min-width: 1680px) {
  .status-strip { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "crumb crumb" "head stats" "champ champ"; }
  .status-strip .stat-row { align-self: center; }
}

/* Section tabs: a fixed bottom bar on phones, a segmented bar under the header from 1024 px. */
.tab-bar {
  position: fixed; inset: auto 0 calc(var(--nav-h) + env(safe-area-inset-bottom)) 0; z-index: 10; display: flex;
  background: var(--bq-surface-1); border-top: 1px solid var(--bq-edge); box-shadow: var(--bq-shadow-up);
}
/* Elsewhere (the Test Bracket page) the site navigation stays below the workspace bar. */
.in-workspace .tab-bar { bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
.tab {
  position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--nav-h); padding: var(--space-1); border: 0; background: none; color: var(--muted);
  font: inherit; font-size: var(--text-xs); font-weight: 700; cursor: pointer; white-space: nowrap;
}
.tab .icon { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] .icon { color: var(--brand); }
.tab[aria-current="page"]::before { content: ""; position: absolute; inset: 0 22% auto; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand-fill); }
@media (min-width: 1024px) {
  .workspace, .in-workspace .workspace { padding-bottom: var(--space-6); }
  .workspace:not(:last-child), .workspace ~ .page-section:last-child { padding-bottom: 0; }
  .tab-bar, .in-workspace .tab-bar {
    position: static; justify-self: start; gap: 2px; padding: 4px; border: 1px solid var(--bq-edge); border-radius: var(--radius-lg);
    background: var(--bq-surface-1); box-shadow: var(--bq-highlight);
  }
  .tab { flex: 0 0 auto; flex-direction: row; gap: var(--space-2); min-height: 40px; padding: 0 var(--space-4); border-radius: var(--radius); font-size: var(--text-sm); }
  .tab .icon { width: 18px; height: 18px; }
  .tab:hover { color: var(--text); background: var(--bq-surface-3); }
  .tab[aria-current="page"] {
    color: var(--on-brand); background: var(--bq-crimson-fill);
    box-shadow: var(--bq-sheen);
  }
  .tab[aria-current="page"] .icon { color: var(--on-brand); }
  .tab[aria-current="page"]::before { display: none; }
  .toast, .in-workspace .toast { inset: auto var(--space-5) var(--space-5) auto; max-width: 30rem; }
}

/* Queue beside the bracket from 1280 px (about 38/62). */
.workspace-aside { display: none; }
.workspace-aside .bracket-view:not([data-full="true"]) .bracket-scroll { max-height: min(36vh, 360px); }
@media (min-width: 1280px) {
  .workspace-split { display: grid; grid-template-columns: minmax(400px, 5fr) minmax(0, 8fr); gap: var(--space-4); align-items: start; }
  .workspace-aside { display: grid; gap: var(--space-4); position: sticky; top: calc(var(--header-h) + var(--space-3)); max-height: calc(100vh - var(--header-h) - 2 * var(--space-3)); overflow-y: auto; }
}

/* Match Queue: a framed panel with its own header, hint and grouped lists. */
.queue-panel {
  display: grid; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--bq-edge); border-radius: var(--radius-lg);
  background: var(--bq-surface-grad); box-shadow: var(--bq-highlight), var(--bq-shadow-2);
}
.queue-panel > .panel-header { margin: 0; }
.queue-panel .field { max-width: none; }
.queue-hint {
  display: flex; align-items: center; gap: var(--space-2); margin: 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--bq-edge)); background: linear-gradient(90deg, var(--warn-soft), transparent 70%), var(--bq-surface-1);
  color: var(--text); font-size: var(--text-sm);
}
.queue-hint .icon { color: var(--warn); }
.queue-group { display: grid; gap: var(--space-2); }
.queue-group-head {
  display: flex; align-items: center; gap: var(--space-2); margin: var(--space-2) 0 0; padding: 0 var(--space-1);
  color: var(--muted); font-size: var(--text-sm); font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
.queue-group-head .icon { color: var(--muted); }
.queue-group-head[data-tone="board"] .icon { color: var(--good); }
.queue-group-head .count { color: var(--text); font-weight: 700; letter-spacing: 0; }
.queue-list { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.queue-section { margin-bottom: var(--space-2); }
.queue-section > summary {
  display: flex; align-items: center; gap: var(--space-2); min-height: var(--control-h); padding: 0 var(--space-2);
  border-radius: var(--radius); color: var(--muted); font-weight: 700; cursor: pointer;
}
.queue-section > summary:hover { color: var(--text); background: var(--bq-surface-3); }
.queue-section[open] > summary { color: var(--text); }

/* Match card: match code, teams and board on top; both winner buttons always in view underneath. */
.match-card {
  position: relative; display: grid; gap: var(--space-2); padding: var(--space-2) var(--space-3); list-style: none;
  border: 1px solid var(--bq-edge); border-radius: var(--radius-lg); background: var(--bq-surface-2); box-shadow: var(--bq-highlight);
}
.match-card[data-board="true"] {
  border-color: color-mix(in srgb, var(--brand-fill) 45%, var(--bq-edge));
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand-fill) 11%, transparent), transparent 45%), var(--bq-surface-2);
}
.match-card[data-board="true"]::before { content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--brand-fill); }
.match-card[data-selected="true"] { border-color: color-mix(in srgb, var(--brand-fill) 60%, transparent); box-shadow: var(--bq-crimson-edge), var(--bq-shadow-2); }
.match-card-main { display: grid; gap: var(--space-2); }
.match-card-head {
  position: relative; display: grid; grid-template-columns: 4.25rem minmax(0, 1fr); gap: var(--space-1) var(--space-3); align-items: center;
  width: 100%; min-height: var(--control-h); padding: var(--space-1) 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left;
}
button.match-card-head { cursor: pointer; border-radius: var(--radius); padding-right: var(--space-5); }
.match-card-more { position: absolute; right: 0; top: 50%; translate: 0 -50%; color: var(--muted); transition: rotate var(--dur-1) var(--ease-out); }
.match-card[data-selected="true"] .match-card-more { rotate: 90deg; color: var(--brand); }
.match-card-id { display: grid; justify-items: center; align-self: stretch; align-content: center; padding: var(--space-1); border-right: 1px solid var(--bq-edge); }
.match-card-number { display: grid; justify-items: center; line-height: 1; font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: var(--text-2xl); }
.match-card-number small { font-family: var(--font); font-style: normal; font-size: .6rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.match-card-stage { color: var(--muted); font-size: var(--text-xs); font-weight: 600; text-align: center; line-height: 1.25; margin-top: 4px; }
.match-card-body { display: grid; gap: var(--space-1); min-width: 0; }
.match-card-teams { display: grid; gap: 2px; font-weight: 700; font-size: var(--text-md); overflow-wrap: anywhere; }
.match-card-teams .vs { color: var(--muted); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.match-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); color: var(--muted); font-size: var(--text-sm); }
.board-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px; border-radius: var(--radius-pill);
  border: 1px solid color-mix(in srgb, var(--good) 40%, transparent); background: var(--good-soft); color: var(--good); font-size: var(--text-sm); font-weight: 700;
}
.board-chip[data-empty="true"] { border: 1px dashed var(--bq-edge-strong); background: none; color: var(--muted); font-weight: 600; }
.match-card-board { color: var(--brand); font-weight: 600; }

/* Winner buttons: a team name wraps (never truncated), up to three lines in the button and always in full above it. */
.winner-buttons { display: grid; gap: var(--space-2); }
.win-btn {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-2); min-height: var(--control-h-lg);
  padding: var(--space-2) var(--space-3); white-space: normal; text-align: left; line-height: 1.2; font-size: var(--text-sm);
  border-color: var(--bq-edge-metal); background: var(--bq-raised-grad);
}
.win-btn .icon { color: var(--brand); }
.win-name { min-width: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; font-weight: 700; }
.win-cta {
  padding: 4px 8px; border: 1px solid var(--bq-edge-strong); border-radius: 6px; color: var(--muted);
  font-size: var(--text-xs); font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
.win-btn:hover:not(:disabled) { border-color: var(--brand); background: linear-gradient(180deg, color-mix(in srgb, var(--brand-fill) 22%, transparent), color-mix(in srgb, var(--brand-fill) 10%, transparent)), var(--bq-raised-grad); }
.win-btn:hover:not(:disabled) .win-cta { color: var(--on-brand); background: var(--bq-crimson-fill); border-color: transparent; }
.match-card > .button-row, .match-card > .queue-section { margin: 0; }
/* Two buttons side by side while each keeps a readable label; stacked on the narrowest screens. Media queries rather
   than a container query, which costs an extra layout pass on every render. */
@media (min-width: 360px) {
  .winner-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .win-btn { grid-template-columns: minmax(0, 1fr); gap: var(--space-1); }
  .win-btn .icon { display: none; }
  .win-cta { justify-self: start; }
}
/* Queue as a full-width list (600-1279 px): teams left, winner buttons in a column at the right. */
@media (min-width: 600px) and (max-width: 1279px) {
  .match-card-main { grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); align-items: stretch; }
  .match-card-teams { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; column-gap: var(--space-2); }
  .winner-buttons { grid-template-columns: 1fr; }
  .win-btn { grid-template-columns: minmax(0, 1fr) auto; min-height: var(--control-h); }
  .win-cta { justify-self: end; }
}
@media (prefers-reduced-motion: no-preference) {
  .match-card { transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out); }
}

/* Board status strip under the bracket. */
.board-strip { display: grid; gap: var(--space-3); padding: var(--space-3); }
.board-strip-lead { display: flex; align-items: center; gap: var(--space-3); }
.board-strip-lead h2 { margin: 0; font-family: var(--font-display); font-style: italic; font-size: var(--text-lg); }
.board-strip-lead p { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.board-strip-list { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); }
.board-tile {
  display: grid; gap: var(--space-2); align-content: start; padding: var(--space-2) var(--space-3); border: 1px solid var(--bq-edge); border-radius: var(--radius);
  background: var(--bq-surface-2); box-shadow: var(--bq-highlight); min-width: 0;
}
.board-tile[data-state="busy"] { border-color: color-mix(in srgb, var(--good) 30%, var(--bq-edge)); }
.board-tile[data-state="free"] { border-style: dashed; border-color: color-mix(in srgb, var(--warn) 50%, var(--bq-edge)); background: linear-gradient(180deg, var(--warn-soft), transparent 60%), var(--bq-surface-2); }
.board-tile[data-state="offline"] { border-style: dashed; background: var(--bq-hatch), var(--bq-surface-1); }
.board-tile-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.board-tile-match { display: grid; margin: 0; font-size: var(--text-sm); font-weight: 600; overflow-wrap: anywhere; }
.board-tile-assign { display: grid; gap: var(--space-2); }
.board-tile-assign select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.board-tile-assign .btn { min-height: 40px; }

/* Boards */
.boards-layout { display: grid; gap: var(--space-4); }
.board-grid { display: grid; gap: var(--space-3); margin: 0; padding: 0; list-style: none; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }
.board-card {
  position: relative; display: grid; gap: var(--space-3); align-content: start; padding: var(--space-4); list-style: none;
  border: 1px solid var(--bq-edge); border-radius: var(--radius-lg); background: var(--bq-surface-grad); box-shadow: var(--bq-highlight);
}
/* A thin status edge along the top: green when free, crimson while a match is on the board, hatched when out of service. */
.board-card::before { content: ""; position: absolute; inset: -1px -1px auto -1px; height: 3px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--good); }
.board-card[data-status="Enabled"][data-occupied="false"] { background: linear-gradient(180deg, var(--good-soft), transparent 55%), var(--bq-surface-grad); }
.board-card[data-occupied="true"] { border-color: color-mix(in srgb, var(--brand-fill) 35%, var(--bq-edge)); box-shadow: var(--bq-highlight), var(--bq-shadow-2); }
.board-card[data-occupied="true"]::before { background: var(--bq-crimson-fill); }
.board-card[data-status="OutOfService"] { border-style: dashed; background: var(--bq-hatch), var(--bq-surface-1); }
.board-card[data-status="OutOfService"]::before { background: var(--bq-edge-strong); }
.board-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
.board-card-head h3 { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; font-family: var(--font-display); font-style: italic; font-size: var(--text-xl); overflow-wrap: anywhere; }
.board-card-head h3 .icon { color: var(--muted); }
.board-card-match { display: grid; gap: var(--space-1); margin: 0; padding: var(--space-3); border: 1px solid var(--bq-edge); border-radius: var(--radius); background: var(--bq-surface-1); overflow-wrap: anywhere; }
.board-card-match .match-label { color: var(--brand); font-size: var(--text-xs); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.board-card-match strong { font-size: var(--text-md); }
.board-card-empty { margin: 0; padding: var(--space-3); border: 1px dashed var(--bq-edge-strong); border-radius: var(--radius); color: var(--muted); text-align: center; }
.board-card .button-row { margin: 0; }
.board-card label { display: grid; gap: 4px; flex: 1 1 12rem; font-size: var(--text-sm); color: var(--muted); }
.board-tools { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); align-items: end; }
.board-tools .button-row { margin: 0; }
@media (min-width: 1280px) {
  .boards-layout.with-ready { grid-template-columns: minmax(320px, 2fr) minmax(0, 3fr); align-items: start; }
}

/* Teams */
.team-list { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; counter-reset: team; }
.team-list li {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-2) var(--space-3);
  border: 1px solid var(--bq-edge); border-radius: var(--radius); background: var(--bq-surface-grad); counter-increment: team; overflow-wrap: anywhere;
}
.team-list li::before { content: counter(team); min-width: 2ch; color: var(--muted); font-family: var(--font-display); font-weight: 600; text-align: right; }
.team-list .team-name { flex: 1 1 10rem; font-weight: 600; }
.team-list .btn { min-height: 40px; }
.boards-ready { display: none; }
@media (min-width: 1280px) {
  .boards-ready { display: grid; align-content: start; }
}

/* Sharing and results sections */
.access-section { display: grid; gap: var(--space-3); margin-bottom: var(--space-3); }
.access-section > h3 { margin: 0; }
.access-section .card-list, .access-section .form-grid, .access-section .button-row { margin: 0; }
#panel-results > h3, #panel-results .queue-group-head { margin-top: var(--space-5); }

/* M3 refinement: tighter vertical rhythm, team names first. */
.queue-panel { gap: var(--space-2); padding: var(--space-3); }
.queue-panel .queue-search input { min-height: 40px; }
.queue-panel .panel-header-icon { display: none; }
.queue-hint { padding: var(--space-1) var(--space-3); border: 0; background: none; color: var(--muted); }
.match-card-teams { display: block; font-size: var(--text-lg); line-height: 1.25; }
.match-card-teams .vs { margin: 0 var(--space-1); }
.match-card-meta { font-size: var(--text-xs); }
.workspace-split { gap: var(--space-3); }
@media (max-width: 599px) {
  .workspace { gap: var(--space-3); }
  .status-strip .breadcrumb { display: none; }
  .status-strip h1 { font-size: 1.375rem; }
  .status-head .button-row .btn { min-height: 40px; }
  .match-card-head { grid-template-columns: 3.5rem minmax(0, 1fr); }
  .match-card-number { font-size: var(--text-xl); }
  .match-card-stage { display: none; }
  .queue-panel .queue-group-head { margin-top: 0; }
}

/* Undo toast on phones: one compact row so it covers as little as possible; the page keeps room below the last match. */
@media (max-width: 599px) {
  .toast { flex-wrap: nowrap; gap: var(--space-1); padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3); }
  .toast > span { flex: 1 1 auto; min-width: 0; font-size: var(--text-sm); line-height: 1.25; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .toast .btn { min-height: 44px; }
  .toast-icon { display: none; }
}

@media (max-width: 599px) {
  /* Title and Auto-Assign share one row. */
  .queue-panel > .panel-header { flex-wrap: nowrap; margin-bottom: 0; }
  .queue-panel .panel-header-text { flex: 1 1 auto; }
  .queue-panel .panel-header-actions { flex: 0 0 auto; }
  .queue-panel .panel-header-actions .btn { min-height: 44px; padding-inline: var(--space-3); }
  /* The Undo toast rides under the sticky header, so it never covers a winner button or the bottom bar. */
  /* In the page flow below the header band, then stuck under the sticky header while scrolling: it never covers the title or the bottom bar. */
  .toast, .in-workspace .toast { position: sticky; inset: auto; top: calc(var(--header-h, 56px) + var(--space-2)); bottom: auto; margin: 0; }
  .workspace.has-toast, .in-workspace .workspace.has-toast { padding-bottom: calc(var(--nav-h) + var(--space-6)); }
}

/* Phone header: title and the main control share a row; the facts run underneath across the full width. */
@media (max-width: 599px) {
  .status-strip { gap: var(--space-2); padding: var(--space-3); }
  .status-head { grid-template-columns: minmax(0, 1fr) auto; row-gap: var(--space-1); }
  .status-title { display: contents; }
  .status-strip h1 { grid-column: 1; font-size: 1.25rem; line-height: 1.15; }
  .status-head > .button-row { grid-column: 2; grid-row: 1; }
  .status-strip .tournament-card-meta { grid-column: 1 / -1; grid-row: 2; margin: 0; gap: var(--space-1) var(--space-3); font-size: var(--text-sm); }
  .status-strip .tournament-card-meta .icon { display: none; }
  .status-strip .btn-lg { min-height: 44px; padding-inline: var(--space-3); }
}
@media (max-width: 719px) {
  .status-strip .stat-tile { padding: var(--space-1) var(--space-2); }
  .status-strip .stat-tile-value { font-size: var(--text-md); }
  /* Value and label share one line so the 2 x 2 grid stays short. */
  .status-strip .stat-tile-body { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 var(--space-1); }
  .status-strip .stat-tile-label { font-size: var(--text-xs); }
}
@media (max-width: 379px) {
  .queue-panel .panel-header-text h2 { font-size: var(--text-lg); white-space: nowrap; }
  .queue-panel .panel-header-actions .btn { padding-inline: var(--space-2); }
}
