/* Chess is its own quiet tabletop, with textures drawn locally in CSS/SVG. */
.game-screen{--board-light:#edddc4;--board-dark:#967252;--board-rim:#5d4535;background:radial-gradient(ellipse at 15% 0,#e3d5bf66,transparent 55%),#f2f1ed;color:#292a2c}.game-screen-header,.game-footer{background:#faf9f3de;border-color:#d8d4cb;backdrop-filter:blur(20px)}.game-screen-header{height:68px}.game-stage{padding:18px 20px 24px;overscroll-behavior:contain;scrollbar-gutter:stable}.game-player-strip{width:min(600px,100%);gap:12px;margin-bottom:12px}.game-player{background:#ffffffb8;border-radius:18px;box-shadow:none;border-color:#dcd9d0;min-width:0}.game-player strong{display:block;overflow-wrap:anywhere}.game-player.active{border-color:#668679;box-shadow:0 0 0 2px #3d7b5810}.game-status{font-size:14px;padding:7px 17px;margin-bottom:16px;max-width:100%;line-height:1.5;overflow-wrap:anywhere}.game-board-wrap{display:flex;justify-content:center;padding:0 8px 8px}.game-board.chess-board{width:min(590px,100%,calc(100dvh - 285px));min-width:min(280px,100%);height:auto;aspect-ratio:1;grid-template-rows:repeat(8,minmax(0,1fr));border:8px solid var(--board-rim);border-radius:12px;box-shadow:0 22px 40px #44332224,0 3px 0 #30261f,0 5px 0 #614b3d;overflow:visible;background:var(--board-rim);isolation:isolate}.game-board.chess-board .chess-square{overflow:visible;aspect-ratio:1;min-height:0;border-radius:0!important;transform:none!important;transition:box-shadow .15s;opacity:1;touch-action:manipulation;cursor:default}.chess-board .chess-square[aria-disabled=false]{cursor:pointer}.chess-board .chess-square.light{background-color:var(--board-light);background-image:repeating-linear-gradient(94deg,#fff1 0px,#fff1 1px,transparent 2px,transparent 7px),linear-gradient(8deg,#fff1,transparent 55%,#5b39240c)}.chess-board .chess-square.dark{background-color:var(--board-dark);background-image:repeating-linear-gradient(92deg,#3821130a 0px,#3821130a 1px,transparent 2px,transparent 8px),linear-gradient(10deg,#ffffff09,transparent 50%,#38211316)}.chess-board[data-finish=slate]{--board-light:#dde3e6;--board-dark:#687c89;--board-rim:#344854}.chess-board[data-finish=slate] .chess-square{background-image:repeating-linear-gradient(135deg,#fff1 0px,#fff1 1px,transparent 1px,transparent 6px)}.chess-board .chess-square::after,.chess-board .chess-square::before{pointer-events:none}.chess-board .chess-square.selected::before{content:'';position:absolute;inset:2px;border:3px solid #f5dc88;box-shadow:inset 0 0 0 1px #544e3260;border-radius:3px;z-index:5}.chess-board .chess-square.last-move::after{content:'';position:absolute;inset:0;background:#f9dc5450;border:0;z-index:0}.chess-board .chess-square.legal-target::before{content:'';position:absolute;inset:36%;background:#263d3770;border:0;border-radius:50%;z-index:4;box-shadow:0 0 0 1px #ffffff30}.chess-board .chess-square.capture-target::before{inset:5%;background:transparent;border:5px solid #354f4260}.chess-board .chess-square.in-check{box-shadow:inset 0 0 26px #cb283dc0}.chess-board .chess-square.moving-piece{z-index:10}.chess-board .chess-piece{inset:6%;width:88%;height:88%;max-width:88%;max-height:88%;filter:drop-shadow(0 2px 1px #1b1c2348);transition:none}.chess-board .chess-piece-shape{stroke-width:2.6}.chess-board .white-piece .chess-piece-shape{fill:url(#chess-ivory);stroke:#574e46}.chess-board .black-piece .chess-piece-shape{fill:url(#chess-ebony);stroke:#141923}.chess-board .black-piece .knight-eye{fill:#c4d0d7}.chess-board .white-piece .knight-eye{fill:#423d37}.chess-board .chess-square:enabled:hover .chess-piece{transform:none}.square-coordinate{font:650 clamp(8px,1.5vw,11px)/1 -apple-system,BlinkMacSystemFont,sans-serif;text-transform:none;z-index:3}.chess-square.light .square-coordinate{color:#68533e}.chess-square.dark .square-coordinate{color:#f5e9d6}.chess-board[data-finish=slate] .light .square-coordinate{color:#445967}.chess-board[data-finish=slate] .dark .square-coordinate{color:#edf5fc}.chess-tools{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:10px;margin:18px auto 8px;max-width:650px}.chess-tools label{display:flex;align-items:center;gap:9px;font-size:12px}.chess-tools select{height:38px;font-size:12px;max-width:180px}.chess-tools button{min-height:38px;font-size:12px}.chess-record{max-width:590px;margin:18px auto 0;padding:15px 18px;border:1px solid #d4d1c8;border-radius:18px;background:#ffffff70;font-size:13px;line-height:1.65}.chess-record summary{cursor:pointer;font-weight:650}.chess-record p{color:#616761}.chess-record ol{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 28px;padding-left:25px;font-variant-numeric:tabular-nums;max-height:180px;overflow:auto}.chess-record li{padding-left:2px}.game-footer{flex-wrap:wrap;gap:8px;padding:10px 16px max(10px,env(safe-area-inset-bottom));min-height:68px}.game-footer button{min-width:0;min-height:40px;font-size:13px;padding:9px 16px}.game-hint{max-width:550px;line-height:1.6}.chess-promotion{width:min(450px,calc(100vw - 28px));color:var(--g-text);background:var(--g-panel)}.chess-promotion::backdrop{background:#11182766;backdrop-filter:blur(5px)}#chess-promotion-options{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:24px 0}#chess-promotion-options button{position:relative;display:flex;flex-direction:column;align-items:center;padding:10px 4px;border:1px solid var(--g-divider);border-radius:16px;background:#e4d6bf;color:#333;font-size:12px;text-transform:capitalize}#chess-promotion-options .chess-piece{position:static;width:60px;height:65px;max-width:100%}.chess-promotion .white-piece .chess-piece-shape{fill:#faf4e7;stroke:#574e46}.chess-promotion .black-piece .chess-piece-shape{fill:#343d47;stroke:#141923}body.theme-dark .game-screen{background:radial-gradient(ellipse at 20% 0,#3d3f4722,transparent 60%),#14171d;color:#eceff5}body.theme-dark :is(.game-screen-header,.game-footer){background:#20242dde;border-color:#ffffff12}body.theme-dark .game-player,body.theme-dark .game-status{background:#272b34;border-color:#ffffff20;color:#eceff5}body.theme-dark .chess-record{background:#222630;border-color:#ffffff18}body.theme-dark .chess-record p{color:#a8aeb8}body.theme-dark .chess-tools label{color:#a8aeb8}.game-board[aria-busy=true]{cursor:progress}@media(max-width:720px){.game-stage{padding:12px 8px 20px}.game-board.chess-board{width:min(590px,100%);min-width:0;border-width:6px}.game-board-wrap{padding:0 4px 7px}.game-player-strip{gap:8px;padding-inline:4px}.game-player{padding:9px;min-height:50px}.game-player small{font-size:10px}.game-player .avatar{width:30px;height:30px}.game-screen-header{height:60px}.game-status{margin-bottom:12px;font-size:13px}.game-footer button{flex:0 1 auto;font-size:12px;min-height:40px}.game-hint{padding:0 10px;font-size:12px}.chess-record ol{grid-template-columns:repeat(2,minmax(0,1fr))}.chess-tools{gap:8px}.chess-tools label{flex-basis:100%;justify-content:center}.game-player>span{min-width:0}}
@media(max-height:520px) and (min-width:600px){.game-board.chess-board{width:min(390px,75vh)}.game-stage{overflow:auto}.game-screen-header{height:50px}.game-footer{min-height:54px}.game-player-strip{max-width:390px}}
@media(prefers-reduced-motion:reduce){.chess-piece,.chess-square{animation:none!important;transition:none!important}}@media(forced-colors:active){.chess-square.legal-target::before{background:Highlight}.chess-square.selected{outline:3px solid Highlight}.chess-board .chess-piece-shape{fill:Canvas;stroke:CanvasText}.chess-board .black-piece .chess-piece-shape{fill:CanvasText;stroke:Canvas}}
.chess-materials{position:absolute;pointer-events:none;overflow:hidden}.chess-tools.hidden,.chess-record.hidden{display:none!important}
#chess-review-notice{flex-basis:100%;margin:0;text-align:center;overflow-wrap:anywhere}
.chess-engine-panel{width:min(590px,100%);margin:14px auto;padding:18px;border:1px solid var(--line,#d4d1c8);border-radius:18px;background:var(--g-panel,#fff);color:var(--g-text,#26332f)}.chess-engine-panel.hidden{display:none!important}.chess-engine-panel h3{margin:0 0 8px}.chess-engine-panel p{line-height:1.6;overflow-wrap:anywhere}.chess-engine-actions{display:flex;flex-wrap:wrap;align-items:end;gap:10px}.chess-engine-actions label{font-size:12px;display:grid;gap:5px;margin:0}.chess-engine-actions select{max-width:160px;min-height:40px}.chess-engine-panel progress{width:100%;margin-top:15px;accent-color:var(--green,#176979)}.chess-engine-panel small{display:block;margin-top:6px;font-size:12px;line-height:1.6;color:var(--muted,#68716c)}#chess-engine-evaluation>strong{display:block;font-size:21px}#chess-engine-move{margin:16px 0}.engine-quality{display:inline-block;border-radius:8px;padding:7px 10px;background:#dceee4;color:#205342}.engine-quality[data-quality=inaccuracy]{background:#fff1bb;color:#74571a}.engine-quality[data-quality=mistake]{background:#ffe1c2;color:#873e12}.engine-quality[data-quality=blunder]{background:#ffdbe1;color:#962843}.chess-engine-moves{list-style:none;padding:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;max-height:240px;overflow:auto}.chess-engine-moves button{width:100%;white-space:normal;text-align:left;min-height:44px}.chess-engine-moves button[aria-current=step]{border-color:var(--green,#176979);background:var(--green-pale,#e3efed)}.chess-engine-panel summary{cursor:pointer;min-height:36px;font-weight:650}.chess-board .chess-square.engine-suggestion{outline:3px solid #16aaab;outline-offset:-4px;z-index:2}
.chess-replay-controls{width:min(590px,100%);margin:12px auto;padding:16px;border:1px solid var(--line,#d4d1c8);border-radius:18px;background:var(--g-panel,#ffffffb8);color:var(--g-text,#26332f)}.chess-replay-controls.hidden,.chess-history-picker.hidden{display:none!important}.chess-replay-controls>div{display:flex;gap:12px;align-items:center}.chess-replay-controls>div>label{flex:1;min-width:70px;font-size:12px}.chess-replay-controls input[type=range]{width:100%;min-height:40px;padding:0;margin:0}.chess-replay-controls details{margin:16px 0}.chess-replay-controls details label{display:flex;align-items:center;gap:10px;margin:10px 0;font-size:14px}.chess-replay-controls input[type=checkbox]{width:20px;height:20px;margin:0}.chess-replay-controls p{font-size:14px;line-height:1.55}.chess-history-picker{margin-top:18px}.chess-history-picker summary,.chess-replay-controls summary{cursor:pointer;font-weight:650}.chess-history-picker button{width:100%;margin-top:10px;text-align:left;white-space:normal;min-height:44px}
.call-screen{z-index:45}.call-dock{position:fixed;inset:0 0 auto;z-index:44;min-height:56px;display:flex;align-items:center;justify-content:center;gap:12px;padding:6px 12px;background:#173f45;color:#fff;box-sizing:border-box}.call-dock.hidden{display:none!important}.call-dock button{min-height:42px;margin:0;white-space:nowrap}.call-dock .soft-button{background:#fff;color:#173f45}body.call-minimized :is(.app,.game-screen){padding-top:58px;box-sizing:border-box}
.game-player .avatar{flex:none}.game-player>span:not(.avatar){min-width:0}.game-player strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;overflow-wrap:normal}
@media(max-width:720px) and (max-height:700px){.game-stage{padding-top:8px}.game-player-strip{margin-bottom:8px}.game-player{padding:6px;min-height:50px}.game-status{padding:4px 12px;margin-bottom:8px}.game-board.chess-board{width:min(100%,calc(var(--app-height,100dvh) - 300px))}}
/* Finished-game review keeps the move rating beside the replayed board. */
.chess-review-layout{width:100%}.chess-board-column{min-width:0}.review-mode .chess-review-layout{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(300px,1fr);gap:22px;max-width:1080px;margin:0 auto;align-items:start}.review-mode .chess-engine-panel{width:100%;margin:0;min-width:0}.review-mode .game-board.chess-board{width:min(590px,100%);min-width:0}.review-mode .game-player-strip{max-width:1080px;width:100%}.review-mode .game-hint{font-size:12px;margin:8px auto}.review-mode .chess-record{width:100%;max-width:1080px}.chess-review-feedback{max-width:590px;margin:6px auto 10px;padding:12px 14px;border-radius:14px;background:var(--g-panel,#fff);color:var(--g-text,#26332f);min-height:92px;text-align:left}.chess-review-feedback small{display:block;line-height:1.5;margin-top:7px;font-size:12px}.chess-review-feedback.hidden{display:none}.chess-replay-buttons{justify-content:center;margin-bottom:8px}.chess-replay-buttons button{min-height:42px}.chess-replay-buttons #chess-replay-play{min-width:110px}.chess-move-badge{position:absolute;z-index:5;right:-3px;top:-5px;display:grid;place-items:center;min-width:25px;height:25px;padding:0 4px;border-radius:50%;font:700 13px system-ui;box-shadow:0 2px 5px #0004;pointer-events:none}.chess-move-badge,.engine-quality,.engine-move-rating{--rating-bg:#dceee4;--rating-text:#205342}.chess-move-badge,.engine-quality{background:var(--rating-bg);color:var(--rating-text)}[data-quality=brilliant]{--rating-bg:#c5f4f1;--rating-text:#006d72}[data-quality=great]{--rating-bg:#d8e8ff;--rating-text:#214d93}[data-quality=best]{--rating-bg:#d9eec5;--rating-text:#365d16}[data-quality=excellent]{--rating-bg:#e6f0db;--rating-text:#46612e}[data-quality=inaccuracy]{--rating-bg:#fff1bb;--rating-text:#74571a}[data-quality=mistake]{--rating-bg:#ffe1c2;--rating-text:#873e12}[data-quality=blunder]{--rating-bg:#ffdbe1;--rating-text:#962843}.engine-quality[data-quality]{background:var(--rating-bg);color:var(--rating-text)}.engine-move-rating{font-size:11px;padding:3px 6px;border-radius:6px;background:var(--rating-bg);color:var(--rating-text);display:block;margin-top:5px;width:fit-content}.chess-engine-moves{max-height:300px;gap:7px;scrollbar-gutter:stable}.chess-engine-moves button{padding:9px;line-height:1.3}.chess-engine-moves button[aria-current=step]{box-shadow:inset 0 0 0 2px #16817f}.chess-review-counts{width:100%;border-collapse:collapse;font-size:12px;margin:10px 0}.chess-review-counts th,.chess-review-counts td{padding:6px 4px;border-bottom:1px solid var(--line,#d4d1c8);text-align:center}.chess-review-counts th:first-child{text-align:left}.chess-review-counts tbody th{color:var(--rating-text);background:var(--rating-bg);border-radius:6px}#chess-engine-summary h4{margin:16px 0 8px}.review-mode .game-stage{scroll-padding-top:12px}
@media(max-width:800px){.review-mode .chess-review-layout{display:block;max-width:590px}.review-mode .chess-engine-panel{margin-top:16px}.review-mode .chess-replay-controls{padding:12px;margin-top:8px}.review-mode .chess-tools{margin:6px auto}.review-mode .chess-tools label{flex-basis:auto}.review-mode .game-hint{display:none}.review-mode .chess-review-feedback{min-height:95px}.review-mode .game-board.chess-board{max-width:410px}.review-mode .game-stage{padding-inline:10px}.chess-engine-moves{max-height:290px}}
@media(prefers-reduced-motion:no-preference){.chess-move-badge{animation:chess-badge-in .18s ease-out}@keyframes chess-badge-in{from{transform:scale(.7)}to{transform:scale(1)}}}
@media(min-width:801px){.review-mode .game-hint{display:none}.review-mode .game-board.chess-board{width:min(590px,100%,max(220px,calc(100dvh - 375px)))}.review-mode .chess-review-feedback{min-height:0;padding:8px 12px}.review-mode .chess-review-feedback small{display:none}.review-mode .chess-replay-controls{display:grid;grid-template-columns:1fr auto;align-items:center;gap:8px;padding:12px}.review-mode #chess-replay-position{margin:0}.review-mode .chess-replay-buttons{margin:0;gap:6px}.review-mode .chess-replay-buttons button{padding:8px 12px}.review-mode .chess-replay-controls>div:not(.chess-replay-buttons),.review-mode .chess-replay-controls>details{grid-column:1/-1}.review-mode .chess-replay-controls>button{justify-self:start}}
