/* ============================================================
   出牌历史查看器
   ============================================================ */

/* ----- 中央牌堆入口 ----- */
#center-trick { gap: 6px; }  /* 让 .ct-deck 与 .ct-plays 并排留间距 */

.ct-deck {
  position: relative;
  width: 36px;
  height: 52px;
  cursor: pointer;
  flex: 0 0 auto;
}
.ct-deck-card {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: var(--mc-bg, #2a2a2a);
  border: 1px solid var(--mc-border, #666);
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.ct-deck-card.l2 { transform: translate(2px, 2px); }
.ct-deck-card.l3 { transform: translate(4px, 4px); }
.ct-deck::after {
  content: '?';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  color: var(--mc-text, #ccc);
  font-size: 22px;
  font-weight: bold;
  pointer-events: none;
}
.ct-deck:hover .ct-deck-card {
  border-color: var(--seat-current, #7cf);
  box-shadow: 0 0 6px 2px rgba(124, 204, 255, 0.4);
}

.ct-plays {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* ----- 面板（浮动、可拖拽，非 modal，不遮挡牌局） ----- */
#history-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);  /* 默认垂直 + 水平居中；拖拽时 JS 清掉 transform 并切绝对 left/top */
  max-height: 40vh;
  max-width: 70vw;
  min-width: 320px;
  background: rgba(22,24,32,0.35);   /* 更透明，不遮挡牌局 */
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 1000;
}
#history-panel.hidden { display: none; }
.hp-header {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--seat-border, #444);
  color: var(--seat-text, #ddd);
  font-size: 14px;
  font-weight: bold;
  cursor: move;
  user-select: none;
}
.hp-close {
  background: transparent;
  border: none;
  color: var(--seat-text, #ddd);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.hp-close:hover { color: #fff; }

.hp-body {
  flex: 1 1 auto;
  overflow: auto;      /* 水平 + 垂直滚动都在外层容器 */
  padding: 0;
}

.hp-table {
  border-collapse: collapse;
  table-layout: fixed;
  width: max-content;   /* 列宽由 colgroup 决定 */
}
.hp-table col.hp-col-label { width: 30px; }
.hp-table col.hp-col-player { width: 170px; }  /* 约 5 张牌（含 "大王" 等宽字）的宽度 */

.hp-table thead th {
  position: sticky;
  top: 0;
  background: rgba(22,24,32,0.85);  /* 表头略厚，滚动时盖住下方 */
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2;
  padding: 6px 6px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.25);
  font-weight: bold;
  font-size: 12px;
  color: var(--seat-text, #ddd);
  text-align: left;
}
.hp-table thead .hp-corner { border-right: 1px solid rgba(255,255,255,0.12); }
.hp-player-head.is-me .hp-name { color: #fc9; }
.hp-player-head .hp-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hp-player-head .hp-tags {
  margin-top: 2px;
  display: flex; gap: 4px;
}
.hp-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.1);
  color: #bbb;
}
.hp-tag-ai { background: rgba(120,180,255,0.2); color: #9cf; }
.hp-tag-me { background: rgba(255,200,100,0.2); color: #fc9; }

/* 圈号圆圈（显示在圈首行的左列） */
.hp-round-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: #ddd;
  font-size: 10px;
  font-weight: bold;
}

/* 每次出牌一行 */
.hp-play-row td {
  padding: 3px 6px;
  vertical-align: top;
}
/* 去掉横向分隔线，用隔轮底色区分（加大对比） */
.hp-play-row.hp-trick-odd { background: rgba(255,255,255,0.11); }
.hp-play-row.hp-trick-even { background: rgba(0,0,0,0.22); }

.hp-play-label {
  color: #666;
  font-size: 10px;
  text-align: center;
}

/* 每个玩家列独立框 — 按队伍着色（加粗） */
.hp-table .hp-team-a { border-left: 2px solid rgba(140,190,255,0.75); border-right: 2px solid rgba(140,190,255,0.75); }
.hp-table .hp-team-b { border-left: 2px solid rgba(255,145,145,0.75); border-right: 2px solid rgba(255,145,145,0.75); }
/* 无明确分队时用中性浅色 */
.hp-table .hp-col-player:not(.hp-team-a):not(.hp-team-b),
.hp-table .hp-player-head:not(.hp-team-a):not(.hp-team-b),
.hp-table .hp-play-cell:not(.hp-team-a):not(.hp-team-b) {
  border-left: 2px solid rgba(255,255,255,0.2);
  border-right: 2px solid rgba(255,255,255,0.2);
}

.hp-play-cell {
  min-height: 18px;
  line-height: 1.5;
  /* 牌面用 inline-block 自然换行 */
  word-break: break-all;
}
.hp-play-cell.hp-is-lead {
  background: rgba(255,180,80,0.08);
  box-shadow: inset 2px 0 0 rgba(255,180,80,0.6);
}
.hp-table .mc {
  font-size: 11px;
  margin: 0 1px;
  display: inline-block;
}

.hp-empty {
  color: #888;
  font-size: 12px;
  font-style: italic;
  text-align: center;
  padding: 20px;
}
