/* bb-board.css: layout for the reusable board (js/bb-board.js), Merida pieces. Colors,
   last-move and selection tints come from bb-board-theme.css (loaded by base.html), the
   same as every other board. Scoped to .bb-board-host so it can't touch other boards. */

.bb-board-host {
  --sq-size: calc(min(92vw, 440px) / 8);
  --piece-size: calc(var(--sq-size) * 0.84);
}

.bb-board-host .board-wrap {
  position: relative;
  display: grid;
  width: calc(var(--sq-size) * 8);
  height: calc(var(--sq-size) * 8);
  margin: 0 auto;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}
.bb-board-host .board-grid {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
}
.bb-board-host .sq {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--board-border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.bb-board-host .sq.light { background: var(--board-light); }
.bb-board-host .sq.dark { background: var(--board-dark); }
.bb-board-host .sq.last-move { background: var(--board-last-move) !important; }
.bb-board-host .sq.selected { background: var(--board-selected) !important; border: 2px solid var(--board-selected-border) !important; }
.bb-board-host .sq.possible-move::after {
  content: ''; position: absolute; width: 34%; height: 34%; border-radius: 50%;
  background: rgba(34, 197, 94, 0.6); pointer-events: none; z-index: 3;
}
.bb-board-host .sq.possible-move.has-piece::after {
  width: 100%; height: 100%; border-radius: 0; background: transparent;
  border: 3px solid rgba(34, 197, 94, 0.7); box-sizing: border-box;
}
.bb-board-host .sq.flash-bad { background: rgba(239, 68, 68, 0.55) !important; }
.bb-board-host .sq.flash-good { background: rgba(34, 197, 94, 0.85) !important; }
.bb-board-host .sq .coord {
  position: absolute; font-size: 10px; line-height: 1; opacity: 0.85;
  pointer-events: none; font-weight: 600; z-index: 0;
}
.bb-board-host .sq.light .coord { color: rgba(0, 0, 0, 0.55); }
.bb-board-host .sq.dark .coord { color: rgba(255, 255, 255, 0.70); }
.bb-board-host .sq .coord-file { right: 3px; bottom: 2px; }
.bb-board-host .sq .coord-rank { left: 3px; top: 2px; }
.bb-board-host .bb-piece {
  position: relative; z-index: 2; width: var(--piece-size); height: var(--piece-size);
  max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none;
}
.bb-board-host .bb-piece.black {
  filter: drop-shadow(1px 0 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 1px 0 #fff)
          drop-shadow(0 -1px 0 #fff) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}
.bb-board-host .bb-piece.white {
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.8)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
/* Drag (bb-drag.js) */
.bb-board-host .board-wrap.dragging { cursor: grabbing; }
.bb-board-host .board-wrap.drag-enabled .sq[data-piece] { cursor: grab; touch-action: none; }
.bb-piece.bb-drag-ghost {
  position: fixed; z-index: 9999; pointer-events: none;
  transform: translate(-50%, -50%); opacity: 0.92; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
}
