* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#app {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding: 20px;
}

.sidebar {
  width: 180px;
  min-height: 200px;
}

.sidebar h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
  margin-bottom: 8px;
}

.captured-pieces {
  font-size: 24px;
  line-height: 1.6;
  min-height: 40px;
}

#move-history {
  margin-top: 24px;
}

#moves-list {
  max-height: 400px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.8;
}

.move-row {
  display: flex;
  gap: 8px;
}

.move-num { color: #666; min-width: 28px; text-align: right; }
.move-white, .move-black {
  min-width: 56px;
  padding: 0 4px;
  border-radius: 3px;
  cursor: default;
}
.move-white:hover, .move-black:hover { background: #2a2a4a; }

#board-area { display: flex; flex-direction: column; align-items: center; gap: 12px; }

#turn-indicator {
  font-size: 18px;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 8px;
  background: #16213e;
}

#board {
  display: grid;
  grid-template-columns: repeat(8, 72px);
  grid-template-rows: repeat(8, 72px);
  border: 3px solid #0f3460;
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.square {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  cursor: pointer;
  position: relative;
  user-select: none;
  transition: background 0.1s;
}

.square.light { background: #e8dcc8; }
.square.dark { background: #b58863; }

.square.selected { background: #f6f669 !important; }
.square.valid-move::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
}
.square.valid-capture {
  background: radial-gradient(transparent 50%, rgba(0,0,0,0.2) 50%),
    var(--sq-bg) !important;
}
.square.last-from { background: #cdd26a !important; }
.square.last-to { background: #aaa23a !important; }
.square.check { background: radial-gradient(ellipse at center, #ff0000 0%, #e70000 25%, rgba(169,0,0,0) 89%) !important; }

.piece { cursor: pointer; line-height: 1; }
.piece-white { filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.3)); }
.piece-black { filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.5)); }

#game-status {
  font-size: 20px;
  font-weight: bold;
  color: #f6c90e;
  min-height: 28px;
}

#controls { display: flex; gap: 12px; }
#controls button {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  background: #0f3460;
  color: #e0e0e0;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
#controls button:hover { background: #1a4a8a; }

#promotion-dialog {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
#promotion-dialog.hidden { display: none; }
.promo-pieces {
  display: flex;
  gap: 8px;
  background: #16213e;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
.promo-piece {
  font-size: 52px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.15s;
}
.promo-piece:hover { background: #0f3460; }

.coord-label {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  pointer-events: none;
}
.file-label { bottom: 1px; right: 3px; }
.rank-label { top: 1px; left: 3px; }
.square.light .coord-label { color: #b58863; }
.square.dark .coord-label { color: #e8dcc8; }
