:root {
  --bg: #f7efe3;
  --bg-strong: #eed9bf;
  --panel: rgba(255, 251, 245, 0.82);
  --panel-strong: #fff8ef;
  --ink: #1d1a16;
  --muted: #63584c;
  --line: rgba(29, 26, 22, 0.12);
  --accent: #d94f2b;
  --accent-deep: #a53518;
  --accent-soft: #ffd8c6;
  --success: #146c43;
  --danger: #9b2226;
  --shadow: 0 20px 60px rgba(78, 54, 28, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(217, 79, 43, 0.12), transparent 30%),
    radial-gradient(circle at top right, rgba(31, 119, 180, 0.09), transparent 28%),
    linear-gradient(180deg, #fffaf4 0%, var(--bg) 100%);
}

.page-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 28px;
}

.hero-copy,
.hero-panel,
.resource-card,
.question-card,
.results-card,
.mode-card,
.progress-panel {
  backdrop-filter: blur(12px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 28px;
}

.hero-copy {
  padding: 34px;
}

.eyebrow,
.resource-kicker,
.quiz-label {
  margin: 0 0 12px;
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-deep);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 0.95;
}

h1,
h2 {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
}

h1 {
  font-size: clamp(3rem, 6vw, 5.8rem);
  max-width: 11ch;
}

.lede {
  max-width: 58ch;
  margin: 22px 0 0;
  font-size: 1.08rem;
  line-height: 1.65;
  color: var(--muted);
}

.hero-actions,
.results-actions,
.quiz-actions,
.nav-row,
.resource-links,
.question-meta,
.progress-copy,
.results-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-actions {
  margin-top: 28px;
}

button,
a {
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
}

button {
  font: inherit;
  cursor: pointer;
}

.primary-action,
.secondary-action,
.ghost-action,
.mode-card,
.answer-option {
  border-radius: 18px;
}

.primary-action,
.secondary-action,
.ghost-action {
  padding: 14px 18px;
  border: 1px solid transparent;
}

.primary-action {
  background: var(--accent);
  color: #fff8f2;
  box-shadow: 0 10px 25px rgba(217, 79, 43, 0.25);
}

.secondary-action {
  background: var(--panel-strong);
  border-color: var(--line);
  color: var(--ink);
}

.ghost-action {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.primary-action:hover,
.secondary-action:hover,
.ghost-action:hover,
.mode-card:hover,
.answer-option:hover {
  transform: translateY(-1px);
}

.hero-panel {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.stat-card {
  padding: 22px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 248, 239, 0.95), rgba(255, 240, 225, 0.88));
  border: 1px solid rgba(29, 26, 22, 0.08);
}

.stat-value {
  display: block;
  font-size: 2.7rem;
  font-weight: 700;
}

.stat-label {
  color: var(--muted);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.mode-card {
  text-align: left;
  padding: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,245,236,0.88));
}

.mode-card strong {
  display: block;
  margin: 8px 0 10px;
  font-size: 1.15rem;
}

.mode-card span:last-child {
  display: block;
  color: var(--muted);
  line-height: 1.5;
}

.mode-badge,
#question-reference,
#question-theme {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  font-size: 0.86rem;
}

.resources {
  margin-bottom: 24px;
}

.resource-card {
  padding: 24px 28px;
}

.resource-links a {
  color: var(--ink);
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--line);
}

.quiz-shell,
.results-shell {
  margin-top: 20px;
}

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

.progress-panel {
  padding: 16px 18px;
  margin-bottom: 18px;
}

.progress-copy {
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--muted);
}

.progress-track {
  height: 10px;
  background: rgba(29, 26, 22, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ea6c33 0%, #d94f2b 100%);
  border-radius: inherit;
}

.question-card {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(300px, 0.9fr);
  gap: 18px;
  padding: 18px;
}

.media-panel,
.question-panel {
  min-width: 0;
}

.media-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 22px;
  overflow: hidden;
  background: #0f1418;
  display: grid;
  place-items: center;
}

.media-frame img,
.media-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0f1418;
}

.media-controls {
  margin-top: 12px;
}

.media-controls audio {
  width: 100%;
}

.question-panel {
  padding: 6px 4px;
}

#question-title {
  font-size: clamp(2rem, 3vw, 3rem);
  margin: 18px 0;
}

#prompts {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.prompt-chip {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px dashed rgba(29, 26, 22, 0.18);
  background: rgba(255, 251, 245, 0.9);
}

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

.answer-option {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  text-align: left;
  padding: 16px;
  border: 1px solid rgba(29, 26, 22, 0.12);
  background: rgba(255, 255, 255, 0.86);
}

.answer-option.selected {
  border-color: var(--accent);
  background: rgba(255, 216, 198, 0.72);
}

.answer-option.correct {
  border-color: rgba(20, 108, 67, 0.34);
  background: rgba(20, 108, 67, 0.09);
}

.answer-option.incorrect {
  border-color: rgba(155, 34, 38, 0.28);
  background: rgba(155, 34, 38, 0.09);
}

.choice-key {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(29, 26, 22, 0.07);
  font-weight: 700;
}

.choice-copy {
  line-height: 1.45;
}

.explanation-box {
  margin-top: 18px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 248, 239, 0.92);
  border: 1px solid rgba(29, 26, 22, 0.08);
  color: var(--muted);
  line-height: 1.6;
}

.explanation-box strong {
  color: var(--ink);
}

.nav-row {
  justify-content: space-between;
  margin-top: 18px;
}

.results-card {
  padding: 32px;
}

.results-stats {
  margin: 18px 0 22px;
}

.results-stats .mode-badge {
  background: rgba(255,255,255,0.88);
}

.hidden {
  display: none !important;
}

@media (max-width: 1040px) {
  .hero,
  .question-card,
  .mode-grid {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    padding-top: 20px;
  }

  .hero,
  .mode-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .resource-card,
  .results-card {
    padding: 22px;
  }

  h1 {
    max-width: none;
  }

  .quiz-topbar,
  .progress-copy,
  .nav-row {
    flex-direction: column;
  }

  .nav-row > * {
    width: 100%;
  }
}
