/* ============================================================
   Happy Birthday — animated cake
   ============================================================ */

:root {
  --bg-0: #0b0616;
  --bg-1: #1a0a2e;
  --pink: #ff5f8f;
  --pink-soft: #ffd6e6;
  --purple: #a855f7;
  --gold: #ffc93c;
  --aqua: #49e5e0;
  --text: #f7f2ff;
  --radius: 18px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(120% 100% at 50% 0%, var(--bg-1) 0%, var(--bg-0) 55%, #05030c 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- background ---------- */
.sky {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: drift 18s ease-in-out infinite alternate;
}
.aurora-1 {
  width: 46vw; height: 46vw; left: -10vw; top: -8vw;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.9), transparent 70%);
}
.aurora-2 {
  width: 40vw; height: 40vw; right: -8vw; top: 10vh;
  background: radial-gradient(circle, rgba(255, 95, 143, 0.75), transparent 70%);
  animation-delay: -6s;
}
.aurora-3 {
  width: 38vw; height: 38vw; left: 30vw; bottom: -14vw;
  background: radial-gradient(circle, rgba(73, 229, 224, 0.5), transparent 70%);
  animation-delay: -11s;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(4vw, 5vh, 0) scale(1.18); }
}

.stars { position: absolute; inset: 0; }
.star {
  position: absolute;
  width: 2px; height: 2px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.25;
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.7); }
  50%      { opacity: 0.95; transform: scale(1.4); }
}

.balloons { position: absolute; inset: 0; }
.balloon {
  position: absolute;
  bottom: -22vh;
  width: 46px; height: 58px;
  border-radius: 50% 50% 48% 48%;
  opacity: 0.85;
  animation: float-up linear infinite;
  will-change: transform;
}
.balloon::before {
  content: "";
  position: absolute;
  bottom: -5px; left: 50%;
  width: 8px; height: 8px;
  transform: translateX(-50%);
  background: inherit;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.balloon::after {
  content: "";
  position: absolute;
  bottom: -70px; left: 50%;
  width: 1px; height: 70px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.6), transparent);
}
.balloon span {
  position: absolute;
  inset: 8px 10px auto 8px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  filter: blur(3px);
}
@keyframes float-up {
  0%   { transform: translate3d(0, 0, 0) rotate(-6deg); }
  50%  { transform: translate3d(34px, -60vh, 0) rotate(6deg); }
  100% { transform: translate3d(-24px, -128vh, 0) rotate(-4deg); }
}

/* ---------- fx canvas ---------- */
#fx {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

/* ---------- layout ---------- */
.wrap {
  position: relative;
  z-index: 4;
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(28px, 6vh, 64px) 20px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 2.4vh, 22px);
}

/* the cake blurs away behind the name-entry overlay */
.wrap { transition: filter 0.45s ease, opacity 0.45s ease; }
body.intro-open .wrap { filter: blur(9px); opacity: 0.28; pointer-events: none; }

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(255, 201, 60, 0.9);
}

/* ---------- logo ---------- */
.logo-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  margin: 0 auto 12px;
  animation: logo-float 5.5s ease-in-out infinite;
}
.logo-wrap::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--gold), var(--pink), var(--purple), var(--aqua), var(--gold));
  filter: blur(10px);
  opacity: 0.8;
  animation: spin 9s linear infinite;
}
.logo {
  position: relative;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  border: 3px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.12);
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-9px); }
}

.title {
  margin: 0;
  font-family: "Pacifico", "Segoe Script", cursive;
  font-weight: 400;
  font-size: clamp(2.1rem, 7vw, 3.9rem);
  line-height: 1.15;
  background: linear-gradient(100deg, #fff 5%, var(--gold) 28%, var(--pink) 52%, var(--aqua) 78%, #fff 98%);
  background-size: 260% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 7s linear infinite;
  filter: drop-shadow(0 6px 26px rgba(255, 95, 143, 0.35));
}
@keyframes shine {
  to { background-position: 260% center; }
}

.subtitle {
  margin: 0;
  font-weight: 300;
  font-size: clamp(0.95rem, 2.6vw, 1.15rem);
  color: rgba(247, 242, 255, 0.78);
  min-height: 1.6em;
  transition: opacity 0.3s ease;
}

/* ---------- cake ---------- */
.stage {
  position: relative;
  display: grid;
  place-items: end center;
  padding: 70px 0 30px;
  perspective: 900px;
}

.glow {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 420px; height: 420px;
  transform: translate(-50%, -50%) scale(0.8);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 176, 59, 0.55), rgba(255, 95, 143, 0.25) 45%, transparent 70%);
  filter: blur(30px);
  opacity: 0;
  transition: opacity 0.7s ease, transform 0.7s ease;
  pointer-events: none;
}
.cake.lit ~ .glow,
.glow.lit { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.cake {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-style: preserve-3d;
  animation: cake-in 1s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
@keyframes cake-in {
  from { opacity: 0; transform: translateY(60px) scale(0.85); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cake.pop { animation: pop 0.75s cubic-bezier(0.22, 1.4, 0.36, 1); }
@keyframes pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.07) translateY(-8px); }
  60%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}
.cake.shake { animation: shake 0.5s ease-in-out; }
@keyframes shake {
  0%, 100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-6px) rotate(-1deg); }
  45% { transform: translateX(5px) rotate(1deg); }
  70% { transform: translateX(-3px) rotate(-0.6deg); }
}

/* candles */
.candles {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(12px, 3.4vw, 22px);
  margin-bottom: -3px;
}

.candle {
  position: relative;
  width: 10px;
  border-radius: 5px;
  background: repeating-linear-gradient(138deg, var(--c1) 0 5px, #fff 5px 10px);
  box-shadow: inset -2px 0 4px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: filter 0.4s ease;
}
.candle::before {
  content: "";
  position: absolute;
  top: -7px; left: 50%;
  width: 2px; height: 7px;
  transform: translateX(-50%);
  background: #3c2a20;
  border-radius: 1px;
}

.flame {
  position: absolute;
  left: 50%;
  top: -30px;
  width: 15px; height: 26px;
  transform: translateX(-50%);
  border-radius: 50% 50% 46% 46% / 68% 68% 36% 36%;
  background: radial-gradient(circle at 50% 72%, #fff 0%, #ffe98a 26%, #ffb43c 55%, #ff6a2b 80%, rgba(255, 90, 20, 0.15) 100%);
  filter: blur(0.4px) drop-shadow(0 0 14px rgba(255, 170, 40, 0.95)) drop-shadow(0 0 34px rgba(255, 120, 20, 0.55));
  transform-origin: 50% 92%;
  animation: flicker 0.16s infinite alternate ease-in-out;
}
.flame::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 3px;
  width: 6px; height: 9px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(120, 190, 255, 0.9);
  filter: blur(1px);
}
@keyframes flicker {
  from { transform: translateX(-50%) scale(1, 1) rotate(-3deg); }
  to   { transform: translateX(-50%) scale(1.08, 1.16) rotate(3deg); }
}

.candle.out { filter: grayscale(0.3) brightness(0.72); }
.candle.out .flame { animation: none; opacity: 0; transform: translateX(-50%) scale(0.2); }

.smoke {
  position: absolute;
  left: 50%;
  top: -26px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(220, 220, 235, 0.55);
  filter: blur(4px);
  pointer-events: none;
  animation: smoke 1.5s ease-out forwards;
}
@keyframes smoke {
  0%   { opacity: 0.75; transform: translate(-50%, 0) scale(0.6); }
  100% { opacity: 0; transform: translate(-50%, -90px) scale(3.2); }
}

/* tiers */
.tier {
  position: relative;
  border-radius: 16px;
  box-shadow:
    inset 12px 0 26px rgba(255, 255, 255, 0.09),
    inset -14px 0 26px rgba(0, 0, 0, 0.22),
    0 14px 26px rgba(0, 0, 0, 0.38);
  overflow: hidden;
}

.tier .body {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--sponge-a) 0%, var(--sponge-b) 60%, var(--sponge-c) 100%);
}

.tier .frosting {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 44%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.75) 0%, transparent 26%, transparent 74%, rgba(0, 0, 0, 0.09) 100%),
    linear-gradient(180deg, #ffffff 0%, #fff3f8 50%, var(--frost) 100%);
  z-index: 2;
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.16);
}
.tier .frosting::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -10px;
  height: 20px;
  background-image: radial-gradient(circle at 10px 0, var(--frost) 10px, transparent 10.4px);
  background-size: 20px 20px;
  background-repeat: repeat-x;
}

.tier-top {
  --frost: #ffd6e6;
  --sponge-a: #ffc2d6;
  --sponge-b: #ff9fbe;
  --sponge-c: #f2769d;
  width: clamp(150px, 42vw, 190px);
  height: clamp(52px, 14vw, 64px);
  z-index: 3;
}
.tier-mid {
  --frost: #d9c4ff;
  --sponge-a: #f7e3b8;
  --sponge-b: #efd18d;
  --sponge-c: #dcb367;
  width: clamp(210px, 58vw, 262px);
  height: clamp(60px, 16vw, 74px);
  margin-top: 3px;
  z-index: 2;
}
.tier-bottom {
  --frost: #ffb3c9;
  --sponge-a: #7a4a2b;
  --sponge-b: #5f3519;
  --sponge-c: #47260f;
  width: clamp(258px, 72vw, 322px);
  height: clamp(66px, 18vw, 84px);
  margin-top: 3px;
  z-index: 1;
}

.sprinkle {
  position: absolute;
  width: 7px; height: 3px;
  border-radius: 2px;
  z-index: 3;
  opacity: 0.95;
}

.plate {
  width: clamp(320px, 88vw, 400px);
  height: 20px;
  margin-top: 6px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f4f1ff 0%, #b9b3d6 45%, #6d668f 100%);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.55), inset 0 -4px 8px rgba(0, 0, 0, 0.25);
}

/* ---------- controls ---------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  padding: 13px 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.btn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.14); }
.btn:active { transform: translateY(0) scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--aqua); outline-offset: 3px; }

.btn-primary {
  border: none;
  color: #2a0a1c;
  background: linear-gradient(100deg, var(--gold), #ffa4c4 55%, var(--purple));
  box-shadow: 0 14px 34px rgba(255, 122, 170, 0.4);
  font-weight: 700;
}
.btn-primary:hover { box-shadow: 0 18px 44px rgba(255, 122, 170, 0.55); }

.btn-ghost { padding: 10px 18px; font-size: 0.88rem; }

.hint {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 300;
  color: rgba(247, 242, 255, 0.5);
}
.hint kbd {
  font-family: inherit;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 2px 7px;
}

/* ---------- wish card ---------- */
.wish-card {
  width: min(560px, 100%);
  padding: 26px 24px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(22px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 1.2, 0.4, 1);
}
.wish-card.show { opacity: 1; transform: none; pointer-events: auto; }
.wish-card h2 {
  margin: 0 0 10px;
  font-family: "Pacifico", "Segoe Script", cursive;
  font-weight: 400;
  font-size: clamp(1.35rem, 4.2vw, 1.85rem);
  color: var(--gold);
}
.wish-card p {
  margin: 0 0 18px;
  font-weight: 300;
  line-height: 1.65;
  color: rgba(247, 242, 255, 0.85);
}
.wish-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.foot {
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 300;
  color: rgba(247, 242, 255, 0.35);
}

/* ---------- first-visit name entry ---------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow-y: auto;
  background: radial-gradient(120% 100% at 50% 0%, rgba(26, 10, 46, 0.88), rgba(6, 3, 14, 0.95));
  backdrop-filter: blur(14px);
  animation: fade 0.35s ease;
}
[hidden] { display: none !important; }

.intro-card {
  width: min(460px, 100%);
  padding: 32px 26px 26px;
  border-radius: 24px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.04));
  box-shadow: var(--shadow);
  animation: rise 0.5s cubic-bezier(0.2, 1.2, 0.4, 1);
}

.intro-logo {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  background: #fff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), 0 0 44px rgba(255, 95, 143, 0.45);
  margin-bottom: 18px;
  animation: logo-float 5.5s ease-in-out infinite;
}

.intro-title {
  margin: 0 0 8px;
  font-family: "Pacifico", "Segoe Script", cursive;
  font-weight: 400;
  font-size: clamp(1.45rem, 5.4vw, 2rem);
  line-height: 1.25;
  color: #fff;
  text-shadow: 0 4px 24px rgba(255, 95, 143, 0.55);
}

.intro-sub {
  margin: 0 0 22px;
  font-weight: 300;
  font-size: 0.95rem;
  color: rgba(247, 242, 255, 0.72);
}

.intro-form { display: flex; flex-direction: column; gap: 12px; }

.intro-form input {
  width: 100%;
  font-family: inherit;
  font-size: 1.05rem;
  text-align: center;
  color: var(--text);
  padding: 15px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.intro-form input::placeholder { color: rgba(247, 242, 255, 0.4); }
.intro-form input:focus { border-color: var(--aqua); box-shadow: 0 0 0 4px rgba(73, 229, 224, 0.18); }

.intro-err {
  min-height: 1.2em;
  margin: 10px 0 0;
  font-size: 0.84rem;
  color: #ff9db8;
}

/* ---------- recipient gift reveal ---------- */
.reveal {
  position: fixed;
  inset: 0;
  z-index: 32;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 20px;
  text-align: center;
  cursor: pointer;
  background: radial-gradient(120% 100% at 50% 40%, rgba(45, 15, 75, 0.97), rgba(5, 2, 12, 0.99));
  animation: fade 0.3s ease;
}
.reveal-gift {
  font-size: clamp(3.5rem, 14vw, 4.8rem);
  line-height: 1;
  animation: gift-bounce 1.1s ease-in-out infinite;
  filter: drop-shadow(0 18px 34px rgba(255, 120, 170, 0.55));
}
.reveal-text {
  margin: 0;
  font-family: "Pacifico", "Segoe Script", cursive;
  font-size: clamp(1.05rem, 4vw, 1.4rem);
  color: #fff;
}
@keyframes gift-bounce {
  0%, 100% { transform: translateY(0) rotate(-6deg) scale(1); }
  50%      { transform: translateY(-16px) rotate(6deg) scale(1.12); }
}

/* ---------- share panel ---------- */
.share-panel {
  width: min(560px, 100%);
  padding: 22px 20px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 201, 60, 0.3);
  background: linear-gradient(160deg, rgba(255, 201, 60, 0.15), rgba(255, 255, 255, 0.04));
  backdrop-filter: blur(12px);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.42);
  animation: rise 0.45s cubic-bezier(0.2, 1.2, 0.4, 1);
}

.share-label {
  margin: 0 0 14px;
  font-weight: 500;
  font-size: 1rem;
  color: rgba(247, 242, 255, 0.92);
}
.share-label strong { color: var(--gold); }

.share-link { display: flex; gap: 8px; align-items: stretch; }
.share-link input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: inherit;
  font-size: 0.86rem;
  color: rgba(247, 242, 255, 0.88);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.3);
  outline: none;
}

.share-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.share-row .btn { flex: 1 1 auto; padding: 11px 14px; font-size: 0.85rem; }

.share-new { margin-top: 16px; font-size: 0.8rem; opacity: 0.8; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(18px) scale(0.96); opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 520px) {
  .stage { padding: 56px 0 22px; }
  .glow { width: 320px; height: 320px; }
  .logo-wrap, .logo { width: 88px; height: 88px; }
  .share-link { flex-direction: column; }
  .intro-card { padding: 26px 20px 20px; }
  .intro-logo { width: 84px; height: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
