/* Donum Secretum — festive, warm, readable. Dark "Winternacht" by default, light "Schneetag". */
:root {
  --bg: #f6eee0;
  --bg-2: #efe2cc;
  --surface: rgba(255, 252, 245, .86);
  --surface-solid: #fffaf1;
  --paper: #fffaf0;
  --ink: #2e2019;
  --ink-soft: #6b5546;
  --muted: #8a7466;
  --line: rgba(78, 52, 36, .16);
  --red: #b3202c;
  --red-2: #d6404b;
  --gold: #b9832b;
  --gold-2: #e8b960;
  --green: #2b6a4c;
  --green-2: #3f8d67;
  --focus: #1d5fd6;
  --shadow: 0 10px 30px -12px rgba(60, 30, 10, .35), 0 2px 6px rgba(60, 30, 10, .08);
  --radius: 20px;
  --snow: 255, 255, 255;
  --hill-back: #e6d5bb;
  --hill-front: #dbc6a6;
  --aurora-a: rgba(214, 64, 75, .18);
  --aurora-b: rgba(63, 141, 103, .16);
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1526; --bg-2: #13233d;
    --surface: rgba(20, 34, 58, .78); --surface-solid: #16263f; --paper: #fbf5e8;
    --ink: #f6eedf; --ink-soft: #cdbfa9; --muted: #9a8f80; --line: rgba(246, 238, 223, .14);
    --red: #e04652; --red-2: #f0656f; --gold: #e8b960; --gold-2: #f6d58e; --green: #4fae80; --green-2: #6fcf9f;
    --focus: #8ab4ff; --shadow: 0 14px 40px -14px rgba(0, 0, 0, .7), 0 2px 8px rgba(0, 0, 0, .3);
    --hill-back: #14284a; --hill-front: #1b3359;
    --aurora-a: rgba(224, 70, 82, .16); --aurora-b: rgba(79, 174, 128, .18);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1526; --bg-2: #13233d;
  --surface: rgba(20, 34, 58, .78); --surface-solid: #16263f; --paper: #fbf5e8;
  --ink: #f6eedf; --ink-soft: #cdbfa9; --muted: #9a8f80; --line: rgba(246, 238, 223, .14);
  --red: #e04652; --red-2: #f0656f; --gold: #e8b960; --gold-2: #f6d58e; --green: #4fae80; --green-2: #6fcf9f;
  --focus: #8ab4ff; --shadow: 0 14px 40px -14px rgba(0, 0, 0, .7), 0 2px 8px rgba(0, 0, 0, .3);
  --hill-back: #14284a; --hill-front: #1b3359;
  --aurora-a: rgba(224, 70, 82, .16); --aurora-b: rgba(79, 174, 128, .18);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--font-body); font-size: 17px; line-height: 1.6;
  color: var(--ink);
  background: radial-gradient(1200px 700px at 80% -10%, var(--bg-2), transparent 70%), var(--bg);
  background-attachment: fixed;
  display: flex; flex-direction: column;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--surface-solid); padding: 8px 14px; border-radius: 10px; }
.skip-link:focus { top: 12px; }

/* ---------- background layers ---------- */
#snow { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.no-snow #snow { display: none; }
.aurora {
  position: fixed; inset: -20% -10% auto; height: 70vh; z-index: 0; pointer-events: none; filter: blur(60px);
  background: radial-gradient(40% 50% at 25% 40%, var(--aurora-a), transparent 70%), radial-gradient(40% 50% at 75% 30%, var(--aurora-b), transparent 70%);
  animation: aurora 18s ease-in-out infinite alternate;
}
@keyframes aurora { to { transform: translate3d(4%, 6%, 0) scale(1.08); } }
.hills { position: fixed; left: 0; right: 0; bottom: 0; width: 100%; height: 90px; z-index: 0; pointer-events: none; }
.hill-back { fill: var(--hill-back); opacity: .7; }
.hill-front { fill: var(--hill-front); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; white-space: nowrap; }
.brand em { color: var(--red); font-style: italic; }
.brand-star { width: 24px; height: 24px; fill: var(--gold-2); filter: drop-shadow(0 0 6px rgba(232, 185, 96, .7)); animation: twinkle 3.2s ease-in-out infinite; }
@keyframes twinkle { 50% { transform: rotate(18deg) scale(.88); opacity: .8; } }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; padding: 7px 11px; border-radius: 999px; font-weight: 700; font-size: .92rem; white-space: nowrap; color: var(--ink-soft); }
.nav a:hover { color: var(--ink); background: var(--line); }
.nav a.active { color: var(--ink); background: color-mix(in srgb, var(--red) 16%, transparent); }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--red), var(--gold)); color: #fff; font-weight: 800; font-size: .9rem; }
.nav a:has(.avatar) { padding: 3px; }
.icon-btn { border: 0; background: transparent; color: var(--ink-soft); width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--line); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.i-moon { fill: currentColor !important; stroke: none !important; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; } :root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .i-sun { display: block; } :root:not([data-theme="light"]) .i-moon { display: none; } }
@media (max-width: 560px) { .brand-text { display: none; } }

/* ---------- layout ---------- */
main { position: relative; z-index: 1; flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 8px 16px 140px; }
main:focus { outline: none; }
.footer { position: relative; z-index: 2; text-align: center; font-size: .8rem; color: var(--muted); padding: 0 16px 28px; }
.hero { text-align: center; padding: 48px 0 28px; }
.hero-sm { padding: 28px 0 16px; }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .78rem; font-weight: 800; color: var(--gold); margin: 0 0 6px; }
.title { font-family: var(--font-display); font-weight: 800; font-size: clamp(2.2rem, 7vw, 4.2rem); line-height: 1.05; margin: 0; letter-spacing: -.01em; }
.title em { color: var(--red); font-weight: 400; font-style: italic; }
.hero-sm .title { font-size: clamp(1.8rem, 5vw, 2.8rem); }
.lead { color: var(--ink-soft); font-size: 1.1rem; max-width: 40rem; margin: 12px auto 0; }
.countdown { margin: 14px 0 0; color: var(--ink-soft); font-weight: 700; }
.countdown-num { display: inline-block; font-family: var(--font-display); font-size: 2.2rem; color: var(--gold); vertical-align: -4px; min-width: 1.4ch; }
.h2 { font-family: var(--font-display); font-size: 1.8rem; margin: 0 0 8px; }
.h3, .card h2 { font-family: var(--font-display); font-size: 1.35rem; margin: 0 0 12px; font-weight: 600; }
.h4 { font-size: 1rem; margin: 18px 0 6px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.hint { color: var(--ink-soft); font-size: .93rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86rem; }
.big-emoji { font-size: 3.2rem; line-height: 1; margin-bottom: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 20px; align-items: start; }
.grid .card { margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.grow { flex: 1 1 200px; }
.stack > * + * { margin-top: 14px; }
.inline { display: inline-block; margin: 4px 4px 0 0; }
ul.plain { list-style: none; padding: 0; }

/* ---------- cards ---------- */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; margin: 0 auto 20px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.card-narrow { max-width: 480px; }
.card-paper {
  background: var(--paper); color: #2e2019; max-width: 760px;
  background-image: repeating-linear-gradient(transparent 0 31px, rgba(179, 32, 44, .07) 31px 32px);
  border: 1px solid rgba(78, 52, 36, .12);
}
.card-paper .hint, .card-paper .muted { color: #6b5546; }
.card-paper::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 8px; border-radius: var(--radius) var(--radius) 0 0;
  background: repeating-linear-gradient(135deg, var(--red) 0 14px, #fff 14px 22px, var(--green) 22px 36px, #fff 36px 44px);
}
.flash { max-width: 760px; margin: 14px auto; padding: 12px 18px; border-radius: 14px; font-weight: 700; background: color-mix(in srgb, var(--green) 18%, var(--surface-solid)); border: 1px solid color-mix(in srgb, var(--green) 40%, transparent); position: relative; z-index: 2; }
.flash-err { background: color-mix(in srgb, var(--red) 16%, var(--surface-solid)); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.notice { padding: 10px 14px; border-radius: 12px; }
.notice-warn { background: color-mix(in srgb, var(--gold) 20%, transparent); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); }
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: .85rem; background: var(--line); }
.badge-new { background: linear-gradient(90deg, var(--gold-2), var(--gold)); color: #3a2405; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(232, 185, 96, 0); } 0% { box-shadow: 0 0 0 0 rgba(232, 185, 96, .6); } }
.pill { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; background: var(--line); vertical-align: 1px; }
.pill-draft { background: color-mix(in srgb, var(--muted) 25%, transparent); }
.pill-collecting { background: color-mix(in srgb, var(--gold) 30%, transparent); }
.pill-drawn { background: color-mix(in srgb, var(--green) 30%, transparent); }
.pill-locked { background: color-mix(in srgb, var(--red) 25%, transparent); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: .92rem; }
input[type=email], input[type=text], input[type=number], input:not([type]), select, textarea {
  font: inherit; font-weight: 600; color: var(--ink); background: var(--surface-solid);
  border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; width: 100%; min-height: 48px;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: 3px solid color-mix(in srgb, var(--gold) 35%, transparent); outline-offset: 0; }
.check { display: inline-flex; gap: 10px; align-items: center; font-weight: 600; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--red); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; font-size: .92rem; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span, button.chip { padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--line); font-weight: 700; font-size: .92rem; background: var(--surface-solid); color: var(--ink); transition: all .15s; }
.chip input:checked + span { background: var(--green); color: #fff; border-color: var(--green); }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
button.chip { cursor: pointer; font: inherit; font-weight: 700; font-size: .88rem; }
button.chip-x:hover:not(:disabled) { background: var(--red); color: #fff; border-color: var(--red); }

.btn {
  --b: var(--surface-solid);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--b); color: var(--ink);
  font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--red), color-mix(in srgb, var(--red) 70%, var(--gold))); color: #fff; border-color: transparent; box-shadow: 0 8px 22px -10px var(--red); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .86rem; }
.btn-wide { width: 100%; }
.btn-magic { position: relative; overflow: hidden; }
.btn-magic::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%); transform: translateX(-100%); animation: shine 2.8s ease-in-out infinite; }
@keyframes shine { 60%, 100% { transform: translateX(100%); } }
.link { color: var(--red); font-weight: 700; text-decoration-thickness: 2px; text-underline-offset: 3px; }
details > summary { cursor: pointer; font-weight: 800; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; display: inline-block; margin-right: 8px; transition: transform .2s; color: var(--gold); }
details[open] > summary::before { transform: rotate(90deg); }
details.sub { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
details.sub > form, details.sub > p { margin-top: 14px; }
.danger-zone summary { color: var(--red); font-size: .9rem; }

/* ---------- tables / admin ---------- */
.table-wrap { overflow-x: auto; margin: 0 -8px 12px; }
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr.inactive { opacity: .5; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.table .actions form { margin: 0; }
@media (max-width: 640px) {
  .table thead { display: none; }
  .table tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 8px; border-bottom: 1px solid var(--line); }
  .table td { border: 0; padding: 2px 0; }
  .table td:nth-child(3), .table td:nth-child(4) { font-size: .82rem; color: var(--muted); }
  .table .actions { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
}
.round-list { list-style: none; padding: 0; margin: 0 0 8px; }
.round-item { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; text-decoration: none; border: 1px solid var(--line); margin-bottom: 8px; }
.round-item:hover { background: var(--line); }
.round-item strong { font-family: var(--font-display); font-size: 1.4rem; }
.round-item span:last-child { margin-left: auto; }
.excl-list { list-style: none; padding: 0; }
.excl-list li { padding: 8px 0; border-bottom: 1px dashed var(--line); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.excl-list .inline { margin: 0; }
.progress { height: 14px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 8px 0 4px; }
.progress span { display: block; height: 100%; background: repeating-linear-gradient(135deg, var(--red) 0 12px, var(--red-2) 12px 24px); border-radius: 999px; transition: width .8s; }
.card-actions > * + * { margin-top: 12px; }

/* ---------- gift reveal ---------- */
.card-gift { text-align: center; overflow: hidden; }
.gift-stage { position: relative; padding: 10px 0 0; min-height: 250px; }
.gift { position: relative; width: 150px; height: 150px; margin: 30px auto 6px; display: block; border: 0; background: none; cursor: pointer; padding: 0; }
.gift-box, .gift-lid { position: absolute; left: 50%; transform: translateX(-50%); border-radius: 10px; }
.gift-box { bottom: 0; width: 130px; height: 100px; background: linear-gradient(160deg, var(--red-2), var(--red) 60%, #8f1620); box-shadow: inset -12px -10px 0 rgba(0,0,0,.12), 0 18px 30px -12px rgba(0,0,0,.5); }
.gift-ribbon { position: absolute; left: 50%; top: 0; bottom: 0; width: 22px; transform: translateX(-50%); background: linear-gradient(90deg, var(--gold), var(--gold-2), var(--gold)); }
.gift-lid { top: 18px; width: 146px; height: 34px; z-index: 2; background: linear-gradient(160deg, var(--red-2), var(--red)); box-shadow: 0 6px 10px -4px rgba(0,0,0,.35); }
.gift-lid::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 24px; transform: translateX(-50%); background: linear-gradient(90deg, var(--gold), var(--gold-2), var(--gold)); }
.gift-bow { position: absolute; left: 50%; top: -26px; transform: translateX(-50%); width: 80px; height: 30px; }
.gift-bow i { position: absolute; top: 0; width: 38px; height: 28px; border: 7px solid var(--gold-2); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
.gift-bow i:first-child { left: 0; transform: rotate(-18deg); } .gift-bow i:last-child { right: 0; transform: rotate(18deg); }
.gift:hover .gift-lid { animation: wiggle .6s ease-in-out; }
@keyframes wiggle { 25% { transform: translateX(-50%) rotate(-4deg); } 75% { transform: translateX(-50%) rotate(4deg); } }
.gift-name { font-family: var(--font-display); font-weight: 800; font-size: clamp(2rem, 6vw, 2.8rem); margin: 0; color: var(--gold-2); opacity: 0; transform: scale(.6); text-shadow: 0 0 24px rgba(232, 185, 96, .45); }
:root[data-theme="light"] .gift-name { color: var(--red); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .gift-name { color: var(--red); } }
.gift-stage.revealed .gift-name { opacity: 1; transform: none; }
.gift-stage.revealed .hint { visibility: hidden; }
.spark { position: absolute; width: 8px; height: 8px; border-radius: 50%; pointer-events: none; left: 50%; top: 45%; }
.waiting { padding: 20px 0; }
.hourglass { font-size: 3rem; animation: flip 3s ease-in-out infinite; }
@keyframes flip { 45%, 55% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } }
.manual-change { margin-top: 16px; text-align: left; }

/* ---------- envelope ---------- */
.card-letter, .card-mine { text-align: center; }
.envelope { position: relative; width: 140px; height: 90px; margin: 14px auto 12px; background: #f3e6cc; border-radius: 6px; box-shadow: var(--shadow); overflow: hidden; }
.envelope::after { content: ""; position: absolute; inset: auto 0 0; height: 100%; background: linear-gradient(to top right, #e9d8b6 50%, transparent 50.5%) left/50% 100% no-repeat, linear-gradient(to top left, #e9d8b6 50%, transparent 50.5%) right/50% 100% no-repeat; }
.envelope-flap { position: absolute; inset: 0 0 auto; height: 55%; background: #e2cda4; clip-path: polygon(0 0, 100% 0, 50% 100%); z-index: 2; transform-origin: top; }
.envelope-seal { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 3; width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: var(--gold-2); display: grid; place-items: center; font-size: 14px; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.envelope-empty { opacity: .45; filter: grayscale(.6); }
.status { font-weight: 700; }
.status-published { color: var(--green); }
.status-changed, .status-draft { color: var(--gold); }

/* ---------- letter & editor ---------- */
.letter-body { font-family: var(--font-display); font-size: 1.12rem; line-height: 1.75; overflow-wrap: anywhere; }
.letter-body img { border-radius: 12px; margin: 8px 0; box-shadow: 0 6px 18px -8px rgba(0,0,0,.35); }
.letter-body a { color: #b3202c; font-weight: 600; }
.letter-body h1, .letter-body h2, .letter-body h3 { line-height: 1.25; margin: 1em 0 .4em; }
.letter-sign { text-align: right; font-family: var(--font-display); font-style: italic; font-size: 1.3rem; margin-top: 24px; }
.version { margin: 10px 0; padding: 10px 0; border-top: 1px dashed var(--line); }
.version summary { font-weight: 700; font-size: .95rem; }
.editor-wrap { margin: 14px 0; background: #fffdf7; border-radius: 14px; border: 1.5px solid rgba(78,52,36,.18); }
.editor-wrap .ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid rgba(78,52,36,.15); border-radius: 14px 14px 0 0; padding: 8px; position: sticky; top: 58px; z-index: 5; background: #fffaf0; flex-wrap: wrap; display: flex; }
.editor-wrap .ql-toolbar.ql-snow .ql-formats { margin-right: 10px; }
.editor-wrap .ql-toolbar button { width: 34px; height: 34px; padding: 6px; }
.editor-wrap .ql-container.ql-snow { border: 0; font-family: var(--font-display); font-size: 1.1rem; color: #2e2019; }
.editor-wrap .ql-editor { min-height: 300px; line-height: 1.7; }
.editor-wrap .ql-editor.ql-blank::before { color: #9a8573; font-style: italic; }
.editor-wrap .ql-editor img { border-radius: 10px; }
#editor:not(.ql-container) { min-height: 300px; padding: 16px; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; }
.save-state { margin-right: auto; font-size: .88rem; color: #6b5546; }
.btn-send { min-width: 220px; }
@media (max-width: 560px) { .editor-actions .btn { flex: 1 1 100%; } }

/* ---------- link previews ---------- */
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 14px 0; }
.previews:empty { display: none; }
.lp { display: flex; flex-direction: column; text-decoration: none; border-radius: 14px; overflow: hidden; background: #fff; border: 1px solid rgba(78,52,36,.14); box-shadow: 0 6px 16px -10px rgba(0,0,0,.35); color: #2e2019; transition: transform .2s; }
.lp:hover { transform: translateY(-3px) rotate(-.4deg); }
.lp img { aspect-ratio: 1.6; object-fit: cover; width: 100%; background: #f1e7d6; }
.lp div { padding: 10px 12px; }
.lp strong { display: block; font-size: .95rem; line-height: 1.3; }
.lp small { color: #8a7466; font-size: .78rem; }

/* ---------- motion ---------- */
.reveal { opacity: 1; }
.js-anim .reveal { opacity: 0; transform: translateY(18px); }
.hero-login { padding-top: 24px; }
.ornament { width: 110px; margin: 0 auto 8px; color: var(--gold); }
.orn { transform-origin: 60px 0; animation: swing 4s ease-in-out infinite; }
@keyframes swing { 50% { transform: rotate(-6deg); } 0%, 100% { transform: rotate(6deg); } }
.orn-cap { fill: var(--gold); }
.orn-ball { fill: var(--red); }
.orn-band { stroke: var(--gold-2); stroke-width: 5; fill: none; }
.orn-shine { fill: rgba(255,255,255,.35); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .js-anim .reveal { opacity: 1; transform: none; }
}

[hidden] { display: none !important; }
.card-paper .btn:not(.btn-primary) { --b: #fff; color: #2e2019; border-color: rgba(78,52,36,.2); }
.card-push { display: flex; gap: 18px; align-items: flex-start; max-width: 760px; margin-top: 20px; }
.push-bell { font-size: 2.4rem; line-height: 1; transform-origin: top center; }
.card-push.is-on .push-bell { filter: drop-shadow(0 0 10px rgba(232,185,96,.7)); }
.push-text { flex: 1; }
.push-text .row { margin-top: 8px; }

.lang-switch { margin: 0; flex: none; }
.lang-btn { position: relative; display: inline-flex; align-items: center; gap: 4px; height: 38px; padding: 0 10px 0 8px; border-radius: 999px; color: var(--ink-soft); font-weight: 800; font-size: .8rem; letter-spacing: .04em; cursor: pointer; }
.lang-btn:hover { background: var(--line); color: var(--ink); }
.lang-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.lang-btn select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; min-height: 0; padding: 0; border: 0; }
.lang-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.topbar { flex-wrap: nowrap; }
.topbar .nav { margin-left: auto; }
.tools { display: flex; align-items: center; gap: 2px; flex: none; }
.nav a { display: inline-flex; align-items: center; gap: 6px; }
.nav-ico, .nav-label { display: none; }
@media (max-width: 720px) {
  .has-tabs .nav {
    position: fixed; z-index: 30; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); margin: 0;
    display: flex; justify-content: space-around; gap: 0; padding: 6px;
    border-radius: 22px; border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
    backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
    box-shadow: 0 12px 30px -10px rgba(0,0,0,.45);
  }
  .has-tabs .nav a { flex: 1 1 0; flex-direction: column; gap: 1px; padding: 6px 4px; border-radius: 16px; font-size: .7rem; min-width: 0; text-align: center; }
  .has-tabs .nav a > span:last-child { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .has-tabs .nav-ico { display: block; font-size: 1.25rem; line-height: 1.2; }
  .has-tabs .nav-label { display: block; }
  .has-tabs .nav a:has(.avatar) { padding: 6px 4px; }
  .has-tabs .nav .avatar { width: 26px; height: 26px; font-size: .8rem; }
  .has-tabs ~ main { padding-bottom: 170px; }
  .has-tabs ~ .footer { padding-bottom: 100px; }
  .topbar .tools { margin-left: auto; }
}
@media (max-width: 720px) {
  /* backdrop-filter would make the fixed tab bar relative to the header */
  .topbar.has-tabs { backdrop-filter: none; -webkit-backdrop-filter: none; background: color-mix(in srgb, var(--bg) 94%, transparent); }
}

/* =================== festive layer =================== */
:root { --b0: #ff4d5e; --b1: #ffd166; --b2: #4fd18b; --b3: #6cc4ff; --wire: #2d4a3a; --cap: #ffffff; --tree: #24553f; --tree-2: #1c4533; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --wire: #31503f; --tree: #173d2d; --tree-2: #12301f; } }
:root[data-theme="dark"] { --wire: #31503f; --tree: #173d2d; --tree-2: #12301f; }

/* Light mode gets a wintry sky so white snow is visible */
body { background:
  radial-gradient(1200px 700px at 80% -10%, var(--bg-2), transparent 70%),
  linear-gradient(180deg, var(--sky-top, transparent), transparent 60%),
  var(--bg); background-attachment: fixed; }
:root { --sky-top: #b9cfe6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --sky-top: #070f1d; } }
:root[data-theme="dark"] { --sky-top: #070f1d; }

/* garland */
.topbar { position: sticky; }
.garland { position: absolute; left: 0; right: 0; bottom: -26px; height: 30px; pointer-events: none; z-index: 1; }
.garland svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.garland path { fill: none; stroke: var(--wire); stroke-width: 2.2; vector-effect: non-scaling-stroke; }
.garland i { position: absolute; left: var(--x); top: 9px; width: 9px; height: 14px; margin-left: -4.5px; border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  background: var(--c); box-shadow: 0 0 10px 2px var(--c), 0 0 22px 4px color-mix(in srgb, var(--c) 45%, transparent);
  animation: bulb 2.4s ease-in-out infinite; animation-delay: var(--d); }
.garland i:nth-child(odd) { top: 3px; }
.garland i::before { content: ""; position: absolute; left: 2px; right: 2px; top: -3px; height: 4px; border-radius: 1px; background: #556; }
@keyframes bulb { 0%, 100% { opacity: 1; filter: brightness(1.15); } 50% { opacity: .45; filter: brightness(.7); box-shadow: 0 0 4px 1px var(--c); } }
@media (max-width: 720px) { .garland i:nth-child(3n) { display: none; } }

/* trees & cabin on the hills */
.trees { position: fixed; left: 0; right: 0; bottom: 0; width: 100%; height: 130px; z-index: 0; pointer-events: none; }
.trees .fir { fill: var(--tree); } .trees .trunk { fill: #4a3424; } .trees .fir-snow, .trees .roof-snow { fill: var(--cap); opacity: .92; }
.trees .cabin path:first-child { fill: #6b3b2a; } .trees .win { fill: #ffd27a; filter: drop-shadow(0 0 6px #ffcc66); animation: flicker 4s infinite; }
@keyframes flicker { 0%, 100% { opacity: 1; } 47% { opacity: .85; } 50% { opacity: .65; } 53% { opacity: .95; } }
.hills { height: 100px; }

/* snow caps on cards */
.card::after { content: ""; position: absolute; left: 18px; right: 18px; top: -7px; height: 16px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 16' preserveAspectRatio='none'%3E%3Cpath d='M0 7 C8 0 18 0 26 5 C33 1 44 0 52 6 C60 2 70 1 78 7 C86 2 98 0 106 6 C114 1 126 1 134 7 C142 2 152 0 160 6 C168 1 180 1 188 6 C193 3 198 4 200 7 L200 10 C196 15 188 14 182 11 C174 16 162 15 156 11 C146 16 136 15 128 11 C118 16 108 15 100 11 C90 16 80 16 72 11 C62 16 52 15 44 11 C34 16 24 15 16 11 C10 15 3 14 0 10Z' fill='white'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  filter: drop-shadow(0 2px 2px rgba(80, 110, 150, .25)); }
.card-gift { overflow: visible; }
.card-paper::after { left: 30px; right: 30px; top: -6px; }

/* holly decoration */
.deco-holly::before { content: ""; position: absolute; width: 74px; height: 56px; right: -10px; top: -18px; z-index: 2; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 74 56'%3E%3Cpath d='M36 30 C30 20 18 22 8 14 C12 22 6 26 2 30 C10 30 14 36 12 44 C20 38 28 40 36 30Z' fill='%232b6a4c'/%3E%3Cpath d='M38 30 C44 18 56 18 66 8 C64 18 70 22 74 26 C66 28 62 34 64 42 C56 36 46 40 38 30Z' fill='%23367d5a'/%3E%3Cpath d='M36 30 L8 14 M38 30 L66 8' stroke='%231c4533' stroke-width='1.2'/%3E%3Ccircle cx='33' cy='33' r='6' fill='%23d6283a'/%3E%3Ccircle cx='42' cy='35' r='6' fill='%23e23a4b'/%3E%3Ccircle cx='37' cy='26' r='5.5' fill='%23c41f30'/%3E%3Ccircle cx='31' cy='31' r='1.6' fill='%23fff' opacity='.7'/%3E%3Ccircle cx='40' cy='33' r='1.6' fill='%23fff' opacity='.7'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.3)); }

/* shimmering title accent */
.title em { background: linear-gradient(100deg, var(--red) 20%, var(--gold-2) 45%, var(--red) 70%); background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 6s ease-in-out infinite; }
@keyframes shimmer { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
.hero { position: relative; }
.hero::before, .hero::after { content: "✦"; position: absolute; color: var(--gold-2); font-size: 1.3rem; opacity: .8; animation: twinkle 2.6s ease-in-out infinite; pointer-events: none; }
.hero::before { left: 12%; top: 30%; } .hero::after { right: 14%; top: 18%; font-size: .9rem; animation-delay: 1.1s; }
.eyebrow::before, .eyebrow::after { content: " ❄ "; color: var(--muted); }

/* cards: subtle gold inner frame */
.card { box-shadow: var(--shadow), inset 0 0 0 1px color-mix(in srgb, var(--gold) 18%, transparent); }
.footer span::before { content: "🎄 "; } .footer span::after { content: " 🎄"; }
/* trees: two clusters anchored left/right so they survive narrow screens */
.trees { position: fixed; inset: auto 0 0 0; height: 140px; width: auto; z-index: 0; pointer-events: none; }
.trees svg { position: absolute; bottom: 0; height: 140px; width: auto; }
.trees-l { left: 0; } .trees-r { right: 0; }
@media (max-width: 720px) { .trees svg { height: 96px; } .has-tabs ~ .trees svg, .trees svg { opacity: .9; } }
:root { --tree: #2e6b4f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --tree: #24583f; } }
:root[data-theme="dark"] { --tree: #24583f; }
:root { --sky-top: #a7c2e0; }
body { background:
  radial-gradient(1200px 700px at 80% -10%, var(--bg-2), transparent 70%),
  linear-gradient(180deg, var(--sky-top), transparent 75%),
  var(--bg); background-attachment: fixed; }
