:root {
  /* Pastels */
  --pink: #ffc8dd;
  --pink-light: #ffe3ee;
  --pink-deep: #f6a8c7;
  --mint: #c8ead9;
  --cream: #fffbf5;

  /* Darker shades for text and accents */
  --ink: #463f5c;
  --heading: #b5527f;
  --accent: #e68fb3;
  --wrong: #b4557a;
  --right: #3f8f6e;
  --line: #f6d3e1;

  --shadow: 0 12px 32px rgba(181, 82, 127, 0.14);
  --shadow-soft: 0 6px 20px rgba(181, 82, 127, 0.1);
  --radius: 24px;
  --script: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.5;
  background: linear-gradient(160deg, #ffeef5 0%, #ffe1ec 45%, #ffe6ef 75%, #fff1ea 100%);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.script {
  font-family: var(--script);
  font-style: italic;
  font-weight: 600;
}

/* ---------- Buttons ---------- */

.btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 28px;
  font: 700 1rem/1.2 var(--sans);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, font-size 0.25s ease;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.96);
}

.btn:focus-visible,
.reason-card:focus-visible,
.envelope:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.btn-primary {
  color: var(--ink);
  background: linear-gradient(135deg, var(--pink-light), var(--pink) 50%, var(--pink-deep));
  box-shadow: 0 8px 20px rgba(246, 168, 199, 0.45);
}

.btn-ghost {
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
}

.hint {
  margin: 12px 0 0;
  font-size: 0.9rem;
  color: var(--heading);
  opacity: 0.85;
  text-align: center;
}

/* ---------- Floating hearts & confetti ---------- */

.floating-hearts {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.floating-heart {
  position: absolute;
  bottom: -48px;
  opacity: 0;
  animation: float-up linear forwards;
}

.floating-heart svg {
  display: block;
  width: 100%;
  fill: currentColor;
}

@keyframes float-up {
  0% { transform: translate(0, 0) rotate(0); opacity: 0; }
  10% { opacity: 0.9; }
  85% { opacity: 0.7; }
  100% { transform: translate(var(--drift), -115vh) rotate(var(--rot)); opacity: 0; }
}

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

/* ---------- Quiz ---------- */

.quiz-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  transition: opacity 0.6s ease;
}

.quiz-screen.leaving {
  opacity: 0;
}

.quiz-card {
  width: 100%;
  max-width: 420px;
  padding: 32px 24px 24px;
  text-align: center;
  background: rgba(255, 255, 255, 0.86);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.quiz-card.shake {
  animation: shake 0.45s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.quiz-badge {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  box-shadow: var(--shadow-soft);
}

.quiz-badge svg {
  width: 30px;
  fill: #fff;
}

.quiz-intro {
  margin: 0 0 20px;
  font-family: var(--script);
  font-style: italic;
  font-size: 1.9rem;
  line-height: 1.2;
  color: var(--heading);
}

.progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.progress-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.3s ease, transform 0.3s ease;
}

.progress-dot.current {
  background: var(--pink-deep);
  transform: scale(1.25);
}

.progress-dot.done {
  background: #9fd8bf;
}

.quiz-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quiz-form.enter {
  animation: fade-slide 0.45s ease;
}

@keyframes fade-slide {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.quiz-question {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.quiz-input {
  width: 100%;
  padding: 14px 18px;
  font: 500 1.05rem var(--sans);
  color: var(--ink);
  text-align: center;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 999px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.quiz-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(246, 168, 199, 0.25);
}

.quiz-feedback {
  min-height: 3em;
  margin: 16px 0 0;
  font-weight: 700;
  color: var(--wrong);
}

.quiz-feedback.good {
  color: var(--right);
}

/* ---------- Celebration ---------- */

.celebration {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(255, 227, 238, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: opacity 0.8s ease;
}

.celebration.leaving {
  opacity: 0;
}

.celebration-text {
  margin: 0;
  font-family: var(--script);
  font-style: italic;
  font-size: clamp(2.8rem, 12vw, 5rem);
  font-weight: 600;
  color: var(--heading);
  text-align: center;
  text-shadow: 0 4px 18px rgba(255, 255, 255, 0.9);
  animation: pop 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

@keyframes pop {
  from { opacity: 0; transform: scale(0.4); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- Main site ---------- */

.site {
  animation: fade-in 1.2s ease both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.slideshow,
.slideshow-overlay {
  position: fixed;
  inset: 0;
}

.slideshow {
  z-index: -2;
  background: var(--pink);
  overflow: hidden;
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 1.6s ease, transform 1.6s ease;
}

/* The whole photo is shown on top of a blurred copy that fills the screen,
   so faces near the edges never get cropped off. */
.slide::before,
.slide::after {
  content: "";
  position: absolute;
  background-image: var(--photo);
  background-position: center;
  background-repeat: no-repeat;
}

.slide::before {
  inset: -48px;
  background-size: cover;
  filter: blur(26px) saturate(1.1);
}

.slide::after {
  inset: 0;
  background-size: contain;
}

.slide.active {
  opacity: 1;
  transform: scale(1);
  transition: opacity 1.6s ease, transform 8s linear;
}

.slideshow-overlay {
  z-index: -1;
  background: linear-gradient(180deg, rgba(90, 40, 65, 0.32) 0%, rgba(90, 40, 65, 0.1) 50%, rgba(255, 227, 238, 0.3) 100%);
}

.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px 32px;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 14px rgba(90, 40, 65, 0.55);
}

.hero-eyebrow {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hero-title {
  margin: 8px 0 24px;
  font-size: clamp(2.8rem, 11vw, 5rem);
  line-height: 1.1;
}

.hero-sub {
  margin: 0 0 12px;
  font-weight: 600;
  font-size: 1.05rem;
}

.counter {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 440px;
}

.counter-box {
  padding: 12px 4px;
  background: var(--mint);
  border-radius: 18px;
  box-shadow: var(--shadow);
  text-shadow: none;
}

.counter-box span {
  display: block;
  font-size: clamp(1.5rem, 7vw, 2.2rem);
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.counter-box small {
  font-size: clamp(0.58rem, 2.5vw, 0.75rem);
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hero-since {
  margin: 14px 0 0;
  font-weight: 600;
}

.scroll-hint {
  margin: 40px 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  animation: bob 1.8s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

.section {
  position: relative;
  z-index: 1;
  padding: 40px 16px;
}

.panel {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px;
  background: rgba(255, 250, 252, 0.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.panel h2 {
  margin: 0 0 24px;
  font-size: clamp(2.2rem, 8vw, 3rem);
  line-height: 1.15;
  color: var(--heading);
  text-align: center;
}

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ---------- Envelope & letter ---------- */

/* Top padding leaves room for the flap when it folds open. */
.envelope-wrap {
  padding: calc(min(116px, 30vw) + 8px) 0 8px;
  transition: opacity 0.4s ease;
}

.envelope-wrap.leaving {
  opacity: 0;
}

.envelope {
  position: relative;
  display: block;
  width: min(300px, 78vw);
  aspect-ratio: 3 / 2;
  margin: 0 auto;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  perspective: 900px;
}

.envelope:not(.open) {
  animation: wiggle 2.6s ease-in-out infinite;
}

@keyframes wiggle {
  0%, 60%, 100% { transform: rotate(0); }
  70% { transform: rotate(-3deg); }
  80% { transform: rotate(3deg); }
  90% { transform: rotate(-2deg); }
}

.envelope-back,
.envelope-front,
.envelope-paper,
.envelope-flap {
  position: absolute;
}

.envelope-back {
  inset: 0;
  background: var(--pink-deep);
  border-radius: 10px;
}

.envelope-paper {
  inset: 8% 8% 10%;
  z-index: 1;
  background: repeating-linear-gradient(180deg, var(--cream) 0 14px, #f6e3ea 14px 15px);
  border-radius: 6px;
  transition: transform 0.8s ease 0.45s;
}

.envelope-front {
  inset: 0;
  z-index: 2;
  background: var(--pink);
  border-radius: 10px;
  clip-path: polygon(0 0, 50% 55%, 100% 0, 100% 100%, 0 100%);
}

.envelope-flap {
  inset: 0 0 auto;
  height: 58%;
  z-index: 3;
  background: #f9b9d2;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
  transition: transform 0.6s ease, z-index 0s linear 0.3s;
}

.envelope-seal {
  position: absolute;
  left: 50%;
  top: 56%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--pink-light));
  box-shadow: 0 3px 8px rgba(181, 82, 127, 0.25);
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease;
}

.envelope-seal svg {
  width: 24px;
  fill: var(--accent);
}

.envelope.open .envelope-flap {
  transform: rotateX(180deg);
  z-index: 0;
}

.envelope.open .envelope-seal {
  opacity: 0;
}

.envelope.open .envelope-paper {
  transform: translateY(-48%);
}

.letter {
  padding: 28px 22px;
  background: var(--cream);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  line-height: 1.75;
  animation: letter-in 0.8s ease both;
}

@keyframes letter-in {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.letter-greeting,
.letter-signature {
  font-family: var(--script);
  font-style: italic;
  font-size: 2.1rem;
  font-weight: 600;
  color: var(--heading);
  line-height: 1.2;
}

.letter-greeting {
  margin: 0 0 12px;
}

.letter p {
  margin: 0 0 14px;
}

.letter-signoff {
  margin-top: 24px !important;
  margin-bottom: 0 !important;
}

.letter-signature {
  margin: 4px 0 0 !important;
}

/* ---------- Timeline ---------- */

.timeline {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background: linear-gradient(var(--pink), var(--pink-deep));
  border-radius: 3px;
}

.timeline-item {
  position: relative;
  padding-left: 54px;
}

.timeline-item + .timeline-item {
  margin-top: 28px;
}

.timeline-dot {
  position: absolute;
  left: 0;
  top: 14px;
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  background: var(--pink);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-soft);
}

.timeline-dot svg {
  width: 16px;
  fill: #fff;
}

.timeline-card {
  overflow: hidden;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}

.timeline-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.timeline-body {
  padding: 14px 18px 18px;
}

.timeline-date {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--heading);
}

.timeline-body h3 {
  margin: 2px 0 6px;
  font-family: var(--script);
  font-style: italic;
  font-weight: 600;
  font-size: 1.9rem;
  line-height: 1.15;
  color: var(--ink);
}

.timeline-body p:last-child {
  margin: 0;
}

/* ---------- Reasons deck ---------- */

.deck {
  position: relative;
  width: min(320px, 100%);
  height: 260px;
  margin: 8px auto 0;
}

.deck::before,
.deck::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
}

.deck::before {
  transform: rotate(-5deg);
  background: var(--pink);
}

.deck::after {
  transform: rotate(4deg);
  background: var(--pink-light);
}

.reason-card {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 24px;
  text-align: center;
  background: linear-gradient(160deg, #fff 15%, var(--card-colour, var(--pink)) 140%);
  border-radius: 22px;
  box-shadow: var(--shadow);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.reason-number {
  font-family: var(--script);
  font-style: italic;
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
}

.reason-text {
  margin: 14px 0 0;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
}

/* ---------- Final question ---------- */

.final {
  min-height: 90vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.final-panel {
  width: 100%;
  text-align: center;
}

.final-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 64px;
}

#no-btn.runaway {
  position: absolute;
  z-index: 5;
  transition: left 0.25s ease, top 0.25s ease;
}

.final-message {
  min-height: 3em;
  margin: 20px 0 0;
  font-weight: 700;
  color: var(--wrong);
}

.final-message.pop-in {
  animation: pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

.final-answer {
  margin: 0;
  font-size: clamp(1.8rem, 7vw, 2.4rem);
  line-height: 1.3;
  color: var(--heading);
  animation: pop 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

/* ---------- Bigger screens ---------- */

@media (min-width: 720px) {
  .quiz-card {
    padding: 40px 36px 28px;
  }

  .panel {
    padding: 40px 36px;
  }

  .section {
    padding: 56px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .floating-hearts {
    display: none;
  }
}
