/* =========================================================================
   宜宾麻将 UI v3 —— 按参考截图重建：四向立牌墙 + 中央风向灯 + 点提/拖动出牌
   设计来源：对参考图做像素级实测（蓝条 #0049DB / 金线 #E99A2D /
            绿桌 #128B2F→#0D7725 / 牌墙背 #D7A74D / 灰核 #696A69 /
            手牌 #E4E0CB / 风向灯 红 #E53935）。
   仅覆盖视觉，DOM 结构与所有事件/数据流向保持原样（逻辑不动）。
   ========================================================================= */

/* 页面底色：深木纹 */
.game-table-page { background: #0a0f0c; }

/* ---------- 顶部蓝条 + 金色下缘 ---------- */
.game-table-page .game-header {
  background: linear-gradient(180deg, #1a63d0 0%, #0049DB 100%);
  border-bottom: 3px solid #E99A2D;
  padding: 8px 12px;
  height: 46px;
  min-height: 46px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.45);
  gap: 8px;
}
.game-table-page .game-header .back-btn {
  color: #fff;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.55);
}
.game-table-page .game-header .back-btn:hover { background: rgba(255,255,255,0.28); }
.game-table-page .game-room-code { color: #ffffff; text-shadow: 0 1px 2px rgba(0,0,0,0.35); }
.game-table-page .game-status { color: #FFE9B0; }
.game-table-page .game-header .dissolve-btn {
  color: #fff; background: rgba(226,85,85,0.9); border: none;
}
.game-table-page .game-header .dissolve-btn:hover { background: rgba(226,85,85,1); }

/* ---------- 牌桌容器 ---------- */
.game-table-page .game-main { padding: 6px; }
.game-table-page .table-section { position: relative; box-sizing: border-box; padding: 60px 60px; overflow: visible; width: 100%; }

.game-table-page .table-layout-v2 {
  /* 横版 4:3，按视口高度约束宽度 */
  width: min(100%, calc((100vh - 110px) * 4 / 3));
  aspect-ratio: 4 / 3;
  height: auto;
  margin: auto;
  --wall-depth: 42px;             /* 牌墙占用边宽 */
  --opponent-hand-depth: 56px;    /* 绿框：手牌区占用边宽 */
  --river-depth: 40px;            /* 黄框：河牌区占用边宽 */
  --core-size: 110px;             /* 中央核尺寸 */
  --avatar-depth: 42px;           /* 头像占用 */
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 45%, #128B2F 0%, #0D7725 50%, #064d18 100%);
  box-shadow:
    inset 0 0 0 10px #0B501C,
    inset 0 0 0 11px rgba(233,154,45,0.55),
    0 16px 42px rgba(0,0,0,0.6);
}

/* ---------- 牌墙：铺满四边，立牌背朝外 ---------- */
.game-table-page .tile-wall {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 1;
  pointer-events: none;
  --wt-w: 15px;
  --wt-h: 15px;
  --group-gap: 1px;
}
.game-table-page .tile-wall:empty { display: none; }

.game-table-page .wall-side {
  position: absolute;
  display: flex;
  gap: 1px;
  padding: 1px;
  border-radius: 6px;
}
.game-table-page .wall-bottom { bottom: 0; left: 50%; transform: translateX(-50%); flex-direction: row; --wt-w: 15px; --wt-h: 15px; }
.game-table-page .wall-top    { top: 0;    left: 50%; transform: translateX(-50%); flex-direction: row; --wt-w: 15px; --wt-h: 15px; }
.game-table-page .wall-left   { left: 0;  top: 50%; transform: translateY(-50%); flex-direction: column; --wt-w: 15px; --wt-h: 15px; }
.game-table-page .wall-right  { right: 0; top: 50%; transform: translateY(-50%); flex-direction: column; --wt-w: 15px; --wt-h: 15px; }

/* 单组 = 两张牌叠放；为适配四边，所有组统一 24×58 竖牌 */
.game-table-page .tile-wall-stack {
  width: var(--wt-w);
  height: calc(var(--wt-h) * 2 + var(--group-gap));
  position: relative;
  flex-shrink: 0;
}
.game-table-page .tile-wall-stack .tile.back {
  position: absolute;
  width: var(--wt-w);
  height: var(--wt-h);
  border-radius: 3px;
  /* 牌背统一引用 :root 牌背令牌（墨绿），与 .op-hand-card/.hand-card.back/.tile.back 一致 */
  background:
    radial-gradient(circle at 50% 42%, var(--tile-back-c1) 0%, var(--tile-back-c2) 55%, var(--tile-back-c3) 100%);
  border: 1px solid var(--tile-back-edge);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    1px 1px 0 var(--tile-back-sh1), 2px 2px 0 var(--tile-back-sh2), 3px 4px 0 var(--tile-back-sh3),
    0 4px 6px rgba(0,0,0,0.4);
}
.game-table-page .tile-wall-stack .tile.back::before {
  content: ''; position: absolute; inset: 2px;
  border: 1px solid rgba(var(--tile-back-edge-rgb), 0.5); border-radius: 2px;
}
.game-table-page .tile-wall-stack .tile.back::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 44%; height: 44%; transform: translate(-50%,-50%) rotate(45deg);
  background: linear-gradient(135deg, var(--tile-back-dia1), var(--tile-back-dia2));
  box-shadow: 0 0 3px rgba(var(--tile-back-edge-rgb), 0.6); border-radius: 2px;
}

/* 顶牌/底牌定位 */
.game-table-page .tile-wall-stack .tw-lo { bottom: 0; left: 0; z-index: 1; }
.game-table-page .tile-wall-stack .tw-hi { top: 0;    left: 0; z-index: 2; }

/* 各边牌墙：统一竖牌 */
.game-table-page .wall-bottom .tile.back { transform: rotate(0deg); }
.game-table-page .wall-top    .tile.back { transform: rotate(180deg); }
.game-table-page .wall-left   .tile.back { transform: rotate(0deg); }
.game-table-page .wall-right  .tile.back { transform: rotate(0deg); }

/* 已摸走的组：淡出占位 */
.game-table-page .tile-wall-stack.taken { opacity: 0; }

/* 起牌点高亮 */
.game-table-page .wall-side.draw-origin {
  box-shadow: 0 0 0 2px rgba(244,195,77,0.7), 0 0 12px rgba(244,195,77,0.45);
}

/* 当前即将摸牌的那一组脉冲 */
.game-table-page .tile-wall-stack.draw-now .tile.back {
  box-shadow:
    0 0 0 2px #ffe27a, 0 0 9px #ffd84d,
    0 1px 0 var(--tile-back-sh1), 0 2px 0 var(--tile-back-sh2), 0 3px 0 var(--tile-back-sh3);
  animation: wallPulseV3 1.1s ease-in-out infinite;
}
@keyframes wallPulseV3 {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.35); }
}

/* 方向标签（东/南/西/北）- 沿牌墙边缘 */
.game-table-page .wall-dir {
  position: absolute;
  font-size: 8px; font-weight: 800; color: #f0d27a;
  background: rgba(10,40,22,0.75); padding: 0 3px; border-radius: 4px;
  border: 1px solid rgba(244,195,77,0.45);
}
.game-table-page .wall-bottom .wall-dir, .game-table-page .wall-top .wall-dir { bottom: -2px; left: 50%; transform: translate(-50%,100%); }
.game-table-page .wall-left .wall-dir { left: -2px; top: 50%; transform: translate(-100%,-50%); }
.game-table-page .wall-right .wall-dir { right: -2px; top: 50%; transform: translate(100%,-50%); }

/* ---------- 四家手牌区（绿框）：自己底部 + 对手顶/左/右 ---------- */
.game-table-page .hand-strip.hand-top,
.game-table-page .hand-strip.hand-left,
.game-table-page .hand-strip.hand-right {
  position: absolute;
  z-index: 3;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 2px;
  background: rgba(0,0,0,0.12);
  border-radius: 6px;
  border: 1px solid rgba(244,195,77,0.14);
  overflow: hidden;
  pointer-events: none;
}
.game-table-page .hand-strip.hand-top,
.game-table-page .hand-strip.hand-bottom {
  height: var(--opponent-hand-depth);
  flex-direction: row;
  left: 50%;
  transform: translateX(-50%);
}
.game-table-page .hand-strip.hand-left,
.game-table-page .hand-strip.hand-right {
  width: var(--opponent-hand-depth);
  flex-direction: column;
  top: 50%;
  transform: translateY(-50%);
}
.game-table-page .hand-strip.hand-top    { top: calc(var(--wall-depth) + 4px); width: 70%; }
.game-table-page .hand-strip.hand-left   { left: calc(var(--wall-depth) + 4px); height: 62%; }
.game-table-page .hand-strip.hand-right  { right: calc(var(--wall-depth) + 4px); height: 62%; }

/* 对手扣背牌尺寸：缩小+留缝，避免叠盖观感 */
.game-table-page .op-hand-card.h {
  width: 22px;
  height: 34px;
  margin-right: 0;
  border-radius: 3px;
}
.game-table-page .op-hand-card.h + .op-hand-card.h { margin-left: 2px; }
.game-table-page .op-hand-card.v {
  width: 34px;
  height: 22px;
  margin-bottom: 0;
  border-radius: 3px;
}
.game-table-page .op-hand-card.v + .op-hand-card.v { margin-top: 2px; }

/* ---------- 四条河（弃牌区）：位于绿框内侧的黄框 ---------- */
.game-table-page .river {
  position: absolute;
  z-index: 4;
  display: flex;
  gap: 2px;
  padding: 2px;
  background: rgba(0,0,0,0.18);
  border-radius: 5px;
  border: 1px solid rgba(244,195,77,0.12);
  overflow: hidden;
}
/* 河牌容器：3 行（外 14 / 中 13 / 内 12）错位堆叠。top/bottom 纵向叠，left/right 横向叠（旋转后视觉上 3 列错位） */
.game-table-page .river-top, .game-table-page .river-bottom {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  left: 50%; transform: translateX(-50%);
}
.game-table-page .river-left, .game-table-page .river-right {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1px;
  top: 50%; transform: translateY(-50%);
}
.game-table-page .river-top    { top: calc(var(--wall-depth) + var(--opponent-hand-depth) + 8px); width: 78%; height: calc(3 * 30px + 2px); }
.game-table-page .river-bottom { bottom: calc(var(--wall-depth) + var(--opponent-hand-depth) + 8px); width: 78%; height: calc(3 * 30px + 2px); }
.game-table-page .river-left   { left: calc(var(--wall-depth) + var(--opponent-hand-depth) + 8px); width: calc(3 * 22px + 2px); height: 70%; }
.game-table-page .river-right  { right: calc(var(--wall-depth) + var(--opponent-hand-depth) + 8px); width: calc(3 * 22px + 2px); height: 70%; }

/* 河牌行：top/bottom 水平排列（row 0 外缘 14、row 1 中 13 错位、row 2 内 12 再错位）；left/right 垂直排列（单牌 rotate 90° 后视觉上 3 列错位） */
.game-table-page .river-top .river-row, .game-table-page .river-bottom .river-row {
  display: flex;
  flex-direction: row;
  gap: 1px;
  line-height: 0;
}
.game-table-page .river-left .river-row, .game-table-page .river-right .river-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
/* top/bottom：水平错位 0 / 半牌宽（11px）/ 整牌宽（22px）—— row 越大越靠中心 */
.game-table-page .river-top .river-row[data-row="1"],
.game-table-page .river-bottom .river-row[data-row="1"] { transform: translateX(11px); }
.game-table-page .river-top .river-row[data-row="2"],
.game-table-page .river-bottom .river-row[data-row="2"] { transform: translateX(22px); }
/* left/right：垂直错位 0 / 半牌高（15px）/ 整牌高（30px）—— row 越大越靠中心（旋转 90° 后视觉上从外缘向中心） */
.game-table-page .river-left .river-row[data-row="1"],
.game-table-page .river-right .river-row[data-row="1"] { transform: translateY(15px); }
.game-table-page .river-left .river-row[data-row="2"],
.game-table-page .river-right .river-row[data-row="2"] { transform: translateY(30px); }
/* 2/3 人局时左右河牌压窄 */
.game-table-page .table-layout-v2.players-2 .river-left,
.game-table-page .table-layout-v2.players-2 .river-right,
.game-table-page .table-layout-v2.players-3 .river-left,
.game-table-page .table-layout-v2.players-3 .river-right {
  width: calc(3 * 22px + 2px);
  height: 50%;
}

.game-table-page .river .discard-card {
  width: clamp(14px, 3.6vmin, 22px);
  height: clamp(19px, 5vmin, 30px);
  border-radius: 3px;
  background: linear-gradient(160deg, #fbf8ec 0%, #f0f0e0 60%, #e2dcc4 100%);
  border: 1px solid #cfc7a8;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    1px 1px 0 #d8d0b2, 2px 2px 0 #c8c09e, 0 2px 4px rgba(0,0,0,0.35);
  flex-shrink: 0;
}
/* 全局"刚打出"的那张牌高亮（黄色光圈），仅一张避免视觉冗余 */
.game-table-page .river .discard-card.latest {
  box-shadow:
    0 0 0 2px rgba(244,195,77,0.95),
    1px 1px 0 #d8d0b2, 2px 2px 0 #c8c09e,
    0 4px 8px rgba(0,0,0,0.45);
}

/* 河牌旋转：保持各自视角 */
.game-table-page .river-bottom .discard-card { transform: rotate(0deg); }
.game-table-page .river-top    .discard-card { transform: rotate(180deg); }
.game-table-page .river-left   .discard-card { transform: rotate(90deg); }
.game-table-page .river-right  .discard-card { transform: rotate(-90deg); }

/* ---------- 中央核：剩余张数 + 东南西北风向灯 ---------- */
.game-table-page .table-core {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 8;
  width: var(--core-size);
  height: var(--core-size);
  background: linear-gradient(160deg, #696A69 0%, #4f504f 60%, #3a3b3a 100%);
  border: 2px solid #E99A2D;
  border-radius: 12px;
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,0.5),
    0 6px 18px rgba(0,0,0,0.5);
  display: grid;
  place-items: center;
  pointer-events: none;
}

/* 中央数字：剩余张数 */
.game-table-page .wall-count-frame {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border: 2px solid #E99A2D;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.38);
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.55),
    0 0 6px rgba(233, 154, 45, 0.35);
  pointer-events: none;
}
.game-table-page #wall-info {
  font-family: 'Courier New', monospace;
  font-size: clamp(16px, 4vmin, 22px);
  font-weight: 900;
  color: #4dabf5;
  text-shadow: 0 0 6px rgba(77,171,245,0.6), 0 1px 2px rgba(0,0,0,0.8);
  line-height: 1;
  letter-spacing: 0.5px;
}
.game-table-page #wall-info::before { content: none; }

/* 骰子区：铺满中央核，仅显示结果小字 */
.game-table-page .dice-area {
  position: absolute;
  inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  pointer-events: none;
}
.game-table-page .dice-cups { display: none; }
.game-table-page .dice-result {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px; color: #FFE9B0; text-shadow: 0 1px 2px #000;
  min-height: 12px; text-align: center;
}

/* 风向灯：東南西北，位于核的四边 */
.game-table-page .table-core::before,
.game-table-page .table-core::after,
.game-table-page .dice-area::before,
.game-table-page .dice-area::after {
  position: absolute;
  font-size: 13px;
  font-weight: 800;
  color: rgba(255,255,255,0.45);
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
  transition: all .25s ease;
  pointer-events: none;
}
.game-table-page .table-core::before { content: '北'; top: 4px; left: 50%; transform: translateX(-50%); }
.game-table-page .table-core::after  { content: '南'; bottom: 4px; left: 50%; transform: translateX(-50%); }
.game-table-page .dice-area::before  { content: '西'; left: 6px; top: 50%; transform: translateY(-50%); }
.game-table-page .dice-area::after   { content: '東'; right: 6px; top: 50%; transform: translateY(-50%); }

/* 风向灯激活：红色高亮 + 光晕 */
.game-table-page .table-core.turn-north::before,
.game-table-page .table-core.turn-south::after {
  color: #ff5a5a;
  text-shadow: 0 0 8px #ff5a5a, 0 0 16px rgba(255,90,90,0.7), 0 1px 2px rgba(0,0,0,0.7);
  transform: translateX(-50%) scale(1.15);
}
.game-table-page .table-core.turn-west .dice-area::before,
.game-table-page .table-core.turn-east .dice-area::after {
  color: #ff5a5a;
  text-shadow: 0 0 8px #ff5a5a, 0 0 16px rgba(255,90,90,0.7), 0 1px 2px rgba(0,0,0,0.7);
  transform: translateY(-50%) scale(1.15);
}

/* ---------- 四角玩家芯片 ---------- */
.game-table-page .avatar-node {
  position: absolute;
  z-index: 12;
  width: auto;
  min-width: 38px;
  max-width: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 5px 7px;
  background: linear-gradient(165deg, rgba(22,30,24,0.95), rgba(8,14,10,0.95));
  border: 1.5px solid rgba(233,154,45,0.55);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
  color: #f3efe0;
  text-align: center;
}
.game-table-page .avatar-node.active {
  border-color: #F4C34D;
  box-shadow: 0 0 0 2px rgba(244,195,77,0.35), 0 0 18px 4px rgba(244,195,77,0.65);
  animation: seatPulseV3 1.4s ease-in-out infinite;
}
@keyframes seatPulseV3 {
  0%, 100% { box-shadow: 0 0 0 2px rgba(244,195,77,0.35), 0 0 18px 4px rgba(244,195,77,0.5); }
  50%      { box-shadow: 0 0 0 3px rgba(244,195,77,0.5), 0 0 24px 8px rgba(244,195,77,0.85); }
}
.game-table-page .avatar-face { font-size: 18px; line-height: 1; }
.game-table-page .avatar-name { font-size: 10px; font-weight: 700; color: #f6f2e4; max-width: 52px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-table-page .avatar-count { display: block !important; font-size: 9px; color: #FFE9B0; }
.game-table-page .avatar-score { display: block !important; font-size: 10px; font-weight: 800; color: #fff; }

.game-table-page .avatar-top    { top: 6px; left: 50%; transform: translateX(-50%); flex-direction: row; gap: 8px; padding: 5px 12px; min-width: 150px; max-width: 260px; z-index: 14; }
.game-table-page .avatar-bottom { bottom: 6px; left: 50%; transform: translateX(-50%); flex-direction: row; gap: 8px; padding: 5px 12px; min-width: 150px; max-width: 260px; }
.game-table-page .avatar-left   { left: 6px; top: 50%; transform: translateY(-50%); flex-direction: row; gap: 6px; padding: 5px 10px; }
.game-table-page .avatar-right  { right: 6px; top: 50%; transform: translateY(-50%); flex-direction: row; gap: 6px; padding: 5px 10px; }

.game-table-page .avatar-node.dealer::after {
  content: '庄';
  position: absolute;
  top: -9px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, #F4C34D, #d9a93a);
  color: #3a2a00;
  font-size: 9px; font-weight: 800; padding: 1px 5px; border-radius: 999px;
  border: 1px solid #b8893b; box-shadow: 0 2px 5px rgba(0,0,0,0.45);
}

/* ---------- 自己手牌：放入底部绿框 ---------- */
.game-table-page .hand-strip.hand-bottom {
  position: absolute;
  bottom: calc(var(--wall-depth) + 4px);
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: var(--opponent-hand-depth);
  max-width: 92%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0;
}
.game-table-page .avatar-bottom { display: none !important; }
.game-table-page .hand-bottom .hand-info {
  display: flex;
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  gap: 10px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(233,154,45,0.35);
  border-radius: 999px;
  padding: 3px 12px;
  color: #f3efe0;
  white-space: nowrap;
}
.game-table-page .hand-bottom .hand-info::before {
  content: '👤';
  font-size: 14px;
  margin-right: -6px;
}
.game-table-page .hand-bottom .self-melds {
  position: absolute;
  bottom: calc(var(--wall-depth) + var(--opponent-hand-depth) + var(--river-depth) + 12px);
  left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(233,154,45,0.35);
  border-radius: 8px;
  padding: 3px;
  z-index: 11;
}

.game-table-page .hand-cards {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-end;
  gap: 0;
  width: 100%;
  height: 100%;
  padding: 0 4px 2px;
  min-height: 0;
  overflow-x: auto;
  touch-action: pan-x;
  user-select: none;
  -webkit-user-select: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.game-table-page .hand-cards::-webkit-scrollbar { display: none; }

.game-table-page .hand-card {
  width: clamp(18px, 4.8vmin, 30px);
  height: clamp(22px, 5.8vmin, 46px);
  flex-shrink: 0;
  margin: 0;
  background: linear-gradient(160deg, #fbf8ec 0%, #f0f0e0 55%, #e2dcc4 100%);
  border: 1px solid #cfc7a8;
  border-radius: 3px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    1px 1px 0 #d8d0b2, 2px 3px 0 #c8c09e, 3px 5px 0 #b8b08c,
    0 7px 12px rgba(0,0,0,0.42);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
/* 牌背统一：.hand-card.back 必须压过上方 .hand-card 的牌面米白底色（table-v2 后加载、同优先级后者胜），
   否则发牌期隐藏牌会显示成米白"白背"。全部引用 :root 牌背令牌（墨绿），与牌墙/对手扣背完全一致。 */
.game-table-page .hand-card.back,
.game-table-page .hand-card.back:hover {
  background: radial-gradient(circle at 50% 42%, var(--tile-back-c1) 0%, var(--tile-back-c2) 55%, var(--tile-back-c3) 100%);
  border: 1.5px solid var(--tile-back-edge);
  cursor: default;
  transform: none;
  box-shadow:
    1px 1px 0 var(--tile-back-sh1),
    2px 3px 0 var(--tile-back-sh2),
    3px 5px 0 var(--tile-back-sh3),
    0 6px 10px rgba(0, 0, 0, 0.4);
}
.game-table-page .hand-card.back::before {
  content: ''; position: absolute; inset: 2px;
  border: 1px solid rgba(var(--tile-back-edge-rgb), 0.55);
  border-radius: 4px;
}
.game-table-page .hand-card.back::after {
  content: ''; position: absolute; left: 50%; top: 48%;
  width: 46%; height: 46%; transform: translate(-50%, -50%) rotate(45deg);
  background: linear-gradient(135deg, var(--tile-back-dia1), var(--tile-back-dia2));
  box-shadow: 0 0 4px rgba(var(--tile-back-edge-rgb), 0.7);
  border-radius: 2px;
}

.game-table-page .hand-card:hover {
  transform: translateY(-8px);
  border-color: #F4C34D;
}
.game-table-page .hand-card.selected {
  transform: translateY(-18px);
  border-color: #F4C34D;
  box-shadow:
    0 0 0 2px #F4C34D,
    0 10px 20px rgba(0,0,0,0.5),
    0 14px 22px rgba(0,0,0,0.4);
  z-index: 20;
}
.game-table-page .hand-card.dragging-armed {
  box-shadow:
    0 0 0 2px #F4C34D,
    0 12px 22px rgba(244,195,77,0.6),
    0 0 26px rgba(255,210,120,0.7);
}
.game-table-page .hand-card.disabled {
  filter: grayscale(0.7) brightness(0.62);
  opacity: 0.55;
}
.game-table-page .hand-card.disabled:hover { transform: none; border-color: #cbb98c; }

/* 刚摸起的牌 */
.game-table-page .hand-cards .drawn-tile {
  box-shadow:
    0 0 0 2px #F4C34D,
    0 6px 12px rgba(244,195,77,0.45),
    0 0 16px rgba(244,195,77,0.35);
}
.game-table-page .hand-cards .drawn-tile.selected {
  box-shadow:
    0 0 0 2px #FFE9B0,
    0 8px 16px rgba(244,195,77,0.6),
    0 0 22px rgba(244,195,77,0.5);
}

/* ---------- 亮牌（碰/杠） ---------- */
.game-table-page .meld-group {
  display: flex;
  gap: 1px;
  padding: 2px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(233,154,45,0.35);
  border-radius: 4px;
}
.game-table-page .meld-tile {
  width: clamp(14px, 3.6vmin, 22px);
  height: clamp(19px, 5vmin, 30px);
  border-radius: 3px;
  background: linear-gradient(160deg, #fbf8ec 0%, #f0f0e0 60%, #e2dcc4 100%);
  border: 1px solid #cfc7a8;
}

/* ---------- 操作按钮：右下角黄色框 + 彩色光圈 ---------- */
.game-table-page .game-actions {
  position: absolute;
  bottom: calc(var(--wall-depth) + 4px);
  right: calc(var(--wall-depth) + 4px);
  z-index: 20;
  display: none;                 /* 默认隐藏，JS 按需显示 */
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  max-width: 62%;
  padding: 6px 10px;
  background: rgba(10,25,12,0.92);
  border: 2px solid #F4C34D;
  border-radius: 10px;
  box-shadow:
    0 0 0 2px rgba(244,195,77,0.25),
    0 0 18px rgba(244,195,77,0.35),
    0 6px 18px rgba(0,0,0,0.5);
  pointer-events: auto;
}
.game-table-page .game-actions.active { display: flex; }

/* 圆形 3D 图标按钮（参考第二张截图） */
.game-table-page .game-actions .btn {
  width: 46px;
  height: 46px;
  min-width: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  color: #1a1a1a;
  border: 2px solid rgba(255,255,255,0.45);
  border-radius: 50%;
  background: linear-gradient(160deg, #e8e8e8 0%, #b0b0b0 45%, #808080 100%);
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.65),
    inset 0 -4px 6px rgba(0,0,0,0.35),
    0 4px 8px rgba(0,0,0,0.45);
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
  transition: all .15s ease;
}
.game-table-page .game-actions .btn:hover { filter: brightness(1.1); transform: translateY(-2px); }
.game-table-page .game-actions .btn:active { transform: translateY(1px); }

/* 各动作按钮语义色（保留 3D 金属高光） */
.game-table-page .game-actions #chi-btn    { background: linear-gradient(160deg, #a5f3fc 0%, #22d3ee 45%, #0891b2 100%); color: #064e63; }
.game-table-page .game-actions #draw-btn   { background: linear-gradient(160deg, #93c5fd 0%, #3b82f6 45%, #1d4ed8 100%); color: #eff6ff; text-shadow: 0 1px 0 rgba(0,0,0,0.25); border-color: rgba(255,255,255,0.55); }
.game-table-page .game-actions #win-btn    { background: linear-gradient(160deg, #fca5a5 0%, #ef4444 45%, #b91c1c 100%); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,0.25); border-color: rgba(255,255,255,0.5); }
.game-table-page .game-actions #peng-btn   { background: linear-gradient(160deg, #fde047 0%, #facc15 45%, #b45309 100%); color: #3a2a00; }
.game-table-page .game-actions #gang-btn    { background: linear-gradient(160deg, #fde68a 0%, #F4C34D 45%, #b8891f 100%); color: #3a2a00; }
.game-table-page .game-actions #pass-btn   { background: linear-gradient(160deg, #d1d5db 0%, #6b7280 45%, #374151 100%); color: #f3f4f6; text-shadow: 0 1px 0 rgba(0,0,0,0.25); border-color: rgba(255,255,255,0.35); }

/* 彩色光圈：按钮显示时自带对应颜色光晕 + 保留 3D 按钮体感 */
.game-table-page .game-actions #chi-btn:not([style*="display: none"]) { box-shadow: inset 0 2px 4px rgba(255,255,255,0.65), inset 0 -4px 6px rgba(0,0,0,0.25), 0 0 0 2px #22d3ee, 0 0 12px rgba(34,211,238,0.65), 0 4px 8px rgba(0,0,0,0.45); }
.game-table-page .game-actions #peng-btn:not([style*="display: none"]) { box-shadow: inset 0 2px 4px rgba(255,255,255,0.65), inset 0 -4px 6px rgba(0,0,0,0.25), 0 0 0 2px #facc15, 0 0 12px rgba(250,204,21,0.65), 0 4px 8px rgba(0,0,0,0.45); }
.game-table-page .game-actions #gang-btn:not([style*="display: none"]) { box-shadow: inset 0 2px 4px rgba(255,255,255,0.65), inset 0 -4px 6px rgba(0,0,0,0.25), 0 0 0 2px #F4C34D, 0 0 14px rgba(244,195,77,0.75), 0 4px 8px rgba(0,0,0,0.45); }
.game-table-page .game-actions #pass-btn:not([style*="display: none"]) { box-shadow: inset 0 2px 4px rgba(255,255,255,0.5), inset 0 -4px 6px rgba(0,0,0,0.35), 0 0 0 2px #9ca3af, 0 0 12px rgba(156,163,175,0.6), 0 4px 8px rgba(0,0,0,0.45); }
.game-table-page .game-actions #win-btn:not([style*="display: none"]) { box-shadow: inset 0 2px 4px rgba(255,255,255,0.55), inset 0 -4px 6px rgba(0,0,0,0.35), 0 0 0 2px #ef4444, 0 0 14px rgba(239,68,68,0.7), 0 4px 8px rgba(0,0,0,0.45); }
.game-table-page .game-actions #draw-btn:not([style*="display: none"]) { box-shadow: inset 0 2px 4px rgba(255,255,255,0.55), inset 0 -4px 6px rgba(0,0,0,0.35), 0 0 0 2px #4dabf5, 0 0 12px rgba(77,171,245,0.6), 0 4px 8px rgba(0,0,0,0.45); }

/* 出牌按钮隐藏：强制使用点提/拖动 */
.game-table-page .game-actions #discard-btn { display: none !important; }

/* ---------- 定缺等待：底部中央透明横幅（参考黄色框） ---------- */
#dingque-modal.waiting {
  align-items: flex-end;
  justify-content: center;
  padding-bottom: calc(var(--safe-area-bottom, 0px) + 120px);
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
#dingque-modal.waiting .modal-content {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  max-width: 90%;
  width: auto;
  padding: 0;
  transform: none;
}
#dingque-modal.waiting .modal-header,
#dingque-modal.waiting .modal-content > p,
#dingque-modal.waiting .dingque-btns { display: none !important; }

#dingque-modal.waiting .dingque-wait {
  display: block !important;
  color: #FFC300;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 0 8px rgba(0,0,0,0.9), 0 0 18px rgba(255,195,0,0.5);
  letter-spacing: 1px;
  padding: 8px 20px;
  background: transparent;
  border: none;
  margin: 0;
}

/* ---------- 回合提示 / 响应提示 ---------- */
.game-table-page .turn-banner.my-turn {
  background: linear-gradient(90deg, #1a63d0, #0049DB);
  color: #fff;
  border: 1px solid #F0CA72;
}
.game-table-page .claim-banner.active {
  background: linear-gradient(90deg, #d9a93a, #F4C34D);
  color: #3a2a00;
}

/* 响应窗口可见倒计时（与后端 15s 自动过对齐） */
.game-table-page .claim-banner .claim-countdown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  background: rgba(0,0,0,0.35);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35), 0 0 8px rgba(0,0,0,0.4);
  color: #fff;
  letter-spacing: 0.5px;
}
.game-table-page .claim-banner.waiting .claim-countdown { color: #ffe08a; }
.game-table-page .claim-banner.active .claim-countdown {
  color: #3a2a00;
  background: rgba(255,255,255,0.5);
  box-shadow: inset 0 0 0 1px rgba(58,42,0,0.25);
}
.game-table-page .claim-banner .claim-countdown.urgent {
  color: #fff;
  background: #e23b3b;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5), 0 0 10px rgba(226,59,59,0.85);
  animation: claimUrgentPulse 0.9s ease-in-out infinite;
}
@keyframes claimUrgentPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.14); }
}

/* 操作按钮栏内的倒计时（与响应窗口徽章同源，紧挨碰/杠/过按钮） */
.game-table-page .game-actions .claim-countdown-actions {
  order: -1;
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: #3a2a00;
  background: rgba(255,255,255,0.5);
  box-shadow: inset 0 0 0 1px rgba(58,42,0,0.25);
  letter-spacing: 0.5px;
}
.game-table-page .game-actions .claim-countdown-actions.urgent {
  color: #fff;
  background: #e23b3b;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5), 0 0 10px rgba(226,59,59,0.85);
  animation: claimUrgentPulse 0.9s ease-in-out infinite;
}

/* ---------- 2/3 人局微调 ---------- */
.game-table-page .table-layout-v2.players-2,
.game-table-page .table-layout-v2.players-3 {
  --wall-depth: 36px;
  --opponent-hand-depth: 48px;
  --river-depth: 32px;
  --core-size: 92px;
}
.game-table-page .table-layout-v2.players-2 .river-left,
.game-table-page .table-layout-v2.players-2 .river-right,
.game-table-page .table-layout-v2.players-3 .river-left,
.game-table-page .table-layout-v2.players-3 .river-right { width: 10px; height: 50%; }

/* ---------- 小屏适配 ---------- */
@media (max-width: 480px) {
  .game-table-page .table-layout-v2 {
    --wall-depth: 34px;
    --opponent-hand-depth: 46px;
    --river-depth: 28px;
    --core-size: 86px;
    --avatar-depth: 34px;
    border-radius: 12px;
  }
  .game-table-page .table-core { border-radius: 8px; }
  .game-table-page .wall-count-frame { width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0; border-width: 1.5px; border-radius: 6px; }
  .game-table-page #wall-info { font-size: clamp(14px, 4vmin, 18px); }
  .game-table-page .table-core::before,
  .game-table-page .table-core::after,
  .game-table-page .dice-area::before,
  .game-table-page .dice-area::after { font-size: 11px; }
  .game-table-page .game-actions { padding: 4px 6px; gap: 4px; border-radius: 8px; }
  .game-table-page .game-actions .btn { width: 40px; height: 40px; font-size: 14px; }
  .game-table-page .avatar-node { min-width: 32px; padding: 4px 5px; border-radius: 8px; }
  .game-table-page .avatar-face { font-size: 15px; }
  .game-table-page .avatar-name { font-size: 9px; }
}

/* ---------- 横屏窄高适配（平板横屏） ---------- */
@media (min-aspect-ratio: 4/3) {
  .game-table-page .table-layout-v2 {
    width: min(100%, calc((100vh - 180px) * 4 / 3));
  }
}
