:root {
  --bg: #07131f;
  --bg-accent: #0d2236;
  --panel: rgba(6, 17, 29, 0.88);
  --panel-border: rgba(146, 215, 255, 0.2);
  --text: #f5fbff;
  --muted: #9ac6dd;
  --gold: #ffcb47;
  --cyan: #66e1ff;
  --red: #ff6b57;
  --green: #7bf5a4;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(59, 169, 255, 0.18), transparent 35%),
    linear-gradient(135deg, #030913, var(--bg) 55%, #081d30);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 92%);
  pointer-events: none;
}

.app-shell {
  width: min(1600px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 48px;
}

.topbar {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.eyebrow,
.section-label,
.score-pill span,
.position-chip span,
.final-score span,
.track-headings span {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-size: 0.85rem;
}

h1,
h2,
h3,
.answer-tile,
.timer-display,
.final-score strong,
#contestantPosition,
#chaserPosition,
.cash-display-card strong,
.cash-summary-pill strong {
  font-family: "Oswald", sans-serif;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
}

h2 {
  font-size: clamp(2.8rem, 5.2vw, 5.8rem);
  line-height: 1;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.question-counter {
  margin-top: 10px;
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
.mode-toggle {
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

button:hover,
.mode-toggle:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.14);
}

button:active,
.mode-toggle:active {
  transform: translateY(1px);
}

.mode-toggle.is-active,
.primary-action {
  background: linear-gradient(135deg, #2cbcff, #1976ff);
  box-shadow: 0 12px 30px rgba(24, 133, 255, 0.32);
}

.mode-jump {
  background: linear-gradient(135deg, #ffcb47, #ff8f39);
  color: #08111a;
  box-shadow: 0 12px 30px rgba(255, 181, 56, 0.28);
}

.success {
  background: linear-gradient(135deg, #2bc86f, #0e9f52);
}

.danger {
  background: linear-gradient(135deg, #ff8650, #de3a2e);
}

.mode-panel {
  display: none;
}

.mode-panel.active {
  display: grid;
  gap: 18px;
}

.screen-card,
.controls-card {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.screen-card::after,
.controls-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -65% auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(102, 225, 255, 0.18), transparent 65%);
  pointer-events: none;
}

.question-card,
.final-card,
.cash-builder-card {
  min-height: 62vh;
  padding: 24px;
}

.final-card,
.cash-builder-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.board-header,
.final-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.position-chip,
.score-pill {
  min-width: 150px;
  border-radius: 22px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.position-chip strong,
.score-pill strong {
  display: block;
  font-size: clamp(1.6rem, 2.6vw, 2.5rem);
}

.cash-builder-content {
  display: grid;
  gap: 24px;
  flex: 1;
  align-items: center;
}

.cash-display-card,
.cash-summary-pill {
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, rgba(255, 203, 71, 0.22), rgba(255, 255, 255, 0.06));
}

.cash-display-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 34vh;
  text-align: center;
}

.cash-display-card span,
.cash-summary-pill span,
.cash-builder-message p {
  color: var(--muted);
}

.cash-display-card strong {
  font-size: clamp(4rem, 12vw, 9rem);
  line-height: 0.95;
}

.cash-builder-message {
  max-width: 900px;
}

.cash-builder-message p {
  font-size: clamp(1.1rem, 2vw, 1.8rem);
}

.cash-summary-row {
  margin-bottom: 12px;
}

.cash-summary-pill {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 18px;
  min-width: 220px;
}

.cash-summary-pill strong {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.answer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  height: auto;
}

.answer-tile {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  min-height: 11vh;
  text-align: center;
  padding: 12px 18px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 203, 71, 0.16), rgba(102, 225, 255, 0.08)),
    rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: clamp(1.4rem, 2.7vw, 2.6rem);
  line-height: 1.05;
}

.answer-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-family: "Oswald", sans-serif;
  font-size: clamp(2rem, 3vw, 2.8rem);
  line-height: 1;
}

.answer-text {
  display: block;
  width: 100%;
  text-align: center;
}

.chase-track-card {
  padding: 20px 24px 28px;
}

.track-headings,
.track-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: center;
}

.track {
  display: grid;
  margin: 16px 0 18px;
}

.track-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.track-square {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 72px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 1.1rem;
  color: rgba(245, 251, 255, 0.75);
}

.track-square.player-square {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
}

.track-square.finish-square {
  border-color: rgba(255, 203, 71, 0.32);
  background: linear-gradient(135deg, rgba(255, 203, 71, 0.28), rgba(255, 255, 255, 0.08));
}

.track-markers {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.marker {
  min-width: 42px;
  padding: 8px 10px;
  border-radius: 999px;
  font-family: "Oswald", sans-serif;
  font-size: 1.05rem;
  line-height: 1;
}

.marker.contestant {
  background: linear-gradient(135deg, rgba(43, 200, 111, 0.88), rgba(14, 159, 82, 0.96));
  color: white;
  box-shadow: 0 0 22px rgba(43, 200, 111, 0.32);
}

.marker.chaser {
  background: linear-gradient(135deg, rgba(255, 134, 80, 0.88), rgba(222, 58, 46, 0.96));
  color: white;
  box-shadow: 0 0 22px rgba(222, 58, 46, 0.32);
}

.timer-display {
  min-width: 180px;
  text-align: center;
  padding: 10px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: clamp(2.2rem, 5vw, 5rem);
}

.final-scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  flex: 1;
  align-items: stretch;
}

.final-score {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: 28px;
  min-height: 42vh;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.contestant-side {
  background: linear-gradient(135deg, rgba(43, 200, 111, 0.25), rgba(8, 20, 34, 0.3));
}

.chaser-side {
  background: linear-gradient(135deg, rgba(255, 107, 87, 0.25), rgba(8, 20, 34, 0.3));
}

.final-score strong {
  font-size: clamp(7rem, 18vw, 14rem);
  line-height: 0.95;
}

.control-panel {
  margin-top: 26px;
  padding-top: 26px;
}

.controls-card {
  padding: 22px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.control-group label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

textarea {
  resize: vertical;
}

.answer-inputs,
.button-row {
  display: grid;
  gap: 10px;
}

.button-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#resetMainChase {
  grid-column: span 3;
}

@media (max-width: 1200px) {
  .controls-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .button-row {
    grid-template-columns: 1fr;
  }

  #resetMainChase {
    grid-column: auto;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100vw - 20px, 1600px);
    padding-top: 10px;
  }

  .topbar,
  .board-header,
  .final-header,
  .final-scores {
    grid-template-columns: 1fr;
    display: grid;
  }

  .question-card,
  .final-card,
  .cash-builder-card {
    min-height: auto;
  }

  .controls-card {
    grid-template-columns: 1fr;
  }

  .answer-tile {
    min-height: 10vh;
    grid-template-columns: 84px 1fr;
  }

  .answer-letter {
    width: 60px;
    height: 60px;
  }

  .track-square {
    min-height: 58px;
  }
}
