* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: #0C0D14;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding-top: 16px;
  font-family: 'Courier New', monospace;
  color: #fff;
}

#game-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  padding: 0 8px;
}

/* ── HUD ─────────────────────────────────────────────────── */
#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: #13141D;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 16px;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hud-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #888;
  text-transform: uppercase;
}

.hud-value {
  font-size: 28px;
  font-weight: 700;
  color: #00ff88;
}

.hud-value--ai {
  color: #ff4466;
}

.hud-capture {
  font-size: 10px;
  color: #666;
  letter-spacing: 1px;
}

#turn-indicator {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #ffcc00;
  text-align: center;
  text-transform: uppercase;
  min-width: 100px;
}

/* ── Board ────────────────────────────────────────────────── */
#board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  max-width: 440px;
  aspect-ratio: 1;
  border: 2px solid #3a2a4a;
  border-radius: 4px;
  overflow: hidden;
}

.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.square--light {
  background: #1a1520;
}

.square--dark {
  background: #2a1a3a;
}

.square--highlight {
  background: rgba(0, 255, 136, 0.2);
  cursor: pointer;
}

.square--highlight::after {
  content: '';
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(0, 255, 136, 0.5);
}

.square--jump-highlight {
  background: rgba(255, 204, 0, 0.25);
  cursor: pointer;
}

.square--jump-highlight::after {
  content: '';
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(255, 204, 0, 0.6);
}

/* ── Pieces ───────────────────────────────────────────────── */
.piece {
  width: 75%;
  height: 75%;
  border-radius: 50%;
  position: relative;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.piece:hover {
  transform: scale(1.08);
}

.piece--player {
  background: radial-gradient(circle at 35% 35%, #33ffaa, #00cc66);
  box-shadow: 0 3px 8px rgba(0, 255, 136, 0.3), inset 0 -3px 6px rgba(0, 0, 0, 0.3);
  border: 2px solid #00ff88;
}

.piece--ai {
  background: radial-gradient(circle at 35% 35%, #ff7799, #cc2244);
  box-shadow: 0 3px 8px rgba(255, 68, 102, 0.3), inset 0 -3px 6px rgba(0, 0, 0, 0.3);
  border: 2px solid #ff4466;
  cursor: default;
}

.piece--selected {
  transform: scale(1.12);
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.6), 0 4px 12px rgba(0, 255, 136, 0.4);
}

.piece--selectable {
  animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 3px 8px rgba(0, 255, 136, 0.3), inset 0 -3px 6px rgba(0, 0, 0, 0.3); }
  50% { box-shadow: 0 0 14px rgba(0, 255, 136, 0.5), 0 3px 8px rgba(0, 255, 136, 0.3), inset 0 -3px 6px rgba(0, 0, 0, 0.3); }
}

/* King crown */
.piece--king::after {
  content: '\u2605';
  font-size: clamp(10px, 3vw, 18px);
  color: rgba(0, 0, 0, 0.5);
  position: absolute;
  line-height: 1;
}

.piece--player.piece--king::after {
  color: rgba(0, 60, 30, 0.7);
  text-shadow: 0 0 4px rgba(0, 255, 136, 0.3);
}

.piece--ai.piece--king::after {
  color: rgba(80, 0, 20, 0.7);
  text-shadow: 0 0 4px rgba(255, 68, 102, 0.3);
}

/* ── Overlay ──────────────────────────────────────────────── */
#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(12, 13, 20, 0.92);
  z-index: 20;
  transition: opacity 0.3s ease;
}

#overlay.hidden {
  display: none;
}

#overlay-box {
  text-align: center;
  padding: 40px 48px;
}

#overlay-box h1 {
  font-family: 'Courier New', monospace;
  font-size: 38px;
  margin-bottom: 12px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
}

#screen-start h1 {
  color: #00ff88;
}

.subtitle {
  font-size: 16px;
  color: #ffcc00;
  letter-spacing: 3px;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.controls-hint {
  font-size: 13px;
  color: #777;
  margin-bottom: 24px;
  line-height: 1.6;
}

.game-btn {
  font-family: 'Courier New', monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  background: #00ff88;
  color: #0C0D14;
  border: none;
  padding: 14px 40px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.game-btn:hover {
  background: #33ffaa;
}

.game-btn:active {
  transform: scale(0.96);
}

#screen-gameover h1 {
  margin-bottom: 8px;
}

#result-detail {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 24px;
  letter-spacing: 1px;
}

.hidden {
  display: none !important;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 500px) {
  body {
    padding-top: 8px;
  }

  #hud {
    padding: 8px 10px;
  }

  .hud-value {
    font-size: 22px;
  }

  .hud-label {
    font-size: 10px;
    letter-spacing: 2px;
  }

  #turn-indicator {
    font-size: 11px;
    letter-spacing: 1px;
    min-width: 80px;
  }

  #overlay-box {
    padding: 32px 24px;
  }

  #overlay-box h1 {
    font-size: 28px;
    letter-spacing: 3px;
  }

  .game-btn {
    font-size: 14px;
    padding: 12px 32px;
  }
}
