/* Cape Town Quiz — colours inspired by Bo-Kaap houses, the ocean and fynbos */
:root {
  --bg: #FFF8EE;
  --card: #FFFFFF;
  --ink: #1F2A44;
  --muted: #5D6781;
  --line: #EADFCF;
  --ocean: #1E6FB8;
  --ocean-dark: #155A97;
  --mountain: #2F7D5B;
  --pink: #E8457A;
  --sun: #F7C548;
  --orange: #F08A3C;
  --lime: #8CC63F;
  --purple: #8E5BC9;
  --right: #1F9D55;
  --right-bg: #E3F6EA;
  --wrong: #D63A3A;
  --wrong-bg: #FCE6E6;
  --radius: 18px;
  --shadow: 0 6px 20px rgba(31, 42, 68, .08);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#app {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 24px;
  flex: 1;
}

h1, h2, .result-score, .btn, .tag, .score-pill {
  font-family: "Fredoka", "Inter", system-ui, sans-serif;
}

h1 { font-size: 2.3rem; line-height: 1.1; margin: 8px 0 8px; color: var(--ocean); }
.lead { margin: 0 0 20px; color: var(--muted); }
.section-title { font-size: 1.2rem; margin: 28px 0 12px; }
.small { font-size: .88rem; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* Screens */
.screen { display: none; animation: fadeIn .25s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Hero */
.hero { text-align: center; }
.hero-art { width: 100%; height: auto; display: block; border-radius: var(--radius); background: linear-gradient(#BFE3F7, #E9F6FD); }

/* Buttons */
.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 1.08rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn:focus-visible, .answer:focus-visible, .theme-card:focus-visible, .btn-link:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.btn-primary { background: var(--ocean); color: #fff; box-shadow: 0 4px 0 var(--ocean-dark); }
.btn-primary:hover { background: var(--ocean-dark); }
.btn-secondary { background: #fff; color: var(--ocean); border: 2px solid var(--ocean); }
.btn-secondary:hover { background: #EEF5FC; }
.btn-big { padding: 17px 18px; font-size: 1.18rem; }
.btn-link { background: none; border: 0; color: var(--ocean); font-weight: 600; font-size: .95rem; cursor: pointer; padding: 6px 0; }

/* Theme cards */
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  text-align: left;
  font: inherit; font-size: .92rem; font-weight: 600; color: var(--ink);
  cursor: pointer;
  transition: border-color .15s ease, transform .08s ease;
  min-height: 64px;
}
.theme-card:hover { border-color: var(--ocean); }
.theme-card:active { transform: scale(.98); }
.theme-card svg { flex: none; width: 36px; height: 36px; }

/* Question screen */
.q-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.score-pill { background: var(--sun); color: var(--ink); border-radius: 999px; padding: 3px 12px; font-weight: 600; font-size: .95rem; }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 10px 0 16px; }
#progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), var(--orange), var(--sun)); transition: width .3s ease; }

.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.q-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.tag { background: #EEF5FC; color: var(--ocean); border-radius: 999px; padding: 3px 10px; font-size: .82rem; font-weight: 600; }
.level { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.q-text { font-size: 1.35rem; line-height: 1.3; margin: 4px 0 18px; }

.answers { display: grid; gap: 10px; }
.answer {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit; font-size: 1.02rem; color: var(--ink); text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  min-height: 56px;
}
.answer:hover:not(:disabled) { border-color: var(--ocean); background: #F6FAFE; }
.answer .letter {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg); font-weight: 600; font-size: .9rem; color: var(--muted);
}
.answer:disabled { cursor: default; }
.answer.correct { border-color: var(--right); background: var(--right-bg); }
.answer.correct .letter { background: var(--right); color: #fff; }
.answer.wrong { border-color: var(--wrong); background: var(--wrong-bg); }
.answer.wrong .letter { background: var(--wrong); color: #fff; }
.answer.faded { opacity: .55; }

/* Feedback */
.feedback { margin-top: 16px; background: #FFF3D6; border-radius: var(--radius); padding: 18px 20px 20px; animation: fadeIn .25s ease; }
.feedback-title { font-family: "Fredoka", sans-serif; font-size: 1.3rem; font-weight: 600; margin: 0 0 6px; }
.feedback-title.good { color: var(--right); }
.feedback-title.bad { color: var(--wrong); }
.dyk-label { font-weight: 600; margin: 0; color: var(--orange); font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; }
#feedback-fact { margin: 4px 0 12px; }
.tip { background: #fff; border-left: 4px solid var(--mountain); border-radius: 8px; padding: 10px 12px; margin: 0 0 16px; font-size: .95rem; }
.tip strong { color: var(--mountain); }

/* Result */
.result-card { padding-top: 26px; }
.badge { width: 96px; height: 96px; margin: 0 auto 8px; }
.result-score { font-size: 3rem; font-weight: 700; margin: 0; color: var(--ocean); line-height: 1.1; }
.result-title { font-size: 1.6rem; margin: 6px 0 6px; color: var(--pink); }
.fact-list { padding-left: 22px; margin: 0; }
.fact-list li { background: var(--card); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.fact-list li::marker { font-family: "Fredoka", sans-serif; font-weight: 600; color: var(--orange); }
.fact-list .fq { font-weight: 600; display: block; margin-bottom: 4px; }
.fact-list .fa { color: var(--right); font-weight: 600; }
.button-stack { display: grid; gap: 10px; margin-top: 22px; }

.footer { text-align: center; padding: 16px; }

/* Confetti */
#confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 10; }
.confetti-bit { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall 1.4s ease-in forwards; }
@keyframes fall {
  to { transform: translateY(105vh) rotate(540deg); opacity: .9; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  #confetti { display: none; }
}

@media (max-width: 360px) {
  .theme-grid { grid-template-columns: 1fr; }
  h1 { font-size: 2rem; }
}
