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

body {
  min-height: 100vh;
  overflow: hidden;
  font-family: "Segoe UI", Arial, sans-serif;
  background: radial-gradient(circle at top, #3b1460, #12002b 70%);
  color: #fff;
}

/* ---------- Background face ---------- */
.bg-face {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 1.2s ease, transform 1.2s ease;
  z-index: 0;
  pointer-events: none;
}
.bg-face.show { opacity: 0.35; transform: scale(1); }
.bg-face img {
  width: min(80vw, 80vh);
  height: min(80vw, 80vh);
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 0 80px #ff4fd8;
}
.face-fallback { display: none; font-size: min(70vw, 70vh); line-height: 1; }
.bg-face.no-photo img { display: none; }
.bg-face.no-photo .face-fallback { display: block; }

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

/* ---------- Bunting ---------- */
.bunting {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-around;
  z-index: 2;
}
.bunting .flag {
  width: 0; height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 40px solid var(--c);
  animation: sway 2s ease-in-out infinite alternate;
  transform-origin: top center;
}
@keyframes sway { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }

/* ---------- Balloons ---------- */
.balloons { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
.balloon {
  position: absolute;
  bottom: -160px;
  width: 60px; height: 76px;
  border-radius: 50% 50% 48% 52% / 60% 60% 40% 40%;
  background: var(--c);
  box-shadow: inset -8px -10px 0 rgba(0,0,0,0.15);
  animation: floatUp var(--d) linear infinite;
  animation-delay: var(--delay);
}
.balloon::before { /* knot */
  content: "";
  position: absolute;
  bottom: -6px; left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: var(--c);
}
.balloon::after { /* string */
  content: "";
  position: absolute;
  top: 82px; left: 50%;
  width: 1px; height: 70px;
  background: rgba(255,255,255,0.6);
}
@keyframes floatUp {
  0%   { transform: translateY(0) translateX(0); }
  50%  { transform: translateY(-60vh) translateX(25px); }
  100% { transform: translateY(-125vh) translateX(-15px); }
}

/* ---------- Stages ---------- */
.stage {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  text-align: center;
  padding: 16px;
}
.hidden { display: none; }
.hint { font-size: 1.6rem; letter-spacing: 1px; }

/* ---------- Gift box ---------- */
.gift { position: relative; width: 160px; height: 160px; animation: shake 1.6s ease-in-out infinite; }
.box, .lid {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #ff3e7f 42%, #ffd23f 42%, #ffd23f 58%, #ff3e7f 58%);
}
.box { bottom: 0; width: 140px; height: 110px; border-radius: 6px; }
.lid {
  top: 18px; width: 160px; height: 34px; border-radius: 6px;
  transition: transform 0.8s ease, opacity 0.8s ease;
  z-index: 1;
}
.bow {
  position: absolute; top: -26px; left: 50%;
  width: 60px; height: 30px; transform: translateX(-50%);
}
.bow::before, .bow::after {
  content: ""; position: absolute; top: 0;
  width: 30px; height: 28px;
  border: 7px solid #ffd23f; border-radius: 50% 50% 0 50%;
}
.bow::before { left: -2px; transform: rotate(-20deg); }
.bow::after  { right: -2px; transform: rotate(20deg) scaleX(-1); }

.gift.open { animation: none; }
.gift.open .lid { transform: translate(-50%, -160px) rotate(-35deg); opacity: 0; }

@keyframes shake {
  0%, 70%, 100% { transform: rotate(0); }
  75% { transform: rotate(-6deg); }
  85% { transform: rotate(6deg); }
  95% { transform: rotate(-3deg); }
}

/* ---------- Buttons ---------- */
.open-btn {
  font-size: 1.3rem;
  padding: 14px 34px;
  border: none;
  border-radius: 50px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(45deg, #ff3e7f, #ff9a3e);
  box-shadow: 0 6px 20px rgba(255, 62, 127, 0.6);
  animation: pulse 1.4s ease-in-out infinite;
}
.open-btn:hover { filter: brightness(1.15); }
.open-btn.small { font-size: 1rem; padding: 10px 24px; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ---------- Wish text ---------- */
.wish {
  font-size: clamp(2.4rem, 9vw, 6rem);
  font-family: "Brush Script MT", "Comic Sans MS", cursive;
  display: flex; flex-wrap: wrap; justify-content: center;
}
.wish span {
  display: inline-block;
  opacity: 0;
  animation: pop 0.5s forwards, colors 3s linear infinite;
  text-shadow: 0 0 18px currentColor;
}
.wish .gap { width: 0.4em; }
@keyframes pop {
  0%   { opacity: 0; transform: translateY(-80px) scale(0.3); }
  70%  { transform: translateY(8px) scale(1.2); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes colors {
  0%   { color: #ff3e7f; } 25% { color: #ffd23f; }
  50%  { color: #3effa8; } 75% { color: #3ec5ff; } 100% { color: #ff3e7f; }
}
.sub { font-size: 1.2rem; opacity: 0; animation: fadeIn 1s 1.8s forwards; }
@keyframes fadeIn { to { opacity: 1; } }
