:root {
  --pine-950: #08170f;
  --pine-900: #0d2117;
  --pine-800: #133022;
  --pine-700: #183d2b;
  --pine-600: #1f4e37;
  --red-900: #4a0c13;
  --red-700: #7f111c;
  --red-600: #991522;
  --red-500: #b91c2c;
  --gold-300: #f3dc8c;
  --gold-400: #e5c158;
  --gold-500: #d4af37;
  --gold-600: #b59024;
  --paper: #fbf6ec;
  --paper-2: #f5ebd6;
  --ink: #2a1d14;
  --text: #f6efe0;
  --muted: #cdd9cf;
  --line: rgba(212, 175, 55, .28);
  --radius: 18px;
  --ui: "Nunito", system-ui, sans-serif;
  --serif: "Playfair Display", Georgia, serif;
  --festive: "Mountains of Christmas", "Playfair Display", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
  background: var(--pine-900);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(229, 193, 88, .12), transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(153, 21, 34, .18), transparent 70%);
  background-attachment: fixed;
  overflow-x: hidden;
}
img, canvas { max-width: 100%; display: block; }
a { color: var(--gold-400); }
button, input, select, textarea { font: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }

/* top bar + header */
.topbar {
  position: relative; z-index: 2;
  background: var(--red-700);
  border-bottom: 1px solid rgba(229, 193, 88, .4);
  text-align: center; font-size: 15px; font-weight: 600;
  padding: 9px 16px;
}
.pill {
  display: inline-block; border-radius: 999px; padding: 2px 10px;
  font-size: 13px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; vertical-align: 1px;
}
.pill-gold { background: var(--gold-400); color: var(--pine-900); }

.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(19, 48, 34, .92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.brand-mark {
  width: 44px; height: 44px; flex: none; border-radius: 14px;
  display: grid; place-items: center; font-size: 22px;
  background: var(--red-600); border: 2px solid var(--gold-400);
}
.brand-name { display: block; font-family: var(--festive); font-size: 27px; line-height: 1; color: var(--paper); }
.brand-sub { display: block; font-size: 14px; color: var(--gold-400); font-weight: 700; }
.header-actions { display: flex; gap: 8px; flex: none; }
.show-sm { display: none; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px; border-radius: 14px; border: 0;
  font-weight: 800; font-size: 16px; text-decoration: none; cursor: pointer;
  transition: transform .15s ease, filter .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn:focus-visible, .link-btn:focus-visible, .chip:focus-visible, .style-swatch:focus-visible, .stamp-swatch:focus-visible, .swatch:focus-visible { outline: 3px solid var(--gold-300); outline-offset: 2px; }
.btn-sm { min-height: 40px; padding: 7px 13px; font-size: 15px; border-radius: 12px; }
.btn-lg { min-height: 56px; padding: 14px 24px; font-size: 18px; }
.btn-block { width: 100%; }
.btn-gold { background: linear-gradient(180deg, var(--gold-300), var(--gold-500)); color: var(--pine-900); box-shadow: 0 6px 18px rgba(212, 175, 55, .3); }
.btn-gold:hover { filter: brightness(1.06); }
.btn-red { background: var(--red-500); color: #fff; box-shadow: 0 6px 18px rgba(153, 21, 34, .35); }
.btn-red:hover { background: #c92636; }
.btn-ghost { background: var(--pine-700); color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--pine-600); }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 10px; font-size: 15px; }

/* hero */
.hero { position: relative; z-index: 2; text-align: center; padding-top: 34px; padding-bottom: 10px; }
.eyebrow { margin: 0 0 8px; color: var(--gold-400); font-weight: 900; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
h1, h2 { font-family: var(--serif); font-weight: 700; line-height: 1.12; margin: 0; color: var(--paper); }
h1 { font-size: clamp(34px, 6vw, 56px); }
h2 { font-size: clamp(30px, 4.6vw, 44px); }
h1 em, h2 em { color: var(--gold-400); }
.lede { max-width: 640px; margin: 12px auto 0; color: var(--muted); font-size: 18px; }

/* workspace */
.workspace {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 28px; align-items: start; padding-top: 24px; padding-bottom: 24px;
}
.panel {
  background: rgba(19, 48, 34, .94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}
.form-panel { padding: 8px 20px 14px; }
.step { border: 0; border-bottom: 1px solid var(--line); margin: 0; padding: 18px 0; min-width: 0; }
.step:last-of-type { border-bottom: 0; }
.step legend {
  display: flex; align-items: center; gap: 10px; padding: 0;
  font-family: var(--serif); font-size: 21px; font-weight: 700; color: var(--paper);
  margin-bottom: 10px;
}
.step legend small { font-family: var(--ui); font-size: 14px; color: var(--gold-400); font-weight: 800; }
.num {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--red-600); color: #fff; font-family: var(--ui); font-size: 15px; font-weight: 900;
}
.hint { margin: -4px 0 10px; color: var(--muted); font-size: 15px; }
.field { display: block; margin-top: 10px; }
.field > span, .mini-label { display: block; font-size: 14px; font-weight: 800; color: var(--gold-400); margin-bottom: 5px; letter-spacing: .02em; }
.mini-label { margin-top: 12px; }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border-radius: 12px; border: 1px solid rgba(212, 175, 55, .35);
  background: var(--pine-900); color: var(--paper); font-size: 17px;
}
textarea { resize: vertical; min-height: 64px; }
input::placeholder, textarea::placeholder { color: rgba(234, 216, 179, .45); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold-400); box-shadow: 0 0 0 3px rgba(229, 193, 88, .25); }
.row-2 { display: flex; gap: 10px; }
.row-2 .grow { flex: 1; min-width: 0; }
.row-2 .age { width: 96px; flex: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 42px; padding: 8px 13px; border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, .3); background: var(--pine-900);
  color: var(--muted); font-size: 15px; font-weight: 700; cursor: pointer; text-align: left;
}
.chip[aria-pressed="true"] { background: var(--pine-600); border-color: var(--gold-400); color: var(--paper); }
.chip[aria-pressed="true"]::before { content: "✓"; color: var(--gold-400); font-weight: 900; }

.wish { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.dot { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 15px; }
.dot-red { background: var(--red-500); }
.dot-green { background: var(--pine-600); border: 1px solid var(--gold-500); }
.dot-gold { background: var(--gold-600); }

/* drawing pad */
.pad-wrap { position: relative; border-radius: 14px; overflow: hidden; border: 3px dashed rgba(229, 193, 88, .55); background: #fffdf8; }
#pad { width: 100%; height: auto; aspect-ratio: 4 / 3; touch-action: none; cursor: crosshair; }
.pad-empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #b8a888; font-family: "Patrick Hand", cursive; font-size: 26px; pointer-events: none;
}
.pad-empty.gone { display: none; }
.pad-tools { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 10px; }
.swatches { display: flex; gap: 7px; flex-wrap: wrap; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25); cursor: pointer; padding: 0; }
.swatch[aria-checked="true"] { border-color: #fff; box-shadow: 0 0 0 3px var(--gold-400); }
.pad-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }

.swatch-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.style-swatch, .stamp-swatch {
  min-height: 64px; border-radius: 14px; cursor: pointer; padding: 6px;
  border: 2px solid transparent; color: var(--ink); font-weight: 800; font-size: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.style-swatch span { background: var(--paper); padding: 3px 8px; border-radius: 8px; }
.style-swatch[aria-checked="true"], .stamp-swatch[aria-checked="true"] { border-color: var(--gold-300); box-shadow: 0 0 0 3px rgba(229, 193, 88, .35); }
.sw-airmail { background: repeating-linear-gradient(45deg, #991522 0 10px, #fbf6ec 10px 20px, #183d2b 20px 30px, #fbf6ec 30px 40px); }
.sw-gold { background: linear-gradient(135deg, #d4af37, #fff3b0 50%, #b59024); }
.sw-tartan { background: repeating-linear-gradient(-45deg, #183d2b 0 12px, #d4af37 12px 15px, #991522 15px 27px); }
.stamp-swatch { background: var(--red-600); color: var(--paper); font-size: 26px; }
.stamp-swatch span { font-size: 14px; }

/* preview */
.preview-col { position: sticky; top: 84px; min-width: 0; scroll-margin-top: 84px; }
.action-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; margin-bottom: 14px; }
.live { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 0 rgba(74, 222, 128, .6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }
.action-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.letter-frame { border-radius: 14px; overflow: hidden; box-shadow: 0 30px 60px rgba(0, 0, 0, .5); background: var(--paper); }
#letter { width: 100%; height: auto; }
.tiny { font-size: 14px; color: var(--muted); text-align: center; margin: 10px 0 0; }

/* reply section */
.reply-section { position: relative; z-index: 2; padding-top: 56px; padding-bottom: 40px; scroll-margin-top: 70px; }
.center { text-align: center; }
.offer-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 22px; margin-top: 30px; }
.offer {
  border-radius: 26px; padding: 26px; border: 2px solid var(--gold-400);
  background: linear-gradient(150deg, var(--red-700), var(--red-900) 55%, var(--pine-900));
  box-shadow: 0 30px 60px rgba(0, 0, 0, .4);
}
.perks { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 14px; }
.perks li { display: flex; gap: 12px; align-items: flex-start; color: var(--muted); font-size: 16px; }
.perks li > span { font-size: 26px; line-height: 1; flex: none; width: 34px; text-align: center; }
.perks strong { display: block; color: var(--paper); font-size: 17px; }
.price-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.price { display: block; font-size: 40px; font-weight: 900; color: #fff; line-height: 1; }
.price-note { display: block; font-size: 14px; color: var(--muted); margin-top: 4px; }
.cross { border-radius: 26px; padding: 26px; background: rgba(19, 48, 34, .95); border: 1px solid var(--line); display: flex; flex-direction: column; }
.cross h3 { font-family: var(--serif); font-size: 26px; margin: 0; color: var(--paper); }
.cross p { color: var(--muted); }
.checks { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.checks li::before { content: "✓ "; color: #4ade80; font-weight: 900; }
.cross .btn { margin-top: auto; }

.site-footer { position: relative; z-index: 2; border-top: 1px solid var(--line); padding: 22px 0 96px; font-size: 14px; color: var(--muted); text-align: center; }
.site-footer p { margin: 4px 0; }

.mobile-bar { display: none; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(5, 12, 8, .78); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal[hidden] { display: none; }
.modal-card {
  position: relative; width: 100%; max-width: 470px; max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--pine-900); border: 2px solid var(--gold-400); border-radius: 26px;
  padding: 26px 22px 18px; text-align: center; animation: pop .35s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.modal-card h3 { font-family: var(--serif); font-size: 26px; margin: 0 0 6px; color: var(--paper); line-height: 1.2; }
.modal-card h3 .js-name { color: var(--gold-400); }
.modal-x { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--pine-700); color: var(--text); font-size: 17px; cursor: pointer; }
.modal-copy { color: var(--muted); font-size: 16px; margin: 6px 0 16px; }
.cross-mini { display: block; margin-top: 6px; font-size: 14px; color: var(--muted); text-decoration: none; }

/* envelope teaser */
.envelope { position: relative; width: 280px; height: 180px; margin: 74px auto 18px; perspective: 800px; }
.env-back { position: absolute; inset: 0; background: #e9d9b6; border-radius: 8px; }
.env-letter {
  position: absolute; left: 18px; right: 18px; top: 12px; height: 150px; z-index: 1; background: var(--paper);
  border-radius: 6px; padding: 14px; text-align: left; color: var(--ink);
  font-family: "Patrick Hand", cursive; font-size: 20px; box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
  animation: rise 4s ease-in-out infinite;
}
.env-letter i { display: block; height: 7px; margin-top: 12px; border-radius: 4px; background: #e6dcc6; }
.env-letter i:nth-child(3) { width: 80%; } .env-letter i:nth-child(4) { width: 60%; }
@keyframes rise { 0%, 30% { transform: translateY(0); } 58%, 82% { transform: translateY(-64px); } 100% { transform: translateY(0); } }
.env-front {
  position: absolute; inset: 0; border-radius: 8px; z-index: 2;
  background: linear-gradient(160deg, #f6ead0, #e7d3aa);
  clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 14px 16px; color: var(--ink); text-align: left;
}
.env-to { margin-left: 50%; line-height: 1.15; }
.env-to small { font-size: 13px; color: #7a6a52; display: block; }
.env-to b { font-family: "Patrick Hand", cursive; font-size: 24px; color: var(--red-600); font-weight: 400; display: block; }
.env-to span { font-size: 13px; color: #5d4f3c; display: block; }
.env-from { position: absolute; left: 14px; bottom: 12px; font-size: 13px; font-weight: 800; color: #7a6a52; width: 40%; line-height: 1.25; }
.env-flap {
  position: absolute; left: 0; right: 0; top: 0; height: 62%; z-index: 3; transform-origin: top;
  background: linear-gradient(180deg, #e3cd9f, #d8bf8c);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  animation: flap 4s ease-in-out infinite;
}
@keyframes flap { 0%, 15% { transform: rotateX(0); opacity: 1; } 28% { opacity: 1; } 35%, 85% { transform: rotateX(180deg); opacity: 0; z-index: 0; } 95% { opacity: 1; } 100% { transform: rotateX(0); opacity: 1; } }
.env-seal {
  position: absolute; left: 50%; top: 52%; z-index: 4; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--festive); font-size: 28px; color: var(--gold-300);
  background: radial-gradient(circle at 35% 30%, #d0303f, var(--red-700) 60%, var(--red-900));
  border: 3px solid var(--gold-500); box-shadow: 0 4px 10px rgba(0, 0, 0, .35);
  animation: seal 4s ease-in-out infinite;
}
@keyframes seal { 0%, 12% { transform: scale(1); opacity: 1; } 6% { transform: scale(1.12); } 20%, 90% { transform: scale(.4); opacity: 0; } 100% { opacity: 1; transform: scale(1); } }
.spark { position: absolute; color: var(--gold-300); font-size: 20px; animation: twinkle 1.8s ease-in-out infinite; z-index: 5; }
.s1 { left: -14px; top: 10px; } .s2 { right: -12px; top: 40px; animation-delay: .6s; } .s3 { right: 30px; bottom: -16px; animation-delay: 1.2s; }
@keyframes twinkle { 50% { opacity: .2; transform: scale(.6) rotate(30deg); } }

.toast {
  position: fixed; left: 50%; bottom: 90px; z-index: 80; transform: translate(-50%, 20px);
  background: var(--paper); color: var(--ink); font-weight: 800; padding: 12px 18px; border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transition: .25s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

#print-img { display: none; }

@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
  .preview-col { position: static; }
  .offer-grid { grid-template-columns: 1fr; }
  .mobile-bar {
    display: flex; gap: 10px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(13, 33, 23, .96); border-top: 1px solid var(--line);
  }
  .mobile-bar .btn { flex: 1; }
}
@media (max-width: 560px) {
  .hide-sm { display: none; }
  .show-sm { display: inline; }
  .brand-name { font-size: 23px; }
  .brand-sub { font-size: 14px; }
  .brand-mark { width: 40px; height: 40px; }
  .topbar { font-size: 14px; }
  .form-panel { padding: 4px 14px 10px; }
  .offer, .cross { padding: 20px; }
  .price-row .btn { width: 100%; }
  .action-btns, .action-btns .btn { width: 100%; }
  .action-btns .btn { flex: 1; width: auto; }
  .envelope { transform: scale(.9); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  @page { size: letter; margin: 0; }
  body { background: #fff; }
  body > *:not(#print-img) { display: none !important; }
  html, body { height: auto !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; background: #fff !important; }
  #print-img { display: block !important; width: auto; height: auto; max-width: 100%; max-height: 99vh; margin: 0 auto; object-fit: contain; break-inside: avoid; page-break-inside: avoid; break-after: avoid; }
}
