/* Space Base Defender — styles. Same game chrome as Knowledge Keep and Bridge Builder (deep navy, gold for
   score and the main action, raised things on a solid 2px darker bottom edge). Readability floor for a
   Chromebook at arm's length or a projector: body 16px+, HUD numbers 22px+, answers 18px+, the prompt
   22-26px, tap targets 48px+. The game screen fits a 1366x768 window (about 1366x650 inside the browser)
   with no scrolling: the HUD bar, then the scene, which takes the rest. The reload question floats over
   the top of the scene (the aliens' entry zone, where the ship can't fly). */
:root {
  --sbd-page: #0e1424;
  --sbd-chrome: #141b2d;
  --sbd-panel: #1a2340;
  --sbd-raised: #243056;
  --sbd-raised-hover: #2d3b69;
  --sbd-edge: #0a0f1c;
  --sbd-line: #33406a;
  --sbd-line-soft: #27325a;
  --sbd-ink: #f2f5fc;
  --sbd-muted: #aeb8d4;
  --sbd-gold: #ffc53d;
  --sbd-gold-edge: #b9820c;
  --sbd-gold-ink: #1d1400;
  --sbd-gold-tint: #3a3014;
  --sbd-good: #3ddc97;
  --sbd-good-bg: #10392c;
  --sbd-bad: #ff8a8a;
  --sbd-bad-bg: #401a22;
  --sbd-amber: #ffb547;
  --sbd-red: #ff6b6b;
  --sbd-focus: #7cc4ff;
  --sbd-font: 'Lexend', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sbd-mono: 'DM Mono', ui-monospace, monospace;
  font-family: var(--sbd-font);
  font-size: 16px;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--sbd-ink); background: var(--sbd-page); min-height: 100vh; font-size: 16px; line-height: 1.45; }
.app-shell { color: var(--sbd-ink); background: var(--sbd-page); font-family: var(--sbd-font); }
button, input { font: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-weight: 800; letter-spacing: -.02em; }
:where(button, a, input, [tabindex]):focus-visible { outline: 3px solid var(--sbd-focus); outline-offset: 3px; }
.hidden { display: none !important; }
.sbd-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.kicker { margin: 0; color: var(--sbd-muted); font-family: var(--sbd-mono); font-size: 14px; letter-spacing: .1em; text-transform: uppercase; }
kbd { padding: 0 6px; font: 500 14px/1.4 var(--sbd-mono); color: inherit; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .22); border-bottom-width: 2px; border-radius: 6px; }
.card { background: var(--sbd-panel); border: 2px solid var(--sbd-line-soft); border-radius: 12px; }

/* While a run is on screen the game owns the viewport; on the start screen the footer steps aside. */
body.sbd-playing .tlg-header, body.sbd-playing .tlg-footer, body.sbd-playing .tlg-skip { display: none; }
body.sbd-playing { overflow: hidden; }
body.sbd-start .tlg-footer { display: none; }

/* ---- buttons ---------------------------------------------------------------------------------- */
.play-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 10px; font-weight: 800; transition: transform .08s, box-shadow .08s, background .12s; }
.play-button { width: 100%; min-height: 60px; color: var(--sbd-gold-ink); background: var(--sbd-gold); box-shadow: 0 4px 0 var(--sbd-gold-edge); font-size: 26px; }
.play-button:hover:not(:disabled) { background: #ffd162; }
.play-button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--sbd-gold-edge); }
.play-button:disabled { cursor: progress; opacity: .7; }
.play-button svg { width: 26px; height: 26px; }
.secondary-button { min-height: 52px; padding: 0 22px; color: var(--sbd-ink); background: var(--sbd-raised); box-shadow: 0 3px 0 var(--sbd-edge); font-size: 18px; }
.secondary-button:hover { background: var(--sbd-raised-hover); }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; color: var(--sbd-ink); background: var(--sbd-raised); border: 0; border-radius: 10px; box-shadow: 0 2px 0 var(--sbd-edge); }
.icon-button:hover { background: var(--sbd-raised-hover); }
.icon-button svg { width: 22px; height: 22px; }

/* ---- start screen (matches Knowledge Keep): title bar + three columns ------------------------- */
.screen { min-height: 100vh; }
.start-screen { display: flex; flex-direction: column; gap: 12px; height: calc(100vh - var(--tlg-header-h, 68px) - 1px); height: calc(100dvh - var(--tlg-header-h, 68px) - 1px); min-height: 520px; padding: 12px clamp(16px, 2.4vw, 32px) 16px; overflow: hidden; background: var(--sbd-page); }
.start-bar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 1320px; margin: 0 auto; }
.crumbs { display: flex; align-items: center; gap: 10px; min-width: 0; }
.crumbs h1 { margin: 0; font-size: 26px; line-height: 1.1; white-space: nowrap; }
.crumb-sep { color: var(--sbd-muted); font-size: 20px; font-weight: 700; }
.brand, .game-brand a { color: var(--sbd-ink); text-decoration: none; font-size: 16px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; }
.brand span, .game-brand a span { color: var(--sbd-gold); }
.start-columns { flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.15fr) minmax(0, 1.1fr); gap: 16px; width: 100%; max-width: 1320px; min-height: 0; margin: 0 auto; }
.start-col { display: flex; flex-direction: column; min-height: 0; padding: 16px; background: var(--sbd-panel); border: 2px solid var(--sbd-line-soft); border-radius: 12px; }
.step-heading { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 20px; line-height: 1.2; }
.step-num { display: grid; flex: 0 0 32px; place-items: center; width: 32px; height: 32px; color: var(--sbd-gold-ink); background: var(--sbd-gold); border-radius: 8px; box-shadow: 0 2px 0 var(--sbd-gold-edge); font-size: 17px; font-weight: 800; }
.subject-picker { flex: 0 1 auto; display: grid; grid-auto-rows: minmax(54px, 74px); gap: 10px; min-height: 0; }
.subject-option { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 8px 14px; color: var(--sbd-ink); background: var(--sbd-raised); border: 2px solid transparent; border-radius: 12px; box-shadow: 0 3px 0 var(--sbd-edge); font-size: 20px; font-weight: 800; line-height: 1.2; text-align: left; }
.subject-option .subject-icon { display: grid; flex: 0 0 46px; place-items: center; width: 46px; height: 46px; color: #fff; background: var(--subject-color); border-radius: 10px; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25); }
.subject-icon svg { width: 28px; height: 28px; }
.subject-option:hover { background: var(--sbd-raised-hover); }
.subject-option.selected { background: color-mix(in srgb, var(--subject-color) 30%, var(--sbd-raised)); border-color: var(--subject-color); }
.how-to { flex: 0 0 auto; margin-top: auto; padding: 12px 14px 4px; background: var(--sbd-chrome); border: 2px solid var(--sbd-line-soft); border-radius: 10px; }
.how-to h3 { margin: 0 0 6px; color: var(--sbd-gold); font-size: 16px; letter-spacing: .02em; }
.how-to ul { margin: 0; padding-left: 20px; }
.how-to li { margin: 0 0 8px; font-size: 15px; line-height: 1.35; }
.topic-list { flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; min-height: 0; margin: 0 -6px; padding: 0 6px 6px; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: var(--sbd-line) transparent; }
.unit-heading { margin: 6px 0 0; color: var(--sbd-muted); font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.unit-heading:first-child { margin-top: 0; }
.bank-option { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 46px; padding: 4px 12px 4px 6px; color: var(--sbd-ink); background: var(--sbd-raised); border: 2px solid transparent; border-radius: 10px; box-shadow: 0 2px 0 var(--sbd-edge); text-align: left; font-size: 16px; font-weight: 700; line-height: 1.2; }
.bank-option .bank-icon { display: grid; place-items: center; width: 34px; height: 34px; color: #fff; background: var(--bank-color); border-radius: 8px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25); font-size: 19px; }
.bank-option:hover { background: var(--sbd-raised-hover); }
.bank-option.selected { background: color-mix(in srgb, var(--bank-color) 26%, var(--sbd-raised)); border-color: var(--sbd-gold); }
.bank-best { color: var(--sbd-gold); font-size: 16px; font-weight: 800; white-space: nowrap; }
.bank-best.none { color: var(--sbd-muted); font-size: 14px; font-weight: 500; }
.play-col .start-leaderboard { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.play-dock { flex: 0 0 auto; display: flex; flex-direction: column; gap: 12px; padding-top: 12px; border-top: 2px solid var(--sbd-line-soft); }
.your-best { margin: 0; padding: 10px 14px; background: var(--sbd-gold-tint); border: 2px solid var(--sbd-gold); border-radius: 10px; font-size: 18px; font-weight: 700; }
.your-best b { color: var(--sbd-gold); font-size: 21px; font-weight: 800; }
.your-rank { margin-left: 6px; color: var(--sbd-muted); font-size: 16px; font-weight: 500; }
.question-set .lgq-picker { margin: 0 0 4px; }
.topic-list.is-overridden { opacity: .45; }
.play-status { margin: 0; color: var(--sbd-muted); font-size: 16px; font-weight: 700; text-align: center; }
.play-status:empty { display: none; }
.play-status.error { color: var(--sbd-bad); }

/* ---- leaderboard rows (markup from games/shared/leaderboard.js) -------------------------------- */
.sbd-leaderboard { display: flex; flex-direction: column; gap: 6px; }
.lb-row { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 10px; background: var(--sbd-raised); border-radius: 10px; box-shadow: 0 2px 0 var(--sbd-edge); font-size: 16px; }
.lb-row.hi { background: var(--sbd-gold-tint); outline: 2px solid var(--sbd-gold); }
.lb-med { flex: 0 0 34px; color: var(--sbd-gold); font-weight: 800; }
.lb-name { flex: 1 1 auto; min-width: 0; overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.lb-pts { flex: 0 0 auto; color: var(--sbd-gold); font-weight: 800; }
.lb-empty, .lb-note, .lb-you, .lb-signin { color: var(--sbd-muted); font-size: 16px; }
.lb-you { padding: 6px 4px; color: var(--sbd-ink); }
.lb-signin a, .lb-note a, .lb-you a { color: var(--sbd-focus); font-weight: 700; }
.lb-title { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 18px; font-weight: 800; }
.lb-title svg { width: 22px; height: 22px; color: var(--sbd-gold); }
.lb-celebrate { color: var(--sbd-gold); font-size: 18px; font-weight: 800; }

.lb-rank { color: var(--sbd-ink); font-size: 16px; font-weight: 700; }
.lb-rank b { color: var(--sbd-gold); }

/* ---- graphics toggle (start screen + in-game corner; a toggle, never a menu) -------------------- */
.gfx-toggle { display: inline-flex; align-items: center; gap: 0; padding: 3px; background: var(--sbd-chrome); border: 2px solid var(--sbd-line-soft); border-radius: 10px; }
.gfx-label { padding: 0 10px 0 6px; color: var(--sbd-muted); font-size: 15px; font-weight: 700; }
.gfx-toggle button { min-height: 38px; padding: 0 14px; color: var(--sbd-muted); background: transparent; border: 0; border-radius: 7px; font-size: 15px; font-weight: 800; letter-spacing: .06em; }
.gfx-toggle button.on { color: var(--sbd-gold-ink); background: var(--sbd-gold); box-shadow: 0 2px 0 var(--sbd-gold-edge); }
.gfx-toggle.small button { min-height: 34px; padding: 0 10px; font-size: 14px; }

/* ---- game screen ------------------------------------------------------------------------------ */
.game-screen { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; background: #060a17; }
.game-header { flex: 0 0 58px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 0 clamp(10px, 1.6vw, 20px); background: var(--sbd-chrome); border-bottom: 2px solid var(--sbd-edge); }
.game-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.game-brand h2 { margin: 0; font-size: 19px; white-space: nowrap; }
.game-divider { width: 2px; height: 24px; background: var(--sbd-line); }
.hud-center { display: flex; justify-content: center; gap: 10px; }
.game-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.pill { display: flex; align-items: center; gap: 6px; padding: 5px 12px; color: var(--sbd-muted); background: var(--sbd-raised); border-radius: 10px; box-shadow: 0 2px 0 var(--sbd-edge); font-size: 15px; font-weight: 700; white-space: nowrap; }
.pill b { color: var(--sbd-gold); font-size: 24px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pill svg { width: 20px; height: 20px; color: var(--sbd-gold); }
.integrity { display: inline-flex; gap: 4px; margin-left: 2px; }
.integrity i { width: 20px; height: 20px; border: 2px solid var(--sbd-good); border-radius: 4px; }
.integrity i.on { background: var(--sbd-good); }
.integrity-pill.danger { animation: sbd-pulse 1s ease-in-out infinite; }
.integrity-pill.danger svg { color: var(--sbd-red); }
.integrity-pill.danger .integrity i { border-color: var(--sbd-red); }
.integrity-pill.danger .integrity i.on { background: var(--sbd-red); }
@keyframes sbd-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

.scene-wrap { position: relative; flex: 1 1 auto; min-height: 240px; overflow: hidden; background: #060a17; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; }

.banner { position: absolute; left: 50%; top: 40%; padding: 12px 28px; color: var(--sbd-ink); background: rgba(10, 15, 30, .86); border: 2px solid var(--sbd-gold); border-radius: 14px; font-size: 30px; font-weight: 800; text-align: center; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none; z-index: 3; }
.banner small { display: block; color: var(--sbd-muted); font-size: 18px; font-weight: 600; }
.banner.bad { border-color: var(--sbd-bad); }
.boss-bar { position: absolute; left: 50%; top: 10px; display: flex; align-items: center; gap: 10px; padding: 6px 14px; color: var(--sbd-ink); background: rgba(10, 15, 30, .82); border: 2px solid #b597ff; border-radius: 12px; transform: translateX(-50%); font-weight: 800; z-index: 2; }
.boss-bar span { color: #c9b2ff; font-size: 16px; letter-spacing: .12em; }
.boss-track { width: clamp(160px, 26vw, 340px); height: 14px; background: #241a40; border-radius: 7px; overflow: hidden; }
.boss-track i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff3b5c, #b597ff); transition: width .12s; }
.boss-bar b { font-size: 16px; font-variant-numeric: tabular-nums; }
.out-of-ammo { position: absolute; left: 50%; bottom: 96px; padding: 8px 18px; color: var(--sbd-ink); background: rgba(58, 40, 10, .9); border: 2px solid var(--sbd-amber); border-radius: 12px; font-size: 18px; font-weight: 700; transform: translateX(-50%); white-space: nowrap; pointer-events: none; z-index: 2; }
@keyframes sbd-blink { to { visibility: hidden; } }
.toast { position: absolute; left: 50%; bottom: 96px; padding: 8px 18px; color: var(--sbd-ink); background: rgba(10, 15, 30, .9); border: 2px solid var(--sbd-line); border-radius: 10px; font-size: 17px; font-weight: 700; transform: translateX(-50%); pointer-events: none; z-index: 2; }
.gfx-toast { position: absolute; left: 16px; bottom: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; max-width: 520px; padding: 10px 14px; color: var(--sbd-ink); background: rgba(10, 15, 30, .94); border: 2px solid var(--sbd-amber); border-radius: 12px; font-size: 16px; font-weight: 600; z-index: 4; }
.gfx-toast button { min-height: 40px; padding: 0 14px; color: var(--sbd-gold-ink); background: var(--sbd-gold); border: 0; border-radius: 8px; box-shadow: 0 2px 0 var(--sbd-gold-edge); font-weight: 800; }
.gfx-toast button.ghost { color: var(--sbd-ink); background: var(--sbd-raised); box-shadow: 0 2px 0 var(--sbd-edge); }

.ammo-hud { position: absolute; left: 16px; top: 12px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: rgba(10, 15, 30, .78); border: 2px solid var(--sbd-line-soft); border-radius: 12px; z-index: 2; }
.ammo-label { color: var(--sbd-muted); font-size: 16px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.ammo-count { min-width: 2ch; color: var(--sbd-gold); font-size: 24px; font-weight: 800; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; }
.ammo-pips { display: inline-flex; gap: 3px; }
.ammo-pips i { width: 8px; height: 22px; background: #2b3350; border: 2px solid #3d4870; border-radius: 4px 4px 2px 2px; }
.ammo-spares { color: var(--sbd-good); font-size: 16px; font-weight: 800; }
.ammo-spares:empty { display: none; }
.ammo-backup { display: none; color: var(--sbd-amber); font-size: 16px; font-weight: 800; }
.ammo-hud.backup { border-color: var(--sbd-amber); }
.ammo-hud.backup .ammo-backup { display: inline; }
.ammo-hud.backup .ammo-count { color: var(--sbd-amber); }
.ammo-pips i.on { background: linear-gradient(#fff6c8, #ffd24a 45%, #c98a12); border-color: #8a5e08; }
.ammo-pips i.pop { animation: sbd-pip .25s ease-out; }
@keyframes sbd-pip { 0% { transform: scale(1.6); } 100% { transform: scale(1); } }
.action-buttons { position: absolute; right: 16px; bottom: 16px; display: flex; align-items: flex-end; gap: 10px; z-index: 2; }
.action-button { min-height: 56px; padding: 0 18px; color: #fff; border: 0; border-radius: 14px; font-size: 20px; font-weight: 800; letter-spacing: .04em; animation: sbd-pulse 1s ease-in-out infinite; }
.action-button.beam { background: #2a8fd6; box-shadow: 0 4px 0 #14527e; }
.action-button.nova { background: #d9641a; box-shadow: 0 4px 0 #8a3a08; }
.action-button kbd { color: #fff; border-color: rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .18); }
.action-button:disabled { opacity: .6; animation: none; }
.fire-button { display: none; position: absolute; left: 16px; bottom: 16px; width: 96px; height: 96px; color: var(--sbd-gold-ink); background: var(--sbd-gold); border: 0; border-radius: 50%; box-shadow: 0 4px 0 var(--sbd-gold-edge); font-size: 20px; font-weight: 800; touch-action: none; user-select: none; -webkit-user-select: none; z-index: 2; }
.sbd-touch .fire-button { display: block; }
.sbd-touch #scene { touch-action: none; }
@media (pointer: coarse) { .fire-button { display: block; } #scene { touch-action: none; } }
.reload-button { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 64px; padding: 0 22px; color: var(--sbd-gold-ink); background: var(--sbd-gold); border: 0; border-radius: 14px; box-shadow: 0 4px 0 var(--sbd-gold-edge); font-size: 24px; font-weight: 800; letter-spacing: .04em; z-index: 2; }
.reload-button svg { width: 28px; height: 28px; }
/* Gear (Avatar Phase 5): the perk line sits above the reload button. */
.sbd-perk-hud { position: absolute; right: 16px; bottom: 92px; max-width: min(520px, 60%); z-index: 2; }
.sbd-perk-hud .perk-btn { font-size: 13px; padding: 2px 8px; }
.reload-button kbd { color: var(--sbd-gold-ink); border-color: rgba(0, 0, 0, .35); background: rgba(255, 255, 255, .35); }
.reload-button:disabled { color: var(--sbd-muted); background: var(--sbd-raised); box-shadow: 0 4px 0 var(--sbd-edge); cursor: default; opacity: .8; }
.reload-button:disabled kbd { color: var(--sbd-muted); background: transparent; }
.reload-button.urgent { animation: sbd-pulse .8s ease-in-out infinite; }

/* The reload question: floats over the top of the scene (the aliens' entry zone, where the ship can't
   fly), so the station and the ship stay visible below it. The game keeps running underneath. */
.question-panel { position: absolute; left: 50%; top: 10px; width: min(980px, calc(100% - 32px)); display: grid; gap: 8px; padding: 12px 18px 14px; background: rgba(20, 28, 54, .95); border: 3px solid var(--sbd-line); border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); transform: translateX(-50%); z-index: 5; }
.question-panel.right { border-color: var(--sbd-good); box-shadow: 0 0 0 4px rgba(61, 220, 151, .35), 0 10px 30px rgba(0, 0, 0, .45); }
.question-panel.wrong { border-color: var(--sbd-bad); }
.question-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.question-tag { color: var(--sbd-gold); font-size: 16px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.question-type { color: var(--sbd-muted); font-size: 16px; font-weight: 600; }
.question-text { margin: 0; font-size: clamp(21px, 1.8vw, 26px); font-weight: 700; line-height: 1.3; letter-spacing: 0; }
.question-text:focus { outline: none; }
.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; transition: opacity .2s; }
.answers.arming { opacity: .55; }
.answer { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 14px; color: var(--sbd-ink); background: var(--sbd-raised); border: 2px solid transparent; border-radius: 10px; box-shadow: 0 3px 0 var(--sbd-edge); font-size: 19px; font-weight: 600; line-height: 1.25; text-align: left; }
.answer:hover:not(:disabled) { background: var(--sbd-raised-hover); }
.answer .key { display: grid; flex: 0 0 30px; place-items: center; height: 30px; color: var(--sbd-gold-ink); background: var(--sbd-gold); border-radius: 7px; font-size: 16px; font-weight: 800; }
.answer.right { background: var(--sbd-good-bg); border-color: var(--sbd-good); }
.answer.wrong { background: var(--sbd-bad-bg); border-color: var(--sbd-bad); }
.answer:disabled { cursor: default; }
.fill { display: flex; gap: 10px; grid-column: 1 / -1; }
.fill input { flex: 1 1 auto; min-height: 54px; padding: 8px 14px; color: var(--sbd-ink); background: #0f1629; border: 2px solid var(--sbd-line); border-radius: 10px; font-size: 21px; font-weight: 600; }
.fill input:focus { border-color: var(--sbd-focus); outline: none; box-shadow: 0 0 0 3px rgba(124, 196, 255, .3); }
.fill input.right { border-color: var(--sbd-good); }
.fill input.wrong { border-color: var(--sbd-bad); }
.fill button:disabled { color: var(--sbd-muted); background: var(--sbd-raised); box-shadow: 0 3px 0 var(--sbd-edge); cursor: default; }
.fill button { flex: 0 0 auto; min-height: 54px; padding: 0 22px; color: var(--sbd-gold-ink); background: var(--sbd-gold); border: 0; border-radius: 10px; box-shadow: 0 3px 0 var(--sbd-gold-edge); font-size: 19px; font-weight: 800; }
.q-result { font-size: 26px; font-weight: 800; letter-spacing: .02em; }
.q-result span { font-size: 19px; color: var(--sbd-ink); }
.q-result small { display: block; margin-top: 2px; color: var(--sbd-ink); font-size: 19px; font-weight: 600; letter-spacing: 0; }
.q-result small b { color: var(--sbd-good); }
.q-result.good { color: var(--sbd-good); }
.q-result.bad { padding: 8px 14px; color: #fff; background: var(--sbd-bad-bg); border: 2px solid var(--sbd-bad); border-radius: 10px; }
.q-lock { display: grid; gap: 8px; }
.q-lock-track { height: 16px; background: #0f1629; border: 2px solid var(--sbd-line); border-radius: 8px; overflow: hidden; }
.q-lock-track i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--sbd-amber), var(--sbd-gold)); }
.q-lock-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.q-lock-label { flex: 1 1 auto; font-size: 18px; font-weight: 700; color: var(--sbd-amber); font-variant-numeric: tabular-nums; }
.q-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 50px; padding: 0 18px; color: var(--sbd-gold-ink); background: var(--sbd-gold); border: 0; border-radius: 10px; box-shadow: 0 3px 0 var(--sbd-gold-edge); font-size: 18px; font-weight: 800; }
.q-btn.ghost { color: var(--sbd-ink); background: var(--sbd-raised); box-shadow: 0 3px 0 var(--sbd-edge); }
.q-btn .lock { display: none; width: 20px; height: 20px; }
.q-btn.locked { color: #8790ad; background: #2b3350; box-shadow: 0 3px 0 var(--sbd-edge); cursor: not-allowed; }
.q-btn.locked .lock { display: inline; }
.q-btn kbd { color: inherit; }

/* ---- results ----------------------------------------------------------------------------------- */
.results-screen { padding: 20px clamp(16px, 3vw, 40px) 32px; }
.results-shell { max-width: 1180px; margin: 0 auto; }
.results-head h1 { margin: 4px 0 6px; font-size: clamp(30px, 3.4vw, 44px); }
.results-head h1 span { color: var(--sbd-gold); }
.results-lede { margin: 0 0 16px; color: var(--sbd-muted); font-size: 18px; }
.results-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.results-score { display: flex; flex-direction: column; gap: 10px; padding: 18px; }
.score-label { color: var(--sbd-muted); font-size: 15px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
#results-score { color: var(--sbd-gold); font-size: 56px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.results-bank { color: var(--sbd-muted); font-size: 16px; font-weight: 600; }
.score-breakdown { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.score-breakdown li { display: flex; gap: 8px; padding: 6px 12px; background: var(--sbd-raised); border-radius: 8px; font-size: 16px; }
.score-breakdown b { color: var(--sbd-gold); font-variant-numeric: tabular-nums; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin: 0; }
.stat-grid div { padding: 8px 10px; background: var(--sbd-chrome); border: 2px solid var(--sbd-line-soft); border-radius: 10px; }
.stat-grid dt { color: var(--sbd-muted); font-size: 14px; font-weight: 700; }
.stat-grid dd { margin: 2px 0 0; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kill-table { width: 100%; border-collapse: collapse; font-size: 16px; font-variant-numeric: tabular-nums; }
.kill-table th { padding: 6px 8px; color: var(--sbd-muted); font-size: 14px; font-weight: 700; text-align: left; border-bottom: 2px solid var(--sbd-line); }
.kill-table td { padding: 4px 8px; border-bottom: 1px solid var(--sbd-line-soft); }
.kill-name { display: inline-flex; align-items: center; gap: 10px; vertical-align: middle; }
.kill-table td:not(:first-child), .kill-table th:not(:first-child) { text-align: right; }
.alien-icon { display: inline-grid; place-items: center; width: 48px; height: 36px; }
.alien-icon canvas { image-rendering: pixelated; max-width: 48px; max-height: 36px; }
.results-actions { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.results-side { display: flex; flex-direction: column; gap: 18px; }
.results-side .sbd-leaderboard { padding: 16px; }
.missed { padding: 16px; }
.missed h2 { margin: 0 0 8px; font-size: 18px; }
.missed ul { margin: 0; padding-left: 20px; }
.missed li { margin-bottom: 8px; font-size: 16px; }
.missed li b { color: var(--sbd-good); }

/* ---- small screens: the start columns stack and the page scrolls ------------------------------- */
@media (max-width: 1500px) {
  .game-brand h2, .game-divider { display: none; }
}
@media (max-width: 1100px) {
  .game-brand h2, .game-divider { display: none; }
  .pill span { display: none; }
  .integrity-pill span.integrity { display: inline-flex; }
}
@media (max-width: 980px) {
  .start-screen { height: auto; overflow: visible; }
  .start-columns { grid-template-columns: minmax(0, 1fr); }
  .topic-list { max-height: 360px; }
  .results-layout { grid-template-columns: minmax(0, 1fr); }
  .answers { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .start-bar { flex-wrap: wrap; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .integrity-pill.danger, .reload-button.urgent, .out-of-ammo, .ammo-pips i.pop, .action-button { animation: none; }
}

/* The start screen's first column holds four subjects plus How to play: keep both inside 1366x768. */
.subject-col .subject-picker { grid-auto-rows: minmax(48px, 62px); gap: 8px; }
.subject-col .subject-option { font-size: 19px; }
.subject-col .how-to { margin-top: 12px; padding: 10px 12px 2px; }
.subject-col .how-to li { margin-bottom: 6px; }

/* Weapon readout under the ammo: name, 5 tier pips, and how many more right answers in a row to the next. */
.weapon-hud { position: absolute; left: 16px; top: 66px; display: grid; gap: 2px; padding: 6px 12px 8px; background: rgba(10, 15, 30, .78); border: 2px solid var(--sbd-line-soft); border-radius: 12px; z-index: 2; --weapon: #ffd24a; }
.weapon-hud[data-tier="1"] { --weapon: #4fe0ff; }
.weapon-hud[data-tier="2"] { --weapon: #5be36b; }
.weapon-hud[data-tier="3"] { --weapon: #ff4fd8; }
.weapon-hud[data-tier="4"] { --weapon: #7aa8ff; }
.weapon-hud[data-tier="5"] { --weapon: #ff9a2e; }
.weapon-row { display: flex; align-items: center; gap: 10px; }
.weapon-label { color: var(--sbd-muted); font-size: 15px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.weapon-hud b { color: var(--weapon); font-size: 18px; font-weight: 800; }
.weapon-pips { display: inline-flex; gap: 4px; }
.weapon-pips i { width: 10px; height: 10px; border: 2px solid #3d4870; border-radius: 3px; }
.weapon-pips i.on { background: var(--weapon); border-color: var(--weapon); }
.weapon-next { color: var(--sbd-ink); font-size: 15px; font-weight: 600; }
.charge-row { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.charge-pips { display: inline-flex; gap: 4px; }
.charge-pips i { width: 14px; height: 10px; border: 2px solid #3d4870; border-radius: 3px; }
.charge-pips i.on { background: #4fc3ff; border-color: #4fc3ff; }
.charge-note { color: var(--sbd-muted); font-size: 15px; font-weight: 700; }
.charge-row.ready .charge-note { color: #7fd8ff; font-weight: 800; }
.pw-hud { position: absolute; left: 16px; top: 156px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; z-index: 2; pointer-events: none; }
.pw-chip { padding: 5px 12px; color: var(--sbd-ink); background: rgba(10, 15, 30, .82); border: 2px solid var(--pw, var(--sbd-gold)); border-radius: 10px; font-size: 16px; font-weight: 800; }
.pw-chip[data-kind="spread"] { --pw: #5be36b; }
.pw-chip[data-kind="rapid"] { --pw: #ff4fd8; }
.pw-chip[data-kind="shield"] { --pw: #7fe9ff; }
.pw-chip[data-kind="nova"] { --pw: #ff9a2e; }
.repair-note { color: var(--sbd-muted); font-size: 14px; font-weight: 700; }
.repair-note:empty { display: none; }
.integrity-pill.repaired { box-shadow: 0 0 0 3px rgba(61, 220, 151, .55), 0 2px 0 var(--sbd-edge); }
.combo-pill.hot b { color: var(--sbd-amber); }
.question-panel.stock { border-color: var(--sbd-good); }
.question-panel.stock .question-tag { color: var(--sbd-good); }
.q-lock-track.hidden { display: none; }
.question-panel kbd { font-size: 16px; }
