.dm-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  max-width: 560px;
  aspect-ratio: 1;
  margin: 0 auto;
  border: 2px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  user-select: none;
  overflow: hidden;
}

.dm-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
.dm-cell.light { background: #f4d9b0; }
.dm-cell.dark  { background: #7a4a25; cursor: pointer; }

.dm-cell.selected {
  outline: 3px solid #ff9966;
  outline-offset: -3px;
  z-index: 2;
}
.dm-cell.lastmove {
  box-shadow: inset 0 0 0 3px rgba(102, 192, 244, 0.65);
}
.dm-cell.chain-lock {
  outline: 3px dashed #ffcc66;
  outline-offset: -3px;
}

.dm-cell.legal::after {
  content: '';
  position: absolute;
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(255, 153, 102, 0.55);
  pointer-events: none;
}
.dm-cell.legal.capture::after {
  width: 78%;
  height: 78%;
  background: transparent;
  border: 4px solid rgba(255, 93, 93, 0.7);
  border-radius: 50%;
}

.dm-piece {
  width: 76%;
  height: 76%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 3px 6px rgba(0, 0, 0, 0.55),
    inset 2px 2px 6px rgba(255, 255, 255, 0.18),
    inset -2px -2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 120ms;
  font-size: clamp(16px, 4.5vw, 26px);
  line-height: 1;
}
.dm-piece.white {
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #d6d6d6 75%);
  color: #c9a35a;
}
.dm-piece.black {
  background: radial-gradient(circle at 35% 30%, #4a4a4a 0%, #0c0c0c 75%);
  color: #ffcc66;
}
.dm-piece.king::after {
  content: '★';
  font-size: 0.95em;
}

.dm-bar .score {
  display: inline-block;
  min-width: 22px;
  padding: 2px 6px;
  margin: 0 4px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  color: var(--text);
}

.dm-status {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
  min-height: 18px;
}
.dm-status.warn { color: #ffcc66; }

.dm-history {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--panel2);
  border-radius: 8px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  max-height: 120px;
  overflow-y: auto;
  color: var(--muted);
  line-height: 1.7;
}
.dm-history span { margin-right: 10px; color: var(--text); white-space: nowrap; }
.dm-history span.cap { color: #ff8a8a; }
.dm-history span.promo { color: #ffcc66; }

@media (max-width: 540px) {
  .dm-board { max-width: 96vw; }
}
