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

html, body { height: 100%; }

body {
  background: #08030c;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #fff;
}

.hidden { display: none !important; }

/* ---------- portrait stage (phone-shaped frame) ---------- */

#portrait {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(900px 600px at 50% 0%, #17081f 0%, #08030c 65%);
}

#stage-box {
  position: relative;
  width: min(100vw, 56.25vh);
  height: 100vh;
  max-width: 100vw;
  overflow: hidden;
  background: #0d0612;
  border-radius: 28px;
  box-shadow: 0 0 90px rgba(255, 111, 165, .14), 0 0 0 1px rgba(255, 255, 255, .07);
}

@media (max-width: 640px), (max-height: 820px) {
  #stage-box { border-radius: 0; box-shadow: none; }
}

/* ---------- landing ---------- */

#landing {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 1s ease, transform 1s ease;
}

#landing.leaving { opacity: 0; transform: scale(1.05); pointer-events: none; }

.landing-bg {
  position: absolute;
  inset: 0;
  background: url('pookie-pics/12-landing.jpg') center / cover no-repeat;
  filter: blur(16px) brightness(.4) saturate(1.25);
  transform: scale(1.15);
  animation: slowZoom 26s ease-in-out infinite alternate;
}

@keyframes slowZoom {
  from { transform: scale(1.15) translate(0, 0); }
  to   { transform: scale(1.3) translate(-1.5%, 1%); }
}

.landing-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(13,6,18,.5) 0%, rgba(13,6,18,.82) 100%);
}

.landing-content { position: relative; z-index: 2; text-align: center; padding: 0 24px; }

.landing-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.8rem, 7.5vh, 4.4rem);
  font-weight: 400;
  letter-spacing: .12em;
  padding-left: .12em;
  white-space: nowrap;
  background: linear-gradient(180deg, #ffe3ee 0%, #ffb3cf 60%, #ff8fb8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 60px rgba(255, 140, 190, .35);
}

.landing-sub {
  margin-top: 18px;
  font-size: clamp(.8rem, 2.5vw, 1rem);
  letter-spacing: .4em;
  padding-left: .4em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .65);
}

#startBtn {
  margin-top: 52px;
  font-family: inherit;
  font-size: 1.05rem;
  letter-spacing: .3em;
  padding-left: .3em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #ff6fa5, #c75b8d);
  border: none;
  padding: 19px 54px;
  border-radius: 999px;
  cursor: pointer;
  animation: glowPulse 2.6s ease-in-out infinite;
  transition: transform .25s ease;
}

#startBtn:hover { transform: scale(1.07); }

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 24px rgba(255,111,165,.55); }
  50%      { box-shadow: 0 0 52px rgba(255,111,165,.95); }
}

/* ---------- slideshow: 3D card roll ---------- */

#slideshow { position: absolute; inset: 0; z-index: 10; background: #0d0612; }

#stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  perspective: 1400px;
  perspective-origin: 50% 45%;
  transition: opacity .9s ease;
}

#stage.leaving { opacity: 0; }

.card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 88%;
  height: 84%;
  border-radius: 12px;
  overflow: hidden;
  background: #0d0612;
  box-shadow: 0 24px 50px rgba(0, 0, 0, .55);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  pointer-events: none;
  transition: transform 1.1s cubic-bezier(.4, .1, .2, 1), filter 1.1s ease, opacity 1.1s ease;
}

.card .fill { position: absolute; inset: 0; overflow: hidden; }

.card .fill img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.12);
}

.card .photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.card.front {
  z-index: 10;
  transform: translate(-50%, -50%) translateZ(0) rotateY(0) scale(1);
  filter: none;
  opacity: 1;
  will-change: transform;
}

.card.near {
  z-index: 9;
  transform: translate(-50%, -50%) translateX(24%) translateZ(-160px) rotateY(-16deg) scale(.72);
  filter: blur(3px);
  opacity: 1;
}

.card.mid {
  z-index: 8;
  transform: translate(-50%, -50%) translateX(33%) translateZ(-320px) rotateY(-22deg) scale(.56);
  filter: blur(6px);
  opacity: .95;
}

.card.far {
  z-index: 7;
  transform: translate(-50%, -50%) translateX(40%) translateZ(-480px) rotateY(-26deg) scale(.44);
  filter: blur(10px) brightness(.8);
  opacity: .8;
}

.card.out {
  z-index: 5;
  transform: translate(-50%, -50%) translateX(55%) translateZ(-500px) rotateY(-30deg) scale(.38);
  filter: blur(12px);
  opacity: 0;
  transition: transform .55s cubic-bezier(.4, .1, .3, 1), filter .55s ease, opacity .55s ease;
}

#counter {
  position: absolute;
  bottom: 22px;
  left: 24px;
  z-index: 6;
  font-size: 12px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .7);
  text-shadow: 0 1px 6px rgba(0,0,0,.6);
}

#progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 0%;
  z-index: 7;
  background: linear-gradient(90deg, #ff9ec4, #ff6fa5);
  box-shadow: 0 0 14px rgba(255, 111, 165, .8);
  transition: width 1s ease;
}

#skipBtn {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 7;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .25);
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background .2s ease;
}

#skipBtn:hover { background: rgba(255, 255, 255, .2); }

/* ---------- finale ---------- */

#finale {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: radial-gradient(700px 500px at 50% 115%, #2a0f22 0%, #0d0612 70%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#finaleVidWrap { position: absolute; inset: 0; }

#finaleVid {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 1.6s ease;
}

#finaleVid.fade-out { opacity: 0; }

.finale-text { position: relative; z-index: 2; padding: 0 20px; }

#loveText {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: clamp(1.3rem, 5.5vh, 3.2rem);
  letter-spacing: .22em;
  padding-left: .22em;
  white-space: nowrap;
  color: #ffd9e6;
  text-shadow: 0 0 30px rgba(255, 140, 190, .8), 0 0 90px rgba(255, 140, 190, .4);
  opacity: 0;
  animation: textIn 2.2s ease forwards;
  animation-play-state: paused;
}

#pookieText {
  margin-top: 10px;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: clamp(2rem, 9vh, 6rem);
  letter-spacing: .1em;
  padding-left: .1em;
  white-space: nowrap;
  background: linear-gradient(92deg, #ff9ec4, #ff6fa5 55%, #ffd9a0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 28px rgba(255, 111, 165, .65));
  opacity: 0;
  animation: textIn 2.4s .8s ease forwards;
  animation-play-state: paused;
}

@keyframes textIn {
  from { opacity: 0; transform: scale(.6); letter-spacing: .6em; }
  to   { opacity: 1; transform: scale(1); }
}

#replayBtn {
  position: relative;
  z-index: 3;
  margin-top: 64px;
  font-family: inherit;
  font-size: .95rem;
  letter-spacing: .3em;
  padding-left: .3em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(255, 111, 165, .18);
  border: 1px solid rgba(255, 158, 196, .5);
  padding: 15px 44px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .25s ease;
  animation: glowPulse 3s ease-in-out infinite;
}

#replayBtn:hover { transform: scale(1.06); background: rgba(255, 111, 165, .3); }

/* ---------- hearts ---------- */

.hearts { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 4; }

.heart {
  position: absolute;
  bottom: -8vh;
  color: #ff7ba9;
  opacity: .7;
  animation: rise linear forwards;
  will-change: transform, opacity;
}

.heart::before { content: '\2665'; }

@keyframes rise {
  0%   { transform: translateY(0) rotate(-8deg); opacity: 0; }
  10%  { opacity: var(--o, .7); }
  100% { transform: translateY(-112vh) rotate(16deg); opacity: 0; }
}