.chess-home {
  display: flex; flex-wrap: wrap; gap: clamp(1rem,4vw,3rem); align-items: center;
  justify-content: center; padding: clamp(1rem,4vw,3rem); background: #eef3e9; border-radius: 18px;
}
.chess-preview {
  display: grid; grid-template-columns: repeat(3,1fr); width: min(100%,16rem);
  aspect-ratio: 1; overflow: hidden; border: 6px solid #694d38; border-radius: 14px;
  background: url('./board.webp') left top / 266.6667% 266.6667%;
}
.chess-preview span { display: grid; min-height: 0; place-items: center; }
.chess-preview img { width: 94%; height: 94%; object-fit: contain; }
.chess-theme-picker { display: inline-flex; gap: .65rem; align-items: center; font-weight: 750; }
.chess-theme-picker select { min-height: 44px; border-radius: .7rem; padding: .4rem .75rem; font: inherit; color: #233d39; background-color: white; border: 1px solid #9cafaa; }
.chess-menu { display: grid; gap: .75rem; max-width: 100%; text-align: left; }
.chess-option,.chess-choice {
  font: inherit; color: #214438; background: #fffdf6; border: 2px solid #a6bba7;
  border-radius: 12px; cursor: pointer; padding: .7rem 1rem;
}
.chess-option { text-align: left; }
.chess-option strong,.chess-option small { display: block; }
.chess-option small { font-size: .875rem; margin-top: .15rem; }
.chess-option:hover,.chess-choice:hover { background: #e1efd9; }
.chess-board {
  display: grid; grid-template-columns: repeat(8,minmax(0,1fr)); width: min(100%,35rem);
  margin: 0 auto 1rem; border: clamp(4px,1vw,10px) solid #644834; border-radius: .65rem;
  overflow: hidden; box-sizing: border-box; background: #ceb588 url('./board.webp') center / 100% 100% no-repeat;
  box-shadow: 0 4px 0 #412f23, 0 8px 18px #3b352324;
}
.chess-surface[data-theme="ocean"] { --light:#d7ebe8; --dark:#85aec2; --frame:#30536c; }
.chess-surface[data-theme="rose"] { --light:#fae4d8; --dark:#cb9299; --frame:#754858; }
.chess-surface[data-theme="violet"] { --light:#ebe6f5; --dark:#b09ecb; --frame:#59476f; }
.chess-surface:not([data-theme="classic"]) {
  border-color: var(--frame);
  background: linear-gradient(125deg,#ffffff18,transparent 55%,#16112712),
    conic-gradient(var(--dark) 25%,var(--light) 0 50%,var(--dark) 0 75%,var(--light) 0) top left / 25% 25%;
}
.chess-preview:not([data-theme="classic"]) { background-size: 100% 100%,66.6667% 66.6667%; }
.chess-cell {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; min-width: 0;
  border: 0; padding: 0; background: transparent; cursor: pointer; touch-action: manipulation;
}
.chess-cell img { width: 95%; height: 95%; object-fit: contain; pointer-events: none; }
.chess-cell.recent { background: #ffdf6347; }
.chess-cell.selected { box-shadow: inset 0 0 0 3px #05567a; background: #94e2e16b; }
.chess-cell.check { box-shadow: inset 0 0 0 4px #b82228; }
.chess-cell.target::after {
  position: absolute; content: ''; width: 24%; height: 24%; border-radius: 50%;
  background: #123d40ba; border: 1px solid #fff8;
}
.chess-cell.target.occupied::after { width: 88%; height: 88%; border: 3px dashed #0d474a; background: transparent; }
.chess-cell:focus-visible { outline: 3px solid #16467a; outline-offset: -3px; }
.chess-promotion:not([hidden]) { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-bottom: 1rem; }
.chess-promotion strong { width: 100%; }
@media(max-width:600px) {
  .chess-preview { width: min(100%,9rem); }
  .chess-board { width: calc(100vw - 12px); margin-left: calc(50% - 50vw + 6px); }
}
