#board {
  position: relative; /* needed for overlay */
  display: grid;
  grid-template-columns: repeat(11, 64px);
  grid-template-rows: repeat(11, 64px);
  grid-column: 2;
  grid-row: 2;
  border: 6px solid #3a2a1a;
  border-radius: 6px;
  overflow: hidden;
}

/* Bigger pieces */
.square img {
  width: 52px;
  height: 52px;
}

.square {
  position: relative;
  z-index: 1;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  cursor: pointer;
}

.corner, .throne {
  border: 3px solid rgba(0, 0, 0, 0.5); /* semi-transparent black */
  box-sizing: border-box; /* ensures border doesn’t increase square size */
  background: #d8b46c;
}

/* =============================
   BOARD COORDINATE FRAME
============================= */

#boardFrame {
  display: grid;
  grid-template-columns: 24px auto 24px;
  grid-template-rows: 24px auto 24px;
  gap: 1;
  align-items: center;
  justify-items: center;
}

/* Empty corner cells */
.coord-corner {
  width: 28px;
  height: 28px;
}

/* Top / bottom file labels */
.coord-row {
  display: grid;
  grid-template-columns: repeat(11, 64px);
  width: 704px; /* 11 × 64 */
  height: 28px;
  font-family: monospace;
  font-size: 14px;
  font-weight: bold;
  color: #4a3420;
}

.coord-row.top {
  grid-column: 2;
  grid-row: 1;
}

.coord-row.bottom {
  grid-column: 2;
  grid-row: 3;
}

.coord-row span {
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  pointer-events: none;
}

/* Left / right rank labels */
.coord-col {
  display: grid;
  grid-template-rows: repeat(11, 64px);
  width: 28px;
  height: 704px; /* 11 × 64 */
  font-family: monospace;
  font-size: 14px;
  font-weight: bold;
  color: #4a3420;
}

.coord-col.left {
  grid-column: 1;
  grid-row: 2;
}

.coord-col.right {
  grid-column: 3;
  grid-row: 2;
}

.coord-col span {
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  pointer-events: none;
}

/* Toggle to hide coordinates */
.coords-hidden .coord-row span,
.coords-hidden .coord-col span {
  color: transparent;
}

/* =============================
   BOARD ANNOTATIONS
============================= */
/* SVG overlay for arrows */
#annotationOverlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none; /* don't block square clicks */
  overflow: visible;
}

/* Annotation square highlight */
.annotated-square {
  outline: 4px solid #2f80ff;
  outline-offset: -4px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.45);
}

/* selection highlight */
.selected {
  outline: 4px solid white;
  outline-offset: -2px;
  border-radius: 2px;
  z-index:4;
}

/* Subtle centered neon glow */
.square.last-move {
  position: relative;
  z-index: 2;
  border-radius: 4px;
  overflow: visible;
}

.square.last-move::after {
  content: "";
  position: absolute;
  inset: -2px;                 /* slightly outside the square */
  border-radius: 4px;
  pointer-events: none;

  border: 4px solid rgba(80, 140, 255, 0.50);

  box-shadow:
    0 0 4px rgba(80, 140, 255, 0.22),
    0 0 12px rgba(80, 140, 255, 0.14),
    0 0 16px rgba(80, 140, 255, 0.08);

  opacity: 0.75;
  transform: scale(1);

  animation: subtleGlowPulse 1.2s ease-in-out infinite alternate;
  transform-origin: center;
}

@keyframes subtleGlowPulse {
  from {
    opacity: 0.55;
    transform: scale(0.99);
    border-color: rgba(80, 140, 255, 0.38);
    box-shadow:
      0 0 2px rgba(80, 140, 255, 0.14),
      0 0 6px rgba(80, 140, 255, 0.08),
      0 0 10px rgba(80, 140, 255, 0.05);
  }
  to {
    opacity: 0.95;
    transform: scale(1.03);
    border-color: rgba(80, 140, 255, 0.62);
    box-shadow:
      0 0 5px rgba(80, 140, 255, 0.28),
      0 0 12px rgba(80, 140, 255, 0.18),
      0 0 20px rgba(80, 140, 255, 0.10);
  }
}
