:root {
  --bg-1: #1b0026;
  --bg-2: #36004d;
  --bg-3: #75003f;
  --pink: #ff3d89;
  --pink-2: #ff77ad;
  --red: #ff2e63;
  --red-dark: #b90e3b;
  --white: #fff7fb;
  --glass: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: "Be Vietnam Pro", system-ui, -apple-system, sans-serif;
  color: var(--white);
  overflow: hidden;
}

body {
  background: radial-gradient(circle at 20% 20%, #8c005d 0%, transparent 35%),
    radial-gradient(circle at 80% 15%, #d6007e 0%, transparent 30%),
    linear-gradient(120deg, var(--bg-1), var(--bg-2), var(--bg-3));
}

body::before {
  content: "";
  position: fixed;
  inset: -30%;
  pointer-events: none;
  z-index: 1;
  background: conic-gradient(from 0deg, rgba(255, 67, 156, 0.16), rgba(255, 40, 100, 0.08), rgba(250, 126, 189, 0.16), rgba(255, 67, 156, 0.16));
  filter: blur(55px);
  animation: spinAura 22s linear infinite;
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}

#ambientCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  opacity: 0.95;
}

#sparkBurst {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.burst-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #fff7fb, #ff4f93 70%, #d1004f 100%);
  filter: drop-shadow(0 0 10px rgba(255, 120, 180, 0.8));
  animation: burstFly 800ms ease-out forwards;
}

@keyframes burstFly {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2);
  }
}

.bg-layer::before,
.bg-layer::after {
  content: "";
  position: absolute;
  width: 200vmax;
  height: 200vmax;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.18;
  animation: blobMove 15s ease-in-out infinite alternate;
}

.bg-layer::before {
  background: #ff70c2;
  top: -60vmax;
  left: -30vmax;
}

.bg-layer::after {
  background: #ff3f6c;
  bottom: -80vmax;
  right: -50vmax;
  animation-delay: 2s;
}

@keyframes blobMove {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    transform: translate(8vmax, -6vmax) rotate(25deg);
  }
}

.app {
  position: relative;
  z-index: 6;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 20px;
}

.stage {
  display: none;
  width: min(780px, 95vw);
  max-height: 92vh;
}

.stage.active {
  display: block;
}

.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.35);
  padding: clamp(20px, 5vw, 36px);
  text-align: center;
  position: relative;
  overflow: hidden;
}

#choiceStage {
  display: none;
  width: 100vw;
  max-width: none;
  min-height: 100vh;
  max-height: none;
  border-radius: 0;
  padding: clamp(20px, 4vw, 44px);
  flex-direction: column;
  justify-content: center;
}

#choiceStage.active {
  display: flex;
}

.card::before {
  content: "";
  position: absolute;
  inset: -140% -50%;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.3) 50%, transparent 65%);
  transform: rotate(9deg);
  animation: cardShine 6.8s ease-in-out infinite;
  pointer-events: none;
}

.eyebrow {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.95;
}

.title {
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  line-height: 1.2;
  margin: 16px 0 8px;
  text-shadow: 0 4px 20px rgba(255, 112, 180, 0.34);
}

.subtitle {
  margin: 0 0 22px;
  opacity: 0.9;
}

.name-box {
  display: block;
  max-width: 520px;
  margin: 0 auto 16px;
  text-align: left;
}

.name-box span {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: #ffe6f4;
  font-size: 0.98rem;
}

.name-box input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--white);
  background: rgba(255, 255, 255, 0.11);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.name-box input::placeholder {
  color: rgba(255, 235, 247, 0.72);
}

.name-box input:focus {
  border-color: rgba(255, 185, 221, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 105, 177, 0.2);
  background: rgba(255, 255, 255, 0.16);
}

.button-zone {
  position: relative;
  min-height: min(62vh, 720px);
  width: min(1300px, 96vw);
  margin: 10px auto 0;
  border-radius: 20px;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  overflow: visible;
}

.button-zone::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 160, 210, 0.3), transparent 42%);
  transition: background 0.2s linear;
  pointer-events: none;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 26px;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.25s ease, filter 0.2s ease, box-shadow 0.25s ease;
  user-select: none;
}

.btn:active {
  transform: scale(0.96);
}

.btn-yes {
  color: white;
  background: linear-gradient(135deg, var(--red), var(--pink));
  box-shadow: 0 12px 30px rgba(255, 61, 137, 0.45);
  transform-origin: center;
}

.btn-yes:hover {
  filter: brightness(1.1);
}

.btn-no {
  color: #2f1020;
  background: linear-gradient(120deg, #ffe6f2, #fff8fc);
  box-shadow: 0 8px 20px rgba(255, 255, 255, 0.35);
  z-index: 3;
  will-change: transform;
}

.btn-no.runaway {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  transition: none;
  will-change: transform;
}

.photo-wrap {
  width: clamp(120px, 20vw, 180px);
  height: clamp(120px, 20vw, 180px);
  margin: 4px auto 18px;
  border-radius: 999px;
  padding: 4px;
  background: linear-gradient(135deg, #ffd4ec, #ff6ea9, #ff305d);
  box-shadow: 0 10px 45px rgba(255, 60, 120, 0.5);
}

.photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px;
  display: block;
  border: 2px solid rgba(255, 255, 255, 0.65);
}

.wish-text {
  margin: 12px auto;
  font-size: clamp(1.1rem, 2.8vw, 1.8rem);
  line-height: 1.45;
  max-width: 640px;
  min-height: 110px;
  text-shadow: 0 4px 18px rgba(255, 136, 193, 0.4);
}

.countdown {
  margin: 10px 0 0;
  font-weight: 700;
  color: #ffe9f4;
  font-size: clamp(1rem, 2.1vw, 1.35rem);
  animation: beat 1s ease-in-out infinite;
}

#heartStage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#heartStage::before,
#heartStage::after {
  content: "";
  position: absolute;
  inset: -22%;
  pointer-events: none;
  z-index: 1;
}

#heartStage::before {
  background: conic-gradient(from 0deg, rgba(255, 78, 148, 0.13), rgba(255, 44, 98, 0), rgba(255, 139, 198, 0.14), rgba(255, 44, 98, 0));
  filter: blur(40px);
  animation: stageAuroraSpin 18s linear infinite;
}

#heartStage::after {
  background: radial-gradient(circle at 20% 35%, rgba(255, 161, 214, 0.16), transparent 42%), radial-gradient(circle at 78% 70%, rgba(255, 93, 154, 0.14), transparent 40%);
  filter: blur(24px);
  animation: stageAuroraFloat 7.2s ease-in-out infinite alternate;
}

#heartCanvas {
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
  z-index: 3;
}

#heartFxCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 4;
}

.heart-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.main-heart {
  width: min(42vw, 320px);
  aspect-ratio: 1;
  transform: rotate(-45deg) scale(0);
  background: radial-gradient(circle at 30% 25%, #ff9abd, #ff2f63 55%, #b0003a 100%);
  box-shadow: 0 20px 120px rgba(255, 31, 96, 0.8);
  position: relative;
  border-radius: 20px;
  animation: popHeart 2.3s cubic-bezier(0.2, 0.8, 0.1, 1) forwards;
  animation-delay: 0.35s;
  isolation: isolate;
  display: none;
}

.main-heart::before,
.main-heart::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
}

.main-heart::before {
  left: 0;
  top: -50%;
}

.main-heart::after {
  left: 50%;
  top: 0;
}

.main-heart::selection {
  background: transparent;
}

.main-heart::marker {
  content: "";
}

.main-heart::before,
.main-heart::after,
.main-heart {
  animation-timing-function: cubic-bezier(0.17, 0.85, 0.19, 1);
}

.main-heart::after {
  box-shadow: 0 0 30px rgba(255, 133, 185, 0.35) inset;
}

.main-heart::before {
  box-shadow: 0 0 30px rgba(255, 93, 153, 0.4) inset;
}

.heart-message {
  position: absolute;
  left: 50%;
  bottom: 6vh;
  transform: translateX(-50%);
  text-align: center;
  max-width: min(86vw, 740px);
  font-size: clamp(1rem, 2.8vw, 1.6rem);
  font-weight: 700;
  color: #fff2f8;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(20, 0, 12, 0.32);
  backdrop-filter: blur(4px);
  animation: riseIn 1.5s ease-out both;
  animation-delay: 0.9s;
  z-index: 25;
}

@keyframes popHeart {
  0% {
    transform: rotate(-45deg) scale(0);
    filter: brightness(0.7);
  }
  55% {
    transform: rotate(-45deg) scale(1.08);
    filter: brightness(1.2);
  }
  75% {
    transform: rotate(-45deg) scale(0.98);
  }
  100% {
    transform: rotate(-45deg) scale(1);
  }
}

@keyframes beat {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@keyframes riseIn {
  0% {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes cardShine {
  0% {
    transform: translateX(-72%) rotate(9deg);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  48%,
  100% {
    transform: translateX(72%) rotate(9deg);
    opacity: 0;
  }
}

@keyframes spinAura {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes stageAuroraSpin {
  from {
    transform: rotate(0deg) scale(1);
  }
  to {
    transform: rotate(360deg) scale(1.06);
  }
}

@keyframes stageAuroraFloat {
  0% {
    transform: translate(-2.5%, -1.6%) scale(1);
    opacity: 0.55;
  }
  100% {
    transform: translate(2.5%, 1.6%) scale(1.08);
    opacity: 0.9;
  }
}

@media (max-width: 560px) {
  .button-zone {
    min-height: 68vh;
    width: 100%;
  }

  .btn {
    padding: 12px 20px;
  }
}
