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

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "KaiTi", "STKaiti", serif;
  background: #0e1020;
  color: #e8eaf2;
  display: flex;
  justify-content: center;
  padding: 18px 12px 28px;
}

.game-wrap { width: 100%; max-width: 460px; }

.top-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.back { color: #aab0d0; text-decoration: none; font-size: 13px; }
.top-bar h1 {
  font-size: 26px; font-weight: 800;
  background: linear-gradient(90deg, #ffd27a, #ff8a5c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.side-tag { font-size: 12px; color: #c7cbe6; }
.side-tag b { color: #ff6b6b; }

.status {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  padding: 8px 0;
  margin-bottom: 8px;
  color: #ffd27a;
  letter-spacing: 1px;
  min-height: 20px;
}
.status.check { color: #ff5b5b; }

.board {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  border-radius: 10px;
  padding: 0;
  background:
    repeating-linear-gradient(90deg, rgba(120,70,20,0.05) 0 6px, rgba(120,70,20,0) 6px 14px),
    linear-gradient(160deg, #e9bd7c, #d99c4e 55%, #cf923f);
  box-shadow: 0 10px 30px rgba(0,0,0,0.45), inset 0 0 0 4px #6b3f17, inset 0 0 0 10px #8a5a25;
  touch-action: manipulation;
  user-select: none;
  cursor: pointer;
}

.lines { position: absolute; inset: 0; pointer-events: none; }
.lines line, .lines path { stroke: #5b3a17; stroke-width: 1.6; stroke-linecap: round; }
.lines .river { fill: rgba(91,58,23,0.55); font-size: 22px; font-weight: 700; letter-spacing: 4px; text-anchor: middle; }

.piece {
  position: absolute;
  transform: translate(-50%, -50%);
  width: var(--pd);
  height: var(--pd);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--pd) * 0.52);
  font-weight: 800;
  border: 2px solid rgba(0,0,0,0.35);
  box-shadow: 0 3px 5px rgba(0,0,0,0.4), inset 0 2px 4px rgba(255,255,255,0.35), inset 0 -3px 6px rgba(0,0,0,0.35);
  z-index: 2;
}
.piece.r {
  color: #7a0d12;
  background: radial-gradient(circle at 35% 30%, #ff8a8a, #e23b3b 55%, #b3161b);
  border-color: #7a0d12;
}
.piece.b {
  color: #0c0c12;
  background: radial-gradient(circle at 35% 30%, #5b5b66, #26262e 55%, #0c0c12);
  border-color: #05050a;
}
.piece.selected {
  box-shadow: 0 0 0 3px #ffd54a, 0 3px 8px rgba(0,0,0,0.5), inset 0 2px 4px rgba(255,255,255,0.35);
  z-index: 3;
}

.dot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: calc(var(--pd) * 0.32);
  height: calc(var(--pd) * 0.32);
  border-radius: 50%;
  background: rgba(20,20,30,0.32);
  z-index: 1;
}
.dot.cap {
  width: var(--pd); height: var(--pd);
  background: transparent;
  border: 3px solid rgba(255,80,80,0.7);
}

.controls { display: flex; gap: 12px; justify-content: center; margin-top: 14px; }
.btn {
  background: #1b1e38;
  color: #e8eaf2;
  border: 1px solid rgba(255,255,255,0.12);
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn:hover { background: #23274a; }
.btn.primary {
  background: linear-gradient(90deg, #ffb347, #ff7e5f);
  color: #2a1500; border: none;
}
.btn.primary:hover { filter: brightness(1.05); }

.hint { color: #9aa0c0; font-size: 12px; text-align: center; margin-top: 12px; line-height: 1.6; }
