/* ========== 变量与重置 ========== */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #c7d2fe;
  --accent: #818cf8;
  --bg-gradient-start: #f1f5f9;
  --bg-gradient-end: #e2e8f0;
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.7);
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  color: var(--text-primary);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--bg-gradient-start) 0%, #dbeafe 50%, var(--bg-gradient-end) 100%);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ========== 动画 ========== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes gentleFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(2deg); }
}

/* ========== 玻璃态卡片 ========== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  max-width: 480px;
  width: 100%;
  animation: fadeInUp 0.6s ease-out;
}

/* ========== 排版 ========== */
.title {
  font-size: 2.6rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -1px;
  color: var(--text-primary);
}

.subtitle {
  font-size: 1.1rem;
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 28px;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.25);
  transition: all 0.25s ease;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.btn-small {
  width: auto;
  padding: 10px 20px;
  font-size: 0.95rem;
}

/* ========== 邀请链接区域 ========== */
.invite-box {
  background: rgba(255, 255, 255, 0.5);
  border: 1px dashed #94a3b8;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin: 14px 0;
  word-break: break-all;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.invite-box:hover {
  background: rgba(255, 255, 255, 0.75);
  border-color: var(--primary);
}

/* ========== 玩家状态卡片 ========== */
.player-list {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 24px 0;
}

.player-card {
  flex: 1;
  max-width: 160px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-sm);
  padding: 20px 12px;
  text-align: center;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.player-card.online {
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.1);
}

.player-card.waiting {
  border-color: rgba(148, 163, 184, 0.3);
  background: rgba(255, 255, 255, 0.3);
}

.player-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.player-card.online .player-avatar {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
}

.player-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.player-status {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ========== 状态标签 ========== */
.status-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  margin: 8px 0;
}

.status-waiting {
  background: rgba(251, 191, 36, 0.15);
  color: #b45309;
}

.status-ready {
  background: rgba(52, 211, 153, 0.15);
  color: #047857;
}

.status-error {
  background: rgba(248, 113, 113, 0.12);
  color: #b91c1c;
}

/* ========== 提示信息 ========== */
.hint {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 20px;
  line-height: 1.6;
}

/* ========== 房间号展示 ========== */
.room-id {
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 5px;
  color: var(--primary-dark);
  margin: 10px 0 18px;
  font-family: 'Courier New', monospace;
}

/* ========== 顶部装饰 ========== */
.decoration-icon {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 10px;
  animation: gentleFloat 4s ease-in-out infinite;
  opacity: 0.7;
}

/* ========== 页脚 ========== */
.footer {
  margin-top: 32px;
  text-align: center;
  font-size: 0.8rem;
  color: #94a3b8;
}

/* ========== 加载动画 ========== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
}

.loading-dot {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: pulse 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

/* ========== 隐藏类 ========== */
.hidden { display: none !important; }

/* ========== 游戏页面布局 ========== */
.game-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.game-header-left,
.game-header-center,
.game-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.game-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.room-tag {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
  background: rgba(0, 0, 0, 0.04);
  padding: 4px 12px;
  border-radius: 20px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.btn-icon:hover {
  background: rgba(0, 0, 0, 0.1);
}

.btn-text {
  padding: 6px 14px;
  border-radius: 20px;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-text:hover {
  background: rgba(0, 0, 0, 0.1);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
}

.status-dot.offline {
  background: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2);
}

.game-main {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 8px 12px;
}

.game-board {
  flex: 1;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  position: relative;
  padding: 8px 12px 0;
}

/* ========== 玩法介绍下拉 ========== */
.rules-dropdown {
  flex-shrink: 0;
  padding: 8px 16px 0;
  max-height: 30vh;
  overflow-y: auto;
}

.rules-content {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(12px);
}

.rules-text {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* ========== 表情互动区 ========== */
.emoji-bar {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 8px 16px 12px;
  flex-shrink: 0;
}

.emoji-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  font-size: 1.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.emoji-btn:hover {
  transform: translateY(-3px) scale(1.1);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.emoji-btn:active {
  transform: translateY(0) scale(0.95);
}

/* ========== 大表情冒泡动画 ========== */
.emoji-bubble-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}

.emoji-bubble {
  position: absolute;
  font-size: 4rem;
  opacity: 0;
  transform: scale(0.3) translateY(20px);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

.emoji-bubble.show {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.emoji-bubble.fade-out {
  opacity: 0;
  transform: scale(1.2) translateY(-40px);
  transition: all 0.5s ease-out;
}

.self-bubble {
  left: 50%;
  bottom: 120px;
  transform: translateX(-50%) scale(0.3) translateY(20px);
}

.self-bubble.show {
  transform: translateX(-50%) scale(1) translateY(0);
}

.self-bubble.fade-out {
  transform: translateX(-50%) scale(1.2) translateY(-40px);
}

.opponent-bubble {
  left: 50%;
  top: 120px;
  transform: translateX(-50%) scale(0.3) translateY(20px);
}

.opponent-bubble.show {
  transform: translateX(-50%) scale(1) translateY(0);
}

.opponent-bubble.fade-out {
  transform: translateX(-50%) scale(1.2) translateY(-40px);
}

/* ========== 响应式 ========== */
@media (max-width: 900px) {
  .game-main {
    padding: 8px 12px;
  }
}

@media (max-width: 520px) {
  .glass-card {
    padding: 28px 20px;
  }
  .title {
    font-size: 2.2rem;
  }
  .player-list {
    flex-direction: column;
    align-items: center;
  }
  .player-card {
    max-width: 100%;
    width: 100%;
  }
  .btn-action {
    padding: 10px 14px;
    font-size: 0.9rem;
    min-width: 76px;
  }
  .emoji-btn {
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
  }
  .emoji-bubble {
    font-size: 3rem;
  }
}

/* ========== 炸金花游戏区域 ========== */
.poker-table {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex: 1;
  padding: 0;
  gap: 10px;
}

.player-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: var(--radius);
  border: 2px solid transparent;
  transition: all 0.3s ease;
  width: 100%;
  max-width: 420px;
}

.player-area.active-turn {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.opponent-area {
  opacity: 1;
}

.self-area {
  opacity: 1;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.95rem;
}

.player-role {
  font-weight: 700;
  color: var(--text-primary);
}

.player-chips {
  color: var(--text-secondary);
  font-weight: 500;
}

.player-bet {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.card-row-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
}

.card-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.looked-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  font-style: italic;
  color: #ff6b6b;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  border-radius: 4px;
  letter-spacing: 1px;
  z-index: 2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.35);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.card {
  width: 64px;
  height: 90px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.25s ease;
  user-select: none;
}

.card:hover {
  transform: translateY(-4px);
}

.card-back {
  background: repeating-linear-gradient(
    45deg,
    #1a365d,
    #1a365d 6px,
    #234876 6px,
    #234876 12px
  );
  position: relative;
  border: none;
}

.card-back::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 2px;
}

.card-back::after {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.card-back-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.65rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.5px;
  text-align: center;
  line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  z-index: 1;
}

.card-front {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  position: relative;
  padding: 4px;
}

.card-red {
  color: #ef4444;
}

.card-black {
  color: #1e293b;
}

.card-corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.top-left {
  top: 4px;
  left: 4px;
}

.bottom-right {
  bottom: 4px;
  right: 4px;
  transform: rotate(180deg);
}

.card-rank {
  font-size: 0.9rem;
  font-weight: 700;
}

.card-suit-small {
  font-size: 0.75rem;
}

.card-center-suit {
  font-size: 1.6rem;
}

.table-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  position: relative;
  justify-content: center;
}

.table-center-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pot-display {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.5);
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
}

.game-status {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  min-height: 20px;
}

.turn-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
  padding: 4px 10px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 16px;
}

.turn-dot {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
}

.action-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 420px;
  height: 100px;
  min-height: 100px;
  justify-content: center;
  flex-shrink: 0;
  margin: 4px auto;
  padding: 0 16px;
}

.btn-large {
  padding: 16px 36px;
  font-size: 1.1rem;
  max-width: 320px;
}

.action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-action {
  width: auto;
  padding: 12px 20px;
  font-size: 0.95rem;
  min-width: 90px;
}

.btn-action:disabled {
  background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%) !important;
  color: #fff !important;
  box-shadow: none !important;
  cursor: not-allowed;
  transform: none !important;
  opacity: 0.7;
}

.btn-raise {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.25);
}

.btn-fold {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 2px 12px rgba(239, 68, 68, 0.25);
}

.btn-look {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.25);
}

.btn-showdown {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.25);
}

.result-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  padding: 20px 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  z-index: 5;
  border: 1px solid var(--glass-border);
  min-width: 260px;
  max-width: 90%;
  white-space: nowrap;
}

.result-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.result-win { color: #059669; }
.result-lose { color: #dc2626; }
.result-draw { color: var(--primary-dark); }

.result-detail {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

