:root {
  --paper: #f7f1ea;
  --paper-deep: #ece0d5;
  --white: #fffdfa;
  --ink: #382f2c;
  --muted: #7e716c;
  --rose: #9a6c70;
  --rose-dark: #724b50;
  --gold: #a88961;
  --line: rgba(130, 102, 92, .24);
  --serif: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.8 var(--sans); overflow-x: hidden; }
button, input, select, textarea { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.eyebrow { color: var(--gold); font-size: 10px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; }
.muted { color: var(--muted); }

.loading-view, .error-view { min-height: 100vh; display: grid; place-content: center; justify-items: center; padding: 32px; text-align: center; }
.loading-view .seal { animation: breathe 1.8s infinite; }
.error-view h1 { margin: 7px 0; font: 400 35px var(--serif); }
.error-view p { max-width: 420px; }
.seal { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 50%; background: var(--rose-dark); color: #fff4ec; border: 3px double rgba(255,255,255,.55); font: 26px var(--serif); box-shadow: 0 8px 25px rgba(78,50,49,.18); }

.opening { position: fixed; inset: 0; z-index: 20; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(30px + env(safe-area-inset-top)) 26px calc(30px + env(safe-area-inset-bottom)); text-align: center; background: radial-gradient(circle at 20% 0, #fffaf5, transparent 40%), linear-gradient(150deg, #f8f1e9, #eadcd1); transition: opacity .8s, transform .8s; }
.opening.opened { opacity: 0; transform: translateY(-3%); pointer-events: none; }
.paper-grain { position: absolute; inset: 0; opacity: .12; pointer-events: none; background-image: repeating-linear-gradient(97deg, transparent 0, transparent 3px, rgba(86,60,49,.08) 4px); }
.envelope { position: relative; width: 126px; height: 86px; margin-bottom: 35px; background: #e7d4c5; border: 1px solid #d0b9aa; box-shadow: 0 18px 40px rgba(66,45,39,.12); }
.envelope::before { content: ""; position: absolute; inset: 0; clip-path: polygon(0 0, 50% 61%, 100% 0); background: #f2e4d8; }
.envelope .seal { position: absolute; left: 50%; top: 50%; width: 47px; height: 47px; transform: translate(-50%,-30%); font-size: 20px; }
.couple-small { margin: 0; color: var(--rose-dark); font: 17px var(--serif); letter-spacing: .16em; }
.opening h1 { margin: 13px 0 10px; font: 400 clamp(32px, 9vw, 45px)/1.4 var(--serif); letter-spacing: .05em; }
.opening-copy { max-width: 420px; margin: 0 0 28px; color: var(--muted); white-space: pre-line; }
.opening-hint { margin-top: 14px; color: #91857e; font-size: 11px; }

.button { display: inline-flex; justify-content: center; align-items: center; min-height: 46px; padding: 10px 24px; border: 1px solid transparent; border-radius: 99px; font-weight: 700; cursor: pointer; text-decoration: none; }
.button.primary { color: #fff; background: var(--rose-dark); box-shadow: 0 8px 20px rgba(114,75,80,.18); }
.button.quiet { border-color: var(--line); background: rgba(255,255,255,.42); }
.button.text-link { background: transparent; text-decoration: underline; }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .music-toggle:focus-visible { outline: 3px solid rgba(154,108,112,.4); outline-offset: 3px; }

.letter { min-height: 100vh; }
.section { position: relative; width: min(100%, 720px); margin: auto; padding: 90px clamp(24px, 7vw, 62px); text-align: center; }
.section + .section::before { content: ""; position: absolute; top: 0; left: 50%; width: 44px; border-top: 1px solid var(--gold); transform: translateX(-50%); }
.section h2 { margin: 10px 0 28px; font: 400 clamp(28px, 7vw, 39px)/1.4 var(--serif); letter-spacing: .08em; }
.section-lead { color: var(--muted); }

.hero { width: 100%; min-height: 100svh; display: grid; grid-template-rows: minmax(55vh, 1fr) auto; padding: 0; background: #eadfd7; }
.hero-image { min-height: 55vh; border: 0 !important; }
/* 竖构图婚纱照的人物几乎都在画面上半部；这里的容器比图片更扁，
   默认居中裁剪会把头切掉，所以把裁剪锚点上移。小程序端容器是整屏
   竖向的，垂直方向本就完整，不受影响。 */
.hero-image img { object-position: center 25%; }
.hero-copy { padding: 42px 24px 56px; background: var(--paper); text-align: center; }
.hero-copy h1 { margin: 8px 0 3px; font: 400 clamp(37px, 10vw, 60px)/1.3 var(--serif); letter-spacing: .07em; }
.hero-date { margin: 14px 0 0; color: var(--rose-dark); font: 17px var(--serif); letter-spacing: .15em; }

.media-placeholder { position: relative; display: grid; place-items: center; width: 100%; overflow: hidden; background: linear-gradient(145deg, #eee3d8, #dfd0c5); border: 1px dashed #bba99e; color: #796c65; text-align: center; }
.media-placeholder::after { content: "待替换为真实婚纱照"; display: block; position: absolute; bottom: 13px; font-size: 10px; letter-spacing: .1em; }
.media-placeholder span { padding: 20px; font: 12px/1.7 monospace; overflow-wrap: anywhere; }
.media-placeholder img, .media-placeholder video { width: 100%; height: 100%; object-fit: cover; }
.media-placeholder.has-media { border: 0; }
.media-placeholder.has-media::after { display: none; }
.letter-copy { text-align: left; font: 17px/2.1 var(--serif); white-space: pre-line; }
.letter-copy::first-letter { font-size: 31px; color: var(--rose-dark); }

.story-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 35px; }
.story-grid .media-placeholder { aspect-ratio: 4/5; }
.story-grid .media-placeholder:nth-child(3n) { grid-column: 1 / -1; aspect-ratio: 16/10; }
.video-shell { position: relative; aspect-ratio: 16/10; }
.video-shell video { width: 100%; height: 100%; object-fit: cover; background: #201d1c; }
.video-play { position: absolute; inset: 50% auto auto 50%; width: 66px; height: 66px; transform: translate(-50%,-50%); border: 1px solid rgba(255,255,255,.7); border-radius: 50%; color: #fff; background: rgba(55,40,38,.65); cursor: pointer; }
.media-note { color: var(--muted); font-size: 12px; }

.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 30px 0; }
.countdown span { padding: 15px 4px; background: rgba(255,255,255,.52); border: 1px solid var(--line); }
.countdown b { display: block; font: 27px var(--serif); }
.countdown small { color: var(--muted); }
.detail-list { padding: 0; margin: 30px 0 0; list-style: none; text-align: left; }
.detail-list li { display: grid; grid-template-columns: 94px 1fr; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.detail-list small { color: var(--muted); }
.location-card { padding: 30px 22px; background: rgba(255,255,255,.45); border: 1px solid var(--line); }
.location-card h3 { margin: 0 0 8px; font: 400 25px var(--serif); }
.location-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; margin-top: 22px; }

.rsvp-form { display: grid; gap: 20px; text-align: left; }
.rsvp-form label, .field-label { display: grid; gap: 8px; font-weight: 650; }
.rsvp-form input, .rsvp-form select, .rsvp-form textarea { width: 100%; min-height: 46px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.7); }
.rsvp-form textarea { min-height: 90px; resize: vertical; }
.choice-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choice { position: relative; display: block; }
.choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice span { display: grid; min-height: 56px; place-items: center; padding: 7px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.5); text-align: center; font-size: 13px; cursor: pointer; }
.choice input:checked + span { color: #fff; border-color: var(--rose-dark); background: var(--rose-dark); }
.choice input:focus-visible + span { outline: 3px solid rgba(154,108,112,.4); outline-offset: 3px; }
.conditional { display: grid; gap: 18px; padding: 20px; background: rgba(255,255,255,.34); border-left: 2px solid var(--rose); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
.privacy-note { margin: 0; color: var(--muted); font-size: 11px; }
.rsvp-success { padding: 40px 18px; text-align: center; }
.rsvp-success h3 { font: 400 28px var(--serif); }

.fortune-entry { padding: 45px 28px; background: #413331; color: #f8efe8; }
.fortune-entry .eyebrow { color: #d8b98e; }
.fortune-entry .button { color: #3f302e; background: #f9f0e8; }
.fortune-result-card { position: relative; padding: 34px 25px; background: #f5eadf; border: 1px solid var(--gold); text-align: center; color: var(--ink); }
.fortune-result-card h3 { margin: 8px 0; font: 400 29px var(--serif); color: var(--rose-dark); }

.music-toggle { position: fixed; z-index: 12; top: calc(16px + env(safe-area-inset-top)); right: 16px; width: 51px; height: 51px; display: grid; place-content: center; border: 1px solid rgba(255,255,255,.7); border-radius: 50%; color: #fff; background: rgba(58,45,43,.67); backdrop-filter: blur(8px); cursor: pointer; }
/* 选定赴约状态后的即时回应：缺席给安慰，未定给台阶 */
.status-reply { margin: 16px 0 4px; padding: 16px 18px; border-radius: 8px; background: #f3e9e2; text-align: left; }
.status-reply b { display: block; margin-bottom: 5px; font: 400 16px/1.7 var(--serif); color: #5a4842; }
.status-reply span { display: block; font-size: 13px; line-height: 1.8; color: #8d7d78; }
/* 说明为什么要收集来程信息，降低填写顾虑 */
.purpose-note { margin: 4px 0 18px; padding: 14px 16px; border-left: 2px solid #b98d84; background: #f8f2ec; text-align: left; }
.purpose-note b { display: block; margin-bottom: 4px; font: 400 15px/1.6 var(--serif); color: #5a4842; }
.purpose-note span { display: block; font-size: 13px; line-height: 1.8; color: #7d6c66; }
.rsvp-jump {
  position: fixed; z-index: 12; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px); padding: 13px 30px;
  border: 0; border-radius: 999px; cursor: pointer;
  font: 15px/1 var(--serif); letter-spacing: .12em; color: #fff;
  background: var(--rose-dark); box-shadow: 0 10px 28px rgba(80, 56, 48, .3);
  opacity: 0; transition: opacity .35s ease, transform .35s ease;
}
.rsvp-jump.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.music-toggle span { font-size: 18px; line-height: 1; }
.music-toggle small { font-size: 9px; }
.music-toggle.playing span { animation: spin 3s linear infinite; }
.page-footer { padding: 85px 24px calc(38px + env(safe-area-inset-bottom)); text-align: center; background: #3d302e; color: #f3e8df; }
.page-footer > p { max-width: 530px; margin: 0 auto 16px; }
.signature { font: 23px var(--serif); letter-spacing: .1em; }
.footer-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 28px 0 12px; }
.page-footer .button { color: #f3e8df; border-color: rgba(255,255,255,.3); }
.page-footer small { color: #bfb0a9; }
.icp-link { display: block; width: fit-content; margin: 18px auto 0; color: #a99a94; font-size: 12px; text-decoration: none; }
.icp-link:hover { color: #ded1cb; text-decoration: underline; }
.icp-link:focus-visible { outline: 2px solid rgba(255,255,255,.55); outline-offset: 4px; }

.memory-page { min-height: 100vh; background: #ece1d7; }
.memory-hero { min-height: 75vh; display: grid; align-content: end; padding: 60px 27px; background: linear-gradient(transparent, rgba(47,34,32,.78)), #dfd0c5; color: #fff; text-align: center; }
.memory-hero.media-placeholder::after { color: #fff; }
.memory-hero h1 { position: relative; margin: 10px 0; font: 400 clamp(34px, 9vw, 54px) var(--serif); }
.memory-hero p { position: relative; }

.fortune-dialog { width: min(620px, calc(100% - 24px)); max-height: calc(100vh - 24px); padding: 30px; border: 0; border-radius: 13px; background: var(--paper); }
.fortune-dialog::backdrop { background: rgba(44,33,31,.67); backdrop-filter: blur(4px); }
.dialog-close { position: absolute; right: 12px; top: 12px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: transparent; font-size: 23px; cursor: pointer; }
.fortune-step h2 { font: 400 30px var(--serif); }
.fragment-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin: 24px 0; }
.fragment-grid .choice span { min-height: 70px; }
.fortune-stick { width: 110px; height: 210px; display: grid; place-items: center; margin: 30px auto; border: 1px solid var(--gold); border-radius: 55px 55px 9px 9px; color: var(--rose-dark); background: #ead4c1; font: 25px var(--serif); writing-mode: vertical-rl; letter-spacing: .16em; animation: sway 1.5s ease-in-out infinite; }
.dialog-actions { display: flex; justify-content: center; gap: 9px; margin-top: 22px; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); max-width: calc(100% - 40px); transform: translate(-50%,12px); padding: 11px 16px; border-radius: 99px; background: #382e2b; color: #fff; opacity: 0; pointer-events: none; transition: .2s; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%,0); }

.reveal { opacity: 0; transform: translateY(20px); transition: opacity .8s, transform .8s; }
.reveal.visible { opacity: 1; transform: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(1.06); opacity: .82; } }
@keyframes sway { 50% { transform: rotate(4deg); } }

@media (min-width: 760px) {
  .hero { grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); grid-template-rows: 100vh; }
  .hero-image { min-height: 100vh; }
  .hero-copy { display: grid; align-content: center; }
  .story-grid { gap: 18px; }
}
@media (max-width: 430px) {
  .choice-row { grid-template-columns: 1fr; }
  .form-grid, .fragment-grid { grid-template-columns: 1fr; }
  .fortune-dialog { padding: 25px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
