/* Read the Swing, in the baseballvoid "Deep Field" design system.
   Selectors are shared with app.js and results.html; change visuals only. */

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

:root {
  --bg:      #05070d;
  --surface: #0c111d;
  --panel:   rgba(14, 19, 31, 0.78);
  --line:    rgba(226, 230, 240, 0.1);
  --line-2:  rgba(226, 230, 240, 0.2);
  --cream:   #ece9e2;   /* text */
  --text-2:  #c2c3c9;
  --muted:   #878d9c;
  --accent:  #9fd0ff;   /* signal blue */
  --accent-2:#c6e3ff;
  --warm:    #ffb24d;
  --correct: #5fd69a;
  --wrong:   #ff6b5e;
  --green:   var(--line-2);   /* legacy name: borders */
  --sans: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --radius: 2px;
  color-scheme: dark;
}

body {
  background:
    radial-gradient(ellipse 60% 45% at 82% 0%, rgba(70, 92, 160, 0.18), transparent 70%),
    radial-gradient(ellipse 50% 40% at 4% 80%, rgba(140, 60, 80, 0.08), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--cream);
  font: 400 1rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.label, .eyebrow {
  font: 500 0.72rem/1.4 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow { color: var(--accent); }

/* ── site bar (same as baseballvoid.com) ── */
.site-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 7, 13, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}
.site-bar .bar {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-bar .logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--cream);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
  text-decoration: none;
}
.site-bar nav { display: flex; gap: 32px; }
.site-bar nav a { text-decoration: none; transition: color 0.15s; }
.site-bar nav a:hover, .site-bar nav a[aria-current='page'] { color: var(--cream); }
@media (max-width: 560px) {
  .site-bar .bar { padding: 0 20px; }
  .site-bar nav { gap: 20px; }
}

/* ── screens ── */
.screen {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hidden { display: none !important; }

.back-link {
  align-self: flex-start;
  color: var(--muted);
  text-decoration: none;
  font: 500 0.72rem var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 32px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--accent); }

/* ── buttons ── */
#start-btn, #replay-btn, #next-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 26px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: 500 1rem var(--sans);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, border-color 0.15s, color 0.15s;
}
#start-btn, #replay-btn {
  background: var(--accent);
  color: var(--bg);
  min-width: 180px;
}
#start-btn:hover, #replay-btn:hover {
  background: var(--accent-2);
  box-shadow: 0 0 28px rgba(159, 208, 255, 0.32);
}
#next-btn {
  background: rgba(5, 7, 13, 0.4);
  border-color: var(--line-2);
  color: var(--cream);
  min-height: 42px;
  padding: 0 20px;
}
#next-btn:hover { border-color: var(--cream); }

/* ── start screen ── */
#start-screen { text-align: center; }
#start-screen h1 {
  font-size: clamp(2.6rem, 7vw, 4.3rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.98;
  margin: 14px 0 18px;
}
.subtitle {
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--text-2);
  margin-bottom: 22px;
}
.criteria {
  font: 500 0.72rem var(--mono);
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 28px;
  padding: 7px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
}

/* ── game header ── */
.game-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.game-header .back-link { margin-bottom: 0; }
.progress-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.progress-bar-track {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(159, 208, 255, 0.6);
  transition: width 0.3s ease;
  width: 0%;
}
#progress-text {
  font: 500 0.72rem var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
#score-display {
  font: 500 0.95rem var(--mono);
  color: var(--accent);
  white-space: nowrap;
  min-width: 3.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── video ── */
.video-wrap {
  width: 100%;
  position: relative;
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.video-wrap::before, .video-wrap::after {
  content: '';
  position: absolute;
  z-index: 3;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--accent);
  opacity: 0.65;
  pointer-events: none;
}
.video-wrap::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.video-wrap::after { right: -1px; bottom: -1px; border-left: 0; border-top: 0; }
#play-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.tap-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 13, 0.6);
  color: var(--cream);
  font: 500 1.2rem var(--sans);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── batter bar ── */
.batter-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  font-size: 1rem;
  font-weight: 500;
}
.muted { color: var(--muted); }

/* ── action area ── */
#action-area {
  width: 100%;
  min-height: 9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.prompt {
  font: 500 0.72rem var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}
.guess-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
}
.guess-btn {
  flex: 1;
  padding: 14px 0;
  background: var(--panel);
  color: var(--cream);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  font: 600 1.1rem var(--sans);
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.guess-btn:hover { border-color: var(--accent); background: rgba(159, 208, 255, 0.08); }
.guess-btn:disabled { cursor: default; }
.guess-btn:disabled:not(.correct):not(.wrong):not(.correct-answer) { opacity: 0.4; }
.guess-btn:disabled:hover:not(.correct):not(.wrong) { background: var(--panel); border-color: var(--line-2); }
.guess-btn.correct {
  background: var(--correct);
  border-color: var(--correct);
  color: var(--bg);
}
.guess-btn.wrong {
  background: var(--wrong);
  border-color: var(--wrong);
  color: var(--bg);
}
.guess-btn.correct-answer {
  border-color: var(--correct);
  color: var(--correct);
}

/* ── reveal ── */
#reveal-section {
  text-align: center;
  width: 100%;
}
#result-line {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
#result-line.correct { color: var(--correct); }
#result-line.wrong   { color: var(--wrong); }
#detail-line {
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

/* ── complete screen ── */
#complete-screen { text-align: center; }
#complete-screen h2 {
  font: 500 0.72rem var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
#final-score-display {
  font-size: clamp(3.2rem, 9vw, 4.6rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1;
  color: var(--cream);
  margin-bottom: 14px;
}
#breakdown-table {
  width: 100%;
  max-width: 340px;
  margin: 28px 0;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 0 16px;
}
.breakdown-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.breakdown-row:last-child { border-bottom: 0; }
.breakdown-row .dir { color: var(--muted); }
.breakdown-row .hits { color: var(--accent); font-family: var(--mono); }

@media (max-width: 480px) {
  .screen { padding: 32px 20px 48px; }
  .guess-btn { font-size: 1rem; padding: 12px 0; }
}

/* ── start: how-to ── */
.howto {
  max-width: 34rem;
  text-align: center;
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--text-2);
  margin-bottom: 28px;
}
.howto b { color: var(--cream); font-weight: 600; }
.howto .keys {
  display: block;
  margin-top: 12px;
  font: 500 0.72rem var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
kbd {
  display: inline-block;
  min-width: 1.6em;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  padding: 1px 5px;
  font: 500 0.78rem var(--mono);
  color: var(--cream);
  text-align: center;
}

/* ── freeze tag ── */
#guess-section { width: 100%; display: flex; flex-direction: column; align-items: center; }
#freeze-tag {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(5, 7, 13, 0.85);
  border: 1px solid var(--accent);
  color: var(--accent);
  font: 500 0.72rem var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: var(--radius);
  pointer-events: none;
}

/* ── batter bar extras ── */
.hand {
  font: 500 0.66rem var(--mono);
  letter-spacing: 0.1em;
  color: var(--accent);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 1px 5px;
  margin-left: 6px;
  vertical-align: 2px;
}
#matchup { text-align: right; font-size: 0.85rem; font-weight: 400; }

/* ── guess buttons: field-side sublabel ── */
.guess-btn .side {
  display: block;
  font: 500 0.64rem var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}
.guess-btn.correct .side,
.guess-btn.wrong .side { color: rgba(5, 7, 13, 0.7); }

/* ── reveal: spray chart ── */
.reveal-grid {
  display: flex;
  align-items: center;
  gap: 24px;
  text-align: left;
}
#spray { width: 180px; flex-shrink: 0; }
#spray .field      { fill: var(--surface); stroke: var(--line-2); stroke-width: 1; }
#spray .infield    { fill: none; stroke: var(--muted); stroke-width: 0.8; opacity: 0.5; }
#spray .divider    { stroke: var(--muted); stroke-width: 0.6; stroke-dasharray: 3 3; }
#spray .zone-right { fill: var(--correct); opacity: 0.22; }
#spray .zone-wrong { fill: var(--wrong); opacity: 0.18; }
#spray .flight     { stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 2 2; }
#spray .ball       { fill: var(--accent); stroke: var(--bg); stroke-width: 1.5; }
#spray .zone-label { fill: var(--muted); font-size: 10px; text-anchor: middle; font-family: var(--mono); letter-spacing: 1px; text-transform: uppercase; }
.reveal-text { flex: 1; }
.reveal-text #next-btn { margin-top: 4px; }
#detail-line { color: var(--cream); margin-bottom: 6px; font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.02em; }
#desc-line { font-size: 0.9rem; line-height: 1.55; margin-bottom: 16px; }

/* ── complete: baseline + history ── */
#emoji-line { margin-top: 16px; font-size: 0.9rem; letter-spacing: 1px; text-align: center; word-break: break-all; }
#history-list { width: 100%; max-width: 380px; margin-bottom: 40px; font-size: 0.88rem; }
.history-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.history-row.ok span:first-child   { color: var(--correct); }
.history-row.miss span:first-child { color: var(--wrong); }

@media (max-width: 480px) {
  .reveal-grid { flex-direction: column; text-align: center; gap: 12px; }
  #spray { width: 160px; }
  .batter-bar { flex-direction: column; gap: 2px; }
  #matchup { text-align: left; }
}

/* ── start: experience question + results link ── */
.intake {
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px 18px 16px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.98rem;
  max-width: 26rem;
  width: 100%;
  text-align: left;
}
.intake legend {
  font: 500 0.95rem var(--sans);
  color: var(--cream);
  padding: 0 6px;
}
.intake label { cursor: pointer; display: flex; gap: 10px; align-items: center; }
.intake input { accent-color: var(--accent); width: 16px; height: 16px; }
.intake.needs-answer { border-color: var(--warm); }
.results-link {
  margin-top: 20px;
  color: var(--muted);
  font: 500 0.72rem var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.15s;
}
.results-link:hover { color: var(--accent); }
.complete-actions { display: flex; flex-direction: column; align-items: center; }
#verdict-line, #scout-line { text-align: center; font-size: 0.98rem; max-width: 30rem; line-height: 1.6; color: var(--text-2); }
#scout-line { margin-top: 10px; color: var(--muted); }

/* ── warm-up round ── */
#practice-note { font-size: 0.85rem; color: var(--warm); line-height: 1.5; margin: -4px 0 14px; }
#practice-note:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
