:root {
  --plum: #2a0e3d;
  --plum-deep: #1b0829;
  --pink: #ff4f9a;
  --gold: #ffc93c;
  --sky: #4ed0f1;
  --cream: #fff6ec;
  --violet: #8c4fe0;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  width: 100%;
  background: radial-gradient(
    ellipse at 50% -10%,
    #4a1a63 0%,
    var(--plum) 45%,
    var(--plum-deep) 100%
  );
  background-attachment: fixed;
  font-family: "Quicksand", sans-serif;
  color: var(--cream);
  overflow-x: hidden;
}
h1,
h2,
.display {
  font-family: "Baloo 2", cursive;
}

::selection {
  background: var(--pink);
  color: #fff;
}

/* subtle scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--plum-deep);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--pink), var(--violet));
  border-radius: 10px;
}

canvas#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}
canvas#sparkle-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 49;
}

.stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(
      2px 2px at 20% 30%,
      rgba(255, 255, 255, 0.5) 0,
      transparent 50%
    ),
    radial-gradient(
      2px 2px at 70% 65%,
      rgba(255, 255, 255, 0.4) 0,
      transparent 50%
    ),
    radial-gradient(
      1.5px 1.5px at 40% 80%,
      rgba(255, 255, 255, 0.4) 0,
      transparent 50%
    ),
    radial-gradient(
      1.5px 1.5px at 85% 20%,
      rgba(255, 255, 255, 0.35) 0,
      transparent 50%
    ),
    radial-gradient(
      2px 2px at 10% 90%,
      rgba(255, 255, 255, 0.3) 0,
      transparent 50%
    ),
    radial-gradient(
      1.5px 1.5px at 55% 15%,
      rgba(255, 255, 255, 0.3) 0,
      transparent 50%
    ),
    radial-gradient(
      1.5px 1.5px at 92% 55%,
      rgba(255, 255, 255, 0.3) 0,
      transparent 50%
    ),
    radial-gradient(
      1.5px 1.5px at 5% 55%,
      rgba(255, 255, 255, 0.25) 0,
      transparent 50%
    );
  background-size: 100% 100%;
  animation: twinkle 4s ease-in-out infinite;
  will-change: opacity, transform;
}
@keyframes twinkle {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

.glow-orb {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  mix-blend-mode: screen;
  animation: orbDrift 18s ease-in-out infinite;
}
.glow-orb.o1 {
  width: 340px;
  height: 340px;
  top: -80px;
  left: -60px;
  background: var(--pink);
}
.glow-orb.o2 {
  width: 300px;
  height: 300px;
  bottom: -60px;
  right: -60px;
  background: var(--sky);
  animation-delay: -6s;
}
.glow-orb.o3 {
  width: 260px;
  height: 260px;
  top: 40%;
  left: 60%;
  background: var(--gold);
  animation-delay: -11s;
}
@keyframes orbDrift {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(30px, -24px) scale(1.15);
  }
}

.fairy-lights {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 26px;
  z-index: 3;
  pointer-events: none;
  display: flex;
  justify-content: space-around;
  padding-top: 8px;
}
.bulb {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: bulbGlow 1.6s ease-in-out infinite;
}
@keyframes bulbGlow {
  0%,
  100% {
    opacity: 0.35;
    filter: drop-shadow(0 0 2px currentColor);
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 8px currentColor);
  }
}

.balloons {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.balloon {
  position: absolute;
  bottom: -140px;
  width: 64px;
  height: 80px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: floatUp linear infinite;
  opacity: 0.9;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.25));
}
.balloon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 78%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid rgba(255, 255, 255, 0.25);
}
.balloon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -46px;
  width: 2px;
  height: 50px;
  background: rgba(255, 255, 255, 0.35);
  transform: translateX(-50%);
}
@keyframes floatUp {
  0% {
    transform: translateY(0) translateX(0) rotate(-4deg);
  }
  50% {
    transform: translateY(-55vh) translateX(30px) rotate(4deg);
  }
  100% {
    transform: translateY(-115vh) translateX(-10px) rotate(-4deg);
  }
}

.hearts-field {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.heart-float {
  position: absolute;
  bottom: -40px;
  font-size: 1rem;
  color: rgba(255, 143, 199, 0.55);
  animation: heartUp linear infinite;
}
@keyframes heartUp {
  0% {
    transform: translateY(0) rotate(0deg) scale(0.8);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 0.7;
  }
  100% {
    transform: translateY(-105vh) rotate(20deg) scale(1.1);
    opacity: 0;
  }
}

.wrap {
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin: 0 auto;
  padding: 60px 24px 100px;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  font-family: "Quicksand";
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--gold);
  border: 1.5px dashed rgba(255, 201, 60, 0.5);
  border-radius: 999px;
  padding: 8px 18px;
  margin-bottom: 22px;
  animation: fadeDown 0.8s ease both;
}

h1.title {
  font-size: clamp(2.2rem, 7vw, 4.2rem);
  font-weight: 800;
  line-height: 1.08;
  margin: 0 0 10px;
  background: linear-gradient(90deg, var(--gold), var(--pink) 55%, var(--sky));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation:
    fadeUp 0.9s ease 0.1s both,
    shimmer 6s linear infinite;
}
@keyframes shimmer {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 200% center;
  }
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.name-input-row {
  margin: 18px 0 8px;
  animation: fadeUp 0.9s ease 0.2s both;
}

.subtitle {
  font-size: 1.05rem;
  color: rgba(255, 246, 236, 0.8);
  max-width: 520px;
  margin: 18px auto 0;
  line-height: 1.6;
  animation: fadeUp 0.9s ease 0.3s both;
}

/* CAKE */
.cake-stage {
  margin: 56px auto 18px;
  width: 280px;
  position: relative;
  height: 260px;
  animation: fadeUp 1s ease 0.4s both;
}
.cake {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.35));
  z-index: 1;
}
.tier {
  position: relative;
  margin: 0 auto;
  border-radius: 14px;
  box-shadow:
    inset 0 -10px 14px rgba(0, 0, 0, 0.15),
    0 10px 20px rgba(0, 0, 0, 0.25);
}
.tier.bottom {
  width: 240px;
  height: 80px;
  background: linear-gradient(180deg, #ff77b0, #ff4f9a);
}
.tier.middle {
  width: 190px;
  height: 64px;
  background: linear-gradient(180deg, #9c6bef, #8c4fe0);
  margin-top: -8px;
}
.tier.top {
  width: 140px;
  height: 52px;
  background: linear-gradient(180deg, #ffd766, #ffc93c);
  margin-top: -8px;
}
.drip {
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 14px;
  background-repeat: repeat-x;
  background-size: 24px 14px;
}
.tier.bottom .drip {
  background-image: radial-gradient(
    circle at 50% 0,
    #ffd1e4 6px,
    transparent 7px
  );
}
.tier.middle .drip {
  background-image: radial-gradient(
    circle at 50% 0,
    #d7bbfb 6px,
    transparent 7px
  );
}
.tier.top .drip {
  background-image: radial-gradient(
    circle at 50% 0,
    #ffebae 6px,
    transparent 7px
  );
}

.candles {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  z-index: 5;
}
.candle {
  width: 8px;
  height: 46px;
  background: linear-gradient(180deg, #fff, #ffead1);
  border-radius: 3px;
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.candle:nth-child(2n) {
  background: linear-gradient(180deg, #fff, #d8f3ff);
}
.flame {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 20px;
  background: radial-gradient(
    circle at 50% 70%,
    #fff7b0 0%,
    #ffb238 45%,
    #ff6a1a 80%
  );
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: flicker 1.1s infinite ease-in-out;
  transform-origin: bottom center;
  filter: drop-shadow(0 0 6px rgba(255, 178, 56, 0.8));
  z-index: 6;
}
.flame::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 50%;
  width: 60px;
  height: 26px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 200, 90, 0.35) 0%,
    rgba(255, 200, 90, 0) 70%
  );
  pointer-events: none;
  z-index: -1;
}
@keyframes flicker {
  0%,
  100% {
    transform: translateX(-50%) scale(1) rotate(-2deg);
  }
  50% {
    transform: translateX(-50%) scale(1.08) rotate(3deg);
  }
}
.flame.out {
  animation: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.smoke {
  position: absolute;
  top: -24px;
  left: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  pointer-events: none;
}

.hint {
  margin-top: 14px;
  font-size: 0.92rem;
  color: rgba(255, 246, 236, 0.65);
  min-height: 1.4em;
}

.blow-btn {
  margin-top: 26px;
  font-family: "Baloo 2";
  font-weight: 700;
  font-size: 1.05rem;
  background: linear-gradient(90deg, var(--pink), var(--violet));
  color: #fff;
  border: none;
  padding: 14px 34px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(255, 79, 154, 0.35);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}
.blow-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  box-shadow: 0 0 0 0 rgba(255, 79, 154, 0.55);
  animation: pulseRing 2.4s ease-out infinite;
}
@keyframes pulseRing {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 79, 154, 0.45);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(255, 79, 154, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 79, 154, 0);
  }
}
.blow-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(255, 79, 154, 0.45);
}
.blow-btn:active {
  transform: translateY(0) scale(0.97);
}
.blow-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
  box-shadow: none;
}
.blow-btn:disabled::after {
  animation: none;
  box-shadow: none;
}
.blow-btn:focus-visible,
.polaroid:focus-visible,
.music-toggle:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 3px;
}

.wish-panel {
  margin-top: 42px;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 30px 26px;
  backdrop-filter: blur(6px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.wish-panel.show {
  opacity: 1;
  transform: none;
}
.wish-panel h2 {
  font-size: 1.6rem;
  margin: 0 0 12px;
  color: var(--gold);
}
.wish-panel p {
  margin: 0;
  line-height: 1.75;
  font-size: 1.05rem;
  color: rgba(255, 246, 236, 0.92);
}

.signature {
  margin-top: 34px;
  font-family: "Baloo 2";
  font-size: 1rem;
  color: var(--sky);
}

/* GALLERY */
.gallery-title {
  margin: 64px 0 26px;
  font-size: clamp(1.3rem, 4vw, 1.9rem);
  color: var(--gold);
}
.gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 36px 26px;
  padding: 14px 6px 0;
}
.photo-item {
  width: 150px;
  text-align: center;
  opacity: 0;
  animation: popIn 0.6s ease both;
  animation-delay: var(--d, 0s);
  transition: transform 0.35s ease;
}
@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.photo-item:hover {
  transform: translateY(-6px);
}

.photo-orbit {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto;
  animation: floatBob 4.5s ease-in-out infinite;
  animation-delay: var(--float-delay, 0s);
}
@keyframes floatBob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-9px);
  }
}

.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    var(--pink),
    var(--gold),
    var(--sky),
    var(--violet),
    var(--pink)
  );
  animation: ringSpin var(--ring-dur, 6s) linear infinite;
  animation-direction: var(--spin-dir, normal);
  transition: box-shadow 0.35s ease;
}
@keyframes ringSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
.photo-item:hover .ring {
  animation-play-state: paused;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.06),
    0 0 26px 6px rgba(255, 79, 154, 0.5);
}

.photo-inner {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--plum-deep);
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.35, 1.2);
}
.photo-item:hover .photo-inner {
  transform: scale(1.08);
}
.photo-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  background: linear-gradient(135deg, #ffd9ec, #e4d3ff);
}
.photo-inner::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -160%;
  width: 55%;
  height: 220%;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(255, 255, 255, 0.65),
    transparent
  );
  transform: rotate(20deg);
  transition: left 0.7s ease;
  pointer-events: none;
}
.photo-item:hover .photo-inner::after {
  left: 160%;
}

.photo-item figcaption {
  font-family: "Baloo 2";
  font-weight: 600;
  color: var(--cream);
  font-size: 0.85rem;
  margin-top: 14px;
  line-height: 1.3;
  opacity: 0.85;
  transition:
    opacity 0.3s ease,
    color 0.3s ease;
}
.photo-item:hover figcaption {
  opacity: 1;
  color: var(--gold);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(20, 5, 30, 0.86);
  backdrop-filter: blur(4px);
  padding: 24px;
  cursor: zoom-out;
}
.lightbox.open {
  display: flex;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.lightbox img {
  max-width: min(90vw, 520px);
  max-height: 80vh;
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: zoomIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes zoomIn {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
.lightbox figcaption {
  position: absolute;
  bottom: 8vh;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Baloo 2";
  color: var(--cream);
  font-size: 1rem;
}

/* MUSIC TOGGLE */
.music-toggle {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 60;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--violet), var(--pink));
  color: #fff;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(140, 79, 224, 0.45);
  transition: transform 0.2s ease;
}
.music-toggle:hover {
  transform: scale(1.08);
}
.music-toggle.playing {
  animation: spinSlow 6s linear infinite;
}
@keyframes spinSlow {
  from {
    transform: rotate(0);
  }
  to {
    transform: rotate(360deg);
  }
}

footer {
  margin-top: 60px;
  font-size: 0.82rem;
  color: rgba(255, 246, 236, 0.4);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 640px) {
  .wrap {
    padding: 44px 16px 90px;
  }
  .cake-stage {
    width: 220px;
    height: 220px;
    transform: scale(0.92);
  }
  .gallery {
    gap: 30px 18px;
  }
  .photo-item {
    width: 42vw;
    max-width: 150px;
  }
  .photo-orbit {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
  }
  .wish-panel {
    padding: 24px 18px;
  }
  .music-toggle {
    width: 46px;
    height: 46px;
    bottom: 16px;
    right: 16px;
    font-size: 1.1rem;
  }
}
@media (max-width: 380px) {
  .cake-stage {
    transform: scale(0.8);
    margin-top: 30px;
  }
  .blow-btn {
    padding: 12px 26px;
    font-size: 0.95rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .balloon,
  .flame,
  .heart-float,
  h1.title,
  .eyebrow,
  .name-input-row,
  .subtitle,
  .cake-stage,
  .photo-item,
  .photo-orbit,
  .ring,
  .glow-orb,
  .music-toggle.playing,
  .blow-btn::after {
    animation: none !important;
  }
}
.birthday-display {
  margin-top: 8px;
  font-family: "Baloo 2", cursive;
  font-weight: 700;
  font-size: clamp(0.95rem, 3vw, 1.15rem);
  letter-spacing: 0.02em;
  display: inline-block;
  background: linear-gradient(
    90deg,
    #ff4f9a,
    #ffc93c,
    #4ed0f1,
    #8c4fe0,
    #ff8fc7,
    #4ed0f1,
    #ffc93c
  );
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation:
    rainbowShift 5s linear infinite,
    fadeUp 0.9s ease 0.25s both;
}
@keyframes rainbowShift {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 300% center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .birthday-display {
    animation: none !important;
  }
}
