/* ============================================================
   BoardDuel Game Page Enhancement (P1)
   — 玩家卡片 + 计时器 + 对战布局
   — 只改 CSS，不动已有 DOM id/结构
   ============================================================ */

/* ---------- 玩家卡片（注入到 .status-bar 区域上方） ---------- */
.bd-players {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.bd-player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 20px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--r);
  min-width: 110px;
  transition: all 0.2s;
  position: relative;
}
.bd-player-card.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-l);
}
.bd-player-card .bd-p-avatar {
  font-size: 28px;
  line-height: 1;
}
.bd-player-card .bd-p-symbol {
  font-size: 22px;
  font-weight: 800;
}
.bd-player-card.me .bd-p-symbol { color: var(--brand); }
.bd-player-card.opp .bd-p-symbol { color: var(--t); }
.bd-player-card .bd-p-name {
  font-size: 12px;
  color: var(--m);
  font-weight: 600;
}
.bd-player-card .bd-p-timer {
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--t);
  margin-top: 2px;
}
.bd-player-card .bd-p-timer.warn { color: var(--warn); }
.bd-player-card .bd-p-timer.danger {
  color: var(--bad);
  animation: bd-p-pulse 1s infinite;
}
@keyframes bd-p-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.bd-vs {
  font-size: 18px;
  font-weight: 700;
  color: var(--m);
  align-self: center;
  padding-top: 30px;
}

/* ---------- 游戏容器（包装 board + toolbar 居中） ---------- */
.bd-game-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* ---------- 行动按钮条（Resign / New / Emoji） ---------- */
.bd-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.bd-actions .btn { padding: 8px 16px; font-size: 13px; }

/* ---------- 轻量模式切换（替代原 toggle 按钮组） ---------- */
.bd-mode-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
}
.bd-mode-bar .mode-label {
  font-size: 12px;
  color: var(--m);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.bd-mode-bar .mode-pill {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.bd-mode-bar .mode-pill button {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  border: none;
  background: none;
  color: var(--m);
  cursor: pointer;
  transition: all 0.15s;
}
.bd-mode-bar .mode-pill button.active {
  background: var(--brand);
  color: #fff;
}

/* ---------- 小屏幕适配 ---------- */
@media (max-width: 500px) {
  .bd-players { gap: 10px; }
  .bd-player-card { min-width: 90px; padding: 8px 12px; }
  .bd-player-card .bd-p-avatar { font-size: 22px; }
  .bd-player-card .bd-p-symbol { font-size: 18px; }
  .bd-player-card .bd-p-timer { font-size: 18px; }
  .bd-vs { font-size: 14px; padding-top: 22px; }
}

/* ---------- 共享棋钟组件（gomoku 等非 chess 页复用，避免每页复制页内 <style>） ----------
   仅作展示组件；权威值由服务端 clock_state 推送，前端只做显示衰减。 */
.bd-clocks {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  max-width: 480px;
  margin: .4rem auto;
}
.bd-clock-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: .4rem .8rem;
  background: var(--card, #fff);
  border: 1.5px solid var(--line, #e5e7eb);
  border-radius: 10px;
  min-width: 96px;
  font-variant-numeric: tabular-nums;
}
.bd-clock-box .bd-cl-lb {
  font-size: .78rem;
  color: var(--m, #6b7280);
  display: flex;
  align-items: center;
  gap: .25rem;
}
.bd-clock-box .bd-cl-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--t, #1e1b4b);
  line-height: 1.1;
}
.bd-clock-box.active {
  border-color: var(--brand, #0066CC);
  background: #F0FDFA;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, .16);
}
.bd-clock-box.low .bd-cl-val { color: var(--bad, #dc2626); }
.bd-clock-info { font-size: .8rem; color: var(--m, #6b7280); text-align: center; }

/* 全局头像槽（与 shared/avatars.js 注入的 .bd-p-avatar 互补；未引 avatars.js 时也能渲染）*/
.bd-p-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6em;
  height: 1.6em;
  font-size: 1.05em;
  background: var(--bd-muted, #f9fafb);
  border-radius: 50%;
  vertical-align: -0.35em;
  margin-right: .35em;
  line-height: 1;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
