/* ====== 全局重置 ====== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { 
  width: 100%; 
  height: 100%;
  height: 100dvh;
  height: 100vh; /* 回退 */
  overflow: hidden; 
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  /* 主菜单渐变背景延伸到边缘，消除白条 */
  background: linear-gradient(135deg, #0a1628 0%, #1a0a28 50%, #0a2818 100%);
}

/* ====== 响应式断点系统 ====== */
/* 手机横屏: < 768px && width > height （PRIMARY - 核心设计） */
/* 手机竖屏: < 768px && height > width */
/* 平板: 769px - 1024px */
/* PC端: > 1024px */

/* ====== 屏幕管理 ====== */
.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: flex; }

/* ====== 开始界面 ====== */
#startScreen {
  background: linear-gradient(135deg, #0a1628 0%, #1a0a28 50%, #0a2818 100%);
  flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}

/* 背景渐变 */
.start-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}
.bg-gradient {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(255, 100, 50, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(50, 150, 255, 0.05) 0%, transparent 70%);
  animation: bgPulse 8s ease-in-out infinite;
}
@keyframes bgPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* 粒子星星 */
.particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
}
.particle {
  position: absolute;
  color: #ffd700;
  font-size: 12px;
  opacity: 0;
  animation: sparkle 3s ease-in-out infinite;
}
.p1 { top: 15%; left: 10%; animation-delay: 0s; font-size: 16px; }
.p2 { top: 25%; right: 15%; animation-delay: 0.5s; }
.p3 { top: 60%; left: 8%; animation-delay: 1s; font-size: 14px; }
.p4 { bottom: 30%; right: 10%; animation-delay: 1.5s; }
.p5 { top: 40%; left: 20%; animation-delay: 2s; font-size: 10px; }
.p6 { top: 10%; right: 25%; animation-delay: 0.3s; font-size: 18px; }
.p7 { bottom: 20%; left: 15%; animation-delay: 1.2s; }
.p8 { bottom: 40%; right: 20%; animation-delay: 2.2s; font-size: 14px; }
@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* 飘动的牌花色 */
.floating-cards {
  position: absolute;
  inset: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
}
.float-card {
  position: absolute;
  font-size: 40px;
  opacity: 0.15;
  animation: floatCard 20s linear infinite;
}
.fc1 { top: 10%; left: 5%; color: #e74c3c; animation-duration: 25s; }
.fc2 { top: 60%; left: 8%; color: #e74c3c; animation-duration: 22s; animation-delay: -5s; }
.fc3 { top: 30%; right: 5%; color: #2ecc71; animation-duration: 28s; }
.fc4 { bottom: 15%; right: 10%; color: #3498db; animation-duration: 24s; animation-delay: -10s; }
.fc5 { top: 5%; left: 40%; color: #ffd700; animation-duration: 26s; animation-delay: -15s; font-size: 30px; }
.fc6 { bottom: 25%; left: 25%; color: #9b59b6; animation-duration: 23s; animation-delay: -8s; font-size: 35px; }
@keyframes floatCard {
  0% { transform: translateY(100vh) rotate(0deg); }
  100% { transform: translateY(-100vh) rotate(360deg); }
}

/* 角落装饰 */
.corner-decor {
  position: absolute;
  width: 120px;
  height: 120px;
  opacity: 0.3;
}
.corner-decor::before,
.corner-decor::after {
  content: '';
  position: absolute;
  background: linear-gradient(135deg, #ffd700, transparent);
}
.corner-decor.top-left { top: 20px; left: 20px; }
.corner-decor.top-left::before { width: 60px; height: 3px; top: 0; left: 0; }
.corner-decor.top-left::after { width: 3px; height: 60px; top: 0; left: 0; }
.corner-decor.top-right { top: 20px; right: 20px; }
.corner-decor.top-right::before { width: 60px; height: 3px; top: 0; right: 0; }
.corner-decor.top-right::after { width: 3px; height: 60px; top: 0; right: 0; }
.corner-decor.bottom-left { bottom: 20px; left: 20px; }
.corner-decor.bottom-left::before { width: 60px; height: 3px; bottom: 0; left: 0; }
.corner-decor.bottom-left::after { width: 3px; height: 60px; bottom: 0; left: 0; }
.corner-decor.bottom-right { bottom: 20px; right: 20px; }
.corner-decor.bottom-right::before { width: 60px; height: 3px; bottom: 0; right: 0; }
.corner-decor.bottom-right::after { width: 3px; height: 60px; bottom: 0; right: 0; }

/* 主内容 */
.start-content {
  text-align: center;
  position: relative;
  z-index: 10;
  padding: 20px;
}

/* 皇冠图标 */
.crown-icon {
  font-size: 48px;
  margin-bottom: 10px;
  animation: crownBounce 2s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5));
}
@keyframes crownBounce {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-10px) rotate(5deg); }
}

/* Logo区域 */
.game-logo {
  margin-bottom: 20px;
  position: relative;
}
.logo-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 250px;
  height: 120px;
  background: radial-gradient(ellipse, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
  filter: blur(20px);
  animation: glowPulse 3s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}
.logo-cards {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 15px;
  perspective: 500px;
}
.logo-card {
  width: 70px;
  height: 98px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease;
  position: relative;
  overflow: hidden;
}
.logo-card:hover {
  transform: translateY(-10px) scale(1.05);
}
.logo-card.red {
  background: linear-gradient(145deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  border: 3px solid rgba(255, 255, 255, 0.3);
}
.logo-card.black {
  background: linear-gradient(145deg, #2c3e50 0%, #1a252f 100%);
  color: white;
  border: 3px solid rgba(255, 255, 255, 0.2);
}
.logo-card .card-num {
  font-size: 36px;
  line-height: 1;
}
.logo-card .card-suit {
  font-size: 24px;
  margin-top: 2px;
}
.lc1 { animation: cardHover 3s ease-in-out infinite; }
.lc2 { animation: cardHover 3s ease-in-out infinite 0.2s; transform: translateY(-5px); }
.lc3 { animation: cardHover 3s ease-in-out infinite 0.4s; }
@keyframes cardHover {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.logo-card:hover {
  animation: none;
  transform: translateY(-15px) scale(1.1) rotateZ(5deg);
}

/* 标题 */
.start-content h1 {
  font-size: 52px;
  font-weight: 900;
  background: linear-gradient(135deg, #ffd700 0%, #ffed4a 50%, #ffd700 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  letter-spacing: 6px;
  text-shadow: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  animation: titleGlow 3s ease-in-out infinite;
}
@keyframes titleGlow {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5)); }
  50% { filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.8)); }
}
.subtitle {
  color: #a0c4ff;
  font-size: 18px;
  margin-bottom: 20px;
  letter-spacing: 4px;
  text-shadow: 0 0 10px rgba(100, 180, 255, 0.3);
}

/* 特色标签 */
.feature-tags {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}
.tag {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 100, 50, 0.2));
  border: 1px solid rgba(255, 215, 0, 0.4);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  color: #ffd700;
  animation: tagFloat 4s ease-in-out infinite;
}
.tag:nth-child(1) { animation-delay: 0s; }
.tag:nth-child(2) { animation-delay: 0.5s; }
.tag:nth-child(3) { animation-delay: 1s; }
@keyframes tagFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* 按钮组 */
.start-buttons {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}

/* 底部装饰 */
.start-footer {
  margin-top: 40px;
}
.footer-decor {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 15px;
  opacity: 0.5;
}
.fd-line {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #ffd700, transparent);
}
.fd-diamond {
  color: #ffd700;
  font-size: 10px;
}
.version-info {
  color: #666;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
}
#versionNumber {
  color: #ffd700;
  font-weight: bold;
}



/* ====== 按钮 ====== */
.btn-primary, .btn-secondary, .btn-menu, .btn-action {
  border: none; cursor: pointer; border-radius: 12px;
  font-family: inherit; font-weight: 700; transition: all 0.3s;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.btn-icon {
  font-size: 22px;
}
.btn-text {
  position: relative;
  z-index: 1;
}
.btn-shine {
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transition: left 0.6s;
}
.btn-primary:hover .btn-shine {
  left: 100%;
}
.btn-primary {
  padding: 18px 60px; font-size: 20px;
  background: linear-gradient(135deg, #ffd700 0%, #ff9500 100%);
  color: #1a0a00;
  box-shadow:
    0 6px 20px rgba(255, 215, 0, 0.5),
    0 0 40px rgba(255, 150, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.3);
  animation: btnPulse 2s ease-in-out infinite;
}
@keyframes btnPulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5), 0 0 40px rgba(255, 150, 0, 0.3); }
  50% { box-shadow: 0 6px 30px rgba(255, 215, 0, 0.7), 0 0 60px rgba(255, 150, 0, 0.5); }
}
.btn-primary:hover {
  background: linear-gradient(135deg, #ffed4a 0%, #ffa500 100%);
  transform: translateY(-5px) scale(1.05);
  animation: none;
}
.btn-primary:active {
  transform: translateY(-2px) scale(1.02);
}
.btn-secondary {
  padding: 14px 44px; font-size: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
  color: #e0e0e0;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(5px);
}
.btn-secondary:hover {
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.1) 100%);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 215, 0, 0.5);
}
.btn-secondary:active {
  transform: translateY(-1px);
}

/* ====== 规则界面 ====== */
#rulesScreen {
  background: rgba(0,0,0,0.9);
  align-items: center; justify-content: center; z-index: 100;
}
.rules-panel {
  background: #1a1a1a;
  border: 1px solid #333; border-radius: 12px; padding: 24px;
  max-width: 500px; width: 90%; max-height: 85vh; overflow-y: auto;
}
.rules-panel h2 { color: #ffd700; font-size: 20px; margin-bottom: 20px; text-align: center; }
.rule-section { margin-bottom: 16px; }
.rule-section h3 { color: #aaa; margin-bottom: 6px; font-size: 14px; }
.rule-section p, .rule-section li { color: #ccc; font-size: 13px; line-height: 1.6; }
.rule-section ul { padding-left: 20px; }
.rules-panel .btn-primary { width: 100%; margin-top: 16px; }

/* ====== 游戏主界面 ====== */
#gameScreen {
  background: #1a3d1a;
  flex-direction: column;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  min-height: 100vh;
  /* 确保填满安全区域 */
  padding-bottom: env(safe-area-inset-bottom);
}

/* 牌桌背景 */
.table-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* 木纹边框 */
.table-wood-frame {
  position: absolute;
  inset: 0;
  border: 12px solid;
  border-image: linear-gradient(135deg, #5c3d2e 0%, #8b6914 25%, #5c3d2e 50%, #8b6914 75%, #5c3d2e 100%) 1;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.5);
  pointer-events: none;
}

/* 牌桌布料 */
.table-felt {
  position: absolute;
  inset: 12px;
  background: 
    radial-gradient(ellipse at 50% 50%, #2d6a2d 0%, #1a4a1a 60%, #0f2f0f 100%);
  border-radius: 8px;
  box-shadow: 
    inset 0 0 60px rgba(0,0,0,0.4),
    inset 0 0 20px rgba(0,0,0,0.2);
}

/* 布料纹理 */
.table-felt::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 2px,
      rgba(0,0,0,0.03) 2px,
      rgba(0,0,0,0.03) 4px
    );
  border-radius: 8px;
  pointer-events: none;
}

/* 中央发光区域 */
.table-center-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 200px;
  background: radial-gradient(ellipse, rgba(255,215,0,0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  animation: tableGlow 4s ease-in-out infinite;
}

@keyframes tableGlow {
  0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

/* 四角装饰 */
.table-corner-decor {
  position: absolute;
  width: 80px;
  height: 80px;
  opacity: 0.15;
  pointer-events: none;
}

.table-corner-decor::before,
.table-corner-decor::after {
  content: '';
  position: absolute;
  background: linear-gradient(135deg, #ffd700, transparent);
}

.table-corner-decor.top-left { top: 20px; left: 20px; }
.table-corner-decor.top-left::before { width: 40px; height: 2px; top: 0; left: 0; }
.table-corner-decor.top-left::after { width: 2px; height: 40px; top: 0; left: 0; }

.table-corner-decor.top-right { top: 20px; right: 20px; }
.table-corner-decor.top-right::before { width: 40px; height: 2px; top: 0; right: 0; }
.table-corner-decor.top-right::after { width: 2px; height: 40px; top: 0; right: 0; }

.table-corner-decor.bottom-left { bottom: 20px; left: 20px; }
.table-corner-decor.bottom-left::before { width: 40px; height: 2px; bottom: 0; left: 0; }
.table-corner-decor.bottom-left::after { width: 2px; height: 40px; bottom: 0; left: 0; }

.table-corner-decor.bottom-right { bottom: 20px; right: 20px; }
.table-corner-decor.bottom-right::before { width: 40px; height: 2px; bottom: 0; right: 0; }
.table-corner-decor.bottom-right::after { width: 2px; height: 40px; bottom: 0; right: 0; }

/* 漂浮花色装饰 */
.table-floating-suits {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.table-float-suit {
  position: absolute;
  font-size: 24px;
  opacity: 0.06;
  animation: floatSuit 15s linear infinite;
  color: #ffd700;
}

.table-float-suit:nth-child(1) { top: 20%; left: 10%; animation-duration: 18s; }
.table-float-suit:nth-child(2) { top: 60%; left: 15%; animation-duration: 22s; animation-delay: -5s; }
.table-float-suit:nth-child(3) { top: 30%; right: 10%; animation-duration: 20s; animation-delay: -8s; }
.table-float-suit:nth-child(4) { bottom: 25%; right: 12%; animation-duration: 19s; animation-delay: -3s; }
.table-float-suit:nth-child(5) { top: 50%; left: 30%; animation-duration: 25s; animation-delay: -10s; font-size: 18px; }

@keyframes floatSuit {
  0% { transform: translateY(0) rotate(0deg); opacity: 0.06; }
  50% { opacity: 0.1; }
  100% { transform: translateY(-50vh) rotate(180deg); opacity: 0.06; }
}

/* 出牌区域光效 */
.play-area-glow {
  position: absolute;
  border-radius: 12px;
  background: radial-gradient(ellipse, rgba(255,255,255,0.05) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.play-area-glow.active {
  opacity: 1;
  animation: areaPulse 2s ease-in-out infinite;
}

@keyframes areaPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ====== 倒计时条（左上角，极简） ====== */
.countdown-bar-mini {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
  padding: 3px 8px;
}
.cd-track-mini {
  width: 40px; height: 3px; background: rgba(255,255,255,0.2);
  border-radius: 2px; overflow: hidden;
}
.cd-fill-mini {
  height: 100%; background: #ffd700; border-radius: 2px;
  transition: width 1s linear;
}
.cd-text-mini {
  font-size: 10px; color: #aaa; font-weight: bold;
  white-space: nowrap; min-width: 32px;
}

/* ====== 游戏桌面布局 ====== */
.game-table {
  flex: 1; position: relative;
  display: grid;
  grid-template-columns: 60px 1fr 60px;
  grid-template-rows: 1fr 1fr;
  gap: 8px; padding: 8px;
  overflow: hidden; min-height: 0;
  z-index: 2;
}

/* ====== 游戏背景 ====== */
.game-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #1a3d1a;
  z-index: 0;
  pointer-events: none;
}

/* ====== 中央区域 ====== */
.center-area {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

/* ====== 翻牌区 ====== */
.flip-zone { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.flip-card-container { width: 50px; height: 72px; perspective: 800px; cursor: pointer; }
.flip-inner {
  width:100%; height:100%; position:relative;
  transform-style:preserve-3d; transition:transform 0.6s;
}
.flip-card-container.flipped .flip-inner { transform: rotateY(180deg); }
.flip-front, .flip-back {
  position: absolute; inset: 0;
  backface-visibility: hidden; border-radius: 6px;
  border: 1px solid #555;
}
.flip-front {
  background: #1a3a1a;
  display: flex; align-items: center; justify-content: center;
}
.flip-front::after { content:'?'; font-size:24px; font-weight:900; color:#666; }
.flip-back {
  transform: rotateY(180deg);
  background: #fff; border: 1px solid #ccc;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900;
}

/* 翻牌显示文字样式 */
.flip-back-text {
  font-size: 15px;
  font-weight: 900;
  color: #c0392b;
  text-align: center;
  line-height: 1.3;
  padding: 2px 4px;
}
.flip-text {
  color: #aaa; font-size: 11px;
  background: rgba(0,0,0,0.4); border-radius: 4px; padding: 3px 8px;
}

/* ====== 出牌区（中央信息）====== */
.play-zone {
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%;
}
.last-play { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 30px; }
.last-player-tag {
  color: #888; font-size: 11px;
  background: rgba(0,0,0,0.4); border-radius: 4px;
  padding: 2px 8px; min-height: 20px;
}
.turn-indicator {
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.5); border-radius: 4px;
  padding: 4px 12px; border: 1px solid rgba(255,255,255,0.1);
}
.turn-arrow { width:8px; height:8px; background:#ffd700; border-radius:50%; animation:blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0.3;} }
#turnText { color: #ccc; font-size: 11px; }

/* ====== 玩家区域 ====== */
.player-area {
  display: flex; align-items: center;
  position: relative; z-index: 5;
}

/* ====== 左侧玩家（上家 player3） ====== */
.player-left {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 6px 4px;
  gap: 6px;
}

/* ====== 右侧玩家（下家 player1） ====== */
.player-right {
  grid-column: 3;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 6px 4px;
  gap: 6px;
}

/* ====== 上方玩家（对家 player2） ====== */
.player-top {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px;
  gap: 4px;
  /* 默认transform由媒体查询控制 */
}

/* ====== 下方玩家（我 player0） ====== */
.player-bottom {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 4px 8px;
  gap: 4px;
  position: relative;
}
/* 玩家信息移到左下角，向上平移3px */
.player-bottom .player-info {
  position: absolute;
  bottom: -5px;
  left: -3px;
}

/* ====== 玩家信息 ====== */
.player-info { display: flex; align-items: center; gap: 6px; }
.player-info.vertical { flex-direction: column; gap: 3px; }
.player-avatar {
  position: relative; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  border: 2px solid #555;
  transition: all 0.3s; flex-shrink: 0;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.player-avatar-img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 50%;
}
.player-avatar.avatar-red  { background: #d32f2f; color: white; }
.player-avatar.avatar-blue { background: #1976d2; color: white; }
.player-avatar.active-turn {
  border-color: #ffd700;
  box-shadow: 0 0 12px rgba(255,215,0,0.6);
}
.player-badge {
  position: absolute; bottom: -3px; right: -3px;
  width: 14px; height: 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: bold; color: white;
  border: 1px solid rgba(255,255,255,0.3);
}
.team-a-badge { background: #d32f2f; }
.team-b-badge { background: #1976d2; }
.player-name  { color: #fff; font-size: 11px; font-weight: 600; }
.card-count   { color: #888; font-size: 10px; }

/* 倒计时闹钟 */
.countdown-clock {
  position: fixed;
  width: 24px;
  height: 24px;
  background: rgba(255, 87, 34, 0.95);
  border: 2px solid #fff;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  animation: pulse 1s ease-in-out infinite;
  z-index: 10;
}
.countdown-clock.visible { display: flex; }
.countdown-clock.warning {
  background: rgba(244, 67, 54, 0.95);
  animation: pulse 0.5s ease-in-out infinite;
}
.countdown-clock.danger {
  background: rgba(183, 28, 28, 0.95);
  animation: pulse 0.3s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
/* 对家闹钟：出牌区左边，位置微调向下+3px */
.countdown-clock-top {
  top: 111px;
  left: calc(50% - 85px);
}
/* 我(player0)闹钟：出牌区左边，位置微调向上+3px */
.countdown-clock-bottom {
  bottom: 134px;
  left: calc(50% - 85px);
}
/* 上家/下家闹钟：显示在出牌区旁边 */
.countdown-clock-left {
  left: 40px;
  top: 50%;
  transform: translateY(-50%) translateX(8px);
}
.countdown-clock-right {
  right: 40px;
  top: 50%;
  transform: translateY(-50%) translateX(-8px);
}

/* 对家牌数样式 - 移除蓝色背景，和其他玩家一致 */
/* .player-top .card-count 使用默认样式 */
.player-stats { display: flex; gap: 6px; align-items: center; }
.player-beans { color: #4caf50; font-size: 9px; font-weight: 600; }
.player-awards { color: #ffd700; font-size: 9px; font-weight: 600; }



/* ====== 单张牌 ====== */
.card {
  width: 36px; height: 52px;
  background: white; border-radius: 4px;
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: flex-start;
  padding: 3px 3px;
  cursor: pointer;
  box-shadow: 1px 2px 4px rgba(0,0,0,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative; user-select: none; -webkit-user-select: none;
  flex-shrink: 0;
}
.card:hover { transform: translateY(-6px); box-shadow: 1px 4px 8px rgba(0,0,0,0.4); }
.card.selected {
  transform: translateY(-10px);
  box-shadow: 0 6px 12px rgba(255,215,0,0.4);
  border: 2px solid #ffd700;
}
.card.red-card   { color: #d32f2f; }
.card.black-card { color: #1a1a1a; }
.card.ghost-big   { color: #d32f2f; background: #fff9c4; }
.card.ghost-small { color: #1976d2; background: #e3f2fd; }
.card.ghost-extra { color: #7b1fa2; background: #f3e5f5; }
.card.score-card::after {
  content:'★'; position:absolute; top:1px; right:2px;
  font-size:8px; color:#ffd700;
}
.card-rank   { font-size: 12px; font-weight: 900; line-height: 1; }
.card-suit   { font-size: 10px; line-height: 1; margin-top: 1px; }
.card-center { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); font-size:16px; }

/* 牌背面 */
.card-back {
  width: 32px; height: 46px;
  background: #1976d2;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 1px 2px 4px rgba(0,0,0,0.3);
  border: 1px solid #444;
  flex-shrink: 0; position: relative; overflow: hidden;
}
.card-back.vertical { width: 38px; height: 26px; }
.card-back::before {
  content:''; position:absolute; inset:3px;
  border: 1px solid rgba(255,255,255,0.2); border-radius: 2px;
  background: repeating-linear-gradient(45deg,transparent,transparent 3px,rgba(255,255,255,0.05) 3px,rgba(255,255,255,0.05) 6px);
}

/* ====== 手牌区域 ====== */
.hand-cards {
  display: flex; align-items: flex-end;
  flex-wrap: nowrap; position: relative; min-height: 60px;
  overflow: visible;
}
.hand-cards.back-cards.vertical {
  flex-direction: column; min-width: 40px; min-height: 50px; align-items: center;
}

/* 手牌叠放 */
#player0Hand { width: fit-content; overflow-x: auto; padding-bottom: 15px; padding-top: 15px; max-width: 90vw; }
#player0Hand .card          { margin-right: -18px; }
#player0Hand .card:last-child{ margin-right: 0; }
#player0Hand .card:hover     { z-index: 10; }
#player0Hand .card.selected  { z-index: 11; }
#player0Hand::-webkit-scrollbar { display: none; }
#player0Hand { scrollbar-width: none; -ms-overflow-style: none; }

#player2Hand .card-back { margin-right: -16px; }
#player2Hand .card-back:last-child { margin-right: 0; }

#player1Hand .card-back { margin-bottom: -24px; }
#player1Hand .card-back:last-child { margin-bottom: 0; }

#player3Hand .card-back { margin-bottom: -24px; }
#player3Hand .card-back:last-child { margin-bottom: 0; }

/* ====== 玩家出牌展示区 ====== */
.player-played-zone {
  display: flex; flex-wrap: wrap; gap: 2px;
  justify-content: center; align-items: center;
  min-height: 30px; min-width: 50px;
  pointer-events: none;
  position: fixed;
  z-index: 100;
}
/* 对家(player2) */
.player-played-top {
  max-width: 140px;
  top: 114px;
  left: 50%;
  transform: translateX(-50%);
}
/* 我(player0) */
.player-played-bottom {
  max-width: 150px;
  bottom: 143px;
  left: 50%;
  transform: translateX(calc(-50% + 8px));
  gap: 3px;
}
/* 上家(player3) */
.player-played-left {
  max-width: 70px;
  flex-direction: row;
  flex-wrap: wrap;
  left: 66px;
  top: 50%;
  transform: translateY(-50%) translateX(19px);
}
/* 下家(player1) */
.player-played-right {
  max-width: 70px;
  flex-direction: row;
  flex-wrap: wrap;
  right: 66px;
  top: 50%;
  transform: translateY(-50%);
}

/* 不出标签 */
.p-passed-tag {
  background: rgba(0,0,0,0.6); color: #ff7043;
  border: 1px solid rgba(255,112,67,0.4);
  padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: bold;
}
/* 出牌区卡片容器 */
.p-played-cards {
  display: flex; flex-wrap: wrap; gap: 1px; justify-content: center;
  animation: slideInCards 0.3s ease;
}
@keyframes slideInCards {
  from{opacity:0;transform:translateY(-5px);}
  to{opacity:1;transform:translateY(0);}
}

/* ====== 小号牌（出牌展示区用） ====== */
.card-sm {
  width: 24px !important; height: 34px !important;
  font-size: 9px !important; padding: 2px 2px !important;
  cursor: default !important;
}
.card-sm .card-rank { font-size: 8px !important; }
.card-sm .card-suit { font-size: 6px !important; }
.card-sm .card-center { font-size: 10px !important; }
.card-sm:hover { transform: none !important; }

/* ====== 左上角分数面板 ====== */
.left-score-panel {
  position: fixed;
  left: 8px;
  top: 8px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transform: translateX(15px); /* 向右平移15px（11+4） */
}
.round-info {
  color: #888;
  font-size: 11px;
  white-space: nowrap;
}
.round-score-display {
  font-size: 10px;
  color: #aaa;
  background: rgba(0,0,0,0.4);
  border-radius: 3px;
  padding: 2px 6px;
  white-space: nowrap;
}
.btn-menu-fixed {
  position: fixed;
  right: 8px;
  top: 8px;
  z-index: 21;
  padding: 4px 10px;
  font-size: 14px;
  background: rgba(0,0,0,0.4);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transform: translateX(-17px); /* 向左平移17px（14+3） */
}
.btn-menu-fixed:hover { background: rgba(255,255,255,0.2); }

/* ====== 浮动操作按钮（居中，玩家手牌上方） ====== */
.floating-buttons {
  position: fixed;
  bottom: 87px;
  left: 0;
  right: 0;
  z-index: 1000;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}
.floating-buttons > * {
  pointer-events: auto;
}
.btn-floating {
  padding: 8px 16px;
  font-size: 12px;
  border-radius: 6px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.btn-pass {
  background: #444;
  color: #ccc;
  border: 1px solid #666;
}
.btn-pass:not(:disabled):hover {
  background: #555;
  color: #fff;
  transform: translateY(-2px);
}
.btn-pass:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-hint {
  background: rgba(255,200,0,0.2);
  color: #ffd700;
  border: 1px solid rgba(255,200,0,0.4);
  padding: 7px 12px;
  font-size: 11px;
}
.btn-hint:hover {
  background: rgba(255,200,0,0.3);
  transform: translateY(-2px);
}
.btn-play {
  background: #ffd700;
  color: #1a1a1a;
  border: none;
  font-size: 13px;
  padding: 10px 20px;
}
.btn-play:not(:disabled):hover {
  background: #ffcc00;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255,215,0,0.4);
}
.btn-play:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #666;
}
.card-type-hint {
  font-size: 10px;
  color: #ffd700;
  background: rgba(0,0,0,0.5);
  border-radius: 4px;
  padding: 3px 8px;
  min-height: 18px;
  text-align: center;
}

/* ====== 消息提示 ====== */
.message-toast {
  position: fixed; bottom: 150px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 6px 14px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
  opacity: 0; transition: opacity 0.2s;
  z-index: 999; pointer-events: none;
  white-space: nowrap;
}
.message-toast.show { opacity: 1; }

/* ====== 匹配界面 ====== */
.matching-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 20, 10, 0.92);
  backdrop-filter: blur(8px);
  z-index: 5000;
  display: flex; align-items: center; justify-content: center;
}
.matching-box {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 28px 36px; border-radius: 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  min-width: 260px;
}
.matching-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top: 3px solid #ffd700;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.matching-title {
  color: #ffd700; font-size: 18px; font-weight: 900; letter-spacing: 2px;
}
.matching-status {
  color: #888; font-size: 12px;
  animation: blink 1.2s ease-in-out infinite;
}
.matching-players {
  display: flex; gap: 16px; margin-top: 6px;
}
.mp-slot {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 50px; transition: all 0.4s;
}
.mp-slot.waiting { opacity: 0.4; }
.mp-slot.found   { opacity: 1; }
.mp-slot.joining {
  opacity: 1;
  animation: joinPop 0.5s ease-out forwards;
}
@keyframes joinPop {
  0%  { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100%{ transform: scale(1);   opacity: 1; }
}
.mp-avatar {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  border: 2px solid #555;
  background: #333;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.mp-avatar-img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block;
  position: absolute; top: 0; left: 0;
}
.mp-avatar-empty {
  border: 2px dashed #444;
  background: rgba(255,255,255,0.05);
}
.mp-avatar-empty span { color: #444; font-size: 18px; font-weight: 900; }
.mp-name {
  color: #ccc; font-size: 9px;
  max-width: 50px; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mp-tag {
  color: #ffd700; font-size: 9px; font-weight: bold;
}

/* 玩家区域进场动画 */
.player-area { transition: opacity 0.5s, transform 0.5s; }
.player-area.hidden-player {
  opacity: 0;
  pointer-events: none;
}

/* ====== 动画层 ====== */
.animation-layer { position: fixed; inset: 0; pointer-events: none; z-index: 200; }

/* ====== 回合分数/奖励提示 ====== */
.point-popup {
  position: absolute; pointer-events: none;
  font-size: 16px; font-weight: 900; color: #ffd700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  animation: popupUp 1.2s forwards; z-index: 500;
}
.award-popup { color: #4caf50; font-size: 14px; }
@keyframes popupUp {
  0%{opacity:1;transform:translateY(0) scale(1);}
  60%{opacity:1;transform:translateY(-30px) scale(1.1);}
  100%{opacity:0;transform:translateY(-60px) scale(0.8);}
}

/* ====== 玩家出牌/不出 提示标签 ====== */
.action-tag {
  position: absolute;
  background: rgba(0,0,0,0.75); color: white;
  padding: 3px 10px; border-radius: 4px; font-size: 10px; font-weight: bold;
  pointer-events: none; z-index: 50;
  animation: fadeTag 1.2s forwards;
}
.action-tag.pass-tag { color: #ff7043; border: 1px solid rgba(255,112,67,0.4); }
.action-tag.play-tag { color: #4caf50; border: 1px solid rgba(76,175,80,0.4); }
@keyframes fadeTag {
  0%{opacity:1;transform:translateY(0);}
  70%{opacity:1;}
  100%{opacity:0;transform:translateY(-15px);}
}

/* ====== 炸弹特效 ====== */
.bomb-flash {
  position: fixed; inset: 0;
  background: radial-gradient(circle at center, rgba(255,200,0,0.3), transparent 60%);
  pointer-events: none; z-index: 100;
  animation: bombFlash 0.5s forwards;
}
@keyframes bombFlash { 0%{opacity:0;} 30%{opacity:1;} 100%{opacity:0;} }

/* ====== 510K 特效标签 ====== */
.fiveTenK-label {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  font-size: 36px; font-weight: 900; letter-spacing: 4px; color: #ffd700;
  text-shadow: 0 0 20px rgba(255,215,0,0.8);
  animation: ftkPop 1s forwards;
  pointer-events: none; z-index: 400;
}
@keyframes ftkPop {
  0%{opacity:0;transform:translate(-50%,-50%) scale(0.5);}
  30%{opacity:1;transform:translate(-50%,-50%) scale(1.2);}
  70%{opacity:1;transform:translate(-50%,-50%) scale(1);}
  100%{opacity:0;transform:translate(-50%,-50%) scale(0.8);}
}

/* ====== 结算界面 ====== */
#resultScreen {
  background: rgba(0,0,0,0.9);
  align-items: center; justify-content: center; z-index: 300;
}
.result-panel {
  background: #1a1a1a;
  border: 1px solid #333; border-radius: 12px; padding: 16px;
  max-width: 380px; width: 92%; max-height: 80vh; overflow-y: auto;
  text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.result-header { margin-bottom: 12px; }
.result-crown  { font-size: 30px; }
#resultTitle   { color: #ffd700; font-size: 18px; margin-top: 4px; }
.ranking-list  { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.rank-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; background: rgba(255,255,255,0.05);
}
.rank-num  { font-size: 14px; width: 20px; }
.rank-name { flex: 1; color: #fff; font-size: 12px; text-align: left; }
.rank-badge { padding: 2px 6px; border-radius: 4px; font-size: 9px; font-weight: bold; }
.badge-1st { background: #ffd700; color: #1a1a1a; }
.badge-2nd { background: #9e9e9e; color: #1a1a1a; }
.badge-3rd { background: #cd7f32; color: #fff; }
.badge-4th { background: rgba(255,255,255,0.1); color: #888; }
.score-change {
  margin: 8px 0; padding: 6px 8px; border-radius: 6px;
  background: rgba(255,215,0,0.1); border: 1px solid rgba(255,215,0,0.2);
  color: #ccc; font-size: 11px; line-height: 1.5;
}
.total-scores { display: flex; justify-content: center; gap: 20px; margin-bottom: 10px; }
.total-team   { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.total-team-label { color: #888; font-size: 10px; }
.total-team-score { font-size: 20px; font-weight: 900; color: #ffd700; }

/* 欢乐豆面板 */
.beans-panel {
  margin-bottom: 10px; padding: 6px 8px; border-radius: 6px;
  background: rgba(76,175,80,0.1); border: 1px solid rgba(76,175,80,0.2);
}
.beans-title  { color: #4caf50; font-size: 11px; font-weight: bold; margin-bottom: 4px; }
.bean-row     { color: #ccc; font-size: 10px; line-height: 1.6; }
.bean-row b   { color: #4caf50; }

.result-buttons { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.result-buttons .btn-primary  { padding: 8px 18px; font-size: 12px; }
.result-buttons .btn-secondary{ padding: 8px 16px; font-size: 12px; }

/* ====== 滚动条美化 ====== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

/* ====== PWA要求提示界面 ====== */
.pwa-requirement-prompt {
  position: fixed;
  inset: 0;
  background: rgba(0, 20, 10, 0.98);
  backdrop-filter: blur(10px);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pwa-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px;
  max-width: 300px;
  text-align: center;
}
.pwa-icon {
  font-size: 48px;
  animation: bouncePhone 1.5s ease-in-out infinite;
}
@keyframes bouncePhone {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.pwa-title {
  font-size: 20px;
  font-weight: 900;
  color: #ffd700;
  letter-spacing: 2px;
}
.pwa-desc {
  font-size: 13px;
  color: #888;
}
.pwa-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  text-align: left;
}
.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: #ffd700;
  color: #1a1a1a;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
}
.step-text {
  font-size: 11px;
  color: #ccc;
  line-height: 1.4;
}
.pwa-note {
  font-size: 10px;
  color: #666;
  font-style: italic;
}

/* ====== 横屏提示界面 ====== */
.landscape-prompt {
  position: fixed;
  inset: 0;
  background: rgba(0, 20, 10, 0.98);
  backdrop-filter: blur(10px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.landscape-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px;
  text-align: center;
}
.landscape-icon {
  font-size: 48px;
  animation: shakePhone 2s ease-in-out infinite;
}
@keyframes shakePhone {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-15deg); }
  75% { transform: rotate(15deg); }
}
.landscape-title {
  font-size: 20px;
  font-weight: 900;
  color: #ffd700;
  letter-spacing: 2px;
}
.landscape-desc {
  font-size: 13px;
  color: #888;
  max-width: 240px;
  line-height: 1.6;
}
.landscape-rotate {
  font-size: 36px;
  color: #666;
  animation: rotateIcon 2s ease-in-out infinite;
}
@keyframes rotateIcon {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(90deg); }
}

/* ═══════════════════════════════════════════════════════════════
   📱 主菜单竖屏模式（通用 - 所有设备）
   ═══════════════════════════════════════════════════════════════ */
@media (orientation: portrait) {
  /* 主菜单竖屏适配 - 保持全屏 */
  #startScreen.active {
    padding: 16px;
  }
  
  .start-content {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
  }
  
  .start-content h1 {
    font-size: 32px;
    margin-bottom: 6px;
    letter-spacing: 3px;
  }
  
  .subtitle {
    font-size: 14px;
    margin-bottom: 16px;
  }
  
  .game-logo {
    margin-bottom: 12px;
  }
  
  .logo-cards {
    gap: 8px;
    margin-bottom: 10px;
  }
  
  .logo-card {
    width: 54px;
    height: 76px;
  }
  
  .logo-card .card-num {
    font-size: 28px;
  }
  
  .logo-card .card-suit {
    font-size: 18px;
  }
  
  .feature-tags {
    gap: 10px;
    margin-bottom: 20px;
  }
  
  .tag {
    padding: 6px 14px;
    font-size: 12px;
  }
  
  .crown-icon {
    font-size: 36px;
    margin-bottom: 6px;
  }
  
  .start-buttons {
    gap: 14px;
  }
  
  .btn-primary {
    padding: 14px 40px;
    font-size: 16px;
  }
  
  .btn-secondary {
    padding: 11px 30px;
    font-size: 14px;
  }
  
  .start-footer {
    margin-top: 24px;
  }
  
  /* 规则界面竖屏适配 */
  #rulesScreen {
    padding: 16px;
  }
  
  .rules-panel {
    padding: 16px;
    width: 94%;
    max-height: 85vh;
  }
  
  .rules-panel h2 {
    font-size: 18px;
    margin-bottom: 14px;
  }
  
  .rule-section {
    margin-bottom: 12px;
  }
  
  .rule-section h3 {
    font-size: 13px;
    margin-bottom: 4px;
  }
  
  .rule-section p,
  .rule-section li {
    font-size: 12px;
    line-height: 1.5;
  }
  
  .rules-panel .btn-primary {
    padding: 12px 24px;
    font-size: 14px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   📱 🎯 手机端横屏模式（PRIMARY - 核心设计） - < 768px
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) and (orientation: landscape) {
  /* ====== 横屏时确保主菜单显示，横屏提示隐藏 ====== */
  #startScreen {
    display: flex !important;
  }
  #landscapePrompt {
    display: none !important;
  }
  
  /* ====== 主菜单横屏适配 ====== */
  body #startScreen,
  #startScreen {
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 20px !important;
    padding: 16px !important;
  }
  
  body #startScreen .start-content,
  #startScreen .start-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: auto !important;
    max-width: none !important;
  }
  
  #startScreen .start-content h1 {
    font-size: 28px !important;
    margin-bottom: 4px !important;
  }
  
  #startScreen .game-logo {
    margin-bottom: 6px !important;
  }
  
  #startScreen .logo-cards {
    gap: 4px !important;
    margin-bottom: 4px !important;
  }
  
  #startScreen .logo-card {
    width: 36px !important;
    height: 50px !important;
  }
  
  #startScreen .logo-card .card-num { font-size: 16px !important; }
  #startScreen .logo-card .card-suit { font-size: 12px !important; }
  
  #startScreen .subtitle {
    font-size: 12px !important;
    margin-bottom: 8px !important;
  }
  
  #startScreen .feature-tags {
    margin-bottom: 8px !important;
    gap: 6px !important;
  }
  
  #startScreen .feature-tags .tag {
    padding: 2px 8px !important;
    font-size: 10px !important;
  }
  
  #startScreen .start-buttons {
    gap: 6px !important;
  }
  
  #startScreen .btn-primary,
  #startScreen .btn-secondary {
    padding: 8px 18px !important;
    font-size: 12px !important;
  }
  
  #startScreen .crown-icon {
    font-size: 20px !important;
  }
  
  #startScreen .logo-glow {
    width: 60px !important;
    height: 40px !important;
  }
  
  /* ====== 游戏容器 - Flexbox垂直分层 ====== */
  #gameScreen {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100dvh;
    /* 底部安全区域 - iPhone Home Indicator */
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* 牌桌边框（手机端更细） */
  .table-wood-frame {
    border-width: 6px;
  }
  .table-felt {
    inset: 6px;
  }
  .table-corner-decor {
    width: 40px;
    height: 40px;
  }
  .table-corner-decor.top-left { top: 10px; left: 10px; }
  .table-corner-decor.top-left::before { width: 25px; height: 1px; }
  .table-corner-decor.top-left::after { width: 1px; height: 25px; }
  .table-corner-decor.top-right { top: 10px; right: 10px; }
  .table-corner-decor.top-right::before { width: 25px; height: 1px; }
  .table-corner-decor.top-right::after { width: 1px; height: 25px; }
  .table-corner-decor.bottom-left { bottom: 10px; left: 10px; }
  .table-corner-decor.bottom-left::before { width: 25px; height: 1px; }
  .table-corner-decor.bottom-left::after { width: 1px; height: 25px; }
  .table-corner-decor.bottom-right { bottom: 10px; right: 10px; }
  .table-corner-decor.bottom-right::before { width: 25px; height: 1px; }
  .table-corner-decor.bottom-right::after { width: 1px; height: 25px; }
  .table-float-suit {
    font-size: 16px;
  }
  .table-center-glow {
    width: 180px;
    height: 120px;
  }

  /* ====== 倒计时条（左上角，极简） ====== */
  .countdown-bar-mini {
    top: 3px;
    left: 3px;
    padding: 2px 6px;
    gap: 4px;
  }
  .cd-track-mini { width: 32px; height: 2px; }
  .cd-text-mini { font-size: 9px; min-width: 26px; }

  /* ====== 游戏桌面 - Grid 3x2布局 ====== */
  .game-table {
    flex: 1;
    display: grid;
    grid-template-columns: 50px 1fr 50px;
    grid-template-rows: 1fr 1fr;
    gap: 6px;
    padding: 6px;
  }

  /* ====== 中央区域（翻牌区 + 提示） ====== */
  .center-area {
    gap: 10px;
  }
  .flip-card-container {
    width: 40px;
    height: 58px;
  }
  .flip-text {
    font-size: 9px;
    padding: 2px 6px;
  }
  .play-zone {
    gap: 6px;
  }
  .last-player-tag {
    font-size: 10px;
    padding: 2px 6px;
  }
  #turnText { font-size: 10px; }

  /* ====== 左侧玩家（上家 player3） ====== */
  .player-left {
    padding: 4px 3px;
    gap: 4px;
    transform: translateX(24px); /* 向右平移24px（20+4） */
  }
  .player-left .player-info.vertical {
    gap: 2px;
    margin-bottom: 4px;
  }
  .player-left .player-avatar {
    width: 26px;
    height: 26px;
    font-size: 10px;
    border-width: 1.5px;
  }
  .player-left .player-name { font-size: 9px; }
  .player-left .card-count { font-size: 8px; }
  .player-left .player-stats {
    gap: 3px;
    font-size: 8px;
  }

  /* 上家手牌（竖向） */
  .player-left .hand-cards.vertical {
    flex-direction: column;
  }
  .player-left .card-back.vertical {
    width: 32px;
    height: 22px;
    margin-bottom: -18px;
  }
  .player-left .card-back.vertical:last-child {
    margin-bottom: 0;
  }

  /* 上家出牌区 - 向右平移13px (8+5) */
  .player-played-left {
    left: 56px;
    max-width: 60px;
    gap: 1px;
    transform: translateY(-50%) translateX(13px);
  }

  /* ====== 右侧玩家（下家 player1） ====== */
  .player-right {
    padding: 4px 3px;
    gap: 4px;
  }
  .player-right .player-info.vertical {
    gap: 2px;
    margin-bottom: 4px;
  }
  .player-right .player-avatar {
    width: 26px;
    height: 26px;
    font-size: 10px;
    border-width: 1.5px;
  }
  .player-right .player-name { font-size: 9px; }
  .player-right .card-count { font-size: 8px; }
  .player-right .player-stats {
    gap: 3px;
    font-size: 8px;
  }

  /* 下家手牌（竖向） */
  .player-right .hand-cards.vertical {
    flex-direction: column;
  }
  .player-right .card-back.vertical {
    width: 32px;
    height: 22px;
    margin-bottom: -18px;
  }
  .player-right .card-back.vertical:last-child {
    margin-bottom: 0;
  }

  /* 下家出牌区 */
  .player-played-right {
    right: 56px;
    max-width: 60px;
    gap: 1px;
  }

  /* ====== 上方玩家（对家 player2） ====== */
  .player-top {
    padding: 3px;
    gap: 3px;
  }
  .player-top .player-info {
    gap: 6px;
    margin-bottom: 4px;
  }
  .player-top .player-avatar {
    width: 24px;
    height: 24px;
    font-size: 9px;
    border-width: 1.5px;
  }
  .player-top .player-name { font-size: 9px; }
  .player-top .card-count { font-size: 8px; }
  .player-top .player-stats {
    gap: 4px;
    font-size: 8px;
  }

  /* 对家手牌（横向） */
  .player-top .hand-cards {
    flex-direction: row;
  }
  .player-top .card-back {
    width: 28px;
    height: 40px;
    margin-right: -14px;
  }
  .player-top .card-back:last-child {
    margin-right: 0;
  }

  /* 对家出牌区 */
  .player-played-top {
    top: 104px;
    max-width: 120px;
    gap: 1px;
  }

  /* 对家整体UI向右平移30px */
  .player-top {
    transform: translateX(20px);
  }

  /* 左上角分数面板 */
  .left-score-panel {
    left: 6px;
    top: 6px;
    gap: 2px;
    transform: translateX(12px); /* 向右平移12px（8+4） */
  }
  .round-info {
    font-size: 9px;
  }
  .round-score-display {
    font-size: 8px;
    padding: 2px 4px;
  }

  /* 右上角菜单按钮 */
  .btn-menu-fixed {
    right: 6px;
    top: 6px;
    padding: 3px 8px;
    font-size: 12px;
    transform: translateX(-17px); /* 向左平移17px（14+3） */
  }

  /* 闹钟位置（手机横屏）- 玩家向上3px，对家向下3px */
  .countdown-clock-top {
    top: 98px;
    left: calc(50% - 65px);
    width: 18px;
    height: 18px;
    font-size: 8px;
  }
  .countdown-clock-bottom {
    bottom: 133px;
    left: calc(50% - 65px);
    width: 18px;
    height: 18px;
    font-size: 8px;
  }

  /* ====== 下方玩家（我 player0） ====== */
  .player-bottom {
    padding: 3px 6px;
    gap: 3px;
  }

  /* 玩家信息 */
  .player-bottom .player-area {
    display: flex;
    flex-direction: column-reverse;
    gap: 4px;
    position: relative;
  }
  .player-bottom .player-info {
    gap: 6px;
    margin-bottom: 0;
    margin-top: 4px;
    position: absolute;
    bottom: -5px;
    left: -2px;
  }
  .player-bottom .player-avatar {
    width: 26px;
    height: 26px;
    font-size: 10px;
    border-width: 1.5px;
  }
  .player-bottom .player-name { font-size: 10px; }
  .player-bottom .card-count { font-size: 9px; }
  .player-bottom .player-stats {
    gap: 6px;
    font-size: 9px;
  }

  /* 闹钟位置（手机横屏） - 出牌区左边 */
  .countdown-clock-top {
    top: 95px;
    left: calc(50% - 75px);
    width: 20px;
    height: 20px;
    font-size: 9px;
  }
  .countdown-clock-bottom {
    bottom: 130px;
    left: calc(50% - 75px);
    width: 20px;
    height: 20px;
    font-size: 9px;
  }
  /* 上家/下家闹钟位置（手机横屏） */
  .countdown-clock-left {
    left: 35px;
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    width: 18px;
    height: 18px;
    font-size: 8px;
  }
  .countdown-clock-right {
    right: 35px;
    top: 50%;
    transform: translateY(-50%) translateX(-8px);
    width: 18px;
    height: 18px;
    font-size: 8px;
  }

  /* 我的手牌（横向，可滚动） */
  .player-bottom .hand-cards {
    display: flex;
    gap: 0;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
    padding: 6px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    order: -1;
  }
  .player-bottom .hand-cards::-webkit-scrollbar {
    display: none;
  }

  /* 牌尺寸 */
  .card {
    width: 30px;
    height: 44px;
    padding: 2px 2px;
  }
  .card-rank { font-size: 10px; }
  .card-suit { font-size: 8px; }
  .card-center { font-size: 12px; }
  .card:hover { transform: translateY(-4px); }
  .card.selected {
    transform: translateY(-7px);
    border: 1.5px solid #ffd700;
  }

  /* 小号牌 */
  .card-sm {
    width: 20px !important;
    height: 28px !important;
    font-size: 6px !important;
  }
  .card-sm .card-rank { font-size: 6px !important; }
  .card-sm .card-suit { font-size: 5px !important; }
  .card-sm .card-center { font-size: 8px !important; }

  /* 牌背面 */
  .card-back { width: 26px; height: 38px; }
  .card-back.vertical { width: 32px; height: 22px; }

  /* 手牌叠放 */
  #player0Hand .card { margin-right: -14px; }
  #player0Hand .card:last-child { margin-right: 0; }

  /* 我的出牌区 - 向上+5px，向右+8px，放大 */
  .player-played-bottom {
    bottom: 141px;
    max-width: 128px;
    gap: 2px;
    transform: translateX(calc(-50% + 8px));
  }

  /* ====== 浮动操作按钮（居中，手机端）向上+5px ====== */
  .floating-buttons {
    bottom: 80px;
    gap: 4px;
    transform: translateY(-5px);
  }
  .btn-floating {
    padding: 6px 12px;
    font-size: 10px;
    border-radius: 5px;
  }
  .btn-pass {
    order: 1;
  }
  .btn-hint {
    order: 2;
    font-size: 9px;
    padding: 5px 10px;
  }
  .btn-play {
    order: 3;
    padding: 8px 16px;
    font-size: 11px;
  }
  .card-type-hint {
    order: 0;
    font-size: 9px;
    padding: 2px 6px;
    min-height: 16px;
  }

  /* ====== 底部操作区（已弃用，保留兼容） ====== */
  .action-bar {
    flex-shrink: 0;
    gap: 6px;
    padding: 6px 10px;
    height: 42px;
  }
  .btn-action {
    padding: 6px 16px;
    font-size: 11px;
    border-radius: 4px;
    min-height: 30px;
  }
  .btn-pass { padding: 6px 12px; font-size: 10px; }
  .btn-hint { padding: 5px 10px; font-size: 10px; }
  .btn-play { padding: 6px 16px; font-size: 11px; }
  .card-type-hint {
    font-size: 9px;
    padding: 2px 6px;
    margin-bottom: 3px;
  }
  .center-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  /* ====== 消息提示 ====== */
  .message-toast {
    bottom: 110px;
    font-size: 9px;
    padding: 5px 10px;
  }

  /* ====== 匹配界面 ====== */
  .matching-box {
    padding: 20px 24px;
    min-width: 240px;
    border-radius: 10px;
  }
  .matching-spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
  }
  .matching-title {
    font-size: 16px;
    letter-spacing: 1.5px;
  }
  .matching-status {
    font-size: 10px;
  }
  .matching-players {
    gap: 12px;
    margin-top: 4px;
  }
  .mp-slot {
    min-width: 44px;
  }
  .mp-avatar {
    width: 36px;
    height: 36px;
  }
  .mp-name {
    font-size: 8px;
    max-width: 44px;
  }
  .mp-tag {
    font-size: 8px;
    padding: 2px 6px;
  }

  /* ====== 结算界面（手机横屏优化） ====== */
  .result-panel {
    padding: 12px;
    width: 90%;
    max-width: 320px;
    max-height: 75vh;
    border-radius: 10px;
  }
  .result-header { margin-bottom: 10px; }
  .result-crown {
    font-size: 24px;
  }
  #resultTitle {
    font-size: 16px;
  }
  .ranking-list {
    gap: 4px;
    margin-bottom: 8px;
  }
  .rank-item {
    padding: 5px 6px;
    gap: 6px;
  }
  .rank-num {
    font-size: 12px;
    width: 18px;
  }
  .rank-name {
    font-size: 10px;
  }
  .rank-badge {
    font-size: 8px;
    padding: 2px 5px;
  }
  .score-change {
    font-size: 10px;
    padding: 5px 6px;
    margin: 6px 0;
  }
  .total-scores {
    gap: 16px;
    margin-bottom: 8px;
  }
  .total-team-label {
    font-size: 9px;
  }
  .total-team-score {
    font-size: 18px;
  }
  .beans-panel {
    padding: 5px 6px;
    margin-bottom: 8px;
  }
  .beans-title {
    font-size: 10px;
    margin-bottom: 3px;
  }
  .bean-row {
    font-size: 9px;
    line-height: 1.5;
  }
  .result-buttons {
    gap: 6px;
    margin-top: 8px;
  }
  .result-buttons .btn-primary {
    padding: 7px 16px;
    font-size: 11px;
  }
  .result-buttons .btn-secondary {
    padding: 7px 14px;
    font-size: 11px;
  }

  /* ====== 特效标签 ====== */
  .fiveTenK-label {
    font-size: 28px;
    letter-spacing: 3px;
  }
  .action-tag {
    font-size: 9px;
    padding: 2px 6px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   📱 手机端竖屏模式（横屏提示） - < 768px
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) and (orientation: portrait) {
  /* 显示横屏提示，游戏桌面隐藏 */
  #gameScreen {
    display: none;
  }
  #landscapePrompt {
    display: flex;
  }
  /* 开始界面适配 */
  #startScreen {
    display: flex;
  }
  .start-content h1 { font-size: 28px; margin-bottom: 6px; }
  .subtitle { font-size: 13px; margin-bottom: 24px; }
  .btn-primary { padding: 12px 36px; font-size: 15px; }
  .btn-secondary { padding: 10px 28px; font-size: 13px; }

  /* 规则界面 */
  .rules-panel { padding: 16px; width: 94%; }
  .rules-panel h2 { font-size: 16px; margin-bottom: 12px; }
  .rule-section { margin-bottom: 10px; }
  .rule-section h3 { font-size: 12px; }
  .rule-section p, .rule-section li { font-size: 11px; line-height: 1.5; }

  /* 匹配界面 */
  .matching-box { padding: 18px 22px; min-width: 220px; }
  .matching-spinner { width: 32px; height: 32px; }
  .matching-title { font-size: 15px; }
  .matching-status { font-size: 10px; }
  .matching-players { gap: 12px; }
  .mp-slot { min-width: 42px; }
  .mp-avatar { width: 36px; height: 36px; }
  .mp-name { font-size: 8px; max-width: 40px; }
  .mp-tag { font-size: 8px; }

  /* 结算界面（手机竖屏优化） */
  .result-panel { padding: 12px; width: 92%; max-width: 300px; max-height: 70vh; }
  .result-header { margin-bottom: 8px; }
  .result-crown { font-size: 22px; }
  #resultTitle { font-size: 15px; }
  .ranking-list { gap: 4px; margin-bottom: 8px; }
  .rank-item { padding: 5px 6px; gap: 6px; }
  .rank-num { font-size: 12px; width: 18px; }
  .rank-name { font-size: 10px; }
  .rank-badge { font-size: 8px; padding: 2px 5px; }
  .score-change { font-size: 10px; padding: 5px 6px; margin: 6px 0; }
  .total-scores { gap: 14px; margin-bottom: 8px; }
  .total-team-label { font-size: 9px; }
  .total-team-score { font-size: 16px; }
  .beans-panel { padding: 5px 6px; margin-bottom: 8px; }
  .beans-title { font-size: 10px; margin-bottom: 3px; }
  .bean-row { font-size: 9px; line-height: 1.5; }
  .result-buttons { gap: 6px; margin-top: 8px; }
  .result-buttons .btn-primary { padding: 7px 16px; font-size: 11px; }
  .result-buttons .btn-secondary { padding: 7px 14px; font-size: 11px; }
}

/* ═══════════════════════════════════════════════════════════════
   📱 平板横屏模式（769px - 1024px）
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
  /* ====== 横屏时确保主菜单显示，横屏提示隐藏 ====== */
  #startScreen {
    display: flex !important;
  }
  #landscapePrompt {
    display: none !important;
  }
  
  /* ====== 游戏容器 ====== */
  #gameScreen {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100dvh;
    /* 底部安全区域 - iPhone Home Indicator */
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* 牌桌边框（平板端中等） */
  .table-wood-frame {
    border-width: 8px;
  }
  .table-felt {
    inset: 8px;
  }
  .table-corner-decor {
    width: 60px;
    height: 60px;
  }
  .table-corner-decor.top-left { top: 15px; left: 15px; }
  .table-corner-decor.top-left::before { width: 30px; height: 2px; }
  .table-corner-decor.top-left::after { width: 2px; height: 30px; }
  .table-corner-decor.top-right { top: 15px; right: 15px; }
  .table-corner-decor.top-right::before { width: 30px; height: 2px; }
  .table-corner-decor.top-right::after { width: 2px; height: 30px; }
  .table-corner-decor.bottom-left { bottom: 15px; left: 15px; }
  .table-corner-decor.bottom-left::before { width: 30px; height: 2px; }
  .table-corner-decor.bottom-left::after { width: 2px; height: 30px; }
  .table-corner-decor.bottom-right { bottom: 15px; right: 15px; }
  .table-corner-decor.bottom-right::before { width: 30px; height: 2px; }
  .table-corner-decor.bottom-right::after { width: 2px; height: 30px; }
  .table-float-suit {
    font-size: 20px;
  }
  .table-center-glow {
    width: 240px;
    height: 160px;
  }

  /* ====== 倒计时条（左上角，极简） ====== */
  .countdown-bar-mini {
    top: 3px;
    left: 3px;
    padding: 2px 7px;
    gap: 5px;
  }
  .cd-track-mini { width: 36px; height: 2px; }
  .cd-text-mini { font-size: 9px; min-width: 30px; }

  /* ====== 游戏桌面 ====== */
  .game-table {
    display: grid;
    grid-template-columns: 70px 1fr 70px;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    padding: 8px;
  }

  /* ====== 中央区域 ====== */
  .center-area {
    gap: 14px;
  }
  .flip-card-container {
    width: 60px;
    height: 86px;
  }
  .flip-text {
    font-size: 12px;
    padding: 3px 10px;
  }
  .last-player-tag {
    font-size: 12px;
    padding: 3px 10px;
  }
  #turnText { font-size: 12px; }

  /* ====== 左右玩家 ====== */
  .player-left .player-avatar,
  .player-right .player-avatar {
    width: 34px;
    height: 34px;
    font-size: 14px;
    border-width: 2px;
  }

  /* 上家向右平移34px */
  .player-left {
    transform: translateX(34px);
  }
  .player-left .player-name,
  .player-right .player-name { font-size: 11px; }
  .player-left .card-count,
  .player-right .card-count { font-size: 10px; }
  .player-left .player-stats,
  .player-right .player-stats {
    font-size: 9px;
    gap: 4px;
  }

  /* 左右玩家手牌 */
  .player-left .card-back.vertical,
  .player-right .card-back.vertical {
    width: 44px;
    height: 32px;
    margin-bottom: -26px;
  }

  /* 左右出牌区 - 上家向右+19px (14+5) */
  .player-played-left { left: 76px; max-width: 100px; transform: translateY(-50%) translateX(19px); }
  .player-played-right { right: 76px; max-width: 100px; }

  /* ====== 上方玩家 ====== */
  .player-top .player-avatar {
    width: 30px;
    height: 30px;
    font-size: 12px;
    border-width: 2px;
  }
  .player-top .player-name { font-size: 11px; }
  .player-top .card-count { font-size: 10px; }
  .player-top .player-stats {
    font-size: 10px;
    gap: 6px;
  }

  /* 对家手牌 */
  .player-top .card-back {
    width: 38px;
    height: 54px;
    margin-right: -20px;
  }

  /* 对家出牌区 */
  .player-played-top {
    top: 120px;
    max-width: 180px;
  }

  /* 对家整体UI向右平移30px */
  .player-top {
    transform: translateX(25px);
  }

  /* 左上角分数面板 */
  .left-score-panel {
    left: 8px;
    top: 8px;
    gap: 3px;
    transform: translateX(15px); /* 向右平移15px（11+4） */
  }

  /* 右上角菜单按钮 */
  .btn-menu-fixed {
    right: 8px;
    top: 8px;
    padding: 4px 10px;
    font-size: 13px;
    transform: translateX(-17px); /* 向左平移17px（14+3） */
  }

  /* 闹钟位置（平板横屏）- 玩家向上3px，对家向下3px */
  .countdown-clock-top {
    top: 111px;
    left: calc(50% - 90px);
  }
  .countdown-clock-bottom {
    bottom: 142px;
    left: calc(50% - 90px);
  }

  /* ====== 下方玩家（我） ====== */
  .player-bottom .player-area {
    position: relative;
  }
  .player-bottom .player-info {
    position: absolute;
    bottom: -4px;
    left: -3px;
  }
  .player-bottom .player-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
    border-width: 2px;
  }
  .player-bottom .player-name { font-size: 12px; }
  .player-bottom .card-count { font-size: 11px; }
  .player-bottom .player-stats {
    font-size: 11px;
    gap: 8px;
  }

  /* 牌尺寸 */
  .card {
    width: 42px;
    height: 60px;
    padding: 3px 3px;
  }
  .card-rank { font-size: 14px; }
  .card-suit { font-size: 11px; }
  .card-center { font-size: 18px; }

  /* 小号牌 */
  .card-sm {
    width: 28px !important;
    height: 40px !important;
    font-size: 10px !important;
  }
  .card-sm .card-rank { font-size: 9px !important; }
  .card-sm .card-suit { font-size: 8px !important; }
  .card-sm .card-center { font-size: 14px !important; }

  /* 牌背面 */
  .card-back { width: 38px; height: 54px; }
  .card-back.vertical { width: 46px; height: 32px; }

  /* 手牌叠放 */
  #player0Hand .card { margin-right: -20px; }
  #player0Hand .card:last-child { margin-right: 0; }

  /* 我的出牌区 - 向上+5px */
  .player-played-bottom {
    bottom: 153px;
    max-width: 180px;
  }

  /* ====== 浮动操作按钮（居中，平板端） ====== */
  .floating-buttons {
    bottom: 105px;
    gap: 5px;
  }
  .btn-floating {
    padding: 7px 14px;
    font-size: 11px;
    border-radius: 6px;
  }
  .btn-pass {
    order: 1;
  }
  .btn-hint {
    order: 2;
    font-size: 10px;
    padding: 6px 12px;
  }
  .btn-play {
    order: 3;
    padding: 9px 18px;
    font-size: 12px;
  }
  .card-type-hint {
    order: 0;
    font-size: 10px;
    padding: 3px 8px;
    min-height: 18px;
  }

  /* 闹钟位置（平板横屏） - 出牌区左边 */
  .countdown-clock-top {
    top: 108px;
    left: calc(50% - 100px);
  }
  .countdown-clock-bottom {
    bottom: 139px;
    left: calc(50% - 100px);
  }
  /* 上家/下家闹钟位置（平板横屏） */
  .countdown-clock-left {
    left: 50px;
    top: 50%;
    transform: translateY(-50%) translateX(8px);
  }
  .countdown-clock-right {
    right: 50px;
    top: 50%;
    transform: translateY(-50%) translateX(-8px);
  }

  /* ====== 底部操作区（已弃用，保留兼容） ====== */
  .action-bar {
    padding: 8px 16px;
    height: 48px;
  }
  .btn-action {
    padding: 8px 24px;
    font-size: 13px;
    min-height: 36px;
  }
  .btn-pass { padding: 7px 18px; font-size: 12px; }
  .btn-hint { padding: 7px 14px; font-size: 12px; }
  .btn-play { padding: 8px 24px; font-size: 13px; }
  .card-type-hint {
    font-size: 11px;
    padding: 3px 10px;
    margin-bottom: 4px;
  }

  /* ====== 消息提示 ====== */
  .message-toast {
    bottom: 130px;
    font-size: 11px;
    padding: 6px 14px;
  }

  /* ====== 匹配界面 ====== */
  .matching-box {
    padding: 28px 36px;
    min-width: 300px;
  }
  .matching-spinner {
    width: 44px;
    height: 44px;
  }
  .matching-title {
    font-size: 18px;
  }
  .matching-status {
    font-size: 12px;
  }
  .matching-players {
    gap: 20px;
  }
  .mp-slot {
    min-width: 56px;
  }
  .mp-avatar {
    width: 48px;
    height: 48px;
  }
  .mp-name {
    font-size: 10px;
    max-width: 58px;
  }
  .mp-tag {
    font-size: 10px;
    padding: 3px 8px;
  }

  /* ====== 结算界面 ====== */
  .result-panel {
    padding: 20px;
    max-width: 400px;
  }
  .result-crown {
    font-size: 32px;
  }
  #resultTitle {
    font-size: 20px;
  }
  .rank-item {
    padding: 8px 12px;
    gap: 12px;
  }
  .rank-num {
    font-size: 16px;
    width: 26px;
  }
  .rank-name {
    font-size: 12px;
  }
  .rank-badge {
    font-size: 10px;
    padding: 3px 10px;
  }
  .score-change {
    font-size: 12px;
    padding: 8px 12px;
  }
  .total-team-score {
    font-size: 22px;
  }
  .beans-panel {
    padding: 8px 12px;
  }
  .beans-title {
    font-size: 12px;
  }
  .bean-row {
    font-size: 11px;
  }
  .result-buttons {
    gap: 10px;
    margin-top: 16px;
  }
  .result-buttons .btn-primary {
    padding: 10px 26px;
    font-size: 13px;
  }
  .result-buttons .btn-secondary {
    padding: 10px 22px;
    font-size: 13px;
  }

  /* ====== 特效标签 ====== */
  .fiveTenK-label {
    font-size: 32px;
    letter-spacing: 4px;
  }
  .action-tag {
    font-size: 10px;
    padding: 3px 10px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   📱 平板竖屏模式（显示横屏提示） - 769px - 1024px
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait) {
  /* 显示横屏提示 */
  #gameScreen {
    display: none;
  }
  #landscapePrompt {
    display: flex;
  }
  /* 其他界面保持默认样式 */
  .start-content h1 { font-size: 36px; }
  .btn-primary { padding: 14px 48px; font-size: 17px; }
}

/* ═══════════════════════════════════════════════════════════════
   💻 PC端主菜单样式（> 1024px）
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 1025px) {
  /* 主菜单元素PC端大尺寸 */
  .start-content h1 {
    font-size: 52px !important;
    margin-bottom: 10px !important;
    letter-spacing: 6px !important;
  }
  
  .subtitle {
    font-size: 18px !important;
    margin-bottom: 30px !important;
    letter-spacing: 2px !important;
  }
  
  .game-logo {
    margin-bottom: 24px !important;
  }
  
  .logo-cards {
    gap: 14px !important;
    margin-bottom: 18px !important;
  }
  
  .logo-card {
    width: 80px !important;
    height: 112px !important;
  }
  
  .logo-card .card-num {
    font-size: 42px !important;
  }
  
  .logo-card .card-suit {
    font-size: 28px !important;
  }
  
  .feature-tags {
    gap: 16px !important;
    margin-bottom: 32px !important;
  }
  
  .tag {
    padding: 10px 24px !important;
    font-size: 14px !important;
  }
  
  .crown-icon {
    font-size: 52px !important;
    margin-bottom: 10px !important;
  }
  
  .start-buttons {
    gap: 20px !important;
  }
  
  .btn-primary {
    padding: 18px 60px !important;
    font-size: 20px !important;
    border-radius: 12px !important;
  }
  
  .btn-secondary {
    padding: 14px 44px !important;
    font-size: 17px !important;
    border-radius: 10px !important;
  }
  
  .start-footer {
    margin-top: 36px !important;
  }
  
  .start-footer p {
    font-size: 12px !important;
  }
  
  /* PC端规则界面 */
  #rulesScreen {
    padding: 24px;
  }
  
  .rules-panel {
    padding: 32px;
    max-width: 680px;
    border-radius: 16px;
  }
  
  .rules-panel h2 {
    font-size: 26px;
    margin-bottom: 28px;
  }
  
  .rule-section {
    margin-bottom: 20px;
  }
  
  .rule-section h3 {
    font-size: 16px;
    margin-bottom: 8px;
  }
  
  .rule-section p,
  .rule-section li {
    font-size: 14px;
    line-height: 1.8;
  }
  
  .rules-panel .btn-primary {
    padding: 16px 32px;
    font-size: 16px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   💻 PC端模式（> 1024px） - 游戏界面专属布局
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 1025px) {
  /* 确保PC端不显示横屏提示 */
  #landscapePrompt {
    display: none !important;
  }

  /* PC端主菜单（只有在有active class时才显示） */
  #startScreen {
    display: none !important;
  }
  #startScreen.active {
    display: flex !important;
  }

  /* ====== 游戏主界面 - PC端专属布局 ====== */
  #gameScreen.active {
    display: flex !important;
    flex-direction: column;
    height: 100%;
    min-height: 100vh;
    overflow: hidden;
  }

  /* 牌桌边框（PC端最粗） */
  .table-wood-frame {
    border-width: 12px;
  }
  .table-felt {
    inset: 12px;
  }
  .table-corner-decor {
    width: 80px;
    height: 80px;
  }
  .table-corner-decor.top-left { top: 20px; left: 20px; }
  .table-corner-decor.top-left::before { width: 40px; height: 2px; }
  .table-corner-decor.top-left::after { width: 2px; height: 40px; }
  .table-corner-decor.top-right { top: 20px; right: 20px; }

  /* PC端顶部栏 */
  .game-top-bar {
    height: 42px;
    padding: 0 16px;
    font-size: 14px;
  }
  .round-info {
    font-size: 15px;
  }
  .score-info {
    font-size: 13px;
  }

  /* PC端底部操作区 */
  .game-bottom-bar {
    height: 58px;
    padding: 0 20px;
  }
  .game-bottom-bar .btn-action {
    padding: 10px 28px;
    font-size: 14px;
  }
  .game-bottom-bar .btn-primary {
    padding: 12px 32px;
    font-size: 15px;
  }

  /* PC端牌尺寸 - 更大更清晰 */
  .card {
    width: 56px;
    height: 80px;
    padding: 4px 4px;
    border-radius: 5px;
  }
  .card-rank { font-size: 18px; }
  .card-suit { font-size: 14px; }
  .card-center { font-size: 24px; }

  .card-sm {
    width: 36px !important;
    height: 52px !important;
    font-size: 12px !important;
  }
  .card-sm .card-rank { font-size: 11px !important; }
  .card-sm .card-suit { font-size: 9px !important; }
  .card-sm .card-center { font-size: 16px !important; }

  .card-back { width: 50px; height: 72px; }
  .card-back.vertical { width: 60px; height: 42px; }

  /* PC端手牌间距更大 */
  #player0Hand .card { margin-right: -28px; }
  #player0Hand .card:hover { transform: translateY(-16px); }

  /* PC端玩家信息 */
  .player-avatar {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }
  .player-name { font-size: 13px; }
  .player-stats { font-size: 11px; }
  .card-count { font-size: 11px; }

  /* PC端出牌区位置微调 */
  .player-played-top {
    top: 75px;
    left: calc(50% + 5px);
  }
  .player-played-bottom {
    bottom: 108px;
    left: calc(50% + 8px);
  }
  .player-played-left {
    left: 140px;
  }
  .player-played-right {
    right: 140px;
  }

  /* PC端闹钟位置 */
  .countdown-clock-top {
    top: 68px;
    left: calc(50% - 80px);
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
  .countdown-clock-bottom {
    bottom: 101px;
    left: calc(50% - 80px);
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
  .countdown-clock-left {
    left: 70px;
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
  .countdown-clock-right {
    right: 70px;
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  /* PC端左侧分数面板 */
  .left-score-panel {
    top: 50px;
    padding: 10px 14px;
    font-size: 13px;
  }

  /* PC端菜单按钮 */
  .btn-menu-fixed {
    top: 50px;
    padding: 8px 16px;
    font-size: 14px;
  }

  /* PC端玩家区域间距 */
  .player-left {
    padding: 8px 6px;
  }
  .player-right {
    padding: 8px 6px;
  }

  /* PC端玩家整体UI位置调整 */
  /* 玩家（我）整体UI上移5px（再上移5px） */
  .player-bottom {
    transform: translateY(-10px);
  }
  /* 对家整体UI下移3px */
  .player-top {
    transform: translateY(3px) translateX(25px);
  }
  /* 下家整体UI左移5px */
  .player-right {
    transform: translateX(-5px);
  }

  /* PC端出牌区位置微调 */
  /* 对家出牌显示下移40px */
  .player-played-top {
    top: 155px !important;
    left: calc(50% + 5px);
  }
  /* 玩家出牌区上移15px */
  .player-played-bottom {
    bottom: 168px !important;
    left: calc(50% + 8px);
  }

  /* PC端闹钟位置 */
  .countdown-clock-top {
    top: 128px !important;
    left: calc(50% - 100px);
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
  /* 玩家闹钟上移10px */
  .countdown-clock-bottom {
    bottom: 146px !important;
    left: calc(50% - 80px);
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  /* PC端浮动按钮（不出/提示/出牌）上移10px */
  .floating-buttons {
    bottom: 122px !important;
  }

  /* PC端底部操作区上移10px */
  .game-bottom-bar {
    height: 48px;
    padding: 0 20px;
  }
  .game-bottom-bar .btn-action {
    padding: 8px 24px;
    font-size: 14px;
  }
  .game-bottom-bar .btn-primary {
    padding: 10px 28px;
    font-size: 15px;
  }

  /* PC端特效标签 */
  .fiveTenK-label {
    font-size: 36px;
    letter-spacing: 5px;
  }
  .action-tag {
    font-size: 11px;
    padding: 4px 12px;
  }

  /* PC端消息提示 */
  .toast-container {
    font-size: 14px;
    padding: 10px 20px;
  }
  #messageToast {
    font-size: 14px;
    bottom: 175px;
  }
  .message-toast {
    bottom: 175px !important;
  }

  /* PC端翻牌区 */
  .flip-card {
    width: 50px;
    height: 72px;
  }

  /* PC端匹配界面 */
  .matching-box {
    padding: 24px;
    max-width: 420px;
  }
  .matching-title {
    font-size: 22px;
  }
  .matching-status {
    font-size: 13px;
  }
  .matching-players {
    gap: 24px;
  }
  .mp-slot {
    min-width: 64px;
  }
  .mp-avatar {
    width: 52px;
    height: 52px;
  }
  .mp-name {
    font-size: 11px;
    max-width: 64px;
  }

  /* PC端结算界面 */
  .result-panel {
    padding: 24px;
    max-width: 480px;
  }
  .result-crown {
    font-size: 38px;
  }
  #resultTitle {
    font-size: 24px;
  }
  .rank-item {
    padding: 10px 16px;
    gap: 16px;
  }
  .rank-num {
    font-size: 18px;
    width: 30px;
  }
  .rank-name {
    font-size: 13px;
  }
  .rank-badge {
    font-size: 11px;
    padding: 4px 12px;
  }
  .score-change {
    font-size: 13px;
    padding: 10px 16px;
  }
  .total-team-score {
    font-size: 26px;
  }
  .beans-panel {
    padding: 10px 16px;
  }
  .beans-title {
    font-size: 13px;
  }
  .bean-row {
    font-size: 12px;
  }
  .result-buttons {
    gap: 14px;
    margin-top: 20px;
  }
  .result-buttons .btn-primary {
    padding: 12px 30px;
    font-size: 14px;
  }
  .result-buttons .btn-secondary {
    padding: 12px 26px;
    font-size: 14px;
  }
}

/* ====== 牌桌水印 ====== */
.table-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: bold;
  color: rgba(120, 120, 120, 0.15);
  text-shadow:
    1px 1px 0 rgba(80, 80, 80, 0.1),
    -1px -1px 0 rgba(160, 160, 160, 0.05);
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
  letter-spacing: 4px;
  font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
}

/* 手机横屏水印 */
@media (max-width: 1024px) and (orientation: landscape) {
  .table-watermark {
    font-size: 28px;
    letter-spacing: 2px;
  }
}

/* 高分辨率横屏水印 */
@media (max-width: 1024px) and (orientation: landscape) and (min-resolution: 3dppx) {
  .table-watermark {
    font-size: 32px;
    letter-spacing: 3px;
  }
}

/* 手机竖屏隐藏水印（因为不玩游戏） */
@media (orientation: portrait) {
  .table-watermark {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════════════
   🔐 登录/注册界面
   ═══════════════════════════════════════════════════════════════ */
#authScreen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  background: linear-gradient(135deg, #0a1628 0%, #1a0a28 50%, #0a2818 100%);
}
.auth-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.auth-container {
  position: relative;
  z-index: 1;
  width: 360px;
  max-width: 90vw;
  background: rgba(10, 26, 40, 0.92);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 16px;
  padding: 32px 28px 28px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(12px);
}
.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}
.auth-logo h1 {
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(135deg, #ffd700, #ffed85, #ffd700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 4px;
  margin-bottom: 4px;
}
.auth-logo .subtitle {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 2px;
}
.auth-tabs {
  display: flex;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  padding: 3px;
  margin-bottom: 20px;
  gap: 3px;
}
.auth-tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,0.5);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.auth-tab.active {
  background: rgba(212, 175, 55, 0.2);
  color: #ffd700;
  font-weight: 600;
}
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form.hidden { display: none; }
.auth-field {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 10px 14px;
  gap: 10px;
  transition: border-color 0.2s;
}
.auth-field:focus-within {
  border-color: rgba(212,175,55,0.6);
  background: rgba(212,175,55,0.05);
}
.auth-icon { font-size: 16px; flex-shrink: 0; }
.auth-field input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
}
.auth-field input::placeholder { color: rgba(255,255,255,0.3); }
.auth-error {
  color: #ff6b6b;
  font-size: 12px;
  min-height: 16px;
  text-align: center;
}
.auth-submit {
  margin-top: 4px;
  width: 100%;
  padding: 12px;
  font-size: 15px;
}
.auth-note {
  text-align: center;
  color: rgba(255,255,255,0.4);
  font-size: 12px;
}

/* ─── 用户信息栏（主菜单顶部） ──── */
.user-info-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(212,175,55,0.1);
  border: 1px solid rgba(212,175,55,0.25);
  border-radius: 20px;
  padding: 6px 14px;
  margin-bottom: 6px;
}
.user-info-name {
  color: #ffd700;
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}
.user-info-beans {
  color: rgba(255,255,255,0.8);
  font-size: 13px;
}
.btn-logout {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  color: rgba(255,255,255,0.6);
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-logout:hover { background: rgba(255,80,80,0.2); color: #ff8080; }

/* ─── 真人对战按钮 ──── */
.btn-human {
  background: linear-gradient(135deg, #1565c0, #0d47a1) !important;
  border-color: rgba(100,150,255,0.4) !important;
}
.btn-human:hover {
  background: linear-gradient(135deg, #1976d2, #1565c0) !important;
}

/* ─── 主菜单第二行按钮 ──── */
.start-buttons-row2 {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
}
.start-buttons-row2 .btn-secondary { flex: 1; max-width: 160px; }

/* ─── 取消匹配按钮 ──── */
.btn-cancel-match {
  margin-top: 14px;
  padding: 8px 24px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.btn-cancel-match:hover { background: rgba(255,80,80,0.15); color: #ff8080; }

/* ═══════════════════════════════════════════════════════════════
   🏆 排行榜界面
   ═══════════════════════════════════════════════════════════════ */
.leaderboard-panel { max-height: 80vh; }
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px 0;
  margin-bottom: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(212,175,55,0.3) transparent;
}
.lb-loading, .lb-error, .lb-empty {
  text-align: center;
  color: rgba(255,255,255,0.5);
  padding: 24px;
  font-size: 14px;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
  color: rgba(255,255,255,0.85);
}
.lb-top {
  background: rgba(212,175,55,0.08);
  border-color: rgba(212,175,55,0.25);
}
.lb-rank  { font-size: 16px; width: 28px; text-align: center; flex-shrink: 0; }
.lb-name  { flex: 1; font-weight: 600; color: #fff; }
.lb-beans { color: #ffd700; font-size: 12px; flex-shrink: 0; }
.lb-wins  { color: rgba(255,255,255,0.5); font-size: 11px; flex-shrink: 0; }
.lb-rate  { color: #4fc3f7; font-size: 11px; width: 36px; text-align: right; flex-shrink: 0; }

/* ─── 手机端适配 ──── */
@media (max-width: 768px) {
  .auth-container { padding: 24px 18px 20px; }
  .auth-logo h1 { font-size: 26px; }
  .user-info-bar { padding: 5px 10px; }
  .user-info-name { font-size: 12px; }
  .user-info-beans { font-size: 12px; }
  .lb-row { font-size: 11px; gap: 6px; padding: 6px 8px; }
  .lb-wins { display: none; }
}
