@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Noto+Serif+SC:wght@500;600;700&display=swap");

:root {
  color-scheme: dark;
  --bg: #09050d;
  --paper: #f8edf1;
  --muted: rgba(248, 237, 241, 0.58);
  --pink: #ff5c8a;
  --hot-pink: #ff2d6f;
  --line: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  overscroll-behavior: none;
  background:
    radial-gradient(circle at 72% 43%, rgba(111, 20, 63, 0.2), transparent 32%),
    radial-gradient(circle at 5% 100%, rgba(62, 23, 78, 0.24), transparent 35%),
    var(--bg);
  color: var(--paper);
  font-family: "DM Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
canvas {
  -webkit-tap-highlight-color: transparent;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#scene:active {
  cursor: grabbing;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 3;
  opacity: 0.055;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.75'/%3E%3C/svg%3E");
}

.aurora {
  position: fixed;
  z-index: 0;
  width: 36vw;
  height: 36vw;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.09;
  pointer-events: none;
  animation: drift 14s ease-in-out infinite alternate;
}

.aurora--one {
  top: -20vw;
  right: 5vw;
  background: #ff3975;
}

.aurora--two {
  bottom: -25vw;
  left: 20vw;
  background: #6a42ff;
  animation-delay: -7s;
}

.page-shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(24px, 4vw, 58px) clamp(24px, 6vw, 96px) 30px;
  padding-top: max(clamp(24px, 4vw, 58px), calc(env(safe-area-inset-top) + 18px));
  padding-right: max(clamp(24px, 6vw, 96px), calc(env(safe-area-inset-right) + 18px));
  padding-bottom: max(30px, calc(env(safe-area-inset-bottom) + 18px));
  padding-left: max(clamp(24px, 6vw, 96px), calc(env(safe-area-inset-left) + 18px));
  pointer-events: none;
}

.topbar,
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(248, 237, 241, 0.45);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand__spark {
  color: var(--pink);
  font-size: 14px;
  animation: sparkle 2.4s ease-in-out infinite;
}

.sound-state {
  display: flex;
  align-items: center;
  gap: 9px;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.sound-state.is-visible {
  opacity: 1;
}

.sound-state__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ff719b;
  box-shadow: 0 0 10px #ff719b;
  animation: soundPulse 1.1s ease-in-out infinite;
}

.hero {
  display: grid;
  grid-template-columns: minmax(300px, 0.82fr) minmax(420px, 1.18fr);
  align-items: center;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
}

.hero__copy {
  position: relative;
  z-index: 4;
  max-width: 590px;
  animation: copyIn 1.3s 0.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.kicker {
  margin: 0 0 21px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.34em;
  color: var(--pink);
}

h1 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(44px, 5vw, 78px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

h1 em {
  color: transparent;
  font-style: normal;
  background: linear-gradient(90deg, #fff 5%, #ffc0d2 48%, #ff5e8b 100%);
  background-clip: text;
  -webkit-background-clip: text;
}

.love-note {
  position: relative;
  max-width: 430px;
  margin: 30px 0 0;
  padding-left: 22px;
  color: var(--muted);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(14px, 1.2vw, 17px);
  line-height: 1.9;
  letter-spacing: 0.08em;
}

.love-note::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 0;
  width: 1px;
  background: linear-gradient(transparent, var(--pink), transparent);
}

.actions {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 42px;
  pointer-events: auto;
}

.heartbeat-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 145px;
  padding: 14px 21px;
  overflow: hidden;
  border: 1px solid rgba(255, 113, 155, 0.45);
  border-radius: 999px;
  background: rgba(255, 70, 124, 0.09);
  box-shadow: inset 0 0 25px rgba(255, 70, 124, 0.04);
  color: #fff4f7;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.heartbeat-button::before {
  content: "";
  position: absolute;
  top: -100%;
  left: -40%;
  width: 30%;
  height: 300%;
  transform: rotate(20deg);
  background: rgba(255, 255, 255, 0.15);
  transition: left 0.65s ease;
}

.heartbeat-button:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 126, 164, 0.9);
  background: rgba(255, 70, 124, 0.18);
}

.heartbeat-button:hover::before {
  left: 120%;
}

.heartbeat-button:focus-visible {
  outline: 2px solid #ff7aa2;
  outline-offset: 4px;
}

.heartbeat-button__icon {
  color: #ff719b;
  filter: drop-shadow(0 0 7px #ff2d6f);
  animation: tinyBeat 1.2s ease-in-out infinite;
}

.hint {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.11em;
  color: rgba(248, 237, 241, 0.35);
  white-space: nowrap;
}

.hint span {
  display: inline-block;
  width: 3px;
  height: 3px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--pink);
  vertical-align: middle;
}

.heart-space {
  position: relative;
  min-height: min(68vh, 720px);
  pointer-events: none;
}

.heart-reticle {
  position: absolute;
  top: 49%;
  left: 53%;
  width: clamp(350px, 40vw, 590px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 104, 148, 0.1);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.8);
  animation: reticleIn 1.8s 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.heart-reticle::before,
.heart-reticle::after {
  content: "";
  position: absolute;
  inset: 7%;
  border: 1px dashed rgba(255, 255, 255, 0.075);
  border-radius: inherit;
}

.heart-reticle::after {
  inset: 17%;
  border-style: solid;
  border-color: rgba(255, 68, 124, 0.1) transparent rgba(140, 108, 255, 0.12);
}

.heart-reticle > i {
  position: absolute;
  width: 8px;
  height: 1px;
  background: rgba(255, 138, 172, 0.38);
  box-shadow: 0 0 8px rgba(255, 74, 131, 0.6);
}

.heart-reticle > i:nth-child(1) { top: 50%; left: -4px; }
.heart-reticle > i:nth-child(2) { top: -4px; left: 50%; width: 1px; height: 8px; }
.heart-reticle > i:nth-child(3) { top: 50%; right: -4px; }
.heart-reticle > i:nth-child(4) { bottom: -4px; left: 50%; width: 1px; height: 8px; }

.heart-status {
  position: absolute;
  top: 82%;
  left: 53%;
  display: flex;
  align-items: center;
  gap: 11px;
  color: rgba(255, 255, 255, 0.25);
  font-size: 8px;
  letter-spacing: 0.22em;
  transform: translateX(-50%);
}

.heart-status::before,
.heart-status::after {
  content: "";
  width: 25px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 100, 146, 0.28));
}

.heart-status::after { transform: rotate(180deg); }

.heart-status b {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255, 126, 164, 0.58);
  font-size: inherit;
  font-weight: 500;
}

.heart-status b i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ff4f84;
  box-shadow: 0 0 8px #ff2d6f;
  will-change: opacity, transform;
}

.orbit-label {
  position: absolute;
  top: 50%;
  font-size: 9px;
  letter-spacing: 0.28em;
  color: rgba(255, 255, 255, 0.22);
}

.orbit-label--left {
  left: 9%;
  transform: rotate(-90deg);
}

.orbit-label--right {
  right: 1%;
  transform: rotate(90deg);
}

.footer {
  position: relative;
  z-index: 5;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.footer span {
  color: var(--pink);
}

.signature {
  font-family: "Noto Serif SC", serif;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: none;
}

.wish {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(86vw, 560px);
  padding: 32px 25px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  background: rgba(15, 7, 17, 0.46);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(20px);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -45%) scale(0.92);
  transition: opacity 0.55s ease, transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.wish.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.wish span {
  color: #ff709a;
  font-size: 21px;
  text-shadow: 0 0 25px #ff2d6f;
}

.wish p {
  margin: 14px 0 0;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(17px, 2vw, 23px);
  letter-spacing: 0.1em;
  text-align: center;
}

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

@keyframes sparkle {
  0%, 100% { opacity: 0.4; transform: scale(0.85) rotate(0); }
  50% { opacity: 1; transform: scale(1.2) rotate(90deg); }
}

@keyframes tinyBeat {
  0%, 38%, 100% { transform: scale(1); }
  14% { transform: scale(1.32); }
  27% { transform: scale(1.12); }
}

@keyframes soundPulse {
  0%, 100% { opacity: 0.35; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.25); }
}

@keyframes drift {
  to { transform: translate3d(6vw, 5vh, 0) scale(1.18); }
}

@keyframes reticleIn {
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 900px) {
  body { overflow-y: auto; }

  #scene { touch-action: pan-y; }

  .page-shell {
    min-height: 100svh;
    padding: 24px 22px 22px;
    padding-top: max(24px, calc(env(safe-area-inset-top) + 16px));
    padding-right: max(22px, calc(env(safe-area-inset-right) + 16px));
    padding-bottom: max(22px, calc(env(safe-area-inset-bottom) + 16px));
    padding-left: max(22px, calc(env(safe-area-inset-left) + 16px));
  }

  .hero {
    grid-template-columns: 1fr;
    align-content: center;
  }

  .hero__copy {
    align-self: end;
    padding-top: 9vh;
  }

  h1 { font-size: clamp(40px, 11vw, 62px); }

  .love-note { margin-top: 20px; }

  .actions { margin-top: 26px; }

  .heart-space {
    min-height: 35vh;
    order: -1;
    position: absolute;
    inset: 8vh 0 auto;
  }

  .heart-reticle {
    top: 54%;
    left: 50%;
    width: min(94vw, 390px);
  }

  .heart-status {
    top: 94%;
    left: 50%;
  }

  .orbit-label { display: none; }

  .hero__copy {
    margin-top: min(36vh, 330px);
  }

  .hint { display: none; }

  .footer p:first-child { display: none; }
  .footer { justify-content: flex-end; }
  .sound-state { display: none; }
}

@media (max-width: 480px) {
  .page-shell { padding-right: 18px; padding-left: 18px; }
  .topbar { font-size: 8px; }
  .hero__copy { margin-top: min(34vh, 290px); }
  h1 { font-size: clamp(36px, 10.8vw, 48px); }
  .love-note { font-size: 13px; line-height: 1.75; }
  .heartbeat-button { padding: 13px 18px; }
  .signature { font-size: 9px; }
}

@media (max-width: 900px) and (orientation: landscape) {
  body { overflow: hidden; }
  #scene { touch-action: none; }
  .page-shell { padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .hero { grid-template-columns: 53% 47%; }
  .hero__copy { align-self: center; margin-top: 0; padding-top: 0; }
  .heart-space { inset: 8% 0 8% 53%; min-height: auto; }
  .heart-reticle { top: 50%; width: min(47vw, 70vh); }
  .heart-status { top: 88%; }
  h1 { font-size: clamp(30px, 5.2vw, 47px); line-height: 1.18; }
  .kicker { margin-bottom: 10px; }
  .love-note { margin-top: 12px; font-size: 12px; line-height: 1.6; }
  .actions { margin-top: 15px; }
  .heartbeat-button { padding: 10px 16px; }
  .footer { padding-top: 10px; }
}

@media (hover: none) and (pointer: coarse) {
  .heartbeat-button:hover { transform: none; background: rgba(255, 70, 124, 0.09); }
  .heartbeat-button:active { transform: scale(0.96); background: rgba(255, 70, 124, 0.2); }
}

@media (max-height: 650px) and (min-width: 901px) {
  .hero { transform: scale(0.9); }
  .heart-space { min-height: 510px; }
  .actions { margin-top: 25px; }
  .love-note { margin-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
