.chess { position: absolute; inset: 0; display: flex; }
.chess .area { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 8px; background: #808080; }
.board-wrap { display: grid; grid-template-columns: 16px 1fr; grid-template-rows: 1fr 16px; }
.board-wrap .ranks, .board-wrap .files { display: flex; color: #fff; font-size: 11px; font-weight: normal; }
.board-wrap .ranks { flex-direction: column; }
.board-wrap .ranks span, .board-wrap .files span { flex: 1; display: flex; align-items: center; justify-content: center; }
.board-wrap .files { grid-column: 2; }
.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 2px solid #000;
  box-shadow: 0 0 0 2px #c0c0c0, 3px 3px 0 3px rgba(0,0,0,.4);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.sq { position: relative; display: flex; align-items: center; justify-content: center; }
.sq.l { background: #e8dcb4; }
.sq.d { background: #5a8a5a; }
.sq.last::before { content: ""; position: absolute; inset: 0; background: rgba(255, 230, 0, .38); }
.sq.sel::before { content: ""; position: absolute; inset: 0; background: rgba(0, 120, 255, .45); }
.sq.hint::before { content: ""; position: absolute; inset: 0; background: rgba(0, 255, 120, .45); }
.sq.check::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, rgba(255,0,0,.85) 20%, rgba(255,0,0,0) 72%); }
.sq.tgt::after { content: ""; position: absolute; width: 26%; height: 26%; border-radius: 50%; background: rgba(0,0,0,.28); }
.sq.tgt.cap::after { width: 86%; height: 86%; background: none; border: 4px solid rgba(0,0,0,.28); box-sizing: border-box; }
.pc {
  position: relative;
  z-index: 1;
  line-height: 1;
  font-family: "Segoe UI Symbol", "DejaVu Sans", "Noto Sans Symbols2", "Arial Unicode MS", serif;
  cursor: pointer;
  pointer-events: none;
}
.pc.w { color: #fff; text-shadow: 0 0 1px #000, 0 0 1px #000, 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000; }
.pc.b { color: #101010; text-shadow: 0 0 1px #fff8; }
.drag-ghost { position: fixed; z-index: 90; pointer-events: none; transform: translate(-50%, -50%); }
.chess .side {
  width: 240px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-left: 1px solid #000;
  min-height: 0;
}
.chess .status { background: #fff; padding: 4px 6px; font-weight: normal; min-height: 42px; box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #fff; }
.chess .status b { color: #000080; }
.chess .opening { font-weight: normal; font-style: italic; font-size: 12px; min-height: 16px; }
.chess .caps { font-size: 20px; min-height: 24px; line-height: 1; font-family: "Segoe UI Symbol", "DejaVu Sans", serif; word-break: break-all; }
.chess .moves {
  flex: 1;
  min-height: 60px;
  overflow: auto;
  background: #fff;
  font: 12px/1.5 "Courier New", monospace;
  padding: 2px 4px;
  box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #fff;
}
.chess .moves .mv { display: inline-block; min-width: 62px; }
.chess .moves .no { display: inline-block; min-width: 30px; color: #808080; }
.chess .moves .cur { background: #000080; color: #fff; }
.chess .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.chess .btns .btn { min-width: 0; }
.chess .palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.chess .palette .btn { min-width: 0; padding: 2px 0; font-size: 22px; font-family: "Segoe UI Symbol", "DejaVu Sans", serif; }
.chess .palette .btn.on { background: #000080; }
.chess .edit { display: none; flex-direction: column; gap: 6px; }
.chess.editing .edit { display: flex; }
.chess.editing .play { display: none; }
.chess .play { display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 0; }
@media (max-width: 640px) {
  .chess { flex-direction: column; }
  .chess .side { width: auto; border-left: 0; border-top: 1px solid #000; max-height: 42%; }
  .chess .moves { min-height: 40px; }
  .chess .btns { grid-template-columns: repeat(4, 1fr); }
}
