:root{--bg:#f3f6f9;--surface:#fff;--text:#24364b;--muted:#52657b;--line:#bbc8d7;--grid:#61748c;--accent:#255b96;--selected:#c8def7;--peer:#edf3fa;--match:#d9e8f9;--error:#9d2436;--errorbg:#ffe6ea;--control:#e6edf5;color-scheme:light;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;font-size:16px}
[data-theme=paper]{--bg:#f4f0e7;--surface:#fffaf0;--text:#493c2e;--muted:#695a48;--line:#c8bba5;--grid:#7e6e54;--accent:#735331;--selected:#e3d2b5;--peer:#f0e9da;--match:#e9dfc6;--control:#ebe2d1}
[data-theme=sage]{--bg:#eaf0e9;--surface:#f8fbf5;--text:#28432f;--muted:#506650;--line:#abc1aa;--grid:#648063;--accent:#346641;--selected:#bedbc0;--peer:#e4eee1;--match:#d2e4cd;--control:#dce8d8}
[data-theme=graphite]{--bg:#171c22;--surface:#212832;--text:#e3e9f1;--muted:#a8b7c9;--line:#455569;--grid:#94a7bc;--accent:#a3c8ef;--selected:#3f5874;--peer:#293545;--match:#35465b;--error:#ffb4bc;--errorbg:#512c38;--control:#303c4c;color-scheme:dark}
[data-theme=midnight]{--bg:#0b1221;--surface:#111e32;--text:#e0ebfc;--muted:#a6bbd9;--line:#354b6b;--grid:#7894bd;--accent:#a4ccff;--selected:#294d7d;--peer:#172b47;--match:#203959;--error:#ffb7c2;--errorbg:#48233a;--control:#1c2f4d;color-scheme:dark}
[data-theme=oled]{--bg:#000000;--surface:#000000;--text:#dedede;--muted:#aaa;--line:#444;--grid:#aaa;--accent:#a1bfd9;--selected:#223545;--peer:#0d141a;--match:#17232d;--error:#ffb5bd;--errorbg:#35131b;--control:#101010;color-scheme:dark}
[data-theme=warm]{--bg:#17120f;--surface:#211b17;--text:#e9ded0;--muted:#bda991;--line:#5d4b3a;--grid:#a99277;--accent:#dfb77c;--selected:#584329;--peer:#30271e;--match:#423421;--error:#efada5;--errorbg:#4d2823;--control:#372b22;color-scheme:dark}
[data-theme=contrast]{--bg:#080808;--surface:#111;--text:#fff;--muted:#e0e0e0;--line:#999;--grid:#fff;--accent:#96e3ff;--selected:#06475d;--peer:#252525;--match:#253b43;--error:#ffd0d0;--errorbg:#651c1c;--control:#282828;color-scheme:dark}
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text)}button,select,input{font:inherit}button,select{min-height:44px;touch-action:manipulation}button{border:1px solid var(--line);background:var(--surface);color:var(--text);border-radius:8px;padding:8px 12px;cursor:pointer;font-size:.85rem;font-weight:600}button:hover{background:var(--peer)}button:focus-visible,select:focus-visible,a:focus-visible,input:focus-visible,summary:focus-visible{outline:3px solid var(--accent);outline-offset:3px}button[aria-pressed=true]{background:var(--selected);border-color:var(--accent)}button[aria-disabled=true]{opacity:.5}a{color:var(--accent)}select{border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--text);padding:8px;font-size:.9rem}input{accent-color:var(--accent)}[hidden]{display:none!important}.shell{max-width:1050px;margin:auto;padding:0 24px}.topbar{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;min-height:92px}.topbar>div{min-width:0;max-width:100%}.brand{font-size:.75rem;letter-spacing:.015em;text-decoration:none;font-weight:700;color:var(--muted)}h1{font-size:36px;line-height:1;margin:5px 0 0;letter-spacing:-.04em}.title-dot{color:var(--accent)}.top-links{display:flex;flex-wrap:wrap;max-width:100%;gap:8px}.top-links button{background:transparent;border-color:transparent;color:var(--muted)}.game{max-width:880px;margin:auto}.game-bar{display:flex;gap:8px;align-items:center;margin-bottom:12px}.game-bar select{font-weight:650;min-width:140px}#new-game{background:var(--accent);color:var(--surface);border-color:var(--accent)}.play-area{display:grid;grid-template-columns:minmax(0,468px) minmax(0,300px);gap:38px;justify-content:center;align-items:start}.board-meta{display:flex;gap:10px;align-items:center;justify-content:space-between;font-size:.75rem;color:var(--muted);min-height:26px}#local-save{white-space:nowrap}#board,#focus-board{display:grid;grid-template-columns:repeat(9,minmax(0,1fr));aspect-ratio:1;border:2px solid var(--grid);background:var(--grid);overflow:hidden;border-radius:3px}.cell{position:relative;min-height:0;min-width:0;border:0;border-right:1px solid var(--line);border-bottom:1px solid var(--line);border-radius:0;padding:0;display:flex;justify-content:center;align-items:center;background:var(--surface);font-size:clamp(18px,3vw,29px);font-weight:450;color:var(--accent);touch-action:manipulation;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;line-height:1}.cell.given{font-weight:700;color:var(--text)}.cell.box-right{border-right:2px solid var(--grid)}.cell.box-bottom{border-bottom:2px solid var(--grid)}.cell.peer{background:var(--peer)}.cell.match{background:var(--match)}.cell.selected{background:var(--selected);box-shadow:inset 0 0 0 2px var(--accent)}.cell.error{color:var(--error);background:var(--errorbg)}.cell.error:after{content:"!";font-size:10px;position:absolute;right:2px;bottom:1px}.cell:focus-visible{outline:none;box-shadow:inset 0 0 0 3px var(--accent);z-index:1}.candidates{display:grid;width:90%;height:90%;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);font-size:clamp(8px,1vw,12px);font-weight:600;color:var(--muted);line-height:1}.candidates span{display:flex;align-items:center;justify-content:center}.control-area{padding-top:26px}.keypad{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}.keypad button{font-size:1.25rem;min-height:54px;padding:4px;font-weight:600;background:var(--control)}.keypad button:nth-child(6){grid-column:2}.keypad button.completed-number:after{content:"✓";font-size:.6rem;padding-left:2px}.tools{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-top:12px}.tools button{display:flex;flex-direction:column;align-items:center;gap:3px;padding:6px 2px;min-height:55px;font-size:.75rem}.tool-icon{font-size:1.25rem;font-weight:400;line-height:1}.utility{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-top:10px}.utility button{padding:4px 2px;font-size:.75rem}.status-line{font-size:.8rem;color:var(--muted);min-height:32px;padding:8px 0}.desktop-note{padding-top:30px;color:var(--muted)}.quiet-mark{font-size:.75rem;letter-spacing:.3em;border-bottom:1px solid var(--line);padding-bottom:10px}.desktop-note p{font-size:1.8rem;line-height:1.25;letter-spacing:-.035em;color:var(--text);margin:20px 0 12px}.desktop-note small{line-height:1.6;display:block;max-width:240px}#board.paused .cell{color:transparent;background:var(--peer)}#board.paused .candidates{visibility:hidden}.about{margin:85px auto 35px;max-width:880px;border-top:1px solid var(--line);padding-top:28px}.about h2{font-size:1.3rem;letter-spacing:-.02em;line-height:1.25}.about p{font-size:.95rem;line-height:1.7;color:var(--muted)}.about-columns{display:grid;grid-template-columns:1fr 1fr;gap:12px 40px}.about details{padding:16px 0;border-top:1px solid var(--line)}summary{cursor:pointer;font-size:.9rem;font-weight:650}.related{display:flex;flex-wrap:wrap;gap:20px}footer{font-size:.75rem;color:var(--muted);padding:24px 0 35px}dialog{background:var(--surface);color:var(--text);border:1px solid var(--grid);border-radius:16px;width:min(620px,calc(100% - 24px));padding:24px;max-height:calc(100dvh - 32px)}dialog::backdrop{background:rgba(0,0,0,.6)}.dialog-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}.dialog-head h2{font-size:1.4rem;letter-spacing:-.03em;margin:0}dialog p{font-size:.9rem;line-height:1.65;color:var(--muted)}fieldset{border:0;border-top:1px solid var(--line);padding:18px 0;margin:0}legend{font-size:.85rem;font-weight:700;padding-right:10px}#preferences label{display:flex;justify-content:space-between;align-items:center;gap:15px;min-height:48px;font-size:.85rem}#preferences .check{justify-content:flex-start;gap:10px}#preferences input[type=checkbox]{width:20px;height:20px}.theme-options{display:grid;grid-template-columns:1fr 1fr;gap:6px}.theme-choice{display:flex;align-items:center;gap:9px;font-size:.75rem;font-weight:500}.swatch{width:22px;height:22px;border:1px solid var(--line);border-radius:50%;background:var(--swatch);display:inline-block}.schedule-row{display:flex;gap:10px;flex-wrap:wrap}.schedule-row label{flex-direction:column;align-items:start!important;gap:4px!important}#preferences button{margin:6px 4px 6px 0}#import-save{max-width:65%;font-size:.75rem}.completion-mark{font-size:40px;color:var(--accent)}.completion-actions{display:flex;gap:8px;flex-wrap:wrap}.stats-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.stat{padding:15px;background:var(--peer);border-radius:6px}.stat strong{display:block;font-size:1.7rem}.stat small{color:var(--muted)}.daily-history{display:grid;grid-template-columns:repeat(7,1fr);gap:5px}.daily-day{padding:8px 2px;text-align:center;font-size:.75rem;border:1px solid var(--line);border-radius:4px}.daily-day.done{background:var(--selected)}.tutorial-row{display:grid;grid-template-columns:repeat(9,1fr);border:1px solid var(--grid);margin:20px 0}.tutorial-row>*{display:flex;align-items:center;justify-content:center;min-height:44px;border-right:1px solid var(--line);font-size:1.1rem}.tutorial-row button{padding:0;border-radius:0;background:var(--selected)}.tutorial-keys{display:flex;gap:8px}.tutorial-keys button{min-width:65px}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}.focus-heading{display:flex;align-items:center;justify-content:space-between;margin:8px 0;font-size:.85rem}#focus-board{grid-template-columns:repeat(3,minmax(0,1fr));max-width:330px;margin:auto}#focus-board .cell{font-size:2rem}#focus-board .candidates{font-size:1rem}.focus-help{text-align:center;font-size:.75rem;color:var(--muted)}[data-focus=true] #board{max-width:180px;margin:auto}[data-focus=true] #board .cell{font-size:12px}[data-focus=true] #board .candidates{font-size:5px}[data-focus=true] #local-save{display:none}[data-layout=onehand] .keypad{grid-template-columns:repeat(3,minmax(0,1fr));max-width:270px;margin-left:auto}[data-layout=onehand] .keypad button:nth-child(6){grid-column:auto}[data-layout=onehand][data-hand=left] .keypad{margin-left:0;margin-right:auto}[data-layout=zen] .board-meta,[data-layout=zen] .desktop-note{visibility:hidden}[data-layout=zen] .top-links #stats{display:none}[data-layout=large] .cell{font-size:2rem;font-weight:650}[data-layout=large] #board{border-width:3px}[data-layout=large] .box-right{border-right-width:3px}[data-layout=large] .box-bottom{border-bottom-width:3px}[data-layout=large] .candidates{font-size:.8rem}[data-layout=large] .keypad button{min-height:60px}
@media(min-width:800px) and (max-height:800px){.topbar{min-height:75px}.play-area{grid-template-columns:minmax(0,420px) 300px}.desktop-note{padding-top:16px}.about{margin-top:50px}}
#settings-dialog{padding-top:0}#settings-dialog .dialog-head{position:sticky;top:0;z-index:1;background:var(--surface);margin:0 -24px 18px;padding:18px 24px;border-bottom:1px solid var(--line)}
@media(max-width:799px){#settings-dialog .dialog-head{margin-left:-18px;margin-right:-18px;padding:18px}.shell{padding:0 12px;max-width:560px}.topbar{min-height:53px}.topbar>div:first-child{display:flex;flex-wrap:wrap;align-items:baseline;gap:12px}.brand{font-size:.65rem}h1{font-size:30px;margin:0}.top-links{gap:0}.top-links button{font-size:.65rem;padding:2px 6px}.game-bar{margin-bottom:6px;gap:6px;display:grid;grid-template-columns:repeat(auto-fit,minmax(5.25rem,1fr))}.game-bar select{width:100%;min-width:0;font-size:.8rem;padding:5px}.game-bar button{font-size:.75rem;padding:4px}.play-area{display:flex;flex-direction:column;gap:6px;align-items:center}.board-area{width:min(100%,calc(100svh - 348px),430px)}.board-meta{min-height:22px;font-size:.65rem}#puzzle-label{max-width:68%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#board .cell{font-size:clamp(17px,6vw,25px)}#board .candidates{font-size:clamp(7px,2vw,10px)}.control-area{padding:0;width:100%;max-width:430px}.keypad{gap:5px}.keypad button{min-height:44px;font-size:1.25rem}.tools{grid-template-columns:repeat(auto-fit,minmax(2.7rem,1fr));gap:5px;margin-top:6px}.tools button{min-height:44px;font-size:.65rem;gap:1px;padding:3px 1px}.tool-icon{font-size:1.1rem}.utility{grid-template-columns:repeat(auto-fit,minmax(5.25rem,1fr));margin-top:6px;gap:5px}.utility button{font-size:.7rem}.status-line{font-size:.65rem;padding:4px 0;min-height:21px}.desktop-note{display:none}.about{margin-top:42px}.about-columns{grid-template-columns:1fr;gap:6px}.about h2{font-size:1.2rem}.about p{font-size:.9rem}dialog{padding:18px}.dialog-head h2{font-size:1.2rem}.theme-choice{font-size:.65rem;padding:6px}.swatch{width:18px;height:18px;flex-shrink:0}[data-layout=onehand] .board-area{width:min(100%,calc(100svh - 393px),430px)}[data-layout=onehand] .keypad{max-width:270px}[data-layout=large] .board-area{width:min(100%,calc(100svh - 360px),430px)}[data-layout=large] #board .cell{font-size:1.7rem}[data-layout=large] .keypad button{min-height:50px}[data-focus=true] .board-area{width:100%}[data-focus=true] .board-meta{display:none}[data-focus=true] #board{max-width:clamp(44px,calc(100svh - 610px),100px)}[data-focus=true] #board .cell{font-size:0}[data-focus=true] #board .cell.given:before{content:"";width:2px;height:2px;border-radius:50%;background:var(--muted)}[data-focus=true] #board .candidates{display:none}[data-focus=true] #focus-board{max-width:min(100%,max(132px,calc(100svh - 480px)));min-width:132px}[data-focus=true] #focus-board .cell{font-size:2rem;min-height:44px}.focus-heading{margin:5px 0}.focus-help{margin:4px 0}}
@media(max-width:359px){.brand{display:none}.topbar{min-height:49px}h1{font-size:28px}.board-area{width:min(100%,calc(100svh - 344px))}.top-links button{font-size:.7rem}}
@media(max-height:500px) and (orientation:landscape){.shell{max-width:860px}.topbar{min-height:48px}.play-area{display:grid;grid-template-columns:minmax(0,calc(100svh - 130px)) 280px;gap:20px}.board-area{width:100%!important}.tools{grid-template-columns:repeat(3,1fr)}.control-area{padding-top:22px}.utility{grid-template-columns:repeat(3,1fr)}.desktop-note{display:none}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}



/* Shared save/account UI follows this game's theme and never covers its controls. */
body[data-rex-app=sudoku] .rex-progress-pill{position:static;max-width:880px;margin:16px auto;padding:12px;right:auto;bottom:auto;left:auto;background:var(--surface);color:var(--text);border:1px solid var(--line);border-radius:8px;box-shadow:none;backdrop-filter:none;font:600 .8rem/1.4 system-ui,sans-serif;z-index:auto}
body[data-rex-app=sudoku] .rex-progress-pill button{background:var(--accent);color:var(--surface);border-radius:6px;font:600 .8rem system-ui,sans-serif}
body[data-rex-app=sudoku] :is(.rex-progress-conflict,.rex-progress-loss){background:var(--surface);color:var(--text);border-color:var(--grid);box-shadow:none;font-family:system-ui,sans-serif}
body[data-rex-app=sudoku] :is(.rex-progress-conflict,.rex-progress-loss) h2{font:700 1.4rem/1.25 system-ui,sans-serif;color:var(--text)}
body[data-rex-app=sudoku] :is(.rex-progress-conflict,.rex-progress-loss) p{color:var(--muted)}
body[data-rex-app=sudoku] :is(.rex-conflict-card,.rex-conflict-actions button,.rex-loss-actions button){border-color:var(--line);color:var(--text)}
body[data-rex-app=sudoku] :is(.rex-conflict-actions,.rex-loss-actions) .primary{background:var(--accent);color:var(--surface)}
@media(max-width:799px){body[data-rex-app=sudoku] .rex-progress-pill{margin:12px}}

