.cb-board {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  user-select: none;
  touch-action: none;
}

.cb-squares {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
}

.cb-square {
  position: relative;
  display: grid;
  place-items: center;
}

.cb-square.light { background: #eedbb7; }
.cb-square.dark { background: #b48a5e; }

.cb-square.last-move::before,
.cb-square.selected::before,
.cb-square.in-check::before {
  content: "";
  position: absolute;
  inset: 0;
}

.cb-square.last-move::before { background: rgba(214, 196, 60, 0.45); }
.cb-square.selected::before { background: rgba(20, 110, 40, 0.5); }
.cb-square.in-check::before {
  background: radial-gradient(circle, rgba(255, 0, 0, 0.85) 0%, rgba(230, 0, 0, 0.5) 40%, transparent 75%);
}

.cb-square.target::after {
  content: "";
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(20, 85, 30, 0.45);
}

.cb-square.target-capture::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(transparent 0%, transparent 72%, rgba(20, 85, 30, 0.45) 73%);
}

.cb-piece {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 1;
  cursor: grab;
}

.cb-piece.dragging-origin { opacity: 0.3; }

.cb-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  pointer-events: none;
  cursor: grabbing;
}

.cb-coord {
  position: absolute;
  font-size: clamp(0.55rem, 1.4vw, 0.75rem);
  font-weight: 600;
  pointer-events: none;
  z-index: 2;
}

.cb-rank { top: 3px; left: 4px; }
.cb-file { bottom: 2px; right: 4px; }
.light .cb-coord { color: #b48a5e; }
.dark .cb-coord { color: #eedbb7; }

.cb-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

.cb-promotion {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(14, 16, 20, 0.75);
}

.cb-promotion button {
  width: 20%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: #eedbb7;
  cursor: pointer;
  padding: 0.3rem;
}

.cb-promotion button img { width: 100%; height: 100%; }

.cb-promotion .cb-promotion-cancel {
  flex-basis: 100%;
  width: auto;
  aspect-ratio: auto;
  max-width: 120px;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 0.4rem 1rem;
}
