:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #493f46;
  background: #fff8fb;
  --page-pad: clamp(16px, 3vw, 36px);
  --stage-top: clamp(118px, 19vh, 174px);
  --controls-space: 92px;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 214, 231, 0.68), transparent 31%),
    radial-gradient(circle at 84% 18%, rgba(214, 236, 255, 0.74), transparent 32%),
    radial-gradient(circle at 52% 88%, rgba(255, 245, 186, 0.5), transparent 36%),
    #fff8fb;
}

button {
  font: inherit;
}

.page-shell {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 520px;
  padding:
    calc(var(--page-pad) + env(safe-area-inset-top))
    calc(var(--page-pad) + env(safe-area-inset-right))
    calc(var(--page-pad) + env(safe-area-inset-bottom))
    calc(var(--page-pad) + env(safe-area-inset-left));
  isolation: isolate;
}

.page-shell::before,
.page-shell::after {
  position: absolute;
  z-index: -1;
  width: clamp(180px, 28vw, 400px);
  aspect-ratio: 1;
  border: 1px solid rgba(139, 111, 128, 0.08);
  border-radius: 42% 58% 66% 34% / 43% 35% 65% 57%;
  content: "";
}

.page-shell::before {
  top: -13%;
  right: -7%;
  transform: rotate(24deg);
}

.page-shell::after {
  bottom: -18%;
  left: -8%;
  transform: rotate(-18deg);
}

.hero-copy {
  position: absolute;
  z-index: 20;
  top: calc(var(--page-pad) + env(safe-area-inset-top));
  left: 50%;
  width: min(92vw, 720px);
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 7px;
  color: #a8718d;
  font-size: clamp(10px, 1.1vw, 12px);
  font-weight: 800;
  letter-spacing: 0.2em;
}

h1 {
  margin: 0;
  color: #5b4652;
  font-size: clamp(27px, 4.6vw, 48px);
  line-height: 1.16;
  letter-spacing: 0.04em;
}

.subtitle {
  margin: 10px auto 0;
  color: #75636d;
  font-size: clamp(13px, 1.7vw, 17px);
  line-height: 1.65;
}

.heart-stage {
  position: absolute;
  inset:
    var(--stage-top)
    calc(var(--page-pad) + env(safe-area-inset-right))
    calc(var(--controls-space) + env(safe-area-inset-bottom))
    calc(var(--page-pad) + env(safe-area-inset-left));
  min-height: 250px;
  overflow: hidden;
  border: 1px solid rgba(113, 84, 101, 0.08);
  border-radius: clamp(24px, 4vw, 46px);
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.notes-layer {
  position: absolute;
  inset: 0;
}

.note {
  position: absolute;
  top: 0;
  left: 0;
  width: clamp(130px, 15vw, 222px);
  min-height: clamp(38px, 4.4vw, 54px);
  display: flex;
  align-items: center;
  padding: 9px 15px 9px 22px;
  overflow: hidden;
  color: #4a4247;
  font-size: clamp(10px, 1.15vw, 13px);
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
  border-radius: 3px;
  box-shadow: 5px 6px 14px rgba(84, 67, 77, 0.16);
  opacity: 0;
  will-change: transform, opacity;
  transform: translate3d(var(--start-x), var(--start-y), 0) rotate(var(--rotation)) scale(0.78);
  transition:
    transform 720ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 330ms ease;
}

.note::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 7px;
  background: rgba(255, 255, 255, 0.9);
  content: "";
}

.note.is-heart {
  opacity: 0.94;
  transform: translate3d(var(--heart-x), var(--heart-y), 0) rotate(var(--rotation)) scale(1);
}

.note.is-scattered {
  opacity: 0.82;
  transform: translate3d(var(--scatter-x), var(--scatter-y), 0) rotate(var(--scatter-rotation)) scale(0.9);
}

.motion-status {
  position: absolute;
  right: 16px;
  bottom: 12px;
  margin: 0;
  color: #8b7481;
  font-size: 12px;
}

.controls {
  position: absolute;
  z-index: 30;
  right: calc(var(--page-pad) + env(safe-area-inset-right));
  bottom: calc(var(--page-pad) + env(safe-area-inset-bottom));
  left: calc(var(--page-pad) + env(safe-area-inset-left));
  display: flex;
  justify-content: center;
  gap: 12px;
}

.control-button {
  min-width: 108px;
  min-height: 46px;
  padding: 10px 22px;
  border: 1px solid rgba(104, 75, 91, 0.18);
  border-radius: 999px;
  color: #604e58;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 9px 22px rgba(97, 72, 86, 0.1);
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-tap-highlight-color: transparent;
}

.control-button--primary {
  border-color: transparent;
  color: #654b59;
  background: #ffd6e7;
}

.control-button:hover {
  transform: translateY(-1px);
}

.control-button:active {
  transform: translateY(1px);
}

.control-button:focus-visible {
  outline: 3px solid #7d5b70;
  outline-offset: 3px;
}

.noscript-message {
  position: fixed;
  right: 20px;
  bottom: 90px;
  left: 20px;
  z-index: 50;
  margin: 0 auto;
  max-width: 620px;
  padding: 16px;
  text-align: center;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(97, 72, 86, 0.15);
}

@media (max-width: 720px) {
  :root {
    --page-pad: 12px;
    --stage-top: 132px;
    --controls-space: 78px;
  }

  .subtitle {
    width: min(92vw, 470px);
  }

  .heart-stage {
    border-radius: 26px;
  }

  .note {
    width: clamp(108px, 31vw, 148px);
    min-height: 36px;
    padding: 7px 10px 7px 17px;
    font-size: clamp(9px, 2.55vw, 11px);
    box-shadow: 3px 4px 10px rgba(84, 67, 77, 0.14);
  }

  .note::before {
    width: 5px;
  }

  .control-button {
    min-width: 104px;
    min-height: 46px;
    padding-inline: 18px;
  }
}

@media (max-height: 650px) {
  :root {
    --stage-top: 104px;
    --controls-space: 66px;
  }

  .eyebrow,
  .subtitle {
    display: none;
  }

  h1 {
    font-size: clamp(24px, 5vw, 34px);
  }

  .control-button {
    min-height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .note,
  .control-button {
    transition: none !important;
  }

  .control-button:hover,
  .control-button:active {
    transform: none;
  }
}

@media (prefers-contrast: more) {
  .heart-stage,
  .control-button {
    border-color: rgba(73, 63, 70, 0.42);
  }

  .note {
    color: #211c1f;
    box-shadow: 4px 5px 0 rgba(73, 63, 70, 0.25);
  }
}
