﻿/* 基础样式 */
body {
  font-family: sans-serif;
  background: #f7f7f7;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
h1 {
  margin-top: 20px;
}
.screen {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.screen.hidden {
  display: none;
}
.hidden {
  display: none;
}
.menu-group {
  width: min(920px, 96%);
  margin: 8px 0;
  text-align: center;
}
.menu-layout {
  width: min(980px, 96%);
  margin: 8px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}
.menu-section {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 12px;
  background: #fff;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.menu-section-title {
  font-size: 18px;
  font-weight: 700;
  color: #222;
}
.menu-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.menu-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}
.menu-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.menu-options.special-board-buttons {
  width: min(640px, 100%);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  gap: 8px;
  justify-items: center;
}
.menu-options.special-board-buttons .option-button {
  min-width: 56px;
}
.menu-options.hidden {
  display: none;
}
.custom-size {
  margin-top: 6px;
  gap: 12px;
}
.custom-input {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px dashed #888;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
}
.custom-input input {
  width: 80px;
  font-size: 14px;
  padding: 2px 4px;
}
.option {
  cursor: pointer;
  user-select: none;
}
.option input {
  display: none;
}
.option span {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid #666;
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
}
.option input:checked + span {
  background: #222;
  color: #fff;
  border-color: #222;
}
.option-button {
  padding: 6px 12px;
  border: 1px solid #666;
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}
.option-button.selected {
  background: #222;
  color: #fff;
  border-color: #222;
}
.option-button:active {
  transform: translateY(1px);
}
.controls {
  margin: 10px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.menu-actions {
  margin: 12px 0 20px;
  display: flex;
  justify-content: center;
}
.game-header {
  margin: 12px 0 4px;
}
.controls button,
.menu-actions button {
  margin-right: 0;
  padding: 6px 12px;
  font-size: 16px;
  cursor: pointer;
}
.controls label {
  font-size: 14px;
}
.controls input,
.controls select {
  font-size: 14px;
  padding: 4px 6px;
  margin-left: 4px;
}
.status {
  margin: 8px 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

/* 棋盘样式 */
#board,
#editorBoard {
  display: grid;
  position: relative;
  border: 2px solid #333;
  background: #ffe5b4;
}
.cell {
  width: 60px;
  height: 60px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
/* 绘制网格线 */
.cell::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-top: 1px solid #333;
  border-right: 1px solid #333;
}
/* 左边界添加左边线 */
.cell.left-edge::before {
  border-left: 1px solid #333;
}
/* 上边界添加上边线 */
.cell.top-edge::before {
  border-top: 1px solid #333;
}
/* 下边界添加下边线 */
.cell.bottom-edge::before {
  border-bottom: 1px solid #333;
}
/* 右边界添加右边线 */
.cell.right-edge::before {
  border-right: 1px solid #333;
}
/* 宫区提示 */
.cell.palace-red {
  background-color: rgba(255, 120, 120, 0.25);
}
.cell.palace-black {
  background-color: rgba(120, 120, 120, 0.2);
}
.cell.palace-overlap {
  background-color: rgba(255, 200, 120, 0.35);
}
.cell.palace-cell {
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4);
}
/* 高亮可走位置 */
.cell.highlight {
  background-color: rgba(0, 255, 0, 0.3);
}
.cell.last-move-from {
  background-color: rgba(255, 215, 0, 0.18);
}
.cell.last-move-to {
  background-color: rgba(255, 215, 0, 0.35);
}
/* 选中棋子 */
.selected-piece {
  outline: 2px solid #f00;
  border-radius: 50%;
}
.river-overlay {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.45);
}
.piece {
  font-size: 32px;
  user-select: none;
}
.piece.red {
  color: #d30000;
}
.piece.black {
  color: #000;
}
.piece.block {
  width: 100%;
  height: 100%;
  background: #111;
}
.dialog {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  z-index: 10;
}
.dialog.hidden {
  display: none;
}
.dialog-content {
  background: #fff;
  padding: 20px 24px;
  border-radius: 6px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  text-align: center;
  min-width: 180px;
}
.dialog-content button {
  margin-top: 12px;
  padding: 6px 12px;
  font-size: 16px;
  cursor: pointer;
}

/* 编辑器样式 */
.editor-settings {
  width: min(1100px, 96%);
  margin-top: 8px;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fff;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.editor-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
}
.editor-field label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.editor-field input {
  width: 80px;
  padding: 4px 6px;
  font-size: 14px;
}
.editor-actions {
  display: flex;
  justify-content: flex-end;
}
.editor-actions button {
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
}.palace-settings {
  justify-content: space-between;
  gap: 16px;
}
.palace-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #bbb;
}
.palace-group.palace-black {
  background: rgba(80, 80, 80, 0.12);
}
.palace-group.palace-red {
  background: rgba(255, 120, 120, 0.18);
}
.palace-title {
  font-weight: 600;
  margin-right: 6px;
}
.editor-area {
  width: min(1200px, 96%);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  margin: 16px 0 20px;
}
.editor-palette {
  width: 150px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 12px;
  background: #fff;
  box-sizing: border-box;
}
.palette-title {
  text-align: center;
  font-weight: 600;
  margin-bottom: 8px;
}
.palette-items {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.palette-piece {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #666;
  border-radius: 8px;
  background: #fff;
  cursor: grab;
  font-size: 24px;
  user-select: none;
}
.palette-piece.red {
  color: #d30000;
}
.palette-piece.black {
  color: #000;
}
.palette-piece.empty {
  color: #666;
  border-style: dashed;
  background: #f2f2f2;
  font-size: 16px;
}
.palette-piece.block {
  background: #111;
  border-color: #111;
}
.editor-board-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  overflow: auto;
}
.load-dialog {
  min-width: 240px;
}
.load-title {
  font-weight: 600;
  margin-bottom: 8px;
}
.load-dialog select {
  width: 100%;
  padding: 6px 8px;
  font-size: 14px;
}
.load-actions {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

