.chess-layout {
  grid-template-columns: 1.25fr 1fr;
}

.board-wrap {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 12px;
}

.chess-board {
  width: min(100%, 640px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #0b1220;
}

.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition:
    filter 0.15s ease,
    transform 0.12s ease;
  min-width: 0;
  min-height: 0;
  font-family:
    "Segoe UI Symbol", "Noto Sans Symbols", "Apple Symbols", sans-serif;
}

.chess-board {
  width: min(100%, 640px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #0b1220;
}

.square:hover {
  filter: brightness(1.06);
}

.square.light {
  background: #dbe4f0;
  color: #111827;
}

.square.dark {
  background: #63738f;
  color: #111827;
}

.square.selected {
  outline: 3px solid var(--warning);
  outline-offset: -3px;
}

.square.in-check {
  box-shadow: inset 0 0 0 4px rgba(239, 68, 68, 0.7);
}

.square.last-move {
  box-shadow: inset 0 0 0 4px rgba(79, 70, 229, 0.35);
}

.square .dot {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.75);
}

.square.capture::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 4px solid rgba(239, 68, 68, 0.75);
  border-radius: 50%;
}

.square .coord {
  position: absolute;
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.7;
  pointer-events: none;
}

.square .coord.file {
  bottom: 4px;
  right: 6px;
}

.square .coord.rank {
  top: 4px;
  left: 6px;
}

.move-history {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
  max-height: 320px;
  overflow: auto;
}

@media (max-width: 1000px) {
  .chess-layout {
    grid-template-columns: 1fr;
  }
}

.promotion-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.promotion-modal.hidden {
  display: none;
}

.promotion-card {
  width: min(420px, calc(100% - 24px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 22px;
  text-align: center;
}

.promotion-card h3 {
  margin: 0 0 8px;
}

.promotion-card p {
  margin: 0 0 16px;
  color: var(--muted);
}

.promotion-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.promotion-btn {
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 800;
  color: white;
  cursor: pointer;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  transition:
    transform 0.18s ease,
    filter 0.18s ease;
}

.promotion-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}
