/* Adventfully art v2: a gift package seen from above, lying on a table. Pairs with art.js.
   gb- one gift box   pp- a paper   pk- the package   ot- the composer's open box
   th- things          mi- mini icons   sc- the table (scene)
   bn- the little extra in a paid box   wax the wax seal   pc- a parcel (a calendar box given as a present)
   Full-colour papercraft: flat paper layers, warm tinted shadows (never pure black or white).
   Only transform and opacity animate; every loop stops under prefers-reduced-motion (bottom of file).
   Font faces mirror app.css on purpose so this file stands on its own; the browser fetches each once. */
@font-face { font-family: "Instrument Serif"; src: url(/fonts/serif.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: Inter; font-weight: 400 600; src: url(/fonts/inter.woff2) format("woff2"); font-display: swap; }
/* Kalam Bold (OFL 1.1, Indian Type Foundry), Latin subset. One file serves every weight so no faux bold. */
@font-face { font-family: "Adventfully Hand"; font-weight: 100 900; src: url(/fonts/hand.woff2) format("woff2"); font-display: swap; }

:root {
  --hand: "Adventfully Hand", "Kalam", "Segoe Print", "Bradley Hand", cursive;
  --shade: 74, 42, 22;        /* tinted shadow, as an rgb triple: rgba(var(--shade), a) */
  --ink: #3b2417;             /* handwriting on cream paper */
  --focus: #f2c14e;           /* focus ring */
  --focus-edge: rgba(59, 36, 23, .6);
}

/* ======================================================================
   Papers: colours and patterns. pp-* sets variables; parts use them.
   ====================================================================== */

.pp-kraft {
  --pp-bg:
    radial-gradient(circle at 30% 40%, rgba(96, 58, 28, .24) 0 .7px, transparent 1.3px) 0 0 / 9px 11px,
    radial-gradient(circle at 60% 70%, rgba(250, 230, 196, .3) 0 .6px, transparent 1.2px) 3px 5px / 13px 9px,
    repeating-linear-gradient(100deg, rgba(110, 70, 36, .08) 0 1px, transparent 1px 6px),
    linear-gradient(155deg, #cba271, #b98a59);
  --rb: #efe2c4; --rb-d: #b89c6e; --rb-l: #fbf3e0; --tw: #eddcb4; --tw-d: #9f7f4c;
  --pen: #3b2417; --stamp: #a8322d; --stk: #f6ecd9; --stk-ink: #3b2417;
  --inside: #9a6f44; --tissue: #efe3cc; --tissue-d: #cdb48c;
}
.pp-berry {
  --pp-bg:
    radial-gradient(circle, #f3e4cf 0 2px, transparent 2.5px) 0 0 / 13px 13px,
    radial-gradient(circle, #f1dcc6 0 1.1px, transparent 1.5px) 6.5px 6.5px / 13px 13px,
    linear-gradient(155deg, #c43b47, #a62936);
  --rb: #f2e6d2; --rb-d: #cdb994; --rb-l: #fdf8ee;
  --pen: #f8ecd8; --stamp: #ecc970; --stk: #f6ecd9; --stk-ink: #8e1f2c;
  --inside: #741b28; --tissue: #f6dedd; --tissue-d: #dcb0b0;
}
.pp-pine {
  --pp-bg:
    repeating-linear-gradient(135deg, transparent 0 6px, rgba(16, 54, 37, .34) 6px 12px, transparent 12px 14px, rgba(238, 226, 196, .5) 14px 15px, transparent 15px 20px),
    linear-gradient(155deg, #347a5b, #265d45);
  --rb: #b3262f; --rb-d: #7a1820; --rb-l: #db5660;
  --pen: #f3ead6; --stamp: #e5c470; --stk: linear-gradient(140deg, #f6df9a, #d6a849 60%, #b98a34); --stk-ink: #1e4434;
  --inside: #1b4634; --tissue: #dcebdf; --tissue-d: #a9c7b1;
}
.pp-linen {
  --pp-bg:
    repeating-linear-gradient(0deg, rgba(122, 100, 70, .09) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(122, 100, 70, .08) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 30% 30%, rgba(122, 100, 70, .14) 0 .6px, transparent 1px) 0 0 / 7px 7px,
    linear-gradient(155deg, #efe6d4, #ddd0b8);
  --rb: #c84a4f; --rb-d: #8f2530; --rb-l: #ef9a98;
  --pen: #2e3a5c; --stamp: #b43a3a; --stk: #b8353f; --stk-ink: #f8ecd8;
  --inside: #c2b190; --tissue: #f6efe3; --tissue-d: #d6c8ae;
}
.pp-gold {
  --pp-bg:
    radial-gradient(circle, rgba(255, 246, 214, .2) 0 .6px, transparent 1.1px) 0 0 / 5px 5px,
    linear-gradient(125deg, #b98a34 0%, #e8c66f 20%, #f8e4a8 32%, #d6a64a 48%, #f0d389 64%, #b88a35 84%, #e3bf66 100%);
  --rb: #8e1d2b; --rb-d: #5e1019; --rb-l: #c4485a;
  --pen: #5a3a0e; --stamp: #8e1d2b; --stk: #f8efdc; --stk-ink: #5a3a0e;
  --inside: #6b4c1a; --tissue: #f6ead0; --tissue-d: #dcc28c;
}
.pp-velvet {
  --pp-bg:
    repeating-linear-gradient(45deg, rgba(255, 200, 220, .03) 0 1px, transparent 1px 3px),
    radial-gradient(130% 100% at 28% 18%, #9c2d4d 0%, #74193a 42%, #4d0d26 100%);
  --rb: #dcb057; --rb-d: #a87d2c; --rb-l: #f6e2a6;
  --pen: #efcf83; --stamp: #e3bd63; --stk: linear-gradient(140deg, #f6df9a, #d6a849 60%, #b98a34); --stk-ink: #5a1027;
  --inside: #3c0a1d; --tissue: #f0d9df; --tissue-d: #d3a8b6;
}
.pp-aurora {
  --pp-bg: linear-gradient(155deg, #efe9f6, #dfe4f3);
  --rb: #f6f1fb; --rb-d: #c3b8de; --rb-l: #fdfaf6;
  --pen: #4c3a6e; --stamp: #6e56a3; --stk: #f8f3fb; --stk-ink: #4c3a6e;
  --inside: #b3abd3; --tissue: #ece4f6; --tissue-d: #c8bce4;
}
.pp-starlight {
  --pp-bg:
    radial-gradient(circle, rgba(240, 226, 180, .75) 0 .6px, transparent 1px) 0 0 / 11px 13px,
    radial-gradient(circle, rgba(214, 222, 245, .55) 0 .5px, transparent .9px) 5px 7px / 9px 10px,
    linear-gradient(155deg, #26346e, #19224f);
  --rb: #dfe3ee; --rb-d: #9aa2bb; --rb-l: #f7f8fc;
  --pen: #efe9f6; --stamp: #e3c271; --stk: linear-gradient(140deg, #f6df9a, #d6a849 60%, #b98a34); --stk-ink: #1f2a5c;
  --inside: #10183c; --tissue: #e3e8f4; --tissue-d: #b6c0dc;
}
/* Gold edition: every ribbon turns gold (a deeper gold on gold foil, so it still reads). */
.gb-gold { --rb: #d8ab4f; --rb-d: #9a7026; --rb-l: #f7e2a0; }
.gb-gold.pp-gold { --rb: #a8792a; --rb-d: #6f4e16; --rb-l: #e2bd66; }

/* ======================================================================
   One gift box, seen from above
   ====================================================================== */

.gb {
  --ar: 1; --bw: 12cqmin; --bow: 58cqmin; --tagw: 90cqmin; --sprw: 56cqmin;
  position: relative; display: block; width: 100%; aspect-ratio: var(--ar); container-type: size;
  -webkit-user-select: none; user-select: none; color: var(--ink);
}
.gb-m  { --ar: 2.06; --bw: 13cqmin; --bow: 62cqmin; --tagw: 92cqmin; }
.gb-l  { --ar: 1; --bw: 8.5cqmin; --bow: 56cqmin; --tagw: 54cqmin; --sprw: 62cqmin; }
.gb-xl { --ar: 1.53; --bw: 10cqmin; --bow: 68cqmin; --tagw: 56cqmin; --sprw: 72cqmin; }
.gb-rb-twine { --bow: 58cqmin; }
.gb-rb-twine.gb-l { --bow: 52cqmin; }
.gb-rb-twine.gb-xl { --bow: 60cqmin; }

.gb-body { position: absolute; inset: 3.5cqmin; rotate: var(--gb-r, 0deg); }
.gb-lid, .gb-base { position: absolute; inset: 0; border-radius: 2.4cqmin 3cqmin 2.2cqmin 3.4cqmin; }
.gb-lid {
  overflow: hidden;
  box-shadow: 0 .5px 0 rgba(var(--shade), .35), .6cqmin 1.4cqmin 1.6cqmin rgba(var(--shade), .32), 1.4cqmin 3.4cqmin 5cqmin -1cqmin rgba(var(--shade), .38);
}
.gb-paper { position: absolute; inset: 0; border-radius: inherit; background: var(--pp-bg); }
/* Light from the top left: a soft sheen, a lit top edge, a shaded bottom edge. */
.gb-paper::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(140deg, rgba(255, 248, 235, .22), rgba(255, 248, 235, 0) 38%, rgba(255, 248, 235, 0) 62%, rgba(var(--shade), .14));
  box-shadow: inset .8px .8px 0 rgba(255, 246, 230, .4), inset -.8px -1.2px 0 rgba(var(--shade), .28);
}

/* Starlight: foil stars. Gold, velvet, aurora: a moving sheen, clipped to the lid. */
.gb-stars { position: absolute; inset: 0; width: 100%; height: 100%; }
.st-f0 { fill: #ecca74; } .st-f1 { fill: #dfe4f2; } .st-d { fill: #f2e2b0; opacity: .8; }
.gb-sheen { position: absolute; pointer-events: none; }
.pp-gold .gb-sheen {
  inset: -10% -70%;
  background: linear-gradient(105deg, rgba(255, 246, 214, 0) 40%, rgba(255, 246, 214, .55) 47%, rgba(255, 250, 236, .8) 50%, rgba(255, 246, 214, .5) 53%, rgba(255, 246, 214, 0) 60%);
  transform: translateX(-45%); animation: gb-shimmer 6s cubic-bezier(.45, 0, .25, 1) infinite; animation-delay: calc(var(--gb-k, 0) * -1s);
}
.pp-velvet .gb-sheen {
  inset: -40%;
  background: radial-gradient(28% 22% at 50% 50%, rgba(255, 196, 214, .3), rgba(255, 196, 214, 0) 70%);
  animation: gb-velvet 7s ease-in-out infinite alternate;
}
.pp-aurora .gb-sheen {
  inset: -20% -120%;
  background:
    repeating-linear-gradient(100deg, rgba(253, 250, 246, .18) 0 2px, rgba(253, 250, 246, 0) 2px 7px),
    linear-gradient(100deg, #b6f0e0, #c6c0ff 14%, #f5c2e4 28%, #ffe1c0 42%, #c0efd6 56%, #b4d3ff 70%, #e5c4ff 84%, #b6f0e0);
  opacity: .82; animation: gb-holo 10s ease-in-out infinite alternate;
}
@keyframes gb-shimmer { 0% { transform: translateX(-45%); } 45%, 100% { transform: translateX(45%); } }
@keyframes gb-velvet { from { transform: translate(-14%, -12%); } to { transform: translate(14%, 10%); } }
@keyframes gb-holo { from { transform: translateX(-22%); } to { transform: translateX(22%); } }

/* Ribbons. --rx/--ry are the crossing in percent of the box. */
.gb-rib { position: absolute; inset: 0; }
.gb-band { position: absolute; display: block; }
.gb-band-v {
  top: -.5px; bottom: -.5px; left: calc(var(--rx) * 1% - var(--bw) / 2); width: var(--bw); transform-origin: 50% 0;
  background: linear-gradient(90deg, var(--rb-d) 0 7%, var(--rb) 15% 34%, var(--rb-l) 47%, var(--rb) 60% 86%, var(--rb-d) 94%);
  box-shadow: .4cqmin 0 .9cqmin rgba(var(--shade), .38), -.3cqmin 0 .5cqmin rgba(var(--shade), .18);
}
.gb-band-h {
  left: -.5px; right: -.5px; top: calc(var(--ry) * 1% - var(--bw) / 2); height: var(--bw); transform-origin: 0 50%;
  background: linear-gradient(180deg, var(--rb-d) 0 7%, var(--rb) 15% 34%, var(--rb-l) 47%, var(--rb) 60% 86%, var(--rb-d) 94%);
  box-shadow: 0 .5cqmin .9cqmin rgba(var(--shade), .38), 0 -.3cqmin .5cqmin rgba(var(--shade), .18);
}
.gb-rb-gingham .gb-band {
  background:
    linear-gradient(90deg, rgba(176, 42, 54, .55) 50%, transparent 0) 0 0 / 5px 5px,
    linear-gradient(0deg, rgba(176, 42, 54, .55) 50%, transparent 0) 0 0 / 5px 5px,
    #f3ebde;
}
.gb-rb-gingham .gb-band-v { box-shadow: inset 1px 0 rgba(143, 37, 48, .4), inset -1px 0 rgba(143, 37, 48, .4), .4cqmin 0 .9cqmin rgba(var(--shade), .35); }
.gb-rb-gingham .gb-band-h { box-shadow: inset 0 1px rgba(143, 37, 48, .4), inset 0 -1px rgba(143, 37, 48, .4), 0 .5cqmin .9cqmin rgba(var(--shade), .35); }
/* Twine: two thin twisted strands each way. */
.gb-rb-twine .gb-band { --bw: 6cqmin; background: none; box-shadow: none; }
.gb-rb-twine .gb-band::before, .gb-rb-twine .gb-band::after {
  content: ""; position: absolute; border-radius: 2px;
  box-shadow: .3cqmin .6cqmin .6cqmin rgba(var(--shade), .4);
}
.gb-rb-twine .gb-band-v::before, .gb-rb-twine .gb-band-v::after { top: 0; bottom: 0; width: 32%; background: repeating-linear-gradient(60deg, var(--tw) 0 2px, var(--tw-d) 2px 2.6px); }
.gb-rb-twine .gb-band-v::before { left: 0; } .gb-rb-twine .gb-band-v::after { right: 0; }
.gb-rb-twine .gb-band-h::before, .gb-rb-twine .gb-band-h::after { left: 0; right: 0; height: 32%; background: repeating-linear-gradient(30deg, var(--tw) 0 2px, var(--tw-d) 2px 2.6px); }
.gb-rb-twine .gb-band-h::before { top: 0; } .gb-rb-twine .gb-band-h::after { bottom: 0; }

/* Bow, sprig and tag sit at the crossing. translate/rotate place them; WAAPI animates transform on top. */
.gb-bow, .gb-sprig, .gb-tag { position: absolute; display: block; overflow: visible; left: calc(var(--rx) * 1%); top: calc(var(--ry) * 1%); }
.gb-bow { width: var(--bow); height: var(--bow); translate: -50% -50%; }
.gb-sprig { width: var(--sprw); height: var(--sprw); translate: -50% -50%; rotate: var(--spr); }
.gb-tag { width: var(--tagw); height: auto; aspect-ratio: 124 / 64; translate: 0 -50%; rotate: var(--tr); transform-origin: 0 50%; }
.gb-tag-l { left: auto; right: calc(100% - var(--rx) * 1%); transform-origin: 100% 50%; }
.bw-r { fill: var(--rb); }
.bw-d { fill: var(--rb-d); }
.bw-l { fill: none; stroke: var(--rb-l); stroke-width: 2; stroke-linecap: round; opacity: .85; }
.bw-sh, .bw-sh path { fill: rgba(var(--shade), .3); }
.bw-tw, .bw-twd, .bw-tws { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.bw-tw { stroke: var(--tw); stroke-width: 3.4; }
.bw-twd { stroke: var(--tw-d); stroke-width: 1.2; stroke-dasharray: 1.4 2.6; }
.bw-tws { stroke: rgba(var(--shade), .3); stroke-width: 3.4; }
.bw-knot { fill: var(--tw); stroke: var(--tw-d); stroke-width: .8; }
.sp-stem { fill: none; stroke: #5a3b22; stroke-width: 2; stroke-linecap: round; }
.sp-n1, .sp-n2, .sp-sh2 { fill: none; stroke-width: 2.4; stroke-linecap: round; }
.sp-n1 { stroke: #2b6446; } .sp-n2 { stroke: #3f8560; } .sp-sh2 { stroke: rgba(var(--shade), .28); }
.sp-leaf { fill: #2c6646; } .sp-leaf2 { fill: #3a7d58; }
.sp-vein { fill: none; stroke: #8cc0a0; stroke-width: .9; opacity: .8; }
.sp-berry { fill: #c0303a; } .sp-hi { fill: #f8d8cc; opacity: .75; } .sp-sh { fill: rgba(var(--shade), .3); }
.tg-str { fill: none; stroke: #e6d3a8; stroke-width: 2.2; stroke-linecap: round; }
.tg-sh { fill: rgba(var(--shade), .32); }
.tg-face { fill: #f1e2bf; }
.tg-edge { fill: none; stroke: rgba(130, 92, 44, .38); stroke-width: 1.2; }
.tg-ring { fill: #dcc28a; }
.tg-hole { fill: rgba(var(--shade), .6); }
.tg-num { font-family: var(--hand); font-weight: 700; font-size: 40px; fill: var(--ink); }
.gb-gold .tg-face { fill: #f4dc98; } .gb-gold .tg-ring { fill: #c9a04a; }

/* Numbers on the paper: a sticker, a stamp, or written straight on in pen. */
.gb-num {
  position: absolute; left: var(--nx); top: var(--ny); translate: -50% -50%; rotate: var(--nr);
  display: grid; place-items: center; font-family: var(--hand); font-weight: 700; line-height: 1; white-space: nowrap;
}
.gb-n { display: block; transform: translateY(.08em); }
.gb-num-paper { font-size: 42cqmin; color: var(--pen); text-shadow: 0 .4cqmin .5cqmin rgba(var(--shade), .3); }
.gb-num-sticker {
  width: 46cqmin; height: 46cqmin; border-radius: 50%; background: var(--stk); color: var(--stk-ink); font-size: 25cqmin;
  box-shadow: .3cqmin .8cqmin 1cqmin rgba(var(--shade), .45), inset 0 0 0 .5px rgba(var(--shade), .18);
}
.gb-num-sticker::before { content: ""; position: absolute; inset: 7%; border-radius: 50%; border: max(1px, .7cqmin) dashed currentColor; opacity: .35; }
.gb-num-stamp {
  width: 48cqmin; height: 48cqmin; border-radius: 50%; color: var(--stamp); font-size: 22cqmin; opacity: .86;
  border: max(1.5px, 1.4cqmin) solid currentColor;
}
.gb-num-stamp::before { content: ""; position: absolute; inset: 9%; border-radius: 50%; border: max(1px, .6cqmin) solid currentColor; opacity: .8; }
.gb-num-stamp .gb-n { transform: translateY(.22em); }
.gb-stamp-dec { position: absolute; top: 19%; font-size: 9cqmin; letter-spacing: .12em; text-transform: uppercase; }

/* Opened: the lid off to one side, tissue puffing out of the box, the number on a little card. */
.gb-base { opacity: 0; box-shadow: .6cqmin 1.4cqmin 1.6cqmin rgba(var(--shade), .32), 1.4cqmin 3.4cqmin 5cqmin -1cqmin rgba(var(--shade), .38); }
.gb-inside {
  position: absolute; inset: 7cqmin; border-radius: 1.6cqmin; background: var(--inside);
  box-shadow: inset 2.6cqmin 3.2cqmin 3.4cqmin rgba(var(--shade), .6), inset -.6cqmin -.6cqmin 0 rgba(255, 240, 220, .14);
}
.gb-tissue { position: absolute; left: 5cqmin; top: 5cqmin; width: calc(100% - 10cqmin); height: calc(100% - 10cqmin); overflow: visible; transform-origin: 50% 60%; }
.ts-a { fill: var(--tissue); }
.ts-b { fill: #fbf6ee; opacity: .55; }
.ts-c { fill: #fdf9f2; opacity: .6; }
.ts-f { fill: none; stroke: var(--tissue-d); stroke-width: 1; vector-effect: non-scaling-stroke; }
.gb-card {
  position: absolute; left: 50%; top: 54%; translate: -50% -50%; rotate: -7deg; padding: .22em .42em .1em; border-radius: 1cqmin;
  background: #f8f0e0; color: var(--ink); font: 700 26cqmin/1 var(--hand);
  box-shadow: .4cqmin 1cqmin 1.4cqmin rgba(var(--shade), .45);
}
.gb-l .gb-card, .gb-xl .gb-card { font-size: 20cqmin; }
.gb-opened .gb-lid { transform: translate(9%, -8%) rotate(7deg) scale(.86); }
.gb-opened .gb-base { opacity: 1; transform: translate(-4%, 4%) scale(.9); }
.gb-opened .gb-rib, .gb-opened .gb-bow, .gb-opened .gb-tag, .gb-opened .gb-sprig, .gb-opened .gb-num { opacity: 0; }

/* Ready: its day has come. A warm glow, a gentle bob, a few sparkles. */
.gb-glow { position: absolute; inset: 0; border-radius: 3cqmin; pointer-events: none; opacity: 0; }
/* Box shadows, not a bigger element: a glow must never widen the page. */
.gb-glow::after {
  content: ""; position: absolute; inset: -1.2cqmin; border-radius: 4cqmin;
  box-shadow: 0 0 0 1.3cqmin rgba(255, 230, 160, .85), 0 0 7cqmin 3cqmin rgba(255, 200, 100, .7), 0 0 18cqmin 9cqmin rgba(255, 214, 128, .42);
}
.gb-ready .gb-glow { opacity: 1; animation: gb-glow 2.8s ease-in-out infinite; }
.gb-ready .gb-body { animation: gb-bob 2.8s ease-in-out infinite; }
.gb-sparks { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.gb-spark { fill: #fff0c2; transform-box: fill-box; transform-origin: 50% 50%; animation: gb-tw 2.4s ease-in-out infinite; animation-delay: calc(var(--d) * -.8s); }
@keyframes gb-glow { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes gb-bob { 0%, 100% { transform: none; } 50% { transform: translateY(-2.6cqmin) scale(1.025); } }
@keyframes gb-tw { 0%, 100% { transform: scale(.3); opacity: .2; } 50% { transform: scale(1); opacity: 1; } }

/* Paid and still waiting (sealed, or locked until its day): a slow glint crosses the lid now and then,
   and two small stars twinkle at its corners. Free boxes rest. */
.gb-glint {
  position: absolute; inset: -10% -70%; pointer-events: none;
  background: linear-gradient(105deg, rgba(255, 248, 228, 0) 42%, rgba(255, 248, 228, .38) 48.5%, rgba(255, 252, 240, .62) 50%, rgba(255, 248, 228, .34) 51.5%, rgba(255, 248, 228, 0) 58%);
  transform: translateX(-60%); animation: gb-glint 7.5s cubic-bezier(.45, 0, .25, 1) infinite; animation-delay: calc(var(--gk, 0) * -1s);
}
@keyframes gb-glint { 0%, 64% { transform: translateX(-60%); } 100% { transform: translateX(60%); } }
.gb-sparks-paid .gb-spark { fill: #fbe9b6; animation-duration: 3.8s; animation-delay: calc(var(--d) * -1.3s - var(--gk, 0) * 1s); }

/* The payer's own seal, pressed on the ribbon. Only their phone draws it. */
.gb-seal { position: absolute; width: 30cqmin; aspect-ratio: 1; translate: -50% -50%; rotate: -9deg; pointer-events: none; }
.gb-l .gb-seal, .gb-xl .gb-seal { width: 24cqmin; }
.gb-seal .wax, .wax { display: block; width: 100%; height: 100%; overflow: visible; }

/* A box someone is playing with: loops rest so WAAPI owns the motion. */
.gb-playing .gb-body, .gb-playing .gb-glow { animation: none; }
.gb-playing .gb-glow { opacity: 0; }

/* "yours": a scrap of paper with the word written on it. */
.gb-yours {
  position: absolute; z-index: 3; left: -2%; top: -5%; padding: .2em .45em .05em; border-radius: 2px; rotate: -7deg;
  background: #f8efdc; color: var(--ink); font: 700 max(11px, 12cqmin)/1.1 var(--hand);
  box-shadow: .3cqmin .8cqmin 1.2cqmin rgba(var(--shade), .4); pointer-events: none; white-space: nowrap;
}

/* Empty: a hollow pressed into the tray, the number pencilled in. */
.gb-empty { --pencil: #5e5246; --hollow-bg: #d6b583; }
.gb-hollow {
  position: absolute; inset: 6cqmin; border-radius: 12cqmin 14cqmin 13cqmin 15cqmin; background: var(--hollow-bg);
  box-shadow: inset 1.8cqmin 2.6cqmin 3.6cqmin rgba(var(--shade), .42), inset -.8cqmin -1cqmin 0 rgba(255, 244, 224, .32), 0 0 0 .6cqmin rgba(var(--shade), .08);
}
.gb-pencil-ring { position: absolute; inset: 14cqmin; width: calc(100% - 28cqmin); height: calc(100% - 28cqmin); fill: none; stroke: var(--pencil); stroke-width: 1.2; vector-effect: non-scaling-stroke; stroke-linecap: round; opacity: .22; }
.gb-pencil { position: absolute; left: 50%; top: 50%; translate: -50% -44%; rotate: var(--nr); font: 700 36cqmin/1 var(--hand); color: var(--pencil); opacity: .8; }
.gb-plus { display: none; }
.pk[data-mode="friend"] .gb-plus { display: block; position: absolute; right: 15cqmin; bottom: 13cqmin; width: 13cqmin; height: 13cqmin; opacity: .55; }
.pk[data-mode="friend"] .gb-plus::before, .pk[data-mode="friend"] .gb-plus::after { content: ""; position: absolute; left: 50%; top: 50%; background: var(--pencil); border-radius: 2px; }
.gb-plus::before { width: 100%; height: max(1.5px, 1.6cqmin); translate: -50% -50%; rotate: -4deg; }
.gb-plus::after { width: max(1.5px, 1.6cqmin); height: 100%; translate: -50% -50%; rotate: 3deg; }

/* ======================================================================
   The package: lid with the name, outer box, tray of doors
   ====================================================================== */

.pk {
  --cols: 4; --gap: 6px; --pad: 7px; --wall: 11px;
  position: relative; display: block; width: 100%; max-width: 560px; margin-inline: auto; padding: 2px 0 20px;
  container-type: inline-size; color: var(--ink);
}
@media (min-width: 600px) { .pk { --cols: 6; --gap: 8px; --pad: 10px; --wall: 14px; max-width: 860px; } }
@media (min-width: 1101px) { .pk { --cols: 8; --gap: 9px; --pad: 12px; --wall: 16px; max-width: 1100px; } }

.pk-lid {
  position: relative; z-index: 0; margin: 0 3% -30px; padding: clamp(14px, 3.6cqi, 26px) clamp(14px, 4cqi, 30px) 44px;
  border-radius: 10px 12px 6px 6px; rotate: -.7deg; text-align: center; overflow: hidden;
  background: var(--pk-lid-bg);
  box-shadow: inset 0 1px 0 rgba(255, 246, 228, .3), 0 2px 0 var(--pk-edge), 0 14px 26px -14px rgba(var(--shade), .55);
}
.pk-label { position: relative; z-index: 1; display: inline-block; max-width: 100%; padding: 6px 16px 4px; }
.pk-title { margin: 0; font: 700 clamp(28px, 9cqi, 58px)/1.12 var(--hand); color: var(--pk-title); overflow-wrap: anywhere; }
.pk-sub { margin: 0; font: 700 clamp(15px, 4cqi, 22px)/1.25 var(--hand); color: var(--pk-sub); overflow-wrap: anywhere; }

.pk-box {
  position: relative; z-index: 1; padding: var(--wall); border-radius: 9px; background: var(--pk-wall-bg);
  box-shadow: inset 0 1px 0 rgba(255, 246, 228, .35), inset 0 -2px 0 rgba(var(--shade), .2),
    0 1px 0 var(--pk-edge), 0 3px 0 var(--pk-edge-d), 0 20px 34px -16px rgba(var(--shade), .62), 0 6px 10px -4px rgba(var(--shade), .32);
}
.pk-trayw { position: relative; container-type: inline-size; border-radius: 5px; }
.pk-tray {
  position: relative; display: grid; gap: var(--gap); padding: var(--pad); border-radius: 5px; overflow: hidden;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-rows: calc((100cqi - 2 * var(--pad) - (var(--cols) - 1) * var(--gap)) / var(--cols));
  grid-auto-flow: row dense; background: var(--pk-floor);
}
/* The walls cast a shadow into the tray, over the crinkle and the boxes alike. */
.pk-tray::after {
  content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: inherit;
  box-shadow: inset 0 6px 10px -4px rgba(var(--shade), .6), inset 5px 0 8px -5px rgba(var(--shade), .45), inset -1px -2px 0 rgba(255, 240, 220, .14);
}
.pk-bed { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cr, .cr-sh { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.cr-sh { stroke: rgba(var(--shade), .3); }
.pk-fill { position: relative; z-index: 0; pointer-events: none; }
.pk-nest { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pk-nest-bg { fill: rgba(var(--shade), .16); }
.pk-prop { position: absolute; height: auto; overflow: visible; }

.pk .door {
  position: relative; z-index: 1; display: block; min-width: 44px; min-height: 44px; padding: 0; margin: 0; border: 0;
  background: none; color: inherit; font: inherit; cursor: pointer; border-radius: 10px;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.pk .door > .gb { position: absolute; inset: 0; width: auto; height: auto; aspect-ratio: auto; }
.pk .door[data-state="ready"] { z-index: 2; }
.pk .door:focus-visible { z-index: 3; outline: 3px solid var(--focus); outline-offset: 1px; box-shadow: 0 0 0 6px var(--focus-edge); }
.gb-body { transition: transform .18s cubic-bezier(.2, .8, .3, 1); }
@media (hover: hover) { .pk .door:hover > .gb:not(.gb-ready):not(.gb-empty) .gb-body { transform: translateY(-1.6cqmin) scale(1.025); } }
.pk .door:active > .gb:not(.gb-ready) .gb-body { transform: scale(.97); }

/* The closed lid that liftLid() lifts off. */
.pk-cover {
  position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; border-radius: 9px; overflow: hidden; transform-origin: 0 0;
  background: var(--pk-lid-bg); box-shadow: inset 0 1px 0 rgba(255, 246, 228, .3), 0 10px 24px -10px rgba(var(--shade), .6);
}
.pk-cover-band { position: absolute; top: 0; bottom: 0; left: 50%; width: 18px; translate: -50% 0; background: var(--pk-ribbon); box-shadow: 1px 0 3px rgba(var(--shade), .35); }
.pk-cover-band-h { top: 50%; bottom: auto; left: 0; right: 0; width: auto; height: 18px; translate: 0 -50%; }
.pk-cover-name {
  position: relative; max-width: 80%; padding: 10px 22px 6px; border-radius: 6px; rotate: -2deg;
  background: #f6ecd8; color: var(--ink); font: 700 clamp(26px, 8cqi, 54px)/1.1 var(--hand); text-align: center; overflow-wrap: anywhere;
  box-shadow: 0 3px 8px rgba(var(--shade), .35);
}
.pk-cover-name:empty { display: none; }

/* --- packs --- */
.pk-kraft {
  --pk-lid-bg:
    radial-gradient(circle at 30% 40%, rgba(96, 58, 28, .2) 0 .7px, transparent 1.3px) 0 0 / 9px 11px,
    repeating-linear-gradient(95deg, rgba(110, 70, 36, .07) 0 1px, transparent 1px 7px),
    linear-gradient(170deg, #c99d6a, #b8875a);
  --pk-wall-bg:
    repeating-linear-gradient(90deg, rgba(110, 70, 36, .08) 0 1px, transparent 1px 5px),
    linear-gradient(180deg, #c3925f, #b07f4e);
  --pk-edge: #946738; --pk-edge-d: #7a522b; --pk-floor: #a97b4c; --pk-title: var(--ink); --pk-sub: #6b4a2e; --pk-ribbon: repeating-linear-gradient(60deg, #eddcb4 0 3px, #9f7f4c 3px 4px);
}
.pk-kraft .gb-empty { --hollow-bg: #d5b383; --pencil: #57493c; }
.pk-kraft .pk-label {
  background: repeating-linear-gradient(180deg, transparent 0 27px, rgba(120, 140, 170, .22) 27px 28px), #f4ead6;
  padding: 10px 20px 6px; margin-top: 6px; rotate: 1deg; box-shadow: 0 2px 5px rgba(var(--shade), .35);
  clip-path: polygon(0 3%, 6% 0, 14% 2%, 26% 0, 40% 2.5%, 55% 0, 70% 2%, 84% 0, 100% 2%, 99% 50%, 100% 98%, 88% 100%, 72% 98%, 56% 100%, 40% 97.5%, 24% 100%, 10% 98%, 0 100%, 1% 50%);
}
.pk-kraft .pk-label::before, .pk-kraft .pk-label::after {
  content: ""; position: absolute; top: -4px; width: 46px; height: 16px; background: rgba(214, 168, 160, .72);
  background-image: repeating-linear-gradient(90deg, rgba(255, 246, 236, .35) 0 3px, transparent 3px 7px);
}
.pk-kraft .pk-label::before { left: -10px; rotate: -24deg; }
.pk-kraft .pk-label::after { right: -10px; rotate: 22deg; }
.pk-twine { position: absolute; top: 0; bottom: 0; left: 9%; width: 7px; z-index: 0;
  background: linear-gradient(90deg, transparent 0 0, #eddcb4 0 3px, transparent 3px 4px, #eddcb4 4px 7px); box-shadow: 1px 1px 2px rgba(var(--shade), .4); }
.pk-twine::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(60deg, transparent 0 2px, rgba(159, 127, 76, .8) 2px 2.6px); }
.pk-stamps { position: absolute; right: 2%; top: 6px; width: clamp(84px, 24cqi, 150px); height: auto; z-index: 0; }
.pk-st-sh { fill: rgba(var(--shade), .35); }
.pk-st-paper { fill: #f3e8d2; }
.pk-perf circle { fill: #bf9062; }
.pk-st-red { fill: #b93a3f; } .pk-st-green { fill: #2f6b4e; }
.pk-st-tree { fill: #2f6b4e; } .pk-st-trunk { fill: #6b4527; } .pk-st-star { fill: #ecca74; }
.pk-st-txt { font: 700 9px var(--hand); fill: #f3e8d2; }
.pk-st-hill { fill: none; stroke: #f3e8d2; stroke-width: 2; }
.pk-pm { fill: none; stroke: #3d3552; stroke-width: 1.6; opacity: .55; }

.pk-cream {
  --pk-lid-bg:
    repeating-linear-gradient(0deg, rgba(150, 120, 80, .05) 0 1px, transparent 1px 3px),
    linear-gradient(170deg, #f6efdf, #eadcc2);
  --pk-wall-bg: linear-gradient(180deg, #f1e7d3, #e2d3b6);
  --pk-edge: #cdb88f; --pk-edge-d: #b39b6e; --pk-floor: #ddc9a4; --pk-sub: #8d6a2e; --pk-ribbon: linear-gradient(90deg, #a87b2c, #f0d68e 50%, #a87b2c);
}
.pk-cream .gb-empty { --hollow-bg: #f0e6d2; --pencil: #6b5f50; }
.pk-cream .pk-title, .pk-velvet .pk-title {
  background: linear-gradient(100deg, #9c6f24, #e6c56f 30%, #b8892f 52%, #f2d991 72%, #a87b2c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.pk-cream .pk-lid::before, .pk-velvet .pk-lid::before, .pk-gold .pk-lid::before, .pk-cream .pk-box::before, .pk-velvet .pk-box::before {
  content: ""; position: absolute; inset: 7px; border: 1.5px solid rgba(201, 160, 74, .85); border-radius: 6px; pointer-events: none;
  box-shadow: inset 0 0 0 3px transparent, inset 0 0 0 4px rgba(201, 160, 74, .45);
}
.pk-cream .pk-box::before, .pk-velvet .pk-box::before { inset: 3px; border-radius: 7px; box-shadow: none; border-width: 1px; }
.pk-laurel { display: block; width: clamp(80px, 22cqi, 130px); height: auto; margin: 0 auto 2px; fill: #c9a04a; position: relative; z-index: 1; }

.pk-candy {
  --pk-lid-bg: repeating-linear-gradient(-45deg, #c3323d 0 16px, #f4e9d9 16px 32px);
  --pk-wall-bg: repeating-linear-gradient(-45deg, #c3323d 0 9px, #f4e9d9 9px 18px);
  --pk-edge: #8e1f2a; --pk-edge-d: #6e1620; --pk-floor: #e7d6bf; --pk-title: #a8242f; --pk-sub: #6b4a2e; --pk-ribbon: linear-gradient(90deg, #7f1b24, #c3323d 30% 70%, #7f1b24);
}
.pk-candy .gb-empty { --hollow-bg: #f3e8d8; --pencil: #6b5f50; }
.pk-candy .pk-label { background: #f6ecdb; border-radius: 40px; padding: 10px 26px 6px; box-shadow: 0 0 0 4px #f6ecdb, 0 0 0 5.5px rgba(168, 36, 47, .55), 0 4px 10px rgba(var(--shade), .4); }
.pk-candy .pk-label::before { content: ""; position: absolute; inset: 4px; border-radius: 36px; border: 1.5px dashed rgba(168, 36, 47, .55); }

.pk-velvet {
  --pk-lid-bg:
    repeating-linear-gradient(45deg, rgba(200, 255, 220, .025) 0 1px, transparent 1px 3px),
    radial-gradient(120% 150% at 30% 15%, #2f7a58, #1d4f3a 55%, #12362a);
  --pk-wall-bg: radial-gradient(140% 120% at 30% 10%, #2a6e50, #194532 60%, #10301f);
  --pk-edge: #0e2a1e; --pk-edge-d: #0a1f16; --pk-floor: #163e2e; --pk-sub: #e4c987; --pk-ribbon: linear-gradient(90deg, #a87b2c, #f0d68e 50%, #a87b2c);
}
.pk-velvet .gb-empty { --hollow-bg: #22513d; --pencil: #ebe1c8; }
.pk-velvet .pk-laurel { fill: #d9b45a; }

.pk-midnight {
  --pk-lid-bg: radial-gradient(140% 130% at 50% 0%, #2c3d80, #1b2656 58%, #131b40);
  --pk-wall-bg: linear-gradient(180deg, #24326c, #182250);
  --pk-edge: #0f1636; --pk-edge-d: #0b1029; --pk-floor: #151d45; --pk-title: #f3ead6; --pk-sub: #d8c58e; --pk-ribbon: linear-gradient(90deg, #8d93a8, #eef0f7 50%, #8d93a8);
}
.pk-midnight .gb-empty { --hollow-bg: #1f2a5c; --pencil: #e3e5f0; }
.pk-midnight .pk-title { text-shadow: 0 0 18px rgba(242, 216, 150, .35); }
.pk-sky { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.pk-mdot { fill: #e9e1c6; opacity: .75; } .pk-mstar { fill: #ecca74; } .pk-moon { fill: #f1e3b8; }

.pk-gold {
  --pk-lid-bg:
    radial-gradient(circle, rgba(255, 246, 214, .22) 0 .6px, transparent 1.1px) 0 0 / 5px 5px,
    linear-gradient(120deg, #b98a34 0%, #e8c66f 22%, #f8e4a8 34%, #d6a64a 50%, #f0d389 66%, #b88a35 86%, #e3bf66 100%);
  --pk-wall-bg: linear-gradient(120deg, #b38433, #e3c06a 30%, #f3dc9c 45%, #c99a42 65%, #e8c877 85%, #b08232);
  --pk-edge: #8a6122; --pk-edge-d: #6e4c18; --pk-floor: #b98d3c; --pk-title: #6a4810; --pk-sub: #6a4810; --pk-ribbon: linear-gradient(90deg, #8a6122, #e2bd66 50%, #8a6122);
}
.pk-gold .gb-empty { --hollow-bg: #e3cb8f; --pencil: #5a4416; }
.pk-gold .pk-title { text-shadow: 0 1px 0 rgba(255, 242, 206, .7), 0 -1px 0 rgba(90, 60, 10, .35); }
.pk-gold .pk-laurel { fill: #8a6122; }
.pk-gold .pk-lid::before { border-color: rgba(138, 97, 34, .55); box-shadow: inset 0 0 0 4px rgba(138, 97, 34, .3); }
.pk-gold .pk-lid::after {
  content: ""; position: absolute; inset: -10% -60%; pointer-events: none;
  background: linear-gradient(105deg, rgba(255, 246, 214, 0) 42%, rgba(255, 250, 236, .6) 50%, rgba(255, 246, 214, 0) 58%);
  animation: gb-shimmer 7s cubic-bezier(.45, 0, .25, 1) infinite;
}

/* Props in the tray and on the table. */
.pr-sh { fill: rgba(var(--shade), .28); }
.pr-shs { fill: none; stroke: rgba(var(--shade), .28); stroke-width: 11; stroke-linecap: round; }
.cn-a, .cn-b { fill: none; stroke-width: 10; stroke-linecap: round; }
.cn-a { stroke: #f4ece0; } .cn-b { stroke: #c0303a; stroke-dasharray: 5.5 6; stroke-linecap: butt; }
.cn-hi { fill: none; stroke: #fbf8f2; stroke-width: 2; opacity: .6; stroke-linecap: round; }
.pc-body { fill: #5e3a1d; } .pc-s0 { fill: #8a5a30; } .pc-s1 { fill: #74471f; }
.pc-tip { fill: none; stroke: #c08a52; stroke-width: 1.2; opacity: .8; }
.pc-stem { stroke: #5e3a1d; stroke-width: 3; stroke-linecap: round; }
.ci-a { fill: #8b4a22; } .ci-b { fill: #6b3517; } .ci-c { fill: none; stroke: #b0693a; stroke-width: 1.2; opacity: .8; }
.ci-end { fill: #a35c2e; } .ci-curl { fill: none; stroke: #5a2c12; stroke-width: 1.1; }
.tw-a { fill: none; stroke: #e2cfa2; stroke-width: 2.4; stroke-linecap: round; }
.tw-d { fill: none; stroke: #a3824f; stroke-width: 1; stroke-dasharray: 1.4 2.4; }
.or-rind { fill: #d9661f; } .or-pith { fill: #f3dcaa; } .or-fl { fill: #e98a2c; }
.or-seg { fill: none; stroke: #f6d7a0; stroke-width: 2.2; stroke-linecap: round; }
.an-a { fill: #6b3a1e; stroke: #4a2410; stroke-width: 1; } .an-seed { fill: #b0703a; } .an-c { fill: #4a2410; }
.bb-cap { fill: #c9a24a; } .bb-capl { stroke: #8a6122; stroke-width: .8; } .bb-loop { fill: none; stroke: #b8892f; stroke-width: 2; }
.ws-a { fill: #d9b27c; } .ws-e { fill: none; stroke: #f0d5a8; stroke-width: 1.2; opacity: .7; } .ws-g { fill: none; stroke: #b58650; stroke-width: 1; opacity: .7; }

/* ======================================================================
   The composer's open box
   ====================================================================== */

.ot { position: relative; display: grid; place-items: center; width: 100%; padding: 14px 0 18px; container-type: inline-size; }
.ot-box { --u: min(30cqi, 150px); position: relative; width: calc(var(--u) * var(--ow)); aspect-ratio: var(--oar); container-type: size; }
.ot-s { --ow: 1.25; --oar: 1; --tw: 40cqmin; }
.ot-m { --ow: 2; --oar: 2; --tw: 46cqmin; }
.ot-l { --ow: 2; --oar: 1; --tw: 30cqmin; }
.ot-xl { --ow: 3; --oar: 1.5; --tw: 31cqmin; }
.ot-shadow { position: absolute; inset: 3% -1% -3% 2%; border-radius: 6px; background: rgba(var(--shade), .3); filter: blur(8px); }
.ot-rim { border-radius: 3cqmin; box-shadow: 0 1px 0 rgba(var(--shade), .4), 0 3px 0 rgba(var(--shade), .2); }
.ot-in {
  position: absolute; inset: 5.5cqmin; overflow: hidden; border-radius: 1.6cqmin; background: var(--inside);
}
.ot-in::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 3cqmin 4cqmin 5cqmin rgba(var(--shade), .5), inset -1cqmin -1cqmin 2cqmin rgba(var(--shade), .2);
}
.ot-crinkle { position: absolute; inset: 0; width: 100%; height: 100%; }
.ot-crinkle .ts-a { fill: inherit; }
.ot-crinkle .cr-sh { stroke: rgba(var(--shade), .13); }
.ot-things { position: absolute; inset: 0; }
.ot-thing { position: absolute; width: var(--tw); height: var(--tw); translate: -50% -50%; rotate: var(--r); }
.ot-thing .mi { width: 100%; height: 100%; }
.ot-card {
  position: absolute; display: flex; flex-direction: column; aspect-ratio: 4 / 3; padding: .55em .6em .5em; rotate: var(--r); border-radius: 1cqmin; overflow: hidden;
  font: 700 max(10px, 5.4cqmin)/1.45 var(--hand); color: var(--ink);
  background: repeating-linear-gradient(180deg, transparent 0 calc(1.45em - 1px), rgba(110, 130, 170, .3) calc(1.45em - 1px) 1.45em) 0 calc(.55em + .1em) / 100% 100% no-repeat, #f8f1e3;
  box-shadow: .6cqmin 1.4cqmin 2.4cqmin rgba(var(--shade), .45), inset 0 0 0 .5px rgba(var(--shade), .15);
}
.ot-card::after { content: ""; position: absolute; right: 0; bottom: 0; width: 8cqmin; height: 8cqmin; background: linear-gradient(135deg, #f8f1e3 50%, #e3d6be 50%); box-shadow: -.4cqmin -.4cqmin .8cqmin rgba(var(--shade), .2); }
.ot-card-text {
  display: block; flex: 1; min-height: 0; overflow: hidden; overflow-wrap: anywhere; -webkit-hyphens: auto; hyphens: auto;
  -webkit-mask-image: linear-gradient(180deg, #3b2417 calc(100% - 1.3em), transparent); mask-image: linear-gradient(180deg, #3b2417 calc(100% - 1.3em), transparent);
}
.ot-lid { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.ot-lid > .gb { position: absolute; inset: 0; width: auto; height: auto; aspect-ratio: auto; }
.ot-lid .gb-body { inset: 0; rotate: none; }
.ot-closed .ot-lid { opacity: 1; }

/* ======================================================================
   Things
   ====================================================================== */

.th { position: relative; width: min(100%, 250px); margin-inline: auto; container-type: inline-size; -webkit-user-select: none; user-select: none; }
.th-art { display: block; width: 100%; height: auto; overflow: visible; }
.th-sh { fill: rgb(var(--shade)); }
.th-tap {
  display: block; width: 100%; min-height: 44px; padding: 0; margin: 0; border: 0; background: none; color: inherit; font: inherit;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; border-radius: 22px;
}
.th-tap:focus-visible, .th-play:focus-visible, .th-link:focus-visible, .th-zoom-x:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.th-hint { margin: 10px 0 0; min-height: 1.3em; text-align: center; font: 700 15px/1.3 var(--hand); opacity: .72; }

/* Cocoa: steam rises and thins. */
.th-steam { fill: none; stroke: #efe6d8; stroke-width: 5; stroke-linecap: round; opacity: 0; transform-box: fill-box; transform-origin: 50% 100%;
  animation: th-steam 3.6s ease-out infinite; animation-delay: calc(var(--d, 0) * -1.2s); }
@keyframes th-steam { 0% { opacity: 0; transform: translateY(12px) scale(.9, .8); } 30% { opacity: .72; } 100% { opacity: 0; transform: translateY(-14px) scale(1.08, 1.04); } }
.th-mug { transform-box: view-box; transform-origin: 100px 166px; }

/* Cookies: a little sugar catches the light. */
.th-glint { transform-box: fill-box; transform-origin: 50% 50%; animation: gb-tw 3s ease-in-out infinite; animation-delay: calc(var(--d, 0) * -1s); }
.th-cookie-top { transform-box: fill-box; transform-origin: 50% 50%; }

/* Wish candle: the flame flickers; tap to blow it out (smoke curl, sparks), tap again to relight. */
.th-flame, .th-flick, .th-core { transform-box: fill-box; transform-origin: 50% 96%; }
.th-flame { transition: transform .32s cubic-bezier(.16, 1, .3, 1), opacity .25s; }
.th-flick { animation: th-flick 1.9s ease-in-out infinite; }
.th-core { animation: th-flick 1.1s ease-in-out infinite reverse; }
.th-halo { transition: opacity .6s; animation: th-halo 2.3s ease-in-out infinite; }
@keyframes th-flick {
  0%, 100% { transform: none; }
  20% { transform: scale(.96, 1.05) rotate(-1.6deg); }
  40% { transform: scale(1.03, .96) rotate(1deg); }
  60% { transform: scale(.98, 1.07) rotate(-.6deg); }
  80% { transform: scale(1.02, .98) rotate(1.4deg); }
}
@keyframes th-halo { 0%, 100% { opacity: .82; } 50% { opacity: 1; } }
.th-out .th-flame { opacity: 0; transform: scale(.25, .1); transition: transform .22s ease-in, opacity .18s ease-in; }
.th-out .th-halo { opacity: 0; animation: none; }
.th-smoke, .th-spark, .th-ember { opacity: 0; }
.th-smoke { transform-box: fill-box; transform-origin: 50% 100%; }
.th-out .th-smoke { animation: th-smoke 2.2s ease-out .1s both; }
.th-out .th-spark { animation: th-spark .9s cubic-bezier(.2, .7, .4, 1) both; animation-delay: calc(var(--d, 0) * 40ms); }
.th-out .th-ember { animation: th-ember 1.8s ease-out both; }
@keyframes th-smoke { 0% { opacity: 0; transform: translateY(10px) scale(.6, .4); } 25% { opacity: .6; } 100% { opacity: 0; transform: translateY(-22px) scale(1.15, 1.1) rotate(4deg); } }
@keyframes th-spark { 0% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(.4); } }
@keyframes th-ember { 0% { opacity: 1; } 100% { opacity: 0; } }

/* Snow globe: canvas snow inside the glass. */
.th-globe { position: relative; display: block; }
.th-snow { position: absolute; left: 16%; top: 9.0909%; width: 68%; height: 61.8182%; border-radius: 50%; pointer-events: none; }
.th-glass { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.th-snowglobe .th-tap:active .th-globe { transform: scale(.98) rotate(-1deg); transition: transform .12s ease-out; }

/* Ornament swings on its ribbon; gingerbread hops and waves. */
.th-swing { transform-box: view-box; transform-origin: 100px 12px; }
.th-orn-glint { transform-box: view-box; transform-origin: 100px 132px; }
.th-gb-man { transform-box: view-box; transform-origin: 100px 196px; }
.th-gb-arm { transform-box: view-box; transform-origin: 116px 84px; }

/* Photo: a square print that develops from grey to the picture. */
.th-photo { width: min(100%, 240px); }
.th-photo .th-tap { border-radius: 6px; }
.th-pol { position: relative; display: block; padding: 7% 7% 0; background: #f7f1e6; border-radius: 3px; rotate: -2.5deg;
  box-shadow: 0 1px 0 #e4dac8, 0 10px 0 -6px rgba(var(--shade), .2), 0 18px 34px -12px rgba(var(--shade), .55); }
.th-pol-pic { position: relative; display: block; aspect-ratio: 1; overflow: hidden; background: #2b2f3c; border-radius: 1px; }
.th-pol-pic img, .th-pol-pic svg { display: block; width: 100%; height: 100%; object-fit: cover; }
.th-pol-fog, .th-pol-milk, .th-pol-gloss { position: absolute; inset: 0; pointer-events: none; }
.th-pol-fog { background: #3d4352; }
.th-pol-milk { background: #d9d1c1; opacity: .5; }
.th-pol-gloss { background: linear-gradient(135deg, rgba(255, 250, 240, .16) 0%, rgba(255, 250, 240, 0) 38%); }
.th-dev .th-pol-fog { opacity: 0; transition: opacity 2.8s cubic-bezier(.5, 0, .6, 1) .2s; }
.th-dev .th-pol-milk { opacity: 0; transition: opacity 3.4s ease-in-out 1.4s; }
.th-pol-foot { display: block; height: 0; padding-bottom: 24%; }
.th-pol-tape { position: absolute; z-index: 1; left: 50%; top: -9px; width: 34%; height: 20px; margin-left: -17%; background: rgba(233, 196, 106, .62); rotate: 3deg; box-shadow: 0 1px 2px rgba(var(--shade), .2); }
.th-zoom { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) 16px; background: rgba(36, 22, 14, .88); cursor: zoom-out; }
.th-zoom img { display: block; max-width: 100%; max-height: calc(100dvh - 96px); border: 10px solid #f7f1e6; border-bottom-width: 34px; border-radius: 3px; box-shadow: 0 24px 60px -20px rgba(10, 6, 3, .7); }
.th-zoom-x {
  position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; display: grid; place-items: center; width: 48px; height: 48px;
  border: 0; border-radius: 50%; background: #f7f1e6; color: var(--ink); cursor: pointer;
}
.th-zoom-x svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

/* Voice note: a little recorder, a big play button, a waveform that moves while it plays. */
.th-voice { width: min(100%, 300px); }
.th-reel { transform-box: view-box; }
.th-on .th-reel { animation: th-spin 2.6s linear infinite; }
@keyframes th-spin { to { transform: rotate(360deg); } }
.th-rec-led { fill: #5a1a22; }
.th-on .th-rec-led { fill: #ff8a66; }
.th-rec-label { font: 700 13px var(--hand); fill: #f6dccf; }
.th-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.th-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 40px; min-width: 0; }
.th-wave i { flex: 1; height: 100%; border-radius: 3px; background: #c0434b; opacity: .55; transform: scaleY(var(--h)); }
.th-on .th-wave i { opacity: .95; animation: th-bar var(--d) ease-in-out infinite alternate; animation-delay: var(--o); }
@keyframes th-bar { from { transform: scaleY(.18); } to { transform: scaleY(var(--h)); } }
.th-time { min-width: 2.6em; font: 600 14px/1 Inter, system-ui, sans-serif; font-variant-numeric: tabular-nums; opacity: .8; text-align: right; }
.th-play {
  position: relative; flex: none; display: grid; place-items: center; width: 60px; height: 60px; padding: 0; border: 0; border-radius: 50%;
  background: #b8363f; color: #fbf3e6; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 3px 0 #7f1f2b, 0 10px 18px -8px rgba(var(--shade), .7);
}
.th-play:active { transform: translateY(2px); box-shadow: 0 1px 0 #7f1f2b, 0 6px 12px -8px rgba(var(--shade), .7); }
.th-play:disabled { opacity: .45; cursor: default; }
.th-play svg { grid-area: 1 / 1; width: 28px; height: 28px; fill: currentColor; transition: opacity .15s; }
.th-i-pause, .th-on .th-i-play { opacity: 0; }
.th-on .th-i-pause { opacity: 1; }

/* Video: a gilded frame, a dark mat, the clip plays inline. */
.th-video { width: min(100%, 300px); }
.th-frame {
  padding: 13px; border-radius: 6px;
  background: linear-gradient(135deg, #e8c672, #a87a2a 28%, #f3da94 50%, #9c6e24 74%, #dbb45c);
  box-shadow: inset 0 0 0 2px rgba(90, 60, 15, .35), inset 0 0 0 7px rgba(255, 240, 200, .14), 0 14px 28px -12px rgba(var(--shade), .65);
}
.th-screen { position: relative; aspect-ratio: var(--ar, .8); overflow: hidden; border-radius: 2px; background: #221c31; box-shadow: inset 0 0 0 3px #6b4b18; }
.th-screen video, .th-novideo { display: block; width: 100%; height: 100%; object-fit: contain; }
.th-play-big { position: absolute; left: 50%; top: 50%; width: 72px; height: 72px; translate: -50% -50%; transition: opacity .2s; }
.th-play-big svg { width: 32px; height: 32px; }
.th-on .th-play-big { opacity: 0; }
.th-on .th-play-big:focus-visible { opacity: .9; }
@media (hover: hover) { .th-on .th-screen:hover .th-play-big { opacity: .85; } }

/* Mixtape: the reels turn; the song opens in a new tab. */
.th-mixtape { width: min(100%, 260px); text-align: center; }
.th-tape { position: relative; display: block; }
.th-mixtape .th-reel { animation: th-spin 3.2s linear infinite; }
.th-tape-side { font: 400 17px "Instrument Serif", Georgia, serif; fill: #7a6a43; }
.th-tape-label { position: absolute; left: 14%; right: 23%; top: 15%; height: 19%; display: flex; align-items: center; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 700 clamp(12px, 6.4cqi, 17px)/1.2 var(--hand); color: var(--ink); }
.th-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; margin-top: 14px; padding: 0 22px 0 16px; border-radius: 999px;
  background: #262d55; color: #f5efe4; font: 600 15px/1 Inter, system-ui, sans-serif; text-decoration: none;
  box-shadow: 0 3px 0 #151a38, 0 10px 18px -8px rgba(var(--shade), .6);
}
.th-link svg { width: 20px; height: 20px; fill: currentColor; }
.th-link .th-i-pause { display: none; }

/* The little extra: a toy like the trinkets. The bell swings from its bow; the star's glint breathes. */
.th-bonus { width: min(100%, 260px); }
.th-bonus .bn.th-art { width: min(100%, 150px); margin-inline: auto; }
.bn { overflow: visible; }
.bn-swing { transform-box: view-box; transform-origin: 50px 30px; }
.bn-glint { transform-box: fill-box; transform-origin: 50% 50%; animation: gb-tw 3.2s ease-in-out infinite; }
.th-bonus .bn { transform-origin: 50% 60%; }
.ot-thing.ot-bonus .bn { display: block; width: 100%; height: 100%; }

/* ======================================================================
   Mini icons
   ====================================================================== */

.mi { display: inline-block; width: 1em; height: 1em; vertical-align: -.16em; overflow: visible; flex: none; }
.mi-sh { fill: rgba(var(--shade), .28); }

/* ======================================================================
   The table (scene)
   ====================================================================== */

body.sc-on { background: transparent; }
body[data-night="false"] { --sc-ink: #3b2417; --sc-ink-soft: #6b5240; }
body[data-night="true"] { --sc-ink: #f6ecda; --sc-ink-soft: #d8c6ad; }
.sc { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; contain: strict; }
.sc-table, .sc-warm, .sc-props, .sc-lights, .sc-halos, .sc-vig { position: absolute; inset: 0; }
.sc-day .sc-table {
  background:
    linear-gradient(115deg, rgba(255, 250, 240, .3), rgba(255, 250, 240, 0) 45%, rgba(120, 86, 54, .08)),
    repeating-linear-gradient(90deg, rgba(120, 88, 58, 0) 0 178px, rgba(120, 88, 58, .2) 178px 180px),
    repeating-linear-gradient(90deg, rgba(255, 252, 244, .1) 0 180px, rgba(140, 100, 62, .06) 180px 360px, rgba(255, 252, 244, 0) 360px 540px),
    repeating-linear-gradient(90deg, rgba(140, 104, 70, .05) 0 1px, transparent 1px 9px, rgba(140, 104, 70, .04) 9px 11px, transparent 11px 26px),
    #e6d8c3;
}
.sc-night .sc-table {
  background:
    repeating-linear-gradient(90deg, rgba(20, 10, 5, 0) 0 178px, rgba(20, 10, 5, .4) 178px 180px),
    repeating-linear-gradient(90deg, rgba(255, 220, 180, .03) 0 180px, transparent 180px 360px, rgba(30, 15, 8, .12) 360px 540px),
    repeating-linear-gradient(90deg, rgba(255, 214, 170, .035) 0 1px, transparent 1px 9px, rgba(255, 214, 170, .025) 9px 11px, transparent 11px 26px),
    #3b2a20;
}
.sc-warm { opacity: 0; }
.sc-night .sc-warm { opacity: 1; background: radial-gradient(ellipse 75% 60% at 50% 42%, rgba(255, 184, 108, .17), rgba(255, 184, 108, 0) 72%); }
.sc-vig { background: radial-gradient(ellipse 125% 105% at 50% 45%, rgba(80, 50, 30, 0) 55%, rgba(80, 50, 30, .14)); }
.sc-night .sc-vig { background: radial-gradient(ellipse 115% 100% at 50% 45%, rgba(20, 10, 4, 0) 42%, rgba(20, 10, 4, .55)); }
.sc-p { position: absolute; overflow: visible; }
.sc-night .sc-p { opacity: .92; }
.sc-string { position: absolute; left: 0; height: 80px; overflow: visible; transform-origin: 0 0; }
.lt-wire { fill: none; stroke: #2e4a33; stroke-width: 2.2; }
.lt-sock { fill: #36513a; }
.lt-glass { opacity: .72; }
.sc-night .lt-glass { opacity: 1; }
.lt-hi { fill: none; stroke: #fbf6ea; stroke-width: 1.4; stroke-linecap: round; opacity: .6; }
.sc-halo {
  position: absolute; width: calc(56px * var(--s, 1)); height: calc(56px * var(--s, 1)); margin: calc(-28px * var(--s, 1)) 0 0 calc(-28px * var(--s, 1));
  border-radius: 50%; opacity: .9;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--c) 72%, transparent), color-mix(in srgb, var(--c) 24%, transparent) 48%, transparent);
}
.sc-tw { animation: sc-tw 3.4s ease-in-out infinite; animation-delay: var(--d); }
@keyframes sc-tw { 0%, 100% { opacity: .95; } 50% { opacity: .42; } }
.br-stem { fill: none; stroke: #5b3d24; stroke-width: 2.6; stroke-linecap: round; }
.br-n0, .br-n1, .br-n2, .br-sh { fill: none; stroke-width: 2.3; stroke-linecap: round; }
.br-n0 { stroke: #22533a; } .br-n1 { stroke: #2d6849; } .br-n2 { stroke: #3e7e5a; } .br-sh { stroke: rgba(var(--shade), .22); }
.cd-flame { fill: #f6b54a; }
.sc-snow { position: absolute; inset: 0; width: 100%; height: 100%; }
.sc-burst { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }
.sc-dust { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 61; pointer-events: none; }
/* A box landed: the string lights blink for a moment, alternate bulbs out of step. */
.sc-twinkle .lt-glass, .sc-twinkle .sc-halo { animation: lt-blink .3s ease-in-out 7 alternate; }
.sc-twinkle g:nth-of-type(2n) .lt-glass, .sc-twinkle .sc-halo:nth-child(2n) { animation-delay: .15s; }
@keyframes lt-blink { from { opacity: 1; } to { opacity: .22; } }

/* ======================================================================
   A parcel: a calendar box given by a friend. Kraft shipping box from above, two flaps taped at the seam.
   ====================================================================== */

.pc { position: relative; width: min(100%, 380px); margin: 0 auto; container-type: inline-size; }
.pc-box {
  position: relative; aspect-ratio: 1.3; perspective: 900px; border-radius: 6px;
  background: repeating-linear-gradient(90deg, rgba(110, 70, 36, .08) 0 1px, transparent 1px 6px), linear-gradient(170deg, #c99d6a, #b8875a);
  box-shadow: 0 1px 0 #946738, 0 4px 0 #7a522b, 0 28px 44px -18px rgba(var(--shade), .75);
}
.pc-in { position: absolute; inset: 5%; border-radius: 4px; background: #7d5532; box-shadow: inset 0 8px 16px rgba(var(--shade), .65); overflow: hidden; }
.pc-pk { position: absolute; inset: 7%; width: auto; max-width: none; margin: 0; padding: 0; }
.pc-pk .pk-lid { height: 100%; margin: 0; padding: 12px; display: grid; place-items: center; rotate: none; border-radius: 6px; }
.pc-pk .pk-title { font-size: clamp(22px, 10cqi, 40px); }
.pc-note {
  position: absolute; z-index: 1; right: 6%; bottom: 7%; padding: .35em .7em .2em; rotate: -4deg; border-radius: 2px;
  background: #f8efdc; color: var(--ink); font: 700 clamp(16px, 5.4cqi, 22px)/1.1 var(--hand); box-shadow: 0 3px 8px rgba(var(--shade), .45);
}
.pc-flap { position: absolute; left: 0; right: 0; height: 50%; z-index: 2; transform-style: preserve-3d; }
.pc-flap-t { top: 0; transform-origin: 50% 0; }
.pc-flap-b { bottom: 0; transform-origin: 50% 100%; }
.pc-face, .pc-back { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.pc-face {
  background: radial-gradient(circle at 30% 40%, rgba(96, 58, 28, .18) 0 .7px, transparent 1.3px) 0 0 / 9px 11px,
    repeating-linear-gradient(95deg, rgba(110, 70, 36, .07) 0 1px, transparent 1px 7px), linear-gradient(175deg, #cfa575, #bb8b5c);
}
.pc-flap-t .pc-face { border-radius: 6px 6px 0 0; box-shadow: inset 0 -1px 0 rgba(var(--shade), .3); }
.pc-flap-b .pc-face { border-radius: 0 0 6px 6px; box-shadow: inset 0 1px 0 rgba(255, 240, 214, .25); }
.pc-back { transform: rotateX(180deg); background: linear-gradient(175deg, #e0c193, #cfab7a); }
.pc-flap-t .pc-back { border-radius: 6px 6px 0 0; } .pc-flap-b .pc-back { border-radius: 0 0 6px 6px; }
.pc-tape-half {
  position: absolute; left: -1.5%; right: -1.5%; height: 20%; opacity: .94;
  background: linear-gradient(180deg, rgba(255, 242, 214, .38), rgba(255, 242, 214, 0) 45%), repeating-linear-gradient(90deg, rgba(140, 96, 50, .12) 0 2px, transparent 2px 9px), #c9995a;
}
.pc-flap-t .pc-tape-half { bottom: 0; } .pc-flap-b .pc-tape-half { top: 0; }
.pc-label {
  position: absolute; left: 8%; top: 14%; display: grid; gap: 2px; padding: 8px 14px 6px; rotate: -2deg; border-radius: 2px;
  background: repeating-linear-gradient(180deg, transparent 0 21px, rgba(120, 140, 170, .2) 21px 22px), #f6ecd8; color: var(--ink);
  font: 700 clamp(18px, 6.4cqi, 26px)/1.1 var(--hand); box-shadow: 0 2px 6px rgba(var(--shade), .38);
}
.pc-label span { font: 600 10.5px/1.3 Inter, system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: #8a6a48; }
.pc-stamp { position: absolute; right: 8%; top: 12%; width: 14%; height: auto; rotate: 7deg; }
.pc-fragile {
  position: absolute; left: 50%; bottom: 26%; translate: -50% 0; rotate: -3deg; padding: 2px 10px; border: 2px solid rgba(168, 50, 45, .65); border-radius: 4px;
  color: rgba(168, 50, 45, .75); font: 600 12px/1.4 Inter, system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
}
/* The tape's hit area: a strip over the seam, taller than it looks, so a thumb finds it. */
.pc-tape {
  position: absolute; z-index: 3; left: -2%; right: -2%; top: 50%; height: max(52px, 24%); translate: 0 -50%; padding: 0; border: 0; border-radius: 4px;
  background: transparent; cursor: ew-resize; touch-action: none; -webkit-tap-highlight-color: transparent;
}
.pc-tape:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pc-cut { position: absolute; left: 0; top: 50%; width: 100%; height: 3px; margin-top: -1.5px; border-radius: 2px; background: #3b2417; opacity: 0; transform: scaleX(0); transform-origin: 0 50%; box-shadow: 0 1px 0 rgba(255, 240, 210, .5); }
/* A glint runs along the tape: this is where to swipe. */
.pc-tape::after {
  content: ""; position: absolute; left: 4%; top: 50%; width: 16%; height: 8px; margin-top: -4px; border-radius: 4px; pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 250, 236, 0), rgba(255, 250, 236, .85), rgba(255, 250, 236, 0)); animation: pc-hint 2s ease-in-out infinite;
}
@keyframes pc-hint { 0% { transform: translateX(0); opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { transform: translateX(480%); opacity: 0; } }
.pc-tape:active::after, .pc-cutdone .pc-tape::after { display: none; }
.pc-open .pc-tape { pointer-events: none; }
.pc-open .pc-flap { pointer-events: none; }
.pc-open .pc-flap-t { transform: rotateX(-160deg); }
.pc-open .pc-flap-b { transform: rotateX(160deg); }

/* ======================================================================
   Reduced motion: loops stop; state changes still show, they just do not travel.
   ====================================================================== */
@media (prefers-reduced-motion: reduce) {
  .gb, .gb *, .pk *, .th *, .sc *, .pc * { animation: none !important; transition: none !important; }
  .gb-ready .gb-glow { opacity: .9; }
  .gb-spark { opacity: .9; transform: none; }
  .th-steam { opacity: .4; }
  .th-out .th-smoke { opacity: 0; }
  .th-on .th-wave i { opacity: .95; }
}
