:root {
  --bg-main: #08080a;
  --bg-panel: #121316;
  --bg-btn: #1c1e24;
  --bg-btn-active: #2a2d36;
  --text-primary: #d0d3dc;
  --text-muted: #787d8a;
  --sq-light: #363942;
  --sq-dark: #1d1f24;
  --sq-selected: #3b4d7a;
  --sq-last-move: #2c3545;
  --sq-check: #6e2424;
  --hint-dot: rgba(130, 160, 255, 0.45);
  --hint-capture: rgba(235, 87, 87, 0.55);
  --piece-white: #eef1f8;
  --piece-black: #0a0b0d;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; }
body {
  margin: 0; padding: 0;
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  min-height: 100dvh; overflow-x: hidden;
}
header {
  width: 100%; max-width: 480px; padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
  background-color: var(--bg-panel); border-bottom: 1px solid #1f2128;
}
.title { font-size: 1.05rem; font-weight: 600; letter-spacing: 0.5px; }
.controls-top { display: flex; gap: 8px; align-items: center; }
select, button {
  background-color: var(--bg-btn); color: var(--text-primary);
  border: 1px solid #2b2e38; border-radius: 6px; padding: 6px 10px;
  font-size: 0.85rem; cursor: pointer; outline: none;
}
button:active { background-color: var(--bg-btn-active); }
.status-bar {
  width: 100%; max-width: 480px; padding: 10px 16px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.9rem; color: var(--text-muted);
}
#status-text { color: var(--text-primary); font-weight: 500; }
.captured-box { display: flex; gap: 2px; font-size: 1rem; min-height: 22px; }
.board-wrapper {
  width: 96vw; max-width: 460px; aspect-ratio: 1 / 1; padding: 4px;
  background-color: #16181d; border: 1px solid #262932; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
}
#board {
  width: 100%; height: 100%; display: grid;
  grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  border-radius: 4px; overflow: hidden;
}
.square {
  position: relative; display: flex; align-items: center; justify-content: center;
  font-size: clamp(26px, 8.5vw, 44px); cursor: pointer;
}
.square.light { background-color: var(--sq-light); }
.square.dark { background-color: var(--sq-dark); }
.square.selected { background-color: var(--sq-selected) !important; }
.square.last-move { background-color: var(--sq-last-move); }
.square.in-check { background-color: var(--sq-check) !important; }
.piece.white { color: var(--piece-white); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); }
.piece.black { color: var(--piece-black); text-shadow: 0 0 2px rgba(200, 205, 220, 0.65), 0 1px 2px rgba(0, 0, 0, 0.9); }
.square.hint::after {
  content: ""; width: 28%; height: 28%; background-color: var(--hint-dot);
  border-radius: 50%; position: absolute; pointer-events: none;
}
.square.hint-capture::after {
  content: ""; width: 82%; height: 82%; border: 3px solid var(--hint-capture);
  background-color: transparent; border-radius: 50%; position: absolute; pointer-events: none;
}
.coord-rank { position: absolute; top: 2px; left: 3px; font-size: 9px; color: rgba(255, 255, 255, 0.25); pointer-events: none; }
.coord-file { position: absolute; bottom: 1px; right: 3px; font-size: 9px; color: rgba(255, 255, 255, 0.25); pointer-events: none; }
footer {
  width: 100%; max-width: 480px; padding: 12px 16px 18px;
  display: flex; justify-content: space-around; gap: 10px;
  background-color: var(--bg-panel); border-top: 1px solid #1f2128;
}
footer button { flex: 1; padding: 10px; font-size: 0.92rem; font-weight: 500; }
#promo-modal {
  display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85);
  align-items: center; justify-content: center; z-index: 100;
}
.promo-box {
  background: var(--bg-panel); border: 1px solid #2e323d;
  border-radius: 10px; padding: 16px; text-align: center;
}
.promo-choices { display: flex; gap: 12px; margin-top: 12px; }
.promo-btn { font-size: 2.2rem; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; }
