* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", Arial, sans-serif;
  background: #dff3ff;
  color: #20445c;
  overflow: hidden;
}

button {
  border: none;
  cursor: pointer;
  padding: 14px 28px;
  border-radius: 999px;
  background: #4aa3df;
  color: white;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(74, 163, 223, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(74, 163, 223, 0.45);
}

.app {
  width: 100vw;
  height: 100vh;
  position: relative;
}

.scene {
  width: 100vw;
  height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #dff3ff, #b8e6ff, #f5fbff);
  overflow: hidden;
  padding: 40px;
}

.scene.active {
  display: flex;
  animation: fadeIn 0.7s ease forwards;
}

.card,
.letter-card,
.gallery-layout {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  border-radius: 32px;
  padding: 42px;
  max-width: 780px;
  text-align: center;
  box-shadow: 0 25px 70px rgba(51, 126, 169, 0.22);
  border: 2px solid rgba(255, 255, 255, 0.7);
  position: relative;
  z-index: 2;
}

.opening-card h1 {
  font-size: 42px;
  margin-bottom: 12px;
}

.card h2,
.letter-card h2,
.gallery-layout h2 {
  font-size: 36px;
  margin-bottom: 18px;
}

.card p,
.letter-card p,
.gallery-layout p {
  font-size: 19px;
  line-height: 1.7;
  margin-bottom: 20px;
}

.cat-gif {
  width: 150px;
  height: 150px;
  object-fit: contain;
  margin-bottom: 18px;
}

.cat-gif.large {
  width: 220px;
  height: 220px;
}

.countdown-number {
  font-size: 180px;
  font-weight: 900;
  color: #1976b8;
  text-shadow: 0 14px 35px rgba(25, 118, 184, 0.25);
  animation: pop 0.7s ease infinite alternate;
}

.small-text {
  position: absolute;
  margin-top: 250px;
  font-size: 24px;
  color: #326783;
}

.balloons span {
  position: absolute;
  bottom: -80px;
  font-size: 70px;
  animation: floatBalloon 5s linear infinite;
}

.balloons span:nth-child(1) {
  left: 10%;
  animation-delay: 0s;
}

.balloons span:nth-child(2) {
  left: 25%;
  animation-delay: 1s;
}

.balloons span:nth-child(3) {
  left: 50%;
  animation-delay: 0.5s;
}

.balloons span:nth-child(4) {
  left: 72%;
  animation-delay: 1.5s;
}

.balloons span:nth-child(5) {
  left: 88%;
  animation-delay: 0.2s;
}

.scene-kicker {
  display: inline-block;
  margin-bottom: 10px;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(74, 163, 223, 0.14);
  color: #2876a7;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.2px;
  line-height: 1;
  text-transform: uppercase;
}

#cakeScene {
  padding: 28px;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.88), transparent 28%),
    radial-gradient(circle at 82% 22%, rgba(255, 214, 236, 0.34), transparent 25%),
    radial-gradient(circle at 50% 90%, rgba(97, 178, 229, 0.32), transparent 36%),
    linear-gradient(135deg, #dff3ff, #b9e8ff 55%, #f7fcff);
}

.cake-card {
  width: min(960px, 94vw);
  padding: 30px 44px 34px;
  overflow: visible;
}

.cake-card h2 {
  margin-bottom: 8px;
}

.cake-card p:not(.scene-kicker) {
  margin-bottom: 14px;
}

.cake-showcase {
  position: relative;
  width: min(760px, 100%);
  height: 382px;
  margin: 8px auto 16px;
}

.birthday-cake {
  position: absolute;
  left: 50%;
  bottom: 20px;
  width: 430px;
  height: 315px;
  transform: translateX(-50%);
  filter: drop-shadow(0 26px 35px rgba(37, 92, 128, 0.2));
  z-index: 4;
}

.cake-tier {
  position: absolute;
  left: 50%;
  overflow: hidden;
  transform: translateX(-50%);
  border: 4px solid rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 -12px 0 rgba(38, 112, 160, 0.08);
}

.cake-tier::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  height: 16px;
  opacity: 0.36;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 20px,
    rgba(255, 255, 255, 0.85) 20px 28px,
    transparent 28px 48px
  );
}

.cake-tier-top {
  bottom: 178px;
  width: 245px;
  height: 82px;
  z-index: 5;
  border-radius: 34px 34px 24px 24px;
  background: linear-gradient(180deg, #aee6ff, #7fc8f3);
}

.cake-tier-middle {
  bottom: 88px;
  width: 340px;
  height: 108px;
  z-index: 4;
  border-radius: 38px 38px 26px 26px;
  background: linear-gradient(180deg, #d9f5ff, #9bdcff);
}

.cake-tier-bottom {
  bottom: 0;
  width: 420px;
  height: 125px;
  z-index: 3;
  border-radius: 44px 44px 30px 30px;
  background: linear-gradient(180deg, #9ddcff, #6ebeed);
}

.frosting {
  position: absolute;
  top: -3px;
  left: -2%;
  width: 104%;
  height: 34px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 18% 30px, #ffffff 0 15px, transparent 16px),
    radial-gradient(circle at 38% 31px, #ffffff 0 20px, transparent 21px),
    radial-gradient(circle at 61% 31px, #ffffff 0 17px, transparent 18px),
    radial-gradient(circle at 82% 29px, #ffffff 0 18px, transparent 19px),
    linear-gradient(180deg, #ffffff, #eaf8ff);
  box-shadow: 0 8px 14px rgba(82, 164, 215, 0.13);
  z-index: 2;
}

.frosting-middle {
  height: 38px;
}

.frosting-bottom {
  height: 42px;
}

.cake-plate {
  position: absolute;
  left: 50%;
  bottom: -16px;
  width: 470px;
  height: 34px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #cfefff);
  box-shadow: 0 18px 26px rgba(40, 105, 145, 0.16);
  z-index: 1;
}

.cake-candles {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 220px;
  height: 112px;
  transform: translateX(-50%);
  z-index: 8;
}

.candle {
  position: absolute;
  bottom: 0;
  width: 20px;
  height: 76px;
  border-radius: 10px 10px 6px 6px;
  background: repeating-linear-gradient(
    45deg,
    #ffffff,
    #ffffff 8px,
    #79c7f6 8px,
    #79c7f6 16px
  );
  box-shadow: inset -3px 0 rgba(34, 110, 158, 0.12);
}

.candle-main {
  left: 50%;
  width: 24px;
  height: 92px;
  transform: translateX(-50%);
}

.candle-left {
  left: 52px;
  transform: rotate(-6deg);
}

.candle-right {
  right: 52px;
  transform: rotate(6deg);
}

.cake-flame {
  position: absolute;
  top: -34px;
  left: 50%;
  width: 21px;
  height: 31px;
  border-radius: 48% 52% 45% 55%;
  background:
    radial-gradient(circle at 50% 62%, #ffffff 0 20%, transparent 22%),
    radial-gradient(circle at 50% 45%, #ffe995 0 34%, #ffbf47 55%, #ff7b5c 82%);
  box-shadow:
    0 0 16px rgba(255, 190, 72, 0.74),
    0 0 34px rgba(255, 167, 80, 0.48);
  transform: translateX(-50%) rotate(-2deg) scale(1);
  transform-origin: center bottom;
  animation: candleFlicker 0.85s ease-in-out infinite alternate;
  transition: opacity 0.3s ease, transform 0.3s ease, filter 0.3s ease;
}

.flame {
  top: -43px;
  width: 29px;
  height: 43px;
}

.flame-small {
  animation-delay: 0.18s;
}

.cake-flame.off {
  opacity: 0;
  filter: blur(3px);
  transform: translateX(-50%) translateY(12px) scale(0.18);
  animation: none;
}

.candle-smoke {
  position: absolute;
  top: -58px;
  left: 50%;
  width: 96px;
  height: 88px;
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
}

.candle-smoke.active {
  opacity: 1;
}

.candle-smoke span {
  position: absolute;
  bottom: 5px;
  left: 44px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(142, 184, 205, 0.82);
  filter: blur(1px);
  opacity: 0;
  animation: none;
}

.candle-smoke.active span {
  animation: smokePuff 1.7s ease-out forwards;
}

.candle-smoke span:nth-child(2) {
  left: 28px;
}

.candle-smoke span:nth-child(3) {
  left: 56px;
}

.candle-smoke.active span:nth-child(2) {
  animation-delay: 0.14s;
}

.candle-smoke.active span:nth-child(3) {
  animation-delay: 0.28s;
}

.sprinkle,
.cream-dot {
  position: absolute;
  z-index: 3;
}

.sprinkle {
  width: 28px;
  height: 7px;
  border-radius: 999px;
  background: #ff9fc7;
}

.cream-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 0 rgba(66, 142, 192, 0.08);
}

.sprinkle-one { top: 44px; left: 44px; transform: rotate(16deg); }
.sprinkle-two { top: 52px; right: 48px; transform: rotate(-18deg); background: #ffcc70; }
.sprinkle-three { top: 33px; left: 120px; transform: rotate(-8deg); background: #77d8a8; }
.sprinkle-four { top: 60px; left: 168px; transform: rotate(18deg); background: #9d9bff; }
.sprinkle-five { top: 68px; left: 74px; transform: rotate(-14deg); background: #ffcc70; }
.sprinkle-six { top: 82px; left: 188px; transform: rotate(18deg); background: #ff9fc7; }
.sprinkle-seven { top: 68px; right: 82px; transform: rotate(-12deg); background: #77d8a8; }
.sprinkle-eight { top: 96px; right: 172px; transform: rotate(10deg); background: #9d9bff; }

.dot-one { top: 54px; left: 58px; }
.dot-two { top: 72px; left: 136px; }
.dot-three { top: 56px; right: 126px; }
.dot-four { top: 78px; right: 54px; }

.cake-cat {
  position: absolute;
  bottom: 16px;
  width: 138px;
  height: 138px;
  object-fit: contain;
  z-index: 5;
  filter: drop-shadow(0 16px 18px rgba(34, 91, 127, 0.14));
  animation: catPeek 2.8s ease-in-out infinite alternate;
}

.cake-cat-left {
  left: 8px;
}

.cake-cat-right {
  right: 8px;
  animation-delay: 0.5s;
}

.cake-balloon {
  position: absolute;
  top: 34px;
  width: 58px;
  height: 70px;
  border-radius: 50% 50% 46% 46%;
  background: linear-gradient(145deg, #ffffff 8%, #9bdcff 52%, #65b8ec);
  box-shadow: inset -10px -10px 0 rgba(48, 127, 178, 0.08), 0 16px 28px rgba(49, 121, 165, 0.12);
  animation: balloonBob 3.2s ease-in-out infinite alternate;
}

.cake-balloon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 70px;
  width: 1px;
  height: 120px;
  background: rgba(57, 121, 160, 0.34);
  transform: translateX(-50%);
}

.cake-balloon-left {
  left: 82px;
}

.cake-balloon-right {
  right: 82px;
  background: linear-gradient(145deg, #ffffff 8%, #ffd3e7 56%, #f2a7c9);
  animation-delay: 0.8s;
}

.cake-star {
  position: absolute;
  width: 18px;
  height: 18px;
  background: #ffffff;
  clip-path: polygon(50% 0, 62% 35%, 100% 50%, 62% 65%, 50% 100%, 38% 65%, 0 50%, 38% 35%);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.9);
  animation: cakeTwinkle 1.7s ease-in-out infinite alternate;
}

.star-one { left: 20%; top: 27%; }
.star-two { right: 21%; top: 24%; animation-delay: 0.4s; }
.star-three { left: 52%; top: 5%; animation-delay: 0.9s; }

.floating-heart {
  position: absolute;
  width: 18px;
  height: 18px;
  transform: rotate(-45deg);
  background: #ff9fc7;
  opacity: 0.75;
  animation: heartFloat 3.6s ease-in-out infinite;
}

.floating-heart::before,
.floating-heart::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: inherit;
}

.floating-heart::before {
  top: -9px;
  left: 0;
}

.floating-heart::after {
  top: 0;
  left: 9px;
}

.heart-one { left: 14%; top: 54%; }
.heart-two { right: 14%; top: 50%; animation-delay: 0.9s; background: #8fd6ff; }
.heart-three { right: 31%; top: 12%; animation-delay: 1.5s; background: #ffc8a2; }

.cake-confetti span,
.blow-sparkle-field span {
  position: absolute;
  display: block;
  pointer-events: none;
}

.cake-confetti span {
  width: 10px;
  height: 18px;
  border-radius: 3px;
  background: #ffffff;
  opacity: 0.72;
  animation: cakeConfetti 5.4s linear infinite;
}

.cake-confetti span:nth-child(1) { left: 8%; top: -20px; background: #ffb6d6; animation-delay: 0s; }
.cake-confetti span:nth-child(2) { left: 17%; top: -20px; background: #ffffff; animation-delay: 1s; }
.cake-confetti span:nth-child(3) { left: 28%; top: -20px; background: #8ed7ff; animation-delay: 2.2s; }
.cake-confetti span:nth-child(4) { left: 39%; top: -20px; background: #ffe18c; animation-delay: 0.7s; }
.cake-confetti span:nth-child(5) { left: 52%; top: -20px; background: #b7f2cf; animation-delay: 1.6s; }
.cake-confetti span:nth-child(6) { left: 63%; top: -20px; background: #ffb6d6; animation-delay: 2.9s; }
.cake-confetti span:nth-child(7) { left: 73%; top: -20px; background: #ffffff; animation-delay: 0.4s; }
.cake-confetti span:nth-child(8) { left: 83%; top: -20px; background: #8ed7ff; animation-delay: 1.9s; }
.cake-confetti span:nth-child(9) { left: 91%; top: -20px; background: #ffe18c; animation-delay: 2.6s; }
.cake-confetti span:nth-child(10) { left: 46%; top: -20px; background: #b7f2cf; animation-delay: 3.3s; }

.mini-countdown {
  width: 165px;
  height: 165px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.18) 34%, transparent 36%),
    linear-gradient(145deg, #f8fcff, #bfeaff);
  font-weight: 900;
  color: #1976b8;
  font-size: 112px;
  line-height: 1;
  margin: 8px auto 26px;
  box-shadow:
    0 22px 45px rgba(56, 131, 179, 0.2),
    inset 0 0 0 2px rgba(255, 255, 255, 0.8);
  text-shadow: 0 8px 20px rgba(25, 118, 184, 0.16);
  animation: countdownGlow 0.85s ease-in-out infinite alternate;
  transition: background 0.35s ease, color 0.35s ease, font-size 0.35s ease;
}

#blowScene {
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 255, 255, 0.84), transparent 26%),
    radial-gradient(circle at 20% 75%, rgba(255, 211, 231, 0.32), transparent 25%),
    linear-gradient(135deg, #dff3ff, #c7efff, #f7fcff);
}

.blow-card {
  width: min(620px, 90vw);
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.blow-card::before {
  content: "";
  position: absolute;
  inset: 36px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(123, 191, 233, 0.18), transparent 66%);
  z-index: -1;
  animation: softPulse 2.4s ease-in-out infinite alternate;
}

.blow-card #wishText {
  max-width: 470px;
  margin: 0 auto;
  color: #326783;
  transition: color 0.35s ease, transform 0.35s ease;
}

.blow-card.wish-revealed .mini-countdown {
  background: linear-gradient(145deg, #6ebeed, #9bdcff);
  color: #ffffff;
  font-size: 70px;
  box-shadow:
    0 0 34px rgba(123, 191, 233, 0.6),
    0 22px 45px rgba(56, 131, 179, 0.2);
  animation: wishPulse 1.4s ease-in-out infinite alternate;
}

.blow-card.wish-revealed #wishText {
  color: #1f5778;
  transform: translateY(-2px);
  animation: wishTextReveal 0.9s ease both;
}

.blow-sparkle-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.blow-sparkle-field span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.9);
  opacity: 0.58;
  animation: sparkleDrift 3.8s ease-in-out infinite;
}

.blow-sparkle-field span:nth-child(1) { left: 24%; top: 25%; animation-delay: 0s; }
.blow-sparkle-field span:nth-child(2) { left: 34%; top: 70%; animation-delay: 0.8s; background: #c8efff; }
.blow-sparkle-field span:nth-child(3) { left: 66%; top: 28%; animation-delay: 1.4s; background: #ffd4e8; }
.blow-sparkle-field span:nth-child(4) { left: 74%; top: 66%; animation-delay: 2s; background: #fff0ad; }
.blow-sparkle-field span:nth-child(5) { left: 50%; top: 16%; animation-delay: 2.6s; background: #ffffff; }

.letter-card {
  max-width: 850px;
  text-align: left;
}

.letter-card h2 {
  text-align: center;
}

.letter-card button {
  display: block;
  margin: 28px auto 0;
}

.gallery-layout {
  width: 900px;
}

.polaroid {
  width: 420px;
  background: white;
  padding: 18px 18px 30px;
  border-radius: 18px;
  margin: 20px auto;
  transform: rotate(-2deg);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
}

.polaroid img {
  width: 100%;
  height: 420px;
  object-fit: cover;
  border-radius: 12px;
  background: #eaf7ff;
}

.polaroid p {
  font-size: 17px;
  color: #24485f;
  margin-top: 14px;
  margin-bottom: 0;
}

.gallery-buttons {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 20px;
}

.secondary-btn {
  margin-top: 8px;
  background: #7bbfe9;
  align-self: center;
  padding: 12px 26px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(1.03);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pop {
  from {
    transform: scale(0.88);
  }
  to {
    transform: scale(1.08);
  }
}

@keyframes floatBalloon {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  100% {
    transform: translateY(-120vh) rotate(12deg);
    opacity: 0;
  }
}

@keyframes flicker {
  from {
    transform: translateX(-50%) scale(0.9);
    opacity: 0.85;
  }
  to {
    transform: translateX(-50%) scale(1.12);
    opacity: 1;
  }
}

@keyframes candleFlicker {
  0% {
    transform: translateX(-50%) rotate(-3deg) scale(0.92);
    border-radius: 48% 52% 44% 56%;
  }
  100% {
    transform: translateX(-50%) rotate(4deg) scale(1.08);
    border-radius: 56% 44% 52% 48%;
  }
}

@keyframes smokePuff {
  0% {
    opacity: 0;
    transform: translate(0, 8px) scale(0.55);
  }
  25% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: translate(-18px, -52px) scale(1.9);
  }
}

@keyframes catPeek {
  from {
    transform: translateY(0) rotate(-1deg);
  }
  to {
    transform: translateY(-10px) rotate(1deg);
  }
}

@keyframes balloonBob {
  from {
    transform: translateY(0) rotate(-3deg);
  }
  to {
    transform: translateY(-14px) rotate(3deg);
  }
}

@keyframes cakeTwinkle {
  from {
    opacity: 0.35;
    transform: scale(0.75) rotate(0deg);
  }
  to {
    opacity: 1;
    transform: scale(1.15) rotate(22deg);
  }
}

@keyframes heartFloat {
  0%, 100% {
    opacity: 0.32;
    transform: translateY(14px) rotate(-45deg) scale(0.75);
  }
  50% {
    opacity: 0.82;
    transform: translateY(-18px) rotate(-45deg) scale(1);
  }
}

@keyframes cakeConfetti {
  0% {
    opacity: 0;
    transform: translateY(-10vh) rotate(0deg);
  }
  12% {
    opacity: 0.78;
  }
  100% {
    opacity: 0;
    transform: translateY(112vh) rotate(240deg);
  }
}

@keyframes countdownGlow {
  from {
    transform: scale(0.96);
  }
  to {
    transform: scale(1.04);
  }
}

@keyframes softPulse {
  from {
    opacity: 0.45;
    transform: scale(0.94);
  }
  to {
    opacity: 0.85;
    transform: scale(1.04);
  }
}

@keyframes wishPulse {
  from {
    transform: scale(0.97);
  }
  to {
    transform: scale(1.03);
  }
}

@keyframes wishTextReveal {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(-2px);
  }
}

@keyframes sparkleDrift {
  0%, 100% {
    opacity: 0.18;
    transform: translateY(10px) scale(0.7);
  }
  50% {
    opacity: 0.85;
    transform: translateY(-16px) scale(1);
  }
}

@media (max-width: 900px) {
  .card,
  .letter-card,
  .gallery-layout {
    width: 92vw;
    padding: 28px;
  }

  .opening-card h1,
  .card h2,
  .letter-card h2,
  .gallery-layout h2 {
    font-size: 28px;
  }

  .polaroid {
    width: 300px;
  }

  .polaroid img {
    height: 300px;
  }

  .countdown-number {
    font-size: 120px;
  }
}

/* ===== Upgraded Gallery ===== */

#galleryScene {
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), transparent 32%),
    radial-gradient(circle at bottom right, rgba(102, 184, 236, 0.35), transparent 34%),
    linear-gradient(135deg, #dff3ff, #b9e8ff, #edf9ff);
}

.gallery-scene-bg {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upgraded-gallery {
  width: min(1120px, 92vw);
  max-width: min(1120px, 92vw);
  height: min(720px, calc(100vh - 48px));
  padding: 22px 34px 18px;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.92), rgba(240,249,255,0.78));
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow:
    0 30px 90px rgba(45, 118, 164, 0.25),
    inset 0 0 0 1px rgba(255,255,255,0.65);
}

.gallery-header {
  text-align: center;
  margin-bottom: 12px;
}

.gallery-kicker {
  display: inline-block;
  margin-bottom: 6px;
  padding: 6px 15px;
  border-radius: 999px;
  background: rgba(74, 163, 223, 0.14);
  color: #2876a7;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.gallery-header h2 {
  font-size: 34px;
  margin-bottom: 4px;
  color: #173d59;
}

.gallery-subtitle {
  color: #416982;
  font-size: 15px;
  margin-bottom: 0;
}

.memory-stage {
  position: relative;
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 150px 58px minmax(420px, 1fr) 58px 150px;
  align-items: center;
  gap: 12px;
}

.side-album {
  min-height: 318px;
  padding: 14px 10px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 0 0 1px rgba(123, 191, 233, 0.08);
}

.side-album p {
  margin-bottom: 10px;
  color: #2f6c91;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.7px;
  line-height: 1.2;
  text-transform: uppercase;
}

.mini-photo-rail {
  position: relative;
  height: 270px;
}

.mini-memory-frame {
  position: absolute;
  left: 50%;
  width: 92px;
  height: 100px;
  padding: 6px 6px 15px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 12px 25px rgba(39, 103, 144, 0.14);
  transform: translateX(-50%) rotate(var(--tilt));
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
  opacity: 0.76;
}

.mini-memory-frame:nth-child(1) { top: 2px; --tilt: -7deg; }
.mini-memory-frame:nth-child(2) { top: 65px; --tilt: 5deg; }
.mini-memory-frame:nth-child(3) { top: 128px; --tilt: -4deg; }
.mini-memory-frame:nth-child(4) { top: 191px; --tilt: 6deg; }

.mini-memory-frame img {
  width: 100%;
  height: 68px;
  object-fit: cover;
  border-radius: 10px;
  background: #eaf7ff;
  display: block;
}

.mini-memory-frame.active {
  opacity: 1;
  z-index: 3;
  box-shadow: 0 18px 32px rgba(39, 103, 144, 0.22);
  transform: translateX(-50%) rotate(0deg) scale(1.07);
}

.photo-stack {
  position: relative;
  width: 438px;
  height: 352px;
  margin: 0 auto;
}

.back-polaroid {
  position: absolute;
  width: 350px;
  height: 300px;
  left: 44px;
  top: 38px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 18px 45px rgba(36, 80, 112, 0.18);
}

.back-one {
  transform: rotate(-8deg) translateX(-44px);
  background:
    linear-gradient(#ffffff, #ffffff),
    linear-gradient(135deg, #caefff, #ffffff);
}

.back-two {
  transform: rotate(7deg) translateX(44px);
  background:
    linear-gradient(#ffffff, #ffffff),
    linear-gradient(135deg, #ffffff, #d5f3ff);
}

.main-polaroid {
  position: absolute;
  inset: 0;
  width: 416px;
  min-height: 350px;
  margin: auto;
  background: #ffffff;
  padding: 18px 18px 22px;
  border-radius: 24px;
  transform: rotate(-1.2deg);
  box-shadow:
    0 28px 70px rgba(30, 87, 122, 0.28),
    0 0 0 1px rgba(70, 150, 205, 0.08);
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.main-polaroid:hover {
  transform: rotate(0deg) translateY(-6px);
}

.photo-label-row {
  position: absolute;
  top: -17px;
  left: 24px;
  right: 24px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.photo-label {
  padding: 8px 16px;
  border-radius: 999px;
  background: #4aa3df;
  color: white;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(74, 163, 223, 0.35);
}

.photo-category {
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff1f7;
  color: #bb5f88;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(186, 95, 136, 0.13);
}

.photo-category.is-solo {
  background: #eaf8ff;
  color: #2475a8;
}

.main-polaroid img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: center;
  border-radius: 18px;
  background: #eaf7ff;
  display: block;
}

.main-polaroid p {
  min-height: 48px;
  margin: 12px 8px 0;
  color: #23475f;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 600;
}

.gallery-nav {
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 50%;
  font-size: 28px;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: #277aad;
  box-shadow: 0 14px 34px rgba(35, 94, 130, 0.18);
  border: 2px solid rgba(74, 163, 223, 0.18);
}

.gallery-nav:hover {
  background: #4aa3df;
  color: #ffffff;
}

.left-nav {
  justify-self: end;
}

.right-nav {
  justify-self: start;
}

.gallery-dots {
  display: flex;
  justify-content: center;
  align-self: center;
  position: relative;
  z-index: 6;
  gap: 9px;
  margin: 0 0 10px;
}

.gallery-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(40, 118, 167, 0.22);
  transition: width 0.25s ease, background 0.25s ease;
}

.gallery-dot.active {
  width: 28px;
  background: #4aa3df;
}

.floating-note {
  position: absolute;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(255,255,255,0.85);
  border-radius: 18px;
  color: #326783;
  font-weight: 800;
  box-shadow: 0 14px 35px rgba(36, 92, 130, 0.12);
  animation: softFloat 4s ease-in-out infinite alternate;
}

.note-1 {
  top: 12%;
  left: 9%;
  transform: rotate(-5deg);
}

.note-2 {
  right: 10%;
  bottom: 13%;
  transform: rotate(5deg);
  animation-delay: 1s;
}

@keyframes softFloat {
  from {
    transform: translateY(0) rotate(-5deg);
  }
  to {
    transform: translateY(-12px) rotate(-2deg);
  }
}

@media (max-width: 1000px) {
  .upgraded-gallery {
    height: min(700px, calc(100vh - 32px));
    padding: 24px;
  }

  .memory-stage {
    grid-template-columns: 58px 1fr 58px;
  }

  .side-album {
    display: none;
  }

  .photo-stack {
    width: 420px;
    height: 440px;
  }

  .main-polaroid {
    width: 400px;
    min-height: 440px;
  }

  .back-polaroid {
    width: 350px;
    height: 380px;
  }

  .main-polaroid img {
    height: 290px;
  }

  .floating-note {
    display: none;
  }
}
