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

.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.square.light {
  background: #f0d9b5;
}

.square.dark {
  background: #b58863;
}

.piece {
  width: 85%;
  height: 85%;
  object-fit: contain;
  pointer-events: none;
  z-index: 1;
}

.piece.dragging-source {
  opacity: 0.3;
}

.piece.ghost {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.9;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.square.highlight {
  box-shadow: inset 0 0 0 3px rgba(255, 255, 0, 0.5);
}

.square.selected {
  box-shadow: inset 0 0 0 3px rgba(20, 85, 200, 0.7);
}

.square.wrong {
  animation: wrong-flash 0.4s ease;
}

@keyframes wrong-flash {
  0%, 30% { box-shadow: inset 0 0 0 100px rgba(231, 76, 60, 0.6); }
  100%    { box-shadow: inset 0 0 0 100px rgba(231, 76, 60, 0); }
}

.board-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--tg-theme-hint-color, #999);
  min-width: 16px;
  min-height: 16px;
}
