@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700;800;900&family=Noto+Sans+Thai:wght@300;400;500;600;700&display=swap');

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

body {
  font-family: 'Kanit', 'Noto Sans Thai', sans-serif;
  background: #0a0015;
  color: #fff;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ===== BACKGROUNDS ===== */
.bg-stars {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at 20% 50%, rgba(255,50,120,0.12) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(168,85,247,0.12) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 80%, rgba(255,100,150,0.08) 0%, transparent 40%);
}

.star {
  position: fixed; border-radius: 50%; background: #fff; pointer-events: none; z-index: 0;
  animation: twinkle var(--dur) ease-in-out infinite alternate;
}
@keyframes twinkle {
  0% { opacity: 0.2; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1.2); }
}

/* ===== FLOATING HEARTS ===== */
.floating-hearts { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.fheart {
  position: absolute; bottom: -60px; opacity: 0;
  animation: floatHeart var(--dur) ease-in-out infinite;
  animation-delay: var(--delay);
  font-size: var(--size);
}
@keyframes floatHeart {
  0% { opacity: 0; transform: translateY(0) rotate(0deg) scale(0.5); }
  10% { opacity: 0.7; }
  90% { opacity: 0.3; }
  100% { opacity: 0; transform: translateY(-110vh) rotate(360deg) scale(1); }
}

/* ===== PAGES ===== */
.page {
  position: relative; z-index: 1;
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 20px;
  transition: opacity 0.6s, transform 0.6s;
}
.page.hidden { display: none; }

/* ===== PAGE 1: INTRO ===== */
#page1 { cursor: pointer; }
.intro-envelope {
  width: 200px; height: 140px; position: relative; margin-bottom: 40px;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.envelope-body {
  width: 200px; height: 130px; background: linear-gradient(135deg, #ff6b9d, #c471ed);
  border-radius: 0 0 16px 16px; position: relative; overflow: hidden;
  box-shadow: 0 10px 40px rgba(255,107,157,0.4);
}
.envelope-body::after {
  content: '💌'; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); font-size: 3rem;
}
.envelope-flap {
  width: 0; height: 0;
  border-left: 100px solid transparent; border-right: 100px solid transparent;
  border-top: 80px solid #e055a0;
  position: absolute; top: 0; left: 0;
  transform-origin: top center;
  transition: transform 0.8s ease;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.envelope-flap.open { transform: rotateX(180deg); }
.intro-text {
  font-size: 1.6rem; font-weight: 300; color: rgba(255,255,255,0.7);
  animation: fadeInUp 1s ease 0.5s both;
}
.intro-text span { color: #ff6b9d; font-weight: 500; }
.tap-hint {
  margin-top: 24px; font-size: 0.9rem; color: rgba(255,255,255,0.4);
  animation: blink 1.5s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity:0.4; } 50% { opacity:1; } }
@keyframes fadeInUp {
  from { opacity:0; transform: translateY(20px); }
  to { opacity:1; transform: translateY(0); }
}

/* ===== PAGE 2: MESSAGE ===== */
.message-container {
  max-width: 600px; text-align: center;
}
.love-icon {
  font-size: 5rem; margin-bottom: 24px;
  animation: heartbeat 1.2s ease-in-out infinite;
}
@keyframes heartbeat {
  0%,100% { transform: scale(1); }
  15% { transform: scale(1.15); }
  30% { transform: scale(1); }
  45% { transform: scale(1.1); }
}
.message-title {
  font-size: 2.6rem; font-weight: 700; margin-bottom: 20px;
  background: linear-gradient(135deg, #ff6b9d, #c471ed, #ff6b9d);
  background-size: 200% 200%;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  animation: gradientShift 3s ease infinite;
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.message-text {
  font-size: 1.15rem; line-height: 2; color: rgba(255,255,255,0.75);
  font-weight: 300; margin-bottom: 40px;
  white-space: pre-line;
}
.message-text .typing-cursor {
  display: inline-block; width: 2px; height: 1.2em; background: #ff6b9d;
  animation: cursorBlink 0.8s step-end infinite; vertical-align: text-bottom;
  margin-left: 2px;
}
@keyframes cursorBlink { 0%,100% { opacity:1; } 50% { opacity:0; } }
.next-btn {
  padding: 16px 48px; border-radius: 60px; border: none;
  background: linear-gradient(135deg, #ff6b9d, #c471ed);
  color: #fff; font-family: inherit; font-size: 1.1rem; font-weight: 500;
  cursor: pointer; transition: all 0.3s;
  box-shadow: 0 6px 30px rgba(255,107,157,0.4);
  animation: fadeInUp 0.6s ease 0.3s both;
}
.next-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 10px 40px rgba(255,107,157,0.6);
}

/* ===== PAGE 3: QUESTION ===== */
.question-container { text-align: center; max-width: 600px; }
.question-icon { font-size: 6rem; margin-bottom: 20px; animation: heartbeat 1.2s ease-in-out infinite; }
.question-text {
  font-size: 2.8rem; font-weight: 800; margin-bottom: 16px;
  background: linear-gradient(135deg, #ff6b9d, #ffd700, #ff6b9d);
  background-size: 300% 300%;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  animation: gradientShift 3s ease infinite;
}
.question-sub {
  font-size: 1.2rem; color: rgba(255,255,255,0.6); font-weight: 300; margin-bottom: 48px;
}
.buttons-area {
  display: flex; gap: 24px; justify-content: center; align-items: center;
  flex-wrap: wrap; min-height: 80px; position: relative;
}
.btn-yes {
  padding: 18px 64px; border-radius: 60px; border: none;
  background: linear-gradient(135deg, #ff4b8a, #ff6b9d, #c471ed);
  color: #fff; font-family: inherit; font-size: 1.3rem; font-weight: 600;
  cursor: pointer; transition: all 0.3s;
  box-shadow: 0 8px 35px rgba(255,75,138,0.5);
  animation: pulse 2s ease-in-out infinite;
}
.btn-yes:hover {
  transform: scale(1.15); box-shadow: 0 12px 50px rgba(255,75,138,0.7);
}
.btn-no {
  padding: 14px 40px; border-radius: 60px;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.5);
  font-family: inherit; font-size: 1rem; font-weight: 400;
  cursor: pointer; transition: all 0.2s; position: relative;
}
.btn-no:hover { border-color: rgba(255,255,255,0.1); }
.no-count {
  display: block; font-size: 0.7rem; color: rgba(255,255,255,0.3); margin-top: 12px;
}

/* ===== PAGE 4: CELEBRATION ===== */
.celebration-container { text-align: center; max-width: 600px; }
.cele-emoji {
  font-size: 6rem; margin-bottom: 20px;
  animation: bounceIn 0.8s ease both, heartbeat 1.2s ease-in-out 0.8s infinite;
}
@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { transform: scale(1.1); }
  70% { transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}
.cele-title {
  font-size: 3rem; font-weight: 900; margin-bottom: 16px;
  background: linear-gradient(135deg, #ff6b9d, #ffd700, #ff6b9d);
  background-size: 200% 200%;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  animation: gradientShift 2s ease infinite, bounceIn 0.6s ease 0.2s both;
}
.cele-text {
  font-size: 1.3rem; color: rgba(255,255,255,0.8); font-weight: 300;
  line-height: 1.8; margin-bottom: 32px;
  animation: fadeInUp 0.6s ease 0.5s both;
}
.cele-date {
  display: inline-block; padding: 12px 32px; border-radius: 50px;
  background: rgba(255,107,157,0.15); border: 1px solid rgba(255,107,157,0.3);
  color: #ff9ec5; font-size: 0.95rem; margin-bottom: 32px;
  animation: fadeInUp 0.6s ease 0.7s both;
}
.cele-heart-rain {
  position: fixed; inset: 0; pointer-events: none; z-index: 10; overflow: hidden;
}
.rain-heart {
  position: absolute; top: -60px;
  animation: rainFall var(--dur) linear infinite;
  animation-delay: var(--delay);
  font-size: var(--size);
  opacity: 0.8;
}
@keyframes rainFall {
  0% { transform: translateY(-60px) rotate(0deg); opacity: 0.8; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ===== CONFETTI ===== */
.confetti-piece {
  position: fixed; top: -20px; z-index: 11; pointer-events: none;
  width: var(--w); height: var(--h);
  background: var(--color);
  animation: confettiFall var(--dur) linear forwards;
  animation-delay: var(--delay);
  border-radius: 2px;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translateY(110vh) rotate(1080deg) scale(0.5); opacity: 0; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .message-title { font-size: 2rem; }
  .question-text { font-size: 2rem; }
  .cele-title { font-size: 2.2rem; }
  .message-text { font-size: 1rem; }
  .btn-yes { padding: 16px 48px; font-size: 1.1rem; }
  .intro-text { font-size: 1.3rem; }
}
