:root {
  --red: #b3202c; --pine: #1f5e46; --pine-dark: #15432f; --cream: #fffaf0; --ink: #1d2730;
  --muted: #5b6875; --gold: #f3c74f;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 17px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink);
  background: var(--red) url(texture.svg) repeat; background-size: 160px; }

.hero {
  position: relative; overflow: hidden; text-align: center; color: #fff;
  padding: 64px 20px 56px; text-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.hero > * { position: relative; }
.kicker { margin: 0; text-transform: uppercase; letter-spacing: .12em; font-size: 13px; color: var(--gold); }
.hero h1 { margin: 10px 0 6px; font-size: clamp(34px, 8vw, 60px); line-height: 1.05; }
.date { margin: 0; font-size: 20px; }
.countdown { margin: 8px 0 22px; min-height: 1.5em; color: #ffe9b0; }

/* falling snow over the whole page: a fixed layer behind the content, two layers of dots
   drifting down at different speeds */
.snow { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.snow::before, .snow::after {
  content: ""; position: absolute; inset: -100% 0 0;
  background-image: radial-gradient(2px 2px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(3px 3px at 90px 120px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 160px 60px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 60px 170px, #fff 50%, transparent 51%);
  background-size: 200px 200px; opacity: .5; animation: snow 14s linear infinite;
}
.snow::after { background-size: 300px 300px; opacity: .7; animation-duration: 22s; }
@keyframes snow { to { transform: translateY(50%); } }
.hero, main, footer { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .snow::before, .snow::after { animation: none; } }

.button {
  display: inline-block; padding: 12px 26px; border-radius: 999px; font-weight: 600;
  background: var(--pine); color: #fff; text-decoration: none; text-shadow: none;
  border: 2px solid var(--gold); box-shadow: 0 3px 8px rgba(0, 0, 0, .3);
}
.button:hover { filter: brightness(1.1); }
.button.disabled { background: #9aa5ae; border-color: #c4ccd2; cursor: default; filter: none; box-shadow: none; }

main {
  max-width: 680px; margin: 0 auto; padding: 8px 28px 16px;
  background: var(--cream) url(paper.svg);  /* faint paper grain */
  background-clip: padding-box;  /* see-through between the ribbon and the page */
  /* fancy frame (frame.svg): green satin ribbon with gold edges flowing round the card, see-through
     outside it; bows, holly and gold curls at the corners */
  border: 46px solid var(--pine); border-image: url(frame.svg) 40 round;
  /* small, tight shadow that follows the ribbon; a big soft one darkened the see-through strip
     outside the ribbon so its red no longer matched the page */
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .3));
}
@media (max-width: 720px) { main { margin: 0 8px; padding: 0 6px 4px; border-width: 36px; } }
section { margin: 36px 0; }
h2 { font-size: 24px; margin: 0 0 10px; color: var(--pine); }
h2::before { content: "\2744\FE0E  "; color: var(--red); font-size: .8em; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dt { font-weight: 600; }
dd { margin: 0; }
ul { padding-left: 22px; }
/* little ugly-sweater icon after "Something festive to wear" */
.sweater { vertical-align: middle; margin-left: 4px; }
.tbd { color: var(--muted); font-style: italic; background: #fff3cd; padding: 0 4px; border-radius: 3px; }
footer { text-align: center; color: #fff; padding: 24px 20px 40px; text-shadow: 0 1px 4px rgba(0, 0, 0, .4); }

/* Easter egg: advent calendar in the footer (built by app.js from characters.js). A picture
   (scene.svg) with doors 1-27 cut into it, in order, 5 columns; door 27 is 2x2 in the
   bottom-right corner. Each door's front shows its own piece of the picture (app.js sets the
   offset). Opening: the door swings on its left hinge, then the character springs forward
   toward the viewer (scales up from inside the compartment, shifted by --dx/--dy so it stays
   on the board) and wobbles. One door open at a time. */
footer p { margin: 0 0 24px; }
.calendar {
  position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
  width: min(440px, 100%); margin: 0 auto; padding: 16px; border-radius: 8px;
  background: #17503a url(scene.svg) 0 0 / 100% 100%;
  /* printed gold and red border, then the card's cut edge showing its thickness along the bottom */
  box-shadow: 0 0 0 4px var(--gold), 0 0 0 9px #8e1621, 0 3px 0 9px #c8b48c, 0 4px 0 9px #9c8762,
    0 14px 30px rgba(0, 0, 0, .5);
  text-shadow: none;
}
/* printed-card look: matte print grain and card fibres (card.svg, overlay blend) over the picture
   and the printed border. The doors carry the same grain, lined up (app.js), so it runs on
   unbroken across the board. */
.calendar::before {
  content: ""; position: absolute; inset: -9px; z-index: 0; border-radius: 14px; pointer-events: none;
  background: url(card.svg) 9px 9px / 160px; mix-blend-mode: overlay; opacity: .55;
}
@media (max-width: 520px) {
  footer { padding-left: 14px; padding-right: 14px; }
  .calendar { padding: 11px; gap: 7px; }
}
.advent {
  position: relative; z-index: 1; aspect-ratio: 1; padding: 0; border: 0; background: none;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: z-index 0s .45s;  /* stay on top while the character shrinks back */
}
.advent.big { grid-column: 4 / span 2; grid-row: 5 / span 2; aspect-ratio: auto; }
.advent.open { z-index: 6; transition-delay: 0s; }
.advent .compartment {
  position: absolute; inset: 0; border-radius: 4px; background: #2a060b;
  box-shadow: inset 0 5px 12px rgba(0, 0, 0, .8);
}
.advent .door {
  position: absolute; inset: 0; z-index: 3; transform-origin: left center;
  /* the door carries its own perspective (centred on the door, like perspective: 500px on
     .advent would be) so the character isn't under a perspective: in Firefox that left it
     fuzzy when pinch-zoomed (Firefox bug; Chrome is fine) */
  transform: translateX(50%) perspective(500px) translateX(-50%) rotateY(0);
  transform-style: preserve-3d; transition: transform .5s cubic-bezier(.3, .7, .4, 1) .35s;
}
/* Krampus's door (18) rattles every so often while closed, as if something inside is pushing it:
   it cracks open a few degrees and shakes. The rattle is on the door's printed front (.num), not
   the door itself: on the door it fought the door's open/close transition (closing 18 by opening
   another door made it swing back open). The front pivots on the same hinge, in the door's 3D. */
.advent[data-n="18"] .num { transform-origin: left center; }
.advent[data-n="18"]:not(.open) .num { animation: krampus-rattle 7s ease-in-out 3s infinite; }
@keyframes krampus-rattle {
  0%, 82%, 100% { transform: rotateY(0); }
  85% { transform: rotateY(-14deg); } 87% { transform: rotateY(-3deg); } 89% { transform: rotateY(-11deg); }
  91% { transform: rotateY(-2deg); } 93% { transform: rotateY(-7deg); } 96% { transform: rotateY(0); }
}
@media (prefers-reduced-motion: reduce) { .advent[data-n="18"]:not(.open) .num { animation: none; } }
.advent .num, .advent .door::after {
  position: absolute; inset: 0; border-radius: 4px; backface-visibility: hidden;
}
/* small doors: die-cut into the picture, with the cut line (.num::before) and the number.
   The front is the same printed card: the picture's piece plus the card grain (app.js lines both
   up with the board behind). */
.advent .num {
  display: grid; place-items: center; border-radius: 2px;
  background: url(card.svg), #17503a url(scene.svg) no-repeat;
  background-blend-mode: overlay, normal;
  font: 700 19px/1 Georgia, serif; color: #fff; text-shadow: 0 0 3px #000, 0 1px 2px #000;
}
/* the door's cut line: a light line (the card's core showing at the cut) with a dark shadow line
   just inside it, both a little see-through, so it reads on both the dark sky and the white snow */
.advent .num::before {
  content: ""; position: absolute; inset: 0; border-radius: 2px; pointer-events: none;
  box-shadow: inset 0 0 0 1.2px rgba(255, 249, 232, .4), inset 0 0 0 2.2px rgba(20, 28, 24, .22);
}
.advent.big .num {
  box-shadow: 0 3px 8px rgba(0, 0, 0, .45);
  outline: 1.5px dashed rgba(243, 199, 79, .9); outline-offset: -6px;
}
.advent.big .num b {
  display: grid; place-items: center; width: 56%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e0464f, #8e1621); border: 3px solid var(--gold);
  font: 700 30px/1 Georgia, serif; color: var(--gold); text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
  box-shadow: 0 3px 6px rgba(0, 0, 0, .4);
}
.advent .door::after {
  content: ""; transform: rotateY(180deg); background: url(card.svg) 0 0 / 160px, #d9c49a;
  background-blend-mode: overlay;  /* plain unprinted card on the back, same grain */
  box-shadow: inset 0 0 8px rgba(0, 0, 0, .25);
}
@media (hover: hover) { .advent:hover .door { transform: translateX(50%) perspective(500px) translateX(-50%) rotateY(-14deg); } }
.advent.open .door { transform: translateX(50%) perspective(500px) translateX(-50%) rotateY(-115deg); transition-delay: 0s; }

.advent .choc {
  position: absolute; left: 50%; top: 50%; z-index: 10; pointer-events: none;
  transform: translate(-50%, -50%) scale(.3); opacity: 0;
  transition: transform .3s ease-in, opacity 0s .3s;
}
.advent .wobble { display: block; }
.advent .wob { transform-box: view-box; transform-origin: 50% 90%; }
.advent .choc svg {
  display: block; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .4)); transition: filter .3s;
}
.advent.open .choc {
  pointer-events: auto; opacity: 1;
  transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(var(--s, 1.1));
  transition: transform .6s cubic-bezier(.3, 1.7, .5, 1) .35s, opacity 0s .35s;
}
.advent.open .choc svg { filter: drop-shadow(0 16px 16px rgba(0, 0, 0, .5)); transition-delay: .35s; }
.advent.open .wob { animation: wobble 2.4s ease-in-out 1s infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
.advent .bubble {
  position: absolute; left: 50%; bottom: calc(100% + 4px); z-index: 1;
  transform: translateX(-50%); width: max-content; max-width: 150px; text-align: center;
  background: #fff; color: var(--red); font: 700 12px/1.25 system-ui, sans-serif; padding: 6px 9px;
  border-radius: 12px; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); opacity: 0; transition: opacity .15s;
}
.advent .bubble::after {
  content: ""; position: absolute; left: calc(50% - 6px); top: 100%;
  border: 6px solid transparent; border-top-color: #fff;
}
.advent.open .bubble { opacity: 1; transition: opacity .2s .48s; }
/* blinking: each character's eyes (<g class="blink"> in characters.js) close briefly every few
   seconds while its door is open; app.js gives each door its own rhythm (--blink-dur/-delay) */
.advent.open .blink {
  transform-box: fill-box; transform-origin: center;
  animation: blink var(--blink-dur, 4s) var(--blink-delay, 1.2s) infinite;
}
/* Pair easter eggs (app.js): reindeer (20) + dog (26) toss the frisbee; cookie & milk (17) +
   Santa (27): a cookie hops over and gets eaten. Only small things travel (.flyer, no filters);
   the character that gave its thing away hides its own (.no-disc, .no-cookie). */
.advent.no-disc .disc, .advent.no-cookie .plate-cookie { visibility: hidden; }
/* present (25): drag it around to shake it (app.js); enough shaking bursts toys all over the page */
.advent[data-n="25"].open .choc { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.advent[data-n="25"].open .choc:active { cursor: grabbing; }
.advent .box-open, .advent.unwrapped .lid, .advent.unwrapped .strap { visibility: hidden; }
.advent.unwrapped .box-open { visibility: visible; }
.toy-burst { position: fixed; inset: 0; z-index: 1000; overflow: hidden; pointer-events: none; }
.toy-burst > div { position: absolute; }
.toy-burst svg { display: block; }  /* no filters on things that move: janky */
/* black sticker outline behind each toy (you liked black better than white): its shapes
   repainted black with a thick black stroke */
.toy-burst .outline * { fill: #1a1a1f !important; stroke: #1a1a1f !important; stroke-width: 7px !important; stroke-linejoin: round; stroke-linecap: round; opacity: 1 !important; }
/* rings stay rings (see-through bike wheels, hoop); the thin wheel rings get a thinner outline */
.toy-burst .outline [fill="none"], .toy-burst .outline [fill="none"] * { fill: none !important; }
.toy-burst .outline g[fill="none"] circle { stroke-width: 5.5px !important; }
.flyer { position: absolute; left: 0; top: 0; z-index: 20; pointer-events: none; }
.flyer > *, .flyer svg { display: block; }
.crumb { position: absolute; z-index: 20; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 1px;
  background: #b97f3e; pointer-events: none; }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.08); } }
@media (prefers-reduced-motion: reduce) { .advent.open .blink { animation: none; } }
/* Santa's sleigh glides: bobs and tilts as if over snow, speed lines streaming behind */
.advent.open .glide { transform-box: view-box; animation: glide 1.6s ease-in-out infinite; }
@keyframes glide {
  0%, 100% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(-3px) rotate(-3deg); }
  65% { transform: translateY(1px) rotate(2deg); }
}
.advent .speed { opacity: 0; }
.advent.open .speed { animation: speed .9s linear infinite; }
@keyframes speed { 0% { opacity: 0; transform: translateX(10px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateX(-6px); } }
@media (prefers-reduced-motion: reduce) { .advent.open .glide, .advent.open .speed { animation: none; } }
/* ice skates lean into the figure-eight's turns; a little ice spray now and then */
.advent.open .lean { transform-box: view-box; animation: lean 4s ease-in-out infinite; }
@keyframes lean { 0%, 50%, 100% { transform: rotate(0); } 25% { transform: rotate(-7deg); } 75% { transform: rotate(7deg); } }
.advent .spray { opacity: 0; }
.advent.open .spray { animation: spray 2s ease-out infinite; }
@keyframes spray { 0%, 40% { opacity: 0; transform: translate(0, 0); } 50% { opacity: 1; } 80%, 100% { opacity: 0; transform: translate(-6px, -5px); } }
@media (prefers-reduced-motion: reduce) { .advent.open .lean, .advent.open .spray { animation: none; } }
/* hedgehog (5): curled up, it rolls right and back (.hh-spin turns as it goes), then unrolls
   (ball squashes and pops away as the hedgehog springs up from a crouch), stands and waves, and
   curls back up. Closed or reduced motion: just standing. */
.advent .hh-ball { opacity: 0; }
.advent.open .hh-ball { animation: hh-ball 7s ease-in-out infinite; }
.advent.open .hh-spin { animation: hh-spin 7s ease-in-out infinite; }
.advent.open .hh-open { animation: hh-open 7s ease-in-out infinite; }
.advent.open .hh-wave { animation: hh-wave 7s ease-in-out infinite; }
@keyframes hh-ball {
  0%, 4% { opacity: 1; transform: none; }
  18% { transform: translateX(20px); }
  32% { transform: none; }
  37% { opacity: 1; transform: scale(1.12, .8); }
  40%, 84% { opacity: 0; transform: scale(.6); }
  88% { opacity: 1; transform: scale(1.1, .85); }
  92%, 100% { opacity: 1; transform: none; }
}
@keyframes hh-spin { 0%, 4% { transform: rotate(0); } 18% { transform: rotate(150deg); } 32%, 100% { transform: rotate(0); } }
@keyframes hh-open {
  0%, 37% { opacity: 0; transform: scale(.55, .4); }
  40% { opacity: 1; transform: scale(.9, 1.1); }
  44% { transform: scale(1.05, .95); }
  48%, 80% { opacity: 1; transform: none; }
  84% { opacity: 1; transform: scale(1.1, .6); }
  86%, 100% { opacity: 0; transform: scale(.55, .4); }
}
@keyframes hh-wave { 0%, 52% { transform: none; } 56%, 64%, 72% { transform: rotate(-35deg); } 60%, 68% { transform: rotate(10deg); } 76%, 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .advent.open .hh-ball, .advent.open .hh-spin, .advent.open .hh-open, .advent.open .hh-wave { animation: none; } }
/* snow globe (5): grab and shake it (app.js). While stirred its endless snowfall hides and
   app.js's simulated flakes take over; shaken a while, its face goes dizzy (spinning spirals) */
.advent[data-n="5"].open .choc { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.advent[data-n="5"].open .choc:active { cursor: grabbing; }
.advent .globe-snow { transition: opacity .8s; }
.advent.stirred .globe-snow { opacity: 0; transition: opacity .15s; }
.advent .globe-dizzy, .advent.dizzy .globe-eyes { display: none; }
.advent.dizzy .globe-dizzy { display: inline; }
.advent.dizzy .globe-dizzy path { transform-box: fill-box; transform-origin: center; animation: dizzy .6s linear infinite; }
@keyframes dizzy { to { transform: rotate(360deg); } }
/* shy bunny (16): app.js moves it with --bx/--by; it peeks over the snowdrift, its tail pokes out
   the side, and it hops up on top (.shy-out: a springier move) when it finally comes out */
.advent .shy-b { transform: translate(var(--bx, 0px), var(--by, 92px)); transition: transform .3s ease-in-out; }
.advent.shy-out .shy-b { transition: transform .55s cubic-bezier(.3, 1.6, .5, 1); }
.advent .shy-tail { transform: translateX(-14px); transition: transform .35s ease-in-out; }
.advent.shy-tailout .shy-tail { transform: translateX(3px); }
.advent.shy-tailout .tail-fluff { animation: tail-twitch .3s ease-in-out .35s 4 alternate; }
.advent[data-n="16"]:not(.shy-talk) .bubble { opacity: 0; }
@keyframes tail-twitch { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }
@media (prefers-reduced-motion: reduce) { .advent .shy-b, .advent .shy-tail { transition: none; } .advent.shy-tailout .tail-fluff { animation: none; } }
/* wreath: the squirrel ducks behind the ring and pops back up (peekaboo); its tail flicks */
.advent.open .peek { animation: peek 3.4s ease-in-out 1s infinite; }
.advent.open .peek-paws { animation: peek-paws 3.4s ease-in-out 1s infinite; }
@keyframes peek { 0%, 45%, 100% { transform: translateY(0); } 15%, 30% { transform: translateY(23px); } }
@keyframes peek-paws { 0%, 45%, 100% { transform: translateY(0); opacity: 1; } 12%, 33% { transform: translateY(5px); opacity: 0; } }
.advent.open .tail-flick { transform-box: view-box; animation: tail-flick 1.6s ease-in-out infinite; }
.advent.open .nibble { animation: nibble 1.7s linear infinite; }
@keyframes nibble {
  0%, 50%, 100% { transform: translateY(0); }
  8%, 24%, 40% { transform: translateY(-2.5px); } 16%, 32% { transform: translateY(0); }
}
@keyframes tail-flick { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-12deg); } 80% { transform: rotate(6deg); } 90% { transform: rotate(-4deg); } }
@media (prefers-reduced-motion: reduce) { .advent.open .peek, .advent.open .peek-paws, .advent.open .tail-flick { animation: none; } }
/* stocking: the candy cane and present pop up in turn; the kitten's ears twitch in turn; the
   stocking wiggles now and then */
.advent.open .pop-a { animation: pop-up 2.8s ease-in-out .5s infinite; }
.advent.open .pop-b { animation: pop-up 2.8s ease-in-out 1.9s infinite; }
@keyframes pop-up { 0%, 40%, 100% { transform: translateY(0); } 12% { transform: translateY(-6px); } 22% { transform: translateY(-4px); } }
.advent.open .ear-l { transform-box: view-box; animation: ear-l 3s ease-in-out 1.2s infinite; }
.advent.open .ear-r { transform-box: view-box; animation: ear-twitch 3s ease-in-out 2.4s infinite; }
@keyframes ear-l { 0%, 20%, 100% { transform: rotate(0); } 5%, 15% { transform: rotate(-24deg); } 10% { transform: rotate(4deg); } }
.advent.open .wiggle { transform-box: view-box; animation: wiggle 3.6s ease-in-out .8s infinite; }
@keyframes wiggle {
  0%, 30%, 100% { transform: rotate(0); }
  6% { transform: rotate(-4deg); } 12% { transform: rotate(3.5deg); } 18% { transform: rotate(-2.5deg); } 24% { transform: rotate(1deg); }
}
@media (prefers-reduced-motion: reduce) { .advent.open .ear-l, .advent.open .ear-r, .advent.open .wiggle, .advent.open .pop-a, .advent.open .pop-b { animation: none; } }
/* the sleigh's reindeer gallop: the body bounces, front and back legs swing in turn; Rudolph's
   nose glows */
.advent.open .gallop { animation: gallop .5s ease-in-out infinite; }
@keyframes gallop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.advent.open .leg-front { transform-box: view-box; animation: leg .5s ease-in-out infinite alternate; }
.advent.open .leg-back { transform-box: view-box; animation: leg .5s ease-in-out infinite alternate-reverse; }
@keyframes leg { from { transform: rotate(-25deg); } to { transform: rotate(25deg); } }
.advent.open .glow-nose { animation: glow-nose 1s ease-in-out infinite alternate; }
@keyframes glow-nose { from { opacity: .2; } to { opacity: .7; } }
@media (prefers-reduced-motion: reduce) {
  .advent.open .gallop, .advent.open .leg-front, .advent.open .leg-back, .advent.open .glow-nose { animation: none; }
}
/* penguin waddles (quick rock from the feet) and flaps its free flipper */
.advent.waddle.open .wob { animation: waddle .55s ease-in-out .6s infinite alternate; }
@keyframes waddle { from { transform: rotate(-6deg) translateX(-1px); } to { transform: rotate(6deg) translateX(1px); } }
.advent.open .flap { transform-box: view-box; animation: flap .55s ease-in-out .6s infinite alternate; }
@keyframes flap { from { transform: rotate(10deg); } to { transform: rotate(-18deg); } }
@media (prefers-reduced-motion: reduce) { .advent.open .flap { animation: none; } }
/* Mrs. Claus tilts her clipboard; the frisbee reindeer's eyes search (left, right, up at the
   frisbee on his antlers); mistletoe leaves sway; the present's lid jiggles */
.advent.open .clip-tilt { transform-box: view-box; animation: clip-tilt 3.4s ease-in-out infinite; }
@keyframes clip-tilt { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-10deg); } 60% { transform: rotate(5deg); } }
.advent.open .search { animation: search 4.5s ease-in-out infinite; }
@keyframes search {
  0%, 8%, 92%, 100% { transform: translate(0, 0); }
  16%, 28% { transform: translate(-3px, 0); }
  40%, 52% { transform: translate(3px, 0); }
  64%, 82% { transform: translate(1.5px, -3px); }
}
.advent.open .sway { transform-box: view-box; animation: sway 2.4s ease-in-out infinite; }
/* mistletoe on a sneaky elf's fishing rod (door 2): the picture doesn't wobble as a whole. The
   bait swings from the rod tip (56,4), jiggles twice (the rod dips with it and the elf snickers),
   sways, is yanked up (the elf leans back, the reel spins) and let down slowly. The rod only moves
   up and down so its tip stays on the line; the line above the tip runs off the top of the
   picture, which clips it */
.advent[data-n="2"].open .wob { animation: none; }
.advent .bait, .advent .rod, .advent .reel-handle, .advent .angler { transform-box: view-box; }
.advent .bait { transform-origin: 56px 4px; }
.advent .angler { transform-origin: 21px 120px; }
.advent .reel-handle { transform-origin: 45.5px 102px; }
.advent.open .bait { animation: bait 6s ease-in-out .9s infinite; }
.advent.open .rod { animation: rod 6s ease-in-out .9s infinite; }
.advent.open .angler { animation: angler 6s ease-in-out .9s infinite; }
.advent.open .reel-handle { animation: reel 6s linear .9s infinite; }
@keyframes bait {
  0% { transform: none; }
  4% { transform: translateY(3px); } 7% { transform: none; }
  10% { transform: translateY(3px); } 13% { transform: none; }
  22% { transform: rotate(4deg); } 32% { transform: rotate(-4deg); } 40% { transform: none; }
  46% { transform: translateY(-14px); animation-timing-function: ease-in; }  /* yanked up (more and the bow is cut off by the top of the picture) */
  54% { transform: translateY(-14px); }
  90%, 100% { transform: none; }  /* let down slowly */
}
@keyframes rod {
  0%, 100% { transform: none; }
  4% { transform: translateY(1.5px); } 7% { transform: none; }
  10% { transform: translateY(1.5px); } 13% { transform: none; }
  40% { transform: none; } 46% { transform: translateY(-2px); } 54% { transform: none; }
}
@keyframes angler {  /* snickers (little bounces) while jiggling the bait; leans back for the yank */
  0%, 100% { transform: none; }
  3% { transform: translateY(-1.2px); } 5% { transform: none; } 7% { transform: translateY(-1.2px); }
  9% { transform: none; } 11% { transform: translateY(-1.2px); } 13% { transform: none; }
  40% { transform: none; } 46%, 52% { transform: rotate(-5deg); } 60% { transform: none; }
}
@keyframes reel { 0%, 40% { transform: none; } 46% { transform: rotate(720deg); } 54%, 100% { transform: rotate(720deg); } }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.advent.open .lid { transform-box: view-box; animation: lid 2.6s linear 1s infinite; }
@keyframes lid {
  0%, 30%, 100% { transform: translateY(0) rotate(0); }
  5% { transform: translateY(-3px) rotate(-1.5deg); }
  10% { transform: translateY(0) rotate(0); }
  15% { transform: translateY(-4px) rotate(1.5deg); }
  20% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-2px) rotate(-.8deg); }
}
/* the ribbon stretches from the bottom of the box as the lid pushes up (66 units tall: +3 = 4.5%) */
.advent.open .strap { transform-box: view-box; animation: strap 2.6s linear 1s infinite; }
@keyframes strap {
  0%, 10%, 20%, 30%, 100% { transform: scaleY(1); }
  5% { transform: scaleY(1.045); }
  15% { transform: scaleY(1.06); }
  25% { transform: scaleY(1.03); }
}
@media (prefers-reduced-motion: reduce) {
  .advent.open .clip-tilt, .advent.open .search, .advent.open .sway, .advent.open .lid, .advent.open .strap { animation: none; }
  .advent.open .bait, .advent.open .rod, .advent.open .reel-handle, .advent.open .angler { animation: none; }
}
/* train rocks forward and back on the track; teddy squishes; a cookie dunks in the milk */
.advent.open .chug { animation: chug 1.4s ease-in-out infinite alternate; }
@keyframes chug { from { transform: translateX(-2.5px); } to { transform: translateX(2.5px); } }
.advent.open .squish { transform-box: view-box; animation: squish 3s ease-in-out 1s infinite; }
@keyframes squish {
  0%, 30%, 100% { transform: scale(1, 1); }
  8% { transform: scale(1.07, .92); }
  16% { transform: scale(.97, 1.03); }
  23% { transform: scale(1.01, .99); }
}
.advent.open .dunk { animation: dunk 3.2s ease-in-out infinite; }
@keyframes dunk {
  0%, 20%, 75%, 100% { transform: translateY(0); }
  35%, 50% { transform: translateY(17px); }
}
.advent .splash { opacity: 0; }
.advent.open .splash { animation: splash 3.2s ease-out infinite; }
@keyframes splash {
  0%, 32% { opacity: 0; transform: translateY(4px); }
  36% { opacity: 1; }
  46%, 100% { opacity: 0; transform: translateY(-6px); }
}
@media (prefers-reduced-motion: reduce) {
  .advent.open .chug, .advent.open .squish, .advent.open .dunk, .advent.open .splash { animation: none; }
}
/* beaver chews in bursts; polar bear's ear twitches now and then; owl's eyes glance side to side */
.advent.open .chew { animation: chew 2.4s linear infinite; }
@keyframes chew {
  0%, 8%, 16%, 24%, 32%, 40%, 100% { transform: translateY(0); }
  4%, 12%, 20%, 28%, 36% { transform: translateY(2.4px); }
}
.advent.open .ear-twitch { transform-box: view-box; animation: ear-twitch 3.2s ease-in-out 1s infinite; }
@keyframes ear-twitch {
  0%, 20%, 100% { transform: rotate(0); }
  5%, 15% { transform: rotate(26deg); }
  10% { transform: rotate(-4deg); }
}
.advent.open .look { animation: look 4s ease-in-out infinite; }
@keyframes look {
  0%, 10%, 90%, 100% { transform: translateX(0); }
  20%, 40% { transform: translateX(-3.5px); }
  55%, 75% { transform: translateX(3.5px); }
}
@media (prefers-reduced-motion: reduce) { .advent.open .chew, .advent.open .ear-twitch, .advent.open .look { animation: none; } }
/* beaver (22) + tree (23) pair trick (app.js timber()): he goes in front of the tree, gnaws fast,
   the top of the tree falls over from the cut above its stump */
.advent.gnawing { z-index: 7; }
.beaver-side, .advent.side-view .beaver-front { display: none; }
.advent.side-view .beaver-side { display: inline; }
/* upright on his hind legs while he walks over, then he bends down to the trunk */
.side-body { transform-box: view-box; transform-origin: 32px 113px; transition: transform .35s ease-in-out; }
.advent.walking .side-body { transform: rotate(-50deg); }
/* ...with his head tipped back down so he looks ahead, not at the sky (pivot at his neck) */
.side-head { transform-box: view-box; transform-origin: 60px 95px; transition: transform .35s ease-in-out; }
.advent.walking .side-head { transform: rotate(42deg); }
.advent.gnaw-fast .chew { animation: gnaw .14s linear infinite; }
@keyframes gnaw { 50% { transform: translateY(2.6px); } }
.tree-top { transform-box: view-box; transform-origin: 54px 97.5px; }
.advent[data-n="23"] .wobble svg { overflow: visible; }  /* the fallen tree reaches past its picture */
.chip { width: 5px; height: 3px; background: #e8c48c; border-radius: 1px; }
.puff { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: #fff; }
/* snow piles up slowly on the snowman's hat, arms (8 s each, staggered over ~20 s) and the ground
   round his base (30 s) while his door is open (each mound grows once) */
.advent .pile { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); }
.advent.open .pile { animation: pile 8s ease-out forwards; }
@keyframes pile { from { transform: scale(.4, 0); } to { transform: scale(1, 1); } }
@media (prefers-reduced-motion: reduce) { .advent.open .pile { animation: none; transform: none; } }
/* snowflakes drift down around the snowman, swaying, fading near the bottom */
.advent .flake { opacity: 0; }
.advent.open .flake { animation: flake 6s linear infinite; }
@keyframes flake {
  0% { opacity: 0; transform: translate(0, 4px) rotate(0); }
  10% { opacity: 1; }
  30% { transform: translate(4px, 34px) rotate(60deg); }
  60% { transform: translate(-4px, 70px) rotate(120deg); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translate(2px, 110px) rotate(180deg); }
}
@media (prefers-reduced-motion: reduce) { .advent.open .flake { animation: none; opacity: 1; transform: translateY(40px); } }
/* the elf's hat tip bobs and its bell swings from it, a beat behind (a waving arm looked like
   a shaken fist); Krampus shakes his birch switch from his grip: quick shakes, then a pause */
.advent.open .hat-tip { transform-box: view-box; animation: hat-tip 1.6s ease-in-out infinite; }
@keyframes hat-tip { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg); } }
.advent.open .bell-swing { transform-box: view-box; animation: bell-swing 1.6s ease-in-out -.3s infinite; }
@keyframes bell-swing { 0%, 100% { transform: rotate(14deg); } 50% { transform: rotate(-14deg); } }
.advent.open .shake { transform-box: view-box; animation: shake var(--shake-dur, 1.8s) ease-in-out infinite; }
/* Krampus (18): pester him by reopening his door and he gets angrier (app.js sets --anger 0-5):
   redder face, steam out of his ears from 3 on, faster switch-shaking */
/* Krampus's punishment (app.js punish()): coal tumbling down the screen; for 30 s every door
   holds a lump of coal saying "Naughty!" (.coaled) and his door is chained shut (.coal-time);
   then a sparkle sweeps across the calendar (.coal-lifted) */
.advent .coal-lump, .advent .coal-say, .advent .chains { display: none; }
.advent.coaled .coal-lump { display: block; }
.advent.coaled .coal-say { display: block; bottom: 48%; }  /* just above the lump, which sits low in its picture */
.advent.coaled .wobble, .advent.coaled .label, .advent.coaled .bubble:not(.coal-say) { display: none; }
.advent .coal-lump svg { display: block; filter: drop-shadow(0 16px 16px rgba(0, 0, 0, .5)); }
.coal-time .chains { display: block; position: absolute; inset: -3px; z-index: 2; }
.coal-time .chains svg { display: block; width: 100%; height: 100%; }
.coal-rain { position: fixed; inset: 0; z-index: 1000; overflow: hidden; pointer-events: none; }
.coal-rain > div { position: absolute; top: 0; }
.coal-rain svg { display: block; }
.calendar.coal-lifted::after {
  content: ""; position: absolute; inset: 0; z-index: 30; pointer-events: none; border-radius: 8px;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 246, 200, .75) 48%, rgba(255, 255, 255, .9) 50%, transparent 62%) no-repeat;
  background-size: 300% 100%; animation: lifted 1.2s ease-in-out forwards;
}
@keyframes lifted { from { background-position: 100% 0; } to { background-position: 0 0; } }
.advent .anger { opacity: calc(var(--anger, 0) * .13); transition: opacity .3s; }
.advent .fume { display: none; }
.advent.fuming .fume { display: inline; }
.advent.fuming .fume-puff { transform-box: fill-box; transform-origin: center; animation: fume .9s ease-out infinite; }
@keyframes fume { from { opacity: .9; transform: translateY(0) scale(.6); } to { opacity: 0; transform: translateY(-14px) scale(1.6); } }
@media (prefers-reduced-motion: reduce) { .advent.fuming .fume-puff { animation: none; opacity: .7; } }
@keyframes shake {
  0%, 50%, 100% { transform: rotate(0); }
  10%, 30% { transform: rotate(-10deg); }
  20%, 40% { transform: rotate(8deg); }
}
@media (prefers-reduced-motion: reduce) { .advent.open .hat-tip, .advent.open .bell-swing, .advent.open .shake { animation: none; } }
/* hanging things swing like a pendulum from their hanger (--pivot: hanger height in the SVG) */
.advent.hang .wob { transform-origin: 50% var(--pivot, 0%); }
.advent.hang.open .wob { animation: swing 2.8s ease-in-out .6s infinite; }
@keyframes swing { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-7deg); } 75% { transform: rotate(7deg); } }
/* shine: a glint of light sweeps across Santa's foil and the bauble, then pauses */
.advent.open .shine { animation: shine 3.6s ease-in-out infinite; }
.advent .shine { opacity: 0; }
@keyframes shine {
  0% { opacity: 1; transform: translateX(0); }
  35% { opacity: 1; transform: translateX(150px); }
  36%, 100% { opacity: 0; transform: translateX(150px); }
}
@media (prefers-reduced-motion: reduce) { .advent.open .shine { animation: none; } }
/* sleepy mouse: "z"s float up from beside its head, growing and fading, one after another */
.advent.open .zzz { transform-box: fill-box; transform-origin: center; animation: zzz 3s ease-out infinite; }
.advent .zzz { opacity: 0; }
@keyframes zzz {
  0% { opacity: 0; transform: translate(0, 0) scale(.5); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(-10px, -30px) scale(1.4); }
}
@media (prefers-reduced-motion: reduce) { .advent.open .zzz { animation: none; opacity: 1; } }
/* nutcracker: the lower jaw (beard) drops open and snaps shut twice, then rests */
.advent.open .jaw { animation: jaw 2.2s ease-in-out infinite; }
@keyframes jaw {
  0%, 45%, 100% { transform: translateY(0); }
  10%, 30% { transform: translateY(8px); }
  20% { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) { .advent.open .jaw { animation: none; } }
/* tails: the dog wags fast, the cat swishes slowly (pivot set inline, in viewBox units) */
.advent.open .wag { transform-box: view-box; animation: wag .32s ease-in-out infinite alternate; }
@keyframes wag { from { transform: rotate(-14deg); } to { transform: rotate(16deg); } }
.advent.open .swish { transform-box: view-box; animation: swish 2.6s ease-in-out infinite; }
@keyframes swish { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-16deg); } }
@media (prefers-reduced-motion: reduce) { .advent.open .wag, .advent.open .swish { animation: none; } }
/* rising steam (hot cocoa) and smoke puffs (train): each wisp/puff rises and fades, out of step */
.advent.open .steam { animation: steam 3s ease-out infinite; }
@keyframes steam {
  0% { opacity: 0; transform: translate(0, 6px); }
  30% { opacity: 1; }
  70% { transform: translate(2px, -5px); }
  100% { opacity: 0; transform: translate(-1px, -10px); }
}
.advent.open .puff { transform-box: fill-box; transform-origin: center; animation: puff 1.8s ease-out infinite; }
@keyframes puff {
  0% { opacity: 0; transform: translate(-6px, 10px) scale(.4); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(6px, -10px) scale(1.4); }
}
@media (prefers-reduced-motion: reduce) { .advent.open .steam, .advent.open .puff { animation: none; } }
/* twinkling Christmas-tree lights (class="twinkle", big tree's lights also have a .glow halo)
   and the tree's star gently pulsing; per-light animation-delay set inline in characters.js */
.advent.open .twinkle { animation: twinkle 1.8s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.advent.open .glow { animation: glow 1.8s ease-in-out infinite; }
@keyframes glow { 0%, 100% { opacity: .8; } 50% { opacity: 0; } }
.advent.open .star-pulse { transform-box: fill-box; transform-origin: center; animation: star-pulse 2.2s ease-in-out infinite; }
@keyframes star-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) {
  .advent.open .twinkle, .advent.open .glow, .advent.open .star-pulse { animation: none; }
}
/* name tag under a character people might not recognize (characters.js `label`) */
.advent .label {
  position: absolute; left: 50%; top: calc(100% - 6px); transform: translateX(-50%);
  white-space: nowrap; padding: 3px 12px; background: var(--red); color: #fff;
  font: 700 11px/1.2 Georgia, serif; letter-spacing: .06em; text-transform: uppercase;
  border: 1.5px solid var(--gold); border-radius: 3px; box-shadow: 0 2px 5px rgba(0, 0, 0, .35);
}
/* the two sound buttons share one look: green (gold rim) = on, grey = off (off music also gets a
   red line struck through the note, like the crossed-out speaker) */
/* door-sound mute (sfx.js), stacked above the music button */
.sfx {
  position: fixed; right: 17px; bottom: 72px; z-index: 20; width: 44px; height: 44px;  /* centred over the music button */
  border-radius: 50%; border: 2.5px solid var(--gold); background: var(--pine); font-size: 21px;
  line-height: 1; cursor: pointer; box-shadow: 0 3px 10px rgba(0, 0, 0, .4); padding: 0;
}
.sfx[aria-pressed="false"] { background: #6b7780; border-color: #9aa3a8; }
/* music toggle (music.js): floating bottom-right, off until clicked */
.music {
  position: fixed; right: 14px; bottom: 14px; z-index: 20; width: 50px; height: 50px;
  border-radius: 50%; border: 3px solid #9aa3a8; background: #6b7780; color: #fff;
  line-height: 0; padding: 0; display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
}
.music svg { width: 38px; height: 38px; }  /* a drawn note: the ♪ glyph varied with the font */
.music[aria-pressed="false"]::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 36px; height: 2.5px; border-radius: 2px;
  background: #e8313b; transform: translate(-50%, -50%) rotate(-45deg);  /* red, like the muted speaker's line */
}
.music[aria-pressed="true"] { background: var(--pine); border-color: var(--gold); color: #fff; animation: bop .8s ease-in-out infinite; }
@keyframes bop { 50% { transform: translateY(-3px) rotate(-8deg); } }
@media (prefers-reduced-motion: reduce) { .music[aria-pressed="true"] { animation: none; } }
.advent:focus-visible { outline: 3px solid #fff; outline-offset: 3px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  .advent .door, .advent .choc, .advent .bubble, .advent .choc svg { transition: none !important; }
  .advent .wob { animation: none !important; }
}
