/* ============================================================
   Army Chess - Game Styles
   ============================================================ */

:root {
  --red-color: #c62828;
  --blue-color: #1565c0;
  --overlay-bg: rgba(0, 0, 0, 0.7);
}

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

body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f0f0f0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #333;
}

/* ---- Common Buttons ---- */
.btn {
  padding: 10px 28px;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
  font-weight: 500;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.btn:active {
  transform: translateY(0);
}

/* ---- Overlay ---- */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--overlay-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.overlay-content {
  background: #fff;
  border-radius: 12px;
  padding: 36px 44px;
  text-align: center;
  max-width: 460px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ---- Mode Selection ---- */
.game-title {
  font-size: 38px;
  margin-bottom: 4px;
  color: #e65100;
  font-weight: 700;
}

.subtitle {
  font-size: 15px;
  color: #888;
  margin-bottom: 28px;
}

.mode-section {
  margin-bottom: 16px;
}

.mode-section h3 {
  font-size: 15px;
  margin-bottom: 8px;
  color: #555;
}

.mode-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ---- Rock Paper Scissors ---- */
#rps-section h2 {
  margin-bottom: 24px;
  color: #333;
}

.rps-player {
  margin-bottom: 20px;
}

.rps-player h3 {
  margin-bottom: 10px;
  font-size: 16px;
  color: #555;
}

.rps-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-rps {
  background: #fff;
  border: 2px solid #ccc;
  padding: 10px 18px;
  font-size: 16px;
  border-radius: 8px;
}

.btn-rps:hover {
  border-color: #333;
  background: #f5f5f5;
}

.btn-rps.selected {
  border-color: #ffd600;
  background: #fff9c4;
}

.rps-status {
  margin-top: 8px;
  font-size: 14px;
  color: #888;
}

.rps-result {
  margin-top: 16px;
  font-size: 18px;
  font-weight: bold;
  min-height: 28px;
}

.btn-flip {
  background: #006400;
  color: #fff;
}

.btn-open {
  background: #e65100;
  color: #fff;
}

.btn-hidden {
  background: #4a148c;
  color: #fff;
}

/* ---- Game Area ---- */
#game-area {
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1100px;
}

/* ---- Status Bar ---- */
#status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: center;
  margin-bottom: 16px;
  padding: 10px 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  width: 100%;
}

.status-item {
  font-size: 14px;
}

.label {
  color: #777;
}

.team-indicator {
  font-weight: bold;
}

.red-text {
  color: var(--red-color);
  font-weight: bold;
}

.blue-text {
  color: var(--blue-color);
  font-weight: bold;
}

/* ---- Main Game Area ---- */
#game-main {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: center;
}

/* ---- Board Container ---- */
#board-container {
  flex-shrink: 0;
  position: relative;
  width: 420px;
  max-width: 100%;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#board-container svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ---- Piece ---- */
.chess-piece {
  position: absolute;
  width: 56px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  background: #fef7cc;
  border: 2px solid #fdc44c;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  z-index: 10;
  user-select: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.chess-piece:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.chess-red {
  color: #c62828;
}

.chess-blue {
  color: #1565c0;
}

.chess-face-down {
  background: #5b7d1a;
  border: 2px solid #4a6a14;
  color: transparent;
}

.chess-selected {
  border: 2px solid #e53935;
  box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.3);
}

.chess-ai-highlight {
  border: 2px solid #1565c0;
  box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.3);
}

/* ---- Move Highlight ---- */
.move-highlight {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  z-index: 5;
  cursor: pointer;
}

.highlight-move {
  background: rgba(76, 175, 80, 0.7);
}

.highlight-capture {
  background: rgba(244, 67, 54, 0.7);
}

/* ---- Game Rules Panel ---- */
#rules-panel {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  width: 200px;
  font-size: 12px;
  line-height: 1.6;
}

#rules-panel h3 {
  font-size: 15px;
  margin-bottom: 10px;
  color: #333;
  border-bottom: 2px solid #fdc44c;
  padding-bottom: 6px;
}

.rule-section {
  margin-bottom: 10px;
}

.rule-section h4 {
  font-size: 12px;
  color: #555;
  margin-bottom: 3px;
}

.rule-section ul {
  list-style: none;
  padding-left: 4px;
}

.rule-section li {
  color: #666;
  padding: 1px 0;
}

.rule-section p {
  color: #666;
  font-size: 11px;
}

/* ---- Captured Pieces Display ---- */
#captured-area {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 16px;
  width: 100%;
}

.captured-section {
  flex: 1;
  background: #fff;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  max-width: 400px;
}

.captured-section h3 {
  font-size: 13px;
  margin-bottom: 6px;
  text-align: center;
}

.captured-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: center;
  min-height: 24px;
}

.captured-piece {
  font-size: 11px;
  padding: 1px 5px;
  background: #f5f5f5;
  border-radius: 3px;
}

/* ---- Action Hint ---- */
#message {
  margin-top: 12px;
  padding: 8px 16px;
  font-size: 14px;
  color: #555;
  text-align: center;
  min-height: 36px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  width: 100%;
  max-width: 360px;
}

#message.error {
  color: var(--red-color);
  background: #ffcdd2;
}

#message.info {
  color: var(--blue-color);
  background: #bbdefb;
}

/* ---- Game Over Screen ---- */
#game-over .overlay-content h2 {
  font-size: 26px;
  margin-bottom: 20px;
}

.btn-restart {
  background: #333;
  color: #fff;
  font-size: 16px;
}

/* ---- Responsive Layout ---- */
@media (max-width: 900px) {
  #game-main {
    flex-direction: column;
    align-items: center;
  }
  #rules-panel {
    width: 100%;
    max-width: 600px;
  }
}

@media (max-width: 500px) {
  .overlay-content {
    padding: 20px 16px;
  }
  .game-title {
    font-size: 30px;
  }
  .btn {
    padding: 8px 20px;
    font-size: 14px;
  }
  .mode-buttons {
    flex-direction: column;
    gap: 10px;
  }
  #status-bar {
    gap: 6px 14px;
    padding: 8px 10px;
  }
  .status-item {
    font-size: 12px;
  }
  #captured-area {
    flex-direction: column;
    gap: 8px;
  }
}
