@import url("https://fonts.googleapis.com/css2?family=Dancing+Script:wght@600;700&family=Poppins:wght@300;400;500;600;700&display=swap");

:root {
  --pink: #ff4d88;
  --red: #ff2d2d;
  --rose: #ff7aa5;
  --white: #fffdfd;
  --text: #3e1b2c;
  --muted: #7b5364;
  --card-bg: rgba(255, 255, 255, 0.52);
  --shadow: 0 16px 45px rgba(255, 77, 136, 0.26);
  --radius: 24px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Poppins", "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(-35deg, #ffe3ed 0%, #fff5f8 35%, #ffffff 65%, #ffd7e6 100%);
  background-size: 220% 220%;
  animation: hueFlow 18s ease-in-out infinite;
  position: relative;
  overflow-x: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.09;
  background-image: radial-gradient(rgba(255, 255, 255, 0.95) 0.75px, transparent 0.75px);
  background-size: 3px 3px;
}

body.music-on {
  animation-duration: 10s;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(4px);
  z-index: 0;
  pointer-events: none;
}

.orb-one {
  width: 210px;
  height: 210px;
  left: -55px;
  top: 7%;
  background: rgba(255, 77, 136, 0.28);
}

.orb-two {
  width: 260px;
  height: 260px;
  right: -80px;
  bottom: 8%;
  background: rgba(255, 45, 45, 0.2);
}

.floating-hearts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.floating-hearts span {
  position: absolute;
  bottom: -10%;
  left: var(--left, 50%);
  font-size: var(--size, 20px);
  color: rgba(255, 77, 136, 0.35);
  opacity: 0;
  animation: floatHeart var(--dur, 9s) linear infinite;
  animation-delay: var(--delay, 0s);
}

.page-wrap {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 24px 16px 8px;
  position: relative;
  z-index: 1;
}

.card {
  width: min(100%, 680px);
  background: var(--card-bg);
  backdrop-filter: blur(14px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 20px 24px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.65);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    rgba(255, 77, 136, 0.5),
    rgba(255, 255, 255, 0.08),
    rgba(255, 45, 45, 0.45),
    rgba(255, 255, 255, 0.08),
    rgba(255, 77, 136, 0.5)
  );
  background-size: 250% 250%;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: shimmerBorder 5s linear infinite;
}

.view {
  position: relative;
  z-index: 1;
}

.hidden {
  display: none !important;
}

.music-toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 77, 136, 0.25);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  color: var(--pink);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.music-toggle[aria-pressed="true"] {
  animation: notePulse 1.3s ease-in-out infinite;
  box-shadow: 0 0 18px rgba(255, 77, 136, 0.42);
}

.title {
  margin: 0;
  font-size: 2.05rem;
  line-height: 1.15;
  font-family: "Dancing Script", cursive;
  color: #c4205a;
  text-wrap: balance;
}

.subtitle {
  margin: 10px 0 20px;
  color: var(--muted);
  font-size: 0.98rem;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #6b3d4f;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.text-input {
  width: 100%;
  border: 1px solid rgba(255, 77, 136, 0.3);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.text-input:focus-visible,
.btn:focus-visible,
.music-toggle:focus-visible,
.link-preview:focus-visible {
  outline: 3px solid rgba(255, 77, 136, 0.36);
  outline-offset: 1px;
}

.error-text {
  min-height: 20px;
  margin: 8px 0 0;
  color: #d51347;
  font-size: 0.9rem;
  font-weight: 500;
}

.result-box {
  margin-top: 18px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 77, 136, 0.15);
  animation: popIn 0.45s ease;
}

.result-label {
  margin: 0 0 10px;
  color: #874f63;
  font-size: 0.92rem;
  font-weight: 600;
}

.link-preview {
  display: inline-flex;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  text-decoration: none;
  color: #cb1e5c;
  background: rgba(255, 255, 255, 0.96);
  font-weight: 700;
  letter-spacing: 0.01em;
  font-size: 1rem;
  word-break: break-all;
  user-select: all;
}

.result-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  border: 0;
  border-radius: 13px;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.2s ease, color 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px) scale(1.02);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(130deg, var(--pink), var(--red));
  color: #fff;
  box-shadow: 0 9px 20px rgba(255, 45, 45, 0.3);
}

.btn-soft {
  background: rgba(255, 255, 255, 0.92);
  color: #9d234f;
  border: 1px solid rgba(255, 77, 136, 0.2);
}

.btn-soft:hover {
  box-shadow: 0 8px 18px rgba(255, 77, 136, 0.2);
}

.copy-status {
  min-height: 18px;
  margin: 10px 2px 0;
  font-size: 0.86rem;
  color: #7c495d;
}

.chip {
  display: inline-flex;
  margin: 0 0 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 77, 136, 0.14);
  color: #9d2350;
  font-size: 0.8rem;
  font-weight: 700;
}

.message-heading {
  margin: 0;
  font-size: 2rem;
  line-height: 1.15;
  font-family: "Dancing Script", cursive;
  color: #c11759;
  text-wrap: balance;
}

.typewriter-text {
  min-height: 110px;
  margin: 14px 0 0;
  font-size: 1rem;
  line-height: 1.7;
  color: #4e2b39;
  white-space: pre-wrap;
  border-right: 2px solid rgba(255, 77, 136, 0.75);
  padding-right: 3px;
  animation: caretBlink 0.8s step-end infinite;
}

.message-actions {
  margin-top: 10px;
}

.glow-btn {
  animation: glowPulse 1.5s ease-in-out infinite;
}

.whatsapp-btn {
  text-decoration: none;
}

.surprise-line {
  margin: 14px 0 0;
  color: #af1a4d;
  font-weight: 600;
  animation: fadeSlideUp 0.42s ease;
}

.burst-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.burst-heart {
  position: absolute;
  left: 50%;
  top: 55%;
  transform: translate(-50%, -50%);
  color: rgba(255, 45, 45, 0.9);
  font-size: var(--heart-size, 16px);
  animation: burstHeart 0.95s ease-out forwards;
}

.btn-link {
  margin-top: 16px;
  background: transparent;
  color: #9f214f;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding-inline: 0;
}

.site-footer {
  text-align: center;
  padding: 10px 16px 18px;
  color: #885064;
  font-size: 0.92rem;
  position: relative;
  z-index: 1;
}

.sparkle-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px rgba(255, 77, 136, 0.9);
  animation: sparkle 0.9s ease-out forwards;
}

.fade-in-up {
  animation: fadeSlideUp 0.65s ease;
}

@media (min-width: 640px) {
  .card {
    padding: 36px 32px 28px;
  }

  .title {
    font-size: 2.5rem;
  }

  .message-heading {
    font-size: 2.7rem;
  }

  .field-group {
    flex-direction: row;
  }

  .text-input {
    flex: 1;
  }
}

@keyframes floatHeart {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-120vh) translateX(var(--drift, 22px)) rotate(8deg);
    opacity: 0;
  }
}

@keyframes shimmerBorder {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 250% 50%;
  }
}

@keyframes glowPulse {
  0%,
  100% {
    box-shadow: 0 8px 16px rgba(255, 77, 136, 0.22);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 77, 136, 0), 0 10px 30px rgba(255, 45, 45, 0.35);
  }
}

@keyframes hueFlow {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes notePulse {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.08) rotate(-5deg);
  }
}

@keyframes caretBlink {
  50% {
    border-right-color: transparent;
  }
}

@keyframes sparkle {
  0% {
    transform: translate3d(0, 0, 0) scale(0.8);
    opacity: 0;
  }
  25% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--sx, 0), var(--sy, -20px), 0) scale(0);
    opacity: 0;
  }
}

@keyframes burstHeart {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.8);
  }
  100% {
    opacity: 0;
    transform: translate(
        calc(-50% + var(--x, 0px)),
        calc(-50% + var(--y, -80px))
      )
      scale(1.28);
  }
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
