:root {
  --ink: #fff8ed;
  --muted: rgba(255, 245, 226, 0.72);
  --gold: #f6d88f;
  --gold-strong: #fff0bd;
  --wine: #6b233d;
  --deep: #140b17;
  --deep-2: #241020;
  --glass: rgba(255, 250, 239, 0.075);
  --line: rgba(246, 216, 143, 0.38);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--deep); }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -12%, rgba(132, 54, 90, 0.55), transparent 42%),
    radial-gradient(circle at 88% 34%, rgba(95, 44, 73, 0.24), transparent 28%),
    linear-gradient(165deg, #1e0e1d 0%, #120a16 46%, #1a0b17 100%);
  font-family: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }
button { font: inherit; }

#fxCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.aurora {
  position: fixed;
  width: 55vw;
  height: 55vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.17;
  z-index: 0;
  pointer-events: none;
  animation: drift 13s ease-in-out infinite alternate;
}
.aurora-a { top: -14vw; left: -15vw; background: #8c365d; }
.aurora-b { right: -18vw; bottom: 10vh; background: #b47250; animation-delay: -6s; }
.noise {
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: 0.035;
  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='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 26px;
  background: radial-gradient(circle at 50% 32%, rgba(104, 35, 64, 0.47), rgba(13, 7, 15, 0.95) 69%);
  transition: opacity 1s ease, visibility 1s ease, transform 1s ease;
}
.gate.is-open { opacity: 0; visibility: hidden; transform: scale(1.06); }
.gate-halo {
  position: absolute;
  width: min(78vw, 480px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 224, 157, 0.15), transparent 62%);
  border: 1px solid rgba(255, 231, 179, 0.12);
  box-shadow: 0 0 0 34px rgba(255,255,255,0.012), 0 0 0 72px rgba(255,255,255,0.008);
  animation: gatePulse 4s ease-in-out infinite;
}
.gate-card {
  position: relative;
  width: min(88vw, 440px);
  padding: 54px 28px 38px;
  text-align: center;
  border: 1px solid rgba(246, 216, 143, 0.38);
  background: linear-gradient(145deg, rgba(255,255,255,0.095), rgba(255,255,255,0.025));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow), inset 0 0 40px rgba(255,255,255,0.025);
  clip-path: polygon(22px 0, calc(100% - 22px) 0, 100% 22px, 100% calc(100% - 22px), calc(100% - 22px) 100%, 22px 100%, 0 calc(100% - 22px), 0 22px);
}
.gate-card::before, .gate-card::after {
  content: "";
  position: absolute;
  left: 22%; right: 22%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.65;
}
.gate-card::before { top: 22px; }
.gate-card::after { bottom: 22px; }
.gate-knot {
  position: absolute;
  top: -19px; left: 50%;
  transform: translateX(-50%);
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #4d2032;
  background: linear-gradient(145deg, #fff1c1, #c99445);
  box-shadow: 0 0 24px rgba(246, 216, 143, 0.48);
}
.gate-small, .eyebrow, .section-label {
  margin: 0;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.22em;
  font-size: 11px;
}
.gate-card h1 {
  margin: 25px 0 30px;
  font-size: clamp(32px, 8vw, 46px);
  line-height: 1.42;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-shadow: 0 5px 22px rgba(0,0,0,.34);
}
.open-button {
  position: relative;
  border: 0;
  border-radius: 999px;
  padding: 15px 29px;
  color: #452033;
  cursor: pointer;
  overflow: hidden;
  background: linear-gradient(110deg, #c99245, #ffefba 48%, #d6a75d);
  box-shadow: 0 10px 35px rgba(210, 158, 80, .3), inset 0 1px rgba(255,255,255,.8);
  letter-spacing: .14em;
  font-weight: 700;
  transform: translateZ(0);
}
.open-button:active { transform: scale(.97); }
.open-button-glow {
  position: absolute;
  top: -80%; left: -35%; width: 26%; height: 260%;
  background: rgba(255,255,255,.72);
  transform: rotate(24deg);
  filter: blur(4px);
  animation: shine 2.7s ease-in-out infinite;
}
.open-button-text { position: relative; z-index: 1; }
.gate-tip { margin: 18px 0 0; color: rgba(255,255,255,.5); font-size: 12px; letter-spacing: .08em; }

.app {
  position: relative;
  z-index: 3;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1.1s ease .15s;
}
.app.is-visible { opacity: 1; visibility: visible; }
.section { position: relative; min-height: 100svh; padding: 90px 22px; }
.hero { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; overflow: hidden; }
.hero::before {
  content: "";
  position: absolute;
  width: min(115vw, 760px); aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(246,216,143,.11);
  box-shadow: 0 0 0 45px rgba(246,216,143,.025), 0 0 0 95px rgba(246,216,143,.014);
  animation: slowSpin 38s linear infinite;
}
.ornament { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; color: var(--gold); }
.ornament span { width: 54px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.ornament span:last-child { transform: scaleX(-1); }
.ornament i { font-style: normal; font-size: 13px; }
.eyebrow { position: relative; z-index: 1; margin-bottom: 34px; }
.portrait-shell { position: relative; width: 178px; height: 178px; margin-bottom: 33px; }
.portrait-frame {
  position: absolute;
  inset: 14px;
  padding: 5px;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff2bd, #9c6934 50%, #ffe8a7);
  box-shadow: 0 18px 60px rgba(0,0,0,.36), 0 0 32px rgba(246,216,143,.18);
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.portrait-orbit { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(246,216,143,.26); }
.orbit-one::before, .orbit-two::before {
  content: "✦"; position: absolute; top: 50%; left: -5px; color: var(--gold); font-size: 10px; transform: translateY(-50%);
}
.orbit-one { animation: slowSpin 12s linear infinite; }
.orbit-two { inset: 7px; border-style: dashed; opacity: .5; animation: slowSpinReverse 18s linear infinite; }
.portrait-badge {
  position: absolute; right: -6px; bottom: 17px;
  width: 48px; height: 48px; display: grid; place-items: center;
  border-radius: 50%;
  color: #3f1c2b; background: linear-gradient(145deg, #fff3c6, #d39c52);
  border: 3px solid #25101e; font: 700 11px/1 Georgia, serif; letter-spacing: .1em;
  box-shadow: 0 6px 18px rgba(0,0,0,.3);
}
.main-title {
  position: relative; z-index: 1;
  margin: 0;
  font-size: clamp(42px, 11vw, 68px);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: .08em;
  background: linear-gradient(100deg, #f4d996, #fff8df 45%, #e6ba6d 82%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 8px 28px rgba(0,0,0,.35));
}
.subtitle { position: relative; z-index: 1; max-width: 620px; margin: 24px auto 0; color: var(--muted); font-size: 16px; line-height: 2; letter-spacing: .08em; }
.date-ribbon {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 11px;
  margin-top: 30px; padding: 10px 17px;
  color: #f7e5ba;
  border-top: 1px solid rgba(246,216,143,.28);
  border-bottom: 1px solid rgba(246,216,143,.28);
  font-size: 13px; letter-spacing: .16em;
}
.date-ribbon span { color: var(--gold); }
.scroll-cue { position: absolute; bottom: 34px; width: 26px; height: 44px; border: 1px solid rgba(255,255,255,.25); border-radius: 20px; }
.scroll-cue span { position: absolute; width: 3px; height: 7px; top: 9px; left: 50%; transform: translateX(-50%); border-radius: 3px; background: var(--gold); animation: scrollDot 1.8s infinite; }

.letter-section, .wishes-section { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.section-label { margin-bottom: 18px; text-align: center; }
.section-title { margin: 0 0 38px; font-size: clamp(32px, 7vw, 46px); letter-spacing: .12em; }
.letter-card {
  position: relative;
  width: min(100%, 760px);
  padding: clamp(48px, 8vw, 78px) clamp(28px, 7vw, 68px) 50px;
  background:
    linear-gradient(rgba(31,14,28,.82), rgba(31,14,28,.82)),
    radial-gradient(circle at top, rgba(255,244,213,.12), transparent 45%);
  border: 1px solid rgba(246,216,143,.33);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.letter-card h2 { margin: 0 0 32px; text-align: center; color: var(--gold-strong); font-size: clamp(26px, 6vw, 38px); letter-spacing: .12em; }
.letter-body p { margin: 0 0 18px; color: rgba(255,248,234,.84); font-size: 16px; line-height: 2.15; text-indent: 2em; letter-spacing: .055em; }
.letter-body p:first-child { text-indent: 0; }
.signature { margin: 30px 0 0; text-align: right; color: var(--gold); font-size: 16px; letter-spacing: .12em; }
.wax-seal {
  position: absolute; top: -28px; left: 50%; transform: translateX(-50%) rotate(-7deg);
  width: 58px; height: 58px; display: grid; place-items: center;
  border-radius: 50%;
  color: #f6cf9b; background: radial-gradient(circle at 35% 25%, #b34b62, #642038 70%);
  border: 2px solid rgba(246,207,155,.34);
  box-shadow: 0 8px 24px rgba(0,0,0,.34), inset 0 0 0 5px rgba(255,255,255,.035);
  font-weight: 700; font-size: 21px;
}
.corner { position: absolute; width: 34px; height: 34px; border-color: var(--gold); opacity: .55; }
.corner-tl { top: 14px; left: 14px; border-top: 1px solid; border-left: 1px solid; }
.corner-tr { top: 14px; right: 14px; border-top: 1px solid; border-right: 1px solid; }
.corner-bl { bottom: 14px; left: 14px; border-bottom: 1px solid; border-left: 1px solid; }
.corner-br { bottom: 14px; right: 14px; border-bottom: 1px solid; border-right: 1px solid; }

.wishes-section { padding-top: 110px; padding-bottom: 110px; }
.wishes-grid { display: grid; width: min(100%, 980px); grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.wish-card {
  position: relative; min-height: 250px; padding: 34px 26px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; overflow: hidden;
  border: 1px solid rgba(246,216,143,.25);
  background: linear-gradient(155deg, rgba(255,255,255,.08), rgba(255,255,255,.018));
  box-shadow: 0 18px 50px rgba(0,0,0,.22);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: transform .35s ease, border-color .35s ease, background .35s ease;
}
.wish-card::after { content: ""; position: absolute; inset: auto -20% -60% -20%; height: 70%; background: radial-gradient(circle, rgba(246,216,143,.13), transparent 65%); }
.wish-card:hover { transform: translateY(-8px); border-color: rgba(246,216,143,.58); background: linear-gradient(155deg, rgba(255,255,255,.11), rgba(255,255,255,.025)); }
.wish-icon { position: relative; z-index: 1; width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 20px; border-radius: 50%; color: #522137; background: linear-gradient(145deg, #fff0b8, #c88e43); font-size: 25px; box-shadow: 0 8px 22px rgba(212,161,81,.22); }
.wish-card h3 { position: relative; z-index: 1; margin: 0 0 13px; color: var(--gold-strong); font-size: 23px; letter-spacing: .13em; }
.wish-card p { position: relative; z-index: 1; margin: 0; color: var(--muted); line-height: 1.9; font-size: 14px; letter-spacing: .04em; }

.memory-section { display: grid; place-items: center; min-height: 75svh; }
.memory-card { width: min(92vw, 720px); padding: 55px 28px; text-align: center; }
.quote-mark { color: rgba(246,216,143,.35); font: 84px/0.65 Georgia, serif; }
.memory-card p { margin: 26px 0; font-size: clamp(26px, 6vw, 42px); line-height: 1.7; letter-spacing: .1em; }
.gold-line { width: 90px; height: 1px; margin: 26px auto 20px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.memory-card span { color: var(--gold); font: 11px/1.6 Georgia, serif; letter-spacing: .22em; }

.final-section { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100svh; text-align: center; }
.final-flower { font-size: 54px; color: var(--gold); filter: drop-shadow(0 0 20px rgba(246,216,143,.35)); animation: flowerFloat 4s ease-in-out infinite; }
.final-text { max-width: 660px; margin: 26px 0 22px; color: var(--muted); font-size: 17px; line-height: 2; letter-spacing: .09em; }
.final-title { margin: 0; font-size: clamp(43px, 10vw, 68px); color: var(--gold-strong); letter-spacing: .1em; text-shadow: 0 12px 35px rgba(0,0,0,.35); }
.wish-button { margin-top: 35px; padding: 13px 24px; color: var(--gold-strong); background: transparent; border: 1px solid rgba(246,216,143,.46); border-radius: 999px; cursor: pointer; letter-spacing: .12em; transition: all .28s ease; }
.wish-button:hover { color: #3d1b2c; background: var(--gold-strong); box-shadow: 0 0 30px rgba(246,216,143,.2); }
.tiny-note { position: absolute; bottom: 30px; color: rgba(255,255,255,.32); font: 10px/1 Georgia, serif; letter-spacing: .22em; }

.music-button {
  position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 35; width: 52px; height: 52px; padding: 0;
  display: grid; place-items: center;
  border-radius: 50%; border: 1px solid rgba(246,216,143,.42);
  color: var(--gold-strong); background: rgba(27,12,24,.74);
  box-shadow: 0 10px 30px rgba(0,0,0,.34);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  cursor: pointer; opacity: 0; visibility: hidden; transition: opacity .5s ease, transform .2s ease;
}
.music-button.show { opacity: 1; visibility: visible; }
.music-button:active { transform: scale(.94); }
.music-disc { position: absolute; font: 22px/1 Georgia, serif; }
.music-button.playing .music-disc { animation: discSpin 4s linear infinite; }
.music-wave { position: absolute; right: -2px; bottom: -2px; width: 20px; height: 20px; display: flex; gap: 2px; align-items: end; justify-content: center; border-radius: 50%; background: linear-gradient(145deg, #fff1bb, #c98e43); padding: 5px; }
.music-wave i { width: 2px; height: 5px; border-radius: 2px; background: #522136; }
.music-button.playing .music-wave i:nth-child(1) { animation: wave .7s ease-in-out infinite alternate; }
.music-button.playing .music-wave i:nth-child(2) { animation: wave .45s ease-in-out infinite alternate; }
.music-button.playing .music-wave i:nth-child(3) { animation: wave .6s ease-in-out infinite alternate-reverse; }

.reveal { opacity: 0; transform: translateY(22px) scale(.98); }
.app.is-visible .reveal { animation: revealUp 1s cubic-bezier(.2,.8,.2,1) forwards; }
.delay-1 { animation-delay: .3s !important; }
.delay-2 { animation-delay: .55s !important; }
.delay-3 { animation-delay: .78s !important; }
.delay-4 { animation-delay: 1s !important; }
.reveal-on-scroll { opacity: 0; transform: translateY(34px); transition: opacity .9s ease, transform .9s cubic-bezier(.2,.8,.2,1); }
.reveal-on-scroll.visible { opacity: 1; transform: none; }

@keyframes revealUp { to { opacity: 1; transform: none; } }
@keyframes drift { to { transform: translate3d(10vw, 8vh, 0) scale(1.12); } }
@keyframes gatePulse { 50% { transform: scale(1.05); opacity: .78; } }
@keyframes shine { 0%, 28% { left: -35%; } 65%, 100% { left: 120%; } }
@keyframes slowSpin { to { transform: rotate(360deg); } }
@keyframes slowSpinReverse { to { transform: rotate(-360deg); } }
@keyframes scrollDot { 0% { opacity: 0; transform: translate(-50%,0); } 35% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,17px); } }
@keyframes flowerFloat { 50% { transform: translateY(-10px) rotate(7deg); } }
@keyframes discSpin { to { transform: rotate(360deg); } }
@keyframes wave { to { height: 10px; } }

@media (max-width: 760px) {
  .section { padding-left: 19px; padding-right: 19px; }
  .wishes-grid { grid-template-columns: 1fr; max-width: 440px; }
  .wish-card { min-height: 210px; }
  .letter-body p { font-size: 15px; line-height: 2; }
  .eyebrow { font-size: 9px; letter-spacing: .16em; }
}

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