/* v33 work loop, v5 "treadmill": Cilantro never moves horizontally; the room slides past him.
   Structure (built by work-loop.js inside .nap):
     .nap (viewport, V wide x A tall)
       .wl-clip   overflow:hidden + soft mask walls on both sides
         .wl-room (A x A, centered, slides via translateX)
            bed back, empty bed back, sleeping dog, bed front, Z's   (original .nap children, moved here)
            .wl-office (A x A at left:D) chair, laptop, sit-type-1/2, desk, bursts
       .wl-stage  (A x A, centered, never moves) walker frames, sign
   A = art size, V = viewport width. */
.nap{--a:min(400px,52vh,calc(90vw / 1.6));--v:calc(var(--a) * 1.6);
  width:var(--v);height:var(--a);aspect-ratio:auto;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}
.wl-clip{position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;
  -webkit-mask-image:linear-gradient(to right,transparent 0,#000 13%,#000 87%,transparent 100%);
  mask-image:linear-gradient(to right,transparent 0,#000 13%,#000 87%,transparent 100%)}
.wl-room,.wl-stage{position:absolute;top:0;left:calc((100% - var(--a)) / 2);width:var(--a);height:var(--a);will-change:transform}
.wl-stage{pointer-events:none}
.wl-office{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}
.wl-office img,.wl-stage img{position:absolute;left:0;top:0;width:100%;height:100%}
.wl-walker{position:absolute;left:0;top:0;width:100%;height:100%;opacity:0}
/* sleeping layers fade then hard-hide (Chromium can keep painting a composited animating layer at opacity 0) */
/* v6b: hard swap both ways (no crossfade -> never two dogs) */
.nap .dog,.nap .z,.wl-room > img.wl-bed{transition:none}
.nap.wl-awake .dog,.nap.wl-awake .z,.nap.wl-awake .wl-room > img.wl-bed{opacity:0!important;visibility:hidden;animation-play-state:paused;transition:none}
.wl-bedbox,.wl-bedbox img{position:absolute;left:0;top:0;width:100%;height:100%}
.wl-bedbox{opacity:0;visibility:hidden}
/* v70: desk stays visible during the turn (new office desk; the walker draws above it) */
/* turn.png: desk hidden */
/* sign: black, pulses ~1.2s, above his head (in the fixed stage, so it stays above him) */
.wl-sign{position:absolute;left:42%;top:7%;z-index:2;transform:translate(-50%,-100%);white-space:nowrap;
  font:700 clamp(8px,1.5vw,13px)/1.15 "Trebuchet MS",system-ui,sans-serif;color:#000;background:#fff;
  border:2px solid #000;border-radius:7px;padding:3px 7px;opacity:0;transition:opacity .4s ease}
.wl-typing .wl-sign{opacity:1;animation:wlpulse 1.2s ease-in-out infinite}
@keyframes wlpulse{0%,100%{transform:translate(-50%,-100%) scale(1)}50%{transform:translate(-50%,-100%) scale(1.07)}}
.wl-burst{position:absolute;transform:translate(-50%,0);font:900 clamp(9px,1.6vw,15px)/1 "Trebuchet MS",system-ui,sans-serif;
  color:#ffd54f;-webkit-text-stroke:1.2px #3f2a9c;letter-spacing:.5px;pointer-events:none;animation:wlpop 1.1s ease-out forwards}
.wl-burst::after{content:"";position:absolute;left:50%;top:110%;width:4px;height:4px;border-radius:50%;background:#ffd54f;
  box-shadow:-7px 3px 0 #fff59d,7px 3px 0 #fff59d;transform:translateX(-50%)}
@keyframes wlpop{0%{opacity:0;transform:translate(-50%,0) scale(.5) rotate(var(--r,0deg))}
  25%{opacity:1;transform:translate(-50%,-40%) scale(1.15) rotate(var(--r,0deg))}
  100%{opacity:0;transform:translate(-50%,-140%) scale(.9) rotate(var(--r,0deg))}}
@media (max-width:420px){.wl-burst{font-size:11px}.wl-stage .wl-burst{margin-top:0}
  .wl-sign{font-size:10px;top:-2%;left:50%;max-width:90%;padding:2px 5px;border-width:1.5px;
    white-space:normal;text-align:center;line-height:1.1}}
/* OPT-IN (CANON_SIGN_BOX=true): Canon sign space x 355-559, y 30-189 of 640 art (covers his face with current art) */
@media (min-width:421px){.nap.wl-canon-sign .wl-sign{left:55.5%;top:4.7%;width:31.9%;height:24.8%;box-sizing:border-box;transform:none;
  display:flex;align-items:center;justify-content:center;text-align:center;white-space:normal}
  .nap.wl-canon-sign.wl-typing .wl-sign{animation-name:wlpulse2}}
@keyframes wlpulse2{0%,100%{transform:scale(1)}50%{transform:scale(1.07)}}
@media (prefers-reduced-motion:reduce){.wl-burst{display:none}.wl-typing .wl-sign{animation:none}}
@media (max-width:340px){.wl-sign{left:63%}} /* clear the Web Design sign at 320 */

/* v5c floor strip at his feet (art y=501), slides with the room, fades via the clip mask */
.wl-floor{position:absolute;top:78.3%;height:3px;pointer-events:none;border-radius:2px;opacity:.75;
  background:repeating-linear-gradient(90deg,transparent 0 46px,rgba(150,110,70,.28) 46px 48px),linear-gradient(#e8d5bc,#dcc4a3)}
.wl-floor.wl-floor-img{background-color:transparent;background-repeat:repeat-x;border-radius:0;opacity:1}
.wl-walker{transform-origin:41.875% 50%} /* flip about x=268 so the walk back stays put */

@media (max-width:640px){
  /* Phone sleep-only: square bed — work-loop viewport is 1.6:1 and stretches sleep art */
  .nap{--a:min(280px,72vw,46vh);--v:var(--a);width:var(--a);height:var(--a);aspect-ratio:1/1}
}
/* v70 constant size. Re-measured with rigid gauges (collar tag, ear width at same view angle): the bed-scene art
   (sleep-cilantro, rise-1..3) is drawn at the SAME scale as stand/walk/sit (sleep ears 46/59/66 art px = sit-type 45/59/68;
   tag stand 18 = sit-type 18; rise-2 ears = turn ears, same 3/4 view). So every factor is 1. The per-frame scale hooks stay
   (desktop only, .wl-sz set by work-loop.js after the phone return), anchored at his feet (x=268, y=501 = floor line). */
.nap.wl-sz{--wlS:1;--wlS2:1;--wlS3:1}
.nap.wl-sz .wl-room > img.wl-bed,.nap.wl-sz .dog,.nap.wl-sz .wl-bedbox > img{transform-origin:41.875% 78.28%}
.nap.wl-sz .wl-room > img.wl-bed,.nap.wl-sz .dog,.nap.wl-sz .wl-bed-empty,.nap.wl-sz .wl-bed-slept,
.nap.wl-sz .wl-bed-front,.nap.wl-sz .wl-bedbox > img.wl-s-1{scale:var(--wlS)}
.nap.wl-sz .wl-bedbox > img.wl-s-2{scale:var(--wlS2)}
.nap.wl-sz .wl-bedbox > img.wl-s-3{scale:var(--wlS3)}
.nap.wl-sz .z{translate:calc(var(--a) * 45.6 / 640 * (var(--wlS) - 1)) calc(var(--a) * -360.2 / 640 * (var(--wlS) - 1))}
