/* ---------- Доска ---------- */
.board {
  --light: #f0d9b5; --dark: #b58863; --coord-light: #b58863; --coord-dark: #f0d9b5;
  --hl-last: rgba(155, 199, 0, .41); --hl-sel: rgba(20, 85, 30, .5);
  position: relative; width: 100%; aspect-ratio: 1; user-select: none; -webkit-user-select: none;
  touch-action: none; border-radius: 6px; overflow: hidden; box-shadow: 0 18px 50px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.04);
  outline: none; contain: layout;
}
.board-theme-wood .board {
  --light: #ecd3a9; --dark: #a87b51; --coord-light: #8a6040; --coord-dark: #f4e0bf;
}
.board-theme-wood .board .sq.light { background-image: linear-gradient(115deg, rgba(255,255,255,.08), transparent 40%, rgba(120,70,20,.06) 70%, transparent); }
.board-theme-wood .board .sq.dark { background-image: linear-gradient(115deg, rgba(255,255,255,.06), transparent 35%, rgba(60,30,5,.12) 75%, transparent); }
.board-theme-emerald .board { --light: #e9eee4; --dark: #3f8f6b; --coord-light: #3f8f6b; --coord-dark: #e9eee4; }
.board-theme-marble .board { --light: #dee3e6; --dark: #8ca2ad; --coord-light: #788a94; --coord-dark: #eef2f4; }
.board-theme-classic .board { --light: #f0d9b5; --dark: #b58863; --coord-light: #b58863; --coord-dark: #f0d9b5; }

.board .squares { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.board .sq { position: relative; background-color: var(--dark); }
.board .sq.light { background-color: var(--light); }
.board .sq.last::before, .board .sq.selected::before, .board .sq.hover::before,
.board .sq[class*="mark-"]::before { content: ''; position: absolute; inset: 0; }
.board .sq.last::before { background: var(--hl-last); }
.board .sq.selected::before { background: var(--hl-sel); }
.board .sq.hover::before { box-shadow: inset 0 0 0 4px rgba(255,255,255,.65); }
.board .sq.check { background-image: radial-gradient(circle, rgba(255,40,40,1) 0%, rgba(231,0,0,.85) 25%, rgba(169,0,0,0) 89%) !important; }
.board .sq.move-target::after { content: ''; position: absolute; left: 50%; top: 50%; width: 30%; height: 30%; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(20, 85, 30, .45); z-index: 3; pointer-events: none; }
.board .sq.capture-target::after { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 calc(var(--sq, 10px) * .5) rgba(20, 85, 30, .45); background: radial-gradient(transparent 0 79%, rgba(20,85,30,.45) 80%); z-index: 3; pointer-events: none; }
.board .sq.mark-hint::before { background: rgba(59,130,246,.38); }
.board .sq.mark-good::before { background: rgba(16,185,129,.55); }
.board .sq.mark-bad::before { background: rgba(229,72,77,.55); }
.board .sq.mark-target::before { background: rgba(245,196,81,.5); }
.board .sq.mark-focus::before { box-shadow: inset 0 0 0 4px rgba(245,196,81,.95); }
.board .coord { position: absolute; font-size: clamp(8px, 1.7vmin, 12px); font-weight: 700; line-height: 1; pointer-events: none; z-index: 1; }
.board .coord.rank { left: 3px; top: 3px; }
.board .coord.file { right: 3px; bottom: 2px; }
.board .sq.light .coord { color: var(--coord-light); }
.board .sq.dark .coord { color: var(--coord-dark); }

.board .pieces { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.board .piece {
  position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%;
  background-size: calc(88% * var(--piece-scale, 1)); background-position: center; background-repeat: no-repeat;
  transition: transform var(--anim, 200ms) cubic-bezier(.25,.8,.35,1); will-change: transform;
}
.board .piece.moving { z-index: 5; }
.board .piece.no-anim, .board .piece.dragging { transition: none !important; }
.board .piece.dragging { z-index: 20; filter: drop-shadow(0 8px 12px rgba(0,0,0,.45)); background-size: calc(100% * var(--piece-scale, 1)); }
.board .piece.vanish { opacity: 0; transition: opacity 200ms ease; }
.board .piece.appear { animation: pieceIn 260ms ease; }
@keyframes pieceIn { from { opacity: 0; } to { opacity: 1; } }
.board .arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 6; }

.board .promo-layer { position: absolute; inset: 0; z-index: 30; display: none; }
.board .promo-layer.on { display: block; }
.board .promo-shade { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.board .promo { position: absolute; width: 12.5%; height: 50%; display: flex; flex-direction: column; background: #f4f4f4; border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.5); overflow: hidden; }
.board .promo-btn { flex: 1; border: 0; background: #f4f4f4 center / 82% no-repeat; cursor: pointer; transition: background-color .15s; }
.board .promo-btn:hover { background-color: #10b981; }

body.no-anim .board .piece { transition: none; }
