:root {
  --bg: #f7f3e9;
  --bg-soft: #fffdf8;
  --panel: rgba(255, 253, 248, 0.92);
  --ink: #1f2a2f;
  --muted: #61737b;
  --line: rgba(31, 42, 47, 0.12);
  --brand: #0f766e;
  --brand-strong: #0b5f59;
  --accent: #f59e0b;
  --danger: #c2410c;
  --danger-soft: #fff2eb;
  --success: #177245;
  --success-soft: #effcf4;
  --shadow: 0 24px 60px rgba(24, 32, 38, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.page-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.35fr 0.95fr;
  gap: 18px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 30px;
  background: var(--brand);
  color: #fffef9;
  box-shadow: var(--shadow);
}

.eyebrow,
.panel__kicker {
  margin: 0 0 8px;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1,
.panel h2,
.question-card h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.08;
}

.hero h1 {
  max-width: 12ch;
  font-size: clamp(2.1rem, 5vw, 4rem);
}

.hero__lead {
  max-width: 58ch;
  margin: 14px 0 0;
  font-size: 1.02rem;
  line-height: 1.65;
  color: rgba(255, 254, 249, 0.88);
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  align-self: end;
}

.stat-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(6px);
}

.stat-card strong {
  font-size: 1.55rem;
}

.stat-card__label {
  font-size: 0.84rem;
  color: rgba(255, 254, 249, 0.78);
}

.app-grid {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.panel {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 6px;
  background: var(--brand);
}

.panel__header {
  margin-bottom: 18px;
}

.panel__header h2 {
  font-size: clamp(1.55rem, 3.5vw, 2.25rem);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.mode-card,
.choice-btn,
.primary-btn,
.secondary-btn {
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.mode-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fffdfa;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.mode-card:hover,
.choice-btn:hover,
.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-2px);
}

.mode-card.is-active {
  border-color: rgba(15, 118, 110, 0.42);
  background: rgba(15, 118, 110, 0.1);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.12);
}

.mode-card.is-disabled,
.mode-card:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.mode-card__title {
  font-weight: 700;
}

.mode-card__count {
  display: inline-flex;
  width: fit-content;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.mode-card__meta,
.setup-summary__text,
#results-summary,
#results-breakdown,
#review-caption {
  color: var(--muted);
}

.saved-sets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.saved-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: var(--radius-lg);
  background: rgba(15, 118, 110, 0.08);
}

.saved-progress__title,
.saved-progress__meta {
  margin: 0;
}

.saved-progress__title {
  font-weight: 700;
  color: var(--brand-strong);
}

.saved-progress__meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.95rem;
}

.saved-progress__actions {
  display: flex;
  gap: 10px;
}

.saved-set {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fffdfa;
}

.saved-set__title,
.saved-set__meta {
  margin: 0;
}

.saved-set__title {
  font-weight: 700;
}

.saved-set__meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.setup-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 18px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdfa;
}

.toggle input {
  accent-color: var(--brand);
}

.setup-summary {
  margin: 20px 0 18px;
  padding: 18px;
  border: 1px dashed rgba(15, 118, 110, 0.28);
  border-radius: var(--radius-lg);
  background: rgba(15, 118, 110, 0.05);
}

.setup-summary__title {
  margin: 0 0 4px;
  font-weight: 700;
}

.primary-btn,
.secondary-btn {
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  cursor: pointer;
}

.primary-btn:disabled,
.secondary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.primary-btn {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 28px rgba(15, 118, 110, 0.22);
}

.primary-btn--small {
  padding: 9px 14px;
  font-size: 0.92rem;
}

.secondary-btn {
  border: 1px solid var(--line);
  background: #fffdfa;
  color: var(--ink);
}

.secondary-btn--small {
  padding: 9px 14px;
  font-size: 0.92rem;
}

.quiz-topbar,
.results-hero,
.results-actions,
.review-block__header,
.quiz-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.score-pills {
  display: flex;
  gap: 10px;
}

.score-pill {
  min-width: 84px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(15, 118, 110, 0.08);
  border: 1px solid rgba(15, 118, 110, 0.16);
  text-align: center;
}

.score-pill span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

.score-pill strong {
  font-size: 1.2rem;
}

.progress-track {
  height: 10px;
  margin: 16px 0 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
}

.progress-track__bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--brand);
  transition: width 220ms ease;
}

.question-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  background: #fffdfa;
  border: 1px solid rgba(15, 118, 110, 0.1);
}

.question-card__badge {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--brand-strong);
  font-size: 0.85rem;
  font-weight: 700;
}

.question-card h3 {
  font-size: clamp(1.28rem, 3vw, 1.7rem);
  line-height: 1.32;
}

.choices {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.question-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 4px;
}

.question-tools__status {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

#flag-btn.is-flagged {
  border-color: rgba(245, 158, 11, 0.36);
  background: rgba(245, 158, 11, 0.1);
  color: #8f5a00;
}

.choice-btn {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  padding: 16px;
  border: 1px solid rgba(31, 42, 47, 0.1);
  border-radius: 18px;
  background: #fffdfa;
  text-align: left;
  cursor: pointer;
}

.choice-btn__tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: 14px;
  background: rgba(245, 158, 11, 0.14);
  color: #9a6707;
  font-weight: 800;
}

.choice-btn.is-selected {
  border-color: rgba(15, 118, 110, 0.36);
  background: rgba(15, 118, 110, 0.08);
}

.choice-btn.is-correct {
  border-color: rgba(23, 114, 69, 0.36);
  background: var(--success-soft);
}

.choice-btn.is-wrong {
  border-color: rgba(194, 65, 12, 0.3);
  background: var(--danger-soft);
}

.feedback {
  margin: 16px 0 2px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid transparent;
}

.feedback.is-correct {
  color: var(--success);
  border-color: rgba(23, 114, 69, 0.2);
  background: var(--success-soft);
}

.feedback.is-wrong {
  color: var(--danger);
  border-color: rgba(194, 65, 12, 0.18);
  background: var(--danger-soft);
}

.results-hero {
  margin: 18px 0 14px;
  align-items: center;
}

.results-ring {
  display: grid;
  place-items: center;
  width: 132px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fffdfa 55%, transparent 56%),
    conic-gradient(var(--brand) 0deg, var(--accent) 220deg, rgba(15, 118, 110, 0.14) 221deg 360deg);
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.7);
}

.results-ring span {
  font-size: 1.7rem;
  font-weight: 800;
}

.results-copy {
  flex: 1;
}

.review-block {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.review-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.review-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(31, 42, 47, 0.08);
  background: #fffdfa;
}

.site-footer {
  margin-top: 18px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 24px;
  background: #e8efe9;
  box-shadow: var(--shadow);
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
}

.site-footer__brand,
.site-footer__meta {
  display: grid;
  gap: 4px;
}

.site-footer__meta {
  text-align: right;
}

.site-footer__title,
.site-footer__text {
  margin: 0;
}

.site-footer__title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.site-footer__text,
.site-footer a {
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer a {
  color: var(--brand-strong);
  text-decoration: none;
  font-weight: 700;
}

.site-footer a:hover {
  text-decoration: underline;
}

.review-card__meta {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.review-card__question {
  margin: 0 0 12px;
  font-weight: 700;
}

.review-card__answers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.answer-chip {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
}

.answer-chip--correct {
  background: var(--success-soft);
  color: var(--success);
}

.answer-chip--wrong {
  background: var(--danger-soft);
  color: var(--danger);
}

.answer-chip--flagged {
  background: rgba(245, 158, 11, 0.14);
  color: #8f5a00;
}

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

.panel,
.question-card,
.review-card {
  animation: riseIn 260ms ease;
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero__stats,
  .mode-grid,
  .saved-progress,
  .saved-sets {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .hero,
  .panel {
    padding: 18px;
    border-radius: 24px;
  }

  .hero h1 {
    max-width: none;
  }

  .hero__stats,
  .mode-grid,
  .saved-sets,
  .quiz-topbar,
  .results-hero,
  .results-actions,
  .review-block__header,
  .quiz-actions,
  .question-tools,
  .saved-progress,
  .site-footer__inner {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .score-pills {
    justify-content: stretch;
  }

  .score-pill {
    flex: 1;
  }

  .results-ring {
    width: 110px;
    margin-inline: auto;
  }

  .saved-set {
    align-items: stretch;
    flex-direction: column;
  }

  .saved-progress__actions {
    flex-direction: column;
  }

  .site-footer__meta {
    text-align: left;
  }

  .primary-btn,
  .secondary-btn {
    width: 100%;
  }

  .choice-btn {
    padding: 14px;
  }
}
