/* FastBets. Tokens from DESIGN.md. Dark is the arena palette, light the daylight one. */
:root {
  --ground: #F5F6F8; --surface: #FFFFFF; --surface-2: #E9ECF1; --line: #CBD2DB;
  --text: #12161C; --muted: #5C6675; --armed: #E0640A; --disarmed: #7A838F;
  --prod: #C8102E; --demo: #1F6FEB; --good: #1F9D55; --warn: #C98A00; --bad: #D63A3A; --exit: #2F6FDE;
  --display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", Helvetica, Arial, sans-serif;
}
.frame.dark, body.dark {
  --ground: #0E1116; --surface: #161C24; --surface-2: #1F2731; --line: #2C3540;
  --text: #F2F4F7; --muted: #98A2B3; --armed: #FF7A1A; --disarmed: #5B6470;
  --prod: #E0203E; --demo: #3B82F6; --good: #35C46A; --warn: #F2B01E; --bad: #E23D3D; --exit: #5B8DEF;
}
@font-face { font-family: "Barlow Condensed"; font-weight: 600 800; src: local("Barlow Condensed"), url(/static/fonts/BarlowCondensed.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400 600; src: local("IBM Plex Sans"), url(/static/fonts/IBMPlexSans.woff2) format("woff2"); font-display: swap; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--ground); color: var(--text); font-family: var(--body); font-size: 0.875rem; -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
::selection { background: var(--armed); color: #fff; }
:focus-visible { outline: 3px solid var(--armed); outline-offset: 2px; }
button { font-family: inherit; }

.frame { height: 100dvh; display: flex; flex-direction: column; border: 6px solid var(--disarmed); background: var(--ground); overflow: hidden; }
.frame[data-armed="true"] { border-color: var(--armed); }
.strip { display: flex; align-items: center; justify-content: space-between; padding: 0.375rem 0.75rem; font: 700 0.8125rem var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: #fff; background: var(--prod); }
.frame[data-env="demo"] .strip { background: var(--demo); }
.dot { width: 0.625rem; height: 0.625rem; border-radius: 50%; background: var(--bad); display: inline-block; margin-right: 0.375rem; vertical-align: -1px; }
.frame[data-conn="up"] .dot { background: var(--good); }
.frame[data-conn="stale"] .dot { background: var(--warn); }
.strip .arm { font-size: 0.875rem; }
.strip .theme { font: 700 0.6875rem var(--display); letter-spacing: 0.1em; background: rgba(255,255,255,0.18); border: 0; color: #fff; border-radius: 4px; padding: 0.1875rem 0.375rem; margin-left: 0.5rem; min-height: 1.75rem; }
.navrow { display: flex; justify-content: space-between; align-items: center; padding: 0.375rem 0.625rem 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { font: 700 0.75rem var(--display); letter-spacing: 0.1em; padding: 0.4375rem 0.625rem; color: var(--muted); min-width: 2.75rem; min-height: 2.75rem; background: transparent; border: 0; }
.seg button[aria-selected="true"] { background: var(--text); color: var(--ground); }
.pager { display: inline-flex; align-items: center; gap: 0.25rem; font: 700 0.8125rem var(--display); }
.pager button { font: 800 1rem var(--display); width: 2.75rem; height: 2.25rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }

.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.screen.scroll { overflow-y: auto; padding: 0 0.75rem 1.5rem; }
.head { display: flex; justify-content: space-between; align-items: baseline; padding: 0.25rem 0.75rem; font-size: 0.75rem; color: var(--muted); }
.head b { color: var(--text); font-family: var(--display); font-size: 1.125rem; font-weight: 700; letter-spacing: 0.02em; }
.nosession { flex: 1; display: grid; place-content: center; gap: 0.75rem; text-align: center; padding: 1.5rem; }
.nosession p { margin: 0; font-size: 1rem; color: var(--muted); max-width: 26ch; }

.grid { flex: 1; display: grid; gap: 0.375rem; padding: 0.25rem 0.5rem; min-height: 0; touch-action: none; }
.grid.list { grid-template-columns: 1fr; grid-auto-rows: minmax(9.375rem, 1fr); }
.grid.roster { grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; }
.grid.roster .col { display: grid; grid-template-rows: auto; grid-auto-rows: minmax(5.25rem, 1fr); gap: 0.375rem; min-height: 0; }
@media (orientation: landscape) { .grid.roster .col { grid-template-columns: 1fr 1fr; } .grid.roster .col .teamname { grid-column: 1 / -1; } .grid.list { grid-template-columns: 1fr 1fr; } }
.grid .teamname { font: 700 0.75rem var(--display); letter-spacing: 0.12em; color: var(--muted); padding: 0.125rem 0.25rem 0; text-transform: uppercase; align-self: end; min-height: 1rem; }
.roster .btn .name { font-size: 1.375rem; }
.roster .btn .px { font-size: 1.5rem; }

.btn { position: relative; display: grid; grid-template-rows: auto auto 1fr auto; text-align: left; padding: 0.5rem 0.625rem 0.375rem; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); color: var(--text); user-select: none; -webkit-user-select: none; touch-action: none; min-height: 5.25rem; }
.list .btn { min-height: 9.375rem; }
.btn .name { font: 700 1.5rem/1 var(--display); letter-spacing: 0.01em; overflow-wrap: anywhere; }
.list .btn .name { font-size: 2.5rem; }
.btn .line { font-size: 0.75rem; color: var(--muted); margin-top: 0.125rem; }
.list .btn .line { font-size: 0.875rem; margin-top: 0.375rem; }
.btn .leg { display: block; }
.btn .leg b { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.btn .px { position: absolute; top: 0.5rem; right: 0.625rem; font: 800 1.625rem/1 var(--display); font-variant-numeric: tabular-nums; }
.list .btn .px { font-size: 2.5rem; }
.list .btn .px.legs { font-size: 1.375rem; color: var(--muted); }
.btn .cov { align-self: end; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; margin-top: 0.5rem; }
.btn .cov i { display: block; height: 100%; background: var(--good); }
.btn .cov.short i { background: var(--warn); }
.btn .tag { position: absolute; right: 0.5rem; bottom: 0.75rem; font: 600 0.625rem var(--body); letter-spacing: 0.06em; text-transform: uppercase; padding: 0.125rem 0.375rem; border-radius: 4px; background: var(--exit); color: #fff; }
.btn .tag.max { background: var(--surface-2); color: var(--text); }
.btn.stale { border-color: var(--warn); border-style: dashed; }
.btn.capped { opacity: 0.55; }
.frame[data-armed="false"] .btn { opacity: 0.45; }
.frame[data-conn="down"] .btn { opacity: 0.35; }
.btn.SENT { border-color: var(--text); }
.btn.FILLED, .btn.PARTIAL { border-color: var(--good); }
.btn.NONE, .btn.NOT_PLACED, .btn.CLEARED { border-color: var(--muted); }
.btn.BLOCKED, .btn.REJECTED { border-color: var(--bad); }
.btn.UNKNOWN, .btn.NO_ACK { border-color: var(--warn); }
.btn .res { position: absolute; left: 0.625rem; bottom: 0.375rem; font: 700 0.8125rem var(--display); letter-spacing: 0.06em; text-transform: uppercase; max-width: 70%; overflow-wrap: anywhere; }
.btn.FILLED .res, .btn.PARTIAL .res { color: var(--good); } .btn.NONE .res { color: var(--muted); }
.btn.BLOCKED .res, .btn.REJECTED .res { color: var(--bad); } .btn.UNKNOWN .res, .btn.NO_ACK .res { color: var(--warn); }
.btn.flash { animation: edge 0.25s steps(2) 3; }
@keyframes edge { 50% { border-color: var(--text); } }
@media (prefers-reduced-motion: reduce) { .btn.flash { animation: none; } }

.bottom { background: var(--surface-2); border-top: 1px solid var(--line); padding: 0.5rem 0.625rem 0.625rem; display: grid; gap: 0.5rem; }
.positions { display: grid; gap: 0.375rem; }
.pos { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.8125rem; }
.pos .who { font: 700 1rem var(--display); }
.pos .qty { font-variant-numeric: tabular-nums; color: var(--muted); }
.pos .ex { display: block; font-size: 0.75rem; color: var(--exit); font-variant-numeric: tabular-nums; }
.pos .ex button { font: 600 0.6875rem var(--body); border: 1px solid var(--exit); background: transparent; color: var(--exit); border-radius: 4px; padding: 0.125rem 0.375rem; min-height: 1.75rem; margin-left: 0.375rem; }
.pos.unknown .who { color: var(--warn); }
.notice { position: fixed; left: 0.75rem; right: 0.75rem; bottom: 6.5rem; z-index: 4; font: 700 0.9375rem var(--display); letter-spacing: 0.06em; text-transform: uppercase; padding: 0.625rem 0.75rem; border-radius: 8px; background: var(--exit); color: #fff; text-align: center; }
.notice.warn { background: var(--warn); color: #12161C; }
.notice.bad { background: var(--bad); }
.notice.good { background: var(--good); color: #12161C; }
.sheet .res-line { font: 700 1rem var(--display); }
.player { display: grid; grid-template-columns: 1fr auto auto auto; gap: 0.375rem; align-items: center; padding: 0.375rem 0; border-bottom: 1px solid var(--line); }
.player .nm { font: 600 0.875rem var(--body); }
.player .nm small { display: block; color: var(--muted); font-weight: 400; }
.player select { min-height: 2.25rem; padding: 0.25rem; font-size: 0.8125rem; width: auto; }
.player button { font: 600 0.75rem var(--body); padding: 0.375rem 0.625rem; min-height: 2.25rem; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.teamhead { font: 700 0.75rem var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0.75rem 0 0.25rem; }
.ctl { font: 700 0.8125rem var(--display); letter-spacing: 0.1em; text-transform: uppercase; padding: 0.625rem 0.75rem; min-height: 2.75rem; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); color: var(--text); }
.ctl.flat { border-color: var(--bad); color: var(--bad); }
.ctl.primary { background: var(--text); color: var(--ground); border-color: var(--text); }
.ctl.disarm { border-color: var(--armed); color: var(--armed); }
.frame[data-armed="false"] .ctl.disarm { background: var(--armed); color: #fff; }
.ctl:disabled { opacity: 0.5; }
.ctlrow { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.banner { font: 700 0.8125rem var(--display); letter-spacing: 0.08em; text-transform: uppercase; padding: 0.5rem; border-radius: 6px; background: var(--bad); color: #fff; text-align: center; }
.banner.warn { background: var(--warn); color: #12161C; }

.sheet { position: fixed; inset: auto 0 0 0; background: var(--surface); border-top: 2px solid var(--bad); padding: 0.875rem 0.875rem 1.125rem; display: grid; gap: 0.625rem; z-index: 5; }
@media (prefers-reduced-motion: no-preference) { .sheet { animation: up 150ms ease-out; } }
@keyframes up { from { transform: translateY(100%); } }
.sheet h3 { margin: 0; font: 700 1.375rem var(--display); }
.sheet .kv { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.75rem; font-size: 0.875rem; }
.sheet .kv span:nth-child(odd) { color: var(--muted); }
.sheet .kv b { font-variant-numeric: tabular-nums; }
.sheet .confirm { background: var(--bad); color: #fff; border-color: var(--bad); font-size: 1.125rem; padding: 0.875rem; }

h2 { font: 700 1.125rem var(--display); letter-spacing: 0.02em; margin: 1rem 0 0.5rem; }
.form { display: grid; gap: 0.625rem; }
.form label, .row label { display: grid; gap: 0.25rem; font-size: 0.8125rem; color: var(--muted); }
input, select { font: 400 1rem var(--body); padding: 0.625rem; min-height: 2.75rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); width: 100%; }
.row { display: flex; gap: 0.5rem; align-items: center; }
.muted { color: var(--muted); font-size: 0.8125rem; }
.err { color: var(--bad); font-size: 0.8125rem; margin: 0; }
.legbox { border: 1px solid var(--line); border-radius: 8px; padding: 0.625rem; display: grid; gap: 0.5rem; margin-top: 0.5rem; }
.legbox .two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 0.625rem; margin-top: 0.5rem; background: var(--surface); }
.card .t { font: 700 1rem var(--display); }
.card .cov { height: 6px; border-radius: 3px; background: var(--surface-2); margin-top: 0.375rem; overflow: hidden; }
.card .cov i { display: block; height: 100%; background: var(--good); }
.card .cov.short i { background: var(--warn); }
.card .actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.game { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.mk { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.375rem 0; }
.mk button { font: 600 0.75rem var(--body); padding: 0.375rem 0.625rem; min-height: 2.25rem; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.checks { list-style: none; padding: 0; margin: 0.5rem 0; display: grid; gap: 0.375rem; }
.checks li { display: flex; gap: 0.5rem; font-size: 0.8125rem; }
.checks li::before { content: "•"; color: var(--muted); }
.checks li.ok::before { content: "✓"; color: var(--good); } .checks li.bad::before { content: "✗"; color: var(--bad); }
.runbook { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.runbook td { border-top: 1px solid var(--line); padding: 0.375rem 0.25rem; vertical-align: top; }
.runbook td:first-child { font: 700 0.75rem var(--display); letter-spacing: 0.04em; white-space: nowrap; }
.report { width: 100%; font-size: 0.75rem; border-collapse: collapse; }
.report td, .report th { border-top: 1px solid var(--line); padding: 0.25rem; text-align: right; font-variant-numeric: tabular-nums; }
.report td:first-child, .report th:first-child { text-align: left; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.login-body { display: grid; place-items: center; min-height: 100dvh; padding: 1rem; }
.login { width: min(24rem, 100%); display: grid; gap: 1rem; }
.login h1 { font: 800 2.5rem var(--display); margin: 0; letter-spacing: 0.02em; }
.login form { display: grid; gap: 0.625rem; }
