:root {
  --bg-1: #1a0726;
  --bg-2: #28093c;
  --accent-1: #ff2f8f;
  --accent-2: #ff82be;
  --accent-3: #1de5ff;
  --ok: #1bd88f;
  --bad: #ff4e78;
  --text: #fff4fd;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-border: rgba(255, 255, 255, 0.18);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Trebuchet MS", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 47, 143, 0.25), transparent 40%),
    radial-gradient(circle at 85% 10%, rgba(29, 229, 255, 0.2), transparent 32%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
  min-height: 100%;
  touch-action: manipulation;
}

body {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding: env(safe-area-inset-top) 12px env(safe-area-inset-bottom);
}

.app {
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding-top: 8px;
}

.brand h1 {
  margin: 2px 0 0;
  font-size: 1.65rem;
  letter-spacing: 0.02em;
}

.eyebrow {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  opacity: 0.8;
}

.audio-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.icon-btn {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 700;
  min-height: 40px;
}

.screen {
  display: none;
  flex: 1;
}

.screen-active {
  display: flex;
}

.card {
  width: 100%;
  background: rgba(13, 1, 23, 0.48);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
}

#screenStart,
#screenRoundResult,
#screenFinal,
#screenCountdown {
  align-items: center;
}

label {
  display: block;
  margin: 14px 0 6px;
  font-weight: 700;
}

.select-large {
  width: 100%;
  min-height: 56px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 10px 12px;
  font-size: 1rem;
}

.select-large option {
  color: #1f1230;
}

.primary-btn {
  width: 100%;
  min-height: 56px;
  margin-top: 18px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(130deg, var(--accent-1), #ff6ca6 55%, var(--accent-3));
  color: white;
  font-size: 1.05rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  box-shadow: 0 8px 18px rgba(255, 47, 143, 0.35);
}

.helper {
  opacity: 0.9;
}

.countdown-wrap {
  width: 100%;
  text-align: center;
  border-radius: 22px;
  padding: 28px 12px;
  background: rgba(13, 1, 23, 0.65);
  border: 1px solid var(--panel-border);
}

.countdown-wrap h2 {
  margin: 8px 0;
  font-size: clamp(3rem, 20vw, 5rem);
  text-shadow: 0 0 24px rgba(255, 130, 190, 0.7);
}

#screenBattle {
  flex-direction: column;
  gap: 12px;
}

.race-zone {
  min-height: 32dvh;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: rgba(7, 0, 13, 0.45);
  padding: 10px;
}

.hud-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.lanes {
  margin-top: 8px;
  display: grid;
  gap: 10px;
}

.lane {
  position: relative;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 8px 12px;
}

.lane-header {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 8px;
}

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

.step {
  height: 18px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.step.active-player {
  background: linear-gradient(120deg, #ff2f8f, #ff82be);
}

.step.active-cpu {
  background: linear-gradient(120deg, #1de5ff, #00bcd4);
}

.runner {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  transition: left 230ms ease-out;
}

.player-runner {
  background: #ff5da8;
  box-shadow: 0 0 16px rgba(255, 93, 168, 0.9);
}

.cpu-runner {
  background: #36f0ff;
  box-shadow: 0 0 16px rgba(54, 240, 255, 0.9);
}

.qa-zone {
  flex: 1;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 14px;
  background: rgba(7, 0, 13, 0.45);
  display: flex;
  flex-direction: column;
}

.question-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 16px;
}

.question {
  margin: 0;
  font-size: clamp(1.65rem, 6vw, 2.1rem);
  text-align: center;
  font-weight: 800;
}

.answers {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.answer-btn {
  min-height: 56px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  border-radius: 14px;
  font-size: 1.25rem;
  font-weight: 800;
}

.answer-btn.correct {
  background: rgba(27, 216, 143, 0.22);
  border-color: rgba(27, 216, 143, 0.8);
}

.answer-btn.wrong {
  background: rgba(255, 78, 120, 0.26);
  border-color: rgba(255, 78, 120, 0.85);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.metric-label {
  margin: 0;
  opacity: 0.8;
}

.metric-value {
  margin: 4px 0;
  font-size: 1.4rem;
  font-weight: 800;
}

.review-wrap {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px;
  min-height: 56px;
}

.review-wrap.hidden {
  display: none;
}

@media (min-width: 481px) {
  .answers {
    grid-template-columns: 1fr 1fr;
  }
}
