:root {
  --ink: #2a0f4e;
  --grape: #1e0b3c;
  --grape-soft: #2f1560;
  --cream: #fff5e1;
  --card: #ffc93c;
  --card-next: #ff5d73;
  --card-later: #3ed9c4;
  --radius: 2.2rem;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1rem;
  padding: clamp(1rem, 3vw, 2rem);
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--cream);
  background: var(--grape);
  overflow-x: hidden;
}

/* Soft colour clouds in the background, purely decorative. */
.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}
.glow--a { width: 26rem; height: 26rem; top: -8rem; left: -6rem; background: #ff5d73; }
.glow--b { width: 22rem; height: 22rem; bottom: -7rem; right: -5rem; background: #3ed9c4; }
.glow--c { width: 18rem; height: 18rem; top: 40%; right: 20%; background: #7b8cff; opacity: 0.35; }

.topbar,
.stage,
.footnote { position: relative; z-index: 1; }

.topbar { text-align: center; }

.wordmark {
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-weight: 800;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  line-height: 1;
  margin: 0;
  color: var(--cream);
  letter-spacing: -0.01em;
}

.tagline {
  margin: 0.4rem 0 0;
  font-size: clamp(0.85rem, 2vw, 1rem);
  font-weight: 700;
  color: #c9b6ee;
  text-wrap: balance;
}

.stage {
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-items: center;
  justify-items: center;
  gap: clamp(1.2rem, 3vw, 2rem);
}

/* The stack: two card edges peeking out behind, so you see there is more to come. */
.stack {
  position: relative;
  width: min(52rem, 100%);
  display: grid;
  align-self: center;
}

.stack > * { grid-area: 1 / 1; }

.ghost {
  border-radius: var(--radius);
  box-shadow: 0 1.2rem 2.5rem rgba(0, 0, 0, 0.28);
}
.ghost--near { background: var(--card-next); transform: rotate(2.5deg) translateY(0.7rem) scale(0.985); }
.ghost--far { background: var(--card-later); transform: rotate(-3.5deg) translateY(1.3rem) scale(0.965); }

.card {
  perspective: 1600px;
  transition: transform 240ms ease, opacity 240ms ease;
}

.card.is-leaving {
  transform: translateY(-1.4rem) rotate(-4deg) scale(0.95);
  opacity: 0;
}

.card.is-entering {
  transform: translateY(1.6rem) rotate(3deg) scale(0.95);
  opacity: 0;
}

.card__inner {
  display: grid;
  min-height: clamp(17rem, 44dvh, 28rem);
  transform-style: preserve-3d;
  transition: transform 620ms cubic-bezier(0.2, 0.8, 0.25, 1);
}

.card__inner.is-flipped { transform: rotateY(180deg); }

.face {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(0.8rem, 2vw, 1.4rem);
  padding: clamp(1.6rem, 4.5vw, 3.2rem);
  border-radius: var(--radius);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 1.6rem 3rem rgba(0, 0, 0, 0.35);
}

.face--front {
  background: var(--card);
  color: var(--ink);
}

.face--back {
  background: var(--cream);
  color: var(--ink);
  transform: rotateY(180deg);
}

.eyebrow {
  margin: 0;
  font-weight: 800;
  font-size: clamp(0.8rem, 1.8vw, 1rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(42, 15, 78, 0.65);
}

.question {
  margin: 0;
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-weight: 800;
  font-size: clamp(1.7rem, 5vw, 3.4rem);
  line-height: 1.14;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.answer {
  margin: 0;
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-weight: 700;
  font-size: clamp(1.4rem, 3.8vw, 2.6rem);
  line-height: 1.2;
  text-wrap: pretty;
  overflow-wrap: break-word;
}

.answer::after {
  content: "";
  display: block;
  width: 4.5rem;
  height: 0.55rem;
  margin-top: clamp(0.9rem, 2vw, 1.4rem);
  border-radius: 1rem;
  background: var(--card);
}

/* Announced by screen readers, not shown: the answer is already on the card. */
.live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.controls {
  width: min(52rem, 100%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
}

.btn {
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-weight: 800;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  min-height: 3.4rem;
  padding: 0.7rem 2.2rem;
  border: none;
  border-radius: 5rem;
  cursor: pointer;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 0.4rem 0 rgba(0, 0, 0, 0.35);
  transition: transform 120ms ease, box-shadow 120ms ease, background 160ms ease;
}

.btn--reveal { background: #ffc93c; }
.btn--next { background: #3ed9c4; }
.btn--again { background: #ff9f45; }

.btn:hover { transform: translateY(-2px); box-shadow: 0 0.6rem 0 rgba(0, 0, 0, 0.35); }
.btn:active { transform: translateY(2px); box-shadow: 0 0.15rem 0 rgba(0, 0, 0, 0.35); }

.btn:focus-visible {
  outline: 3px solid var(--cream);
  outline-offset: 4px;
}

.footnote {
  text-align: center;
  color: #a893d4;
  font-size: 0.85rem;
  font-weight: 600;
}

.footnote p { margin: 0; text-wrap: balance; }

@media (max-width: 30rem) {
  .ghost--near { transform: rotate(2deg) translateY(0.5rem) scale(0.99); }
  .ghost--far { transform: rotate(-2.5deg) translateY(0.9rem) scale(0.98); }
  .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .card__inner,
  .btn {
    transition: none;
  }
  .card.is-leaving,
  .card.is-entering { transform: none; }
}
