:root {
  --navy-950: #071c33;
  --navy-900: #0b2949;
  --navy-800: #123d67;
  --teal-600: #078477;
  --teal-500: #0a9a89;
  --teal-100: #dff5f1;
  --gold-500: #e5ad36;
  --gold-100: #fff5d8;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --white: #ffffff;
  --success: #137a53;
  --success-bg: #e9f8f1;
  --danger: #b33838;
  --danger-bg: #fff0f0;
  --warning: #966118;
  --warning-bg: #fff7e4;
  --shadow: 0 18px 50px rgba(7, 28, 51, 0.10);
  --radius-lg: 22px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--navy-950);
  background:
    radial-gradient(circle at 90% 8%, rgba(10, 154, 137, 0.10), transparent 24rem),
    linear-gradient(180deg, #f7fbfd 0%, #eef5f8 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  padding: 0.7rem 1rem;
  color: var(--white);
  background: var(--navy-950);
  border-radius: 8px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  color: var(--white);
  background: linear-gradient(125deg, var(--navy-950), var(--navy-800));
  border-bottom: 4px solid var(--gold-500);
}

.header-inner {
  width: min(100% - 2rem, 1120px);
  margin: 0 auto;
  padding: 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--navy-950);
  background: var(--gold-500);
  border-radius: 13px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.brand-name,
.brand-tagline {
  margin: 0;
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-tagline {
  color: #c8dae9;
  font-size: 0.76rem;
}

.page-shell {
  width: min(100% - 1.25rem, 860px);
  margin: 1.25rem auto 2rem;
}

.panel {
  padding: clamp(1.1rem, 4vw, 2.5rem);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(203, 213, 225, 0.78);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.status-panel {
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.status-panel h1 {
  margin: 1rem 0 0.25rem;
  font-size: clamp(1.5rem, 5vw, 2rem);
}

.status-panel p {
  max-width: 38rem;
  margin: 0 0 1.25rem;
  color: var(--slate-600);
}

.loader {
  width: 46px;
  height: 46px;
  border: 4px solid var(--teal-100);
  border-top-color: var(--teal-600);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.status-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 1.75rem;
  font-weight: 900;
}

.status-icon-error {
  color: var(--danger);
  background: var(--danger-bg);
}

.quiz-heading {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.4rem;
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--teal-600);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  line-height: 1.25;
}

.quiz-heading h1,
.results-panel h1,
.review-heading h1 {
  margin: 0;
  font-size: clamp(1.6rem, 6vw, 2.35rem);
  letter-spacing: -0.035em;
}

.answer-status {
  align-self: flex-start;
  margin: 0;
  padding: 0.35rem 0.7rem;
  color: var(--slate-700);
  background: var(--slate-100);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.45rem;
  color: var(--slate-600);
  font-size: 0.86rem;
  font-weight: 700;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  background: var(--slate-200);
  border-radius: 999px;
}

.progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--teal-600), var(--teal-500));
  border-radius: inherit;
  transition: width 180ms ease-out;
}

.question-block {
  padding: 1.5rem 0 0.4rem;
}

#question-text {
  margin: 0 0 1.25rem;
  font-size: clamp(1.2rem, 4vw, 1.55rem);
  letter-spacing: -0.015em;
}

.answer-options {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 0.7rem;
}

.answer-option {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 0.8rem;
  min-height: 58px;
  padding: 0.8rem;
  color: var(--slate-700);
  background: var(--white);
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.answer-option:hover {
  border-color: #92c8c1;
  transform: translateY(-1px);
}

.answer-option:has(input:focus-visible) {
  outline: 3px solid rgba(7, 132, 119, 0.25);
  outline-offset: 2px;
}

.answer-option:has(input:checked) {
  color: var(--navy-950);
  background: var(--teal-100);
  border-color: var(--teal-600);
}

.answer-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.answer-letter {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--navy-800);
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 900;
}

.answer-option:has(input:checked) .answer-letter {
  color: var(--white);
  background: var(--teal-600);
  border-color: var(--teal-600);
}

.answer-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.hint-button {
  margin-top: 1rem;
  padding: 0.3rem 0;
  color: var(--teal-600);
  background: transparent;
  border: 0;
  border-bottom: 1px dashed currentColor;
  font-weight: 800;
  cursor: pointer;
}

.hint-button:focus-visible,
.button:focus-visible {
  outline: 3px solid rgba(7, 132, 119, 0.28);
  outline-offset: 3px;
}

.hint-text {
  margin: 0.8rem 0 0;
  padding: 0.85rem 1rem;
  color: #684712;
  background: var(--gold-100);
  border-left: 4px solid var(--gold-500);
  border-radius: 0 10px 10px 0;
}

.quiz-actions,
.results-actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.7rem;
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--slate-200);
}

.button {
  min-height: 48px;
  padding: 0.72rem 1.15rem;
  border: 2px solid transparent;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-primary {
  color: var(--white);
  background: var(--navy-800);
  box-shadow: 0 7px 18px rgba(18, 61, 103, 0.18);
}

.button-primary:hover:not(:disabled) {
  background: var(--navy-950);
}

.button-secondary {
  color: var(--navy-800);
  background: var(--white);
  border-color: var(--slate-300);
}

.button-secondary:hover:not(:disabled) {
  background: var(--slate-100);
}

.results-panel {
  text-align: center;
}

.related-quizzes {
  margin-top: 1.4rem;
  padding: 1rem;
  color: var(--slate-700);
  background: var(--slate-100);
  border-radius: 13px;
  text-align: left;
}

.related-quizzes h2 {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
}

.related-quiz-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.related-quiz-link {
  min-height: 40px;
  padding: 0.45rem 0.75rem;
  display: inline-flex;
  align-items: center;
  color: var(--navy-800);
  background: var(--white);
  border: 1px solid var(--slate-300);
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
}

.related-quiz-link:hover {
  border-color: var(--teal-600);
}

.related-quiz-link.is-current {
  color: var(--white);
  background: var(--teal-600);
  border-color: var(--teal-600);
}

.results-quiz-title {
  margin: 0.35rem 0 1.35rem;
  color: var(--slate-600);
}

.score-hero {
  width: min(100%, 330px);
  margin: 0 auto 1.6rem;
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  color: var(--white);
  background: linear-gradient(135deg, var(--navy-900), var(--teal-600));
  border-radius: 20px;
}

.score-percentage {
  font-size: clamp(2.8rem, 12vw, 4.2rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.06em;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 0;
}

.result-stat {
  padding: 1rem 0.6rem;
  background: var(--slate-100);
  border-radius: 13px;
}

.result-stat dt {
  color: var(--slate-600);
  font-size: 0.78rem;
  font-weight: 700;
}

.result-stat dd {
  margin: 0.1rem 0 0;
  font-size: 1.6rem;
  font-weight: 900;
}

.result-stat-correct dd { color: var(--success); }
.result-stat-incorrect dd { color: var(--danger); }
.result-stat-unanswered dd { color: var(--warning); }

.review-heading {
  margin-bottom: 1rem;
}

.review-list {
  display: grid;
  gap: 1rem;
}

.review-card {
  padding: clamp(1rem, 4vw, 1.6rem);
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-left: 5px solid var(--slate-300);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 28px rgba(7, 28, 51, 0.07);
}

.review-card.is-correct { border-left-color: var(--success); }
.review-card.is-incorrect { border-left-color: var(--danger); }
.review-card.is-unanswered { border-left-color: var(--warning); }

.review-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.review-number {
  color: var(--slate-500);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.review-badge {
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
}

.is-correct .review-badge {
  color: var(--success);
  background: var(--success-bg);
}

.is-incorrect .review-badge {
  color: var(--danger);
  background: var(--danger-bg);
}

.is-unanswered .review-badge {
  color: var(--warning);
  background: var(--warning-bg);
}

.review-question {
  margin: 0 0 1rem;
  font-size: 1.06rem;
}

.review-detail {
  margin: 0.6rem 0;
  color: var(--slate-700);
}

.review-label {
  display: block;
  color: var(--slate-500);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.review-explanation,
.review-hint {
  margin: 0.85rem 0 0;
  padding: 0.85rem 1rem;
  background: var(--slate-100);
  border-radius: 10px;
}

.review-hint {
  color: #684712;
  background: var(--gold-100);
}

.quiz-ad-slot,
.ad-slot {
  width: min(100% - 1.25rem, 860px);
  min-width: 0;
  min-height: 78px;
  margin: 1.25rem auto;
  padding: 0.75rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--slate-500);
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed var(--slate-300);
  border-radius: 12px;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.quiz-ad-label {
  pointer-events: none;
  user-select: none;
}

.quiz-ad-slot .adsbygoogle {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.quiz-ad-mid,
.quiz-ad-results {
  width: 100%;
  background: var(--slate-100);
  box-shadow: none;
}

.quiz-ad-mid {
  margin: 3rem 0 0;
}

.quiz-ad-results {
  margin: 3rem 0 0;
}

.ad-slot-bottom {
  margin-top: 2rem;
}

.site-footer {
  padding: 0.7rem 1rem 1.8rem;
  color: var(--slate-500);
  text-align: center;
  font-size: 0.8rem;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (min-width: 560px) {
  .header-inner {
    padding: 1.1rem 0;
  }

  .quiz-heading {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }

  .answer-status {
    align-self: auto;
  }

  .quiz-actions,
  .results-actions {
    flex-direction: row;
    justify-content: space-between;
  }

  .quiz-actions .button,
  .results-actions .button {
    min-width: 145px;
  }

  .result-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
