.game-hub-card.chess{border-color:#9bd6ac;background:radial-gradient(ellipse at 92% 15%,#4d9a5973,transparent 66%),linear-gradient(145deg,#174437,#101f2b 75%);box-shadow:inset 0 0 20px #8ae5a32b,0 8px 24px #0006}
.chess .hub-character{right:-12px;width:54%;filter:drop-shadow(0 0 12px #b3df8355)}.chess .hub-card-icon{filter:none;width:65px;height:65px}
.chess .hub-card-badge{border-color:#b6dfa7;background:linear-gradient(#355b49,#213d35);color:#e4f8cd;box-shadow:0 0 9px #a7d89233}
.game-hub-card.chess .btn.primary{border-color:#b6d19a;background:linear-gradient(#d2eeb4,#87bd79 43%,#579963 55%,#347152 90%,#7fbc7f);color:#102a23;box-shadow:inset 0 2px 4px #eeffdb99,0 4px 7px #0008}
/* Use the same header, panel and spacing as the Hokm and Uno menus. */
#chessMenu .menu-head,#chessMenu .menu-body{flex-shrink:0}
#chessMenu .user-info-right{min-width:0}
#chessMenu .avatar-container{flex-shrink:0}
#chessMenu .menu-head-text{min-width:0}
#chessMenu .menu-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chess-menu-burger{flex-shrink:0}
.chess-menu-burger .burger-line svg{display:block;width:14px;height:14px;fill:currentColor;flex-shrink:0}.chess-menu-burger .burger-line.cyan{color:#e6bc62}.chess-menu-burger .burger-line.gold{color:#c8d7df}.chess-menu-burger .burger-line.red{color:#69c5a2}
#chessMenu .chess-quick,#btnChessCreate{display:grid;grid-template-columns:88px minmax(0,1fr);direction:ltr;align-items:center;gap:10px;min-height:78px;padding:10px 14px;font-size:22px}
#chessMenu .chess-quick .btn-img,#btnChessCreate .btn-img{width:88px;height:88px;margin:-16px 0;grid-column:1;grid-row:1;justify-self:center}
#chessMenu .btn-sub-container{grid-column:2;grid-row:1;min-width:0;direction:rtl;text-align:right;gap:3px;justify-content:center}
#chessMenu .btn-sub-container>span{display:block;line-height:1.45}
#chessMenu .btn-sub-container>small{margin:0;line-height:1.7;font-size:11px}
#chessMenu .join-row{margin:8px 0}
#chessMenu .join-input-wrap{min-width:0}
#chessMenu .menu-links{grid-template-columns:repeat(2,minmax(0,1fr))}
#chessMenu .menu-links .link-btn{display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:4px;padding:0 8px;text-align:center}
#chessMenu .menu-links .link-img{width:44px;height:44px}
.chess-menu-note{font-size:10px;text-align:center;color:#8fa0b0;margin:2px 0 0;line-height:1.9}#chessMeStat{font-size:10px;letter-spacing:0}
/* Palace chamber: lightweight backdrop and real-time board. */
#chessTable{padding:0;align-items:center;overflow-y:auto;isolation:isolate;background:#302d25}
#chessTable:before{content:'';position:fixed;inset:0;pointer-events:none;background:linear-gradient(180deg,#0d19225c,transparent 32%,#131c1b0a 65%,#0a161c80),url('/static/chess/images/palace.webp?v=20261104-11') center/cover no-repeat;z-index:-1}
.chess-hud{position:relative;inset:auto;width:100%;max-width:none;height:32px;margin:0;flex-shrink:0;display:grid;grid-template-columns:28px minmax(0,1fr) 28px;gap:4px;padding:0 5px;background:linear-gradient(135deg,#172a31f2,#0d1c27f2);border:1px solid #d4b47255;box-shadow:0 4px 16px #0004;color:#dfc28b}
.chess-hud .hud-icon-btn{color:#dfc28b;width:28px;height:28px;justify-self:center}
.chess-hud .scoreboard{min-width:0;text-align:center;color:#dfc28b;font-size:11px;font-weight:700;letter-spacing:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chess-tools{width:100%;min-width:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(62px,auto) minmax(58px,auto);align-items:stretch;gap:5px}
.chess-room-code{position:static;min-width:0;min-height:28px;padding:4px 8px;display:flex;align-items:center;justify-content:flex-start;border:1px solid #c9ad7140;border-radius:12px;background:#10262be8;color:#e4d6b6;font:700 10px 'IRANSans',sans-serif;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#chessTools .chat-badge,#chessTools .voice-badge{position:static;inset:auto;min-width:0;min-height:28px;max-width:none!important;margin:0;padding:4px 8px;justify-content:center;gap:5px;border-radius:12px;box-shadow:0 2px 6px #0003;font-size:11px}
#chessTools .voice-badge{grid-column:2;grid-row:1}
#chessTools .chat-badge{grid-column:3;grid-row:1}
.chess-table-body{width:100%;max-width:724px;height:100%;min-height:0;padding:calc(var(--safe-t) + 5px) 10px calc(var(--safe-b) + 5px);display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(220px,1fr) auto;gap:5px;flex-shrink:0}
.chess-top-zone,.chess-bottom-zone{display:flex;flex-direction:column;align-items:center;width:100%;min-width:0;gap:4px}
.chess-top-zone,.chess-bottom-zone{justify-content:flex-start;padding:0}
.chess-player{width:100%;max-width:620px;display:flex;align-items:center;gap:7px;background:linear-gradient(110deg,#132932dd,#12212be6);border:1px solid #d2c09a26;border-radius:13px;padding:4px 9px;min-height:42px;box-shadow:0 4px 18px #0002;transition:border-color .2s,box-shadow .2s}
.chess-player.on-turn{border-color:#d2c09a26;box-shadow:0 4px 18px #0002}
.chess-player.on-turn .chess-avatar{border:2px solid #4de698;box-shadow:0 0 0 3px #4de69826,0 0 15px #4de69866}
.chess-avatar{width:28px;height:28px;border-radius:50%;background:#2a444b center/cover;display:grid;place-items:center;font-weight:800;color:#e7d8b2;flex-shrink:0;border:1px solid #d6c18c40}
.chess-player-info{display:flex;flex-direction:column;flex:1;min-width:0;gap:2px}.chess-player-info b{font-size:11px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;color:#f1eadc}.chess-player-info small{font-size:9px;color:#a1b4b7}
.chess-clock{font:800 18px/1.3 'IRANSans',sans-serif;direction:ltr;color:#e4ceb0;font-variant-numeric:tabular-nums;white-space:nowrap;letter-spacing:1px}.chess-clock.urgent{color:#ffb0a0;text-shadow:0 0 15px #ff624b70;animation:chessClock 1s ease-in-out infinite}
@keyframes chessClock{50%{opacity:.65}}
.chess-board-frame{padding:0;border:0;background:none;width:100%;height:100%;min-height:0;max-width:700px;position:relative}
.chess-arena{--board-lift:0px;margin:0;position:relative;width:100%;height:100%;min-height:0;isolation:isolate}
.chess-arena:before{content:'';position:absolute;inset:8% 2% 10%;pointer-events:none;z-index:-1}
.chess-canvas{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;outline:0;cursor:grab;user-select:none;-webkit-user-select:none}
.chess-canvas:active{cursor:grabbing}.chess-canvas:focus-visible{outline:1px solid #c6ae6c88;outline-offset:-4px;border-radius:24px}
.chess-stage-title{position:absolute;top:0;left:0;right:0;display:flex;flex-direction:column;align-items:center;gap:5px;pointer-events:none;z-index:3}
.chess-stage-title>span{font:800 11px/1.4 'IRANSans',sans-serif;color:#c5ac74;letter-spacing:1px}
.chess-status{font-size:11px;min-height:20px;line-height:20px;margin:0;color:#a7c6bf;text-align:center;background:#0d2028a6;border:1px solid #8fb6a71a;border-radius:20px;padding:2px 13px;backdrop-filter:blur(8px)}.chess-status.check{color:#ffd1ba;border-color:#ff897a60;background:#482521b3}
.chess-world-coords{position:absolute;inset:0;pointer-events:none;overflow:hidden;z-index:1}.chess-world-coords span{position:absolute;left:0;top:0;font:700 9px/1 sans-serif;color:#f3d693;text-shadow:0 1px 3px #000;will-change:transform}
.chess-selection{position:absolute;top:8px;left:50%;transform:translateX(-50%);z-index:3;padding:4px 12px;border-radius:14px;color:#9eb5b4;font-size:10px;text-align:center;white-space:nowrap;pointer-events:none;background:#10232b8c;backdrop-filter:blur(6px);border:1px solid #b9d2c00f}
.chess-selection.has-piece{color:#f5dca6;border-color:#d8b76545;background:#162a32d9}
.chess-camera-tools{display:flex;flex-direction:column;align-items:center;gap:1px;width:100%}
.chess-camera-bar{position:static;inset:auto;transform:none;z-index:4;display:flex;align-items:center;justify-content:center;gap:4px;padding:3px;border:1px solid #dbc69340;border-radius:14px;background:linear-gradient(#1b3039ed,#101f28f2);box-shadow:0 4px 12px #0004;white-space:nowrap}
.chess-camera-bar button{height:26px;min-width:32px;padding:3px 9px;border:0;border-radius:10px;background:transparent;color:#d5c9aa;font:700 10px/1.4 'IRANSans',sans-serif;cursor:pointer;transition:background .15s,color .15s}
.chess-camera-bar button:hover,.chess-camera-bar button[aria-expanded=true]{background:#d8b87124;color:#f8dca0}.chess-camera-bar button:focus-visible{outline:2px solid #e7c77f}.chess-camera-bar button:first-child{font-size:18px}
.chess-camera-panel{position:absolute;z-index:5;bottom:12px;left:50%;transform:translateX(-50%);width:min(280px,85%);padding:13px 16px;border:1px solid #dbc69366;border-radius:18px;background:#142a35f2;box-shadow:0 8px 28px #0008;backdrop-filter:blur(18px)}
.chess-camera-panel[hidden]{display:none}.chess-camera-panel label{font-size:12px;color:#dcc795;display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.chess-camera-panel output{direction:ltr;color:#a7d8ce}.chess-camera-panel input{width:100%;accent-color:#d9bd76;cursor:pointer;direction:ltr}
.chess-orbit-hint{position:static;margin:0;text-align:center;pointer-events:none;font-size:8px;line-height:1.4;color:#efdfba;text-shadow:0 1px 4px #000}
#chessTable:has(.is-flat) .chess-camera-tools{display:none}
.chess-moment{position:absolute;z-index:4;top:24%;left:50%;transform:translate(-50%,15px) scale(.92);padding:10px 22px;border-radius:14px;background:linear-gradient(120deg,#67522aeb,#213e41ed);border:1px solid #f0d59399;color:#ffedbc;box-shadow:0 5px 40px #bda46b30;text-align:center;opacity:0;pointer-events:none;transition:opacity .18s,transform .25s;font:900 19px/1.5 'IRANSans',sans-serif;white-space:nowrap}
.chess-moment.on{opacity:1;transform:translate(-50%,0) scale(1)}.chess-moment.danger{background:linear-gradient(120deg,#773d32ed,#3b2639ed);border-color:#ffb7a8;color:#ffe3c8;box-shadow:0 0 40px #ff755b30}.chess-arena.in-check:before{background:radial-gradient(ellipse,#c449362d,transparent 66%)}
.is-3d .chess-board{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;left:0;bottom:0}
.is-flat .chess-canvas,.is-flat .chess-world-coords,.is-flat .chess-camera-bar,.is-flat .chess-orbit-hint,.is-flat .chess-camera-panel{display:none}
.is-flat.chess-arena{margin-bottom:0;height:auto;min-height:0;padding-top:50px;padding-bottom:30px}.is-flat .chess-selection{bottom:0}.is-flat .chess-board{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));grid-template-rows:repeat(8,minmax(0,1fr));aspect-ratio:1;width:100%;border:5px solid #8d7948;border-radius:9px;overflow:hidden;direction:ltr}
.chess-square{aspect-ratio:1;position:relative;display:grid;place-items:center;padding:0;border:0;border-radius:0;min-width:0;min-height:0;touch-action:manipulation;cursor:pointer;isolation:isolate;opacity:1!important}.chess-square.light{background:#d9cfad;color:#34514c}.chess-square.dark{background:#235351;color:#f3e1bd}
.chess-square.selected{box-shadow:inset 0 0 0 3px #72e0ce}.chess-square.last-move{background-image:linear-gradient(#e3c84d44,#e3c84d44)}.chess-square.legal-target:after{content:'';position:absolute;width:22%;height:22%;border-radius:50%;background:#1b8471a6;z-index:2;pointer-events:none}.chess-square.legal-target:has(svg):after{width:85%;height:85%;background:none;border:2px solid #f6c777}.chess-square.in-check{background:#b15a4c}.chess-square:focus-visible{outline:3px solid #f0c94c;outline-offset:-3px}
.chess-emblem{width:100%;height:100%;display:block;pointer-events:none;filter:drop-shadow(0 2px 1px #0005)}.chess-square>.chess-emblem{position:absolute;inset:3%;width:94%;height:94%}.chess-rank,.chess-file{position:absolute;font:800 8px/1 sans-serif;z-index:1;pointer-events:none}.chess-rank{left:2px;top:2px}.chess-file{right:2px;bottom:2px}
.chess-actions{display:flex;gap:7px;width:100%;max-width:620px;margin-top:2px}.chess-actions .btn{flex:1;min-height:32px;padding:5px 4px;font-size:10px;border:1px solid #d8bc7333;border-radius:12px;background:linear-gradient(#21373a,#142b31);color:#d6ceb7;box-shadow:inset 0 1px #fff1}.chess-actions .btn:active{transform:translateY(1px)}#btnChessResign{color:#e3a493;border-color:#c17f6d33}
.chess-draw-prompt{display:flex;align-items:center;flex-wrap:wrap;gap:6px;background:#d9be6b1c;border:1px solid #c9b47477;padding:10px;border-radius:14px;width:100%;max-width:620px;font-size:12px}.chess-draw-prompt .btn{padding:7px 10px;background:#31564e;border-radius:12px;font-size:11px}.chess-claim{background:#517254;color:#fff;font-size:12px;padding:8px}
.chess-history{width:100%;max-width:620px;font-size:11px;color:#879d9d;line-height:1.9;margin-top:2px}.chess-history summary{cursor:pointer;padding:3px}.chess-history div{max-height:100px;overflow:auto;background:#091d2080;border-radius:10px;padding:8px;word-break:break-word;text-align:left;color:#c6d6cd}
.chess-result{background:linear-gradient(145deg,#243a3b,#152a30);border:1px solid #cbb77888;border-radius:19px;padding:18px;width:100%;max-width:620px;text-align:center;box-shadow:0 12px 35px #0004}.chess-result h3{color:#eed292;margin:0 0 8px}.chess-result p{color:#b5c9b8;font-size:12px}.chess-result .btn{width:100%;min-height:42px}.chess-result[hidden],.chess-draw-prompt[hidden],.chess-claim[hidden]{display:none}
.chess-promotion{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px}.chess-promotion .btn{display:flex;flex-direction:column;align-items:center;background:linear-gradient(#27474b,#172d36);padding:9px 5px;border:1px solid #c5ac7380;border-radius:14px;color:#f0ddae;box-shadow:inset 0 1px #fff1}.chess-promotion .chess-emblem{height:84px;width:100%}.chess-promotion span{font-size:12px;margin-top:5px}
.hist-row .d{color:#d7bf7a}.profile-tabs{flex-wrap:wrap}
@media(min-width:700px){.chess-stage-title>span{font-size:13px}.chess-status{font-size:12px}.chess-selection{font-size:12px}.chess-camera-bar button{height:28px;padding:3px 12px;font-size:11px}.chess-world-coords span{font-size:11px}.chess-orbit-hint{font-size:10px}}
@media(max-height:650px){.chess-table-body{padding-top:calc(var(--safe-t) + 5px);padding-bottom:calc(var(--safe-b) + 5px);gap:5px}.chess-top-zone,.chess-bottom-zone{gap:4px}.chess-player{min-height:40px;padding:4px 8px}.chess-avatar{width:26px;height:26px}.chess-clock{font-size:17px}.chess-actions .btn{min-height:30px}.chess-stage-title>span{font-size:10px}.chess-stage-title{gap:1px}.chess-selection{top:8px;font-size:9px}.chess-camera-bar button{font-size:9px;padding:3px 8px;min-width:30px;height:25px}}
@media(max-width:340px){.chess .hub-card-icon{width:48px;height:48px}.chess-actions .btn{font-size:10px}}
@media(prefers-reduced-motion:reduce){.chess-clock.urgent{animation:none}.chess-moment,.chess-player{transition:none}}


.chess-selection[hidden],.chess-status[hidden]{display:none}
#btnChessAutoplay[hidden]{display:none}
.chess-actions{flex-wrap:wrap}
.chess-actions #btnChessAutoplay{flex-basis:100%;border-color:#8cc7b666;color:#d8eee4}
.chess-actions #btnChessAutoplay[aria-pressed="true"]{background:linear-gradient(#635333,#3e382c);border-color:#e5bc5c;color:#ffe7a3}
.chess-arena.has-status .chess-selection{top:34px}

.chess-board-frame{justify-self:center;align-self:stretch}
.chess-player{background:linear-gradient(110deg,#142a31e8,#14232be8);backdrop-filter:blur(6px)}
.chess-history{color:#e4d7b9;text-shadow:0 1px 3px #000}
.chess-orbit-hint{color:#efdfba;text-shadow:0 1px 4px #000}

@media(max-width:360px){.chess-table-body{padding-left:8px;padding-right:8px}.chess-tools{gap:5px}#chessTools .chat-badge,#chessTools .voice-badge{padding:4px 7px}}

@media(max-width:360px){#chessMenu .chess-quick,#btnChessCreate{grid-template-columns:66px minmax(0,1fr);font-size:19px;min-height:74px;padding:10px;gap:8px}#chessMenu .chess-quick .btn-img,#btnChessCreate .btn-img{width:66px;height:76px}#chessMenu .btn-sub-container>small{font-size:10px}#chessMenu .menu-links .link-btn{font-size:15px;grid-template-columns:minmax(0,1fr) 38px;padding:0 6px}#chessMenu .menu-links .link-img{width:38px;height:42px}#chessMenu>.menu-head{padding:16px;gap:8px}#chessMenu .user-info-right{gap:8px}#chessMeStat{font-size:9px}}
