:root {
  --ivory: #fff8eb; --paper: #fffcf5; --ink: #2d211f; --red: #802537;
  --red-dark: #661829; --pine: #284737; --gold: #d3aa72; --line: #d8c2a5;
  --pink: #f0d3c7; --sage: #d8e1d1; --muted: #66534b;
  --serif: Fraunces, Georgia, serif; --radius: 8px;
}
* { box-sizing: border-box }
body { margin: 0; background: var(--ivory); color: var(--ink); font: 16px/1.55 "DM Sans", system-ui, sans-serif }
button,input,select,textarea { font: inherit }
button,summary { cursor: pointer }
:focus-visible { outline: 3px solid var(--pine); outline-offset: 3px }
.board :focus-visible { outline-color: var(--paper) }
[hidden] { display: none !important }
.shell { max-width: 1280px; padding-inline: 32px; margin-inline: auto }
.mast,.foot { display: flex; min-height: 72px; justify-content: space-between; align-items: center; gap: 16px }
.mast { border-bottom: 1px solid var(--line) }
.mast a { color: var(--pine); text-decoration: none }
.mast .brand { font: 600 25px/1.1 var(--serif); color: var(--ink); display: flex; align-items: center; gap: 10px }
.brand span { display: inline-grid; place-items: center; width: 32px; height: 32px; background: var(--red); border: 2px dotted var(--ivory); color: var(--ivory); font-size: 22px }
.foot { font-size: 14px; color: var(--muted); border-top: 1px solid var(--line) }
.hero { display: grid; grid-template-columns: minmax(0, 42fr) minmax(0, 58fr); align-items: center; gap: 36px; padding-block: 52px 56px }
h1,h2,p { margin: 0 }
h1,h2 { font-family: var(--serif); line-height: 1.08 }
h1 { font-size: clamp(42px, 4.7vw, 70px); font-weight: 600; color: var(--red); letter-spacing: -.045em; overflow-wrap: anywhere }
.date { font-size: 13px; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; color: var(--pine); margin-bottom: 16px }
.lead { font-size: 19px; max-width: 34ch; margin-top: 16px }
form,#controls { display: grid; gap: 8px; max-width: 390px; margin-top: 22px }
label { font-weight: 700; font-size: 15px }
input,select,textarea { min-height: 48px; width: 100%; border: 1px solid var(--muted); border-radius: var(--radius); color: var(--ink); background: var(--paper); padding: 9px 12px }
textarea { resize: vertical }
button { border-radius: var(--radius) }
.primary { min-height: 48px; padding: 9px 16px; background: var(--red); color: var(--paper); border: 1px solid var(--red); font-weight: 700; margin-top: 4px }
.primary:hover { background: var(--red-dark) }
.text-button { min-height: 44px; border: 0; background: transparent; color: var(--pine); text-decoration: underline; text-align: left; padding: 4px 0 }
#sample { margin-top: 6px }
.preview-tag,#status { font-size: 13px; color: var(--muted) }
.preview-tag { margin-top: 14px }
#status:not(:empty) { margin-top: 10px }
#demo-controls { padding-top: 8px; font-size: 14px }
#demo-controls[open] label { display: block; margin-top: 8px }
#demo-controls[open] { border-top: 1px solid var(--line) }
.board { min-width: 0; background: var(--red); color: var(--ivory); padding: 22px; border-radius: var(--radius); box-shadow: 0 10px 22px #2d211f26; outline: 1px solid var(--gold); outline-offset: -9px }
.board-head { text-align: center; padding: 8px 0 18px }
.board h2 { font-size: clamp(24px, 3.1vw, 42px); font-weight: 600; overflow-wrap: anywhere }
.doors { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 9px }
.door { --envelope: var(--paper); min-height: 50px; aspect-ratio: 1.24; position: relative; isolation: isolate; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 3px; background: var(--envelope); color: var(--red-dark); padding: 0 0 9px; font: 600 clamp(17px,2.15vw,29px)/1 var(--serif); box-shadow: 0 2px 3px #2d211f35 }
.door:nth-child(4n+2), .door:nth-child(7n+3) { --envelope: var(--pink) }
.door:nth-child(5n+3) { --envelope: var(--sage) }
.door::before { content: ""; position: absolute; inset: -102% 8% auto; aspect-ratio: 1; background: var(--envelope); border: 1px solid var(--line); border-radius: 4px; transform: rotate(45deg); z-index: -1; box-shadow: 1px 1px 3px #2d211f1a }
.door:hover { filter: brightness(.94) }
.door[data-state="ready"] { box-shadow: inset 0 0 0 2px var(--red),0 2px 3px #2d211f35 }
.door[data-state="opened"] { --envelope: var(--sage) }
.door[data-state="sealed"] { border-style: dashed }
.door small { position: absolute; bottom: 4px; font: 700 12px/1 system-ui }
.board-end { display: flex; min-height: 52px; justify-content: space-between; align-items: center; gap: 8px; padding-top: 10px }
.board-note { font-size: 13px; color: var(--ivory) }
.postmark { display: grid; place-content: center; text-align: center; width: 38px; height: 38px; flex: none; border: 1px dashed var(--gold); border-radius: 50%; transform: rotate(12deg); color: var(--gold); font: 700 10px/1.1 system-ui }
.how { border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1.5fr; gap: 24px; padding-block: 42px }
.how h2 { font-size: 36px; color: var(--red) }
.how ol { margin: 0; padding-left: 23px }
.how li+li { margin-top: 10px }
.questions { padding-bottom: 38px }
.questions details { border-top: 1px solid var(--line); padding: 12px 0 }
.questions summary { font-weight: 700 }
.questions p { color: var(--muted); margin-top: 8px; max-width: 69ch }
dialog { width: min(490px,calc(100% - 24px)); max-height: calc(100% - 24px); background: var(--ivory); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: 0 8px 24px #2d211f35 }
dialog::backdrop { background: #2d211f77 }
dialog h2 { font-size: 34px; color: var(--red); margin-bottom: 8px }
dialog p { white-space: pre-wrap; overflow-wrap: anywhere }
dialog form { max-width: none; margin-top: 14px }
.dialog-actions { display: grid; gap: 4px }
.dialog-actions .text-button { text-align: center }
.postal-rule { height: 4px; background: repeating-linear-gradient(125deg,var(--red) 0 12px,var(--ivory) 12px 20px,var(--pine) 20px 32px,var(--ivory) 32px 40px); margin: 13px 0 6px }
.anon { display: flex; align-items: center; gap: 8px; min-height: 38px }
.anon input { width: 20px; min-height: auto; height: 20px; accent-color: var(--red) }
@media (max-width: 800px) {
  .shell { padding-inline: 20px }
  .hero,.how { grid-template-columns: 1fr; gap: 24px }
  .hero { padding-block: 28px 36px }
  .mast,.foot { min-height: 58px; font-size: 13px }
  .mast .brand { font-size: 18px }
  h1 { font-size: clamp(36px,7vw,52px) }
  .lead { font-size: 17px; margin-top: 10px }
  form,#controls { max-width: none }
  .board { padding: 18px }
  .doors { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px }
  .door { font-size: 22px }
}
@media (max-width: 355px) {
  .shell { padding-inline: 14px }
  .mast .brand { gap: 5px; font-size: 16px }
  .brand span { width: 25px; height: 25px }
}
@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: letter-in .16s ease-out }
  @keyframes letter-in { from { opacity: .5; transform: translateY(5px) } }
}