* {
  box-sizing: border-box;
}

:root {
  --pink: #f0b9d8;
  --deep-pink: #c27eaa;
  --lavender: #d7c2f0;
  --text: #a783a8;
}

html {
  min-height: 100%;
  background: #fff2f7;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse at 15% 15%, #ffffff 0%, transparent 38%),
    radial-gradient(ellipse at 90% 75%, #e9e0fc 0%, transparent 40%),
    linear-gradient(140deg, #fff0f6, #fffaf5 48%, #f0edff);
}

button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid #c5a6e0;
  outline-offset: 4px;
}

.background-glow {
  position: fixed;
  z-index: 0;
  top: 15%;
  left: 50%;
  width: 340px;
  height: 340px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, .45);
  filter: blur(45px);
  pointer-events: none;
}

#particles {
  position: fixed;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  bottom: -40px;
  animation: floatUp 7s linear forwards;
  user-select: none;
}

.page {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.welcome,
.main-view {
  width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.welcome {
  display: flex;
}

.welcome.hide {
  display: none;
}

.welcome-card {
  width: min(100%, 430px);
  padding: 38px 24px;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 30px;
  background: rgba(255, 255, 255, .48);
  box-shadow: 0 15px 50px rgba(197, 151, 186, .13);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: cardAppear .8s ease both;
}

.welcome-heart {
  margin-bottom: 10px;
  color: #df9fc7;
  font-size: 68px;
  line-height: 1.2;
  animation: heartbeat 1.7s ease-in-out infinite;
}

.eyebrow {
  color: #b6a0c8;
  font-size: 10px;
  letter-spacing: 4px;
}

.welcome h1,
.main-title {
  color: var(--deep-pink);
  font-weight: 500;
}

.welcome h1 {
  margin: 18px 0 12px;
  font-size: clamp(25px, 6vw, 34px);
}

.welcome-desc {
  margin: 0 auto 28px;
  font-size: 14px;
  line-height: 1.9;
}

.primary-btn,
.secondary-btn {
  display: inline-block;
  max-width: 100%;
  padding: 13px 30px;
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 999px;
  background: linear-gradient(120deg, #f7c7df, #dfb8ed);
  box-shadow: 0 5px 18px rgba(209, 155, 194, .2);
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(209, 155, 194, .28);
}

.primary-btn:active,
.secondary-btn:active {
  transform: scale(.97);
}

.small-note {
  margin: 22px 0 0;
  color: #c4acc7;
  font-size: 12px;
}

.main-view {
  display: none;
  padding: 12px 0 28px;
  animation: cardAppear .7s ease both;
}

.main-view.active {
  display: flex;
}

.main-title {
  margin: 7px 0;
  font-size: clamp(23px, 5.5vw, 31px);
  line-height: 1.5;
}

.subtitle {
  margin: 0 0 2px;
  color: #b39ac4;
  font-size: 13px;
  line-height: 1.8;
}

/* 爱心场景 */
.heart-scene {
  position: relative;
  width: min(90vw, 390px);
  aspect-ratio: 320 / 290;
  margin: 18px auto 12px;
  overflow: visible;
  flex-shrink: 0;
}

.heart-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.heart-line {
  fill: none;
  stroke: url(#lineGradient);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: url(#heartGlow);
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
}

.heart-scene.drawing .heart-line {
  opacity: 1;
  animation: drawHeart 2.4s cubic-bezier(.35, 0, .25, 1) forwards;
}

.heart-scene.drawing #rightHeartLine {
  animation-delay: .12s;
}

.center-heart {
  fill: none;
  stroke: #f2b8d8;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: url(#heartGlow);
  opacity: 0;
  transform: scale(.6);
  transform-origin: 160px 105px;
}

.heart-scene.drawing .center-heart {
  animation: centerHeartAppear 1s ease 2.2s forwards;
}

.heart-scene.complete .heart-line {
  opacity: 1;
  stroke-dashoffset: 0;
}

.heart-scene.complete .center-heart {
  opacity: .95;
  transform: scale(1);
}

.blessing-words {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.blessing-word {
  position: absolute;
  left: var(--word-x, 50%);
  top: var(--word-y, 50%);

  display: inline-block;
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 10px;

  background: rgba(255, 240, 248, 0.94);
  box-shadow: 0 2px 8px rgba(190, 120, 175, 0.12);

  color: #bd679d;
  font-size: clamp(10px, 2.6vw, 12px);
  font-weight: 400;
  letter-spacing: 0.2px;
  line-height: 1.5;
  white-space: nowrap;

  opacity: 0;
  transform: translate(-50%, -50%) scale(0.85);
  animation: wordPop 0.6s ease forwards;
}

.blessing-word:nth-child(6n + 1) {
  color: #bd679d;
  background: rgba(255, 235, 245, 0.94);
  border-color: #f6d2e5;
}

.blessing-word:nth-child(6n + 2) {
  color: #9277bd;
  background: rgba(243, 236, 255, 0.94);
  border-color: #ded1f5;
}

.blessing-word:nth-child(6n + 3) {
  color: #6799bb;
  background: rgba(232, 246, 255, 0.94);
  border-color: #cce8f8;
}

.blessing-word:nth-child(6n + 4) {
  color: #6d9e8a;
  background: rgba(232, 250, 241, 0.94);
  border-color: #ccebdc;
}

.blessing-word:nth-child(6n + 5) {
  color: #c38c62;
  background: rgba(255, 243, 230, 0.94);
  border-color: #f5dfc8;
}

.blessing-word:nth-child(6n) {
  color: #ad80a8;
  background: rgba(250, 236, 250, 0.94);
  border-color: #ead3e8;
}

@keyframes wordPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.7);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.progress-text {
  min-height: 24px;
  margin: 2px 0 12px;
  color: #b6a0c8;
  font-size: 12px;
  line-height: 1.8;
}

.secondary-btn {
  margin-top: 0;
  padding: 11px 26px;
}

.final-message {
  width: min(92%, 360px);
  margin: 0 auto;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 20px;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 8px 26px rgba(190, 145, 190, .12);
  color: #ad7ba8;
  font-size: clamp(13px, 3.5vw, 15px);
  line-height: 2;
  white-space: normal;
  animation: cardAppear .9s ease both;
}

.final-title {
  margin: 0 0 8px;
  color: #c17fa9;
  font-size: 20px;
  font-weight: 500;
}

@keyframes drawHeart {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes centerHeartAppear {
  0% {
    opacity: 0;
    stroke-dasharray: 0 200;
    transform: scale(.6);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    stroke-dasharray: 200 0;
    transform: scale(1);
  }
}

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(0);
  }
  15% {
    opacity: .85;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift, 30px), -110vh, 0)
      rotate(var(--spin, 40deg));
  }
}

@keyframes cardAppear {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@media (max-width: 480px) {
  .page {
    padding: 16px 12px;
  }

  .welcome-card {
    padding: 30px 20px;
  }

  .main-view {
    padding-top: 8px;
  }

  .heart-scene {
    width: min(94vw, 350px);
  }
}

@media (max-height: 700px) {
  .heart-scene {
    width: min(72vw, 300px);
  }

  .main-view {
    padding-top: 0;
  }

  .subtitle {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}