* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-1: #ff5db1;
  --bg-2: #ffa14f;
  --bg-3: #7c7bff;
  --card: rgba(255, 255, 255, 0.18);
  --card-strong: rgba(255, 255, 255, 0.28);
  --text: #ffffff;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  --accent: #ffe066;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.18), transparent 35%),
              radial-gradient(circle at 80% 15%, rgba(255, 255, 255, 0.15), transparent 40%),
              linear-gradient(120deg, var(--bg-1), var(--bg-2), var(--bg-3));
  background-size: 200% 200%;
  animation: gradientBackground 12s ease infinite;
  min-height: 100vh;
  overflow-x: hidden;
}

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

#confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.balloons {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.balloon {
  position: absolute;
  width: 110px;
  height: 140px;
  border-radius: 50% 50% 45% 45%;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
  animation: balloonFloat 6s ease-in-out infinite;
}

.balloon::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 80px;
  background: rgba(255, 255, 255, 0.7);
  left: 50%;
  top: 100%;
}

.balloon-1 { background: #ff6aa5; top: 12%; left: 8%; animation-delay: 0s; }
.balloon-2 { background: #ffd93d; top: 18%; right: 8%; animation-delay: 1s; }
.balloon-3 { background: #6ae4ff; top: 60%; left: 4%; animation-delay: 2s; }
.balloon-4 { background: #b07cff; top: 55%; right: 12%; animation-delay: 2.5s; }
.balloon-5 { background: #7cff9b; top: 35%; left: 45%; animation-delay: 1.8s; }

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

.container {
  position: relative;
  z-index: 3;
  width: min(1100px, 92%);
  margin: 0 auto;
  padding: 48px 0 80px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.header {
  text-align: center;
  display: grid;
  gap: 8px;
  padding: 40px 24px;
  background: var(--card);
  backdrop-filter: blur(14px);
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: var(--shadow);
  animation: floatIn 1s ease both;
}

.title {
  font-size: clamp(2.2rem, 4vw, 3.8rem);
  letter-spacing: 2px;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.subtitle {
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  opacity: 0.95;
}

.age-text {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent);
}

.animate-title { animation: pop 1.2s ease both; }
.animate-subtitle { animation: fadeUp 1.2s ease 0.2s both; }
.animate-age { animation: fadeUp 1.2s ease 0.4s both; }

@keyframes pop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeUp {
  0% { transform: translateY(12px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes floatIn {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.cake-section {
  display: grid;
  place-items: center;
  gap: 16px;
  padding: 28px;
  background: var(--card);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: var(--shadow);
}

.cake {
  position: relative;
  width: 220px;
  height: 180px;
}

.cake-layer {
  position: absolute;
  width: 100%;
  height: 55px;
  border-radius: 18px;
  left: 0;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.1);
}

.cake-layer-1 { bottom: 0; background: #ff7eb3; }
.cake-layer-2 { bottom: 45px; background: #ffe066; width: 190px; left: 15px; }
.cake-layer-3 { bottom: 90px; background: #8ce3ff; width: 160px; left: 30px; }

.candle {
  position: absolute;
  width: 18px;
  height: 60px;
  background: #ffffff;
  border-radius: 8px;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
}

.flame {
  position: absolute;
  width: 22px;
  height: 32px;
  background: radial-gradient(circle, #fff7b2 20%, #ff9f1c 60%, transparent 75%);
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  animation: flame 1.2s infinite;
}

@keyframes flame {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.9; }
  50% { transform: translateX(-50%) scale(1.15); opacity: 1; }
}

.cake-text {
  font-size: 1.1rem;
  font-weight: 600;
}

.section-title {
  font-size: clamp(1.4rem, 2.4vw, 2.2rem);
  text-align: center;
  margin-bottom: 18px;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.gallery-section,
.messages-section,
.music-section,
.wishes-section,
.final-section {
  padding: 32px;
  border-radius: 26px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  transform: translateY(0);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.gallery-item:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.25);
}

.gallery-item:hover img {
  transform: scale(1.1);
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.messages-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.message-card {
  padding: 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 126, 95, 0.85), rgba(254, 180, 123, 0.85));
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.message-card:hover {
  transform: translateY(-6px);
}

.message-text {
  font-size: 1rem;
  line-height: 1.5;
}

.message-author {
  margin-top: 12px;
  font-weight: 600;
  color: #fff7c2;
}

.music-section {
  text-align: center;
}

#birthday-music {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.music-btn,
.wish-btn {
  border: none;
  padding: 12px 22px;
  border-radius: 999px;
  background: #ffffff;
  color: #ff5b8c;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.2);
}

.music-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.audio-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.3);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
}

.volume-label {
  font-weight: 600;
}

.volume-slider {
  width: 160px;
  accent-color: #ff5b8c;
}

.music-btn:hover,
.wish-btn:hover {
  background: #ffe066;
  transform: translateY(-3px);
}

.wishes-input {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

#wish-input {
  flex: 1 1 260px;
  min-width: 200px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  outline: none;
}

.wishes-list {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.wish-item {
  padding: 10px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

.floating-wish {
  position: fixed;
  bottom: -40px;
  padding: 12px 20px;
  border-radius: 999px;
  color: #ff5b8c;
  font-weight: 700;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.2);
  z-index: 4;
  animation: floatWish 8s ease-in forwards;
  pointer-events: none;
}

.floating-balloon::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 50px;
  background: rgba(255, 255, 255, 0.7);
  left: 50%;
  top: 100%;
}

.floating-image {
  position: fixed;
  bottom: -60px;
  width: 140px;
  height: 180px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.25);
  background: rgba(255, 255, 255, 0.9);
  z-index: 4;
  animation: floatWish 10s ease-in forwards;
  pointer-events: none;
}

.floating-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.floating-message {
  position: fixed;
  bottom: -50px;
  padding: 14px 22px;
  border-radius: 26px;
  color: #6a1b9a;
  font-weight: 600;
  max-width: 240px;
  text-align: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(233, 214, 255, 0.9));
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.2);
  z-index: 4;
  animation: floatWish 9s ease-in forwards;
  pointer-events: none;
}


@keyframes floatWish {
  0% {
    transform: translateY(0) scale(0.9);
    opacity: 0.8;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translateY(-110vh) scale(1.05);
    opacity: 0;
  }
}

.final-section {
  text-align: center;
}

.final-title {
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  margin-bottom: 8px;
}

.final-text {
  opacity: 0.9;
  margin-bottom: 16px;
}

.stars {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.star {
  animation: twinkle 1.8s infinite;
}

.star:nth-child(2) { animation-delay: 0.4s; }
.star:nth-child(3) { animation-delay: 0.8s; }
.star:nth-child(4) { animation-delay: 1.2s; }
.star:nth-child(5) { animation-delay: 1.6s; }

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

@media (max-width: 768px) {
  .container { gap: 32px; }
  .header { padding: 28px 18px; }
  .gallery { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

@media (max-width: 480px) {
  .balloon { width: 80px; height: 110px; }
  .cake { width: 180px; height: 150px; }
  .wishes-input { flex-direction: column; }
  .music-btn,
  .wish-btn { width: 100%; }
}
