/* Shared look, taken from the original scoreboard: dark arena, red/blue title bar, gold highlights. */
:root {
  --bg: #0E1220;
  --panel: #171C2E;
  --line: #2C3552;
  --fg: #FFFFFF;
  --muted: #A9B3CF;
  --red: #D7262E;
  --blue: #1E6FD9;
  --gold: #FFC93C;
  --ink: #0E1220;
  --ok: #2BB673;
  --build: #1E6FD9;
  --demo: #B45CE0;
  --clean: #2BB673;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Barlow', 'Helvetica Neue', Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 16px; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--gold); }
img { max-width: 100%; }

/* Title bar */
.top { display: flex; align-items: center; gap: 10px; background: linear-gradient(100deg, var(--red) 0%, #8E1B1F 48%, #0B3F8C 52%, var(--blue) 100%); border: 3px solid #000; border-radius: 6px; padding: 6px 10px; }
.top h1 { margin: 0; flex: 1; min-width: 0; font-family: var(--display); font-style: italic; font-weight: 900; font-size: clamp(22px, 3.2vw, 40px); line-height: 1; text-shadow: 2px 2px 0 #000; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn { width: 44px; height: 44px; border-radius: 6px; border: 2px solid rgba(255,255,255,.5); background: rgba(0,0,0,.35); color: #fff; cursor: pointer; display: grid; place-items: center; flex: 0 0 auto; padding: 0; }
.iconbtn svg { width: 24px; height: 24px; }
.textbtn { min-height: 44px; padding: 4px 12px; border-radius: 6px; border: 2px solid rgba(255,255,255,.5); background: rgba(0,0,0,.35); color: #fff; font-family: var(--display); font-weight: 800; font-size: 16px; letter-spacing: .5px; cursor: pointer; white-space: nowrap; }

/* Content pages */
.shell { padding: 8px max(12px, env(safe-area-inset-right, 0px)) 40px max(12px, env(safe-area-inset-left, 0px)); }
.shell > .top { position: sticky; top: 8px; z-index: 10; }
.page { max-width: 1100px; margin: 0 auto; padding-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.page h2 { margin: 0; font-family: var(--display); font-style: italic; font-weight: 900; font-size: clamp(26px, 4vw, 36px); line-height: 1; }
.page h3 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 22px; }
.panel { background: var(--panel); border: 3px solid var(--line); border-radius: 8px; padding: 14px; }
.muted { color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .grow { flex: 1; min-width: 160px; }

/* Buttons + forms */
.btn { min-height: 44px; padding: 6px 16px; border-radius: 6px; border: 2px solid var(--line); background: #0A0E19; color: #fff; font-family: var(--display); font-weight: 800; font-size: 17px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn.danger { border-color: var(--red); color: #FF8A8F; }
.btn.danger.armed { background: var(--red); color: #fff; }
.btn.small { min-height: 36px; padding: 4px 10px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: default; }
.input, .field input, .field select, textarea.input { min-height: 44px; font: 600 17px var(--body); color: var(--fg); background: #0A0E19; border: 2px solid var(--line); border-radius: 6px; padding: 6px 10px; width: 100%; }
textarea.input { min-height: 90px; resize: vertical; }
label.stack { display: flex; flex-direction: column; gap: 4px; font-weight: 700; }
label.stack small { color: var(--muted); font-weight: 600; }
.field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.field label { font-weight: 700; }
.field small { display: block; color: var(--muted); font-weight: 600; }
.field input, .field select { width: auto; }
.seg3 { display: flex; border: 2px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg3 button { min-height: 44px; padding: 6px 12px; border: 0; background: #0A0E19; color: var(--muted); font-family: var(--display); font-weight: 800; font-size: 16px; cursor: pointer; }
.seg3 button[aria-pressed="true"] { background: var(--gold); color: var(--ink); }
.row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; }
.status { font-size: 12px; color: var(--muted); }
.err { color: #FF8A8F; font-weight: 700; }

/* Dialog sheets */
.sheet { position: fixed; inset: 0; background: rgba(5,8,16,.85); display: grid; place-items: center; z-index: 20; padding: 16px; }
.sheet .card { width: min(560px, 100%); max-height: 100%; overflow: auto; background: var(--panel); border: 3px solid var(--gold); border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.sheet .card.wide { width: min(900px, 100%); }
.sheet .card > * { flex-shrink: 0; } /* scroll the card instead of squashing its contents */
.sheet h2 { margin: 0; font-family: var(--display); font-style: italic; font-weight: 900; font-size: 30px; }

/* Menu drawer */
.drawer { position: fixed; inset: 0; z-index: 50; display: flex; background: rgba(5,8,16,.75); }
.drawer nav { width: min(320px, 86vw); height: 100%; overflow: auto; background: var(--panel); border-right: 3px solid var(--gold); padding: max(12px, env(safe-area-inset-top, 0px)) 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.drawer .navhead { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 10px; font-family: var(--display); font-style: italic; font-weight: 900; font-size: 26px; }
.drawer a, .drawer .navbtn { min-height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 14px; border-radius: 6px; border: 0; background: transparent; color: #fff; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 22px; text-align: left; cursor: pointer; }
.drawer a:hover, .drawer .navbtn:hover { background: #0A0E19; }
.drawer a[aria-current="page"] { background: var(--gold); color: var(--ink); }
.drawer .sep { border-top: 2px solid var(--line); margin: 8px 0; }
.drawer .who { color: var(--muted); font-size: 14px; padding: 4px 14px; }
@media (prefers-reduced-motion: no-preference) { .drawer nav { animation: slidein .18s ease-out; } @keyframes slidein { from { transform: translateX(-100%); } to { transform: none; } } }

/* Small helpers */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 700; background: #0A0E19; border: 2px solid var(--line); }
.pill.need { background: var(--red); border-color: var(--red); color: #fff; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; background: #000; color: #fff; border: 2px solid var(--gold); border-radius: 8px; padding: 10px 16px; font-weight: 700; max-width: calc(100% - 32px); }
