* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', 'Poppins', sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: #12000f;
}

.screen {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* ================= OPEN SCREEN ================= */

#openScreen {
  background: linear-gradient(135deg, #ff5f96, #ff9a76, #7b3fe4);
  background-size: 300% 300%;
  animation: gradientMove 8s ease infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.open-content {
  text-align: center;
  color: #fff;
  z-index: 5;
  padding: 20px;
}

.gift-icon {
  font-size: 80px;
  animation: bounce 1.4s infinite ease-in-out;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-20px) rotate(5deg); }
}

.open-content h1 {
  margin-top: 15px;
  font-size: 28px;
  text-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.sub-line {
  margin-top: 8px;
  font-size: 16px;
  opacity: 0.9;
}

.open-btn {
  margin-top: 35px;
  padding: 14px 34px;
  font-size: 16px;
  border: none;
  border-radius: 50px;
  background: #fff;
  color: #ff5f96;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.07); }
  100% { transform: scale(1); }
}

.balloons {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.balloons span {
  position: absolute;
  bottom: -60px;
  font-size: 42px;
  opacity: 0.85;
  animation: floatUp 9s linear infinite;
}

.balloons span:nth-child(1){ left: 10%; animation-delay: 0s; }
.balloons span:nth-child(2){ left: 30%; animation-delay: 1.5s; }
.balloons span:nth-child(3){ left: 50%; animation-delay: 3s; }
.balloons span:nth-child(4){ left: 70%; animation-delay: 4.5s; }
.balloons span:nth-child(5){ left: 88%; animation-delay: 2s; }

@keyframes floatUp {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-115vh) rotate(15deg); }
}

/* ================= CARD SCREEN ================= */

#cardScreen {
  background: #12000f;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.top-bar {
  position: absolute;
  top: 14px;
  width: 100%;
  text-align: center;
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  letter-spacing: 0.5px;
  z-index: 10;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-wrap {
  position: relative;
  width: min(88vw, 420px);
  height: min(60vh, 500px);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(255, 90, 150, 0.35);
}

.image-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.15);
}

.image-wrap img.show {
  animation: imgIn 1.1s ease forwards;
}

@keyframes imgIn {
  0% { opacity: 0; transform: scale(1.2) rotate(-2deg); }
  60% { opacity: 1; transform: scale(1.02) rotate(0.5deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.image-wrap img.leave {
  animation: imgOut 0.8s ease forwards;
}

@keyframes imgOut {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.9) translateY(-15px); }
}

.quote-box {
  position: absolute;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  width: 88%;
  max-width: 480px;
  text-align: center;
  color: #ffe3ee;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.6;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
  opacity: 0;
  padding: 0 10px;
}

.quote-box.show {
  animation: quoteFade 3.6s ease forwards;
}

@keyframes quoteFade {
  0% { opacity: 0; transform: translate(-50%, 15px); }
  15% { opacity: 1; transform: translate(-50%, 0); }
  85% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -10px); }
}

/* paused visual cue */
#cardScreen.paused .image-wrap {
  filter: brightness(0.55) saturate(0.7);
}

.final-title {
  position: absolute;
  bottom: 5%;
  color: #fff;
  font-size: 22px;
  text-align: center;
  padding: 0 20px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
  animation: glowText 2.5s infinite ease-in-out;
  z-index: 6;
}

@keyframes glowText {
  0%, 100% { text-shadow: 0 0 10px rgba(255,120,180,0.4); }
  50% { text-shadow: 0 0 25px rgba(255,120,180,0.9); }
}

/* ================= FLOATING RANDOM MODE ================= */

.floating-hearts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.float-pic {
  position: absolute;
  width: 130px;
  height: 130px;
  border-radius: 14px;
  object-fit: cover;
  opacity: 0;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: floatPic 7s ease-in-out forwards;
}

@keyframes floatPic {
  0% { opacity: 0; transform: translateY(40px) scale(0.7) rotate(-6deg); }
  12% { opacity: 1; }
  50% { transform: translateY(-20px) scale(1) rotate(3deg); }
  88% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-70px) scale(0.85) rotate(-3deg); }
}

@media (max-width: 480px) {
  .float-pic { width: 100px; height: 100px; }
  .open-content h1 { font-size: 22px; }
  .quote-box { font-size: 16px; }
}
