: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;--wrong-square:#d9261ed9;--wrong:#c2410c;--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;--chip:#ebe5d6}: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;--chip:#2a3240}*{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 .account{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:start center;min-height:260px;display:grid;container-type:size}@media (height<=480px){.board-area{min-height:0}}.table{flex-direction:column;gap:6px;width:min(100cqw,100cqh - 140px);display:flex}.daily-checks{justify-content:center;gap:5px;margin-top:4px;display:flex}.daily-check{border:1.5px solid var(--line);border-radius:50%;place-items:center;width:16px;height:16px;display:grid}.daily-check svg{width:11px;height:11px}.daily-limit .daily-checks{gap:8px}.daily-limit .daily-check{width:22px;height:22px}.daily-limit .daily-check svg{width:14px;height:14px}.daily-check.done{border-color:var(--action);background:var(--action);color:var(--action-ink)}.daily-limit{text-align:center;flex-direction:column;flex:1;justify-content:center;align-items:center;gap:12px;padding:24px 8px;display:flex}.daily-limit h2{margin:4px 0 0;font-size:1.3rem}.daily-limit p{max-width:320px;color:var(--muted);margin:0}.daily-limit-join{background:var(--action);color:var(--action-ink);border-radius:10px;margin-top:8px;padding:12px 22px;font-weight:600;text-decoration:none}.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.wrong:before{content:"";background:var(--wrong-square);animation:2.6s linear forwards wrong-square;position:absolute;inset:0}@keyframes wrong-square{0%,77%{opacity:1}to{opacity:0}}.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;position:relative;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}@media (width<=360px){.chip{min-width:0;padding:4px 8px}.chip-value{font-size:1.2rem}.turn .name{gap:4px;font-size:.9rem}}.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}.puzzles .status.wrong{background:var(--wrong);color:#fff;border-radius:4px;padding:2px 10px}.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}.bar .next:has(>svg:only-child){border-radius:12px;place-items:center;width:52px;height:52px;padding:0;display:grid}.choices,.sign-in-choices{gap:10px;display:grid}.choices button,.sign-in-choices button{cursor:pointer;background:0 0;border:2px solid #16a34a;border-radius:8px;min-height:48px;font-size:1rem;font-weight:600}.choices button.quiet{min-height:36px;color:var(--muted);border:0;font-weight:500}.choices button:disabled,.sign-in-choices button:disabled{opacity:.5;cursor:default}.sign-in-choices button.provider{color:#1f1f1f;background:#fff;border:1px solid #747775;border-radius:10px;justify-content:center;align-items:center;gap:12px;min-height:62px;font-size:17px;font-weight:500;display:flex}:root[data-theme=dark] .sign-in-choices button.provider{color:#e3e3e3;background:#131314;border-color:#8e918f}.dialog h2{text-align:center}.field{gap:6px;margin-bottom:14px;font-weight:600;display:grid}.field input,.age-pickers select{border:1px solid var(--line);background:var(--bg);height:44px;color:var(--ink);font:inherit;border-radius:8px;padding:0 10px;font-size:16px}.age-pickers{gap:8px;margin-bottom:14px;display:flex}.age-pickers select{flex:1;min-width:0}.form-error{font-size:.9rem;color:var(--bad)!important}.friend-list{gap:8px;max-height:40vh;margin:0 0 16px;padding:0;list-style:none;display:grid;overflow-y:auto}.friend-list li{border-bottom:1px solid var(--line);justify-content:space-between;align-items:center;gap:10px;padding:6px 0;font-weight:600;display:flex}.friend-list button{cursor:pointer;background:0 0;border:2px solid #16a34a;border-radius:8px;padding:6px 14px;font-weight:600}.invite-link{word-break:break-all;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--ink)!important}.friend-games{gap:12px}.games-head{justify-content:space-between;align-items:center;display:flex}.games-head h2{margin:0;font-size:1.2rem}.games-head button{border:1px solid var(--action);background:var(--action);min-height:40px;color:var(--action-ink);cursor:pointer;border-radius:10px;padding:0 16px;font-weight:600}.game-list{gap:8px;margin:0;padding:0;list-style:none;display:grid;overflow-y:auto}.game-list button{border:1px solid var(--line);background:var(--surface);text-align:left;cursor:pointer;border-radius:10px;grid-template-columns:auto 1fr auto;align-items:center;gap:10px;width:100%;padding:12px 14px;display:grid}.game-list button.urgent{border-color:var(--turn);background:var(--turn-wash)}.game-list .who{text-overflow:ellipsis;white-space:nowrap;font-weight:600;overflow:hidden}.game-list .what{color:var(--muted);font-size:.9rem}.game-list button.urgent .what{color:var(--ink);font-weight:600}.muted{color:var(--muted)}.center{text-align:center;margin-top:30vh}.bar .text-button{border:1px solid var(--line);background:var(--surface);cursor:pointer;border-radius:10px;flex:none;min-height:44px;padding:0 12px;font-weight:600}.bar .icon-button .half{font-size:1.5rem;font-weight:700;line-height:1}.name-fields{grid-template-columns:1fr 1fr;gap:8px;display:grid}.name-fields .field{min-width:0;margin-bottom:8px}.name-fields input{min-width:0}.dialog .note{color:var(--muted);margin:4px 0 0;font-size:.85rem}.dialog .save-name{min-height:40px;color:var(--ink);font:inherit;cursor:pointer;background:0 0;border:2px solid #16a34a;border-radius:8px;padding:0 16px;font-weight:600}.dialog .save-name:disabled{opacity:.5;cursor:default}.dialog .switches{border:0;border-top:1px solid var(--line);margin:14px 0;padding:12px 0 0}.dialog .switches legend{padding:0 6px 0 0;font-weight:600}.switch-row{cursor:pointer;align-items:center;gap:10px;min-height:44px;display:flex}.switch-row input{accent-color:#16a34a;flex:none;width:20px;height:20px}.dialog-corner{z-index:2;gap:8px;display:flex;position:absolute;top:14px;right:14px}.settings{position:relative}.settings-cog{background:var(--chip);width:32px;height:32px;color:var(--ink);cursor:pointer;border:0;border-radius:50%;place-items:center;display:grid}.settings-menu{background:var(--surface);border:1px solid var(--line);border-radius:12px;min-width:260px;position:absolute;top:40px;right:0;overflow:hidden;box-shadow:0 4px 20px #0003}.settings-row{gap:10px;padding:16px;display:grid}.settings-row+.settings-row{border-top:1px solid var(--line)}.toggle-row{grid-template-columns:1fr auto;align-items:center;padding:14px 16px}.toggle{background:var(--line);cursor:pointer;border:0;border-radius:12px;width:44px;height:24px;padding:0;transition:background .2s;position:relative}.toggle[aria-checked=true]{background:#3b82f6}.toggle-knob{background:#fff;border-radius:50%;width:20px;height:20px;transition:left .2s;position:absolute;top:2px;left:2px;box-shadow:0 1px 3px #0003}.toggle[aria-checked=true] .toggle-knob{left:22px}.settings-label{letter-spacing:.02em;font-size:.85rem;font-weight:500}.mode-switch{background:var(--chip);border:1.5px solid var(--line);border-radius:100px;grid-template-columns:1fr 1fr 1fr;padding:3px;display:grid;position:relative}.mode-thumb{background:#fff;border-radius:100px;width:calc(33.3333% - 2px);height:calc(100% - 6px);transition:left .25s cubic-bezier(.4,0,.2,1);position:absolute;top:3px;box-shadow:0 1px 4px #00000026}.mode-switch button{z-index:1;color:var(--muted);cursor:pointer;background:0 0;border:0;border-radius:100px;padding:7px 0;font-size:.82rem;transition:color .2s;position:relative}.mode-switch button[aria-checked=true]{color:#17294c;font-weight:600}.settings-cog.close{padding:0;font-size:1.25rem;line-height:1}.dialog.profile legend,.dialog.profile .field>span{color:var(--muted);text-transform:uppercase;letter-spacing:.05em;font-size:.75rem;font-weight:400}.stat-grid{grid-template-columns:1fr 1fr;gap:12px;margin-bottom:8px;display:grid}.dialog .stat-card{background:var(--bg);text-align:center;border-radius:12px;padding:12px}.dialog .stat-value{color:var(--ink);margin:0 0 4px;font-size:1.5rem;font-weight:700}.dialog .stat-value.empty{color:var(--muted)}.dialog .stat-label{color:var(--muted);text-transform:uppercase;letter-spacing:.05em;margin:0;font-size:.7rem}.dialog .stat-note{text-align:center;margin:0 0 24px;font-size:.75rem}[data-reduce-motion=true] *,[data-reduce-motion=true] :before,[data-reduce-motion=true] :after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}[data-reduce-motion=true] .toast{animation:2s step-end forwards toast-hold!important}[data-reduce-motion=true] .square.wrong:before{animation:none!important}@keyframes toast-hold{to{opacity:0}}:root[data-high-contrast=true]{--ink:#0b1630;--muted:#2f3846;--line:#7d7563;--chip:#ddd5c2;--dot:#0b16308c;--coord-on-light:#3e4d39;--coord-on-dark:#fff}:root[data-theme=dark][data-high-contrast=true]{--ink:#fff;--muted:#d4d8de;--line:#6b7686;--chip:#3a4456;--dot:#0b0f1799;--coord-on-light:#2f3a2b;--coord-on-dark:#fff}
