

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* Disables text highlighting on click/drag */
  user-select: none; 
  -webkit-user-select: none;
  /* Removes the blue flash on mobile taps */
  -webkit-tap-highlight-color: transparent; 
}

body {
  font-family: "Space Grotesk", sans-serif;
  background: linear-gradient(-45deg, #ff416c, #ff4b2b, #8a2387, #e94057);
  background-size: 400% 400%;
  animation: gradientBG 12s ease infinite;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
  text-align: center;
  padding: 20px;
  overflow-x: hidden;
}
@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.screen {
  max-width: 500px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  transition: opacity 0.5s ease;
}

.hidden {
  display: none !important;
}

.title {
  font-family: "Dancing Script", cursive;
  font-size: 3.5rem;
  margin-bottom: 5px;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

.subtitle {
  font-size: 1.1rem;
  margin-bottom: 30px;
  opacity: 0.9;
  font-weight: 600;
}

/* --- GAME ELEMENTS --- */
#tap-target {
  font-size: 5rem;
  cursor: pointer;
  user-select: none;
  /* This completely detaches the cat from the layout so it can fly anywhere */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(
    -50%,
    -50%
  ); /* Keeps it perfectly centered at the start */
  /* Smoothly animates its flight to the new spot */
  transition: top 0.2s ease-out, left 0.2s ease-out, transform 0.2s ease-out;
  z-index: 50;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
}

.progress-container {
  width: 100%;
  height: 25px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 15px;
  transition: width 0.2s cubic-bezier(0.4, 0.2, 0.2, 1);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* --- PROMISES GRID --- */
.promises-grid {
  display: flex;
  flex-direction: column;
  gap: 25px;
  width: 100%;
}

.flip-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
  transform: translateY(120px) scale(0.3);
  pointer-events: none;
  /* Change 0.7s here to adjust how fast it pops out of the envelope */
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.5s ease;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.2s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
}

/* On desktop hover, just peek the card slightly to invite a click */
@media (hover: hover) {
  .flip-card:hover .flip-card-inner {
    transform: rotateY(30deg) scale(1.02);
  }
}

/* The JavaScript strictly controls the full 180-degree flip */
.flip-card.is-flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.flip-card-front {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-family: "Dancing Script", cursive;
  font-size: 2.5rem;
  letter-spacing: 2px;
}

.flip-card-back {
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  transform: rotateY(180deg);
  font-weight: 600;
  font-size: 1rem;
}

.meme-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 15px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Interactive Emojis styling */
.floating-emoji {
  position: fixed;
  font-size: 1.5rem;
  pointer-events: none;
  animation: floatUp 1s ease-out forwards;
  z-index: 100;
}

@keyframes floatUp {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) scale(1.5);
    opacity: 0;
  }
}

/* --- CINEMATIC SCENE STYLING --- */
.scene-container {
  position: relative;
  width: 100%;
  height: 400px; /* Gives room for the cards to drop down */
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin-top: 40px;
}

/* --- ENVELOPE STYLING --- */
.envelope-wrapper {
  position: absolute;
  z-index: 10;
  cursor: pointer;
  transition: opacity 0.8s ease, transform 0.8s ease;
  animation: float 3s ease-in-out infinite;
}

.envelope {
  width: 220px;
  height: 140px;
  background: #ff758c;
  position: relative;
  border-radius: 8px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
}

.flap {
  position: absolute;
  top: 0;
  left: 0;
  border-left: 110px solid transparent;
  border-right: 110px solid transparent;
  border-top: 80px solid #ff416c;
  transform-origin: top;
  transition: transform 0.6s ease;
  z-index: 2;
}

.envelope.open .flap {
  transform: rotateX(180deg);
}

/* --- THE DECK OF CARDS --- */
.card-stack {
  position: absolute;
  width: 300px;
  height: 290px;
  z-index: 5;
  perspective: 1000px;
}

/* The Outer Card Container controls movement/tossing */
.flip-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
  /* Start hidden inside the envelope */
  transform: translateY(120px) scale(0.3);
  pointer-events: none;
  /* Smoothly animates sliding up, and then later getting tossed aside */
  transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.5s ease;
}

/* The Inner Card controls the actual flipping */
.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
}

/* Apply this class via JS to flip the card over permanently */
.flip-card.is-flipped .flip-card-inner {
  transform: rotateY(180deg);
}

/* Faces of the cards */
.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.flip-card-front {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-family: "Dancing Script", cursive;
  font-size: 2.5rem;
  letter-spacing: 2px;
}

.flip-card-back {
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  transform: rotateY(180deg);
  font-weight: 600;
  font-size: 1rem;
}
/* --- SPRINKLE BURST EFFECT --- */
.sprinkle {
  position: fixed;
  font-size: 1.5rem;
  pointer-events: none;
  z-index: 100;
  /* Start exactly in the center of the screen */
  top: 50%;
  left: 50%;
  /* The --tx and --ty variables are injected by JavaScript for random directions */
  animation: burstAnim 1s ease-out forwards;
}

@keyframes burstAnim {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 1;
  }
  100% {
    /* Shoots outwards to the random coordinates and fades out */
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty)))
      scale(1.5) rotate(180deg);
    opacity: 0;
  }
}
