body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

.card {
  border-radius: 0.75rem;
}

/* iQ brand: lorrank greens, from the logo */
.navbar-iq {
  background-color: #16301F;
}

.navbar-iq .nav-link {
  color: #F5F1E6;
}

.navbar-iq .nav-link:hover,
.navbar-iq .nav-link:focus {
  color: #C4DC7A;
}

/* IQ tests: keep line breaks so grid and matrix questions line up */
.question-text {
  white-space: pre-wrap;
}

/* IQ tests: countdown timer, stays visible while scrolling */
.iq-timer {
  position: sticky;
  top: 0.5rem;
  z-index: 1020;
  overflow: hidden;
}

.iq-timer-clock {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.iq-timer-progress {
  height: 4px;
  border-radius: 0;
}

.iq-timer .progress-bar {
  background-color: #16301F;
  transition: width 0.25s linear;
}

.iq-timer--warning .iq-timer-clock {
  color: #9A6400;
}

.iq-timer--warning .progress-bar {
  background-color: #D99A00;
}

.iq-timer--danger .iq-timer-clock {
  color: #B02A37;
}

.iq-timer--danger .progress-bar {
  background-color: #B02A37;
}

/* IQ test: paid offer card and how-it-works steps */
.iq-offer {
  border: 2px solid #16301F;
}

.iq-offer-price {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: #16301F;
}

.iq-steps li {
  margin-bottom: 0.75rem;
}

/* ------------------------------------------------------------------ */
/* Lessons: read-aloud and fill-in-the-gap exercises                   */
/* ------------------------------------------------------------------ */
.voice-bar {
  position: sticky;
  top: 0;
  z-index: 1010;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 1.25rem;
  padding: 0.6rem 0.75rem;
  background: #F5F1E6;
  border: 1px solid #DDD5BF;
  border-radius: 0.75rem;
}

.voice-bar[hidden] {
  display: none;
}

.voice-bar-title {
  font-weight: 700;
  color: #16301F;
}

.voice-bar-hint {
  font-size: 0.875rem;
  color: #5c5c5c;
}

.lesson-body {
  font-size: 1.0625rem;
  line-height: 1.6;
}

.lesson-goal {
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  background: #EEF5E0;
  border-left: 4px solid #16301F;
  border-radius: 0.5rem;
}

.lesson-goal-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.8125rem;
  color: #16301F;
  margin-right: 0.25rem;
}

.lesson-heading {
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #16301F;
  margin: 1.75rem 0 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #DDD5BF;
}

.lesson-heading-sub {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: #333;
}

/* A line that can be read aloud: speaker button + text */
.say-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  border-radius: 0.4rem;
  transition: background-color 0.15s;
}

.say-row.is-speaking {
  background: #FFF6D6;
}

.say-list {
  list-style: none;
  padding-left: 0;
  margin-bottom: 0.75rem;
}

.say-list--numbered {
  counter-reset: say;
}

.say-list--numbered > li::before {
  counter-increment: say;
  content: counter(say) ".";
  min-width: 1.25rem;
  font-weight: 600;
  order: 1;
}

.say-list--numbered > li > .say-text {
  order: 2;
}

.say-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-top: -0.1rem;
  padding: 0;
  border: 1px solid #C9D9AE;
  border-radius: 50%;
  background: #fff;
  color: #16301F;
  cursor: pointer;
}

.say-btn:hover,
.say-btn:focus-visible {
  background: #16301F;
  border-color: #16301F;
  color: #fff;
}

.no-speech .say-btn {
  display: none;
}

/* Tap-a-word */
.w {
  cursor: pointer;
  border-radius: 0.2rem;
}

.w:hover {
  background: #EEF5E0;
  text-decoration: underline dotted #16301F;
  text-underline-offset: 0.2em;
}

.w.is-speaking {
  background: #FFE38A;
}

/* Dialogue */
.dialogue {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: #fff;
  border: 1px solid #E6E1D3;
  border-radius: 0.75rem;
}

.dialogue-speaker {
  font-weight: 700;
  color: #16301F;
  margin-right: 0.25rem;
}

.dialogue-speaker::after {
  content: ":";
}

.dialogue-play.is-playing {
  background: #16301F;
  color: #fff;
}

/* Hidden answers */
.lesson-answers {
  margin: 0.5rem 0 1rem;
  padding: 0.5rem 0.75rem;
  border: 1px dashed #C9D9AE;
  border-radius: 0.5rem;
}

.lesson-answers summary {
  font-weight: 600;
  color: #16301F;
  cursor: pointer;
}

.lesson-answers[open] summary {
  margin-bottom: 0.5rem;
}

/* Fill-in-the-gap exercise */
.exercise {
  padding: 1rem;
  margin-bottom: 1.25rem;
  background: #fff;
  border: 2px solid #16301F;
  border-radius: 0.75rem;
}

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 2.75rem;
  margin-bottom: 1rem;
  padding: 0.5rem;
  background: #F5F1E6;
  border-radius: 0.5rem;
}

.word-bank.is-empty {
  display: none;
}

.word-chip {
  padding: 0.4rem 0.9rem;
  font-size: 1.0625rem;
  font-weight: 600;
  color: #16301F;
  background: #fff;
  border: 2px solid #16301F;
  border-radius: 999px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.word-chip:focus-visible {
  outline: 3px solid #C4DC7A;
  outline-offset: 2px;
}

.word-chip.is-selected {
  background: #16301F;
  color: #fff;
}

.word-chip.is-dragging {
  opacity: 0.35;
}

.word-chip.is-used {
  display: none;
}

.word-chip--ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2000;
  pointer-events: none;
  cursor: grabbing;
  background: #16301F;
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.exercise-items {
  list-style: none;
  padding-left: 0;
  margin-bottom: 0.75rem;
  counter-reset: gap;
}

.exercise-item {
  align-items: center;
  margin-bottom: 0.6rem;
}

.exercise-item::before {
  counter-increment: gap;
  content: counter(gap) ".";
  order: 1;
  min-width: 1.25rem;
  font-weight: 600;
}

.exercise-sentence {
  order: 2;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.blank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.5rem;
  min-height: 2.25rem;
  padding: 0.15rem 0.6rem;
  font-size: 1.0625rem;
  font-weight: 600;
  color: #16301F;
  background: #fff;
  border: 2px dashed #8A9A7A;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.blank.is-target {
  border-color: #16301F;
  background: #F8FBF0;
}

.blank.is-over {
  background: #EEF5E0;
  border-style: solid;
  transform: scale(1.05);
}

.blank.is-correct {
  color: #fff;
  background: #198754;
  border: 2px solid #198754;
  cursor: default;
}

.blank.is-wrong {
  color: #fff;
  background: #DC3545;
  border: 2px solid #DC3545;
  animation: iq-shake 0.45s ease-in-out;
}

.blank.is-revealed {
  color: #16301F;
  background: #E7F0FF;
  border: 2px solid #8AB0E6;
  cursor: default;
}

@keyframes iq-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

@media (prefers-reduced-motion: reduce) {
  .blank.is-wrong {
    animation: none;
  }
}

.exercise-feedback {
  min-height: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.exercise-feedback.is-correct,
.exercise-feedback.is-done {
  color: #198754;
}

.exercise-feedback.is-wrong {
  color: #DC3545;
}

/* ------------------------------------------------------------------ */
/* Home page                                                           */
/* ------------------------------------------------------------------ */
.home-panel {
  padding: 2rem;
  border-radius: 1rem;
}

.home-panel--challenge {
  color: #F5F1E6;
  background: #16301F radial-gradient(circle at 85% 15%, rgba(196, 220, 122, 0.22), transparent 55%);
}

.home-panel--learn {
  background: #F5F1E6;
  border: 1px solid #DDD5BF;
}

.home-kicker {
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #C4DC7A;
}

.home-kicker--learn {
  color: #16301F;
}

.home-title {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.home-title--small {
  font-size: clamp(1.6rem, 3vw, 2rem);
  color: #16301F;
}

.home-lead {
  font-size: 1.125rem;
  max-width: 36rem;
  color: rgba(245, 241, 230, 0.9);
}

.home-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding: 0;
  margin: 1.25rem 0 1.5rem;
  list-style: none;
  font-size: 0.95rem;
  color: rgba(245, 241, 230, 0.85);
}

.home-facts strong {
  display: block;
  font-size: 1.75rem;
  line-height: 1;
  color: #C4DC7A;
}

.btn-challenge {
  font-weight: 700;
  color: #16301F;
  background: #C4DC7A;
  border-color: #C4DC7A;
}

.btn-challenge:hover,
.btn-challenge:focus-visible {
  color: #16301F;
  background: #D6E99A;
  border-color: #D6E99A;
}

.home-price {
  font-weight: 700;
}

.home-price-note {
  font-weight: 400;
  color: rgba(245, 241, 230, 0.75);
}

@media (max-width: 575.98px) {
  .home-panel {
    padding: 1.5rem;
  }
}

/* ------------------------------------------------------------------ */
/* Lesson quiz: "Check Your Understanding"                             */
/* ------------------------------------------------------------------ */
.quiz {
  margin: 2rem 0;
  padding: 1.5rem;
  background: #F5F1E6;
  border: 1px solid #DDD5BF;
  border-radius: 1rem;
}

.quiz-question {
  padding: 1rem 0;
  border-top: 1px solid #DDD5BF;
}

.quiz-question-text {
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.quiz-number {
  color: #16301F;
}

.quiz-options {
  display: grid;
  gap: 0.5rem;
}

.quiz-option {
  text-align: left;
  padding: 0.6rem 0.9rem;
  border: 1px solid #C9C0A6;
  border-radius: 0.5rem;
  background: #fff;
  color: inherit;
}

.quiz-option:hover:not(:disabled),
.quiz-option:focus-visible {
  border-color: #16301F;
  outline: none;
  box-shadow: 0 0 0 2px rgba(22, 48, 31, 0.15);
}

.quiz-option:disabled {
  cursor: default;
  opacity: 0.75;
}

.quiz-option.is-correct {
  opacity: 1;
  border-color: #198754;
  background: #D1E7DD;
}

.quiz-option.is-correct::before {
  content: "\2713  ";
  font-weight: 700;
  color: #198754;
}

.quiz-option.is-wrong {
  opacity: 1;
  border-color: #B02A37;
  background: #F8D7DA;
}

.quiz-option.is-wrong::before {
  content: "\2717  ";
  font-weight: 700;
  color: #B02A37;
}

.quiz-feedback {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border-left: 4px solid #16301F;
  border-radius: 0.25rem;
}

.quiz-result {
  padding-top: 1rem;
  border-top: 1px solid #DDD5BF;
}

/* Lesson diagrams */
.lesson-diagram {
  margin: 1.5rem 0;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid #DDD5BF;
  border-radius: 1rem;
}

.lesson-diagram img {
  display: block;
  width: 100%;
  height: auto;
}

.lesson-diagram figcaption {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: #3d4a40;
}
