/* Functional Chessboard & High-Quality SVG Piece Styling */

:root {
  --square-light: #e2e8f0;
  --square-dark: #64748b;
  --square-light-hover: #f8fafc;
  --square-dark-hover: #475569;
  --selected-glow: #38bdf8;
  --card-border: #233148;
}

.board-paper {
  background: transparent !important;
}

/* Board Wrapper */
.board-wrapper {
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1 / 1;
  background: #070a12;
  padding: 8px;
  border-radius: 14px;
  box-shadow: 0 25px 35px -5px rgba(0, 0, 0, 0.6), 0 10px 15px -6px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--card-border);
}

.chessboard {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
}

/* Chessboard Squares */
.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 0.15s ease, transform 0.1s ease;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #000000;
}

.square.light {
  background-color: var(--square-light);
}

.square.dark {
  background-color: var(--square-dark);
}

.square.light:hover {
  background-color: var(--square-light-hover);
}

.square.dark:hover {
  background-color: var(--square-dark-hover);
}

.square.selected {
  outline: 3px solid var(--selected-glow);
  outline-offset: -3px;
  z-index: 2;
}

.square.light.selected {
  background-color: #bae6fd;
}

.square.dark.selected {
  background-color: #38bdf8;
}

.square.opponent-move {
  background-color: #bae6fd !important;
  box-shadow: inset 0 0 0 3px #8b5cf6 !important;
}

.square.dark.opponent-move {
  background-color: #475569 !important;
  box-shadow: inset 0 0 0 3px #a855f7 !important;
}

.square.in-check {
  background-color: #f87171 !important;
  animation: check-pulse 1.2s infinite ease-in-out;
}

@keyframes check-pulse {
  0% { box-shadow: inset 0 0 0 3px #dc2626; }
  50% { box-shadow: inset 0 0 0 6px #ef4444; }
  100% { box-shadow: inset 0 0 0 3px #dc2626; }
}

/* Vector Piece SVG */
.piece-img {
  width: 84%;
  height: 84%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
  transition: transform 0.12s ease;
}

.square:hover .piece-img {
  transform: scale(1.08);
}

/* Move Indicator Dots */
.move-dot {
  position: absolute;
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.7);
  box-shadow: 0 0 6px rgba(14, 165, 233, 0.5);
  pointer-events: none;
  z-index: 3;
}

.square.dark .move-dot {
  background: rgba(56, 189, 248, 0.8);
}

/* Capture Indicator Ring */
.capture-ring {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 4px solid rgba(239, 68, 68, 0.85);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
  pointer-events: none;
  z-index: 3;
}

/* Coordinates */
.coord {
  position: absolute;
  font-size: 0.65rem;
  font-weight: 700;
  pointer-events: none;
  opacity: 0.75;
  font-family: monospace;
}

.coord.rank {
  top: 3px;
  left: 4px;
}

.coord.file {
  bottom: 3px;
  right: 4px;
}

.square.light .coord {
  color: var(--square-dark);
}

.square.dark .coord {
  color: var(--square-light);
}

/* Captured Pieces Tray */
.captured-tray {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  min-height: 28px;
}

.captured-mini-piece {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}
