/* The scene is a cabinet sibling: shelf rendering owns only the shelf rows. */
.shelf-theatre{position:absolute;inset:0;z-index:14;pointer-events:none;overflow:visible;contain:layout style}
.sl-theatre-source{visibility:hidden!important}
.sl-theatre-prop-source>svg{visibility:hidden!important}
.shelf-theatre-actor{position:absolute;left:0;top:0;z-index:3;will-change:transform;pointer-events:none}
.shelf-theatre-pose{width:100%;height:100%;transform-origin:50% 100%}
.shelf-theatre-actor .sprite.sl2{width:100%;height:100%;--pet-h:100%;max-width:none}
.shelf-theatre-actor .sprite-figure{filter:drop-shadow(3px 4px 3px rgba(0,0,0,.5)) drop-shadow(-1px -1px 2px var(--key-hi))}
.shelf-theatre-tub{position:absolute;pointer-events:none}
.shelf-theatre-tub svg{width:100%;height:100%;display:block;overflow:visible}
.shelf-theatre-tub-back{z-index:2;filter:drop-shadow(0 4px 3px #0008)}
.shelf-theatre-tub-front{z-index:5}
.shelf-theatre-furniture{position:absolute;z-index:2;transform-origin:50% 100%;filter:drop-shadow(0 4px 3px #0008)}
.shelf-theatre-furniture>svg{width:100%;height:100%;display:block}
.shelf-theatre-crumb{position:absolute;z-index:6;left:0;top:0;width:9px;height:7px;border:1px solid #B17735;border-radius:35% 20% 45% 25%;background:#F3C47A;box-shadow:inset 2px 1px #FFE1A8,0 2px 2px #0008}
[data-action="phone"] .shelf-theatre-furniture[data-active="true"]{animation:theatre-ring .28s ease-in-out 6}
[data-action="meal"] .shelf-theatre-furniture[data-active="true"]{animation:theatre-plate 1.2s ease-in-out infinite}
@keyframes theatre-ring{0%,100%{rotate:-3deg}50%{rotate:3deg}}
@keyframes theatre-plate{0%,100%{translate:0 0}50%{translate:0 -2px}}
.shelf-theatre-splash{position:absolute;z-index:6;width:0;height:0}
.shelf-theatre-splash i{position:absolute;width:5px;height:9px;border-radius:65% 65% 60% 60%;background:#BCF6EB;box-shadow:0 0 3px #E5FFF9;animation:theatre-splash 1.1s ease-out var(--drop-delay) infinite}
@keyframes theatre-splash{0%{translate:0 0;scale:.5;opacity:0}18%{opacity:1}50%{translate:var(--drop-x) var(--drop-rise);scale:1;opacity:.9}100%{translate:var(--drop-x) 9px;scale:.65;opacity:0}}
.shelf-theatre-rope{position:absolute;z-index:4;height:5px;border-radius:50%;background:repeating-linear-gradient(110deg,#BCA77C 0 3px,#E7D4A7 3px 5px);box-shadow:0 2px 2px #0008;rotate:-2deg;transform-origin:left center}
.shelf-theatre-rope::after{content:'';position:absolute;left:47%;top:-4px;width:12px;height:12px;border-radius:50%;border:3px solid #DAC497;background:#B39D77}
.shelf-theatre-symbol{position:absolute;z-index:7;color:var(--mint);font:700 clamp(18px,3vw,30px)/1 var(--body);translate:-50% -50%;text-shadow:0 2px 4px #000;animation:theatre-symbol 1.5s ease-in-out infinite}
.shelf-theatre-speech{position:absolute;z-index:9;box-sizing:border-box;max-width:calc(100% - 16px);padding:9px 12px;border:1px solid #D8C7A44D;border-radius:12px 12px 12px 3px;background:#211D1AF5;color:#F3E9DA;box-shadow:0 5px 16px #0008;font:500 12px/1.4 var(--body);overflow-wrap:anywhere}
.shelf-theatre-speaker{display:block;margin-bottom:3px;color:var(--mint);font-size:10px;letter-spacing:.04em}
.shelf-theatre-spoken{display:block}
[data-action="argument"] .shelf-theatre-symbol{color:var(--pink)}
[data-action="dance"] .shelf-theatre-symbol{color:var(--amber)}
@keyframes theatre-symbol{0%,100%{transform:translateY(0)}50%{transform:translateY(-5px)}}
.shelf-theatre-pose[data-pose="wash"] .sl-part[data-part="arm"]{animation:armwalk .3s ease-in-out infinite}
.shelf-theatre-pose[data-pose="wash"] .sl-part[data-part="tail"]{animation:tailwag .5s ease-in-out infinite}
.shelf-theatre-pose:is([data-pose="dance"],[data-pose="mirror"]) .sl-part[data-part="arm"]{animation:arm-lift 1.3s ease-in-out infinite alternate}
.shelf-theatre-pose[data-pose="dance"] .sl-part[data-part="leg"]{animation:legwalk .55s ease-in-out calc(var(--sl-ph,0) * .55s) infinite}
.shelf-theatre-pose:is([data-pose="pull"],[data-pose="comfort"],[data-pose="switch"]) .sl-part[data-part="arm"]{animation:theatre-reach .8s ease-out forwards}
@keyframes theatre-reach{from{rotate:0deg}to{rotate:calc(-70deg * var(--sl-dir,1))}}
.shelf-theatre-pose[data-pose="argue"] .sl-part[data-part="arm"]{animation:arm-lift .7s ease-in-out infinite alternate}
.shelf-theatre-pose[data-pose="argue"] .sl-part[data-part="mouth"]{animation:chomp-mouth .3s ease-in-out infinite;transform-box:fill-box;transform-origin:center}
.shelf-theatre-pose:is([data-pose="receive"],[data-pose="wash"]) .sl-part[data-part="eye"]{scale:1 .6}
.shelf-theatre-pose[data-pose="eat"] .sl-part[data-part="arm"]{animation:arm-feed 1.2s ease-in-out infinite}
.shelf-theatre-pose[data-pose="eat"] .sl-part[data-part="mouth"]{animation:chomp-mouth .3s ease-in-out infinite;transform-box:fill-box;transform-origin:center}
.shelf-theatre-pose[data-pose="phone"] .sl-part[data-part="arm"]{animation:arm-lift .6s ease-out forwards}

/* The transient override reenacts the previous state; saved state wins again
   as soon as the scene cleans up. The prop card can use the same attributes. */
[data-prop="lamp"][data-theatre-lit="false"]::before,
[data-prop="lamp"][data-lit="false"]:not([data-theatre-lit])::before{opacity:0;animation:none}
[data-prop="lamp"][data-theatre-lit="false"] svg,
[data-prop="lamp"][data-lit="false"]:not([data-theatre-lit]) svg{filter:brightness(.5) saturate(.4)}
[data-prop="lamp"][data-theatre-lit="false"] svg>circle,
[data-prop="lamp"][data-lit="false"]:not([data-theatre-lit]) svg>circle{opacity:0}
[data-prop="lamp"][data-theatre-lit="false"]::after,
[data-prop="lamp"][data-lit="false"]:not([data-theatre-lit])::after{background:radial-gradient(ellipse,rgba(0,0,0,.55),transparent 65%)}

.shelf-theatre-still *, .shelf-theatre-still *::before,.shelf-theatre-still *::after{animation:none!important;transition:none!important}
.shelf-theatre-still .shelf-theatre-actor{will-change:auto}
@media(prefers-reduced-motion:reduce){.shelf-theatre *, .shelf-theatre *::before,.shelf-theatre *::after{animation:none!important;transition:none!important}.shelf-theatre-splash{display:none}}
