/* --- Chessboard Squares --- */
.square-light {
  background-color: #f0d9b5;
}
.square-dark {
  background-color: #b58863;
}
.square-selected {
  background-color: rgba(20, 85, 30, 0.5);
}

/* Highlight squares where a piece can move */
.square-valid-move {
  position: relative;
}
.square-valid-move::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30%;
  height: 30%;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 50%;
}

/* Highlight the squares from the last move */
.square-last-move {
  background-color: rgba(155, 199, 0, 0.41);
}

/* If you have file/rank coordinate overlays */
.coordinate-label {
  position: absolute;
  font-size: 0.8em;
  color: #b58863;
  opacity: 0.8;
  pointer-events: none;
}

/* --- Dragging & Ghost Piece --- */
body.dragging * {
  cursor: grabbing !important;
}
.ghost-piece {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
}

/* --- Pieces --- */
.piece {
  /* Removed transitions for instant appearance */
  position: absolute;
  width: 100%;
  height: 100%;
  cursor: grab;
  z-index: 2;

  /*
   * If you previously had:
   *   transition: transform 0.15s, opacity 0.15s;
   *   will-change: transform, opacity;
   *   -webkit-backface-visibility: hidden;
   *   -webkit-transform: translateZ(0);
   *   -webkit-perspective: 1000;
   * remove or comment those out to reduce overhead on mobile.
   */
}

.piece img {
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  /* No transform transitions here; load instantly. */
}

/* --- Spinner or Overlay (if you use one for loading) --- */
.spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 5px solid #f3f3f3;  /* Light gray */
  border-top: 5px solid #3498db;  /* Blue */
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Optional overlay for 'board-loading': disable interaction */
.board-loading {
  opacity: 0.5;
  pointer-events: none;
}
