/**
 * Part 3: 模拟多人对战演示 专属 CSS
 */

.match-sim-controls-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.sim-status-banner {
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid var(--accent-purple);
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.turn-badge-active {
  background: linear-gradient(135deg, var(--accent-gold), #F59E0B);
  color: #0F172A;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.9rem;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.arena-sim-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 3列横向并列：中央公共桌面 (左) + 训练家实时看板 (中) + 实时对战日志 (右) */
.sim-top-row {
  display: flex;
  gap: 14px;
  align-items: stretch;
  flex-wrap: wrap;
}

/* 中央公共桌面 (PUBLIC BOARD) 比例微缩，保障 3 列布局下绝无重叠 */
.sim-top-row .public-zone {
  flex: 2.2;
  min-width: 460px;
}

.sim-top-row .public-board-layout {
  zoom: 0.84;
  gap: 12px;
}

.sim-top-row .public-zone .pokemon-card,
.sim-top-row .public-zone .deck-stack,
.sim-top-row .public-zone .deck-stack-spacer {
  width: 102px;
  height: 124px;
  padding: 6px 4px;
  flex-shrink: 0;
}

.sim-top-row .public-zone .card-avatar {
  font-size: 1.7rem;
}

.sim-top-row .public-zone .card-name {
  font-size: 0.75rem;
}

.sim-top-row .public-zone .card-market-row {
  gap: 8px;
}

.sim-top-row .players-overview-section {
  flex: 1.3;
  min-width: 295px;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px;
}

.players-cards-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  justify-content: space-between;
}

.player-card-sim {
  background: rgba(15, 23, 42, 0.7);
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.3s ease;
}

.player-card-sim.is-active-turn {
  border-color: var(--accent-gold);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.25);
  background: rgba(245, 158, 11, 0.08);
}

.p-header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  flex-wrap: nowrap;
}

.p-name {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-main);
  max-width: 130px;
  white-space: nowrap;
  flex-shrink: 1;
}

.p-name.trainer-name-pill {
  position: relative;
  cursor: pointer;
  overflow: visible;
}

.trainer-hover-popover {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: #0F172A;
  border: 1.5px solid var(--accent-gold);
  border-radius: 8px;
  padding: 8px 12px;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7), 0 0 14px rgba(245, 158, 11, 0.3);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.trainer-name-pill:hover .trainer-hover-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.trainer-popover-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.trainer-popover-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.held-tokens-pill {
  position: relative;
  color: var(--accent-cyan);
  cursor: pointer;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.4);
  transition: all 0.2s ease;
  white-space: nowrap;
  font-size: 0.68rem;
  padding: 1px 5px;
  flex-shrink: 0;
}

.held-tokens-pill:hover {
  background: rgba(6, 182, 212, 0.25);
  border-color: var(--accent-cyan);
  z-index: 600;
}

.held-tokens-popover {
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: 175px;
  background: #0F172A;
  border: 1.5px solid var(--accent-cyan);
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.85), 0 0 15px rgba(6, 182, 212, 0.25);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 999;
  text-align: left;
}

.held-tokens-popover::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: var(--accent-cyan) transparent transparent transparent;
}

.held-tokens-pill:hover .held-tokens-popover {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.held-breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 6px;
  font-size: 0.7rem;
  margin-top: 2px;
}

.breakdown-item {
  color: var(--text-main);
  white-space: nowrap;
}

.breakdown-item strong {
  color: var(--accent-gold);
  margin-left: 2px;
}

.p-vp-badge {
  font-weight: 800;
  color: var(--accent-gold);
  font-size: 0.95rem;
  white-space: nowrap;
}

.p-discounts-flex {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.mini-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
}

.p-cards-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.p-cards-section.reserved-section {
  background: rgba(168, 85, 247, 0.08);
  border-color: rgba(168, 85, 247, 0.25);
}

.p-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-cyan);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reserved-section .p-section-title {
  color: var(--accent-purple);
}

.facedown-tag {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: normal;
}

.p-cards-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.mini-pokemon-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.72rem;
  color: var(--text-main);
  transition: transform 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}

.mini-pokemon-chip:hover {
  transform: translateY(-1px);
  border-color: var(--accent-cyan);
  z-index: 500;
}

.card-hover-popover {
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: 135px;
  background: #0F172A;
  border: 1.5px solid var(--accent-gold);
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.85), 0 0 15px rgba(245, 158, 11, 0.2);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 999;
  text-align: center;
}

.card-hover-popover::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: var(--accent-gold) transparent transparent transparent;
}

.mini-pokemon-chip:hover .card-hover-popover {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 4px;
  margin-bottom: 4px;
}

.popover-pts {
  font-weight: 800;
  color: var(--accent-gold);
  font-size: 0.82rem;
}

.popover-level {
  font-size: 0.65rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.popover-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 3px 0;
}

.popover-avatar {
  font-size: 1.8rem;
  line-height: 1;
}

.popover-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

.popover-bonus {
  font-size: 0.68rem;
  color: var(--accent-gold);
  font-weight: 700;
  margin: 3px 0;
  background: rgba(245, 158, 11, 0.1);
  padding: 1px 4px;
  border-radius: 4px;
}

.popover-cost {
  margin-top: 4px;
  border-top: 1px dashed var(--border-color);
  padding-top: 4px;
}

.popover-cost-title {
  font-size: 0.62rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}

.popover-cost-badges {
  display: flex;
  justify-content: center;
  gap: 3px;
}

.mini-pokemon-chip.rare-chip {
  border-color: #EC4899;
  background: rgba(236, 72, 153, 0.15);
}

.mini-pokemon-chip.leg-chip {
  border-color: #A855F7;
  background: rgba(168, 85, 247, 0.2);
}

.mini-pokemon-chip.reserved-chip {
  border-color: var(--accent-purple);
  background: rgba(168, 85, 247, 0.12);
}

.chip-avatar {
  font-size: 0.85rem;
}

.chip-name {
  font-weight: 600;
}

.chip-pts {
  font-weight: 800;
  color: var(--accent-gold);
  font-size: 0.7rem;
  background: rgba(245, 158, 11, 0.15);
  padding: 0 3px;
  border-radius: 3px;
}

.empty-cards-tip {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
}

/* 右侧第 3 列：实时对战日志 (与公共桌面、训练家看板 3 列并列) */
.match-log-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
}

.match-log-card.log-section-right {
  flex: 1.2;
  min-width: 280px;
}

.log-header {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-cyan);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.log-stream {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
  flex: 1;
  max-height: 520px;
  min-height: 380px;
}

.log-entry {
  font-size: 0.78rem;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.6);
  border-left: 3px solid var(--border-color);
  line-height: 1.4;
  animation: fadeIn 0.3s ease-out;
}

.log-entry.turn-p1 { border-left-color: var(--accent-cyan); }
.log-entry.turn-p2 { border-left-color: var(--accent-gold); }
.log-entry.turn-p3 { border-left-color: #10B981; }
.log-entry.turn-p4 { border-left-color: var(--accent-purple); }
.log-entry.victory { border-left-color: #EF4444; background: rgba(239, 68, 68, 0.15); font-weight: 700; }

/* 胜利结算 Modal */
.sim-winner-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.sim-winner-card {
  background: var(--bg-card);
  border: 2px solid var(--accent-gold);
  border-radius: 16px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 0 40px rgba(245, 158, 11, 0.4);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.winner-trophy {
  font-size: 3.5rem;
}

.winner-title {
  font-size: 1.5rem;
  color: var(--accent-gold);
  font-weight: 800;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.score-table th, .score-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.score-table th {
  color: var(--text-muted);
  font-weight: 600;
}
