:root {
  color-scheme: light;
  --bg: #f4efe5;
  --bg-accent: #efe2c4;
  --surface: rgba(255, 252, 245, 0.92);
  --surface-strong: #fffdf8;
  --ink: #1f2a2c;
  --muted: #5f6d70;
  --line: rgba(41, 56, 59, 0.12);
  --brand: #bc5d2e;
  --brand-strong: #8f3d18;
  --brand-soft: rgba(188, 93, 46, 0.12);
  --success: #2a7c53;
  --success-soft: rgba(42, 124, 83, 0.12);
  --danger: #b83939;
  --danger-soft: rgba(184, 57, 57, 0.14);
  --shadow: 0 24px 60px rgba(71, 53, 30, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.82), transparent 30%),
    radial-gradient(circle at top right, rgba(188, 93, 46, 0.18), transparent 28%),
    linear-gradient(180deg, var(--bg-accent) 0%, var(--bg) 40%, #f8f4ec 100%);
  color: var(--ink);
}

body {
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

button {
  font: inherit;
}

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 20px 16px 36px;
}

.topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.topbar h1,
.hero-block h2,
.summary-screen h2,
.quiz-status h2 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.topbar h1 {
  font-size: clamp(2rem, 7vw, 3.2rem);
}

.screen-stack {
  display: grid;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 20px;
}

.home-screen,
.quiz-screen,
.summary-screen {
  display: grid;
  gap: 18px;
}

.hero-block {
  display: grid;
  gap: 10px;
}

.hero-kicker,
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  color: var(--brand-strong);
  font-weight: 700;
}

.hero-copy,
.microcopy,
#feedbackText,
.stat-label {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.stat-chip {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.stat-chip-alert {
  background: linear-gradient(180deg, #fff8f3 0%, #fff1ea 100%);
}

.stat-value {
  font-size: clamp(1.6rem, 7vw, 2.6rem);
  line-height: 1;
}

.mode-list,
.answers {
  display: grid;
  gap: 12px;
}

.quiz-navigation {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mode-button,
.answer-button,
.ghost-button {
  border: 0;
  border-radius: var(--radius-md);
  min-height: 58px;
  padding: 16px 18px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease;
}

.mode-button:active,
.answer-button:active,
.ghost-button:active {
  transform: scale(0.985);
}

.mode-button {
  text-align: left;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(31, 42, 44, 0.08);
}

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

.mode-button-secondary {
  background: linear-gradient(135deg, #243a3d 0%, #355358 100%);
  color: #f9f5ef;
}

.mode-button-tertiary,
.ghost-button {
  background: var(--surface-strong);
  color: var(--ink);
  border: 1px solid var(--line);
}

.mode-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

.quiz-status {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.quiz-status-main {
  display: grid;
  gap: 8px;
}

.pill-group {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(31, 42, 44, 0.08);
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
}

.pill-accent {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.question-card {
  display: grid;
  gap: 18px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.question-text {
  margin: 0;
  font-size: clamp(1.2rem, 4.8vw, 1.75rem);
  line-height: 1.35;
}

.answer-button {
  text-align: left;
  background: #ffffff;
  border: 1px solid rgba(41, 56, 59, 0.12);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.4;
}

.answer-button.is-selected {
  border-color: rgba(188, 93, 46, 0.65);
  box-shadow: 0 0 0 4px rgba(188, 93, 46, 0.12);
}

.answer-button.is-correct {
  background: var(--success-soft);
  border-color: rgba(42, 124, 83, 0.45);
  color: #184931;
}

.answer-button.is-wrong {
  background: var(--danger-soft);
  border-color: rgba(184, 57, 57, 0.38);
  color: #6d2020;
}

.feedback-panel {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(251, 247, 240, 0.95) 100%);
}

.feedback-panel.is-correct {
  border-color: rgba(42, 124, 83, 0.22);
}

.feedback-panel.is-wrong {
  border-color: rgba(184, 57, 57, 0.22);
}

@media (hover: hover) {
  .mode-button:hover,
  .answer-button:hover,
  .ghost-button:hover {
    transform: translateY(-1px);
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .card {
    padding: 16px;
    border-radius: 24px;
  }

  .quiz-status {
    flex-direction: column;
  }

  .pill-group {
    grid-auto-flow: column;
    justify-content: start;
  }

  .mode-button,
  .answer-button,
  .ghost-button {
    min-height: 64px;
  }

  .quiz-navigation {
    grid-template-columns: 1fr;
  }
}
