.chess-game[data-screen="play"]{background:#0b1120;color:#e6edf8}
.chess-game[data-screen="play"]>header{background:#131e34;color:#e6edf8;border-color:#2c3f5e}
.chess-game #arena:not(.table-chat-layout){
  grid-template-columns:minmax(0,1fr) minmax(260px,320px);
  max-width:1380px;gap:18px;padding:12px 18px;margin:auto
}
.chess-game .game-panel{
  min-height:0;padding:0;gap:8px;background:none;border:0;box-shadow:none
}
.chess-game .game-panel h1{display:none}
.chess-game .board-top{color:#a5b8d5}
.chess-game .board-top button,.chess-game .play-sidebar button{
  color:#e6edf8;background:#192846;border-color:#3a5076;box-shadow:none
}
.chess-game .game-panel .board.chess{
  position:relative;isolation:isolate;aspect-ratio:1;
  width:min(100%,calc(100dvh - var(--table-header) - 64px));max-width:960px;
  grid-template-columns:repeat(8,minmax(0,1fr));grid-template-rows:repeat(8,minmax(0,1fr));
  margin:0 auto;gap:0;padding:10px 10px 25px 25px;border:1px solid #6994b6;border-radius:12px;
  background:linear-gradient(145deg,#386481,#152b4a 78%);box-shadow:0 12px 28px #0005;
  overflow:hidden
}
.chess-game .chess .chess-square{position:relative;min-width:0;min-height:0;aspect-ratio:auto;padding:0;border:0}
.chess-game .chess .light{
  background:repeating-linear-gradient(0deg,#fff0 0 3px,#fff1 4px,#fff0 6px),linear-gradient(145deg,#93c8dc,#70abc6)
}
.chess-game .chess .dark{
  background:repeating-linear-gradient(0deg,#fff0 0 4px,#c9edff12 5px,#fff0 7px),linear-gradient(145deg,#558daa,#427594)
}
.chess-game .chess .cell:nth-child(8n+1):before,
.chess-game .chess .cell:nth-child(n+57):after{
  color:#e4f0ff;font:700 11px system-ui;line-height:1;
}
.chess-game .chess .cell:nth-child(8n+1):before{left:-17px;top:50%;transform:translateY(-50%)}
.chess-game .chess .cell:nth-child(n+57):after{left:50%;right:auto;bottom:-17px;transform:translateX(-50%)}
.chess-game .chess .chess-last{box-shadow:inset 0 0 0 3px #ceeff9a0}
.chess-game .chess .chosen{outline:3px solid #ffe397;outline-offset:-3px}
.chess-game .chess .chess-check{background:#b96166}
.chess-game .chess-target{background-image:radial-gradient(circle,#18364e8c 0 12%,transparent 13%),linear-gradient(145deg,#93c8dc,#70abc6)!important}
.chess-game .dark.chess-target{background-image:radial-gradient(circle,#18364eb0 0 12%,transparent 13%),linear-gradient(145deg,#558daa,#427594)!important}
.chess-game .chess .chess-capture{outline:4px solid #d74f5d;outline-offset:-4px}
.chess-game .chess-square:focus-visible{outline:3px solid #fff;outline-offset:-4px;z-index:1}
.chess-piece{
  width:83%;height:92%;display:block;margin:auto;pointer-events:none;
  fill:var(--piece-fill);stroke:var(--piece-edge);stroke-width:3.8;
  stroke-linecap:round;stroke-linejoin:round;filter:drop-shadow(0 2px 1px #11263a55);
}
.chess-piece.is-white{--piece-fill:#edf7f8;--piece-edge:#28516a;--piece-detail:#83acbf}
.chess-piece.is-black{--piece-fill:#29364f;--piece-edge:#101827;--piece-detail:#61758d}
.chess-piece-detail{fill:none;stroke:var(--piece-detail);stroke-width:2.3}
.chess-game .play-sidebar{gap:9px}
.chess-game .play-sidebar>section{
  padding:13px;border:1px solid #2c3f5e;border-radius:12px;background:#131e34!important;
  box-shadow:none;color:#d6e5fb
}
.chess-game .play-sidebar .panel-heading h2,.chess-game .turn-panel h2,.chess-review h2{color:#eaf2ff}
.chess-game .turn-panel #status{color:#eaf2ff}
.chess-game .players-panel .seat{min-height:56px;padding:8px;background:#182740;color:#e1edff;border-color:#364e72}
.chess-game .players-panel .seat.active{background:#203854;border-color:#6ea6d6}
.chess-game .players-panel .seat-status{color:#9cb7d7}
.chess-game .players-panel .avatar-shell{display:grid;place-items:center;width:36px;height:36px;flex-basis:36px;border-radius:7px;color:#e1edff;background:#2d4a6d}
.chess-game .players-panel .avatar-frame{inset:-6px;width:48px;height:48px}
.chess-game .turn-panel h2{margin:5px 0;font-size:17px}
.chess-game .turn-panel #turn-instruction,.chess-game .turn-panel #promotion-setting{color:#a9c0df}
.chess-review h2{margin:0 0 9px;font-size:15px}
.chess-review-tools{display:flex;gap:5px}
.chess-review-tools button{flex:1;min-width:0;padding:5px 4px;font-size:13px}
.chess-review-tools button:last-child{flex:2.4;font-size:11px}
.chess-moves{min-height:115px;max-height:clamp(115px,31dvh,350px);margin:9px 0 0;padding:3px 5px;list-style:none;overflow:auto;background:#0d1729;border-radius:6px}
.chess-moves li{display:grid;grid-template-columns:28px 1fr 1fr;align-items:center;gap:4px;color:#91a9c9;font-size:12px}
.chess-game .chess-moves button{min-height:26px;padding:3px 8px;text-align:left;background:none;border:0;font-size:13px}
.chess-game .chess-moves button[aria-current="true"]{background:#385c88;color:#fff}
.chess-review-status{color:#b6d4f2;margin:8px 0 0;font-size:12px;min-height:1.2em}
/* On desktop the sidebar stretches to the full game height. Let the move
   list grow into that space instead of stopping at a fixed 115px/31dvh cap;
   the leave button then sits at the bottom of the same column. */
@media(min-width:921px){
 .chess-game[data-screen="play"] .play-sidebar{align-self:stretch;min-height:0}
 .chess-game[data-screen="play"] .chess-review{display:flex;flex-direction:column;flex:1 1 0;min-height:0}
 .chess-game[data-screen="play"] .chess-moves{flex:1 1 0;max-height:none}
}
@media(min-width:921px) and (max-height:620px){
 .chess-game[data-screen="play"] .chess-moves{flex:none;max-height:clamp(115px,31dvh,350px)}
}
@media(max-width:820px){
  .chess-game #arena:not(.table-chat-layout){grid-template-columns:minmax(0,1fr);padding:8px;gap:11px}
  .chess-game .game-panel .board.chess{width:min(100%,650px)}
  .chess-game .play-sidebar{display:flex}
}
