@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;--complete:#126a91;--selected:#e2e2e2;--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;--complete:#86cfee;--selected:#303030;--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;--complete:#86cfee;--selected:#303030;--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 56px;display:flex;overflow:auto;overscroll-behavior:contain;touch-action:none;padding:5px;scrollbar-width:thin}.board{position:relative;flex:none;margin:auto;user-select:none;touch-action:none;width:calc(var(--cell)*var(--w));height:calc(var(--cell)*var(--h));color:var(--ink)}.board svg.routes{position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;fill:none;stroke:currentColor}.island{position:absolute;display:grid;place-items:center;left:calc((var(--x) + .5)*var(--cell));top:calc((var(--y) + .5)*var(--cell));transform:translate(-50%,-50%);width:calc(var(--cell)*.8);height:calc(var(--cell)*.8);min-width:24px;min-height:24px;max-width:84px;max-height:84px;padding:0;border:2px solid var(--ink);border-radius:50%;background:var(--bg);color:var(--ink);font:500 clamp(14px,calc(var(--cell)*.31),30px)/1 var(--mono);touch-action:none;transition:background .7s,color .7s}.fullness{position:absolute;inset:3px;width:calc(100% - 6px);height:calc(100% - 6px);fill:none;stroke:currentColor;pointer-events:none}.fullness-track{stroke-width:2;opacity:.14}.fullness-fill{stroke-width:4}.fullness-port{stroke-width:2}.island.overfull .fullness-fill{stroke-dasharray:4 3!important}.fullness{transition:opacity .6s}.board.solved .fullness{opacity:0}.island.satisfied{color:var(--complete);border-color:var(--complete)}.island.selected{background:var(--selected);border-width:3px}.island.evidence{border-style:dashed;border-width:3px}.island.region{outline:4px double currentColor;outline-offset:3px}.island.rule-error{outline:2px dashed currentColor;outline-offset:5px}.island.hint-target{outline:3px solid currentColor;outline-offset:6px;animation:pulse 650ms 2}.island:focus-visible{z-index:3;outline:none}.island:focus-visible .island-label{text-decoration:underline;text-underline-offset:5px}.board.solved .island{background:var(--complete);border-color:var(--complete);color:var(--bg)}.route{stroke-width:.028;stroke-linecap:round}.route.evidence-route{stroke-dasharray:.09 .06;stroke-width:.045}.route.hint-route{stroke-dasharray:.07 .06;stroke-width:.07;animation:pulse 650ms 2}.route.illegal{stroke-dasharray:.05 .05;stroke-width:.06}.preview{stroke-dasharray:.08 .07;stroke-width:.045;opacity:.7}.preview.removing{opacity:.25;stroke-dasharray:.02 .12}.cross-mark{stroke-width:.05}.practice{--cell:54px}
#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,.row input{max-width:65%;width:fit-content;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{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}
/* Completion keeps the connected network visible, without hint or selection marks. */
.board-stage{flex:none;margin:auto;display:flex;flex-direction:column;align-items:center;padding-bottom:0;position:relative}.board-stage .board{margin:0}.completion{position:absolute;bottom:0;display:flex;justify-content:center;animation:next-reveal .65s .35s both}.completion[hidden]{display:none}.board-stage:has(.board.solved){padding-bottom:64px}#board{transform-origin:top left}.board.solved .island.satisfied:after{opacity:0}.island-label{transition:opacity .65s}.board.solved .island-label{opacity:0}
@keyframes next-reveal{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}

@keyframes pulse{50%{opacity:.3}}
@media(orientation:landscape) and (max-height:500px){#board-shell{inset:32px 72px 44px 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){.island{forced-color-adjust:none;background:Canvas;color:CanvasText;border-color:CanvasText}.board.solved .island{background:CanvasText;color:Canvas}.island.selected{background:Highlight;color:HighlightText}.island.satisfied{border-color:CanvasText}.routes{color:CanvasText}.sheet{border-color:CanvasText}}

/* Candidate controls stay stable while their route count is cycled. */
.route-control{position:absolute;transform:translate(-50%,-50%);width:44px;height:44px;display:grid;place-items:center;z-index:4;padding:0;border:0;background:transparent;color:var(--ink);touch-action:manipulation;font:500 14px/1 var(--mono)}
.route-control[hidden]{display:none}.route-control span{display:grid;place-items:center;width:26px;height:26px;border:1px solid var(--guide);border-radius:5px;background:var(--bg)}.route-control:hover span,.route-control:active span{border-color:var(--ink);background:var(--lit)}.route-control[data-count="1"] span,.route-control[data-count="2"] span{visibility:hidden}.route-control:focus-visible{outline-offset:0}

.route.candidate-guide{stroke-dasharray:.025 .09;stroke-width:.018;opacity:.3}

/* Compact lessons follow the same sheet hierarchy as Notan. */
.sheet-head{padding:8px 16px;gap:12px}.sheet-head h2{margin:0;line-height:1.3}.sheet-x{width:44px;height:44px;min-width:44px;min-height:44px;padding:10px}.sheet-x svg{width:24px;height:24px}
.sheet-body{overscroll-behavior:contain;scroll-padding:12px}.sheet-body p{margin:0 0 16px}.sheet-foot{font-size:14px}
.lesson{border:0;padding:0;margin:20px 0}.lesson-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:8px}.lesson-heading h3{margin:0;font:500 16px/1.4 var(--mono)}#lesson-count{color:var(--sub);font-variant-numeric:tabular-nums}
.practice-stage{display:flex;align-items:center;justify-content:center;min-height:168px;padding:12px 0}.practice-stage .practice{margin:0;filter:none}.practice-controls{display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
.text-action{min-height:44px;padding:8px 12px;border:1px solid var(--line);background:none;font:500 14px/1.3 var(--mono);color:var(--text)}.text-action[aria-pressed=true]{background:var(--ink);color:var(--bg)}.text-action:focus-visible,.sheet summary:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
.sheet-body #practice-feedback{min-height:24px;margin:8px 0;color:var(--sub);font-size:14px}.lesson-nav{display:flex;justify-content:space-between;gap:12px}.controls{border-top:1px solid var(--line);padding-top:16px}.controls p{margin:0 0 6px}.help-more{border-top:1px solid var(--line);margin-top:16px;padding-top:4px}.help-more summary{cursor:pointer;min-height:44px;padding:12px 0;color:var(--sub)}.help-more p{font-size:14px}.sheet-body .help-more p:last-child{margin-bottom:0}
@media(max-width:480px){.sheet-head{padding:8px 12px}.sheet-body{padding:16px}}

/* Restart occupies the same upper-left position across the puzzle family. */
#restart-btn{position:fixed;top:max(0px,env(safe-area-inset-top));left:8px;color:var(--sub);z-index:2}#restart-btn:hover,#restart-btn:focus-visible{color:var(--ink)}

/* Circuit study: operate on wires, with roomy exact-count choices. */
.circuits .island{width:calc(var(--cell)*.52);height:calc(var(--cell)*.52);min-width:44px;min-height:44px;max-width:68px;max-height:68px;font-size:clamp(16px,calc(var(--cell)*.25),26px)}
.circuits .candidate-guide{stroke-dasharray:none;stroke-width:.012;opacity:.35}
.circuit-route{position:absolute;z-index:4;display:flex;gap:4px;align-items:center;justify-content:center}.circuit-route.vertical{flex-direction:column}
.circuit-contact,.circuit-close{display:grid;place-items:center;width:44px;height:44px;min-width:44px;min-height:44px;border:1px solid var(--line);background:var(--bg);color:var(--sub);padding:10px;touch-action:manipulation}
.circuit-contact svg,.circuit-close svg,.circuit-launch svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
.circuit-contact[aria-pressed=true]{background:var(--ink);border-color:var(--ink);color:var(--bg)}.circuit-contact:hover,.circuit-launch:hover{border-color:var(--ink)}
.circuit-launch{display:none;width:100%;height:100%;min-width:24px;min-height:24px;padding:0;border:1px solid var(--guide);background:var(--bg);color:var(--ink);place-items:center;touch-action:manipulation}.circuit-launch svg{width:16px;height:16px}
.circuit-route.compact .circuit-contact{display:none}.circuit-route.compact .circuit-launch{display:grid}.circuit-route[hidden],.circuit-picker[hidden]{display:none}
.circuit-picker{position:fixed;z-index:20;display:flex;gap:4px;padding:4px;background:var(--bg);border:1px solid var(--ink);box-shadow:0 8px 32px #0006}.wire-selected{outline:2px solid var(--ink);outline-offset:3px}
.circuit-study #board-shell,.circuit-study #board{touch-action:pan-x pan-y}.circuit-study .board-stage{margin:auto}.circuit-study button{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}

/* Opt-in scores study. */
#scores-list{list-style:none;padding:0;margin:20px 0;font-variant-numeric:tabular-nums}#scores-list li{display:grid;grid-template-columns:32px 1fr auto;gap:12px;padding:10px 0;border-bottom:1px solid var(--line)}#scores-list li span:first-child{color:var(--sub)}#scores-list li span:nth-child(2){overflow-wrap:anywhere}#score-submit{margin-bottom:16px}#score-alias{border:1px solid var(--line);width:60%}#scores-status{color:var(--sub);font-size:14px}

/* Confidence locks are monochrome; blue remains clue completion. */
.board,.board *{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.route-lock{stroke:var(--ink);stroke-width:.014;fill:var(--bg);pointer-events:none}.route-lock path{fill:none}
.circuit-route.locked:after{content:'';position:absolute;right:-3px;top:-5px;width:8px;height:7px;border:1.5px solid var(--ink);background:var(--bg);pointer-events:none}.circuit-route.locked:before{content:'';position:absolute;right:-1px;top:-10px;width:4px;height:6px;border:1.5px solid var(--ink);border-bottom:0;border-radius:5px 5px 0 0;pointer-events:none}

.completion{gap:12px}#settings-feedback a{overflow-wrap:anywhere}

/* Share and Scores are hidden on the opening boards. */
.completion .ib[hidden]{display:none}

.milestone{color:var(--sub);font:14px/1.3 var(--sans);text-align:center;margin:0;grid-row:2;grid-column:1/-1;justify-self:center;white-space:nowrap}.milestone:empty{display:none}.completion:not([hidden]):has(.milestone:not(:empty)){display:grid;grid-template-columns:repeat(2,48px);height:auto;row-gap:0}
.completion:has(#scores-btn):has(.milestone:not(:empty)){grid-template-columns:repeat(3,48px)}.board-stage:has(.board.solved):has(.milestone:not(:empty)){padding-bottom:82.2px}

/* 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; }

/* iOS zooms the page when a form control under 16px takes focus. Touch
   devices get at least 16px; desktop keeps its sizes. */
@media (pointer: coarse) {
  input, select, textarea { font-size: max(16px, 1em) !important; }
}
