/* ===== CSS Variables ===== */
:root {
  --pink-light: #ffe4ec;
  --pink-medium: #ff85a2;
  --pink-dark: #ff3d6e;
  --rose: #e91e63;
  --purple-light: #f3e5f5;
  --purple-medium: #ce93d8;
  --purple-dark: #9c27b0;
  --red-heart: #e53935;
  --gold: #ffd700;
  --white: #ffffff;
  --gradient-romantic: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
  --gradient-love: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-sunset: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  --shadow-soft: 0 10px 40px rgba(255, 61, 110, 0.2);
  --shadow-glow: 0 0 30px rgba(255, 105, 180, 0.4);
}

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--gradient-romantic);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* ===== Floating Hearts Background ===== */
.hearts-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.floating-bg-heart {
  position: absolute;
  font-size: 20px;
  animation: floatUp 8s ease-in-out infinite;
  opacity: 0.6;
}

@keyframes floatUp {
  0% {
    transform: translateY(100vh) rotate(0deg) scale(1);
    opacity: 0;
  }

  10% {
    opacity: 0.6;
  }

  90% {
    opacity: 0.6;
  }

  100% {
    transform: translateY(-100vh) rotate(720deg) scale(0.5);
    opacity: 0;
  }
}

/* ===== Pages ===== */
.page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease, visibility 0.8s ease;
  z-index: 1;
}

.page.active {
  opacity: 1;
  visibility: visible;
}

.content {
  text-align: center;
  padding: 20px;
  max-width: 500px;
  width: 100%;
}

/* ===== Welcome Page - Greeting Card ===== */
.greeting-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 30px;
  padding: 50px 40px;
  box-shadow: var(--shadow-soft), var(--shadow-glow);
  position: relative;
  overflow: hidden;
  animation: cardAppear 1s ease-out;
}

.greeting-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 182, 193, 0.3) 0%, transparent 70%);
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {

  0%,
  100% {
    transform: rotate(0deg);
  }

  50% {
    transform: rotate(180deg);
  }
}

@keyframes cardAppear {
  0% {
    transform: scale(0.8) translateY(30px);
    opacity: 0;
  }

  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.sparkle {
  position: absolute;
  font-size: 24px;
  animation: sparkle 2s ease-in-out infinite;
}

.sparkle-1 {
  top: 20px;
  left: 30px;
  animation-delay: 0s;
}

.sparkle-2 {
  top: 30px;
  right: 30px;
  animation-delay: 0.5s;
}

.sparkle-3 {
  bottom: 30px;
  left: 50%;
  animation-delay: 1s;
}

@keyframes sparkle {

  0%,
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 0.7;
  }

  50% {
    transform: scale(1.3) rotate(180deg);
    opacity: 1;
  }
}

.greeting {
  font-family: 'Dancing Script', cursive;
  font-size: 4rem;
  font-weight: 700;
  background: var(--gradient-love);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
  animation: textGlow 2s ease-in-out infinite alternate;
}

@keyframes textGlow {
  0% {
    filter: drop-shadow(0 0 10px rgba(255, 61, 110, 0.3));
  }

  100% {
    filter: drop-shadow(0 0 20px rgba(255, 61, 110, 0.6));
  }
}

.subtitle {
  font-size: 1.1rem;
  color: #888;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.heart-divider {
  margin: 25px 0;
  position: relative;
  z-index: 1;
}

.heart-divider span {
  font-size: 2rem;
  animation: heartBeat 1s ease-in-out infinite;
}

@keyframes heartBeat {

  0%,
  100% {
    transform: scale(1);
  }

  25% {
    transform: scale(1.1);
  }

  50% {
    transform: scale(1);
  }

  75% {
    transform: scale(1.2);
  }
}

/* ===== Code Section ===== */
.code-section {
  position: relative;
  z-index: 1;
}

.code-label {
  font-size: 0.95rem;
  color: #666;
  margin-bottom: 20px;
}

.code-input-wrapper {
  margin-bottom: 15px;
}

#codeInput {
  width: 180px;
  height: 60px;
  font-size: 2rem;
  text-align: center;
  letter-spacing: 15px;
  border: 3px solid var(--pink-medium);
  border-radius: 15px;
  background: white;
  color: var(--pink-dark);
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  outline: none;
  transition: all 0.3s ease;
}

#codeInput:focus {
  border-color: var(--pink-dark);
  box-shadow: 0 0 20px rgba(255, 61, 110, 0.3);
  transform: scale(1.02);
}

#codeInput::placeholder {
  color: #ddd;
  letter-spacing: 10px;
}

.hint {
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 15px;
}

.error-message {
  color: var(--red-heart);
  font-size: 0.9rem;
  margin-bottom: 15px;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.error-message.show {
  opacity: 1;
  transform: translateY(0);
  animation: shake 0.5s ease;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-10px);
  }

  75% {
    transform: translateX(10px);
  }
}

/* ===== Buttons ===== */
.btn {
  padding: 15px 40px;
  font-size: 1.1rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--gradient-love);
  color: white;
  box-shadow: 0 5px 20px rgba(240, 147, 251, 0.4);
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 30px rgba(240, 147, 251, 0.6);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-hearts {
  margin-left: 8px;
}

/* ===== Valentine Page ===== */
.valentine-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 30px;
  padding: 50px 40px;
  box-shadow: var(--shadow-soft), var(--shadow-glow);
  position: relative;
  animation: cardAppear 1s ease-out;
}

.floating-heart {
  position: absolute;
  font-size: 30px;
  animation: floatAround 6s ease-in-out infinite;
}

.heart-1 {
  top: 10%;
  left: 10%;
  animation-delay: 0s;
}

.heart-2 {
  top: 15%;
  right: 10%;
  animation-delay: 1.5s;
}

.heart-3 {
  bottom: 15%;
  left: 15%;
  animation-delay: 3s;
}

.heart-4 {
  bottom: 10%;
  right: 15%;
  animation-delay: 4.5s;
}

@keyframes floatAround {

  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  25% {
    transform: translateY(-15px) rotate(10deg);
  }

  50% {
    transform: translateY(0) rotate(0deg);
  }

  75% {
    transform: translateY(-10px) rotate(-10deg);
  }
}

.top-heart {
  font-size: 2.5rem;
  margin-bottom: 15px;
  animation: heartBeat 1.5s ease-in-out infinite;
}

.bear-emoji {
  font-size: 4rem;
  margin-bottom: 15px;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-15px);
  }
}

.valentine-title {
  font-family: 'Dancing Script', cursive;
  font-size: 2.8rem;
  font-weight: 700;
  background: var(--gradient-love);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 15px;
}

.valentine-subtitle {
  font-size: 1rem;
  color: #888;
  margin-bottom: 25px;
}

.rose-container {
  margin: 25px 0;
}

.rose {
  font-size: 2.5rem;
  margin: 0 10px;
  display: inline-block;
  animation: sway 2s ease-in-out infinite;
}

.rose:nth-child(1) {
  animation-delay: 0s;
}

.rose:nth-child(2) {
  animation-delay: 0.3s;
}

.rose:nth-child(3) {
  animation-delay: 0.6s;
}

@keyframes sway {

  0%,
  100% {
    transform: rotate(-5deg);
  }

  50% {
    transform: rotate(5deg);
  }
}

/* ===== Yes/No Buttons ===== */
.button-container {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 30px;
  min-height: 80px;
  position: relative;
}

.btn-yes {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: white;
  font-size: 1.3rem;
  padding: 18px 50px;
  box-shadow: 0 5px 25px rgba(56, 239, 125, 0.4);
  animation: pulse 2s ease-in-out infinite;
}

.btn-yes:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 35px rgba(56, 239, 125, 0.6);
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 5px 25px rgba(56, 239, 125, 0.4);
  }

  50% {
    box-shadow: 0 5px 35px rgba(56, 239, 125, 0.7);
  }
}

.btn-no {
  background: linear-gradient(135deg, #bdc3c7 0%, #95a5a6 100%);
  color: #666;
  font-size: 0.9rem;
  padding: 12px 25px;
  transition: all 0.15s ease;
}

.btn-no:hover {
  transform: scale(0.9);
}

.btn-no.running {
  position: absolute;
}

.playful-text {
  margin-top: 20px;
  font-size: 0.95rem;
  color: var(--pink-dark);
  min-height: 25px;
  font-style: italic;
}

/* ===== Success Page ===== */
.success-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 30px;
  padding: 50px 40px;
  box-shadow: var(--shadow-soft), var(--shadow-glow);
  position: relative;
  overflow: hidden;
  animation: cardAppear 1s ease-out;
}

.confetti-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  animation: confettiFall 3s ease-in-out infinite;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-100%) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(400px) rotate(720deg);
    opacity: 0;
  }
}

.success-hearts {
  font-size: 2rem;
  margin-bottom: 20px;
}

.success-hearts span {
  display: inline-block;
  animation: popIn 0.5s ease-out forwards;
  opacity: 0;
  margin: 0 5px;
}

.success-hearts span:nth-child(1) {
  animation-delay: 0.1s;
}

.success-hearts span:nth-child(2) {
  animation-delay: 0.2s;
}

.success-hearts span:nth-child(3) {
  animation-delay: 0.3s;
}

.success-hearts span:nth-child(4) {
  animation-delay: 0.4s;
}

.success-hearts span:nth-child(5) {
  animation-delay: 0.5s;
}

@keyframes popIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }

  50% {
    transform: scale(1.3);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.success-title {
  font-family: 'Dancing Script', cursive;
  font-size: 4rem;
  font-weight: 700;
  background: var(--gradient-sunset);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: celebrate 0.5s ease-out;
}

@keyframes celebrate {
  0% {
    transform: scale(0.5);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

.success-message {
  font-size: 1.2rem;
  color: #888;
  margin: 15px 0 25px;
}

.nanaj-photo {
  margin: 30px 0;
  animation: heartBeat 1.5s ease-in-out infinite;
}

.nanaj-img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--pink-medium);
  box-shadow: 0 8px 30px rgba(255, 105, 180, 0.4),
    0 0 20px rgba(255, 182, 193, 0.3);
  transition: all 0.3s ease;
}

.nanaj-img:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 40px rgba(255, 105, 180, 0.6),
    0 0 30px rgba(255, 182, 193, 0.5);
}

.farewell {
  margin-top: 30px;
}

.doi-doi {
  font-family: 'Dancing Script', cursive;
  font-size: 3.5rem;
  font-weight: 700;
  background: var(--gradient-love);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  animation: textGlow 2s ease-in-out infinite alternate;
}

.see-you {
  font-size: 1.1rem;
  color: #999;
}

.final-hearts {
  margin-top: 30px;
}

.pulse-heart {
  font-size: 3rem;
  display: inline-block;
  animation: heartBeat 1s ease-in-out infinite;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {

  .greeting-card,
  .valentine-card,
  .success-card {
    padding: 35px 25px;
    border-radius: 25px;
  }

  .greeting {
    font-size: 3rem;
  }

  .valentine-title {
    font-size: 2.2rem;
  }

  .success-title {
    font-size: 3rem;
  }

  .doi-doi {
    font-size: 2.8rem;
  }

  .button-container {
    flex-direction: column;
    gap: 15px;
  }

  .btn-yes {
    padding: 15px 40px;
    font-size: 1.1rem;
  }

  .floating-heart {
    font-size: 20px;
  }
}