:root{--bg:#f4f0e7;--surface:#fffdf8;--ink:#17294c;--muted:#5f6878;--line:#d9d2c0;--accent:#db3016;--accent-ink:#fff;--action:#15803d;--action-ink:#fff;--good:#2f7a4b;--bad:#b3261e;--mode-on:#366899;--turn:#0077b6;--turn-wash:#0077b624;--toast-good:green;--sq-light:#ece5d1;--sq-dark:#84987f;--sq-last:#e2aa3480;--sq-selected:#073e5661;--dot:#17294c52;--coord-on-light:#6f8169;--coord-on-dark:#f1ecdd;--piece-white:#f7f1e3;--piece-white-line:#3b2f22;--piece-black:#2e2e33}:root[data-theme=dark]{--bg:#0d1117;--surface:#161c26;--ink:#f4f0e7;--muted:#a3a9b4;--line:#2a3240;--accent:#e5492f;--good:#6cc48d;--bad:#ff8a80;--turn-wash:#0077b647;--sq-light:#c9c1aa;--sq-dark:#627560;--sq-selected:#78bedc73;--dot:#0b0f1766;--coord-on-light:#56664f;--coord-on-dark:#e2dcc9}*{box-sizing:border-box}html,body{background:var(--bg);color:var(--ink);-webkit-tap-highlight-color:transparent;margin:0;font:16px/1.45 system-ui,-apple-system,Segoe UI,sans-serif}button{font:inherit;color:inherit}.loading{min-height:100dvh;color:var(--muted);place-content:center;justify-items:center;gap:12px;display:grid}.loading p{margin:0}.app{max-width:640px;height:100dvh;padding:max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));flex-direction:column;gap:6px;margin:0 auto;display:flex}.top{align-items:center;gap:12px;min-height:44px;display:flex}.top h1{letter-spacing:-.01em;margin:0;font-size:1.45rem;font-weight:800;line-height:1}.modes{align-items:center;font-size:.875rem;font-weight:500;display:flex}.modes button{cursor:pointer;color:var(--ink);background:0 0;border:0;border-radius:4px;padding:2px 10px;transition:background-color .2s}.modes button[aria-pressed=true]{background:var(--mode-on);color:#fff}.modes .divider{color:var(--muted);padding:0 6px}.icon-button{cursor:pointer;color:var(--ink);background:0 0;border:0;place-items:center;padding:4px;transition:opacity .2s;display:grid}.icon-button:hover:not(:disabled){opacity:.7}.top .theme{margin-left:auto}.segmented button{cursor:pointer;color:var(--muted);background:0 0;border:0;border-radius:999px;padding:5px 14px}.segmented button[aria-pressed=true]{background:var(--ink);color:var(--bg)}.games-menu{flex:none;position:relative}.menu-button{width:32px;height:32px;color:var(--ink);cursor:pointer;background:0 0;border:0;border-radius:8px;place-items:center;padding:0;transition:opacity .2s;display:grid;position:relative}.menu-button:hover{opacity:.7}.menu-button:before{content:"";position:absolute;inset:-6px}.menu-button[aria-expanded=true]{background:var(--line)}.menu-panel{z-index:15;overscroll-behavior:contain;background:var(--surface);width:min(280px,100vw - 32px);max-height:calc(100dvh - 64px);color:var(--ink);border:1px solid var(--line);border-radius:12px;padding:6px;position:absolute;top:calc(100% + 8px);right:0;overflow-y:auto;box-shadow:0 12px 32px #00000038}.menu-label{letter-spacing:.04em;color:var(--muted);margin:0;padding:6px 10px 4px;font-size:.75rem}.menu-game{min-height:44px;color:var(--ink);border-radius:8px;flex-direction:column;justify-content:center;padding:6px 10px;text-decoration:none;display:flex}.menu-game:hover{background:var(--bg)}.menu-game:focus-visible{outline:2px solid var(--ink);outline-offset:-2px}.menu-game-name{font-weight:500}.menu-game-tagline{color:var(--muted);font-size:.8rem;line-height:1.3}.play{flex-direction:column;flex:1;gap:6px;min-height:0;display:flex}.strip{align-items:center;gap:8px;min-height:30px;font-size:.95rem;display:flex}.strip .name{font-weight:600}.strip .detail{color:var(--muted);font-size:.85rem}.strip.active .name:after{content:"";background:var(--turn);vertical-align:middle;border-radius:50%;width:7px;height:7px;margin-left:7px;display:inline-block}.swatch{border:1.5px solid var(--piece-white-line);border-radius:4px;flex:none;width:14px;height:14px}.swatch-w{background:var(--piece-white)}.swatch-b{background:var(--piece-black)}.taken{align-items:center;margin-left:auto;display:flex}.piece.mini{width:20px;height:20px;margin-left:-5px}.lead{color:var(--muted);margin-left:4px;font-size:.85rem}.delta{font-size:.9rem;font-weight:600}.delta.up{color:var(--good)}.delta.down{color:var(--bad)}.board-area{flex:1;place-items:center;min-height:260px;display:grid;container-type:size}.table{flex-direction:column;gap:6px;width:min(100cqw,100cqh - 140px);display:flex}.board{aspect-ratio:1;width:100%;box-shadow:0 1px 0 var(--line), 0 6px 18px #17294c24;touch-action:none;-webkit-user-select:none;user-select:none;border-radius:6px;grid-template:repeat(8,1fr)/repeat(8,1fr);display:grid;position:relative;overflow:hidden}.square.hover:before{content:"";box-shadow:inset 0 0 0 3px var(--ink);opacity:.55;position:absolute;inset:0}.square .piece.lifted{opacity:.3}.drag-piece{z-index:5;pointer-events:none;position:absolute;top:0;left:0}.drag-piece .piece{filter:drop-shadow(0 4px 6px #0000004d);width:100%;height:100%}.board.dragging{cursor:grabbing}.square{cursor:pointer;border:0;place-items:center;margin:0;padding:0;display:grid;position:relative}.square:disabled{cursor:default}.square.light{background:var(--sq-light)}.square.dark{background:var(--sq-dark)}.square.last:before,.square.selected:before,.square.check:before{content:"";position:absolute;inset:0}.square.last:before{background:var(--sq-last)}.square.selected:before{background:var(--sq-selected)}.square.check:before{background:radial-gradient(circle,#db3016d9 0%,#db301673 45%,#0000 72%)}.square.move:after{content:"";background:var(--dot);border-radius:50%;width:30%;height:30%;position:absolute}.square.capture:after{content:"";border:.35em solid var(--dot);border-radius:50%;position:absolute;inset:4%}.square .piece{z-index:1;width:90%;height:90%;position:relative}.coord{z-index:2;pointer-events:none;font-size:clamp(9px,2.4cqw,13px);font-weight:600;line-height:1;position:absolute}.coord.rank{top:3px;left:3px}.coord.file{bottom:3px;right:4px}.square.light .coord{color:var(--coord-on-light)}.square.dark .coord{color:var(--coord-on-dark)}.piece-w{--p-body:#f7f1e3;--p-shade:#e4d8bf;--p-line:#3b2f22;--p-detail:#3b2f22}.piece-b{--p-body:#2e2e33;--p-shade:#1c1c20;--p-line:#0e0e10;--p-detail:#cdbf9e}.piece .body,.piece .accent{fill:var(--p-body)}.piece .shade{fill:var(--p-shade)}.piece .outline,.piece .accent{stroke:var(--p-line);stroke-width:2.2px;stroke-linejoin:round}.piece .outline{fill:none}.piece .accent .eye{fill:var(--p-detail);stroke:none}.piece .detail{fill:none;stroke:var(--p-detail);stroke-width:2.6px;stroke-linecap:round}.status{text-align:center;min-height:1.45em;margin:0;font-size:1.15rem;font-weight:600}.status.wrong{color:var(--bad)}.status.solved{color:var(--good)}.moves{white-space:nowrap;color:var(--muted);scrollbar-width:none;gap:10px;min-height:1.4em;margin:0;padding:0 0 2px;font-size:.85rem;list-style:none;display:flex;overflow-x:auto}.moves li:last-child{color:var(--ink);font-weight:600}.actions,.dialog-actions{gap:10px;display:flex}.actions button,.dialog-actions button{border:1px solid var(--line);background:var(--surface);cursor:pointer;border-radius:10px;flex:1;min-height:44px;font-weight:600}.actions button.primary,.dialog-actions button.primary{background:var(--action);border-color:var(--action);color:var(--action-ink)}.actions button:disabled{opacity:.45;cursor:default}.backdrop{z-index:10;background:#0b0f1773;place-items:center;padding:16px;display:grid;position:fixed;inset:0}.dialog{background:var(--surface);width:min(420px,100%);max-height:calc(100dvh - 32px);color:var(--ink);border-radius:14px;padding:20px;overflow-y:auto;box-shadow:0 18px 50px #0000004d}.dialog h2{margin:0 0 12px;font-size:1.2rem}.dialog p{color:var(--muted);margin:0 0 16px}.dialog fieldset{border:0;margin:0 0 16px;padding:0}.dialog legend{margin-bottom:8px;padding:0;font-weight:600}.segmented{border:1px solid var(--line);border-radius:999px;padding:3px;display:flex}.segmented button{flex:1}.levels{gap:8px;display:grid}.levels button{text-align:left;border:1px solid var(--line);cursor:pointer;background:0 0;border-radius:10px;padding:9px 12px;display:grid}.levels button small{color:var(--muted);font-weight:400}.rating-change strong{color:var(--ink)}.levels button span{color:var(--muted);font-size:.85rem}.levels button[aria-pressed=true]{border-color:var(--ink);box-shadow:inset 0 0 0 1px var(--ink)}.promotion{grid-template-columns:repeat(4,1fr);gap:8px;display:grid}.promotion button{aspect-ratio:1;border:1px solid var(--line);background:var(--sq-light);cursor:pointer;border-radius:10px;padding:6px}.promotion .piece{width:100%;height:100%}@media (width<=360px){.top{gap:6px}.menu-button{width:28px}.top h1{font-size:1.2rem}.modes button{padding:2px 7px}}.app .loading{flex:1;min-height:0}.scores{justify-content:space-between;align-items:center;gap:8px;height:54px;display:flex}.chip{border:1px solid var(--line);background:var(--surface);border-radius:8px;flex-direction:column;min-width:92px;padding:4px 12px;transition:border-color .3s,background-color .3s;display:flex}.chip.end{align-items:flex-end}.chip.active{border-color:var(--turn);background:var(--turn-wash)}.chip-label{color:var(--muted);font-size:.85rem;font-weight:500;line-height:1.2}.chip-value{font-variant-numeric:tabular-nums;opacity:.55;align-items:baseline;gap:6px;font:700 1.4rem/1.2 ui-monospace,SFMono-Regular,Menlo,monospace;transition:opacity .3s;display:flex}.chip.active .chip-value,.chip.counting .chip-value{opacity:1}.chip-value .delta{font:600 .85rem system-ui,-apple-system,Segoe UI,sans-serif}.turn{text-align:center;flex-direction:column;align-items:center;min-width:0;line-height:1.25;display:flex}.turn .name{white-space:nowrap;align-items:center;gap:6px;font-weight:600;display:flex}.turn .detail{color:var(--muted);-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:.8rem;display:-webkit-box;overflow:hidden}.puzzles .table{width:min(100cqw,100cqh - 62px)}.vs-computer .table{width:min(100cqw,100cqh - 72px)}.vs-computer .status-slot{height:auto;min-height:40px}.dock{flex-direction:column;gap:4px;display:flex}.status-slot{place-items:center;height:40px;display:grid;position:relative}.puzzles .status{white-space:nowrap;text-overflow:ellipsis;max-width:100%;font-size:min(1.3rem,5.4vw);overflow:hidden}.status .side{border:2px solid var(--ink);border-radius:6px;margin-left:2px;padding:0 9px;font-weight:700;line-height:1.35;display:inline-block}.status .side-w{background:var(--piece-white);color:#17294c}.status .side-b{background:var(--piece-black);color:#f4f0e7}.toast{background:var(--toast-good);color:#fff;letter-spacing:.02em;text-transform:uppercase;white-space:nowrap;pointer-events:none;-webkit-user-select:none;user-select:none;border-radius:4px;padding:4px 9px;font-size:min(1.32rem,5.6vw);font-weight:600;animation:2s ease-out forwards toast-fade;position:absolute}@keyframes toast-fade{0%,50%{opacity:1}to{opacity:0}}.bar{align-items:center;gap:10px;min-height:52px;display:flex}.bar .moves{flex:1;min-width:0;min-height:0;padding:0;font-size:.95rem}.bar .icon-button{border:1px solid var(--line);background:var(--surface);border-radius:12px;flex:none;width:52px;height:52px}.bar .icon-button img{width:40px;height:40px}.bar .icon-button:disabled{opacity:.4;cursor:default}.flag path:first-child{stroke:var(--ink)}.flag path:last-child{fill:#fff;stroke:var(--ink)}.bar .next{border:1px solid var(--action);background:var(--action);min-height:48px;color:var(--action-ink);cursor:pointer;border-radius:10px;flex:none;padding:0 20px;font-weight:600}
