:root {
  --paper: #faf5ec;
  --paper-2: #f3ebdd;
  --card: #fffdf8;
  --ink: #20242c;
  --muted: #5b6270;
  --line: #e6dccb;
  --red: #b8322a;
  --red-2: #9c2820;
  --green: #2f5d46;
  --gold: #e9b949;
  --radius: 14px;
  --serif: "Young Serif", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.6 var(--sans); }
img, svg { max-width: 100%; }
a { color: var(--red); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.5em; text-wrap: balance; }
h1 { font-size: clamp(2.3rem, 6vw, 3.6rem); }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; text-wrap: pretty; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 99; background: #fff; padding: 8px 12px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.wrap-text { max-width: 720px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 620px; margin: 0 auto; padding: 0 16px; }
.center { text-align: center; }
.fine { font-size: 0.85rem; color: var(--muted); }
.kicker, .eyebrow { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--red); margin-bottom: 0.6em; }
.lede { font-size: 1.15rem; color: #3b404a; }
.h1-sub { display: block; font-size: 0.42em; line-height: 1.3; color: #5b6270; margin-top: 0.35em; letter-spacing: 0; }

/* Header and footer */
.top { border-bottom: 1px solid var(--line); background: var(--paper); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 1.15rem; }
.top nav { display: flex; gap: 18px; font-size: 0.95rem; }
.top nav a { color: var(--ink); text-decoration: none; }
.top nav a:hover { color: var(--red); }
@media (max-width: 640px) { .top nav a:not(:first-child) { display: none; } .brand span { font-size: 1.05rem; } }
.bottom { margin-top: 40px; padding: 40px 0 50px; border-top: 1px solid var(--line); background: var(--paper-2); font-size: 0.95rem; color: var(--muted); }
.bottom-brand { font-family: var(--serif); font-size: 1.2rem; color: var(--ink); margin-bottom: 0.3em; }
.bottom nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 14px 0; }
.bottom nav a { color: var(--ink); }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); font: 600 0.98rem/1.2 var(--sans); text-decoration: none; cursor: pointer; transition: transform .1s ease, background .15s ease; }
.btn:hover { background: rgba(0,0,0,.04); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-2); }
.btn-big { min-height: 54px; padding: 14px 26px; font-size: 1.08rem; }
.btn-wide { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.btn-row.center { justify-content: center; }
.link-btn { background: none; border: 0; padding: 6px 2px; color: var(--muted); font: inherit; font-size: 0.95rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn.danger { color: var(--red); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: 0 1px 0 rgba(0,0,0,.03), 0 10px 30px -18px rgba(60,40,20,.25); }
.field { display: grid; gap: 6px; margin-bottom: 14px; position: relative; }
label, legend { font-weight: 600; font-size: 0.95rem; }
input[type="text"], input:not([type]), textarea, select { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; }
input:focus, textarea:focus, select:focus, .btn:focus-visible, .door:focus-visible { outline: 3px solid rgba(184,50,42,.35); outline-offset: 2px; border-color: var(--red); }
textarea { resize: vertical; min-height: 110px; }
.form-error { color: var(--red); font-weight: 600; font-size: 0.95rem; margin: 6px 0 10px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 400; margin: 4px 0 12px; }
.check input { width: 20px; height: 20px; accent-color: var(--red); }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }

/* Create form */
.create { display: grid; gap: 4px; }
.create .mode { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--paper-2); border-radius: 999px; padding: 5px; margin-bottom: 16px; }
.create .mode button { border: 0; background: transparent; border-radius: 999px; padding: 10px 8px; font: 600 0.9rem/1.2 var(--sans); color: var(--muted); cursor: pointer; }
.create .mode button[aria-checked="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.create[data-mode="friends"] .only-gift, .create[data-mode="gift"] .only-friends { display: none; }
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.themes legend { margin-bottom: 8px; }
.swatch { display: grid; justify-items: center; gap: 6px; padding: 10px 6px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 500; font-size: 0.85rem; text-align: center; }
.swatch input { position: absolute; opacity: 0; }
.swatch-chip { width: 44px; height: 32px; border-radius: 8px; }
.swatch-night .swatch-chip { background: linear-gradient(#22335a, #0e1730); box-shadow: inset 0 0 0 3px #f5eddd; }
.swatch-pine .swatch-chip { background: linear-gradient(#2a5241, #12281e); box-shadow: inset 0 0 0 3px #f7f0e3; }
.swatch-cocoa .swatch-chip { background: linear-gradient(#73463a, #3a2017); box-shadow: inset 0 0 0 3px #f8ecda; }
.swatch:has(input:checked) { border-color: var(--ink); background: #fff; }
.swatch:has(input:focus-visible) { outline: 3px solid rgba(184,50,42,.35); }
.create .fine { text-align: center; margin: 8px 0 0; }
.mine { margin-top: 16px; }
.mine-h { font-weight: 700; font-size: 0.9rem; margin-bottom: 6px; }
.mine ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.mine a { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; }
.mine-role { color: var(--muted); font-size: 0.88rem; }

/* Home */
.hero { position: relative; overflow: hidden; padding: 40px 0 52px; color: #fff; background: linear-gradient(var(--bg1), var(--bg2)); }
.hero-in { position: relative; }
.hero h1 { color: #fff; }
.hero .eyebrow { color: var(--accent); }
.hero .h1-sub { color: rgba(255,255,255,.72); }
.hero .lede { color: rgba(255,255,255,.86); }
.hero .mine-h { color: #fff; }
.hero .card { color: var(--ink); }
.preview { margin: 22px 0 0; pointer-events: none; }
.preview .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.preview .door { aspect-ratio: 1 / 1.08; padding: 4px; }
.preview .door.empty .door-n { font-size: clamp(1rem, 3.6vw, 1.35rem); }
.preview .door-n { font-size: .8rem; top: 4px; left: 6px; }
.preview .door-st { font-size: clamp(1.1rem, 4.2vw, 1.6rem); }
.preview .door-from { font-size: .58rem; bottom: 3px; }
.preview figcaption { margin-top: 10px; font-size: .8rem; color: rgba(255,255,255,.6); }
.hero-in { display: grid; gap: 34px; align-items: start; }
@media (max-width: 899px) { .hero-copy { display: contents; } .hero-in { gap: 18px; } .hero-copy .preview { order: 3; margin-top: 8px; } .hero-form { order: 2; } .hero .lede { font-size: 1.05rem; margin-bottom: 0; } .hero h1 { margin-bottom: .3em; } }
@media (max-width: 420px) { .create .mode button { font-size: .82rem; padding: 10px 4px; } }
@media (min-width: 900px) { .hero-in { grid-template-columns: 1.05fr 1fr; gap: 56px; padding-top: 18px; align-items: center; } }
.ticks { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; }
.ticks li { padding-left: 30px; position: relative; }
.ticks li::before { content: ""; position: absolute; left: 0; top: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 10.5l3 3 6-7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat; }
.sec { padding: 56px 0; }
.sec-alt { background: var(--paper-2); }
.steps { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 18px; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.steps li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; position: relative; }
.step-n { display: inline-grid; place-items: center; width: 40px; height: 48px; border-radius: 8px 8px 4px 4px; background: var(--red); color: #fff; font-family: var(--serif); font-size: 1.3rem; margin-bottom: 12px; box-shadow: inset 0 -6px 0 rgba(0,0,0,.15); }
.two { display: grid; gap: 18px; }
@media (min-width: 760px) { .two { grid-template-columns: 1fr 1fr; } }
.two-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.prose h2 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 0.45em; }
.ideas li::marker { color: var(--red); font-weight: 700; }
.faqs { display: grid; gap: 10px; margin-top: 12px; }
details.faq { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 18px; }
details.faq summary { cursor: pointer; font-weight: 600; padding: 15px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--red); }
details.faq[open] summary::after { content: "–"; }
details.faq > div p:last-child { margin-bottom: 16px; }
.cta { padding: 60px 0; background: #1d2c4f; color: #fff; text-align: center; }
.cta h2 { color: #fff; }
.cta p { color: rgba(255,255,255,.8); }
.code-form { display: grid; gap: 10px; margin: 26px 0 36px; }
.code-form input { font-family: var(--serif); font-size: 1.6rem; letter-spacing: 0.12em; text-align: center; text-transform: uppercase; }

/* Calendar board */
.cal-page .bottom { margin-top: 20px; }
.board { --bg1: #22335a; --bg2: #0e1730; --door: #f5eddd; --door-ink: #1d2c4f; --accent: #e9b949; position: relative; overflow: hidden; color: #fff; background: linear-gradient(var(--bg1), var(--bg2)); padding: 30px 0 34px; }
.theme-night { --bg1: #22335a; --bg2: #0e1730; --door: #f5eddd; --door-ink: #1d2c4f; --accent: #e9b949; }
.theme-pine { --bg1: #2a5241; --bg2: #12281e; --door: #f7f0e3; --door-ink: #1f3d30; --accent: #ef6a5e; }
.theme-cocoa { --bg1: #73463a; --bg2: #3a2017; --door: #f8ecda; --door-ink: #4a2a1d; --accent: #f0b067; }
.snow { position: absolute; inset: 0; pointer-events: none; opacity: .5; background-image: radial-gradient(2px 2px at 20px 30px, #fff 50%, transparent 51%), radial-gradient(3px 3px at 120px 80px, #fff 50%, transparent 51%), radial-gradient(2px 2px at 200px 150px, #fff 50%, transparent 51%), radial-gradient(2.5px 2.5px at 60px 190px, #fff 50%, transparent 51%); background-size: 240px 240px; animation: snow 18s linear infinite; }
@keyframes snow { to { background-position: 0 240px, 30px 240px, -20px 240px, 10px 240px; } }
@media (prefers-reduced-motion: reduce) { .snow { animation: none; } }
.board-in { position: relative; max-width: 760px; margin: 0 auto; padding: 0 14px; }
.board-head { text-align: center; margin-bottom: 20px; }
.board-kicker { color: var(--accent); font-weight: 700; font-size: 0.8rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 6px; }
.board h1 { color: #fff; font-size: clamp(1.9rem, 6vw, 2.8rem); margin-bottom: 6px; }
.board-sub { color: rgba(255,255,255,.82); margin: 0; }
.board-tz { text-align: center; font-size: .8rem; color: rgba(255,255,255,.6); margin: 16px 0 0; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; } }
.grid:empty::before { content: ""; grid-column: 1 / -1; height: 420px; border-radius: 14px; background: rgba(255,255,255,.06); }
.door { position: relative; min-width: 0; aspect-ratio: 3 / 3.6; border-radius: 12px; border: 0; padding: 8px; cursor: pointer; font: inherit; color: #fff; background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.28); display: grid; place-items: center; transition: transform .15s ease, background .15s ease; -webkit-tap-highlight-color: transparent; }
.door:hover { transform: translateY(-2px); }
.door-n { position: absolute; top: 6px; left: 9px; font-family: var(--serif); font-size: 1.15rem; line-height: 1; }
.door.empty .door-n { position: static; font-size: 1.6rem; opacity: .9; }
.door.filled { background: var(--door); color: var(--door-ink); box-shadow: 0 6px 0 -2px rgba(0,0,0,.25), inset 0 0 0 1.5px rgba(0,0,0,.06); }
.door-st { font-family: var(--emoji); font-size: clamp(1.6rem, 6vw, 2.1rem); line-height: 1; }
.door-from { position: absolute; bottom: 6px; left: 6px; right: 6px; font-size: .68rem; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .8; }
.door.mine { box-shadow: 0 6px 0 -2px rgba(0,0,0,.25), inset 0 0 0 3px var(--accent); }
.door-lock { position: absolute; top: 8px; right: 8px; width: 10px; height: 10px; border-radius: 3px; background: currentColor; opacity: .35; }
.door-locked { font-size: clamp(1.2rem, 4.5vw, 1.5rem); opacity: .55; }
.door.today { outline: 3px solid var(--accent); outline-offset: 2px; }
.door.ready.new { animation: glow 1.8s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(255,255,255,.25), 0 6px 0 -2px rgba(0,0,0,.25); } }
@media (prefers-reduced-motion: reduce) { .door.ready.new { animation: none; } }
.panel-wrap { padding: 22px 0 10px; }
#panel { display: grid; gap: 14px; }
#panel h2 { font-size: 1.35rem; }
.card-hi { border-color: var(--red); box-shadow: 0 0 0 3px rgba(184,50,42,.12); }
.card-quiet { background: transparent; box-shadow: none; }
.linkbox { display: flex; gap: 8px; margin: 6px 0 4px; }
.linkbox input { min-width: 0; font-size: 15px; padding: 10px 12px; color: var(--muted); }
.code { font-family: var(--serif); letter-spacing: .06em; color: var(--ink); background: var(--paper-2); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }

/* Sheet */
.sheet { width: min(560px, calc(100% - 20px)); max-height: calc(100dvh - 20px); border: 0; border-radius: 18px; padding: 14px 20px 22px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.sheet::backdrop { background: rgba(10,15,30,.6); }
.sheet-close-row { display: flex; justify-content: flex-end; margin: 0 -8px 0 0; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; font-size: 1.1rem; cursor: pointer; color: var(--muted); }
.fill h2 { font-size: 1.45rem; margin-top: -6px; padding-right: 30px; }
.fill-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.fill-row select { width: auto; padding: 8px 12px; }
.stickers { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.stickers legend { margin-bottom: 8px; }
.st { display: grid; place-items: center; aspect-ratio: 1; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-family: var(--emoji); font-size: 1.5rem; }
.st input { position: absolute; opacity: 0; }
.st:has(input:checked) { border-color: var(--red); background: #fff2ef; box-shadow: 0 0 0 2px rgba(184,50,42,.25); }
.st:has(input:focus-visible) { outline: 3px solid rgba(184,50,42,.35); }
.counter { position: absolute; right: 10px; bottom: 8px; font-size: .78rem; color: var(--muted); }
.note-card { background: linear-gradient(var(--bg1), var(--bg2)); border-radius: 16px; padding: 14px; margin-bottom: 14px; animation: pop .35s ease; }
.note-card > * { background: var(--door); color: var(--door-ink); margin: 0; padding: 0 20px; text-align: center; }
.note-card > :first-child { border-radius: 12px 12px 0 0; padding-top: 22px; }
.note-card > :last-child { border-radius: 0 0 12px 12px; padding-bottom: 26px; }
.note-st { font-family: var(--emoji); font-size: 3.4rem; line-height: 1.1; }
.note-door { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding-top: 8px !important; color: color-mix(in srgb, var(--door-ink) 65%, transparent) !important; }
.note-from { font-size: 1.15rem; padding-top: 2px !important; padding-bottom: 8px !important; }
.note-text { font-family: var(--serif); font-size: 1.3rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
@keyframes pop { from { transform: scale(.94) rotateX(25deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .note-card { animation: none; } }
.toast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; max-width: min(520px, calc(100% - 24px)); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: .95rem; box-shadow: 0 12px 30px rgba(0,0,0,.3); }
.ts-box { position: fixed; right: 12px; bottom: 12px; z-index: 60; }
.warn { background: #fff4d6; border: 1px solid #f0d58a; color: #5a4300; border-radius: 10px; padding: 10px 12px; font-size: .92rem; }
.create .form-alt { margin-top: 2px; }
