:root {
  color-scheme: dark;
  --bg-ink: #050815;
  --bg-deep: #0c1532;
  --panel-bg: rgba(8, 14, 36, 0.58);
  --panel-border: rgba(163, 239, 255, 0.32);
  --stage-border: rgba(255, 177, 217, 0.55);
  --text-main: #f6f8ff;
  --text-soft: rgba(228, 236, 255, 0.78);
  --accent-pink: #ff5ea8;
  --accent-rose: #ff8bbd;
  --accent-cyan: #65f3ff;
  --accent-gold: #ffd886;
  --shadow-strong: 0 35px 90px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 18px 48px rgba(101, 243, 255, 0.18);
  --stage-width: min(82vw, 46rem);
  --stage-height: min(62vh, 38rem);
  --panel-width: min(90vw, 38rem);
  --font-body:
    -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    "Noto Sans CJK SC",
    "Source Han Sans SC",
    "WenQuanYi Micro Hei",
    "Segoe UI",
    sans-serif;
  --font-display:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Display",
    "Segoe UI",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  font-synthesis-weight: none;
}

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

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 94, 168, 0.18), transparent 28%),
    radial-gradient(circle at 82% 14%, rgba(101, 243, 255, 0.14), transparent 26%),
    linear-gradient(180deg, #070b18 0%, #0d1230 48%, #070912 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--text-main);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.is-sealed {
  overflow: hidden;
}

body::selection {
  background: rgba(255, 94, 168, 0.28);
}

.page-shell {
  position: relative;
  min-height: inherit;
  padding:
    calc(1.5rem + var(--safe-top))
    calc(1.15rem + var(--safe-right))
    calc(1.8rem + var(--safe-bottom))
    calc(1.15rem + var(--safe-left));
  display: grid;
  place-items: center;
  isolation: isolate;
  opacity: 0.08;
  pointer-events: none;
  filter: blur(16px);
  transform: scale(0.97);
  transition:
    opacity 900ms ease,
    filter 900ms ease,
    transform 900ms ease;
}

body.has-entered .page-shell {
  opacity: 1;
  pointer-events: auto;
  filter: none;
  transform: scale(1);
}

.page-shell::after {
  content: "";
  position: fixed;
  inset: auto calc(1.2rem + var(--safe-right)) calc(1.2rem + var(--safe-bottom)) auto;
  inline-size: 4rem;
  block-size: 4rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(101, 243, 255, 0.1), transparent 70%);
  filter: blur(8px);
  pointer-events: none;
  z-index: 1;
}

.letter-intro {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding:
    calc(1.5rem + var(--safe-top))
    calc(1.2rem + var(--safe-right))
    calc(1.5rem + var(--safe-bottom))
    calc(1.2rem + var(--safe-left));
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255, 216, 134, 0.1), transparent 34%),
    radial-gradient(circle at 18% 20%, rgba(255, 94, 168, 0.18), transparent 28%),
    radial-gradient(circle at 82% 16%, rgba(101, 243, 255, 0.16), transparent 30%),
    linear-gradient(180deg, rgba(5, 9, 22, 0.985), rgba(6, 12, 30, 0.98));
}

.letter-intro::before,
.letter-intro::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.5;
  pointer-events: none;
}

.letter-intro::before {
  inline-size: min(34rem, 50vw);
  block-size: min(22rem, 30vw);
  inset: 10% auto auto 8%;
  background: rgba(255, 94, 168, 0.22);
}

.letter-intro::after {
  inline-size: min(30rem, 44vw);
  block-size: min(20rem, 26vw);
  inset: auto 10% 12% auto;
  background: rgba(101, 243, 255, 0.18);
}

.letter-intro__content {
  position: relative;
  z-index: 1;
  inline-size: min(100%, 120rem);
  block-size: min(100%, 100dvh);
  display: block;
  text-align: center;
}

.letter-intro__content::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(101, 243, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(101, 243, 255, 0.08) 1px, transparent 1px);
  background-size: clamp(2rem, 3.6vw, 3rem) clamp(2rem, 3.6vw, 3rem);
  mask-image: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.78) 18%, rgba(0, 0, 0, 0.4) 78%, transparent);
  opacity: 0.22;
  pointer-events: none;
}

.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.meteor-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  perspective: 1800px;
  isolation: isolate;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 124, 188, 0.06), transparent 14%),
    radial-gradient(circle at 76% 20%, rgba(133, 229, 255, 0.05), transparent 16%),
    radial-gradient(circle at 54% 72%, rgba(255, 214, 148, 0.04), transparent 20%),
    linear-gradient(180deg, #02030b 0%, #040815 28%, #060d1c 56%, #030712 100%);
}

.meteor-stage::before,
.meteor-stage::after {
  content: "";
  position: absolute;
  inset: -12%;
  pointer-events: none;
}

.meteor-stage::before {
  z-index: 0;
  background:
    radial-gradient(ellipse at 22% 26%, rgba(255, 132, 192, 0.08), transparent 18%),
    radial-gradient(ellipse at 74% 34%, rgba(118, 225, 255, 0.08), transparent 19%),
    radial-gradient(ellipse at 48% 74%, rgba(255, 223, 170, 0.04), transparent 24%);
  filter: blur(56px);
  opacity: 0.56;
}

.meteor-stage::after {
  z-index: 0;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.28) 0 0.7px, transparent 1.9px) 0 0 / 104px 104px repeat,
    radial-gradient(circle, rgba(191, 243, 255, 0.24) 0 0.65px, transparent 1.8px) 26px 34px / 128px 128px repeat,
    radial-gradient(circle, rgba(255, 244, 214, 0.22) 0 0.6px, transparent 1.7px) 56px 18px / 142px 142px repeat,
    radial-gradient(circle, rgba(255, 255, 255, 0.16) 0 0.45px, transparent 1.2px) 14px 10px / 62px 62px repeat,
    radial-gradient(circle, rgba(188, 244, 255, 0.12) 0 0.42px, transparent 1.1px) 34px 42px / 52px 52px repeat,
    radial-gradient(circle, rgba(255, 248, 226, 0.1) 0 0.4px, transparent 1px) 11px 28px / 44px 44px repeat,
    radial-gradient(circle at 9% 16%, rgba(255, 255, 255, 0.42) 0 0.06rem, transparent 0.28rem),
    radial-gradient(circle at 27% 12%, rgba(188, 244, 255, 0.34) 0 0.05rem, transparent 0.24rem),
    radial-gradient(circle at 46% 20%, rgba(255, 240, 205, 0.34) 0 0.05rem, transparent 0.24rem),
    radial-gradient(circle at 67% 18%, rgba(255, 255, 255, 0.38) 0 0.06rem, transparent 0.28rem),
    radial-gradient(circle at 84% 26%, rgba(188, 244, 255, 0.32) 0 0.05rem, transparent 0.24rem),
    radial-gradient(circle at 14% 68%, rgba(255, 255, 255, 0.3) 0 0.05rem, transparent 0.22rem),
    radial-gradient(circle at 38% 78%, rgba(255, 248, 226, 0.28) 0 0.05rem, transparent 0.22rem),
    radial-gradient(circle at 59% 72%, rgba(188, 244, 255, 0.26) 0 0.05rem, transparent 0.22rem),
    radial-gradient(circle at 81% 86%, rgba(255, 255, 255, 0.32) 0 0.06rem, transparent 0.26rem);
  opacity: 0.58;
  animation: sky-drift 20s linear infinite alternate;
}

.meteor-stage__glow,
.meteor-stage__flare,
.meteor-curtain,
.star-node {
  position: absolute;
}

.star-node,
.star-node::before,
.star-node::after {
  display: none;
}

.meteor-stage__glow {
  z-index: 1;
  inset: 16% 9% 22%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 44%, rgba(255, 94, 168, 0.06), transparent 18%),
    radial-gradient(circle at 64% 56%, rgba(101, 243, 255, 0.06), transparent 22%),
    radial-gradient(circle at 50% 52%, rgba(255, 216, 134, 0.03), transparent 40%);
  filter: blur(58px);
  opacity: 0.38;
  transition:
    transform 960ms cubic-bezier(0.23, 1, 0.32, 1),
    opacity 960ms ease;
  animation: sky-breathe 9s ease-in-out infinite;
}

.meteor-stage__flare {
  z-index: 1;
  border-radius: 50%;
  filter: blur(62px);
  opacity: 0.16;
}

.meteor-stage__flare--left {
  inset: 10% auto auto 4%;
  inline-size: min(32rem, 38vw);
  block-size: min(22rem, 26vw);
  background: rgba(255, 94, 168, 0.12);
}

.meteor-stage__flare--right {
  inset: auto 5% 8% auto;
  inline-size: min(30rem, 34vw);
  block-size: min(22rem, 24vw);
  background: rgba(101, 243, 255, 0.12);
}

.meteor-curtain {
  inset: -5%;
  overflow: hidden;
  z-index: 2;
  will-change: transform, opacity;
  transform-style: preserve-3d;
  transition:
    transform 1180ms cubic-bezier(0.23, 1, 0.32, 1),
    opacity 960ms ease;
  background: transparent;
  opacity: 0.96;
}

.meteor-curtain::before,
.meteor-curtain::after {
  content: "";
  position: absolute;
  inset: -8%;
}

.meteor-curtain::before {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.46) 0 0.85px, transparent 3.8px) 0 0 / 164px 164px repeat,
    radial-gradient(circle, rgba(255, 246, 226, 0.4) 0 0.8px, transparent 3.6px) 48px 22px / 188px 188px repeat,
    radial-gradient(circle, rgba(188, 244, 255, 0.34) 0 0.75px, transparent 3.3px) 86px 66px / 214px 214px repeat,
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.72) 0 0.06rem, transparent 0.3rem),
    radial-gradient(circle at 31% 14%, rgba(188, 244, 255, 0.58) 0 0.05rem, transparent 0.28rem),
    radial-gradient(circle at 52% 26%, rgba(255, 246, 226, 0.6) 0 0.06rem, transparent 0.3rem),
    radial-gradient(circle at 74% 20%, rgba(255, 255, 255, 0.66) 0 0.06rem, transparent 0.3rem),
    radial-gradient(circle at 88% 34%, rgba(188, 244, 255, 0.54) 0 0.05rem, transparent 0.28rem),
    radial-gradient(circle at 18% 78%, rgba(255, 255, 255, 0.56) 0 0.05rem, transparent 0.26rem),
    radial-gradient(circle at 42% 70%, rgba(255, 246, 226, 0.48) 0 0.05rem, transparent 0.24rem),
    radial-gradient(circle at 68% 82%, rgba(255, 255, 255, 0.52) 0 0.05rem, transparent 0.26rem),
    radial-gradient(circle at 86% 74%, rgba(255, 232, 193, 0.42) 0 0.05rem, transparent 0.24rem);
  opacity: 0.34;
  animation: sky-drift 24s linear infinite alternate;
  mix-blend-mode: screen;
}

.meteor-curtain::after {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.18) 0 0.65px, transparent 1.75px) 0 0 / 72px 72px repeat,
    radial-gradient(circle, rgba(188, 244, 255, 0.14) 0 0.58px, transparent 1.65px) 18px 24px / 86px 86px repeat,
    radial-gradient(circle, rgba(255, 248, 226, 0.14) 0 0.58px, transparent 1.65px) 44px 14px / 96px 96px repeat,
    radial-gradient(circle, rgba(255, 255, 255, 0.12) 0 0.46px, transparent 1.25px) 8px 6px / 46px 46px repeat,
    radial-gradient(circle, rgba(188, 244, 255, 0.08) 0 0.4px, transparent 1.1px) 22px 12px / 34px 34px repeat,
    radial-gradient(circle, rgba(255, 248, 226, 0.08) 0 0.38px, transparent 1px) 6px 30px / 28px 28px repeat;
  animation: starfield-drift 18s linear infinite alternate;
  opacity: 0.46;
  mix-blend-mode: screen;
}

.meteor-curtain--upper {
  clip-path: polygon(0 0, 100% 0, 100% 56%, 58% 64%, 0 40%);
  transform-origin: 70% 18%;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 1) 82%, transparent 100%);
}

.meteor-curtain--lower {
  clip-path: polygon(0 60%, 42% 36%, 100% 44%, 100% 100%, 0 100%);
  transform-origin: 30% 82%;
  mask-image: linear-gradient(0deg, rgba(0, 0, 0, 1) 82%, transparent 100%);
}

.meteor-curtain--lower::after {
  animation-direction: alternate-reverse;
}

.star-node {
  inline-size: var(--size, 0.34rem);
  block-size: var(--size, 0.34rem);
  inset: var(--top) auto auto var(--left);
  z-index: 2;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 1) 0 34%, rgba(255, 247, 228, 0.98) 58%, rgba(255, 224, 175, 0.22) 78%, transparent 100%);
  box-shadow:
    0 0 calc(var(--size, 0.34rem) * 1.3) rgba(255, 255, 255, 0.94),
    0 0 calc(var(--size, 0.34rem) * 3.2) rgba(255, 230, 190, 0.22),
    0 0 calc(var(--size, 0.34rem) * 5.8) rgba(168, 233, 255, 0.08);
  transform: translate(-50%, -50%);
  animation: star-twinkle var(--duration, 4.8s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  mix-blend-mode: screen;
}

.star-node::before,
.star-node::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.star-node::before {
  inline-size: calc(var(--size, 0.34rem) * 11);
  block-size: max(1px, calc(var(--size, 0.34rem) * 0.14));
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.88), transparent);
  filter: blur(0.7px);
  opacity: 0.72;
}

.star-node::after {
  inline-size: max(1px, calc(var(--size, 0.34rem) * 0.14));
  block-size: calc(var(--size, 0.34rem) * 11);
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  filter: blur(0.7px);
  opacity: 0.64;
}

.star-node--u1 {
  --left: 14%;
  --top: 20%;
  --size: 0.28rem;
  --duration: 5.2s;
  --delay: -1.4s;
}

.star-node--u2 {
  --left: 29%;
  --top: 28%;
  --size: 0.16rem;
  --duration: 4.6s;
  --delay: -0.8s;
}

.star-node--u3 {
  --left: 46%;
  --top: 16%;
  --size: 0.22rem;
  --duration: 6.2s;
  --delay: -2.4s;
}

.star-node--u4 {
  --left: 64%;
  --top: 31%;
  --size: 0.14rem;
  --duration: 5.8s;
  --delay: -1.2s;
}

.star-node--u5 {
  --left: 78%;
  --top: 18%;
  --size: 0.32rem;
  --duration: 6.8s;
  --delay: -3.1s;
}

.star-node--u6 {
  --left: 88%;
  --top: 36%;
  --size: 0.18rem;
  --duration: 5s;
  --delay: -2.2s;
}

.star-node--l1 {
  --left: 12%;
  --top: 72%;
  --size: 0.18rem;
  --duration: 4.8s;
  --delay: -0.6s;
}

.star-node--l2 {
  --left: 25%;
  --top: 58%;
  --size: 0.3rem;
  --duration: 6.4s;
  --delay: -2.7s;
}

.star-node--l3 {
  --left: 44%;
  --top: 78%;
  --size: 0.2rem;
  --duration: 5.6s;
  --delay: -1.1s;
}

.star-node--l4 {
  --left: 58%;
  --top: 62%;
  --size: 0.16rem;
  --duration: 5.4s;
  --delay: -2.9s;
}

.star-node--l5 {
  --left: 74%;
  --top: 84%;
  --size: 0.32rem;
  --duration: 7.2s;
  --delay: -3.5s;
}

.star-node--l6 {
  --left: 88%;
  --top: 68%;
  --size: 0.2rem;
  --duration: 5.1s;
  --delay: -1.9s;
}

.seal-button {
  position: absolute;
  inset: auto auto calc(2.8rem + var(--safe-bottom)) 50%;
  z-index: 7;
  inline-size: 178px;
  block-size: 52px;
  border: 1px solid rgba(255, 245, 223, 0.26);
  border-radius: 999px;
  padding: 0 26px;
  cursor: pointer;
  isolation: isolate;
  background:
    linear-gradient(180deg, rgba(255, 248, 233, 0.16), rgba(255, 248, 233, 0.04)),
    linear-gradient(135deg, rgba(255, 213, 142, 0.18), rgba(255, 94, 168, 0.08) 52%, rgba(101, 243, 255, 0.08));
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.34),
    0 0 22px rgba(255, 220, 148, 0.12),
    0 0 36px rgba(101, 243, 255, 0.08);
  filter:
    drop-shadow(0 0 14px rgba(255, 216, 134, 0.12))
    drop-shadow(0 0 22px rgba(255, 255, 255, 0.04));
  transform: translateX(-50%);
  transition:
    transform 220ms ease,
    opacity 260ms ease,
    box-shadow 220ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 247, 229, 0.96);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-shadow: 0 0 12px rgba(255, 220, 148, 0.16);
  animation: heartbeat-star 2.4s ease-in-out infinite;
}

.seal-button::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.03));
  opacity: 0.9;
}

.seal-button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 220, 148, 0.16), transparent 52%);
  filter: blur(10px);
  opacity: 0.72;
}

.seal-button::after,
.seal-button::before {
  pointer-events: none;
}

.seal-button:hover {
  transform: translateX(-50%) scale(1.04);
  box-shadow:
    0 22px 38px rgba(0, 0, 0, 0.38),
    0 0 26px rgba(255, 220, 148, 0.16),
    0 0 40px rgba(101, 243, 255, 0.12);
}

.seal-button:active {
  transform: translateX(-50%) scale(0.96);
}

.seal-button:disabled {
  cursor: wait;
  opacity: 0.62;
  animation-play-state: paused;
}

.seal-button__label {
  position: relative;
  z-index: 1;
}

body.is-opening-letter .meteor-curtain--upper {
  transform: translate3d(-9vw, -20vh, 0) rotateZ(-15deg) rotateX(14deg);
  opacity: 0;
}

body.is-opening-letter .meteor-curtain--lower {
  transform: translate3d(9vw, 20vh, 0) rotateZ(15deg) rotateX(-14deg);
  opacity: 0;
}

body.is-opening-letter .meteor-stage__glow,
body.is-opening-letter .meteor-stage__flare {
  transform: scale(1.08);
  opacity: 0;
}

body.is-opening-letter .seal-button {
  opacity: 0;
  transform: translate(-50%, 3.4rem) scale(0.74);
}

body.is-opening-letter .letter-intro {
  animation: intro-fade-out 1150ms ease forwards 260ms;
}

body.is-opening-letter .meteor-stage {
  animation: meteor-stage-shift 980ms cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

body.has-entered .letter-intro {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.scene-backdrop {
  position: absolute;
  inset: 0;
  overflow: clip;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.03), transparent 32%),
    linear-gradient(140deg, rgba(255, 94, 168, 0.12), transparent 42%),
    linear-gradient(320deg, rgba(101, 243, 255, 0.12), transparent 40%);
}

.scene-backdrop::before,
.scene-backdrop::after {
  content: "";
  position: absolute;
  inset: auto;
  border-radius: 999px;
  filter: blur(20px);
  opacity: 0.6;
}

.scene-backdrop::before {
  inline-size: min(26rem, 46vw);
  block-size: min(26rem, 46vw);
  inset-block-start: 8%;
  inset-inline-start: 8%;
  background: radial-gradient(circle, rgba(255, 94, 168, 0.35), transparent 70%);
}

.scene-backdrop::after {
  inline-size: min(24rem, 40vw);
  block-size: min(24rem, 40vw);
  inset-block-end: 4%;
  inset-inline-end: 5%;
  background: radial-gradient(circle, rgba(101, 243, 255, 0.3), transparent 72%);
}

.scene-grid,
.scene-radial {
  position: absolute;
  inset: 0;
}

.scene-grid {
  background:
    linear-gradient(rgba(101, 243, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(101, 243, 255, 0.1) 1px, transparent 1px);
  background-size: clamp(2rem, 4vw, 3.6rem) clamp(2rem, 4vw, 3.6rem);
  mask-image: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.9) 18%, rgba(0, 0, 0, 0.35) 80%, transparent);
  opacity: 0.35;
}

.scene-radial {
  border-radius: 999px;
  filter: blur(55px);
  opacity: 0.42;
}

.radial-left {
  inset: 18% auto auto 10%;
  inline-size: min(22rem, 34vw);
  block-size: min(20rem, 30vw);
  background: rgba(255, 94, 168, 0.22);
}

.radial-right {
  inset: 10% 10% auto auto;
  inline-size: min(24rem, 40vw);
  block-size: min(18rem, 28vw);
  background: rgba(101, 243, 255, 0.18);
}

.radial-bottom {
  inset: auto 22% 5% auto;
  inline-size: min(30rem, 46vw);
  block-size: min(14rem, 18vw);
  background: rgba(255, 216, 134, 0.12);
}

.heart-cloud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pulse-heart {
  --heart-size: 2.5rem;
  --heart-opacity: 0.24;
  --float-duration: 15s;
  position: absolute;
  inline-size: var(--heart-size);
  block-size: var(--heart-size);
  background: linear-gradient(135deg, rgba(255, 94, 168, 0.95), rgba(255, 139, 189, 0.58));
  border-radius: 0.35rem;
  box-shadow:
    0 0 18px rgba(255, 94, 168, 0.45),
    0 0 46px rgba(101, 243, 255, 0.15);
  opacity: var(--heart-opacity);
  transform: rotate(45deg);
  animation: float-heart var(--float-duration) ease-in-out infinite;
}

.pulse-heart::before,
.pulse-heart::after {
  content: "";
  position: absolute;
  inline-size: 100%;
  block-size: 100%;
  border-radius: 50%;
  background: inherit;
}

.pulse-heart::before {
  inset-block-start: -50%;
  inset-inline-start: 0;
}

.pulse-heart::after {
  inset-block-start: 0;
  inset-inline-start: -50%;
}

.heart-1 {
  --heart-size: 3.4rem;
  --heart-opacity: 0.2;
  inset: 16% auto auto 12%;
}

.heart-2 {
  --heart-size: 2.1rem;
  --heart-opacity: 0.25;
  --float-duration: 12s;
  inset: 24% 20% auto auto;
}

.heart-3 {
  --heart-size: 4rem;
  inset: auto 16% 18% auto;
}

.heart-4 {
  --heart-size: 1.8rem;
  --float-duration: 11s;
  inset: auto auto 22% 18%;
}

.heart-5 {
  --heart-size: 2.8rem;
  --heart-opacity: 0.18;
  --float-duration: 17s;
  inset: 10% auto auto 42%;
}

.heart-6 {
  --heart-size: 2rem;
  --float-duration: 13s;
  inset: auto 34% 10% auto;
}

.heart-7 {
  --heart-size: 3.1rem;
  --heart-opacity: 0.12;
  inset: 58% auto auto 8%;
}

.heart-8 {
  --heart-size: 2.4rem;
  --float-duration: 14s;
  inset: 60% 10% auto auto;
}

.hero {
  position: relative;
  z-index: 1;
  inline-size: min(100%, 70rem);
  display: grid;
  gap: 1rem;
  justify-items: center;
}

.eyebrow {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.8rem, 1.4vw, 1rem);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(207, 248, 255, 0.82);
  text-shadow: 0 0 16px rgba(101, 243, 255, 0.34);
}

.hero-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 2.4vh, 1.6rem);
  inline-size: 100%;
}

.stage-shell {
  position: relative;
  inline-size: var(--stage-width);
  block-size: var(--stage-height);
  min-inline-size: min(100%, 18rem);
  min-block-size: 18rem;
}

.photo-stage {
  position: relative;
  inline-size: 100%;
  block-size: 100%;
  overflow: hidden;
  border-radius: clamp(1.4rem, 3vw, 2.5rem);
  border: 1px solid var(--stage-border);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    radial-gradient(circle at top left, rgba(255, 94, 168, 0.2), transparent 42%),
    radial-gradient(circle at bottom right, rgba(101, 243, 255, 0.18), transparent 36%),
    rgba(4, 10, 28, 0.82);
  box-shadow:
    var(--shadow-strong),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 0 72px rgba(255, 94, 168, 0.2);
  backdrop-filter: blur(16px);
}

.photo-stage::before {
  content: "";
  position: absolute;
  inset: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: inherit;
  pointer-events: none;
  z-index: 3;
}

.photo-layer,
.photo-fallback,
.photo-sheen {
  position: absolute;
  inset: 0;
}

.photo-layer {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  opacity: 0;
  object-fit: cover;
  object-position: center center;
  transition:
    opacity 600ms ease,
    transform 2.2s ease;
  transform: scale(1.04);
}

.photo-layer.is-active {
  opacity: 1;
  transform: scale(1);
}

.photo-sheen {
  z-index: 2;
  background:
    linear-gradient(125deg, rgba(255, 255, 255, 0.16), transparent 28%),
    linear-gradient(180deg, transparent 0%, rgba(8, 14, 36, 0.08) 60%, rgba(8, 14, 36, 0.28) 100%);
  mix-blend-mode: screen;
  pointer-events: none;
}

.photo-fallback {
  display: grid;
  place-items: center;
  padding: 1.5rem;
  z-index: 1;
  text-align: center;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  line-height: 1.8;
  color: rgba(240, 244, 255, 0.76);
  opacity: 0;
  transition: opacity 300ms ease;
}

.photo-stage.is-empty .photo-fallback {
  opacity: 1;
}

.orbit {
  position: absolute;
  inset: 50% auto auto 50%;
  border-radius: 50%;
  border: 1px solid rgba(101, 243, 255, 0.18);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.orbit-a {
  inline-size: min(92vw, 54rem);
  block-size: min(92vw, 54rem);
  animation: orbit-spin 30s linear infinite;
}

.orbit-b {
  inline-size: min(72vw, 42rem);
  block-size: min(72vw, 42rem);
  border-color: rgba(255, 94, 168, 0.16);
  animation: orbit-spin 24s linear infinite reverse;
}

.ui-panel {
  inline-size: var(--panel-width);
  max-inline-size: calc(var(--stage-width) + 4rem);
  padding: clamp(0.95rem, 1.8vw, 1.35rem);
  border-radius: clamp(1.1rem, 2.6vw, 1.8rem);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04)),
    var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow:
    var(--shadow-soft),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  backdrop-filter: blur(22px);
  text-align: center;
}

.quote,
.meta-line,
.audio-state {
  margin: 0;
}

.quote {
  min-block-size: 3.7lh;
  font-size: clamp(1.1rem, 2.7vw, 1.55rem);
  line-height: 1.72;
  letter-spacing: 0.03em;
  text-wrap: balance;
  text-shadow: 0 0 22px rgba(255, 255, 255, 0.12);
}

.quote.is-refreshing {
  animation: quote-flash 320ms ease;
}

.meta-line {
  display: none;
  font-size: clamp(0.78rem, 1.4vw, 0.92rem);
  color: var(--text-soft);
}

.meta-line.is-visible {
  display: block;
  margin-top: 0.5rem;
}

.play-button {
  margin-top: 0.95rem;
  inline-size: min(100%, 18rem);
  min-block-size: 2.75rem;
  padding: 0.68rem 1rem;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: #08101e;
  background:
    linear-gradient(135deg, var(--accent-gold), #fff0c7 36%, #9ff5ff 100%);
  box-shadow:
    0 14px 26px rgba(255, 216, 134, 0.2),
    0 0 22px rgba(101, 243, 255, 0.28);
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

.play-button:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow:
    0 18px 30px rgba(255, 216, 134, 0.26),
    0 0 28px rgba(101, 243, 255, 0.32);
}

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

.play-button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 4px;
}

.audio-state {
  display: none;
  font-size: clamp(0.84rem, 1.6vw, 0.96rem);
  line-height: 1.7;
  color: rgba(220, 231, 255, 0.84);
}

.audio-state.is-visible {
  display: block;
  margin-top: 0.65rem;
  min-block-size: 2.2lh;
}

.music-toggle {
  position: fixed;
  inset: auto calc(1.1rem + var(--safe-right)) calc(1.1rem + var(--safe-bottom)) auto;
  z-index: 5;
  inline-size: 3.3rem;
  block-size: 3.3rem;
  border: 1px solid rgba(163, 239, 255, 0.35);
  border-radius: 50%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04)),
    rgba(7, 14, 34, 0.78);
  color: rgba(236, 245, 255, 0.92);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.28),
    0 0 18px rgba(101, 243, 255, 0.18);
  backdrop-filter: blur(14px);
  cursor: pointer;
  transition:
    opacity 220ms ease,
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    filter 160ms ease;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

body.has-entered .music-toggle {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.music-toggle:hover {
  transform: translateY(-2px);
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.34),
    0 0 24px rgba(101, 243, 255, 0.24);
}

.music-toggle:active {
  transform: translateY(1px);
}

.music-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.74);
  outline-offset: 4px;
}

.music-toggle.is-disabled {
  opacity: 0.68;
}

.music-toggle.is-on {
  border-color: rgba(255, 216, 134, 0.5);
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.36),
    0 0 28px rgba(255, 216, 134, 0.24);
}

.music-toggle__icon {
  inline-size: 1.25rem;
  block-size: 1.25rem;
}

.music-toggle__slash {
  position: absolute;
  inset: 50% auto auto 50%;
  inline-size: 1.75rem;
  block-size: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(-40deg);
  transition: opacity 160ms ease;
}

.music-toggle.is-on .music-toggle__slash {
  opacity: 0;
}

@keyframes float-heart {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(45deg);
  }

  50% {
    transform: translate3d(0, -18px, 0) rotate(45deg);
  }
}

@keyframes orbit-spin {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes quote-flash {
  from {
    opacity: 0.3;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sky-drift {
  from {
    transform: translate3d(-1.4rem, -0.8rem, 0) scale(1);
  }

  to {
    transform: translate3d(1.8rem, 1.2rem, 0) scale(1.03);
  }
}

@keyframes sky-breathe {
  0%,
  100% {
    opacity: 0.62;
    transform: scale(0.98);
  }

  50% {
    opacity: 0.78;
    transform: scale(1.03);
  }
}

@keyframes starfield-drift {
  from {
    transform: translate3d(-0.8rem, -1.2rem, 0) scale(1);
  }

  to {
    transform: translate3d(1.2rem, 1rem, 0) scale(1.02);
  }
}

@keyframes heartbeat-star {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
  }

  18% {
    transform: translateX(-50%) scale(1.08);
  }

  36% {
    transform: translateX(-50%) scale(0.96);
  }

  56% {
    transform: translateX(-50%) scale(1.12);
  }

  72% {
    transform: translateX(-50%) scale(0.98);
  }
}

@keyframes star-twinkle {
  0%,
  100% {
    opacity: 0.62;
    transform: translate(-50%, -50%) scale(0.94);
  }

  22% {
    opacity: 0.82;
    transform: translate(-50%, -50%) scale(1.01);
  }

  48% {
    opacity: 0.98;
    transform: translate(-50%, -50%) scale(1.06);
  }

  74% {
    opacity: 0.74;
    transform: translate(-50%, -50%) scale(0.99);
  }
}

@keyframes meteor-stage-shift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    transform: translate3d(0, -1.8vh, 0) scale(1.02);
  }
}

@keyframes intro-fade-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
    visibility: hidden;
  }
}

/* iPhone 14 canvas layout */

:root {
  --design-width: 390px;
  --design-height: 844px;
  --scene-scale: 1;
  --stage-width: 338px;
  --stage-height: 444px;
  --panel-width: 338px;
}

html,
body {
  inline-size: 100%;
  block-size: 100%;
}

body {
  min-height: 100%;
}

.scene-viewport {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
}

.scene-frame {
  position: relative;
  inline-size: var(--frame-width, var(--design-width));
  block-size: var(--frame-height, var(--design-height));
  overflow: hidden;
  isolation: isolate;
  transform: scale(var(--scene-scale));
  transform-origin: center center;
}

.letter-intro,
.page-shell {
  position: absolute;
  inset: 0;
}

.letter-intro {
  padding: 0;
}

.letter-intro::before {
  inline-size: 260px;
  block-size: 170px;
  inset: 78px auto auto 22px;
}

.letter-intro::after {
  inline-size: 236px;
  block-size: 156px;
  inset: auto 24px 98px auto;
}

.letter-intro__content {
  inline-size: 100%;
  block-size: 100%;
  max-inline-size: none;
  text-align: initial;
}

.letter-intro__content::before {
  background-size: 30px 30px;
}

.meteor-stage__glow {
  inset: 132px 34px 190px;
}

.meteor-stage__flare--left {
  inset: 86px auto auto 18px;
  inline-size: 290px;
  block-size: 214px;
}

.meteor-stage__flare--right {
  inset: auto 14px 82px auto;
  inline-size: 272px;
  block-size: 208px;
}

.seal-button {
  inset: auto auto 72px 50%;
  inline-size: 178px;
  block-size: 52px;
}

body.is-opening-letter .meteor-curtain--upper {
  transform: translate3d(-72px, -154px, 0) rotateZ(-15deg) rotateX(14deg);
}

body.is-opening-letter .meteor-curtain--lower {
  transform: translate3d(72px, 154px, 0) rotateZ(15deg) rotateX(-14deg);
}

body.is-opening-letter .seal-button {
  transform: translate(-50%, 40px) scale(0.74);
}

.page-shell {
  min-height: 0;
  padding: 54px 24px 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-shell::after {
  position: absolute;
  inset: auto 16px 16px auto;
  inline-size: 64px;
  block-size: 64px;
}

.scene-backdrop::before {
  inline-size: 252px;
  block-size: 252px;
  inset-block-start: 68px;
  inset-inline-start: 24px;
}

.scene-backdrop::after {
  inline-size: 226px;
  block-size: 226px;
  inset-block-end: 54px;
  inset-inline-end: 16px;
}

.scene-grid {
  background-size: 32px 32px;
}

.radial-left {
  inline-size: 208px;
  block-size: 186px;
}

.radial-right {
  inline-size: 224px;
  block-size: 176px;
}

.radial-bottom {
  inline-size: 286px;
  block-size: 118px;
}

.hero {
  inline-size: 100%;
  max-inline-size: none;
  gap: 12px;
}

.eyebrow {
  font-size: 13px;
  letter-spacing: 0.38em;
}

.hero-stack {
  gap: 18px;
}

.stage-shell {
  inline-size: var(--stage-width);
  block-size: var(--stage-height);
  min-inline-size: 0;
  min-block-size: 0;
}

.photo-stage {
  border-radius: 30px;
}

.photo-stage::before {
  inset: 15px;
}

.photo-fallback {
  padding: 24px;
  font-size: 16px;
}

.orbit-a {
  inline-size: 548px;
  block-size: 548px;
}

.orbit-b {
  inline-size: 416px;
  block-size: 416px;
}

.ui-panel {
  inline-size: var(--panel-width);
  max-inline-size: none;
  padding: 16px 18px 14px;
  border-radius: 22px;
}

.quote {
  min-block-size: 3.5lh;
  font-size: 20px;
}

.meta-line {
  font-size: 12px;
}

.play-button {
  margin-top: 14px;
  inline-size: 244px;
  min-block-size: 50px;
  font-size: 15px;
}

.audio-state {
  font-size: 13px;
}

.music-toggle {
  position: absolute;
  inset: auto 24px 30px auto;
  inline-size: 52px;
  block-size: 52px;
}

.music-toggle__icon {
  inline-size: 20px;
  block-size: 20px;
}

.music-toggle__slash {
  inline-size: 28px;
}

@keyframes meteor-stage-shift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }

  to {
    transform: translate3d(0, -14px, 0) scale(1.02);
  }
}

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