﻿/* ============================================================
   拖拉机（经典升级）游戏样式
   经典绿色牌桌 + 扑克风格卡牌
   ============================================================ */
/* ---------- 基础重置 ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background: #1a1a2e;
}
/* ---------- 牌桌 ---------- */
#game-table {
  width: 100%;
  height: 100vh;
  padding: 0 3%;
  background: radial-gradient(ellipse at center, #2d7a3a 0%, #1a5a28 40%, #0d3d18 100%);
  display: flex;
  flex-direction: column;
  position: relative;
  user-select: none;
  box-shadow: inset 0 0 150px rgba(0,0,0,0.5);
}
/* 牌桌纹理 */
#game-table::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255,255,255,0.02) 2px,
      rgba(255,255,255,0.02) 4px
    );
  pointer-events: none;
  z-index: 0;
}
#game-table > * {
  position: relative;
  z-index: 1;
}
/* ---------- 顶部栏 ---------- */
#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  color: #f0e6c8;
  font-size: 14px;
  min-height: 44px;
}
#trump-display {
  font-weight: bold;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.trump-icon {
  font-size: 32px;
  line-height: 1;
  text-shadow: 0 0 12px currentColor;
  filter: drop-shadow(0 0 6px currentColor);
}
.trump-text {
  font-size: 15px;
  color: #f0e6c8;
}
.trump-text b {
  color: #f0d060;
}
.trump-level {
  font-size: 13px;
  color: rgba(240, 230, 200, 0.6);
  margin-left: 4px;
}
.trump-level b {
  color: #f0e6c8;
}
.trump-suit {
  font-size: 22px;
  display: inline-block;
  margin: 0 4px;
}
#controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
#bgm-toggle {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #f0e6c8;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}
#bgm-toggle:hover {
  background: rgba(255,255,255,0.2);
}
#track-prev, #track-next {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #f0e6c8;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: background 0.2s;
}
#track-prev:hover, #track-next:hover {
  background: rgba(255,255,255,0.2);
}
.track-info {
  font-size: 12px;
  color: #c0b080;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 60px;
}
#volume-slider {
  width: 80px;
  height: 4px;
  accent-color: #f0d060;
  cursor: pointer;
}
/* ---------- 游戏区域 ---------- */
#game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 4px;
}
/* 玩家区域 */
.player-area {
  position: relative;
  min-height: 100px;
}
.player-top {
  text-align: center;
  padding: 4px 0;
  min-height: 90px;
}
#middle-row {
  flex: 1;
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-height: 0;
}
.player-left {
  width: 80px;
  min-width: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.player-right {
  width: 80px;
  min-width: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.player-bottom {
  min-height: 130px;
  padding: 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
/* ---------- 中央出牌区 ---------- */
#center-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}
#played-cards {
  position: relative;
  width: min(320px, 80vw);
  height: 200px;
}
.center-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(240, 230, 200, 0.4);
  font-size: 16px;
  text-align: center;
}
.center-play {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  gap: -4px;
  background: rgba(0,0,0,0.15);
  border-radius: 6px;
  padding: 4px;
  animation: cardPlay 0.3s ease-out;
}
@keyframes cardPlay {
  from { opacity: 0; transform: translate(-50%, -30%) scale(0.8); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.banker-tag { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: 26px; z-index: 6; filter: drop-shadow(0 0 10px rgba(240,208,96,0.8)); pointer-events: none; text-shadow: 0 0 8px rgba(240,208,96,0.5); }
.player-tag {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: #f0e6c8;
  background: rgba(0,0,0,0.4);
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
}
/* 赢家标记 */
.center-play.is-best .banker-tag { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: 26px; z-index: 6; filter: drop-shadow(0 0 10px rgba(240,208,96,0.8)); pointer-events: none; text-shadow: 0 0 8px rgba(240,208,96,0.5); }
.player-tag {
  color: #f0d060;
  background: rgba(212, 160, 48, 0.4);
}
/* 牌型信息 */
.play-type-info {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(240, 230, 200, 0.6);
  font-size: 12px;
  background: rgba(0,0,0,0.3);
  padding: 2px 12px;
  border-radius: 10px;
  white-space: nowrap;
}
/* 当前轮到谁 */
.current-turn {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  color: #f0d060;
  font-size: 14px;
  font-weight: bold;
  background: rgba(0,0,0,0.4);
  padding: 4px 16px;
  border-radius: 12px;
  white-space: nowrap;
  animation: pulse 1.5s ease-in-out infinite;
}
/* AI思考中 */
.ai-thinking {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(240, 230, 200, 0.5);
  font-size: 13px;
  background: rgba(0,0,0,0.25);
  padding: 3px 14px;
  border-radius: 10px;
  animation: pulse 1.5s ease-in-out infinite;
}
/* 底部信息栏（出牌阶段，不遮中央） */
.bottom-info {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  color: #f0d060;
  font-size: 14px;
  font-weight: bold;
  background: rgba(0,0,0,0.35);
  padding: 4px 16px;
  border-radius: 12px;
  white-space: nowrap;
  animation: pulse 1.5s ease-in-out infinite;
  z-index: 5;
}
/* 上圈简记 */
.trick-memo {
  position: absolute;
  bottom: -52px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(240, 230, 200, 0.5);
  font-size: 11px;
  background: rgba(0,0,0,0.2);
  padding: 2px 12px;
  border-radius: 8px;
  white-space: nowrap;
  z-index: 4;
}
.last-trick-label {
  color: #f0d060;
  font-weight: bold;
  font-size: 10px;
  margin-bottom: 2px;
}
.last-trick-cards {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.lt-play {
  white-space: nowrap;
}
.lt-card {
  display: inline-block;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  padding: 0 3px;
  margin: 0 1px;
  font-size: 10px;
}
.lt-pts {
  color: #f0d060;
  font-weight: bold;
}
/* 轮到玩家中央大号提示 */
@keyframes yourTurnGlow {
  0%, 100% { box-shadow: inset 0 0 20px rgba(240, 208, 96, 0); }
  50% { box-shadow: inset 0 0 30px rgba(240, 208, 96, 0.08); }
}
@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
/* ---------- 局末战报 ---------- */
.round-summary {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(240, 230, 200, 0.12);
  border-radius: 10px;
  padding: 8px 16px;
  margin-left: 12px;
  font-size: 12px;
  animation: fadeInUp 0.4s ease-out;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.summary-title {
  font-weight: bold;
  color: #f0d060;
  font-size: 13px;
  margin-bottom: 4px;
  text-align: center;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(240, 230, 200, 0.8);
}
.summary-row .gold {
  color: #f0d060;
  font-weight: bold;
}
.summary-row.gold {
  color: #f0d060;
  font-weight: bold;
}
/* 出牌动画加强 */
.center-play {
  animation: cardPlay 0.3s ease-out;
}
.center-play:last-child {
  animation: cardPlay 0.2s ease-out, cardGlow 0.6s ease-out;
}
@keyframes cardGlow {
  from { filter: brightness(1.3); }
  to { filter: brightness(1); }
}
/* 选中牌飘起动画 */
.card.selected {
  animation: cardSelected 0.2s ease-out forwards;
}
/* 非法出牌抖动提示 */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.card.invalid {
  animation: shake 0.35s ease-in-out;
  border-color: #e74c3c !important;
  box-shadow: 0 0 8px rgba(231, 76, 60, 0.5) !important;
}
@keyframes cardSelected {
  from { transform: translateY(0); }
  to { transform: translateY(-12px); }
}
/* 按钮缩放的点击反馈 */
#action-btn:active {
  transform: scale(0.96);
}
/* 非法出牌按钮抖动 */
#action-btn.shake {
  animation: shake 0.35s ease-in-out;
  border-color: #e74c3c;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
}
/* ---------- 卡牌 ---------- */
.card {
  display: inline-block;
  width: 62px;
  height: 86px;
  background: #fffdf5;
  border: 1.5px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s, margin-top 0.15s;
  box-shadow: 1px 2px 4px rgba(0,0,0,0.2);
  margin-left: -18px;
  flex-shrink: 0;
}
/* 发牌动画：牌从底部飞到手中 */
.card-deal {
  animation: dealCard 0.3s ease-out both;
}
@keyframes dealCard {
  from { opacity: 0; transform: translateY(-60px) rotate(-10deg); }
  to { opacity: 1; transform: translateY(0) rotate(0deg); }
}
/* 洗牌动画 */
.shuffle-anim {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.shuffle-card {
  position: absolute;
  width: 42px;
  height: 58px;
  background: linear-gradient(135deg, #1a5276, #2980b9);
  border: 2px solid #1a3a5a;
  border-radius: 5px;
  box-shadow: 1px 2px 6px rgba(0,0,0,0.4);
  top: -29px;
  left: -21px;
  animation: shuffleCard 0.35s ease-in-out infinite alternate;
}
.shuffle-card::after {
  content: '♠';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  color: rgba(255,255,255,0.2);
}
@keyframes shuffleCard {
  from { transform: translateY(-5px); }
  to { transform: translateY(5px); }
}
/* 叫主可视化 */
.bidding-panel {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; gap: 6px;
  background: rgba(0,0,0,0.35); border-radius: 12px; padding: 16px 24px;
  min-width: 160px;
}
.bidding-step {
  font-size: 14px; padding: 4px 12px; border-radius: 6px;
  text-align: center; animation: bidEnter 0.3s ease-out;
}
@keyframes bidEnter {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}
.bidding-bid { color: #f0d060; background: rgba(240,208,96,0.1); }
.bidding-pass { color: rgba(240,230,200,0.4); }
.bidding-won { color: #f0d060; font-weight: bold; background: rgba(240,208,96,0.2); border: 1px solid rgba(240,208,96,0.3); }
.bidding-next { color: rgba(240,230,200,0.35); font-style: italic; }
/* 叫主花色选择按钮 */
.bid-suits { display: flex; gap: 6px; }
.bid-suit {
  width: 56px; height: 56px; border-radius: 50%; border: 2px solid rgba(240,230,200,0.2);
  background: rgba(255,255,255,0.08); cursor: pointer;
  font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, background 0.15s;
  color: #f0e6c8;
  box-sizing: border-box;
}
.bid-suit:hover { transform: scale(1.15); background: rgba(255,255,255,0.18); }
.bid-suit:active { transform: scale(0.95); }
.bid-actions { display: flex; gap: 10px; justify-content: center; margin-top: 8px; }
.bid-btn { flex: 1; padding: 8px 12px; border-radius: 8px; border: none; cursor: pointer; transition: transform 0.15s; }
.bid-call { background: linear-gradient(135deg,#f0d060,#d4a030); color: #1a1a2e; font-size: 15px; font-weight: bold; }
.bid-pass { background: rgba(255,255,255,0.1); color: #f0e6c8; border: 1px solid rgba(255,255,255,0.2); font-size: 15px; font-weight: bold; }
.bid-btn:active { transform: scale(0.95); }
.bid-call:hover { background: linear-gradient(135deg,#f5e070,#d8a840); }
.bid-pass:hover { background: rgba(255,255,255,0.18); }
.bidding-next { color: rgba(240,230,200,0.35); font-style: italic; }
.shuffle-label {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(240, 230, 200, 0.7);
  font-size: 15px;
  white-space: nowrap;
  animation: pulse 1s ease-in-out infinite;
  width: 200px;
  text-align: center;
}
.card:first-child {
  margin-left: 0;
}
.card-hover:hover {
  transform: translateY(-10px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  z-index: 5;
}
.card.selected {
  transform: translateY(-12px);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
  border-color: #f0c040;
}
.card.card-trump {
  border-left: 3px solid #d4a030;
}
/* 级牌标记 — 独立于普通主牌的视觉 */
.card.card-level {
  border-left: 3px solid #e74c3c !important;
  background: linear-gradient(135deg, #fffdf5, #fff8e1);
}
.card.card-level .card-rank::after {
  content: "级";
  font-size: 10px;
  color: #e74c3c;
  margin-left: 2px;
}
/* 庄家区域金色边框 */
.player-area.banker-area {
  border: 2px solid rgba(240, 208, 96, 0.3);
  border-radius: 10px;
  background: rgba(240, 208, 96, 0.04);
}
/* 底部错误提示条 */
.error-bar {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translate(-50%, -100%);
  background: rgba(231, 76, 60, 0.2);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: #e74c3c;
  font-size: 13px;
  font-weight: bold;
  padding: 6px 18px;
  border-radius: 8px;
  z-index: 150;
  pointer-events: none;
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
/* 小尺寸（中心出牌区） */
.card.small {
  width: 43px;
  height: 59px;
  margin-left: -12px;
  font-size: 13px;
  border-radius: 5px;
}
.card.small:first-child {
  margin-left: 0;
}
/* 迷你尺寸（底牌） */
.card.mini {
  width: 50px;
  height: 70px;
  margin-left: -10px;
  font-size: 13px;
  border-radius: 5px;
}
.card.mini:first-child {
  margin-left: 0;
}
/* 牌面 */
.card-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}
.card-inner.red {
  color: #c0392b;
}
.card-inner.black {
  color: #1a1a2e;
}
.card-rank {
  font-size: 22px;
  line-height: 1;
}
.card.small .card-rank { font-size: 16px; }
.card.mini .card-rank { font-size: 13px; }
.card-suit {
  font-size: 24px;
  line-height: 1;
  margin-top: 2px;
}
.card.small .card-suit { font-size: 18px; }
.card.mini .card-suit { font-size: 14px; }
/* 王 */
.card-inner.joker {
  color: #8e44ad;
}
.card-inner.small-joker {
  background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
  border-radius: 4px;
}
.card-inner.big-joker {
  background: linear-gradient(135deg, #fff8e1, #ffd54f);
  border-radius: 4px;
}
.card-inner .card-icon {
  font-size: 18px;
  margin-top: 2px;
}
/* 牌背 */
.card-back {
  display: inline-block;
  width: 40px;
  height: 56px;
  background: linear-gradient(135deg, #1a5276, #2980b9);
  border: 2px solid #1a3a5a;
  border-radius: 6px;
  margin-left: -24px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.card-back:first-child {
  margin-left: 0;
}
.card-back::after {
  content: '♠♥♣♦';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: rgba(255,255,255,0.25);
  letter-spacing: 1px;
}
/* ---------- 手牌行 ---------- */
.hand-row {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 12px 10px 0;
  overflow: hidden;
  flex-wrap: nowrap;
}
/* 手牌分隔符（扣底牌阶段区分手牌与底牌） */
.hand-separator {
  display: flex;
  align-items: center;
  color: rgba(240, 230, 200, 0.4);
  font-size: 11px;
  padding: 0 8px;
  margin: 0 4px;
  border-left: 1px solid rgba(240, 230, 200, 0.15);
  border-right: 1px solid rgba(240, 230, 200, 0.15);
  user-select: none;
}
/* 底牌来源标记 */
.card.from-bottom {
  border-color: #8e44ad;
  border-width: 2px;
  box-shadow: 0 0 6px rgba(142, 68, 173, 0.3);
}
.ai-cards {
  display: flex;
  justify-content: center;
  padding: 4px 0;
}
.banker-crown { display: inline-block; font-size: 16px; margin-left: 4px; vertical-align: middle; text-shadow: 0 0 6px rgba(240,208,96,0.6); }
.ai-label {
  color: #f0e6c8;
  font-size: 13px;
  background: rgba(0,0,0,0.3);
  padding: 2px 10px;
  border-radius: 10px;
  display: inline-block;
  margin-bottom: 4px;
}
.empty-hand {
  color: rgba(240, 230, 200, 0.3);
  font-size: 14px;
}
/* ---------- 底部栏 ---------- */
#bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
  min-height: 48px;
}
#scoreboard {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #f0e6c8;
  font-size: 13px;
}
.score-row {
  display: flex;
  gap: 16px;
}
.score-team {
  display: flex;
  gap: 6px;
  align-items: center;
}
.score-team.banker-team {
  color: #f0d060;
}
.score-label {
  opacity: 0.7;
}
.score-value {
  font-weight: bold;
  color: #f0d060;
}
.score-value.highlight {
  color: #ff8c42;
}
.score-team.attacker-team {
  color: #ff8c42;
}
/* 底牌展示 */
.bottom-cards {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid rgba(255,255,255,0.1);
}
.bottom-label {
  color: rgba(240, 230, 200, 0.5);
  font-size: 11px;
}
/* 扣底牌分数预览 */
.discard-preview {
  font-size: 12px;
  color: rgba(240, 230, 200, 0.7);
  padding: 2px 10px;
  margin-left: 8px;
  border-left: 1px solid rgba(240, 230, 200, 0.1);
  white-space: nowrap;
}
.discard-preview .gold { color: #f0d060; font-weight: bold; }
/* 局末计分板特效 */
#scoreboard.round-end {
  border: 1px solid rgba(240, 208, 96, 0.25);
  border-radius: 8px;
  padding: 4px 12px;
  animation: roundEndGlow 0.8s ease-in-out 4;
}
/* 底牌逐张翻牌 */
.card-reveal {
  animation: cardFlip 0.3s ease-out both;
}
@keyframes cardFlip {
  from { transform: rotateY(90deg) scale(0.8); opacity: 0; }
  to { transform: rotateY(0deg) scale(1); opacity: 1; }
}
@keyframes roundEndGlow {
  0%, 100% { box-shadow: 0 0 0px rgba(240, 208, 96, 0); }
  50% { box-shadow: 0 0 25px rgba(240, 208, 96, 0.25); }
}
.bottom-row {
  display: flex;
}
#action-area {
  display: flex;
  gap: 8px;
}
#action-btn {
  background: linear-gradient(135deg, #f0d060, #d4a030);
  border: none;
  color: #1a1a2e;
  font-weight: bold;
  font-size: 16px;
  padding: 10px 30px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  letter-spacing: 1px;
}
#action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(212, 160, 48, 0.5);
}
#action-btn:active {
  transform: translateY(0);
}
/* 底牌迷你背面 */
.card-mini-back {
  display: inline-block;
  width: 30px;
  height: 42px;
  background: linear-gradient(135deg, #1a5276, #2980b9);
  border: 1.5px solid #1a3a5a;
  border-radius: 4px;
  margin-left: -4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  flex-shrink: 0;
}
.card-mini-back:first-child {
  margin-left: 0;
}
/* 底牌隐藏状态 */
.bottom-cards.hidden {
  opacity: 0.6;
}
/* 轮到玩家时手牌区高亮呼吸 */
.player-bottom.i-am-banker::before { content: "👑"; position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 22px; z-index: 10; text-shadow: 0 0 8px rgba(240,208,96,0.5); }
.player-bottom.your-turn {
  background: radial-gradient(ellipse at center, rgba(240, 208, 96, 0.06) 0%, transparent 70%);
  border-radius: 12px;
  animation: yourTurnGlow 1.8s ease-in-out infinite;
}
@keyframes yourTurnGlow {
  0%, 100% { box-shadow: inset 0 0 20px rgba(240, 208, 96, 0); }
  50% { box-shadow: inset 0 0 30px rgba(240, 208, 96, 0.08); }
}
.bottom-cards.revealed {
  animation: revealBottom 0.5s ease-out;
}
@keyframes revealBottom {
  from { opacity: 0.3; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
/* ---------- 消息区域（浮动提示，不盖住牌） ---------- */
#game-message {
  position: absolute;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  color: #f0e6c8;
  font-size: 14px;
  font-weight: normal;
  padding: 5px 18px;
  border-radius: 18px;
  border: 1px solid rgba(240, 230, 200, 0.1);
  text-align: center;
  pointer-events: none;
  z-index: 50;
  max-width: 65%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.3s ease;
  box-shadow: 0 3px 15px rgba(0,0,0,0.3);
}
#game-message:empty {
  opacity: 0;
  pointer-events: none;
}
/* 错误消息 — 红色边框突出 */
#game-message.error-msg {
  border-color: #e74c3c !important;
  color: #e74c3c !important;
  background: rgba(231, 76, 60, 0.15) !important;
  font-weight: bold;
}
/* 局末消息 — 放大居中突出 */
#game-message.round-end {
  top: 40%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  font-weight: bold;
  padding: 20px 40px;
  border-radius: 14px;
  white-space: normal;
  max-width: 80%;
  background: rgba(212, 160, 48, 0.18);
  border-color: #f0c040;
  color: #f0d060;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
}
/* ---------- 滚动条（极简） ---------- */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}
/* ---------- 响应式 ---------- */
/* ---------- 大屏断点（整体协调缩放） ---------- */
/* 中屏 900-1200px */
@media (min-width: 900px) {
  #game-table { padding: 0 4%; }
  #played-cards { width: min(400px, 70vw); height: 240px; }
  .card { flex: 1 1 0; min-width: 0; width: auto; aspect-ratio: 52 / 72; margin-left: -22px; }
  .card .card-rank { font-size: min(24px, 2.5vw); }
  .card .card-suit { font-size: min(26px, 3vw); }
  .card .card-rank { font-size: min(22px, 2.8vw); }
  .card .card-suit { font-size: min(24px, 3.2vw); }
  .card .card-rank { font-size: min(20px, 3vw); }
  .card .card-suit { font-size: min(22px, 3.5vw); }
  .card .card-rank { font-size: min(16px, 2.5vw); }
  .card .card-suit { font-size: min(18px, 3vw); }
  .hand-row { overflow: hidden; gap: 2px; padding: 12px 10px 0; }
  .card.small { width: 54px; height: 76px; }
  .player-left, .player-right { width: 120px; min-width: 80px; }
}
/* 大屏 1200-1600px */
@media (min-width: 1200px) {
  #game-table { padding: 0 6%; }
  #played-cards { width: min(480px, 65vw); height: 280px; }
  .card { flex: 1 1 0; min-width: 0; width: auto; aspect-ratio: 52 / 72; margin-left: -18px; }
  .card .card-rank { font-size: min(18px, 2.2vw); }
  .card .card-suit { font-size: min(20px, 2.6vw); }
  .card.small { width: 61px; height: 86px; }
  .player-left, .player-right { width: 140px; min-width: 100px; }
}
/* 超大屏 1600px+ */
@media (min-width: 1600px) {
  #game-table { padding: 0 8%; }
  #played-cards { width: min(560px, 60vw); height: 320px; }
  .card { flex: 1 1 0; min-width: 0; width: auto; aspect-ratio: 52 / 72; margin-left: -20px; }
  .card .card-rank { font-size: min(20px, 1.8vw); }
  .card .card-suit { font-size: min(22px, 2.2vw); }
  .card.small { width: 67px; height: 94px; }
  .player-left, .player-right { width: 160px; min-width: 120px; }
}
/* 手机/平板竖屏（补丁） */
@media (max-width: 899px) {
  #game-table { padding: 0 3%; }
  .player-left, .player-right { width: 80px; min-width: 60px; }
  .card { width: 48px; height: 68px; margin-left: -15px; }
  .card:first-child { margin-left: 0; }
  .card-back { width: 30px; height: 42px; margin-left: -18px; }
  .card.small { width: 36px; height: 50px; }
  #played-cards { width: min(260px, 80vw); height: 180px; }
}
/* 手机横屏 / 小平板 */
@media (min-width: 481px) and (max-width: 899px) {
  #game-table { padding: 0 3%; }
  .player-left, .player-right { width: 90px; min-width: 70px; }
  .player-top { min-height: 50px; }
  .card { width: 40px; height: 56px; margin-left: -12px; }
  .card.small { width: 30px; height: 42px; margin-left: -8px; }
  .card-back { width: 26px; height: 38px; margin-left: -14px; }
  #played-cards { width: 260px; height: 170px; }
  #center-area { min-height: 140px; }
  .hand-row { padding: 12px 8px 0; overflow-x: auto; }
  .bottom-info { font-size: 13px; }
  .play-type-info { font-size: 11px; top: -24px; }
  .trick-memo { font-size: 10px; bottom: -48px; }
  #action-btn { font-size: 15px; padding: 10px 30px; }
  .bid-suit { width: 56px; height: 56px; font-size: 30px; }
}

@media (max-width: 768px) {
  .player-left, .player-right {
    width: 80px;
    min-width: 60px;
  }
  .card {
    width: 44px;
    height: 62px;
    margin-left: -14px;
  }
  .card:first-child { margin-left: 0; }
  .card-back {
    width: 28px;
    height: 40px;
    margin-left: -16px;
  }
  .card-rank { font-size: 14px; }
  .card-suit { font-size: 15px; }
  #played-cards { width: 220px; height: 160px; }
  #top-bar { font-size: 12px; padding: 4px 8px; flex-wrap: wrap; }
  .card.small { width: 30px; height: 42px; margin-left: -10px; }
  #game-area { gap: 1px; padding: 2px 4px; }
  #game-message { font-size: 13px; padding: 4px 14px; top: 48px; }
  #action-btn { padding: 8px 20px; font-size: 14px; }
  .hand-row { padding: 12px 8px 0; overflow-x: auto; justify-content: flex-start; }
  .hand-row::-webkit-scrollbar { height: 3px; }
  .bottom-label { font-size: 10px; }
  .score-row { gap: 8px; }
  #volume-slider { width: 60px; }
  .bottom-info { font-size: 12px; padding: 3px 12px; bottom: -26px; }
  .trick-memo { font-size: 10px; bottom: -48px; }
  .play-type-info { font-size: 10px; top: -24px; }
}
/* 手机竖屏 */
@media (max-width: 480px) {
  #game-table { border-radius: 0; padding: 0 2%; }
  #top-bar { font-size: 10px; padding: 3px 6px; gap: 2px; }
  #trump-display { min-width: auto; font-size: 11px; }
  #controls { gap: 4px; }
  #bgm-toggle { font-size: 11px; padding: 2px 8px; }
  #help-btn { font-size: 11px; padding: 2px 8px; }
  #track-prev, #track-next { font-size: 11px; padding: 2px 6px; }
  #volume-slider { width: 40px; }
  .player-left, .player-right {
    width: 50px;
    min-width: 40px;
  }
  .player-top { min-height: 32px; }
  .player-area { min-height: 48px; }
  .card {
    width: 24px;
    height: 34px;
    margin-left: -12px;
  }
  .card:first-child { margin-left: 0; }
  .card-rank { font-size: 6px; }
  .card-suit { font-size: 7px; }
  .card .card-icon { font-size: 12px; }
  .card.small { width: 13px; height: 18px; }
  .card.mini { width: 18px; height: 26px; }
  .card-mini-back { width: 22px; height: 32px; }
  .card-back {
    width: 12px;
    height: 20px;
    margin-left: -6px;
  }
  .card-back::after { font-size: 5px; }
  .banker-crown { display: inline-block; font-size: 16px; margin-left: 4px; vertical-align: middle; text-shadow: 0 0 6px rgba(240,208,96,0.6); }
.ai-label { font-size: 10px; padding: 1px 6px; }
  .hand-row { padding: 12px 0 0; gap: 0; overflow: hidden; }
  .player-bottom { min-height: 56px; padding: 2px 0; }
  #played-cards { width: 140px; height: 80px; }
  #center-area { min-height: 80px; }
  .center-empty { font-size: 12px; }
  .banker-tag { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: 26px; z-index: 6; filter: drop-shadow(0 0 10px rgba(240,208,96,0.8)); pointer-events: none; text-shadow: 0 0 8px rgba(240,208,96,0.5); }
.player-tag { font-size: 9px; padding: 1px 4px; bottom: -15px; }
  .play-type-info { font-size: 9px; top: -20px; padding: 1px 8px; }
  .bottom-info { font-size: 10px; padding: 2px 8px; bottom: -22px; }
  .trick-memo { font-size: 9px; bottom: -42px; }
  #game-message {
    font-size: 12px;
    padding: 4px 12px;
    top: 44px;
    border-radius: 14px;
    max-width: 90%;
  }
  #bottom-bar {
    flex-direction: column;
    gap: 4px;
    padding: 4px 8px;
    min-height: 36px;
  }
  #scoreboard { font-size: 11px; }
  .score-row { gap: 8px; flex-wrap: wrap; }
  .score-value { font-size: 12px; }
  #action-btn {
    font-size: 13px;
    padding: 8px 24px;
  }
  .hand-separator { font-size: 9px; padding: 0 4px; }
  .bottom-cards { gap: 2px; }
  .bottom-label { font-size: 9px; }
  ::-webkit-scrollbar { width: 2px; height: 2px; }
}
/* 特别小屏幕（<360px） */
@media (max-width: 360px) {
  #game-area { overflow-y: auto; }
  .player-left, .player-right { width: 36px; min-width: 30px; }
  .card { width: 30px; height: 42px; margin-left: -14px; }
  .card-rank { font-size: 9px; }
  .card-suit { font-size: 10px; }
  .card-back { width: 18px; height: 26px; margin-left: -12px; }
  .hand-row { padding: 12px 0 0; overflow-x: auto; }
  #played-cards { width: 130px; height: 110px; }
  .card.small { width: 24px; height: 34px; margin-left: -6px; }
  .card .card-icon { font-size: 10px; }
}
/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  .card-hover:hover { transform: none; box-shadow: 1px 2px 4px rgba(0,0,0,0.2); }
  .card:hover { box-shadow: 1px 2px 4px rgba(0,0,0,0.2); transform: none; }
  .card.selected { transform: translateY(-10px); }
  .card:active { transform: translateY(-6px); }
  #action-btn:hover { transform: none; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
  #action-btn:active { transform: scale(0.97); }
  #bgm-toggle:hover { background: rgba(255,255,255,0.1); }
  #bgm-toggle:active { background: rgba(255,255,255,0.2); }
}
/* 安全区适配（刘海屏）— 不覆盖左右padding，让百分比留白生效 */
@supports (padding: env(safe-area-inset-top)) {
  #game-table {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  #top-bar { padding-top: max(8px, env(safe-area-inset-top)); }
  #bottom-bar { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}
/* ---------- 战绩弹窗 ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.visible {
  display: flex;
}
.modal-content {
  background: linear-gradient(135deg, #1a3a2a, #0d2d1a);
  border: 1px solid rgba(240, 230, 200, 0.15);
  border-radius: 16px;
  padding: 24px;
  max-width: 420px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  color: #f0e6c8;
  box-shadow: 0 16px 64px rgba(0,0,0,0.6);
  animation: fadeInUp 0.3s ease-out;
}
.stats-empty {
  text-align: center;
  color: rgba(240, 230, 200, 0.4);
  padding: 32px;
  font-size: 14px;
}
.stats-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 12px 8px;
}
.stat-num {
  font-size: 24px;
  font-weight: bold;
}
.stat-num.gold {
  color: #f0d060;
}
.stat-label {
  font-size: 11px;
  color: rgba(240, 230, 200, 0.5);
  margin-top: 2px;
}
.stats-detail {
  display: flex;
  justify-content: center;
  gap: 24px;
  font-size: 13px;
  color: rgba(240, 230, 200, 0.7);
}
.stats-detail strong {
  color: #f0d060;
}
.stats-recent-title {
  font-size: 13px;
  font-weight: bold;
  color: rgba(240, 230, 200, 0.6);
  margin-bottom: 4px;
}
.recent-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 2px;
}
.recent-row.win {
  background: rgba(46, 125, 50, 0.15);
}
.recent-row.loss {
  background: rgba(198, 40, 40, 0.15);
}
/* 战绩详情扩展 */
.stats-section-title {
  font-size: 14px; font-weight: bold; color: #f0d060;
  margin-top: 12px; margin-bottom: 6px;
  padding-bottom: 4px; border-bottom: 1px solid rgba(240,230,200,0.1);
}
.stats-avg {
  display: flex; justify-content: center; gap: 20px;
  font-size: 12px; color: rgba(240,230,200,0.6); margin-top: 6px;
}
.stats-avg b { color: #f0e6c8; }
.trend-chart {
  display: flex; align-items: flex-end; gap: 4px;
  height: 100px; padding: 4px 0;
  border-bottom: 1px solid rgba(240,230,200,0.1);
}
.trend-bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.trend-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.trend-bar { width: 70%; border-radius: 3px 3px 0 0; min-height: 2px; }
.trend-win { background: rgba(46,125,50,0.6); }
.trend-loss { background: rgba(198,40,40,0.6); }
.trend-label { font-size: 9px; color: rgba(240,230,200,0.4); margin-top: 2px; }
.trend-val { font-size: 9px; color: rgba(240,230,200,0.5); }
.stats-reset { text-align: center; margin-top: 12px; }
.stats-reset-btn {
  background: rgba(198,40,40,0.2); border: 1px solid rgba(198,40,40,0.3);
  color: #e74c3c; padding: 6px 16px; border-radius: 6px;
  cursor: pointer; font-size: 12px;
}
.stats-reset-btn:hover { background: rgba(198,40,40,0.35); }
#stats-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #f0e6c8;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}
#stats-btn:hover {
  background: rgba(255,255,255,0.2);
}
#help-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #f0e6c8;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}
#help-btn:hover {
  background: rgba(255,255,255,0.2);
}
/* 帮助面板 */
.help-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(240, 230, 200, 0.9);
}
.help-title {
  font-size: 18px;
  font-weight: bold;
  color: #f0d060;
  text-align: center;
  margin-bottom: 4px;
}
.help-section {
  padding: 6px 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
}
.help-h {
  font-weight: bold;
  color: #f0d060;
  margin-bottom: 2px;
  font-size: 14px;
}
.help-section p {
  margin: 2px 0;
  font-size: 12px;
}