/* ==========================================================================
   Playtime (js/fun.js): the layer over the house, Zakzak's copy in it, and each game.
   Loaded after walk.css. A game draws inside .fun-stage; its own classes start with
   its prefix (bl- balloons, rc- race, dr- drums, fw- fireworks, lx- lights, sn- sneeze).
   ========================================================================== */

/* ---------- The layer: a window that is the whole screen ---------- */
.fun-layer {
  display: block;
  padding: 0;
  overflow: hidden;
  background: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.fun-sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(#8fd4ff, #e3f6ff 58%, #cdeec0 60%, #a9df9a);
  opacity: 0;
  transition: opacity .45s;
}
.fun-layer.is-playing .fun-sky, .fun-layer.is-done .fun-sky { opacity: 1; }
.fun-layer.is-closing { animation: fun-out .32s ease-in forwards; }
@keyframes fun-out { to { opacity: 0; } }

.fun-stage { position: absolute; inset: 0; z-index: 1; overflow: hidden; }

/* His copy: in his house place at first (same size and spot as #zakzak, css/app.css) */
.fun-layer .zakzak {
  z-index: 3;
  pointer-events: none;      /* taps go through to the stage; a game may switch them on */
  transition: left .6s cubic-bezier(.3, 1.2, .5, 1), bottom .6s cubic-bezier(.3, 1.2, .5, 1), width .6s;
}
.fun-layer .zakzak .zk-fill { fill: url(#zk-grad); }
.fun-layer .zakzak .zk-leg { fill: url(#zk-limb-grad); }
.fun-layer .zakzak .zk-horn { fill: url(#zk-horn-grad); }
.fun-layer .zakzak .zk-cheek { fill: url(#zk-cheek-grad); opacity: .85; }
.fun-layer .fun-owl { position: absolute; transform: none; pointer-events: none; }

/* His bubble (parents read it; the child hears him) */
.fun-bubble { z-index: 4; }

/* Leaving: the same hold-on-home as a lesson (js/touch.js data-hold) */
.fun-home { z-index: 5; }

/* The finale's confetti falls inside the layer */
.fun-layer .confetti { position: absolute; z-index: 6; }

/* ---------- Shared bits for the games ---------- */
/* A big round thing to tap (a balloon, a drum pad): no browser button look */
.fun-btn {
  position: absolute;
  padding: 0;
  border: 0;
  background: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.fun-btn:focus { outline: none; }

/* A burst of light that answers any tap on empty ground */
.fun-spark {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 2;
}
.fun-spark i {
  position: absolute;
  left: -6px;
  top: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffd84d;
  animation: fun-spark .55s ease-out forwards;
}
@keyframes fun-spark {
  to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .fun-layer.is-closing { animation: none; opacity: 0; }
  .fun-sky { transition: none; }
}

/* ---------- Balloons (js/fun.js balloons): balloons rise in lanes, a tap pops one ---------- */
/* Zakzak's copy stays in his place, a little smaller and lower, and looks up at the balloons */
.fun--balloons .zakzak { width: min(44vw, 30vh); bottom: 3%; }
.fun--balloons .zakzak:not(.is-wrong) .zk-pupil,
.fun--balloons .zakzak:not(.is-wrong) .zk-shine { animation: none; translate: 0 -6px; }
@media (orientation: landscape) {
  .fun--balloons .zakzak { width: min(30vw, 42vh); bottom: 2%; }
}

/* The gradients every balloon body fills with (one hidden svg in the stage) */
.bl-defs { position: absolute; width: 0; height: 0; }

/* A balloon: the button is moved by js (translate), its svg sways like a pendulum from the string's end */
.bl-balloon {
  left: 0;
  top: 0;
  width: clamp(90px, 24vmin, 160px);
  height: clamp(135px, 36vmin, 240px);   /* 1.5 x the width: the body, the knot and the string (viewBox 100 x 150) */
  z-index: 1;
  will-change: transform;
  --d: 0s;                                /* js: a random negative delay, so no two sway in step */
}
.bl-balloon svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform-origin: 50% 100%;
  animation: bl-sway 3.2s ease-in-out var(--d) infinite alternate, bl-in .45s cubic-bezier(.3, 1.5, .5, 1);
}
@keyframes bl-sway { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
@keyframes bl-in { from { scale: .3; opacity: 0; } }
.bl-balloon.is-press svg { scale: 1.1; }   /* the finger is on it (js/touch.js) */

.bl-body { stroke: rgba(40, 34, 70, .14); stroke-width: 1.5; }
.bl-shine { fill: #fff; opacity: .6; }
.bl-knot { fill: var(--cd); }
.bl-string {
  fill: none;
  stroke: #7a6a9a;
  stroke-width: 2.5;
  stroke-linecap: round;
  transform-box: fill-box;
  transform-origin: 50% 0;
  animation: bl-string 1.6s ease-in-out var(--d) infinite alternate;
}
@keyframes bl-string { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }

/* The six colours: --c tints the bits, --cd the knot (the body uses the matching gradient) */
.bl-c0 { --c: #ff5c7a; --cd: #d4355a; }
.bl-c1 { --c: #ff9f43; --cd: #e0761a; }
.bl-c2 { --c: #ffd84d; --cd: #e0b000; }
.bl-c3 { --c: #7fd36b; --cd: #4ea43c; }
.bl-c4 { --c: #5fb8ff; --cd: #2f8ad9; }
.bl-c5 { --c: #b98cff; --cd: #8a5fe0; }

/* The golden one (level 2+): wobbles, glows and glints (.bl-gold alone also colours its bits, see .bl-pop) */
.bl-gold { --c: #ffd84d; --cd: #c98a00; }
.bl-balloon.bl-gold { z-index: 2; }
.bl-balloon.bl-gold svg { animation: bl-wobble 1.1s ease-in-out var(--d) infinite alternate, bl-in .45s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes bl-wobble { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
.bl-glow { fill: #ffe680; opacity: .45; animation: bl-glow 1.2s ease-in-out infinite alternate; }
@keyframes bl-glow { from { opacity: .25; } to { opacity: .6; } }
.bl-gold .bl-shine { animation: bl-glow 1.2s ease-in-out infinite alternate; }

/* The giant one (finale): bobs in the centre; every tap swells it (--g from js) with a boing */
.bl-giant { --c: #b98cff; --cd: #8a5fe0; }
.bl-balloon.bl-giant {
  --g: 1;
  width: clamp(180px, 46vmin, 440px);
  height: clamp(270px, 69vmin, 660px);
  z-index: 3;
}
.bl-balloon.bl-giant svg { animation: bl-bob 1.8s ease-in-out infinite alternate, bl-in .6s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes bl-bob { from { transform: translateY(0); } to { transform: translateY(-3%); } }
.bl-gs {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transform: scale(var(--g));
  transition: transform .4s cubic-bezier(.3, 1.8, .5, 1);   /* the overshoot is the swell */
}
.bl-gb { transform-box: fill-box; transform-origin: 50% 100%; }
.bl-boing .bl-gb { animation: bl-boing .45s ease-out; }
@keyframes bl-boing {
  30% { transform: scale(1.18, .84); }
  60% { transform: scale(.9, 1.12); }
  100% { transform: scale(1, 1); }
}

/* The suspense beat (level 3+): everything holds still for a moment */
.bl-still .bl-balloon svg, .bl-still .bl-string, .bl-still .bl-glow, .bl-still .bl-shine { animation-play-state: paused; }

/* Self-play: the balloon about to pop by itself swells a few times first */
.bl-hint .bl-body { transform-box: fill-box; transform-origin: center; animation: bl-pulse .2s ease-in-out 3 alternate; }
@keyframes bl-pulse { to { transform: scale(1.14); } }

/* A pop: rubber bits fly out, the string drops; stars after a golden one. Placed by js, gone in under a second.
   The box carries the balloon's colour class (bl-c0..5, bl-gold, bl-giant) so the bits take its --c */
.bl-pop { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 4; pointer-events: none; }
.bl-bit {
  position: absolute;
  left: -8px;
  top: -6px;
  width: 16px;
  height: 12px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--c, #ffd84d);
  animation: bl-bit .7s ease-out forwards;
}
.bl-bit:nth-child(2n) { width: 12px; height: 9px; }
.bl-bit:nth-child(3n) { width: 20px; height: 8px; }
.bl-big .bl-bit { width: 26px; height: 18px; animation-duration: .9s; }
.bl-big .bl-bit:nth-child(6n+1) { background: #ff5c7a; }
.bl-big .bl-bit:nth-child(6n+2) { background: #ff9f43; }
.bl-big .bl-bit:nth-child(6n+3) { background: #ffd84d; }
.bl-big .bl-bit:nth-child(6n+4) { background: #7fd36b; }
.bl-big .bl-bit:nth-child(6n+5) { background: #5fb8ff; }
.bl-big .bl-bit:nth-child(6n) { background: #b98cff; }
@keyframes bl-bit {
  from { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(.4); opacity: 0; }
}
.bl-tail { position: absolute; overflow: visible; animation: bl-tail .7s ease-in forwards; }
.bl-tail path { fill: none; stroke: #7a6a9a; stroke-width: 2.5; stroke-linecap: round; }
@keyframes bl-tail { to { transform: translateY(60px) rotate(25deg); opacity: 0; } }
.bl-star {
  position: absolute;
  left: -10px;
  top: -10px;
  width: 20px;
  height: 20px;
  background: #ffd84d;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  animation: bl-star .95s ease-out forwards;
}
.bl-star:nth-child(2n) { width: 14px; height: 14px; background: #fff; }
@keyframes bl-star {
  0% { transform: translate(0, 0) scale(.2) rotate(0); opacity: 1; }
  45% { transform: translate(calc(var(--dx) * .6), calc(var(--dy) * .6)) scale(1.3) rotate(90deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.3) rotate(180deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .bl-balloon svg, .bl-string, .bl-glow, .bl-shine, .bl-hint .bl-body { animation: none; }
  .bl-gs { transition: none; }
}
/* ---------- Race (fun.games.race): a side-view track; he runs left, the world slides right ---------- */
/* js/fun.js sets --p, --ph, --pf (the periods of the track marks, hills and far hills, in px) on
   .rc-world and moves every layer with a transform; nothing here animates anything but transform
   and opacity. */
.rc-world { position: absolute; inset: 0; overflow: hidden; animation: rc-fade .5s ease-out; }
@keyframes rc-fade { from { opacity: 0; } }

/* Zakzak on the near lane, centre-right, facing the way he runs (left) */
.fun--race .fun-zak { left: 56%; bottom: 7%; width: 40vmin; }
.fun--race .fun-zak.rc-hop { animation: rc-hop .25s ease-out; }
.fun--race .fun-zak.rc-jump { animation: rc-jump .52s ease-out; }
@keyframes rc-hop {
  0%, 100% { transform: translate(-50%, 0); }
  45%      { transform: translate(-50%, -16%); }
}
@keyframes rc-jump {
  0%, 100% { transform: translate(-50%, 0) rotate(0); }
  40%      { transform: translate(-50%, -50%) rotate(-9deg); }
  70%      { transform: translate(-50%, -30%) rotate(-4deg); }
}
/* His legs kick with each hop (the two rects in .zk-body) */
.fun--race .fun-zak .zk-leg { transform-box: fill-box; transform-origin: 50% 0; }
.fun--race .fun-zak.rc-hop .zk-leg:first-of-type, .fun--race .fun-zak.rc-jump .zk-leg:first-of-type { animation: rc-leg-a .25s ease-in-out; }
.fun--race .fun-zak.rc-hop .zk-leg:nth-of-type(2), .fun--race .fun-zak.rc-jump .zk-leg:nth-of-type(2) { animation: rc-leg-b .25s ease-in-out; }
@keyframes rc-leg-a { 50% { transform: rotate(28deg); } }
@keyframes rc-leg-b { 50% { transform: rotate(-28deg); } }

/* ---------- Sky: three clouds that drift, and slide a little with the track ---------- */
.rc-cloud {
  position: absolute;
  left: 0;
  width: 24vmin;
  height: 9vmin;
  border-radius: 9vmin;
  background: #fff;
  opacity: .92;
  will-change: transform;
}
.rc-cloud::before, .rc-cloud::after {
  content: "";
  position: absolute;
  bottom: 30%;
  border-radius: 50%;
  background: #fff;
}
.rc-cloud::before { left: 18%; width: 40%; height: 125%; }
.rc-cloud::after { left: 50%; width: 34%; height: 95%; }
.rc-cloud--0 { top: 8%; }
.rc-cloud--1 { top: 21%; width: 18vmin; height: 7vmin; opacity: .8; }
.rc-cloud--2 { top: 13%; width: 30vmin; height: 10vmin; }

/* ---------- Hills: repeating gradient bumps, wider than the screen by one period each side so a
   slide of up to one period never shows an edge (the js wraps the slide at the period) ---------- */
.rc-hills { position: absolute; left: 0; background-repeat: repeat-x; will-change: transform; }
.rc-hills--far {
  bottom: 36%;
  height: 22%;
  width: calc(100% + 2 * var(--pf, 400px));
  margin-left: calc(-1 * var(--pf, 400px));
  background-image: radial-gradient(ellipse 50% 100% at 50% 100%, #c4e8b3, #c4e8b3 99%, rgba(196, 232, 179, 0) 100%);
  background-size: var(--pf, 400px) 100%;
}
.rc-hills--near {
  bottom: 34%;
  height: 24%;
  width: calc(100% + 2 * var(--ph, 260px));
  margin-left: calc(-1 * var(--ph, 260px));
  background-image:
    radial-gradient(ellipse 40% 72% at 0% 100%, #7cc466, #7cc466 99%, rgba(124, 196, 102, 0) 100%),
    radial-gradient(ellipse 40% 72% at 100% 100%, #7cc466, #7cc466 99%, rgba(124, 196, 102, 0) 100%),
    radial-gradient(ellipse 56% 100% at 50% 100%, #9ad783, #9ad783 99%, rgba(154, 215, 131, 0) 100%);
  background-size: var(--ph, 260px) 100%;
}

/* ---------- Ground: grass, a two-lane track (far lane above, near lane below), grass ---------- */
.rc-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  background: linear-gradient(#8fd37a, #8fd37a 11%, #fff 11%, #fff 13%, #e2875f 13%, #e2875f 50%, #d9774f 50%, #d9774f 87%, #fff 87%, #fff 89%, #7fc26a 89%, #6fb45c);
}
/* The marks that slide: the lane divider's dashes, grass tufts above, pebbles below */
.rc-marks {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 34%;
  width: calc(100% + 2 * var(--p, 90px));
  margin-left: calc(-1 * var(--p, 90px));
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .9) 50%, rgba(255, 255, 255, 0) 50%),
    radial-gradient(circle, #62ad4c, #62ad4c 35%, rgba(98, 173, 76, 0) 38%),
    radial-gradient(circle, #a9dd96, #a9dd96 35%, rgba(169, 221, 150, 0) 38%);
  background-size: var(--p, 90px) 1.3vmin, calc(var(--p, 90px) / 2) 1.8vmin, calc(var(--p, 90px) / 3) 1.4vmin;
  background-position: 0 50%, 0 5%, 0 95%;
  background-repeat: repeat-x;
  will-change: transform;
}

/* ---------- The owl on the far lane: flaps along, trips, dashes, hiccups, waits, claps ---------- */
.rc-owl {
  top: auto;
  left: 0;
  bottom: 21%;
  width: 26vmin;
  margin-left: -13vmin;
  z-index: auto;
  transition: none;
  will-change: transform;
}
.rc-owl svg { transform-origin: 50% 100%; }
.rc-owl .fr-pupil, .rc-owl .fr-shine { transition: transform .3s; }
.rc-owl.is-stumble svg { animation: rc-stumble 1s ease-in-out; }
@keyframes rc-stumble {
  0%   { transform: rotate(0); }
  20%  { transform: rotate(-30deg) translateY(10%); }
  50%  { transform: rotate(-22deg) translateY(12%); }
  75%  { transform: rotate(8deg); }
  100% { transform: rotate(0); }
}
.rc-owl.is-dash svg { animation: rc-dash .3s ease-in-out infinite alternate; }
@keyframes rc-dash {
  from { transform: rotate(-14deg) translateY(0); }
  to   { transform: rotate(-12deg) translateY(-6%); }
}
.rc-owl.is-hiccup svg { animation: rc-hiccup .43s ease-out 3; }
@keyframes rc-hiccup {
  30%  { transform: translateY(-18%) scale(1.08, .92); }
  100% { transform: translateY(0) scale(1, 1); }
}
/* Waiting at the finish: it tilts and looks back toward Zakzak (to the right) */
.rc-owl.is-waiting svg { animation: rc-wait 1.3s ease-in-out infinite; }
.rc-owl.is-waiting .fr-pupil, .rc-owl.is-waiting .fr-shine { transform: translate(4px, 0); }
@keyframes rc-wait { 50% { transform: rotate(14deg) translateX(5%); } }
.rc-owl.is-clap svg { animation: rc-clap .45s ease-in-out infinite alternate; }
.rc-owl.is-clap .fr-wing--l { animation: rc-clap-l .17s ease-in-out infinite alternate; }
.rc-owl.is-clap .fr-wing--r { animation: rc-clap-r .17s ease-in-out infinite alternate; }
@keyframes rc-clap { to { transform: translateY(-14%) scale(1.04, .96); } }
@keyframes rc-clap-l { to { transform: rotate(48deg); } }
@keyframes rc-clap-r { to { transform: rotate(-48deg); } }

/* ---------- The log (level 2+) on the near lane: a cylinder seen from the side ---------- */
.rc-log {
  position: absolute;
  left: 0;
  bottom: 5.5%;
  width: 17vmin;
  height: 7vmin;
  margin-left: -8.5vmin;
  border-radius: 3.5vmin;
  background: linear-gradient(#b07a46, #7a4a22);
  box-shadow: inset 0 -1vmin rgba(0, 0, 0, .18), 0 .6vmin 0 rgba(74, 63, 122, .15);
  will-change: transform;
}
.rc-log::before {   /* the cut end: rings */
  content: "";
  position: absolute;
  left: -1vmin;
  top: 0;
  width: 7vmin;
  height: 7vmin;
  border-radius: 50%;
  background: radial-gradient(circle, #efcfa6, #efcfa6 18%, #c8905c 22%, #c8905c 42%, #efcfa6 46%, #efcfa6 56%, #b07a46 60%);
  box-shadow: inset 0 0 0 .4vmin #7a4a22;
}
.rc-log::after {   /* bark lines */
  content: "";
  position: absolute;
  left: 40%;
  right: 10%;
  top: 30%;
  height: .5vmin;
  border-radius: .5vmin;
  background: #5e3816;
  box-shadow: 0 2vmin 0 #5e3816;
  opacity: .55;
}

/* ---------- The finish: two posts, a ribbon that breaks, a chequered flag that waves ---------- */
.rc-gate {
  position: absolute;
  left: 0;
  bottom: 5%;
  width: 26vmin;
  height: 44vmin;
  margin-left: -13vmin;
  will-change: transform;
}
.rc-post {
  position: absolute;
  bottom: 0;
  width: 2.8vmin;
  height: 100%;
  border-radius: 1.4vmin;
  background: repeating-linear-gradient(-45deg, #ff6b6b, #ff6b6b 2vmin, #fff 2vmin, #fff 4vmin);
  box-shadow: 0 .5vmin 0 rgba(74, 63, 122, .2);
}
.rc-post--l { left: 0; }
.rc-post--r { right: 0; }
.rc-ribbon {
  position: absolute;
  top: 46%;
  width: 50%;
  height: 4.2vmin;
  background: linear-gradient(#ff8fb6, #ff4f8b 55%, #e5347a);
  box-shadow: 0 .4vmin 0 rgba(74, 63, 122, .15);
}
.rc-ribbon--l { left: 1.4vmin; border-radius: .6vmin 0 0 .6vmin; transform-origin: 0 50%; }
.rc-ribbon--r { right: 1.4vmin; border-radius: 0 .6vmin .6vmin 0; transform-origin: 100% 50%; }
.rc-gate.is-broken .rc-ribbon--l { animation: rc-fly-l .9s ease-out forwards; }
.rc-gate.is-broken .rc-ribbon--r { animation: rc-fly-r .9s ease-out forwards; }
@keyframes rc-fly-l { to { transform: translate(-40%, -90%) rotate(-55deg); opacity: 0; } }
@keyframes rc-fly-r { to { transform: translate(40%, -90%) rotate(55deg); opacity: 0; } }
.rc-flag {
  position: absolute;
  left: 2.8vmin;
  top: 0;
  width: 11vmin;
  height: 7.5vmin;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #2b2b2b 25%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 75%, #2b2b2b 75%),
    linear-gradient(45deg, #2b2b2b 25%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 75%, #2b2b2b 75%);
  background-size: 3.6vmin 3.6vmin;
  background-position: 0 0, 1.8vmin 1.8vmin;
  border-radius: 0 .6vmin .6vmin 0;
  transform-origin: 0 50%;
  animation: rc-flag 1.8s ease-in-out infinite;
}
.rc-gate.is-broken .rc-flag { animation: rc-flag .35s ease-in-out infinite; }
@keyframes rc-flag {
  0%, 100% { transform: skewY(-5deg) scaleX(1); }
  50%      { transform: skewY(5deg) scaleX(.94); }
}

/* ---------- The crowd (level 3+): animals on the far grass, bouncing when he crosses ---------- */
.rc-crowd {
  position: absolute;
  left: 0;
  bottom: 31%;
  width: 58vmin;
  margin-left: -29vmin;
  display: flex;
  justify-content: center;
  gap: .6vmin;
  will-change: transform;
}
.rc-crowd img { display: block; width: 11vmin; height: 11vmin; }
.rc-crowd.is-cheer img { animation: rc-cheer .42s ease-in-out infinite alternate; }
.rc-crowd.is-cheer img:nth-child(2n) { animation-delay: .21s; }
@keyframes rc-cheer { to { transform: translateY(-40%) rotate(6deg); } }

/* ---------- Dust behind his feet (sandy) or sparks under a finger (yellow): reused in turn ---------- */
.rc-dust {
  position: absolute;
  left: 0;
  top: 0;
  width: 6vmin;
  height: 6vmin;
  margin: -3vmin 0 0 -3vmin;
  border-radius: 50%;
  background: rgba(222, 196, 150, .8);
  opacity: 0;
  pointer-events: none;
}
.rc-dust i {
  position: absolute;
  left: 40%;
  top: 40%;
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background: #ecd7ad;
  opacity: 0;
}
.rc-dust.is-spark { background: rgba(255, 216, 77, .75); }
.rc-dust.is-spark i { background: #ffd84d; }
.rc-dust.is-go { animation: rc-dust .5s ease-out; }
.rc-dust.is-go i { animation: rc-dot .55s ease-out; }
@keyframes rc-dust {
  0%   { transform: scale(.3); opacity: .95; }
  100% { transform: scale(1.7) translateX(30%); opacity: 0; }
}
@keyframes rc-dot {
  0%   { transform: none; opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)); opacity: 0; }
}

/* ---------- The start light: three red lamps light with the beeps, the green with the ding ---------- */
.rc-light {
  position: absolute;
  left: 5%;
  top: 15%;
  display: flex;
  gap: 1.3vmin;
  padding: 1.3vmin;
  border-radius: 4.5vmin;
  background: #3b3552;
  box-shadow: 0 .7vmin 0 #2a2540;
  z-index: 2;
  animation: rc-pop .5s cubic-bezier(.3, 1.4, .5, 1);
  transition: opacity .6s, transform .6s ease-in;
}
.rc-light::before {   /* the pole it hangs from */
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 1.4vmin;
  height: 16vh;
  margin-left: -.7vmin;
  background: #3b3552;
}
.rc-light i {
  display: block;
  width: 6.5vmin;
  height: 6.5vmin;
  border-radius: 50%;
  background: #5c5678;
}
.rc-light i.is-on { background: #ff5a5a; box-shadow: 0 0 2vmin #ff5a5a; }
.rc-light.is-green i { background: #5c5678; box-shadow: none; }
.rc-light.is-green i:last-child { background: #7fd36b; box-shadow: 0 0 2.5vmin #7fd36b; }
.rc-light.is-gone { opacity: 0; transform: translateY(-140%); }
@keyframes rc-pop { from { transform: scale(.4); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .rc-cloud, .rc-flag, .rc-owl.is-waiting svg, .rc-owl.is-dash svg { animation: none; }
  .fun--race .fun-zak.rc-hop, .fun--race .fun-zak.rc-jump { animation-duration: .01s; }
}

/* ---------- Drums (fun.games.drums): a kitchen, pots to bang, Zakzak drumming behind them ---------- */
/* js/fun.js sets --pw/--ph (a pot's width and height in px) and --tw (a noisemaker's) on the stage, moves
   every pot with a transform on .dr-pot (and a noisemaker with left/height on .dr-hang); the keyframes here
   live on the inner .dr-body / .dr-lid / .dr-thing, so a move and a squash never fight over one transform.
   Nothing animates anything but transform and opacity (and a door's 3d turn). */

/* The room: the layer's sky becomes a cream wall over a wooden floor (44% tall upright, 45% sideways: js FLOOR) */
.fun--drums .fun-sky { background: linear-gradient(#fff8e6, #ffeccb 55.9%, #d9a06a 56%, #b97a48); }
.fun--drums .fun-sky::after {   /* the boards */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 44%;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0) 12vmin, rgba(255, 255, 255, .16) 12vmin, rgba(255, 255, 255, .16) 12.6vmin),
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 7vmin, rgba(0, 0, 0, .08) 7vmin, rgba(0, 0, 0, .08) 7.6vmin);
}
@media (orientation: landscape) {
  .fun--drums .fun-sky { background: linear-gradient(#fff8e6, #ffeccb 54.9%, #d9a06a 55%, #b97a48); }
  .fun--drums .fun-sky::after { height: 45%; }
}

/* ---------- Zakzak's copy: behind the pots (under the stage), the js sets his left and bottom ---------- */
.fun--drums .fun-zak { z-index: 0; width: 36vmin; transition: none; }
@media (orientation: landscape) {
  .fun--drums .fun-zak { width: 28vmin; }
}
.fun--drums .fun-zak.dr-move { transition: left .6s cubic-bezier(.3, 1.2, .5, 1), bottom .6s cubic-bezier(.3, 1.2, .5, 1); }
/* Poses: a bob with blissful eyes on a hit, a hop on a floor thump, drumming through the roll, the lean on the tower */
.fun--drums .fun-zak.dr-bob .zk-eye, .fun--drums .fun-zak.dr-bob .zk-mouth--idle { display: none; }
.fun--drums .fun-zak.dr-bob .zk-happy-eye, .fun--drums .fun-zak.dr-bob .zk-mouth--right { display: inline; }
.fun--drums .fun-zak.dr-bob .zk-body { animation: dr-bob .22s ease-out; }
.fun--drums .fun-zak.dr-hop .zk-body { animation: dr-hop .3s ease-out; }
.fun--drums .fun-zak.dr-drum .zk-body { animation: dr-bob .16s ease-in-out infinite alternate; }
.fun--drums .fun-zak.dr-wobble svg { animation: dr-lean .4s ease-in-out infinite alternate; }
@keyframes dr-bob { 40% { transform: translateY(5%) scale(1.06, .92); } }
@keyframes dr-hop { 45% { transform: translateY(-12%) scale(.96, 1.05); } }
@keyframes dr-lean {
  from { transform: translateX(-5%) rotate(-5deg); }
  to   { transform: translateX(5%) rotate(5deg); }
}

/* His two wooden spoons, one in each hand (the arm tips are at 12% / 88% across, 67% down his box) */
.dr-spoon {
  position: absolute;
  top: 33%;
  width: 7%;
  height: 34%;
  border-radius: 1vmin;
  background: linear-gradient(90deg, #a86a38, #d9a066 50%, #a86a38);
  transform-origin: 50% 100%;
}
.dr-spoon::before {   /* the bowl */
  content: "";
  position: absolute;
  left: -75%;
  top: -8%;
  width: 250%;
  height: 24%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #f0c48c, #c98a4a 70%);
}
.dr-spoon--l { left: 8.5%; transform: rotate(-40deg); }
.dr-spoon--r { right: 8.5%; transform: rotate(40deg); }
.fun--drums .fun-zak.dr-bob .dr-spoon--l { animation: dr-swing-l .22s ease-out; }
.fun--drums .fun-zak.dr-bob .dr-spoon--r, .fun--drums .fun-zak.dr-echo .dr-spoon--r { animation: dr-swing-r .22s ease-out; }
.fun--drums .fun-zak.dr-drum .dr-spoon--l { animation: dr-swing-l .16s ease-in-out infinite alternate; }
.fun--drums .fun-zak.dr-drum .dr-spoon--r { animation: dr-swing-r .16s ease-in-out .08s infinite alternate; }
@keyframes dr-swing-l { 50% { transform: rotate(-88deg); } }
@keyframes dr-swing-r { 50% { transform: rotate(88deg); } }

/* His hat: a lid (level 2+, from 15 s) or a pot (the finale), dropped onto his head */
.dr-hat { position: absolute; left: 20%; width: 60%; z-index: 2; animation: dr-hat-in .4s cubic-bezier(.3, 1.4, .5, 1); }
.dr-hat--lid {
  top: 13%;
  height: 10%;
  border-radius: 50%;
  background: linear-gradient(#fdfdff, #c9cad8);
  box-shadow: 0 .5vmin 0 rgba(74, 63, 122, .2);
}
.dr-hat--lid::before { content: ""; position: absolute; left: 42%; top: -45%; width: 16%; height: 80%; border-radius: 50%; background: #7f7f98; }
.dr-hat--pot {
  top: -4%;
  height: 24%;
  border-radius: 40% 40% 6% 6% / 50% 50% 8% 8%;
  background: linear-gradient(90deg, rgba(0, 0, 0, .22), rgba(0, 0, 0, 0) 30%, rgba(255, 255, 255, .35) 48%, rgba(255, 255, 255, 0) 60%, rgba(0, 0, 0, .22)), #ff9f43;
  box-shadow: inset 0 -1vmin rgba(0, 0, 0, .15);
}
.dr-hat--pot::after { content: ""; position: absolute; left: -4%; right: -4%; bottom: -8%; height: 24%; border-radius: 50%; background: linear-gradient(#f6f6fa, #b4b4c6); }
@keyframes dr-hat-in { from { transform: translateY(-180%); opacity: 0; } }

/* ---------- The pots: enamel bodies, a steel rim and lid, two handles (a long one on the pan) ---------- */
.dr-row { position: absolute; inset: 0; z-index: 2; }
.dr-pot { position: absolute; left: 0; top: 0; width: var(--pw); height: var(--ph); will-change: transform; }
.dr-pot--own { width: calc(var(--pw) * 14 / 22); height: calc(var(--ph) * 14 / 22); }
.dr-pot.is-new, .dr-hang.is-new { opacity: 0; }
.dr-row.is-slide .dr-pot { transition: transform .45s cubic-bezier(.3, 1.2, .5, 1); }   /* into the tower */
.dr-row.is-fly .dr-pot { transition: transform .85s cubic-bezier(.25, .6, .5, 1); }     /* over the floor */
.dr-body { position: absolute; inset: 0; transform-origin: 50% 100%; will-change: transform; }
.dr-can {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 12%;
  bottom: 0;
  border-radius: 10% 10% 34% 34% / 10% 10% 30% 30%;
  background: linear-gradient(90deg, rgba(0, 0, 0, .22), rgba(0, 0, 0, 0) 30%, rgba(255, 255, 255, .35) 48%, rgba(255, 255, 255, 0) 60%, rgba(0, 0, 0, .22)), var(--c, #ff6b6b);
  box-shadow: inset 0 -1.2vmin rgba(0, 0, 0, .16), 0 .8vmin 0 rgba(74, 63, 122, .16);
}
.dr-can::before {   /* the rim */
  content: "";
  position: absolute;
  left: -5%;
  right: -5%;
  top: -8%;
  height: 18%;
  border-radius: 50%;
  background: linear-gradient(#f6f6fa, #b4b4c6);
  box-shadow: 0 .3vmin 0 rgba(0, 0, 0, .15);
}
.dr-can::after {   /* the handles: a ring behind the body, only its two ends show */
  content: "";
  position: absolute;
  left: -14%;
  right: -14%;
  top: 22%;
  height: 30%;
  box-sizing: border-box;
  border: 1vmin solid #6f6f84;
  border-radius: 50%;
  z-index: -1;
}
.dr-pot--pan .dr-can { top: 30%; border-radius: 8% 8% 30% 30% / 14% 14% 40% 40%; }
.dr-pot--pan .dr-can::after {   /* a long handle to the side instead */
  left: 92%;
  right: auto;
  width: 60%;
  top: 8%;
  height: 16%;
  border: 0;
  border-radius: 1vmin;
  background: linear-gradient(#4b4b60, #26263a);
  transform: rotate(-12deg);
  transform-origin: 0 50%;
}
.dr-lid {
  position: absolute;
  left: 12%;
  right: 12%;
  top: -6%;
  height: 22%;
  border-radius: 50%;
  background: linear-gradient(#fdfdff, #c9cad8);
  box-shadow: 0 .4vmin 0 rgba(0, 0, 0, .14);
  transform-origin: 50% 50%;
}
.dr-pot--pan .dr-lid { top: 12%; height: 20%; }
.dr-lid::before { content: ""; position: absolute; left: 42%; top: -40%; width: 16%; height: 75%; border-radius: 50%; background: #7f7f98; }
.dr-lid.is-gone { visibility: hidden; }
.dr-lid.is-fly { animation: dr-lid-fly .9s linear; }
@keyframes dr-lid-fly {
  0%   { transform: translateY(0) rotate(0); animation-timing-function: ease-out; }
  45%  { transform: translateY(-30vh) rotate(360deg); animation-timing-function: ease-in; }
  100% { transform: translateY(0) rotate(720deg); }
}

/* What a pot does: slides in, squashes on a hit, wobbles as a hint, shakes through the drumroll, jumps,
   leans with the tower, tumbles over the floor (the later rules win while the row's classes are on) */
.dr-body.is-in { animation: dr-in .5s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes dr-in { from { transform: translateY(60%) scale(.6); opacity: 0; } }
.dr-body.is-hit, .dr-thing.is-hit { animation: dr-hit .18s ease-out; }
@keyframes dr-hit { 40% { transform: scale(1.08, .8); } }
.dr-body.is-hint { animation: dr-hint 1s ease-in-out; }
@keyframes dr-hint {
  20%, 60% { transform: rotate(-6deg) scale(1.06); }
  40%, 80% { transform: rotate(6deg) scale(1.06); }
}
.dr-body.is-jump { animation: dr-jump .6s ease-out; }
@keyframes dr-jump {
  15% { transform: scale(1.1, .85); }
  50% { transform: translateY(-45%) scale(.95, 1.08); }
  85% { transform: translateY(0) scale(1.06, .94); }
}
.dr-row.is-shake .dr-body { animation: dr-shake .09s linear infinite alternate; }
@keyframes dr-shake {
  from { transform: translateX(-3%) rotate(-2deg); }
  to   { transform: translateX(3%) rotate(2deg); }
}
.dr-row.is-wobble .dr-body { animation: dr-wob .4s ease-in-out infinite alternate; }   /* --i: the pot's place up the tower (js) */
@keyframes dr-wob {
  from { transform: translateX(calc(var(--i, 1) * -3%)) rotate(-3deg); }
  to   { transform: translateX(calc(var(--i, 1) * 3%)) rotate(3deg); }
}
.dr-body.is-tumble { animation: dr-tumble .9s ease-out; }
@keyframes dr-tumble {
  0%   { transform: translateY(-20%) rotate(0); }
  45%  { transform: translateY(-60%) rotate(190deg); }
  70%  { transform: translateY(0) rotate(300deg); }
  85%  { transform: translateY(-12%) rotate(340deg); }
  100% { transform: translateY(0) rotate(360deg); }
}

/* ---------- The noisemakers: hang on a string from the ceiling, drop in, swing when hit ---------- */
.dr-hang { position: absolute; left: 0; top: 0; width: var(--tw); transform-origin: 50% 0; will-change: transform; z-index: 2; }
.dr-hang::before {   /* the string, down to the thing's middle */
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: calc(var(--tw) / 2);
  width: .6vmin;
  margin-left: -.3vmin;
  background: #8a7a6a;
}
.dr-hang.is-drop { animation: dr-drop .8s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes dr-drop { from { transform: translateY(-110%); } }
.dr-hang.is-swing { animation: dr-swing .9s ease-in-out; }
@keyframes dr-swing {
  25% { transform: rotate(13deg); }
  55% { transform: rotate(-9deg); }
  80% { transform: rotate(4deg); }
}
.dr-thing { position: absolute; left: 0; bottom: 0; width: 100%; height: var(--tw); transform-origin: 50% 100%; will-change: transform; }
.dr-thing--rattle::before {   /* the head */
  content: "";
  position: absolute;
  left: 15%;
  top: 0;
  width: 70%;
  height: 70%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd0a8, #ff8a3d 55%, #d9533f);
  box-shadow: inset 0 -1vmin rgba(0, 0, 0, .12), 0 .6vmin 0 rgba(74, 63, 122, .15);
}
.dr-thing--rattle::after {   /* the handle */
  content: "";
  position: absolute;
  left: 42%;
  top: 62%;
  width: 16%;
  height: 38%;
  border-radius: 1vmin;
  background: linear-gradient(90deg, #a86a38, #d9a066 50%, #a86a38);
}
.dr-thing--horn::before {   /* the cone */
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 10%;
  bottom: 0;
  clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%);
  background: linear-gradient(90deg, #c99a1f, #ffe066 45%, #fff3b0 55%, #e0b000);
}
.dr-thing--horn::after {   /* the mouthpiece */
  content: "";
  position: absolute;
  left: 36%;
  top: 0;
  width: 28%;
  height: 14%;
  border-radius: 40%;
  background: #d94e4e;
}
.dr-thing--bell::before {   /* the dome */
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 4%;
  height: 76%;
  border-radius: 50% 50% 14% 14% / 60% 60% 12% 12%;
  background: linear-gradient(90deg, #c99a1f, #ffe066 40%, #fff3b0 50%, #ffd84d 60%, #c99a1f);
  box-shadow: inset 0 -1.2vmin rgba(0, 0, 0, .15), 0 .6vmin 0 rgba(74, 63, 122, .15);
}
.dr-thing--bell::after {   /* the clapper */
  content: "";
  position: absolute;
  left: 40%;
  top: 70%;
  width: 20%;
  height: 24%;
  border-radius: 50%;
  background: #6f6f84;
}

/* ---------- The cupboards (level 3+): a door swings open and a utensil (an icon) tumbles out ---------- */
.dr-cupboard {
  position: absolute;
  width: 16vmin;
  height: 20vmin;
  border-radius: 1.4vmin;
  background: #8a5a36;
  box-shadow: inset 0 0 0 .8vmin #6e4426;
  perspective: 40vmin;
  z-index: 1;
}
.dr-door {
  position: absolute;
  inset: 6% 8%;
  border-radius: 1vmin;
  background: linear-gradient(90deg, #d9a066, #f0c48c 50%, #d9a066);
  box-shadow: inset 0 0 0 .5vmin #b97a48;
  transform-origin: 0 50%;
  transition: transform .25s ease-out;
}
.dr-door::after {   /* the knob */
  content: "";
  position: absolute;
  right: 12%;
  top: 46%;
  width: 12%;
  height: 10%;
  border-radius: 50%;
  background: #4b4b60;
}
.dr-door.is-open { transform: rotateY(-80deg); }
.dr-cupboard--1 .dr-door { transform-origin: 100% 50%; }
.dr-cupboard--1 .dr-door::after { right: auto; left: 12%; }
.dr-cupboard--1 .dr-door.is-open { transform: rotateY(80deg); }
.dr-item { position: absolute; width: 12vmin; height: 12vmin; z-index: 1; animation: dr-fall 1s forwards; transition: opacity .4s; }
.dr-item.is-gone { opacity: 0; }
@keyframes dr-fall {   /* --dx, --fy (px, js): where it lands on the floor; one bounce on the way */
  0%   { transform: translate(0, 0) rotate(0); animation-timing-function: ease-in; }
  55%  { transform: translate(calc(var(--dx) * .6), var(--fy)) rotate(180deg); animation-timing-function: ease-out; }
  72%  { transform: translate(calc(var(--dx) * .8), calc(var(--fy) - 8vmin)) rotate(260deg); animation-timing-function: ease-in; }
  100% { transform: translate(var(--dx), var(--fy)) rotate(360deg); }
}

/* ---------- The owl by the ceiling, dancing on every 2nd hit (level 2+) and at the end ---------- */
.dr-owl { top: 2%; left: auto; right: 4%; width: clamp(72px, 20vmin, 140px); z-index: 2; }
.dr-owl.is-dance .fr-body { animation: dr-owl-dance .5s ease-in-out; }
@keyframes dr-owl-dance {
  30% { transform: translateY(-18%) rotate(-8deg) scale(1.05, .95); }
  70% { transform: translateY(-10%) rotate(8deg); }
}

/* ---------- What answers a finger: a ring from the pot, a pulse of light, dust on the floor ---------- */
.dr-fx { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.dr-ring {
  position: absolute;
  border-radius: 50%;
  border: 1vmin solid #fff;
  box-shadow: 0 0 0 .6vmin rgba(255, 216, 77, .6);
  opacity: 0;
  animation: dr-ring .5s ease-out;
}
@keyframes dr-ring {
  from { transform: translate(-50%, -50%) scale(.6); opacity: .7; }
  to   { transform: translate(-50%, -50%) scale(2.6); opacity: 0; }
}
.dr-dust { position: absolute; width: 0; height: 0; }
.dr-dust i {
  position: absolute;
  left: -1vmin;
  top: -1vmin;
  width: 2vmin;
  height: 2vmin;
  border-radius: 50%;
  background: #c9b8a0;
  animation: dr-dot .6s ease-out forwards;
}
.dr-dust i:nth-child(2n) { width: 1.5vmin; height: 1.5vmin; background: #e6d8c3; }
@keyframes dr-dot { to { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; } }
.dr-light { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 4; }
.dr-light.is-on { animation: dr-flash .16s ease-out; }
.dr-light.is-glow { opacity: .1; transition: opacity .3s; }
@keyframes dr-flash { from { opacity: .18; } to { opacity: 0; } }

/* The suspense beat (level 3+): everything holds still for a moment */
.fun--drums.dr-still .dr-body, .fun--drums.dr-still .dr-thing, .fun--drums.dr-still .dr-hang, .fun--drums.dr-still .dr-lid,
.fun--drums.dr-still .fr-body, .fun--drums.dr-still .fr-wing, .fun--drums.dr-still .zk-body, .fun--drums.dr-still .dr-spoon { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  .dr-lid.is-fly, .dr-row.is-shake .dr-body, .dr-row.is-wobble .dr-body,
  .fun--drums .fun-zak.dr-wobble svg, .fun--drums .fun-zak.dr-drum .zk-body, .fun--drums .fun-zak.dr-drum .dr-spoon { animation: none; }
  .dr-body.is-tumble, .dr-item { animation-duration: .3s; }
  .dr-light.is-on { animation: none; opacity: .08; }
  .dr-row.is-slide .dr-pot, .dr-row.is-fly .dr-pot, .fun--drums .fun-zak.dr-move { transition-duration: .01s; }
}

/* ---------- Fireworks (fun.games.fireworks): night over a hill, rockets from his sparkler, sparks in the sky ---------- */
/* js/fun.js moves rockets, bursts, the sparkler and the rain with transforms; the sparks, the rings, the
   flashes and the drops fly by keyframes (transform and opacity only). The night is one overlay in the
   stage: his copy and the owl sit above it, so the dark never feels empty. */

/* ---------- The night: a dark sky that fades in over the day one, stars, a moon ---------- */
.fw-night {
  position: absolute;
  inset: 0;
  background: linear-gradient(#070627, #171352 55%, #2a2466);
  opacity: 0;
  transition: opacity 1.5s;
}
.fw-night.is-on { opacity: .94; }
.fw-star {
  position: absolute;
  width: 1.1vmin;
  height: 1.1vmin;
  margin: -.55vmin 0 0 -.55vmin;
  border-radius: 50%;
  background: #fff;
  animation: fw-twinkle 2.6s ease-in-out infinite alternate;
}
.fw-star:nth-child(3n) { width: .7vmin; height: .7vmin; }
@keyframes fw-twinkle {
  from { opacity: .25; transform: scale(.7); }
  to   { opacity: 1; transform: scale(1.2); }
}
.fw-moon {
  position: absolute;
  right: 10%;
  top: 7%;
  width: 12vmin;
  height: 12vmin;
  border-radius: 50%;
  background: #fff4b8;
  box-shadow: 0 0 4vmin rgba(255, 244, 184, .45);
}
.fw-moon::after {   /* a second circle of night bites the crescent out of it */
  content: "";
  position: absolute;
  left: -20%;
  top: -14%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #15124a;
}

/* ---------- The hills: a dark green one in front (it lights up at every burst), a darker one behind ---------- */
.fw-hill {
  position: absolute;
  left: -12%;
  right: -12%;
  bottom: -10%;
  height: 30%;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  background: linear-gradient(#2a6b3e, #1c4a2b);
}
.fw-hill--far {
  left: 30%;
  right: -30%;
  bottom: 6%;
  height: 22%;
  background: linear-gradient(#1b3f28, #15321f);
}
.fw-hill::after {   /* the light of a burst on the grass */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #5cc37a;
  opacity: 0;
  transition: opacity .25s;
}
.fw-hill.is-lit::after { opacity: .45; }

/* ---------- Zakzak on the near hill, left of the middle, looking up; the owl perched on the far hill behind,
   to the right and higher up, clear of the home button (bottom right upright, bottom left sideways) ---------- */
.fun--fireworks .zakzak { left: 40%; bottom: 10%; width: min(38vw, 30vh); }
.fun--fireworks .zakzak .zk-pupil, .fun--fireworks .zakzak .zk-shine { animation: none; translate: 0 -5px; }
@media (orientation: landscape) {
  .fun--fireworks .zakzak { width: min(26vw, 42vh); bottom: 8%; }
}
.fw-owl {
  top: auto;
  left: 68%;
  bottom: 25%;
  width: clamp(56px, 16vmin, 110px);
  z-index: auto;
  transition: none;
}
.fw-owl svg { transform-origin: 50% 100%; }

/* A burst: his mouth goes "o" and his eyes go to its side (--lx from js) */
.fun--fireworks .zakzak.fw-wow .zk-mouth--idle { display: none; }
.fun--fireworks .zakzak.fw-wow .zk-mouth--wrong { display: inline; }
.fun--fireworks .zakzak.fw-wow.is-talking .zk-mouth--wrong { display: none; }
.fun--fireworks .zakzak.fw-wow .zk-pupil, .fun--fireworks .zakzak.fw-wow .zk-shine { transform: translate(var(--lx, 0px), -4px); }

/* The giant charging (level 3+): hands over his ears, eyes squeezed */
.fun--fireworks .zakzak.fw-ears .zk-arm { animation: none; transform: translate(var(--tx), -24px) rotate(calc(var(--up) * .82)); transition: transform .25s; }
.fun--fireworks .zakzak.fw-ears .zk-eye { animation: none; transform: scaleY(.45); transition: transform .25s; }

/* The finale: flat on his back, legs kicking, laughing; the owl beside him the same way */
.fun--fireworks .zakzak.fw-flop svg { animation: fw-zak-flop 1.1s cubic-bezier(.3, 1.3, .5, 1) forwards; }
@keyframes fw-zak-flop { to { transform: rotate(-65deg) translate(0, 3%); } }
.fun--fireworks .zakzak.fw-flop .zk-eye, .fun--fireworks .zakzak.fw-flop .zk-mouth--idle { display: none; }
.fun--fireworks .zakzak.fw-flop .zk-happy-eye, .fun--fireworks .zakzak.fw-flop .zk-mouth--right { display: inline; }
.fun--fireworks .zakzak.fw-flop.is-talking:not(.is-right) .zk-mouth--right { display: none; }
.fun--fireworks .zakzak.fw-flop .zk-body { animation: fw-giggle .32s ease-in-out infinite alternate; }
.fun--fireworks .zakzak.fw-flop .zk-leg { transform-box: fill-box; transform-origin: 50% 0; animation: fw-kick .28s ease-in-out infinite alternate; }
.fun--fireworks .zakzak.fw-flop .zk-leg:first-of-type { animation-delay: .14s; }
@keyframes fw-giggle { from { transform: scale(1, 1); } to { transform: scale(1.04, .96); } }
@keyframes fw-kick { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }

/* The owl: a loop over the sky to the left and back (level 2+), knocked over by the giant (and up again),
   down for good at the end */
.fw-owl.fw-fly { animation: fw-fly 5s ease-in-out; }
@keyframes fw-fly {
  0%   { transform: translate(0, 0) rotate(0); }
  25%  { transform: translate(-18vw, -35vh) rotate(-8deg); }
  50%  { transform: translate(-52vw, -22vh) rotate(-4deg); }
  75%  { transform: translate(-38vw, -48vh) rotate(6deg); }
  100% { transform: translate(0, 0) rotate(0); }
}
.fw-owl.fw-topple svg { animation: fw-topple 1.7s ease-out; }
@keyframes fw-topple {
  0%       { transform: rotate(0); }
  25%, 60% { transform: rotate(70deg) translateX(10%); }
  100%     { transform: rotate(0); }
}
.fw-owl.fw-flop svg { animation: fw-owl-flop 1s cubic-bezier(.3, 1.3, .5, 1) forwards; }
@keyframes fw-owl-flop { to { transform: rotate(75deg) translateX(10%); } }
.fw-owl.fw-flop .fr-body { animation: fw-giggle .3s ease-in-out infinite alternate; }

/* ---------- His sparkler: a stick from his right hand, leaning right, sputtering at the tip ---------- */
.fw-sparkler { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 2; pointer-events: none; }
.fw-stick {
  position: absolute;
  left: -.6vmin;
  bottom: 0;
  width: 1.2vmin;
  height: var(--len, 8vmin);
  border-radius: .6vmin;
  background: linear-gradient(90deg, #d6d6e8, #8f8fa8);
  transform-origin: 50% 100%;
  transform: rotate(35deg);   /* js STICK_DEG agrees: rockets start at the tip */
}
.fw-tip { position: absolute; left: 50%; top: 0; width: 0; height: 0; }
.fw-tip b {
  position: absolute;
  left: -.7vmin;
  top: -.7vmin;
  width: 1.4vmin;
  height: 1.4vmin;
  border-radius: 50%;
  background: #fff3b0;
  box-shadow: 0 0 1.2vmin #ffd84d;
  animation: fw-tip .55s ease-out infinite;
}
.fw-tip b:nth-child(1) { --tx: -2.6vmin; --ty: -1.4vmin; }
.fw-tip b:nth-child(2) { --tx: 2.4vmin; --ty: -2vmin; animation-delay: .14s; }
.fw-tip b:nth-child(3) { --tx: -1.2vmin; --ty: 2.4vmin; animation-delay: .28s; }
.fw-tip b:nth-child(4) { --tx: 2.8vmin; --ty: 1vmin; animation-delay: .42s; }
@keyframes fw-tip {
  from { transform: translate(0, 0) scale(1); opacity: 1; }
  to   { transform: translate(var(--tx), var(--ty)) scale(.2); opacity: 0; }
}
/* The finale: it drops out of his hand as he falls over */
.fw-sparkler.is-down .fw-stick { animation: fw-stick-drop .8s ease-in forwards; }
.fw-sparkler.is-down .fw-tip { display: none; }
@keyframes fw-stick-drop { to { transform: rotate(95deg) translate(0, 4vmin); opacity: 0; } }

/* The giant charging at the tip (level 3+): a golden ball that swells and shakes while it hums */
.fw-charge { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 2; pointer-events: none; }
.fw-charge i {
  position: absolute;
  left: -4vmin;
  top: -4vmin;
  width: 8vmin;
  height: 8vmin;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0, #ffd84d 40%, rgba(255, 216, 77, 0) 70%);
  opacity: 0;
  transform: scale(.2);
}
.fw-charge.is-on { animation: fw-shake .12s linear infinite; }
.fw-charge.is-on i { animation: fw-charge 1.8s ease-in forwards; }
@keyframes fw-charge {
  0%   { transform: scale(.3); opacity: .6; }
  12%  { opacity: 1; }
  100% { transform: scale(2.6); opacity: 1; }
}
@keyframes fw-shake {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(.8vmin, -.4vmin); }
}

/* ---------- A ring under the finger (it grows and fades), or a wobbling one where his own rocket is going ---------- */
.fw-aim {
  position: absolute;
  width: 18vmin;
  height: 18vmin;
  margin: -9vmin 0 0 -9vmin;
  border-radius: 50%;
  border: .9vmin solid rgba(255, 255, 255, .85);
  box-shadow: 0 0 2vmin rgba(255, 255, 255, .5);
  pointer-events: none;
  animation: fw-aim .9s ease-out forwards;
}
@keyframes fw-aim {
  from { transform: scale(.3); opacity: 1; }
  to   { transform: scale(1); opacity: 0; }
}
.fw-aim--hint { animation: fw-hint 1.4s ease-in-out forwards; }
@keyframes fw-hint {
  0%       { transform: scale(.6); opacity: 0; }
  20%, 70% { opacity: 1; }
  35%      { transform: scale(1.12); }
  50%      { transform: scale(.9); }
  65%      { transform: scale(1.06); }
  100%     { transform: scale(1); opacity: 0; }
}

/* ---------- The colours: --c the main, --cl its light (sparks, rockets, flashes take them from the box) ---------- */
.fw-c0 { --c: #ff5c7a; --cl: #ffb3c1; }
.fw-c1 { --c: #ff9f43; --cl: #ffd3a3; }
.fw-c2 { --c: #ffd84d; --cl: #fff3b0; }
.fw-c3 { --c: #7fd36b; --cl: #c8f0bb; }
.fw-c4 { --c: #5fb8ff; --cl: #b9e2ff; }
.fw-c5 { --c: #b98cff; --cl: #e0d3ff; }
.fw-gold { --c: #ffd84d; --cl: #fff3b0; }
.fw-purple { --c: #b98cff; --cl: #e0d3ff; }

/* ---------- A rocket: a bright head with a tail behind it (js turns it the way it flies) ---------- */
.fw-rocket {
  position: absolute;
  left: -.8vmin;
  top: 0;
  width: 1.6vmin;
  height: 8vmin;
  border-radius: .8vmin;
  background: linear-gradient(#fff, var(--c) 25%, rgba(255, 255, 255, 0));
  transform-origin: 50% 0;
  pointer-events: none;
  will-change: transform;
}
.fw-rocket::before {
  content: "";
  position: absolute;
  left: -.6vmin;
  top: -.6vmin;
  width: 2.8vmin;
  height: 2.8vmin;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 1.5vmin var(--c);
}

/* ---------- A burst: a box at the point; each spark flies to its --dx/--dy, hangs, then falls and fades ---------- */
.fw-burst { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
.fw-spark {
  position: absolute;
  left: -.9vmin;
  top: -.9vmin;
  width: 1.8vmin;
  height: 1.8vmin;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 1.2vmin var(--c);
  animation: fw-spark 1.2s forwards;
}
.fw-spark--l { background: var(--cl); box-shadow: 0 0 1.2vmin var(--cl); }
.fw-spark--w { width: 2.2vmin; height: 2.2vmin; left: -1.1vmin; top: -1.1vmin; background: #fff; box-shadow: 0 0 1.4vmin #fff; }
.fw-spark--g { background: #ffd84d; box-shadow: 0 0 1.4vmin #ffd84d; }
.fw-spark--p { background: #ff9fc0; box-shadow: 0 0 1.2vmin #ff9fc0; }
@keyframes fw-spark {
  0%   { transform: translate(var(--sx, 0px), var(--sy, 0px)) scale(.5); opacity: 1; animation-timing-function: cubic-bezier(.1, .7, .3, 1); }
  45%  { transform: translate(var(--dx), var(--dy)) scale(1.1); opacity: 1; animation-timing-function: ease-in; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 9vmin)) scale(.3); opacity: 0; }
}
/* The re-bursts (level 2+): smaller sparks, each starting where its parent spark was (--sx/--sy from js) */
.fw-burst--mini .fw-spark { width: 1.3vmin; height: 1.3vmin; left: -.65vmin; top: -.65vmin; }
/* A shape (heart, star, smiley) and his face hold their outline a while before they fall */
.fw-burst--shape .fw-spark { animation: fw-shape 1.8s forwards; }
.fw-burst--face .fw-spark { animation: fw-shape 2.3s forwards; width: 2.2vmin; height: 2.2vmin; left: -1.1vmin; top: -1.1vmin; }
@keyframes fw-shape {
  0%   { transform: translate(0, 0) scale(.5); opacity: 1; animation-timing-function: cubic-bezier(.1, .7, .3, 1); }
  30%  { transform: translate(var(--dx), var(--dy)) scale(1.1); opacity: 1; animation-timing-function: linear; }
  70%  { transform: translate(var(--dx), calc(var(--dy) + 1vmin)) scale(1); opacity: 1; animation-timing-function: ease-in; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 8vmin)) scale(.3); opacity: 0; }
}
/* The giant (level 3+): big golden sparks that rain down longer */
.fw-burst--giant .fw-spark { width: 2.6vmin; height: 2.6vmin; left: -1.3vmin; top: -1.3vmin; animation: fw-giant 2s forwards; }
@keyframes fw-giant {
  0%   { transform: translate(0, 0) scale(.5); opacity: 1; animation-timing-function: cubic-bezier(.1, .7, .3, 1); }
  40%  { transform: translate(var(--dx), var(--dy)) scale(1.2); opacity: 1; animation-timing-function: ease-in; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 18vmin)) scale(.3); opacity: 0; }
}

/* A soft glow at the burst point, and the hill lighting up (no full-screen flash) */
.fw-flash {
  position: absolute;
  width: 36vmin;
  height: 36vmin;
  margin: -18vmin 0 0 -18vmin;
  border-radius: 50%;
  background: radial-gradient(circle, var(--cl, #fff) 0, var(--c, #fff) 25%, rgba(0, 0, 0, 0) 70%);
  pointer-events: none;
  animation: fw-flash .6s ease-out forwards;
}
.fw-flash--big { width: 70vmin; height: 70vmin; margin: -35vmin 0 0 -35vmin; }
@keyframes fw-flash {
  from { transform: scale(.2); opacity: .8; }
  to   { transform: scale(1.4); opacity: 0; }
}

/* Golden rain (level 3+): drops all over the width that fall from the giant's height to the hill */
.fw-rain { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
.fw-drop {
  position: absolute;
  left: -.6vmin;
  top: -1.1vmin;
  width: 1.2vmin;
  height: 2.2vmin;
  border-radius: 50%;
  background: #ffe680;
  box-shadow: 0 0 1vmin #ffd84d;
  opacity: 0;
  animation: fw-drop 2.5s ease-in forwards;
}
@keyframes fw-drop {
  0%   { transform: translate(var(--x), 0); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translate(calc(var(--x) + var(--sx)), var(--fall)); opacity: 0; }
}

/* The suspense beat (level 3+): everything in the sky holds still for a moment */
.fw-still .fw-spark, .fw-still .fw-star, .fw-still .fw-tip b, .fw-still .fw-drop, .fw-still .fw-flash, .fw-still .fw-aim, .fw-still .fw-owl { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  .fw-star, .fw-tip b, .fw-owl.fw-fly, .fw-owl.fw-topple svg, .fw-charge.is-on, .fw-aim--hint { animation: none; }
  .fw-night { transition: none; }
  /* a burst is a ring that fades where it is: no flying sparks, no trails */
  .fw-spark, .fw-burst--shape .fw-spark, .fw-burst--face .fw-spark, .fw-burst--giant .fw-spark { transform: translate(var(--dx), var(--dy)); animation-name: fw-fade; }
  .fw-drop { animation-name: fw-fade; transform: translate(var(--x), var(--fall)); }
  .fw-aim { animation-name: fw-fade; transform: none; }
  .fun--fireworks .zakzak.fw-flop svg, .fw-owl.fw-flop svg { animation-duration: .01s; }
  .fun--fireworks .zakzak.fw-flop .zk-leg, .fun--fireworks .zakzak.fw-flop .zk-body, .fw-owl.fw-flop .fr-body { animation: none; }
}
@keyframes fw-fade { from { opacity: 1; } to { opacity: 0; } }

/* ---------- Lights (fun.games.lights): an evening room, a switch, the dark and his glowing eyes ---------- */
/* js/fun.js moves his copy into the stage and places him, his eyes, the owl and the curtain in px
   (left/bottom/width/transform); nothing here animates anything but transform and opacity.
   State classes on the layer: lx-off (the dark), lx-still (the suspense hold), lx-disco (the party),
   lx-big (the finale's halo). */

/* The room: the wall with the floor below it, a rug, the window with the moon */
.lx-wall {
  position: absolute;
  inset: 0;
  background: linear-gradient(#f8ecd4 0, #f3dfbe 82%, #b98a5c 82%, #a67a4a 100%);
  animation: lx-fade .5s ease-out;
}
@keyframes lx-fade { from { opacity: 0; } }
.lx-rug {
  position: absolute;
  left: 50%;
  bottom: 5%;
  width: 76vmin;
  height: 10vmin;
  margin-left: -38vmin;
  border-radius: 50%;
  background: repeating-radial-gradient(ellipse at center, #e08a8a 0 3vmin, #f3c0a8 3vmin 6vmin);
  opacity: .9;
}
.lx-window {
  position: absolute;
  right: 8%;
  top: 12%;
  width: 30vmin;
  height: 36vmin;
  border: 1.6vmin solid #fff8ea;
  border-radius: 15vmin 15vmin 2.5vmin 2.5vmin;
  background: linear-gradient(#1c2a6b, #3b4fa6 70%, #6f85c9);
  box-shadow: 0 .7vmin 0 rgba(74, 63, 122, .15);
  z-index: 1;
}
.lx-window::before {   /* the moon */
  content: "";
  position: absolute;
  left: 50%;
  top: 42%;
  width: 9vmin;
  height: 9vmin;
  margin: -4.5vmin 0 0 -4.5vmin;
  border-radius: 50%;
  background: #fff3b0;
  box-shadow: 0 0 2.5vmin 1vmin rgba(255, 243, 176, .6);
}
.lx-window::after {   /* three stars */
  content: "";
  position: absolute;
  left: 22%;
  top: 20%;
  width: 1.4vmin;
  height: 1.4vmin;
  border-radius: 50%;
  background: #fff;
  box-shadow: 14vmin 6vmin 0 #fff, 3vmin 20vmin 0 #fff;
}

/* The lamp hangs top-centre: a cord, a shade, the bulb, its beam to the floor and the finale's halo */
.lx-lamp {
  position: absolute;
  left: 50%;
  top: 0;
  width: 18vmin;
  height: calc(12vh + 9vmin);
  margin-left: -9vmin;
  z-index: 2;
  transform-origin: 50% 0;
  pointer-events: none;
}
.lx-cord { position: absolute; left: 50%; top: 0; width: .9vmin; height: 12vh; margin-left: -.45vmin; background: #6b5a8a; }
.lx-shade {
  position: absolute;
  left: 0;
  top: 12vh;
  width: 100%;
  height: 9vmin;
  background: linear-gradient(#ffb347, #ff8f3d);
  clip-path: polygon(28% 0, 72% 0, 100% 100%, 0 100%);
}
.lx-bulb {
  position: absolute;
  left: 50%;
  top: calc(12vh + 7.5vmin);
  width: 5vmin;
  height: 5vmin;
  margin-left: -2.5vmin;
  border-radius: 50%;
  background: #fff3b0;
  box-shadow: 0 0 3vmin 1vmin rgba(255, 236, 140, .8);
  transition: opacity .3s;
}
.lx-beam {
  position: absolute;
  left: 50%;
  top: calc(12vh + 8vmin);
  width: 90vmin;
  height: 70vh;
  margin-left: -45vmin;
  background: linear-gradient(rgba(255, 236, 140, .5), rgba(255, 236, 140, 0));
  clip-path: polygon(41% 0, 59% 0, 100% 100%, 0 100%);
  transition: opacity .3s;
}
.lx-halo {
  position: absolute;
  left: 50%;
  top: calc(12vh + 8vmin);
  width: 44vmin;
  height: 44vmin;
  margin: -22vmin 0 0 -22vmin;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 246, 180, .95) 0 18%, rgba(255, 246, 180, 0) 70%);
  opacity: 0;
  transition: opacity .5s;
}
.fun--lights.lx-off .lx-bulb, .fun--lights.lx-off .lx-beam { opacity: 0; }
.fun--lights.lx-big .lx-halo { opacity: 1; }
.lx-lamp.lx-swing { animation: lx-swing 1.6s ease-in-out; }
@keyframes lx-swing {
  0%, 100% { transform: rotate(0); }
  25%      { transform: rotate(14deg); }
  55%      { transform: rotate(-10deg); }
  80%      { transform: rotate(5deg); }
}

/* The switch on the wall: a plate with a rocker knob that drops when the light is off */
.lx-switch {
  position: absolute;
  left: 6%;
  top: 36%;
  width: 18vmin;
  height: 24vmin;
  border-radius: 3vmin;
  background: #fff8ea;
  box-shadow: inset 0 0 0 1.2vmin #efe0c3, 0 .7vmin 0 rgba(74, 63, 122, .15);
  z-index: 2;
}
.lx-knob {
  position: absolute;
  left: 22%;
  top: 9%;
  width: 56%;
  height: 40%;
  border-radius: 2vmin;
  background: linear-gradient(#ffd166, #ffb347);
  box-shadow: 0 .5vmin 0 #d98a2b;
  transition: transform .18s;
}
.fun--lights.lx-off .lx-knob { transform: translateY(105%); }
.lx-switch.lx-wobble { animation: lx-wobble .7s ease-in-out; }
@keyframes lx-wobble {
  20%, 60% { transform: rotate(-8deg) scale(1.08); }
  40%, 80% { transform: rotate(8deg) scale(1.08); }
}
/* The window, the lamp and the switch pop in at the start (js takes lx-in off after a second) */
.lx-window.lx-in, .lx-switch.lx-in { animation: lx-pop .55s cubic-bezier(.3, 1.5, .5, 1) backwards; }
.lx-switch.lx-in { animation-delay: .15s; }
.lx-lamp.lx-in { animation: lx-drop .6s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes lx-pop { from { transform: scale(.4); opacity: 0; } }
@keyframes lx-drop { from { transform: translateY(-110%); } }

/* Zakzak's copy (inside the stage): placed by js, slides between poses; hats ride inside his box */
.fun--lights .fun-zak {
  z-index: 3;
  will-change: transform;
  transition: left .8s ease-in-out, bottom .8s ease-in-out, width .8s ease-in-out, transform .8s ease-in-out;
}
.lx-hat { position: absolute; opacity: 0; pointer-events: none; transition: opacity .2s; }
.lx-hat--pot {
  left: 24%;
  top: 0;
  width: 52%;
  height: 21%;
  background: linear-gradient(#c67a3a, #8a4b12);
  border-radius: 12% 12% 45% 45% / 18% 18% 60% 60%;
  box-shadow: inset 0 1.2vmin 0 rgba(255, 255, 255, .25), 0 .5vmin 0 rgba(74, 63, 122, .2);
}
.lx-hat--party {
  left: 32%;
  top: -12%;
  width: 36%;
  height: 28%;
  background: repeating-linear-gradient(-45deg, #ff7aa8 0 1.6vmin, #ffd84d 1.6vmin 3.2vmin, #6ec6ff 3.2vmin 4.8vmin);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.fun--lights .fun-zak.lx-pot .lx-hat--pot, .fun--lights .fun-zak.lx-party .lx-hat--party { opacity: 1; }
/* His jumps are on the svg, like his own expressions (the box keeps its pose); the party's dance is on
   the bodies (where his breathing is), so a step, a boo or the core's happy jump still shows over it */
.fun--lights.lx-disco .fun-zak .zk-body { animation: lx-dance .5s ease-in-out infinite alternate; }
.fun--lights.lx-disco .lx-owl .fr-body { transform-box: fill-box; transform-origin: 50% 100%; animation: lx-dance .5s ease-in-out .25s infinite alternate; }
.fun--lights .fun-zak.lx-boo svg { animation: lx-boo .6s cubic-bezier(.3, 1.5, .5, 1); }
.fun--lights .fun-zak.lx-step svg, .fun--lights .lx-owl.lx-hop svg { animation: lx-step .4s ease-out; }
.fun--lights .fun-zak.lx-bow svg { animation: lx-bow 1.1s ease-in-out; }
@keyframes lx-dance {
  from { transform: translateY(0) rotate(-6deg); }
  to   { transform: translateY(-7%) rotate(6deg); }
}
@keyframes lx-boo {
  0%   { transform: scale(.6); }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}
@keyframes lx-step {
  40%  { transform: translateY(-18%) rotate(8deg); }
  100% { transform: translateY(0) rotate(0); }
}
@keyframes lx-bow {
  0%, 100% { transform: rotate(0); }
  35%, 65% { transform: rotate(18deg); }
}

/* The owl: perched on the switch, on his head, or dancing beside him (js places it) */
.fun--lights .lx-owl {
  top: 0;
  left: 0;
  width: 20vmin;
  margin: 0;
  z-index: 4;
  transition: transform .8s ease-in-out;
  will-change: transform;
}
.fun--lights .lx-owl.lx-peck svg { animation: lx-peck .4s ease-in-out; }
@keyframes lx-peck { 50% { transform: rotate(28deg) translateY(12%); } }

/* The finale's row of animals along the bottom (above the home button's corner), hidden until the big
   reveal, then popping in one after another in front of his feet */
.lx-row {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16%;
  display: flex;
  justify-content: center;
  gap: 1vmin;
  z-index: 5;
  pointer-events: none;
}
.lx-row img {
  display: block;
  width: 15vmin;
  height: 15vmin;
  opacity: 0;
  transform: scale(.2);
  transition: transform .6s cubic-bezier(.3, 1.5, .5, 1), opacity .25s;
}
.lx-row.is-in img { opacity: 1; transform: none; }
.lx-row.is-hop img { animation: lx-hop .45s ease-out; }
.lx-row.is-hop img:nth-child(2n) { animation-delay: .08s; }
@keyframes lx-hop { 40% { transform: translateY(-35%) rotate(6deg); } }

/* Level 2+: the curtain that hides him (sized and placed by js), parked a whole screen to the left until
   its moment (its own width is not enough sideways, where it is wide and sits near the middle) */
.lx-curtain {
  position: absolute;
  z-index: 6;
  border-radius: 0 0 2vmin 2vmin;
  background: repeating-linear-gradient(90deg, #d12f45 0 3vmin, #a51b2d 3vmin 4.6vmin, #ee4b62 4.6vmin 6vmin);
  box-shadow: 0 .8vmin 0 rgba(74, 63, 122, .2);
  transform: translate3d(calc(-100% - 100vw), 0, 0);
  transition: transform .55s cubic-bezier(.3, 1.1, .5, 1);
  pointer-events: none;
}
.lx-curtain::before {   /* the rod */
  content: "";
  position: absolute;
  left: -6%;
  right: -6%;
  top: -1.2vmin;
  height: 2vmin;
  border-radius: 1vmin;
  background: #8a5a2b;
}
.lx-curtain.is-in { transform: translate3d(0, 0, 0); }
.lx-curtain.is-away { transform: translate3d(calc(-100% - 100vw), -12%, 0) rotate(-12deg); transition-timing-function: ease-in; }

/* The dark: never past 90%, bluer around the window's moon; a moon glow and three fireflies live in it */
.lx-dark {
  position: absolute;
  inset: 0;
  z-index: 7;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(circle at var(--wx, 78%) var(--wy, 30%), #2d2a66 0, #100b33 30vmin, #05031a 60vmin);
  transition: opacity .35s;
}
.fun--lights.lx-off .lx-dark { opacity: .9; transition-duration: .22s; }
.lx-moon {
  position: absolute;
  left: var(--wx, 78%);
  top: var(--wy, 30%);
  width: 28vmin;
  height: 28vmin;
  margin: -14vmin 0 0 -14vmin;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6c4 0 15%, rgba(255, 246, 196, .35) 28%, rgba(255, 246, 196, 0) 70%);
}
.lx-fly {
  position: absolute;
  width: 1.8vmin;
  height: 1.8vmin;
  border-radius: 50%;
  background: #ffe66d;
  box-shadow: 0 0 1.6vmin .4vmin rgba(255, 230, 109, .6);
  will-change: transform, opacity;
}
.lx-fly--0 { left: 18%; top: 30%; animation: lx-fly-0 9s ease-in-out infinite alternate, lx-pulse 2.3s ease-in-out infinite; }
.lx-fly--1 { left: 60%; top: 55%; animation: lx-fly-1 11s ease-in-out infinite alternate, lx-pulse 2.9s ease-in-out .7s infinite; }
.lx-fly--2 { left: 35%; top: 70%; animation: lx-fly-2 8s ease-in-out infinite alternate, lx-pulse 2.1s ease-in-out 1.3s infinite; }
@keyframes lx-fly-0 {
  0%   { transform: translate3d(0, 0, 0); }
  35%  { transform: translate3d(14vmin, 8vmin, 0); }
  70%  { transform: translate3d(4vmin, 20vmin, 0); }
  100% { transform: translate3d(24vmin, 4vmin, 0); }
}
@keyframes lx-fly-1 {
  0%   { transform: translate3d(0, 0, 0); }
  40%  { transform: translate3d(-16vmin, -10vmin, 0); }
  70%  { transform: translate3d(-6vmin, 10vmin, 0); }
  100% { transform: translate3d(10vmin, -18vmin, 0); }
}
@keyframes lx-fly-2 {
  0%   { transform: translate3d(0, 0, 0); }
  30%  { transform: translate3d(18vmin, -12vmin, 0); }
  65%  { transform: translate3d(28vmin, 4vmin, 0); }
  100% { transform: translate3d(8vmin, -22vmin, 0); }
}
@keyframes lx-pulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

/* His eyes in the dark: two white eyes with pupils in one glowing box, placed, turned and scaled by js
   over his real eyes; they glide (.8 s) as he sneaks, blink, and peek over the curtain in the light */
.lx-eyes {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 9;
  opacity: 0;
  pointer-events: none;
  transform-origin: center;
  transition: transform .8s ease-in-out, opacity .15s;
}
.lx-eyes.is-jump { transition: none; }
.lx-eyes.is-on, .lx-eyes.is-peek { opacity: 1; }
.lx-eyes i {
  display: block;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 23% 50% at 23% 50%, #2a2340 0 42%, #fff 46% 96%, rgba(255, 255, 255, 0) 100%),
    radial-gradient(ellipse 23% 50% at 77% 50%, #2a2340 0 42%, #fff 46% 96%, rgba(255, 255, 255, 0) 100%);
  filter: drop-shadow(0 0 1.4vmin rgba(255, 246, 180, .95));
  transform-origin: center;
  animation: lx-blink 3.8s infinite;
}
@keyframes lx-blink {
  0%, 93%, 100% { transform: scaleY(1); }
  96%           { transform: scaleY(.1); }
}
/* The suspense hold (level 3+): the fireflies and the blink stand still */
.fun--lights.lx-still .lx-fly, .fun--lights.lx-still .lx-eyes i { animation-play-state: paused; }

/* Level 3+: the party. A coloured wash (one of six, never deeper than .35), a mirror ball that drops
   from the ceiling and spins (one turn in 4 s), six light spots sweeping between two places each */
.lx-wash {
  position: absolute;
  inset: 0;
  z-index: 7;
  opacity: 0;
  pointer-events: none;
  background-color: #ff5c7a;
  transition: opacity .5s, background-color .35s;
}
.lx-wash.lx-h0 { background-color: #ff5c7a; }
.lx-wash.lx-h1 { background-color: #ff9f43; }
.lx-wash.lx-h2 { background-color: #ffd84d; }
.lx-wash.lx-h3 { background-color: #7fd36b; }
.lx-wash.lx-h4 { background-color: #5fb8ff; }
.lx-wash.lx-h5 { background-color: #b98cff; }
.fun--lights.lx-disco .lx-wash { opacity: .35; }
.lx-ball {
  position: absolute;
  left: 28%;
  top: 0;
  width: 16vmin;
  height: 16vmin;
  margin-left: -8vmin;
  z-index: 8;
  pointer-events: none;
  transform: translate3d(0, -140%, 0);
  transition: transform .7s cubic-bezier(.3, 1.2, .5, 1);
}
.lx-ball::before {   /* its cord */
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: .8vmin;
  height: 14vh;
  margin-left: -.4vmin;
  background: #6b5a8a;
}
.lx-ball i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: #cfd6e6;
  background-image: radial-gradient(circle, #fff 0 28%, rgba(255, 255, 255, 0) 34%);
  background-size: 3vmin 3vmin;
  box-shadow: inset -1.5vmin -1.5vmin 0 rgba(90, 80, 140, .25), 0 0 2vmin rgba(255, 255, 255, .6);
  animation: lx-spin 4s linear infinite;
  animation-play-state: paused;
}
.fun--lights.lx-disco .lx-ball { transform: translate3d(0, 14vh, 0); }
.fun--lights.lx-disco .lx-ball i { animation-play-state: running; }
@keyframes lx-spin { to { transform: rotate(360deg); } }
.lx-dot {
  position: absolute;
  left: 0;
  top: 0;
  width: 16vmin;
  height: 16vmin;
  margin: -8vmin 0 0 -8vmin;
  border-radius: 50%;
  background: radial-gradient(circle, var(--c, #fff) 0 30%, rgba(255, 255, 255, 0) 70%);
  opacity: 0;
  z-index: 8;
  pointer-events: none;
  transition: opacity .5s;
}
.fun--lights.lx-disco .lx-dot { opacity: .6; animation: lx-sweep var(--t, 3s) ease-in-out infinite alternate; }
@keyframes lx-sweep {
  from { transform: translate3d(var(--x0), var(--y0), 0); }
  to   { transform: translate3d(var(--x1), var(--y1), 0); }
}

/* Sparkles under a finger (three boxes reused in turn): five coloured dots fly out and fade */
.lx-spark { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 10; pointer-events: none; }
.lx-spark i {
  position: absolute;
  left: -1.1vmin;
  top: -1.1vmin;
  width: 2.2vmin;
  height: 2.2vmin;
  border-radius: 50%;
  opacity: 0;
}
.lx-spark i:nth-child(1) { background: #ff7aa8; }
.lx-spark i:nth-child(2) { background: #ffd84d; }
.lx-spark i:nth-child(3) { background: #6ec6ff; }
.lx-spark i:nth-child(4) { background: #7fd36b; }
.lx-spark i:nth-child(5) { background: #fff; }
.lx-spark.is-go i { animation: lx-spark .55s ease-out; }
@keyframes lx-spark {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; }
}

/* A firework in the window (the finale): placed by js, gone after 1.2 s */
.lx-fw { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 10; pointer-events: none; }
.lx-fw i {
  position: absolute;
  left: -1.3vmin;
  top: -1.3vmin;
  width: 2.6vmin;
  height: 2.6vmin;
  border-radius: 50%;
  animation: lx-fw 1.1s ease-out forwards;
}
.lx-fw i:nth-child(6n+1) { background: #ff5c7a; }
.lx-fw i:nth-child(6n+2) { background: #ff9f43; }
.lx-fw i:nth-child(6n+3) { background: #ffd84d; }
.lx-fw i:nth-child(6n+4) { background: #7fd36b; }
.lx-fw i:nth-child(6n+5) { background: #5fb8ff; }
.lx-fw i:nth-child(6n)   { background: #fff; }
@keyframes lx-fw {
  0%   { transform: translate(0, 0) scale(.4); opacity: 1; }
  60%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0; }
}

/* Sideways phones: the window and the switch sit higher, the lamp's cord is the same 12vh */
@media (orientation: landscape) {
  .lx-window { top: 8%; right: 6%; width: 26vmin; height: 30vmin; }
  .lx-switch { top: 40%; }
  .lx-rug { width: 60vmin; margin-left: -30vmin; }
}

@media (prefers-reduced-motion: reduce) {
  .lx-fly, .lx-eyes i, .lx-ball i, .lx-dot, .lx-lamp.lx-swing, .lx-switch.lx-wobble, .lx-window.lx-in, .lx-switch.lx-in, .lx-lamp.lx-in,
  .fun--lights.lx-disco .fun-zak .zk-body, .fun--lights.lx-disco .lx-owl .fr-body { animation: none; }
  .lx-eyes, .fun--lights .fun-zak, .fun--lights .lx-owl, .lx-curtain, .lx-ball, .lx-wash { transition-duration: .01s; }
  .fun--lights.lx-disco .lx-dot { opacity: .6; }
}

/* ---------- Sneeze (fun.games.sneeze): a garden, a pepper shaker over his head, a sneeze that blows everything away ---------- */
/* js/fun.js sets --sw (the tickler's width), --iw (a thing's size) and --ow (the owl's width) in px on the stage,
   places every thing, the tickler and the owl's branch with left/top, and moves them only with transform
   animations (--dx/--dy per thing, from his middle). His nose is a circle the js adds to his copy's SVG; the
   grains and the pepper cloud live inside his copy too (the stage is under him). Nothing here animates anything
   but transform and opacity (and the nose's fill). */

/* The garden: the layer's sky ends in grass (he stands on it: his feet are at 10% / 4% from the bottom) */
.fun--sneeze .fun-sky { background: linear-gradient(#9fdcff, #e6f7ff 60%, #b9e59a 60.5%, #8fcf78); }
@media (orientation: landscape) {
  .fun--sneeze .fun-sky { background: linear-gradient(#9fdcff, #e6f7ff 56%, #b9e59a 56.5%, #8fcf78); }
}

/* ---------- Zakzak's copy: in the middle, a little smaller; the core's css slides his left (the launch) ---------- */
.fun--sneeze .fun-zak { width: min(56vw, 40vh); bottom: 10%; }
@media (orientation: landscape) {
  .fun--sneeze .fun-zak { width: min(34vw, 52vh); bottom: 4%; }
}

/* His nose: small and pink, then a step bigger and redder per tickle (--ns, --nc from the step classes) */
.sn-nose {
  fill: var(--nc, #f7a6b8);
  stroke: var(--zk-line);
  stroke-width: 3;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(var(--ns, 1));
  transition: transform .3s cubic-bezier(.3, 1.6, .5, 1), fill .3s;
}
.fun--sneeze .fun-zak.sn-s1 { --ns: 1.5; --nc: #ff8a9a; }
.fun--sneeze .fun-zak.sn-s2 { --ns: 2.1; --nc: #ff5f74; }
.fun--sneeze .fun-zak.sn-s3 { --ns: 2.8; --nc: #ff2d4a; }
/* ...and he leans back a little more each step (the breathing stops: the lean is a transform on the same group) */
.fun--sneeze .fun-zak.sn-s1 .zk-body, .fun--sneeze .fun-zak.sn-s2 .zk-body, .fun--sneeze .fun-zak.sn-s3 .zk-body,
.fun--sneeze .fun-zak.sn-relief .zk-body { animation: none; transition: transform .35s ease-out; }
.fun--sneeze .fun-zak.sn-s1 .zk-body { transform: rotate(-4deg); }
.fun--sneeze .fun-zak.sn-s2 .zk-body { transform: rotate(-8deg) scale(1.02, 1.03); }
.fun--sneeze .fun-zak.sn-s3 .zk-body { transform: rotate(-13deg) scale(1.03, 1.05); }
.fun--sneeze .fun-zak.sn-s3 .zk-eye { animation: none; transform: scaleY(.55); transition: transform .3s; }
.fun--sneeze .fun-zak.sn-s3 .sn-nose { animation: sn-throb .5s ease-in-out infinite alternate; }
@keyframes sn-throb { from { transform: scale(var(--ns, 1)); } to { transform: scale(calc(var(--ns, 1) * 1.12)); } }
/* A tickle: the nose wiggles */
.fun--sneeze .fun-zak.sn-tick .sn-nose { animation: sn-wiggle .4s ease-in-out; }
@keyframes sn-wiggle {
  25% { transform: translateX(-3px) scale(var(--ns, 1)); }
  50% { transform: translateX(3px) scale(calc(var(--ns, 1) * 1.15)); }
  75% { transform: translateX(-2px) scale(var(--ns, 1)); }
}

/* "Aah...": head back and back, eyes nearly shut, mouth an "o", the nose throbbing fast */
.fun--sneeze .fun-zak.sn-aah .zk-body { animation: sn-aah .85s ease-in forwards; }
@keyframes sn-aah {
  0%   { transform: rotate(-13deg) scale(1.03, 1.05); }
  70%  { transform: rotate(-20deg) scale(1.02, 1.1); }
  100% { transform: rotate(-24deg) scale(1.04, 1.12); }
}
.fun--sneeze .fun-zak.sn-aah-big .zk-body { animation: sn-aah-big 2s ease-in-out forwards; }   /* the finale: longer, with a quiver */
@keyframes sn-aah-big {
  0%   { transform: rotate(-13deg) scale(1.03, 1.05); }
  30%  { transform: rotate(-20deg) scale(1.02, 1.1); }
  40%  { transform: rotate(-18deg) scale(1.03, 1.09); }
  50%  { transform: rotate(-23deg) scale(1.02, 1.11); }
  60%  { transform: rotate(-20deg) scale(1.04, 1.1); }
  70%  { transform: rotate(-25deg) scale(1.03, 1.12); }
  100% { transform: rotate(-28deg) scale(1.06, 1.14); }
}
.fun--sneeze .fun-zak.sn-aah .zk-eye, .fun--sneeze .fun-zak.sn-aah-big .zk-eye { animation: none; transform: scaleY(.3); }
.fun--sneeze .fun-zak.sn-aah .zk-mouth--idle, .fun--sneeze .fun-zak.sn-aah-big .zk-mouth--idle,
.fun--sneeze .fun-zak.sn-choo .zk-mouth--idle { display: none; }
.fun--sneeze .fun-zak.sn-aah .zk-mouth--wrong, .fun--sneeze .fun-zak.sn-aah-big .zk-mouth--wrong { display: inline; transform: scale(1.4); }
.fun--sneeze .fun-zak.sn-aah .sn-nose, .fun--sneeze .fun-zak.sn-aah-big .sn-nose { animation: sn-throb .25s ease-in-out infinite alternate; }

/* ACHOO: the snap forward, eyes shut, a wide "o", a puff from his mouth (the zk-puff part of his SVG) */
.fun--sneeze .fun-zak.sn-choo .zk-body { animation: sn-choo .7s ease-out; }
@keyframes sn-choo {
  0%   { transform: rotate(-24deg) scale(1.04, 1.12); }
  18%  { transform: rotate(14deg) scale(1.1, .86); }
  45%  { transform: rotate(10deg) scale(1.05, .95); }
  70%  { transform: rotate(-3deg) scale(1, 1); }
  100% { transform: rotate(0) scale(1, 1); }
}
.fun--sneeze .fun-zak.sn-choo .zk-eye { animation: none; transform: scaleY(.1); }
.fun--sneeze .fun-zak.sn-choo .zk-mouth--wrong { display: inline; transform: scale(1.8, 1.4); }
.fun--sneeze .fun-zak.sn-choo .zk-puff { display: inline; opacity: 0; animation: sn-puff .7s ease-out; }
@keyframes sn-puff {
  0%   { opacity: 0; transform: translateY(0) scale(.4); }
  25%  { opacity: 1; transform: translateY(8px) scale(1.1); }
  100% { opacity: 0; transform: translateY(28px) scale(1.7); }
}

/* The fake-out (level 2+): he straightens up, relieved, happy eyes and a smile... */
.fun--sneeze .fun-zak.sn-relief .zk-body { transform: rotate(0); }
.fun--sneeze .fun-zak.sn-relief .zk-eye, .fun--sneeze .fun-zak.sn-relief .zk-mouth--idle,
.fun--sneeze .fun-zak.sn-happy .zk-eye, .fun--sneeze .fun-zak.sn-happy .zk-mouth--idle { display: none; }
.fun--sneeze .fun-zak.sn-relief .zk-happy-eye, .fun--sneeze .fun-zak.sn-relief .zk-mouth--right,
.fun--sneeze .fun-zak.sn-happy .zk-happy-eye, .fun--sneeze .fun-zak.sn-happy .zk-mouth--right { display: inline; }

/* After a sneeze: he shakes his head and rubs with his right hand (up by his face: the arms are drawn behind his body) */
.fun--sneeze .fun-zak.sn-wipe .zk-body { animation: sn-headshake .8s ease-in-out; }
@keyframes sn-headshake {
  20%, 60% { transform: rotate(-5deg); }
  40%, 80% { transform: rotate(5deg); }
}
.fun--sneeze .fun-zak.sn-wipe .zk-arm--r { animation: sn-wipe .9s ease-in-out; }
@keyframes sn-wipe {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  25%, 75% { transform: translate(var(--tx, 6px), -14px) rotate(var(--up, -100deg)); }
  40%, 60% { transform: translate(var(--tx, 6px), -14px) rotate(calc(var(--up, -100deg) * .8)); }
}

/* Level 3+: launched into the wall (the core slides his left), a tumble, then dizzy eyes going round */
.fun--sneeze .fun-zak.sn-fly svg { animation: sn-tumble 1.1s linear; }
@keyframes sn-tumble { to { transform: rotate(360deg); } }
.fun--sneeze .fun-zak.sn-dizzy .zk-pupil, .fun--sneeze .fun-zak.sn-dizzy .zk-shine { animation: sn-roll .5s linear 3; }
@keyframes sn-roll {
  0%   { transform: translate(0, -5px); }
  25%  { transform: translate(5px, 0); }
  50%  { transform: translate(0, 5px); }
  75%  { transform: translate(-5px, 0); }
  100% { transform: translate(0, -5px); }
}
.fun--sneeze .fun-zak.sn-dizzy .zk-stars { display: inline; transform-origin: 100px 20px; animation: sn-stars 1.4s ease-in-out; }
@keyframes sn-stars {
  0%   { opacity: 0; transform: rotate(0); }
  20%, 80% { opacity: 1; }
  100% { opacity: 0; transform: rotate(360deg); }
}

/* The finale's giggle (a wriggle) and hiccup (a hop) */
.fun--sneeze .fun-zak.sn-happy .zk-body { animation: sn-giggle .14s linear 8; }
@keyframes sn-giggle {
  0%, 100% { transform: rotate(0) scale(1, 1); }
  25% { transform: rotate(-4deg) scale(1.03, .97); }
  75% { transform: rotate(4deg) scale(.97, 1.03); }
}
.fun--sneeze .fun-zak.sn-hic .zk-body { animation: sn-hic .42s ease-out; }
@keyframes sn-hic {
  20% { transform: translateY(-9%) scale(.96, 1.05); }
  45% { transform: translateY(0) scale(1.04, .96); }
}

/* The grains (pepper; fluff or pollen from level 3) fall from the tickler's cap onto his nose: --dx/--dy from the js */
.sn-grains { position: absolute; left: 50%; top: 0; width: 0; height: 0; z-index: 2; pointer-events: none; }
.sn-grains i {
  position: absolute;
  left: -.5vmin;
  top: -.5vmin;
  width: 1vmin;
  height: 1vmin;
  border-radius: 50%;
  background: #2b2633;
  opacity: 0;
}
.sn-grains i:nth-child(2n) { width: .75vmin; height: .75vmin; }
.sn-grains i.is-fall { animation: sn-fall .5s ease-in var(--d, 0s) forwards; }
@keyframes sn-fall {
  0%   { transform: translate(0, 0); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)); opacity: 0; }
}
.sn-grains.is-fluff i { width: 1.4vmin; height: 1.4vmin; background: #fff; box-shadow: 0 0 0 .3vmin #ffd3e3; }
.sn-grains.is-pollen i { width: 1.3vmin; height: 1.3vmin; background: #ffd84d; }

/* The pepper cloud of the finale, around his nose */
.sn-cloud {
  position: absolute;
  left: 50%;
  top: 0;
  width: 34vmin;
  height: 34vmin;
  margin: -17vmin 0 0 -17vmin;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(60, 54, 70, .75), rgba(60, 54, 70, .3) 40%, rgba(60, 54, 70, 0) 70%);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}
.sn-cloud.is-on { animation: sn-cloud 2.6s ease-out forwards; }
@keyframes sn-cloud {
  0%   { opacity: 0; transform: scale(.3); }
  30%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.7); }
}

/* ---------- The tickler on its string over his head: a pepper shaker; level 3+: a feather, a flower too ---------- */
/* The box runs from the top of the screen (the string) down to the cap (js: left, height); the string is its ::before,
   the body hangs at the bottom. .sn-swing swings the whole thing from the top; .sn-body kicks from where the string ends. */
.sn-tickler { position: absolute; left: 0; top: 0; width: var(--sw); z-index: 2; will-change: transform; }
.sn-tickler::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: calc(var(--sw) * 1.28);
  width: .6vmin;
  margin-left: -.3vmin;
  background: #8a7a6a;
}
.sn-swing { position: absolute; inset: 0; transform-origin: 50% 0; }
.sn-body { position: absolute; left: 0; bottom: 0; width: 100%; height: calc(var(--sw) * 1.3); transform-origin: 50% 0; will-change: transform; }
.sn-tickler.is-drop { animation: sn-drop .8s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes sn-drop { from { transform: translateY(-110%); } }
.sn-tickler.is-swing .sn-swing { animation: sn-swing 1.6s ease-in-out; }
@keyframes sn-swing {
  20% { transform: rotate(9deg); }
  45% { transform: rotate(-7deg); }
  70% { transform: rotate(4deg); }
  88% { transform: rotate(-2deg); }
}
.sn-tickler.is-shake .sn-body { animation: sn-kick .4s ease-in-out; }
@keyframes sn-kick {
  20% { transform: rotate(-26deg) scale(1.06, .94); }
  45% { transform: rotate(20deg); }
  70% { transform: rotate(-10deg); }
  88% { transform: rotate(4deg); }
}
.sn-tickler.is-hint .sn-body { animation: sn-hint 1s ease-in-out; }   /* self-play: it wobbles, so the child knows what to touch */
@keyframes sn-hint {
  20%, 60% { transform: rotate(-12deg) scale(1.08); }
  40%, 80% { transform: rotate(12deg) scale(1.08); }
}
.sn-tickler.is-pour .sn-body { animation: sn-pour .12s linear infinite alternate; }   /* the finale: a frantic shiver */
@keyframes sn-pour { from { transform: rotate(-12deg) scale(1.04, .96); } to { transform: rotate(12deg) scale(1.04, .96); } }
.sn-tickler.is-up { animation: sn-up .9s ease-in forwards; --dx: 0px; }

/* The shaker: hangs by its base, the glass body with the pepper inside, the dotted cap pointing down at his nose */
.sn-tickler--shaker .sn-body::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 0;
  height: 74%;
  box-sizing: border-box;
  border: .7vmin solid #b8c6e0;
  border-radius: 24% 24% 8% 8% / 16% 16% 6% 6%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, .05) 35%, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, .1)),
    linear-gradient(#eef5ff, #eef5ff 36%, #4b4556 36%, #2f2a39);
}
.sn-tickler--shaker .sn-body::after {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  top: 70%;
  bottom: 0;
  border-radius: 10% 10% 48% 48% / 10% 10% 64% 64%;
  background-color: #c9cfdd;
  background-image: radial-gradient(circle, #3a3a48, #3a3a48 1vmin, rgba(0, 0, 0, 0) 1.15vmin);
  background-size: 3.4vmin 3.4vmin;
  background-position: 50% 60%;
  box-shadow: inset 0 -1vmin rgba(0, 0, 0, .18), 0 .6vmin 0 rgba(74, 63, 122, .15);
}
/* The feather: a soft white vane on a pink quill, tickling by itself */
.sn-tickler--feather .sn-body::before {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  top: 2%;
  bottom: 2%;
  box-sizing: border-box;
  border: .5vmin solid #ffb6d1;
  border-radius: 50% 50% 50% 50% / 42% 42% 58% 58%;
  background: linear-gradient(90deg, #fff, #ffe9f1 50%, #fff);
}
.sn-tickler--feather .sn-body::after {
  content: "";
  position: absolute;
  left: 49%;
  top: 0;
  bottom: 0;
  width: 2%;
  background: #f29ab8;
}
.sn-tickler--feather .sn-body { animation: sn-tickle 1.4s ease-in-out infinite; }
@keyframes sn-tickle { 50% { transform: rotate(8deg); } }
/* The flower: its stem up the string, the daisy's head (petals as shadows) down by his nose */
.sn-tickler--flower .sn-body::after {
  content: "";
  position: absolute;
  left: 47%;
  top: 0;
  width: 6%;
  height: 46%;
  background: #6fbf5a;
}
.sn-tickler--flower .sn-body::before {
  content: "";
  position: absolute;
  left: 30%;
  top: 44%;
  width: 40%;
  height: calc(var(--sw) * .4);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff3b0, #ffd84d 60%, #e0b000);
  box-shadow: 0 -5.5vmin 0 #ff8fb6, 4.8vmin -2.8vmin 0 #ff8fb6, 4.8vmin 2.8vmin 0 #ff8fb6, 0 5.5vmin 0 #ff8fb6, -4.8vmin 2.8vmin 0 #ff8fb6, -4.8vmin -2.8vmin 0 #ff8fb6;
  z-index: 1;
}

/* ---------- The things around him: leaves (css), a flower, a cup, a butterfly, a cloud (icons) ---------- */
.sn-item {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--iw);
  height: var(--iw);
  margin: calc(var(--iw) / -2) 0 0 calc(var(--iw) / -2);
  z-index: 1;
  will-change: transform;
}
.sn-item img { display: block; width: 100%; height: 100%; pointer-events: none; }
.sn-item.is-new { animation: sn-in .5s cubic-bezier(.3, 1.5, .5, 1) var(--d, 0s) both; }
@keyframes sn-in { from { transform: scale(.3); opacity: 0; } }
.sn-leaf {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 0 60% 0 60%;
  background: linear-gradient(135deg, var(--lc, #7fd36b), #4ea43c);
  box-shadow: 0 .5vmin 0 rgba(74, 63, 122, .12);
  transform: rotate(var(--r, 0deg));
  animation: sn-sway 3s ease-in-out infinite alternate;
}
.sn-leaf::after {   /* the vein, corner to corner */
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 4%;
  border-radius: 1vmin;
  background: #3f8a2f;
  opacity: .6;
  transform: rotate(45deg);
}
@keyframes sn-sway { from { transform: rotate(calc(var(--r, 0deg) - 7deg)); } to { transform: rotate(calc(var(--r, 0deg) + 7deg)); } }
.sn-item--butterfly img { animation: sn-flutter .6s ease-in-out infinite alternate; }
@keyframes sn-flutter { from { transform: scaleX(1) translateY(0); } to { transform: scaleX(.8) translateY(-6%); } }
/* What a thing does: hops under a finger, flies out on a sneeze and tumbles back, flies off up in the finale and drifts down */
.sn-item.is-hop { animation: sn-hop .5s ease-out; }
@keyframes sn-hop {
  30% { transform: translateY(-30%) rotate(-10deg) scale(1.1); }
  65% { transform: translateY(0) rotate(6deg); }
}
.sn-item.is-blast { animation: sn-blast 1.9s ease-out; }
@keyframes sn-blast {
  0%   { transform: translate(0, 0) rotate(0); animation-timing-function: ease-out; }
  35%  { transform: translate(var(--dx), var(--dy)) rotate(360deg); animation-timing-function: ease-in-out; }
  100% { transform: translate(0, 0) rotate(360deg); }
}
.sn-item.is-up { animation: sn-up .9s ease-in forwards; }
@keyframes sn-up { to { transform: translate(var(--dx, 0px), -130vh) rotate(540deg); } }
.sn-item.is-down { animation: sn-down 2.2s ease-out; }
@keyframes sn-down {
  0%   { transform: translate(var(--dx, 0px), -130vh) rotate(-40deg); }
  55%  { transform: translate(calc(var(--dx, 0px) * .5), -40vh) rotate(25deg); }
  100% { transform: translate(0, 0) rotate(0); }
}

/* ---------- The owl on its branch at the top right: ruffles on every sneeze, knocked off at level 2, his hat at the end ---------- */
.sn-branch { position: absolute; left: 0; top: 0; height: 2.6vmin; border-radius: 1.3vmin 0 0 1.3vmin; background: linear-gradient(#a0693c, #6e4426); z-index: 1; }
.sn-branch::before, .sn-branch::after {   /* two leaves on it */
  content: "";
  position: absolute;
  width: 5vmin;
  height: 3vmin;
  border-radius: 0 60% 0 60%;
  background: #6fbf5a;
}
.sn-branch::before { left: -2vmin; top: -2.6vmin; transform: rotate(-30deg); }
.sn-branch::after { left: 9vmin; top: 1.8vmin; transform: rotate(150deg); }
.fun--sneeze .sn-owl { top: 5%; left: auto; right: 5%; width: var(--ow); z-index: 2; transition: none; will-change: transform; }
.fun--sneeze .sn-owl .fr-pupil, .fun--sneeze .sn-owl .fr-shine { transform: translate(-3px, 3px); }   /* it looks down at him */
.fun--sneeze .sn-owl.is-ruffle .fr-body { animation: sn-ruffle .7s ease-in-out; }
@keyframes sn-ruffle {
  20% { transform: translateY(-14%) rotate(-8deg) scale(1.05, .95); }
  50% { transform: translateY(-6%) rotate(8deg); }
  80% { transform: translateY(-3%) rotate(-3deg); }
}
.fun--sneeze .sn-owl.is-ruffle .fr-wing--l { animation: sn-wing-l .17s ease-in-out 4 alternate; }
.fun--sneeze .sn-owl.is-ruffle .fr-wing--r { animation: sn-wing-r .17s ease-in-out 4 alternate; }
@keyframes sn-wing-l { to { transform: rotate(44deg); } }
@keyframes sn-wing-r { to { transform: rotate(-44deg); } }
.fun--sneeze .sn-owl.is-ruffle .fr-brow { animation: sn-brow .7s ease-in-out; }
@keyframes sn-brow { 30%, 70% { transform: translateY(-5px); } }
.fun--sneeze .sn-owl.is-off { animation: sn-off .8s ease-in forwards; }
@keyframes sn-off { to { transform: translate(-8vmin, 30vh) rotate(-160deg); } }
.fun--sneeze .sn-owl.is-back { animation: sn-back 1s cubic-bezier(.3, 1.2, .5, 1) forwards; }
@keyframes sn-back { from { transform: translate(-8vmin, 30vh) rotate(-160deg); } to { transform: none; } }
.fun--sneeze .sn-owl.is-up { animation: sn-up .9s ease-in forwards; }
.fun--sneeze .sn-owl.is-land { animation: sn-land 1.2s ease-out forwards; }   /* --hx/--hy/--hs: onto his head, half his width (js) */
@keyframes sn-land {
  0%   { transform: translate(var(--dx, 0px), -130vh) rotate(0) scale(1); }
  100% { transform: translate(var(--hx), var(--hy)) rotate(0) scale(var(--hs, .8)); }
}
.fun--sneeze .fun-zak .sn-hat { position: absolute; z-index: 2; animation: sn-hat-bob 1.6s ease-in-out infinite; }
@keyframes sn-hat-bob { 50% { transform: translateY(-4%) rotate(3deg); } }

/* ---------- Feathers off the owl (float down, swaying) and sparkles under a finger ---------- */
.sn-fx { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.sn-feather {
  position: absolute;
  left: 0;
  top: 0;
  width: 4vmin;
  height: 7vmin;
  margin: -3.5vmin 0 0 -2vmin;
  box-sizing: border-box;
  border: .4vmin solid #c99a6c;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: linear-gradient(90deg, #fff, #f3dfc3);
  opacity: 0;
}
.sn-feather.is-fly { animation: sn-feather 2.6s ease-in forwards; }
@keyframes sn-feather {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0); }
  25%  { transform: translate(calc(var(--dx) * .3), 10vh) rotate(40deg); }
  50%  { transform: translate(calc(var(--dx) * .6), 20vh) rotate(-30deg); }
  75%  { opacity: 1; transform: translate(calc(var(--dx) * .85), 31vh) rotate(35deg); }
  100% { opacity: 0; transform: translate(var(--dx), 42vh) rotate(-20deg); }
}

/* The screen shake (level 2+) on the stage; the hush (level 3+, before the finale): everything holds still */
.fun--sneeze .fun-stage.sn-shake { animation: sn-shake .35s linear; }
@keyframes sn-shake {
  20% { transform: translate(5px, -4px); }
  40% { transform: translate(-5px, 3px); }
  60% { transform: translate(4px, 4px); }
  80% { transform: translate(-3px, -3px); }
}
.fun--sneeze.sn-still .sn-leaf, .fun--sneeze.sn-still .sn-item img, .fun--sneeze.sn-still .sn-body, .fun--sneeze.sn-still .sn-swing,
.fun--sneeze.sn-still .fr-body, .fun--sneeze.sn-still .fr-wing, .fun--sneeze.sn-still .zk-body, .fun--sneeze.sn-still .zk-arm,
.fun--sneeze.sn-still .sn-nose { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  .sn-leaf, .sn-item--butterfly img, .sn-tickler--feather .sn-body, .fun--sneeze .fun-zak .sn-hat,
  .fun--sneeze .fun-stage.sn-shake, .fun--sneeze .fun-zak.sn-fly svg, .fun--sneeze .fun-zak.sn-dizzy .zk-pupil, .fun--sneeze .fun-zak.sn-dizzy .zk-shine,
  .sn-tickler.is-pour .sn-body { animation: none; }
  .sn-item.is-blast { animation: sn-blast-rm 1.9s ease-out; }   /* a fade out and in instead of the flight */
  .sn-item.is-up, .sn-item.is-down, .fun--sneeze .sn-owl.is-up, .fun--sneeze .sn-owl.is-land, .sn-tickler.is-up { animation-duration: .4s; }
  .fun--sneeze .fun-zak.sn-happy .zk-body { animation-iteration-count: 2; }
}
@keyframes sn-blast-rm { 35% { opacity: 0; } 100% { opacity: 1; } }
