/* ============================================================
   中国象棋AI对战平台 - 主样式 (style.css)
   ============================================================ */

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

body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  min-height: 100vh;
  padding: 20px;
  color: #ecf0f1;
}

/* 页面标题 */
.app-title {
  text-align: center;
  font-size: 26px;
  margin-bottom: 20px;
  letter-spacing: 4px;
  color: #f1c40f;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* 主布局:棋盘 + 侧边面板 */
.main-layout {
  display: flex;
  gap: 25px;
  justify-content: center;
  flex-wrap: wrap;
  align-items: flex-start;
}

/* 棋盘区域 */
.board-wrapper {
  background: #fff;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

#chess-canvas {
  display: block;
  cursor: pointer;
  border-radius: 4px;
}

/* 侧边面板 */
.side-panel {
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.panel-card {
  background: rgba(255,255,255,0.95);
  color: #2c3e50;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.panel-card h3 {
  font-size: 15px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #ecf0f1;
  color: #34495e;
}

/* 状态信息行 */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
}

.info-label { color: #7f8c8d; }
.info-value { font-weight: bold; }

/* 回合显示(红黑分色) */
.turn-value { font-size: 18px; font-weight: bold; }
.turn-value.red { color: #c0392b; }
.turn-value.black { color: #2c3e50; }

/* 状态显示 */
.status-value { font-weight: bold; padding: 2px 10px; border-radius: 12px; font-size: 13px; }
.status-playing { background: #d4edda; color: #155724; }
.status-check { background: #f8d7da; color: #721c24; animation: blink 0.8s infinite; }
.status-ended { background: #e2e3e5; color: #383d41; }
.status-thinking { background: #fff3cd; color: #856404; animation: blink 0.8s infinite; }

/* 难度按钮组 */
.difficulty-group { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.difficulty-btn { background: #95a5a6; font-size: 13px; padding: 8px; }
.difficulty-btn:hover { background: #7f8c8d; }
.difficulty-btn.active { background: #8e44ad; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 按钮组 */
.btn-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-group .btn-full { grid-column: 1 / -1; }

button {
  padding: 10px 12px;
  border: none;
  border-radius: 6px;
  background: #3498db;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

button:hover { background: #2980b9; transform: translateY(-1px); }
button:active { transform: translateY(0); }

button.btn-undo { background: #e67e22; }
button.btn-undo:hover { background: #d35400; }
button.btn-reset { background: #27ae60; }
button.btn-reset:hover { background: #229954; }
button.btn-resign { background: #e74c3c; }
button.btn-resign:hover { background: #c0392b; }
button.btn-sound { background: #27ae60; }
button.btn-sound:hover { background: #229954; }

/* 吃子标记 */
.log-capture { color: #e74c3c; font-weight: bold; }

/* 走棋日志 */
.move-log-container {
  max-height: 280px;
  overflow-y: auto;
  font-size: 13px;
  font-family: "KaiTi", "STKaiti", serif;
}

.log-row {
  display: grid;
  grid-template-columns: 30px 1fr 1fr;
  gap: 8px;
  padding: 5px 4px;
  border-bottom: 1px dashed #ecf0f1;
  align-items: center;
}

.log-round { color: #95a5a6; font-size: 12px; }
.log-red { color: #c0392b; font-weight: bold; }
.log-black { color: #2c3e50; font-weight: bold; }
.log-empty { color: #bdc3c7; text-align: center; padding: 20px; font-style: italic; }

/* 滚动条美化 */
.move-log-container::-webkit-scrollbar { width: 6px; }
.move-log-container::-webkit-scrollbar-thumb { background: #bdc3c7; border-radius: 3px; }

/* 游戏结束遮罩 */
.overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.game-over-box {
  background: #fff;
  padding: 40px 50px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  animation: pop 0.3s ease;
}

@keyframes pop {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.go-title {
  font-size: 36px;
  margin-bottom: 12px;
  font-weight: bold;
}

.go-title.red { color: #c0392b; }
.go-title.black { color: #2c3e50; }

.go-reason { color: #7f8c8d; margin-bottom: 12px; font-size: 15px; }
.go-stats { color: #95a5a6; margin-bottom: 25px; font-size: 13px; font-family: Consolas, monospace; }

/* 轻提示 toast */
.toast {
  display: none;
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(44,62,80,0.95);
  color: #fff;
  padding: 12px 24px;
  border-radius: 6px;
  z-index: 200;
  font-size: 14px;
}

/* 操作提示 */
.tip-box {
  background: rgba(241,196,15,0.15);
  border-left: 3px solid #f1c40f;
  padding: 10px;
  border-radius: 4px;
  font-size: 12px;
  color: #ecf0f1;
  line-height: 1.6;
}
