:root{--paper:#f6f4ef;--ink:#252c2b;--muted:#5c6660;--line:#dfdfd6;--accent:#e9bc51;--green:#426c59;--wash:#eaf0e9}*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font:14px/1.5 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}button,input,select{font:inherit}button{cursor:pointer;color:inherit;border:1px solid var(--line);background:white;border-radius:7px;padding:10px 14px;transition:background .15s,transform .15s}button:hover{background:#efeee7}button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible{outline:3px solid #527d72;outline-offset:3px}button:disabled{opacity:.55;cursor:wait}.quiet,.text-button{border:0;background:none}.text-button{font-size:12px;padding:5px 0;color:var(--green)}header{height:86px;display:flex;align-items:center;gap:30px;padding:0 4.5%;border-bottom:1px solid var(--line)}.brand{display:flex;gap:12px;align-items:center;text-decoration:none;color:var(--ink);font-size:20px;font-weight:650;letter-spacing:-1px}.brand-light{font-weight:400}.mark{font-size:38px;line-height:1;color:var(--green)}.header-note{color:var(--muted);font-size:12px;margin-left:25px}header .quiet{margin-left:auto;font-size:12px}main{max-width:1550px;margin:auto;padding:42px 4.5% 0}.intro{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:38px}.eyebrow{font-size:12px;letter-spacing:2px;font-weight:700;color:var(--green)}h1{font-family:Georgia,serif;font-size:clamp(35px,3.4vw,54px);font-weight:400;letter-spacing:-1.8px;line-height:1.1;margin:12px 0 0}h1 em{font-weight:400;color:var(--green)}.intro>p{color:var(--muted);font-size:14px;margin:0 0 4px}.workspace{display:grid;grid-template-columns:260px minmax(350px,570px) minmax(220px,270px);gap:30px;align-items:start;justify-content:space-between}.panel{padding:22px 20px;border:1px solid var(--line);border-radius:12px;background:#faf9f5}.section-top{display:flex;flex-direction:column;gap:5px}.section-top h2{font-size:16px;font-weight:550;margin:0;letter-spacing:-.3px}.tiny{font-size:12px;letter-spacing:1.5px;color:var(--muted)}.muted{font-size:12px;color:var(--muted);line-height:1.7;margin:15px 0 18px}.rule-list{display:flex;flex-direction:column;gap:10px}.rule{display:flex;align-items:center;gap:10px;border:1px solid var(--line);border-radius:8px;padding:12px 9px;cursor:pointer;background:transparent;position:relative}.rule:has(input:checked){background:#edf1e9;border-color:#8b9f8a}.rule input{position:absolute;right:9px;top:13px;accent-color:var(--green);width:13px;height:13px}.rule-icon{font:25px/1 Georgia,serif;color:var(--green);width:27px;text-align:center;flex-shrink:0}.rule strong{font-size:12px;font-weight:600}.rule small{display:block;font-size:12px;line-height:1.55;color:var(--muted);margin-top:4px}.field-label{display:block;font-size:12px;letter-spacing:1.7px;font-weight:650;margin:23px 0 8px}select,#seed{width:100%;padding:10px 9px;border:1px solid var(--line);border-radius:5px;background:#fff;color:var(--ink);font-size:12px}select{cursor:pointer}.seed-row{display:flex;align-items:center;justify-content:space-between;margin-top:13px}.seed-row .field-label{margin:0}.seed-row .text-button{font-size:12px}.primary{width:100%;background:var(--accent);border-color:var(--accent);font-weight:600;display:flex;justify-content:space-between;align-items:center}.primary:hover{background:#dfad3b}#generate{margin-top:18px}.small-note{font-size:12px;color:var(--muted);line-height:1.6;margin-bottom:0}.error{font-size:12px;color:#a33131;padding:10px;border:1px solid #e0bbbb;background:#fff2ed;border-radius:6px}.board-heading{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:1px 0 8px}.board-heading .eyebrow{font-size:12px}.board-heading h2{margin:4px 0;font-size:28px;font-weight:500;letter-spacing:-.7px}.status-pill{font-size:12px;color:var(--green);background:#e7eee6;padding:6px 10px;border-radius:25px;white-space:nowrap}.tags{display:flex;gap:5px;flex-wrap:wrap;min-height:30px;margin-bottom:8px}.tags span{font-size:12px;border:1px solid #c9d5c6;color:var(--green);border-radius:4px;padding:2px 7px}.board-wrap{position:relative;aspect-ratio:1;box-shadow:0 12px 25px #28382a0b}#board{display:grid;grid-template-columns:repeat(9,1fr);height:100%;border:2px solid var(--ink);background:#fff}#board .cell{border:0;border-right:1px solid #deded6;border-bottom:1px solid #deded6;border-radius:0;padding:0;position:relative;display:flex;align-items:center;justify-content:center;aspect-ratio:1;min-width:0;background:transparent;font-size:clamp(21px,2.1vw,32px);font-weight:400;z-index:1}#board .cell:nth-child(3n){border-right:2px solid var(--ink)}#board .cell:nth-child(9n){border-right:0}#board .cell:nth-child(n+19):nth-child(-n+27),#board .cell:nth-child(n+46):nth-child(-n+54){border-bottom:2px solid var(--ink)}#board .cell:nth-child(n+73){border-bottom:0}#board .cell.given{font-weight:650;color:#283832}#board .cell.entered{color:#32688f}#board .cell.deduced{color:#387353}#board .cell.related{background:#f5f7f1}#board .cell.witness{background:#dbece0}#board .cell.target{background:#fae4a3}#board .cell.selected{box-shadow:inset 0 0 0 3px #b58c2b;background:#fff3ce}#board .cell.wrong{color:#b73535;background:#fff0ed}.digit{position:relative;z-index:3;pointer-events:none}.pencils{position:absolute;inset:18% 8% 5%;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);font-size:clamp(8px,.75vw,11px);line-height:1;align-items:center;color:#667367;pointer-events:none}.pencils span{text-align:center}#overlay{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:2;overflow:visible}.board-toolbar{display:flex;gap:6px;margin-top:15px}.board-toolbar button{font-size:12px;padding:8px 9px;flex:1}.board-toolbar button[aria-pressed=true]{background:#e5eddf;border-color:#8fa389}kbd{font:9px system-ui;opacity:.55;padding-left:4px}#keypad{display:grid;grid-template-columns:repeat(9,1fr);gap:5px;margin-top:9px}#keypad button{padding:8px 0;font-size:20px;font-weight:450;background:#fdfcf9}.play-actions{display:flex;align-items:center;gap:10px;margin-top:12px}.play-actions button{font-size:12px;white-space:nowrap;padding:7px 8px}#play-status{font-size:12px;color:var(--muted);flex:1;line-height:1.4}.hint-symbol{font-size:46px;color:#b69641;margin:27px 0 12px}.insight h3{font:400 25px/1.2 Georgia,serif;margin:0 0 15px;letter-spacing:-.5px}.insight>p{font-size:12px;line-height:1.8;color:#697168}.secondary{display:flex;justify-content:space-between;width:100%;font-size:12px;font-weight:550;background:transparent;margin-top:22px}.divider{height:1px;background:var(--line);margin:28px 0 20px}.stats{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:16px}.stats strong{display:block;font-size:28px;font-weight:450}.stats small{font-size:12px;color:var(--muted)}.insight .verification{font-size:12px;color:var(--green);line-height:1.7;margin-top:16px}details{font-size:12px;color:var(--muted);margin:20px 0}summary{cursor:pointer;color:var(--ink)}details p{font-size:12px;line-height:1.7}.insight #export{font-size:12px}#hint-detail{background:#eef2e9;border:1px solid #d6dfcf;padding:12px;border-radius:6px;font-size:12px;margin:15px 0}#apply-hint{font-size:12px;margin-top:12px}footer{display:flex;justify-content:space-between;gap:20px;margin:35px 0 20px;border-top:1px solid var(--line);padding-top:18px;color:#8a9088;font-size:12px}#loading{position:absolute;inset:0;background:#f7f6efed;z-index:6;display:flex;flex-direction:column;gap:16px;align-items:center;justify-content:center;border:1px solid var(--line)}#loading[hidden],[hidden]{display:none!important}#loading small{font-size:12px;color:var(--muted)}.spinner{width:35px;height:35px;border:2px solid #d7dfce;border-top-color:var(--green);border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}#toast{position:fixed;bottom:25px;left:50%;transform:translateX(-50%);padding:12px 22px;background:var(--ink);color:white;border-radius:8px;z-index:10;font-size:12px;box-shadow:0 5px 20px #0002}@media(min-width:1600px){main{padding-top:48px}.workspace{gap:42px}}@media(max-width:1150px){.workspace{grid-template-columns:220px minmax(340px,1fr);gap:24px}.insight{grid-column:2}.controls{grid-row:1 / span 2}.intro>p{font-size:12px}.header-note{display:none}.rule{padding:10px 7px}.rule-icon{width:23px}}@media(max-width:740px){header{height:65px;padding:0 20px}.brand{font-size:20px}main{padding:28px 18px 0}.intro{margin-bottom:25px}.intro>p{display:none}h1{font-size:37px}.workspace{display:flex;flex-direction:column;gap:22px}.controls{width:100%;padding:17px}.rule-list{display:grid;grid-template-columns:1fr 1fr}.controls .muted{margin:8px 0 13px}.controls .section-top{flex-direction:row;align-items:center;justify-content:space-between}.controls .rule small{font-size:12px}.play-area,.insight{width:100%}.play-area{order:-1}.intro{display:none}.board-heading h2{font-size:28px}#board .cell{font-size:28px}.pencils{font-size:12px}.insight .hint-symbol{margin:14px 0;font-size:28px}.insight .divider{margin:20px 0}footer{flex-direction:column;gap:8px}.rule strong{font-size:12px}.rule input{right:7px}.board-toolbar button{font-size:12px;padding:9px 5px}#keypad button{font-size:20px}.status-pill{font-size:12px}#loading small{font-size:12px}}@media(prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}

/* Keep the clue strip clear, with independent center and corner notation. */
#board .cell{z-index:auto}.pencils{z-index:3;inset:29% 8% 5%;font-size:clamp(7px,.75vw,10px)}
#board .cell.has-sum .pencils{top:33%}
.center-marks{position:absolute;left:4px;right:4px;top:50%;transform:translateY(-50%);text-align:center;color:#526b73;font-weight:450;letter-spacing:.1px;z-index:3;pointer-events:none}
.corner-marks{position:absolute;left:6px;right:5px;font-size:clamp(7px,.7vw,10px);line-height:1;letter-spacing:1px;color:#65705c;text-align:left;z-index:3;pointer-events:none}
.corner-top{top:5px}.corner-bottom{bottom:5px}.has-sum .corner-top{left:43%;text-align:right}
@media(max-width:740px){.pencils{font-size:12px}.corner-marks{font-size:12px;letter-spacing:.5px;left:4px;right:4px}.has-sum .corner-top{left:43%}.corner-top{top:3px}.corner-bottom{bottom:3px}.board-toolbar button{font-size:12px;padding:9px 3px}}

#board{touch-action:none;user-select:none;-webkit-user-select:none}#board .cell.selected{background:#fff0bf;box-shadow:inset 0 0 0 2px #b58c2b}

.letter-clue{position:absolute;right:4px;top:3px;font:bold 10px/1 system-ui;color:#8a4f73;z-index:3;background:#fffdf8;border-radius:2px;padding:1px 2px}.has-letter .corner-top{right:20px}#board .cell.equal-related{background:#f1e5f0}#board .cell.equal-related.related{background:repeating-linear-gradient(135deg,#f1e5f0 0 5px,#eaf0e9 5px 10px)}

.color-tools{margin-top:10px;padding:12px;border:1px solid var(--line);border-radius:8px;background:#faf9f5}.color-tools[hidden]{display:none}.color-options{display:grid;grid-template-columns:1fr 1fr;gap:10px}.color-options label{font-size:12px;color:var(--muted)}.color-options select{margin-top:4px}#color-swatches{display:flex;flex-wrap:wrap;gap:5px;margin:10px 0}#color-swatches button{padding:6px 9px;font-size:12px}#board .cell[data-color][data-color-target="0"]{background:var(--annotation-wash)}.annotation-tag{position:absolute;bottom:2px;left:3px;padding:0 2px;z-index:4;border:1px solid #647068;border-radius:3px;background:var(--annotation-wash);color:#26332d;font:bold 8px/1.3 system-ui}#board .cell[data-color] .corner-bottom{left:24px;font-size:12px;letter-spacing:0}#board .cell.witness{outline:2px dashed #487769;outline-offset:-4px}#board .cell.target{outline:3px solid #b37d27;outline-offset:-4px}#strategy{margin-bottom:8px}#color-pattern{margin-bottom:8px}#strategy-evidence{padding-left:18px;font-size:12px;color:var(--muted);max-height:180px;overflow:auto}#color-lessons{margin-top:18px}#color-lessons summary{cursor:pointer;color:var(--green);font-weight:600}#color-lessons p{font-size:12px;line-height:1.65}#color-lessons h4{font-size:14px;margin-bottom:8px}#lesson-example{padding:10px;background:var(--wash);border-radius:6px}.board-toolbar{flex-wrap:wrap}#color-tools select{max-width:100%}@media(max-width:740px){.annotation-tag{font-size:12px}.color-options{grid-template-columns:1fr}#board .cell[data-color] .corner-bottom{left:20px;font-size:12px}.board-toolbar button{flex:1 1 28%}}

.colored-candidate{border-radius:2px;outline:1px solid #647068;color:#26332d}.annotation-tag{pointer-events:none}


/* Draw cell focus above neighboring backgrounds and clue paths, inside the cell. */
#board .cell:focus-visible{outline:none}
#board .cell:focus-visible::after{content:"";position:absolute;inset:1px;border:3px solid #527d72;z-index:5;pointer-events:none}

.annotation-tags{position:absolute;bottom:2px;left:2px;right:2px;display:flex;flex-wrap:wrap;gap:1px;z-index:4;pointer-events:none}.annotation-tags .annotation-tag{position:static;white-space:nowrap;font-size:12px;padding:0 1px}#board .cell[data-color] .corner-bottom{left:5px;bottom:var(--annotation-space,14px)}#color-layer-legend{display:flex;flex-wrap:wrap;gap:4px;margin-top:8px;font-size:12px;color:var(--green)}#color-layer-legend span{border:1px solid var(--line);border-radius:4px;padding:2px 5px;background:#faf9f5}

.hint-reveal{display:flex;gap:12px;align-items:center}.hint-reveal .secondary{margin-top:10px}.candidate-question{border-top:1px solid var(--line);margin-top:18px;padding-top:14px;display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:12px}.candidate-question select{width:60px}.candidate-question button{font-size:12px}#hint-level{color:var(--green)}

#board{grid-template-rows:repeat(9,minmax(0,1fr))}#board .cell{min-height:0;aspect-ratio:auto}

#color-swatches button[aria-pressed="true"]{outline:2px solid var(--green);outline-offset:1px}#color-swatches button[aria-pressed="mixed"]{outline:2px dashed var(--green);outline-offset:1px}

#hint-detail{white-space:pre-line}

#keypad button.digit-complete{color:#858c87;background:#e7e8e2;opacity:.55}#board .cell.matching-digit .digit{background:#f6d37a;line-height:1;padding:0 2px;border-radius:3px;color:#25392e}

#home-screen{max-width:1180px;margin:auto}#home-screen .intro{display:flex}#collections{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px;margin:22px 0 32px}.collection{background:#faf9f5;border:1px solid var(--line);border-radius:12px;padding:22px}.collection h3{font:27px Georgia,serif;margin:8px 0}.collection>p{color:var(--muted);font-size:12px;min-height:40px}.level-card{display:flex;flex-direction:column;align-items:flex-start;text-align:left;width:100%;gap:5px;margin-top:12px;padding:14px;background:#fffdf8}.level-card small{color:var(--muted);font-size:12px}.level-card strong{font-size:14px}.level-card.completed{border-color:#91aa91;background:#edf3e9}.library-heading{display:flex;align-items:baseline;justify-content:space-between;gap:15px}.library-heading h2,#resume-section h2{font:27px Georgia,serif}.library-heading p{color:var(--muted);font-size:12px}#resume-list{display:flex;gap:12px;flex-wrap:wrap;margin-bottom:30px}.resume-card{flex:1;min-width:220px;text-align:left;background:#eaf0e9;padding:18px}.resume-card strong,.resume-card small{display:block}.resume-card small{margin-top:8px;color:var(--muted)}#custom-builder{border:1px solid var(--line);border-radius:10px;padding:18px;font-size:14px}#custom-builder .controls{margin-top:18px}#custom-builder .rule-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}#custom-builder .controls .section-top,#custom-builder .controls>.muted{display:none}.play-history{margin-top:32px}#history-list{overflow:auto;margin-top:14px}#history-list table{border-collapse:collapse;width:100%;font-size:12px;white-space:nowrap}#history-list th,#history-list td{text-align:left;padding:12px 10px;border-bottom:1px solid var(--line)}#history-list th{font-size:12px;color:var(--muted)}#history-list button{font-size:12px;padding:5px 10px}.solve-nav{display:flex;gap:14px;align-items:center;max-width:950px;margin:0 auto 12px}#session-title{flex:1;font:22px Georgia,serif}.session-stats{display:flex;gap:18px;flex-wrap:wrap;max-width:950px;margin:0 auto 24px;font-size:12px;color:var(--muted)}#session-time{font-variant-numeric:tabular-nums;color:var(--green);font-weight:650}#solve-screen .workspace{grid-template-columns:minmax(350px,570px) minmax(240px,300px);max-width:950px;margin:auto;gap:35px}#solve-screen .insight{grid-column:auto}.completion{padding:22px;margin-bottom:20px;border:1px solid #9fb598;border-radius:10px;background:#eaf0e9}.completion h2{font:26px Georgia,serif}.completion p{font-size:14px;line-height:1.8}.completion button{margin-right:10px}#pause-overlay{position:absolute;inset:0;z-index:7;background:#f6f4eff5;display:flex;flex-direction:column;align-items:center;justify-content:center;border:2px solid var(--ink);border-radius:2px}#pause-overlay strong{font:30px Georgia,serif}#pause-overlay .primary{width:auto;min-width:160px}body[data-screen="home"] footer span:last-child{display:none}
@media(max-width:900px){#collections{grid-template-columns:1fr}.collection>p{min-height:0}.collection{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.collection h3,.collection>p,.collection>.eyebrow{grid-column:1/-1}.level-card{margin:0}#custom-builder .rule-list{grid-template-columns:1fr 1fr}#solve-screen .workspace{gap:24px;grid-template-columns:minmax(320px,1fr) 240px}}
@media(max-width:740px){#home-screen .intro h1{font-size:38px}#home-screen .intro>p{display:none}.library-heading{align-items:flex-start;flex-direction:column;gap:0}.library-heading h2{margin-bottom:5px}.collection{display:block}.level-card{margin-top:12px}#solve-screen .workspace{display:flex}.solve-nav{gap:5px}#session-title{font-size:20px}.solve-nav button{padding:8px}.session-stats{gap:8px 14px;margin-bottom:18px;font-size:12px}.resume-card{min-width:100%}#custom-builder{padding:12px}#custom-builder .controls{padding:10px}.play-history{margin-top:25px}}

.tags .rule-chip{font-size:12px;border:1px solid #c9d5c6;color:var(--green);border-radius:5px;padding:6px 9px;min-height:34px;background:transparent}.tags .rule-chip:hover,.tags .rule-chip[aria-expanded="true"]{background:var(--wash);border-color:var(--green)}.rule-help{border:1px solid #c9d5c6;border-radius:8px;background:#fafbf7;padding:12px 14px;margin:0 0 12px;font-size:14px}.rule-help-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.rule-help-heading button{font-size:12px;padding:6px 9px;flex-shrink:0}.rule-help p{margin:8px 0 0}.rule-help #rule-help-base{font-size:12px;color:var(--muted)}@media(pointer:coarse){.tags .rule-chip,.rule-help-heading button{min-height:44px}}

/* Collections open independently, keeping the library compact by default. */
#collections{align-items:start}.collection{display:block;padding:0;margin:0}.collection>summary{cursor:pointer;position:relative;list-style:none;padding:22px 42px 22px 22px;min-height:160px}.collection>summary::-webkit-details-marker{display:none}.collection>summary::after{content:"+";position:absolute;right:20px;top:24px;font-size:20px;color:var(--green)}.collection[open]>summary::after{content:"−"}.collection>summary:focus-visible{outline:3px solid var(--green);outline-offset:3px;border-radius:12px}.collection>summary p{color:var(--muted);font-size:12px;line-height:1.6;margin-bottom:0}.collection-levels{padding:0 22px 22px}.collection-levels .level-card:first-child{margin-top:0}
@media(max-width:900px){.collection-levels{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.collection>summary{min-height:0}}
@media(max-width:740px){.collection-levels{display:block}.collection-levels .level-card{margin-top:12px}}

.matching-candidate{border-radius:2px;box-shadow:0 0 0 1px #b58416;color:#25392e;font-weight:750}.matching-candidate:not(.colored-candidate){background:#f6d37a}

#hint-practice{border:1px solid var(--line);border-radius:9px;padding:14px;margin:16px 0;background:#fffdf8}#hint-practice[hidden]{display:none}#practice-question,#practice-feedback{font-size:14px;line-height:1.65}#practice-choices{display:flex;gap:8px;flex-wrap:wrap}#practice-choices button{min-width:44px;min-height:44px}#practice-choices button[aria-pressed=true]{outline:2px solid var(--green);background:var(--wash)}#practice-choices button:disabled{opacity:1;cursor:default}

.completion{position:relative;background:linear-gradient(140deg,#edf3e9,#fff8df)}.completion-emblem{display:block;font-size:42px;line-height:1.2;color:#b58416;margin-bottom:10px}.completion h3{font-size:14px;margin:22px 0 10px}#completion-ideas{display:flex;flex-wrap:wrap;gap:7px;list-style:none;padding:0}#completion-ideas li{padding:5px 9px;border:1px solid #c7d4c1;border-radius:20px;font-size:12px;background:#fff9}#completion-next{display:grid;gap:9px;margin-bottom:20px}.completion .next-puzzle{display:flex;flex-direction:column;gap:4px;text-align:left;width:100%;margin:0;background:#fffdf8}.next-puzzle small{color:var(--green);font-size:12px}.next-puzzle strong{font-size:14px}.next-puzzle span{color:var(--muted);font-size:12px}#celebration{position:fixed;inset:0;z-index:50;pointer-events:none;overflow:hidden}#celebration[hidden]{display:none}#celebration span{position:absolute;top:-20px;left:var(--left);width:8px;height:13px;border-radius:2px;animation:celebrate-fall 2.6s var(--delay) ease-in both}@keyframes celebrate-fall{0%{transform:translate(0,-20px) rotate(0);opacity:1}85%{opacity:1}100%{transform:translate(var(--drift),110vh) rotate(var(--turn));opacity:0}}@media(prefers-reduced-motion:reduce){#celebration{display:none}}

#completion-title:focus{outline:none}

#app-settings{margin:24px 0;padding:18px;border:1px solid var(--line);border-radius:10px}#app-settings summary{cursor:pointer}#app-settings p{font-size:12px;line-height:1.7}.storage-actions{display:flex;flex-wrap:wrap;gap:10px}.storage-actions button{min-height:44px}#app-settings a,footer a,.information-page a{color:var(--green)}.information-page{max-width:780px;padding-bottom:60px}.information-page h1{margin:30px 0}.information-page h2{font:25px Georgia,serif;margin-top:30px}.information-page p{line-height:1.8}button[hidden]{display:none!important}

dialog{max-width:min(32rem,calc(100vw - 3rem));border:1px solid var(--line,#ddd);border-radius:12px;background:#f6f4ef;color:#263632;padding:1.5rem}dialog::backdrop{background:#182d2666}dialog p{line-height:1.6}#loading button{margin-top:1rem}#install-shortcut{margin-left:auto}

#hint-title:empty,#hint-text:empty{display:none}

/* Keep the grid full width on phones, landscape phones and small tablets. */
@media(max-width:1100px){
 #solve-screen .workspace{display:grid;grid-template-columns:minmax(0,1fr);max-width:680px;gap:24px}
 #solve-screen .play-area,#solve-screen .insight{width:100%;min-width:0;grid-column:1}
 #solve-screen .solve-nav,#solve-screen .session-stats{max-width:680px}
 #solve-screen .insight{padding:20px}
 #solve-screen .insight>p,#solve-screen .insight details p,#strategy-evidence,#hint-detail,.candidate-question{font-size:16px;line-height:1.6}
 #solve-screen .insight button,#solve-screen .insight select{font-size:16px;min-height:44px}
 #solve-screen .insight .tiny,#solve-screen .insight .eyebrow,#solve-screen .stats small{font-size:12px}
 #solve-screen .insight summary{font-size:16px}
 #board .cell{font-size:clamp(25px,5vw,40px)}
}
@media(max-width:1100px){
 #home-screen{font-size:16px}
 #home-screen .intro>p,.library-heading p,.collection>summary p,#app-settings p,#home-screen details p{font-size:16px;line-height:1.6}
 #home-screen .eyebrow{font-size:12px;letter-spacing:1.4px}
 .level-card strong,.resume-card strong{font-size:16px}
 .level-card small,.resume-card small,#home-screen .small-note,#home-screen .muted{font-size:14px;line-height:1.6}
 #home-screen summary,#home-screen button,#home-screen select,#home-screen input{font-size:16px}
 #home-screen button,#home-screen select,#home-screen input{min-height:44px}
 #home-screen .rule input{min-height:0;width:18px;height:18px}
 #home-screen .rule{padding-right:34px}
 #home-screen .rule strong{font-size:16px}
 #home-screen .controls .rule small{font-size:14px}
 #home-screen .field-label,#history-list th{font-size:12px}
 #history-list table{font-size:14px}
 #home-screen .collection>summary{padding:20px 42px 20px 20px}
}
@media(max-width:740px){
 header{height:auto;min-height:65px;flex-wrap:wrap;gap:8px 14px;padding:12px}
 header .quiet{font-size:14px;padding:8px;min-height:44px}
 main{padding:24px 12px 0}
 #solve-screen .workspace{gap:18px}
 .session-stats{font-size:14px}
 .board-toolbar button{font-size:14px;min-height:44px}
 #keypad button{min-height:44px}
 .play-actions{flex-wrap:wrap}
 .play-actions button,#play-status{font-size:12px}
 .play-actions button{min-height:44px}
 .library-heading h2,#resume-section h2{font-size:28px}
 #home-screen .intro h1{font-size:38px}
 #custom-builder .rule-list{grid-template-columns:minmax(0,1fr)}
}

/* Let the mobile board reach both edges; inset only the surrounding UI. */
@media(max-width:1100px){
 body[data-screen="play"] main{padding-left:0;padding-right:0}
 #solve-screen .workspace{max-width:none}
 #solve-screen .solve-nav,#solve-screen .session-stats{max-width:none;margin-left:12px;margin-right:12px}
 #solve-screen .play-area>:not(.board-wrap){margin-left:12px;margin-right:12px}
 #solve-screen .insight{width:calc(100% - 24px);margin-left:12px;margin-right:12px}
 body[data-screen="play"] footer,body[data-screen="play"] #storage-error{margin-left:12px;margin-right:12px}
}
.rule-icon.xv-icon{font-size:14px;font-weight:700;letter-spacing:-.5px}
/* X-sum numbers sit outside the grid: the board keeps its centre and gives up a margin of 40/620 on every side. */
.board-wrap.outside-clues{--outside:6.4516%;box-shadow:none}
.board-wrap.outside-clues #board{position:absolute;inset:var(--outside);height:auto;box-shadow:0 12px 25px #28382a0b}
.board-wrap.outside-clues #overlay{inset:var(--outside);width:calc(100% - 2*var(--outside));height:calc(100% - 2*var(--outside))}
/* Fog of war: a dark cell hides its clues (the overlay is clipped to lit cells in app.js). Digits typed there stay readable. */
#board .cell.fog{background:repeating-linear-gradient(135deg,#7b8782 0 6px,#727e79 6px 12px);color:#f4f6f1}
#board .cell.fog.entered{color:#f4f6f1}
#board .cell.fog.selected{background:#b9a968}
#board .cell.fog.witness{background:#8fa898}
#board .cell.fog.target{background:#c2a95f}
#board .cell.fog.wrong{background:#b98f88;color:#fff3f0}
#path-section{margin:8px 0 30px}.path-track{height:6px;border-radius:3px;background:var(--line);overflow:hidden;margin:6px 0 16px}#path-bar{display:block;height:100%;width:0;background:var(--green);border-radius:3px}#path-next{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}
@media(max-width:900px){#path-next{grid-template-columns:1fr;gap:10px}}

.update-notice{margin:0 0 1rem;padding:.7rem 1rem;border:1px solid #c9a227;border-radius:10px;background:#fff7dc;color:#3a3200}

/* Home: four short views, one at a time. */
.home-nav{display:flex;gap:6px;margin:8px 0 28px;border-bottom:1px solid #dcd8cc;flex-wrap:wrap}
.home-nav button{border:0;background:none;padding:10px 16px;font:inherit;font-size:1rem;color:#6b6a63;border-bottom:3px solid transparent;border-radius:0;cursor:pointer}
.home-nav button[aria-current]{color:#1f2d27;border-bottom-color:#426c59;font-weight:600}
#home-screen[data-view="play"] [data-home-view]:not([data-home-view="play"]),
#home-screen[data-view="collections"] [data-home-view]:not([data-home-view="collections"]),
#home-screen[data-view="make"] [data-home-view]:not([data-home-view="make"]),
#home-screen[data-view="history"] [data-home-view]:not([data-home-view="history"]){display:none}
#home-screen[data-view="make"] #custom-builder>summary{display:none}
.collection>summary{min-height:0;padding:18px 20px;display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.collection>summary h3{margin:0}
.collection-count{font-size:.85rem;color:#6b6a63;font-variant-numeric:tabular-nums;margin-right:26px}
.collection-about{margin:0 20px 12px;color:#6b6a63;font-size:.9rem}
.path-card.later{opacity:.75}
.collection[open]{grid-column:1/-1}
.collection[open] .collection-levels{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:10px;padding:0 20px 20px}
@media(max-width:480px){.home-nav{gap:0;margin-bottom:18px}.home-nav button{padding:10px 11px;font-size:.95rem}}
.collection[open] .collection-levels>*{margin:0;align-self:stretch}
.puzzle-foot{margin:14px 0 0;text-align:center}
#history-list .history-open{font-size:inherit;padding:0;font-weight:600;text-align:left}
#app-settings{margin-top:32px}
/* Corner marks: the top and bottom rows of the cell, each spread from corner to corner; the middle is for centre marks. */
#board .cell .corner-marks{position:absolute;left:5px;right:5px;display:flex;justify-content:space-between;letter-spacing:0;line-height:1;font-size:clamp(8px,.9vw,12px);color:#526b73;font-weight:500}
#board .cell .corner-top{top:4px}#board .cell .corner-bottom{bottom:4px}
#board .cell.has-sum .corner-top{left:46%;justify-content:flex-end;gap:4px}
@media(max-width:600px){#board .cell .corner-marks{font-size:12px;left:3px;right:3px}#board .cell .corner-top{top:2px}#board .cell .corner-bottom{bottom:2px}}

/* ---- Review pass (2026-11-12) ---- */
/* Hints have their own colour (blue); ochre stays the selection. */
#board .cell.witness{background:#e4edf6;outline:2px dashed #5b83aa;outline-offset:-4px}
#board .cell.target{background:#cfe0f1;outline:3px solid #3d6f9e;outline-offset:-4px}
#strategy{display:none}
#hint-sheet #hint-title:empty,#hint-sheet #hint-text:empty{display:none}
#hint-sheet #hint-title{font-size:20px;margin:0 0 8px}
#hint-sheet #hint-text{font-size:16px;line-height:1.5;color:var(--ink)}
.phone-only{display:none}
/* One control for what a digit key enters; actions are icons. */
.board-toolbar{display:flex;gap:8px;align-items:stretch;flex-wrap:nowrap}
.board-toolbar .segmented{display:flex;flex:1 1 auto;border:1px solid var(--line);border-radius:10px;overflow:hidden;background:#fdfcf9}
.board-toolbar .segmented button{flex:1;border:0;border-radius:0;border-right:1px solid var(--line);font-size:14px;padding:10px 6px;min-height:44px;background:none}
.board-toolbar .segmented button:last-child{border-right:0}
.board-toolbar .segmented button[aria-pressed=true]{background:#426c59;color:#fff;font-weight:600}
.board-toolbar button.tool{flex:0 0 auto;font-size:14px;padding:10px 12px;min-height:44px}
.board-toolbar button.icon{flex:0 0 44px;font-size:20px;padding:0;min-height:44px}
/* Keypad: how many of each digit are still to place. */
#keypad button{position:relative;padding:6px 0 16px;min-height:52px}
#keypad button::after{content:attr(data-left);position:absolute;left:0;right:0;bottom:4px;font-size:12px;line-height:1;color:var(--muted);font-weight:400}
#keypad button.digit-complete::after{content:""}
/* Home: opening a collection lets later tiles fill the row it leaves; the next puzzle is the main action. */
#collections{grid-auto-flow:dense}
.path-card:not(.later){background:#426c59;border-color:#426c59;color:#fff}
.path-card:not(.later) small{color:#dfeae3}
.path-card:not(.later) strong::after{content:"  →"}
/* In-grid marks are the one place below 12px: nine digits must fit a phone cell. */
#board .cell .corner-marks{font-size:clamp(10px,.9vw,12px)}
@media(max-width:700px){
 .phone-only{display:inline-block}
 .workspace{padding-left:8px;padding-right:8px}
 .board-toolbar{flex-wrap:wrap}.board-toolbar .segmented{flex:1 1 100%}.board-toolbar button.tool{flex:1 1 auto}
 .play-actions{flex-wrap:wrap;gap:8px}.play-actions button{min-height:44px;font-size:14px;padding:8px 12px}#play-status{flex:1 1 100%;order:3;font-size:14px}
 /* The hint opens as a sheet over the bottom of the screen. */
 #hint-sheet{display:none}
 body.hint-open #hint-sheet{display:block;position:fixed;left:0;right:0;bottom:0;z-index:40;background:#fbfaf6;border-top:1px solid var(--line);border-radius:16px 16px 0 0;box-shadow:0 -10px 30px #1f2d2733;padding:18px 16px calc(16px + env(safe-area-inset-bottom));max-height:55vh;overflow:auto}
 body.hint-open #hint-sheet button{width:100%;min-height:44px;margin-top:8px}
 #board .cell .corner-marks{font-size:10px}
}
/* A digit in a cell that carries a cage sum sits a little lower and to the right, clear of the sum. */
#board .cell.has-sum .digit{transform:translate(2px,4px)}
@media(max-width:700px){#hint-quick{background:#426c59;color:#fff;border-color:#426c59;font-weight:600}}
/* ---- Second review pass ---- */
/* The wordmark: two words, the second in small capitals. */
.brand{letter-spacing:-.3px}.brand-name{display:inline-flex;align-items:baseline;gap:7px}
.brand-light{font-weight:500;font-size:12px;letter-spacing:.16em;text-transform:uppercase;color:var(--muted)}
/* No blank band above the hint button when no hint is open. */
#hint-sheet #hint-title:empty~#hint{margin-top:0}
/* Laptop: the grid takes the height the window leaves, so the toolbar and keypad stay on screen. */
@media(min-width:901px){
 main{padding-top:18px}
 .session-stats{margin-bottom:8px}.solve-nav{margin-bottom:6px}
 .workspace{grid-template-columns:auto minmax(240px,300px);justify-content:center}
 .play-area{width:min(570px,max(340px,calc(100vh - 372px)))}
 .board-toolbar{margin-top:10px}#keypad{margin-top:8px}.play-actions{margin-top:8px}
}
/* Phone: cage sums a size up, and digits moved further clear of them. */
@media(max-width:700px){#overlay .cage-sum{font-size:17px}#board .cell.has-sum .digit{transform:translate(3px,6px)}}
@media(min-width:901px){
 body[data-screen=play] header{padding-top:10px;padding-bottom:10px}body[data-screen=play] header .mark{font-size:28px}
 body[data-screen=play] main{padding-top:12px}
 .play-area{width:min(570px,max(300px,calc(100vh - 352px)))}
}
@media(min-width:901px){body[data-screen=play] header{height:54px}.play-area{width:min(570px,max(300px,calc(100vh - 362px)))}}
/* On a short window the grid shrinks, not the controls: they keep the width they need. */
@media(min-width:901px){.play-area{width:min(570px,max(430px,calc(100vh - 362px)))}.board-wrap{width:min(100%,max(300px,calc(100vh - 362px)));margin-left:auto;margin-right:auto}}
