/* ONE SHOT — mobile-first quiz-show grid, Jack arcade adjacent */

:root {
  --bg: #071428;
  --bg2: #0a0018;
  --navy: #0b3a82;
  --navy-d: #072a60;
  --cell: #0d2f70;
  --cell-hi: #1648a0;
  --gold: #ffd84d;
  --gold-d: #c9a018;
  --cyan: #00f0ff;
  --pink: #ff2bd6;
  --lime: #b8ff00;
  --text: #f4f0ff;
  --muted: #9bb0d0;
  --panel: #0a1830;
  --ok: #7dff9a;
  --no: #ff6b8a;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Orbitron", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% 0%, #123060 0%, var(--bg) 48%, #03060e 100%);
  overflow-x: hidden;
}

.app {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: calc(8px + var(--safe-t)) 10px calc(20px + var(--safe-b));
}

.hud {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 4px 10px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, rgba(7, 20, 40, 0.96), rgba(7, 20, 40, 0.82) 70%, transparent);
  backdrop-filter: blur(8px);
}

.back, .back-x {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--cyan);
  text-decoration: none;
  padding: 10px 8px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  background: none;
  border: 0;
  cursor: pointer;
}

.brand { text-align: center; }
.brand h1 {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(14px, 4.6vw, 20px);
  letter-spacing: 0.06em;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 216, 77, 0.55), 2px 2px 0 #000;
}
.sub {
  margin: 4px 0 0;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.78rem;
  color: var(--cyan);
  letter-spacing: 0.04em;
}

.hud-score {
  text-align: right;
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: var(--gold);
  line-height: 1.35;
}
.hud-score .k {
  display: block;
  font-size: 7px;
  color: var(--muted);
}
.hud-score .max { font-size: 7px; color: var(--muted); }

.how-line {
  margin: 0 4px 12px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.4;
}
.linkish {
  display: inline;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: var(--cyan);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.board-wrap {
  border: 3px solid #1a2a50;
  border-radius: 8px;
  padding: 5px;
  background: #050c18;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 8px 0 #02060e,
    0 0 28px rgba(0, 80, 200, 0.25);
}

.board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.cat {
  min-height: 44px;
  padding: 6px 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  font-size: clamp(7px, 2.4vw, 11px);
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: #e8f0ff;
  background: linear-gradient(180deg, #2a1460, #140830);
  border: 1px solid #4a28a0;
  text-shadow: 0 0 8px rgba(255, 43, 214, 0.4);
}
.cat .short { display: inline; }
.cat .full { display: none; }

.cell {
  appearance: none;
  -webkit-appearance: none;
  min-height: 52px;
  padding: 0;
  border: 0;
  cursor: pointer;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(10px, 3.2vw, 14px);
  color: var(--gold);
  background: linear-gradient(180deg, var(--cell-hi) 0%, var(--cell) 48%, var(--navy-d) 100%);
  box-shadow:
    inset 0 2px 0 rgba(180, 210, 255, 0.35),
    inset 0 -3px 0 #041830;
  text-shadow: 0 0 8px rgba(255, 216, 77, 0.45);
  -webkit-tap-highlight-color: transparent;
}
.cell:active { filter: brightness(1.15); }
.cell:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.cell.dead {
  cursor: default;
  color: #6a7a98;
  background: linear-gradient(180deg, #152038, #0c1424);
  box-shadow: inset 0 0 12px #000;
  text-shadow: none;
  font-size: clamp(8px, 2.6vw, 11px);
}
.cell.dead.high { color: var(--ok); }
.cell.dead.mid { color: var(--gold-d); }
.cell.dead.low { color: var(--no); }

.legend {
  display: none;
  margin: 10px 0 0;
  font-family: system-ui, sans-serif;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
}

.foot {
  margin-top: 22px;
  text-align: center;
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  color: #7a88a8;
}
.foot p { margin: 0; }
.foot .disclaimer {
  margin-top: 10px;
  font-size: 0.72rem;
  font-style: italic;
  color: #5a6a88;
  letter-spacing: 0.01em;
  max-width: 28em;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.4;
}

/* overlays */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(2, 6, 16, 0.82);
  overflow: auto;
  padding: calc(10px + var(--safe-t)) 10px calc(16px + var(--safe-b));
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.overlay[hidden] { display: none !important; }

.sheet, .clue-sheet {
  width: min(100%, 560px);
  margin: auto 0;
  background: linear-gradient(180deg, #102040, #0a1830);
  border: 2px solid #2a4a88;
  border-radius: 12px;
  padding: 18px 14px 16px;
  box-shadow: 0 0 0 2px #000, 0 12px 40px rgba(0,0,0,0.5);
}

.sheet h2, .finale-score {
  margin: 0 0 8px;
  font-family: "Press Start 2P", monospace;
  font-size: 14px;
  color: var(--gold);
  text-align: center;
}
.sheet ol {
  margin: 0 0 12px;
  padding-left: 1.2rem;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text);
  line-height: 1.45;
}
.sheet p, .note {
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
.eyebrow {
  text-align: center;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--pink);
  margin: 0 0 8px;
}

.clue-sheet { padding: 12px 12px 20px; }
.clue-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.clue-meta {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--cyan);
  text-align: right;
}

.block { margin: 10px 0; }
.block-k {
  margin: 0 0 6px;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--gold);
  letter-spacing: 0.08em;
}

.output, .seed {
  margin: 0;
  padding: 12px;
  background: #050a14;
  border: 1px solid #1e3a68;
  border-left: 3px solid var(--cyan);
  color: #e8f4ff;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.95rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 6px;
}
.seed { border-left-color: var(--pink); color: #f3e8ff; }

textarea {
  width: 100%;
  min-height: 140px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #2a4a88;
  background: #071018;
  color: var(--text);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 16px; /* iOS: avoid zoom */
  line-height: 1.4;
  resize: vertical;
}
textarea:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }
textarea:disabled { opacity: 0.7; }

.dock {
  position: sticky;
  bottom: 0;
  padding: 8px 0 calc(4px + var(--safe-b));
  background: linear-gradient(180deg, transparent, #0a1830 28%);
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin: 8px 0 0;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn.lock, .btn.primary {
  color: #111;
  background: linear-gradient(180deg, #fff6c4 0%, var(--gold) 40%, #c9a018 55%, #ffe98a 100%);
  box-shadow: inset 0 2px 0 #fff, inset 0 -3px 0 #8a7010, 0 4px 0 #3a3008;
}
.btn.lock:disabled {
  background: linear-gradient(180deg, #667, #445 50%, #556);
  color: #ccc;
  box-shadow: inset 0 2px 0 #889;
  cursor: not-allowed;
}
.btn.ghost {
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--cyan);
  box-shadow: none;
}
.btn:active:not(:disabled) { transform: translateY(2px); }

.reveal { margin-top: 8px; }
.score-row { text-align: center; margin: 8px 0 4px; }
.big-score {
  font-family: "Press Start 2P", monospace;
  font-size: 22px;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 216, 77, 0.5);
}
.big-score .k, .big-score .max {
  display: inline;
  font-size: 10px;
  color: var(--muted);
}
.verdict {
  margin: 8px 0 0;
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--cyan);
  text-align: center;
}
.board-delta {
  text-align: center;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--lime);
}
.breakdown, .checks {
  list-style: none;
  margin: 8px 0 14px;
  padding: 0;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.9rem;
}
.breakdown li, .checks li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: var(--muted);
}
.checks li.hit { color: var(--ok); }
.checks li.miss { color: var(--no); }

.finale-score {
  font-size: clamp(18px, 7vw, 28px);
  margin: 12px 0;
}
.finale-score .max { font-size: 12px; color: var(--muted); }

@media (min-width: 420px) {
  .cat .short { display: none; }
  .cat .full { display: inline; }
  .cat { font-size: 10px; min-height: 48px; }
  .cell { min-height: 58px; }
}

@media (min-width: 560px) {
  .board { gap: 6px; }
  .cell { min-height: 64px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}
