/* Luna birthday - design matched to the aya reference, no vendor css */
* { margin:0; padding:0; box-sizing:border-box; }
html, body {
  height:100%; overflow:hidden;
  background:#05000a;
  font-family:'Arial', sans-serif;
  -webkit-font-smoothing:antialiased;
}

.stage { position:fixed; inset:0; display:none; }
.stage.active { display:flex; align-items:center; justify-content:center; }
.hidden { display:none !important; }

#rain { position:fixed; inset:0; width:104%; height:100%; z-index:1; pointer-events:none; }
.stars { position:fixed; inset:0; z-index:0; pointer-events:none;
  background-image:
    radial-gradient(1px 1px at 20% 30%, #fff, transparent),
    radial-gradient(1px 1px at 70% 60%, #fff, transparent),
    radial-gradient(1px 1px at 40% 80%, #fff, transparent),
    radial-gradient(1px 1px at 85% 20%, #fff, transparent),
    radial-gradient(1px 1px at 10% 70%, #fff, transparent),
    radial-gradient(1px 1px at 55% 15%, #fff, transparent),
    radial-gradient(1px 1px at 90% 85%, #fff, transparent),
    radial-gradient(1px 1px at 33% 50%, #fff, transparent);
  opacity:.55;
}

/* ---- 1. gate ---- */
#intro { flex-direction:column; z-index:5; padding:0 24px; }
.psst {
  font-family:'Arial', sans-serif;
  font-size:13px; letter-spacing:.38em; text-transform:uppercase;
  color:rgba(255,255,255,.62); margin-bottom:18px;
  animation:riseIn 1s ease both;
}
.gate { width:min(430px, 88vw); margin-top:38px; animation:riseIn 1.2s ease both; }
.gate input {
  width:100%; padding:15px 20px;
  font-family:'Dancing Script', cursive;
  font-size:19px; text-align:center; color:#fff;
  background:rgba(255,255,255,.05);
  border:1.5px solid rgba(255,105,180,.38);
  border-radius:40px; outline:none;
  transition:border-color .3s ease, box-shadow .3s ease, background .3s ease;
}
.gate input::placeholder { color:rgba(255,255,255,.42); font-style:italic; }
.gate input:focus {
  border-color:#ff69b4;
  background:rgba(255,105,180,.08);
  box-shadow:0 0 26px rgba(255,105,180,.4);
}
.gate.shake { animation:shake .4s ease; }
.gate-err {
  min-height:22px; margin-top:14px; text-align:center;
  font-family:'Arial', sans-serif; font-size:12.5px;
  letter-spacing:.14em; color:#ff7ba8; opacity:0;
  transition:opacity .3s ease;
}
.gate-err.on { opacity:1; }

/* ---- 2. countdown and name ---- */
#count { z-index:4; }
#spring { position:absolute; inset:0; width:100%; height:100%; display:block; }

/* ---- shared hint text ---- */
.tap {
  margin-top:34px;
  font-family:'Arial', sans-serif;
  font-size:12px; letter-spacing:.26em; text-transform:uppercase;
  color:rgba(255,255,255,.55);
  animation:blink 1.9s step-end infinite;
}

/* ---- 4. book ---- */
#bookStage { z-index:6; flex-direction:column; justify-content:center; }

/* the white card, values taken from the reference */
.card {
  position:fixed; top:3%; left:50%; transform:translateX(-50%);
  width:85vw; max-width:650px;
  min-height:150px; max-height:230px;
  padding:36px 32px;
  border-radius:20px;
  background:linear-gradient(145deg, #ffffff 0%, #fefefe 100%);
  box-shadow:
    0 20px 60px rgba(255,105,180,.28),
    0 10px 30px rgba(0,0,0,.16),
    inset 0 1px 0 rgba(255,255,255,.9);
  opacity:0; pointer-events:none;
  transition:opacity .5s ease;
  overflow-y:auto; z-index:12;
  scrollbar-width:thin;
  scrollbar-color:rgba(255,105,180,.35) transparent;
}
.card::after {
  content:'💕'; position:absolute; top:12px; right:18px;
  font-size:22px; animation:heartbeat 2s ease-in-out infinite;
}
.card.show { opacity:1; pointer-events:auto; }
.card p {
  margin:0; text-align:center;
  font-family:'Dancing Script', cursive;
  font-size:clamp(19px, 3vw, 25px);
  line-height:2.05; letter-spacing:.4px;
  background:linear-gradient(45deg, #8b4513, #a0522d, #8b4513, #6b3410);
  background-size:400% 400%;
  -webkit-background-clip:text; background-clip:text;
  -webkit-text-fill-color:transparent;
  animation:romanticText 8s ease-in-out infinite;
}
.type-cursor {
  display:inline-block; width:2px; height:1.05em;
  margin-left:2px; vertical-align:-2px;
  background:#8b4513; animation:blink 1s step-end infinite;
}

.book-wrap {
  perspective:2000px;
  margin-top:120px;
  transition:opacity .8s ease;
}
.book {
  position:relative; width:600px; height:400px;
  transform-style:preserve-3d;
  cursor:pointer; user-select:none;
  -webkit-tap-highlight-color:transparent;
}
.book::before {
  content:''; position:absolute; inset:-22px;
  background:radial-gradient(circle, rgba(255,255,255,.16) 0%, transparent 70%);
  filter:blur(16px); z-index:-1;
  animation:glowPulse 3s ease-in-out infinite;
}
.page {
  position:absolute; top:0; right:0;
  width:300px; height:400px;
  transform-origin:left center;
  transform-style:preserve-3d;
  transition:transform .8s cubic-bezier(.25,.46,.45,.94);
  box-shadow:0 0 0 1px rgba(255,255,255,.8), 0 10px 20px rgba(0,0,0,.3);
  cursor:pointer;
}
.page.flipped { transform:rotateY(-180deg); }
.page .front, .page .back {
  position:absolute; inset:0; overflow:hidden;
  backface-visibility:hidden;
  border:2px solid #e2e2e2; background:#fff;
}
.page .front { border-radius:0 8px 8px 0; z-index:2; }
.page .back { border-radius:8px 0 0 8px; transform:rotateY(180deg); }
.page img { width:100%; height:100%; object-fit:cover; display:block; }
.book-hint { margin-top:26px; }

/* ---- 5. heart finale ---- */
#final { z-index:7; flex-direction:column; }
.final-note {
  position:fixed; bottom:8%; left:50%; transform:translateX(-50%);
  font-family:'Dancing Script', cursive;
  font-size:clamp(22px, 4vw, 32px); color:#fff; text-align:center;
  text-shadow:0 0 24px rgba(255,105,180,.7);
  opacity:0; transition:opacity 1.4s ease; z-index:320; white-space:nowrap;
}
.final-note.show { opacity:1; }

/* the heart tiles, geometry from the reference */
.photo {
  position:fixed; width:120px; height:120px;
  border-radius:20px; object-fit:cover;
  border:5px solid #fff; background:#fff;
  box-shadow:0 0 20px rgba(255,105,180,.8);
  opacity:0; pointer-events:none; z-index:300;
  transform:translate(-50%,-50%) scale(0);
}

.fireworks { position:fixed; top:50%; left:50%;
  width:200px; height:200px; transform:translate(-50%,-50%);
  pointer-events:none; opacity:0;
  transition:opacity .3s ease; z-index:200; }
.firework {
  position:absolute; top:50%; left:50%;
  width:6px; height:20px;
  background:radial-gradient(circle, #fff 0%, transparent 70%);
  border-radius:50% 50% 0 0; transform-origin:bottom center;
  opacity:0; animation:fwBurst 1s ease forwards;
}
.confetti {
  position:fixed; width:9px; height:14px; border-radius:2px;
  pointer-events:none; z-index:250;
  animation:confettiFly 1s ease-out forwards;
}

.music {
  position:fixed; right:18px; bottom:18px; z-index:400;
  width:48px; height:48px; border-radius:50%; border:none;
  background:linear-gradient(135deg, #ff69b4, #ff1493);
  color:#fff; font-size:20px; cursor:pointer;
  box-shadow:0 6px 22px rgba(255,105,180,.45);
}
.music.off { opacity:.4; }
.music.hidden { display:none; }

/* ---- keyframes ---- */
@keyframes riseIn { from { opacity:0; transform:translateY(26px); } to { opacity:1; transform:none; } }
@keyframes countPop { 0% { opacity:0; transform:scale(.4); } 60% { transform:scale(1.12); } 100% { opacity:1; transform:scale(1); } }
@keyframes boxFloat { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-14px); } }
@keyframes blink { 50% { opacity:0; } }
@keyframes glowPulse { 0%,100% { opacity:.5; transform:scale(1); } 50% { opacity:.8; transform:scale(1.05); } }
@keyframes heartbeat { 0%,100% { transform:scale(1); opacity:.6; } 50% { transform:scale(1.2); opacity:.95; } }
@keyframes romanticText { 0%,100% { background-position:0% 50%; } 50% { background-position:100% 50%; } }
@keyframes shake { 0%,100% { transform:translateX(0); } 20% { transform:translateX(-9px); } 40% { transform:translateX(9px); } 60% { transform:translateX(-6px); } 80% { transform:translateX(6px); } }
@keyframes fwBurst {
  0% { opacity:1; transform:rotate(var(--rot)) translateY(0) scaleY(1); }
  100% { opacity:0; transform:rotate(var(--rot)) translateY(-110px) scaleY(3); }
}
@keyframes confettiFly {
  0% { opacity:1; transform:translate(0,0) rotate(0deg); }
  100% { opacity:0; transform:translate(var(--cx), var(--cy)) rotate(540deg); }
}

/* ---- small screens ---- */
@media (max-width: 700px) {
  .book-wrap { transform:scale(.62); transform-origin:center top; margin-top:130px; }
  .card { top:2%; padding:26px 22px; min-height:120px; max-height:34vh; }
  .card p { line-height:1.9; }
  .photo { width:74px; height:74px; border-width:3px; border-radius:14px; }
  .psst { font-size:11px; letter-spacing:.3em; }
  .gate input { font-size:17px; padding:13px 16px; }
}
@media (max-width: 460px) {
  .book-wrap { transform:scale(.46); margin-top:120px; }
  .photo { width:58px; height:58px; border-width:3px; border-radius:12px; }
}
@media (max-height: 560px) {
  .book-wrap { transform:scale(.5); margin-top:100px; }
}