:root {
  --bg-top: #f3ead2;
  --bg-bottom: #d7c19a;
  --panel: rgba(255, 250, 241, 0.84);
  --panel-border: rgba(88, 62, 22, 0.14);
  --text: #2f2416;
  --muted: #6f5d43;
  --accent: #3f6b2a;
  --accent-strong: #234312;
  --danger: #8e2f2b;
  --danger-soft: #fff0ec;
  --success: #234312;
  --success-soft: #edf6e7;
  --shadow: 0 30px 70px rgba(76, 54, 20, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Bitter", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(126, 156, 76, 0.16), transparent 24rem),
    radial-gradient(circle at left 20%, rgba(227, 185, 95, 0.22), transparent 18rem),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

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

.hero {
  padding: 0 8px 28px;
}

.eyebrow {
  margin: 0 0 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 0.78rem;
}

.hero h1,
.summary h2 {
  margin: 0;
  font-size: clamp(1.3rem, 2.55vw, 2.3rem);
  line-height: 1.03;
  max-width: none;
}

.hero h1 {
  white-space: nowrap;
}

.intro,
.summary-copy {
  max-width: 56ch;
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--muted);
  margin: 18px 0 0;
}

.quiz-card {
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  padding: 26px;
}

.mode-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.mode-description {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.55;
  max-width: 60ch;
}

.mode-switch {
  display: inline-flex;
  padding: 5px;
  border-radius: 999px;
  border: 1px solid rgba(88, 62, 22, 0.12);
  background: rgba(255, 255, 255, 0.62);
}

.mode-button {
  border: 0;
  background: transparent;
  padding: 10px 16px;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  color: var(--muted);
}

.mode-button.is-active {
  background: var(--accent);
  color: #fffdf7;
}

.status-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.status-label {
  margin: 0 0 6px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.status-value {
  margin: 0;
  font-size: 1.5rem;
}

.ghost-button,
.primary-button,
.answer-button {
  font: inherit;
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease;
}

.ghost-button,
.primary-button {
  border-radius: 999px;
  padding: 12px 18px;
  border: 1px solid rgba(63, 107, 42, 0.2);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.58);
  color: var(--accent-strong);
}

.ghost-button:hover,
.primary-button:hover,
.answer-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: var(--accent);
  color: #fffdf7;
}

.progress-track {
  height: 10px;
  margin: 20px 0 28px;
  border-radius: 999px;
  background: rgba(90, 68, 30, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5f8d30, #7ab24a);
  transition: width 220ms ease;
}

.question-meta {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.98rem;
}

.quiz-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.95fr);
  gap: 22px;
  align-items: start;
}

.question-text {
  margin: 0 0 24px;
  font-size: clamp(1.45rem, 3vw, 2.05rem);
  line-height: 1.24;
}

.answers {
  display: grid;
  gap: 14px;
}

.answer-button {
  width: 100%;
  text-align: left;
  border-radius: 22px;
  border: 1px solid rgba(88, 62, 22, 0.12);
  padding: 18px 18px 18px 72px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  position: relative;
}

.answer-button::before {
  content: attr(data-letter);
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(63, 107, 42, 0.1);
  color: var(--accent-strong);
  font-weight: 700;
}

.answer-button.is-correct {
  border-color: rgba(35, 67, 18, 0.3);
  background: var(--success-soft);
}

.answer-button.is-correct::before {
  background: var(--accent);
  color: #fff;
}

.answer-button.is-wrong {
  border-color: rgba(142, 47, 43, 0.24);
  background: var(--danger-soft);
}

.answer-button.is-wrong::before {
  background: var(--danger);
  color: #fff;
}

.answer-explanation {
  border-radius: 20px;
  padding: 16px 18px;
  border: 1px solid rgba(88, 62, 22, 0.12);
  line-height: 1.65;
}

.answer-explanation.is-success {
  border-color: rgba(35, 67, 18, 0.2);
  background: rgba(237, 246, 231, 0.96);
}

.answer-explanation.is-error {
  border-color: rgba(142, 47, 43, 0.18);
  background: rgba(255, 244, 240, 0.96);
}

.answer-explanation-label {
  margin: 0 0 8px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.answer-explanation-text {
  margin: 0;
}

.inline-next-button {
  margin-top: 14px;
}

.feedback {
  margin-top: 20px;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(142, 47, 43, 0.16);
  background: rgba(255, 246, 242, 0.92);
}

.feedback.is-success {
  border-color: rgba(35, 67, 18, 0.18);
  background: rgba(237, 246, 231, 0.92);
}

.feedback-label {
  margin: 0 0 8px;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.feedback-text {
  margin: 0;
  line-height: 1.65;
}

.learn-pane {
  display: grid;
  gap: 14px;
}

.learn-image-card,
.learn-note-card {
  border-radius: 22px;
  border: 1px solid rgba(88, 62, 22, 0.12);
  background: rgba(255, 255, 255, 0.66);
  overflow: hidden;
}

.learn-image-frame {
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(180deg, rgba(255, 248, 235, 0.2), rgba(221, 206, 177, 0.35)),
    #ece2cd;
}

.learn-image-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.learn-image-label {
  margin: 0;
  padding: 12px 14px 14px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.learn-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  color: var(--accent-strong);
  background:
    radial-gradient(circle at top, rgba(122, 178, 74, 0.24), transparent 35%),
    linear-gradient(180deg, rgba(255,255,255,0.55), rgba(236,226,205,0.85));
}

.learn-fallback strong {
  display: block;
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.learn-note-card {
  padding: 16px 16px 18px;
}

.learn-note-label {
  margin: 0 0 8px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.learn-note-text {
  margin: 0;
  line-height: 1.65;
}

.summary {
  text-align: left;
  padding: 10px 4px 4px;
}

.exam-review {
  display: grid;
  gap: 12px;
  margin: 22px 0;
}

.review-card {
  border-radius: 20px;
  border: 1px solid rgba(88, 62, 22, 0.12);
  background: rgba(255, 255, 255, 0.68);
  padding: 16px 18px;
}

.review-card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.review-card p {
  margin: 0;
  line-height: 1.6;
}

.review-card p + p {
  margin-top: 8px;
}

body.exam-mode .learn-pane {
  display: none;
}

body.exam-mode .quiz-grid {
  grid-template-columns: 1fr;
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100vw - 20px, 980px);
    padding: 20px 0 40px;
  }

  .quiz-card {
    padding: 18px;
    border-radius: 24px;
  }

  .mode-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .hero h1 {
    white-space: normal;
  }

  .quiz-grid {
    grid-template-columns: 1fr;
  }

  .status-bar {
    grid-template-columns: 1fr;
  }

  .answer-button {
    padding-left: 64px;
  }
}
