.chess-layout {
  display:grid; grid-template-columns:minmax(0,32rem) minmax(13rem,19rem);
  align-items:start; gap:clamp(.7rem,3vw,1.5rem);
}
.chess-layout[hidden] { display:none; }
.chess-court {
  width:100%; max-width:32rem; padding:clamp(.28rem,1.3vw,.65rem);
  border:1px solid #60432b; border-radius:.65rem;
  background:repeating-linear-gradient(4deg,#62432a 0 8px,#755335 8px 10px,#69492f 10px 17px);
  box-shadow:0 3px 8px #39281940;
}
.chess-board {
  display:grid; grid-template-columns:repeat(8,minmax(0,1fr));
  border:1px solid #35291e; touch-action:manipulation;
}
.chess-square {
  position:relative; display:grid; place-items:center; min-width:0; width:100%; aspect-ratio:1;
  padding:0; border:0; border-radius:0; background:#e9d9b9; color:#241c13; cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
.chess-square.is-dark { background:#758265; color:#141c11; }
.chess-square.is-last { box-shadow:inset 0 0 0 2px #5942228c; }
.chess-square.is-selected { background:#e5b557; box-shadow:inset 0 0 0 2px #654412; }
.chess-square.is-check { background:#cf8070; }
.chess-square.is-target::after {
  content:""; position:absolute; width:27%; aspect-ratio:1; border-radius:50%; background:#26332286;
}
.chess-square.is-capture::after {
  content:""; position:absolute; inset:5%; border:2px solid #682a22; border-radius:50%; pointer-events:none;
}
.play .chess-square:focus-visible { z-index:1; outline:2px solid #181710; outline-offset:-3px; }
.chess-piece {
  display:block; font-family:"Segoe UI Symbol","Noto Sans Symbols 2","DejaVu Sans",serif;
  font-size:clamp(1rem,5.5vw,2.7rem); line-height:1; user-select:none;
}
.chess-piece[data-side="w"] {
  color:#fff4dc; -webkit-text-stroke:1px #423122;
  text-shadow:0 1px 1px #2a2017;
}
.chess-piece[data-side="b"] { color:#202c21; text-shadow:0 1px #f4eed685; }
.chess-coordinate {
  position:absolute; z-index:1; pointer-events:none;
  font:700 clamp(.49rem,1.4vw,.72rem)/1 var(--sans);
}
.chess-rank { top:5%; left:5%; }
.chess-file { bottom:5%; right:5%; }
.chess-entrance {
  margin:0 0 .85rem; overflow:hidden; border:1px solid #7a664a; border-radius:.5rem;
  background:#344132; color:#fff4db;
}
.chess-entrance img { display:block; width:100%; height:auto; }
.chess-entrance figcaption { padding:.38rem .7rem; font-weight:700; letter-spacing:.06em; }
.chess-controls { display:flex; flex-wrap:wrap; align-items:center; gap:.45rem; }
.chess-controls label { flex-basis:100%; font-weight:700; }
.chess-controls :is(select,button), .chess-promotion button {
  min-height:44px; padding:.25rem .65rem; border:1px solid var(--accent);
  border-radius:.45rem; background:var(--paper); color:var(--ink); font:inherit;
}
.chess-controls button, .chess-promotion button { cursor:pointer; font-weight:700; }
.chess-side .chess-status { margin:.65rem 0 0; }
.chess-last { margin:.2rem 0 0; min-height:1.5em; }
.chess-promotion {
  max-width:min(26rem,calc(100% - 2rem)); border:1px solid var(--line); border-radius:.7rem;
  padding:1rem; background:var(--panel); color:var(--ink);
}
.chess-promotion::backdrop { background:#18161085; }
.chess-promotion h3 { margin:0 0 .5rem; }
.chess-promotion form { display:flex; flex-wrap:wrap; gap:.4rem; }
@media (max-width:48rem) {
  .chess-layout { grid-template-columns:minmax(0,32rem); }
  .chess-side { display:grid; }
  .chess-entrance { order:1; margin:.5rem 0 0; }
  .chess-entrance img { height:4.5rem; object-fit:cover; object-position:center 59%; }
  .chess-piece { font-size:clamp(1rem,7vw,2.7rem); }
}
