@import url("https://fonts.googleapis.com/css2?family=Varela+Round&family=Fredoka+One&display=swap");

:root {
  --bg-1: #ff9a9e;
  --bg-2: #fad0c4;
  --bg-3: #a18cd1;
  --bg-4: #fbc2eb;
  --text-color: #5d2a42;
  --primary-pink: #ff6b9d;
  --accent-purple: #a18cd1;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  font-family: "Varela Round", sans-serif;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  background: linear-gradient(
    -45deg,
    var(--bg-1),
    var(--bg-2),
    var(--bg-3),
    var(--bg-4)
  );
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='48' style='fill:pink;font-size:24px;'><text y='50%'>✨</text></svg>")
      16 0,
    auto;
  user-select: none;
}

#bg-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
}

.bg-particle {
  position: absolute;
  opacity: 0;
  animation: floatUp linear infinite;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  font-family: "Segoe UI Emoji", sans-serif;
}

.progress-container {
  position: sticky;
  top: 20px;
  justify-self: center;
  width: 90%;
  max-width: 500px;
  z-index: 100;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 50px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.1);
  margin-top: 15px;
}

.progress-bar {
  height: 16px;
  background: linear-gradient(90deg, var(--primary-pink), #ff9a9e);
  border-radius: 50px;
  width: 0%;
  transition: width 0.1s linear;
  position: relative;
}

.progress-emoji {
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
}

.progress-text {
  text-align: center;
  color: var(--text-color);
  font-size: 0.8rem;
  font-weight: 800;
  margin-top: 6px;
  letter-spacing: 0.5px;
  transition: opacity 0.3s ease;
}

.main-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 600px;
  padding: 20px;
  margin: 0 auto;
  position: relative;
  z-index: 10;
  gap: 1rem;
}

.reason-box-wrapper {
  height: 60px;
  display: flex;
  justify-content: center;
  width: 100%;
}

.reason-box {
  background: rgba(255, 255, 255, 0.5);
  padding: 10px 24px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  text-align: center;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.5s ease;
  max-width: 90%;
}

.reason-box.show {
  opacity: 1;
  transform: translateY(0);
}

.reason-text {
  color: var(--text-color);
  font-size: 0.9rem;
  font-weight: bold;
  margin: 0;
}

.reason-number {
  color: var(--primary-pink);
  font-size: 0.7rem;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.glass-card {
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 2.2rem;
  border-radius: 35px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-5px);
}

h1 {
  color: var(--text-color);
  margin: 0;
  font-size: clamp(1.8rem, 6vw, 2.5rem);
  font-family: "Fredoka One", cursive;
}

.distance-pill {
  background: rgba(255, 255, 255, 0.6);
  padding: 8px 20px;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-color);
  display: inline-block;
}

.message-box {
  font-size: 1.1rem;
  color: var(--text-color);
  min-height: 3em;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  width: 100%;
  transition: opacity 0.3s ease;
}

.action-btn {
  background: white;
  color: #5d2a42;
  border: none;
  padding: 14px 35px;
  border-radius: 50px;
  font-family: "Fredoka One", cursive;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.action-btn:hover {
  transform: translateY(-3px) scale(1.05);
  background: #fff5f8;
}

.stage-container {
  position: relative;
  width: 100%;
  height: 180px;
  margin-top: 1rem;
}

.path-line {
  position: absolute;
  bottom: 40px;
  width: 90%;
  left: 5%;
  height: 4px;
  background-image: linear-gradient(
    to right,
    var(--text-color) 50%,
    rgba(255, 255, 255, 0) 0%
  );
  background-position: bottom;
  background-size: 20px 4px;
  background-repeat: repeat-x;
  opacity: 0.3;
  animation: roadMove 0.5s linear infinite;
}

.char {
  position: absolute;
  bottom: 45px;
  font-size: clamp(3rem, 12vw, 5rem);
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.15));
  will-change: left, right;
  z-index: 15;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.char.hugging-left {
  transform: translateX(20px) rotate(10deg);
  z-index: 16;
}

.char.hugging-right {
  transform: translateX(-20px) rotate(-10deg) scaleX(-1);
}

.final-heart {
  position: absolute;
  left: 50%;
  bottom: 60px;
  transform: translateX(-50%) scale(0);
  font-size: clamp(4rem, 15vw, 7rem);
  z-index: 20;
  opacity: 0;
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.final-heart.pop {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  animation: heartbeat 1s infinite;
}

.heart-hint {
  position: absolute;
  left: 50%;
  bottom: -30px;
  transform: translateX(-50%);
  font-size: 0.8rem;
  color: var(--text-color);
  white-space: nowrap;
  opacity: 0;
  animation: hintPulse 1.5s ease-in-out infinite;
}

.secret-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.secret-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.secret-message {
  background: white;
  padding: 2rem;
  border-radius: 35px;
  border: 4px solid var(--primary-pink);
  max-width: 90%;
  width: 450px;
  text-align: center;
  transform: scale(0.8);
  transition: transform 0.4s ease;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.secret-overlay.active .secret-message {
  transform: scale(1);
}

.secret-message h2 {
  color: var(--primary-pink);
  font-family: "Fredoka One", cursive;
  margin-top: 0;
}

.secret-message p {
  color: #333;
  margin: 15px 0;
  font-size: 1.1rem;
  line-height: 1.6;
}

.close-btn {
  background: var(--primary-pink);
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 25px;
  font-weight: bold;
  cursor: pointer;
  font-family: "Fredoka One";
  font-size: 1rem;
}

.shake-hint {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: bold;
  color: var(--text-color);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 150;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.shake-hint.show {
  opacity: 1;
}

.cursor-trail,
.click-heart,
.sparkle,
.confetti {
  position: fixed;
  pointer-events: none;
  z-index: 500;
  font-family: "Segoe UI Emoji", sans-serif;
}

.confetti {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: confettiFall 3s forwards;
}

.sparkle {
  font-size: 1.5rem;
  animation: sparkle 1.5s forwards;
}

.cursor-trail {
  font-size: 1.2rem;
  animation: trailFade 1s forwards;
}

.click-heart {
  font-size: 2rem;
  animation: heartFloat 1.5s forwards;
}

@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@keyframes roadMove {
  from {
    background-position: 0 0;
  }

  to {
    background-position: -20px 0;
  }
}

@keyframes floatUp {
  0% {
    transform: translateY(110vh) scale(0);
    opacity: 0;
  }

  10% {
    opacity: 0.7;
    transform: translateY(100vh) scale(1);
  }

  100% {
    transform: translateY(-10vh) scale(1);
    opacity: 0;
  }
}

@keyframes heartbeat {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
  }

  50% {
    transform: translateX(-50%) scale(1.15);
  }
}

@keyframes hintPulse {
  0%,
  100% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }
}

@keyframes confettiFall {
  to {
    transform: translate(var(--x-spread), 100vh) rotate(720deg);
    opacity: 0;
  }
}

@keyframes sparkle {
  0% {
    opacity: 0;
    transform: scale(0);
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: scale(0.5) rotate(360deg);
  }
}

@keyframes trailFade {
  0% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
}

@keyframes heartFloat {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -150px) scale(1.8);
  }
}

.anim-waddle-left {
  animation: waddleLeft 0.7s ease-in-out infinite alternate;
}

.anim-waddle-right {
  animation: waddleRight 0.7s ease-in-out infinite alternate;
}

.anim-float {
  animation: float 3s ease-in-out infinite;
}

@keyframes waddleLeft {
  0% {
    transform: translateY(0) rotate(-4deg);
  }

  100% {
    transform: translateY(-10px) rotate(4deg);
  }
}

@keyframes waddleRight {
  0% {
    transform: translateY(0) rotate(4deg) scaleX(-1);
  }

  100% {
    transform: translateY(-10px) rotate(-4deg) scaleX(-1);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-20px);
  }
}

@media (max-width: 600px) {
  .glass-card {
    padding: 1.5rem;
  }

  .secret-message {
    padding: 1.5rem;
  }

  .main-layout {
    gap: 1rem;
  }

  h1 {
    font-size: 1.5rem;
  }
}
