/* EluvK e27ac6b original graphical layout, MIT; artwork ownership unchanged. */
:root {
  /* 背景层次：由外到内、由底到面层层清晰，告别浑浊死黑与刺眼纯白 */
  --bg-main: #0b0f17;
  --bg-panel: #131926;
  --bg-card: #1c2438;
  --bg-card-hover: #26314c;
  --bg-inner: #0f1420;
  --border-color: #2a364f;
  --border-subtle: rgba(255, 255, 255, 0.08);

  /* 文字层级：确保 WCAG AA 级别高对比度与易读性 */
  --text-main: #f8fafc;
  --text-body: #e2e8f0;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  /* 珠宝与状态强调色调：典雅贵气，杜绝高饱和度荧光刺眼 */
  --accent-gold: #fbbf24;
  --accent-gold-glow: rgba(251, 191, 36, 0.35);
  --accent-blue: #38bdf8;
  --accent-green: #34d399;
  --accent-red: #f87171;
  --accent-white: #f1f5f9;
  --accent-black: #94a3b8;
  --accent-pearl: #f472b6;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  background: radial-gradient(circle at 50% 0%, #151d2f 0%, #0b0f17 70%);
  background-color: var(--bg-main);
  background-attachment: fixed;
  color: var(--text-body);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* 顶部导航与控制栏 */
header {
  background: rgba(19, 25, 38, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  padding: 6px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.title-group h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent-gold);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.02em;
}

/* 模式切换导航按钮 */
.nav-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.nav-tab {
  padding: 4px 11px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 4px;
  text-decoration: none;
  color: var(--text-muted);
  transition: all 0.2s ease;
  cursor: pointer;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
}

.status-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  transition: all 0.2s;
}

.controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ai-config-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

button, select {
  background-color: var(--primary);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.05s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

button:hover:not(:disabled) {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 8px rgba(79, 70, 229, 0.4);
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.btn-accent {
  background-color: #d97706;
  border-color: rgba(251, 191, 36, 0.3);
}

.btn-accent:hover:not(:disabled) {
  background-color: #b45309;
  box-shadow: 0 4px 8px rgba(217, 119, 6, 0.4);
}

.btn-success {
  background-color: #059669;
  border-color: rgba(52, 211, 153, 0.3);
}

.btn-success:hover:not(:disabled) {
  background-color: #047857;
  box-shadow: 0 4px 8px rgba(5, 150, 105, 0.4);
}

select {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  outline: none;
  cursor: pointer;
  color: var(--text-main);
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  padding: 3px 10px;
  border-radius: 5px;
  border: 1px solid var(--border-color);
}

input[type="range"] {
  accent-color: var(--accent-gold);
  cursor: pointer;
}

/* 顶部与版图之间的独立通栏：阶段指示与独立获胜者专属横幅 */
.phase-strip {
  padding: 6px 14px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.winner-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(90deg, rgba(234, 179, 8, 0.14) 0%, rgba(234, 179, 8, 0.35) 50%, rgba(234, 179, 8, 0.14) 100%);
  border: 1.5px solid var(--accent-gold);
  border-radius: 6px;
  padding: 8px 18px;
  color: #fff;
  font-size: 0.98rem;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.85);
  box-shadow: 0 0 18px rgba(234, 179, 8, 0.3);
  animation: pulse-winner 2.8s infinite ease-in-out;
}

@keyframes pulse-winner {
  0%, 100% {
    box-shadow: 0 0 12px rgba(234, 179, 8, 0.25);
  }
  50% {
    box-shadow: 0 0 22px rgba(234, 179, 8, 0.55);
  }
}

.phase-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 0.82rem;
  color: var(--text-main);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* 主视窗自适应三列布局：左列金字塔卡牌区，中列上棋盘+下双人仪表盘，右列日志与决策侧栏 */
main {
  display: grid;
  grid-template-columns: minmax(660px, 1.28fr) minmax(540px, 1.22fr) 300px;
  gap: 12px;
  padding: 8px 14px 14px 14px;
  flex: 1;
  max-width: 1920px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}

/* 左列：金字塔卡牌展示区 */
.pyramid-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* 中列：上下结构 (上方 5×5 棋盘 + 下方对决双方仪表盘) */
.center-stage {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.center-stage .board-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.center-stage .players-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.panel {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 5px;
}

.left-panel,
.board-panel,
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-panel {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 5x5 棋盘布局 (适度放大至 320x320px，格槽更饱满，质感更通透) */
.board-container {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 6px;
  background-image: url('assets/images/board-square.jpg?v=20261110-tableau-six-col');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  padding: 10px;
  border-radius: 10px;
  border: 2px solid #5a4220;
  box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.85), 0 8px 24px rgba(0, 0, 0, 0.55);
  width: 320px;
  height: 320px;
  box-sizing: border-box;
  margin: 0;
  flex-shrink: 0;
  position: relative;
}

.board-cell {
  background-color: rgba(10, 14, 22, 0.55);
  border: 1.5px solid rgba(212, 175, 55, 0.32);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: all 0.15s ease;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

.board-cell:hover {
  background-color: rgba(212, 175, 55, 0.22);
  border-color: rgba(251, 191, 36, 0.85);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.35);
}

/* 5x5 棋盘紧凑布局：棋盘与侧边特权/布袋紧密贴合，整体水平居中 */
.board-stage-wrap {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  width: fit-content;
}

.board-side-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  flex-shrink: 0;
}

.privilege-rules-panel {
  background: var(--bg-inner);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 8px;
  padding: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.privilege-rules-panel:hover {
  border-color: rgba(251, 191, 36, 0.7);
  box-shadow: 0 4px 14px rgba(251, 191, 36, 0.2);
  transform: translateY(-1px);
}

.privilege-rules-img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

.side-info-card {
  background: var(--bg-inner);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
  min-width: 102px;
  transition: all 0.15s ease;
}

.side-info-card:hover {
  border-color: rgba(251, 191, 36, 0.7);
  box-shadow: 0 4px 14px rgba(251, 191, 36, 0.2);
  transform: translateY(-1px);
}

.side-info-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.side-info-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.board-tokens-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.privilege-icon {
  display: inline-block;
  width: 15px;
  height: 25px;
  background-image: url('assets/images/privilege.png?v=20261110-tableau-six-col');
  background-size: contain;
  background-repeat: no-repeat;
  vertical-align: -5px;
  margin-right: 4px;
}

.bag-icon {
  display: inline-block;
  width: 22px;
  height: 22px;
  background-image: url('assets/images/bag.png?v=20261110-tableau-six-col');
  background-size: contain;
  background-repeat: no-repeat;
  vertical-align: -4px;
  margin-right: 4px;
}

/* 标记样式 (BGA 原版 3D 浮雕筹码，微调放大至 44x44px，触控与辨识度倍增) */
.token {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-image: url('assets/images/tokens.png?v=20261110-tableau-six-col');
  background-size: 800% 100%;
  background-repeat: no-repeat;
  image-rendering: -webkit-optimize-contrast;
  filter: contrast(1.06) brightness(1.03);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.65), inset 0 1.5px 2px rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(0, 0, 0, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: default;
  flex-shrink: 0;
}

.token:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.85), 0 0 10px rgba(251, 191, 36, 0.6);
}

/* BGA tokens.png 排列: gold(0), pearl(1), blue(2), white(3), green(4), black(5), red(6), wild(7) */
.token.token-gold  { background-position: 0% 0%; }
.token.token-pearl { background-position: 14.2857% 0%; }
.token.token-blue  { background-position: 28.5714% 0%; }
.token.token-white { background-position: 42.8571% 0%; }
.token.token-green { background-position: 57.1429% 0%; }
.token.token-black { background-position: 71.4286% 0%; }
.token.token-red   { background-position: 85.7143% 0%; }

/* 步骤历史日志面板 */
.log-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 180px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-inner);
  border-radius: 6px;
  padding: 6px;
  border: 1px solid var(--border-color);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.log-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  background: #151b2a;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.log-item:hover {
  background: #1f273b;
  border-color: rgba(255, 255, 255, 0.08);
}

.log-item.active-step {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--primary);
  border-left: 3px solid var(--accent-gold);
  font-weight: 700;
}

.log-idx { color: var(--text-muted); font-size: 0.72rem; min-width: 28px; }
.log-p { font-weight: 700; min-width: 22px; }
.log-act { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-main); }
.log-score-tag {
  font-size: 0.7rem;
  background: rgba(34, 197, 94, 0.15);
  color: #34d399;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.log-round-divider {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 2px 0;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  border-left: 2px solid #38bdf8;
  border-radius: 2px;
}

.log-item.ai-step {
  background: #171d2e;
  border-left: 2px solid #818cf8;
}

.log-item.ai-step:hover {
  background: #222a40;
}

.log-item.just-executed {
  animation: logPulse 1.2s ease-out;
}

@keyframes logPulse {
  0% {
    background-color: rgba(99, 102, 241, 0.5);
    transform: scale(1.02);
  }
  100% {
    background-color: #151b2a;
    transform: scale(1);
  }
}

.btn-scroll-toggle {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-scroll-toggle.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 700;
}

.guide-details {
  background: var(--bg-inner);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 0.76rem;
  color: var(--text-body);
  line-height: 1.45;
  transition: all 0.2s;
}

.guide-details[open] {
  background: #161c2a;
  border-color: rgba(255, 255, 255, 0.12);
}

.guide-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent-gold);
  user-select: none;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.guide-details summary::-webkit-details-marker {
  display: none;
}

.guide-details[open] .guide-toggle-arrow {
  transform: rotate(180deg);
}

.guide-toggle-arrow {
  font-size: 0.68rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

/* =========================================================
   金字塔与卡牌展示 (放大至 95x144px，画质抗锯齿通透优化)
   ========================================================= */
.tier-row {
  background: var(--bg-inner);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tier-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--accent-gold);
  font-weight: 700;
  padding: 0 2px;
}

.cards-flex {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 3px;
}

/* 卡牌基础形态 (适度放大至 100x152px，数字、费用、王冠清晰辨识) */
.card-item {
  width: 100px;
  height: 152px;
  background-color: #171412;
  background-repeat: no-repeat;
  border: 1.5px solid #5a4835;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.65), inset 0 0 2px rgba(255, 255, 255, 0.15);
  image-rendering: -webkit-optimize-contrast;
  filter: contrast(1.05) brightness(1.02) saturate(1.04);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
  cursor: default;
  flex-shrink: 0;
}

.card-item:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--accent-gold);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.8), 0 0 12px rgba(251, 191, 36, 0.4);
  z-index: 10;
}

/* 等级牌库卡背堆叠效果 (0 号帧) */
.card-item.deck-pile {
  border: 1.5px solid #7c6347;
  box-shadow: 2px 2px 0 #2a2015, 4px 4px 0 #18130d, 0 6px 14px rgba(0, 0, 0, 0.75);
  flex-shrink: 0;
  margin-right: 6px;
  position: relative;
}

.card-item.deck-pile.deck-empty {
  opacity: 0.35;
  filter: grayscale(0.8);
  border-style: dashed;
  box-shadow: none;
}

.card-item.deck-pile.deck-clickable {
  cursor: pointer;
}

.card-item.deck-pile.deck-clickable:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--accent-gold);
  box-shadow: 2px 2px 0 #2a2015, 4px 4px 0 #18130d, 0 8px 20px rgba(0, 0, 0, 0.85), 0 0 12px rgba(251, 191, 36, 0.5);
}

.deck-count-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(15, 23, 42, 0.92);
  color: var(--accent-gold);
  border: 1px solid rgba(251, 191, 36, 0.65);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  backdrop-filter: blur(2px);
  pointer-events: none;
  box-shadow: 0 2px 5px rgba(0,0,0,0.7);
}

/* 金字塔视觉层级阶梯对齐 (牌库左侧对齐，100px宽卡牌 + 6px间距 = 106px 阶梯差) */
#tier3Cards .deck-pile + .card-item {
  margin-left: 106px;
}

#tier2Cards .deck-pile + .card-item {
  margin-left: 53px;
}

/* 王室卡展示 (居中排布，原画通透) */
.royals-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 4px 0;
}

.royal-item {
  width: 100px;
  height: 152px;
  background-color: #171412;
  background-repeat: no-repeat;
  border: 1.5px solid #d4af37;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.65), inset 0 0 2px rgba(255, 255, 255, 0.2);
  image-rendering: -webkit-optimize-contrast;
  filter: contrast(1.05) brightness(1.02) saturate(1.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

.royal-item:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.8), 0 0 14px rgba(234, 179, 8, 0.5);
  z-index: 10;
}

/* =========================================================
   玩家仪表盘区域 (Player Dashboards)
   ========================================================= */
.players-panel,
.player-panel {
  flex: 1 1 540px;
  min-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 双人左右并排网格 */
.players-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 10px;
}

.player-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  transition: all 0.25s ease;
  min-width: 0;
}

.player-assets {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-inner);
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.player-cards-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-inner);
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.player-card.acting {
  border-color: var(--accent-gold);
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.35);
  background: #172036;
}

.player-card.next-turn {
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 4px;
}

.player-name {
  font-weight: 800;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-main);
}

.area-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* 手中筹码 7 列垂直堆叠 (Chip Stacks) */
.player-chips-stack-area {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-inner);
  padding: 5px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.token-stacks-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  align-items: flex-start;
  min-height: 58px;
}

.token-stack-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.stack-count-badge {
  font-size: 0.7rem;
  font-weight: 800;
  font-family: monospace;
  color: var(--text-faint);
  line-height: 1;
  margin-bottom: 2px;
}

.stack-count-badge.active {
  color: #fff;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.6);
}

.stack-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 100%;
}

.stack-chip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-image: url('assets/images/tokens.png?v=20261110-tableau-six-col');
  background-size: 800% 100%;
  background-repeat: no-repeat;
  image-rendering: -webkit-optimize-contrast;
  filter: contrast(1.06) brightness(1.03);
  box-shadow: 0 2px 5px rgba(0,0,0,0.8), inset 0 1px 1.5px rgba(255,255,255,0.45);
  border: 1px solid rgba(0,0,0,0.5);
  flex-shrink: 0;
  margin-top: -14px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.stack-body > .stack-chip:first-child {
  margin-top: 0;
}

.stack-chip:hover {
  transform: scale(1.2);
  box-shadow: 0 0 10px #fff;
  z-index: 100 !important;
}

.stack-chip.token-gold  { background-position: 0% 0%; }
.stack-chip.token-pearl { background-position: 14.2857% 0%; }
.stack-chip.token-blue  { background-position: 28.5714% 0%; }
.stack-chip.token-white { background-position: 42.8571% 0%; }
.stack-chip.token-green { background-position: 57.1429% 0%; }
.stack-chip.token-black { background-position: 71.4286% 0%; }
.stack-chip.token-red   { background-position: 85.7143% 0%; }

/* 空槽：通透轮廓，摆脱死黑看不清的问题 */
.token-slot-empty {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.28);
  background-image: url('assets/images/tokens.png?v=20261110-tableau-six-col');
  background-size: 800% 100%;
  background-repeat: no-repeat;
  opacity: 0.42;
  filter: grayscale(15%) brightness(0.88);
  background-color: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.token-slot-empty.slot-gold  { background-position: 0% 0%; border-color: rgba(251, 191, 36, 0.4); }
.token-slot-empty.slot-pearl { background-position: 14.2857% 0%; border-color: rgba(244, 114, 182, 0.4); }
.token-slot-empty.slot-blue  { background-position: 28.5714% 0%; border-color: rgba(56, 189, 248, 0.4); }
.token-slot-empty.slot-white { background-position: 42.8571% 0%; border-color: rgba(248, 250, 252, 0.4); }
.token-slot-empty.slot-green { background-position: 57.1429% 0%; border-color: rgba(52, 211, 153, 0.4); }
.token-slot-empty.slot-black { background-position: 71.4286% 0%; border-color: rgba(148, 163, 184, 0.4); }
.token-slot-empty.slot-red   { background-position: 85.7143% 0%; border-color: rgba(248, 113, 113, 0.4); }

/* 永久减免与已购卡片 (按颜色分列堆叠 Tableau by Color) */
.player-tableau-area {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg-inner);
  padding: 5px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.tableau-by-color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  align-items: flex-start;
  min-height: 80px;
}

.tableau-color-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.tableau-col-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 2px 0;
  border-radius: 4px;
  background: #0f1422;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--text-muted);
}

.tableau-col-header.has-bonus {
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.tableau-col-header.header-blue.has-bonus  { border-color: #0284c7; color: #38bdf8; }
.tableau-col-header.header-white.has-bonus { border-color: #cbd5e1; color: #f8fafc; }
.tableau-col-header.header-green.has-bonus { border-color: #16a34a; color: #4ade80; }
.tableau-col-header.header-black.has-bonus { border-color: #64748b; color: #cbd5e1; }
.tableau-col-header.header-red.has-bonus   { border-color: #dc2626; color: #f87171; }

.tableau-cards-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 100%;
  padding-top: 1px;
}

.tableau-stacked-card {
  width: 60px;
  height: 90px;
  border-radius: 4px;
  background-color: #171412;
  background-repeat: no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
  image-rendering: -webkit-optimize-contrast;
  filter: contrast(1.05) brightness(1.02);
  cursor: pointer;
  margin-top: -61px;
  transition: transform 0.15s, box-shadow 0.15s, z-index 0.15s;
  flex-shrink: 0;
}

.tableau-cards-stack > .tableau-stacked-card:first-child {
  margin-top: 0;
}

.tableau-stacked-card:hover {
  transform: translateY(-6px) scale(1.15);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.95), 0 0 10px var(--accent-gold);
  z-index: 80 !important;
  border-color: var(--accent-gold);
}

.tableau-empty-slot {
  width: 56px;
  height: 28px;
  border-radius: 4px;
  border: 1.5px dashed rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.25);
  margin-top: 2px;
}

/* 最底部：预留卡与王室卡横排 */
.player-bottom-cards-area {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-inner);
  padding: 5px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.bottom-cards-row {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 46px;
  flex-wrap: nowrap;
}

.empty-cards-placeholder {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 3px 6px;
}

.acting-indicator {
  background: var(--accent-gold);
  color: #000;
  font-weight: 800;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 3px;
  display: none;
}

.next-indicator {
  background: #38bdf8;
  color: #000;
  font-weight: 800;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 3px;
  display: none;
}

.player-card.acting .acting-indicator { display: inline-block; }
.player-card.next-turn .next-indicator { display: inline-block; }

/* 胜利条件进度条 (加粗并带有微光立体感，清晰可见) */
.victory-progress {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.76rem;
  background: var(--bg-inner);
  padding: 6px 9px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.progress-bar {
  height: 7px;
  background: #232d42;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.4);
  transition: width 0.25s ease;
}

.progress-fill.crowns { background: linear-gradient(90deg, #d97706, #f59e0b); }
.progress-fill.color { background: linear-gradient(90deg, #0284c7, #38bdf8); }

.token-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 24px;
  align-items: center;
}

/* 实体筹码样式 */
.chip.token-chip {
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(22, 28, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
  transition: transform 0.15s;
}

.chip.token-chip:hover {
  transform: translateY(-1px);
  border-color: #fff;
}

.chip-count {
  font-family: monospace;
  font-weight: 800;
  color: #fff;
}

/* 永久减免徽章 (Bonus Badges) */
.bonus-badge {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.74rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #0f1422;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 4px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
  letter-spacing: 0.02em;
}

.badge-gem-icon {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  background-image: url('assets/images/tokens.png?v=20261110-tableau-six-col');
  background-size: 800% 100%;
  background-repeat: no-repeat;
  display: inline-block;
  flex-shrink: 0;
}

.badge-gem-icon.token-gold  { background-position: 0% 0%; }
.badge-gem-icon.token-pearl { background-position: 14.2857% 0%; }
.badge-gem-icon.token-blue  { background-position: 28.5714% 0%; }
.badge-gem-icon.token-white { background-position: 42.8571% 0%; }
.badge-gem-icon.token-green { background-position: 57.1429% 0%; }
.badge-gem-icon.token-black { background-position: 71.4286% 0%; }
.badge-gem-icon.token-red   { background-position: 85.7143% 0%; }

.bonus-badge.bonus-blue  { border-color: #0284c7; color: #38bdf8; }
.bonus-badge.bonus-white { border-color: #cbd5e1; color: #f8fafc; }
.bonus-badge.bonus-green { border-color: #16a34a; color: #4ade80; }
.bonus-badge.bonus-black { border-color: #64748b; color: #cbd5e1; }
.bonus-badge.bonus-red   { border-color: #dc2626; color: #f87171; }
.bonus-badge.bonus-pearl { border-color: #db2777; color: #f472b6; }

.badge-num {
  font-family: monospace;
  font-weight: 800;
}

.chip-token-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-image: url('assets/images/tokens.png?v=20261110-tableau-six-col');
  background-size: 800% 100%;
  background-repeat: no-repeat;
  display: inline-block;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.chip-token-icon.token-gold  { background-position: 0% 0%; }
.chip-token-icon.token-pearl { background-position: 14.2857% 0%; }
.chip-token-icon.token-blue  { background-position: 28.5714% 0%; }
.chip-token-icon.token-white { background-position: 42.8571% 0%; }
.chip-token-icon.token-green { background-position: 57.1429% 0%; }
.chip-token-icon.token-black { background-position: 71.4286% 0%; }
.chip-token-icon.token-red   { background-position: 85.7143% 0%; }

.reserved-cards-container {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 38px;
  align-items: center;
}

.card-item.compact {
  width: 78px;
  height: 118px;
  padding: 0;
}

/* 已购买卡牌矩阵 (Tableau) 与迷你卡片样式 */
.card-item.mini {
  width: 60px;
  height: 90px;
  padding: 0;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s, z-index 0.15s;
}

.card-item.mini:hover {
  transform: scale(1.4);
  z-index: 25;
  box-shadow: 0 8px 18px rgba(0,0,0,0.85);
  border-color: var(--accent-gold);
}

.royal-item.mini {
  width: 60px;
  height: 90px;
  padding: 0;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s, z-index 0.15s;
}

.royal-item.mini:hover {
  transform: scale(1.4);
  z-index: 25;
  box-shadow: 0 8px 18px rgba(0,0,0,0.85);
  border-color: var(--accent-gold);
}

.purchased-cards-container {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  max-height: 200px;
  min-height: 48px;
  overflow-y: auto;
  padding: 6px;
  background: var(--bg-inner);
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  align-content: flex-start;
}

.purchased-cards-container::-webkit-scrollbar,
.log-panel::-webkit-scrollbar,
.candidates-list::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.purchased-cards-container::-webkit-scrollbar-thumb,
.log-panel::-webkit-scrollbar-thumb,
.candidates-list::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

.royals-mini-container {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 28px;
  align-items: center;
}

/* AI 决策与评分分析模块 */
.ai-decision-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-type-badge {
  font-size: 0.74rem;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.25);
  border: 1px solid var(--primary);
  color: #c7d2fe;
}

.decision-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.decision-summary {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-inner);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  box-sizing: border-box;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
}

.summary-label {
  color: var(--text-muted);
}

.score-badge {
  font-size: 0.88rem;
  color: #34d399;
  background: rgba(34, 197, 94, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 700;
}

.candidates-section {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-sizing: border-box;
}

.candidates-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.candidates-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 210px;
  min-height: 160px;
  overflow-y: auto;
  background: var(--bg-inner);
  padding: 5px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
}

.candidate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  border-radius: 4px;
  gap: 8px;
}

.candidate-row:hover { background: #1a2336; }
.candidate-row.chosen {
  background: rgba(99, 102, 241, 0.25);
  border-left: 3px solid var(--primary);
  font-weight: 700;
}

.candidate-act {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  color: var(--text-main);
}

.candidate-score {
  font-family: monospace;
  color: #38bdf8;
  font-weight: 700;
  min-width: 50px;
  text-align: right;
}

.candidate-chosen-badge {
  background: var(--accent-gold);
  color: #000;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 800;
}

/* =========================================================
   复盘局势与胜率走势折线图样式 (Evaluation Chart) 
   ========================================================= */
.eval-chart-container {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 14px 4px 14px;
}

.eval-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.eval-chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 85px;
}

.eval-chart-canvas {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  background: var(--bg-inner);
  display: block;
  cursor: crosshair;
}

/* 响应式支持 */
@media (max-width: 1420px) {
  main {
    grid-template-columns: minmax(540px, 1.25fr) minmax(460px, 1.15fr);
  }
  .sidebar-panel {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 1060px) {
  main {
    grid-template-columns: 1fr;
  }
  .sidebar-panel {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .players-grid {
    grid-template-columns: 1fr;
  }
}
