:root {
  --ch-light: #f8fafc;
  --ch-dark: #e2e8f0;
  --ch-line: rgba(15, 23, 42, 0.14);
  --ch-sel: rgba(37, 99, 235, 0.18);
  --ch-move: rgba(34, 197, 94, 0.22);
  --ch-cap: rgba(239, 68, 68, 0.20);
  --ch-hint: rgba(245, 158, 11, 0.22);
}

.chHud {
  margin: 10px 0 12px;
  border-radius: 16px;
  padding: 12px 12px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), rgba(34, 197, 94, 0.06));
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chLeft {
  display: grid;
  gap: 4px;
}

.chTopRow {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chStatus {
  font-weight: 1000;
  font-size: 14px;
  color: rgba(15, 23, 42, 0.9);
}

.chHintText {
  font-size: 12px;
  color: rgba(100, 116, 139, 0.95);
  /* 避免走子/提示文案变长导致 HUD 高度变化 → 棋盘抖动 */
  line-height: 1.45;
  min-height: calc(1.45em * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chProb {
  display: grid;
  grid-template-columns: 72px 10px auto; /* “本局胜率”居中 + 分隔符 + 值 */
  align-items: baseline;
  column-gap: 0; /* 不用空格，使用 “：” 分隔 */
  font-weight: 900;
  color: rgba(15, 23, 42, 0.72);
}

.chProbLabel {
  font-size: 14px; /* “胜率”两个字更大一点 */
  font-weight: 1000;
  letter-spacing: 0.2px;
  text-align: center;
  justify-self: center; /* 放到这个“框”的中间 */
}

.chProbSep {
  font-size: 14px;
  font-weight: 1000;
  text-align: center;
  justify-self: center;
}

.chProbVal {
  font-size: 12px;
  font-weight: 1000;
}

.chProb.isLow {
  color: rgba(239, 68, 68, 0.95); /* 红 */
}

.chProb.isMid {
  color: rgba(245, 158, 11, 0.95); /* 橙 */
}

.chProb.isHigh {
  color: rgba(34, 197, 94, 0.95); /* 绿 */
}

.chRight {
  display: grid;
  place-items: center end;
  gap: 4px;
  min-width: 140px;
}

.chDiffLabel {
  font-size: 12px;
  font-weight: 900;
  color: rgba(15, 23, 42, 0.7);
}

.chDiffGrid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 10px;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(15, 23, 42, 0.1);
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.chDiffDot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, 0.22);
  background: rgba(255, 255, 255, 0.55);
}

.chDiffDot.isDone {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(15, 23, 42, 0.92);
}
.chDiffDot.isCurrent {
  background: rgba(148, 163, 184, 0.92);
  border-color: rgba(148, 163, 184, 0.92);
}

.chBoard {
  width: min(520px, 100%);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 3px solid var(--ch-line);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.chCell {
  appearance: none;
  border: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  display: grid;
  place-items: center;
  font-size: clamp(22px, 5.4vw, 44px);
  font-weight: 900;
  line-height: 1;
  position: relative;
  /* 去掉 background 过渡，避免我方落子时棋盘“闪一下” */
  transition: transform 90ms ease, filter 120ms ease;
}

.chCell.pieceW {
  /* 白棋：更有“立体感”的高光+投影 */
  color: rgba(248, 250, 252, 0.98);
  /* 深色描边，避免在浅色格子上“发白看不清” */
  text-shadow:
    -1px -1px 0 rgba(2, 6, 23, 0.55),
    1px -1px 0 rgba(2, 6, 23, 0.55),
    -1px 1px 0 rgba(2, 6, 23, 0.55),
    1px 1px 0 rgba(2, 6, 23, 0.55),
    0 6px 14px rgba(2, 6, 23, 0.30);
  filter: drop-shadow(0 6px 12px rgba(2, 6, 23, 0.24));
}

.chCell.pieceB {
  /* 黑棋：带轻微高光边与阴影 */
  color: rgba(15, 23, 42, 0.96);
  text-shadow:
    0 -1px 0 rgba(255, 255, 255, 0.22),
    0 2px 0 rgba(2, 6, 23, 0.35),
    0 8px 16px rgba(2, 6, 23, 0.28);
  filter: drop-shadow(0 7px 12px rgba(2, 6, 23, 0.22));
}

.chCell.light {
  background: var(--ch-light);
}
.chCell.dark {
  background: var(--ch-dark);
}

.chCell:active {
  transform: scale(0.985);
}

.chCell.sel {
  background: var(--ch-sel);
}

.chCell.move::after,
.chCell.capture::after,
.chCell.hintFrom::after,
.chCell.hintTo::after,
.chCell.lastFrom::after,
.chCell.lastTo::after {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: 999px;
  background: transparent;
}
.chCell.move::after {
  background: var(--ch-move);
}
.chCell.capture::after {
  background: var(--ch-cap);
}
.chCell.hintFrom::after,
.chCell.hintTo::after {
  background: var(--ch-hint);
}
.chCell.hintTo::after {
  inset: 10%;
  border: 2px solid rgba(245, 158, 11, 0.65);
  background: transparent;
}

/* 王被将军：红圈闪烁提示 */
.chCell.inCheck::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 18px;
  border: 3px solid rgba(239, 68, 68, 0.95);
  box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.12);
  animation: checkPulse 900ms ease-in-out infinite;
  pointer-events: none;
}
@keyframes checkPulse {
  0% {
    opacity: 0.35;
    transform: scale(0.98);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0.35;
    transform: scale(0.98);
  }
}

/* AI 最近一步：蓝色高亮（短暂） */
.chCell.lastFrom::after,
.chCell.lastTo::after {
  background: rgba(59, 130, 246, 0.18);
}
.chCell.lastTo::after {
  inset: 10%;
  border: 2px solid rgba(59, 130, 246, 0.55);
  background: transparent;
}

.promoRow {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.promoBtn {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  padding: 10px 0;
  font-size: 20px;
  font-weight: 1000;
  cursor: pointer;
  touch-action: manipulation;
}

@media (max-width: 420px) {
  .chHud {
    padding: 8px 10px;
    border-radius: 14px;
  }
  .chDiffGrid {
    grid-auto-columns: 9px;
    gap: 3px;
    padding: 3px 5px;
  }
  .chDiffDot {
    width: 9px;
    height: 9px;
  }
  .chBoard {
    border-radius: 16px;
    height: min(380px, 86vw);
  }
}
