@font-face{font-family:Plex Mono;src:url('./fonts/IBMPlexMono-500.woff2')}@font-face{font-family:Plex Sans;src:url('./fonts/IBMPlexSans-400.woff2')}
:root{color-scheme:light;--bg:#fff;--ink:#000;--text:#111;--sub:#5e5e5e;--line:#d4d4d4;--guide:#8f8f8f;--frame:#1c1c1c;--band:rgba(0,0,0,.05);--scrim:rgba(255,255,255,.84);--wash:rgba(0,0,0,.05)}
html[data-theme=dark]{color-scheme:dark;--bg:#000;--ink:#fff;--text:#ededed;--sub:#a6a6a6;--line:#2f2f2f;--frame:#ededed;--band:rgba(255,255,255,.06);--scrim:rgba(0,0,0,.8);--wash:rgba(255,255,255,.06)}
@media(prefers-color-scheme:dark){:root:not([data-theme=light]){color-scheme:dark;--bg:#000;--ink:#fff;--text:#ededed;--sub:#a6a6a6;--line:#2f2f2f;--frame:#ededed;--band:rgba(255,255,255,.06);--scrim:rgba(0,0,0,.8);--wash:rgba(255,255,255,.06)}}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:var(--bg);color:var(--text)}
body{height:100svh;display:grid;grid-template-rows:56px minmax(0,1fr) 68px;font:16px/1.45 'Plex Sans',sans-serif;overflow:hidden;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
button,select{font:inherit;color:inherit}button{touch-action:manipulation;cursor:pointer;-webkit-tap-highlight-color:transparent}
header{display:flex;align-items:center;justify-content:center;padding:4px 16px;position:relative}header .ib{position:absolute;left:8px}
#readout{font:500 13px/1 'Plex Mono',monospace;color:var(--sub);letter-spacing:.02em;font-variant-numeric:tabular-nums}
main{position:relative;display:grid;grid-template-rows:minmax(0,1fr) auto;min-height:0;min-width:0;overflow:hidden;padding:8px 14px 12px}
#stage{position:relative;width:100%;height:100%;min-height:0;max-width:960px;justify-self:center}
#board{position:absolute;inset:0;width:100%;height:100%;overflow:visible;outline:none}
/* The figure: ink tiles, one hairline seam between them. Hatched tiles are the part the cut glyph removes. */
.cell{fill:var(--ink)}.cell.marked{fill:url(#hatch);stroke:var(--ink);stroke-width:1.5}
.hatch-line{stroke:var(--ink);stroke-width:1.6}.hatch-bg{fill:var(--bg)}
.ghost{fill:var(--ink);opacity:.35}
/* The target: an empty slot with a firm outline and faint seams; filled once the figure arrives. */
.slot{fill:var(--band)}.seam{stroke:var(--line);stroke-width:1;fill:none}
.outline{fill:none;stroke:var(--ink);stroke-width:2;stroke-linejoin:miter;stroke-linecap:square}
#fig-pos{transition:transform .7s cubic-bezier(.3,.7,.2,1)}
/* Glyphs: four ink pieces with a hairline frame. A ring marks the chosen one; a dashed ring is the hint. */
#tray{display:flex;justify-content:center;gap:12px;padding:8px 0 0;min-height:80px}
#tray.spent{visibility:hidden}
.glyph{width:64px;height:64px;padding:0;display:grid;place-items:center;border:1px solid var(--line);border-radius:0;background:none;color:var(--ink)}
.glyph svg{width:44px;height:44px;fill:none;stroke:currentColor;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.glyph .solid{fill:currentColor;stroke:none}.glyph .dash{stroke-dasharray:2.5 2.5}
.glyph:active{transform:scale(.94)}
.glyph[aria-disabled=true]{opacity:.35;cursor:default}
.glyph:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
.glyph[data-picked]{outline:2px solid var(--ink);outline-offset:4px}
.glyph[data-hint]{outline:2px dashed var(--ink);outline-offset:4px}
@media(hover:hover) and (pointer:fine){.glyph:hover:not([aria-disabled=true]){background:var(--wash)}}
.ib{height:48px;width:48px;border:0;background:none;border-radius:0;padding:12px;display:inline-grid;place-items:center}
.ib svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linejoin:round;stroke-linecap:round}
.ib:active{transform:scale(.94)}
@media(hover:hover) and (pointer:fine){.ib:hover{background:var(--wash)}}
.ib:focus-visible,select:focus-visible,#catalog button:focus-visible,a:focus-visible{outline:2px solid var(--ink);outline-offset:2px}.ib:disabled{opacity:.4;cursor:default}
.toolbar{display:flex;align-items:center;justify-content:space-between;padding:8px 14px;gap:8px}.toolbar>div{display:flex;gap:4px}
#next-btn{background:var(--ink);color:var(--bg);border-radius:50%}
[hidden]{display:none!important}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.sheet{color:var(--text);background:var(--bg);width:min(32rem,calc(100vw - 16px));max-height:calc(100svh - 24px);padding:0;border:1px solid var(--frame);border-radius:0;overflow:auto}.sheet::backdrop{background:var(--scrim)}
.sheet-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 12px 8px 24px;border-bottom:1px solid var(--line)}
h2{font:500 16px 'Plex Mono',monospace;margin:0}h3{font:500 14px 'Plex Mono',monospace;color:var(--sub);margin:20px 0 8px}.sheet-body{padding:20px 24px}.sheet p{margin:0 0 12px}
.controls{list-style:none;padding:0;margin:0 0 16px}.controls li{margin:6px 0}kbd{font:500 14px 'Plex Mono',monospace}
.row{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0 0 12px;min-height:44px}select{padding:6px 12px;min-height:44px;max-width:70%;background:var(--bg);border:1px solid var(--line);border-radius:0}
.sheet footer{padding:12px 24px;border-top:1px solid var(--line);font-size:13px;color:var(--sub)}a{color:inherit}.note{color:var(--sub);font-size:14px}
#catalog{list-style:none;padding:0;margin:0;display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
#catalog button{width:100%;min-height:44px;border:1px solid var(--line);border-radius:0;background:none;padding:8px;font:500 14px 'Plex Mono',monospace}#catalog button[aria-current]{outline:2px solid var(--ink);outline-offset:1px}#catalog .finished:after{content:' ✓'}
@media(max-height:520px) and (min-width:560px){body{grid-template-columns:56px minmax(0,1fr) 80px;grid-template-rows:100svh}header{writing-mode:vertical-rl}header .ib{position:static}main{grid-template-rows:none;grid-template-columns:minmax(0,1fr) auto;padding:8px}#tray{flex-direction:column;padding:0 0 0 8px;min-height:0;justify-content:center}.toolbar{flex-direction:column;padding:12px 8px}.toolbar>div{flex-direction:column}}
html[data-motion=reduce] #fig-pos{transition:none!important}
@media(prefers-reduced-motion:reduce){#fig-pos{transition:none!important}.glyph:active,.ib:active{transform:none}}
@media(forced-colors:active){:root,html[data-theme]{--bg:Canvas;--ink:CanvasText;--text:CanvasText;--sub:CanvasText;--line:GrayText;--band:Canvas;--wash:Canvas}.cell{fill:CanvasText}.glyph{forced-color-adjust:none}.glyph:focus-visible{outline-color:Highlight}}
