:root {
  --bg: #0a0a0f;
  --fg: #ffffff;
  --pink: #ffd6e7;
  --heart: #ff2b4f;
  --shadow: rgba(255, 43, 79, 0.6);
  --textGlow: 0 0 0.6rem rgba(255, 214, 231, 0.9);
  --maxWidth: 1200px;
  --messageBoxBg: rgba(139, 69, 119, 0.6);
  /* Rosa oscuro translúcido */
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Pattaya", sans-serif;
  font-weight: 400;
  font-style: normal;
  color: var(--fg);
  background: linear-gradient(to bottom,
      #000000,
      #2a3a6b);
  /* Degradado nocturno más suave */
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.scene {
  position: relative;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
}

.scene[data-bg="stars"] {
  background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
  background-attachment: fixed;
}

/* Hiệu ứng mây khí (Nebula) */
.scene[data-bg="stars"]::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 50%, rgba(75, 0, 130, 0.25) 0%, transparent 60%),
    radial-gradient(circle at 85% 30%, rgba(0, 0, 139, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(138, 43, 226, 0.2) 0%, transparent 60%);
  filter: blur(80px);
  z-index: -2;
  pointer-events: none;
}

.scene[data-bg="stars"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 40% 10%, rgba(0, 191, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 70% 90%, rgba(148, 0, 211, 0.1) 0%, transparent 60%);
  filter: blur(100px);
  z-index: -1;
  pointer-events: none;
}

/* Container cho các ngôi sao động */
.stars-container {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  opacity: 0;
  animation: starTwinkle var(--duration) ease-in-out infinite;
  box-shadow: 0 0 3px #fff;
}

@keyframes starTwinkle {

  0%,
  100% {
    opacity: 0.2;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* Ngôi sao hình chữ thập */
.star-cross {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 4px 1px #fff;
  animation: starTwinkle var(--duration) ease-in-out infinite;
}

.star-cross::before,
.star-cross::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 1px;
}

.star-cross::before {
  width: 12px;
  height: 1px;
}

.star-cross::after {
  width: 1px;
  height: 12px;
}

/* Hiệu ứng Sao băng */
.shooting-star {
  position: absolute;
  width: 180px;
  height: 4px;
  background: linear-gradient(to left, #fff, rgba(255, 255, 255, 0.1), transparent);
  clip-path: polygon(0% 0%, 0% 100%, 100% 50%);
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.9));
  animation: shooting var(--duration) linear forwards;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transform-origin: right center;
}

.shooting-star::before {
  content: "";
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  box-shadow:
    0 0 15px 4px #fff,
    0 0 30px 8px rgba(255, 255, 255, 0.5);
}



@keyframes shooting {
  0% {
    transform: translate(0, 0) rotate(var(--angle));
    opacity: 0;
  }

  5% {
    opacity: 1;
  }

  90% {
    opacity: 1;
  }

  100% {
    transform: translate(var(--move-x), var(--move-y)) rotate(var(--angle));
    opacity: 0;
  }
}

.heart-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Ajuste para móviles: mover el corazón hacia arriba */
  transform: translateY(-40px);
}

/* Solo en pantallas más grandes, volver a la posición normal */
@media (min-height: 800px) {
  .heart-container {
    transform: translateY(0);
  }
}

.heart-btn {
  display: grid;
  place-items: center;
  width: clamp(280px, 40vmin, 520px);
  height: clamp(280px, 40vmin, 520px);
  border: none;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 0 40px rgba(255, 43, 79, 0.55));
  transition: transform 0.1s ease;
  z-index: 2;
}

.heart-btn:active {
  transform: scale(0.95);
}

.heart {
  width: 85%;
  height: 85%;
  display: block;
  transform-origin: center center;
  will-change: transform;
}

.heart svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.heart svg .core {
  fill: var(--heart);
  filter: drop-shadow(0 0 20px var(--shadow)) drop-shadow(0 0 40px rgba(255, 43, 79, 0.4));
  animation: gentleBeat 2.5s ease-in-out infinite;
  transform-origin: 50% 50%;
}

.heart svg .shine {
  fill: rgba(255, 255, 255, 0.35);
  mix-blend-mode: screen;
}

@keyframes gentleBeat {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

.heart-btn.clicked .heart svg .core {
  animation:
    strongBeat 0.7s cubic-bezier(0.17, 0.67, 0.83, 0.67),
    gentleBeat 2.5s ease-in-out infinite 0.7s;
}

@keyframes strongBeat {
  0% {
    transform: scale(1);
  }

  15% {
    transform: scale(1.8);
  }

  /* Más grande */
  30% {
    transform: scale(0.6);
  }

  /* Más pequeño */
  45% {
    transform: scale(1.6);
  }

  /* Rebote grande */
  60% {
    transform: scale(0.7);
  }

  /* Rebote pequeño */
  75% {
    transform: scale(1.3);
  }

  /* Casi de vuelta */
  90% {
    transform: scale(0.9);
  }

  /* Pequeña contracción */
  100% {
    transform: scale(1);
  }
}

.phrase {
  position: absolute;
  display: inline-block;
  padding: 1rem 2rem;
  background: linear-gradient(135deg,
      rgba(255, 182, 193, 0.8),
      rgba(139, 69, 119, 0.95));
  /* backdrop-filter removed */
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.5);
  /* Highlight edge */

  font-weight: 700;
  color: var(--pink);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  font-size: clamp(16px, 2.8vw, 24px);
  letter-spacing: 0.5px;

  pointer-events: none;
  z-index: 100;
  box-shadow:
    0 15px 35px rgba(0, 0, 0, 0.3),
    inset 0 0 20px rgba(255, 255, 255, 0.1);

  transform: translate(-50%, -50%);
  white-space: nowrap;
  will-change: transform, opacity;
}

.phrase.shooting {
  animation: shootAndFall var(--duration, 6s) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes shootAndFall {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3) rotate(var(--rotation, 0deg));
    /* blur removed */
  }

  15% {
    opacity: 1;
    transform: translate(calc(-50% + var(--shoot-x)),
        calc(-50% + var(--shoot-y))) scale(1.1) rotate(var(--rotation, 0deg));
    /* blur removed */
  }

  25% {
    transform: translate(calc(-50% + var(--shoot-x)),
        calc(-50% + var(--shoot-y))) scale(1) rotate(var(--rotation, 0deg));
  }

  85% {
    opacity: 1;
    transform: translate(calc(-50% + var(--final-x)),
        calc(-50% + var(--final-y))) scale(1) rotate(var(--final-rotation, 0deg));
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--final-x)),
        calc(-50% + var(--final-y) + 20px)) scale(0.8) rotate(var(--final-rotation, 0deg));
    /* blur removed */
  }
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--heart);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  will-change: transform, opacity;
}

.particle.burst {
  animation: particleBurst 1s ease-out forwards;
}

@keyframes particleBurst {
  0% {
    opacity: 1;
    transform: scale(1.2);
  }

  100% {
    opacity: 0;
    transform: scale(0) translate(var(--particle-x, 0px), var(--particle-y, 0px));
  }
}

/* Reproductor de música */
.music-player {
  position: fixed;
  bottom: 20px;
  /* Movido a la parte inferior */
  left: 50%;
  transform: translateX(-50%);
  background: var(--messageBoxBg);
  padding: 10px 18px;
  /* Reducido el padding vertical */
  border-radius: 20px;
  /* Más redondeado pero menos alto */
  border: 1px solid rgba(255, 214, 231, 0.3);
  box-shadow: 0 8px 32px rgba(255, 43, 79, 0.2);
  display: flex;
  align-items: center;
  gap: 12px;
  /* Reducido el gap */
  z-index: 100;
  backdrop-filter: blur(10px);
  min-width: 260px;
  /* Reducido el ancho mínimo */
  opacity: 0;
  transform: translateX(-50%) translateY(100%);
  /* Animación từ dưới lên */
  /* Animación desde arriba */
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.music-player.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.music-player.minimized {
  transform: translateX(-50%) translateY(calc(100% + 20px));
}

.toggle-btn {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--messageBoxBg);
  border: 1px solid rgba(255, 214, 231, 0.3);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--pink);
  z-index: 101;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.toggle-btn:hover {
  background: rgba(139, 69, 119, 0.8);
  transform: translateX(-50%) translateY(-2px);
}

.toggle-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transition: transform 0.4s ease;
}

.music-player.minimized .toggle-btn {
  top: -30px;
  background: var(--messageBoxBg);
  border-radius: 15px 15px 0 0;
  width: 40px;
  height: 30px;
}

.music-player.minimized .toggle-btn svg {
  transform: rotate(180deg);
}


.play-pause-btn {
  background: rgba(255, 43, 79, 0.8);
  border: none;
  border-radius: 50%;
  width: 36px;
  /* Reducido ligeramente */
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 16px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 43, 79, 0.3);
}

.play-pause-btn:hover {
  background: rgba(255, 43, 79, 1);
  transform: scale(1.05);
}

.play-pause-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.progress-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* Reducido el gap */
}

.song-info {
  font-size: 13px;
  /* Reducido ligeramente */
  color: var(--pink);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  font-weight: 500;
}

.progress-bar {
  width: 100%;
  height: 3px;
  /* Reducido ligeramente */
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff2b4f, #ff5f7a);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s ease;
}

.time-display {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  /* Reducido ligeramente */
  color: rgba(255, 214, 231, 0.8);
  font-weight: 400;
}