/* 扑克牌游戏样式 */
.dragon-game-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(234, 239, 145, 0.85); /* 改为0.85的透明度，使背景更亮一些 */
  z-index: 1000;
  display: none;
  overflow: hidden;
}
/* 提高字体可见度 */
.player-info {
  color: #ffffff; /* 确保文字为纯白色 */
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.8); /* 添加文字阴影提高对比度 */
}
/* 修改游戏容器，确保有足够空间显示完整内容 */
.dragon-game-content {
  padding-bottom: 70px; /* 增加底部内边距 */
  position: relative;
  height: 100vh;
  overflow-y: auto; /* 允许在内容溢出时滚动 */
  -webkit-overflow-scrolling: touch; /* 增强移动端滚动体验 */
}

.dragon-game-header {
  text-align: center;
  color: white;
  padding: 15px;
}

.dragon-game-header h2 {
  margin: 0;
  font-size: 28px;
  color: gold;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.dragon-game-body {
  padding: 0 10px;
}

/* 确保游戏桌面有足够的空间 */
.dragon-table-container {
  position: absolute;
  width: 100%;
  height: calc(100% - 150px); /* 预留顶部和底部空间 */
  top: 80px; /* 从顶部留出空间 */
  display: flex;
  justify-content: center;
}

/* 修改牌桌布局，让更多空间用于游戏区域 */
.dragon-table {
  width: 90%; /* 增大桌面使用空间 */
  height: 80%;
}

/* 修改牌河中的牌为直线排列 */
.dragon-card-river {
  width: 100%;
  height: 110px;
  padding: 10px;
  margin: 0 auto;
  margin-top: 30px;
  position: relative;
  background-color: rgba(219, 230, 236, 0.3);
  border-radius: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap; /* 允许换行 */
  overflow: hidden;
}

/* 修改牌河中的牌样式 */
.dragon-card-river .card {
  position: relative; /* 从absolute改为relative */
  margin: 0 -10px 5px 0; /* 负margin创建重叠效果 */
  transform: none !important; /* 移除所有变换和旋转 */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
  z-index: 1; /* 基本层级 */
}

/* 移除牌河中卡牌的旋转定位 */
.dragon-card-river .card:nth-child(1),
.dragon-card-river .card:nth-child(2),
.dragon-card-river .card:nth-child(3),
.dragon-card-river .card:nth-child(4),
.dragon-card-river .card:nth-child(5),
.dragon-card-river .card:nth-child(6),
.dragon-card-river .card:nth-child(7),
.dragon-card-river .card:nth-child(n+8) {
  transform: none !important;
  z-index: auto;
}

/* 确保每张牌都能有正确的层叠顺序 */
.dragon-card-river .card:hover {
  z-index: 10;
}

/* 更多的牌只显示最近的几张 */
.dragon-card-river .card:nth-child(n+8) {
  opacity: 0.8;
  transform: rotate(calc(15deg + var(--rot, 0deg))) translateX(calc(80px + var(--x, 0px)));
  z-index: calc(7 + var(--z, 0));
}


/* 玩家区域样式 */
.player-position {
  position: absolute;
  width: 150px;
  height: 200px;
}

/* 调整主玩家位置，将其更靠上 */
.player-position-0 {
  bottom: 100px; /* 从80px增加到100px，让手牌更靠上 */
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 140px; /* 略微减小高度，集中手牌 */
  z-index: 100; /* 确保不被其他元素遮挡 */
}
/* 修改AI玩家位置到左右两侧而非顶部 */
.player-position-1 {
  top: 50%;  /* 垂直居中 */
  left: 10px; /* 靠左侧 */
  transform: translateY(-50%);
  width: 180px;
  height: auto;
}

.player-position-2 {
  top: 50%; /* 垂直居中 */
  right: 10px; /* 靠右侧 */
  left: auto;
  transform: translateY(-50%);
  width: 180px;
  height: auto;
}

.player-box {
  background-color: rgba(114, 111, 111, 0.5);
  border-radius: 10px;
  padding: 10px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  color: white;
  transition: all 0.3s ease;
}

.player-box.active {
  box-shadow: 0 0 15px 5px gold;
  border: 2px solid gold;
}

.player-box.eliminated {
  opacity: 0.5;
  background-color: rgba(100, 0, 0, 0.5);
}

/* 手牌区域 */
.player-hand {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hand-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-height: 120px;
  overflow-y: auto;
  gap: 5px;
  margin-top: 10px;
  margin-right: -370px; 
}

/* 卡牌样式 */
.card {
  width: 60px;
  height: 90px;
  background-color: white;
  border-radius: 5px;
  position: relative;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  cursor: pointer;
  margin: 4px;
  font-family: Arial, sans-serif;
  overflow: hidden;
}
/* 牌面样式 */
.card .card-value {
  position: absolute;
  top: 5px;
  left: 5px;
  font-size: 18px;
  font-weight: bold;
}
.card .card-value-bottom {
  position: absolute;
  bottom: 5px;
  right: 5px;
  font-size: 18px;
  font-weight: bold;
  transform: rotate(180deg);
}
/* 牌花色样式 */
.card .card-suit {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 30px;
  line-height: 1;
}
/* 红色花色 */
.card.hearts .card-value, 
.card.hearts .card-value-bottom,
.card.diamonds .card-value, 
.card.diamonds .card-value-bottom {
  color: #e74c3c;
}
/* 黑色花色 */
.card.clubs .card-value,
.card.clubs .card-value-bottom,
.card.spades .card-value,
.card.spades .card-value-bottom {
  color: #2c3e50;
}
/* 花色符号 */
.card.hearts .card-suit:before { content: "♥"; color: #e74c3c; }
.card.diamonds .card-suit:before { content: "♦"; color: #e74c3c; }
.card.clubs .card-suit:before { content: "♣"; color: #2c3e50; }
.card.spades .card-suit:before { content: "♠"; color: #2c3e50; }

/* 牌背样式 */
.card.back {
  background: linear-gradient(135deg, #6c5ce7, #4834d4);
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(255, 255, 255, 0.1) 10px,
    rgba(255, 255, 255, 0.1) 20px
  );
}
.card.back:after {
  content: "";
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

/* 改进卡牌悬停效果 */
.card:hover {
  transform: translateY(-10px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.card.enabled:hover {
  transform: translateY(-10px) scale(1.05);
  box-shadow: 0 15px 25px rgba(0, 0, 0, 0.2), 0 0 10px rgba(255, 215, 0, 0.5);
  z-index: 10;
}

.card.played {
  transform: none;
  margin: 0 -10px 0 0;
}


/* 调整控制面板位置，确保不会遮挡手牌 */
.control-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 5px; /* 减小内边距 */
  display: flex;
  justify-content: center;
  z-index: 90; /* 确保在手牌下方 */
}

.dragon-controls {
  display: flex;
  gap: 15px;
  align-items: center;
}

.dragon-btn {
  padding: 8px 15px;
  border-radius: 5px;
  border: none;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dragon-btn:hover {
  transform: translateY(-2px);
}

.dragon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.dragon-btn.primary {
  background-color: #e74c3c;
  color: white;
  font-weight: bold;
}

.dragon-btn.secondary {
  background-color: #3498db;
  color: white;
}

/* 游戏消息 */
.game-message {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  font-size: 18px;
  text-align: center;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.game-message.show {
  opacity: 1;
}
/* 修改排行榜按钮和容器的相对定位 */
.dragon-leaderboard {
  position: absolute; /* 使用绝对定位 */
  top: -40px; /* 距离顶部的距离 */
  right: -70px; /* 距离右侧的距离 */
  z-index: 1000000; /* 确保在其他元素上方 */
}

/* 覆盖通用.leaderboard-btn的margin-top */
.dragon-leaderboard .leaderboard-btn {
  margin-top: 0 !important; /* 使用!important覆盖通用样式 */
  margin-bottom: 0;
  padding: 6px 12px; /* 稍微减小内边距使按钮更紧凑 */
}


.dragon-leaderboard .leaderboard-btn:hover {
  background-color: #c0392b;
  transform: translateY(-2px);
}

/* 修改排行榜面板的定位，使其居中且提高层级 */
.leaderboard-panel {
  position: fixed; /* 改为fixed定位 */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%); /* 居中定位 */
  width: 400px;
  max-height: 500px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  z-index: 2000; /* 提高z-index值 */
  overflow: hidden;
  display: none; /* 默认隐藏 */
}


/* 保留动画效果，但修改为居中动画 */
@keyframes fadeIn {
  from { 
    opacity: 0; 
    transform: translate(-50%, -55%); 
  }
  to { 
    opacity: 1; 
    transform: translate(-50%, -50%); 
  }
}
/* 显示排行榜时的动画 */
.leaderboard-panel.show {
  display: block;
  animation: fadeIn 0.3s forwards;
}
.leaderboard-header {
  background-color: #2c7873;
  color: white;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.leaderboard-header h3 {
  margin: 0;
  font-size: 16px;
}

.leaderboard-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0 5px;
}

.leaderboard-table {
  width: 100%;
  padding: 10px;
  max-height: 340px;
  overflow-y: auto;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 50px 2fr 1fr 1fr;
  padding: 8px 5px;
  border-bottom: 1px solid #eee;
}

.leaderboard-row.header {
  font-weight: bold;
  background-color: #f5f5f5;
  border-bottom: 2px solid #ddd;
}

.leaderboard-row:last-child {
  border-bottom: none;
}

.rank, .player, .score, .date {
  display: flex;
  align-items: center;
}

.rank {
  justify-content: center;
}

.loading, .error, .no-data, .mock-data-notice {
  padding: 15px;
  text-align: center;
  color: #666;
}

.error {
  color: #e74c3c;
}

.mock-data-notice {
  color: #e67e22;
  font-style: italic;
  font-size: 12px;
  padding: 5px;
}

/* 添加奖牌图标样式 */
.medal-icon {
  width: 20px;
  height: 20px;
}

.rank-1, .rank-2, .rank-3 {
  font-weight: bold;
}

/* 游戏结束模态框样式 */
#dragon-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#dragon-modal > div {
  background-color: white;
  padding: 30px;
  border-radius: 15px;
  max-width: 450px;
  width: 90%;
  text-align: center;
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  cursor: pointer;
}

.close-icon {
  width: 24px;
  height: 24px;
}

.custom-name-container {
  margin: 15px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

#dragon-player-select,
#dragon-custom-name {
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  width: 80%;
  max-width: 250px;
  margin: 0 auto;
  font-size: 14px;
}

#dragon-submit-btn {
  background-color: #2c7873;
  color: white;
  border: none;
  border-radius: 25px;
  padding: 10px 20px;
  margin-top: 15px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
}

#dragon-submit-btn:hover {
  background-color: #1a4d48;
}

/* 改进AI玩家手牌区域 */
#player-hand-1, #player-hand-2 {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}

#player-hand-1 .card.back, 
#player-hand-2 .card.back {
  width: 40px;
  height: 60px;
  margin: -5px;
  transform: rotate(var(--rotation, 0deg));
}

#player-hand-1 .card.back:nth-child(odd) {
  --rotation: -5deg;
}

#player-hand-1 .card.back:nth-child(even) {
  --rotation: 5deg;
}

#player-hand-2 .card.back:nth-child(odd) {
  --rotation: 5deg;
}

#player-hand-2 .card.back:nth-child(even) {
  --rotation: -5deg;
}

/* 改进匹配和收集动画 */
@keyframes matchedAnimation {
  0% { transform: scale(1); box-shadow: 0 0 5px gold; }
  50% { transform: scale(1.1); box-shadow: 0 0 25px gold; }
  100% { transform: scale(1); box-shadow: 0 0 5px gold; }
}

.card.matched {
  animation: matchedAnimation 0.8s ease infinite;
  z-index: 10;
}

@keyframes collectAnimation {
  0% { transform: scale(1); opacity: 1; }
  20% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.1); opacity: 0; }
}

.card.collected {
  animation: collectAnimation 0.8s forwards;
}

/* 修改AI玩家的玩家框样式 - 使其更紧凑 */
.player-box#player-box-1, 
.player-box#player-box-2 {
  flex-direction: row;
  height: auto;
  min-height: 10px;
  padding: 1px;
  align-items: center;
}
/* 修改AI玩家信息区样式 */
#player-box-1 .player-info,
#player-box-2 .player-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-left: 15px;
  flex: 1;
}
/* 修改AI玩家手牌区域 - 只显示一张代表性牌背 */
#player-box-1 .player-hand,
#player-box-2 .player-hand {
  width: auto;
  position: relative;
}
/* 简化AI玩家手牌容器 */
#player-hand-1, 
#player-hand-2 {
  display: flex;
  position: relative;
  justify-content: center;
  margin-right: 10px;
  width: 50px;
}
/* 制作有层叠感的单卡牌背 */
#player-hand-1 .card-stack, 
#player-hand-2 .card-stack {
  position: relative;
  width: 50px;
  height: 70px;
}
/* 主牌背 */
#player-hand-1 .card-stack .card.back, 
#player-hand-2 .card-stack .card.back {
  position: absolute;
  width: 50px;
  height: 70px;
  margin: 0;
  transform: rotate(0deg);
  transition: transform 0.2s ease;
}
/* 层叠效果牌 */
#player-hand-1 .card-stack .stack-indicator, 
#player-hand-2 .card-stack .stack-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 50px;
  height: 70px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
  transform: rotate(5deg) translateX(-5px) translateY(-3px);
  z-index: -1;
}
/* 牌数指示器 */
.cards-count-indicator {
  position: absolute;
  top: -10px;
  right: -10px;
  background-color: #e74c3c;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
/* AI玩家名称样式增强 */
#player-box-1 .player-name, 
#player-box-2 .player-name {
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 5px;
  color: gold;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}
/* AI玩家状态信息样式 */
#player-box-1 .player-cards-count,
#player-box-1 .player-collected,
#player-box-2 .player-cards-count,
#player-box-2 .player-collected {
  font-size: 14px;
  margin: 2px 0;
}

/* 高亮状态下增强AI玩家框显示 */
.player-box#player-box-1.active, 
.player-box#player-box-2.active {
  box-shadow: 0 0 20px 8px gold;
  background-color: rgba(0, 0, 0, 0.7);
}

/* 活跃玩家的牌背动画效果 */
.player-box.active .card-stack .card.back {
  animation: activeCardPulse 1.5s infinite;
}

@keyframes activeCardPulse {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(5deg) scale(1.1); }
  100% { transform: rotate(0deg) scale(1); }
}
/* 调整AI玩家在移动设备上的位置，避免重叠 */
@media (max-width: 768px) {
  /* 在大屏幕上将玩家一二移到顶部 */
  .player-position-1 {
    top: 80px; /* 从50%改为固定80px，靠近顶部 */
    left: 30px;
    transform: none; /* 移除垂直居中 */
  }
  
  
  .player-position-2 {
    top: 80px; /* 从50%改为固定80px，靠近顶部 */
    right: 30px;
    transform: none; /* 移除垂直居中 */
  }
  
  /* 缩小玩家框和信息区 */
  .player-box#player-box-1, 
  .player-box#player-box-2 {
    min-height: 50px; /* 在移动设备上使用较小但仍足够的高度 */
    padding: 5px;
    background-color: rgba(225, 217, 217, 0.7); /* 更深的背景 */
  }
  
  #player-box-1 .player-name, 
  #player-box-2 .player-name {
    font-size: 14px;
  }
  
  #player-box-1 .player-cards-count,
  #player-box-1 .player-collected,
  #player-box-2 .player-cards-count,
  #player-box-2 .player-collected {
    font-size: 12px;
  }
}

/* 超小屏幕设备的更极端调整 */
@media (max-width: 480px) {
  /* 将玩家一放在左上角，玩家二放在右上角，保持足够距离 */
  .player-position-1 {
    top: 10px;
    left: 10px;
    width: 120px;
  }
  
  .player-position-2 {
    top: 10px;
    right: 10px;
    width: 120px;
  }
  
  /* 简化玩家信息显示 */
  .player-box#player-box-1 .player-info, 
  .player-box#player-box-2 .player-info {
    margin-left: 5px;
  }
  
  /* 调整手牌大小和标记 */
  #player-hand-1 .card-stack, 
  #player-hand-2 .card-stack,
  #player-hand-1 .card-stack .card.back, 
  #player-hand-2 .card-stack .card.back {
    width: 40px;
    height: 56px;
  }
  
  .cards-count-indicator {
    width: 20px;
    height: 20px;
    font-size: 10px;
    top: -5px;
    right: -5px;
  }
}
/* 修改玩家手牌容器样式为直线排列 */
#player-hand-0 {
  height: 100px;
  margin-top: 10px;
  margin-bottom: 10px;
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

/* 修改手牌样式为直线排列 */
#player-hand-0 .card {
  position: relative; /* 从absolute改为relative */
  margin: 0 -15px 0 0; /* 负margin创建重叠效果 */
  transform: none !important; /* 移除所有变换 */
  transition: transform 0.3s ease, margin 0.3s ease; /* 保留过渡效果 */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* 修改手牌悬停效果 */
#player-hand-0 .card:hover {
  transform: translateY(-15px) !important; /* 仅上移，不旋转 */
  margin: 0 5px !important; /* 悬停时增加间距 */
  z-index: 100 !important;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3), 0 0 15px rgba(255, 215, 0, 0.6);
}

/* 更新玩家手牌容器 */
.player-position-0 .player-hand {
  width: 100%;
  overflow: visible;
}

.hand-container#player-hand-0 {
  position: relative;
  overflow: visible;
  height: 110px;
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: -130px;
}
/* 移动设备上的玩家手牌调整 */
@media (max-width: 768px) {
  /* 增加手牌区域高度 */
  #player-hand-0 {
    height: 120px; /* 从100px增加到120px */
  }
  
  #player-hand-0 .card {
    width: 55px; /* 增加牌宽度从45px到55px */
    height: 83px; /* 相应调整高度 */
    margin-bottom: 5px;
  }
  
  
  /* 调整整个玩家区域 */
  .player-position-0 {
    bottom: 80px; /* 稍微上移，留出更多空间给手牌 */
    height: 140px; /* 增加高度 */
    }

    .player-box#player-box-0 {
    padding: 5px;
    min-height: 0;
    width: 60%;
    height: 100%;
    margin-left: -50px; /* Center horizontally */
    margin-right: auto; /* Center horizontally */
    /* If vertical centering is also needed within player-position-0, more complex flex/grid might be required depending on parent setup */
    }

    /* 改进手牌悬停效果，减小上升高度 */
    #player-hand-0 .card:hover {
    transform: translateY(-10px) scale(1.05) !important;
    }
  }

  /* 超小屏设备额外优化 */
@media (max-width: 480px) {
  #player-hand-0 {
    height: 80px;
  }
  
  #player-hand-0 .card {
    width: 35px;
    height: 53px;
    font-size: 12px; /* 减小字体 */
  }
  
  /* 缩小花色图标 */
  #player-hand-0 .card .card-suit {
    font-size: 20px;
  }
  
  /* 缩小牌值文字 */
  #player-hand-0 .card .card-value,
  #player-hand-0 .card .card-value-bottom {
    font-size: 12px;
  }
}
@media (max-width: 768px) {
  .dragon-card-river {
    margin-top: 90px; /* 对于平板设备稍微调整 */
    height: 100px;
  }
  
  /* 调整牌河中的卡牌大小 */
  .dragon-card-river .card {
    width: 45px;
    height: 68px;
  }
}

@media (max-width: 480px) {
  .dragon-card-river {
    margin-top: 100px; /* 在手机上稍微降低，避免与顶部玩家区域重叠 */
    height: 80px;
  }
  
  .dragon-card-river .card {
    width: 35px;
    height: 53px;
  }
  
  .dragon-card-river .card .card-value,
  .dragon-card-river .card .card-value-bottom {
    font-size: 12px;
  }
  
  .dragon-card-river .card .card-suit {
    font-size: 20px;
  }
}
/* 修复控制面板在移动设备上的显示 */
@media (max-width: 768px) {
  .control-panel {
    padding: 5px;
  }
  
  .dragon-btn {
    padding: 6px 12px;
    font-size: 14px;
  }
}
/* 移动设备上的牌河优化 */
@media (max-width: 768px) {
  .dragon-card-river {
    width: 100%;
    height: 130px;
  }
  
  /* 调整叠放距离 */
  .dragon-card-river .card:nth-child(1) { transform: rotate(-15deg) translateX(-50px); }
  .dragon-card-river .card:nth-child(2) { transform: rotate(-10deg) translateX(-40px); }
  .dragon-card-river .card:nth-child(3) { transform: rotate(-5deg) translateX(-20px); }
  .dragon-card-river .card:nth-child(4) { transform: rotate(0deg) translateX(0); }
  .dragon-card-river .card:nth-child(5) { transform: rotate(5deg) translateX(20px); }
  .dragon-card-river .card:nth-child(6) { transform: rotate(10deg) translateX(40px); }
  .dragon-card-river .card:nth-child(7) { transform: rotate(15deg) translateX(50px); }
  
  .dragon-card-river .card:nth-child(n+8) {
    transform: rotate(calc(15deg + var(--rot, 0deg))) translateX(calc(50px + var(--x, 0px)));
  }
  
  /* 减小卡牌大小 */
  .dragon-card-river .card {
    width: 45px;
    height: 68px;
  }
  
  /* 手牌交叠优化 */
  #player-hand-0 .card {
    --overlap: 40px; /* 增加重叠度 */
  }
}

/* 超小屏幕设备的极限优化 */
@media (max-width: 480px) {
  .dragon-card-river {
    width: 100%;
    height: 140px;
  }
  
  /* 调整叠放距离 */
  .dragon-card-river .card:nth-child(1) { transform: rotate(-15deg) translateX(-35px); }
  .dragon-card-river .card:nth-child(2) { transform: rotate(-10deg) translateX(-25px); }
  .dragon-card-river .card:nth-child(3) { transform: rotate(-5deg) translateX(-15px); }
  .dragon-card-river .card:nth-child(4) { transform: rotate(0deg) translateX(0); }
  .dragon-card-river .card:nth-child(5) { transform: rotate(5deg) translateX(15px); }
  .dragon-card-river .card:nth-child(6) { transform: rotate(10deg) translateX(25px); }
  .dragon-card-river .card:nth-child(7) { transform: rotate(15deg) translateX(35px); }
  
  .dragon-card-river .card:nth-child(n+8) {
    transform: rotate(calc(15deg + var(--rot, 0deg))) translateX(calc(35px + var(--x, 0px)));
  }
  
  /* 减小卡牌大小 */
  .dragon-card-river .card {
    width: 35px;
    height: 53px;
  }
  
  /* 手牌交叠优化 */
  #player-hand-0 .card {
    --overlap: 45px; /* 更大的重叠度 */
  }
}
/* 调整游戏分数和最高分的容器样式 */
.dragon-game-header .game-info {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px; /* 控制两个元素之间的间距 */
  background-color: rgba(0, 0, 0, 0.5);
  padding: 6px 15px;
  border-radius: 8px;
  margin: 10px auto;
  width: fit-content;
}

/* 分数样式 */
.game-score {
  color: #ffdd00; /* 金色 */
  font-weight: bold;
  font-size: 16px;
  /* text-shadow: 0 0 5px rgba(0, 0, 0, 0.8); */
}

/* 最高分样式 */
.game-high-score {
  color: #ff9900; /* 橙色 */
  font-weight: bold;
  font-size: 16px;
  /* text-shadow: 0 0 5px rgba(0, 0, 0, 0.8); */
}

/* 数字样式加强 */
/* .game-score span,
.game-high-score span {
  display: inline-block;
  background-color: rgba(0, 0, 0, 0.3);
  padding: 0 5px;
  border-radius: 4px;
  margin-left: 5px;
  min-width: 40px;
  text-align: center;
} */

/* 移动设备适配 */
@media (max-width: 480px) {
  .dragon-game-header .game-info {
    gap: 10px;
    padding: 4px 10px;
  }
  
  .game-score, .game-high-score {
    font-size: 14px;
  }
}
/* 为图图(玩家1)添加背景图片 */
.player-box#player-box-1 {
  background-image: url('./image/poke/图图.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}

/* 为壮壮(玩家2)添加背景图片 */
.player-box#player-box-2 {
  background-image: url('./image/poke/壮壮.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}

/* 添加半透明覆盖层，确保文字内容可见 */
.player-box#player-box-1::before,
.player-box#player-box-2::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.1); /* 半透明黑色覆盖 */
  border-radius: 10px; /* 保持与框相同的圆角 */
  z-index: 1;
}

/* 确保内容显示在背景和覆盖层上方 */
.player-box#player-box-1 > *,
.player-box#player-box-2 > * {
  position: relative;
  z-index: 2;
}

/* 移动设备适配调整 */
@media (max-width: 768px) {
  /* 保留背景图但调整容器样式 */
  .player-box#player-box-1, 
  .player-box#player-box-2 {
    background-color: transparent; /* 移除原来的背景色 */
  }
}
/* 添加到现有CSS文件末尾 */

/* 新出的牌高亮效果 */
.card.new-card {
  box-shadow: 0 0 15px gold;
  animation: pulseGlow 1.5s infinite;
  z-index: 200;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 15px gold; }
  50% { box-shadow: 0 0 25px gold, 0 0 40px gold; }
  100% { box-shadow: 0 0 15px gold; }
}

/* 匹配的牌对高亮效果 */
.card.matched-pair {
  box-shadow: 0 0 20px #ff4500;
  animation: matchPulse 0.6s infinite alternate;
  z-index: 200;
}

@keyframes matchPulse {
  0% { box-shadow: 0 0 10px #ff4500; transform: scale(1); }
  100% { box-shadow: 0 0 25px #ff4500, 0 0 40px #ff4500; transform: scale(1.1); }
}

/* 匹配连接线动画 */
.card-match-connection {
  position: fixed;
  height: 3px;
  background-color: #ff4500;
  box-shadow: 0 0 8px #ff4500;
  z-index: 199;
  opacity: 0;
  animation: connectionFadeIn 0.4s forwards;
}

@keyframes connectionFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* AI出牌动画 */
.ai-play-card-animation .card {
  transition: transform 0.5s ease;
}

.ai-play-card-animation .card.flipped {
  transform: rotateY(180deg);
}

/* 收集牌飞向玩家动画 */
.collect-animation-container .card {
  position: absolute;
  transition: all 0.3s ease;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}
/* 魔法卡风格的牌背 */
.card.back {
  background-color: #2c0055; /* 深紫色背景 */
  background-image: 
    radial-gradient(circle at center, rgba(128, 0, 255, 0.2) 0%, transparent 70%), 
    linear-gradient(135deg, rgba(75, 0, 130, 0.8) 0%, rgba(25, 0, 60, 0.8) 100%);
  position: relative;
  overflow: hidden;
  border: none !important;
  box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

/* 简单的扑克牌背面样式 */
.card.back {
  background-color: #bd4b4b; /* 经典红色 */
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.1) 5px,
    transparent 5px,
    transparent 10px
  );
  border: 1px solid #800000; /* 深红色边框 */
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
}

/* 添加一个简单的内边框效果 */
.card.back::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  right: 5px;
  bottom: 5px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  pointer-events: none; /* 确保不影响交互 */
}



/* 删除覆盖层 */
.player-box#player-box-1::before,
.player-box#player-box-2::before {
  display: none !important;
}

/* 简化卡牌背面特效，为玩家1和2的卡牌使用简单背景 */
#player-hand-1 .card.back,
#player-hand-2 .card.back {
  background: none !important;
  animation: none !important;
}

/* 移除复杂的背面效果 */
#player-hand-1 .card.back::before,
#player-hand-2 .card.back::before,
#player-hand-1 .card.back::after,
#player-hand-2 .card.back::after {
  display: none !important;
}

/* 移除旋转效果 */
#player-hand-1 .card.back:nth-child(odd),
#player-hand-1 .card.back:nth-child(even),
#player-hand-2 .card.back:nth-child(odd),
#player-hand-2 .card.back:nth-child(even) {
  --rotation: 0deg !important;
  transform: none !important;
}