/* A shallow wooden tabletop, with a compact shelf of individual carved bowls. */
.workshop{--wood:url('assets/number-play/workshop-chestnut.webp');--carved-rim:url('assets/number-play/workshop-carved-rim.webp');--sand:url('assets/number-play/workshop-sand.webp');--rim:clamp(25px,2.8vw,40px);--bowl:128px;--mascot-size:106px}
.workshop .game{max-width:1440px;grid-template-columns:minmax(0,1fr);grid-template-rows:70px 54px minmax(120px,1fr) auto 72px;gap:10px;padding:10px clamp(10px,2.5vw,38px) 14px;min-width:0}
.workshop .game::before{background-image:linear-gradient(#fff5,#fff1 55%,#f4dfbd66),url('assets/number-play/workshop-backdrop.webp')}
.workshop .topbar{grid-area:1/1;position:relative;z-index:6;padding-inline:5px}
.workshop .title-art{height:76px;width:min(40vw,260px);position:absolute;left:50%;transform:translateX(-50%)}
.workshop .top-actions{margin-left:auto}.workshop .round-button svg{pointer-events:none}
.workshop .challenge{grid-area:2/1;position:relative;width:100%;justify-content:center;z-index:5}
.workshop .plaque{height:50px;width:220px;background:linear-gradient(#fff7df,#f2e0b8);border:3px solid #674026;border-radius:13px;box-shadow:inset 0 2px #fff9,0 3px 0 #3c221b40;font-size:25px;gap:12px}
.workshop .plaque strong{font-size:38px}
.workshop .stage{grid-area:3/1;min-width:0;padding:12px 0 6px;overflow:visible}
.workshop .board{width:100%;height:100%;max-width:none;max-height:none;border:0;border-radius:32px;background:none;isolation:isolate;transform-origin:0 0;filter:none}
/* Shadow the wooden frame alone; filtering the whole table softens its contents. */
.workshop .board::before{content:'';position:absolute;inset:0;border:var(--rim) solid transparent;border-image:var(--carved-rim) 20% / var(--rim) / 0 stretch;pointer-events:none;z-index:4;filter:drop-shadow(0 6px 2px #71432060)}
.workshop .board::after{content:'';position:absolute;inset:calc(var(--rim)*.5);border-radius:calc(var(--rim)*.7);background:linear-gradient(#fff6,#fff6),var(--sand) center/384px 384px;box-shadow:inset 2px 5px 8px #6b442933;pointer-events:none;z-index:0}
.workshop .play-area{inset:calc(var(--rim) + 22px) calc(var(--rim) + 8px) calc(var(--rim) + 32px);isolation:isolate;overflow:visible;z-index:2}
.workshop .play-area::after{content:'';position:absolute;inset:-12px;pointer-events:none;border-radius:24px;opacity:0;background:linear-gradient(110deg,transparent 35%,#fff8ddaa 48%,transparent 60%);background-size:240% 100%;z-index:500}
.workshop .sand-smoothing::after{animation:sand-sweep .55s ease-in-out}
@keyframes sand-sweep{0%{opacity:0;background-position:100% 0}30%{opacity:.8}100%{opacity:0;background-position:0 0}}
/* The mascot is outside the projected board, with only the hands over the lip. */
.workshop .stage>.mascot{width:var(--mascot-size);height:auto;max-width:none;right:auto;bottom:auto;left:calc(var(--table-left,0px) + var(--table-inset,3.2%) - var(--mascot-size)*.20);top:calc(var(--table-top,12px) - var(--mascot-size)*1.02);z-index:7;transform:rotate(-6deg);transform-origin:65% 95%;filter:drop-shadow(0 2px 1px #39241333)}
.workshop.won .stage>.mascot{animation:peek-wiggle .7s ease-in-out}
@keyframes peek-wiggle{25%{transform:rotate(1deg)}65%{transform:rotate(-10deg)}}
.workshop .live-count{bottom:calc(var(--rim)*.6 + 5px);padding:3px 15px;font-size:21px;min-width:70px;background:#fff9e9;box-shadow:0 2px 3px #74533228;z-index:5}
.workshop .board-feedback{top:calc(var(--rim)*.7);font-size:17px;z-index:500}
/* Screen-space controls stay sharp while the tabletop keeps its perspective. */
.workshop #clear-all{position:absolute;right:calc(100% - var(--table-right,100%) + var(--clear-edge,20px));top:calc(var(--table-top,12px) + var(--clear-offset,9px));z-index:7}
.workshop #clear-all .toy-label{font:500 14px/17px Fredoka,system-ui,sans-serif;text-shadow:none}
.workshop .sand-depth{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:0}
.workshop #pieces{z-index:2}
.workshop .tools{grid-area:4/1;--cube-unit:24px;width:min(100%,var(--tray-width,600px));max-width:704px;min-height:0;padding:0;display:block;height:auto}
.workshop .tray-controls{height:44px;display:flex;align-items:center;justify-content:center;gap:8px;margin:0 4px 6px}
.workshop .orientations{gap:5px;flex-shrink:0}
.workshop .orientations button{display:flex;align-items:center;justify-content:center;gap:4px;min-height:44px;padding:5px 10px;border:2px solid #a77945;border-radius:14px;background:linear-gradient(#fff8e4,#e5c99f);box-shadow:0 2px 0 #7c512836;color:#634329;font-size:15px;white-space:nowrap}
.workshop .orientations button[aria-pressed=true]{background:linear-gradient(#90af68,#678a48);color:white;border-color:#58783b;box-shadow:inset 0 2px 2px #36501e40,0 1px 0 #fff6}
.direction-blocks{display:flex;width:34px;height:30px;align-items:center;justify-content:center;flex-shrink:0;pointer-events:none}
.direction-blocks img{width:16px;height:16px;object-fit:contain;filter:var(--cube-color)}
.direction-blocks.across img+img{margin-left:-5px}.direction-blocks.upright{flex-direction:column;width:22px}.direction-blocks.upright img+img{margin-top:-8px}
.workshop .tray-paging{display:none;gap:2px}.workshop .has-more-bowls .tray-paging{display:flex}
.workshop .tray-paging button{width:44px;height:44px;padding:0;border:1px solid #b48b56;border-radius:13px;background:#f4dfb9;color:#654026;font:32px/1 Fredoka,system-ui}.workshop .tray-paging button:disabled{opacity:.35}
.workshop .piece-tray{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:flex-start;align-items:center;gap:8px;padding:2px;border:12px solid transparent;border-image:var(--carved-rim) 20% / 15px / 0 stretch;border-radius:18px;background:linear-gradient(#fff1,#8b512018),var(--wood) center/384px;background-clip:padding-box;box-shadow:0 4px 4px #603a2330;overflow-x:auto;overflow-y:hidden;touch-action:pan-x;scroll-snap-type:x proximity;height:calc(var(--bowl) + 28px);scrollbar-width:none}
.workshop .piece{display:grid;place-items:center;position:relative;flex:0 0 var(--pocket-width,80px);width:var(--pocket-width,80px);height:var(--bowl);min-width:44px;min-height:var(--bowl);padding:0;border:0;border-radius:18px;background:none;box-shadow:none;touch-action:pan-x;scroll-snap-align:start}
.workshop .pattern-pocket{position:relative;display:block;width:var(--pocket-width);height:var(--pocket-height);border-radius:13px;background:linear-gradient(#a56f3440,#5c2f1640),var(--wood) center/260px;box-shadow:0 2px 2px #3e210b55;pointer-events:none}
.workshop .pattern-pocket::after{content:'';position:absolute;inset:0;border:12px solid transparent;border-image:var(--carved-rim) 20% / 12px / 0 stretch;z-index:3;pointer-events:none}
.workshop .pattern-pocket .pocket-recess{position:absolute;left:50%;top:50%;width:calc((var(--pattern-w) + .24)*var(--cube-unit));height:calc((var(--pattern-h) + .24)*var(--cube-unit));transform:translate(-50%,-50%);overflow:visible;z-index:0}
.workshop .pattern-pocket .pattern-art{position:absolute;inset:auto;left:50%;top:50%;transform:translate(-50%,-50%) translateY(1px);z-index:1}
.workshop .pattern-pocket .pattern-cube{filter:var(--cube-color)}
.workshop .piece::before{display:none}.workshop .piece:active{filter:brightness(1.08);transform:translateY(1px)}.workshop .piece:disabled{opacity:.8}
.workshop .pattern-art{position:relative;display:block;inset:auto;flex:none;width:calc(var(--pattern-w)*var(--cube-unit));height:calc(var(--pattern-h)*var(--cube-unit));max-width:none;max-height:none;pointer-events:none;z-index:1;transform:translateY(var(--press-lift,0px));filter:none}
.workshop .pattern-cube{position:absolute;left:calc((var(--cube-x) + .015)*var(--cube-unit));top:calc((var(--cube-y) - .015)*var(--cube-unit));width:calc(.97*var(--cube-unit));height:calc(.97*var(--cube-unit));max-width:none;max-height:none;object-fit:contain;pointer-events:none;filter:var(--cube-color)}
/* Retain the card cube's original clay relief and richer pigment. The sprite
   already contains its contact shadow; another blurred copy hides fine grain. */
.color-teal{--cube-color:contrast(1.12)}.color-gold{--cube-color:hue-rotate(-130.8deg) saturate(1.38) brightness(1.14) contrast(1.12)}.color-coral{--cube-color:hue-rotate(-168.1deg) saturate(1.12) brightness(1.08) contrast(1.12)}.color-purple{--cube-color:hue-rotate(105.2deg) saturate(.76) brightness(1.06) contrast(1.12)}.color-green{--cube-color:hue-rotate(-63.9deg) saturate(.8) brightness(1.02) contrast(1.12)}.color-blue{--cube-color:hue-rotate(33.8deg) saturate(.86) brightness(1.02) contrast(1.12)}
.workshop .group-hit{padding:0;border:0;background:none;box-shadow:none;overflow:visible;min-width:0;min-height:0;outline-offset:5px;cursor:grab}
.workshop .group-hit .pattern-art,.workshop .drag-ghost .pattern-art{position:absolute;inset:0}
.workshop .group-hit.selected{outline:2px dashed #a8885070;outline-offset:7px}.workshop .group-hit.being-lifted{opacity:0}
.workshop .group-hit.stack-target{outline:3px solid #7f9c50;outline-offset:5px;background:#b9d07b22}
.workshop .group-hit.stacked .pattern-cube{filter:var(--cube-color) drop-shadow(0 2px 1px #3a241e88)}
.workshop .stack-drag-member{position:absolute;pointer-events:none}
.workshop .drag-ghost.can-stack{filter:drop-shadow(0 3px 3px #557e4266)}
.workshop .tools.return-ready{outline:3px solid #7f9c50;outline-offset:4px;border-radius:18px}
.workshop .drag-ghost.can-return{opacity:.68;filter:drop-shadow(0 3px 3px #557e4266)}
.workshop .drag-ghost{filter:drop-shadow(3px 17px 7px #543a2445)}.workshop .drag-ghost .pattern-art{transform:translateY(-7px) scale(1.045)}
.workshop .bottom{grid-area:5/1;grid-template-columns:60px minmax(0,1fr) 60px;align-items:center;max-width:704px}
.workshop .bottom .center-actions{grid-column:auto;grid-row:auto}.workshop .bottom #remove{grid-column:auto;grid-row:auto}
.workshop .message{font-size:15px;min-height:18px;margin-bottom:4px}.workshop .primary{min-height:44px;font-size:20px}
.workshop .toy-button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;flex:0 0 auto;width:60px;height:66px;min-width:44px;min-height:44px;margin:0;padding:0;border:0;border-radius:16px;background:none;box-shadow:none;text-decoration:none;color:#654726;touch-action:manipulation;user-select:none;-webkit-user-select:none}
.workshop .toy-icon{display:block;width:49px;height:49px;object-fit:contain;pointer-events:none;filter:drop-shadow(0 3px 1px #69401840);transform-origin:50% 80%;transition:transform .16s}
.workshop .toy-label{font:700 15px/15px Gaegu,system-ui,sans-serif;white-space:nowrap;pointer-events:none}
.workshop .toy-button:active .toy-icon{transform:translateY(3px) scale(.93)}.workshop .toy-button:disabled{opacity:.45}
.workshop dialog{border-color:#65412a}.workshop dialog h2{padding-right:18px}
/* Beside the bowls, both direction buttons fit in a fixed desktop shelf.
   This returns 62–90 vertical pixels to the sand, even on shorter laptops. */
@media(min-width:850px) and (min-height:571px){
 .workshop{--bowl:112px}
 .workshop .tools{display:flex;align-items:center;gap:12px;width:min(100%,calc(var(--tray-width,600px) + 148px));max-width:856px;height:144px}
 .workshop .tray-controls{flex:0 0 136px;flex-direction:column;justify-content:center;gap:6px;height:144px;margin:0}
 .workshop .orientations{flex-direction:column;width:100%;gap:6px}.workshop .orientations button{width:100%;padding-inline:7px}
 .workshop .tray-paging{justify-content:center}.workshop .piece-tray{flex:1;min-width:0}
}
@media(max-width:849px){.workshop{--bowl:108px}.workshop .tools{max-width:604px}}
@media(max-width:599px){
 .workshop{--bowl:104px;--mascot-size:70px;--rim:25px}
 .workshop .game{grid-template-rows:60px 48px minmax(120px,1fr) auto 64px;gap:8px;padding:5px 10px max(10px,env(safe-area-inset-bottom))}
 .workshop .title-art{height:62px;width:160px;left:46%}.workshop .top-actions{gap:4px}.workshop .top-actions .round-button{width:36px;height:40px}.workshop .round-button svg{width:20px;height:20px}
 .workshop .plaque{height:43px;width:178px;font-size:22px}.workshop .plaque strong{font-size:34px}
 .workshop .stage{padding-top:10px}.workshop .play-area{inset:45px 25px 45px}
 .workshop #clear-all{--clear-edge:13px;--clear-offset:9px;width:48px;height:54px}.workshop #clear-all .toy-icon{width:36px;height:36px}.workshop #clear-all .toy-label{font-size:13px}
 .workshop .live-count{font-size:18px;bottom:18px;padding:2px 12px;min-width:62px}
 .workshop .tray-controls{gap:5px;margin-bottom:4px}.workshop .orientations button{padding:4px 7px;font-size:14px;gap:2px}.workshop .tray-paging{gap:0}
 .workshop .piece-tray{gap:6px;border-width:10px;height:calc(var(--bowl) + 24px)}
 .workshop .bottom{grid-template-columns:48px minmax(0,1fr) 48px;gap:7px}.workshop .toy-button{width:48px;height:58px}.workshop .toy-icon{width:43px;height:43px}.workshop .toy-label{font-size:13px;line-height:13px}
 .workshop .message{font-size:12px;min-height:14px;margin-bottom:3px}.workshop .primary{font-size:17px;min-height:42px;padding:7px 6px}
}
@media(max-width:370px){.workshop .title-art{width:135px;left:44%}.workshop .game{padding-inline:7px}.workshop .direction-blocks{display:none}}
@media(max-height:680px) and (max-width:599px){.workshop{--bowl:90px;--mascot-size:59px;--rim:22px}.workshop .game{grid-template-rows:52px 42px minmax(100px,1fr) auto 57px;gap:6px}.workshop .title-art{height:53px}.workshop .plaque{height:38px}.workshop .stage{padding-top:7px}.workshop .play-area{inset:40px 22px 38px}.workshop .primary{min-height:38px;font-size:15px}.workshop .toy-button{height:53px}.workshop .toy-icon{width:39px;height:39px}.workshop .live-count{bottom:14px}}
@media(max-height:570px) and (min-width:600px){
 .workshop{--bowl:82px;--mascot-size:52px;--rim:25px}
 .workshop .game{grid-template-columns:minmax(0,1fr) 210px;grid-template-rows:52px minmax(100px,1fr) 60px;padding:6px 14px 10px;gap:8px 12px}
 .workshop .topbar{grid-area:1/1/2/3}.workshop .title-art{height:48px;width:142px;left:30%}.workshop .challenge{grid-area:1/1/2/3;width:150px;justify-self:center;margin-left:170px;pointer-events:none}.workshop .plaque{width:138px;height:40px;font-size:20px;pointer-events:auto}.workshop .plaque strong{font-size:29px}
 .workshop .stage{grid-area:2/1;padding-top:10px}.workshop .tools{grid-area:2/2;width:210px;height:100%;min-height:0;padding-top:0;display:grid;grid-template-rows:44px minmax(0,1fr);gap:6px}.workshop .tray-controls{height:44px;margin:0;gap:4px}.workshop .orientations{gap:4px}.workshop .orientations button{font-size:13px;padding:4px 7px}.workshop .direction-blocks{display:none}.workshop .has-more-bowls .tray-paging{display:none}
 .workshop .piece-tray{height:100%;max-height:100%;overflow-y:auto;overflow-x:hidden;touch-action:pan-y;flex-direction:row;flex-wrap:wrap;justify-content:center;align-content:flex-start;padding:2px;gap:6px;border-width:10px;scroll-snap-type:y proximity}.workshop .piece{touch-action:pan-y}
 .workshop .play-area{inset:42px 28px 40px}.workshop .bottom{grid-area:3/1/4/3;max-width:720px}.workshop .message{font-size:12px;min-height:14px}.workshop .primary{font-size:17px;min-height:38px}.workshop .toy-button{height:52px}.workshop .toy-icon{width:38px;height:38px}.workshop .toy-label{font-size:12px}.workshop #clear-all{width:45px;height:50px;--clear-offset:7px;--clear-edge:16px}.workshop #clear-all .toy-icon{width:30px;height:30px}.workshop .live-count{bottom:16px;font-size:17px}
}
@media(prefers-reduced-motion:reduce){.workshop .mascot,.workshop .play-area::after{animation:none!important}.workshop .toy-icon{transition:none}}
