*,
*::before,
*::after {
  box-sizing: border-box;
}
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&family=Pacifico&display=swap');

:root {
  --pink: #ff9acb;
  --lavender: #d6c9ff;
  --bg-dark: #1a1435;
  --card-bg: #2c245c;
}

/* ---------- GLOBAL ---------- */
  :root {
  --pink: #ff9acb;
  --lavender: #d6c9ff;
  --bg-dark: #1a1435;
  --card-bg: #2c245c;
  --pz: 300px;
}
body {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background: radial-gradient(circle at top, #3b2f6b, var(--bg-dark));
  color: #f6f6ff;
  text-align: center;
  overflow-x: hidden;
  overscroll-behavior: none;
}

/* floating sparkles */
body::after {
  content: "✨ ✨ ✨";
  position: fixed;
  inset: 0;
  pointer-events: none;
  animation: sparkleFloat 12s linear infinite;
  opacity: 0.12;
  font-size: 40px;
}

@keyframes sparkleFloat {
  from { transform: translateY(0); }
  to { transform: translateY(-200px); }
}

/* ---------- HEADINGS ---------- */
h1, h2 {
  font-family: 'Pacifico', cursive;
  color: var(--pink);
  text-shadow: 0 0 20px rgba(255,143,207,0.5);
}

/* ---------- BUTTONS ---------- */
button {
  padding: 16px 32px;
  border-radius: 999px;
  border: none;
  font-size: clamp(1rem, 4vw, 1.1rem);
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--lavender));
  box-shadow: 0 10px 30px rgba(255,143,207,0.4);
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}

button:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 20px 45px rgba(255,154,203,0.6);
}

button:active {
  transform: scale(0.95);
}

/* ---------- MUSIC TOGGLE ---------- */
#musicToggle {
  position: fixed;
  top: 15px;
  right: 15px;
  background: var(--card-bg);
  border-radius: 50%;
  padding: 10px;
  font-size: 1.4rem;
  box-shadow: 0 0 20px rgba(162,210,255,0.5);
  z-index: 1000;
}

/* ---------- SCREENS ---------- */
.screen {
  display: none;
  min-height: 100svh;
  padding: 20px;
  width: 100%;
  animation: screenIn 0.8s ease;
}



.screen.active {
  display: block;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- LANDING ---------- */
#screen1 {
  display: none;
  flex-direction: column;
  justify-content: center;
  padding-top: 0;
}

#screen1.active {
  display: flex;
}

#screen1 h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);  
  margin-bottom: 15px;
}

#screen1 p {
  font-size: clamp(1rem, 4vw, 1.25rem);
  opacity: 0.9;
  margin-bottom: 40px;
}

/* ---------- PUZZLE ---------- */
#puzzle-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin: 24px auto 0;
  width: 100%;
}
#puzzle,
.slot,
.piece {
  touch-action: none;
}
#puzzle {
  width: var(--pz);
  height: var(--pz);
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  background: linear-gradient(145deg, #3b2f6b, #241c45);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.slot {
  width: 100%;
  height: 100%;
  border: 1px dashed rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.piece {
  width: calc(var(--pz) / 3);
  height: calc(var(--pz) / 3);
  background-image: url("puzzle.png");
  background-size: var(--pz) var(--pz);
  border-radius: 14px;
  cursor: grab;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.piece:hover {
  transform: scale(1.05);
  box-shadow: 0 0 25px rgba(255,143,207,0.6);
}
#puzzle {
  contain: layout paint;
}
#pieces {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 320px;
  justify-content: center;
}

/* ---------- PUZZLE POPUP ---------- */
#puzzlePopup {
  position: fixed;
  inset: 0;
  background: rgba(26, 20, 53, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 999;
}

#puzzlePopup.show {
  opacity: 1;
  pointer-events: all;
}

#puzzlePopup img {
  width: 320px;
  height: 320px;
  border-radius: 26px;
  box-shadow: 0 25px 80px rgba(200,160,255,0.8);
  animation: popIn 0.6s ease;
}

@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------- HEARTS ---------- */
.heart {
  position: fixed;
  color: #b792ff;
  pointer-events: none;
  animation: floatHeart 7s ease forwards;
}

@keyframes floatHeart {
  0% { opacity: 0; transform: translateY(0) scale(0.8); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-140px) scale(1.1); }
}

/* ---------- SLIDES ---------- */
#slideImg {
   width: min(90vw, 90vmin, 320px);
   aspect-ratio: 1 / 1;
  border-radius: 26px;
  object-fit: cover;
  margin-top: 20px;
  box-shadow: 0 25px 70px rgba(0,0,0,0.6);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.slide-hide {
  opacity: 0;
  transform: scale(0.95);
}


#slideCounter {
  margin-top: 8px;
  font-size: 0.95rem;
  opacity: 0.8;
  letter-spacing: 0.04em;
}
#slideText {
  margin-top: 16px;
  padding: 0 12px;
  font-size: 1rem;
  line-height: 1.5;
  color: #ffd6f0;
  animation: textFade 0.6s ease;
}

@keyframes textFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- FLOATING TEXT ---------- */
.floatText {
  position: fixed;
  font-size: 1.4rem;
  color: #ffd6f0;
  font-weight: 600;
  pointer-events: none;
  text-shadow: 0 0 10px rgba(255,200,240,0.6);
  animation: floatTextUp 6s linear forwards;
}

@keyframes floatTextUp {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-120px); }
}

/* ---------- FINAL CARD ---------- */
#card {
  background: linear-gradient(145deg, #fff0f8, #ffe4f2);
  color: #5a2a4a;
  border-radius: 24px;
  padding: 30px;
  max-width: 500px;
  margin: 30px auto 0;
  box-shadow: 0 20px 60px rgba(255,143,207,0.35);
  animation: cardReveal 0.8s ease forwards;
}

#card h3 {
  font-family: 'Pacifico', cursive;
  color: #ff5fa2;
}

@keyframes cardReveal {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- BACKGROUND DECOR ---------- */
.balloon,
.orb,
body::after {
  pointer-events: none;
}

.balloon {
  position: fixed;
  bottom: -120px;
  width: 60px;
  height: 80px;
  border-radius: 50%;
  opacity: 0.25;
  animation: floatUp linear infinite;
}

@keyframes floatUp {
  from { transform: translateY(0); }
  to { transform: translateY(-120vh); }
}

.orb {
  position: fixed;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,143,207,0.25), transparent 70%);
  filter: blur(40px);
  animation: drift 20s alternate infinite;
}

@keyframes drift {
  from { transform: translate(0,0); }
  to { transform: translate(100px, -120px); }
}

/* ---------- GIFT OVERLAY ---------- */
#giftOverlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 10, 30, 0.55);
  backdrop-filter: blur(8px);
  display: none;               /* IMPORTANT */
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 999;
}

/* ---------- BRAIN ---------- */
#brainImg {
  width: 180px;
  margin-top: 28px;
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.6s ease;
  pointer-events: none;
}

/* ---------- TEXT ---------- */
#brainText {
  margin-top: 10px;
  color: white;
  font-size: 1.1rem;
  opacity: 0;
  text-align: center;
  max-width: 90%;
  transition: opacity 0.6s ease;
}

/* ---------- REVEAL ---------- */
#giftOverlay.reveal {
  backdrop-filter: blur(10px);
}

#giftOverlay.reveal #brainImg {
  opacity: 1;
  transform: scale(1);
}

#giftOverlay.reveal #brainText {
  opacity: 1;
}

/* ---------- BIG GIFT BOX ---------- */
#giftBox {
  width: 280px;
  height: 280px;
  background: url("gift.png") center/contain no-repeat;
  cursor: pointer;
  transition: transform 0.6s ease, opacity 0.6s ease;
}

/* Hover = alive */
#giftBox:hover {
  transform: scale(1.08);
}

/* When opening */
#giftBox.open {
  transform: scale(0.3) rotate(10deg);
  opacity: 0;
}

/* ---------- BRAIN POP ---------- */
#brainImg {
  position: relative;
  width: 220px;
  margin-bottom: 16px;
  opacity: 0;
  transform: scale(0.4);
  transition: transform 0.7s ease, opacity 0.7s ease;
}


/* Brain visible */
#giftOverlay.reveal #brainImg {
  opacity: 1;
  transform: scale(1);
}
@media (max-width: 768px) {

  body {
    overflow-x: hidden;
  }

  /* Screens scale better */
  .screen {
    padding: 20px;
  }

  /* Gift box */
  #giftBox {
    width: 180px;
    height: 180px;
  }

  /* Balloons smaller + more */
  .balloon {
    width: 42px;
    height: 54px;
    opacity: 0.35;
  }

  .balloon::after {
    height: 40px;
  }

  /* Buttons feel tappable */
  button {
    padding: 14px 22px;
    font-size: 1rem;
  }
}
.puzzle-piece {
  touch-action: none;
  user-select: none;
}
.puzzle-piece {
  width: 100%;
  height: 100%;
  position: absolute;
  touch-action: none;        
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  cursor: grab;
}

.puzzle-piece:active {
  cursor: grabbing;
}

@media (max-width: 600px) {
  #puzzle-container {
    flex-direction: column;
  }

  #pieces {
    max-width: 100%;
  }
}
