/*
  Birthday surprise for Lin Neariroth
  Restyle the gift from the variables below.
*/

:root {
  --rose-100: #ffe4ee;
  --rose-300: #f0b4c8;
  --lavender-100: #f3eefe;
  --lavender-300: #d9cff2;
  --cream: #fffaf6;
  --gold: #c9a36a;
  --gold-deep: #a68445;
  --ink: #3d3148;
  --ink-soft: #6d5c78;
  --white: #ffffff;
  --shadow: 0 22px 50px rgba(120, 80, 110, 0.12);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.6;
  background:
    radial-gradient(ellipse 80% 42% at 8% 0%, rgba(247, 210, 226, 0.75), transparent 60%),
    radial-gradient(ellipse 70% 36% at 100% 12%, rgba(226, 214, 250, 0.85), transparent 55%),
    radial-gradient(ellipse 60% 30% at 50% 100%, rgba(255, 236, 220, 0.75), transparent 50%),
    linear-gradient(180deg, #fff5f8 0%, #f6f0ff 48%, #fff8f4 100%);
  background-attachment: fixed;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.is-intro {
  overflow: hidden;
  height: 100vh;
  height: 100svh;
}

h1,
h2,
h3,
p {
  margin: 0;
  overflow-wrap: break-word;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

img {
  max-width: 100%;
  display: block;
}

::selection {
  background: #f3c6d8;
  color: var(--ink);
}

/* ---------- Progress and music ---------- */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 28;
  width: 0;
  height: 3px;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(90deg, #e7b4c6, #d4bc8a, #cbb6e6);
}

body.is-open .progress {
  opacity: 1;
  transition: opacity 0.6s ease 0.35s;
}

.music-toggle {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 30;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  min-height: 52px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 10px 26px rgba(130, 90, 120, 0.14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--ink);
  cursor: pointer;
}

.music-disc {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fffaf6 0 4px, #3d3148 4.5px 6px, transparent 6.5px),
    repeating-conic-gradient(from 8deg, #f0b4c8 0 18deg, #d9cff2 18deg 36deg, #e7d3a4 36deg 54deg);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.85);
  opacity: 0.55;
}

.music-toggle[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.9);
  box-shadow:
    0 0 0 1px rgba(201, 163, 106, 0.45),
    0 10px 26px rgba(180, 120, 150, 0.22);
}

.music-toggle[aria-pressed="true"] .music-disc {
  opacity: 1;
}

/* ---------- Floating light ---------- */

.ambient,
.finale-hearts,
.balloons,
.confetti-layer {
  pointer-events: none;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

.star,
.sparkle,
.glint {
  position: absolute;
  opacity: 0.8;
}

.star {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.95), 0 0 12px rgba(243, 215, 164, 0.75);
  animation: twinkle ease-in-out infinite;
}

.sparkle,
.glint,
.cake-sparkles span {
  background: #fff;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  filter: drop-shadow(0 0 6px rgba(255, 230, 180, 0.9));
}

.sparkle {
  width: 8px;
  height: 8px;
  animation: twinkle ease-in-out infinite;
}

.floater {
  position: absolute;
  bottom: -3rem;
  animation-name: float-up;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.heart {
  position: relative;
  display: block;
  width: 1em;
  height: 1em;
  background: currentColor;
  transform: rotate(45deg);
}

.heart::before,
.heart::after {
  content: "";
  position: absolute;
  width: 1em;
  height: 1em;
  background: currentColor;
  border-radius: 50%;
}

.heart::before {
  top: -0.5em;
  left: 0;
}

.heart::after {
  top: 0;
  left: -0.5em;
}

@keyframes float-up {
  0% { transform: translate3d(0, 12vh, 0); opacity: 0; }
  18% { opacity: 0.55; }
  50% { transform: translate3d(var(--sway, 12px), -48vh, 0); opacity: 0.45; }
  100% { transform: translate3d(calc(var(--sway, 12px) * -0.6), -118vh, 0); opacity: 0; }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.7); }
  50% { opacity: 1; transform: scale(1); }
}

/* ---------- Opening ---------- */

.opening-bg,
.opening-screen {
  position: fixed;
  inset: 0;
  transition: opacity 1.05s ease, visibility 1.05s linear;
}

.opening-bg {
  z-index: 0;
  background: linear-gradient(130deg, #ffe7f1, #f3e8ff 42%, #fff4ea 72%, #f8d9e8);
  background-size: 220% 220%;
  animation: sky-shift 18s ease-in-out infinite;
}

.opening-screen {
  z-index: 26;
  display: grid;
  place-items: center;
  padding:
    calc(4.75rem + env(safe-area-inset-top))
    1.35rem
    calc(1.5rem + env(safe-area-inset-bottom));
  overflow: auto;
}

.opening-inner {
  position: relative;
  width: min(100%, 760px);
  text-align: center;
  transition: transform 1.05s ease, opacity 1.05s ease;
}

.opening-inner::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 46%;
  width: min(94vw, 640px);
  height: min(70vw, 420px);
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(255, 250, 252, 0.82) 0%, rgba(255, 250, 252, 0.28) 48%, transparent 72%);
  pointer-events: none;
}

body.is-open .opening-bg,
body.is-open .opening-screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.is-open .opening-inner {
  opacity: 0;
  transform: scale(1.03);
}

.opening-title {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 0.28em;
  row-gap: 0.04em;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.7rem, 8.6vw, 5.8rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.hey {
  font-style: italic;
}

.opening-sub {
  max-width: 16em;
  margin: 1.05rem auto 1.7rem;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.32rem, 3vw, 1.9rem);
}

@keyframes rise-in {
  from { translate: 0 16px; }
  to { translate: 0 0; }
}

@keyframes sky-shift {
  0%, 100% { background-position: 0% 40%; }
  50% { background-position: 100% 60%; }
}

/* ---------- Story ---------- */

.story {
  position: relative;
  z-index: 2;
  background: transparent;
}

body.is-intro .story {
  visibility: hidden;
}

.section {
  position: relative;
  padding: 4.5rem 1.25rem;
}

.section-inner {
  width: min(1040px, 100%);
  margin: 0 auto;
}

.heading-block,
.celebration-copy,
.cake-actions {
  text-align: center;
}

.section-heading {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.15rem, 6.4vw, 3.75rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-align: center;
}

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 132px;
  margin: 0.85rem auto 1.15rem;
}

.ornament::before,
.ornament::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.ornament span {
  width: 6px;
  height: 6px;
  flex: none;
  background: var(--gold);
  transform: rotate(45deg);
}

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

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

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  min-height: 52px;
  padding: 0.85rem 1.45rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.btn:disabled {
  cursor: default;
  filter: saturate(0.75);
  opacity: 0.8;
}

.btn-fill {
  color: #fff;
  background: linear-gradient(120deg, #d989a8 0%, #c9a36e 48%, #b89ad0 100%);
  background-size: 180% 100%;
  box-shadow: 0 14px 32px rgba(190, 120, 150, 0.32);
}

@media (prefers-reduced-motion: no-preference) {
  .opening-title { animation: rise-in 1.15s var(--ease) both; }
  .opening-sub { animation: rise-in 1.15s var(--ease) 0.22s both; }
  .surprise-btn { animation: rise-in 1.1s var(--ease) 0.42s both, sheen 7s ease 1.4s infinite; }

  .music-toggle[aria-pressed="true"] .music-disc {
    animation: music-spin 2.8s linear infinite;
  }
}

@keyframes music-spin {
  to { transform: rotate(360deg); }
}

@keyframes sheen {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.btn-ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 10px 28px rgba(120, 80, 110, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn-fill:active:not(:disabled) {
  transform: translateY(0) scale(0.985);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

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

.celebration {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  padding-top: 5.2rem;
  padding-bottom: 2.5rem;
}

.celebration-copy {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
}

.celebration-copy::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -12% -8%;
  background: radial-gradient(ellipse, rgba(255, 248, 251, 0.78), transparent 70%);
}

.celebration-title {
  font-size: clamp(2.45rem, 7.2vw, 4.6rem);
}

.lead {
  max-width: 34rem;
  margin: 0 auto;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.2rem, 2.7vw, 1.55rem);
  line-height: 1.55;
}

.scroll-cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 2.7rem;
  color: var(--gold-deep);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.scroll-cue i {
  display: block;
  width: 1px;
  height: 46px;
  background: linear-gradient(var(--gold), transparent);
  animation: cue 1.8s ease-in-out infinite;
}

@keyframes cue {
  0%, 100% { opacity: 0.35; transform: scaleY(0.55); transform-origin: top; }
  50% { opacity: 1; transform: scaleY(1); transform-origin: top; }
}

.balloon {
  position: absolute;
  width: 58px;
  height: 74px;
  border-radius: 50% 50% 50% 50% / 42% 42% 58% 58%;
  animation: bob 7.5s ease-in-out infinite;
}

.balloon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 98%;
  width: 1px;
  height: 78px;
  background: linear-gradient(rgba(150, 110, 120, 0.4), transparent);
}

.balloon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: inherit;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.balloon-rose {
  left: 4%;
  top: 14%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95), transparent 22%),
    linear-gradient(#f8c4d4, #e48eab);
}

.balloon-lilac {
  left: 12%;
  bottom: 14%;
  width: 42px;
  height: 54px;
  animation-delay: -2s;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95), transparent 22%),
    linear-gradient(#e7d8fb, #bba4dc);
}

.balloon-cream {
  right: 5%;
  top: 12%;
  animation-delay: -1.3s;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95), transparent 22%),
    linear-gradient(#fff6ea, #f0d2a8);
}

.balloon-gold {
  right: 14%;
  bottom: 16%;
  width: 40px;
  height: 52px;
  animation-delay: -3.1s;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95), transparent 22%),
    linear-gradient(#f7e7c4, #e4c07a);
}

.balloon-blush {
  left: 8%;
  top: 48%;
  width: 34px;
  height: 44px;
  animation-delay: -4.2s;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95), transparent 22%),
    linear-gradient(#fde8ef, #f0b7c8);
}

.balloons .glint {
  width: 11px;
  height: 11px;
  animation: twinkle 2.8s ease-in-out infinite;
}

.balloons .glint:nth-child(6) { left: 24%; top: 18%; }
.balloons .glint:nth-child(7) { right: 22%; top: 30%; animation-delay: 0.6s; }
.balloons .glint:nth-child(8) { left: 20%; bottom: 24%; animation-delay: 1.1s; }
.balloons .glint:nth-child(9) { right: 18%; bottom: 20%; animation-delay: 0.3s; }

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

/* ---------- Letter ---------- */

.letter-section {
  padding-top: 5.4rem;
}

.message-card {
  position: relative;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 3.3rem 1.35rem 1.8rem;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.message-card::before {
  content: "“";
  position: absolute;
  top: 18px;
  left: 22px;
  color: rgba(201, 163, 106, 0.35);
  font-family: var(--serif);
  font-size: 5rem;
  line-height: 1;
  pointer-events: none;
}

.message-card::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(201, 163, 106, 0.32);
  border-radius: 20px;
  pointer-events: none;
}

.seal {
  position: absolute;
  top: -22px;
  left: 50%;
  z-index: 1;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #f3a3b8, #c45d7c 62%, #a34764);
  border-radius: 50%;
  box-shadow:
    0 8px 16px rgba(160, 60, 90, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transform: translateX(-50%);
}

.card-title {
  font-size: clamp(2rem, 6vw, 3.1rem);
}

.message-body p {
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.18rem, 2.5vw, 1.48rem);
  line-height: 1.7;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.8s ease, transform 0.8s ease;
  transition-delay: var(--delay, 0.2s);
}

.message-body p + p {
  margin-top: 1rem;
}

.message-card.is-visible .message-body p {
  opacity: 1;
  transform: none;
}

/* ---------- Gallery ---------- */

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.photo {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  padding: 0;
  overflow: hidden;
  border-radius: 22px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.75), transparent 42%),
    linear-gradient(160deg, #f7d5e3, #e6daf8);
  box-shadow: 0 16px 40px rgba(120, 80, 110, 0.14);
  cursor: pointer;
}

.photo.reveal {
  transition-duration: 0.35s;
}

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease);
}

.photo.is-missing img {
  visibility: hidden;
}

.photo.is-missing::after {
  content: "♡";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.8rem;
}

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

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

.timeline::before {
  content: "";
  position: absolute;
  top: 0.35rem;
  bottom: 0.35rem;
  left: 0.45rem;
  width: 1px;
  background: linear-gradient(rgba(201, 163, 106, 0.15), var(--gold), rgba(201, 163, 106, 0.15));
}

.timeline-item {
  position: relative;
  padding-bottom: 1rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 1.35rem;
  left: calc(-2rem + 0.45rem);
  width: 14px;
  height: 14px;
  background: var(--cream);
  border: 2px solid var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(201, 163, 106, 0.18);
  transform: translateX(-50%);
}

.timeline-card {
  padding: 1.15rem 1.15rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 14px 34px rgba(130, 90, 120, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.timeline-card h3,
.wish-card h3 {
  margin-bottom: 0.35rem;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
}

.timeline-card p,
.wish-card p {
  color: var(--ink-soft);
  line-height: 1.65;
}

/* ---------- Wishes ---------- */

.wish-grid {
  display: grid;
  gap: 14px;
}

.wish-card {
  padding: 1.35rem 1.25rem 1.45rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 16px 40px rgba(130, 90, 120, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.wish-card:nth-child(1) { background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 236, 244, 0.62)); }
.wish-card:nth-child(2) { background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(244, 236, 255, 0.68)); }
.wish-card:nth-child(3) { background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 244, 236, 0.7)); }
.wish-card:nth-child(4) { background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 248, 232, 0.75)); }

.wish-emoji {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 0.75rem;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  font-size: 1.25rem;
}

/* ---------- Cake ---------- */

.cake-section {
  padding-bottom: 5rem;
}

.cake-stage {
  position: relative;
  width: min(340px, 100%);
  margin: 0.4rem auto 0.2rem;
  padding: 1.2rem 0 0.4rem;
}

.cake-stage::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(300px, 80vw);
  height: min(300px, 80vw);
  background: radial-gradient(circle, rgba(255, 214, 170, 0.55), transparent 68%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: background 0.8s ease;
}

.cake-stage.is-celebrating::before {
  background: radial-gradient(circle, rgba(236, 214, 255, 0.62), transparent 68%);
}

.cake {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(240px, 68vw);
  margin: 0 auto;
}

.cake-stage.is-celebrating .cake {
  animation: cake-joy 1.15s ease;
}

@keyframes cake-joy {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-8px) scale(1.03); }
  55% { transform: translateY(0) scale(0.99); }
  78% { transform: translateY(-3px) scale(1.012); }
  100% { transform: translateY(0) scale(1); }
}

.candles {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 78px;
  margin-bottom: -8px;
  gap: clamp(8px, 2.4vw, 16px);
}

.candle {
  position: relative;
  width: 9px;
  border-radius: 3px;
  background: linear-gradient(#fff, #f6e2d8);
  box-shadow: inset -2px 0 0 rgba(180, 120, 140, 0.16);
}

.candle:nth-child(1) { height: 36px; }
.candle:nth-child(2) { height: 50px; background: linear-gradient(#fff, #f7d5e2); }
.candle:nth-child(3) { height: 64px; background: linear-gradient(#fffaf3, #f3e2c4); }
.candle:nth-child(4) { height: 48px; background: linear-gradient(#fff, #eadff8); }
.candle:nth-child(5) { height: 34px; }

.flame {
  position: absolute;
  bottom: calc(100% - 2px);
  left: 50%;
  width: 12px;
  height: 18px;
  margin-left: -6px;
  background: radial-gradient(circle at 50% 78%, #fffef6 0 18%, #ffe38a 34%, #ffb03a 60%, rgba(255, 122, 50, 0) 76%);
  border-radius: 50% 50% 46% 46%;
  transform-origin: center bottom;
  filter: drop-shadow(0 0 6px rgba(255, 170, 60, 0.95));
  animation: flicker 0.45s ease-in-out infinite alternate;
}

.flame::before {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 50%;
  width: 2px;
  height: 6px;
  margin-left: -1px;
  background: #5c4638;
  border-radius: 1px;
}

@keyframes flicker {
  from { opacity: 0.9; transform: scale(1) rotate(-3deg); }
  to { opacity: 1; transform: scale(1.08, 1.18) rotate(3deg); }
}

.cake.candles-out .flame {
  animation: extinguish 0.55s ease forwards;
}

@keyframes extinguish {
  to {
    opacity: 0;
    filter: none;
    transform: scale(0.25, 0.45);
  }
}

.smoke {
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  opacity: 0;
}

.cake.candles-out .smoke {
  animation: smoke-up 1.6s ease-out forwards;
}

.candle:nth-child(2) .smoke { animation-delay: 0.08s; }
.candle:nth-child(3) .smoke { animation-delay: 0.16s; }
.candle:nth-child(4) .smoke { animation-delay: 0.05s; }
.candle:nth-child(5) .smoke { animation-delay: 0.12s; }

@keyframes smoke-up {
  0% { opacity: 0; background: rgba(186, 186, 196, 0.15); transform: translateY(0) scale(0.5); }
  30% { opacity: 0.45; background: rgba(186, 186, 196, 0.45); }
  100% { opacity: 0; transform: translateY(-30px) scale(1.8); }
}

.tier {
  position: relative;
  border-radius: 16px 16px 12px 12px;
}

.tier-top {
  z-index: 3;
  width: 54%;
  height: 52px;
  background: linear-gradient(#fff, #fdeff3);
  box-shadow: inset 0 -8px 12px rgba(214, 150, 170, 0.12), inset 6px 0 10px rgba(255, 255, 255, 0.65);
}

.tier-mid {
  z-index: 2;
  width: 76%;
  height: 64px;
  margin-top: -6px;
  background: linear-gradient(#fde4ec, #f3c0d2);
  box-shadow: inset 8px 0 14px rgba(255, 255, 255, 0.28);
}

.tier-base {
  z-index: 1;
  width: 100%;
  height: 78px;
  margin-top: -6px;
  background: linear-gradient(#f6c9d8, #e7a4bc);
  box-shadow:
    inset 10px 0 16px rgba(255, 255, 255, 0.22),
    inset -8px 0 12px rgba(160, 70, 100, 0.08);
}

.icing {
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 22px;
  background: #fffdfb;
  border-radius: 14px 14px 8px 8px;
}

.icing::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -8px;
  left: 0;
  height: 12px;
  background:
    radial-gradient(circle at 12% 0, #fffdfb 6px, transparent 6.6px),
    radial-gradient(circle at 32% 0, #fffdfb 6px, transparent 6.6px),
    radial-gradient(circle at 52% 0, #fffdfb 6px, transparent 6.6px),
    radial-gradient(circle at 72% 0, #fffdfb 6px, transparent 6.6px),
    radial-gradient(circle at 90% 0, #fffdfb 6px, transparent 6.6px);
}

.drips span {
  position: absolute;
  top: 16px;
  width: 11px;
  background: linear-gradient(#fffdfb, #f8d5e2);
  border-radius: 0 0 10px 10px;
}

.tier-mid .drips span:nth-child(1) { left: 10%; height: 14px; }
.tier-mid .drips span:nth-child(2) { left: 28%; height: 24px; }
.tier-mid .drips span:nth-child(3) { left: 48%; height: 16px; }
.tier-mid .drips span:nth-child(4) { left: 66%; height: 26px; }
.tier-mid .drips span:nth-child(5) { left: 82%; height: 14px; }

.tier-base .drips span:nth-child(1) { left: 6%; height: 16px; }
.tier-base .drips span:nth-child(2) { left: 18%; height: 28px; }
.tier-base .drips span:nth-child(3) { left: 32%; height: 18px; }
.tier-base .drips span:nth-child(4) { left: 46%; height: 32px; }
.tier-base .drips span:nth-child(5) { left: 60%; height: 18px; }
.tier-base .drips span:nth-child(6) { left: 74%; height: 26px; }
.tier-base .drips span:nth-child(7) { left: 86%; height: 15px; }

.tier-mid::after {
  content: "";
  position: absolute;
  top: 54%;
  left: 12px;
  right: 12px;
  height: 7px;
  background: linear-gradient(90deg, transparent, rgba(226, 198, 146, 0.95), transparent);
  border-radius: 99px;
}

.tier-base::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 14px;
  left: 16px;
  height: 8px;
  background: radial-gradient(circle, #f3e2b4 2.4px, transparent 2.9px) 0 50% / 16px 8px repeat-x;
}

.tier-top::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 14px;
  right: 14px;
  height: 8px;
  background: radial-gradient(circle, #f6d7e2 2px, transparent 2.5px) 0 50% / 12px 8px repeat-x;
}

.plate {
  position: relative;
  z-index: 0;
  width: 108%;
  height: 22px;
  margin-top: -1px;
  background: radial-gradient(ellipse at 50% 35%, #ffffff 0%, #f6e8ee 62%, #ead7e2 100%);
  border-radius: 50%;
  box-shadow:
    inset 0 6px 8px rgba(255, 255, 255, 0.85),
    0 16px 24px rgba(130, 80, 110, 0.15);
}

.cake-sparkles span {
  position: absolute;
  width: 10px;
  height: 10px;
  opacity: 0;
}

.cake-sparkles span:nth-child(1) { left: 6%; top: 22%; }
.cake-sparkles span:nth-child(2) { right: 8%; top: 16%; }
.cake-sparkles span:nth-child(3) { left: 0; top: 48%; }
.cake-sparkles span:nth-child(4) { right: 2%; top: 46%; }
.cake-sparkles span:nth-child(5) { left: 18%; top: 8%; }
.cake-sparkles span:nth-child(6) { right: 16%; top: 6%; }
.cake-sparkles span:nth-child(7) { left: 10%; bottom: 18%; }
.cake-sparkles span:nth-child(8) { right: 12%; bottom: 16%; }

.cake-stage.is-celebrating .cake-sparkles span {
  animation: spark-pop 1.35s ease forwards;
}

.cake-sparkles span:nth-child(2) { animation-delay: 0.08s; }
.cake-sparkles span:nth-child(3) { animation-delay: 0.16s; }
.cake-sparkles span:nth-child(4) { animation-delay: 0.04s; }
.cake-sparkles span:nth-child(5) { animation-delay: 0.2s; }
.cake-sparkles span:nth-child(6) { animation-delay: 0.12s; }
.cake-sparkles span:nth-child(7) { animation-delay: 0.18s; }
.cake-sparkles span:nth-child(8) { animation-delay: 0.1s; }

@keyframes spark-pop {
  0% { opacity: 0; transform: scale(0.2); }
  35% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.4) translateY(-16px); }
}

.cake-actions {
  margin-top: 0.35rem;
}

.wish-messages p {
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--serif);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.8s ease, transform 0.8s ease, max-height 0.7s ease, margin-top 0.7s ease, visibility 0.8s linear;
}

.wish-messages p.is-visible {
  max-height: 8rem;
  margin-top: 0.95rem;
  opacity: 1;
  visibility: visible;
  transform: none;
}

#wish-result {
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  font-style: italic;
}

#wish-again {
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  line-height: 1.25;
}

/* ---------- Finale ---------- */

.finale {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(5.5rem + env(safe-area-inset-top)) 1.35rem calc(2.5rem + env(safe-area-inset-bottom));
  overflow: hidden;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 230, 240, 0.95), transparent 55%),
    radial-gradient(ellipse at 85% 80%, rgba(210, 190, 245, 0.55), transparent 50%),
    radial-gradient(ellipse at 8% 90%, rgba(247, 214, 186, 0.5), transparent 46%),
    linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #f7eef8 16%, #f3e6f6 100%);
}

.finale::before {
  content: "";
  position: absolute;
  top: -10%;
  left: -20%;
  width: 140%;
  height: 70%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55), transparent 62%);
  animation: glow-drift 10s ease-in-out infinite;
  pointer-events: none;
}

@keyframes glow-drift {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, 26px, 0); }
}

.finale-hearts {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.finale-inner {
  position: relative;
  z-index: 1;
  width: min(100%, 40rem);
}

.finale-kicker {
  color: var(--ink-soft);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.55rem, 3.4vw, 2.15rem);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.finale.show-intro .finale-kicker {
  opacity: 1;
  transform: none;
}

.finale-rest {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.9s var(--ease);
}

.finale.show-rest .finale-rest {
  grid-template-rows: 1fr;
}

.finale-rest-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.95rem;
  overflow: hidden;
}

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

.finale.show-rest .line {
  opacity: 1;
  transform: none;
}

.finale.show-rest .finale-deserve { transition-delay: 0.12s; }
.finale.show-rest .finale-title { transition-delay: 0.38s; }
.finale.show-rest .finale-from { transition-delay: 0.68s; }
.finale.show-rest #start-again { transition-delay: 1s; }

.finale-deserve {
  max-width: 14em;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 4.4vw, 2.7rem);
  line-height: 1.28;
}

.finale-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.35rem, 6vw, 4.15rem);
  line-height: 1.08;
}

.finale-from {
  color: var(--ink-soft);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.35;
}

.sender {
  display: inline-block;
  margin-top: 0.15rem;
  color: var(--ink);
  font-size: 1.75rem;
}

#start-again {
  margin-top: 0.4rem;
}

/* ---------- Confetti ---------- */

.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 24;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: -24px;
  opacity: 0;
  animation-name: confetti-fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes confetti-fall {
  0% { opacity: 1; transform: translate3d(0, -8vh, 0) rotate(0deg); }
  100% { opacity: 0.9; transform: translate3d(var(--drift), 108vh, 0) rotate(var(--spin)); }
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 28, 46, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lightbox-dialog {
  position: relative;
  z-index: 1;
  max-width: calc(100vw - 20px);
}

.lightbox-frame {
  margin: 0;
  padding: 10px 10px 8px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

.lightbox-frame img {
  width: auto;
  max-width: calc(100vw - 36px);
  height: auto;
  max-height: calc(100svh - 168px);
  margin: 0 auto;
  border-radius: 12px;
  object-fit: contain;
  transition: opacity 0.25s ease;
}

.lightbox-frame img.is-changing,
.lightbox-frame.is-missing img {
  opacity: 0;
}

.lightbox-frame.is-missing {
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(160deg, #f7d5e3, #e6daf8) border-box;
}

.lightbox-frame figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 6px 2px;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.icon-btn {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
  cursor: pointer;
}

.lightbox-close {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
}

.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-prev { left: max(10px, env(safe-area-inset-left)); }
.lightbox-next { right: max(10px, env(safe-area-inset-right)); }

.noscript-note {
  position: fixed;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 80;
  padding: 0.8rem 1rem;
  text-align: center;
  background: #fff;
  border-radius: 12px;
}

/* ---------- Larger screens ---------- */

@media (min-width: 740px) {
  .section {
    padding: 6.2rem 1.75rem;
  }

  .wish-grid {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }

  .message-card {
    padding: 3.6rem 3rem 2.3rem;
  }
}

@media (min-width: 840px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }
}

@media (min-width: 860px) {
  .timeline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 4.5rem;
    max-width: 920px;
    margin: 0 auto;
    padding: 0;
  }

  .timeline::before {
    left: 50%;
    transform: translateX(-50%);
  }

  .timeline-item:nth-child(even) {
    margin-top: 2.6rem;
  }

  .timeline-item::before {
    top: 1.55rem;
  }

  .timeline-item:nth-child(odd)::before {
    right: -2.25rem;
    left: auto;
    transform: translateX(50%);
  }

  .timeline-item:nth-child(even)::before {
    left: -2.25rem;
    transform: translateX(-50%);
  }
}

@media (max-width: 700px) {
  .balloon {
    opacity: 0.7;
  }

  .balloon-lilac,
  .balloon-blush {
    display: none;
  }

  .message-card::after {
    inset: 8px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .btn-fill:hover:not(:disabled) {
    box-shadow: 0 18px 36px rgba(190, 120, 150, 0.4);
    transform: translateY(-2px);
  }

  .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.8);
  }

  .photo:hover img {
    transform: scale(1.06);
  }

  .music-toggle:hover,
  .icon-btn:hover {
    background: rgba(255, 255, 255, 0.98);
  }

  .lightbox-prev:hover,
  .lightbox-next:hover {
    transform: translateY(-50%) scale(1.06);
  }
}

@media (min-width: 900px) {
  body::-webkit-scrollbar {
    width: 10px;
  }

  body::-webkit-scrollbar-thumb {
    background: #e3c3d2;
    border: 2px solid transparent;
    border-radius: 99px;
    background-clip: padding-box;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .opening-bg,
  .opening-screen,
  .opening-inner,
  .reveal,
  .message-body p,
  .wish-messages p,
  .finale-kicker,
  .finale-rest,
  .line,
  .btn-fill,
  .photo img,
  .lightbox-frame img {
    animation: none !important;
    transition: none !important;
  }

  .opening-title,
  .opening-sub,
  .surprise-btn,
  .balloon,
  .floater,
  .star,
  .sparkle,
  .glint,
  .scroll-cue i,
  .finale::before,
  .flame {
    animation: none !important;
  }

  .floater {
    display: none !important;
  }

  .reveal,
  .message-body p,
  .opening-title,
  .opening-sub,
  .surprise-btn {
    opacity: 1 !important;
    transform: none !important;
    translate: none !important;
  }

  .cake.candles-out .flame {
    opacity: 0;
    animation: none !important;
  }

  .cake-stage.is-celebrating .cake,
  .cake-stage.is-celebrating .cake-sparkles span {
    animation: none !important;
  }

  body.is-open .opening-inner {
    transform: none;
  }
}
