:root {
  --bg-top: #fef0a8;
  --bg-bottom: #ffbf69;
  --card: rgba(255, 251, 241, 0.86);
  --card-border: rgba(93, 48, 2, 0.15);
  --text: #3f220f;
  --muted: #7f5a3c;
  --accent: #ff6b35;
  --accent-dark: #d9480f;
  --cream: #fff5de;
  --green: #2f9e44;
  --red: #e03131;
  --pending: #f1c27d;
  --shadow: 0 24px 60px rgba(108, 60, 14, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 32%),
    radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.35), transparent 28%),
    linear-gradient(145deg, var(--bg-top), var(--bg-bottom));
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  z-index: 0;
}

body::before {
  width: 18rem;
  height: 18rem;
  top: -4rem;
  right: -5rem;
}

body::after {
  width: 22rem;
  height: 22rem;
  bottom: -7rem;
  left: -6rem;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}

.quiz-card {
  width: min(100%, 52rem);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding: 2rem;
}

.badge,
.eyebrow {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge {
  display: inline-block;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: #fff1c6;
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 0.85rem;
}

h1,
h2 {
  margin: 0;
  font-family: "Marker Felt", "Trebuchet MS", "Avenir Next", sans-serif;
  line-height: 1;
}

h1 {
  margin-top: 1rem;
  font-size: clamp(2.7rem, 5vw, 4.4rem);
}

h2 {
  font-size: clamp(2.5rem, 4vw, 3.5rem);
}

.subtitle,
.feedback,
.result-message {
  margin: 0;
  font-size: 1.05rem;
}

.subtitle {
  margin-top: 0.5rem;
  color: var(--muted);
  max-width: 36rem;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-top: 1.75rem;
}

.eyebrow {
  margin: 0 0 0.15rem;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 800;
}

.question-count,
.score-count {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
}

.progress-track {
  display: grid;
  grid-template-columns: repeat(15, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 1rem;
  align-items: center;
}

.progress-dot {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: var(--pending);
  border: 2px solid rgba(115, 67, 18, 0.12);
  transition: transform 160ms ease, background-color 160ms ease;
}

.progress-dot.active {
  transform: scale(1.08);
  border-color: rgba(115, 67, 18, 0.35);
}

.progress-dot.correct {
  background: var(--green);
}

.progress-dot.wrong {
  background: var(--red);
}

.question-panel,
.result-panel {
  margin-top: 1.75rem;
  padding: 1.5rem;
  border-radius: 1.5rem;
  background: rgba(255, 247, 227, 0.85);
  border: 1px solid rgba(93, 48, 2, 0.09);
}

.prompt {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.flag-display {
  display: grid;
  place-items: center;
  min-height: 11rem;
  margin-top: 1rem;
  border-radius: 1.5rem;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 234, 181, 0.8)),
    var(--cream);
  font-size: clamp(5rem, 10vw, 7rem);
  box-shadow: inset 0 0 0 1px rgba(93, 48, 2, 0.06);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1.25rem;
}

.option-btn,
.next-btn,
.restart-btn {
  appearance: none;
  border: none;
  font: inherit;
  cursor: pointer;
}

.option-btn {
  min-height: 4.25rem;
  padding: 1rem 1.05rem;
  border-radius: 1.1rem;
  text-align: left;
  background: white;
  color: var(--text);
  font-weight: 800;
  font-size: 1.02rem;
  line-height: 1.25;
  box-shadow: 0 10px 24px rgba(125, 77, 21, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.option-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(125, 77, 21, 0.14);
}

.option-btn:disabled {
  cursor: default;
}

.option-btn.correct {
  background: #dff7e3;
  color: #1f6f31;
}

.option-btn.wrong {
  background: #ffe0e0;
  color: #a61e1e;
}

.feedback {
  min-height: 1.6rem;
  margin-top: 1rem;
  font-weight: 700;
}

.feedback.correct {
  color: #1f6f31;
}

.feedback.wrong {
  color: #a61e1e;
}

.next-btn,
.restart-btn {
  margin-top: 1rem;
  min-height: 3.25rem;
  padding: 0.95rem 1.35rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(217, 72, 15, 0.25);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

.result-message {
  margin-top: 0.8rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.hidden {
  display: none;
}

@media (max-width: 700px) {
  .quiz-card {
    padding: 1.25rem;
    border-radius: 1.5rem;
  }

  .top-bar {
    flex-direction: column;
    align-items: start;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  .progress-track {
    gap: 0.35rem;
  }
}

@media (max-width: 540px) {
  .app-shell {
    display: block;
    padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem
      max(0.75rem, env(safe-area-inset-bottom));
  }

  .quiz-card {
    width: 100%;
    min-height: calc(100vh - 1.5rem);
    border-radius: 1.35rem;
    padding: 1rem;
  }

  .badge {
    font-size: 0.72rem;
    padding: 0.5rem 0.8rem;
  }

  h1 {
    margin-top: 0.8rem;
    font-size: clamp(2.15rem, 11vw, 3rem);
  }

  .subtitle {
    font-size: 0.98rem;
  }

  .top-bar {
    margin-top: 1.2rem;
    gap: 0.7rem;
  }

  .question-count,
  .score-count {
    font-size: 1rem;
  }

  .progress-track {
    gap: 0.22rem;
    margin-top: 0.85rem;
  }

  .progress-dot {
    min-width: 0;
    border-width: 1px;
  }

  .question-panel,
  .result-panel {
    margin-top: 1.15rem;
    padding: 1rem;
    border-radius: 1.2rem;
  }

  .prompt {
    font-size: 1.08rem;
  }

  .flag-display {
    min-height: 8.5rem;
    margin-top: 0.85rem;
    border-radius: 1.1rem;
    font-size: clamp(4rem, 22vw, 5.4rem);
  }

  .options-grid {
    gap: 0.75rem;
    margin-top: 1rem;
  }

  .option-btn {
    min-height: 3.9rem;
    padding: 0.95rem 0.95rem;
    border-radius: 1rem;
    font-size: 0.98rem;
  }

  .feedback,
  .result-message {
    font-size: 1rem;
  }

  .restart-btn {
    width: 100%;
  }
}

@media (max-width: 380px) {
  .quiz-card {
    padding: 0.85rem;
  }

  .badge,
  .eyebrow {
    letter-spacing: 0.05em;
  }

  .flag-display {
    min-height: 7.5rem;
    font-size: clamp(3.4rem, 20vw, 4.8rem);
  }

  .option-btn {
    min-height: 3.6rem;
    font-size: 0.94rem;
  }
}
