:root{--bg:#f4f0e7;--surface:#fffdf8;--ink:#17294c;--muted:#5f6878;--line:#d9d2c0;--accent:#db3016;--accent-ink:#fff;--good:#2f7a4b;--bad:#b3261e;--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;--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;display:flex}.top h1{letter-spacing:.01em;margin:0;font-size:1.25rem}.tabs{border:1px solid var(--line);border-radius:999px;margin:0 auto;padding:3px;display:flex}.tabs button,.segmented button{cursor:pointer;color:var(--muted);background:0 0;border:0;border-radius:999px;padding:5px 14px}.tabs button[aria-pressed=true],.segmented button[aria-pressed=true]{background:var(--ink);color:var(--bg)}.theme{border:1px solid var(--line);color:var(--muted);cursor:pointer;background:0 0;border-radius:8px;min-width:56px;padding:4px 10px;font-size:.85rem}.games-menu{flex:none;position:relative}.menu-button{border:1px solid var(--line);width:30px;height:30px;color:var(--muted);cursor:pointer;background:0 0;border-radius:8px;place-items:center;padding:0;display:grid;position:relative}.menu-button:before{content:"";position:absolute;inset:-7px -4px}.menu-button[aria-expanded=true]{color:var(--ink);border-color:var(--ink)}.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(--accent);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)}.puzzle-info .detail,.puzzles .strip:not(.puzzle-info) .detail{margin-left:auto}.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{min-height:1.45em;margin:0;font-weight:500}.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:not(.empty){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(--accent);border-color:var(--accent);color:var(--accent-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.05rem}.tabs button{padding:5px 10px}}.app .loading{flex:1;min-height:0}
