*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100vh; overflow: hidden; }
body {
  display: flex; justify-content: center; align-items: center;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ========== 棋盘容器 ========== */
.box { margin: 0 auto; position: relative; }
.chess_left { text-align: center; }

/* ========== 控制面板 ========== */
.controls-panel {
  margin-top: 10px;
  padding: 12px 10px;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 7px;
  justify-content: center;
  flex-wrap: wrap;
}

.control-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.8px;
  white-space: nowrap;
  font-weight: 600;
}

/* ========== 按钮基础 ========== */
.btn {
  appearance: none;
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.12s, box-shadow 0.15s;
  font-family: inherit;
  min-width: 48px;
  min-height: 38px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  letter-spacing: 0.3px;
}
.btn:active { transform: scale(0.95); }

/* 常规按钮 */
.btn-default {
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.btn-default:hover, .btn-default:active {
  background: rgba(255, 255, 255, 0.17);
  color: #fff;
}

/* 难度按钮 - 暖棕木纹色 */
.btn-difficulty {
  background: rgba(212, 165, 116, 0.14);
  color: rgba(240, 217, 181, 0.8);
  border: 1.5px solid rgba(212, 165, 116, 0.25);
  min-width: 56px;
}
.btn-difficulty:hover {
  background: rgba(212, 165, 116, 0.24);
  color: #f0d9b5;
}
.btn-difficulty.active {
  background: rgba(212, 165, 116, 0.48);
  color: #fff;
  border-color: rgba(212, 165, 116, 0.6);
  box-shadow: 0 0 16px rgba(212, 165, 116, 0.28);
}

/* 辅助按钮 */
.btn-action {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 12px;
  padding: 7px 18px;
}
.btn-action:hover, .btn-action:active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

/* ========== 棋局选择器 ========== */
.select-board {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.10) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.5)'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 8px 32px 8px 12px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  min-width: 130px;
  transition: background 0.15s, border-color 0.15s;
}
.select-board:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}
.select-board:focus {
  outline: none;
  border-color: rgba(212, 165, 116, 0.5);
  box-shadow: 0 0 0 2px rgba(212, 165, 116, 0.15);
}
.select-board option {
  background: #2a2a36;
  color: #ddd;
}

/* ========== 模态框 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: rgba(28, 28, 40, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 26px 22px 22px;
  max-width: 340px;
  width: 88%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: modalIn 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.92) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #f0d9b5;
  margin-bottom: 8px;
}

.modal-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.7;
  text-align: left;
  margin: 0 auto;
  max-width: 280px;
}

.modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* 游戏说明内的段落 */
.modal-text p {
  margin-bottom: 6px;
}

/* ========== 走棋信息栏 ========== */
.move-info-bar {
  margin-top: 8px;
  padding: 5px 14px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  min-height: 26px;
  text-align: center;
  line-height: 1.5;
  font-family: inherit;
  letter-spacing: 0.2px;
}

/* ========== 页脚 ========== */
.footer-credit {
  margin-top: 8px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.25);
  text-align: center;
  padding-bottom: 4px;
}
.footer-credit a {
  color: rgba(255, 255, 255, 0.35);
  text-decoration: none;
}
.footer-credit a:hover { color: rgba(255, 255, 255, 0.55); }

/* ========== 隐藏旧元素 ========== */
.btn_box { display: none !important; }
.move_info, .proj_info, #proj_info_src, .b, #moveInfoOld, .chess_right, .bill_box { display: none !important; }

/* ========== 响应式 — 窄屏 ========== */
@media (max-width: 500px) {
  .controls-panel { margin-top: 6px; padding: 8px 5px; gap: 4px; border-radius: 12px; }
  .control-row { gap: 3px; flex-wrap: nowrap; }
  .btn { padding: 5px 6px; font-size: 11px; min-height: 30px; min-width: 0; }
  .btn-difficulty { min-width: 0; }
  .select-board { font-size: 11px; padding: 5px 22px 5px 7px; min-width: 80px; background-size: 8px 5px; }
  .modal-card { padding: 22px 16px 18px; }
  .modal-title { font-size: 15px; }
  .modal-text { font-size: 12px; }
}
