/* Christmas Mornings — vintage editorial pen-and-ink.
   Ivory paper, thin shaky ink, flat spot colour (tomato, pine, cream, powder blue, butter, chocolate).
   No gradients, glows or shading; hatching instead. Lettering by hand (Gaegu), codes typed (Special Elite). */
:root {
  --ivory: #fbf6ec; --ink: #1c1a19; --ink-soft: #5b534c;
  --tomato: #e0553b; --tomato-d: #b9402c; --pine: #3d6a48; --pine-l: #86a774;
  --cream: #f5e8d3; --blue: #a8c6df; --butter: #f2cf6a; --choc: #6b4430;
  --hand: "Gaegu", "Comic Sans MS", cursive;
  --typed: "Special Elite", "Courier New", monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--ivory); color: var(--ink); font: 400 19px/1.45 var(--hand); overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
/* waiting: the painted town at night, a soft glowing star, one line */
.hush { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; margin: 0; padding: 0 24px; text-align: center;
  background: linear-gradient(rgba(12, 26, 24, .55), rgba(12, 26, 24, .75)), url("assets/themes/christmas/town-portrait.webp") center bottom / cover, #17312f;
  color: #f6eedd; font: 400 1.9rem/1.2 "Yesteryear", "Libre Caslon Text", Georgia, serif; text-shadow: 0 2px 10px rgba(0, 0, 0, .6); }
.hush::before { content: ""; width: 64px; height: 69px; background: url("assets/themes/christmas/ui/star-painted.webp") center / contain no-repeat; filter: drop-shadow(0 0 16px rgba(255, 214, 140, .75));
  animation: hushglow 1.6s ease-in-out infinite alternate; }
@keyframes hushglow { from { transform: scale(.88) rotate(-6deg); opacity: .7; } to { transform: scale(1.06) rotate(6deg); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hush::before { animation: none; } }
:focus-visible { outline: 2px dashed var(--ink); outline-offset: 4px; }
a { color: inherit; }
.center { justify-self: center; text-align: center; }
.hand { font-family: var(--hand); }
.story { font-family: var(--hand); }

/* ---------- the illustration ---------- */
.scene { position: relative; margin: 0 auto; width: min(100%, 600px); aspect-ratio: 600 / 1600; }
.layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.door { cursor: pointer; pointer-events: auto; outline: none; }
.door .obj { transform-box: view-box; transition: transform .4s cubic-bezier(.3, 1.5, .5, 1); }
.door .num { font-family: var(--hand); font-weight: 700; }
.door .mark, .door .ring, .door .tw, .door .cane, .door .rays { opacity: 0; transition: opacity .3s; }
.door .lid { transform-box: view-box; transition: transform .5s cubic-bezier(.3, 1.5, .5, 1); }
.door:focus-visible .ring { opacity: 1; }
/* small movements only */
.k-balloon .obj { animation: bob 4s ease-in-out infinite; }
.door[data-day="9"] .obj { animation-delay: -1.3s; } .door[data-day="12"] .obj { animation-duration: 5s; }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-2deg); } }
.door:hover .obj, .door:focus-visible .obj { animation: wiggle .7s ease-in-out; }
@keyframes wiggle { 25% { transform: rotate(-5deg) } 55% { transform: rotate(4deg) } 80% { transform: rotate(-1deg) } }
.smoke { animation: drift 4s ease-in-out infinite; transform-box: fill-box; transform-origin: bottom; }
@keyframes drift { 50% { transform: translateX(3px) scaleY(1.06); } }
.fest { opacity: .35; transition: opacity .6s; }
.fest.on { opacity: 1; }
.fest:not(.on) ellipse, .fest:not(.on) circle { fill: var(--ivory); }
/* states */
.door.ready .tw { animation: tick 1.4s steps(2) infinite; }
@keyframes tick { 0% { opacity: 0 } 50% { opacity: 1 } }
.door.ready .obj { animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 0%, 70%, 100% { transform: none } 78% { transform: rotate(-4deg) } 86% { transform: rotate(3deg) } }
.door.opened .mark { opacity: 1; }
.door.opened.k-present .lid { transform: translate(-6px, -16px) rotate(-14deg); }
.door.opened.k-stocking .cane { opacity: 1; }
.door.opened.k-star .rays { opacity: 1; }
.door.opened.k-house .hw { fill: var(--butter); }
.door.no .obj { animation: no .4s ease-in-out !important; }
@keyframes no { 25% { transform: translateX(-4px) } 50% { transform: translateX(4px) } 75% { transform: translateX(-2px) } }
.door.popping .obj { animation: pop .5s cubic-bezier(.3, 1.6, .5, 1) !important; }
@keyframes pop { 40% { transform: scale(1.18) rotate(-4deg) } }
.door.edit .ring { opacity: .8; }
.door.edit.filled .ring { opacity: 0; }
.door.edit.filled .mark { opacity: 1; }
.door.edit.filled.k-present .lid { transform: translate(-3px, -8px) rotate(-7deg); }
.door.deco { pointer-events: none; cursor: default; }
.door.deco .num { opacity: .0; }

/* confetti and the "not yet" tag */
.spark { position: fixed; left: 0; top: 0; width: 10px; height: 10px; pointer-events: none; z-index: 60; background: var(--tomato); border: 1.5px solid var(--ink);
  animation: burst .8s cubic-bezier(.2, .7, .3, 1) forwards; }
.spark:nth-child(3n) { background: var(--butter); border-radius: 50%; } .spark:nth-child(3n+1) { background: var(--blue); }
@keyframes burst { 0% { transform: translate(var(--x0), var(--y0)) scale(.3) rotate(0); opacity: 1 } 100% { transform: translate(calc(var(--x0) + var(--dx)), calc(var(--y0) + var(--dy))) scale(var(--s)) rotate(200deg); opacity: 0 } }
.nudge { position: fixed; z-index: 61; pointer-events: none; font: 700 1.05rem var(--hand); color: var(--ink); background: var(--ivory); border: 1.5px solid var(--ink);
  padding: 3px 12px 3px 20px; transform: translate(-50%, -130%) rotate(-4deg); clip-path: polygon(12px 0, 100% 0, 100% 100%, 12px 100%, 0 50%); animation: nudgein 2.2s ease forwards; white-space: nowrap; }
@keyframes nudgein { 0% { opacity: 0 } 10% { opacity: 1 } 80% { opacity: 1 } 100% { opacity: 0 } }

/* ---------- lettering and buttons ---------- */
.painted { font: 700 clamp(2.6rem, 13vw, 4.4rem)/.9 var(--hand); color: var(--ink); margin: 0; text-wrap: balance; }
.ribbon {
  display: inline-block; cursor: pointer; text-decoration: none; font: 700 1.25rem/1 var(--hand); color: var(--ivory);
  background: var(--tomato); border: 1.6px solid var(--ink); padding: 11px 30px 10px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 50%, 100% 100%, 0 100%, 12px 50%);
  transform: rotate(-2deg); transition: transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
.ribbon:hover { transform: rotate(1deg) scale(1.04); }
.ribbon[disabled] { opacity: .6; cursor: progress; }
.ribbon.green { background: var(--pine); }
.scribble { background: none; border: 0; padding: 2px 0; cursor: pointer; font: 400 1.1rem var(--hand); color: inherit; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.scribble:hover { color: var(--tomato); }

/* ---------- home ---------- */
.backdrop { position: relative; width: 100%; }
.home { position: relative; padding-block: max(28px, env(safe-area-inset-top, 0px)) 60px; display: grid; gap: 26px; justify-items: center; }
.titlecard { width: min(100%, 600px); display: grid; justify-items: start; gap: 6px; }
.titlecard .presents { font-size: 1rem; color: var(--ink-soft); }
.titlecard h1 { transform: rotate(-4deg); transform-origin: left; }
.titlecard h1 span { display: block; color: var(--tomato); margin-left: .8em; }
.flourish { width: 180px; height: 22px; }
.titlecard .sub { margin: 2px 0 10px; max-width: 28ch; }
.hello { margin: 0; color: var(--ink-soft); }
.signin-note { font-size: .95rem; color: var(--ink-soft); }
.modeflag { font-size: .9rem; color: var(--ink-soft); margin: 0; }
.shelf { width: min(100%, 600px); display: grid; gap: 8px; }
.shelf h2 { font: 700 1.5rem var(--hand); margin: 0; }
.twine { display: flex; flex-wrap: wrap; gap: 16px 14px; padding-top: 6px; }
.tag { position: relative; display: grid; gap: 0; text-decoration: none; color: var(--ink); width: 160px; min-height: 84px; padding: 10px 12px 10px 28px;
  background: var(--cream); border: 1.6px solid var(--ink); clip-path: polygon(18px 0, 100% 0, 100% 100%, 18px 100%, 0 50%);
  transform: rotate(var(--r, -2deg)); transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.tag::before { content: ""; position: absolute; left: 11px; top: calc(50% - 4px); width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--ivory); }
.tag:hover, .tag:focus-visible { transform: rotate(0) translateY(-2px); }
.tag b { font: 700 1.1rem/1.1 var(--hand); overflow-wrap: anywhere; }
.tag small { font-size: .9rem; color: var(--ink-soft); }
.tag.new { background: var(--ivory); border-style: dashed; place-items: center; }
.tag.new b { color: var(--tomato); }
.emptynote { color: var(--ink-soft); margin: 0; }
.signout { font-size: .95rem; color: var(--ink-soft); }

/* ---------- pages on paper ---------- */
.leaf { position: relative; color: var(--ink); background: var(--ivory); border: 1.6px solid var(--ink); padding: 28px 22px 24px; }
.leaf .holly { position: absolute; width: 58px; height: 48px; pointer-events: none; }
.leaf .holly.tl { left: 6px; top: -18px; transform: rotate(-12deg); }
.leaf .holly.br { right: 6px; bottom: -14px; transform: rotate(170deg); }
.storyform { width: min(100% - 32px, 560px); margin: 0 auto; display: grid; gap: 14px; font-size: 1.3rem; line-height: 1.8; box-shadow: 6px 6px 0 var(--cream); }
.storyform h1 { font: 700 2.2rem/1 var(--hand); color: var(--tomato); margin: 0; }
.storyform p { margin: 0; }
.line { font: 700 1.3rem var(--hand); color: var(--tomato-d); background: transparent; border: 0; border-bottom: 1.6px solid var(--ink); padding: 0 4px; min-width: 6ch; max-width: 100%; border-radius: 0; }
.line:focus { outline: none; background: var(--cream); }
.line.wide { width: 100%; }
select.line { cursor: pointer; }
textarea.line { width: 100%; min-height: 150px; resize: vertical; border: 0; line-height: 32px; padding: 0 4px; font-weight: 400;
  background: repeating-linear-gradient(180deg, transparent 0 31px, rgba(28, 26, 25, .35) 31px 32px); }
.counter { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; }
.block { width: 36px; height: 36px; border: 1.6px solid var(--ink); cursor: pointer; font: 700 1.4rem/1 var(--hand); color: var(--ivory); background: var(--pine); transform: rotate(-4deg); }
.block + output + .block { background: var(--tomato); transform: rotate(3deg); }
.counter output { font: 700 2.1rem/1 var(--hand); color: var(--tomato); min-width: 2ch; text-align: center; }
.aside { font-size: 1rem; color: var(--ink-soft); }
.err { color: var(--tomato-d); font-weight: 700; font-size: 1.05rem; min-height: 1.3em; margin: 0; line-height: 1.3; }
.formend { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.formend .scribble { color: var(--ink-soft); }

/* ---------- calendar page ---------- */
.calpage { padding-block: max(16px, env(safe-area-inset-top, 0px)) 30px; display: grid; gap: 10px; }
.topnav { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 600px; width: 100%; margin: 0 auto; }
.marquee { width: min(100%, 600px); margin: 0 auto; display: grid; justify-items: start; gap: 2px; }
.marquee .from { font-size: 1rem; color: var(--ink-soft); }
.marquee h1 { font-size: clamp(2.2rem, 10vw, 3.4rem); transform: rotate(-3deg); transform-origin: left; max-width: 14ch; }
.countdown { margin: 4px auto 0; width: min(100% - 32px, 568px); color: var(--ink-soft); }
.pinned { position: relative; width: min(100% - 32px, 520px); margin: 4px auto 0; display: grid; gap: 6px; font-size: 1.02rem; line-height: 1.4;
  background: var(--cream); border: 1.6px solid var(--ink); padding: 14px 16px 12px; transform: rotate(-1deg); }
.pinned b { color: var(--tomato-d); }
.pinned .row { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; }
.pinned label { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.pinned input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--tomato); }
.sharelink { font: .82rem var(--typed); background: var(--ivory); border: 1px solid var(--ink); padding: 3px 7px; overflow-wrap: anywhere; user-select: all; }

/* ---------- the book (a surprise opening / the editor) ---------- */
dialog.book { border: 0; padding: 0; background: transparent; width: min(100% - 24px, 540px); max-height: 90svh; overflow: visible; color: var(--ink); }
dialog.book::backdrop { background: rgba(251, 246, 236, .82); }
dialog.book[open] .leaf { animation: unfold .45s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes unfold { 0% { transform: scale(.7) rotate(-4deg); opacity: 0 } 100% { transform: rotate(-.6deg) } }
dialog.book .leaf { max-height: 90svh; overflow-y: auto; padding: 34px 20px 24px; display: grid; gap: 14px; box-shadow: 7px 7px 0 var(--tomato); }

.datehead { text-align: center; display: grid; justify-items: center; }
.datehead .big { font: 700 4rem/1 var(--hand); color: var(--tomato); }
.datehead .of { font-size: 1rem; color: var(--ink-soft); }
.datehead h2 { font: 700 1.5rem/1.15 var(--hand); margin: 6px 0 0; text-wrap: balance; overflow-wrap: anywhere; }
.field { display: grid; gap: 0; }
.field > label, .field > .lbl, .lbl { font-size: 1rem; color: var(--ink-soft); }
.hint { font-size: .95rem; color: var(--ink-soft); }
.filepick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filepick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.thumb { max-height: 130px; max-width: 100%; transform: rotate(-2deg); border: 6px solid #fff; outline: 1.4px solid var(--ink); }
.picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.pick { all: unset; box-sizing: border-box; cursor: pointer; display: grid; gap: 0; padding: 10px 14px 10px 26px; background: var(--cream); color: var(--ink); border: 1.6px solid var(--ink);
  clip-path: polygon(14px 0, 100% 0, 100% 100%, 14px 100%, 0 50%); transform: rotate(-1.5deg); transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.pick + .pick { transform: rotate(1.5deg); }
.pick:hover:not([disabled]) { transform: rotate(0) scale(1.03); }
.pick:focus-visible { outline: 2px dashed var(--ink); outline-offset: 2px; }
.pick b { font: 700 1.25rem/1.1 var(--hand); color: var(--tomato-d); }
.pick small { font-size: .95rem; color: var(--ink-soft); }
.pick[aria-pressed="true"] { cursor: default; background: var(--pine); }
.pick[aria-pressed="true"] b, .pick[aria-pressed="true"] small { color: var(--ivory); }
.editbody { display: grid; gap: 16px; }
.editsec { display: grid; gap: 8px; padding-top: 12px; border-top: 1.6px dashed var(--ink); }
.sechead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sechead h3 { margin: 0; font: 700 1.35rem var(--hand); color: var(--pine); }
.sechead .scribble { font-size: .95rem; color: var(--ink-soft); }
.adders { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.adders.small .scribble { font-size: 1.02rem; color: var(--ink-soft); }
.adders.small .scribble[aria-pressed="true"] { color: var(--tomato-d); font-weight: 700; }
.fronts { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.frontopt { all: unset; box-sizing: border-box; cursor: pointer; aspect-ratio: 3 / 2; background: #fff; padding: 3px; border: 1.4px solid var(--ink); position: relative; overflow: hidden; transform: rotate(-1deg); }
.frontopt:nth-child(even) { transform: rotate(1.2deg); }
.frontopt svg, .frontopt img { display: block; width: 100%; height: 100%; object-fit: cover; }
.frontopt[aria-pressed="true"] { outline: 3px solid var(--tomato); outline-offset: 2px; transform: none; }
.frontopt:focus-visible { outline: 2px dashed var(--ink); }
.frontopt.own { display: grid; place-items: center; text-align: center; background: var(--ivory); border-style: dashed; }
.frontopt.own img { position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); }
.frontopt.own .filepick { position: relative; z-index: 1; }
.frontopt.own img + .filepick .scribble { background: var(--ivory); padding: 0 6px; }
.frontopt .scribble { color: var(--tomato-d); font-size: .95rem; line-height: 1.2; }
.drawpad { width: 100%; aspect-ratio: 3 / 2; touch-action: none; cursor: crosshair; border: 1.4px solid var(--ink); background: #fff repeating-linear-gradient(180deg, transparent 0 39px, rgba(28, 26, 25, .18) 39px 40px); }
.hand-ta { min-height: 130px; }

/* the postcard */
.postcard { position: relative; width: min(100%, 440px); aspect-ratio: 3 / 2; justify-self: center; perspective: 1200px; cursor: pointer; transform: rotate(-1.5deg); }
.pcface { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .8s cubic-bezier(.3, .8, .3, 1); background: #fff; border: 1.6px solid var(--ink); box-shadow: 5px 5px 0 var(--cream); }
.pcfront { padding: 6px; }
.pcback { transform: rotateY(180deg); display: grid; grid-template-columns: 1.35fr 1fr; gap: 12px; padding: 12px; }
.postcard.flipped .pcfront { transform: rotateY(-180deg); }
.postcard.flipped .pcback { transform: rotateY(0); }
.pcart { display: block; width: 100%; height: 100%; object-fit: cover; }
.pcart svg { display: block; width: 100%; height: 100%; }
.pcart.blank { background: var(--cream); }
.pcmsg { border-right: 1.4px solid var(--ink); padding-right: 10px; overflow: hidden; display: grid; align-content: start; min-width: 0; }
.pcmsg p { margin: 0; font: 400 clamp(.9rem, 3.6vw, 1.12rem)/1.35 var(--hand); white-space: pre-wrap; overflow-wrap: anywhere; }
.pcmsg img { width: 100%; height: 100%; object-fit: contain; }
.pcaddr { position: relative; display: grid; align-content: end; gap: 12px; padding: 62px 0 6px; min-width: 0; }
.addrline { display: block; border-bottom: 1.2px solid var(--ink); font: 700 1rem var(--hand); color: var(--tomato-d); min-height: 1.4em; }
.stamp { position: absolute; top: 0; right: 0; width: 40px; height: 48px; background: var(--tomato); display: grid; place-items: center; color: var(--ivory); font-size: 1.1rem; border: 3px dotted var(--ivory); outline: 1.4px solid var(--ink); transform: rotate(3deg); }
.postmark { position: absolute; top: 6px; right: 32px; width: 48px; height: 48px; border-radius: 50%; border: 1.4px solid var(--ink); display: grid; place-items: center; transform: rotate(-14deg); }
.postmark span { font: .7rem var(--typed); letter-spacing: .06em; }
.giftlink { display: grid; justify-items: center; gap: 4px; }
.code { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
.code code { font: 1.05rem var(--typed); letter-spacing: .12em; padding: 4px 10px; border: 1.4px dashed var(--ink); user-select: all; overflow-wrap: anywhere; }
.note { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.15rem; }
.fromline { text-align: center; color: var(--ink-soft); margin: 0; }
/* a small quiet note at the bottom: night-green pill, ivory text, fades in and out */
.toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); z-index: 2147483000; max-width: calc(100vw - 48px);
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; white-space: nowrap;
  font: 600 .98rem/1.2 "Libre Caslon Text", Georgia, serif; color: #f6eedd; background: rgba(23, 49, 47, .94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3), inset 0 0 0 1px rgba(246, 238, 221, .18);
  animation: toastin .25s ease-out both, toastout .3s ease-in 2.3s both; transform: translateX(-50%); }
.toast::before { content: "✓"; color: #f2c66d; font-weight: 700; }
.toast.plain::before { content: none; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes toastout { to { opacity: 0; transform: translate(-50%, 4px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

@media (prefers-reduced-motion: reduce) {
  .k-balloon .obj, .smoke, .door.ready .obj, .door.ready .tw, .door:hover .obj { animation: none !important; }
  .door.ready .tw { opacity: 1; }
  dialog.book[open] .leaf { animation: none; }
}

/* ======================================================================
   M0: theme-driven town and tree. Colours and fonts come from the active theme's tokens.
   ====================================================================== */
:root { --display: var(--hand); --script: var(--hand); --night: #17312f; }
.painted, .storyform h1, .datehead .big { font-family: var(--display); font-variation-settings: "SOFT" 100; }
.letter, .pcmsg p, .hand-ta, .sig { font-family: var(--script); }
.letter { font-size: 1.35rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.letter-title { margin: 0; font: 700 1.3rem var(--display); }
.sig { text-align: right; font-size: 1.4rem; margin: 0; color: var(--tomato-d); }
.page { min-height: 100svh; padding-block: max(28px, env(safe-area-inset-top, 0px)) 48px; background: var(--ivory); }

/* the stage: the town fills the screen, the header and footer float on it */
.stage { position: relative; height: 100svh; min-height: 520px; overflow: hidden; background: var(--night); color: var(--ivory); }
.town { position: absolute; inset: 0; overflow: hidden; }
.town-bg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center bottom; filter: saturate(calc(.75 + var(--warmth, 1) * .25)) brightness(calc(.8 + var(--warmth, 1) * .2)); }
.town .snow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.town { container-type: size; }
/* two framings: the tree in the town at its real size, and the camera walked up close */
.tree-box { --x: var(--tpx); --b: var(--tpb); --hh: var(--tph);
  --w: min(calc(var(--hh) * 100cqh * var(--arn)), var(--wcap, 96cqw));
  position: absolute; width: var(--w); height: calc(var(--w) / var(--arn)); left: calc(var(--x) * 100%); bottom: calc((1 - var(--b)) * 100%);
  transform: translateX(-50%); container-type: inline-size; cursor: zoom-in;
  transition: width 1.2s cubic-bezier(.45, 0, .2, 1), height 1.2s cubic-bezier(.45, 0, .2, 1), left 1.2s cubic-bezier(.45, 0, .2, 1), bottom 1.2s cubic-bezier(.45, 0, .2, 1); }
.town.close .tree-box { --x: var(--cpx); --b: var(--cpb); --hh: var(--cph); --wcap: 118cqw; cursor: default; }
.town-bg img { transform-origin: 50% calc(var(--bgoP) * 100%); transition: transform 1.2s cubic-bezier(.45, 0, .2, 1), filter .6s; }
.town.close .town-bg img { transform: scale(var(--bgsP)); }
@media (orientation: landscape) {
  .tree-box { --x: var(--tlx); --b: var(--tlb); --hh: var(--tlh); }
  .town.close .tree-box { --x: var(--clx); --b: var(--clb); --hh: var(--clh); }
  .town-bg img { transform-origin: 50% calc(var(--bgoL) * 100%); }
  .town.close .town-bg img { transform: scale(var(--bgsL)); }
}
/* in the town view the ornaments are just part of the picture */
.town:not(.close) .orn { pointer-events: none; }
.town:not(.close) .orn .numtag, .town:not(.close) .orn .glow, .town:not(.close) .orn.edit::after { opacity: 0; }
.orn .numtag, .orn .glow { transition: opacity .6s .5s; }
.orn::before { content: ""; position: absolute; inset: -35%; }
@media (prefers-reduced-motion: reduce) { .tree-box, .town-bg img { transition: none; } }
.viewtoggle { color: var(--ivory); font-size: .95rem; }
.page .storyform { width: 100%; max-width: 560px; }
.tree-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: brightness(var(--tree-light, 1)); pointer-events: none; }

/* ornaments: the date number is drawn by the app on a paper tag, so any design works with any number */
.orn { all: unset; position: absolute; width: calc(var(--s) * 100%); aspect-ratio: 1; transform: translate(-50%, -50%); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.orn img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .35)); transition: filter .4s, transform .4s cubic-bezier(.3, 1.6, .5, 1); transform-origin: 50% 8%; }
.orn .numtag { position: absolute; right: -6%; bottom: 2%; min-width: 1.6em; padding: .12em .32em; text-align: center; border-radius: 999px;
  font: 800 max(11px, calc(var(--s) * 30cqw))/1.1 var(--display); color: var(--ink); background: var(--ivory); border: 1.5px solid var(--choc); box-shadow: 0 2px 4px rgba(0, 0, 0, .3); }
.orn.star .numtag { right: auto; left: 50%; bottom: -14%; transform: translateX(-50%); font-size: max(11px, calc(var(--s) * 20cqw)); }
.orn .glow { position: absolute; inset: -30%; border-radius: 50%; background: radial-gradient(circle, rgba(255, 214, 140, .75), rgba(255, 190, 90, 0) 65%); opacity: 0; transition: opacity .5s; pointer-events: none; }
.orn:hover img, .orn:focus-visible img { transform: rotate(-6deg) scale(1.05); }
.orn:focus-visible { outline: 2px dashed var(--ivory); outline-offset: 4px; border-radius: 50%; }
.orn.locked img { filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .35)) saturate(.75) brightness(.85); }
.orn.ready .glow { opacity: .7; }
.orn.next .glow { animation: beckon 2s ease-in-out infinite; }
.orn.next img { animation: sway 2.4s ease-in-out infinite; }
@keyframes beckon { 50% { opacity: 1; transform: scale(1.12); } }
@keyframes sway { 0%, 100% { transform: rotate(0) } 25% { transform: rotate(-5deg) } 75% { transform: rotate(5deg) } }
.orn.opened .numtag { background: var(--tomato); color: var(--ivory); border-color: var(--tomato-d); }
.orn.edit:not(.filled) img { filter: saturate(.55) brightness(.8); }
.orn.edit:not(.filled)::after { content: "+"; position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); font: 700 calc(var(--s) * 40cqw)/1 var(--display); color: var(--ivory); text-shadow: 0 1px 4px rgba(0, 0, 0, .6); pointer-events: none; }
.orn.edit.filled .numtag { background: var(--butter); }
.orn.no img { animation: no .4s ease-in-out; }
.orn.popping img { animation: pop .55s cubic-bezier(.3, 1.6, .5, 1); }

.bar { position: absolute; left: 0; right: 0; top: 0; padding-top: max(12px, env(safe-area-inset-top, 0px)); display: grid; grid-template-columns: 1fr minmax(0, max-content) 1fr; gap: 10px; align-items: start;
  background: linear-gradient(rgba(10, 24, 24, .7), rgba(10, 24, 24, 0)); padding-bottom: 28px; }
.bar .scribble { color: var(--ivory); }
.bartitle { text-align: center; min-width: 0; }
.bartitle .from { font-size: .9rem; opacity: .85; }
.bartitle .painted { font-size: clamp(1.5rem, 6.5vw, 2.4rem); color: var(--ivory); text-shadow: 0 2px 8px rgba(0, 0, 0, .5); overflow-wrap: anywhere; }
.foot { position: absolute; left: 0; right: 0; bottom: 0; padding-bottom: max(14px, env(safe-area-inset-bottom, 0px)); padding-top: 24px; display: grid; justify-items: center; gap: 8px;
  background: linear-gradient(rgba(10, 24, 24, 0), rgba(10, 24, 24, .7)); }
.status { margin: 0; font-size: 1rem; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.share { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.share .scribble { color: var(--ivory); }
.peek { display: inline-flex; gap: 8px; align-items: center; font-size: .95rem; }

/* home: the town behind, a card and lists over it */
.home-stage { height: auto; min-height: 100svh; overflow: visible; }
.home-stage .town { position: fixed; }
.over { position: relative; z-index: 1; display: grid; gap: 22px; justify-items: center; padding-block: max(28px, env(safe-area-inset-top, 0px)) 40px; }
.homecard { width: min(100%, 520px); text-align: center; display: grid; justify-items: center; gap: 10px; padding: 26px 20px 22px; background: color-mix(in srgb, var(--ivory) 92%, transparent); color: var(--ink); border: 1.5px solid var(--choc); box-shadow: 0 12px 30px rgba(0, 0, 0, .35); }
.homecard .painted { font-size: clamp(2.2rem, 10vw, 3.4rem); color: var(--tomato); }
.homecard .sub { margin: 0; max-width: 30ch; }
.lists { width: min(100%, 560px); display: grid; gap: 16px; justify-items: center; }
.lists .shelf h2 { color: var(--ivory); text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.lists .signout { color: var(--ivory); }
.lists .emptynote { color: var(--ivory); }
.lists .tag.new b { color: var(--ivory); }
.lists .tag.new { border-color: var(--ivory); }

/* bag thumbnails (used from M2) */
.thumb-note, .thumb-link { display: grid; place-items: center; aspect-ratio: 3 / 4; background: var(--cream); border: 1px solid var(--choc); font: .8rem var(--script); padding: 6px; text-align: center; }
.stage > .town { z-index: 0; }
.stage > .bar, .stage > .foot { z-index: 2; }
.orn img:not([src]), .tree-img:not([src]) { visibility: hidden; }

/* keep the tree readable against the snowy town: a soft dark edge in the town view */
.town:not(.close) .tree-img { filter: brightness(var(--tree-light, 1)) drop-shadow(0 0 1.2cqw rgba(12, 26, 24, .55)); }

/* home: card at the top, the tree clear in the middle, your trees on a strip along the bottom */
.home-stage .over { min-height: 100svh; grid-template-rows: auto 1fr auto; padding-bottom: 0; }
.home-stage .lists { align-self: end; width: auto; max-width: none; justify-self: stretch; margin-inline: calc(-1 * var(--gut, 16px)); justify-items: stretch; gap: 8px;
  padding: 36px 16px max(14px, env(safe-area-inset-bottom, 0px)); background: linear-gradient(rgba(10, 24, 24, 0), rgba(10, 24, 24, .78) 40%); }
.home-stage .shelf { width: 100%; max-width: 760px; margin-inline: auto; gap: 4px; }
.home-stage .shelf h2 { font-size: 1.15rem; }
.home-stage .twine { flex-wrap: nowrap; overflow-x: auto; gap: 10px; padding: 6px 2px 8px; scroll-snap-type: x proximity; scrollbar-width: none; }
.home-stage .twine::-webkit-scrollbar { display: none; }
.home-stage .tag { flex: 0 0 auto; width: 140px; min-height: 66px; scroll-snap-align: start; }
.home-stage .tag b { font-size: 1rem; }
.home-stage .tag small { font-size: .8rem; }
.home-stage .signout { justify-self: center; }
@media (min-width: 700px) { .home-stage .homecard { margin-top: 2vh; } }
/* on home the tree stands a little further back so the strip of trees doesn't cover it */
.home-stage .town .tree-box { --b: .74; --hh: .4; }
@media (orientation: landscape) { .home-stage .town .tree-box { --b: .8; --hh: .5; } }

/* ---------- the editor as a sheet that slides up ---------- */
dialog.book.sheet { width: 100%; max-width: 620px; margin: auto auto 0; max-height: 92svh; }
dialog.book.sheet::backdrop { background: rgba(12, 26, 24, .45); }
dialog.book.sheet[open] .leaf { animation: slideup .42s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
dialog.book.sheet .leaf { max-height: 92svh; border: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .35);
  padding: 22px 18px max(20px, env(safe-area-inset-bottom, 0px)); gap: 0; }
@media (min-width: 640px) { dialog.book.sheet { margin-bottom: 4vh; } dialog.book.sheet .leaf { border-radius: 18px; } }
.grab { justify-self: center; width: 42px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 22%, transparent); margin: -10px 0 8px; }

.pane { display: grid; gap: 14px; }
.pane.fwd { animation: panein .32s cubic-bezier(.2, .9, .3, 1) both; --from: 40px; }
.pane.back { animation: panein .32s cubic-bezier(.2, .9, .3, 1) both; --from: -40px; }
@keyframes panein { from { opacity: 0; transform: translateX(var(--from)); } }
.slotchip { margin: 0; display: inline-flex; align-items: center; gap: 8px; font-size: .95rem; color: var(--ink-soft); }
.slotchip b { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; background: var(--tomato); color: var(--ivory); font: 700 .95rem var(--display); }
.sheettitle { font: 700 1.55rem/1.15 var(--display); margin: 0; color: var(--ink); text-wrap: balance; }
.steptop { display: grid; gap: 2px; justify-items: start; }
.steptop .scribble { font-size: .95rem; color: var(--ink-soft); }

.gtiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.gtile { all: unset; box-sizing: border-box; cursor: pointer; display: grid; justify-items: center; align-content: start; gap: 2px; text-align: center;
  padding: 14px 10px 14px; background: var(--cream); border-radius: 14px; border: 1.5px solid color-mix(in srgb, var(--choc) 35%, transparent);
  transition: transform .2s cubic-bezier(.3, 1.6, .5, 1), box-shadow .2s, background .2s; -webkit-tap-highlight-color: transparent; }
.gtile:hover, .gtile:focus-visible { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(60, 35, 20, .16); background: #f3e8d0; }
.gtile:active { transform: scale(.97); }
.gtile:focus-visible { outline: 2px solid var(--tomato); outline-offset: 2px; }
.gicon { width: 64px; height: 64px; display: grid; place-items: center; margin-bottom: 4px; }
.gicon img, .gicon svg { max-width: 100%; max-height: 100%; filter: drop-shadow(0 3px 3px rgba(60, 35, 20, .25)); }
.gicon svg { width: 46px; height: 46px; }
.gtile b { font: 700 1.15rem/1.1 var(--display); color: var(--tomato-d); }
.gtile small { font-size: .85rem; line-height: 1.3; color: var(--ink-soft); }
.ideatile { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--choc) 55%, transparent); }
.ideatile:hover { background: var(--cream); }

.idea { display: grid; gap: 12px; padding: 18px 16px 16px; border-radius: 14px; background: var(--pine); color: var(--ivory); }
.ideatext { margin: 0; font: 600 1.7rem/1.2 var(--script); text-wrap: balance; }
.ideatext.fresh { animation: panein .3s ease-out both; --from: 0; }
.idearow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.die { all: unset; cursor: pointer; width: 46px; height: 46px; display: grid; place-items: center; }
.die svg { width: 100%; height: 100%; }
.die:focus-visible { outline: 2px solid var(--butter); outline-offset: 3px; border-radius: 10px; }
.die.roll svg { animation: roll .5s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes roll { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(200deg) scale(.85); } 100% { transform: rotate(360deg) scale(1); } }
.ribbon.small { font-size: 1.05rem; padding-block: 6px; }
@media (prefers-reduced-motion: reduce) { dialog.book.sheet[open] .leaf, .pane.fwd, .pane.back, .die.roll svg, .ideatext.fresh { animation: none; } }

/* To / From, like the tag on a present */
.tofrom { position: relative; display: grid; gap: 6px; padding: 12px 16px 12px 34px; background: var(--cream); border: 1.5px solid var(--ink);
  clip-path: polygon(16px 0, 100% 0, 100% 100%, 16px 100%, 0 50%); }
.tofrom::before { content: ""; position: absolute; left: 14px; top: calc(50% - 5px); width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--ivory); }
.tfrow { display: grid; grid-template-columns: 3.2em 1fr; align-items: baseline; gap: 8px; }
.tfrow span { font: 600 1.6rem/1 var(--script); color: var(--ink-soft); }
.tfrow .line { width: 100%; }

/* ornaments stand out from the branches: a pale rim and a deeper shadow */
.orn img { filter: drop-shadow(0 0 1.5px rgba(255, 246, 225, .95)) drop-shadow(0 0 5px rgba(255, 236, 200, .45)) drop-shadow(0 4px 4px rgba(0, 0, 0, .5)); }
.orn.locked img { filter: drop-shadow(0 0 1.5px rgba(255, 246, 225, .8)) drop-shadow(0 4px 4px rgba(0, 0, 0, .5)) saturate(.8) brightness(.9); }
.orn.edit:not(.filled) img { filter: drop-shadow(0 0 1.5px rgba(255, 246, 225, .95)) drop-shadow(0 4px 4px rgba(0, 0, 0, .5)) saturate(.6) brightness(.85); }
/* arranging: drag an ornament to a new branch */
.town.arranging.close .orn:not(.star) { touch-action: none; cursor: grab; }
.orn.dragging { cursor: grabbing; z-index: 3; }
.orn.dragging img { transform: scale(1.18) rotate(-4deg); filter: drop-shadow(0 0 1.5px rgba(255, 246, 225, .95)) drop-shadow(0 12px 10px rgba(0, 0, 0, .45)); transition: none; }
.gtile[hidden], .idea[hidden] { display: none; }
.gicon img { width: 100%; height: 100%; object-fit: contain; }
/* filling: every ornament in full colour; the tag says which are done */
.orn.edit:not(.filled) img { filter: drop-shadow(0 0 1.5px rgba(255, 246, 225, .95)) drop-shadow(0 0 5px rgba(255, 236, 200, .45)) drop-shadow(0 4px 4px rgba(0, 0, 0, .5)); }
.orn.edit:not(.filled)::after { content: none; }
.orn.edit:not(.filled) .numtag { background: var(--ivory); border-style: dashed; }
.orn.edit.filled .numtag { background: var(--pine); color: var(--ivory); border-color: var(--pine); }
.tofrom { box-sizing: border-box; width: 100%; min-width: 0; }
.tfrow { grid-template-columns: 3.2em minmax(0, 1fr); }
.tfrow .line { min-width: 0; }

/* the welcome card a recipient sees first */
.welcome { display: grid; gap: 14px; justify-items: center; text-align: center; }
.wtitle { font: 700 1.6rem/1.15 var(--display); margin: 6px 0 0; text-wrap: balance; color: var(--tomato-d); }
.welcome .letter { margin: 0; justify-self: stretch; text-align: left; }
.welcome .sig { margin: -4px 0 0; justify-self: end; font: 600 1.5rem var(--script); color: var(--ink-soft); }
.guide { list-style: none; margin: 4px 0 0; padding: 14px 0 0; border-top: 1.5px dashed color-mix(in srgb, var(--choc) 40%, transparent);
  display: grid; gap: 8px; justify-self: stretch; text-align: left; counter-reset: g; font-size: 1rem; color: var(--ink-soft); }
.guide li { counter-increment: g; display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: baseline; }
.guide li::before { content: counter(g); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--pine); color: var(--ivory); font: 700 .8rem var(--display); }
.storyform { grid-template-columns: minmax(0, 1fr); }
.storyform select.line { max-width: 100%; text-overflow: ellipsis; }
/* To / From, take two: a clean tag, small capital labels */
.tofrom { clip-path: none; border-radius: 4px 12px 12px 4px; padding: 12px 18px 12px 46px; gap: 4px; }
.tofrom::before { left: 16px; width: 12px; height: 12px; top: calc(50% - 6px); }
.tfrow { grid-template-columns: 3.6em minmax(0, 1fr); align-items: center; }
.tfrow span { font: 600 .78rem/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }

/* ---------- new tree: labelled rows ---------- */
.storyform { gap: 22px; line-height: 1.4; }
.frow { display: grid; gap: 6px; }
.fhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.flabel { font: 600 .78rem/1.2 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.fhint { font-size: .85rem; color: var(--ink-soft); }
.bignum { font: 700 2.4rem/1 var(--display); color: var(--tomato); font-variation-settings: "SOFT" 100; }
.storyform .line { font-size: 1.2rem; }
.storyform input[type="date"].line { justify-self: start; }

.rangewrap { position: relative; padding-top: 38px; --thumb: 40px; }
.rangepill { position: absolute; top: 0; left: calc(var(--thumb) / 2 + var(--p, 0) * (100% - var(--thumb))); transform: translateX(-50%);
  background: var(--ink); color: var(--ivory); font: 700 .9rem/1 var(--display); padding: 7px 10px; border-radius: 8px; white-space: nowrap; pointer-events: none; }
.rangepill::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: var(--ink); transform: translateX(-50%) rotate(45deg); z-index: -1; }
.starrange { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: var(--thumb); margin: 0; background: transparent; cursor: pointer; }
.starrange:focus { outline: none; }
.starrange::-webkit-slider-runnable-track { height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--ink) calc(var(--p, 0) * 100%), var(--tomato) calc(var(--p, 0) * 100%)); }
.starrange::-moz-range-track { height: 6px; border-radius: 3px; background: var(--ink); }
.starrange::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--tomato); }
.starrange::-webkit-slider-thumb { -webkit-appearance: none; width: var(--thumb, 40px); height: 40px; margin-top: -17px; border: 0; background: url("assets/ui/star.svg") center / contain no-repeat; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); transition: transform .15s; }
.starrange::-moz-range-thumb { width: 40px; height: 40px; border: 0; background: url("assets/ui/star.svg") center / contain no-repeat; }
.starrange:active::-webkit-slider-thumb { transform: scale(1.12) rotate(-8deg); }
.starrange:focus-visible::-webkit-slider-thumb { outline: 2px dashed var(--ink); outline-offset: 2px; border-radius: 50%; }
.rangeends { display: flex; justify-content: space-between; font-size: .9rem; color: var(--ink-soft); }
.fhead .flabel { white-space: nowrap; }
.fhint { font-size: .8rem; text-align: right; }

/* two-handled season slider: a ribbon handle for the first gift, the star for the last */
.rangewrap.duo { height: 40px; padding-top: 38px; }
.duotrack { position: absolute; left: calc(var(--thumb) / 2); right: calc(var(--thumb) / 2); bottom: 17px; height: 6px; border-radius: 3px;
  background: linear-gradient(to right, color-mix(in srgb, var(--ink) 25%, transparent) calc(var(--a, 0) * 100%), var(--tomato) calc(var(--a, 0) * 100%), var(--tomato) calc(var(--b, 1) * 100%), color-mix(in srgb, var(--ink) 25%, transparent) calc(var(--b, 1) * 100%)); }
.duorange { -webkit-appearance: none; appearance: none; position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: var(--thumb); margin: 0; background: transparent; pointer-events: none; }
.duorange:focus { outline: none; }
.duorange::-webkit-slider-runnable-track { height: 6px; background: transparent; }
.duorange::-moz-range-track { background: transparent; }
.duorange::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; cursor: grab; width: var(--thumb, 40px); height: 40px; margin-top: -17px; border: 0; background: center / contain no-repeat; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); transition: transform .15s; }
.duorange::-moz-range-thumb { pointer-events: auto; cursor: grab; width: 40px; height: 40px; border: 0; background: center / contain no-repeat; }
.duorange.to::-webkit-slider-thumb { background-image: url("assets/ui/star.svg"); }
.duorange.to::-moz-range-thumb { background-image: url("assets/ui/star.svg"); }
.duorange.from::-webkit-slider-thumb { background-image: url("assets/ui/bauble.svg"); width: 30px; height: 30px; margin-top: -12px; }
.duorange.from::-moz-range-thumb { background-image: url("assets/ui/bauble.svg"); width: 30px; height: 30px; }
.duorange:active::-webkit-slider-thumb { transform: scale(1.12); cursor: grabbing; }
.duorange:focus-visible::-webkit-slider-thumb { outline: 2px dashed var(--ink); outline-offset: 2px; border-radius: 50%; }
.rangepill.star { background: var(--tomato-d); }
.rangepill.star::after { background: var(--tomato-d); }
.rangepill[hidden] { display: none; }
.fhint .bignum { font-size: 1.6rem; margin-right: 2px; }
.fhead:has(.bignum) { align-items: center; }
/* a missing name is marked on the To line itself */
.tofrom.missing { border-color: var(--tomato); animation: no .4s ease-in-out; }
.tofrom.missing #toName { border-bottom-color: var(--tomato); }
.tofrom.missing #toName::placeholder { color: var(--tomato); }
.rangewrap.duo { height: 80px; padding-top: 0; }

/* new tree: everything fits on a phone, and the button never hides below the fold */
@media (max-width: 640px) {
  .page:has(.storyform) { padding-block: max(12px, env(safe-area-inset-top, 0px)) 12px; }
  .page .storyform { gap: 14px; padding: 18px 16px 0; box-shadow: none; }
  .storyform h1 { font-size: 1.8rem; }
  .storyform .tofrom { padding-block: 8px; }
}
.storyform #welcome { min-height: 66px; }
.storyform .formend { position: sticky; bottom: 0; z-index: 3; margin: 0 -16px; padding: 12px 16px max(12px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(color-mix(in srgb, var(--ivory) 0%, transparent), var(--ivory) 30%); }

/* number tags: small and quiet so a full tree doesn't look busy */
.orn .numtag { right: -10%; bottom: -4%; min-width: 1.5em; padding: .1em .28em; font-size: max(10px, calc(var(--s) * 21cqw)); border-width: 1px; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
.orn.edit:not(.filled) .numtag { border-style: solid; background: var(--ivory); }
.orn.star .numtag { font-size: max(10px, calc(var(--s) * 13cqw)); bottom: -8%; }
/* close up on a phone: keep the whole tree on screen so edge ornaments aren't cut off */
.town.close .tree-box { --wcap: 100cqw; }

/* ---------- lettering: "Title card" ----------
   --display (brush script) only where a title card would use it: titles, the big numbers, buttons.
   Labels, small numbers and body text stay in the book serif (--hand); people's own words in --script. */
.painted, .storyform h1, .datehead .big, .letter-title, .sheettitle, .wtitle, .gtile b, .shelf h2, .ribbon, .bartitle .painted, .homecard .painted {
  font-family: var(--display); font-weight: 400; font-variation-settings: normal; letter-spacing: .01em; }
.homecard .painted { font-size: clamp(2.8rem, 13vw, 4.2rem); line-height: 1; }
.bartitle .painted { font-size: clamp(2rem, 8.5vw, 3rem); line-height: 1.05; }
.storyform h1 { font-size: 2.5rem; line-height: 1; }
.sheettitle { font-size: 2.1rem; line-height: 1.05; }
.wtitle { font-size: 2.2rem; line-height: 1.05; }
.gtile b { font-size: 1.6rem; line-height: 1; }
.shelf h2 { font-size: 1.6rem; }
.ribbon { font-size: 1.55rem; padding-block: 8px 7px; }
.ribbon.small { font-size: 1.35rem; padding-block: 5px 4px; }
.datehead .big { font-size: 4.4rem; }
.orn .numtag, .slotchip b, .guide li::before, .tfrow span, .flabel, .bignum, .rangepill { font-family: var(--hand); font-variation-settings: normal; }
.bignum { font-weight: 700; }
.orn .numtag { font-weight: 700; }
.letter, .pcmsg p, .hand-ta, .sig, .ideatext { font-family: var(--script); font-weight: 400; }
.letter { font-size: 1.35rem; line-height: 1.75; }
.ideatext { font-size: 1.55rem; line-height: 1.35; }
.welcome .sig, .sig { font-size: 1.35rem; }
.line { font-weight: 400; }
.storyform .line { font-size: 1.15rem; }
.home-stage .shelf h2 { font-size: 1.7rem; }

/* ---------- first-run walkthrough ---------- */
.coach { position: fixed; inset: 0; z-index: 50; cursor: pointer; animation: coachin .35s ease-out both; }
@keyframes coachin { from { opacity: 0; } }
.coach-hole { position: absolute; border-radius: 50%; box-shadow: 0 0 0 200vmax rgba(10, 22, 20, .72), inset 0 0 0 2px rgba(255, 236, 190, .9), 0 0 24px 6px rgba(255, 214, 140, .55);
  transition: left .45s cubic-bezier(.3, 1.2, .4, 1), top .45s cubic-bezier(.3, 1.2, .4, 1), width .45s, height .45s; pointer-events: none; }
.coach-hole.tap { animation: coachpulse 1.6s ease-in-out infinite; }
@keyframes coachpulse { 50% { box-shadow: 0 0 0 200vmax rgba(10, 22, 20, .72), inset 0 0 0 3px rgba(255, 236, 190, 1), 0 0 34px 12px rgba(255, 214, 140, .8); } }
.coach-bubble { position: absolute; box-sizing: border-box; background: var(--ivory); color: var(--ink); border: 1.6px solid var(--ink); border-radius: 12px; padding: 14px 16px 10px; box-shadow: 5px 5px 0 var(--tomato); }
.coach-bubble.in { animation: bubblein .35s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes bubblein { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.coach-bubble::after { content: ""; position: absolute; left: calc(var(--ax, 50%) - 8px); bottom: -9px; width: 14px; height: 14px; background: var(--ivory);
  border-right: 1.6px solid var(--ink); border-bottom: 1.6px solid var(--ink); transform: rotate(45deg); }
.coach-bubble.below::after { bottom: auto; top: -9px; transform: rotate(225deg); }
.coach-bubble p { margin: 0; font: 400 1.75rem/1.1 var(--display); color: var(--tomato-d); text-wrap: balance; }
.coach-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: .8rem; color: var(--ink-soft); }
.coach-dots { display: flex; gap: 5px; }
.coach-dots span { width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 25%, transparent); }
.coach-dots span.on { background: var(--tomato); }
@media (prefers-reduced-motion: reduce) { .coach, .coach-hole, .coach-hole.tap, .coach-bubble.in { animation: none; transition: none; } }

/* "not yet" notes: a small bubble pointing at the ornament that was tapped */
.tipbubble { position: fixed; z-index: 40; box-sizing: border-box; background: var(--ivory); color: var(--tomato-d); border: 1.6px solid var(--ink); border-radius: 12px;
  padding: 9px 14px 8px; box-shadow: 4px 4px 0 var(--tomato); font: 400 1.45rem/1.1 var(--display); text-align: center; text-wrap: balance; pointer-events: none;
  animation: bubblein .3s cubic-bezier(.3, 1.4, .5, 1) both; transition: opacity .35s, transform .35s; }
.tipbubble::after { content: ""; position: absolute; left: calc(var(--ax, 50%) - 7px); bottom: -8px; width: 12px; height: 12px; background: var(--ivory);
  border-right: 1.6px solid var(--ink); border-bottom: 1.6px solid var(--ink); transform: rotate(45deg); }
.tipbubble.below::after { bottom: auto; top: -8px; transform: rotate(225deg); }
.tipbubble.out { opacity: 0; transform: translateY(-4px); }
@media (prefers-reduced-motion: reduce) { .tipbubble { animation: none; } }

/* lighter editors */
.sheet .field > label, .sheet .lbl { font: 600 .74rem/1.2 var(--hand); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.sheet .editsec { display: grid; gap: 14px; border: 0; padding: 0; }
.notepad { min-height: 220px; font-size: 1.35rem; }

/* a photo, printed with a white border */
.print { justify-self: center; background: #fffdf7; padding: 10px 10px 12px; border: 1px solid rgba(43, 33, 28, .25); box-shadow: 0 6px 16px rgba(43, 33, 28, .25); transform: rotate(-1.5deg); max-width: min(100%, 360px); margin: 4px 0 6px; }
.print img { display: block; width: 100%; max-height: 46svh; object-fit: cover; background: var(--cream); }
.print figcaption { font: 400 1.3rem/1.3 var(--script); text-align: center; margin-top: 10px; color: var(--ink); }
figure.print { margin-inline: auto; }
.photoedit .caption { font-family: var(--script); font-size: 1.25rem; text-align: center; }
.photorow { display: flex; justify-content: center; align-items: center; gap: 12px; }
.gtile.busy { opacity: .6; pointer-events: none; }
.hint.center { text-align: center; margin: 0; }
.hint.center:empty { display: none; }

/* close up: the tree fills the free space between title and footer (measured in JS), never more than the screen width.
   The star pokes ~7% above the tree's box, so the box gets 93% of the height. */
.town.close.fit .tree-box { --w: min(calc((100cqh - var(--safeT) - var(--safeB)) * .93 * var(--arn)), 100cqw);
  bottom: var(--safeB); left: 50%; }
.stage { min-height: 0; height: 100dvh; height: 100svh; }

/* ---------- the Tree Upgrade ---------- */
.goldchip { display: inline-block; font: 700 .72rem/1 var(--hand); letter-spacing: .08em; text-transform: uppercase; color: #3a2a10;
  background: linear-gradient(180deg, #f3d48a, #d6a646); border: 1px solid #9c7424; border-radius: 999px; padding: 5px 9px 4px; margin-right: 8px; vertical-align: middle; white-space: nowrap; }
.goldchip[hidden] { display: none; }
.sendbox { display: grid; justify-items: center; gap: 4px; }
.sendfree { color: var(--ivory); font-size: .95rem; opacity: .9; }
.upsell { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 4px 0 6px; }
.upsell p { margin: 0; }
.upsell .warn { color: var(--tomato-d); }
.upsell .scribble { color: var(--ink-soft); font-size: .95rem; }


/* filling: empty ornaments look unpainted (faded paper); filled ones are in full colour, glowing, with a twinkle */
.orn.edit:not(.filled) img { filter: grayscale(1) sepia(.35) brightness(1.18) contrast(.85) drop-shadow(0 0 1.5px rgba(255, 246, 225, .9)) drop-shadow(0 3px 3px rgba(0, 0, 0, .35)); opacity: .78; }
.orn.edit.filled img { filter: drop-shadow(0 0 1.5px rgba(255, 246, 225, .95)) drop-shadow(0 0 7px rgba(255, 214, 140, .8)) drop-shadow(0 4px 4px rgba(0, 0, 0, .5)); }
.orn.edit.filled .glow { opacity: .55; }
.orn.edit.filled::after { content: "✦"; position: absolute; right: 2%; top: -6%; font-size: max(10px, calc(var(--s) * 26cqw)); color: #ffe7a6;
  text-shadow: 0 0 6px rgba(255, 210, 120, .9); animation: twinkle 2.4s ease-in-out infinite; pointer-events: none; }
@keyframes twinkle { 0%, 100% { opacity: .35; transform: scale(.8) rotate(0); } 50% { opacity: 1; transform: scale(1.1) rotate(20deg); } }
.town:not(.close) .orn.edit.filled::after { opacity: 0; }
.orn.edit.filled .numtag { background: var(--ivory); color: var(--ink); border-color: var(--choc); }
@media (prefers-reduced-motion: reduce) { .orn.edit.filled::after { animation: none; opacity: .9; } }

/* ---------- home: your trees as gift tags on twine ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.home-stage .lists { padding-top: 46px; }
.twine.strand { position: relative; gap: 14px; padding: 22px 4px 10px; }
.twine.strand::before { content: ""; position: absolute; left: -20px; right: -20px; top: 8px; height: 2px; background: #c9a77a; border-radius: 2px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.gifttag { position: relative; flex: 0 0 auto; width: 108px; min-height: 132px; box-sizing: border-box; display: grid; justify-items: center; align-content: start; gap: 4px;
  padding: 22px 8px 10px; text-decoration: none; color: var(--ink); scroll-snap-align: start;
  background: #e9d7b4 radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .35), transparent 60%);
  clip-path: polygon(22% 0, 78% 0, 100% 14%, 100% 100%, 0 100%, 0 14%); transform: rotate(var(--r, 0)); transform-origin: 50% -14px;
  box-shadow: inset 0 0 0 1px rgba(90, 60, 30, .25); transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.gifttag::before { content: ""; position: absolute; top: 8px; left: calc(50% - 5px); width: 10px; height: 10px; border-radius: 50%; background: #17312f; box-shadow: inset 0 0 0 2px #b9925f; }
.gifttag .string { position: absolute; top: -14px; left: calc(50% - 1px); width: 2px; height: 26px; background: #c9a77a; }
.gifttag:hover, .gifttag:focus-visible { transform: rotate(0) translateY(2px); }
.gifttag:focus-visible { outline: 2px solid var(--butter); outline-offset: 3px; }
.gifttag .charm { width: 44px; height: 44px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .3)); }
.gifttag b { font: 400 1.55rem/1 var(--display); color: var(--tomato-d); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.gifttag .beads { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 86px; }
.gifttag .beads i { width: 6px; height: 6px; border-radius: 50%; background: rgba(90, 60, 30, .22); }
.gifttag .beads i.on { background: radial-gradient(circle at 35% 35%, #ffeaa8, #d6a646 70%); box-shadow: 0 0 3px rgba(214, 166, 70, .8); }
.gifttag .seal { position: absolute; right: 6px; bottom: 30px; width: 28px; height: 28px; display: grid; place-items: center; color: #f3c9b8; font-size: .8rem;
  background: radial-gradient(circle at 40% 35%, #c4483d, #8e2219 70%); border-radius: 46% 54% 50% 50% / 52% 48% 52% 48%; transform: rotate(-12deg);
  box-shadow: 0 2px 3px rgba(0, 0, 0, .35), inset 0 0 0 3px rgba(0, 0, 0, .12); }
.gifttag.new { place-content: center; background: transparent; box-shadow: inset 0 0 0 1.5px rgba(246, 238, 221, .7); }
.gifttag.new b { color: var(--ivory); font-size: 2.4rem; }
.gifttag.new::before { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(246, 238, 221, .7); }
/* hanger (outer, swings) + body (the paper shape) */
.gifttag { background: none; clip-path: none; box-shadow: none; padding: 0; min-height: 0; display: block; padding-top: 12px; }
.gifttag::before { content: none; }
.gifttag .string { top: -14px; height: 30px; z-index: 1; }
.tagbody { position: relative; display: grid; justify-items: center; align-content: start; gap: 4px; min-height: 126px; box-sizing: border-box; padding: 24px 8px 10px;
  background: #e9d7b4 radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .35), transparent 60%);
  clip-path: polygon(24% 0, 76% 0, 100% 15%, 100% 100%, 0 100%, 0 15%); }
.tagbody::before { content: ""; position: absolute; top: 9px; left: calc(50% - 5px); width: 10px; height: 10px; border-radius: 50%; background: #17312f; box-shadow: inset 0 0 0 2px #b9925f; }
.gifttag.new .tagbody { min-height: 126px; place-content: center; background: rgba(246, 238, 221, .12); }
.gifttag.new .tagbody::after { content: ""; position: absolute; inset: 0; clip-path: inherit; border: 0; box-shadow: inset 0 0 0 1.5px rgba(246, 238, 221, .7); }
.gifttag.new { box-shadow: none; }
.gifttag .seal { bottom: 34px; right: -4px; z-index: 2; }
.gifttag .seal { top: 22px; bottom: auto; right: -6px; }
.home-stage .lists { padding-top: 30px; }
.sharelink { color: var(--ink); }
/* gift picker: fixed-size icons with room before the label */
.gicon { width: 64px; height: 64px; margin-bottom: 10px; flex: none; }
.gicon img { width: 64px; height: 64px; max-width: none; max-height: none; object-fit: contain; }
.gtile { gap: 4px; padding-top: 16px; }
.gtile b { line-height: 1.1; }
.gtile b { padding-top: 10px; line-height: 1.15; }
.gicon { margin-bottom: 4px; }

/* ---------- home: the welcome postcard, and the small sign once it's put away ---------- */
.homehead { display: grid; justify-items: center; width: 100%; }
.homecard.postcard { position: relative; overflow: visible; background: #f7efdc; border: 0; border-radius: 4px; transform: rotate(-1.2deg);
  padding: 34px 22px 22px; box-shadow: 0 14px 30px rgba(0, 0, 0, .4), 0 0 0 1px rgba(90, 60, 30, .18);
  background-image: linear-gradient(90deg, transparent 0 calc(100% - 92px), rgba(90, 60, 30, .0) 0), radial-gradient(circle at 20% 10%, rgba(255, 255, 255, .5), transparent 55%); }
.homecard.postcard::before { content: ""; position: absolute; inset: 7px; border: 1.5px dashed rgba(165, 53, 44, .35); border-radius: 2px; pointer-events: none; }
.homecard.postcard[hidden], .homesign[hidden] { display: none; }
.homecard.postcard.leaving { animation: tuckaway .38s ease-in forwards; }
@keyframes tuckaway { to { transform: rotate(-6deg) translateY(-40px) scale(.9); opacity: 0; } }
.pcclose { all: unset; position: absolute; left: 14px; top: 12px; z-index: 2; cursor: pointer; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%;
  color: var(--ink-soft); font-size: 1rem; }
.pcclose:hover, .pcclose:focus-visible { background: rgba(90, 60, 30, .1); color: var(--ink); }
.pcstamp { position: absolute; right: 14px; top: 12px; width: 54px; height: 64px; display: grid; place-items: center; background: #fbf6ea;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transform: rotate(4deg);
  -webkit-mask: radial-gradient(circle 3.5px at 50% 50%, transparent 98%, #000) -4px -4px / 9px 9px, linear-gradient(#000 0 0) center / calc(100% - 9px) calc(100% - 9px) no-repeat;
  mask: radial-gradient(circle 3.5px at 50% 50%, transparent 98%, #000) -4px -4px / 9px 9px, linear-gradient(#000 0 0) center / calc(100% - 9px) calc(100% - 9px) no-repeat; }
.pcstamp img { width: 36px; height: 36px; object-fit: contain; }
.pcstamp::after { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(165, 53, 44, .5); }
.pcmark { position: absolute; right: 50px; top: 30px; width: 54px; height: 54px; border-radius: 50%; border: 1.5px solid rgba(43, 33, 28, .45); display: grid; place-content: center; text-align: center;
  color: rgba(43, 33, 28, .55); transform: rotate(-14deg); pointer-events: none; line-height: 1; }
.pcmark b { font: 700 .72rem var(--hand); letter-spacing: .12em; }
.pcmark small { font-size: .62rem; letter-spacing: .1em; }
.pcmark::after { content: ""; position: absolute; left: -46px; top: 18px; width: 46px; height: 16px; opacity: .5;
  background: repeating-linear-gradient(180deg, transparent 0 4px, rgba(43, 33, 28, .55) 4px 5.5px); -webkit-mask: radial-gradient(10px 4px at 50% 50%, #000 60%, transparent) 0 0 / 12px 6px; }
.homecard.postcard .painted { margin-top: 18px; }

.homesign { display: flex; align-items: center; gap: 12px; width: min(100%, 520px); box-sizing: border-box; padding: 10px 12px 10px 10px; border-radius: 14px;
  background: rgba(247, 239, 220, .94); box-shadow: 0 8px 20px rgba(0, 0, 0, .35); color: var(--ink); animation: bubblein .35s cubic-bezier(.3, 1.4, .5, 1) both; }
.homesign p { margin: 0; flex: 1; font-size: .95rem; line-height: 1.3; }
.homesign .ribbon { font-size: 1.2rem; padding: 6px 18px 5px; white-space: nowrap; }
.pcstamp.mini { all: unset; position: relative; flex: none; cursor: pointer; width: 42px; height: 50px; display: grid; place-items: center; background: #fbf6ea; transform: rotate(-4deg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  -webkit-mask: radial-gradient(circle 3px at 50% 50%, transparent 98%, #000) -3.5px -3.5px / 8px 8px, linear-gradient(#000 0 0) center / calc(100% - 8px) calc(100% - 8px) no-repeat;
  mask: radial-gradient(circle 3px at 50% 50%, transparent 98%, #000) -3.5px -3.5px / 8px 8px, linear-gradient(#000 0 0) center / calc(100% - 8px) calc(100% - 8px) no-repeat; }
.pcstamp.mini img { width: 28px; height: 28px; }
.pcstamp.mini:focus-visible { outline: 2px dashed var(--ink); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .homecard.postcard.leaving, .homesign { animation: none; } }
.home-stage .over { grid-template-columns: minmax(0, 1fr); }
.homehead { min-width: 0; }
.homecard.postcard { box-sizing: border-box; }
.homecard.postcard .painted { padding: 0 34px; }
.homecard.postcard, .homesign { max-width: calc(100vw - 32px); }
.home-stage .over { max-width: 100vw; box-sizing: border-box; }
.homecard.postcard .painted { margin-top: 34px; }
.pcmark { top: 14px; right: 58px; width: 48px; height: 48px; }

/* the welcome letter: a lined note with the sign-off right under the words */
.lettercard { justify-self: stretch; display: grid; gap: 2px; padding: 14px 18px 10px; border-radius: 4px; text-align: left;
  background: #fbf6ea repeating-linear-gradient(transparent 0 33px, rgba(90, 60, 30, .14) 33px 34px); background-position: 0 12px;
  box-shadow: inset 0 0 0 1px rgba(90, 60, 30, .15); }
.lettercard .letter { margin: 0; font-size: 1.4rem; line-height: 34px; white-space: pre-wrap; overflow-wrap: anywhere; }
.welcome .lettercard .sig { margin: 4px 0 0; justify-self: end; line-height: 34px; font-size: 1.35rem; color: var(--tomato-d); }
.wtitle { margin-bottom: 4px; }
/* a gift's sign-off */
#leaf > .sig { justify-self: end; margin: 6px 4px 0; font-size: 1.35rem; color: var(--tomato-d); }
.lettercard .letter-title { margin: 0; line-height: 34px; font: 400 1.6rem/34px var(--display); color: var(--tomato-d); }
.lettercard .sig { justify-self: end; margin: 4px 0 0; line-height: 34px; font-size: 1.35rem; color: var(--tomato-d); }

/* ---------- the sender's moments ---------- */
.flypresent { position: fixed; left: 0; top: 0; z-index: 60; width: 44px; height: 44px; pointer-events: none; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .35)); }
.flypresent svg { width: 100%; height: 100%; }
.spark { position: fixed; z-index: 61; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, #fff6d6, #e7b64e 60%, rgba(231, 182, 78, 0)); }
.orn.bloom img { animation: bloom .7s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bloom { 0% { transform: scale(.6); filter: brightness(1.8); } 60% { transform: scale(1.18) rotate(-4deg); } 100% { transform: none; } }
/* the tree warms up as it fills: brighter branches and a glow behind it, the star shining once it's full */
.town.editing .tree-img { filter: brightness(calc(.8 + var(--fill, 0) * .32)) saturate(calc(.8 + var(--fill, 0) * .3)); transition: filter 1.2s ease; }
.town.editing .tree-box::before { content: ""; position: absolute; inset: 6% -8% 14%; border-radius: 50%; pointer-events: none; z-index: -1;
  background: radial-gradient(closest-side, rgba(255, 204, 120, calc(var(--fill, 0) * .55)), rgba(255, 204, 120, 0)); transition: background 1.2s ease; }
.town.complete .orn.star .glow { opacity: 1; animation: beckon 2.2s ease-in-out infinite; }
.town.complete .orn.star img { filter: drop-shadow(0 0 10px rgba(255, 220, 140, .95)) drop-shadow(0 4px 4px rgba(0, 0, 0, .5)); }
.ribbon.beckon { animation: ribbonbeckon 1.8s ease-in-out infinite; }
@keyframes ribbonbeckon { 0%, 100% { transform: rotate(-2deg) scale(1); } 50% { transform: rotate(-2deg) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .orn.bloom img, .ribbon.beckon, .town.complete .orn.star .glow { animation: none; } }

/* ---------- sending: the envelope and the wax seal ---------- */
.sealbox { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 6px 0 4px; }
.envelope { position: relative; width: min(300px, 82vw); aspect-ratio: 3 / 2; margin-top: 8px; background: #f3e6c8; border-radius: 6px;
  box-shadow: 0 10px 24px rgba(60, 35, 20, .25), inset 0 0 0 1px rgba(90, 60, 30, .2); display: grid; place-content: center; overflow: visible; }
.envelope::before { content: ""; position: absolute; inset: 0; border-radius: 6px; pointer-events: none;
  background: linear-gradient(to top right, transparent 49.6%, rgba(90, 60, 30, .14) 50%, transparent 50.4%), linear-gradient(to top left, transparent 49.6%, rgba(90, 60, 30, .14) 50%, transparent 50.4%); }
.envelope .flap { position: absolute; left: 0; right: 0; top: 0; height: 58%; background: #ead9b4; clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top; transform: rotateX(180deg); transition: transform .6s cubic-bezier(.3, 1.2, .5, 1); filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .15)); z-index: 1; }
.envelope.sealed .flap { transform: none; }
.envto { position: relative; z-index: 0; font: 400 2rem/1 var(--display); color: var(--tomato-d); margin-top: 26%; }
.envfrom { position: relative; font: 400 1.2rem var(--script); color: var(--ink-soft); }
.waxseal { all: unset; position: absolute; z-index: 2; left: 50%; top: 58%; width: 66px; height: 66px; transform: translate(-50%, -50%); cursor: pointer; touch-action: none;
  display: grid; place-items: center; border-radius: 47% 53% 50% 50% / 52% 48% 52% 48%;
  background: radial-gradient(circle at 38% 34%, #d0574b, #8e2219 72%); box-shadow: 0 4px 8px rgba(0, 0, 0, .35), inset 0 0 0 4px rgba(0, 0, 0, .12);
  transition: transform .2s cubic-bezier(.3, 1.6, .5, 1); -webkit-tap-highlight-color: transparent; }
.waxseal:focus-visible { outline: 2px dashed var(--ink); outline-offset: 4px; }
.waxseal .sealmark { color: #f3c9b8; font-size: 1.5rem; text-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
.sealring { position: absolute; inset: -9px; width: calc(100% + 18px); height: calc(100% + 18px); transform: rotate(-90deg); pointer-events: none; }
.sealring circle { fill: none; stroke: var(--butter); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 290; stroke-dashoffset: 290; }
.waxseal.holding { transform: translate(-50%, -50%) scale(.93); }
.waxseal.holding .sealring circle { stroke-dashoffset: 0; transition: stroke-dashoffset 1.1s linear; }
.waxseal.stamped { animation: stamp .45s cubic-bezier(.3, 1.6, .5, 1) forwards; }
.waxseal.stamped .sealring { opacity: 0; }
@keyframes stamp { 0% { transform: translate(-50%, -50%) scale(1.5); } 60% { transform: translate(-50%, -50%) scale(.92); } 100% { transform: translate(-50%, -50%) scale(1) rotate(-8deg); } }
@media (prefers-reduced-motion: reduce) { .waxseal.stamped { animation: none; } .envelope .flap { transition: none; } }
.envelope { aspect-ratio: 4 / 3; place-content: end center; padding-bottom: 14px; box-sizing: border-box; text-align: center; }
.envto { margin-top: 0; }
.waxseal { top: 52%; }
.envelope .flap { height: 52%; }

/* ---------- making a tree: one question at a time, over the town ---------- */
.newstage .askcard { position: absolute; z-index: 3; left: 50%; bottom: max(14px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  width: min(100% - 28px, 520px); box-sizing: border-box; display: grid; gap: 12px; padding: 20px 20px 16px;
  background: rgba(247, 239, 220, .97); color: var(--ink); border-radius: 18px; box-shadow: 0 14px 34px rgba(0, 0, 0, .4);
  transition: transform .5s cubic-bezier(.5, 0, .7, .3), opacity .4s; }
.askcard.fwd > :not(.askdots) { animation: panein .32s cubic-bezier(.2, .9, .3, 1) both; --from: 28px; }
.askcard.back > :not(.askdots) { animation: panein .32s cubic-bezier(.2, .9, .3, 1) both; --from: -28px; }
.askcard.leaving { transform: translate(-50%, 140%); opacity: 0; }
.askdots { display: flex; gap: 6px; justify-content: center; }
.askdots span { width: 22px; height: 4px; border-radius: 2px; background: rgba(90, 60, 30, .2); }
.askdots span.on { background: var(--tomato); }
.askdots span.done { background: rgba(165, 53, 44, .45); }
.askq { margin: 0; font: 400 2.1rem/1.05 var(--display); color: var(--tomato-d); text-align: center; text-wrap: balance; }
.asksub { margin: -8px 0 0; text-align: center; font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.asksub[hidden] { display: none; }
.askbody { display: grid; gap: 10px; min-width: 0; }
.askbody .line.big { width: 100%; box-sizing: border-box; text-align: center; font: 400 2rem/1.2 var(--script); color: var(--ink); padding: 4px 0; }
.askbody .line.big::placeholder { color: rgba(90, 60, 30, .35); }
.askbody .line.big.missing { border-bottom-color: var(--tomato); animation: no .4s ease-in-out; }
.askbody .line.big.missing::placeholder { color: var(--tomato); }
.askcount { margin: 0; text-align: center; color: var(--ink-soft); }
.askcount .bignum { font-size: 2.2rem; vertical-align: -2px; }
.asktz { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 4px 8px; font-size: .9rem; color: var(--ink-soft); }
.asktz select.line { font-size: 1rem; max-width: 100%; }
.askbody #welcome { min-height: 96px; }
.askcard .formend { margin-top: 2px; }

/* the reveal: lights come on, their name hangs on a tag */
.town.lighting .tree-img { animation: lightson 2s ease-out both; }
@keyframes lightson { 0% { filter: brightness(.55) saturate(.6); } 30% { filter: brightness(.95); } 40% { filter: brightness(.7); } 55% { filter: brightness(1.15) saturate(1.1); } 100% { filter: brightness(1.08) saturate(1.05); } }
.nametag { position: absolute; left: 62%; top: 52%; z-index: 4; transform-origin: 50% 0; animation: tagin .9s .5s cubic-bezier(.3, 1.6, .5, 1) both, tagswing 3.2s 1.4s ease-in-out infinite; pointer-events: none; }
.nametag .string { display: block; width: 2px; height: 26px; margin: 0 auto; background: #c9a77a; }
.nametag .tagbody { display: block; min-height: 0; padding: 10px 14px 8px; background: #e9d7b4; box-shadow: 0 4px 10px rgba(0, 0, 0, .35);
  clip-path: polygon(16% 0, 84% 0, 100% 22%, 100% 100%, 0 100%, 0 22%); }
.nametag b { font: 400 1.5rem/1 var(--display); color: var(--tomato-d); white-space: nowrap; }
@keyframes tagin { from { transform: translateY(-40px) rotate(-20deg); opacity: 0; } }
@keyframes tagswing { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.revealline { position: absolute; z-index: 4; left: 50%; bottom: max(26px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: min(100% - 32px, 480px);
  margin: 0; text-align: center; font: 400 2rem/1.1 var(--display); color: var(--ivory); text-shadow: 0 2px 10px rgba(0, 0, 0, .65); animation: panein .6s 1.2s ease-out both; --from: 0; }
.town.instant, .town.instant * { transition: none !important; }
@media (prefers-reduced-motion: reduce) { .askcard.fwd > *, .askcard.back > *, .town.lighting .tree-img, .nametag, .revealline { animation: none; } }
.waxseal { top: 43%; }
.envelope .flap { height: 44%; }

/* ---------- first visit: a gift on the home tree ---------- */
.home-stage .orn { pointer-events: none; }
.home-stage .orn.star { opacity: .95; }
.home-stage .orn.taste { pointer-events: auto; --s: .24 !important; z-index: 2; cursor: pointer; }
.home-stage .orn.taste .glow { opacity: .9 !important; animation: beckon 2s ease-in-out infinite; }
.home-stage .orn.taste img { animation: sway 2.4s ease-in-out infinite; }
.home-stage .orn .numtag { display: none; }
.home-stage .orn.taste.hung { pointer-events: none; }
.home-stage .orn.taste.hung .glow { animation: none; opacity: 0 !important; }
.tipbubble.pinned { pointer-events: auto; cursor: pointer; animation: bubblein .35s cubic-bezier(.3, 1.4, .5, 1) both, bob 2.6s ease-in-out .4s infinite; }
.tasteend { display: grid; justify-items: center; gap: 8px; margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .home-stage .orn.taste .glow, .home-stage .orn.taste img, .tipbubble.pinned { animation: none; } }

/* ---------- the recipient's envelope ---------- */
.welcomeenv { padding: 18px 0 6px; }
.welcomeenv .waxseal { cursor: pointer; }
.waxseal.broken { animation: sealbreak .5s ease-in forwards; pointer-events: none; }
@keyframes sealbreak { 0% { transform: translate(-50%, -50%) scale(1); } 30% { transform: translate(-50%, -50%) scale(1.12) rotate(-6deg); } 100% { transform: translate(-50%, 10%) scale(.6) rotate(25deg); opacity: 0; } }
.lettercard.unfolding { animation: letterout .55s cubic-bezier(.2, .9, .3, 1.1) both; transform-origin: 50% 100%; width: min(320px, 82vw); box-shadow: 0 10px 24px rgba(60, 35, 20, .2), inset 0 0 0 1px rgba(90, 60, 30, .15); }
@keyframes letterout { from { opacity: 0; transform: translateY(40px) scaleY(.6); } }
.welcomeenv .lettercard .letter { font-size: 1.45rem; }
@media (prefers-reduced-motion: reduce) { .waxseal.broken, .lettercard.unfolding { animation: none; } }
/* an object on its own (the envelope), no card around it */
dialog.book.bare::backdrop { background: rgba(12, 26, 24, .62); }
dialog.book.bare .leaf { background: none; border: 0; box-shadow: none; padding-top: 40px; animation: none; overflow: visible; }
dialog.book.bare .closebtn { color: rgba(246, 238, 221, .85); }
dialog.book.bare .hint { color: rgba(246, 238, 221, .85); }
dialog.book.bare .envelope { animation: envin .6s cubic-bezier(.2, .9, .3, 1.1) both; }
@keyframes envin { from { opacity: 0; transform: translateY(30px) rotate(-4deg) scale(.92); } to { transform: rotate(-1.5deg); } }
@media (prefers-reduced-motion: reduce) { dialog.book.bare .envelope { animation: none; } }

/* ---------- painted postcards (4:3) ---------- */
.postcard { aspect-ratio: 4 / 3; width: min(100%, 460px); }
.pcface { overflow: hidden; border: 0; box-shadow: 0 10px 24px rgba(60, 35, 20, .28); border-radius: 3px; background: #f1e3c6; }
.pcback.painted { display: block; padding: 0; background-size: cover; background-position: center; }
/* the message: the left half, inside the red frame, clear of the holly corner */
.pcback.painted .pcmsg { position: absolute; left: 6%; top: 21%; width: 40%; bottom: 9%; border: 0; padding: 0; overflow: hidden; }
.pcback.painted .pcmsg p { font: 400 clamp(.85rem, 3.4vw, 1.15rem)/1.4 var(--script); color: #2b211c; }
.pcback.painted .pcmsg img { object-position: top left; mix-blend-mode: multiply; }
/* "To Ria" on the first painted address line; the date tucked into the wavy postmark */
.pcback.painted .pcto { position: absolute; left: 55%; right: 7%; top: 35.6%; font: 400 clamp(1rem, 4.4vw, 1.45rem)/1 var(--script); color: var(--tomato-d); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcback.painted .pcpostmark { position: absolute; left: 73%; top: 16.5%; font: .62rem var(--typed); letter-spacing: .08em; color: rgba(47, 77, 58, .75); transform: rotate(-4deg); }
.frontopt { aspect-ratio: 4 / 3; }
.fronts { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
/* message clear of the holly corner, the red frame and the centre divider */
.pcback.painted .pcmsg { left: 9%; top: 28%; width: 35%; bottom: 12%; }
.fliphint { margin: -4px 0 0; text-align: center; font: 400 .82rem/1.2 var(--hand); letter-spacing: .04em; color: var(--ink-soft); opacity: .8; }

/* ---------- type scale: one order everywhere ----------
   titles (script) > day number > date / body > links > close, hints */
:root { --fs-date: 1.15rem; --fs-body: 1.05rem; --fs-link: .95rem; --fs-meta: .82rem; }
.datehead .of { font-size: var(--fs-date); font-weight: 700; color: var(--ink); letter-spacing: .01em; }
.slotchip { font-size: var(--fs-date); color: var(--ink); }

.scribble { font-size: var(--fs-link); }
.bar .scribble { font-size: var(--fs-link); }
.hint, .fliphint, .coach-foot, .modeflag, .fhint { font-size: var(--fs-meta); }
.status { font-size: var(--fs-body); }
.steptop .scribble, .tasteend .scribble, .upsell .scribble, .sealbox .scribble { font-size: var(--fs-link); }

/* ---------- email rows ---------- */
.emailrow { display: grid; gap: 4px; width: min(300px, 82vw); text-align: left; }
.emailrow .line { width: 100%; box-sizing: border-box; font-size: 1.1rem; }
.emailrow.missing { animation: no .4s ease-in-out; }
.emailrow.missing .line { border-bottom-color: var(--tomato); }
.notifyrow { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: var(--fs-meta); color: var(--ink-soft); cursor: pointer; }
.notifyrow input { accent-color: var(--tomato); width: 16px; height: 16px; }
dialog.book.bare .emailrow .flabel, dialog.book.bare .emailrow .why { color: rgba(246, 238, 221, .9); }
dialog.book.bare .emailrow .line { color: var(--ivory); border-bottom-color: rgba(246, 238, 221, .8); }
dialog.book.bare .emailrow .line::placeholder { color: rgba(246, 238, 221, .5); }
dialog.book.bare .err { color: #ffb3a8; }
.emailrow .why { margin: 4px 0 0; font-size: var(--fs-meta); color: var(--ink-soft); }
dialog.book[data-locked="1"] .closebtn { display: none; }

/* ---------- the countdown to the next gift ---------- */
.countdown { display: grid; justify-items: center; gap: 4px; }
.countdown[hidden] { display: none; }
.cdlabel { font-size: var(--fs-meta); letter-spacing: .14em; text-transform: uppercase; color: rgba(246, 238, 221, .85); }
.cdrow { display: flex; gap: 8px; }
.cdunit { display: grid; justify-items: center; min-width: 52px; padding: 6px 6px 4px; border-radius: 8px; background: rgba(246, 238, 221, .92); color: var(--ink);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .3), inset 0 -2px 0 rgba(90, 60, 30, .15); }
.cdunit b { font: 700 1.5rem/1 var(--hand); font-variant-numeric: tabular-nums; color: var(--tomato-d); }
.cdunit small { font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin-top: 2px; }
.notified { margin: 0; font-size: var(--fs-meta); color: rgba(246, 238, 221, .9); }
.foot .ribbon.small { font-size: 1.2rem; padding: 6px 22px 5px; }
.home-stage .lists[hidden] { display: none; }

/* dragging ornaments: lifted while held, a warning tint over another ornament, a short slide when it settles */
.town.arranging.close .tree-box { touch-action: none; }
.orn.dragging img { transform: scale(1.22) rotate(-4deg); filter: drop-shadow(0 0 1.5px rgba(255, 246, 225, .95)) drop-shadow(0 14px 12px rgba(0, 0, 0, .45)); }
.orn.dragging.blocked img { opacity: .55; filter: drop-shadow(0 0 2px rgba(165, 53, 44, .95)) drop-shadow(0 0 8px rgba(165, 53, 44, .7)) sepia(.4) saturate(1.4) hue-rotate(-20deg); }
.orn.settling { transition: left .3s cubic-bezier(.3, 1.3, .5, 1), top .3s cubic-bezier(.3, 1.3, .5, 1); }

/* the "new tree" tag: the same kraft tag as the others, a red wax-seal plus, its name in script */
.twine.strand { align-items: flex-start; }
.gifttag.new .tagbody { min-height: 126px; place-content: initial; align-content: center; justify-items: center; gap: 8px;
  background: #e9d7b4 radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .35), transparent 60%); }
.gifttag.new .tagbody::after { content: ""; position: absolute; inset: 7px; clip-path: none; box-shadow: none; border: 1.5px dashed rgba(126, 38, 32, .35); border-radius: 2px; }
.gifttag.new b { color: var(--tomato-d); font-size: 1.35rem; }
.plusseal { width: 38px; height: 38px; display: grid; place-items: center; color: #f3c9b8; font: 700 1.6rem/1 var(--hand);
  border-radius: 47% 53% 50% 50% / 52% 48% 52% 48%; background: radial-gradient(circle at 38% 34%, #d0574b, #8e2219 72%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .3), inset 0 0 0 3px rgba(0, 0, 0, .12); }
.gifttag.new:hover .plusseal { transform: rotate(-8deg) scale(1.06); transition: transform .2s; }
/* new-tree tag: a painted present with a small plus, room for the words inside the stitching */
.gifttag.new .tagbody { padding: 24px 10px 16px; gap: 6px; align-content: start; }
.gifttag.new .tagbody::after { inset: 8px; }
.gifttag.new b { font-size: 1.2rem; position: relative; z-index: 1; }
.newcharm { position: relative; width: 44px; height: 44px; display: block; }
.newcharm .charm { width: 44px; height: 44px; }
.newcharm i { position: absolute; right: -6px; bottom: -2px; width: 18px; height: 18px; display: grid; place-items: center; font: 700 .9rem/1 var(--hand); font-style: normal;
  color: var(--ivory); background: var(--tomato); border-radius: 50%; box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
/* the dates button on a draft tree, and its sheet */
.datechip { all: unset; cursor: pointer; font-size: var(--fs-meta); letter-spacing: .03em; color: var(--ivory); padding: 5px 12px; border-radius: 999px;
  background: rgba(246, 238, 221, .14); box-shadow: inset 0 0 0 1px rgba(246, 238, 221, .45); }
.datechip::before { content: "✎ "; }
.datechip:hover, .datechip:focus-visible { background: rgba(246, 238, 221, .24); }
.datesheet { width: 100%; }
.datesheet .rangewrap, .datesheet .rangeends { width: 100%; }

/* days before today: faded out of the track */
.daterange { display: grid; gap: 2px; width: 100%; }
.duotrack { background:
  linear-gradient(to right, color-mix(in srgb, var(--ink) 8%, transparent) calc(var(--m, 0) * 100%), transparent calc(var(--m, 0) * 100%)),
  linear-gradient(to right, color-mix(in srgb, var(--ink) 25%, transparent) calc(var(--a, 0) * 100%), var(--tomato) calc(var(--a, 0) * 100%), var(--tomato) calc(var(--b, 1) * 100%), color-mix(in srgb, var(--ink) 25%, transparent) calc(var(--b, 1) * 100%)); }
.duotrack::before { content: ""; position: absolute; left: 0; top: -1px; bottom: -1px; width: calc(var(--m, 0) * 100%); border-radius: 3px;
  background: repeating-linear-gradient(-45deg, rgba(246, 238, 221, .9) 0 3px, transparent 3px 6px); pointer-events: none; }
.rangenote { margin: 0; min-height: 1.2em; text-align: center; font-size: var(--fs-meta); color: var(--tomato-d); opacity: 0; transform: translateY(-3px); transition: opacity .25s, transform .25s; }
.rangenote.on { opacity: 1; transform: none; }
/* the name on the hanging tag sits below the tag's hole */
.nametag .tagbody { padding: 26px 16px 10px; }

/* ---------- the gift sheet, tidied ---------- */
.sheethead { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 8px; margin: 2px 0 6px; }
.sheettitles { text-align: center; display: grid; gap: 2px; }
.sheethead .sheettitle { font-size: 1.9rem; line-height: 1.05; color: var(--tomato-d); }
.sheetsub { margin: 0; font-size: var(--fs-meta); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.iconbtn { all: unset; box-sizing: border-box; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  font: 400 1.25rem/1 var(--hand); color: var(--ink); background: var(--cream); box-shadow: inset 0 0 0 1px rgba(90, 60, 30, .2); }
.iconbtn:hover, .iconbtn:focus-visible { background: #efe2c6; }
.iconbtn:focus-visible { outline: 2px solid var(--tomato); outline-offset: 2px; }
.iconbtn.ghost { visibility: hidden; }

dialog.book.sheet .pane { gap: 16px; }
/* the note: a sheet of lined paper, the sign-off already written at the bottom */
.notepaper { position: relative; border-radius: 6px; padding: 10px 18px 12px; background: #fbf6ea repeating-linear-gradient(transparent 0 35px, rgba(90, 60, 30, .14) 35px 36px);
  background-position: 0 10px; box-shadow: 0 2px 10px rgba(60, 35, 20, .12), inset 0 0 0 1px rgba(90, 60, 30, .15); }
.notepaper::before { content: ""; position: absolute; left: 12px; top: 0; bottom: 0; width: 1px; background: rgba(165, 53, 44, .25); }
.sheet .notepaper .notepad { display: block; width: 100%; min-height: 216px; box-sizing: border-box; margin: 0; padding: 0 0 0 10px; border: 0; background: transparent;
  font: 400 1.4rem/36px var(--script); color: var(--ink); resize: none; outline: none; }
.notesig { margin: 0; text-align: right; font: 400 1.3rem/36px var(--script); color: var(--tomato-d); }
.sheet .editsec .hint:empty { display: none; }
/* save: a full-width button at the bottom; "empty it" a quiet link under it */
.sheetfoot { display: grid; gap: 8px; justify-items: center; margin-top: 4px; }
.savebtn { all: unset; box-sizing: border-box; width: 100%; text-align: center; cursor: pointer; padding: 14px 18px 12px; border-radius: 14px;
  font: 400 1.6rem/1 var(--display); color: var(--ivory); background: var(--tomato); box-shadow: 0 4px 0 var(--tomato-d), 0 8px 18px rgba(126, 38, 32, .3);
  transition: transform .12s, box-shadow .12s; }
.savebtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--tomato-d), 0 3px 8px rgba(126, 38, 32, .3); }
.savebtn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.savebtn[disabled] { opacity: .7; cursor: progress; }
.sheetfoot .scribble { font-size: var(--fs-meta); color: var(--ink-soft); }

/* ---------- send sheet: one centred column the width of the envelope ---------- */
.sendsheet { gap: 16px; padding-top: 2px; }
.sendsheet > * { width: min(320px, 100%); box-sizing: border-box; }
.sendsheet .sheettitles { margin-bottom: -2px; }
.sendsheet .sheettitle { font-size: 1.9rem; color: var(--tomato-d); }
.sendsheet .envelope { width: min(320px, 100%); margin-top: 4px; }
.sendsheet .emailrow { width: min(320px, 100%); }
.sendsheet .notifyrow { margin-top: 8px; }
.sendsheet .hint { margin: -4px 0 0; }
.sendsheet .err:empty { display: none; }
.sendsheet .ribbon, .sendsheet .scribble { width: auto; justify-self: center; }
/* the seal before it's pressed: a dashed outline saying where */
.waxseal.unset { background: rgba(246, 238, 221, .6); box-shadow: none; border: 2px dashed rgba(165, 53, 44, .7); }
.waxseal.unset .sealmark { color: var(--tomato); text-shadow: none; }
.waxseal.unset.holding { background: radial-gradient(circle at 38% 34%, rgba(208, 87, 75, .55), rgba(142, 34, 25, .55) 72%); }
.waxseal.unset::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(165, 53, 44, .35); animation: sealpulse 1.8s ease-out infinite; }
@keyframes sealpulse { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .waxseal.unset::after { animation: none; } }

/* ---------- home: tree first ---------- */
.home-stage.treefirst { height: 100svh; min-height: 0; overflow: hidden; }
.home-stage.treefirst .town { position: absolute; }
.homebar .painted { font-size: clamp(1.9rem, 8vw, 2.8rem); }
.homefoot { display: grid; justify-items: center; gap: 10px; padding-top: 30px; }
.homecta { display: grid; justify-items: center; gap: 10px; text-align: center; }
.homecta .sub { margin: 0; max-width: 30ch; font-size: var(--fs-body); color: var(--ivory); text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.homecta { animation: bubblein .4s cubic-bezier(.3, 1.4, .5, 1) both; }
.homeskip { color: rgba(246, 238, 221, .75); font-size: var(--fs-meta); }
.home-stage.treefirst .orn.taste { --s: .17 !important; }
.home-stage.treefirst .orn.taste.hung { pointer-events: auto; }
.home-stage.treefirst .orn.taste.hung .glow { opacity: .35 !important; animation: none; }
/* your trees as a strip inside the footer */
.home-stage.treefirst .lists { padding: 0; margin: 0; background: none; width: 100%; }
.home-stage.treefirst .lists .twine.strand { justify-content: center; }
.tasteend { gap: 10px; text-align: center; }
.tasteend .savebtn { text-decoration: none; }
.tasteend .center { margin: 0; color: var(--ink-soft); }

/* ---------- setup and links, quieter ---------- */
/* names in the script hand: room for its tall loops and long tails */
.askbody .line.big { line-height: 1.5; padding: 6px 4px 8px; min-height: 64px; overflow: visible; }
.line { overflow: visible; }
/* the count sits under the dates, smaller */
.askcount { font-size: var(--fs-body); }
.askcount .bignum { font-size: 1.6rem; }
/* links: no underlines; quiet colour, a little bolder; underline only on hover */
.scribble { text-decoration: none; font-weight: 600; color: var(--ink-soft); }
.scribble:hover, .scribble:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.bar .scribble, .foot .scribble { color: rgba(246, 238, 221, .9); }
/* the setup's Back / Next: smaller */
.askcard .formend .ribbon { font-size: 1.25rem; padding: 7px 22px 6px; }
.askcard .formend .scribble { font-size: var(--fs-link); }
/* the welcome story card: a bit smaller so the button stays in view */
.tasteend + * {}
#leaf .lettercard .letter { font-size: 1.25rem; line-height: 34px; }

/* ---------- gift sheet, round two ---------- */
.notepad { overflow: hidden; }
.noterow { display: flex; justify-content: space-between; align-items: center; min-height: 22px; margin-top: 6px; }
.notecount { font-size: var(--fs-meta); color: var(--ink-soft); }
.notecount.near { color: var(--tomato-d); font-weight: 700; }
.usebtn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-meta); font-weight: 600; color: var(--tomato-d);
  padding: 6px 12px; border-radius: 999px; background: #f3e3c8; box-shadow: inset 0 0 0 1px rgba(165, 53, 44, .3); }
.usebtn kbd { font: 600 .7rem/1 var(--hand); padding: 3px 6px; border-radius: 5px; background: var(--ivory); box-shadow: inset 0 -1px 0 rgba(90, 60, 30, .3), 0 0 0 1px rgba(90, 60, 30, .2); color: var(--ink-soft); }
@media (hover: none) { .usebtn kbd { display: none; } }
/* footer: Save fills the row; Remove, when there's a gift, is a smaller outlined button beside it */
.sheetfoot.withremove { grid-template-columns: auto 1fr; align-items: stretch; }
.removebtn { all: unset; box-sizing: border-box; cursor: pointer; display: grid; place-items: center; padding: 0 18px; border-radius: 14px; font-size: var(--fs-link); font-weight: 600;
  color: var(--tomato-d); box-shadow: inset 0 0 0 1.5px rgba(165, 53, 44, .45); }
.removebtn:hover, .removebtn:focus-visible { background: #f3e3c8; }
/* postcard: the three ways to write the back as one segmented choice; no tilted tiles */
.adders.small { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 3px; border-radius: 12px; background: #efe2c6; }
.adders.small .scribble { text-align: center; padding: 8px 6px; border-radius: 9px; font-size: .82rem; line-height: 1.2; color: var(--ink-soft); text-decoration: none; }
.adders.small .scribble[aria-pressed="true"] { background: var(--ivory); color: var(--tomato-d); box-shadow: 0 1px 3px rgba(60, 35, 20, .2); }
.frontopt, .frontopt:nth-child(even) { transform: none; }
.frontopt.own { border: 1.5px dashed rgba(90, 60, 30, .45); border-radius: 4px; }
.frontopt.own .scribble { text-decoration: none; font-weight: 600; }

/* ---------- send, round two ---------- */
.signsheet { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 6px 4px 4px; }
.signsheet > * { width: min(340px, 100%); }
.signwhy { margin: 0; color: var(--ink-soft); line-height: 1.45; }
.signsheet .err:empty, .sendsheet .err:empty { display: none; }
/* the notify toggle */
.notifyrow.toggle { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; margin: 0; font-size: var(--fs-body); color: var(--ink); cursor: pointer; }
.notifyrow.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { width: 40px; height: 24px; border-radius: 12px; background: rgba(90, 60, 30, .25); position: relative; transition: background .2s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .2s; }
.notifyrow.toggle input:checked + .switch { background: var(--pine); }
.notifyrow.toggle input:checked + .switch::after { transform: translateX(16px); }
.notifyrow.toggle input:focus-visible + .switch { outline: 2px solid var(--tomato); outline-offset: 2px; }
/* the sent screen: centred, the link already copied, then what next */
.sendsheet { justify-items: center; text-align: center; }
.sendsheet .savebtn { width: min(320px, 100%); }
.copiedline { margin: -6px 0 0; font-size: var(--fs-meta); color: var(--pine); font-weight: 700; }
.copiedline::before { content: "✓ "; }
.whatnext { display: grid; gap: 8px; width: min(320px, 100%); margin-top: 6px; padding-top: 14px; border-top: 1.5px dashed rgba(90, 60, 30, .25); }
.whatnext .flabel { margin: 0; text-align: center; }
.nextrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nextbtn { all: unset; box-sizing: border-box; cursor: pointer; display: grid; gap: 2px; text-align: center; padding: 12px 8px; border-radius: 12px; background: var(--cream);
  box-shadow: inset 0 0 0 1px rgba(90, 60, 30, .2); text-decoration: none; color: var(--ink); }
.nextbtn b { font: 400 1.25rem/1.1 var(--display); color: var(--tomato-d); }
.nextbtn small { font-size: .78rem; color: var(--ink-soft); }
.nextbtn:hover, .nextbtn:focus-visible { background: #efe2c6; }
/* the close button: a small round ×, the same everywhere */
.closebtn { all: unset; position: absolute; top: 12px; right: 12px; z-index: 3; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer;
  border-radius: 50%; font: 400 1.4rem/1 var(--hand); color: var(--ink-soft); background: rgba(239, 227, 201, .9); box-shadow: inset 0 0 0 1px rgba(90, 60, 30, .18); }
.closebtn:hover, .closebtn:focus-visible { color: var(--ink); background: #efe2c6; }
dialog.book.bare .closebtn { background: rgba(246, 238, 221, .18); color: var(--ivory); box-shadow: inset 0 0 0 1px rgba(246, 238, 221, .4); }
/* empty ornaments nudge when you try to send too soon */
.orn.nudge img { animation: no .45s ease-in-out 2; }
/* postcard address: room for the script's tails */
.pcback.painted .pcto { overflow: visible; padding-bottom: 6px; line-height: 1.2; top: 33%; }
.envlead { margin: 0 0 4px; font: 400 2rem/1.1 var(--display); color: var(--ivory); text-align: center; text-shadow: 0 2px 10px rgba(0, 0, 0, .55); text-wrap: balance; }
.adders.small { grid-template-columns: repeat(2, 1fr); }

/* ---------- the first gift: a postcard, everything on one screen ---------- */
.tastecard { display: grid; justify-items: center; gap: 12px; text-align: center; }
.tastehead { display: grid; justify-items: center; gap: 2px; }
.tastehead .sheettitle { font-size: 2rem; color: var(--tomato-d); }
.staricon { width: 44px; height: 44px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25)); }
.datehead .big.staricon { width: 72px; height: 72px; }
.tastecard .postcard { width: min(100%, 360px); margin: 2px 0 0; }
.tastecard .fliphint { margin: -4px 0 0; }
.tastecta { display: grid; gap: 10px; width: min(100%, 360px); }
.tastepass { margin: 0; font-size: var(--fs-body); color: var(--ink-soft); line-height: 1.35; }
.tastepass b { display: block; font: 400 1.5rem/1.1 var(--display); color: var(--ink); margin-bottom: 2px; }
.tastecta .savebtn { text-decoration: none; font-size: 1.4rem; padding: 12px 14px 10px; }
.tastecta .removebtn { padding: 0 14px; }
/* the home tree: bigger, so there's less empty sky above it */
.home-stage.treefirst .town.close.fit .tree-box { --w: min(calc((100cqh - var(--safeT) - var(--safeB)) * .96 * var(--arn)), 132cqw); }
.pcback.painted .pcmsg p { text-align: left; }
/* the first gift: buttons arrive after the message has had its moment */
.tastecta.later { opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .6s ease, transform .6s ease; }
.tastecta.later.shown { opacity: 1; transform: none; pointer-events: auto; }
.tasteactions { display: flex; align-items: center; gap: 10px; }
.tasteactions .savebtn { flex: 1; }
.iconbtn.round { width: 48px; height: 48px; flex: none; color: var(--tomato-d); background: var(--ivory); box-shadow: inset 0 0 0 1.5px rgba(165, 53, 44, .4); }
.iconbtn.round svg { width: 22px; height: 22px; }
.iconbtn.round:hover, .iconbtn.round:focus-visible { background: #f3e3c8; }
@media (prefers-reduced-motion: reduce) { .tastecta.later { transition: none; } }
/* no empty gap while waiting: the space opens as the buttons arrive */
.tastecta.later { max-height: 0; overflow: hidden; margin-top: -12px; transition: opacity .6s ease, transform .6s ease, max-height .6s ease, margin-top .6s ease; }
.tastecta.later.shown { max-height: 260px; margin-top: 0; overflow: visible; }
/* share menu (where there's no share sheet) */
.tasteactions { position: relative; }
.sharemenu { position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 5; display: grid; min-width: 170px; padding: 6px; border-radius: 12px; background: var(--ivory);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .25), inset 0 0 0 1px rgba(90, 60, 30, .15); animation: bubblein .25s cubic-bezier(.3, 1.4, .5, 1) both; }
.sharemenu-item { all: unset; cursor: pointer; padding: 9px 12px; border-radius: 8px; font-size: var(--fs-link); font-weight: 600; color: var(--ink); text-align: left; }
.sharemenu-item:hover, .sharemenu-item:focus-visible { background: #f3e3c8; }
.pcback.painted .pcmsg { display: flex; flex-direction: column; }
.pcback.painted .pcmsg .pcsign { margin-top: auto; padding-top: 6px; font: 400 clamp(.72rem, 2.9vw, .95rem)/1.25 var(--script); color: var(--tomato-d); }

/* gift picker: icon and name only; compact; the idea as a slim bar */
.gtile { padding: 12px 8px 10px; gap: 0; }
.gtile .gicon { width: 56px; height: 56px; margin-bottom: 2px; }
.gtile .gicon img { width: 56px; height: 56px; }
.gtile b { padding-top: 6px; font-size: 1.45rem; }
.gtiles { gap: 8px; }
.ideabar { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 12px;
  border: 1.5px dashed color-mix(in srgb, var(--choc) 45%, transparent); }
.ideabar:hover, .ideabar:focus-visible { background: var(--cream); }
.ideabar[hidden] { display: none; }
.ideadie svg { width: 28px; height: 28px; display: block; }
.ideabar b { font: 400 1.3rem/1 var(--display); color: var(--tomato-d); }
.ideabar small { margin-left: auto; font-size: var(--fs-meta); color: var(--ink-soft); }
/* errors: red, but the size of the other small text */
.err { font-size: .88rem; font-weight: 600; line-height: 1.35; min-height: 0; }
.err:empty { display: none; }

/* ---------- the recipient's envelope: painted ---------- */
.penv { position: relative; width: min(330px, 86vw); aspect-ratio: 1064 / 1191; margin: 4px auto 0; transform: rotate(-2deg);
  animation: envin .6s cubic-bezier(.2, .9, .3, 1.1) both; transition: transform .7s cubic-bezier(.5, 0, .3, 1), opacity .7s ease; }
.penvimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .45)); pointer-events: none; }
/* the blank card inside: names written on it */
.penvcard { position: absolute; left: 10%; right: 18%; top: 22.5%; height: 33.5%; display: grid; place-content: center; text-align: center; gap: 4px; pointer-events: none; }
.penvcard .envto { font: 400 clamp(1.7rem, 8vw, 2.3rem)/1 var(--display); color: var(--tomato-d); }
.penvcard .envfrom { font: 400 clamp(1.05rem, 4.6vw, 1.3rem)/1 var(--script); padding-top: 2px; color: var(--ink-soft); }
/* the painted seal is the button: a soft pulsing ring around it */
.penvseal { all: unset; position: absolute; left: 46.2%; top: 65%; width: 23%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; cursor: pointer; }
.penvseal::after { content: ""; position: absolute; inset: -8%; border-radius: 50%; border: 2px solid rgba(255, 236, 190, .85); animation: sealpulse 1.8s ease-out infinite; }
.penvseal:focus-visible { outline: 2px dashed var(--ivory); outline-offset: 6px; }
/* opening: the envelope sinks away as the letter rises */
.penv.opening { transform: translateY(60px) scale(.9) rotate(-2deg); opacity: 0; }
.penv.opening .penvseal::after { animation: none; opacity: 0; }
@media (prefers-reduced-motion: reduce) { .penv, .penvseal::after { animation: none; transition: none; } }
/* the reminder tickbox under the countdown, on the dark scene */
.remindrow { color: var(--ivory); font-size: var(--fs-link); text-shadow: 0 1px 4px rgba(0, 0, 0, .6); justify-self: center; }
.remindrow .switch { background: rgba(246, 238, 221, .3); }

/* the recipient's gate: one Google button under the envelope, all on one screen */
dialog.book.bare:has(.welcomeenv)::backdrop { background: rgba(10, 22, 20, .82); }
.welcomeenv { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.welcomeenv .penv { width: min(320px, 82vw, calc((100svh - 290px) * 1064 / 1191)); }
.opengate { display: grid; justify-items: center; gap: 6px; width: min(300px, 82vw); }
.opengate .gbtn { width: 100%; }
dialog.book.bare .opengate .why { margin: 0; color: rgba(246, 238, 221, .8); font-size: var(--fs-meta); text-align: center; }
/* while the envelope is up, the tree's footer (countdown, reminder) stays out of the way */
body:has(dialog.book.bare[open] .welcomeenv) .foot { visibility: hidden; }

/* "Sure you want to leave?" */
.leavecard { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 8px 4px 2px; }
.leavecard .sheettitle { margin: 0; }
.leavecard .leavesub { margin: 0 0 6px; font: 400 1.25rem/1.25 var(--script); color: var(--ink-soft); }
.leavecard .savebtn { width: min(260px, 100%); }
.textbtn { all: unset; cursor: pointer; font-size: var(--fs-meta); color: var(--ink-soft); padding: 6px 10px; }
.textbtn:focus-visible { outline: 2px dashed var(--ink-soft); outline-offset: 2px; }

/* the bar: the title sits in the true middle, links at either side */
.bar > :last-child { justify-self: end; }
/* "Remind me": a painted-paper tickbox, ivory words that read on the dark snow */
.remindrow { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 10px auto 0; cursor: pointer;
  font-size: 1rem; line-height: 1.3; color: var(--ivory); text-shadow: 0 1px 6px rgba(0, 0, 0, .7); width: fit-content; max-width: 100%; }
.remindrow input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.remindrow .tick { flex: none; width: 22px; height: 22px; border-radius: 4px; background: var(--ivory); box-shadow: inset 0 0 0 1.5px rgba(90, 60, 30, .45), 0 2px 6px rgba(0, 0, 0, .35); display: grid; place-items: center; transform: rotate(-2deg); }
.remindrow .tick::after { content: ""; width: 6px; height: 12px; border: solid var(--tomato); border-width: 0 3px 3px 0; transform: translateY(-1px) rotate(45deg) scale(0); transition: transform .18s cubic-bezier(.3, 1.6, .5, 1); }
.remindrow input:checked + .tick::after { transform: translateY(-1px) rotate(45deg) scale(1); }
.remindrow input:focus-visible + .tick { outline: 2px solid var(--ivory); outline-offset: 3px; }

/* #/admin */
.adminpage { max-width: 760px; margin: 0 auto; padding-top: 28px; padding-bottom: 40px; background: var(--paper, #f6eedd); min-height: 100svh; color: var(--ink); }
.adminsum { color: var(--ink-soft); margin: 4px 0 14px; }
.admintable { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admintable th, .admintable td { text-align: left; padding: 8px 6px; border-bottom: 1px solid rgba(90, 60, 30, .15); overflow-wrap: anywhere; }
.admintable th { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.admintable .yes { color: var(--pine); font-weight: 700; }
.admintable .no { color: var(--ink-soft); }

/* "Waiting for you": a small painted heading over the same twine tags */
.waitshelf .shelftitle { margin: 0 0 2px; text-align: center; font: 400 1.35rem/1 var(--display); color: var(--ivory); text-shadow: 0 2px 8px rgba(0, 0, 0, .55); }
.gifttag.got .envcharm { object-fit: contain; transform: rotate(-4deg); }

/* close up, measured: the painting slides up so the ground meets the trunk; the snow carries on underneath */

.town.close.fit .town-bg img { transform-origin: 50% 0; transform: translateY(var(--fitT, 0)) scale(var(--fitS, 1)); }

/* trees sent to you, on the home page: a slim line on the snow, not a big tag */
.gotlist { display: grid; justify-items: center; gap: 6px; }
.gotrow { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px 6px 8px; border-radius: 999px; text-decoration: none;
  background: rgba(15, 30, 28, .45); box-shadow: inset 0 0 0 1px rgba(246, 238, 221, .28); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.gotenv { width: 30px; height: 34px; object-fit: contain; transform: rotate(-6deg); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .4)); }
.gotfrom { font: 400 1.2rem/1 var(--display); color: var(--ivory); }
.gotopen { font-size: .85rem; letter-spacing: .04em; color: var(--butter, #d6a646); }
.gotopen::after { content: " ›"; }
.gotrow:hover, .gotrow:focus-visible { background: rgba(15, 30, 28, .6); }

/* trees sent to you: a plain underlined line on the snow, same family as the other links */
.gotlist { display: grid; justify-items: center; gap: 4px; }
.gotrow { all: unset; cursor: pointer; padding: 0; border-radius: 0; background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  font: 400 1.25rem/1.2 var(--display); color: var(--ivory); text-shadow: 0 1px 6px rgba(0, 0, 0, .7);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; text-decoration-color: rgba(246, 238, 221, .5); }
.gotrow::after { content: " ›"; }
.gotrow:focus-visible { outline: 2px dashed var(--ivory); outline-offset: 4px; }
.asklink { color: rgba(246, 238, 221, .85); font-size: var(--fs-meta); }
.asksheet .line.big { width: 100%; box-sizing: border-box; text-align: center; }
.askshare { position: relative; display: grid; }

/* a tree sent to you: a small card hanging on the home tree */
.hangcard { position: absolute; z-index: 3; transform: translate(-50%, 0) rotate(var(--r, 0deg)); transform-origin: 50% 0; text-decoration: none;
  display: grid; justify-items: center; animation: hangsway 4s ease-in-out infinite alternate; }
.hangstring { width: 1.5px; height: 14px; background: #d9c08a; box-shadow: 0 0 2px rgba(0, 0, 0, .3); }
.hangbody { display: grid; justify-items: center; gap: 1px; padding: 6px 10px 7px; min-width: 64px; border-radius: 3px;
  background: var(--ivory); box-shadow: 0 4px 10px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(90, 60, 30, .2); }
.hangbody b { font: 400 1.2rem/1 var(--display); color: var(--tomato-d); white-space: nowrap; }
.hangbody small { font: 400 1.05rem/1 var(--script); color: var(--ink-soft); white-space: nowrap; }
.town:not(.close) .hangcard { opacity: 0; pointer-events: none; }
.hangcard:focus-visible .hangbody { outline: 2px dashed var(--ivory); outline-offset: 3px; }
@keyframes hangsway { from { transform: translate(-50%, 0) rotate(calc(var(--r, 0deg) - 2deg)); } to { transform: translate(-50%, 0) rotate(calc(var(--r, 0deg) + 2deg)); } }
@media (prefers-reduced-motion: reduce) { .hangcard { animation: none; } }

.waitbody { display: grid; justify-items: center; gap: 8px; }
.waitbody .savebtn { width: min(280px, 100%); }
.waitdone { margin: 0; font: 400 1.6rem/1.1 var(--display); color: var(--tomato-d); }
.adminwait { margin: 8px 0 18px; } .adminwait ul { margin: 6px 0 0; padding-left: 18px; }

/* the received-tree ornament: the painted letter, a glow so it reads as tappable, the sender's name under it */
.hangcard { gap: 2px; }
.hangimg { width: 17cqw; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .4)) drop-shadow(0 0 10px rgba(255, 214, 140, .55)); }
.hangname { font: 400 1.05rem/1 var(--script); color: var(--ivory); text-shadow: 0 1px 4px rgba(0, 0, 0, .85), 0 0 8px rgba(0, 0, 0, .5); white-space: nowrap; }
.hangcard .hangbody, .hangcard .hangstring { display: none; }
.waitsub { margin: 4px 0 14px; text-align: center; font-size: var(--fs-body); line-height: 1.4; color: var(--ink-soft); text-wrap: balance; }

/* ask for a tree: the story picture and how to add the link */
.askstory { display: grid; grid-template-columns: 38% 1fr; gap: 14px; align-items: center; margin: 4px 0 12px; }
.askpreview { width: 100%; border-radius: 10px; box-shadow: 0 6px 16px rgba(0, 0, 0, .3); }
.asksteps { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; font-size: var(--fs-body); line-height: 1.35; color: var(--ink); }
.asksteps li::marker { font-family: var(--display); color: var(--tomato-d); }
.asksheet .savebtn { width: 100%; }
.asksheet .askshare { justify-items: center; margin-top: 4px; }

/* report */
.reportlist { display: grid; gap: 8px; margin-top: 4px; }
.reportbtn { all: unset; cursor: pointer; padding: 12px 14px; border-radius: 10px; background: rgba(90, 60, 30, .06); box-shadow: inset 0 0 0 1px rgba(90, 60, 30, .18); font-size: var(--fs-body); color: var(--ink); }
.reportbtn:disabled { opacity: .5; cursor: default; }
.reportlink { all: unset; cursor: pointer; display: block; margin: 8px auto 0; font-size: .8rem; color: rgba(246, 238, 221, .55); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- admin dashboard ---------- */
.adminpage { max-width: 1040px; margin: 0 auto; padding: 24px 16px 60px; min-height: 100svh; background: #f6eedd; color: var(--ink); }
.ahead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ahead h1 { margin: 0; font: 400 2rem/1 var(--display); color: var(--tomato-d); }
.ahead .scribble { color: var(--ink-soft); }
.atabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0; position: sticky; top: 0; padding: 8px 0; background: #f6eedd; z-index: 2; }
.atabs button { all: unset; cursor: pointer; padding: 8px 14px; border-radius: 999px; font-size: .95rem; color: var(--ink-soft); box-shadow: inset 0 0 0 1px rgba(90, 60, 30, .2); }
.atabs button.on { background: var(--pine); color: #f6eedd; box-shadow: none; }
.abody { display: grid; gap: 14px; }
.astats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.astat { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; background: #fffaf0; box-shadow: inset 0 0 0 1px rgba(90, 60, 30, .12); }
.astat b { font: 700 1.6rem/1.1 var(--body, inherit); color: var(--ink); font-variant-numeric: tabular-nums; }
.astat span { font-size: .85rem; color: var(--ink-soft); }
.astat small { font-size: .75rem; color: var(--ink-soft); opacity: .8; }
.acard { padding: 16px; border-radius: 14px; background: #fffaf0; box-shadow: inset 0 0 0 1px rgba(90, 60, 30, .12); min-width: 0; }
.acard h2 { margin: 0 0 10px; font: 700 1.05rem/1.3 var(--body, inherit); color: var(--ink); }
.abars { display: grid; gap: 6px; }
.abar { display: grid; grid-template-columns: minmax(0, 38%) 1fr auto; gap: 10px; align-items: center; font-size: .9rem; }
.alabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.atrack { height: 10px; border-radius: 5px; background: rgba(90, 60, 30, .08); overflow: hidden; }
.atrack i { display: block; height: 100%; border-radius: 5px; background: var(--pine); }
.anum { font-variant-numeric: tabular-nums; color: var(--ink-soft); white-space: nowrap; font-size: .85rem; }
.acard.email .emailhead { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.etag { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: rgba(47, 77, 58, .12); color: var(--pine); }
.etag.nudge, .etag.reminder { background: rgba(214, 166, 70, .2); color: #7a5a14; }
.etag.news, .etag.invite { background: rgba(165, 53, 44, .12); color: var(--tomato-d); }
.ewho { font-size: .85rem; color: var(--ink-soft); }
.acard.email h2 { margin: 0; font-size: 1.15rem; }
.epre { margin: 2px 0 8px; color: var(--ink-soft); font-size: .9rem; }
.ebody { margin: 0 0 10px; }
.ecta { display: inline-block; padding: 8px 14px; border-radius: 8px; background: var(--tomato); color: #f6eedd; font-size: .9rem; margin-bottom: 8px; }
.ewhen { margin: 2px 0; font-size: .82rem; color: var(--ink-soft); }
.estats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.estats .astat { padding: 8px; } .estats .astat b { font-size: 1.1rem; }
.arow { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.alist { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
@media (max-width: 600px) { .estats { grid-template-columns: repeat(3, minmax(0, 1fr)); } .abar { grid-template-columns: minmax(0, 40%) 1fr; } .anum { grid-column: 1 / -1; } }

/* send sheet: the painted envelope, smaller; a light tickbox */
.sendenv { width: min(230px, 60vw); margin: 4px auto 6px; animation: none; }
.sendenv.sealed { animation: sealpop .6s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes sealpop { 40% { transform: rotate(-2deg) scale(1.06); } }
.tickrow { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 4px auto 12px; cursor: pointer; font-size: var(--fs-body); color: var(--ink); text-align: left; }
.tickrow input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tickrow .tick { flex: none; width: 22px; height: 22px; border-radius: 4px; background: #fffaf0; box-shadow: inset 0 0 0 1.5px rgba(90, 60, 30, .45); display: grid; place-items: center; }
.tickrow .tick::after { content: ""; width: 6px; height: 12px; border: solid var(--tomato); border-width: 0 3px 3px 0; transform: translateY(-1px) rotate(45deg) scale(0); transition: transform .18s cubic-bezier(.3, 1.6, .5, 1); }
.tickrow input:checked + .tick::after { transform: translateY(-1px) rotate(45deg) scale(1); }
.tickrow input:focus-visible + .tick { outline: 2px solid var(--tomato); outline-offset: 3px; }
.sendsheet .savebtn { width: 100%; }

/* "Still being wrapped" and friends: the same painted night as the waiting screen, a small card in the middle */
.page.notice { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; min-height: 0;
  background: linear-gradient(rgba(12, 26, 24, .55), rgba(12, 26, 24, .75)), url("assets/themes/christmas/town-portrait.webp") center bottom / cover, #17312f; }
.page.notice .leaf { width: min(360px, 100%); text-align: center; }

/* after sealing: one button, two quiet links */
.sentlinks { display: flex; justify-content: center; gap: 10px; margin-top: 12px; font-size: var(--fs-body); color: var(--ink-soft); }
.sentlinks a { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(90, 60, 30, .35); }
.sendsheet .copiedline { margin: 2px 0 10px; text-align: center; }

.sharebtn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.sharebtn svg { width: 22px; height: 22px; flex: none; }

/* the sender's name, in warm gold, so it's the first thing they read */
.envlead .who { color: #f2c66d; text-shadow: 0 2px 12px rgba(0, 0, 0, .6), 0 0 18px rgba(242, 198, 109, .35); }

/* home: quiet links under the button */
.homelinks { display: flex; justify-content: center; gap: 18px; margin-top: 4px; }
.linkish { all: unset; cursor: pointer; font-size: var(--fs-meta); color: rgba(246, 238, 221, .85); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(246, 238, 221, .4); text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.linkish:focus-visible { outline: 2px dashed #f6eedd; outline-offset: 3px; }
/* your trees sheet */
.treelist { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
.treelist a { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink); background: rgba(90, 60, 30, .05); box-shadow: inset 0 0 0 1px rgba(90, 60, 30, .14); }
.treelist img { width: 44px; height: 44px; object-fit: contain; }
.tl-main { display: grid; gap: 2px; min-width: 0; }
.tl-main b { font: 400 1.35rem/1.1 var(--display); color: var(--tomato-d); }
.tl-main small { font-size: .85rem; color: var(--ink-soft); }
.tl-tag { font-size: .8rem; padding: 4px 10px; border-radius: 999px; background: var(--tomato); color: #f6eedd; }
.tl-tag.sent { background: rgba(47, 77, 58, .14); color: var(--pine); }

/* "Ask someone for a tree": second button, ghost style, painted envelope */
.askbtn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px 7px 10px; border-radius: 999px;
  font: 400 1.2rem/1 var(--display); color: #f6eedd; background: rgba(15, 30, 28, .4); box-shadow: inset 0 0 0 1.5px rgba(246, 238, 221, .65);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); text-shadow: 0 1px 6px rgba(0, 0, 0, .5); }
.askbtn img { width: 28px; height: 30px; object-fit: contain; transform: rotate(-6deg); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .4)); }
.askbtn:hover { background: rgba(15, 30, 28, .55); }
.askbtn:focus-visible { outline: 2px dashed #f6eedd; outline-offset: 3px; }

.homecta .askribbon { font-size: 1.15rem; padding: 6px 26px 5px; margin-top: -2px; }

/* names on the envelope card: one line each, shrunk to fit (fitLine) */
.penvcard .envto, .penvcard .envfrom { display: block; white-space: nowrap; overflow: hidden; max-width: 100%; padding-inline: 4px; box-sizing: border-box; }

/* feedback */
.fbchips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 2px 0 10px; }
.fbchip { all: unset; cursor: pointer; padding: 8px 14px; border-radius: 999px; font-size: .95rem; color: var(--ink); box-shadow: inset 0 0 0 1px rgba(90, 60, 30, .3); }
.fbchip[aria-checked="true"] { background: var(--pine); color: #f6eedd; box-shadow: none; }
.fbchip:focus-visible { outline: 2px dashed var(--pine); outline-offset: 2px; }
.fbtext { width: 100%; box-sizing: border-box; min-height: 110px; resize: vertical; margin-bottom: 8px; }
.fbsheet .savebtn { width: 100%; }
.footlinks { display: flex; justify-content: center; gap: 16px; }
