:root {
  --navy: #17324d;
  --navy-soft: #294f70;
  --turquoise: #18c7c8;
  --aqua: #8ce1dd;
  --cream: #fff5d8;
  --yellow: #ffc83d;
  --coral: #ff6864;
  --white: #fffdf7;
  --shadow: 0 8px 0 rgba(23, 50, 77, .15);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--aqua);
  color: var(--navy);
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  font-weight: 700;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; }

.app-shell {
  width: min(100%, 430px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  position: relative;
}

.brand {
  height: 88px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 0 0 auto;
}

.brand-logo {
  width: 74px;
  height: 74px;
  object-fit: contain;
  transform: translateY(-5px);
}

.brand-name {
  width: min(230px, 62vw);
  height: 72px;
  object-fit: contain;
}

.screen {
  flex: 1;
  min-height: 0;
  border: 4px solid var(--navy);
  border-radius: 34px;
  background: var(--cream);
  box-shadow: inset 0 0 0 4px var(--white);
  overflow: hidden;
  position: relative;
}

[hidden] { display: none !important; }

.place-pill {
  height: 50px;
  margin: 7px 7px 0;
  padding: 0 18px;
  border-radius: 24px;
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: .06em;
}

.place-pill span:first-child { color: var(--turquoise); }

.welcome-content, .result-content {
  min-height: calc(100% - 57px);
  padding: 36px 18px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--turquoise);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .08em;
}

h1 {
  max-width: 330px;
  margin: 0 0 14px;
  font-size: clamp(34px, 10vw, 48px);
  line-height: .98;
  text-transform: uppercase;
}

.welcome-content > p:not(.eyebrow) {
  max-width: 310px;
  margin: 0 0 34px;
  line-height: 1.45;
  color: rgba(23, 50, 77, .76);
}

.primary-button {
  width: 100%;
  min-height: 62px;
  padding: 12px 18px;
  border: 3px solid var(--navy);
  border-radius: 24px;
  background: var(--turquoise);
  color: var(--navy);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 17px;
  font-weight: 900;
}

.primary-button:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(23, 50, 77, .15); }

.play-icon {
  display: inline-block;
  margin-right: 10px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 15px solid var(--navy);
  vertical-align: -3px;
}

.game-screen {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-topbar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.stat-box {
  height: 52px;
  border: 3px solid var(--navy);
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 20px;
  box-shadow: inset 0 -4px 0 rgba(23, 50, 77, .08);
}

.timer-box { background: var(--coral); }
.score-box { background: var(--yellow); }

.timer-box.danger { animation: timer-blink .55s steps(2, end) infinite; }

@keyframes timer-blink { 50% { background: var(--white); color: var(--coral); } }

.progress-row {
  min-height: 42px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 900;
}

.metro {
  height: 5px;
  background: var(--navy);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.station {
  width: 18px;
  height: 18px;
  border: 3px solid var(--navy);
  border-radius: 50%;
  background: var(--white);
}

.station.active, .station.passed { background: var(--turquoise); }
.station.fury { background: var(--yellow); box-shadow: 0 0 0 4px rgba(255, 200, 61, .3); }

.bonus-label {
  padding: 7px 6px;
  border: 2px solid var(--navy);
  border-radius: 10px;
  white-space: nowrap;
  background: var(--white);
}

.points-panel {
  flex: 0 0 auto;
  padding: 7px 0 0;
  text-align: center;
  font-size: 13px;
}

.points-track {
  height: 19px;
  margin-top: 7px;
  border: 3px solid var(--navy);
  border-radius: 8px;
  overflow: hidden;
  background: var(--white);
}

#points-bar {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--yellow);
  transition: width .2s linear;
}

.question-card {
  min-height: 0;
  flex: 1;
  padding: 18px 14px 14px;
  border-radius: 25px;
  background: var(--navy-soft);
  color: var(--white);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.question-meta {
  margin: 0 0 9px;
  text-align: center;
  color: var(--turquoise);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .05em;
}

.question-card h2 {
  margin: 0 0 14px;
  font-size: clamp(19px, 5.5vw, 24px);
  line-height: 1.12;
}

.answers {
  flex: 1;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 9px;
}

.answer {
  min-height: 52px;
  padding: 8px 12px;
  border: 0;
  border-radius: 18px;
  color: var(--navy);
  box-shadow: inset 0 -5px 0 rgba(23, 50, 77, .11);
  cursor: pointer;
  font-size: clamp(15px, 4.4vw, 18px);
  font-weight: 900;
}

.answer:nth-child(3n + 1) { background: var(--turquoise); }
.answer:nth-child(3n + 2) { background: var(--yellow); }
.answer:nth-child(3n) { background: var(--coral); }
.answer:disabled { cursor: default; }
.answer.correct { outline: 4px solid #54dc78; }
.answer.wrong { outline: 4px solid var(--white); opacity: .62; }

.reward-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.reward {
  position: absolute;
  left: 50%;
  bottom: 26%;
  z-index: 5;
  padding: 7px 12px;
  border: 3px solid var(--navy);
  border-radius: 14px;
  background: var(--white);
  color: var(--navy);
  animation: reward-jump .8s cubic-bezier(.2, .7, .3, 1) forwards;
}

@keyframes reward-jump {
  0% { transform: translate(-50%, 0) scale(.75); opacity: 0; }
  18% { opacity: 1; }
  70% { transform: translate(var(--reward-x), -330px) scale(1); opacity: 1; }
  100% { transform: translate(var(--reward-x), -380px) scale(.55); opacity: 0; }
}

.result-content { justify-content: flex-start; padding-top: 24px; }
.result-content > .eyebrow { color: var(--navy); font-size: 28px; }

.final-score-card {
  width: 100%;
  margin-top: 12px;
  padding: 22px 12px;
  border-radius: 25px;
  background: var(--navy);
  color: var(--white);
  box-shadow: var(--shadow);
}

.final-score-card span { color: var(--turquoise); }
.final-score-card strong { display: block; margin: 3px 0; color: var(--yellow); font-size: 44px; }
.final-score-card small { display: block; min-height: 18px; }

.result-stats {
  width: 100%;
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.result-stats div {
  min-width: 0;
  padding: 12px 3px;
  border: 2px solid var(--navy);
  border-radius: 13px;
  background: var(--white);
}

.result-stats strong, .result-stats span { display: block; }
.result-stats strong { font-size: 16px; }
.result-stats span { margin-top: 6px; font-size: 8px; }

.replay-button { margin-top: auto; background: var(--coral); }

.countdown {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(23, 50, 77, .91);
  color: var(--yellow);
  display: grid;
  place-items: center;
  font-size: min(42vw, 180px);
  font-weight: 900;
}

@media (max-height: 700px) {
  .brand { height: 64px; }
  .brand-logo { width: 56px; height: 56px; }
  .brand-name { height: 58px; }
  .question-card { padding-top: 13px; }
  .question-card h2 { margin-bottom: 9px; }
  .game-screen { gap: 7px; }
}

@media (min-width: 700px) {
  body { padding: 24px 0; }
  .app-shell { min-height: min(860px, calc(100dvh - 48px)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; }
}
