* {
  box-sizing: border-box;
  font-family: 'Segoe UI', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #ffdde1, #ee9ca7);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  transition: background 0.5s ease;
}

body.night-mode {
  background: linear-gradient(135deg, #1a0033, #2d004d);
}


.top-controls {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 10px;             
  z-index: 1000;
}

.top-controls button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--control-bg, rgba(255,255,255,0.15));
  backdrop-filter: blur(6px);
  color: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, background 0.2s ease;
}

.top-controls button:hover {
  transform: scale(1.1);
}


body.night-mode .night-toggle {
  background: rgba(100, 50, 150, 0.3);
  border-color: rgba(200, 150, 255, 0.3);
}

body.night-mode::after {
  
  position: fixed;
  top: 80px;
  right: 30px;
  font-size: 3rem;
  opacity: 0.2;
  filter: blur(1px);
  pointer-events: none;
}
/* 
#refreshBtn {
  position: fixed;
  top: 16px;
  right: 64px; 
  background: transparent;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  opacity: 0.7;
}

#refreshBtn:hover {
  opacity: 1;
} */


.scene.locked {
  pointer-events: none;
}


/* Scene gives depth */
.scene {
  perspective: 1400px;
}

/* Card scales with screen */
.card {
  width: min(90vw, 700px);
  aspect-ratio: 3 / 4;
  position: relative;
  transform-style: preserve-3d;
  cursor: pointer;
  z-index: 1;
  transition: transform 360ms cubic-bezier(.2,.9,.2,1), box-shadow 360ms cubic-bezier(.2,.9,.2,1), opacity 360ms ease, filter 360ms ease;
  /* Subtle dim when behind the heart rain */
  opacity: 0.92;
  filter: brightness(0.95) saturate(0.95);
}


/* Shared cover styles */
.card-face {
  position: absolute;
  width: 50%;
  height: 100%;
  top: 0;
  background: white;
  box-shadow: 0 15px 35px rgba(0,0,0,0.25);
  overflow: hidden;
}


/* Image fits perfectly */
.card-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  
}

/* Left cover hinge */
.left-cover {
  left: 0;
  transform-origin: left center;
  transition: transform 1.1s ease;
  width: 50%;
}

/* Right cover hinge */
.right-cover {
  right: 0;
  transform-origin: right center;
  transition: transform 1.1s ease;
  width: 50%;
}

/* Inside page */
.card-inside {
  position: absolute;
  inset: 0;
  background: #fffafc;
  padding: clamp(12px, 4vw, 32px);
  text-align: center;
  opacity: 0;
  transition: opacity 0s ease 1.1s;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: 16px;
  overflow: hidden;
  
}

/* Open animation */
.card.open .left-cover {
  transform: rotateY(-155deg);
}

.card.open .right-cover {
  transform: rotateY(155deg);
}

.card.open .card-inside {
  opacity: 1;
  transition: opacity 0s ease;
}



/* Typography scaling */
.card-inside h1 {
  color: #cf2230;
  font-size: clamp(1rem, 4vw, 1.6rem);
  margin: 0;
  white-space: nowrap;
  font-weight: 300;
  font-family: 'Georgia', 'Times New Roman', serif;
}

.card-inside p {
  font-size: clamp(0.95rem, 4vw, 1.1rem);
  line-height: 1.6;
}


/* ===== Story System ===== */

.story-image {
  width: 100%;
  max-height: 250px;
  object-fit: cover;
  border-radius: 14px;
  opacity: 1;
  transform: none;
  transition: none;
}

.story-image.show {
  opacity: 1;
  /* transform: scale(1); */
}

.story-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 1rem;
}

#nextBtn {
  min-width: 120px;
  font-size: 1.1rem;
}
#nextBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}


.story-controls button,
.final-choice button {
  padding: 10px 18px;
  border-radius: 20px;
  border: none;
  background: #ff5a7a;
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
  transition: transform 0.2s ease, background 0.2s ease;
}

.story-controls button:hover,
.final-choice button:hover {
  transform: scale(1.05);
  background: #ff385f;
}

.final-choice {
  margin-top: 1.2rem;
}





.step {
  opacity: 1;
  transform: none;
  transition: none;
}



.step.active {
  opacity: 1;
}

.hidden {
  display: none;
}

.fade {
  opacity: 0;
  transition: opacity 0.6s ease;
}
.fade.show {
  opacity: 1;
}


.from {
  margin-top: 1.5rem;
  font-style: italic;
}

/* Tablet & desktop polish */
@media (min-width: 768px) {
  .card {
    width: 425px;
  }
}


.heart {
  position: absolute;
  top: -10vh;
  color: #c77dff; /* lavender */
  opacity: 0.6;
  animation-name: fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  pointer-events: none;
  text-shadow: 0 0 10px #c77dff, 0 0 20px rgba(199, 125, 255, 0.5);
  filter: drop-shadow(0 0 8px rgba(199, 125, 255, 0.4));
}

.red-heart {
  color: #ff1744; /* red */
  pointer-events: auto;
  text-shadow: 0 0 10px #ff1744, 0 0 20px rgba(255, 23, 68, 0.5);
  filter: drop-shadow(0 0 8px rgba(255, 23, 68, 0.4));
}

.heart {
  cursor: default;
}

.red-heart {
  cursor: pointer;
}

.heart-rain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 3;
}

@keyframes fall {
  to {
    transform: translateY(120vh);
  }
}

@keyframes popup {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(0, -60px) scale(1.3);
  }
}



.heart-counter {
  position: fixed;
  transform: translate(-50%, -50%) scale(0.3);
  font-size: 28px;
  font-weight: bold;
  color: white;
  text-shadow: 0 0 10px #ff1744, 0 0 20px rgba(255, 23, 68, 0.5);
  pointer-events: none;
  animation: popCounter 0.8s ease forwards;
  z-index: 9999;
}

@keyframes popCounter {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
  40% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.4);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -80%) scale(1);
  }
}




/* Birthday card (overlay-style, not full takeover) */
/* .birthday-card {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;

  background: transparent; 
  opacity: 0;
  pointer-events: none;
  z-index: 5;

  transition: opacity 0.8s ease;
} */


.birthday-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  display: flex;
  justify-content: center;
  align-items: center;

  width: min(90vw, 700px);
  z-index: 5;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}


.birthday-card.show {
  opacity: 1;
  pointer-events: auto;
}

/* .birthday-inner {
  background: white;
  padding: clamp(20px, 6vw, 40px);
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0,0,0,0.25);

  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.8s ease, opacity 0.8s ease;
} */


.birthday-inner {
  width: 100%;
  background: rgb(238, 217, 232);
  padding: clamp(20px, 6vw, 40px);
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0,0,0,0.25);

  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.8s ease, opacity 0.8s ease;
}


.birthday-card.show .birthday-inner {
  transform: scale(1);
  opacity: 1;
}

.birthday-card.show ~ .heart-rain {
  opacity: 0.6;
  filter: blur(2px);
  transition: opacity 0.6s ease, filter 0.6s ease;
}



.card {
  transition: transform 360ms cubic-bezier(.2,.9,.2,1),
              box-shadow 360ms cubic-bezier(.2,.9,.2,1),
              opacity 360ms ease,
              filter 360ms ease;
}

.hidden {
  display: none;
}

.tap-heart {
  position: fixed;
  color: #87ceeb; /* light blue */
  font-size: 2rem;
  pointer-events: none;
  animation: popup 0.6s ease-out forwards;
  text-shadow: 0 0 10px #87ceeb, 0 0 20px rgba(135, 206, 235, 0.5);
  filter: drop-shadow(0 0 8px rgba(135, 206, 235, 0.4));
}

.scene {
  position: relative;
  z-index: 1;
  transition: none;
}

.scene:hover,
.scene:focus-within {
  z-index: 4;
}

/* Visual lift when hovering/focusing the scene for accessibility */
.scene:hover .card,
.scene:focus-within .card {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 30px 50px rgba(0,0,0,0.28);
  /* Bring it visually above the rain */
  opacity: 1;
  filter: none;
}

.card-inside::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(0,0,0,0.04),
    transparent 70%
  );
  pointer-events: none;
}




/* ================= VALLY GUIDE ================= */



.vally-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(6px);
  background: rgba(255, 255, 255, 0.35);
  transition: opacity 0.6s ease;
}

.vally-overlay.show ~ .scene {
  filter: blur(4px);
}

.vally-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.vally {
  position: relative; 
  text-align: center;
  max-width: 425px;
  animation: vallyPop 0.6s ease both;
}

.vally img {
  width: 160px;
  max-width: 60vw;
  display: block;          
  margin: 10px auto;
  margin-right: 31px;         
}


.vally-speech {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  top: -100px;               
  left: 43%;
  transform: translateX(-50%);
  z-index: 2;
}


.vally-bubble {
  background: white;
  padding: 14px 18px;
  border-radius: 18px;
  font-size: clamp(0.85rem, 3.5vw, 0.95rem);
  line-height: 1.4;
  min-width: 220px;     
  max-width: 90vw;
  white-space: normal;
  word-break: keep-all;
  text-align: center;
  box-shadow: 0 15px 30px rgba(0,0,0,0.2);
  transition: opacity 0.4s ease;
  transform-origin: bottom center;
}


#vallyNext {
  margin-top: 6px;      
  padding: 8px 20px;
  border-radius: 18px;
  border: none;
  background: #ff5a7a;
  color: white;
  cursor: pointer;
  font-size: 0.85rem;
}

.vally-text::after {
  content: "▍";
  animation: blink 1s infinite;
}



@media (max-height: 600px) {
  .vally img {
    width: 110px;
  }

  .vally-bubble {
    font-size: 0.8rem;
  }
}

@keyframes blink {
  50% { opacity: 0; }
}




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


.btn-primary {
  padding: 10px 18px;
  border-radius: 20px;
  border: none;
  background: #ff5a7a;
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn-primary:hover {
  transform: scale(1.05);
  background: #ff385f;
}




/* ================= CONFETTI CANNONS ================= */

.confetti-piece {
  position: fixed;
  width: 8px;
  height: 14px;
  pointer-events: none;
  z-index: 9999;
  opacity: 1;
  border-radius: 2px;
}


/*  LIFE STATS MOVIE OUTRO */

.life-stats {
  position: fixed;
  inset: 0;
  background: linear-gradient(#000, #12001f);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
  gap: 1rem;
  padding: 2rem;
  z-index: 9999;
}

.life-stats.hidden {
  display: none;
}


.credit-gif {
  display: flex;
  justify-content: center; /* center / left / right */
  gap: 12px;               /* space between GIFs */
  margin: 2rem 0;
}

.credit-gif.left {
  justify-content: flex-start;
}

.credit-gif.right {
  justify-content: flex-end;
}

.credit-gif img {
  width: 118px;
  max-width: 40vw;
  height: auto;
}

@media (max-width: 480px) {
  .credit-gif {
    flex-wrap: wrap;
    justify-content: center;
  }
}
/* .credits {
  width: 100%;
  max-width: 600px;
  text-align: center;
  font-size: clamp(1rem, 3vw, 1.2rem);
  line-height: 2.2;
  padding-bottom: 40vh;
  animation: none;
} */

.credits {
  width: 100%;
  max-width: 600px;
  text-align: center;
  font-size: clamp(1rem, 3vw, 1.2rem);
  line-height: 2.2;
  padding-bottom: 40vh;
  will-change: transform;
}


.birthday-title {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  margin-bottom: 2rem;
  color: #ffd6f6;
  text-shadow: 0 0 20px rgba(255, 100, 200, 0.4);
}

.birthday-message {
  max-width: 600px;
  margin: 0 auto 2rem auto;
  font-size: clamp(1rem, 3vw, 1.2rem);
  line-height: 1.8;
  opacity: 0.95;
}


.credits h2 {
  font-size: 1.6rem;
  margin-bottom: 3rem;
}

.credit-divider {
  margin: 4rem auto;
  width: 60%;
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, #fff, transparent);
  opacity: 0.3;
}

.final-line {
  margin-top: 4rem;
  font-style: italic;
  opacity: 0.8;
}

/* @keyframes scrollCredits {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(-120%);
  }
} */


.replay-btn {
  position: fixed;
  bottom: 40px;
  right: 40px;
  padding: 12px 20px;
  border-radius: 25px;
  border: none;
  background: #ff5a7a;
  color: white;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(0,0,0,0.3);
  transition: transform 0.2s ease, background 0.2s ease, opacity 0.3s ease;
  z-index: 10000;
}

.replay-btn:hover {
  transform: scale(1.08);
  background: #ff385f;
}


.final-message {
  position: fixed;
  inset: 0;
  background: black;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 2s ease;
  text-align: center;
  z-index: 9999;
}

.final-message.show {
  opacity: 1;
}

.final-message h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.final-message p {
  font-size: 1.2rem;
  opacity: 0.8;
}


.final-replay-btn {
  margin-top: 30px;
  padding: 12px 24px;
  border-radius: 30px;
  border: none;
  background: #ff5a7a;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: 0.3s ease;
}

.final-replay-btn:hover {
  transform: scale(1.08);
  background: #ff385f;
}