:root {
  --ink: #27352e;
  --muted: #68756d;
  --paper: #fffaf2;
  --sage: #758f7d;
  --sage-dark: #3e5c4a;
  --rose: #bd7d78;
  --apricot: #d8a36f;
  --line: rgba(62, 92, 74, .2);
  --shadow: 0 28px 80px rgba(42, 54, 47, .22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  background: linear-gradient(180deg, rgba(239,231,217,.38), rgba(55,78,64,.36)), url("./garden-dusk.png") center / cover fixed, linear-gradient(145deg, #d9e0d2, #e9cdc1 55%, #8fa08c);
}
body.is-sealed { overflow: hidden; }
button, input, textarea { font: inherit; }
button { color: inherit; }
.site-shell { min-height: 100vh; }
.eyebrow { margin: 0 0 16px; color: var(--sage-dark); font: 600 11px/1.4 ui-sans-serif, system-ui, sans-serif; letter-spacing: .23em; }

.intro {
  position: fixed;
  inset: 0;
  z-index: 10;
  min-height: 100svh;
  overflow-y: auto;
  padding: max(56px, 8vh) 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(248,243,233,.18);
  backdrop-filter: blur(2px);
  transition: opacity .7s ease, transform .7s ease;
}
.intro::before { content: ""; position: absolute; inset: 22px; border: 1px solid rgba(255,250,242,.65); pointer-events: none; }
.intro h1 { margin: 0; font-size: clamp(36px, 10vw, 62px); line-height: 1.22; font-weight: 500; letter-spacing: .06em; text-shadow: 0 2px 24px rgba(255,255,255,.7); }
.intro-note { margin: 20px 0 44px; color: #516158; font-size: 14px; line-height: 1.9; }

.envelope { position: relative; width: min(76vw, 320px); aspect-ratio: 1.48; padding: 0; border: 0; background: transparent; cursor: pointer; filter: drop-shadow(0 22px 24px rgba(39,53,46,.22)); transition: transform .25s ease; }
.envelope:hover { transform: translateY(-5px) rotate(-.5deg); }
.envelope:focus-visible { outline: 3px solid var(--sage-dark); outline-offset: 8px; }
.envelope-back, .envelope-front, .envelope-paper { position: absolute; inset: 0; border-radius: 4px; }
.envelope-back { background: #e8d5bc; }
.envelope-paper { inset: 8% 8% 10%; display: grid; place-items: start center; padding-top: 22px; color: var(--sage-dark); background: #fffaf2; border: 1px solid #decfb9; transform: translateY(1%); transition: transform .8s cubic-bezier(.2,.8,.2,1); }
.envelope-paper span { font-size: 13px; letter-spacing: .22em; }
.envelope-front { overflow: hidden; background: linear-gradient(31deg, #dfc8a9 49.5%, transparent 50%) 0 100% / 50.5% 100% no-repeat, linear-gradient(-31deg, #ead7bd 49.5%, transparent 50%) 100% 100% / 50.5% 100% no-repeat; }
.envelope-front::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 70%; background: #f0dfc7; clip-path: polygon(0 0, 50% 82%, 100% 0); transform-origin: top; transition: transform .7s ease; }
.wax-seal { position: absolute; left: 50%; top: 52%; width: 54px; height: 54px; display: grid; place-items: center; transform: translate(-50%,-50%); border: 2px solid rgba(255,255,255,.3); border-radius: 50%; color: #f9eadd; background: #9d514d; box-shadow: 0 4px 12px rgba(76,37,35,.3), inset 0 0 0 3px #a75c57; font: 600 12px ui-sans-serif, system-ui, sans-serif; letter-spacing: .08em; transition: transform .4s ease, opacity .35s ease; }
.envelope.opening .envelope-front::before { transform: rotateX(180deg); }
.envelope.opening .envelope-paper { transform: translateY(-48%); }
.envelope.opening .wax-seal { transform: translate(-50%,-70%) scale(.4) rotate(18deg); opacity: 0; }
.open-hint { margin-top: 28px; padding: 9px 18px; border: 0; border-bottom: 1px solid currentColor; color: var(--sage-dark); background: transparent; cursor: pointer; font-size: 13px; letter-spacing: .18em; }
.intro.leaving { opacity: 0; transform: scale(1.03); pointer-events: none; }

.letter-stage { display: none; padding: 36px 14px 70px; overflow-anchor: none; }
.letter-stage.visible { display: block; animation: stage-in .9s ease both; }
.letter { position: relative; width: min(100%, 780px); margin: 0 auto; padding: clamp(30px, 7vw, 68px); overflow: hidden; background: linear-gradient(rgba(255,250,242,.96),rgba(255,250,242,.96)), repeating-linear-gradient(0deg, transparent 0 28px, rgba(62,92,74,.035) 29px); border: 1px solid rgba(255,255,255,.75); box-shadow: var(--shadow); }
.letter::after { content: "WQ · 2026"; position: absolute; right: -34px; bottom: 90px; color: rgba(62,92,74,.055); font: 700 54px ui-sans-serif, system-ui, sans-serif; letter-spacing: .05em; transform: rotate(-90deg); }
.letter-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.letter-head h2 { margin: 0; font-size: clamp(32px, 7vw, 52px); line-height: 1.3; font-weight: 500; letter-spacing: .04em; }
.stamp { flex: 0 0 66px; min-height: 78px; display: grid; place-content: center; border: 2px solid var(--rose); color: var(--rose); font-weight: 700; line-height: 1.45; text-align: center; transform: rotate(6deg); }
.letter-body { margin-top: 48px; font-size: 16px; line-height: 2.1; }
.letter-body p { margin: 0 0 18px; }
.letter-body .salutation { font-size: 19px; font-weight: 600; }
blockquote { margin: 30px 0; padding: 23px 20px 23px 28px; border-left: 3px solid var(--apricot); background: rgba(216,163,111,.09); font-size: 18px; line-height: 1.95; }
blockquote strong { color: #8b5a3b; font-weight: 700; }

.agenda, .rsvp { margin-top: 56px; padding-top: 34px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.section-heading > span { color: var(--apricot); font: 300 36px/1 ui-sans-serif, system-ui, sans-serif; }
.section-heading p { margin: 0 0 4px; color: var(--muted); font: 600 10px/1.2 ui-sans-serif, system-ui, sans-serif; letter-spacing: .19em; }
.section-heading h3 { margin: 0; font-size: 22px; font-weight: 600; }
.agenda ol { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.agenda li { padding: 18px; border: 1px solid var(--line); background: rgba(255,255,255,.48); }
.agenda li span { display: block; margin-bottom: 7px; font-size: 17px; font-weight: 600; }
.agenda li small { color: var(--muted); font-size: 13px; line-height: 1.65; }

fieldset { padding: 0; margin: 32px 0 0; border: 0; }
legend, .message-field > span { margin-bottom: 14px; font-size: 15px; font-weight: 600; }
legend { padding: 0; }
.date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.date-option { position: relative; }
.date-option input, .choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.date-option span { min-height: 61px; display: grid; place-content: center; gap: 2px; border: 1px solid var(--line); background: rgba(255,255,255,.56); text-align: center; cursor: pointer; transition: .2s ease; }
.date-option b { font: 600 17px ui-sans-serif, system-ui, sans-serif; }
.date-option small { color: var(--muted); font-size: 10px; }
.date-option input:checked + span { border-color: var(--sage-dark); color: white; background: var(--sage-dark); transform: translateY(-3px); box-shadow: 0 7px 16px rgba(62,92,74,.2); }
.date-option input:checked + span small { color: rgba(255,255,255,.75); }
.date-option input:focus-visible + span, .choice-card input:focus-visible ~ span { outline: 2px solid var(--sage-dark); outline-offset: 3px; }
.place-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-card { position: relative; min-height: 74px; display: flex; align-items: center; gap: 13px; padding: 17px; border: 1px solid var(--line); background: rgba(255,255,255,.5); cursor: pointer; transition: .2s ease; }
.choice-card:hover { border-color: rgba(62,92,74,.5); transform: translateY(-2px); }
.choice-card .choice-index { flex: 0 0 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--sage); border-radius: 50%; color: var(--sage-dark); font: 600 11px ui-sans-serif, system-ui, sans-serif; }
.choice-card b, .choice-card small { display: block; }
.choice-card b { margin: 0; font-size: 15px; }
.choice-card small { color: var(--muted); font-size: 12px; line-height: 1.55; }
.choice-card:has(input:checked) { border-color: var(--sage-dark); background: rgba(117,143,125,.12); box-shadow: inset 0 0 0 1px var(--sage-dark); }
.choice-card:has(input:checked) .choice-index { color: white; background: var(--sage-dark); }
.choice-card-wide { grid-column: 1 / -1; }
.field-note { margin: -4px 0 14px; padding: 12px 14px; color: #725540; background: rgba(216,163,111,.09); font-size: 13px; line-height: 1.75; }
.recommended-choice { padding-top: 24px; }
.choice-badge { position: absolute; top: 0; right: 0; padding: 4px 9px; color: #fff; background: var(--rose); font: 600 10px/1.2 ui-sans-serif, system-ui, sans-serif; letter-spacing: .08em; }
.movie-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.compact-choice { min-height: 70px; justify-content: center; text-align: center; }
.compact-choice b { margin-top: 0; }
.clear-choice { display: block; margin: 12px 0 0 auto; padding: 5px 0; border: 0; border-bottom: 1px dashed currentColor; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; }
.clear-choice:hover { color: var(--sage-dark); }
.custom-place { max-height: 0; overflow: hidden; opacity: 0; transform: translateY(-5px); transition: .35s ease; }
.custom-place.visible { max-height: 120px; margin-top: 16px; opacity: 1; transform: none; }
.custom-place label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.optional-input { margin-top: 14px; }
.optional-input label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.custom-place input, .optional-input input, .secret-dialog input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 0; padding: 13px 14px; color: var(--ink); background: rgba(255,255,255,.66); outline: none; transition: border .2s, box-shadow .2s; }
input:focus, textarea:focus { border-color: var(--sage-dark); box-shadow: 0 0 0 3px rgba(117,143,125,.13); }
textarea { resize: vertical; line-height: 1.7; }
.message-field { display: block; margin-top: 30px; }
.message-field > span { display: block; }
em { color: var(--muted); font-size: 12px; font-style: normal; font-weight: 400; }
.form-status { min-height: 24px; margin: 16px 0 0; color: #9c4f4b; font-size: 13px; }
.decision-row { display: flex; align-items: center; gap: 22px; margin-top: 12px; }
.primary-button, .secondary-button { min-height: 50px; padding: 0 28px; border: 1px solid var(--sage-dark); color: #fff; background: var(--sage-dark); cursor: pointer; font-weight: 600; letter-spacing: .12em; transition: .2s ease; }
.primary-button { flex: 1; }
.primary-button:hover, .secondary-button:hover { background: #2f4b3a; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(47,75,58,.2); }
.primary-button:disabled { opacity: .6; cursor: wait; transform: none; }
.text-button { padding: 10px 0; border: 0; border-bottom: 1px solid var(--muted); color: var(--muted); background: transparent; cursor: pointer; font-size: 13px; }
.signature { margin-top: 58px; padding-top: 28px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 24px; color: var(--muted); font-size: 13px; }
.signature > p { margin: 0; }
.signature > div { min-width: 145px; display: grid; text-align: right; }
.signature strong { margin: 5px 0; color: var(--ink); font-size: 20px; font-weight: 500; }

.decline-dialog, .secret-dialog { width: min(calc(100% - 28px), 520px); padding: 0; border: 0; color: var(--ink); background: transparent; }
.decline-dialog::backdrop, .secret-dialog::backdrop { background: rgba(30,42,35,.55); backdrop-filter: blur(5px); }
.decline-dialog form, .secret-dialog form { position: relative; padding: 34px; background: var(--paper); box-shadow: var(--shadow); }
.decline-dialog h2, .secret-dialog h2 { margin: 0 0 20px; font-size: 30px; font-weight: 500; }
.decline-dialog p { line-height: 1.75; }
.decline-dialog .dialog-joke { padding: 13px 15px; color: #795647; background: rgba(216,163,111,.12); font-size: 13px; }
.decline-dialog label, .secret-dialog label { display: block; margin: 22px 0 8px; font-weight: 600; }
.dialog-close { position: absolute; right: 15px; top: 12px; border: 0; background: transparent; font-size: 28px; cursor: pointer; }
.secret-question { margin: 20px 0; padding: 18px; color: var(--sage-dark); background: rgba(117,143,125,.1); font-size: 20px; font-weight: 600; text-align: center; letter-spacing: .04em; }
.secret-status { min-height: 22px; margin: 8px 0; color: #9c4f4b; font-size: 13px; }
.char-count { margin: 5px 0 14px !important; color: var(--muted); text-align: right; font: 11px ui-sans-serif, system-ui, sans-serif; }
.secondary-button { width: 100%; }
.final-decision-row { display: flex; align-items: center; gap: 22px; margin-top: 18px; }
.final-decision-row .primary-button { flex: 1; }

.success-screen { position: fixed; inset: 0; z-index: 20; display: none; place-items: center; padding: 20px; background: rgba(38,54,45,.88); backdrop-filter: blur(12px); }
.success-screen.visible { display: grid; animation: fade-in .5s ease both; }
#celebration { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.success-card { position: relative; width: min(100%, 520px); padding: 44px 30px; text-align: center; background: var(--paper); box-shadow: var(--shadow); }
.success-mark { width: 62px; height: 62px; margin: 14px auto 22px; display: grid; place-items: center; border: 1px solid var(--sage); border-radius: 50%; color: #fff; background: var(--sage-dark); font: 300 32px ui-sans-serif, system-ui, sans-serif; }
.success-card h2 { margin: 0 0 18px; font-size: clamp(29px, 7vw, 42px); line-height: 1.35; font-weight: 500; }
.success-card > p { line-height: 1.8; }
.success-note { margin: 24px 0; padding: 16px; background: rgba(216,163,111,.1); color: #725540; font-size: 13px; line-height: 1.7; }
.success-sign { color: var(--muted); font-size: 13px; }
.success-edit-button { display: block; margin: 18px auto 0; }
.admin-response { margin: 12px 0 24px; }
.admin-empty { padding: 24px 16px; color: var(--muted); background: rgba(117,143,125,.08); text-align: center; }
.admin-status { margin: 0 0 14px; color: var(--sage-dark); font-size: 18px; font-weight: 600; }
.admin-list { margin: 0; border-top: 1px solid var(--line); }
.admin-row { display: grid; grid-template-columns: 92px 1fr; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.admin-row dt { color: var(--muted); font-size: 13px; }
.admin-row dd { margin: 0; overflow-wrap: anywhere; line-height: 1.6; white-space: pre-wrap; }
.reveal-item { opacity: 0; transform: translateY(20px); }
.visible .reveal-item { animation: reveal .75s ease forwards; }
.visible .reveal-item:nth-child(2) { animation-delay: .14s; }
.visible .reveal-item:nth-child(3) { animation-delay: .24s; }
.visible .reveal-item:nth-child(4) { animation-delay: .34s; }
.visible .reveal-item:nth-child(5) { animation-delay: .44s; }
@keyframes stage-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes reveal { to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 620px) {
  .letter-stage { padding: 0; }
  .letter { padding: 38px 22px 46px; }
  .stamp { flex-basis: 56px; min-height: 67px; font-size: 13px; }
  .letter-body { margin-top: 38px; font-size: 15px; }
  .agenda ol, .place-grid { grid-template-columns: 1fr; }
  .movie-grid { grid-template-columns: 1fr; }
  .date-grid { grid-template-columns: repeat(4, 1fr); }
  .decision-row, .signature { align-items: stretch; flex-direction: column; }
  .text-button { align-self: center; }
  .signature { gap: 28px; }
  .signature > div { align-self: flex-end; padding-right: 4px; text-align: right; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
