:root { color-scheme: dark; font-family: system-ui,sans-serif; background:#1b1c24; color:#fff; }
* { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; }
main { max-width:32rem; margin:auto; padding:24px max(16px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left)); }
header { display:flex; align-items:center; gap:12px; color:#ffe000; font-size:.8rem; letter-spacing:.08em; }
header img { width:38px; max-height:38px; object-fit:contain; }
h1 { font-size:clamp(2.4rem,10vw,4.4rem); line-height:.94; letter-spacing:-.06em; margin:24px 0; }
figure { margin:0; }
.invitation { aspect-ratio:4/5; background:#282931; }
.invitation img, #dedication img { display:block; width:100%; height:auto; }
#status:empty { display:none; }
@media (max-width: 600px) {
  main > .invitation { height:clamp(115px, 30svh, 245px); aspect-ratio:auto; overflow:hidden; }
  main > .invitation img { height:100%; object-fit:cover; object-position:center 65%; }
}
nav, form, article { display:grid; gap:10px; margin-block:14px; }
article { border-top:1px solid #6f6f77; padding-top:12px; }
button, input, textarea { font:inherit; min-height:44px; padding:10px; }
button { background:#ffe000; color:#1b1c24; border:0; font-weight:700; }
label { display:grid; gap:4px; }
label.consent { display:flex; align-items:center; }
pre { white-space:pre-wrap; overflow-wrap:anywhere; }
summary { min-height:44px; padding-block:12px; }
#dedication .dedication-star { display:inline-block; width:24px; height:24px; vertical-align:middle; object-fit:contain; }
.dedication-card { position:relative; }
.dedication-message { padding:16px; background:#f7e6cc; color:#382619; text-align:center; font-size:clamp(16px,5vw,25px); line-height:1.28; font-weight:650; text-wrap:balance; }
.dedication-card:has(img:not([hidden])) .dedication-message { position:absolute; inset-inline:22%; top:53%; transform:translateY(-50%); padding:0; background:transparent; }
.envelope { position:relative; isolation:isolate; aspect-ratio:6/5; overflow:hidden; }
.envelope img { position:absolute; inset:0; width:100%; height:100%; }
.envelope .still { visibility:hidden; }
.envelope .letter-pocket { position:absolute; inset:0; clip-path:inset(0 0 15% 0); }
.envelope .letter { visibility:hidden; transform:translateY(22%); }
.envelope .outer,.envelope .inner { transform-origin:50% 47%; backface-visibility:hidden; }
.envelope .inner { opacity:0; }
.envelope.open .seal { animation:lift-seal 120ms forwards; }
.envelope.open .outer { animation:flip-flap 270ms 120ms both; }
.envelope.open .inner { animation:show-flap 1ms 255ms forwards; }
.envelope.open .letter { animation:lift-letter 290ms 390ms forwards; }
@keyframes lift-seal { to { transform:translateY(-3%); opacity:0; } }
@keyframes flip-flap { to { transform:rotateX(180deg); } }
@keyframes show-flap { to { opacity:1; } }
@keyframes lift-letter {
  from { visibility:visible; transform:translateY(22%); }
  to { visibility:visible; transform:translateY(-16%); }
}
@media (prefers-reduced-motion:reduce) {
  .envelope.open img { animation:none; }
  .envelope.open .seal,.envelope.open .outer { opacity:0; }
  .envelope.open .inner { opacity:1; }
  .envelope.open .letter { visibility:visible; transform:translateY(-16%); }
  .envelope.open.has-still img:not(.still) { visibility:hidden; }
  .envelope.open.has-still .still { visibility:visible; }
}
