:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #0f1420;
  background: #f6f8fc;
  line-height: 1.6;

  --primary: #2557ff;
  --primary-hover: #1842d6;
  --primary-2: #6847ff;
  --accent: #d8ff58;
  --dark: #0e131d;
  --muted: #697180;
  --border: #e5e9f0;
  --surface: #ffffff;
  --shadow: 0 18px 55px rgba(20, 34, 70, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
}

button,
input {
  font: inherit;
}

a {
  color: var(--primary);
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid #92400e;
  outline-offset: 4px;
}

[tabindex="-1"]:focus {
  outline: 3px solid #92400e;
  outline-offset: 4px;
}

.container {
  width: min(100% - 2rem, 66rem);
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--text, #0f1420);
  font-size: 1.25rem;
  font-weight: 900;
  text-decoration: none;
  letter-spacing: -0.04em;
}

.brand-mark {
  width: 2.125rem;
  height: 2.125rem;
  display: grid;
  place-items: center;
  border-radius: 0.625rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-size: 1rem;
  letter-spacing: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.back-link {
  color: #4a5260;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover {
  color: var(--primary);
}

.badge {
  padding: 0.35rem 0.75rem;
  border: 1px solid #cbd7ff;
  border-radius: 999px;
  background: #f0f4ff;
  color: #2448b8;
  font-size: 0.78rem;
  font-weight: 800;
}

.intro {
  padding-block: 4rem 2.25rem;
  max-width: 52rem;
}

.eyebrow {
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: var(--primary);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3,
legend {
  line-height: 1.25;
  overflow-wrap: anywhere;
}

h1 {
  font-size: clamp(2.5rem, 6vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.055em;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.125rem;
}

.notice {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: #eff6ff;
  border-left: 4px solid var(--primary);
  border-radius: 0.5rem;
}

.notice strong {
  display: block;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.category-card,
.panel {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1.35rem;
  box-shadow: var(--shadow);
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.category-card p {
  color: var(--muted);
}

.category-card button {
  margin-top: auto;
  width: 100%;
}

button {
  min-height: 48px;
  padding: 0.75rem 1.125rem;
  border: 1px solid var(--primary);
  border-radius: 0.875rem;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
}

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

button.secondary {
  background: #fff;
  color: var(--primary);
}

button.secondary:hover:not(:disabled) {
  background: #eff6ff;
}

button:disabled {
  cursor: default;
  background: #e2e8f0;
  color: #475569;
  border-color: var(--border);
}

.quiz-header,
.progress-header,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.quiz-header {
  margin-bottom: 1rem;
}

.quiz-header h2,
.progress-header p {
  margin-bottom: 0;
}

.progress-header {
  margin-top: 1.5rem;
  gap: 0.5rem;
}

progress {
  display: block;
  width: 100%;
  height: 0.75rem;
  margin-block: 0.75rem;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
  accent-color: var(--primary);
}

progress::-webkit-progress-bar {
  background: #e2e8f0;
}

progress::-webkit-progress-value {
  background: var(--primary);
}

progress::-moz-progress-bar {
  background: var(--primary);
}

.muted {
  color: var(--muted);
}

fieldset {
  min-width: 0;
  margin: 2rem 0 0;
  padding: 0;
  border: 0;
}

legend {
  width: 100%;
  padding: 0;
  margin-bottom: 1rem;
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-weight: 700;
}

.answers {
  display: grid;
  gap: 0.75rem;
}

.answer-option {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  min-height: 56px;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.answer-option:focus-within {
  outline: 3px solid #92400e;
  outline-offset: 3px;
}

.answer-option:has(input:checked) {
  background: #eff6ff;
  border-color: var(--primary);
}

.answer-option input {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.2rem 0 0;
  accent-color: var(--primary);
}

fieldset:disabled .answer-option {
  cursor: default;
}

.error-text {
  margin-block: 1rem;
  color: #991b1b;
  font-weight: 600;
}

.error-text:empty {
  margin-top: 0;
}

#check-answer {
  margin-top: 1rem;
}

.feedback {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 0.75rem;
}

.feedback p:last-child {
  margin-bottom: 0;
}

.next-button {
  margin-top: 1rem;
}

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

.result-grid div {
  padding: 1rem;
  background: #f1f5f9;
  border-radius: 0.75rem;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0.5rem 0 0;
  font-size: 1.75rem;
  font-weight: 750;
}

.actions {
  justify-content: flex-start;
  margin-top: 1.5rem;
}

.site-footer {
  padding-block: 2rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -10rem;
  padding: 0.75rem 1rem;
  background: #fff;
  z-index: 10;
}

.skip-link:focus {
  top: 1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}


@media (max-width: 38rem) {
  .header-actions .back-link {
    display: none;
  }

  .badge {
    font-size: 0.72rem;
  }
}

@media (max-width: 48rem) {
  .category-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 30rem) {
  .intro {
    padding-top: 2rem;
  }

  .panel,
  .category-card {
    padding: 1rem;
  }

  .quiz-header,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  #check-answer,
  .next-button {
    width: 100%;
  }

  .result-grid {
    gap: 0.5rem;
  }

  .result-grid div {
    padding: 0.75rem;
  }
}
