@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:#d4d4d4;--guide:#8f8f8f;--frame:#1c1c1c;--band:rgba(0,0,0,.05);--scrim:rgba(255,255,255,.84);--lit:#fff;--unlit:#d4d4d4;--mono:"Plex Mono",monospace;--sans:"Plex Sans",sans-serif}
@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);--lit:#333;--unlit:#000}}
:root[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);--lit:#333;--unlit:#000}
*{box-sizing:border-box;border-radius:0}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,input{font:inherit;color:inherit}button{cursor:pointer}button:disabled{opacity:.35;cursor:default}button:focus-visible,select:focus-visible,.cell: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(12px,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}
#board-shell{position:absolute;inset:38px 12px 88px;display:flex;overflow:auto;overscroll-behavior:contain;touch-action:none;padding:5px;scrollbar-width:thin}.board{display:flex;flex-direction:column;flex:none;margin:auto;user-select:none;touch-action:none;border:1px solid var(--ink)}.grid-row{display:flex;flex:none}.cell{width:var(--cell);height:var(--cell);flex:none;position:relative;display:grid;place-items:center;border-right:1px solid var(--guide);border-bottom:1px solid var(--guide);font:500 calc(var(--cell)*.42)/1 var(--mono);background:var(--unlit);color:var(--ink);touch-action:none}.grid-row:last-child .cell{border-bottom:0}.cell:last-child{border-right:0}.cell.wall{background:var(--ink);color:var(--bg);border-color:var(--bg)}.cell.lit{background:var(--lit)}.cell svg{width:70%;height:70%;stroke:currentColor;stroke-width:1.7;fill:none}.cell.excluded:before{content:'×';font:400 calc(var(--cell)*.54)/1 var(--sans)}.cell.conflict{background:repeating-linear-gradient(135deg,var(--lit) 0 4px,var(--guide) 4px 6px)}.cell.conflict:after{content:'';position:absolute;inset:2px;border:2px solid currentColor;border-radius:50%}.cell.rule-error{outline:2px dashed currentColor;outline-offset:-4px}.cell.evidence{outline:2px dashed currentColor;outline-offset:-3px}.cell.hint-target:after{content:'';position:absolute;inset:3px;border:3px solid currentColor;border-radius:50%;animation:pulse 650ms 2}.cell.inner-group{outline:4px double currentColor;outline-offset:-6px}.cell.hint-target{z-index:1}.cell:focus-visible{z-index:2;outline-offset:-3px}.board.solved{outline:2px solid var(--ink);outline-offset:5px}
#feedback{position:fixed;bottom:64px;left:16px;right:16px;margin:0;text-align:center;color:var(--sub);font:14px/1.3 var(--sans);pointer-events:none}.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);transition:opacity .15s,transform .1s}.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[aria-pressed=true]{outline:1px solid var(--ink);outline-offset:-7px}
.sheet{width:min(32rem,calc(100vw - 16px));max-height:calc(100dvh - 16px);border:1px solid var(--frame);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:0 10px 0 24px;flex:none;border-bottom:1px solid var(--line)}h2{font:500 16px/1 var(--mono)}.sheet-head form{margin:0}.sheet-x{font:28px/1 var(--sans)}.sheet-body{padding:20px 24px;overflow:auto;min-height:0}.sheet-body p:first-child{margin-top:0}.sheet-body p{max-width:60ch}.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}.row button{min-height:44px;background:none;border:0;padding:8px}.row button:not(:disabled){text-decoration:underline;text-underline-offset:4px}.quiet{color:var(--sub);font:13px/1.4 var(--mono);overflow-wrap:anywhere;margin-top: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}.practice{--cell:48px;width:max-content;margin:12px auto}.practice-controls{display:flex;justify-content:center}.practice-controls .ib{padding:12px}#practice-feedback{min-height:1.45em}section{border-block:1px solid var(--line);padding-block:16px}
@keyframes pulse{50%{opacity:.3}}
@media(orientation:landscape) and (max-height:500px){#board-shell{inset:32px 72px 12px 12px}.toolbar{left:auto;right:8px;top:12px;bottom:12px;flex-direction:column;width:48px}.toolbar>div{flex-direction:column}#feedback{left:12px;right:72px;bottom:4px;background:var(--bg);font-size:12px}.readout{left:calc(50% - 32px)}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}:root[data-motion=reduce] *,:root[data-motion=reduce] *::after{animation:none!important;transition:none!important}
@media(forced-colors:active){.cell{forced-color-adjust:none;background:Canvas;color:CanvasText;border-color:CanvasText}.cell.wall{background:CanvasText;color:Canvas}.cell:not(.wall):not(.lit){background:repeating-linear-gradient(135deg,Canvas 0 5px,GrayText 5px 6px)}.cell.conflict{outline:3px dashed CanvasText;outline-offset:-4px}.cell.lit{background:Canvas}.sheet{border-color:CanvasText}}

/* A completed board settles once; its next arrow appears beneath it. */
.board-stage{flex:none;margin:auto;display:flex;flex-direction:column;align-items:center;gap:16px}.board-stage .board{margin:0}.completion{display:flex;justify-content:center;animation:next-reveal .45s .15s both}.completion[hidden]{display:none}.board.solved{outline:none;animation:solved-settle .65s cubic-bezier(.3,.7,.2,1)}.board.solved .cell:not(.wall){border-color:var(--line)}
@keyframes solved-settle{0%{transform:scale(1)}45%{transform:scale(.985)}100%{transform:scale(1)}}@keyframes next-reveal{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}

.cell.excluded:before{transition:opacity .6s}.board.solved .cell.excluded:before{opacity:0}

/* Double-tap zoom: touch-action is intersected across every ancestor, so
   manipulation on the root stops double-tap zoom page-wide (readouts, gaps
   between controls, sheet backdrops) while pinch zoom still works. */
html, body { touch-action: manipulation; }

/* The alternate board is a native link, with the same reachable target as settings controls. */
.row .look-link{display:inline-flex;align-items:center;min-height:44px;padding:8px;color:inherit;text-underline-offset:4px}.look-link:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
