/* Chessboard rendering, interaction and motion. */
.game-layout{display:grid;grid-template-columns:minmax(300px,600px) minmax(240px,1fr);gap:30px;max-width:1000px;margin:0 auto}.board-wrap{background:#e5e9da;padding:12px;border-radius:12px}.chessboard{display:grid;grid-template-columns:repeat(8,1fr);aspect-ratio:1;overflow:hidden;border-radius:5px;position:relative}.square{aspect-ratio:1;position:relative;background:#edf0df;padding:0;display:grid;place-items:center;touch-action:manipulation}.square.dark{background:#879b75}.square.selected{background:#ebc477}.square.last-move{box-shadow:inset 0 0 0 100px #eac56866}.square.in-check{background:#d18c76}.square .piece{width:86%;height:86%;position:relative;z-index:1;filter:drop-shadow(0 2px 1px #0002)}.square .coordinate{position:absolute;left:4px;top:3px;color:#708663;font-size:9px;z-index:2}.square.dark .coordinate{color:#e7eddb}.square .coordinate.file{top:auto;left:auto;right:4px;bottom:3px}.square.legal::after{content:"";position:absolute;width:25%;height:25%;background:#334c3b40;border-radius:50%;pointer-events:none}.square.legal:has(.piece)::after{width:90%;height:90%;background:transparent;border:5px solid #334c3b45}.board-player{display:flex;align-items:center;gap:11px;margin:0 0 14px}.board-player.bottom{margin:14px 0 0}.board-player h3{font-size:12px}.board-player p{font-size:10px;color:#91a17d;margin-top:4px}.clock{margin-left:auto;background:#e8ecdf;padding:10px 15px;border-radius:7px;font-size:24px;letter-spacing:1px;font-variant-numeric:tabular-nums;min-width:107px;text-align:center}.clock.active{background:#30472f;color:#f4f7ec}.game-detail{padding:24px;background:white;border:1px solid var(--line);border-radius:13px;height:fit-content}.game-detail h2{font-size:19px;letter-spacing:-.5px}.game-pot{padding:18px 0;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;margin-bottom:19px;font-size:12px;color:#8c9c7a}.game-pot strong{font-size:24px;color:#465f35}.turn-status{background:#f0f4e8;border-radius:7px;padding:12px;font-size:12px;color:#667d4e;display:flex;align-items:center;gap:8px;margin-bottom:20px}.move-list{max-height:235px;min-height:125px;overflow:auto;font-size:12px}.move-row{display:grid;grid-template-columns:30px 1fr 1fr;padding:8px 10px;gap:9px}.move-row:nth-child(odd){background:#f6f8f0;border-radius:5px}.move-row span:first-child{color:#a2ad93}.game-detail .card-eyebrow{margin:0 0 12px}.game-controls{display:flex;gap:10px;padding-top:19px;margin-top:10px;border-top:1px solid var(--line)}.game-controls .btn{flex:1;font-size:10px;padding:9px}.game-info{font-size:10px;color:#9ca98b;line-height:1.8;margin-top:17px}.result-panel{background:#ecf0e2;border-radius:9px;padding:20px;text-align:center;margin:15px 0}.result-panel h3{font-size:24px}.result-panel p{color:#7c8e65;font-size:12px;margin-top:8px}.promotion-options{display:flex;justify-content:center;gap:12px}.promotion-options button{width:70px;height:70px;border-radius:8px;background:#e6ecda;padding:9px}.promotion-options svg{width:100%;height:100%}
.board-row { display: contents; }
.chessboard { grid-template-rows: repeat(8, 1fr); isolation: isolate; border-radius: 3px; container-type: inline-size; }
.square { background: var(--board-light); min-width: 0; min-height: 0; border-radius: 0; touch-action: none; user-select: none; }
.square.dark { background: var(--board-dark); }
.square .coordinate {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Helvetica, Arial, sans-serif;
  font-size: 2.8cqw; color: var(--board-dark); font-weight: 600; line-height: 1;
  left: 6%; top: 8%; pointer-events: none;
}
.square .coordinate.file { right: 6%; bottom: 6%; }
.square.dark .coordinate { color: var(--board-light); }
.square.selected, .square.last-move { background: var(--board-light); box-shadow: inset 0 0 0 100px #ffff3380; }
.square.dark.selected, .square.dark.last-move { background: var(--board-dark); }
.square.in-check, .square.dark.in-check { background-image: radial-gradient(ellipse at center, #e52929 0%, #e52929b3 35%, #e5292900 75%); }
.square:focus-visible { outline: 3px solid #172718; outline-offset: -4px; z-index: 3; }
.square.legal::after { width: 33%; height: 33%; background: #00000024; }
.square.legal:has(.piece)::after { width: 100%; height: 100%; border: 5px solid #00000024; background: transparent; z-index: 2; }
.square .piece { width: 100%; height: 100%; object-fit: contain; filter: none; pointer-events: none; }
.piece { display: block; user-select: none; -webkit-user-drag: none; }
.promotion-options .piece { width: 100%; height: 100%; object-fit: contain; }
.letter-piece { display: grid; place-items: center; font-size: clamp(22px, 4vw, 44px); font-weight: 700; line-height: 1; }
.letter-piece.w { color: #fff; -webkit-text-stroke: 1.5px #1a271e; text-shadow: 0 2px 0 #1a271e; }
.letter-piece.b { color: #1a271e; -webkit-text-stroke: 1px #fff; text-shadow: 0 2px 0 #fff; }
.square.movable { cursor: grab; }
.square.piece-moving { z-index: 4; }
.square.piece-moving .piece { will-change: transform; }
.square.drop-target::before { content: ""; position: absolute; inset: 0; border: 3px solid #ffffffb3; z-index: 3; pointer-events: none; }
.drag-source .piece { opacity: 0; }
.dragging-piece, .dragging-piece * { cursor: grabbing !important; }
.drag-ghost { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 1000; will-change: transform; filter: drop-shadow(0 3px 2px #0003); }
.drag-ghost .piece { width: 100%; height: 100%; object-fit: contain; }
.motion-capture { position: absolute; pointer-events: none; z-index: 3; }
.board-player { min-width: 0; }
.board-player h3 { font-size: 15px; overflow-wrap: anywhere; }
.board-player p { font-size: 12px; }
.player-info { min-width: 0; }
.board-player > .avatar { flex-shrink: 0; }
.captured { display: flex; flex-wrap: wrap; min-height: 17px; margin-top: 3px; }
.captured .piece { width: 18px; height: 18px; font-size: 15px; }
.clock { flex-shrink: 0; font-size: 26px; min-width: 106px; padding: 8px 12px; }
.clock.low-time { color: #8f2b1d; background: #fbe5df; box-shadow: inset 0 0 0 2px #a33c29; }
.board-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.board-actions .btn { flex: 1; padding: 10px 12px; }
.board-help, .game-info { font-size: 12px; line-height: 1.7; margin-top: 12px; }
.game-detail h2 { font-size: 22px; }
.game-detail h3 { font-size: 16px; margin: 20px 0 12px; }
.game-detail .money-example { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.turn-status { font-size: 15px; color: #405735; min-height: 48px; margin-bottom: 18px; }
.status-dot { width: 8px; height: 8px; background: #526c3c; border-radius: 50%; }
.paused-panel { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 18px; border: 1px solid #afbf9b; background: #eff3e6; border-radius: 10px; margin-bottom: 18px; }
.paused-panel p { font-size: 13px; margin-top: 4px; color: var(--muted); }
.paused-panel .btn { flex-shrink: 0; }
.result-panel { margin: 0 0 18px; border: 1px solid #afbf9b; }
.result-panel h2 { font-size: 28px; }
.result-panel p { font-size: 14px; }
.result-values { display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: center; margin-top: 14px; font-size: 14px; }
.result-values strong { font-size: 20px; }
.move-list { font-size: 14px; max-height: 290px; min-height: 80px; }
.move-row { padding: 9px 10px; }
.move-row span:first-child { color: var(--muted); }
.review-summary { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 24px; }
.review-summary > span:last-child { color: var(--muted); font-size: 14px; }
.review-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; }
.review-controls .btn { font-size: 20px; padding: 8px 12px; }
#review-position { font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
#review-moves { display: flex; flex-wrap: wrap; align-content: start; gap: 6px; margin: 20px 0; }
.review-move { padding: 9px 12px; min-height: 44px; border-radius: 6px; color: #405735; background: #f2f5eb; font-size: 14px; }
.review-move[aria-current] { background: #334c3b; color: white; }
.review-next { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
[data-theme="blue"] { --board-light: #e4edf3; --board-dark: #7695ae; }
[data-theme="contrast"] { --board-light: #fff; --board-dark: #53604e; }
[data-theme="contrast"] .square.dark .coordinate { color: #fff; }
[data-motion="on"] .btn { transition: background-color .15s, box-shadow .15s; }
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; } }
