:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #5d6875;
  --panel: #ffffff;
  --panel-soft: #f3f7f4;
  --road: #2a3037;
  --stripe: #f7d94c;
  --green: #2f7d57;
  --green-dark: #195c3c;
  --blue: #2463a6;
  --red: #bf3d36;
  --amber: #d28b1f;
  --line: #d7e0d9;
  --shadow: 0 18px 50px rgba(23, 32, 42, 0.16);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.94)),
    repeating-linear-gradient(90deg, #dfeadf 0 44px, #d7e5d8 44px 88px);
}

button,
select {
  font: inherit;
}

.game-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.hero-panel,
.play-panel,
.result-panel {
  min-height: calc(100vh - 56px);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 24px;
  align-items: stretch;
}

.hero-copy {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 560px;
  padding: 40px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(13, 23, 32, 0.05), rgba(13, 23, 32, 0.86)),
    linear-gradient(115deg, #28684b 0 24%, #ced7c7 24% 29%, #39434d 29% 64%, #f1cf45 64% 67%, #39434d 67% 100%);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-copy::before {
  content: "";
  position: absolute;
  inset: 12% -20% auto auto;
  width: 72%;
  height: 64%;
  background:
    linear-gradient(90deg, transparent 0 45%, rgba(255, 255, 255, 0.8) 45% 49%, transparent 49% 100%),
    linear-gradient(#48515a, #222a31);
  transform: rotate(-8deg);
  border-radius: 999px;
  opacity: 0.8;
}

.hero-copy > * {
  position: relative;
}

.eyebrow {
  margin: 0 0 8px;
  color: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 8vw, 6.2rem);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  letter-spacing: 0;
}

h3 {
  margin: 12px 0 18px;
  font-size: clamp(1.25rem, 3vw, 1.9rem);
  line-height: 1.18;
  letter-spacing: 0;
}

.intro {
  max-width: 34rem;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.08rem;
  line-height: 1.55;
}

.setup-card,
.question-card,
.result-card {
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.setup-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field-row {
  display: grid;
  gap: 8px;
}

label,
.chapter-toolbar {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.chapter-toolbar,
.toolbar-buttons,
.question-actions,
.result-actions,
.card-topline,
.topbar,
.scoreboard {
  display: flex;
  align-items: center;
}

.chapter-toolbar,
.topbar,
.card-topline {
  justify-content: space-between;
  gap: 16px;
}

.toolbar-buttons,
.question-actions,
.result-actions {
  gap: 10px;
  flex-wrap: wrap;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.chapter-chip {
  min-height: 54px;
  padding: 10px 12px;
  color: var(--ink);
  text-align: left;
  background: #f8faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.chapter-chip.is-selected {
  color: #fff;
  background: var(--green);
  border-color: var(--green-dark);
}

.chapter-chip strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.84rem;
}

.chapter-chip span {
  display: block;
  font-size: 0.78rem;
  line-height: 1.2;
}

.primary-button,
.ghost-button,
.text-button,
.lifeline-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
}

.primary-button {
  color: #fff;
  background: var(--green);
  border-color: var(--green-dark);
  font-weight: 800;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--green-dark);
}

.ghost-button,
.lifeline-button {
  color: var(--green-dark);
  background: #eef6f0;
  border-color: #bdd3c1;
  font-weight: 700;
}

.text-button {
  min-height: 34px;
  color: var(--blue);
  background: transparent;
  font-weight: 800;
}

.play-panel {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 18px;
}

.topbar {
  padding: 18px 20px;
  color: #fff;
  background: #1e2c37;
  border-radius: 8px;
}

.scoreboard {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.scoreboard span {
  min-height: 38px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  white-space: nowrap;
}

.road-wrap {
  padding: 10px 0;
}

.road {
  position: relative;
  height: 96px;
  overflow: hidden;
  background: var(--road);
  border: 8px solid #f4f0dd;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.lane-markers {
  position: absolute;
  inset: 46px 0 auto;
  height: 8px;
  background: repeating-linear-gradient(90deg, var(--stripe) 0 58px, transparent 58px 100px);
}

.car {
  position: absolute;
  left: 14px;
  top: 22px;
  display: grid;
  place-items: center;
  width: 74px;
  height: 38px;
  color: #fff;
  background: var(--red);
  border: 3px solid #ffd4cd;
  border-radius: 8px 16px 16px 8px;
  font-size: 0.68rem;
  font-weight: 900;
  transition: left 360ms ease;
}

.car::before,
.car::after {
  content: "";
  position: absolute;
  bottom: -10px;
  width: 16px;
  height: 16px;
  background: #13181d;
  border: 3px solid #cbd2d8;
  border-radius: 50%;
}

.car::before {
  left: 8px;
}

.car::after {
  right: 8px;
}

.question-card {
  align-self: start;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  color: #6f4a07;
  background: #fff5da;
  border: 1px solid #efd28d;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.answer-button {
  min-height: 76px;
  padding: 14px;
  color: var(--ink);
  text-align: left;
  background: #f8faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  line-height: 1.35;
}

.answer-button:hover,
.answer-button:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 99, 166, 0.14);
}

.answer-button.is-correct {
  color: #fff;
  background: var(--green);
  border-color: var(--green-dark);
}

.answer-button.is-wrong {
  color: #fff;
  background: var(--red);
  border-color: #8f2924;
}

.answer-button.is-muted {
  opacity: 0.42;
}

.feedback {
  margin-top: 16px;
  padding: 14px;
  background: #f3f7f4;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.5;
}

.question-actions {
  justify-content: space-between;
  margin-top: 18px;
}

.result-panel {
  display: grid;
  place-items: center;
}

.result-card {
  width: min(760px, 100%);
}

.result-card .eyebrow {
  color: var(--green-dark);
}

.medals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.medal {
  padding: 8px 10px;
  color: #20442f;
  background: #eaf4ec;
  border: 1px solid #c4dbc8;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 800;
}

.review-list {
  display: grid;
  gap: 10px;
  max-height: 300px;
  overflow: auto;
  padding-right: 4px;
}

.review-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.review-item strong {
  display: block;
  margin-bottom: 4px;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .hero-panel {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    min-height: 330px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .scoreboard {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .game-shell {
    width: min(100% - 20px, 1120px);
    padding: 10px 0;
  }

  .hero-panel,
  .play-panel,
  .result-panel {
    min-height: calc(100vh - 20px);
  }

  .hero-copy,
  .setup-card,
  .question-card,
  .result-card {
    padding: 18px;
  }

  .chapter-grid,
  .answers {
    grid-template-columns: 1fr;
  }

  .scoreboard span {
    flex: 1 1 100px;
  }
}
