:root {
  --light-square: #f0d9b5;
  --dark-square: #b58863;
  --selected: #6aa84f;
  --last-move: #cdd26a;
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #222;
  color: #eee;
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 32px 16px;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
}

#status-panel {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 0.95rem;
}

#color-badge {
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 600;
}
#color-badge.white { background: #f0f0f0; color: #111; }
#color-badge.black { background: #111; color: #f0f0f0; border: 1px solid #555; }

.hidden {
  display: none !important;
}

#board {
  display: grid;
  grid-template-columns: repeat(8, 64px);
  grid-template-rows: repeat(8, 64px);
  border: 4px solid #444;
  user-select: none;
}

.square {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  cursor: pointer;
  position: relative;
}

.square.light { background: var(--light-square); }
.square.dark { background: var(--dark-square); }
.square.selected { outline: 4px solid var(--selected); outline-offset: -4px; }
.square.last-move { background: var(--last-move); }

.square.white-piece { color: #fff; text-shadow: 0 0 2px #000, 0 0 3px #000; }
.square.black-piece { color: #111; }

#board.flipped {
  transform: rotate(180deg);
}
#board.flipped .square {
  transform: rotate(180deg);
}

#message-bar {
  min-height: 1.4em;
  font-size: 0.9rem;
  color: #f5a623;
}

#promotion-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.promotion-box {
  background: #333;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
}

.promotion-choices {
  display: flex;
  gap: 8px;
}

.promotion-choices button {
  font-size: 32px;
  width: 56px;
  height: 56px;
  cursor: pointer;
  background: #eee;
  border: 1px solid #999;
  border-radius: 6px;
}
