/* ── Reset & Base ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #1a1a2e;
  --surface:     #16213e;
  --surface2:    #0f3460;
  --accent:      #e94560;
  --accent2:     #f5a623;
  --text:        #eaeaea;
  --text-muted:  #888;
  --black-piece: #111;
  --white-piece: #f0f0f0;
  --border:      rgba(255,255,255,0.08);
  --radius:      12px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Layout ────────────────────────────────────── */
.game-layout {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 24px;
  max-width: 1100px;
  width: 100%;
}

.sidebar {
  width: 200px;
  flex-shrink: 0;
}

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

#board-canvas {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: crosshair;
  display: block;
}

/* ── ScoreBoard ────────────────────────────────── */
.scoreboard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.player-score {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s;
}
.player-score.active {
  background: rgba(233,69,96,0.15);
  border: 1px solid var(--accent);
}

.player-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.black-dot { background: #111; border: 1px solid #555; }
.white-dot { background: #eee; border: 1px solid #aaa; }

.player-label { flex: 1; font-size: 14px; }
.score-value  { font-size: 16px; font-weight: bold; color: var(--accent2); }
.score-divider {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin: 6px 0;
}

.turn-indicator {
  text-align: center;
  font-size: 14px;
  font-weight: bold;
  padding: 8px;
  background: var(--surface2);
  border-radius: 8px;
  margin-top: 4px;
}

/* ── Status Tip ────────────────────────────────── */
.status-tip {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  min-height: 36px;
  transition: all 0.2s;
  line-height: 1.5;
}
.status-tip.info { background: rgba(80,150,255,0.15); color: #80b4ff; }
.status-tip.warn { background: rgba(233,69,96,0.15);  color: var(--accent); }

/* ── Skill Panel ───────────────────────────────── */
.skill-panel { display: flex; flex-direction: column; gap: 10px; }
.skill-panel-title {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  position: relative;
  transition: all 0.2s;
  cursor: pointer;
}
.skill-card.available:hover {
  border-color: var(--accent2);
  background: rgba(245,166,35,0.08);
  transform: translateY(-1px);
}
.skill-card.active {
  border-color: var(--accent);
  background: rgba(233,69,96,0.15);
  box-shadow: 0 0 12px rgba(233,69,96,0.3);
}
.skill-card.on-cooldown {
  opacity: 0.5;
  cursor: not-allowed;
}

.skill-icon  { font-size: 24px; margin-bottom: 4px; }
.skill-name  { font-size: 14px; font-weight: bold; }
.skill-ready    { font-size: 11px; color: #6cff6c; margin-top: 2px; }
.skill-cooldown { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.skill-tooltip {
  display: none;
  position: absolute;
  left: 110%;
  top: 0;
  width: 180px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.5;
  z-index: 10;
  pointer-events: none;
  box-shadow: var(--shadow);
}
.skill-card:hover .skill-tooltip { display: block; }

/* ── Modal ─────────────────────────────────────── */
.modal-container {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px;
  max-width: 520px;
  width: 90%;
  box-shadow: var(--shadow);
  animation: modal-in 0.25s ease;
}
@keyframes modal-in {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.modal-title    { font-size: 24px; font-weight: bold; margin-bottom: 8px; }
.modal-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }

/* ── Buttons ───────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:not(:disabled):hover  { background: #ff2a47; transform: translateY(-1px); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent2); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }

/* ── Mode Buttons ──────────────────────────────── */
.mode-buttons { display: flex; flex-direction: column; gap: 12px; }
.mode-buttons .btn { width: 100%; padding: 14px; font-size: 15px; }

/* ── Skill Select ──────────────────────────────── */
.skill-select-modal { max-width: 600px; }

.skill-pick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.skill-pick-card {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.skill-pick-card:hover   { border-color: var(--accent2); }
.skill-pick-card.selected {
  border-color: var(--accent);
  background: rgba(233,69,96,0.15);
}

.skill-pick-icon { font-size: 28px; margin-bottom: 6px; }
.skill-pick-name { font-size: 15px; font-weight: bold; }
.skill-pick-cd   { font-size: 11px; color: var(--text-muted); margin: 2px 0 6px; }
.skill-pick-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.skill-select-info {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
#skill-confirm-btn { width: 100%; padding: 14px; font-size: 15px; }

/* ── Result Modal ──────────────────────────────── */
.result-modal { text-align: center; }
.result-winner {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 20px;
}
.result-scores {
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 24px;
}
.result-scores .vs { color: var(--text-muted); font-size: 14px; }
#restart-btn { width: 100%; padding: 14px; font-size: 15px; }

/* ── Tutorial Modal ────────────────────────────── */
.tutorial-modal { max-width: 440px; }
.tutorial-step  { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.tutorial-title { font-size: 20px; font-weight: bold; margin-bottom: 12px; }
.tutorial-text  { font-size: 14px; line-height: 1.8; color: var(--text-muted); margin-bottom: 24px; }
.tutorial-nav   { display: flex; gap: 10px; justify-content: flex-end; }
