:is(#chess-app,.chess-study){--sq-light:#f0d9b5;--sq-dark:#b58863;--sq-last:#cdd26acc;--sq-last-dark:#aaa23acc;--sq-select:#14551e80;--sq-dot:#14551e80;--sq-check:#e3200f}#chess-app[data-board=green]{--sq-light:#ebecd0;--sq-dark:#739552;--sq-last:#f5f682;--sq-last-dark:#b9ca43;--sq-select:#0000004d;--sq-dot:#00000029}#chess-app[data-board=slate]{--sq-light:#dee3e6;--sq-dark:#8ca2ad;--sq-last:#c3d888;--sq-last-dark:#92b166;--sq-select:#1e4a6c73;--sq-dot:#1e4a6c66}#chess-app{--panel:var(--soft);--panel-ink:var(--ink);--tone-strong:color-mix(in srgb, var(--ink) 14%, var(--soft));width:100%;min-width:0;max-width:1180px;margin:auto;padding:20px}#chess-app [hidden]{display:none!important}.chess-table{--board:clamp(300px, calc(100svh - 200px), 640px);grid-template-columns:200px min(var(--board), calc(100% - 530px)) 290px;grid-template-rows:auto minmax(0,1fr) auto;grid-template-areas:"side board top""side board game""side board bottom";justify-content:center;gap:10px 20px;display:grid}.chess-board-wrap{grid-area:board;align-self:start;min-width:0}.chess-player-top{grid-area:top}.chess-player-bottom{grid-area:bottom}.chess-game-card{grid-area:game}.chess-side{grid-area:side;align-self:start}.chess-board{aspect-ratio:1;touch-action:pan-y;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;border-radius:3px;grid-template-rows:repeat(8,minmax(0,1fr));grid-template-columns:repeat(8,minmax(0,1fr));width:100%;display:grid;overflow:hidden}:is(#chess-app,.chess-study) .chess-square{all:unset;box-sizing:border-box;aspect-ratio:1;background:var(--sq-light);cursor:pointer;touch-action:pan-y;place-items:center;min-width:0;min-height:0;display:grid;position:relative}:is(#chess-app,.chess-study) .chess-square.dark{background:var(--sq-dark)}:is(#chess-app,.chess-study) .chess-square.last{background:var(--sq-last)}:is(#chess-app,.chess-study) .chess-square.dark.last{background:var(--sq-last-dark)}:is(#chess-app,.chess-study) .chess-square.selected:before{content:"";background:var(--sq-select);position:absolute;inset:0}:is(#chess-app,.chess-study) .chess-square.check{background-image:radial-gradient(circle, var(--sq-check) 0%, #e3200fa6 30%, #a9000040 62%, transparent 80%)}.chess-square .chess-piece{z-index:1;pointer-events:none;will-change:transform;width:92%;height:92%;position:relative}#chess-app[data-mouse] .chess-square.own{cursor:grab}.chess-square.drag-origin .chess-piece{opacity:.3}#chess-app .chess-square.drag-over{outline-offset:-4px;outline:4px solid #ffffffb3}.chess-square.legal:after{content:"";background:var(--sq-dot);z-index:2;pointer-events:none;border-radius:50%;width:30%;height:30%;position:absolute}.chess-square.capture:after{box-sizing:border-box;border:.42em solid var(--sq-dot);border-width:max(5px, 9%);background:0 0;border-radius:50%;width:100%;height:100%}@media (hover:hover){#chess-app .chess-square.legal:hover:before{content:"";background:var(--sq-dot);position:absolute;inset:0}}:is(#chess-app,.chess-study) .chess-square:focus-visible{outline-offset:-3px;z-index:3;outline:3px solid #1d6fd8}.chess-coordinate{font:600 clamp(9px, 1.25vw, 13px) / 1 var(--font-number,system-ui), system-ui;z-index:2;pointer-events:none;color:var(--sq-dark);position:absolute}.chess-square.dark .chess-coordinate{color:var(--sq-light)}.chess-study .chess-square .chess-coordinate{color:#000}.chess-file{bottom:3px;right:4px}.chess-rank{top:3px;left:4px}.chess-drag-ghost{z-index:1000;pointer-events:none;position:fixed;top:0;left:0;translate:-50% -50%}.chess-drag-ghost .chess-piece{width:100%;height:100%}.chess-board.reviewing .chess-square{cursor:default}.chess-player{background:var(--panel);min-height:56px;color:var(--panel-ink);border-radius:8px;grid-template-columns:30px minmax(0,1fr) auto;grid-template-areas:"mark name state""mark taken taken";align-items:center;gap:2px 10px;padding:8px 12px;display:grid}.chess-player.to-move{background:var(--tone-strong)}.chess-player-mark{grid-area:mark;width:30px;height:30px}.chess-player-mark .chess-piece{width:100%;height:100%}.chess-player-name{white-space:nowrap;text-overflow:ellipsis;grid-area:name;font-size:15px;font-weight:700;overflow:hidden}.chess-player-state{color:var(--muted);white-space:nowrap;grid-area:state;font-size:13px}.chess-player.to-move .chess-player-state{color:var(--ink);font-weight:700}.chess-player-state.thinking:after{content:"";text-align:left;width:1.2em;animation:1.2s steps(4,end) infinite chess-dots;display:inline-block}@keyframes chess-dots{0%{content:""}25%{content:"."}50%{content:".."}75%{content:"..."}}.chess-player-taken{font-variant-numeric:tabular-nums;min-height:20px;color:var(--muted);flex-wrap:wrap;grid-area:taken;align-items:center;font-size:13px;display:flex}.chess-player-taken:empty{display:none}.chess-player-taken .chess-piece{width:22px;height:22px;margin-right:-8px}.chess-player-taken .chess-taken-gap{width:12px}.chess-player-taken .chess-score{color:var(--ink);margin-left:12px;font-weight:700}.chess-game-card{background:var(--panel);border-radius:8px;flex-direction:column;min-height:0;display:flex;overflow:hidden}.chess-status{gap:2px;padding:12px 14px 10px;display:grid}.chess-status strong{font-size:17px;line-height:1.35}.chess-status span{color:var(--muted);font-size:13px}#chess-app.game-over .chess-status strong{font-size:19px}.chess-notice{color:var(--ink);margin:0 14px 8px;font-size:13px;line-height:1.5}.chess-notice:empty{display:none}.chess-moves{background:var(--surface);font-variant-numeric:tabular-nums;overscroll-behavior:contain;flex:1 1 0;min-height:120px;margin:0;padding:4px 0;list-style:none;overflow-y:auto}.chess-moves li{grid-template-columns:44px 1fr 1fr;align-items:center;min-height:30px;display:grid}.chess-move-no{color:var(--muted);padding-left:14px;font-size:13px}.chess-move{all:unset;box-sizing:border-box;cursor:pointer;height:28px;color:var(--ink);border-radius:4px;margin-right:4px;padding:0 10px;font-size:15px}.chess-move:hover{background:var(--soft)}.chess-move:focus-visible{outline-offset:-2px;outline:2px solid #1d6fd8}.chess-move[aria-current=step]{background:var(--tone-strong);font-weight:700}.chess-moves .chess-moves-empty{color:var(--muted);padding:10px 14px;font-size:14px;display:block}.chess-moves .chess-moves-result{padding:8px 14px;font-size:14px;font-weight:700;display:block}.chess-review{background:var(--yellow-soft);justify-content:space-between;align-items:center;gap:8px;padding:8px 14px;font-size:13px;display:flex}.chess-nav{grid-template-columns:repeat(4,1fr);gap:2px;padding:6px;display:grid}.chess-icon-button,.chess-action{all:unset;box-sizing:border-box;color:var(--ink);cursor:pointer;border-radius:6px;place-items:center;transition:background-color .12s,transform 80ms;display:grid}.chess-icon-button{height:36px}.chess-icon-button svg,.chess-action svg{fill:none;stroke:currentColor;stroke-width:2px;stroke-linecap:round;stroke-linejoin:round;width:20px;height:20px}.chess-icon-button[data-nav=prev] svg,.chess-icon-button[data-nav=next] svg{fill:currentColor}.chess-actions{grid-template-columns:repeat(4,1fr);gap:4px;padding:0 6px 6px;display:grid}.chess-action{gap:3px;padding:8px 2px 6px;font-size:13px}:is(.chess-icon-button,.chess-action,.chess-move,.chess-switch,.chess-theme,.chess-text-button):hover:not(:disabled){background:color-mix(in srgb, var(--ink) 9%, transparent)}:is(.chess-icon-button,.chess-action,.chess-new,.chess-switch,.chess-theme):active:not(:disabled){transform:translateY(1px)}:is(.chess-icon-button,.chess-action,.chess-new,.chess-switch,.chess-theme,.chess-text-button):focus-visible{outline-offset:2px;outline:2px solid #1d6fd8}.chess-action[aria-pressed=true]{background:var(--tone-strong)}#chess-app :is(.chess-icon-button,.chess-action,.chess-text-button):disabled{opacity:.38;cursor:default}.chess-new{all:unset;box-sizing:border-box;background:var(--yellow);color:#292c3d;cursor:pointer;border-radius:6px;place-items:center;height:46px;margin:0 12px 12px;font-size:16px;font-weight:700;transition:background-color .12s;display:grid}.chess-new:hover{background:#ffc933}.chess-text-button{all:unset;box-sizing:border-box;color:var(--ink);cursor:pointer;border-radius:6px;padding:5px 10px;font-size:14px;text-decoration:none}.chess-game-card>.chess-text-button{margin:0 8px 8px;font-weight:700;text-decoration:underline}.chess-side{gap:14px;font-size:14px;display:grid}.chess-settings{gap:10px;display:grid}.chess-settings h2{margin:0;font-size:15px}.chess-field{color:var(--muted);grid-template-columns:36px minmax(0,1fr);align-items:center;gap:4px;font-size:13px;display:grid}#chess-app .chess-field select{background:var(--panel);width:100%;min-height:40px;color:var(--ink);font:inherit;cursor:pointer;border:0;border-radius:6px;padding:0 10px;font-size:15px}#chess-app .chess-field select:disabled{opacity:.5;cursor:default}#chess-app .chess-field select:focus-visible{outline-offset:1px;outline:2px solid #1d6fd8}.chess-note{color:var(--muted);margin:0;font-size:13px;line-height:1.55}.chess-prefs{gap:4px;display:grid}.chess-switch{all:unset;box-sizing:border-box;cursor:pointer;border-radius:6px;justify-content:space-between;align-items:center;margin-inline:-8px;padding:6px 8px;font-size:14px;display:flex}.chess-switch:after{content:"";background:color-mix(in srgb, var(--ink) 22%, transparent);background-image:radial-gradient(circle at 10px 50%, var(--surface) 7px, transparent 7.5px);border-radius:10px;width:34px;height:20px;transition:background-color .15s}.chess-switch[aria-pressed=true]:after{background-color:#2f8a4a;background-image:radial-gradient(circle at 24px,#fff 7px,#0000 7.5px)}.chess-themes{grid-template-columns:repeat(3,1fr);gap:6px;margin-top:4px;display:grid}.chess-theme{all:unset;box-sizing:border-box;cursor:pointer;border-radius:6px;justify-items:center;gap:4px;padding:6px 2px;font-size:12px;display:grid}.chess-theme[aria-pressed=true]{background:var(--panel);font-weight:700}.chess-theme-swatch{--a:#f0d9b5;--b:#b58863;background:conic-gradient(var(--b) 0 25%, var(--a) 0 50%, var(--b) 0 75%, var(--a) 0);background-size:14px 14px;border-radius:3px;width:28px;height:28px}.chess-theme[data-swatch=green] .chess-theme-swatch{--a:#ebecd0;--b:#739552}.chess-theme[data-swatch=slate] .chess-theme-swatch{--a:#dee3e6;--b:#8ca2ad}.chess-more{justify-items:start;gap:0;margin-inline:-10px;display:grid}.chess-stats{color:var(--muted);margin:0;font-size:13px;line-height:1.6}.chess-promotions{grid-template-columns:repeat(4,1fr);gap:8px;margin:16px 0;display:grid}.chess-promote{all:unset;box-sizing:border-box;background:var(--sq-light);color:#292c3d;cursor:pointer;border-radius:8px;justify-items:center;gap:4px;padding:8px 4px;font-size:13px;font-weight:700;display:grid}.chess-promote:nth-child(2n){background:var(--sq-dark);color:#fff}.chess-promote:focus-visible{outline-offset:2px;outline:3px solid #1d6fd8}.chess-promote-piece{width:56px;height:56px}.chess-promote-piece .chess-piece{width:100%;height:100%}#chess-app dialog{max-width:min(440px,100vw - 24px)}.chess-layout{grid-template-columns:minmax(0,1fr) 290px;align-items:start;gap:24px;display:grid}.chess-layout>*,.chess-sidebar{min-width:0}.chess-sidebar{gap:12px;display:grid}.chess-tools{grid-template-columns:1fr 1fr;gap:8px;display:grid}:is(#chess-app,.chess-study) .button{white-space:normal;min-height:42px;padding:8px 10px;font-size:.83rem}:is(#chess-app,.chess-study) .local-help{margin:8px 0;font-size:.8rem;line-height:1.65}@media (width<=760px){.chess-layout{grid-template-columns:minmax(0,1fr);gap:12px}.chess-tools{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (width<=1099px){.chess-table{--board:clamp(300px, calc(100svh - 190px), 620px);grid-template-columns:min(var(--board), calc(100% - 262px)) minmax(242px, 300px);grid-template-areas:"board top""board game""board bottom""side side"}.chess-side{grid-template-columns:repeat(3,minmax(0,1fr));gap:24px;padding-top:16px}.chess-stats{grid-column:1/-1}.chess-moves{min-height:64px}.chess-status{padding-block:10px 6px}.chess-new{height:42px}}@media (width<=760px){#chess-app{padding:10px}.chess-table{grid-template-rows:none;grid-template-columns:minmax(0,1fr);grid-template-areas:"top""board""bottom""game""side";gap:6px}.chess-board-wrap{width:min(100%, var(--board-narrow,100%));justify-self:center}.chess-board{border-radius:0}.chess-player{grid-template-columns:26px auto minmax(0,1fr) auto;grid-template-areas:"mark name taken state";min-height:44px;padding:6px 10px}.chess-player-mark{width:26px;height:26px}.chess-player-taken{flex-wrap:nowrap;overflow:hidden}.chess-player-taken .chess-piece{width:18px;height:18px}.chess-game-card{grid-template-areas:"status""notice""retry""actions""moves""review""nav""new";margin-top:6px;display:grid}.chess-status{grid-area:status}.chess-actions{grid-area:actions}.chess-moves{grid-area:moves;min-height:0;max-height:184px}.chess-nav{grid-area:nav}.chess-new{grid-area:new}.chess-side{grid-template-columns:minmax(0,1fr);gap:20px;padding:18px 4px 0}.chess-coordinate{font-size:10px}}@media (width<=380px){#chess-app{padding:6px}.chess-coordinate{font-size:9px}.chess-action{font-size:12px}}@media (prefers-reduced-motion:reduce){#chess-app *,#chess-app :before,#chess-app :after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}.chess-study-page{max-width:1120px;padding-block:1.5rem 3rem}.chess-study-page nav,.chess-study-page .chess-tools{flex-wrap:wrap;gap:.5rem;margin-block:1rem;display:flex}.chess-study{border:1px solid var(--border);background:var(--surface);border-radius:1.25rem;margin-block:1.5rem;padding:clamp(.5rem,2vw,1.5rem)}.chess-study .chess-layout{align-items:start}.chess-study label{margin-block:.65rem;display:block}.chess-study select,.chess-study textarea{width:100%;max-width:100%;min-height:44px}.chess-study .chess-square .chess-coordinate{font-size:clamp(8px,1.5vw,11px)}.chess-study-page article{border:1px solid var(--border);border-radius:1rem;margin-block:1rem;padding:1rem}.chess-study [data-study=moves]{flex-wrap:wrap;gap:.35rem;max-height:16rem;display:flex;overflow:auto}.chess-study [data-study=moves] button{min-height:44px;padding:.4rem}.chess-study button:focus-visible,.chess-study a:focus-visible{outline:3px solid var(--accent,#087f74);outline-offset:3px}.chess-study [data-study=feedback]{min-height:3em}.chess-study textarea{resize:vertical;overflow-wrap:anywhere;min-height:8rem}.chess-study .study-active{outline:2px solid}.chess-study [hidden]{display:none!important}@media (width<=760px){.chess-study .chess-layout{grid-template-columns:1fr}.chess-study-page{padding-inline:12px}}@media (prefers-reduced-motion:reduce){.chess-study *{scroll-behavior:auto;transition:none;animation:none}}.chess-study{overflow-wrap:anywhere}.chess-study .chess-sidebar{grid-template-columns:minmax(0,1fr)}.chess-study .chess-tools{flex-wrap:wrap;gap:.5rem;display:flex}.chess-study .chess-layout>*,.chess-study label{min-width:0}.chess-study input,.chess-study select,.chess-study textarea{max-width:100%;font-size:16px}.chess-study input[type=file]{width:100%}@media (width<=760px){.chess-study .chess-layout{grid-template-columns:minmax(0,1fr)}}.chess-study .chess-coordinate{color:#000}
