:root {
  --bg: #1d1a17;
  --panel: #26221e;
  --panel-2: #2e2924;
  --line: #6f5233;
  --wood: #e9d3a8;
  --wood-2: #f3e3c3;
  --ink: #2a2018;
  --red: #b3261e;
  --muted: #b7a894;
  --accent: #d9a441;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% -10%, #33291f 0%, var(--bg) 55%);
  color: #f1e6d6;
  font-family: "Noto Serif SC", "Songti SC", "SimSun", "Microsoft YaHei", system-ui, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid #3a3129;
}

.brand { display: flex; align-items: baseline; gap: 12px; }
.logo { font-size: 26px; letter-spacing: 6px; color: var(--accent); font-weight: 700; }
.sub { font-size: 13px; color: var(--muted); letter-spacing: 1px; }

.status {
  font-size: 16px;
  padding: 6px 14px;
  border: 1px solid #4a3c2c;
  border-radius: 999px;
  background: #2b251f;
  color: #f0d9b5;
  white-space: nowrap;
}
.status.check { color: #ff9d8a; border-color: #7a3329; }
.status.over { color: var(--accent); border-color: #6b5227; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  padding: 22px 28px 32px;
  max-width: 1500px;
  margin: 0 auto;
}

.board-card {
  background: linear-gradient(180deg, var(--wood-2), var(--wood));
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 0 0 1px #b98f57;
}

#board { display: block; width: 100%; height: auto; border-radius: 8px; }

.side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.card {
  background: var(--panel);
  border: 1px solid #3a3129;
  border-radius: 12px;
  padding: 14px;
}

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.buttons { margin-top: 12px; flex-wrap: wrap; }

label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
select {
  background: var(--panel-2);
  color: #f1e6d6;
  border: 1px solid #4a3c2c;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
}

button {
  background: #3a2f25;
  color: #f1e6d6;
  border: 1px solid #5a4630;
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
button:hover { background: #4a3b2c; }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: default; }

.hint { margin-top: 10px; font-size: 12.5px; color: var(--muted); min-height: 18px; }

.moves-card { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.moves-card h2 { margin: 0 0 8px; font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 2px; }
.moves { overflow: auto; max-height: 340px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 4px 8px; text-align: left; }
thead th { color: var(--muted); font-weight: 400; border-bottom: 1px solid #3a3129; position: sticky; top: 0; background: var(--panel); }
tbody td:first-child { color: #7d6c58; width: 34px; }
tbody tr:nth-child(odd) { background: rgba(255, 255, 255, 0.02); }

details { font-size: 13.5px; color: #e6d7c3; }
summary { cursor: pointer; color: var(--muted); letter-spacing: 1px; }
details ul { margin: 10px 0 0; padding-left: 18px; line-height: 1.7; }
details b { color: var(--accent); font-weight: 600; }

/* ---- 棋盘 ---- */
.line { stroke: var(--line); stroke-width: 1.6; }
.line.edge { stroke-width: 2.6; }
.river-text { fill: #9c7a4d; font-size: 26px; letter-spacing: 10px; opacity: 0.55; }
.coord { fill: #8a6a45; font-size: 12px; opacity: 0.8; }

.piece .disc {
  fill: #f7e7c6;
  stroke: #a97a44;
  stroke-width: 2;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}
.piece.red .glyph { fill: var(--red); }
.piece.black .glyph { fill: #241d16; }
.glyph { font-weight: 700; pointer-events: none; user-select: none; }

.piece.selected .disc { stroke: var(--accent); stroke-width: 4; }
.piece.check .disc { stroke: #d33; stroke-width: 4; }

.mark-dot { fill: rgba(60, 40, 20, 0.35); }
.mark-capture { fill: none; stroke: rgba(160, 40, 30, 0.8); stroke-width: 3.5; }
.mark-last { fill: none; stroke: rgba(217, 164, 65, 0.85); stroke-width: 3; stroke-dasharray: 5 4; }

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; }
  .side .card { flex: 1 1 300px; }
  .moves { max-height: 220px; }
}
