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

.xqHud {
  margin: 10px 0 12px;
  border-radius: 16px;
  padding: 12px 12px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.06), rgba(37, 99, 235, 0.05));
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

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

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

.xqProb {
  display: grid;
  grid-template-columns: 72px 10px auto;
  align-items: baseline;
  column-gap: 0;
  font-weight: 900;
  color: rgba(15, 23, 42, 0.72);
}

.xqProbLabel {
  font-size: 14px;
  font-weight: 1000;
  letter-spacing: 0.2px;
  text-align: center;
}

.xqProbSep {
  font-size: 14px;
  font-weight: 1000;
  text-align: center;
}

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

.xqProb.isLow {
  color: rgba(239, 68, 68, 0.95);
}
.xqProb.isMid {
  color: rgba(245, 158, 11, 0.95);
}
.xqProb.isHigh {
  color: rgba(34, 197, 94, 0.95);
}

.xqHint {
  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;
}

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

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

.xqDiffGrid {
  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);
  user-select: none;
  touch-action: manipulation;
}

.xqDiffDot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, 0.22);
  background: rgba(255, 255, 255, 0.55);
}
.xqDiffDot.isDone {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(15, 23, 42, 0.92);
}
.xqDiffDot.isCurrent {
  background: rgba(148, 163, 184, 0.92);
  border-color: rgba(148, 163, 184, 0.92);
}

.xqBoard {
  /* 交叉点坐标系（棋子落在线上） */
  --cols: 9;
  --rows: 10;
  --stone: clamp(26px, 7.2vw, 44px);
  --pad: calc(var(--stone) / 2 + 8px);

  width: min(560px, 100%);
  aspect-ratio: 9 / 10;
  margin: 0 auto;
  border: 3px solid var(--xq-line);
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.96));
  box-shadow: var(--shadow-soft);
  position: relative;
}

.xqCanvas {
  position: absolute;
  inset: var(--pad);
  border-radius: 12px;
  pointer-events: none;
  overflow: hidden;
}

.xqSvg {
  width: 100%;
  height: 100%;
  display: block;
}

.xqPoints {
  position: absolute;
  inset: 0;
}

.xqPoint {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  width: var(--stone);
  height: var(--stone);
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.xqPoint.sel {
  background: var(--xq-sel);
  border-radius: 999px;
}

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

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

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

.xqPiece {
  width: calc(var(--stone) * 0.96);
  height: calc(var(--stone) * 0.96);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid rgba(15, 23, 42, 0.18);
  box-shadow: 0 10px 22px rgba(2, 6, 23, 0.10);
  display: grid;
  place-items: center;
  font-size: clamp(14px, 2.8vw, 22px);
  font-weight: 1000;
  line-height: 1;
}

.xqPiece.red {
  color: rgba(239, 68, 68, 0.95);
  border-color: rgba(239, 68, 68, 0.40);
}
.xqPiece.black {
  color: rgba(15, 23, 42, 0.85);
  border-color: rgba(15, 23, 42, 0.30);
}

@media (max-width: 420px) {
  .xqHud {
    padding: 8px 10px;
    border-radius: 14px;
  }
  .xqBoard {
    border-radius: 16px;
  }
}
