@font-face {
  font-family: "Playfair Display";
  src: url("./vendor/playfair-italic.woff2") format("woff2");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --ink: #f5eddc;
  --muted: #c2b8a9;
  --gold: #efd095;
  --hairline: rgba(229, 201, 151, .31);
  --panel: #181822;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
*, *::before, *::after {box-sizing: border-box}
html, body {width: 100%; height: 100%; margin: 0}
body {background: #090a16; color: var(--ink); overflow: hidden; -webkit-tap-highlight-color: transparent}
button, input {font: inherit}
button {cursor: pointer; color: inherit; touch-action: manipulation}
button:focus-visible, input:focus-visible, a:focus-visible, .drop-zone:focus-within {outline: 2px solid #ffe2a6; outline-offset: 4px}
[hidden] {display: none !important}
#stage {position: relative; width: 100%; height: 100%; height: 100dvh; overflow: hidden; isolation: isolate; touch-action: none; background: radial-gradient(ellipse at 50% 42%, #272234, #0c0c1b 65%, #090913); user-select: none}
#stage canvas, #ornaments {position: absolute; inset: 0; width: 100%; height: 100%; display: block}
#sky, #tree-canvas, #tree-flat, .opening-effects {pointer-events: none}
.is-opening #tree-canvas, .is-opening #tree-flat {
  opacity: var(--opening-tree,0);
  -webkit-mask-image: linear-gradient(to bottom, transparent calc(var(--opening-cut,100%) - 6%), #000 calc(var(--opening-cut,100%) + 5%));
  mask-image: linear-gradient(to bottom, transparent calc(var(--opening-cut,100%) - 6%), #000 calc(var(--opening-cut,100%) + 5%));
}
#ornaments {pointer-events: none; perspective-origin: center}
.mast {position: absolute; z-index: 3; inset: max(1.6rem, env(safe-area-inset-top)) clamp(1.25rem, 3.8vw, 4.75rem) auto; display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; gap: 1rem}
.signature {filter: drop-shadow(0 2px 11px #070710); pointer-events: none}
.eyebrow {display: flex; align-items: center; gap: .5rem; font: 500 .7rem/1.4 Georgia, serif; letter-spacing: .235em; color: #e5cda4; white-space: nowrap}
.eyebrow span {font-size: 1rem; line-height: 1}
h1 {margin: .2rem 0 .55rem; font: italic 500 clamp(2.15rem, 4.25vw, 4.35rem)/1.05 "Playfair Display", Georgia, serif; letter-spacing: -.063em; color: #ffdfa8; background: linear-gradient(112deg, #fff0c2 4%, #f8dca6 46%, #c68f64 95%); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent}
.countdown {display: flex; align-items: baseline; gap: .3rem; color: #c9bea8; font-size: .78rem; white-space: nowrap}
.countdown em {margin-right: .32rem; font-style: normal}
.countdown b {font: 500 .9rem Georgia, serif; color: #ffedc2; font-variant-numeric: tabular-nums}
.countdown small {font-size: .72rem; margin-right: .15rem}
#album-button {pointer-events: auto; flex-shrink: 0}
.button, .music, .close, .mode-switch button, .paging button {border: 0; transition: background .2s, border-color .2s, color .2s, transform .2s}
.button {min-height: 42px; padding: .52rem 1.04rem; border-radius: 999px; display: inline-flex; gap: .52rem; align-items: center; justify-content: center; font-size: .89rem; font-weight: 540; letter-spacing: .035em}
.glass, .outline {background: rgba(19, 19, 30, .85); border: 1px solid var(--hairline); color: #f0dbb1}
.glass:hover, .outline:hover {background: #35303a; border-color: #c4a66d}
.gold {color: #302518; background: linear-gradient(120deg, #ffe7b5, #dbb77a); border: 1px solid #f1d7a7; box-shadow: 0 3px 22px #251b130d}
.gold:hover {background: #ffe9c4; transform: translateY(-1px)}
.album-icon {width: 17px; height: 14px; border: 1.5px solid currentColor; border-radius: 3px; position: relative}
.album-icon::before {content: ""; position: absolute; left: 2px; top: 2px; width: 3px; height: 3px; border-radius: 50%; background: currentColor}
.album-icon::after {content: ""; position: absolute; left: 4px; bottom: 1px; width: 7px; height: 7px; border-left: 1.3px solid; border-top: 1.3px solid; transform: rotate(45deg)}
.controls {position: absolute; z-index: 2; bottom: max(1.15rem, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: .52rem; white-space: nowrap}
.mode-switch {display: flex; padding: .25rem; border-radius: 999px; border: 1px solid #cbb48854; background: #15141fd9; box-shadow: 0 6px 24px #09091438; backdrop-filter: blur(10px)}
.mode-switch button {display: flex; gap: .36rem; align-items: center; justify-content: center; border-radius: 999px; background: transparent; color: #d9d1c5; min-height: 35px; min-width: 6rem; padding: .3rem .85rem; font-size: .88rem}
.mode-switch button span {font: 1.17rem/1 Georgia, serif}
.tree-icon {width: 14px; height: 16px; background: currentColor; clip-path: polygon(50% 1%,76% 34%,64% 34%,88% 60%,74% 60%,100% 84%,57% 84%,57% 99%,43% 99%,43% 84%,0 84%,26% 60%,12% 60%,36% 34%,24% 34%)}
.mode-switch button[aria-pressed="true"] {color: #332718; background: linear-gradient(120deg,#f7dfb1,#d9bb86)}
.mode-switch button[aria-pressed="false"]:hover {background: #ffffff12}
.hint {margin: 0; font-size: .77rem; letter-spacing: .095em; color: #f1e6d4; text-shadow: 0 1px 4px #080913, 0 1px 10px #080913}
.hint b {margin: 0 .22rem; font-weight: normal; color: #cdb88c}
.is-opening .hint {display: none}
.intro-skip {justify-self:center; min-height:24px; margin:-3px 0; padding:2px .75rem; border:0; color:#eddfc9; background:#171621bd; border-radius:999px; font-size:.77rem; letter-spacing:.08em}
.music {position: absolute; z-index: 2; bottom: max(1.6rem, env(safe-area-inset-bottom)); right: max(clamp(1.25rem, 3.8vw, 4.75rem), env(safe-area-inset-right)); display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%}
.sound-bars {display: flex; align-items: center; height: 16px; gap: 2px; color: #e5ca99}
.sound-bars i {width: 2px; height: 7px; background: currentColor; border-radius: 2px}
.sound-bars i:nth-child(2) {height: 15px; animation-delay: .16s}
.sound-bars i:nth-child(3) {height: 12px; animation-delay: .34s}
.sound-bars i:nth-child(4) {height: 5px; animation-delay: .48s}
.music[aria-pressed="false"] .sound-bars {opacity: .74}
@media (prefers-reduced-motion: no-preference) {
  .music[aria-pressed="true"] i {animation-name: bars; animation-duration: .8s; animation-direction: alternate; animation-iteration-count: infinite}
}
@keyframes bars {to {transform: scaleY(.38)}}
.tree-frame {pointer-events: auto; position: absolute; left: 0; top: 0; display: block; border: 0; padding: 6px; background: transparent; min-width: 44px; min-height: 44px; margin: 0; cursor: zoom-in; will-change: transform; touch-action: none; -webkit-user-drag: none}
.tree-frame .bevel {width: 100%; height: 100%; display: block; position: relative; padding: 3px; background: linear-gradient(135deg,#fff2bc 0%,#a07334 19%,#fddc82 40%,#725127 68%,#eac577 91%,#795331); outline: 1px solid #5d4627; box-shadow: 1px 3px 5px #080710bd, inset 0 0 0 1px #f4dda2; transition: filter .15s, box-shadow .15s}
.tree-frame:hover .bevel, .tree-frame:focus-visible .bevel {filter: brightness(1.2); box-shadow: 0 0 13px 2px #ffd27580}
.tree-frame img {display: block; width: 100%; height: 100%; object-fit: cover; border: 1px solid #5b4229; pointer-events: none}
.sheet {color:var(--ink); width: min(420px, calc(100vw - 2rem)); max-height: min(80vh, 760px); max-height: min(80dvh, 760px); padding: 0; background: linear-gradient(150deg,#24212a,#151620 70%); border: 1px solid #b899625f; border-radius: 18px; margin: auto; box-shadow: 0 25px 90px #04050abd; overflow: auto; overscroll-behavior: contain}
.sheet::backdrop {background: #0809159c; backdrop-filter: blur(4px)}
.sheet-body {padding: 1.4rem}
.sheet-head, .gallery-heading, .viewer-head, .share-actions {display: flex; align-items: center; justify-content: space-between; gap: .65rem}
.album-mute {display: inline-flex; align-items: center; gap: .35rem; margin-left: auto; min-height: 36px; color: var(--muted); font-size: .88rem; cursor: pointer}
.album-mute input {margin: 0; accent-color: var(--gold)}
h2 {margin: 0; font: 500 1.4rem/1.4 "Songti SC", SimSun, Georgia, serif; letter-spacing: .08em; color: #ffe6b8}
.close {width: 36px; height: 36px; border-radius: 50%; display: grid; place-content: center; border: 1px solid var(--hairline); background: #ffffff07; color: #e8d8b8; font: 1.55rem/1 Arial,sans-serif}
.close:hover, .paging button:hover {background: #ffffff1b}
.drop-zone {position: relative; margin-top: 1.15rem; padding: 1.05rem .6rem; display: grid; place-items: center; gap: .3rem; border: 1px dashed #b79b6d96; border-radius: 10px; background: #ebc67a0b; cursor: pointer}
.drop-zone:hover,.drop-zone.dragging {border-color: #f3d391; background: #ebc67a19}
.drop-zone strong {color: #f4d9a6; font-size: 1rem}
.drop-zone span:last-child, .fine, .status, .share-status, .link-label {font-size: .84rem; color: var(--muted); line-height: 1.65}
.upload-symbol {font: 1.65rem/1 Georgia,serif; color: #e6c58a}
.file-input {width: 1px; height: 1px; position: absolute; overflow: hidden; clip-path: inset(50%)}
#editor:has(.file-input:focus-visible) .drop-zone {outline: 2px solid var(--gold); outline-offset: 3px}
.fine {margin: .65rem 0 1.15rem}
#manage-album {display: inline-block; margin: .8rem .4rem; text-underline-offset: .2em}
#owner-login {text-decoration: none}
.gallery-heading {color: #e7d7b9; font-size: .85rem; margin: .95rem 0 .55rem}
#gallery-count {font: .85rem Georgia,serif; color: var(--muted)}
.gallery {display: grid; gap: .6rem; grid-template-columns: repeat(4,1fr)}
.tile {position: relative; aspect-ratio: 1; min-width: 0}
.tile-photo {width: 100%; height: 100%; display: block; padding: 2px; background: #6e5b39; border: 1px solid #ae915e; border-radius: 4px; overflow: hidden}
.tile-photo img {display: block; width: 100%; height: 100%; object-fit: cover}
.remove-photo {position: absolute; right: -3px; top: -4px; width: 24px; height: 24px; padding: 0; border: 1px solid #b79464; border-radius: 50%; background: #27212b; color: #f8e1b9; font: 1rem Arial,sans-serif}
.status {min-height: 0; margin: .7rem 0 0}
.status:empty {display:none}
#new-tree {width: 100%; margin-top: 1rem}
.viewer {--photo-width: min(82vw,900px); --photo-height: 66vh; --bevel: clamp(4px,.7vw,9px); width: 100vw; max-width: 100%; height: 100%; height: 100dvh; max-height: 100%; margin: 0; padding: max(1rem,env(safe-area-inset-top)) 1rem max(1rem,env(safe-area-inset-bottom)); border: 0; color: var(--ink); background: transparent; overflow: hidden}
@supports (height: 1dvh) {.viewer {--photo-height: 66dvh}}
.viewer::backdrop {background: rgba(5,6,15,.69); backdrop-filter: blur(3px)}
#viewer-inner {display: grid; height: 100%; grid-template-rows: minmax(40px,1fr) calc(var(--photo-height) + 2 * var(--bevel)) minmax(48px,1fr); justify-items: center; align-items: center; gap: .65rem; pointer-events: none}
.viewer-head {align-self: end; width: min(82vw,680px); justify-content: flex-end; pointer-events: none}
.viewer-head button, .paging, #focus-frame {pointer-events: auto}
#viewer-status, #viewer-retry {font-size: .85rem; color: #ede0c6}
#viewer-retry {background: transparent; text-decoration: underline; text-underline-offset: .2em}
#photo-count {font: 1rem Georgia,serif; color: #ecd6b2; letter-spacing: .12em; text-shadow: 0 1px 5px #000}
#focus-frame {display: grid; grid-template: minmax(0,1fr) / minmax(0,1fr); box-sizing: content-box; width: min(var(--photo-width),calc(var(--photo-height) * var(--photo-ratio,1))); aspect-ratio: var(--photo-ratio,1); margin: 0; padding: var(--bevel); background: linear-gradient(135deg,#ffe195,#775627 20%,#f5cf7d 42%,#7f522a 69%,#efd49a 89%,#8f6a3c); box-shadow: 0 0 0 1px #6e4f2b,0 0 0 2px #e4cb9480,0 10px 65px #020208b3; transform-origin: center; line-height: 0}
#focus-frame {touch-action: pan-y pinch-zoom}
#focus-photo {display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; background: #211f23; border: 1px solid #7e673d; pointer-events: none}
#focus-frame:empty {visibility: hidden}
.paging {display: flex; gap: .65rem; align-self: start}
.paging button {border: 1px solid var(--hairline); padding: .45rem .9rem; border-radius: 999px; background: #171822a6; font-size: .86rem; color: #f1d9b4}
.share-sheet {width: min(360px,calc(100vw - 2rem))}
.share-status {margin: .7rem 0}
.qr {margin: 1rem auto; width: 156px; height: 156px; background: #fffaf0; padding: 9px; border-radius: 7px; display: grid; place-items:center}
.qr canvas {width: 100%; height:100%; image-rendering:pixelated}
.link-label {display:block; margin-bottom:.25rem}
#share-url {display: block; width:100%; padding: .65rem .7rem; border:1px solid var(--hairline); border-radius: 7px; background:#10121c; color:#eddfc8; font-size:.84rem}
.share-actions {margin-top: .85rem}
.share-actions button {flex:1}
.toast {position:fixed; bottom:max(6.6rem,16%); left:50%; z-index:4; transform:translate(-50%,8px); opacity:0; pointer-events:none; background:#1c1b25ed; color:#ffe4b0; border:1px solid var(--hairline); border-radius:10px; padding:.65rem .95rem; font-size:.88rem; transition:.2s; max-width:90vw; width:max-content}
.toast.show {opacity:1; transform:translate(-50%,0)}
@media(max-width:650px) {
  .mast {inset: max(1rem,env(safe-area-inset-top)) 1rem auto; gap:.5rem}
  .eyebrow {font-size:.57rem; letter-spacing:.18em; gap:.3rem}
  .eyebrow span {font-size:.82rem}
  h1 {font-size:clamp(1.7rem,7.3vw,2.85rem); margin:.24rem 0 .45rem}
  .signature h1 {white-space:nowrap}
  #album-button {min-height:36px; padding:.42rem .78rem; font-size:.8rem; gap:.32rem; white-space:nowrap}
  .album-icon {width:15px; height:12px}
  .countdown {gap:.17rem}
  .countdown em,.countdown small {font-size:.67rem}
  .countdown b {font-size:.8rem}
  .music {bottom:max(1.65rem,env(safe-area-inset-bottom)); right:max(1rem,env(safe-area-inset-right))}
  .controls {bottom:max(1.1rem,env(safe-area-inset-bottom))}
  .viewer-head {width:90vw}
  .viewer {--photo-width: 88vw; --photo-height: 68vh}
  @supports (height: 1dvh) {.viewer {--photo-height: 68dvh}}
  .sheet-body {padding:1.1rem}
}
@media (max-width:355px) {#album-button {padding:.4rem .45rem}#album-button .album-icon {display:none}.countdown em {margin-right:.1rem}.music {right:max(.5rem,env(safe-area-inset-right))}}
@media (max-height:500px) and (min-aspect-ratio: 6/5) {
  .mast {top:.7rem}.eyebrow {display:none}h1 {font-size:2rem}
  .controls {bottom:.55rem; gap:.2rem}.hint {font-size:.67rem}
  .music {bottom:max(.7rem,env(safe-area-inset-bottom))}
  .sheet {max-height:94dvh}
  .viewer {--photo-height: 54vh}
  @supports (height: 1dvh) {.viewer {--photo-height: 54dvh}}
}
@media (prefers-reduced-motion: reduce) {*, *::before, *::after {animation-duration:.01ms !important; transition-duration:.01ms !important}}

