/* Cast. By Luke Steuber. */
@font-face{font-family:"Plex Mono";src:url("./fonts/IBMPlexMono-500.woff2") format("woff2");font-weight:500;font-display:swap}
@font-face{font-family:"Plex Sans";src:url("./fonts/IBMPlexSans-400.woff2") format("woff2");font-weight:400;font-display:swap}
:root{color-scheme:light;--bg:#fff;--ink:#000;--text:#111;--sub:#5e5e5e;--line:#c7c7c7;--edge:#747474;--wall:#f7f7f7;--floor:#fafafa;--plinth:#e4e4e4;--shadow:#929292;--top:#e9e9e9;--left:#bcbcbc;--right:#d1d1d1;--scrim:rgba(255,255,255,.84);--mono:"Plex Mono",monospace;--sans:"Plex Sans",sans-serif}
*{box-sizing:border-box;border-radius:0}html,body{touch-action:manipulation}body{margin:0;height:100dvh;overflow:hidden;background:var(--bg);color:var(--text);font:16px/1.45 var(--sans);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}button,select{font:inherit;color:inherit}button{cursor:pointer}button:disabled{opacity:.35;cursor:default}button:focus-visible,select:focus-visible{outline:2px solid var(--ink);outline-offset:2px}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.readout{position:fixed;top:max(16px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);font:500 13px/1 var(--mono);letter-spacing:.02em;color:var(--sub);font-variant-numeric:tabular-nums;white-space:nowrap}#restart-btn{position:fixed;top:max(0px,env(safe-area-inset-top));left:8px;z-index:2;color:var(--sub)}
#board-shell{position:absolute;inset:max(52px,env(safe-area-inset-top)) 8px max(60px,env(safe-area-inset-bottom));display:grid;place-items:center;touch-action:none}#stage{width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center}#board{display:block;flex:none;overflow:visible;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;outline:none;cursor:crosshair}#completion{height:48px;min-height:48px;display:flex;justify-content:center;align-items:center;width:100%}
#board polygon,#board path,#board line{vector-effect:non-scaling-stroke;stroke-linejoin:miter}.wall{fill:var(--wall);stroke:var(--line);stroke-width:1}.wall-grid{stroke:var(--line);stroke-width:.6;fill:none}.plinth-side{fill:var(--plinth);stroke:var(--edge);stroke-width:1}.square{fill:var(--floor);stroke:var(--line);stroke-width:1}.target{fill:url(#hatch);stroke:none}.target-outline{fill:none;stroke:var(--edge);stroke-width:1.3}.hatch-line{stroke:var(--edge);stroke-width:.012;vector-effect:none!important}.cast-shadow{fill:var(--shadow);stroke:none}.footprint{fill:url(#hatch);stroke:var(--edge);stroke-width:1}.footprint.filled{fill:var(--shadow)}.cube-top{fill:var(--top)}.cube-left{fill:var(--left)}.cube-right{fill:var(--right)}.cube-face{stroke:var(--edge);stroke-width:1}.wrong-base,.wrong-cross{fill:none;stroke:var(--ink);stroke-width:2.5}.wrong-cross{stroke-width:1.6}.focus-ring,.hint-ring,.hover-ring{fill:none;stroke:var(--ink);stroke-width:2;pointer-events:none}.focus-ring{stroke-width:3}.hint-ring{stroke-dasharray:5 4;stroke-width:2.5}.hover-ring{stroke-opacity:.65}.hint-ghost{fill:none;stroke:var(--ink);stroke-width:1.5;stroke-dasharray:4 3;pointer-events:none}.tray-line{stroke:var(--line);stroke-width:1;fill:none}.finish-ink{fill:var(--ink);stroke:none;pointer-events:none}.tray-cube{pointer-events:none}.refused .cube-face{stroke:var(--ink);stroke-width:2}.tray.refused .tray-line{stroke:var(--ink);stroke-width:2}
.toolbar{position:fixed;bottom:max(6px,env(safe-area-inset-bottom));left:8px;right:8px;display:flex;justify-content:space-between}.toolbar>div{display:flex}.ib{display:inline-grid;place-items:center;width:48px;height:48px;min-width:48px;min-height:48px;border:0;background:none;padding:12px;color:var(--ink)}.ib svg{width:24px;height:24px;stroke:currentColor;fill:none;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}.ib:active{transform:scale(.94)}.ib[hidden]{display:none}
.sheet{width:min(32rem,calc(100vw - 16px));max-height:calc(100dvh - 16px);border:1px solid var(--ink);padding:0;background:var(--bg);color:var(--text)}.sheet[open]{display:flex;flex-direction:column}.sheet::backdrop{background:var(--scrim)}.sheet-head{display:flex;justify-content:space-between;align-items:center;padding:8px 16px;gap:12px;flex:none;border-bottom:1px solid var(--line)}h2{font:500 16px/1.3 var(--mono);margin:0}.sheet-head form{margin:0}.sheet-x{width:44px;height:44px;min-width:44px;min-height:44px;padding:10px}.sheet-body{padding:20px 24px;overflow:auto;min-height:0;overscroll-behavior:contain}.sheet-body p{margin:0 0 16px}.sheet-body p:last-child{margin-bottom:0}.row{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:52px;border-bottom:1px solid var(--line)}.row select{max-width:65%;min-height:44px;background:var(--bg);border:0;padding:4px 8px}.sheet-foot{padding:12px 24px;border-top:1px solid var(--line);flex:none;color:var(--sub);font-size:14px}.sheet-foot a{color:inherit;text-decoration:none}.sheet-foot a:focus-visible{outline:2px solid var(--ink)}
@media(orientation:landscape) and (max-height:500px){#board-shell{inset:38px 72px 6px 56px}.toolbar{left:auto;right:8px;top:8px;bottom:8px;flex-direction:column;width:48px}.toolbar>div{flex-direction:column}.readout{left:calc(50% - 8px)}#completion{height:44px;min-height:44px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}:root[data-motion=reduce] *{animation:none!important;transition:none!important}
@media(forced-colors:active){:root{--bg:Canvas;--ink:CanvasText;--text:CanvasText;--edge:CanvasText;--shadow:GrayText;--line:GrayText;--top:Canvas;--left:GrayText;--right:Canvas;--wall:Canvas;--floor:Canvas;--plinth:Canvas}.cube-face{forced-color-adjust:none}}

/* A lifted cube keeps its source and landing visible without changing the board. */
.lifted-source{visibility:hidden}.carried-cube,.landing-ghost,.returning-cube,.tray-slot,[data-preview-wall]{pointer-events:none}.carried-cube .cube-face,.returning-cube .cube-face{stroke-width:1.2}.landing-ghost .cube-face,.tray-slot .cube-face{fill:none;stroke:var(--ink);stroke-width:1.3;stroke-opacity:.55}.tray-slot .cube-face{stroke-width:.8}.landing-ring{fill:none;stroke:var(--ink);stroke-width:2;pointer-events:none}.refused-ring{stroke-dasharray:3 3}.contact-shadow,.source-shadow{fill:var(--ink);stroke:none;opacity:.16;filter:blur(3px);pointer-events:none}.source-shadow{opacity:.12}.preview-shadow{fill:#cfcfcf;stroke:none}.preview-hatch{opacity:.85}#board:has(.carried-cube){cursor:grabbing}

@media(forced-colors:active){.preview-shadow{fill:Canvas;stroke:GrayText;stroke-dasharray:3 3}.contact-shadow,.source-shadow{filter:none;fill:GrayText}.landing-ghost .cube-face{stroke:Highlight}}
