:root {
  --bg: #f7f4ec;
  --surface: #ffffff;
  --ink: #182826;
  --muted: #65716f;
  --line: #d8d7cd;
  --green: #167b63;
  --green-soft: #dff1eb;
  --red: #b63f35;
  --red-soft: #f7dfdc;
  --gold: #c8921e;
  --sky: #dbeefa;
  --shadow: 0 16px 36px rgba(26, 40, 38, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Atkinson Hyperlegible", system-ui, sans-serif;
  background:
    linear-gradient(180deg, rgba(219, 238, 250, 0.65), transparent 320px),
    var(--bg);
  color: var(--ink);
}

button,
select {
  font: inherit;
}

button {
  min-height: 44px;
}

a {
  color: #0b6354;
  font-weight: 700;
}

.app-shell {
  width: min(1160px, calc(100% - 28px));
  margin: 24px auto 44px;
  display: grid;
  gap: 18px;
}

.quiz-stage,
.quiz-card,
.review-grid > article,
.score-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.quiz-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  overflow: hidden;
}

.intro-panel {
  min-height: 300px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(230px, 0.95fr);
  align-items: stretch;
}

.intro-panel > div {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.intro-panel img {
  width: 100%;
  height: 100%;
  min-height: 300px;
  object-fit: cover;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2 {
  font-family: "Space Grotesk", system-ui, sans-serif;
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4.7rem);
}

h2 {
  font-size: clamp(1.35rem, 2.2vw, 2rem);
}

.lede {
  max-width: 58ch;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.score-panel {
  border-width: 0 0 0 1px;
  border-radius: 0;
  box-shadow: none;
  padding: 22px;
  display: grid;
  align-content: center;
  gap: 14px;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-strip div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 8px;
  text-align: center;
  background: #fbfaf5;
}

.stat-strip span {
  display: block;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
}

.stat-strip small,
.fine-print {
  color: var(--muted);
  font-size: 0.92rem;
}

label {
  font-weight: 700;
}

select,
.primary-btn,
.ghost-btn {
  border-radius: 8px;
  border: 1px solid var(--line);
}

select {
  width: 100%;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
}

.primary-btn,
.ghost-btn {
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.ghost-btn {
  color: var(--ink);
  background: #fff;
}

.primary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.quiz-card {
  padding: 24px;
  display: grid;
  gap: 16px;
}

.quiz-topline,
.quiz-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--sky);
  color: #173b47;
  font-weight: 700;
}

#questionProgress {
  color: var(--muted);
  font-weight: 700;
}

.progress-track {
  height: 10px;
  background: #ebe9df;
  border-radius: 999px;
  overflow: hidden;
}

#progressBar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width 0.2s ease;
}

#questionText {
  max-width: 900px;
}

.answer-grid {
  display: grid;
  gap: 10px;
}

.answer-btn {
  width: 100%;
  text-align: left;
  color: var(--ink);
  background: #fbfaf5;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  cursor: pointer;
}

.answer-btn:hover:not(:disabled),
.answer-btn:focus-visible {
  border-color: var(--gold);
  outline: none;
}

.answer-btn.correct {
  background: var(--green-soft);
  border-color: var(--green);
}

.answer-btn.wrong {
  background: var(--red-soft);
  border-color: var(--red);
}

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

.feedback strong {
  display: block;
  margin-bottom: 6px;
}

.cat-reaction {
  display: grid;
  grid-template-columns: minmax(110px, 190px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin: 10px 0 14px;
  padding: 10px;
  border: 1px solid rgba(182, 63, 53, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
}

.cat-reaction img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(101, 113, 111, 0.22);
  background: #f8efe0;
}

.cat-reaction p {
  margin: 0;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 1.08rem;
  line-height: 1.25;
}

.feedback.good {
  border-color: #99cdbb;
  background: var(--green-soft);
}

.feedback.bad {
  border-color: #e1a49f;
  background: var(--red-soft);
}

.hidden {
  display: none;
}

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.review-grid > article {
  padding: 22px;
  box-shadow: none;
}

.focus-list {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

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

.focus-item strong {
  display: block;
}

@media (max-width: 860px) {
  .quiz-stage,
  .intro-panel,
  .review-grid {
    grid-template-columns: 1fr;
  }

  .intro-panel img {
    min-height: 190px;
    max-height: 240px;
  }

  .score-panel {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 18px, 1160px);
    margin-top: 10px;
  }

  .intro-panel > div,
  .quiz-card,
  .score-panel,
  .review-grid > article {
    padding: 16px;
  }

  .quiz-actions > button {
    flex: 1;
  }

  .cat-reaction {
    grid-template-columns: 1fr;
  }

  .cat-reaction img {
    max-height: 210px;
  }
}
