/* Checkers（美国/英国跳棋）前端样式 — 沿用 reversi / connect-four 深色玻璃 + 蓝金霓虹风 */

:root {
  --ck-bg: #0f172a;
  --ck-blue: #3b82f6;
  --ck-gold: #f59e0b;
  --ck-text: #f8fafc;
  --ck-muted: #94a3b8;
  --ck-glass: rgba(15, 23, 42, 0.65);
  --ck-glass-light: rgba(255, 255, 255, 0.05);
  --ck-border: rgba(148, 163, 184, 0.2);
  --ck-red: #dc2626;
  --ck-red-light: #fca5a5;
  --ck-black: #0f172a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: var(--ck-text);
  min-height: 100vh;
  overflow-x: hidden;
}

.ck-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: radial-gradient(circle at 20% 20%, rgba(220, 38, 38, 0.07) 0%, transparent 50%),
              radial-gradient(circle at 80% 80%, rgba(245, 158, 11, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 20px 40px;
  position: relative;
  z-index: 1;
}

.ck-back-wrap { padding: 16px 20px; }
.ck-back {
  color: var(--ck-blue);
  text-decoration: none;
  font-size: 14px;
  letter-spacing: 0.5px;
  transition: color 0.2s;
}
.ck-back:hover { color: var(--ck-gold); }

.ck-head { text-align: center; margin-bottom: 24px; }
.ck-head h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--ck-red), var(--ck-gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}
.ck-head .sub {
  color: var(--ck-muted);
  font-size: 13px;
  letter-spacing: 0.5px;
  margin-top: 6px;
}

/* ===== 先手选择 ===== */
.ck-side-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 28px;
}
.ck-side-btn {
  padding: 10px 24px;
  border-radius: 999px;
  border: 1px solid var(--ck-border);
  background: var(--ck-glass);
  color: var(--ck-red-light);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s;
}
.ck-side-btn.active {
  background: var(--ck-red);
  color: #fff;
  box-shadow: 0 0 20px rgba(220, 38, 38, 0.4);
  border-color: var(--ck-red);
}
.ck-side-btn.gold { color: var(--ck-gold); }
.ck-side-btn.gold.active {
  background: var(--ck-gold);
  color: #0f172a;
  border-color: var(--ck-gold);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

/* ===== 游戏区 ===== */
.ck-game {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 768px) {
  .ck-game { grid-template-columns: 1fr; }
}

/* ===== 棋盘 ===== */
.ck-board-wrap {
  background: var(--ck-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--ck-border);
  border-radius: 16px;
  padding: 18px;
  position: relative;
  transition: box-shadow 0.4s;
}
.ck-board-wrap.thinking { box-shadow: 0 0 40px rgba(59, 130, 246, 0.3); }
.ck-board-wrap.stage-win { box-shadow: 0 0 40px rgba(34, 197, 94, 0.4); }
.ck-board-wrap.stage-lose { box-shadow: 0 0 40px rgba(239, 68, 68, 0.4); }
.ck-board-wrap.stage-draw { box-shadow: 0 0 40px rgba(245, 158, 11, 0.4); }

.ck-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0;
  background: rgba(0, 0, 0, 0.45);
  padding: 6px;
  border-radius: 10px;
  aspect-ratio: 1;
  border: 2px solid rgba(148, 163, 184, 0.25);
}
.ck-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: default;
}
.ck-cell-light { background: rgba(255, 255, 255, 0.045); }
.ck-cell-dark { background: rgba(0, 0, 0, 0.32); }
.ck-cell-last::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.14);
  pointer-events: none;
}
.ck-cell-selectable { cursor: pointer; }
.ck-cell-selectable:hover .ck-piece { box-shadow: 0 0 12px rgba(59, 130, 246, 0.55); }
.ck-cell-selected::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 2px solid var(--ck-blue);
  border-radius: 8px;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.65);
  pointer-events: none;
  z-index: 2;
}
.ck-cell-target { cursor: pointer; }
.ck-cell-target::after {
  content: '';
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.45);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
  animation: ck-pulse 1.1s ease-in-out infinite;
}
.ck-cell-jump-target { cursor: pointer; }
.ck-cell-jump-target::after {
  content: '';
  position: absolute;
  width: 72%;
  height: 72%;
  border-radius: 50%;
  border: 3px solid rgba(245, 158, 11, 0.85);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.65);
  animation: ck-pulse 0.9s ease-in-out infinite;
}
@keyframes ck-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* ===== 棋子 ===== */
.ck-piece {
  width: 76%;
  height: 76%;
  border-radius: 50%;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.35);
  animation: ck-drop 0.22s ease-out;
}
.ck-piece-red {
  background: radial-gradient(circle at 32% 28%, #f87171, var(--ck-red) 60%, #7f1d1d);
  border: 1px solid #ef4444;
}
.ck-piece-black {
  background: radial-gradient(circle at 32% 28%, #475569, var(--ck-black) 60%, #000);
  border: 1px solid #334155;
}
.ck-piece.king::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(245, 158, 11, 0.85);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.7);
  pointer-events: none;
}
.ck-crown {
  width: 62%;
  height: 62%;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.9));
}
.ck-piece.just-moved { animation: ck-drop 0.22s ease-out, ck-move-glow 0.45s ease-out; }
.ck-piece.promoted { animation: ck-drop 0.3s ease-out, ck-promo-glow 0.9s ease-out; }
.ck-piece.captured { animation: ck-cap-pop 0.25s ease-in forwards; }
@keyframes ck-drop {
  0% { transform: scale(0.35); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes ck-move-glow {
  0% { box-shadow: 0 0 0 rgba(59, 130, 246, 0), inset 0 0 8px rgba(0,0,0,0.45); }
  50% { box-shadow: 0 0 16px rgba(59, 130, 246, 0.8), inset 0 0 8px rgba(0,0,0,0.45); }
  100% { box-shadow: inset 0 0 8px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.35); }
}
@keyframes ck-promo-glow {
  0% { box-shadow: 0 0 0 rgba(245, 158, 11, 0), inset 0 0 8px rgba(0,0,0,0.45); }
  40% { box-shadow: 0 0 22px rgba(245, 158, 11, 0.95), inset 0 0 8px rgba(0,0,0,0.45); }
  100% { box-shadow: inset 0 0 8px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.35); }
}
@keyframes ck-cap-pop {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.1); opacity: 0; }
}

.ck-status {
  text-align: center;
  font-size: 13px;
  color: var(--ck-muted);
  padding-top: 12px;
  letter-spacing: 0.5px;
  min-height: 20px;
}

/* ===== 侧边面板 ===== */
.ck-panel { display: flex; flex-direction: column; gap: 12px; }
.ck-score { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ck-score-card {
  background: var(--ck-glass);
  border: 1px solid var(--ck-border);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}
.ck-score-card .l { font-size: 11px; color: var(--ck-muted); letter-spacing: 1px; }
.ck-score-card .v { font-size: 26px; font-weight: 800; margin-top: 4px; }
.ck-score-card .v small { font-size: 12px; color: var(--ck-gold); margin-left: 3px; font-weight: 600; }
.ck-score-card.is-red { border-color: rgba(220, 38, 38, 0.35); }
.ck-score-card.is-red .v { color: var(--ck-red-light); }
.ck-score-card.is-black .v { color: #cbd5e1; }

.ck-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ck-stat-card {
  background: var(--ck-glass);
  border: 1px solid var(--ck-border);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}
.ck-stat-card .l { font-size: 11px; color: var(--ck-muted); letter-spacing: 1px; }
.ck-stat-card .v { font-size: 22px; font-weight: 700; margin-top: 4px; }
.ck-stat-card.is-time .v { font-family: 'Courier New', monospace; }
.ck-stat-card small { font-size: 12px; font-weight: 400; color: var(--ck-muted); margin-left: 4px; }

.ck-draw-card {
  background: var(--ck-glass);
  border: 1px solid var(--ck-border);
  border-radius: 12px;
  padding: 10px 12px;
}
.ck-draw-row { display: flex; justify-content: space-between; align-items: center; }
.ck-draw-row .l { font-size: 11px; color: var(--ck-muted); letter-spacing: 1px; }
.ck-draw-row .v { font-size: 18px; font-weight: 700; font-family: 'Courier New', monospace; }
.ck-draw-bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.08); margin-top: 8px; overflow: hidden; }
.ck-draw-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--ck-blue), var(--ck-gold)); transition: width 0.3s; }
.ck-draw-fill.ck-w5 { width: 5%; } .ck-draw-fill.ck-w10 { width: 10%; }
.ck-draw-fill.ck-w15 { width: 15%; } .ck-draw-fill.ck-w20 { width: 20%; }
.ck-draw-fill.ck-w25 { width: 25%; } .ck-draw-fill.ck-w30 { width: 30%; }
.ck-draw-fill.ck-w35 { width: 35%; } .ck-draw-fill.ck-w40 { width: 40%; }
.ck-draw-fill.ck-w45 { width: 45%; } .ck-draw-fill.ck-w50 { width: 50%; }
.ck-draw-fill.ck-w55 { width: 55%; } .ck-draw-fill.ck-w60 { width: 60%; }
.ck-draw-fill.ck-w65 { width: 65%; } .ck-draw-fill.ck-w70 { width: 70%; }
.ck-draw-fill.ck-w75 { width: 75%; } .ck-draw-fill.ck-w80 { width: 80%; }
.ck-draw-fill.ck-w85 { width: 85%; } .ck-draw-fill.ck-w90 { width: 90%; }
.ck-draw-fill.ck-w95 { width: 95%; } .ck-draw-fill.ck-w100 { width: 100%; }
.ck-draw-warn { display: none; margin-top: 6px; font-size: 11px; color: var(--ck-gold); letter-spacing: 0.5px; }
.ck-draw-card.warn .ck-draw-warn { display: block; }
.ck-draw-card.warn { border-color: rgba(245, 158, 11, 0.5); box-shadow: 0 0 14px rgba(245, 158, 11, 0.18); }

.ck-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ck-btn {
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--ck-border);
  background: var(--ck-glass);
  color: var(--ck-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s;
}
.ck-btn:hover:not(:disabled) { background: rgba(59, 130, 246, 0.2); border-color: var(--ck-blue); }
.ck-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ck-btn.primary { background: linear-gradient(135deg, var(--ck-blue), #6366f1); border-color: var(--ck-blue); }
.ck-btn.gold { color: var(--ck-gold); grid-column: 1 / -1; display: none; }
.ck-btn.gold.show { display: block; }
.ck-btn.gold:hover:not(:disabled) { background: rgba(245, 158, 11, 0.18); border-color: var(--ck-gold); }
.ck-btn.danger { color: #fca5a5; }

.ck-status-info { text-align: center; font-size: 12px; color: var(--ck-muted); min-height: 18px; }

.ck-debug { margin-top: 2px; }
.ck-debug summary {
  font-size: 11px;
  color: var(--ck-muted);
  cursor: pointer;
  letter-spacing: 1px;
  text-align: center;
  list-style: none;
}
.ck-debug summary::before { content: '▸ '; }
.ck-debug[open] summary::before { content: '▾ '; }
.ck-debug pre {
  margin: 8px 0 0;
  padding: 8px 10px;
  font-size: 10px;
  line-height: 1.6;
  color: #7dd3fc;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ===== Modal ===== */
.ck-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  animation: ck-fade-in 0.2s ease-out;
}
.ck-modal-mask.show { display: flex; }
@keyframes ck-fade-in { from { opacity: 0; } to { opacity: 1; } }
.ck-modal {
  background: var(--ck-glass);
  border: 1px solid var(--ck-border);
  border-radius: 18px;
  padding: 28px 32px;
  width: min(420px, 90vw);
  text-align: center;
  backdrop-filter: blur(14px);
  animation: ck-modal-pop 0.3s ease-out;
}
@keyframes ck-modal-pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.ck-badge {
  display: inline-block;
  background: rgba(245, 158, 11, 0.18);
  color: var(--ck-gold);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.ck-modal h2 { font-size: 28px; font-weight: 800; letter-spacing: 4px; margin: 12px 0 4px; }
.ck-modal h2.win { color: #86efac; }
.ck-modal h2.lose { color: #fca5a5; }
.ck-modal h2.draw { color: var(--ck-gold); }
.ck-modal .sub { color: var(--ck-muted); font-size: 13px; margin-bottom: 18px; }
.ck-modal .result { display: grid; gap: 8px; margin: 16px 0 20px; }
.ck-modal .r {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
}
.ck-modal .r .l { color: var(--ck-muted); font-size: 12px; }
.ck-modal .r .v { font-weight: 700; }
.ck-modal .actions { display: flex; gap: 8px; justify-content: center; }

/* ===== Toast ===== */
.ck-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ck-glass);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: var(--ck-gold);
  padding: 10px 24px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 1px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 998;
  max-width: 86vw;
  text-align: center;
}
.ck-toast.show { opacity: 1; }
