:root {
  --bg-top: #8edbff;
  --bg-bottom: #fff2b7;
  --card-bg: rgba(255, 255, 255, 0.92);
  --card-border: #ffb84d;
  --text-main: #4b2e2e;
  --text-soft: #7a5a5a;
  --pink: #ff7eb6;
  --blue: #5bc9ff;
  --yellow: #ffd84d;
  --mint: #8ce8c8;
  --shadow: 0 18px 0 #f6b25b, 0 24px 45px rgba(118, 77, 23, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", "Comic Sans MS", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.85) 0, transparent 28%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

.scene {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 28px 16px;
}

.fireworks-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 20;
}

.sky-bubble {
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  filter: blur(2px);
}

.bubble-left {
  top: 7%;
  left: -40px;
  width: 180px;
  height: 180px;
}

.bubble-right {
  right: -60px;
  bottom: 12%;
  width: 220px;
  height: 220px;
}

.card {
  position: relative;
  z-index: 1;
  width: min(100%, 760px);
  padding: 44px 28px 34px;
  border: 5px solid var(--card-border);
  border-radius: 36px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  text-align: center;
  overflow: hidden;
  animation: cardPop 0.9s ease-out both;
}

.entry-card {
  max-width: 700px;
}

.music-toggle {
  position: absolute;
  top: 18px;
  left: 18px;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: #ffeff6;
  color: #cc4e7e;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(204, 78, 126, 0.18);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.music-toggle:active,
.action-button:active,
.preview-link:active {
  transform: translateY(0);
}

.music-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(204, 78, 126, 0.24);
}

.music-toggle.is-playing {
  background: #fff2b7;
  color: #b96b00;
}

.eyebrow {
  margin: 72px 0 12px;
  font-family: "Trebuchet MS", "Comic Sans MS", sans-serif;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: #ff6f91;
  letter-spacing: 0.06em;
  animation: floatSoft 3s ease-in-out infinite;
}

.title {
  margin: 0;
  font-family: "Trebuchet MS", "Comic Sans MS", sans-serif;
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  line-height: 1;
  animation: titleEntrance 0.9s ease-out both 0.15s;
}

#birthday-name {
  display: block;
  margin-bottom: 10px;
  color: #ff8c42;
  animation: nameBounce 2.6s ease-in-out infinite 1s;
}

.title-highlight {
  display: inline-block;
  color: #ff4f8b;
  text-shadow: 0 4px 0 #ffd54a;
  animation: glowPulse 1.8s ease-in-out infinite;
}

.message {
  max-width: 520px;
  margin: 18px auto 26px;
  font-size: clamp(1rem, 2.6vw, 1.2rem);
  line-height: 1.8;
  color: var(--text-soft);
  animation: messageWave 4s ease-in-out infinite 0.4s;
}

.hint {
  margin: 24px 0 0;
  font-size: 0.95rem;
  color: #8a6d6d;
}

.hint code {
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff1f6;
  color: #d94a7a;
}

.entry-form {
  max-width: 560px;
  margin: 0 auto;
}

.entry-label {
  display: block;
  margin: 0 0 10px;
  font-size: 0.96rem;
  font-weight: 700;
  color: #9b5c53;
  text-align: left;
}

.entry-input {
  width: 100%;
  border: 3px solid #ffd39c;
  border-radius: 18px;
  padding: 14px 16px;
  font-size: 1rem;
  color: var(--text-main);
  background: #fffdf8;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.entry-input:focus {
  border-color: #ff93ba;
  box-shadow: 0 0 0 5px rgba(255, 147, 186, 0.18);
  transform: translateY(-1px);
}

.entry-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.action-button,
.preview-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 999px;
  padding: 0 18px;
  font-size: 0.98rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.action-button:hover,
.preview-link:hover {
  transform: translateY(-2px);
}

.primary-button {
  flex: 1;
  border: 0;
  background: linear-gradient(180deg, #ff9fc4, #ff6f91);
  color: #fff;
  box-shadow: 0 12px 22px rgba(255, 111, 145, 0.28);
}

.secondary-button {
  border: 0;
  background: #fff0c8;
  color: #b96b00;
  box-shadow: 0 12px 22px rgba(255, 216, 77, 0.22);
}

.link-output {
  margin-top: 20px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 247, 225, 0.88);
  box-shadow: inset 0 0 0 2px rgba(255, 209, 120, 0.35);
  animation: cardPop 0.45s ease-out both;
}

.link-input {
  font-size: 0.92rem;
}

.preview-link {
  margin-top: 14px;
  border: 0;
  background: #8ce8c8;
  color: #225e52;
  box-shadow: 0 12px 22px rgba(140, 232, 200, 0.22);
}

.entry-title {
  margin-bottom: 12px;
}

.entry-message {
  margin-bottom: 22px;
}

.status-error {
  color: #d9486f;
}

.status-success {
  color: #2c8c74;
}

.balloons {
  position: absolute;
  inset: 24px 24px auto auto;
  display: flex;
  gap: 10px;
}

.balloon {
  position: relative;
  width: 46px;
  height: 60px;
  border-radius: 50% 50% 45% 45%;
  animation: float 3.4s ease-in-out infinite;
}

.balloon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -26px;
  width: 2px;
  height: 28px;
  background: rgba(75, 46, 46, 0.35);
}

.balloon-pink {
  background: var(--pink);
}

.balloon-blue {
  background: var(--blue);
  animation-delay: 0.5s;
}

.balloon-yellow {
  background: var(--yellow);
  animation-delay: 1s;
}

.cake {
  position: relative;
  width: 160px;
  margin: 0 auto;
  padding-top: 26px;
}

.candle {
  position: absolute;
  top: 0;
  left: 50%;
  width: 18px;
  height: 36px;
  margin-left: -9px;
  border-radius: 12px;
  background: repeating-linear-gradient(
    45deg,
    #ffffff,
    #ffffff 6px,
    #ff8eb8 6px,
    #ff8eb8 12px
  );
}

.flame {
  position: absolute;
  top: -18px;
  left: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: linear-gradient(180deg, #fff6a2, #ff9d2f);
  animation: flicker 1.1s ease-in-out infinite;
}

.cake-top,
.cake-middle,
.cake-bottom {
  border-radius: 18px;
}

.cake-top {
  height: 18px;
  background: #fff;
}

.cake-middle {
  height: 42px;
  background: #ffb1cf;
}

.cake-bottom {
  height: 52px;
  background: #8ce8c8;
}

.stars {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  font-size: 1.4rem;
  color: #ffbd2e;
}

.stars span {
  animation: twinkle 1.8s ease-in-out infinite;
}

.stars span:nth-child(2),
.stars span:nth-child(4) {
  animation-delay: 0.5s;
}

.confetti {
  position: absolute;
  top: 18px;
  width: 14px;
  height: 22px;
  border-radius: 999px;
  opacity: 0.95;
}

.confetti-a {
  left: 22px;
  background: var(--pink);
  transform: rotate(-24deg);
}

.confetti-b {
  left: 50%;
  background: var(--yellow);
  transform: translateX(-50%) rotate(18deg);
}

.confetti-c {
  right: 26px;
  background: var(--blue);
  transform: rotate(24deg);
}

.firework {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
}

.firework-piece {
  position: absolute;
  left: 0;
  top: 0;
  width: 10px;
  height: 18px;
  border-radius: 999px;
  background: var(--piece-color, #ff7eb6);
  transform: rotate(var(--angle)) translateY(0);
  animation: burst 900ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes flicker {
  0%,
  100% {
    transform: translateX(0) rotate(-45deg) scale(1);
  }

  50% {
    transform: translateX(1px) rotate(-40deg) scale(1.08);
  }
}

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

  50% {
    transform: scale(1.25);
    opacity: 0.72;
  }
}

@keyframes cardPop {
  0% {
    opacity: 0;
    transform: translateY(28px) scale(0.96);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes titleEntrance {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.92);
  }

  70% {
    transform: translateY(-4px) scale(1.03);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes nameBounce {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  30% {
    transform: translateY(-5px) rotate(-2deg);
  }

  60% {
    transform: translateY(2px) rotate(1deg);
  }
}

@keyframes glowPulse {
  0%,
  100% {
    transform: scale(1);
    text-shadow: 0 4px 0 #ffd54a, 0 0 0 rgba(255, 79, 139, 0);
  }

  50% {
    transform: scale(1.04);
    text-shadow: 0 4px 0 #ffd54a, 0 0 18px rgba(255, 79, 139, 0.35);
  }
}

@keyframes messageWave {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

@keyframes floatSoft {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

@keyframes burst {
  0% {
    opacity: 1;
    transform: rotate(var(--angle)) translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: rotate(var(--angle)) translateY(var(--distance)) scale(0.35);
  }
}

@media (max-width: 640px) {
  .card {
    padding: 36px 20px 28px;
  }

  .entry-actions {
    flex-direction: column;
  }

  .music-toggle {
    top: 14px;
    left: 14px;
    padding: 9px 12px;
    font-size: 0.84rem;
  }

  .eyebrow {
    margin-top: 84px;
  }

  .balloons {
    top: 16px;
    right: 14px;
    transform: scale(0.85);
    transform-origin: top right;
  }
}
