:root {
  color-scheme: dark;
  --night: #030408;
  --silver: #e7e7e0;
  --flower-size: min(43vw, 60vh, 610px);
  font-family: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'STSong', 'SimSun', serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--night); -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--night); color: var(--silver); overflow: hidden; }
button { font: inherit; color: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 1px solid rgba(229, 233, 245, .65); outline-offset: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
#starlight, .moon-haze, .organza { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#starlight { z-index: 0; }
.moon-haze { z-index: 1; background: radial-gradient(ellipse 30vw 28vh at 50% 44%, rgba(146, 155, 157, .045), transparent 80%); }
.organza { z-index: 1; opacity: .85; }
.night-garden { position: relative; height: 100vh; min-height: 400px; overflow: hidden; isolation: isolate; }
.flower-position { position: absolute; left: 50%; top: 47%; width: var(--flower-size); height: var(--flower-size); transform: translate(-50%, -50%); z-index: 3; animation: flower-sway 8.4s ease-in-out infinite; }
.flower { width: 100%; height: 100%; position: relative; opacity: 1; transform: rotate(-4deg) scale(1); transition: transform 1.7s cubic-bezier(.4,0,.2,1); touch-action:none; -webkit-user-select:none; user-select:none; }
.petal-ring { position: absolute; inset: 0; pointer-events: none; }
.outer-ring { z-index: 1; perspective: 950px; perspective-origin: 50% 50%; }
.petal {
  position: absolute;
  width: 64%;
  height: 64%;
  top: calc(var(--attach-y) - 58.24%);
  left: calc(var(--attach-x) - 32%);
  padding: 0;
  border: 0;
  background: transparent;
  transform-origin: 50% 91%;
  transform: rotate(var(--angle)) scale(var(--scale, 1));
  transition: transform 1.7s cubic-bezier(.4,0,.2,1), filter 1.2s ease;
  pointer-events: none;
  filter: brightness(.96) saturate(.88) drop-shadow(0 2px 5px rgba(0,0,0,.15));
}
.petal img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; }
.petal-bend-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.petal.is-bending > img { opacity: 0; }
.petal-hit { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; border: 0; background: transparent; padding: 0; pointer-events: auto; cursor: pointer; clip-path: polygon(46% 94%,22% 76%,7% 51%,9% 27%,30% 6%,66% 7%,91% 29%,91% 61%,69% 82%); }
.petal.is-selected { transform: rotate(var(--angle)) translateY(calc(clamp(-34px,-7vw,-25px) + var(--wind-lift,0px))) rotate(var(--wind-turn,0deg)) rotateX(calc(10deg + var(--wind-lean,0deg))) rotateY(calc(var(--curl-side) * 6deg)) scale(calc(var(--scale, 1) * 1.025)); filter: brightness(1) saturate(.9) drop-shadow(0 6px 10px rgba(0,0,0,.2)); }
.has-breeze .petal:not(.is-selected):not(.is-bending) { transform: rotate(var(--angle)) translateY(var(--wind-lift,0px)) rotate(var(--wind-turn,0deg)) rotateX(var(--wind-lean,0deg)) scale(var(--scale,1)); transition:filter 1s ease; }
.petal-hit:focus-visible { outline: none; }
.petal:has(.petal-hit:focus-visible) { filter: brightness(1.06) drop-shadow(0 0 3px rgba(235,239,230,.32)); }
.natural-core { position: absolute; z-index: 3; width: 75%; height: 75%; left: 16%; top: -1%; pointer-events: none; transform: rotate(4deg); transform-origin: 42% 65%; filter: brightness(.96) saturate(.88) drop-shadow(0 3px 6px rgba(0,0,0,.18)); transition: transform 1.6s cubic-bezier(.4,0,.2,1); }
.natural-core img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; }
.natural-core.is-selected { transform: perspective(900px) translateY(-11px) rotate(8deg) rotateX(-8deg) rotateY(6deg) scale(1.025); }
.core-hit { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; background: transparent; border: 0; padding: 0; pointer-events: auto; cursor: pointer; clip-path: polygon(29% 3%,79% 2%,96% 27%,97% 67%,83% 96%,42% 94%,10% 71%,9% 32%); }
.core-hit:focus-visible { outline: none; background: radial-gradient(ellipse, rgba(241,245,237,.08), transparent 70%); }
.pearl-coat {
  position:absolute;inset:0;z-index:2;pointer-events:none;opacity:.26;
  overflow:hidden;
  -webkit-mask-image:var(--pearl-mask);mask-image:var(--pearl-mask);
  -webkit-mask-size:contain;mask-size:contain;
  -webkit-mask-position:center;mask-position:center;
  -webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;
  transition:opacity .55s ease;
}
.pearl-coat::before,.pearl-coat::after {
  content:'';position:absolute;inset:-35%;pointer-events:none;
  animation:pearl-flow var(--pearl-period,12s) ease-in-out infinite alternate;
  animation-delay:var(--pearl-phase,0s);
  transform:translate(-3%,-2%);
}
.pearl-coat::before { background:linear-gradient(var(--pearl-angle,125deg),transparent 28%,rgba(155,195,246,.7) 41%,rgba(255,255,246,.98) 48%,rgba(247,215,232,.65) 55%,rgba(255,238,215,.32) 60%,transparent 71%); }
.pearl-coat::after { background:linear-gradient(var(--pearl-angle,125deg),transparent 45%,rgba(255,255,255,.95) 49%,rgba(255,248,231,.75) 51%,transparent 56%);opacity:.42;animation-direction:alternate-reverse; }
.is-flexing .pearl-coat { opacity:0;transition-duration:.16s; }
.petal-sparkles { position: absolute; z-index: 5; inset: 0; pointer-events: none; }
.petal-sparkles i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fafbff; box-shadow: 0 0 4px 1px rgba(225,234,255,.55); opacity: .05; animation: petal-glimmer 8s ease-in-out infinite; }
.petal-sparkles i:before, .petal-sparkles i:after { content: ''; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); background: linear-gradient(transparent,rgba(255,255,255,.9),transparent); width: 1px; height: 9px; }
.petal-sparkles i:after { transform: translate(-50%,-50%) rotate(90deg); height: 7px; }
.petal-sparkles i:nth-child(1) { left: 51%; top: 4%; animation-delay: -3s; }
.petal-sparkles i:nth-child(2) { left: 82%; top: 37%; animation-delay: -6.1s; animation-duration: 10s; }
.petal-sparkles i:nth-child(3) { left: 30%; top: 65%; animation-delay: -4.6s; animation-duration: 11s; }
.petal-sparkles i:nth-child(4) { left: 65%; top: 77%; animation-delay: -1.3s; animation-duration: 9s; }
.petal-sparkles i:nth-child(5) { left: 15%; top: 31%; animation-delay: -8s; animation-duration: 12s; }
.petal-sparkles i:nth-child(6) { left: 59%; top: 36%; animation-delay: -5s; animation-duration: 13s; }
.invitation { position: absolute; top: 80%; left: 0; right: 0; margin: 0; text-align: center; font-size: 11px; letter-spacing: .25em; color: rgba(228,231,239,.4); opacity: 0; transition: opacity 1.2s ease; pointer-events: none; }
.is-ready .invitation { opacity: 1; }
.has-touched .invitation { opacity: 0; }
.birthday-glint { position:absolute;z-index:4;top:14%;left:52%;width:3px;height:3px;pointer-events:none;border-radius:50%;background:#fff2cf;box-shadow:0 0 7px 2px rgba(246,223,189,.35);animation:birthday-glint 5.5s ease-in-out infinite; }
.birthday-glint::after { content:'';position:absolute;left:1px;top:-3px;width:1px;height:9px;background:linear-gradient(transparent,#fff4db,transparent); }
.whisper { position: absolute; top: 74%; left: 50%; transform: translateX(-50%); translate:0 5px; opacity:0; pointer-events:none; width: min(360px, calc(100% - 64px)); z-index: 6; padding: 18px 20px; text-align: center; transition:opacity .38s ease,translate .45s ease; }
.whisper.is-visible { opacity:1;translate:0 0;pointer-events:auto;transition:opacity 1.05s cubic-bezier(.4,0,.2,1) .28s,translate 1.25s cubic-bezier(.4,0,.2,1) .28s; }
.whisper p { margin: 0; font-size: 20px; font-weight: 400; line-height: 2; letter-spacing: .12em; white-space: pre-line; text-wrap: balance; text-shadow: 0 1px 16px rgba(0,0,0,.6); }
.whisper .whisper-caption { margin-bottom:12px;color:rgba(225,228,239,.48);font-size:10px;line-height:1.5;letter-spacing:.23em; }
.is-birthday-message .whisper { top:70%;padding-top:10px;padding-bottom:10px; }
.is-birthday-message #whisper-text { font-size:18px;line-height:1.85;letter-spacing:.07em; }
.is-birthday .whisper { opacity:0;visibility:hidden;pointer-events:none; }
#breeze { position:fixed;inset:0;width:100%;height:100%;z-index:2;pointer-events:none; }
.birthday-sky { position:absolute;top:59%;left:50%;width:min(76vw,340px);max-height:34svh;z-index:2;pointer-events:none;opacity:0;transform:translate(-50%,14px) scale(.96);transition:opacity .8s ease,transform 1.2s ease; }
.birthday-sky svg { display:block;width:100%;max-height:34svh;overflow:visible;filter:drop-shadow(0 0 6px rgba(232,224,255,.14)); }
.cake-outline { stroke-opacity:.4; }
.cake-candles { stroke-opacity:.8; }
.candle-flame { transform-box:fill-box;transform-origin:50% 85%;animation:candle-breathe 2.4s ease-in-out infinite alternate;animation-play-state:paused; }
.is-birthday .birthday-sky { opacity:1;transform:translate(-50%,0) scale(1); }
.is-birthday .candle-flame { animation-play-state:running; }
.is-birthday .flower { transform:translateY(-34px) rotate(-3deg) scale(.9); }
.close-whisper { position: absolute; left: calc(50% - 22px); top: 100%; width: 44px; height: 44px; display: grid; place-items: center; border: 0; padding: 0; border-radius: 50%; background: transparent; color: rgba(220,226,240,.3); cursor: pointer; }
.close-whisper:hover { color: rgba(240,244,255,.8); }
.is-open .flower { transform: translateY(-27px) rotate(-3deg) scale(.965); }
.pause-starlight { position: fixed; right: max(18px,env(safe-area-inset-right)); bottom: max(18px,env(safe-area-inset-bottom)); width: 34px; height: 34px; z-index: 9; padding: 0; border: 0; border-radius: 50%; background: none; display: grid; place-items: center; color: rgba(222,229,244,.2); cursor: pointer; }
.pause-starlight:hover, .pause-starlight:focus-visible { color: rgba(222,229,244,.6); }
.play-glyph { display: none; }
.is-paused .pause-glyph { display: none; }
.is-paused .play-glyph { display: block; }
.is-paused .petal-sparkles i { animation-play-state: paused; }
.is-paused .flower-position { animation-play-state: paused; }
.is-paused .pearl-coat::before,.is-paused .pearl-coat::after { animation-play-state:paused; }
.is-paused .birthday-glint,.is-paused .candle-flame { animation-play-state:paused; }
.noscript { position: absolute; top: 45%; width: 100%; text-align: center; font-size: 12px; color: #a7aabb; }
@keyframes petal-glimmer { 0%,35%,65%,100% { opacity: .015; transform: scale(.5); } 49% { opacity: .65; transform: scale(.9); } 52% { opacity: .95; transform: scale(1.05); } }
@keyframes flower-sway { 0%,100% { transform: translate(-50%,-50%) rotate(-.5deg); } 50% { transform: translate(-50%,calc(-50% - 7px)) rotate(.5deg); } }
@keyframes pearl-flow { from { transform:translate(-32%,-18%); } to { transform:translate(32%,18%); } }
@keyframes birthday-glint { 0%,100% { opacity:.15;transform:scale(.7); } 50% { opacity:.85;transform:scale(1.1); } }
@keyframes candle-breathe { from { opacity:.8;transform:scaleX(.95); } to { opacity:1;transform:scaleX(1.03); } }
@media (hover:hover) and (pointer:fine) { .petal:has(.petal-hit:hover):not(.is-selected) { transform: rotate(var(--angle)) translateY(calc(-3px + var(--wind-lift,0px))) rotate(var(--wind-turn,0deg)) rotateX(var(--wind-lean,0deg)) scale(var(--scale,1)); } }
@media (max-width:600px) {
  :root { --flower-size: min(82vw, 45vh); }
  .flower-position { top: 46%; }
  .moon-haze { background: radial-gradient(ellipse 65vw 24vh at 50% 44%, rgba(145,155,157,.045), transparent 80%); }
  .organza { width: 150%; left: -25%; opacity: .7; }
  .whisper { top: 73%; width: calc(100% - 50px); }
  .whisper p { font-size: 18px; line-height: 2; letter-spacing: .14em; }
  .invitation { top: 78%; font-size: 10px; color: rgba(225,228,238,.34); }
  .is-open .flower { transform: translateY(-27px) rotate(-3deg) scale(.965); }
  .is-birthday .flower { transform:translateY(-34px) rotate(-3deg) scale(.9); }
  .is-birthday-message .whisper { top:70%; }
}
@media (max-width:350px) { .is-birthday-message #whisper-text { font-size:16px; } }
@supports (height:100svh) {
  :root { --flower-size:min(43vw,60svh,610px); }
  .night-garden { height:100svh; }
  @media (max-width:600px) { :root { --flower-size:min(82vw,45svh); } }
}
@media (max-height:650px) { .whisper { top: 71%; padding-top: 10px; padding-bottom: 10px; } .whisper p { font-size: 16px; } .invitation { top: 83%; } .is-open .flower { transform: translateY(-16px) rotate(-4deg) scale(.93); } }
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .petal-sparkles i { opacity: .2; }
  .pause-starlight { display: none; }
  .pearl-coat { opacity:.16; }
}
