* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  background: #1a0d1f url('images/backgroud.png') center center / cover no-repeat fixed;
  color: #fff;
}

.stage {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  animation: fadeIn 1s ease forwards;
}

.hidden { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

#musicToggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 999;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  font-size: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

/* ===== LOVE GALAXY (STAGE 1 BACKGROUND) ===== */
.love-galaxy {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
}

.galaxy-star {
  position: absolute;
  background: #ffffff;
  border-radius: 50%;
  animation: twinkle ease-in-out infinite;
}

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

.galaxy-heart-orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
}

.galaxy-heart-orbit span {
  position: absolute;
  filter: drop-shadow(0 0 5px rgba(255,143,171,0.9));
}

@keyframes spinOrbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.heart-loader {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 140px;
}

.heart {
  position: relative;
  width: 100px;
  height: 90px;
  transform: scale(0.6) rotate(-45deg);
  animation: heartForm 1.6s ease forwards, heartBeat 1.2s ease-in-out infinite 1.6s;
}

.heart::before,
.heart::after {
  content: "";
  position: absolute;
  width: 100px;
  height: 100px;
  background: #ff4d6d;
  border-radius: 50%;
}

.heart::before { top: -50px; left: 0; }
.heart::after { left: 50px; top: 0; }

@keyframes heartForm {
  0% { transform: scale(0) rotate(-45deg); opacity: 0; }
  60% { transform: scale(0.8) rotate(-45deg); opacity: 1; }
  100% { transform: scale(1) rotate(-45deg); opacity: 1; }
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1) rotate(-45deg); }
  50% { transform: scale(1.15) rotate(-45deg); }
}

.typing-text {
  position: relative;
  z-index: 2;
  font-size: 1.6rem;
  margin-top: 24px;
  min-height: 3rem;
  color: #ffd6e0;
  border-right: 2px solid #ffd6e0;
  white-space: pre-wrap;
  max-width: 90%;
}

/* ===== ENVELOPE ===== */
.envelope {
  width: 220px;
  height: 150px;
  position: relative;
  cursor: pointer;
  margin-bottom: 20px;
}

.envelope-body {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 110px;
  background: #ffe0ec;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.lock-icon {
  font-size: 2.2rem;
  animation: pulse 1.5s infinite;
}

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

.envelope-lid {
  position: absolute;
  top: 0;
  width: 0;
  height: 0;
  border-left: 110px solid transparent;
  border-right: 110px solid transparent;
  border-top: 70px solid #ff8fab;
}

.hint-text {
  font-size: 0.9rem;
  color: #ffd6e0;
  opacity: 0.8;
}

.question-box {
  background: rgba(0,0,0,0.45);
  padding: 24px;
  border-radius: 14px;
  max-width: 340px;
  width: 100%;
  backdrop-filter: blur(6px);
}

.question-box p { margin-bottom: 14px; font-size: 1rem; }

.question-box input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  margin-bottom: 12px;
  font-size: 1rem;
  text-align: center;
}

.question-box button, .main-btn {
  background: linear-gradient(135deg, #ff4d6d, #ff8fab);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(255,77,109,0.4);
}

.error { color: #ffb3b3; margin-top: 10px; font-size: 0.9rem; }

/* ===== BUBBLES / FLOATING LOVE ===== */
#bubbles-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}

.bubble-heart {
  position: absolute;
  bottom: -40px;
  font-size: 22px;
  color: #ff8fab;
  animation: floatUp linear forwards;
  opacity: 0.85;
}

@keyframes floatUp {
  0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0.9; }
  100% { transform: translateY(-110vh) translateX(var(--drift, 0px)) rotate(360deg); opacity: 0; }
}

/* ===== PHOTOS PAGE ===== */
.page-title {
  font-size: 1.6rem;
  margin-bottom: 20px;
  color: #ffd6e0;
  position: relative;
  z-index: 10;
}

.photo-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  z-index: 10;
  position: relative;
}

.photo-card {
  width: 120px;
  height: 150px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  border: 3px solid #ff8fab;
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  transition: transform 0.25s ease;
}

.photo-card:hover, .photo-card:active { transform: scale(1.06); }

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.caption-display {
  margin: 20px auto;
  max-width: 420px;
  background: rgba(0,0,0,0.4);
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 0.95rem;
  min-height: 60px;
  z-index: 10;
  position: relative;
  border-right: 2px solid #ffd6e0;
  text-align: left;
  white-space: pre-wrap;
}

/* ===== GALAXY PAGE ===== */
.galaxy-container {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
}

.orbit img {
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid #ff8fab;
  object-fit: cover;
  box-shadow: 0 0 14px rgba(255,143,171,0.7);
}

.final-message-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 85%;
  max-width: 480px;
  background: rgba(0,0,0,0.55);
  padding: 24px;
  border-radius: 16px;
  z-index: 20;
  backdrop-filter: blur(6px);
}

.final-text {
  font-size: 1.05rem;
  line-height: 1.6;
  border-right: 2px solid #ffd6e0;
}

@media (max-width: 480px) {
  .typing-text { font-size: 1.25rem; }
  .photo-card { width: 100px; height: 130px; }
  .orbit img { width: 48px; height: 48px; }
}
