/* 棋盘页专用样式，基于首页 styles.css */
.board-workspace {
  gap: 20px;
}

/* 棋盘舞台：对齐首页 video-player 区域 */
.board-stage {
  position: relative;
  background: linear-gradient(165deg, #3d2914 0%, #1a1208 100%);
  border-radius: 10px;
  padding: 28px 20px 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.board-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 220, 160, 0.08), transparent 55%);
  pointer-events: none;
}

.board-stage #board {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
}

.board-stage-overlay {
  position: absolute;
  z-index: 2;
  font-size: 0.78rem;
  color: #fff;
  pointer-events: none;
}

.board-stage-overlay.top-left {
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.board-stage-overlay.top-right {
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.55);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
}

.board-stage-overlay.bottom {
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.75rem;
}

.board-stage-overlay.bottom span:last-child {
  text-align: right;
  white-space: nowrap;
}

/* xiangqiboard 微调 */
.board-stage .board-1ef78 {
  border: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.record-table-wrap {
  overflow-x: auto;
  max-height: 360px;
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid rgba(139, 69, 19, 0.12);
}

.record-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-serif);
  font-size: 0.88rem;
}

.record-table th,
.record-table td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid #f3f4f6;
}

.record-table th {
  background: var(--wood-light);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  position: sticky;
  top: 0;
  z-index: 1;
}

.record-table td:first-child {
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 600;
  width: 52px;
}

.record-table td:nth-child(2) {
  color: var(--red-piece);
}

.record-table td:nth-child(3) {
  color: var(--black-piece);
}

.record-table tr {
  cursor: pointer;
  transition: background 0.15s;
}

.record-table tr:hover {
  background: #faf8f5;
}

.record-table tr.active-row {
  background: var(--blue-light);
}

.record-table .empty-cell {
  color: #d1d5db;
}

.move-list-inline {
  max-height: 220px;
  overflow-y: auto;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  line-height: 1.9;
  padding: 12px 14px;
  background: #faf8f5;
  border-radius: 10px;
  border: 1px solid rgba(139, 69, 19, 0.12);
  min-height: 80px;
}

.move-list-inline .empty {
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.move-item {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 6px;
}

.move-item.active {
  background: var(--blue-light);
  color: var(--blue);
}

.board-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.board-btn {
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid #e5e7eb;
  background: var(--card);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.board-btn:hover {
  background: #f9fafb;
}

.board-btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.board-btn-primary:hover {
  background: #1d4ed8;
}

.board-btn-danger {
  color: var(--danger);
  border-color: #fecaca;
  background: #fef2f2;
}

.replay-controls {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.replay-controls .board-btn {
  padding: 10px 8px;
}

.replay-progress {
  margin-top: 14px;
}

.replay-progress-bar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.replay-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--purple));
  border-radius: 999px;
  transition: width 0.25s ease;
}

.replay-progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stats-list .conn-row dd.ok {
  color: var(--success);
}

.stats-list .conn-row dd.err {
  color: var(--danger);
}

.board-hint {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--blue-light);
  border-radius: 10px;
  font-size: 0.82rem;
  color: #1e40af;
  line-height: 1.6;
}

.board-hint a {
  color: var(--blue);
  font-weight: 600;
}

.home-board-stage {
  min-height: 0;
}

.home-board-stage #board {
  max-width: min(100%, 420px);
}

.host-panel h4 {
  margin-bottom: 12px;
}

.host-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.host-btn {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  border: 1px solid #e5e7eb;
  background: var(--card);
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.host-btn:hover {
  background: #f9fafb;
}

.host-btn-live {
  grid-column: span 2;
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--danger);
}

.host-btn-stop {
  grid-column: span 2;
  background: #1f2937;
  border-color: #1f2937;
  color: #fff;
}

.host-btn-warn {
  color: var(--danger);
  border-color: #fecaca;
  background: #fff5f5;
}

.host-live-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}

.host-live-badge.on {
  background: #fef2f2;
  color: var(--danger);
}

.host-live-badge.off {
  background: #f3f4f6;
  color: var(--text-muted);
}

.host-toast {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--blue-light);
  color: #1e40af;
  font-size: 0.8rem;
}

.live-main .card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .board-stage #board {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .home-board-stage {
    padding: 16px 8px 28px;
  }

  .board-stage {
    padding: 16px 10px 28px;
  }

  .replay-controls {
    grid-template-columns: repeat(3, 1fr);
  }

  .replay-controls .board-btn-primary {
    grid-column: span 3;
  }

  .host-controls {
    grid-template-columns: 1fr;
  }

  .host-btn-live,
  .host-btn-stop {
    grid-column: span 1;
  }
}
