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

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 30px 16px;
}

#container {
  max-width: 900px;
  width: 100%;
}

h1 {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 8px;
  color: #fff;
}

#status {
  text-align: center;
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: #a0c4ff;
  min-height: 1.4em;
}

#game-area {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: flex-start;
  margin-bottom: 16px;
}

#board-wrapper {
  flex-shrink: 0;
}

#captures-sidebar {
  background: #16213e;
  border-radius: 8px;
  padding: 16px 14px;
  width: 180px;
  flex-shrink: 0;
}

#captures-sidebar h3 {
  margin-bottom: 12px;
  font-size: 1rem;
  color: #a0c4ff;
}

.capture-group {
  margin-bottom: 12px;
}

.capture-group h4 {
  font-size: 0.82rem;
  color: #9ec5ff;
  margin-bottom: 6px;
}

.captured-list {
  min-height: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 1.1rem;
  color: #ddd;
}

.captured-piece {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
}

#controls {
  text-align: center;
  margin-bottom: 20px;
}

#newGameBtn {
  background: #0f3460;
  color: #fff;
  border: 1px solid #16213e;
  padding: 10px 28px;
  font-size: 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

#newGameBtn:hover {
  background: #1a5276;
}

#ai-sidebar {
  background: #16213e;
  border-radius: 8px;
  padding: 16px 20px;
  width: 280px;
  flex-shrink: 0;
  align-self: flex-start;
}

#ai-sidebar h3 {
  margin-bottom: 12px;
  font-size: 1rem;
  color: #a0c4ff;
}

#pipeline-stats {
  margin-bottom: 16px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #1e2d4a;
}

.stat-label {
  font-size: 0.85rem;
  color: #999;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
}

#chosen-reasoning {
  margin-bottom: 12px;
}

#chosen-reasoning h4 {
  font-size: 0.85rem;
  color: #a0c4ff;
  margin-bottom: 6px;
}

#chosen-reason-text {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #ccc;
}

#proposals-details {
  margin-top: 12px;
}

#proposals-details summary {
  cursor: pointer;
  color: #a0c4ff;
  font-size: 0.9rem;
}

#proposals-list {
  margin-top: 8px;
  padding-left: 20px;
  font-size: 0.85rem;
  color: #bbb;
}

#proposals-list li {
  margin-bottom: 4px;
}

#board .highlight-selected {
  background-color: rgba(255, 255, 50, 0.4) !important;
}

#board .highlight-move {
  background: radial-gradient(circle, rgba(0, 0, 0, 0.25) 25%, transparent 25%) center center no-repeat !important;
  background-size: 100% 100% !important;
}

#board .square-55d63 {
  cursor: pointer;
}

#board .selected-square {
  box-shadow: inset 0 0 0 3px #ffd166;
}

#board .target-square {
  box-shadow: inset 0 0 0 3px #6bcf90;
}

@media (max-width: 1100px) {
  #game-area {
    flex-wrap: wrap;
  }

  #captures-sidebar,
  #ai-sidebar {
    width: min(480px, 100%);
  }
}

/* Mobile styles */
@media (max-width: 768px) {
  body {
    padding: 16px 8px;
  }

  #container {
    padding: 0 8px;
  }

  h1 {
    font-size: 1.4rem;
    margin-bottom: 6px;
  }

  #status {
    font-size: 0.95rem;
    margin-bottom: 12px;
  }

  #game-area {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  #board-wrapper {
    width: 100%;
    max-width: 100%;
    padding: 8px;
  }

  #board {
    width: 100% !important;
    max-width: 100%;
  }

  #captures-sidebar,
  #ai-sidebar {
    width: 100%;
    max-width: 100%;
    padding: 12px;
  }

  #captures-sidebar {
    order: 2;
  }

  #ai-sidebar {
    order: 3;
  }

  #board-wrapper {
    order: 1;
  }

  .stat-row {
    padding: 8px 0;
  }

  .stat-label {
    font-size: 0.8rem;
  }

  .stat-value {
    font-size: 1rem;
  }

  #chosen-reason-text {
    font-size: 0.85rem;
  }

  #newGameBtn {
    width: 100%;
    max-width: 300px;
    padding: 12px 24px;
  }

  #controls {
    padding: 0 16px;
  }

  .timing-panel {
    padding: 10px 12px;
  }

  .timing-header h4 {
    font-size: 0.85rem;
  }

  .timing-label {
    font-size: 0.78rem;
  }

  .timing-value {
    font-size: 0.85rem;
  }
}

/* Extra small screens */
@media (max-width: 400px) {
  h1 {
    font-size: 1.2rem;
  }

  #status {
    font-size: 0.85rem;
  }

  #captures-sidebar,
  #ai-sidebar {
    padding: 10px;
  }

  #captures-sidebar h3,
  #ai-sidebar h3 {
    font-size: 0.9rem;
  }

  .capture-group h4,
  #chosen-reasoning h4 {
    font-size: 0.75rem;
  }

  .captured-piece {
    width: 20px;
    height: 20px;
    font-size: 0.9rem;
  }
}
