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

:root {
  color-scheme: dark;
  --ink: #f6f1e8;
  --muted: #9b9bb5;
  --gold: #f4c97d;
  --gold-soft: #ffe4a9;
  --violet: #9b8cff;
  --night: #080b24;
  --night-deep: #050718;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; overflow: hidden; background: var(--night-deep); color: var(--ink); font-family: 'Noto Serif TC', serif; }
button { font: inherit; }

.scene { position: relative; min-height: 100svh; overflow: hidden; isolation: isolate; background: radial-gradient(ellipse at 50% 64%, rgba(56, 48, 128, .25) 0%, rgba(16, 18, 62, .1) 34%, transparent 68%), linear-gradient(145deg, #11143b 0%, var(--night) 47%, #060817 100%); }
.scene::before, .scene::after { content: ''; position: absolute; z-index: -2; border-radius: 50%; pointer-events: none; }
.scene::before { width: 48vw; height: 48vw; top: -24vw; left: -12vw; background: rgba(105, 86, 255, .09); filter: blur(5px); }
.scene::after { width: 42vw; height: 42vw; right: -18vw; bottom: -25vw; background: rgba(244, 201, 125, .06); filter: blur(5px); }
#fireworks { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; cursor: crosshair; }
.grain { position: absolute; inset: -100%; z-index: 1; opacity: .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='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E"); transform: rotate(8deg); }
.horizon-glow { position: absolute; z-index: -1; left: 50%; bottom: -18%; width: min(1050px, 120vw); height: 48%; transform: translateX(-50%); background: radial-gradient(ellipse at center, rgba(117, 95, 241, .2), transparent 66%); filter: blur(16px); pointer-events: none; }

.moon { position: absolute; top: 13%; right: 13%; z-index: -1; width: clamp(50px, 7vw, 92px); aspect-ratio: 1; border-radius: 50%; background: linear-gradient(145deg, #fff9df, #e9c877 70%, #9e713b); box-shadow: 0 0 22px rgba(255, 229, 165, .42), 0 0 90px rgba(255, 218, 132, .16); opacity: .82; animation: moonFloat 8s ease-in-out infinite; }
.moon::before, .moon::after, .moon span { content: ''; position: absolute; border-radius: 50%; background: rgba(145, 102, 58, .13); }
.moon::before { width: 20%; height: 20%; top: 23%; left: 23%; }
.moon::after { width: 13%; height: 13%; top: 58%; left: 58%; }
.moon span { width: 10%; height: 10%; top: 38%; left: 68%; }

.wish-stage { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; width: min(680px, calc(100% - 48px)); min-height: 100svh; margin: 0 auto; padding: clamp(78px, 12vh, 128px) 0 48px; text-align: center; }
.eyebrow { display: flex; align-items: center; gap: 12px; color: var(--gold-soft); font-size: 12px; letter-spacing: .38em; line-height: 1; opacity: 0; animation: riseIn 1s .25s ease-out forwards; }
.eyebrow-line { width: 28px; height: 1px; background: rgba(244, 201, 125, .7); }
.date-stamp { margin: 23px 0 0; color: #8586a6; font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: .27em; opacity: 0; animation: riseIn 1s .45s ease-out forwards; }
.countdown { margin: 10px 0 -8px; color: var(--gold); font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: .16em; opacity: 0; animation: riseIn 1s .62s ease-out forwards; }

h1 { margin: 27px 0 0; color: #fcfaf2; font-size: clamp(44px, 8vw, 82px); font-weight: 500; letter-spacing: .08em; line-height: 1.23; text-shadow: 0 4px 34px rgba(167, 151, 255, .17); opacity: 0; animation: titleIn 1.2s .72s cubic-bezier(.2, .8, .2, 1) forwards; }
h1 em { color: var(--gold-soft); font-style: normal; font-weight: 600; text-shadow: 0 0 34px rgba(248, 201, 114, .2); }
.divider { display: flex; align-items: center; gap: 13px; width: min(280px, 74%); margin: 26px 0 25px; opacity: 0; animation: riseIn 1s 1.12s ease-out forwards; }
.divider span { height: 1px; flex: 1; background: linear-gradient(90deg, transparent, rgba(244, 201, 125, .55)); }
.divider span:last-child { background: linear-gradient(90deg, rgba(244, 201, 125, .55), transparent); }
.divider i { color: var(--gold); font-size: 11px; font-style: normal; }

.wishes { width: min(530px, 100%); min-height: 98px; }
.wish { margin: 0; color: #dcd9e5; font-size: clamp(17px, 2.25vw, 21px); font-weight: 400; letter-spacing: .11em; line-height: 2; opacity: 0; }
.wish-one { min-height: 42px; }
.wish-two { min-height: 42px; margin-top: 2px; color: #ada9c9; }
.wish.is-visible { opacity: 1; }

.blessing-card { width: min(430px, 92%); min-height: 84px; margin-top: 14px; padding: 13px 42px 13px 19px; position: relative; border: 1px solid rgba(244, 201, 125, .2); border-radius: 4px 17px 4px 17px; background: linear-gradient(120deg, rgba(34, 29, 78, .5), rgba(15, 17, 53, .3)); box-shadow: 0 12px 32px rgba(0, 0, 0, .1), inset 0 0 24px rgba(244, 201, 125, .025); text-align: left; opacity: 0; transform: translateY(8px) scale(.98); pointer-events: none; }
.blessing-card[aria-hidden='false'] { opacity: 1; transform: translateY(0) scale(1); }
.blessing-card.card-pop { animation: cardPop .55s cubic-bezier(.2, .8, .2, 1); }
.card-label { color: var(--gold); font-family: 'DM Mono', monospace; font-size: 8px; letter-spacing: .18em; }
.blessing-card p { margin: 7px 0 0; color: #e7e1f0; font-size: 14px; letter-spacing: .06em; line-height: 1.7; }
.card-count { position: absolute; top: 14px; right: 14px; color: #777795; font-family: 'DM Mono', monospace; font-size: 8px; letter-spacing: .08em; }

.finale { width: min(500px, 96%); margin-top: 13px; display: flex; flex-direction: column; align-items: center; gap: 5px; opacity: 0; transform: translateY(9px) scale(.96); pointer-events: none; }
.finale[aria-hidden='false'] { opacity: 1; transform: translateY(0) scale(1); }
.finale.finale-pop { animation: finalePop .9s cubic-bezier(.2, .8, .2, 1); }
.finale-date { color: var(--gold); font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: .26em; }
.finale strong { color: var(--gold-soft); font-size: clamp(20px, 3.5vw, 27px); font-weight: 600; letter-spacing: .12em; text-shadow: 0 0 26px rgba(244, 201, 125, .24); }
.finale > span:last-child { color: #aaa8c2; font-size: 12px; letter-spacing: .08em; }

.spark-button { display: inline-flex; align-items: center; gap: 11px; margin-top: 27px; padding: 12px 22px 12px 17px; border: 1px solid rgba(244, 201, 125, .45); border-radius: 999px; color: #f8e7bf; background: rgba(20, 20, 61, .34); box-shadow: inset 0 0 20px rgba(255, 255, 255, .02), 0 0 22px rgba(137, 114, 255, .08); cursor: pointer; font-size: 13px; letter-spacing: .12em; transition: border-color .3s ease, background .3s ease, transform .3s ease, box-shadow .3s ease; opacity: 1; animation: breathe 3.5s ease-in-out infinite; position: relative; z-index: 4; }
.spark-button:hover, .spark-button:focus-visible { border-color: var(--gold-soft); background: rgba(40, 32, 83, .54); box-shadow: 0 0 30px rgba(244, 201, 125, .14); transform: translateY(-2px); outline: none; }
.spark-button:active { transform: translateY(1px) scale(.98); }
.button-icon { color: var(--gold); font-size: 16px; line-height: 1; }
.music-toggle { position: relative; z-index: 4; display: inline-flex; align-items: center; gap: 7px; margin-top: 9px; padding: 6px 12px; border: 1px solid rgba(155, 140, 255, .25); border-radius: 999px; color: #aaa8c5; background: rgba(20, 20, 61, .22); cursor: pointer; font-size: 10px; letter-spacing: .08em; transition: border-color .3s ease, color .3s ease, background .3s ease; }
.music-toggle:hover, .music-toggle:focus-visible { border-color: rgba(244, 201, 125, .55); color: var(--gold-soft); background: rgba(40, 32, 83, .42); outline: none; }
.music-icon { color: var(--gold); font-size: 14px; line-height: 1; }
.hint { position: relative; z-index: 4; margin: 13px 0 0; color: #777795; font-size: 10px; letter-spacing: .1em; opacity: 1; animation: none; }

.corner-note { position: absolute; z-index: 2; bottom: 31px; color: #696a8b; font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: .16em; line-height: 1.65; opacity: .75; }
.corner-note-left { left: 34px; }
.corner-note-right { right: 34px; text-align: right; }
.corner-note-right span { color: var(--gold); font-size: 14px; }

/* Surprise opening */
.letter-gate { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; color: var(--ink); text-align: center; background: radial-gradient(ellipse at 50% 45%, rgba(56, 48, 128, .3), transparent 55%), #07091e; transition: opacity .8s ease, visibility .8s ease; }
.letter-gate.is-open { opacity: 0; visibility: hidden; pointer-events: none; }
.letter-orbit { position: absolute; width: min(390px, 90vw); aspect-ratio: 1; border: 1px solid rgba(244, 201, 125, .15); border-radius: 50%; animation: orbitSpin 18s linear infinite; }
.letter-orbit::before, .letter-orbit::after, .letter-orbit span, .letter-orbit i, .letter-orbit b { content: ''; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--gold-soft); box-shadow: 0 0 14px var(--gold); }
.letter-orbit::before { top: 7%; left: 26%; }
.letter-orbit::after { right: 10%; bottom: 27%; width: 3px; height: 3px; background: var(--violet); }
.letter-orbit span { left: 15%; bottom: 24%; }
.letter-orbit i { right: 22%; top: 16%; width: 2px; height: 2px; }
.letter-orbit b { left: 50%; bottom: -2px; width: 3px; height: 3px; background: #9be7dc; }
.gate-kicker { margin: 0 0 28px; color: #8f90af; font-family: 'DM Mono', monospace; font-size: 9px; letter-spacing: .28em; opacity: 0; animation: riseIn 1s .2s ease-out forwards; }
.envelope-mark { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 19px; border: 1px solid rgba(244, 201, 125, .55); border-radius: 50%; color: var(--gold-soft); font-size: 21px; box-shadow: 0 0 30px rgba(244, 201, 125, .14); animation: gatePulse 3s ease-in-out infinite; }
.letter-gate h2 { margin: 0; color: #fff8e9; font-size: clamp(27px, 5vw, 42px); font-weight: 500; letter-spacing: .12em; opacity: 0; animation: riseIn 1s .45s ease-out forwards; }
.gate-copy { margin: 19px 0 26px; color: #b4b1ca; font-size: 15px; letter-spacing: .11em; line-height: 2; opacity: 0; animation: riseIn 1s .65s ease-out forwards; }
.open-letter { position: relative; z-index: 1; padding: 12px 23px; border: 1px solid rgba(244, 201, 125, .6); border-radius: 999px; color: #f8e7bf; background: rgba(26, 24, 69, .52); cursor: pointer; font-size: 13px; letter-spacing: .12em; opacity: 0; animation: riseIn 1s .85s ease-out forwards, breathe 3.5s 2s ease-in-out infinite; }
.open-letter:hover, .open-letter:focus-visible { border-color: var(--gold-soft); background: rgba(55, 43, 101, .7); outline: none; transform: translateY(-2px); }
.open-letter span { margin-left: 8px; color: var(--gold); }
.gate-hint { margin: 14px 0 0; color: #686987; font-size: 10px; letter-spacing: .08em; opacity: 0; animation: riseIn 1s 1.05s ease-out forwards; }

@keyframes riseIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@keyframes titleIn { from { opacity: 0; transform: translateY(26px) scale(.97); filter: blur(8px); } to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); } }
@keyframes moonFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
@keyframes breathe { 0%, 100% { box-shadow: inset 0 0 20px rgba(255, 255, 255, .02), 0 0 22px rgba(137, 114, 255, .08); } 50% { box-shadow: inset 0 0 20px rgba(255, 255, 255, .02), 0 0 32px rgba(244, 201, 125, .16); } }
@keyframes cardPop { 0% { opacity: .35; transform: translateY(8px) scale(.97); } 55% { opacity: 1; transform: translateY(-3px) scale(1.01); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes orbitSpin { to { transform: rotate(360deg); } }
@keyframes gatePulse { 0%, 100% { box-shadow: 0 0 30px rgba(244, 201, 125, .12); } 50% { box-shadow: 0 0 44px rgba(244, 201, 125, .25); } }
@keyframes finalePop { 0% { opacity: 0; transform: translateY(14px) scale(.86); filter: blur(5px); } 60% { opacity: 1; transform: translateY(-3px) scale(1.04); filter: blur(0); } 100% { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 640px) {
  .scene::before { width: 90vw; height: 90vw; top: -45vw; left: -28vw; }
  .scene::after { width: 90vw; height: 90vw; right: -44vw; bottom: -48vw; }
  .moon { top: 9%; right: 11%; width: 45px; opacity: .72; }
  .wish-stage { width: calc(100% - 36px); padding-top: 19vh; }
  .eyebrow { font-size: 10px; letter-spacing: .27em; }
  .eyebrow-line { width: 18px; }
  .date-stamp { margin-top: 18px; font-size: 8px; letter-spacing: .18em; }
  .countdown { margin-top: 9px; font-size: 8px; letter-spacing: .1em; }
  h1 { margin-top: 23px; font-size: clamp(39px, 13vw, 61px); letter-spacing: .04em; }
  .divider { margin: 22px 0 21px; }
  .wishes { min-height: 116px; }
  .wish { font-size: 16px; letter-spacing: .06em; line-height: 1.9; }
  .wish-two { margin-top: 5px; }
  .blessing-card { width: 100%; min-height: 88px; margin-top: 9px; padding: 12px 36px 12px 15px; }
  .blessing-card p { font-size: 13px; line-height: 1.65; }
  .finale { margin-top: 9px; }
  .finale strong { font-size: 20px; letter-spacing: .08em; }
  .finale > span:last-child { font-size: 10px; }
  .spark-button { margin-top: 22px; font-size: 12px; }
  .music-toggle { margin-top: 8px; font-size: 9px; }
  .hint { font-size: 9px; letter-spacing: .04em; }
  .corner-note { bottom: 19px; font-size: 8px; }
  .corner-note-left { left: 18px; }
  .corner-note-right { right: 18px; }
  .letter-gate h2 { font-size: 29px; }
  .gate-copy { font-size: 14px; }
}

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