:root {
  --bg: #f5efe3;
  --bg-strong: #e6dcc8;
  --surface: rgba(255, 251, 245, 0.94);
  --surface-strong: #fffdf8;
  --text: #1f2a28;
  --muted: #5d655e;
  --line: rgba(31, 42, 40, 0.12);
  --brand: #1c6b57;
  --brand-dark: #134839;
  --brand-soft: rgba(28, 107, 87, 0.12);
  --success: #18794e;
  --danger: #b53b3b;
  --shadow: 0 24px 60px rgba(54, 45, 31, 0.12);
  --card-blur: 14px;
  --focus: rgba(28, 107, 87, 0.22);
  --font-scale: 1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI", "Trebuchet MS", Arial, sans-serif;
  font-size: calc(16px * var(--font-scale));
  background:
    radial-gradient(circle at top left, rgba(214, 182, 109, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(28, 107, 87, 0.12), transparent 28%),
    linear-gradient(180deg, #fbf7ef 0%, var(--bg) 100%);
}

.page-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 255, 255, 0.85) 0, rgba(255, 255, 255, 0) 26%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 45%);
}

body[data-theme="dark"] {
  --bg: #111614;
  --bg-strong: #19211d;
  --surface: rgba(21, 29, 26, 0.92);
  --surface-strong: #18201d;
  --text: #edf2ee;
  --muted: #b8c4bc;
  --line: rgba(237, 242, 238, 0.12);
  --brand: #5fc5a4;
  --brand-dark: #3e9d80;
  --brand-soft: rgba(95, 197, 164, 0.16);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  --focus: rgba(95, 197, 164, 0.28);
  background:
    radial-gradient(circle at top left, rgba(95, 197, 164, 0.12), transparent 24%),
    radial-gradient(circle at bottom right, rgba(218, 171, 86, 0.08), transparent 28%),
    linear-gradient(180deg, #131917 0%, var(--bg) 100%);
}

body[data-contrast="high"] {
  --line: rgba(31, 42, 40, 0.28);
  --muted: #37403a;
  --shadow: 0 0 0 rgba(0, 0, 0, 0);
}

body[data-theme="dark"][data-contrast="high"] {
  --line: rgba(237, 242, 238, 0.28);
  --muted: #dbe7df;
}

body[data-font-size="large"] {
  --font-scale: 1.08;
}

body[data-motion="reduced"] *,
body[data-motion="reduced"] *::before,
body[data-motion="reduced"] *::after {
  animation: none !important;
  transition: none !important;
}

.site-header,
.app-shell {
  width: min(1120px, calc(100% - 24px));
  margin-inline: auto;
}

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

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: block;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand);
}

.brand-title,
.hero-title,
h2,
h3 {
  margin: 0;
  line-height: 1.03;
  letter-spacing: -0.03em;
}

.brand-title {
  font-size: 1.65rem;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}

.header-chip,
.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 84%, transparent);
  color: var(--brand-dark);
  font-weight: 600;
}

.accessibility-wrap {
  position: relative;
}

.accessibility-trigger {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 82%, transparent);
}

.accessibility-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 30;
  width: min(320px, calc(100vw - 24px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface-strong) 90%, transparent);
  backdrop-filter: blur(var(--card-blur));
  box-shadow: var(--shadow);
}

.accessibility-panel-head {
  margin-bottom: 12px;
}

.accessibility-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.accessibility-group + .accessibility-group {
  margin-top: 14px;
}

.accessibility-reset {
  display: inline-flex;
  margin-top: 16px;
}

.accessibility-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.92rem;
  font-weight: 700;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.segment-button {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.segment-button.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #f8fbf9;
}

.meta-pill-soft {
  border-color: rgba(18, 37, 58, 0.08);
  color: var(--muted);
}

.app-shell {
  display: grid;
  gap: 22px;
  padding-bottom: 28px;
}

.hero-shell,
.test-card,
.results-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--surface);
  backdrop-filter: blur(var(--card-blur));
  box-shadow: var(--shadow);
}

.hero-shell::after,
.test-card::after,
.results-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -110px;
  bottom: -110px;
  width: 280px;
  height: 280px;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(218, 171, 86, 0.12), transparent 65%);
}

.hero-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.82fr);
  gap: 18px;
  align-items: start;
}

.hero-title {
  max-width: 11ch;
  font-size: clamp(2.4rem, 4.1vw, 4.35rem);
}

.hero-text,
.feature-card p,
.state-note,
.feedback-copy,
.results-copy,
#progress-copy {
  color: var(--muted);
  line-height: 1.65;
}

.hero-text {
  max-width: 52ch;
  margin: 14px 0 0;
  font-size: 1rem;
}

.hero-info-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
  max-width: 760px;
}

.hero-info-card {
  padding: 16px 16px 14px;
  border-radius: 18px;
  border: 1px solid rgba(18, 37, 58, 0.08);
  background: color-mix(in srgb, var(--surface-strong) 86%, transparent);
}

.hero-info-value {
  display: block;
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.hero-info-label {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.setup-card {
  position: relative;
  z-index: 1;
  padding: 22px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 98%, transparent), color-mix(in srgb, var(--surface) 96%, transparent));
}

.setup-head h3 {
  font-size: 1.36rem;
  max-width: 14ch;
}

.state-lockup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--brand-soft) 70%, transparent);
  border: 1px solid var(--line);
}

.state-lockup-label,
.state-lockup-value span {
  color: var(--muted);
}

.state-lockup-value {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.state-lockup-value strong {
  font-size: 1.05rem;
}

.language-field {
  margin-top: 14px;
}

.language-field-priority {
  margin-top: 18px;
}

.language-select-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
}

.language-select {
  width: 100%;
  min-height: 58px;
  padding: 15px 48px 15px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background-color: var(--surface-strong);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  line-height: 1.4;
  appearance: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--brand-dark) 50%),
    linear-gradient(135deg, var(--brand-dark) 50%, transparent 50%);
  background-position:
    calc(100% - 24px) calc(50% - 3px),
    calc(100% - 18px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.language-select:hover,
.language-select:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--focus);
  outline: none;
}

.language-select option {
  font-weight: 600;
}

.stat-value {
  display: block;
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.stat-label {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.state-note {
  min-height: 44px;
  margin: 14px 0 0;
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, opacity 150ms ease;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
}

.secondary-button {
  color: var(--text);
  background: color-mix(in srgb, var(--surface-strong) 80%, var(--bg-strong));
}

.secondary-button-compact {
  padding: 10px 16px;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  box-shadow: 0 10px 24px rgba(16, 40, 68, 0.08);
}

#exit-button {
  color: var(--brand-dark);
  font-weight: 800;
}

.primary-button-wide {
  width: 100%;
}

.primary-button:hover,
.secondary-button:hover,
.primary-button:focus-visible,
.secondary-button:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.test-topbar,
.test-meta,
.progress-row,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.test-topbar,
.progress-row,
.question-panel,
.feedback-panel,
.actions {
  position: relative;
  z-index: 1;
}

.progress-row {
  margin: 22px 0;
}

.progress-bar {
  flex: 1;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-strong) 70%, var(--surface-strong));
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand) 0%, #2a9df4 100%);
}

.question-panel {
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.question-media {
  margin-bottom: 18px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 96%, transparent), color-mix(in srgb, var(--bg-strong) 75%, transparent));
}

.question-media img {
  display: block;
  width: min(100%, 320px);
  height: auto;
  margin: 0 auto;
}

.question-text {
  margin: 0 0 20px;
  font-size: 1.16rem;
  line-height: 1.55;
}

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

.answer-button {
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.answer-button:hover,
.answer-button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--focus);
  outline: none;
}

.answer-button.selected {
  background: var(--brand-soft);
  border-color: rgba(13, 94, 168, 0.48);
}

.answer-button.correct {
  background: rgba(24, 121, 78, 0.08);
  border-color: rgba(24, 121, 78, 0.4);
}

.answer-button.incorrect {
  background: rgba(181, 59, 59, 0.08);
  border-color: rgba(181, 59, 59, 0.36);
}

.feedback-panel {
  min-height: 84px;
  margin: 18px 0 22px;
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 92%, var(--bg-strong));
}

.feedback-status {
  margin: 0 0 8px;
  font-weight: 800;
}

.feedback-status.correct {
  color: var(--success);
}

.feedback-status.incorrect {
  color: var(--danger);
}

.feedback-status.skipped {
  color: var(--brand-dark);
}

.results-score {
  margin: 14px 0 10px;
  font-size: clamp(2.8rem, 5vw, 4.2rem);
  font-weight: 900;
  line-height: 1;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.results-grid article {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--brand-soft) 70%, transparent);
}

.review-list {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

.review-item {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
}

.review-item p {
  margin: 0;
}

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

.site-disclaimer {
  padding: 18px 20px 6px;
}

.disclaimer-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
}

.disclaimer-copy {
  margin: 8px 0 0;
  max-width: 78ch;
  color: var(--muted);
  line-height: 1.65;
}

.disclaimer-link {
  color: var(--brand-dark);
  font-weight: 700;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

.disclaimer-link:hover,
.disclaimer-link:focus-visible {
  color: var(--brand);
}

.hidden {
  display: none;
}

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

  .hero-info-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .site-header,
  .app-shell {
    width: min(100% - 18px, 1120px);
  }

  .site-header,
  .test-topbar,
  .test-meta,
  .progress-row,
  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-shell,
  .test-card,
  .results-card {
    padding: 20px;
    border-radius: 24px;
  }

  .hero-info-strip,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .hero-title {
    max-width: none;
  }

  .language-field-priority {
    margin-top: 16px;
    margin-bottom: 4px;
  }

  .state-lockup {
    align-items: flex-start;
    flex-direction: column;
  }

  .state-lockup-value {
    justify-items: start;
  }

  .accessibility-panel {
    left: 0;
    right: auto;
    width: min(100vw - 18px, 340px);
  }
}
