/* Reset and Core Setup */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-peach: #fdeade;
  --bg-gradient: linear-gradient(135deg, #fdeade 0%, #fae1d6 50%, #fbd5c6 100%);
  --primary-pink: #ff6b8b;
  --secondary-pink: #ff8e9e;
  --text-dark: #6b3e3e;
  --text-bold: #4a2828;
  --gold-glow: #ffd700;
  --shadow-soft: 0 10px 30px rgba(107, 62, 62, 0.12);
  --shadow-card: 0 15px 35px rgba(255, 107, 139, 0.15);
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg-gradient);
  color: var(--text-dark);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  touch-action: manipulation;
}

/* Canvas Confetti */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 99;
}

/* Floating Balloons Layer */
#balloons-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}

.balloon {
  position: absolute;
  bottom: -100px;
  width: 50px;
  height: 65px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  cursor: pointer;
  pointer-events: auto;
  animation: floatUp 12s linear infinite;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.15));
  transition: transform 0.2s ease;
}

.balloon:active {
  transform: scale(1.15);
}

.balloon::after {
  content: '';
  position: absolute;
  bottom: -16px;
  width: 2px;
  height: 20px;
  background: rgba(100, 100, 100, 0.4);
}

.balloon-knot {
  position: absolute;
  bottom: -4px;
  width: 8px;
  height: 6px;
  border-radius: 3px;
  background: inherit;
}

.balloon-shine {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 10px;
  height: 16px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transform: rotate(-30deg);
}

@keyframes floatUp {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0.9;
  }
  50% {
    transform: translateY(-50vh) rotate(5deg);
  }
  100% {
    transform: translateY(-110vh) rotate(-5deg);
    opacity: 1;
  }
}

/* Audio Control Button */
.audio-control-wrapper {
  position: fixed;
  top: 15px;
  right: 15px;
  z-index: 100;
}

.audio-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid var(--primary-pink);
  color: var(--primary-pink);
  padding: 8px 16px;
  border-radius: 30px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 107, 139, 0.25);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.audio-btn:hover, .audio-btn:active {
  transform: scale(1.05);
  background: var(--primary-pink);
  color: white;
}

.audio-btn.playing {
  background: var(--primary-pink);
  color: white;
  animation: pulseBtn 2s infinite;
}

@keyframes pulseBtn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 139, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(255, 107, 139, 0); }
}

/* Main Layout Container */
.main-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  position: relative;
  z-index: 10;
}

/* Bunting Header */
.bunting-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.bunting-string {
  display: flex;
  justify-content: center;
  gap: 8px;
  position: relative;
  width: 100%;
}

.bunting-string::before {
  content: '';
  position: absolute;
  top: 0;
  left: 5%;
  right: 5%;
  height: 2px;
  background: #8fa382;
  z-index: 1;
}

.flag {
  width: 32px;
  height: 42px;
  background: #78ab9c;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 4px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: white;
  z-index: 2;
  transform-origin: top center;
  animation: sway 3s ease-in-out infinite alternate;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.flag:nth-child(even) {
  background: #de8875;
  animation-delay: -1.5s;
}
.flag:nth-child(3n) {
  background: #eed885;
  color: #574621;
}
.flag:nth-child(4n) {
  background: #95c4cf;
}

@keyframes sway {
  0% { transform: rotate(-6deg); }
  100% { transform: rotate(6deg); }
}

/* Hero Section */
.hero-section {
  text-align: center;
  margin-top: -5px;
}

.crown-badge {
  font-size: 2rem;
  animation: bounce 2s infinite;
  display: inline-block;
}

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

.name-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--primary-pink);
  text-shadow: 3px 3px 0px rgba(255, 255, 255, 0.9), 0 8px 20px rgba(255, 107, 139, 0.3);
  margin: -5px 0 5px;
}

.typewriter-container {
  font-family: 'Dancing Script', cursive;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-dark);
  min-height: 2.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cursor {
  animation: blink 0.8s infinite;
  color: var(--primary-pink);
  margin-left: 2px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Cake Section */
.cake-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.cake-instruction-badge {
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px dashed var(--primary-pink);
  color: var(--text-bold);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-soft);
  animation: floatBadge 3s ease-in-out infinite alternate;
}

@keyframes floatBadge {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

.cake-wrapper {
  position: relative;
  width: 220px;
  height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  cursor: pointer;
  margin-top: 10px;
}

/* Candles */
.candles-row {
  display: flex;
  gap: 18px;
  margin-bottom: -5px;
  z-index: 5;
}

.candle {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.stick {
  width: 10px;
  height: 42px;
  background: repeating-linear-gradient(
    45deg,
    #ff6b8b,
    #ff6b8b 6px,
    #ffffff 6px,
    #ffffff 12px
  );
  border-radius: 4px 4px 1px 1px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.wick {
  width: 2px;
  height: 8px;
  background: #4a2828;
  margin-bottom: -1px;
}

.flame {
  width: 14px;
  height: 22px;
  background: radial-gradient(ellipse at bottom, #ffee55 0%, #ff9900 60%, #ff3300 100%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  box-shadow: 0 0 14px #ffaa00, 0 0 22px #ff4400;
  animation: flicker 0.15s infinite alternate ease-in-out;
  transform-origin: center bottom;
}

@keyframes flicker {
  0% { transform: scale(1) rotate(-2deg); }
  100% { transform: scale(1.1) rotate(2deg); }
}

/* Extinguished Smoke */
.candle.blown .flame {
  display: none;
}

.candle.blown::after {
  content: '';
  position: absolute;
  top: -15px;
  width: 6px;
  height: 20px;
  background: rgba(120, 120, 120, 0.4);
  border-radius: 10px;
  filter: blur(2px);
  animation: smokeRise 1.2s ease-out forwards;
}

@keyframes smokeRise {
  0% { transform: translateY(0) scale(1); opacity: 0.8; }
  100% { transform: translateY(-30px) scale(2.5); opacity: 0; }
}

/* Cake Multi-tier Visual */
.cake {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cake-top {
  width: 150px;
  height: 45px;
  background: #ffb3c1;
  border-radius: 12px 12px 0 0;
  position: relative;
  border-bottom: 4px solid #ff758f;
  box-shadow: inset 0 4px 6px rgba(255,255,255,0.4);
}

.icing-drips {
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 100%;
  height: 12px;
  background: radial-gradient(circle at 10px 0, #ffb3c1 10px, transparent 11px) repeat-x;
  background-size: 20px 12px;
}

.cherry {
  position: absolute;
  top: -12px;
  left: 25px;
  font-size: 1.2rem;
}
.cherry-2 {
  left: auto;
  right: 25px;
}

.cake-middle {
  width: 180px;
  height: 50px;
  background: #ff8fa3;
  position: relative;
  border-bottom: 4px solid #ff4d6d;
}

.decorative-dots {
  position: absolute;
  top: 15px;
  left: 10px;
  right: 10px;
  height: 8px;
  background: radial-gradient(circle, #ffffff 4px, transparent 5px) repeat-x;
  background-size: 18px 8px;
}

.cake-bottom {
  width: 210px;
  height: 55px;
  background: #ff5c8a;
  border-radius: 0 0 16px 16px;
  position: relative;
}

.cake-plate {
  position: absolute;
  bottom: -10px;
  left: -20px;
  width: 250px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 6px 15px rgba(0,0,0,0.12);
  border: 2px solid #e2e2e2;
}

/* Action Button */
.action-btn {
  background: linear-gradient(135deg, var(--primary-pink) 0%, #ff477e 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 30px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 71, 126, 0.35);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.action-btn:hover, .action-btn:active {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 25px rgba(255, 71, 126, 0.45);
}

/* Dudu & Bubu Section */
.dudu-bubu-section {
  width: 100%;
}

.section-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-card);
}

.section-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.25rem;
  color: var(--text-bold);
  text-align: center;
}

.polaroid-wrapper {
  perspective: 1000px;
}

.polaroid-card {
  background: white;
  padding: 12px 12px 18px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  transform: rotate(-2deg);
  transition: transform 0.4s ease;
  max-width: 280px;
}

.polaroid-card:hover {
  transform: rotate(0deg) scale(1.03);
}

.polaroid-img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  border-radius: 8px;
}

.polaroid-caption {
  font-family: 'Dancing Script', cursive;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  text-align: center;
  margin-top: 10px;
}

.interactive-reactions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.reaction-btn {
  background: #fff0f3;
  border: 1.5px solid var(--secondary-pink);
  color: var(--text-bold);
  padding: 9px 15px;
  border-radius: 20px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.reaction-btn:hover, .reaction-btn:active {
  background: var(--primary-pink);
  color: white;
  transform: scale(1.06);
}

/* Floating Reaction Animation */
.floating-heart {
  position: fixed;
  font-size: 1.8rem;
  pointer-events: none;
  z-index: 1000;
  animation: floatHeart 1.8s ease-out forwards;
}

@keyframes floatHeart {
  0% { transform: translateY(0) scale(0.6); opacity: 1; }
  50% { transform: translateY(-80px) scale(1.2) rotate(15deg); }
  100% { transform: translateY(-160px) scale(1) rotate(-15deg); opacity: 0; }
}

/* Gift Section */
.gift-section {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.gift-box-wrapper {
  width: 140px;
  height: 130px;
  position: relative;
  cursor: pointer;
  animation: giftBounce 2s infinite ease-in-out;
}

@keyframes giftBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px) rotate(2deg); }
}

.gift-lid {
  width: 148px;
  height: 35px;
  background: #ff477e;
  border-radius: 8px;
  position: absolute;
  top: 0;
  left: -4px;
  z-index: 2;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  display: flex;
  justify-content: center;
  align-items: center;
}

.ribbon-bow {
  font-size: 2.2rem;
  margin-top: -24px;
}

.gift-body {
  width: 140px;
  height: 100px;
  background: #ff758f;
  border-radius: 0 0 12px 12px;
  position: absolute;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.gift-label {
  color: white;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  padding: 0 10px;
}

/* Modal Popup */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(74, 40, 40, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: white;
  border-radius: 28px;
  max-width: 420px;
  width: 100%;
  padding: 24px 20px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  text-align: center;
  transform: scale(1);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.hidden .modal-content {
  transform: scale(0.8);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: #999;
  cursor: pointer;
}

.modal-badge {
  display: inline-block;
  background: #fff0f3;
  color: var(--primary-pink);
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 15px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.modal-img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 15px;
}

.modal-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.5rem;
  color: var(--text-bold);
  margin-bottom: 10px;
}

.modal-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-dark);
  margin-bottom: 20px;
}

.modal-celebrate-btn {
  width: 100%;
}

/* Responsive Tweaks */
@media (max-width: 480px) {
  .name-title {
    font-size: 2.6rem;
  }
  .typewriter-container {
    font-size: 1.35rem;
  }
  .flag {
    width: 26px;
    height: 36px;
    font-size: 0.85rem;
  }
  .cake-wrapper {
    transform: scale(0.9);
  }
  .polaroid-card {
    max-width: 240px;
  }
  .polaroid-img {
    height: 210px;
  }
}
