/* SYNC: Source of truth is Browser Games/Board Template/board.css -- copy from there after template edits. */
/* Board Template — Cozy Alpaca Studio
   Shared 8×8 board chrome. CSS sizing variables + highlight overlays.
   Oak frame with gold-leaf fillet and garnet fruit; cream marble / forest granite squares.
*/
:root {
  --board-size: min(96vw, 680px);
  --board-gap: 0;
  --board-radius: 4px;
  --frame-pad: 16.9%;
  --board-frame: #c4a574;
  --sq-light: #e8dcc8;
  --sq-dark: #2a3a32;
  --sq-dark-alt: #24342c;
  --hl-selected: rgba(120, 180, 255, 0.42);
  --hl-move: rgba(255, 220, 100, 0.55);
  --hl-jump: rgba(255, 180, 60, 0.65);
  --coord-color: rgba(61, 52, 41, 0.5);
  --coord-size: 0.65rem;
}

.cas-board-wrap {
  position: relative;
  width: var(--board-size);
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  aspect-ratio: 1;
  padding: var(--frame-pad);
  overflow: visible;
}

.cas-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  border-radius: var(--board-radius);
  overflow: visible;
  box-shadow: none;
  user-select: none;
  touch-action: none;
  position: relative;
  background-color: var(--sq-dark);
}

.cas-board::before {
  content: "";
  position: absolute;
  /* extend over wrap padding so the frame sits above the tiles */
  inset: calc(-1 * var(--frame-pad) / (1 - 2 * 0.169));
  background-image: url("../art/board/frame.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
  z-index: 1;
}

.cas-square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  background-size: 220%;
  background-repeat: no-repeat;
}

.cas-square.light {
  background-color: var(--sq-light);
  background-image: url("../art/board/marble.png");
}

.cas-square.dark {
  background-color: var(--sq-dark);
  background-image: url("../art/board/granite.png");
}

.cas-square:nth-child(3n) { background-position: 18% 42%; }
.cas-square:nth-child(3n + 1) { background-position: 72% 18%; }
.cas-square:nth-child(3n + 2) { background-position: 40% 78%; }

.cas-square.hl-selected::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--hl-selected);
  box-shadow: inset 0 0 0 3px #5a9fd4;
  pointer-events: none;
  z-index: 1;
}

.cas-square.hl-move::after,
.cas-square.hl-jump::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
}

.cas-square.hl-move::after {
  width: 28%;
  height: 28%;
  background: var(--hl-move);
}

.cas-square.hl-jump::after {
  width: 36%;
  height: 36%;
  background: var(--hl-jump);
  box-shadow: 0 0 0 2px rgba(255, 160, 40, 0.4);
}

.cas-square .cas-piece-slot {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.cas-square .cas-piece-slot > * {
  pointer-events: auto;
}

.cas-coord {
  position: absolute;
  font-size: var(--coord-size);
  color: var(--coord-color);
  pointer-events: none;
  line-height: 1;
  z-index: 3;
}

.cas-square.dark .cas-coord {
  color: rgba(244, 228, 193, 0.55);
}

.cas-coord.file {
  bottom: 2px;
  right: 3px;
}

.cas-coord.rank {
  top: 2px;
  left: 3px;
}
