/* Xiangqi board. One grid unit (--u) is set by app.js to fit the screen. */
.game { display: flex; flex-direction: column; align-items: center; }
.game h1 { text-align: center; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; margin: 4px 0 14px; }
.controls label { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 6px; }

#status { min-height: 22px; margin: 0 0 12px; color: var(--accent); font-weight: 600; text-align: center; }

#boardWrap {
  --u: 40px;
  --wood: #e8c88a; --grain: #6b4a2b;
  background: var(--wood);
  padding: calc(var(--u) * 0.6);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  touch-action: manipulation;
}
#board { position: relative; width: calc(var(--u) * 8); height: calc(var(--u) * 9); }

.grid { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.grid line, .grid polyline { stroke: var(--grain); stroke-width: 1.5px; fill: none; }

.river {
  position: absolute; left: 0; right: 0; top: calc(var(--u) * 4); height: var(--u);
  display: flex; align-items: center; justify-content: space-around;
  font-family: "KaiTi", "STKaiti", "Songti SC", "Noto Serif CJK SC", serif;
  font-size: calc(var(--u) * 0.42); font-weight: 700; color: #3a2a18; letter-spacing: 0.3em;
  pointer-events: none;
}

.cell {
  position: absolute; width: var(--u); height: var(--u);
  transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cell:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: 50%; }

.piece {
  position: relative; z-index: 1;
  width: calc(var(--u) * 0.8); height: calc(var(--u) * 0.8);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--u) * 0.44); font-weight: 700; line-height: 1;
  font-family: "KaiTi", "STKaiti", "Songti SC", "Noto Serif CJK SC", serif;
  background: #f3e2bb; border: 2px solid #7a5a33;
  box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.35);
}
.piece.red { color: #b8272c; }
.piece.black { color: #1a1a1a; }

.selected .piece { box-shadow: 0 0 0 3px #f6c144, 1px 2px 3px rgba(0, 0, 0, 0.35); }
.in-check .piece { box-shadow: 0 0 0 3px #d64545, 1px 2px 3px rgba(0, 0, 0, 0.35); }
.last-move::before {
  content: ""; position: absolute; width: 88%; height: 88%; border-radius: 8px;
  background: rgba(90, 180, 255, 0.3); pointer-events: none;
}
.dot::after {
  content: ""; position: absolute; width: 26%; height: 26%; border-radius: 50%;
  background: rgba(60, 40, 20, 0.45);
}
.cap::after {
  content: ""; position: absolute; z-index: 2; width: 86%; height: 86%; border-radius: 50%;
  border: 3px solid rgba(60, 40, 20, 0.5); box-sizing: border-box;
}

#history { margin-top: 14px; max-width: 520px; font-size: 13px; color: var(--muted); text-align: center; line-height: 1.7; }
.how { max-width: 560px; margin-top: 22px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.how summary { cursor: pointer; color: var(--ink); font-weight: 600; }
.how ul { padding-left: 20px; }
