/* One small wall, one light, one invitation at a time. */
body.room-adventure.shadow-magic-active{background:#e6e1d6!important}
body.shadow-magic-active .story-world-backdrop,body.shadow-magic-active #playScreen .story-window{display:none!important}
body.shadow-magic-active #playScreen .play-world{display:block!important;height:100%!important;padding:0!important}
body.shadow-magic-active #gameBoard{width:100%;height:100%!important;padding:0!important;background:none!important;border:0!important;box-shadow:none!important;gap:0!important;overflow:hidden!important}
body.shadow-magic-active #gameBoard .mini-heading{position:absolute;right:2%;top:2%;z-index:20;justify-content:flex-end}
body.shadow-magic-active #gameBoard .mini-heading .eyebrow,body.shadow-magic-active #feedback{display:none!important}
body.shadow-magic-active #roundBoard.sm-host{display:block!important;height:100%;padding:0!important;overflow:visible!important}
.sm-scene{position:relative;width:100%;height:100%;isolation:isolate;overflow:hidden;color:#193c45}
.sm-instruction{position:absolute!important;top:6%;left:8%;right:8%;margin:0!important;text-align:center;z-index:8;font:700 clamp(25px,3.2vw,43px)/1.18 Froople,'Trebuchet MS',sans-serif!important;color:#244854!important;paint-order:stroke fill;-webkit-text-stroke:3px #fff6e1;text-shadow:0 2px 4px #fff9e5;pointer-events:none}
.sm-stage{position:absolute;left:50%;top:56%;translate:-50% -50%;width:min(100%,calc((100dvh - 170px)*1.5));aspect-ratio:3/2;background:#d6c5a8 url('art/shadow-stage-v1.webp') center/100% 100%;border-radius:30px;box-shadow:0 15px 35px #69523716;overflow:hidden;isolation:isolate;touch-action:none;user-select:none}
.sm-wall{position:absolute;inset:2% 3% 25%;overflow:hidden;border-radius:22px;touch-action:none;--spot-x:50%;--spot-y:70%;outline-offset:-5px}
.sm-glow{position:absolute;inset:0;background:radial-gradient(ellipse at 50% 52%,#fff5c6b8 0,#ffedb24a 40%,transparent 73%);pointer-events:none}
.sm-beam{position:absolute;left:27%;right:27%;top:32%;bottom:5%;background:linear-gradient(0deg,#ffedab90,#fff5c021);clip-path:polygon(48% 100%,52% 100%,100% 0,0 0);pointer-events:none;filter:blur(3px);z-index:-1}
.sm-scene button{padding:0!important;min-width:0;min-height:0;border:0!important;border-radius:0;background:transparent!important;box-shadow:none!important;touch-action:none;cursor:grab}
.sm-scene button:focus-visible,.sm-wall:focus-visible{outline:4px solid #2b92bd!important;outline-offset:5px}
.sm-scene button:active{cursor:grabbing}
.sm-scene svg{display:block;width:100%;height:100%;pointer-events:none}
.sm-torch{position:absolute;left:50%;top:82%;translate:-50% -20%;width:8%;height:23%;z-index:6;filter:drop-shadow(0 5px 4px #3d494c40)}
.sm-size-shadow,.sm-size-goal{position:absolute;left:50%;top:48%;width:26%;aspect-ratio:1;translate:-50% -50%;transform:scale(var(--shadow-scale,1));color:#35404de0;transform-origin:center;filter:blur(.6px);pointer-events:none}
.sm-size-goal{transform:scale(var(--goal-scale,1.95));color:transparent;filter:none;z-index:1}
.sm-size-goal path{stroke:#fff7d5;stroke-width:1.9;stroke-dasharray:4 4;stroke-linejoin:round}
.sm-toy{position:absolute;left:50%;top:68%;translate:-50% -50%;width:10%;height:16%;color:#717f9c;filter:drop-shadow(0 5px 0 #647591)}
.sm-depth-guide{position:absolute;left:59%;top:70%;height:25%;display:flex;flex-direction:column;align-items:center;justify-content:space-between;color:#fff8dd;font:700 30px/1 sans-serif;pointer-events:none}
.sm-depth-guide i{height:45%;border-left:3px dotted #fff4d7}
.sm-depth-guide span{animation:sm-breathe 1.7s ease-in-out infinite}
.sm-detect-wall{background:#34424c30;cursor:crosshair}
.sm-detect-wall .sm-glow{background:radial-gradient(circle at var(--spot-x) var(--spot-y),#fff6bff5 0,#ffecb3cb 10%,#ffefb230 19%,transparent 25%)}
.sm-animal-layer{position:absolute;inset:0;pointer-events:none}
.sm-dim{color:#303b512b}
.sm-lit{color:#293c50;clip-path:circle(14% at var(--spot-x) var(--spot-y))}
.sm-animal{position:absolute;width:22%;aspect-ratio:1;translate:-50% -50%;transition:color .3s,filter .3s}
.sm-stage[data-found='cat'] [data-animal='cat'],.sm-stage[data-found='bat'] [data-animal='bat'],.sm-stage[data-found='dog'] [data-animal='dog']{color:#a8703d;filter:drop-shadow(0 0 10px #fff4ab);animation:sm-happy .7s ease-in-out 2}
.sm-stage[data-found] .sm-lit{clip-path:none}
.sm-stage[data-found] .sm-lit .sm-animal{opacity:.18}
.sm-stage[data-found='cat'] .sm-lit [data-animal='cat'],.sm-stage[data-found='bat'] .sm-lit [data-animal='bat'],.sm-stage[data-found='dog'] .sm-lit [data-animal='dog']{opacity:1}
.sm-hand,.sm-hand-dock{position:absolute!important;width:16%;height:26%;top:69%;translate:-50% -50%;color:#42617b;z-index:7;transition:left .12s,top .35s,filter .2s}
.sm-hand.sm-left{left:20%}.sm-hand.sm-right{left:80%}
.sm-hand-dock{top:73%;color:#fff4c1a1;z-index:3}
.sm-hand-dock.sm-left{left:43%}.sm-hand-dock.sm-right{left:57%}
.sm-hand-dock path{fill:none;stroke:currentColor;stroke-width:3;stroke-dasharray:7 6}
.sm-hand.sm-seated{top:73%;left:43%;color:#3c5068}
.sm-hand.sm-right.sm-seated{left:57%}
.sm-hand.sm-selected,.sm-hand.sm-held{filter:drop-shadow(0 0 6px #fff3b6);z-index:9;transition:none}
.sm-hand:not(.sm-seated){animation:sm-breathe 2s infinite ease-in-out}
.sm-both-hands .sm-hand{animation:none}
.sm-both-hands:not(.sm-success):after{content:'↔';position:absolute;left:50%;top:74%;translate:-50% -50%;color:#fff9de;font:700 32px/1 sans-serif;pointer-events:none}
.sm-bird{position:absolute;width:48%;aspect-ratio:4/3;left:50%;top:48%;translate:-50% -50%;color:#273847;fill:currentColor;opacity:.09;transition:opacity .6s;pointer-events:none;filter:blur(.3px)}
.sm-bird.sm-bird-visible{opacity:.95}
.sm-wing{transform-box:view-box;transform-origin:50% 59%;transition:transform .1s}
.sm-wing-left{transform:rotate(var(--wing-angle,38deg))}.sm-wing-right{transform:rotate(calc(-1*var(--wing-angle,38deg)))}
.sm-success .sm-size-goal{opacity:0}.sm-success .sm-depth-guide{display:none}
.sm-success .sm-size-shadow{color:#355367;filter:drop-shadow(0 0 12px #fff3bb)}
.sm-flying .sm-wing{animation:sm-flap .5s ease-in-out infinite alternate}
.sm-flying .sm-wing-right{animation-direction:alternate-reverse}
.sm-access-status{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.sm-paused *{animation-play-state:paused!important}
@keyframes sm-breathe{50%{filter:drop-shadow(0 0 7px #fff5c4);opacity:.65}}
@keyframes sm-happy{50%{translate:-50% -56%}}
@keyframes sm-flap{from{transform:rotate(-15deg)}to{transform:rotate(30deg)}}
@media(max-width:600px){.sm-instruction{top:11%;left:3%;right:3%;font-size:29px!important}.sm-stage{top:57%;width:100%;aspect-ratio:1/1.25;background-size:auto 100%;border-radius:24px}.sm-wall{inset:3% 2% 28%}.sm-torch{width:14%;height:24%}.sm-size-shadow,.sm-size-goal{width:30%}.sm-toy{width:15%}.sm-hand,.sm-hand-dock{width:22%;height:23%}.sm-bird{width:72%}.sm-animal{width:28%}.sm-depth-guide{left:66%}.sm-lit{clip-path:circle(19% at var(--spot-x) var(--spot-y))}}
@media(prefers-reduced-motion:reduce){.sm-scene *{animation:none!important;transition:none!important}}
body.reduce-motion .sm-scene *{animation:none!important;transition:none!important}

/* Bedtime theatre: explicit outer grid placement keeps the wall inside the viewport. */
body.room-adventure.shadow-magic-active{background:#0c1128!important}
body.room-adventure.shadow-magic-active #gameBoard{grid-template-rows:minmax(0,1fr)!important;grid-template-columns:minmax(0,1fr)!important;min-height:0!important}
body.room-adventure.shadow-magic-active #gameBoard>#roundBoard.sm-host{grid-area:1 / 1 / 2 / 2!important;align-self:stretch!important;height:100%!important;min-height:0!important;overflow:hidden!important}
body.room-adventure.shadow-magic-active #gameBoard .mini-heading{top:8px;right:12px;z-index:30;min-height:44px}
body.room-adventure.shadow-magic-active #roundCount{color:#fff1cc!important;background:#252c52e6!important;border:1px solid #a59fbe80;border-radius:24px;padding:7px 12px;font-size:14px}
body.room-adventure.shadow-magic-active #listen{width:48px;min-width:48px;min-height:44px;padding:4px}
body.room-adventure.shadow-magic-active .sm-scene{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);gap:10px;min-height:0;height:100%;padding:60px 12px 12px;box-sizing:border-box;background:radial-gradient(ellipse at 50% 65%,#26264a,#0c1128 75%);color:#fff0cc}
body.room-adventure.shadow-magic-active .sm-instruction{position:relative!important;inset:auto!important;grid-row:1;margin:0!important;align-self:center;line-height:1.12!important;font-size:clamp(26px,3vw,42px)!important;color:#fff3d1!important;-webkit-text-stroke:0!important;text-shadow:0 3px 12px #000b;z-index:10}
body.room-adventure.shadow-magic-active .sm-stage{position:relative;grid-row:2;inset:auto;translate:none;align-self:stretch;justify-self:center;width:100%;height:100%;min-height:0;max-width:1120px;aspect-ratio:auto;margin:0;background:#141d38 url('art/shadow-night-room-v2.webp') center bottom/cover no-repeat;border:1px solid #ac9dca40;border-radius:26px;box-shadow:0 12px 35px #02051280,inset 0 0 80px #03071f88;container-type:size}
.sm-stage::before{content:'';position:absolute;inset:0;z-index:0;pointer-events:none;background:radial-gradient(ellipse at 50% 45%,transparent 25%,#060b2755 100%)}
.sm-night-friends{position:absolute;left:2%;bottom:1%;width:clamp(90px,20cqw,190px);height:20%;object-fit:contain;object-position:left bottom;z-index:4;pointer-events:none;user-select:none;filter:brightness(.8) drop-shadow(0 5px 8px #050718);transform-origin:50% 100%}
body.room-adventure.shadow-magic-active .sm-wall{inset:5% 4% 30%;z-index:3;background:transparent;border-radius:35%;overflow:hidden}
body.room-adventure.shadow-magic-active .sm-glow{background:radial-gradient(ellipse at 50% 48%,#fff0b8f2 0,#ffe5a2df 26%,#f5cf8266 45%,transparent 69%);filter:blur(1px);opacity:1;transition:opacity .5s}
body.room-adventure.shadow-magic-active .sm-beam{left:17%;right:17%;top:8%;bottom:24%;z-index:2;transform-origin:50% 100%;background:linear-gradient(0deg,#ffe4a153,#ffe6b617);clip-path:polygon(49% 100%,51% 100%,100% 0,0 0);filter:blur(3px);opacity:.75;transition:rotate .16s linear,bottom .12s linear}
.sm-stage:not(.sm-light-awake) :is(.sm-glow,.sm-beam){opacity:.08}
.sm-light-awake .sm-glow{animation:sm-night-light 1.25s ease-out both}.sm-light-awake .sm-beam{animation:sm-night-beam 1.5s ease-out both}
.sm-light-motes{position:absolute;inset:0;overflow:hidden;pointer-events:none}
.sm-light-motes i{position:absolute;left:calc(12% + var(--mote)*11%);top:calc(10% + var(--mote)*9%);width:3px;height:3px;border-radius:50%;background:#fff1bf;box-shadow:0 0 9px #ffe4ab;animation:sm-night-dust 5s ease-in-out infinite alternate;animation-delay:calc(var(--mote)*-.65s);opacity:.35}
body.room-adventure.shadow-magic-active .sm-size-shadow,body.room-adventure.shadow-magic-active .sm-size-goal{width:min(27cqw,28cqh);color:#10152cee;filter:blur(.8px);top:48%}
body.room-adventure.shadow-magic-active .sm-size-goal{color:transparent;filter:none;opacity:.7}.sm-light-awake .sm-size-shadow{animation:sm-night-shadow 1.3s ease-out both}
body.room-adventure.shadow-magic-active .sm-size-goal path{stroke:#fff7d5;stroke-width:1.5;stroke-dasharray:3 5}
body.room-adventure.shadow-magic-active .sm-toy{top:68%;width:clamp(42px,10cqw,90px);height:15%;color:#d7a878;filter:drop-shadow(0 3px 0 #896044) drop-shadow(0 0 10px #ffe5a355);z-index:5}
body.room-adventure.shadow-magic-active .sm-torch{top:80%;width:clamp(46px,9cqw,72px);height:18%;min-height:44px;min-width:44px;z-index:8;filter:drop-shadow(0 0 12px #ffe1a860) drop-shadow(0 4px 5px #04071499)}
body.room-adventure.shadow-magic-active .sm-depth-guide{left:63%;top:70%;height:22%;font-size:27px;color:#fff0bd}
body.room-adventure.shadow-magic-active .sm-detect-wall .sm-glow{background:radial-gradient(circle at var(--spot-x) var(--spot-y),#fff2c1 0,#ffe5a6e6 11%,#f7d49066 18%,transparent 26%);filter:blur(.6px)}
body.room-adventure.shadow-magic-active .sm-dim{color:#0a102a;opacity:.1}
body.room-adventure.shadow-magic-active .sm-lit{color:#12162b;clip-path:circle(16% at var(--spot-x) var(--spot-y))}
body.room-adventure.shadow-magic-active .sm-animal{width:22%;filter:blur(.5px)}
body.room-adventure.shadow-magic-active .sm-stage[data-found] .sm-lit{clip-path:none}
body.room-adventure.shadow-magic-active .sm-stage[data-found='cat'] .sm-lit [data-animal='cat'],body.room-adventure.shadow-magic-active .sm-stage[data-found='bat'] .sm-lit [data-animal='bat'],body.room-adventure.shadow-magic-active .sm-stage[data-found='dog'] .sm-lit [data-animal='dog']{color:#f6cf86;opacity:1;filter:drop-shadow(0 0 12px #fff1b7);animation:sm-night-found .9s ease-in-out 2}
body.room-adventure.shadow-magic-active .sm-hand,body.room-adventure.shadow-magic-active .sm-hand-dock{width:16%;height:25%;top:68%;color:#e2b884;filter:drop-shadow(0 0 5px #ffdf9c66);min-width:44px;min-height:44px}
body.room-adventure.shadow-magic-active .sm-hand-dock{top:70%;color:#ffe5a29c;filter:none}
body.room-adventure.shadow-magic-active .sm-hand.sm-seated{top:70%;color:#dcb084}
body.room-adventure.shadow-magic-active .sm-bird{width:min(62cqw,66cqh);color:#11162b;filter:blur(.4px)}
body.room-adventure.shadow-magic-active .sm-success .sm-bird{filter:drop-shadow(0 0 9px #ffe1a6)}
.sm-night-sparks{position:absolute;inset:0;z-index:9;pointer-events:none;overflow:hidden}
.sm-night-spark{position:absolute;left:50%;top:38%;opacity:0;color:#ffe6a7;font-size:clamp(17px,3cqw,28px);text-shadow:0 0 12px #ffcf7a}
.sm-success .sm-night-spark{animation:sm-night-spark 1.25s ease-out var(--spark-delay) both}.sm-success .sm-night-friends{animation:sm-night-cheer .6s ease-in-out 3;filter:brightness(1) drop-shadow(0 0 10px #ffe1a655)}
@keyframes sm-night-light{from{opacity:.05;filter:blur(12px)}to{opacity:1;filter:blur(1px)}}
@keyframes sm-night-beam{from{opacity:0}to{opacity:.75}}
@keyframes sm-night-shadow{from{opacity:0;filter:blur(8px)}to{opacity:1;filter:blur(.8px)}}
@keyframes sm-night-dust{to{translate:10px -22px;opacity:.7}}
@keyframes sm-night-found{50%{translate:-50% -56%;scale:1.06}}
@keyframes sm-night-cheer{50%{transform:translateY(-6px) rotate(-2deg)}}
@keyframes sm-night-spark{0%{opacity:0;transform:translate(0,10px) scale(.2)}25%{opacity:1}100%{opacity:0;transform:translate(var(--spark-x),var(--spark-y)) scale(.8)}}
@media(max-width:600px){body.room-adventure.shadow-magic-active .sm-scene{padding:56px 6px 6px;gap:8px}body.room-adventure.shadow-magic-active .sm-instruction{font-size:clamp(25px,7vw,32px)!important}body.room-adventure.shadow-magic-active .sm-stage{border-radius:20px}body.room-adventure.shadow-magic-active .sm-wall{inset:5% 3% 30%}body.room-adventure.shadow-magic-active .sm-animal{width:28%}body.room-adventure.shadow-magic-active .sm-hand,body.room-adventure.shadow-magic-active .sm-hand-dock{width:23%;height:24%}.sm-night-friends{height:19%;width:28%}}
@media(orientation:landscape) and (max-height:540px){body.room-adventure.shadow-magic-active .sm-scene{padding:4px 8px;gap:2px}body.room-adventure.shadow-magic-active .sm-instruction{font-size:24px!important;padding-right:180px;padding-left:24px}body.room-adventure.shadow-magic-active .sm-stage{border-radius:16px}body.room-adventure.shadow-magic-active .sm-wall{inset:2% 5% 28%}.sm-night-friends{height:22%;width:17%}body.room-adventure.shadow-magic-active .sm-torch{height:20%;width:44px}}
@media(prefers-reduced-motion:reduce){.sm-scene *{animation:none!important;transition:none!important}}
body.reduce-motion .sm-scene *{animation:none!important;transition:none!important}

body.room-adventure.shadow-magic-active .sm-stage:not(.sm-light-awake) :is(.sm-glow,.sm-beam){opacity:.08}
body.room-adventure.shadow-magic-active .sm-success .sm-size-goal{opacity:0}
body.room-adventure.shadow-magic-active .sm-success .sm-size-shadow{color:#161b34;filter:drop-shadow(0 0 12px #ffe5aa)}
body.room-adventure.shadow-magic-active .sm-hand:is(.sm-selected,.sm-held){filter:drop-shadow(0 0 9px #ffe3a1);outline:2px solid #ffe5b1;outline-offset:3px}


.sm-torch-depth{--torch-cue-direction:-1}
.sm-torch-depth.sm-small-goal{--torch-cue-direction:1}
.sm-depth-hint{position:absolute;inset:5% auto auto 50%;width:clamp(24px,5cqw,38px);aspect-ratio:1;translate:-50% -32%;display:grid;place-items:center;color:#503f33;background:#ffe3a2;border:2px solid #fff4cf;border-radius:50%;box-shadow:0 0 18px #ffe29e;pointer-events:none;animation:torch-cue 1.55s ease-in-out infinite}
.sm-depth-hint svg{width:62%;height:62%;transform:scaleY(calc(-1 * var(--torch-cue-direction)));fill:none;stroke:currentColor;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.sm-success .sm-depth-hint,.sm-torch-dragging .sm-depth-hint{opacity:0;animation:none}
@keyframes torch-cue{0%,100%{transform:translateY(0)}46%{transform:translateY(calc(10px * var(--torch-cue-direction)));box-shadow:0 0 24px 5px #ffe29edd}}
@media(prefers-reduced-motion:reduce){.sm-depth-hint{animation:none}}
body.reduce-motion .sm-depth-hint{animation:none}
