/* True-black flat: elevation by lightness alone (#000 ground, #111 card, #2a2a2a nested), no card borders or
   shadows, the primary action is an inverted white pill. The only hues are the two CS2 sides, used on team data. */
:root {
  --ground: #000000;
  --surface: #111111;
  --raised: #2a2a2a;
  --active: #222222;
  --rule: #1f1f1f;
  --chrome-rule: #1a1a1a;
  --control: #444444;
  --text: #ffffff;
  --nav: #bbbbbb;
  --muted: #b4b4b4;
  --faint: #949494;
  --ct: #6ea8ef;
  --t: #e3b341;
  --positive: #3fc07a;
  --negative: #e5566f;
  --pill-positive-bg: #172a1d; --pill-positive-ink: #3fc07a;
  --pill-negative-bg: #2c1a20; --pill-negative-ink: #e5566f;
  --pill-warning-bg: #2b2414; --pill-warning-ink: #e5a93b;
  --pill-neutral-bg: #222222; --pill-neutral-ink: #ffffff;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --fs-title: 20px; --fs-section: 16px; --fs-kpi: 24px; --fs-body: 14px; --fs-small: 12px;

  --radius-card: 20px;
  --radius-inner: 12px;
  --radius-field: 10px;
  --radius-control: 999px;
  --sidebar-width: 220px;
  --topbar: 64px;
  --gutter: 29px;
  --gap: 14px;
  --pad: 22px;
  --control-height: 36px;
  --rail: 384px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-press: 120ms; --t-hover: 150ms; --t-ui: 200ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font: var(--fs-body)/20px var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.num, table { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell: ruled T-frame ----------
   1440 wide: 220 sidebar + 1 rule + 2 x 29 gutter = 279, leaving 1161 of canvas.
   Lobby grid: 1fr + 14 + 384 rail, so the main column is 763 and each team card (763 - 14) / 2 = 374.5. */
.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100svh; }
.sidebar { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; border-right: 1px solid var(--chrome-rule); }
.brand { display: flex; align-items: center; gap: 10px; height: var(--topbar); padding: 0 20px; border-bottom: 1px solid var(--chrome-rule); font-weight: 600; font-size: var(--fs-section); }
.brand img { width: 22px; height: 22px; flex: none; }
.nav { display: grid; gap: 0; padding: 16px 12px; }
.nav-label { margin: 18px 8px 6px; font-size: var(--fs-small); color: var(--faint); }
.nav-label:first-child { margin-top: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 8px; border-radius: 8px; color: var(--nav); transition: color var(--t-hover) ease; }
.nav-item svg { width: 16px; height: 16px; flex: none; }
.nav-item:hover, .nav-item[aria-current="page"] { color: var(--text); }
.nav-item .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--pill-warning-bg); color: var(--pill-warning-ink); font-size: var(--fs-small); line-height: 20px; text-align: center; font-weight: 500; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--chrome-rule); }
.me .who { min-width: 0; flex: 1; }
.me .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .role { font-size: var(--fs-small); color: var(--faint); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; height: var(--topbar); padding: 0 var(--gutter); background: var(--ground); border-bottom: 1px solid var(--chrome-rule); }
.topbar .status-line { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; }
.topbar .status-line strong { color: var(--text); font-weight: 500; }
.topbar .spacer { flex: 1; }
.topbar .address { display: flex; align-items: center; gap: 10px; height: 100%; padding-left: 20px; border-left: 1px solid var(--chrome-rule); }
.topbar .address code { font: 500 var(--fs-body)/20px var(--mono); }
.topbar .menu-toggle { display: none; }
.canvas { padding: 28px var(--gutter) 48px; }

/* ---------- title row ---------- */
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.title-row h1 { font-size: var(--fs-title); line-height: 28px; font-weight: 600; letter-spacing: -0.01em; }
.title-row .sub { margin-top: 4px; color: var(--muted); font-size: 15px; }
.title-row .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.stamp { color: var(--faint); font-size: var(--fs-small); }

/* ---------- surfaces ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail); gap: var(--gap); align-items: start; }
.stack { display: grid; gap: var(--gap); min-width: 0; }
.card { background: var(--surface); border-radius: var(--radius-card); padding: var(--pad); min-width: 0; }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card h2 { font-size: var(--fs-section); line-height: 22px; font-weight: 600; }
.rail-section h2 { font-size: var(--fs-section); line-height: 22px; font-weight: 600; margin: 0 0 8px; }
.rail-section + .rail-section { margin-top: 16px; }
.meta { color: var(--faint); font-size: var(--fs-small); }

/* KPI strip: one container, cells divided by a 1px line */
.kpis { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--surface); border-radius: var(--radius-card); }
.kpi { padding: 18px var(--pad); min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--rule); }
.kpi-label { color: var(--muted); }
.kpi-value { margin-top: 6px; font-size: var(--fs-kpi); line-height: 30px; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 14px; color: var(--muted); font-weight: 400; margin-left: 2px; }
.kpi-note { margin-top: 2px; font-size: var(--fs-small); color: var(--faint); }

/* ---------- teams: the two rosters face to face ---------- */
.teams { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.team { display: flex; flex-direction: column; }
.team .team-foot { margin-top: auto; padding-top: 14px; }
.team[data-side="ct"],
.team[data-side="knife_ct"] { --side: var(--ct); }
.team[data-side="t"],
.team[data-side="knife_t"] { --side: var(--t); }
.team[data-side="knife"],
.team[data-side="veto"] { --side: var(--muted); }
.team-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 4px 12px; margin-bottom: 16px; }
.side { display: flex; align-items: center; gap: 8px; color: var(--side); font-size: var(--fs-small); font-weight: 500; }
.side::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--side); flex: none; }
.team-name { grid-column: 1; display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 18px; line-height: 24px; font-weight: 600; }
.team-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-count { grid-column: 2; grid-row: 1 / 3; align-self: end; font-size: var(--fs-kpi); line-height: 30px; font-weight: 500; font-variant-numeric: tabular-nums; }
.team-count small { font-size: 14px; color: var(--muted); font-weight: 400; }
.fill { height: 4px; border-radius: 999px; background: var(--raised); margin-bottom: 14px; overflow: hidden; }
.fill > i { display: block; height: 100%; background: var(--side); border-radius: inherit; }

.roster { display: grid; gap: 6px; }
.player { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px 8px 10px; border-radius: var(--radius-inner); background: var(--raised); }
.player.me-row { box-shadow: inset 2px 0 0 var(--side); }
.player .who { min-width: 0; flex: 1; }
.player .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .sub { font-size: var(--fs-small); color: var(--faint); }
.player .row-actions { display: flex; gap: 2px; flex: none; }
.slot { display: flex; align-items: center; min-height: 52px; padding: 0 14px; border: 1px dashed var(--control); border-radius: var(--radius-inner); color: var(--faint); }
.team-foot { margin-top: 14px; display: flex; min-height: 30px; align-items: center; justify-content: space-between; gap: 12px; }
.team-foot .note { color: var(--faint); font-size: var(--fs-small); }

.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; object-fit: cover; background: var(--active); display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.avatar.lg { width: 36px; height: 36px; }
.online-dot { position: relative; }
.online-dot::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--positive); box-shadow: 0 0 0 2px var(--raised); }

/* ---------- connect card: the answer once the server is live ---------- */
.connect { display: grid; gap: 16px; }
.connect h2 { font-size: var(--fs-title); line-height: 28px; }
.connect .cmd { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 18px; border-radius: var(--radius-inner); background: var(--raised); }
.connect .cmd code { flex: 1; min-width: 0; font: 500 18px/28px var(--mono); overflow-x: auto; white-space: nowrap; }
.connect .facts { display: flex; flex-wrap: wrap; gap: 8px 28px; color: var(--muted); }
.connect .facts strong { color: var(--text); font-weight: 500; }

/* ---------- map veto ---------- */
.veto-turn { padding: 16px 18px; border-radius: var(--radius-inner); background: var(--raised); margin-bottom: 14px; }
.veto-now { font-size: 18px; line-height: 24px; font-weight: 600; margin-bottom: 4px; }
.veto-sides { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.veto-maps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.veto-map { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; padding: 8px 10px 8px 14px; border-radius: var(--radius-inner); background: var(--ground); }
.veto-map .map-name { font-weight: 500; }
.veto-map .veto-label { font-size: var(--fs-small); color: var(--faint); }
.veto-map[data-state="banned"] .map-name { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--control); }
.veto-map[data-state="picked"] { background: var(--raised); box-shadow: inset 0 0 0 1px var(--muted); }
.veto-map[data-state="picked"] .veto-label { color: var(--muted); }

/* ---------- series ---------- */
.score { display: flex; align-items: baseline; gap: 8px; color: var(--muted); white-space: nowrap; }
.score strong { color: var(--text); font-size: var(--fs-kpi); line-height: 30px; font-weight: 500; }
.series-maps { display: grid; }
.series-maps li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 8px 0; }
.series-maps li + li { border-top: 1px solid var(--rule); }
.series-maps .name { font-weight: 500; }
.result-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule); }
.result-row .muted { margin-right: auto; }

/* ---------- live scoreboard ---------- */
.scoreboard { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px 24px; align-items: center; padding: 8px 0 4px; }
.scoreboard.compact { padding: 0 0 12px; }
.sb-team { display: grid; gap: 4px; min-width: 0; }
.sb-team:last-child { text-align: right; justify-items: end; }
.sb-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.sb-score { font-size: 48px; line-height: 1; font-weight: 600; letter-spacing: -0.03em; }
.sb-team[data-side="ct"] .sb-score { color: var(--ct); }
.sb-team[data-side="t"] .sb-score { color: var(--t); }
.sb-mid { display: grid; gap: 4px; justify-items: center; text-align: center; color: var(--muted); }
.sb-sep { font-size: 28px; line-height: 1; color: var(--faint); }
.sb-map { font-weight: 500; color: var(--text); }
.sb-series, .sb-note { font-size: var(--fs-small); color: var(--faint); }
.stats-block { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--rule); }
.table-wrap { overflow-x: auto; }
table.stats { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.stats th, table.stats td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--rule); }
table.stats th { color: var(--faint); font-weight: 500; font-size: var(--fs-small); }
table.stats td.name, table.stats th:first-child, table.stats td.team, table.stats th:nth-child(2) { text-align: left; }
table.stats td.name { font-weight: 500; }
table.stats td.team[data-team="team1"] { color: var(--ct); }
table.stats td.team[data-team="team2"] { color: var(--t); }
table.stats tbody tr:last-child td { border-bottom: 0; }

/* ---------- match history ---------- */
.history-list { display: grid; gap: 8px; }
.history-row { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); color: inherit; text-decoration: none; transition: background-color var(--t-hover) ease; }
.history-row:hover { background: var(--raised); }
.history-main { display: grid; gap: 6px; min-width: 0; flex: 1; }
.history-teams { font-size: 18px; line-height: 24px; font-weight: 500; }
.history-teams strong { font-size: 22px; }
.history-maps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.history-side { display: grid; gap: 8px; justify-items: end; text-align: right; flex: none; }
a.link.back { display: inline-block; margin-bottom: 6px; padding-left: 0; }

/* ---------- key-value lists ---------- */
.kv { display: grid; }
.kv > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 11px 0; }
.kv > div + div { border-top: 1px solid var(--rule); }
.kv dt { color: var(--muted); }
.kv dd { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
.rules > div:nth-child(2) { border-top: 0; }

.people { display: grid; }
.people li { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 0; }
.people li + li { border-top: 1px solid var(--rule); }
.people .name { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- launch log ---------- */
.log { display: grid; gap: 0; }
.log li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 9px 0; }
.log li + li { border-top: 1px solid var(--rule); }
.log .mark { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); transform: translateY(-1px); }
.log li[data-kind="done"] .mark { background: var(--positive); }
.log li[data-kind="error"] .mark { background: var(--negative); }
.log li[data-kind="error"] .text { color: var(--negative); }
.log li.current .mark { background: var(--text); animation: pulse 1.2s ease-in-out infinite; }
.log time { color: var(--faint); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: var(--fs-small); font-weight: 500; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); white-space: nowrap; flex: none; }
.pill.pos { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.neg { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.pos { background: var(--positive); }
.dot.neg { background: var(--negative); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--control-height); padding: 0 16px; border-radius: var(--radius-control); border: 1px solid var(--control); background: transparent; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color var(--t-hover) ease, border-color var(--t-hover) ease, transform var(--t-press) var(--ease-out); }
.btn:hover { background: var(--active); border-color: #5a5a5a; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--text); color: #000; border-color: var(--text); }
.btn.primary:hover { background: #e6e6e6; border-color: #e6e6e6; }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { cursor: not-allowed; color: var(--faint); border-color: var(--active); background: transparent; transform: none; }
.btn.primary[disabled] { background: var(--raised); border-color: var(--raised); color: var(--muted); }
.link { padding: 4px 8px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 13px; cursor: pointer; transition: color var(--t-hover) ease, background-color var(--t-hover) ease; }
.link:hover { color: var(--text); background: var(--active); }
.link.danger:hover { color: var(--negative); }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--active); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

.field { display: grid; gap: 8px; min-width: 0; }
.field > label, .field > .label { font-weight: 500; }
.field .hint { color: var(--faint); font-size: var(--fs-small); }
.input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--radius-field); background: var(--ground); font-variant-numeric: tabular-nums; transition: border-color var(--t-hover) ease; }
.input:hover { border-color: #5a5a5a; }
.input:focus { outline: none; border-color: var(--text); }
.input[disabled] { color: var(--faint); border-color: var(--active); }
.input::placeholder { color: var(--faint); }
.input-unit { position: relative; }
.input-unit .input { padding-right: 48px; }
.input-unit span { position: absolute; right: 12px; top: 10px; color: var(--faint); pointer-events: none; }
.panel > .field + .field, .panel > .field.when, .switch-row + .field { margin-top: 18px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.segmented { display: inline-flex; flex-wrap: wrap; width: max-content; max-width: 100%; padding: 3px; gap: 2px; border-radius: 999px; background: var(--ground); }
.segmented button { height: 30px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; transition: color var(--t-hover) ease, background-color var(--t-hover) ease; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--raised); color: var(--text); }
.segmented button[disabled] { cursor: not-allowed; }

.switch-row { display: flex; align-items: flex-start; gap: 16px; }
.switch-row + .switch-row, .fields + .switch-row, .switch-row + .fields, .switch-row + .field, .field + .switch-row { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--rule); }
.switch-row .what { flex: 1; min-width: 0; }
.switch-row .title { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.switch-row .desc { margin-top: 2px; color: var(--muted); }
.switch { appearance: none; flex: none; margin: 1px 0 0; width: 33px; height: 20px; border-radius: 999px; background: var(--control); position: relative; cursor: pointer; transition: background-color var(--t-ui) ease; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform var(--t-ui) var(--ease-out); }
.switch:checked { background: var(--positive); }
.switch:checked::after { transform: translateX(13px); }
.switch[disabled] { opacity: 0.5; cursor: not-allowed; }

/* map picker */
.maps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.map-btn { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius-inner); background: var(--ground); text-align: left; cursor: pointer; transition: border-color var(--t-hover) ease; }
.map-btn:hover { border-color: var(--control); }
.map-btn[aria-pressed="true"] { border-color: var(--text); background: var(--raised); }
.map-btn .map-name { font-weight: 500; }
.map-btn .map-code { font-size: var(--fs-small); color: var(--faint); }
.map-btn[disabled] { cursor: not-allowed; opacity: 0.6; }

/* ---------- settings: label column beside a panel ---------- */
.settings { display: grid; max-width: 1152px; }
.setting { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 40px; padding: 28px 0; }
.setting + .setting { border-top: 1px solid var(--rule); }
.setting:first-child { padding-top: 4px; }
.setting .about { padding-top: 6px; }
.setting .about h2 { font-size: var(--fs-section); line-height: 22px; font-weight: 500; }
.setting .about p { margin-top: 4px; color: var(--muted); }
.setting .about .now { margin-top: 14px; color: var(--text); font-weight: 500; }
.setting .about .error { margin-top: 10px; color: var(--negative); }
.panel { background: var(--surface); border-radius: 16px; padding: 18px; min-width: 0; }

/* ---------- tables ---------- */
.table-card { padding: 8px var(--pad) 10px; }
table { width: 100%; border-collapse: collapse; }
th { height: 40px; padding: 0 12px; text-align: left; font-weight: 400; font-size: var(--fs-small); color: var(--faint); white-space: nowrap; }
td { padding: 10px 12px; border-top: 1px solid var(--rule); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; text-align: right; }
td .who { display: flex; align-items: center; gap: 12px; min-width: 0; }
td .name { font-weight: 500; }
td .sub { font-size: var(--fs-small); color: var(--faint); font-family: var(--mono); }
td .acts { display: inline-flex; gap: 2px; justify-content: flex-end; flex-wrap: wrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* ---------- console ---------- */
.console-out { height: 420px; overflow: auto; margin: 0; padding: 16px 18px; border-radius: var(--radius-inner); background: var(--ground); font: 13px/20px var(--mono); white-space: pre-wrap; word-break: break-word; color: var(--muted); }
.console-out .cmd { color: var(--text); }
.console-out .err { color: var(--negative); }
.console-form { display: flex; gap: 8px; margin-top: 14px; }
.console-form .input { font-family: var(--mono); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- empty, notices ---------- */
.empty { padding: 14px 16px; border: 1px dashed var(--control); border-radius: var(--radius-inner); color: var(--muted); }
.notice { padding: 12px 16px; border-radius: var(--radius-inner); background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.notice.neg { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }

/* ---------- sign-in and gate screens ---------- */
.gate { min-height: 100svh; display: grid; place-items: center; padding: 24px; }
.gate-card { width: min(440px, 100%); display: grid; gap: 20px; }
.gate-card .brand { height: auto; padding: 0; border: 0; }
.gate-card h1 { font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.01em; }
.gate-card p { color: var(--muted); font-size: 15px; line-height: 22px; }
.gate-card .btn { height: 44px; justify-self: start; padding: 0 22px; }
.gate-card .steam-btn svg { width: 18px; height: 18px; }
.gate-note { color: var(--faint); }
.dev-login { display: grid; gap: 10px; padding: 16px; border-radius: 16px; background: var(--surface); }
.dev-login .row { display: flex; gap: 8px; }

/* ---------- toasts (they float, so they may cast a shadow) ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: grid; gap: 8px; width: min(380px, calc(100vw - 40px)); }
.toast { padding: 12px 16px; border-radius: 14px; background: var(--raised); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); animation: toast-in var(--t-ui) var(--ease-out); }
.toast.error { background: #3a1d24; color: #ffd7de; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- tablet and phone ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .rail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
  .rail-section + .rail-section { margin-top: 0; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0; z-index: 30; width: 100%; height: 100%; background: var(--ground); border-right: 0; transform: translateX(-100%); visibility: hidden; transition: transform var(--t-ui) var(--ease-out), visibility var(--t-ui); }
  .sidebar.open { transform: none; visibility: visible; }
  .sidebar .close-menu { display: inline-grid; margin-left: auto; }
  .topbar .menu-toggle { display: inline-grid; margin-left: -8px; }
  .topbar { height: 56px; padding: 0 16px; gap: 10px; }
  .topbar .address { padding-left: 12px; }
  .canvas { padding: 20px 16px 40px; }
  .setting { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .setting .about { padding-top: 0; }
  .maps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 901px) {
  .sidebar .close-menu { display: none; }
}
@media (max-width: 700px) {
  .teams { grid-template-columns: minmax(0, 1fr); }
  .rail { grid-template-columns: minmax(0, 1fr); }
  .rail-section + .rail-section { margin-top: 2px; }
  .kpis { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi + .kpi { border-left: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--rule); }
  .kpi:nth-child(2n) { border-left: 1px solid var(--rule); }
  .title-row { flex-direction: column; align-items: stretch; }
  .title-row .actions { justify-content: flex-start; }
  .rules { grid-template-columns: minmax(0, 1fr); }
  .veto-maps { grid-template-columns: minmax(0, 1fr); }
  .scoreboard { gap: 10px 12px; }
  .sb-score { font-size: 36px; }
  .history-row { flex-direction: column; gap: 12px; }
  .history-side { justify-items: start; text-align: left; }
  .card > header { flex-wrap: wrap; }
  .rules > div:nth-child(2) { border-top: 1px solid var(--rule); }
  .fields, .fields.three { grid-template-columns: minmax(0, 1fr); }
  .maps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar .status-line .extra { display: none; }
  .topbar .address code { font-size: 13px; }
  .connect .cmd code { font-size: 15px; }
  .btn { height: 44px; }
  .btn.small { height: 36px; }
  /* the players table becomes two-line rows */
  .users-table thead { display: none; }
  .users-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 12px 0; border-top: 1px solid var(--rule); }
  .users-table tr:first-child { border-top: 0; }
  .users-table td { padding: 0; border: 0; text-align: left; }
  .users-table td.c-team, .users-table td.c-seen { display: none; }
  .users-table td.c-status { text-align: right; }
  .users-table td.c-acts { grid-column: 1 / -1; text-align: left; }
  .users-table td .acts { justify-content: flex-start; margin-left: 32px; }
  .console-out { height: 320px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
