/* PRECAST RUN — FIT Precast retro arcade game. No third-party dependencies. */
:root {
  color-scheme: dark;
  --background: #00314c;
  --text: #e8f0f1;
  --muted: #9aacb6;
  --border: #637984;
  --button-background: #1c2a34;
  --accent: #09b9e2;
  --fit-blue: #08bce5; /* FIT Precast cyan (site --cyan): leaderboard initials */
  --gold: #f1d778; /* arcade yellow: stat labels and leaderboard headings */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-width: 280px; background: var(--background); color: var(--text); }
.game-shell { width: 100%; max-width: 960px; padding: 20px 16px 24px; margin: 0 auto; }
.game { font-family: 'Courier New', Courier, monospace; outline: none; }
.game-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 13px; }
.eyebrow { font-size: 11px; letter-spacing: 2px; color: #08bce5; margin-bottom: 2px; }
h1 { font-size: clamp(23px, 5vw, 36px); font-weight: 900; letter-spacing: -1px; line-height: 1.1; margin: 0; }
.cursor { color: var(--accent); }
.scoreboard { display: flex; flex-wrap: wrap; gap: 16px; font-size: 14px; font-weight: 900; }
.scoreboard > div { display: flex; flex-direction: column; }
.score-label { display: block; color: var(--gold); font-size: 10px; margin-bottom: 3px; }
.game-screen { container-type: inline-size; position: relative; background: #002c45; border: 4px solid #576872; overflow: hidden; }
.game-screen canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; image-rendering: pixelated; }
/* Light CRT scanlines — intentionally retro and simple. */
.game-screen::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, transparent 0, transparent 3px, rgba(0,0,0,.15) 4px); }
.overlay { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 12px; text-align: center; padding: 12px; overflow-y: auto; background: rgba(10,20,30,.82); }
.overlay-main { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.overlay-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.overlay-actions [hidden] { display: none; }
.overlay[hidden] { display: none; }
.overlay-title { font-size: clamp(21px, 5vw, 36px); font-weight: 900; letter-spacing: 2px; color: #f2f6f7; text-shadow: 3px 3px #087c97; }
.overlay-subtitle { font-size: clamp(11px, 2.2vw, 14px); color: #c0d0d5; max-width: 340px; }
.button { font: 900 12px 'Courier New', Courier, monospace; border: 2px solid var(--border); background: var(--button-background); color: var(--text); min-height: 44px; padding: 9px 13px; cursor: pointer; border-radius: 0; touch-action: manipulation; }
.button:focus-visible, .game:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.button:hover { filter: brightness(1.15); }
.button-primary { background: var(--accent); border-color: #8be8fa; color: #081b25; }
.button[aria-pressed='true'] { background: #c6a445; color: #17222b; border-color: #f1d778; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.button-large { flex: 1; min-width: 95px; }
.keyboard-hints { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 11px; font-size: 11px; color: var(--muted); line-height: 1.6; }
kbd { display: inline-block; border: 1px solid #55646e; padding: 1px 5px; color: var(--text); font-family: inherit; }
.game-tip { font-size: 11px; line-height: 1.6; color: var(--muted); margin: 12px 0 0; }
.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; }
@media (max-width: 420px) {
  .game-shell { padding: 12px 8px 22px; }
  .game-header { gap: 10px; }
  .scoreboard { gap: 14px; font-size: 12px; }
  .controls { gap: 6px; }
  .button { padding: 8px 10px; font-size: 11px; }
}

/* Leaderboard (top 5, stored in this browser) and the three-initials entry */
.board { width: min(100%, 250px); padding: 12px 16px 14px; border: 2px solid #3f5b6a; background: rgba(0,24,38,.7); text-align: left; }
.board-title { margin-bottom: 8px; color: var(--gold); font-size: 14px; font-weight: 900; letter-spacing: 2px; text-align: center; }
.board-list { margin: 0; padding: 0; list-style: none; }
.board-list li { display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; padding: 4px 0; color: #c0d0d5; font-size: 15px; font-weight: 900; line-height: 1.4; letter-spacing: 1px; }
.board-list li.is-empty { color: #4f6674; }
.board-list li.is-new { color: var(--gold); }
.board-list .rk { color: var(--gold); }
.board-list li:not(.is-empty) .in { color: var(--fit-blue); }
.entry { display: flex; gap: 10px; }
.entry[hidden] { display: none; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.slot button { font: 900 14px 'Courier New', Courier, monospace; border: 2px solid var(--border); background: var(--button-background); color: var(--text); border-radius: 0; cursor: pointer; touch-action: manipulation; }
.slot-step { width: 38px; height: 26px; padding: 0; font-size: 11px !important; }
.slot-letter { width: 38px; height: 38px; padding: 0; font-size: 22px !important; }
.slot.is-active .slot-letter { border-color: #8be8fa; background: #0b4b63; color: #fff; box-shadow: 0 3px 0 0 #09b9e2; }
.slot button:hover { filter: brightness(1.2); }
.slot button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@container (min-width: 440px) {
  .overlay { flex-direction: row; justify-content: center; gap: 22px; padding: 12px 20px; }
  .overlay-main { flex: 1; min-width: 0; }
  .overlay-title { font-size: clamp(20px, 4.4cqw, 24px); }
  .board { flex: none; width: 240px; }
}
@container (max-width: 439px) {
  /* Small screens: during initials entry drop the board and subtitle so the slots and SAVE button fit without scrolling */
  .overlay.is-entry { padding: 6px; gap: 6px; }
  .overlay.is-entry .board, .overlay.is-entry .overlay-subtitle { display: none; }
  .overlay.is-entry .overlay-main { gap: 6px; }
  .overlay.is-entry .overlay-title { font-size: 20px; }
  .overlay.is-entry .slot-step { height: 22px; }
  .overlay.is-entry .slot-letter { height: 32px; font-size: 20px !important; }
  .overlay.is-entry .button { min-height: 36px; padding: 6px 12px; }
}
