@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:#fafafa;--ink:#171717;--sub:#656565;--line:#a5a5a5;--wash:#e5e5e5;--faint:#c9c9c9}
html[data-theme=dark]{color-scheme:dark;--bg:#111;--ink:#f5f5f5;--sub:#aaa;--line:#747474;--wash:#343434;--faint:#444}
@media(prefers-color-scheme:dark){:root:not([data-theme=light]){color-scheme:dark;--bg:#111;--ink:#f5f5f5;--sub:#aaa;--line:#747474;--wash:#343434;--faint:#444}}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:var(--bg);color:var(--ink)}
body{height:100svh;display:grid;grid-template-rows:56px minmax(0,1fr) 68px;font:16px/1.5 'Plex Sans',sans-serif;overflow:hidden}
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:13px 'Plex Mono',monospace;color:var(--sub);letter-spacing:.02em;font-variant-numeric:tabular-nums}
main{position:relative;display:grid;min-height:0;min-width:0;overflow:hidden;padding:4px 16px 8px}
/* The picture above, the description under it, the tray last. Each keeps its place while a board is played. */
#play{position:relative;width:100%;height:100%;min-height:0;display:grid;grid-template-rows:minmax(0,1fr) 24px auto auto;grid-template-areas:"stage" "strip" "desc" "tray";justify-items:center;row-gap:8px}
#stage{grid-area:stage;position:relative;width:100%;height:100%;min-height:0}
#board{position:absolute;inset:0;width:100%;height:100%;overflow:visible;outline:none}
#strip{grid-area:strip;margin:0;align-self:center;max-width:100%;color:var(--sub);font-size:14px;line-height:24px;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#desc{grid-area:desc;position:relative}#links{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none}
#tray{grid-area:tray;display:flex;gap:8px;justify-content:center;flex-wrap:wrap;padding-top:4px;border-top:1px solid var(--wash);min-width:min(100%,320px)}
@media(min-width:900px) and (min-aspect-ratio:6/5){
 #play{grid-template-columns:minmax(0,1fr) minmax(340px,420px);grid-template-rows:minmax(0,1fr) 24px auto auto minmax(0,1fr);grid-template-areas:"stage ." "stage strip" "stage desc" "stage tray" "stage .";column-gap:24px}
}
@media(max-height:520px) and (min-width:560px){
 body{grid-template-columns:minmax(0,1fr) 72px;grid-template-rows:44px minmax(0,1fr)}header,main{grid-column:1}main{padding:0 8px 8px}
 #play{grid-template-columns:minmax(0,1fr) auto;grid-template-rows:minmax(0,1fr) 24px auto auto minmax(0,1fr);grid-template-areas:"stage ." "stage strip" "stage desc" "stage tray" "stage .";column-gap:16px}
}

/* The picture: ink outlines on paper. A dot marks each shape the description fits; the ringed shape carries a second, inner outline. */
.shape{fill:var(--bg);stroke:var(--ink);stroke-width:2}
.ring{fill:none;stroke:var(--ink);stroke-width:1.5}
.dot{fill:var(--ink);opacity:0;transform-box:fill-box;transform-origin:center;transform:scale(.4);transition:opacity .15s,transform .15s}
.fits .dot{opacity:1;transform:none}
.hit{fill:transparent;stroke:none}
.obj{cursor:pointer}
/* Solved: everything but the ringed shape steps back, and the ringed shape's outline thickens. */
.solved .obj:not(.target) .shape{stroke:var(--line)}
.solved .target .shape{stroke-width:3.5}.solved .target .ring{stroke-width:2.5}
.solved .obj{cursor:default}

/* Slots and pieces: 48 px squares. An empty slot is dashed; the chosen slot carries a solid ring. */
.slot,.piece{display:grid;place-items:center;width:48px;height:48px;padding:0;border:1px solid var(--line);border-radius:0;background:var(--bg);color:var(--ink)}
.slot{position:absolute}
.slot.empty{border-style:dashed}
.slot[aria-pressed=true]{outline:2px solid var(--ink);outline-offset:3px}
.slot svg,.piece svg{fill:none;stroke:currentColor;stroke-width:1.6;stroke-linejoin:round;stroke-linecap:round}
.slot svg .fill,.piece svg .fill,.rel .fill{fill:currentColor;stroke:none}
.piece{border-color:transparent}
.piece[aria-disabled=true]{opacity:.32;cursor:default}
.slot:focus-visible,.piece:focus-visible{outline:2px solid var(--ink);outline-offset:3px}
.slot[aria-pressed=true]:focus-visible{outline-width:3px}
.piece:focus-visible{border-color:var(--line)}
.slot[data-hint],.piece[data-hint],.ib[data-hint]{outline:2px dashed var(--ink);outline-offset:3px}
.slot[aria-pressed=true][data-hint]{outline-style:dashed}
@media(hover:hover) and (pointer:fine){.piece:not([aria-disabled=true]):hover{background:var(--wash)}.slot:hover{background:var(--wash)}}
.link{fill:none;stroke:var(--line);stroke-width:1.25}
.rel{color:var(--ink)}.rel-back{fill:var(--bg);stroke:none}
.rel circle,.rel path{fill:none;stroke:currentColor;stroke-width:1.6;stroke-linejoin:round;stroke-linecap:round}
.rel circle.fill{fill:currentColor;stroke:none}

.ib{height:48px;width:48px;border:0;background:none;border-radius:50%;padding:12px}
.ib svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linejoin:round;stroke-linecap:round}
.ib:hover{background:var(--wash)}.ib:focus-visible,select: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)}#next-btn:hover{background:var(--ink)}
[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(--ink);background:var(--bg);width:min(560px,calc(100vw - 24px));max-height:calc(100svh - 24px);padding:0;border:1px solid var(--line);border-radius:8px;overflow:auto}.sheet::backdrop{background:#0006}
.sheet-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 20px;border-bottom:1px solid var(--wash)}
h2{font-size:1.25rem;font-weight:400;margin:0}h3{font-size:1rem;font-weight:400}.sheet-body{padding:8px 20px 20px}.sheet p{margin:12px 0}
kbd{font:500 .9em 'Plex Mono',monospace}
.row{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:16px 0}select{padding:6px 12px;max-width:70%;min-height:44px}
.sheet footer{padding:12px 20px;border-top:1px solid var(--wash);font-size:13px;color:var(--sub)}a{color:inherit}.note{color:var(--sub);font-size:14px}
#catalog h4{font-size:14px;font-weight:400;color:var(--sub);margin:14px 0 6px}#catalog ol{list-style:none;padding:0;margin:0;display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
#catalog button{width:100%;min-height:44px;border:1px solid var(--line);border-radius:4px;background:none;padding:8px}#catalog button[aria-current]{outline:2px solid var(--ink);outline-offset:1px}#catalog .finished:after{content:' ✓'}
html[data-motion=reduce] .dot{transition:none!important}
@media(prefers-reduced-motion:reduce){.dot{transition:none!important}}
@media(forced-colors:active){:root,html[data-theme]{--bg:Canvas;--ink:CanvasText;--sub:CanvasText;--line:GrayText;--wash:Canvas}.dot{fill:CanvasText}.slot,.piece{forced-color-adjust:none}}
