:root {
  --bg-color: #2d5a27; /* 经典扑克桌绿色 */
  --text-color: #ffffff;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

/* ========== 屏幕切换逻辑 ========== */
.screen {
  display: none;
  width: 100%;
  max-width: 900px;
  text-align: center;
  padding: 20px;
  box-sizing: border-box;
}

.screen.active {
  display: block;
}

h1, h2, h3 {
  margin-top: 0;
}

/* ========== 通用弹框样式 (验证界面 & 设置界面) ========== */
.setup-box {
  background: rgba(0, 0, 0, 0.3);
  padding: 30px;
  border-radius: 10px;
  margin: 30px auto;
  max-width: 400px;
}

select, button {
  font-size: 16px;
  padding: 10px;
  margin-top: 15px;
  border-radius: 5px;
  border: none;
  box-sizing: border-box;
}

button {
  background-color: #f39c12;
  color: white;
  cursor: pointer;
  font-weight: bold;
  width: 100%;
  transition: background-color 0.2s;
}

button:hover { 
  background-color: #e67e22; 
}

.rules { 
  font-size: 14px; 
  color: #ccc; 
  margin-top: 20px; 
}

/* ========== 验证界面专属样式 ========== */
.input-group {
  margin-bottom: 20px;
  text-align: left;
}

.input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  font-size: 14px;
}

.input-group input {
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  border-radius: 5px;
  border: 1px solid #ccc;
  font-size: 16px;
  background-color: #f9f9f9;
  color: #333;
}

.captcha-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

#captcha-canvas {
  background: #fff;
  border-radius: 4px;
  border: 1px solid #ccc;
  cursor: pointer;
}

#refresh-captcha {
  cursor: pointer;
  font-size: 24px;
  user-select: none;
  transition: transform 0.2s;
}

#refresh-captcha:hover {
  transform: rotate(180deg);
}

.error-msg {
  color: #ff6b6b;
  display: none;
  margin-top: 15px;
  font-size: 14px;
  font-weight: bold;
  text-align: center;
}

/* ========== 游戏主界面样式 ========== */
#message-board {
  background-color: #111;
  color: #f1c40f;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 18px;
  font-weight: bold;
  margin: 10px auto 30px;
  display: inline-block;
}

#ai-players-container {
  display: flex;
  justify-content: space-around;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.player-area {
  background: rgba(0, 0, 0, 0.2);
  padding: 15px;
  border-radius: 10px;
  margin: 10px;
  min-width: 200px;
  transition: all 0.3s;
}

.player-area.active-turn {
  background: rgba(243, 156, 18, 0.4);
  box-shadow: 0 0 15px #f39c12;
}

/* ========== 扑克牌核心样式 ========== */
.hand {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: -30px; /* 卡牌叠放的视觉效果 */
}

.card {
  width: 50px;
  height: 70px;
  background-color: white;
  border-radius: 5px;
  border: 1px solid #ccc;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  font-weight: bold;
  margin-left: -25px; /* 让后面的牌叠在前面的牌上 */
  box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
  user-select: none;
}

.hand .card:first-child { 
  margin-left: 0; 
}

.card.red { color: #e74c3c; }
.card.black { color: #2c3e50; }

.card.back {
  background-color: #2980b9;
  background-image: repeating-linear-gradient(
    45deg, 
    transparent, 
    transparent 5px, 
    rgba(255, 255, 255, 0.2) 5px, 
    rgba(255, 255, 255, 0.2) 10px
  );
  color: transparent;
}

/* ========== 交互动效 ========== */
.card.clickable { 
  cursor: pointer; 
}

.card.clickable:hover { 
  transform: translateY(-15px); 
}

.card.player-card:hover { 
  transform: translateY(-10px); 
}