:root {
  --bg: #f8f1e3;
  --bg-accent: #f2dfc2;
  --panel: rgba(255, 252, 246, 0.88);
  --panel-strong: #fffaf0;
  --text: #24313a;
  --muted: #566973;
  --line: rgba(36, 49, 58, 0.15);
  --primary: #1d6c63;
  --primary-dark: #134c46;
  --secondary: #d8693a;
  --shadow: 0 18px 40px rgba(36, 49, 58, 0.12);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(216, 105, 58, 0.22), transparent 24%),
    radial-gradient(circle at top right, rgba(29, 108, 99, 0.24), transparent 30%),
    linear-gradient(180deg, #fcf6ea 0%, #f5ead7 100%);
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
}

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

.section-tag {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--secondary);
}

.term-chip,
.primary-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease,
    color 0.2s ease;
}

.term-chip:hover,
.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

main {
  margin-top: 0;
}

.lesson-page {
  display: none;
  animation: reveal 0.35s ease;
}

.lesson-page.is-visible {
  display: block;
}

.page-hero {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 24px;
  align-items: stretch;
  padding: 24px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-copy h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
}

.hero-copy p {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.page-hero img {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
  border-radius: 22px;
  border: 4px solid rgba(255, 255, 255, 0.7);
}

.landing-page .page-hero {
  min-height: 510px;
}

.landing-page .hero-copy h2 {
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 1.04;
}

.start-button {
  align-self: flex-start;
  margin-top: 28px;
}

.fact-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.fact-strip span {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(216, 105, 58, 0.12);
  color: var(--text);
  font-weight: 700;
  font-size: 0.92rem;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 22px;
}

.card,
.quiz-card {
  padding: 22px;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.card h3,
.quiz-question h3,
.quiz-result h3 {
  margin-top: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.card p,
.card li,
.quiz-question p,
.quiz-result p,
.quiz-result li {
  line-height: 1.7;
  color: var(--muted);
}

.term-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.term-chip {
  padding: 10px 14px;
  background: rgba(29, 108, 99, 0.09);
  color: var(--primary-dark);
  font-weight: 700;
}

.term-chip.is-selected {
  background: var(--secondary);
  color: #fff;
}

.definition-box {
  margin-top: 16px;
  padding: 16px;
  min-height: 118px;
  border-radius: var(--radius-sm);
  background: rgba(36, 49, 58, 0.04);
}

.definition-item {
  display: none;
}

.definition-item.is-visible {
  display: block;
}

details {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.54);
}

details summary {
  cursor: pointer;
  font-weight: 700;
}

.quiz-card {
  display: grid;
  gap: 20px;
  margin-top: 22px;
}

.quiz-question {
  padding: 20px;
  border-radius: var(--radius-md);
  background: rgba(36, 49, 58, 0.04);
}

.quiz-question label {
  display: block;
  margin-top: 10px;
}

.quiz-question input[type="text"],
.quiz-question select {
  width: 100%;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.ordering-grid,
.matching-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.primary-button,
.secondary-button {
  padding: 13px 18px;
  font-weight: 700;
}

.primary-button {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 12px 24px rgba(29, 108, 99, 0.24);
}

.secondary-button {
  background: rgba(36, 49, 58, 0.08);
  color: var(--text);
}

.quiz-result {
  border-radius: var(--radius-md);
  background: rgba(29, 108, 99, 0.08);
}

.quiz-result ul {
  padding-left: 20px;
}

.summary-list {
  padding-left: 20px;
}

.callout-card {
  background:
    linear-gradient(135deg, rgba(29, 108, 99, 0.16), rgba(216, 105, 58, 0.16)),
    var(--panel-strong);
}

.page-controls {
  margin-top: 22px;
  padding: 18px 24px;
  background: rgba(255, 248, 237, 0.92);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .page-hero,
  .content-grid,
  .ordering-grid,
  .matching-grid {
    grid-template-columns: 1fr;
  }

  .page-controls,
  .quiz-actions {
    flex-direction: column;
  }

  .page-controls button,
  .quiz-actions button {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1200px);
    margin: 14px auto 28px;
  }

  .page-hero,
  .card,
  .quiz-card,
  .page-controls {
    padding: 18px;
  }

  .page-hero img {
    min-height: 220px;
  }

  .landing-page .page-hero {
    min-height: auto;
  }
}
