:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #172033;
  --muted: #647084;
  --line: #dce3ee;
  --primary: #246bfe;
  --primary-dark: #1554cf;
  --accent: #f6b335;
  --correct: #168a50;
  --correct-bg: #e8f7ef;
  --wrong: #c43d3d;
  --wrong-bg: #fdeaea;
  --shadow: 0 24px 70px rgba(28, 45, 78, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(36, 107, 254, 0.08), transparent 36%),
    linear-gradient(225deg, rgba(246, 179, 53, 0.16), transparent 32%),
    var(--bg);
}

button {
  font: inherit;
}

.site-header {
  display: flex;
  width: min(100% - 32px, 1180px);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 auto;
  padding: 22px 0 0;
}

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

.brand-mark {
  display: inline-flex;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), #15a37c);
  box-shadow: 0 14px 30px rgba(36, 107, 254, 0.22);
  font-size: 1.35rem;
  font-weight: 900;
}

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

.brand-name {
  font-size: 1.25rem;
  font-weight: 900;
}

.brand-tagline {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.site-badge {
  padding: 10px 14px;
  border: 1px solid rgba(36, 107, 254, 0.18);
  border-radius: 999px;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
  font-weight: 900;
}

.app-shell {
  display: grid;
  min-height: calc(100vh - 68px);
  place-items: center;
  padding: 24px;
}

.quiz-card {
  width: min(100%, 760px);
  padding: clamp(20px, 4vw, 36px);
  border: 1px solid rgba(220, 227, 238, 0.8);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.top-row,
.score-row,
.results-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top-row {
  margin-bottom: 18px;
}

.eyebrow,
.score,
.timer,
.high-score {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.timer {
  display: inline-flex;
  min-width: 74px;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: #fbfcff;
}

.timer.is-low {
  border-color: rgba(196, 61, 61, 0.35);
  color: var(--wrong);
  background: var(--wrong-bg);
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef7;
}

.progress-bar {
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 220ms ease;
}

.question {
  margin: 28px 0 22px;
  font-size: clamp(1.35rem, 2.7vw, 2rem);
  line-height: 1.22;
  letter-spacing: 0;
}

.setup-title {
  margin: 8px 0 10px;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.setup-copy {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.6;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.field select {
  min-height: 52px;
  width: 100%;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fbfcff;
  font: inherit;
  font-weight: 700;
}

.field select:focus {
  border-color: rgba(36, 107, 254, 0.55);
  box-shadow: 0 0 0 4px rgba(36, 107, 254, 0.1);
  outline: none;
}

.setup-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  color: var(--muted);
  font-weight: 800;
  flex-wrap: wrap;
}

.setup-message {
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(36, 107, 254, 0.18);
  border-radius: 8px;
  color: var(--muted);
  background: #f7f9ff;
  font-weight: 700;
}

.setup-message.is-error {
  border-color: rgba(196, 61, 61, 0.35);
  color: var(--wrong);
  background: var(--wrong-bg);
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0 0 22px;
}

.option-button {
  min-height: 52px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fbfcff;
  text-align: left;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.option-button:hover:not(:disabled),
.option-button:focus-visible {
  border-color: rgba(36, 107, 254, 0.45);
  box-shadow: 0 10px 24px rgba(36, 107, 254, 0.12);
  transform: translateY(-1px);
  outline: none;
}

.option-button:disabled {
  cursor: not-allowed;
}

.option-button.is-correct {
  border-color: rgba(22, 138, 80, 0.5);
  color: #0f5f38;
  background: var(--correct-bg);
}

.option-button.is-wrong {
  border-color: rgba(196, 61, 61, 0.48);
  color: #8f2828;
  background: var(--wrong-bg);
}

.feedback {
  min-height: 28px;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

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

.feedback.wrong {
  color: var(--wrong);
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.primary-button,
.ghost-button {
  min-height: 44px;
  padding: 11px 18px;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--primary);
  color: #ffffff;
  background: var(--primary);
}

.primary-button:hover,
.primary-button:focus-visible {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
  outline: none;
}

.primary-button:disabled {
  border-color: #9eb8ff;
  background: #9eb8ff;
  cursor: wait;
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: #ffffff;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  border-color: rgba(36, 107, 254, 0.5);
  outline: none;
}

.results {
  text-align: center;
}

.results h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 5vw, 3.25rem);
  letter-spacing: 0;
}

.results-copy {
  max-width: 520px;
  margin: 0 auto 24px;
  color: var(--muted);
  line-height: 1.6;
}

.results-stats {
  margin: 28px 0;
}

.stat {
  flex: 1;
  padding: 18px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.stat strong {
  display: block;
  margin-bottom: 4px;
  font-size: clamp(1.6rem, 4vw, 2.5rem);
}

.stat span {
  color: var(--muted);
  font-weight: 700;
}

.results .actions {
  justify-content: center;
}

.results-actions {
  gap: 12px;
}

@media (min-width: 640px) {
  .setup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 480px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 16px;
  }

  .site-badge {
    width: 100%;
    text-align: center;
  }

  .app-shell {
    padding: 14px;
    place-items: start center;
  }

  .quiz-card {
    margin-top: 20px;
  }

  .top-row,
  .score-row,
  .results-stats {
    align-items: stretch;
    flex-direction: column;
  }

  .score-row {
    gap: 8px;
  }

  .setup-summary {
    flex-direction: column;
  }

  .timer {
    width: 100%;
  }

  .actions,
  .primary-button,
  .ghost-button {
    width: 100%;
  }
}
