:root {
  color-scheme: dark;
  --sky: #14283f;
  --sky-deep: #101e31;
  --paper: #f6f3f5;
  --ink: #263449;
  --gold: #d6b989;
  --sky-text: #f2f1ed;
  --muted: #b6c1cf;
  --serif: "Songti SC", "STSong", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html { scrollbar-gutter: stable; }
body { margin: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); background: var(--sky-deep); color: var(--sky-text); font-family: var(--sans); }
button { font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 20; padding: 12px 18px; background: var(--paper); color: var(--ink); transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 8px; }
button:disabled { cursor: wait; }
[hidden] { display: none !important; }
p, h1, h2 { margin: 0; }
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: radial-gradient(ellipse at 80% 26%, #27435980, transparent 53%), linear-gradient(165deg, var(--sky), var(--sky-deep) 90%); }
.stars { position: absolute; inset: 0; }
.star { position: absolute; width: var(--size); height: var(--size); border-radius: 50%; background: #e6e3d5; opacity: var(--opacity); }
.moon { position: absolute; right: 12%; top: 13%; width: 48px; height: 48px; border-radius: 50%; box-shadow: inset -7px -3px 0 0 #e6d7b0; transform: rotate(-18deg); opacity: .72; }
.horizon { position: absolute; width: 150%; height: 32%; left: -25%; bottom: -25%; border-radius: 50%; box-shadow: 0 -50px 160px #52728725; }
.arrival { max-width: 1120px; margin: 0 auto; padding: 38px 48px 30px; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.page-top, .arrival-footer, .letter-head { display: flex; align-items: center; justify-content: space-between; }
.date-mark { display: flex; align-items: center; gap: 14px; font-family: var(--serif); font-size: 17px; letter-spacing: .16em; }
.date-line { width: 32px; height: 1px; background: #d6b98980; }
.occasion { color: var(--muted); font-size: 12px; letter-spacing: .12em; }
.arrival-layout { display: grid; grid-template-columns: 1fr 1.2fr; align-items: center; gap: 60px; flex: 1; padding: 80px 0 65px; }
.dedication { color: var(--gold); font-size: 13px; letter-spacing: .15em; margin-bottom: 26px; }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(42px, 4.6vw, 62px); line-height: 1.5; letter-spacing: .05em; }
.introduction-copy { color: var(--muted); font-size: 14px; line-height: 2.1; margin-top: 30px; letter-spacing: .08em; }
.envelope-scene { padding-top: 45px; perspective: 1200px; }
.envelope-button { display: block; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; }
.envelope { display: block; position: relative; width: 100%; aspect-ratio: 1.57; background: #c5c5c4; border-radius: 2px; box-shadow: 0 24px 65px #030b1770; transform: rotate(-5deg); transition: transform 450ms cubic-bezier(.2,.7,.2,1); isolation: isolate; }
.envelope-button:hover .envelope { transform: rotate(-3deg) translateY(-6px); }
.envelope-button:active .envelope { transform: rotate(-3deg) translateY(-2px) scale(.99); }
.envelope-lining { position: absolute; inset: 0; background: #a8acb0; }
.insert { position: absolute; inset: 9% 7% 3%; display: block; background: #faf8f6; padding-top: 13%; transition: transform 500ms cubic-bezier(.2,.7,.2,1); }
.insert > span { font-family: var(--serif); color: #4d5767; font-size: 16px; letter-spacing: .28em; }
.insert i { display: block; width: 48%; height: 1px; margin: 14px auto 0; background: #d4d0ca; }
.insert i:last-child { width: 33%; }
.envelope-folds { position: absolute; inset: 0; z-index: 2; background: #e0ddda; clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%); }
.envelope-folds::after { content: ""; position: absolute; inset: 0; clip-path: polygon(0 100%, 50% 43%, 100% 100%); background: linear-gradient(#e2dfdc, #eeebe6); }
.envelope-flap { position: absolute; inset: 0; z-index: 3; background: linear-gradient(#f0ede7, #dedbd6); clip-path: polygon(0 0, 100% 0, 50% 58%); transform-origin: top center; transition: transform 500ms cubic-bezier(.2,.7,.2,1), z-index 0ms 180ms; backface-visibility: hidden; }
.seal { position: absolute; z-index: 4; width: 46px; height: 46px; left: calc(50% - 23px); top: calc(58% - 23px); display: grid; place-items: center; border-radius: 50%; color: #f5e6c6; background: #756245; border: 2px solid #b09b7080; box-shadow: 0 3px 8px #493c3a30, inset 0 0 0 3px #4d402b30; transition: opacity 180ms ease; }
.seal span { font-family: var(--serif); font-size: 18px; }
.envelope-address { position: absolute; z-index: 3; right: 9%; bottom: 13%; color: #5f5b57; font-family: var(--serif); font-size: 16px; letter-spacing: .12em; }
.open-label { display: inline-flex; gap: 12px; align-items: center; margin-top: 45px; padding: 10px 0; color: var(--sky-text); font-size: 14px; letter-spacing: .14em; border-bottom: 1px solid #d6b98970; }
.open-label::after { content: ""; display: block; width: 6px; height: 6px; border-right: 1px solid var(--gold); border-bottom: 1px solid var(--gold); transform: rotate(45deg) translateY(-2px); }
.envelope-note { text-align: center; margin-top: 12px; color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.is-open .envelope, .is-open .envelope-button:hover .envelope { transform: rotate(0); }
.is-open .envelope-flap { transform: rotateX(180deg); z-index: 0; }
.is-open .seal { opacity: 0; }
.is-open .insert { transform: translateY(-22%); transition-delay: 180ms; }
.arrival-footer { color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.arrival-footer p:first-child { display: flex; align-items: center; gap: 10px; }
.sender-line { width: 22px; height: 1px; background: #d6b98970; }
.tiny-star, .paper-bottom i { width: 9px; height: 9px; background: var(--gold); clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); }
.letter-section { padding: 40px 24px 80px; scroll-margin-top: 20px; text-align: center; }
.letter-paper { color-scheme: light; position: relative; max-width: 700px; margin: 0 auto; padding: 40px 76px 42px; color: var(--ink); background: var(--paper); border: 1px solid #ffffff; box-shadow: 0 20px 70px #030b1740, inset 0 0 0 9px #ebe7e940; opacity: 0; transform: translateY(20px); transition: opacity 450ms ease, transform 450ms cubic-bezier(.2,.7,.2,1); }
.letter-section.is-visible .letter-paper { opacity: 1; transform: translateY(0); }
.letter-head { color: #65626b; font-family: var(--serif); font-size: 13px; letter-spacing: .1em; margin-bottom: 28px; }
.paper-star { width: 13px; height: 13px; background: #8a704a; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); }
.letter-title { text-align: left; font-family: var(--serif); font-size: 21px; font-weight: 400; line-height: 1.7; }
.letter-title:focus-visible { outline: 2px solid #3b5e7e; outline-offset: 5px; }
.poem { margin: 28px 0 32px; font-family: var(--serif); font-size: 21px; letter-spacing: .12em; line-height: 1.85; }
.couplet + .couplet { margin-top: 16px; }
.verse { display: block; }
.signature { text-align: right; font-family: var(--serif); font-size: 16px; line-height: 1.9; letter-spacing: .08em; }
.signature p + p { margin-top: 9px; }
.paper-bottom { display: flex; align-items: center; justify-content: center; gap: 13px; margin-top: 32px; }
.paper-bottom span { width: 40px; height: 1px; background: #b8a88b60; }
.paper-bottom i { width: 7px; height: 7px; background: #9d825a; }
.keep-letter { margin-top: 24px; padding: 12px 18px; min-height: 44px; border: 0; border-bottom: 1px solid #b6c1cf50; background: transparent; color: var(--muted); font-size: 13px; letter-spacing: .1em; cursor: pointer; transition: color 160ms ease; }
.keep-letter:hover { color: var(--sky-text); }
.letter-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 26px; }
.letter-actions .keep-letter { margin-top: 0; }
.memories-link { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 6px; color: var(--sky-text); text-decoration: none; font-size: 14px; letter-spacing: .08em; border-bottom: 1px solid #d6b98970; }
.memories-link img { filter: invert(1); }
a:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; }
.memories { color-scheme: light; color: var(--ink); background: #edf0f2; padding: 80px 48px 54px; scroll-margin-top: 0; }
.memories-inner { max-width: 1024px; margin: 0 auto; }
.memories-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 40px; }
.memories-intro { color: #5a6878; font-size: 13px; letter-spacing: .12em; margin-bottom: 15px; }
.memories h2 { font-family: var(--serif); font-size: clamp(30px, 4vw, 42px); font-weight: 400; letter-spacing: .08em; }
.memories h2:focus-visible { outline: 2px solid #3b5e7e; outline-offset: 6px; }
.memories-count { color: #586677; font-size: 13px; line-height: 1.8; padding-bottom: 5px; white-space: nowrap; }
.timeline { list-style: none; padding: 0 0 0 30px; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; top: 0; bottom: 0; left: 5px; width: 1px; background: #c4cdd3; }
.timeline-node { position: relative; border-top: 1px solid #c9d0d6; }
.timeline-node::before { content: ""; position: absolute; left: -30px; top: 48px; width: 11px; height: 11px; background: #edf0f2; border: 1px solid #7d8a97; border-radius: 50%; transition: background-color 180ms ease; }
.timeline-node.is-expanded::before { background: #3b5e7e; border-color: #3b5e7e; }
.node-heading { margin: 0; }
.node-toggle { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 220px 22px; align-items: center; gap: 28px; text-align: left; padding: 30px 4px; color: var(--ink); background: transparent; border: 0; cursor: pointer; }
.node-toggle:focus-visible, .photo-button:focus-visible { outline-color: #3b5e7e; outline-offset: 4px; }
.node-info, .node-title, .node-date, .node-action { display: block; }
.node-info { min-width: 0; }
.node-date { color: #53677d; font: 400 13px/1.5 var(--sans); letter-spacing: .08em; margin-bottom: 12px; }
.node-title { font-family: var(--serif); font-size: clamp(22px, 2.5vw, 29px); font-weight: 400; line-height: 1.65; text-wrap: balance; }
.node-action { color: #586677; font: 400 12px/1.7 var(--sans); margin-top: 13px; text-underline-offset: 5px; }
.node-toggle:hover .node-action { color: #263449; text-decoration: underline; }
.node-cover { display: block; width: 220px; aspect-ratio: 1.6; overflow: hidden; background: #dce1e5; }
.node-cover img, .photo-button img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.node-chevron { opacity: .65; transition: transform 220ms ease; }
.is-expanded .node-chevron { transform: rotate(180deg); }
.node-panel { padding: 0 4px 32px; }
.node-summary, .node-story { max-width: 650px; line-height: 1.9; font-size: 15px; white-space: pre-line; margin-bottom: 22px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; list-style: none; padding: 0; margin: 0; }
.photo-grid li { min-width: 0; }
.photo-button { display: block; position: relative; width: 100%; aspect-ratio: 4/3; padding: 0; border: 0; background: #dce1e5; cursor: zoom-in; }
.photo-index { position: absolute; bottom: 8px; left: 8px; padding: 4px 7px; color: #fff; background: #14283fd9; font: 11px/1.4 var(--sans); font-variant-numeric: tabular-nums; }
.memories-footer { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: 65px; color: #53677d; font-size: 13px; letter-spacing: .08em; }
.memories-footer .tiny-star { background: #8f7959; }
.memories-footer a { color: #3b5e7e; text-underline-offset: 5px; min-height: 44px; display: inline-flex; align-items: center; }
body.gallery-open { overflow: hidden; }
.photo-dialog { color-scheme: dark; padding: 0; border: 1px solid #8293a44d; background: #111e2e; color: var(--sky-text); width: min(1100px, calc(100% - 32px)); max-width: calc(100% - 32px); height: min(900px, calc(100vh - 32px)); height: min(900px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); overflow: hidden; }
.photo-dialog::backdrop { background: #07111de6; }
.gallery-shell { height: 100%; display: flex; flex-direction: column; padding: 20px 24px 18px; overscroll-behavior: contain; }
.gallery-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding-bottom: 16px; }
.gallery-date { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.gallery-date:empty { display: none; }
.gallery-header h2 { font-family: var(--serif); font-size: 22px; font-weight: 400; line-height: 1.6; }
.gallery-close, .gallery-control { flex-shrink: 0; display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-width: 44px; min-height: 44px; color: var(--sky-text); border: 1px solid #9caaba70; background: transparent; cursor: pointer; }
.gallery-close { padding: 0 11px; font-size: 12px; }
.gallery-close img, .gallery-control img { filter: invert(1); }
.gallery-close:hover, .gallery-control:hover:not(:disabled) { background: #3b5e7e55; }
.gallery-control:disabled { opacity: .3; cursor: default; }
.gallery-stage { display: grid; place-items: center; flex: 1; min-height: 0; position: relative; background: #0c1623; }
.gallery-image { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.image-error { position: absolute; inset: 0; display: grid; place-items: center; padding: 28px; background: #0c1623; font-size: 14px; line-height: 1.8; text-align: center; }
.gallery-toolbar { display: flex; align-items: center; justify-content: center; gap: 25px; padding: 12px 0 10px; }
.gallery-count { min-width: 65px; text-align: center; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.gallery-caption { text-align: center; font-size: 13px; line-height: 1.8; padding-bottom: 12px; }
.gallery-thumbnails { display: flex; flex-shrink: 0; gap: 9px; max-width: 100%; overflow-x: auto; padding: 5px 2px; overscroll-behavior: contain; }
.gallery-thumbnail { flex: 0 0 62px; height: 48px; padding: 0; border: 2px solid transparent; background: #263449; cursor: pointer; opacity: .6; }
.gallery-thumbnail[aria-current] { border-color: var(--gold); opacity: 1; }
.gallery-thumbnail img { display: block; width: 100%; height: 100%; object-fit: cover; }
.load-message { max-width: 500px; margin: 0 auto 40px; padding: 20px; text-align: center; line-height: 1.8; }
@media (min-width: 1600px) { .arrival { max-width: 1240px; } .arrival-layout { gap: 110px; } }
@media (max-width: 760px) {
  .arrival { padding: 26px 26px 25px; }
  .occasion { font-size: 11px; letter-spacing: .03em; }
  .date-mark { font-size: 15px; gap: 9px; }
  .date-line { width: 22px; }
  .arrival-layout { grid-template-columns: 1fr; gap: 48px; padding: 55px 0 40px; }
  .introduction { padding-left: 8px; }
  .dedication { font-size: 12px; margin-bottom: 14px; }
  h1 { font-size: clamp(36px, 9vw, 48px); line-height: 1.45; }
  .introduction-copy { margin-top: 17px; font-size: 13px; }
  .envelope-scene { width: min(100% - 14px, 390px); margin: 0 auto; padding-top: 10px; }
  .open-label { margin-top: 28px; font-size: 13px; }
  .envelope-note { font-size: 11px; }
  .moon { top: 19%; right: 13%; width: 32px; height: 32px; box-shadow: inset -5px -2px 0 0 #e6d7b0; }
  .arrival-footer { font-size: 11px; }
  .letter-section { padding: 20px 16px 55px; }
  .letter-paper { padding: 30px 27px 32px; }
  .letter-head { margin-bottom: 22px; }
  .letter-title { font-size: 19px; }
  .poem { font-size: clamp(16px, 4.6vw, 19px); letter-spacing: .075em; line-height: 1.9; margin: 26px 0 30px; }
  .couplet + .couplet { margin-top: 15px; }
  .signature { font-size: 15px; }
  .memories { padding: 50px 22px 38px; }
  .memories-heading { align-items: flex-start; flex-direction: column; gap: 16px; margin-bottom: 26px; }
  .memories-intro { font-size: 12px; margin-bottom: 12px; }
  .memories-count { font-size: 12px; }
  .timeline { padding-left: 22px; }
  .timeline::before { left: 3px; }
  .timeline-node::before { left: -23px; top: 31px; }
  .node-toggle { grid-template-columns: minmax(0, 1fr) 90px 16px; gap: 12px; padding: 22px 0; }
  .node-title { font-size: 19px; line-height: 1.65; }
  .node-date { font-size: 12px; margin-bottom: 7px; }
  .node-action { font-size: 11px; margin-top: 9px; }
  .node-cover { width: 90px; aspect-ratio: 1; }
  .node-chevron { width: 16px; height: 16px; }
  .node-panel { padding: 0 0 24px; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .photo-index { bottom: 5px; left: 5px; font-size: 10px; }
  .memories-footer { padding-top: 43px; }
  .photo-dialog { width: calc(100% - 16px); max-width: calc(100% - 16px); height: calc(100vh - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
  .gallery-shell { padding: 14px 12px 12px; }
  .gallery-header { gap: 12px; padding-bottom: 12px; }
  .gallery-header h2 { font-size: 18px; }
  .gallery-close { padding: 0 8px; }
  .gallery-close span { display: none; }
  .gallery-toolbar { padding-top: 10px; gap: 25px; }
  .gallery-thumbnail { flex-basis: 54px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; transition-delay: 0ms !important; }
  .letter-paper { transform: none; }
  .envelope-button:hover .envelope, .envelope-button:active .envelope { transform: rotate(-5deg); }
}
