:root{font-family:ui-rounded,"SF Pro Rounded",system-ui,-apple-system,sans-serif;color:#172e36;background:#f8f7f1;font-synthesis:none;--board:#e8ecee;--orange:#b56942}
*{box-sizing:border-box}body{margin:0}main{max-width:1100px;margin:auto;padding:4px 32px 24px}
button,input,summary{font:inherit}button{border:1px solid #e1e7e8;border-radius:10px;background:#fff;color:inherit;cursor:pointer;min-height:44px;padding:8px 14px}
button:focus-visible,summary:focus-visible,header a:focus-visible{outline:2px solid var(--orange);outline-offset:2px}button:disabled{cursor:default}#check:disabled,#reset:disabled,#undo:disabled,#redo:disabled,#palette button:disabled{opacity:.45;cursor:not-allowed}
header{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:16px;min-height:44px;border-bottom:1px solid #dce2e4;padding-bottom:0;margin-bottom:4px}
header h1{font-size:28px;font-weight:750;letter-spacing:-1.2px;margin:0}header h1 a{display:inline-flex;align-items:center;min-height:44px;color:inherit;text-decoration:none}
summary{cursor:pointer;font-size:13px;font-weight:700;list-style:none;min-height:44px;display:grid;place-items:center;padding-inline:12px}details{position:relative;justify-self:end}
.game-help{grid-column:-2/-1;z-index:5}.game-help>summary{min-width:44px;font-size:18px}.game-help>.about{position:absolute;right:0;top:52px;width:min(360px,calc(100vw - 32px));max-height:calc(100svh - 150px);overflow-y:auto;overscroll-behavior:contain;margin:0;background:#f8f7f1;border:1px solid #d3dcdf;padding:18px;border-radius:14px;box-shadow:0 8px 30px #172e3620}
.workspace{display:grid;grid-template-columns:minmax(0,1fr) 280px;grid-template-rows:auto auto auto auto 1fr;grid-template-areas:"board info" "board keypad" "board actions" "board feedback" "board ad";gap:20px 32px;align-items:start}
.play-area{grid-area:board;min-width:0}.puzzle-info{grid-area:info;padding-top:12px}#identity,#lesson-title{letter-spacing:-.7px;margin:0 0 12px}#identity{font-size:16px}#lesson-title{font-size:26px}#rules,#instruction{font-size:14px;line-height:1.65;margin:0}
.keypad{grid-area:keypad;min-width:0;padding-block:18px;border-block:1px solid #dce2e4}#selection{font-size:12px;font-weight:700;line-height:1.5;margin:0 0 12px}
#palette{display:flex;flex-direction:column;gap:8px;padding:2px}#palette .choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;min-width:0}#palette button{min-width:0;min-height:56px;font-size:25px;font-weight:650;border-radius:12px}#palette .clear{font-size:13px;min-height:44px}
#palette button.word{font-size:17px}.rule-help{justify-self:stretch;margin-top:8px}.rule-help summary{justify-content:start;padding:0;font-size:12px}.rule-help p{font-size:12px;line-height:1.6;margin:0 0 8px;overflow-wrap:anywhere}.scroll-hint{display:none}.actions{grid-area:actions;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.actions #check,.actions .primary,.actions .wide{grid-column:1/-1}.actions button,.actions a{font-size:14px;font-weight:750;min-height:46px;background:transparent}.actions a{border:1px solid #e1e7e8;border-radius:10px;padding:8px 14px;text-decoration:none;text-align:center}.actions a:not([hidden]){display:grid;place-items:center}#check,.actions .primary{background:#172e36;color:white;border-color:#172e36}
.feedback{grid-area:feedback;min-width:0}#message{font-size:13px;line-height:1.6;color:#60777b;margin:0 0 12px;overflow-wrap:anywhere}#status,footer{font-size:10px;color:#647679;line-height:1.5}#status{margin:0;min-height:15px}footer{margin-top:18px}footer a{color:inherit;text-underline-offset:3px;display:inline-block;min-height:44px;padding-top:8px}
.board-toolbar{display:flex;justify-content:space-between;align-items:center;min-height:44px;margin-bottom:8px}.board-toolbar>span{font-size:12px;color:#647679}.view-controls{display:flex;align-items:center;gap:4px}.view-controls button{background:transparent;border:0;min-width:44px;font-weight:700}
#viewport{width:min(100%,max(300px,calc(100svh - 230px)));container-type:inline-size;overflow:auto;max-height:calc(100svh - 200px);padding:8px;margin-inline:auto;border-radius:14px;background:var(--board)}
#board{position:relative;display:grid;width:100%;margin:auto;gap:0;isolation:isolate}#board .section{border:1px solid #9caaae;border-radius:5px;background:#172e3605;pointer-events:none}
#board .number{z-index:1;aspect-ratio:1;min-height:0;min-width:0;width:94%;height:94%;align-self:center;justify-self:center;padding:0;border-radius:7px;border:1px solid #e1e7e8;font-size:clamp(24px,7cqw,42px);font-weight:500;position:relative}
#board[data-size="9"] .number{font-size:clamp(18px,2.2vw,30px)}#board .given{background:#f6f8f8;font-weight:750}#board .given:before,#board .given:after{content:"";position:absolute;pointer-events:none}#board .given:before{width:8%;height:9%;border:1.2px solid #718287;border-bottom:0;border-radius:5px 5px 0 0;bottom:14%;right:7%}#board .given:after{width:14%;height:11%;background:#718287;border-radius:1px;bottom:4%;right:4%}
#board .unused,#board .automatic{background:#ffffff4a;color:#819296;opacity:.65}#board .selected{outline:2px solid #172e36;outline-offset:-1px;background:#d1dadc}#board .conflict{border-color:#985d66;color:#985d66;background:#985d6616}
#board .sign{display:grid;place-items:center;line-height:1;z-index:2;min-height:0;min-width:0;padding:0;background:#fafbf9;align-self:center;justify-self:center;width:98%;height:68%;border-radius:4px;border:1px solid #82969b;font-size:clamp(10px,1.1vw,15px);font-weight:700}
#board .vertical{width:65%;height:96%;font-size:clamp(8px,1vw,12px);color:var(--orange);border-color:#ba987f}#board .sign.on{background:#172e3620;border-width:2px}#board .sign.unavailable{opacity:.35}#board .mark{position:absolute;top:1px;left:2px;font-size:9px;color:var(--orange);line-height:1}
#board .needs-equals{border:2px dashed #a65b19;background:#fff0d4;box-shadow:0 0 0 3px #a65b1930;opacity:1}#board .needs-attention{border:2px solid #985d66;background:#faf0f2;color:#985d66;box-shadow:0 0 0 2px #985d6625;opacity:1}#feedback-legend{font-size:12px;line-height:1.6;color:#455e64;margin:0 0 12px}#standalone-warning{font-size:13px;line-height:1.6;color:#985d66;border-left:3px solid #985d66;padding:8px 12px;background:#faf0f2;margin:0 0 12px}
.ad-slot:not([hidden]){grid-area:ad;display:grid;place-items:center;border:1px dashed #c6d0d1;border-radius:8px;min-height:90px;font-size:9px;letter-spacing:1px;color:#6a7c80;margin-top:8px}
@media(min-width:800px) and (max-height:760px){.workspace{gap:14px 24px}.puzzle-info{padding-top:8px}#identity,#lesson-title{margin-bottom:8px}#lesson-title{font-size:24px}#rules,#instruction{font-size:13px;line-height:1.5}.keypad{padding-block:12px}#palette .choices{gap:6px}#palette{gap:6px}#palette button{min-height:44px}#palette .clear{min-height:40px}}
@media(max-width:799px){
main{max-width:650px;padding:4px 16px 20px}header{grid-template-columns:1fr auto;gap:8px}header h1{font-size:24px}header nav{grid-column:1/-1;grid-row:2;justify-self:center}header details{grid-column:2;grid-row:1}
.workspace{grid-template-columns:minmax(0,1fr);grid-template-rows:auto;grid-template-areas:"info" "actions" "board" "keypad" "feedback" "ad";gap:14px}.puzzle-info{padding:0}#identity,#lesson-title{font-size:20px;margin-bottom:6px}#identity{font-size:16px}#rules,#instruction{font-size:13px}
#viewport{width:min(100%,max(250px,65svh));max-height:65svh;padding:5px}.board-toolbar{margin-bottom:4px}.keypad{padding:12px 0;border-bottom:0}#selection{margin-bottom:8px}.scroll-hint{display:inline}
#palette{flex-direction:row;align-items:center;gap:6px}#palette .choices{display:flex;gap:6px;flex:1;overflow-x:auto;padding:4px;scrollbar-width:thin}#palette button{min-width:44px;flex:1 0 44px;min-height:52px;padding-inline:6px;font-size:23px}#palette .clear{font-size:12px;min-width:52px;flex:0 0 52px;height:52px}
#board .number{font-size:clamp(14px,4.5vw,28px)}#board[data-size="9"] .number{font-size:clamp(12px,3.5vw,23px)}#board .sign{font-size:clamp(8px,2.3vw,13px)}#board .vertical{font-size:clamp(7px,1.9vw,9px)}.ad-slot:not([hidden]){min-height:70px}
}
.about{border-top:1px solid #dce2e4;margin-top:28px;padding-top:16px;font-size:14px;line-height:1.7;overflow-wrap:anywhere}.about h2{font-size:20px;letter-spacing:-.4px;margin:0 0 10px}.about p{margin:0 0 12px}.about a{color:inherit;text-underline-offset:3px}.about a:focus-visible{outline:2px solid var(--orange);outline-offset:3px}
.demo-link{display:inline-block;font-weight:700;padding-block:8px}
@media(hover:hover) and (pointer:fine){button:not(:disabled):hover{filter:brightness(.96)}}
