:root {
  --table-green: #1a7a40;
  --table-dark-green: #0d5c2e;
  --table-border: #2a9d5f;
  --chip-red: #e63946;
  --chip-blue: #2a9d8f;
  --chip-gold: #f4a261;
  --bg-main: #f0f2f5;
  --bg-card: #ffffff;
  --bg-input: #f8f9fa;
  --text-primary: #1a1a2e;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --border-color: #e0e4e8;
  --accent: #2a9d8f;
  --accent-light: #e8f5f3;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
}

/* ========== 登录页 ========== */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #e8f5f3 0%, #f0f2f5 50%, #fdf6ec 100%);
}

.auth-container { width: 100%; max-width: 420px; padding: 20px; }

.auth-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 40px 30px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.auth-title {
  text-align: center;
  color: var(--accent);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 25px;
  font-size: 0.9rem;
}

.nav-tabs { border-bottom: 2px solid var(--border-color); }
.nav-tabs .nav-link { color: var(--text-secondary); border: none; border-radius: 8px 8px 0 0; }
.nav-tabs .nav-link.active { color: var(--accent); background: transparent; border-bottom: 2px solid var(--accent); font-weight: 600; }
.nav-tabs .nav-link:hover { color: var(--text-primary); }

.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 12px 15px;
}
.form-control:focus {
  background: var(--bg-card);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 0 0.2rem rgba(42,157,143,0.15);
}

.form-select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
}
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem rgba(42,157,143,0.15);
}

.btn-primary { background: var(--accent); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: #21867a; border-color: #21867a; }
.btn-success { background: #28a745; border-color: #28a745; }
.btn-success:hover { background: #218838; }
.btn-danger { background: var(--chip-red); border-color: var(--chip-red); }
.btn-warning { background: var(--chip-gold); border-color: var(--chip-gold); color: #fff; }
.btn-secondary { background: #6c757d; border-color: #6c757d; }

/* ========== 大厅页 ========== */
.lobby-container {
  display: grid;
  grid-template-columns: 250px 1fr 300px;
  gap: 20px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.lobby-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 15px 25px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}
.lobby-header h2 { color: var(--accent); font-size: 1.3rem; font-weight: 700; }
.lobby-header .user-info { display: flex; align-items: center; gap: 12px; }
.lobby-header .chips-display {
  color: var(--chip-gold); font-weight: 700; font-size: 1.15rem;
  background: #fef5e7; padding: 4px 12px; border-radius: 20px;
}
.lobby-header .username-display { color: var(--text-secondary); font-weight: 500; }

.panel {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  height: fit-content;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}
.panel h4 {
  color: var(--text-primary); font-size: 1rem; font-weight: 700;
  margin-bottom: 15px; border-bottom: 2px solid var(--border-color); padding-bottom: 10px;
}

.online-list { list-style: none; }
.online-list li {
  padding: 8px 0; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border-color); color: var(--text-primary);
}
.online-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); display: inline-block;
  box-shadow: 0 0 6px rgba(42,157,143,0.4);
}

.room-card {
  background: var(--bg-input);
  border-radius: 10px;
  padding: 15px 20px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}
.room-card:hover {
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}
.room-card .room-code { color: var(--chip-gold); font-weight: 700; font-size: 1.2rem; }
.room-card .room-info { color: var(--text-secondary); font-size: 0.85rem; }
.room-card .room-players { color: var(--accent); font-weight: 600; }
.room-card .room-status-waiting { color: #f4a261; }
.room-card .room-status-playing { color: var(--chip-red); }

.leaderboard-list { list-style: none; }
.leaderboard-list li {
  padding: 8px 0; display: flex; justify-content: space-between;
  border-bottom: 1px solid var(--border-color); font-size: 0.9rem;
  color: var(--text-primary);
}
.leaderboard-list .rank {
  color: var(--chip-gold); font-weight: 700; width: 25px;
  background: #fef5e7; text-align: center; border-radius: 6px;
}
.leaderboard-list .name { flex: 1; margin-left: 8px; }
.leaderboard-list .profit-positive { color: var(--accent); font-weight: 600; }
.leaderboard-list .profit-negative { color: var(--chip-red); font-weight: 600; }

/* ========== 牌桌页 ========== */
.game-body {
  margin: 0; overflow: hidden; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg-main);
}

.game-topbar {
  background: var(--bg-card);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}
.game-topbar .room-info { color: var(--text-secondary); font-size: 0.85rem; }
.game-topbar .btn-outline-secondary {
  border-color: #adb5bd;
  color: #495057;
  background: transparent;
}
.game-topbar .btn-outline-secondary:hover {
  background: #495057;
  color: #fff;
  border-color: #495057;
}
.game-topbar .phase-badge {
  padding: 4px 12px; border-radius: 20px; font-size: 0.8rem;
  font-weight: 600; text-transform: uppercase;
}
.phase-WAITING { background: #e9ecef; color: #6c757d; }
.phase-PREFLOP { background: #d1ecf1; color: #0c5460; }
.phase-FLOP { background: #fff3cd; color: #856404; }
.phase-TURN { background: #ffe5cc; color: #b35900; }
.phase-RIVER { background: #f8d7da; color: #721c24; }
.phase-SHOWDOWN { background: #f5b7b1; color: #721c24; }

/* ========== 游戏区域：简洁布局 ========== */
.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 12px 8px;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  background: linear-gradient(180deg, #f5f7fa 0%, #e8ecef 100%);
}

/* 对手区域：顶部横向排列 */
.opponents-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 4px;
  min-height: 140px;
  width: 100%;
  box-sizing: border-box;
}

/* 中间区域：公牌 + 底池 + 牌型 */
.center-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 4px;
  background: linear-gradient(135deg, #1a7a40 0%, #0d5c2e 100%);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(13, 92, 46, 0.2);
  min-height: 180px;
  position: relative;
  margin: 0 auto;
  width: 100%;
  max-width: 720px;
}

.pot-display {
  color: #ffd700;
  font-size: 1.1rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  background: rgba(0,0,0,0.25);
  padding: 6px 18px;
  border-radius: 20px;
  z-index: 10;
}

.community-cards {
  display: flex;
  gap: 8px;
  z-index: 10;
  padding: 4px;
}

.community-card-placeholder {
  width: 56px;
  height: 80px;
  border-radius: 6px;
  border: 2px dashed rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.05);
}

.hand-type-hint {
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  z-index: 11;
  border: 1px solid rgba(255, 215, 0, 0.3);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* 我自己的座位：固定在操作栏上方 */
.my-seat-area {
  display: flex;
  justify-content: center;
  padding: 4px;
  width: 100%;
  box-sizing: border-box;
  min-height: 150px;
}

/* ========== 扑克牌 ========== */
.poker-card {
  width: 56px;
  height: 80px;
  border-radius: 6px;
  background: #fff;
  display: flex;
  flex-direction: column;
  padding: 4px;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  font-family: 'Georgia', serif;
  font-weight: bold;
  position: relative;
  border: 1px solid #dee2e6;
  animation: cardDeal 0.3s ease-out;
  flex-shrink: 0;
}

@keyframes cardDeal {
  from { transform: translateY(-30px) rotate(180deg); opacity: 0; }
  to { transform: translateY(0) rotate(0deg); opacity: 1; }
}

.poker-card.card-back {
  background: linear-gradient(135deg, #2a4d7a, #3a6db0);
  border: 2px solid #4a7dc0;
}
.card-back-pattern {
  width: 100%; height: 100%;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(255,255,255,0.15) 4px, rgba(255,255,255,0.15) 8px);
  border-radius: 4px;
}

.card-red { color: #e63946; }
.card-black { color: #1a1a2e; }

.card-corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  position: absolute;
}
.card-corner-tl {
  top: 3px; left: 4px;
}
.card-corner-br {
  bottom: 3px; right: 4px;
  transform: rotate(180deg);
}
.card-rank {
  font-size: 0.85rem;
  font-weight: 700;
}
.card-suit {
  font-size: 0.75rem;
  line-height: 1;
}
.card-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  line-height: 1;
  margin-top: 2px;
}

/* ========== 玩家座位卡片 ========== */
.player-seat {
  width: 140px;
  background: #fff;
  border-radius: 12px;
  padding: 10px 8px 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  text-align: center;
  transition: all 0.3s;
  position: relative;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.player-seat.is-turn {
  border-color: var(--chip-gold);
  box-shadow: 0 0 20px rgba(244,162,97,0.5);
  animation: pulseTurn 1.5s infinite;
}

@keyframes pulseTurn {
  0%, 100% { box-shadow: 0 0 15px rgba(244,162,97,0.4), 0 2px 10px rgba(0,0,0,0.08); }
  50% { box-shadow: 0 0 25px rgba(244,162,97,0.8), 0 2px 10px rgba(0,0,0,0.08); }
}

.player-seat.is-folded { opacity: 0.5; }
.player-seat.is-paused { opacity: 0.8; }
.player-seat.is-paused .player-avatar {
  border-color: #f39c12;
  box-shadow: 0 0 10px rgba(243, 156, 18, 0.5);
}
.player-seat.is-paused::after {
  content: '暂停中';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #f39c12;
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  z-index: 10;
  animation: pulsePause 1.5s infinite;
}

@keyframes pulsePause {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1; box-shadow: 0 0 10px rgba(243, 156, 18, 0.5); }
}

.player-seat.is-disconnected { opacity: 0.6; }
.player-seat.is-disconnected .player-avatar {
  border-color: #e67e22;
  box-shadow: 0 0 10px rgba(230, 126, 34, 0.5);
  animation: pulseDisconnect 1s infinite;
}
.player-seat.is-disconnected::after {
  content: '断线中';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #e67e22;
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  z-index: 10;
}

@keyframes pulseDisconnect {
  0%, 100% { box-shadow: 0 0 10px rgba(230, 126, 34, 0.4); }
  50% { box-shadow: 0 0 18px rgba(230, 126, 34, 0.8); }
}

.player-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 6px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  border: 3px solid #e0e0e0;
  transition: all 0.3s;
  position: relative;
}

.player-seat.is-dealer .player-avatar::after {
  content: 'D';
  position: absolute;
  top: -4px;
  right: -4px;
  background: #fff;
  color: #1a1a2e;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #1a1a2e;
}

.player-name {
  font-size: 0.8rem;
  color: #333;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.me-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 6px;
  margin-left: 4px;
  font-weight: 600;
}

.player-chips {
  font-size: 0.85rem;
  color: var(--chip-gold);
  font-weight: 600;
  margin-bottom: 2px;
}

.player-bet {
  font-size: 0.75rem;
  color: #15803d;
  min-height: 16px;
  font-weight: 500;
}

.player-action-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 0.65rem;
  margin-left: 4px;
  white-space: nowrap;
}

.player-hole-cards {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 6px;
  margin-bottom: 4px;
  min-height: 56px;
}

.player-hole-cards .poker-card {
  width: 42px;
  height: 58px;
  padding: 2px;
}

.player-hole-cards .poker-card .card-center {
  font-size: 1.3rem;
}

.player-hole-cards .poker-card .card-rank {
  font-size: 0.65rem;
}

.player-hole-cards .poker-card .card-suit {
  font-size: 0.6rem;
}

/* ========== 操作栏 ========== */
.action-bar {
  background: var(--bg-card);
  padding: 15px 25px;
  display: flex; gap: 15px; justify-content: center; align-items: center;
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
.action-bar .btn { min-width: 110px; padding: 10px 20px; font-weight: 600; border-radius: 8px; }

.raise-controls { display: flex; align-items: center; gap: 10px; }
.raise-controls input[type="range"] { width: 150px; }
.raise-amount {
  color: var(--chip-gold); font-weight: 700; min-width: 60px; text-align: center;
  background: #fef5e7; padding: 4px 10px; border-radius: 8px;
}

.action-timer {
  width: 100%; height: 4px; background: var(--border-color);
  border-radius: 2px; margin-top: 10px; overflow: hidden;
}
.action-timer-bar {
  height: 100%; background: var(--chip-gold); width: 100%;
  transition: width 1s linear;
}

/* ========== 聊天 ========== */
.chat-panel {
  position: fixed; right: 0; top: 50px; bottom: 0; width: 300px;
  background: var(--bg-card);
  display: flex; flex-direction: column;
  z-index: 5;
  border-left: 1px solid var(--border-color);
  box-shadow: -4px 0 10px rgba(0,0,0,0.05);
  transition: transform 0.3s ease;
  transform: translateX(0);
}
.chat-panel.collapsed { transform: translateX(100%); }
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  color: var(--text-primary);
  background: #fafbfc;
}
.chat-close-btn {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
}
.chat-close-btn:hover {
  background: #eee;
  color: var(--chip-red);
}
.chat-messages { flex: 1; overflow-y: auto; padding: 15px; }
.chat-message-item { margin-bottom: 8px; font-size: 0.85rem; color: var(--text-primary); }
.chat-message-item .chat-name { color: var(--accent); font-weight: 600; }
.chat-message-item .chat-text { color: var(--text-primary); }
.chat-input-area { padding: 10px; border-top: 1px solid var(--border-color); display: flex; gap: 8px; }
.chat-input-area input { flex: 1; }

/* ========== Toast ========== */
.toast-message {
  position: fixed; top: 20px; left: 50%;
  transform: translate(-50%, -20px);
  padding: 12px 25px; border-radius: 8px;
  font-weight: 600; z-index: 9999;
  opacity: 0; transition: all 0.3s;
  box-shadow: var(--shadow-md);
}
.toast-message.show { opacity: 1; transform: translate(-50%, 0); }
.toast-info { background: var(--accent); color: #fff; }
.toast-success { background: #28a745; color: #fff; }
.toast-error { background: var(--chip-red); color: #fff; }

/* ========== 结算弹窗 ========== */
.result-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; animation: fadeIn 0.3s;
  padding: 20px;
  overflow-y: auto;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.result-card {
  background: var(--bg-card); border-radius: 16px;
  padding: 30px 40px; text-align: center;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}
.result-card h3 { color: var(--chip-gold); margin-bottom: 20px; }
.result-card .winner-name { color: var(--accent); font-size: 1.5rem; font-weight: 700; }
.result-card .winner-hand { color: var(--text-secondary); margin: 5px 0; }
.result-card .winner-pot { color: var(--chip-gold); font-size: 1.3rem; margin: 10px 0; font-weight: 700; }
.result-card .player-deltas { margin-top: 15px; text-align: left; max-height: 200px; overflow-y: auto; }
.result-card .delta-row {
  display: flex; justify-content: space-between;
  padding: 4px 0; font-size: 0.9rem; color: var(--text-primary);
}
.delta-positive { color: var(--accent); font-weight: 600; }
.delta-negative { color: var(--chip-red); font-weight: 600; }

/* ========== Modal ========== */
.modal-content {
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border-color); border-radius: 12px;
}
.modal-header { border-bottom: 1px solid var(--border-color); }
.modal-footer { border-top: 1px solid var(--border-color); }
.modal-title { color: var(--accent); font-weight: 700; }
.form-label { color: var(--text-secondary); font-weight: 500; }

.chips-preset { font-weight: 600; }

.text-muted { color: var(--text-muted) !important; }
.text-end { text-align: right; }

/* ========== 响应式 - 平板 ========== */
@media (max-width: 1024px) {
  .lobby-container {
    grid-template-columns: 200px 1fr 250px;
    gap: 15px;
    padding: 15px;
  }

  .opponents-row {
    gap: 8px;
  }
  .player-seat { width: 125px; }
  .poker-card { width: 48px; height: 68px; }
  .community-card-placeholder { width: 48px; height: 68px; }
  .player-hole-cards .poker-card { width: 36px; height: 50px; }
  .player-hole-cards { min-height: 52px; }
}

/* ========== 响应式 - 手机 ========== */
@media (max-width: 768px) {
  /* 登录页 */
  .auth-container { padding: 15px; }
  .auth-card { padding: 25px 20px; border-radius: 12px; }
  .auth-title { font-size: 1.5rem; }

  /* 大厅页 - 单列布局 */
  .lobby-container {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }
  .lobby-header {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 15px;
  }
  .lobby-header h2 { font-size: 1.1rem; }
  .lobby-header .user-info {
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    justify-content: flex-start;
  }
  .lobby-header .chips-display { font-size: 1rem; padding: 3px 10px; }
  .panel { padding: 15px; }
  .room-card { padding: 12px 15px; }
  .room-card .room-code { font-size: 1rem; }

  /* 游戏页 - 紧凑布局 */
  .game-topbar {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .game-topbar .room-info { font-size: 0.75rem; flex-wrap: wrap; }
  .game-topbar .phase-badge { font-size: 0.7rem; padding: 3px 8px; }

  /* 牌桌自适应 - 使用min()确保牌桌在视口内完整显示 */
  .poker-table-container { padding: 0; }
  .poker-table {
    width: min(92vw, 75vh);
    max-width: 100%;
    border-width: 4px;
  }
  #playerSeats {
    width: min(92vw, 75vh);
    max-width: 100%;
  }
  .community-cards { gap: 3px; transform: translate(-50%, -55%); }
  .pot-display { font-size: 0.85rem; transform: translate(-50%, 35%); }
  .hand-type-hint { 
    font-size: 0.75rem; 
    padding: 4px 10px;
    bottom: 8px;
  }

  /* 扑克牌 - 适当放大以保持可读性 */
  .poker-card { width: 32px; height: 45px; padding: 2px; }
  .card-rank { font-size: 0.55rem; }
  .card-suit { font-size: 0.5rem; }
  .card-center { font-size: 1.2rem; margin-top: 0; }
  .community-card-placeholder { width: 32px; height: 45px; }

  /* 玩家座位紧凑 - 使用相对定位适配牌桌 */
  .player-seat { width: 72px; z-index: 1; }
  .player-avatar {
    width: 32px; height: 32px; font-size: 0.8rem;
    border-width: 2px;
  }
  .player-name { font-size: 0.62rem; }
  .player-chips { font-size: 0.65rem; }
  .player-bet { font-size: 0.55rem; min-height: 12px; }
  .player-hole-cards { gap: 2px; min-height: 32px; margin-bottom: 3px; }
  .player-hole-cards .poker-card { width: 24px; height: 34px; padding: 1px; }
  .player-hole-cards .poker-card .card-center { font-size: 0.8rem; }
  .player-hole-cards .poker-card .card-rank { font-size: 0.4rem; }
  .player-hole-cards .poker-card .card-suit { font-size: 0.38rem; }
  .player-action-badge { font-size: 0.55rem; padding: 1px 5px; top: -5px; }

  /* 座位位置 - 使用百分比适配牌桌大小，远离公牌区域 */
  .seat-0 { bottom: 2%; left: 50%; transform: translateX(-50%); }
  .seat-1 { bottom: 22%; right: 2%; }
  .seat-2 { top: 22%; right: 2%; }
  .seat-3 { top: 2%; left: 50%; transform: translateX(-50%); }
  .seat-4 { top: 22%; left: 2%; }
  .seat-5 { bottom: 22%; left: 2%; }

  /* 操作栏紧凑 */
  .action-bar {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .action-bar .btn {
    min-width: 70px;
    padding: 8px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
  }
  .raise-controls { gap: 6px; flex-wrap: wrap; justify-content: center; }
  .raise-controls input[type="range"] { width: 100px; }
  .raise-amount { font-size: 0.85rem; min-width: 50px; padding: 2px 8px; }

  /* 聊天面板 - 底部弹出 */
  .chat-panel {
    position: fixed;
    right: 0; left: 0; bottom: 0;
    width: 100%;
    height: 45vh;
    max-height: 320px;
    top: auto;
    border-left: none;
    border-top: 1px solid var(--border-color);
    border-radius: 12px 12px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  }
  .chat-panel.collapsed {
    transform: translateY(100%);
  }
  .chat-panel .chat-header {
    background: var(--bg-card);
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid var(--border-color);
  }

  /* 结算弹窗 */
  .result-card {
    min-width: auto;
    width: 95%;
    max-width: 360px;
    padding: 20px;
    max-height: calc(100vh - 20px);
  }
  .result-card h3 { font-size: 1.2rem; }
  .result-card .winner-name { font-size: 1.2rem; }

  /* 战绩统计 */
  .room-stats-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .player-stat-card {
    padding: 10px 8px;
  }
  .stats-summary {
    font-size: 0.75rem;
  }
  .stats-summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .summary-value {
    font-size: 1.2rem;
  }
  .room-stat-details {
    gap: 8px;
    font-size: 0.7rem;
  }

  /* Toast */
  .toast-message { max-width: 90%; font-size: 0.85rem; padding: 10px 18px; }

  /* Modal */
  .modal-dialog { margin: 10px; max-width: calc(100% - 20px); }
}

/* ========== 响应式 - 小屏手机 ========== */
@media (max-width: 480px) {
  .poker-table-container { padding: 0; }
  .poker-table {
    width: min(95vw, 78vh);
    max-width: 100%;
    border-width: 3px;
  }
  #playerSeats {
    width: min(95vw, 78vh);
    max-width: 100%;
  }

  .player-seat { width: 64px; z-index: 1; }
  .player-avatar { width: 28px; height: 28px; font-size: 0.7rem; }
  .player-name { font-size: 0.55rem; }
  .player-chips { font-size: 0.6rem; }
  .player-hole-cards { gap: 1px; min-height: 26px; margin-bottom: 2px; }
  .player-hole-cards .poker-card { width: 20px; height: 28px; padding: 1px; }
  .player-hole-cards .poker-card .card-center { font-size: 0.7rem; }
  .player-hole-cards .poker-card .card-rank { font-size: 0.35rem; }
  .player-hole-cards .poker-card .card-suit { font-size: 0.32rem; }

  .poker-card { width: 28px; height: 40px; }
  .community-card-placeholder { width: 28px; height: 40px; }
  .hand-type-hint { 
    font-size: 0.7rem; 
    padding: 3px 8px;
    bottom: 6px;
  }

  /* 小屏座位位置 */
  .seat-0 { bottom: 2%; left: 50%; transform: translateX(-50%); }
  .seat-1 { bottom: 22%; right: 2%; }
  .seat-2 { top: 22%; right: 2%; }
  .seat-3 { top: 2%; left: 50%; transform: translateX(-50%); }
  .seat-4 { top: 22%; left: 2%; }
  .seat-5 { bottom: 22%; left: 2%; }

  .action-bar { padding: 8px; gap: 6px; }
  .action-bar .btn { min-width: 58px; padding: 7px 10px; font-size: 0.75rem; }
  .raise-controls input[type="range"] { width: 80px; }

  .game-topbar { padding: 6px 10px; }
  .game-topbar .room-info { font-size: 0.7rem; }
}

/* ========== 触摸优化 ========== */
@media (hover: none) {
  .room-card:hover {
    transform: none;
    border-color: transparent;
    background: var(--bg-input);
    box-shadow: none;
  }
  .room-card:active {
    background: var(--accent-light);
    transform: scale(0.98);
  }
  .action-bar .btn:active {
    transform: scale(0.95);
  }
  .poker-card {
    -webkit-tap-highlight-color: transparent;
  }

  /* 防止触摸时的文本选中 */
  .player-seat, .room-card, .action-bar .btn {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
}

/* ========== 安全区域适配（iPhone） ========== */
@supports (padding: max(0px)) {
  .game-body {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .action-bar {
    padding-bottom: max(15px, env(safe-area-inset-bottom));
  }
  .game-topbar {
    padding-top: max(10px, env(safe-area-inset-top));
  }
}

/* ========== 房间卡片座位显示 ========== */
.room-card {
  transition: all 0.2s ease;
}
.room-card.joinable {
  border: 2px solid var(--accent);
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-light) 100%);
}
.room-card.full {
  opacity: 0.7;
}
.room-card-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.room-seats {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}
.seats-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 6px;
}
.seat-occupied {
  color: var(--accent);
  font-size: 14px;
}
.seat-empty {
  color: var(--text-muted);
  font-size: 14px;
}
.join-room-btn {
  margin-left: auto;
}

/* ========== 座位选择器 ========== */
.seat-selector {
  margin: 15px auto;
  max-width: 400px;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 15px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}
.seat-selector-title {
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--text-primary);
}
.seat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.seat-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  border-radius: 8px;
  min-height: 56px;
  font-size: 11px;
  transition: all 0.2s ease;
}
.seat-slot.empty {
  background: #f0f4f8;
  border: 2px dashed var(--border-color);
  cursor: pointer;
  color: var(--text-muted);
}
.seat-slot.empty:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}
.seat-slot.occupied {
  background: var(--accent-light);
  border: 2px solid var(--accent);
  color: var(--accent);
}
.seat-slot.occupied.mine {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.seat-empty-icon {
  font-size: 18px;
  font-weight: bold;
}
.seat-label {
  font-size: 10px;
}
.seat-player-name {
  font-size: 12px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seat-selector-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ========== 我的座位标记 ========== */
.me-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 3px;
}

/* ========== 战绩统计 ========== */
.room-stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.player-stat-card {
  background: #f8f9fa;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.stat-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}
.stat-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 4px 0;
}
.stat-profit {
  font-weight: 700;
  font-size: 1.1rem;
}
.hand-history-list {
  max-height: 400px;
  overflow-y: auto;
}
.hand-history-item {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fafbfc;
}
.hand-header {
  display: flex;
  gap: 10px;
  font-size: 0.85rem;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.hand-number {
  font-weight: 600;
  color: var(--text-primary);
}
.hand-pot {
  color: var(--chip-gold);
  font-weight: 600;
}
.hand-time {
  color: var(--text-muted);
  margin-left: auto;
}
.hand-community {
  margin: 6px 0;
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.mini-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 38px;
  border-radius: 4px;
  background: white;
  border: 1px solid #ccc;
  font-size: 12px;
  font-weight: 600;
}
.mini-card.red { color: #d32f2f; }
.mini-card.black { color: #212121; }
.hand-players {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.hand-player {
  display: inline-block;
  margin-right: 8px;
}
.stats-summary {
  font-size: 0.85rem;
}

/* ========== 个人战绩统计 ========== */
.stats-summary-section {
  margin-bottom: 15px;
}
.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.summary-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  border: 1px solid var(--border-color);
}
.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}
.summary-value.profit-positive,
.profit-positive {
  color: var(--accent) !important;
}
.summary-value.profit-negative,
.profit-negative {
  color: var(--chip-red) !important;
}
.summary-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.room-stats-list {
  max-height: 400px;
  overflow-y: auto;
}
.room-stat-item {
  background: #fafbfc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.room-stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.room-code-label {
  font-weight: 600;
  color: var(--text-primary);
  font-family: monospace;
}
.room-last-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.room-stat-details {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.room-stat-profit {
  font-size: 0.95rem;
  font-weight: 700;
}
.room-profit-detail {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ========== 响应式 - 座位选择器 ========== */
@media (max-width: 768px) {
  .seat-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
  }
  .seat-slot {
    padding: 6px 2px;
    min-height: 48px;
  }
  .seat-player-name {
    font-size: 10px;
  }
  .room-seats {
    gap: 3px;
  }
}
