:root {
  --canvas: #e8dfd2;
  --paper: #faf6ed;
  --ink: #303238;
  --muted: #77736c;
  --red: #c94842;
  --red-deep: #9d3537;
  --line: rgba(48, 50, 56, .17);
  --postage: #f0c5b2;
  --paper-shadow: rgba(78, 61, 49, .17);
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { min-width: 320px; margin: 0; color: var(--ink); background: var(--canvas); font-family: "Karla", sans-serif; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.corner-brand { position: fixed; top: 26px; left: 29px; z-index: 5; display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: .75rem; font-weight: 700; letter-spacing: -.02em; }
.brand-symbol { display: grid; width: 27px; height: 27px; place-items: center; color: var(--paper); background: var(--red); border-radius: 50%; font-family: "Caveat", cursive; font-size: .78rem; font-weight: 600; }
.desk { min-height: calc(100svh - 64px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 84px 22px 28px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.mail-piece { position: relative; width: min(100%, 630px); min-height: 430px; }
.envelope-back { position: absolute; inset: 40px 0 0; overflow: hidden; background: #cfd4d1; border-radius: 3px; box-shadow: 0 20px 38px var(--paper-shadow); }
.envelope-back::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(136deg, rgba(255,255,255,.17) 0 1px, transparent 1px 4px); opacity: .46; }
.envelope-lining { position: absolute; z-index: 1; top: 40px; left: 0; width: 100%; height: 148px; background: #aeb9b5; clip-path: polygon(0 0, 50% 78%, 100% 0); opacity: .72; }
.envelope-front { position: absolute; z-index: 3; right: 0; bottom: 0; left: 0; height: 95px; overflow: hidden; background: #d5dad7; border-radius: 0 0 3px 3px; clip-path: polygon(0 0, 50% 55%, 100% 0, 100% 100%, 0 100%); pointer-events: none; }
.envelope-front::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(136deg, rgba(255,255,255,.13) 0 1px, transparent 1px 4px); }
.envelope-script { position: absolute; right: 28px; bottom: 13px; z-index: 1; color: rgba(48,50,56,.43); font-family: "Caveat", cursive; font-size: 1.3rem; transform: rotate(-3deg); }

.letter { position: relative; z-index: 2; width: calc(100% - 62px); min-height: 425px; margin: 0 auto; padding: 28px clamp(25px, 6vw, 66px) 27px; background: var(--paper); box-shadow: 0 4px 5px rgba(78,61,49,.08); transform: rotate(-1.1deg); }
.letter::after { content: ""; position: absolute; inset: 8px; pointer-events: none; border: 1px solid rgba(48,50,56,.1); }
.letter-address { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: start; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--line); color: var(--muted); font-family: "Caveat", cursive; font-size: 1.18rem; line-height: 1.1; }
.letter-address b { color: var(--ink); font-weight: 600; }
.postage { display: grid; width: 66px; min-height: 57px; place-items: center; color: var(--red-deep); border: 1px dashed var(--red-deep); transform: rotate(4deg); }
.postage svg { width: 30px; height: 22px; }
.postage span { font-family: "Karla", sans-serif; font-size: .45rem; font-weight: 700; letter-spacing: .08em; }
.handwritten { position: relative; z-index: 1; margin: 28px 0 12px; color: var(--red); font-family: "Caveat", cursive; font-size: clamp(2.7rem, 7vw, 4.9rem); font-weight: 600; line-height: .9; transform: rotate(-2deg); }
.letter-copy { position: relative; z-index: 1; margin: 0 0 27px; color: var(--muted); font-size: clamp(.95rem, 1.5vw, 1.07rem); line-height: 1.45; }
.email-label { position: relative; z-index: 1; display: block; margin-bottom: 5px; color: var(--muted); font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.address-line { position: relative; z-index: 1; display: flex; align-items: center; gap: 9px; border-bottom: 2px solid var(--ink); }
.address-line input { min-width: 0; flex: 1; min-height: 45px; padding: 0 1px; color: var(--ink); background: transparent; border: 0; border-radius: 0; outline: 0; }
.address-line input::placeholder { color: #aaa49b; }
.address-line svg { width: 21px; height: 21px; stroke: var(--muted); fill: none; stroke-width: 1.4; }
.consent-row { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; min-height: 39px; margin: 11px 0 0; color: var(--muted); font-size: .68rem; cursor: pointer; }
.consent-row input { width: 15px; height: 15px; min-height: 15px; accent-color: var(--red); }
.send-button { position: relative; z-index: 6; display: inline-flex; align-items: center; gap: 8px; min-height: 43px; margin-top: 13px; padding: 0 17px; color: var(--paper); background: var(--red); border: 0; border-radius: 2px; cursor: pointer; font-size: .75rem; font-weight: 700; transition: background 150ms ease, transform 150ms ease; }
.send-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.send-button:hover { background: var(--red-deep); transform: translateY(-2px) rotate(-1deg); }
.send-button:active { transform: translateY(0); }
.form-note { position: relative; z-index: 1; margin: 10px 0 0; color: var(--muted); font-size: .67rem; line-height: 1.5; }
.form-message { position: relative; z-index: 1; min-height: 1.25em; margin: 8px 0 0; color: var(--red-deep); font-size: .75rem; }
.form-message.error { color: var(--red); }
.text-button { position: relative; z-index: 1; min-height: 36px; padding: 0; color: var(--muted); background: transparent; border: 0; cursor: pointer; font-size: inherit; text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 3px; }
.text-button:hover { color: var(--ink); }
.letter-ps { position: relative; z-index: 1; margin: 21px 0 0; color: var(--muted); font-family: "Caveat", cursive; font-size: 1.2rem; transform: rotate(-2deg); }
.receipt { position: relative; z-index: 1; padding-top: 17px; }
.receipt h2 { margin: 0; font-family: "Caveat", cursive; font-size: 3.8rem; font-weight: 600; color: var(--red); }
.receipt p { max-width: 360px; margin: 4px 0 7px; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.saved-stamp { display: inline-block; padding: 4px 9px; color: var(--red-deep); border: 1px solid var(--red-deep); font-size: .54rem; font-weight: 700; letter-spacing: .13em; transform: rotate(-4deg); }

.skip-button { min-height: 42px; margin: 27px 0 0; padding: 0 3px; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--red); cursor: pointer; font-size: .73rem; }
.skip-button span { display: inline-block; margin-left: 7px; color: var(--red); font-size: 1rem; transition: transform 150ms ease; }
.skip-button:hover span { transform: translate(3px, -2px); }
.demo-caption { margin: 12px 0 0; color: rgba(48,50,56,.48); font-family: "Caveat", cursive; font-size: 1rem; transform: rotate(-2deg); }

.address-book { min-height: 425px; }
.address-book .handwritten { margin-top: 45px; font-size: clamp(2.7rem, 6vw, 4.5rem); }
.back-button { position: relative; z-index: 1; min-height: 36px; padding: 0; color: var(--muted); background: none; border: 0; border-bottom: 1px solid var(--red); cursor: pointer; font-size: .7rem; }
.social-links { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 27px; margin-top: 35px; border-top: 1px solid var(--line); }
.social-link { display: flex; align-items: center; justify-content: space-between; min-height: 63px; padding: 10px 3px; color: var(--ink); border-bottom: 1px solid var(--line); text-decoration: none; transition: color 150ms ease, padding 150ms ease; }
.social-link:hover { padding-left: 9px; color: var(--red); }
.social-link.is-disabled { color: #99958c; cursor: default; }
.social-link.is-disabled:hover { padding-left: 3px; color: #99958c; }
.social-link strong { display: block; font-size: .85rem; }
.social-link small { display: block; margin-top: 3px; color: var(--muted); font-size: .67rem; }
.social-index { color: var(--red); font-family: "Caveat", cursive; font-size: 1.35rem; }

.footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 0 29px 17px; color: rgba(48,50,56,.5); font-size: .64rem; }
.dialog { width: min(560px, calc(100% - 32px)); max-height: calc(100svh - 40px); padding: 28px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 2px; }
.dialog::backdrop { background: rgba(48,50,56,.6); }
.dialog-top { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.dialog h3 { margin: 0; color: var(--ink); font-family: "Caveat", cursive; font-size: 2.7rem; font-weight: 600; }
.dialog p { color: var(--muted); font-size: .82rem; line-height: 1.6; }
.close-button { width: 38px; min-height: 38px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 50%; cursor: pointer; font-size: 1.25rem; }
.link-field { padding: 13px 0; border-bottom: 1px solid var(--line); }
.link-field label { display: block; margin: 0 0 5px; font-size: .68rem; font-weight: 700; }
.link-field input { min-height: 38px; padding: 0 9px; border: 1px solid var(--line); }
.editor-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 13px; }
.secondary-button { min-height: 41px; padding: 0 15px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 2px; cursor: pointer; }
.stats-section { margin-top: 26px; }
.stats-section h4 { margin: 0; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.stat-line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .75rem; }
.stat-line b { color: var(--ink); }
[hidden] { display: none !important; }
@keyframes letter-in { from { opacity: 0; transform: translateY(10px) rotate(-3deg); } to { opacity: 1; transform: translateY(0) rotate(-1.1deg); } }
.letter { animation: letter-in 460ms ease both; }

@media (max-width: 700px) {
  .corner-brand { position: absolute; top: 18px; left: 18px; }
  .desk { min-height: auto; padding: 73px 16px 20px; }
  .mail-piece { min-height: 520px; }
  .envelope-back { inset: 22px 0 0; }
  .envelope-lining { top: 22px; height: 125px; }
  .envelope-front { height: 160px; }
  .letter { width: calc(100% - 20px); min-height: 485px; padding: 23px 22px 25px; transform: rotate(-.6deg); }
  .postage { width: 57px; min-height: 51px; }
  .postage svg { width: 26px; }
  .handwritten { margin-top: 27px; font-size: clamp(2.7rem, 14vw, 4.2rem); }
  .desktop-break { display: none; }
  .address-line { display: flex; }
  .send-button { width: 100%; justify-content: center; }
  .skip-button { position: relative; z-index: 5; margin-top: -58px; margin-bottom: 25px; color: var(--red-deep); border-bottom-color: var(--red-deep); }
  .skip-button span { color: var(--red-deep); }
  .social-links { grid-template-columns: 1fr; margin-top: 28px; }
  .address-book { min-height: 485px; }
  .address-book .handwritten { margin-top: 37px; font-size: clamp(2.55rem, 13vw, 4rem); }
  .footer { padding-right: 17px; padding-left: 17px; align-items: flex-start; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
