/* ==========================================================================
   军棋翻翻棋 · 页面样式
   ========================================================================== */

.game-shell { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
  align-items: start;
}

.board-zone { min-width: 0; }

.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 18px;
  margin-bottom: 14px;
  font-size: 14.5px;
  min-height: 50px;
}

.turn-dot {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.turn-dot.red { background: radial-gradient(circle at 35% 32%, #e0604d, #8c2317 75%); }
.turn-dot.blue { background: radial-gradient(circle at 35% 32%, #7db4f5, #2c5282 75%); }
.turn-dot.unknown { background: linear-gradient(135deg, #e0604d 50%, #7db4f5 50%); }

.status-text { color: var(--text); font-weight: 600; }

.thinking {
  display: none; align-items: center; gap: 7px; margin-left: auto;
  color: var(--accent); font-size: 13px; font-weight: 600;
}

.thinking.show { display: inline-flex; }

.thinking i {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(245, 176, 74, 0.25); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.board-wrap { display: flex; justify-content: center; }

.junqi-board {
  --cw: 78px;
  display: grid;
  grid-template-columns: repeat(4, var(--cw));
  grid-template-rows: repeat(8, calc(var(--cw) * 0.62));
  gap: 5px;
  background: linear-gradient(160deg, #3a4258, #242b3d);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow-card);
  user-select: none;
  -webkit-user-select: none;
}

.jcell {
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  font-family: "STKaiti", "KaiTi", "BiauKai", serif;
  transition: transform 0.08s, background 0.15s, box-shadow 0.15s;
}

.jcell.hidden {
  background: linear-gradient(160deg, #4a5468, #333c4f);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.25);
  font-size: calc(var(--cw) * 0.3);
}

.jcell.hidden:hover { background: linear-gradient(160deg, #556179, #3d4759); }

.jcell.hidden::after { content: '❓'; }

.jcell.empty { background: rgba(255, 255, 255, 0.03); cursor: default; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05); }

.jcell.red {
  background: linear-gradient(160deg, #e0604d, #a02a1e);
  color: #fff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), inset 0 0 0 1.5px rgba(0, 0, 0, 0.2);
  font-size: calc(var(--cw) * 0.3);
}

.jcell.blue {
  background: linear-gradient(160deg, #5d92d6, #2c5282);
  color: #fff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), inset 0 0 0 1.5px rgba(0, 0, 0, 0.2);
  font-size: calc(var(--cw) * 0.3);
}

.jcell.sel { box-shadow: 0 0 0 2.5px var(--accent), 0 2px 0 rgba(0, 0, 0, 0.35); }

.jcell.target { background: rgba(245, 176, 74, 0.3); box-shadow: inset 0 0 0 2px rgba(245, 176, 74, 0.8); }

.jcell.die { animation: dieFlash 0.5s ease-out; }

@keyframes dieFlash {
  0% { filter: brightness(2.2); }
  100% { filter: brightness(1); }
}

/* AI 普通移动：轻量波纹，与交战的 die 闪现区分 */
.jcell.ai-step { animation: aiStep 0.65s ease-out; }

@keyframes aiStep {
  0% { box-shadow: 0 0 0 0 rgba(245, 176, 74, 0.7), 0 2px 0 rgba(0, 0, 0, 0.35); }
  100% { box-shadow: 0 0 0 9px rgba(245, 176, 74, 0), 0 2px 0 rgba(0, 0, 0, 0.35); }
}

.side-box {
  text-align: center;
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 16px;
  font-weight: 800;
  color: var(--text-dim);
}

.side-box.red { color: #f58e7d; }
.side-box.blue { color: #7db4f5; }

.panel { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 84px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card.grow { flex: 1; }

.card-title { font-size: 14px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-dim); margin-bottom: 16px; }

.field-note { font-size: 12px; color: var(--text-faint); margin-top: 8px; line-height: 1.6; }

.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.move-list {
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
}

.move-list li {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--text-dim);
}

.move-list li:last-child { background: rgba(245, 176, 74, 0.1); color: var(--text); }

.move-list li .no { color: var(--text-faint); min-width: 26px; font-size: 12px; font-variant-numeric: tabular-nums; }

.move-list li b.red { color: #f58e7d; }
.move-list li b.blue { color: #7db4f5; }

.move-list .empty-note { text-align: center; color: var(--text-faint); padding: 16px 0; width: 100%; }

.overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(6, 8, 12, 0.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity 0.25s;
}

.overlay.show { opacity: 1; pointer-events: auto; }

.dialog {
  width: min(420px, calc(100vw - 40px));
  background: linear-gradient(165deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border-strong); border-radius: 22px; padding: 36px 32px 30px;
  text-align: center; box-shadow: 0 40px 90px -20px rgba(0, 0, 0, 0.8);
  transform: translateY(14px) scale(0.96); transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.3, 1.2);
}

.overlay.show .dialog { transform: translateY(0) scale(1); }

.dialog-icon { font-size: 52px; line-height: 1; margin-bottom: 14px; }
.dialog h2 { font-size: 24px; font-weight: 800; }
.dialog > p { color: var(--text-dim); font-size: 14.5px; margin-top: 8px; }
.dialog-btns { display: flex; gap: 12px; margin-top: 26px; justify-content: center; }

.rules-body { text-align: left; margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.rules-body p { font-size: 13.5px; color: var(--text-dim); line-height: 1.7; }
.rules-body b { color: var(--text); }

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px);
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text);
  font-size: 14px; font-weight: 600; padding: 11px 22px; border-radius: 999px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s; z-index: 400;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 960px) {
  .game-layout { grid-template-columns: 1fr; }
  .panel { position: static; }
  .game-shell { padding: 20px 14px 48px; }
  .junqi-board { --cw: min(21vw, 78px); }
}
