/**
 * 1:1 皇家翡翠流金 3D 竖屏麻将样式表 (fx3d-hud.css)
 * 黄金比例重构版 (12% : 56% : 8% : 24%) + 四方双层待抓牌墙保留版 + 全机型屏幕自适应架构
 *
 * 核心空间布局：
 *   1. 顶栏对家区 (0% ~ 19%)：顶部对家分数框 + 对家 3D 立牌 (.top-hand) 与正前方碰/杠副露 (.seat-top .melds)
 *   2. 错峰侧家区 (15.6% ~ 60%)：
 *      - 左右家头像上移错峰至 Y = 15.6%（彻底避开中间最宽的牌墙与弃牌河水平带，释放横向 130px 空间）
 *      - 左右家 3D 竖立暗牌 (.side-hand) 紧贴左右桌沿内侧 (Y = 25% ~ 45%)
 *      - 左右家副露 (.melds) 顺着桌沿排在立牌正下方 (Y = 48.5% ~ 59.5%)，填补左下/右下空档
 *   3. 四方双层待抓牌墙 (.wall-rack-4d，围绕 Y = 42.8% 黄金中心)：
 *      - 利用左右头像上移释放的横向空间，将四面双层待抓牌墩外推至 342×332px 宽敞四方围城
 *      - 每墩两个一叠无缝靠在一起，带金色抓牌箭头 ▼ 从上到下逐张真实减少（双层 -> 单张 .single -> 抓空）
 *   4. 牌墙内院：舒展四方弃牌河 (.river-3d) + 中央黄金罗盘 (Y = 42.8%)：
 *      - 四家打出的牌在四面待抓牌墙中间围绕罗盘排列（上下标准 6 列矩阵，左右 2×3 矩阵），与罗盘保持 25~30px 呼吸间距
 *      - 中央罗盘显示「东 · 18秒」及底部「余 53 张」流金铭牌
 *   5. 自家锚点与副露区 (Y = 65.4%)：
 *      - 南侧待抓牌墙正下方展示左下自家积分胶囊 (.seat-self「庄 · 我 · 1000」) 与左对齐自家副露 (#selfMelds「九万×3」)
 *   6. 底部操作栏 (Y = 72.8%) 与双排 7×2 手牌区 (Y = 77.4% ~ 96.2%)：
 *      - 左侧紧凑横条「听牌提示」胶囊与右侧八角按钮「碰/杠/胡/过」严格同轴对齐
 */

:root {
  --table-scale: min(calc(100vw / 390), calc(100dvh / 844));
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html,
body {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  height: 100dvh !important;
  overflow: hidden !important;
  background: #031712 !important;
}

.fx3d-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 88;
}

.shake-3d-light {
  animation: cameraShakeLight 0.28s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
.shake-3d-heavy {
  animation: cameraShakeHeavy 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes cameraShakeLight {
  0%, 100% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(-3px, 2px, 0) rotate(-0.3deg); }
  50% { transform: translate3d(3px, -3px, 0) rotate(0.3deg); }
  75% { transform: translate3d(-2px, 1px, 0); }
}
@keyframes cameraShakeHeavy {
  0%, 100% { transform: translate3d(0, 0, 0); }
  15% { transform: translate3d(-7px, 5px, 0) rotate(-0.8deg); }
  35% { transform: translate3d(6px, -6px, 0) rotate(0.8deg); }
  55% { transform: translate3d(-5px, -3px, 0) rotate(-0.5deg); }
  75% { transform: translate3d(4px, 3px, 0) rotate(0.4deg); }
}

/* ============================================================================
   1. 全屏 3D 皇家翡翠流金对称舞台底板（消除右侧 8px 缝隙，100% 居中贴合）
   ============================================================================ */
.table {
  position: relative !important;
  width: 100% !important;
  height: 100dvh !important;
  max-width: calc(100dvh * 0.58) !important;
  margin: 0 auto !important;
  background: url('../assets/table-3d-royal-stage.webp') center center / 100% 100% no-repeat !important;
  overflow: hidden !important;
  box-shadow: 0 0 40px #000d !important;
  container-type: size;
}

@media (max-aspect-ratio: 3/4) {
  .table {
    max-width: 100% !important;
    width: 100% !important;
  }
}

.table::before,
.ambient,
.table-inlay,
.room-title,
.wall-count {
  display: none !important;
}

.topbar {
  position: absolute !important;
  inset: 0 0 auto 0 !important;
  height: 7% !important;
  padding: 0 !important;
  background: transparent !important;
  pointer-events: none;
}
#menuBtn {
  position: absolute;
  left: 2.3%;
  top: 18%;
  width: 8.8%;
  height: 74%;
  opacity: 0;
  pointer-events: auto;
  cursor: pointer;
}
.bottom-nav {
  position: absolute !important;
  top: 1.2% !important;
  right: 2.3% !important;
  left: auto !important;
  bottom: auto !important;
  width: 8.8% !important;
  height: 5.2% !important;
  padding: 0 !important;
  background: transparent !important;
}
#backBtn,
#chatBtn,
#settingsBtn {
  display: none !important;
}
#historyBtn {
  width: 100% !important;
  height: 100% !important;
  opacity: 0 !important;
  cursor: pointer;
}

.stage {
  position: absolute !important;
  inset: 0 !important;
}

/* ============================================================================
   2. 顶栏对家区 (Y = 11.4% ~ 19%)：对家 3D 立牌 + 正前方碰/杠牌组
   ============================================================================ */
.seat-top {
  position: absolute !important;
  top: 11.4% !important;
  left: 18% !important;
  right: 18% !important;
  height: auto !important;
  transform: none !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 3px !important;
  z-index: 9 !important;
}
.seat-top .avatar,
.seat-top .seat-meta {
  display: none !important;
}
.seat-top .top-hand {
  position: static !important;
  transform: none !important;
  display: flex !important;
  flex-direction: row !important;
  gap: 0px !important;
  filter: drop-shadow(0 5px 7px #000c) !important;
}
.seat-top .top-hand .tile-back-3d {
  width: 21px;
  height: 28px;
  flex: 0 0 21px;
  margin-left: -1px;
  background: url('../assets/stand-top-3d.png') center / 100% 100% no-repeat;
}
.seat-top .melds {
  position: static !important;
  display: flex !important;
  justify-content: center !important;
  gap: 6px !important;
  transform: scale(0.80);
  transform-origin: center top;
}

/* ============================================================================
   3. 左右侧家错峰布局 (Y = 15.6% ~ 60%)：
      - 头像上移至 Y = 15.6%（避开中间牌墙与弃牌河水平带）
      - 3D 竖立暗牌紧贴左右桌沿内侧 (Y = 25% ~ 45%)
      - 碰/杠副露顺着桌沿排在立牌正下方 (Y = 48.5% ~ 59.5%)，与立牌留出 18px 间距
   ============================================================================ */
.seat-left,
.seat-right {
  position: absolute !important;
  top: 15.6% !important;
  width: 20% !important;
  height: 46% !important;
  z-index: 11 !important;
  pointer-events: none;
}
.seat-left {
  left: 2.8% !important;
}
.seat-right {
  right: 2.8% !important;
}

.seat-left .avatar,
.seat-right .avatar {
  pointer-events: auto;
  opacity: 1 !important;
  position: absolute !important;
  top: 0 !important;
  width: 44px !important;
  height: 44px !important;
  border: 2.5px solid #f0d27a !important;
  border-radius: 50% !important;
  background: radial-gradient(circle at 35% 30%, #48b88e, #114d39 75%) !important;
  box-shadow:
    0 0 0 2px #429d7b,
    0 0 0 3.5px #d9b55c,
    0 6px 14px #000d !important;
  overflow: hidden !important;
}
.seat-left .avatar {
  left: 2px !important;
}
.seat-right .avatar {
  right: 2px !important;
  left: auto !important;
}
.avatar-photo {
  opacity: 1 !important;
}

.seat-left .seat-meta,
.seat-right .seat-meta {
  opacity: 1 !important;
  position: absolute !important;
  top: 47px !important;
  width: auto !important;
  min-width: 50px !important;
  padding: 2px 6px !important;
  border: 1px solid #e5c46b !important;
  border-radius: 8px !important;
  background: linear-gradient(180deg, #16493bf5, #07231bf8) !important;
  box-shadow: 0 4px 10px #000b !important;
  text-align: center !important;
  white-space: nowrap !important;
}
.seat-left .seat-meta {
  left: 0 !important;
  transform: none !important;
}
.seat-right .seat-meta {
  right: 0 !important;
  left: auto !important;
  transform: none !important;
}
.seat-left .seat-meta b,
.seat-right .seat-meta b {
  display: block !important;
  font-size: 10px !important;
  line-height: 1.15 !important;
  color: #f6eed8 !important;
}
.seat-left .seat-meta small,
.seat-right .seat-meta small {
  display: block !important;
  font-size: 9.5px !important;
  line-height: 1.15 !important;
  font-weight: 800 !important;
  color: #ffe074 !important;
}

/* 左家 3D 竖立暗牌：排在左头像下方、紧贴左桌沿内侧 */
.seat-left .side-hand {
  position: absolute !important;
  top: 84px !important;
  left: 4px !important;
  transform: none !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  filter: drop-shadow(4px 6px 8px #000c) !important;
}
.seat-left .side-hand .tile-back-3d {
  width: 19px;
  height: 25px;
  flex: 0 0 25px;
  margin: 0 0 -10px 0 !important;
  background: url('../assets/stand-left-3d.png') center / 100% 100% no-repeat;
}

/* 左家碰/杠副露：顺着左桌沿排在左家暗手牌正下方，与第10张立牌保持 18px 呼吸间距 */
.seat-left .melds {
  position: absolute !important;
  top: 256px !important;
  left: 4px !important;
  transform: scale(0.75) !important;
  transform-origin: left top !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
}

/* 右家 3D 竖立暗牌：排在右头像下方、紧贴右桌沿内侧 */
.seat-right .side-hand {
  position: absolute !important;
  top: 84px !important;
  right: 4px !important;
  left: auto !important;
  transform: none !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  filter: drop-shadow(-4px 6px 8px #000c) !important;
}
.seat-right .side-hand .tile-back-3d {
  width: 19px;
  height: 25px;
  flex: 0 0 25px;
  margin: 0 0 -10px 0 !important;
  background: url('../assets/stand-right-3d.png') center / 100% 100% no-repeat;
}

/* 右家碰/杠副露：顺着右桌沿排在右家暗手牌正下方，与第10张立牌保持 18px 呼吸间距 */
.seat-right .melds {
  position: absolute !important;
  top: 256px !important;
  right: 4px !important;
  left: auto !important;
  transform: scale(0.75) !important;
  transform-origin: right top !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
}

/* 左右家的碰/杠牌组紧凑横向排列在左下/右下桌角 */
.seat-left .melds .meld-group,
.seat-right .melds .meld-group {
  flex-direction: row !important;
  padding: 2px 3px 3px !important;
}

/* ============================================================================
   4. 四面【等待抓的双层牌墩】(.wall-rack-4d)
      利用左右头像上移释放的宽敞横向空间，外推至 342×332px 围绕在弃牌河外圈
      两个一叠无缝紧贴，带金色抓牌箭头 ▼ 从上到下真实逐张减少
   ============================================================================ */
.wall-rack-4d {
  position: absolute !important;
  display: block !important;
  z-index: 8 !important;
  left: 50% !important;
  top: 42.8% !important;
  right: auto !important;
  width: 342px !important;
  height: 332px !important;
  transform: translate(-50%, -50%) !important;
  pointer-events: none;
}
.wall-ring {
  position: relative;
  width: 100%;
  height: 100%;
}
.wall-side {
  position: absolute;
  display: flex;
  gap: 0px !important;
  filter: drop-shadow(0 7px 9px #000d);
}

.wall-north {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  flex-direction: row;
}
.wall-east {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  flex-direction: column;
}
.wall-south {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  flex-direction: row-reverse;
}
.wall-west {
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  flex-direction: column-reverse;
}

.wall-stack {
  position: relative;
  transform: none !important;
  border: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  transition: transform 0.16s ease, opacity 0.16s ease;
}
.wall-stack::after {
  display: none !important;
  content: none !important;
}
.wall-stack.wall-slot-empty {
  visibility: hidden !important;
  opacity: 0 !important;
}

.wall-north .wall-stack,
.wall-south .wall-stack {
  width: 22px !important;
  height: 30px !important;
  flex: 0 0 22px !important;
  background: url('../assets/wall-stack-h.png') center / 100% 100% no-repeat !important;
}
.wall-north .wall-stack.single,
.wall-south .wall-stack.single {
  background: url('../assets/wall-stack-h-single.png') center / 100% 100% no-repeat !important;
}

.wall-west .wall-stack,
.wall-east .wall-stack {
  width: 28px !important;
  height: 21px !important;
  flex: 0 0 21px !important;
  background: url('../assets/wall-stack-v.png') center / 100% 100% no-repeat !important;
}
.wall-west .wall-stack.single,
.wall-east .wall-stack.single {
  background: url('../assets/wall-stack-v-single.png') center / 100% 100% no-repeat !important;
}

.wall-stack.current-draw {
  z-index: 4;
  filter: drop-shadow(0 0 7px #ffe57ecc) brightness(1.08);
}
.wall-stack.current-draw::before {
  content: "▼";
  position: absolute;
  left: 50%;
  top: -12px;
  transform: translateX(-50%);
  color: #ffe378;
  font-size: 9px;
  font-style: normal;
  text-shadow: 0 1px 3px #000;
  animation: drawPointerBob 0.7s ease-in-out infinite alternate;
}
@keyframes drawPointerBob {
  from { transform: translate(-50%, 0); }
  to { transform: translate(-50%, -3px); }
}

/* 剩余张数已融合进中央罗盘底部铭牌 (.compass-wall-pill)，隐藏牌墙右上角重复角标 */
.wall-remain-badge {
  display: none !important;
}

/* ============================================================================
   5. 黄金视觉中心 (Y = 42.8%)：中央黄金罗盘 + 底部剩余牌数铭牌 + 牌墙内院四方弃牌河
   ============================================================================ */
.center-console {
  position: absolute !important;
  left: 50% !important;
  top: 42.8% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 12 !important;
  pointer-events: none;
}
.compass-3d {
  width: 106px !important;
  height: 96px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
}
.compass-3d > em,
.center-console .round-info {
  display: none !important;
}
.compass-core {
  width: auto !important;
  height: auto !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5px;
  margin-top: -3px !important;
  color: #fff6dc;
  font-family: "PingFang SC", "STKaiti", serif;
  text-shadow: 0 2px 6px #000e;
  white-space: nowrap;
}
.compass-core span,
.compass-core b,
.compass-core small {
  position: static !important;
  transform: none !important;
  font-size: 12.5px !important;
  font-weight: 800 !important;
  color: #fff6dc !important;
}
.compass-core i {
  font-style: normal;
  margin: 0 1px;
  color: #ffe28a;
  font-weight: 900;
}

/* 融合进中央罗盘底部的「余 53 张」流金翡翠小铭牌 */
.compass-wall-pill {
  position: absolute !important;
  bottom: -6px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  padding: 1px 8px !important;
  border: 1px solid #ebd078cc !important;
  border-radius: 999px !important;
  background: linear-gradient(180deg, #134739f5, #06211af8) !important;
  box-shadow: 0 3px 8px #000c, inset 0 1px 1px #fff3 !important;
  color: #d6ece4 !important;
  font-size: 9.5px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  letter-spacing: 0.5px !important;
}
.compass-wall-pill b {
  color: #ffe274 !important;
  font-size: 10.5px !important;
  font-weight: 900 !important;
  margin: 0 1px !important;
}

/* 在四面待抓牌墙的内院中，围绕中央罗盘舒展排布四家打出去的牌 */
.river-3d {
  position: absolute !important;
  z-index: 10 !important;
  left: 50% !important;
  top: 42.8% !important;
  right: auto !important;
  width: 268px !important;
  height: 254px !important;
  transform: translate(-50%, -50%) !important;
  pointer-events: none;
}
.river-zone {
  position: absolute;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
/* 上家弃牌河：在北待抓牌墙与罗盘之间，标准 6 列宽 (164px) */
.river-north {
  top: 2px;
  left: 50%;
  width: 164px;
  transform: translateX(-50%);
  justify-content: center;
  align-content: flex-start;
}
/* 自家弃牌河：在罗盘与南待抓牌墙之间，标准 6 列宽 (164px) */
.river-south {
  bottom: 2px;
  left: 50%;
  width: 164px;
  transform: translateX(-50%);
  justify-content: center;
  align-content: flex-end;
}
/* 左家弃牌河：在西待抓牌墙与罗盘之间，与罗盘保持 26px 呼吸间距 */
.river-west {
  left: 2px;
  top: 50%;
  width: 54px;
  transform: translateY(-50%);
  flex-wrap: wrap;
  align-content: center;
  justify-content: flex-end;
}
/* 右家弃牌河：在罗盘与东待抓牌墙之间，与罗盘保持 26px 呼吸间距 */
.river-east {
  right: 2px;
  top: 50%;
  width: 54px;
  transform: translateY(-50%);
  flex-wrap: wrap;
  align-content: center;
  justify-content: flex-start;
}

.river-3d .tile {
  width: 25px !important;
  height: 34px !important;
  transform: none !important;
  border-radius: 3.5px !important;
  background-color: #f6f0de !important;
  box-shadow:
    0 2px 0 #ded7c2,
    0 4px 0 #267d5d,
    0 6px 8px #000b !important;
}
.river-3d .tile.latest {
  z-index: 15 !important;
  outline: 1.5px solid #ffe47a !important;
  filter: drop-shadow(0 0 8px #ffe580) !important;
}

/* ============================================================================
   6. 自家积分锚点胶囊 (.seat-self) 与靠左对齐的自家碰/杠副露 (#selfMelds)
      严格对齐在南侧待抓牌墙下方的 Y = 65.5% 水平中心线上
   ============================================================================ */
.seat-self {
  display: flex !important;
  align-items: center !important;
  gap: 7px !important;
  position: absolute !important;
  left: 5.2% !important;
  top: 65.5% !important;
  bottom: auto !important;
  transform: translateY(-50%) !important;
  z-index: 24 !important;
  padding: 3px 11px 3px 4px !important;
  border: 1px solid #e5c46b99 !important;
  border-radius: 999px !important;
  background: linear-gradient(180deg, #15483af2, #06211af8) !important;
  box-shadow: 0 6px 14px #000b, inset 0 1px 1px #fff3 !important;
}
.seat-self .avatar {
  width: 30px !important;
  height: 30px !important;
  flex: 0 0 30px !important;
  border: 1.5px solid #f0d27a !important;
  box-shadow: 0 2px 6px #0009 !important;
}
.seat-self .avatar span {
  font-size: 13px !important;
}
.seat-self .avatar::before {
  display: none !important;
}
.seat-self.banker .avatar::after {
  width: 16px !important;
  height: 16px !important;
  top: -8px !important;
  font-size: 9px !important;
}
.seat-self .seat-meta {
  position: static !important;
  width: auto !important;
  transform: none !important;
  text-align: left !important;
  line-height: 1.15 !important;
}
.seat-self .seat-meta b {
  display: block !important;
  font-size: 10.5px !important;
  color: #f6eed8 !important;
}
.seat-self .seat-meta small {
  display: block !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  color: #ffe074 !important;
}

/* 自家吃/碰/杠副露牌：靠左排列在自家积分胶囊右侧同一水平轴线上 (Y = 65.5%) */
.self-melds {
  position: absolute !important;
  left: 28.5% !important;
  top: 65.5% !important;
  bottom: auto !important;
  transform: translateY(-50%) scale(0.90) !important;
  transform-origin: left center !important;
  z-index: 24 !important;
  display: flex !important;
  justify-content: flex-start !important;
  align-items: center !important;
  gap: 10px !important;
}

.meld-group {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 2px 4px 4px;
  border-radius: 6px;
  border: 1px solid #e5c66c44;
  background: #04221b88;
  filter: drop-shadow(0 6px 9px #000c);
}
.meld-group .tile {
  width: 24px !important;
  height: 33px !important;
  border-radius: 3.5px !important;
  background-color: #f6f0de !important;
  box-shadow:
    0 2px 0 #ded7c2,
    0 4px 0 #267d5d,
    0 5px 7px #000a !important;
  pointer-events: none;
}

.meld-group .tile.meld-quad-top {
  position: absolute !important;
  z-index: 5 !important;
  left: 50% !important;
  top: -6px !important;
  transform: translateX(-50%) !important;
  box-shadow:
    0 2px 0 #ded7c2,
    0 4px 0 #1f6b4f,
    0 6px 10px #000e !important;
}

.tile.meld-tile-back {
  display: inline-block;
  border: 1px solid #75d8b0aa !important;
  background: linear-gradient(165deg, #49ba8e 0%, #227e5c 58%, #104b36 100%) !important;
  box-shadow:
    0 2px 0 #e8e1ce,
    0 4px 0 #15533c,
    0 5px 7px #000a !important;
}

/* ============================================================================
   7. 底部操作行 (Y = 72.8%)：
      左侧紧凑横条「听牌提示」与右侧八角按钮「碰/杠/胡/过」严格垂直居中对齐在同一水平轴
   ============================================================================ */
.ting-hud {
  position: absolute !important;
  z-index: 30 !important;
  left: 5.2% !important;
  top: 72.8% !important;
  bottom: auto !important;
  width: auto !important;
  min-width: 124px !important;
  max-width: 38% !important;
  height: 48px !important;
  padding: 0 12px !important;
  transform: translateY(-50%) !important;
  border: 1.5px solid #d5b972bb !important;
  border-radius: 999px !important;
  background: radial-gradient(circle at 50% 25%, #1d5749f0 0%, #0b3228f8 75%, #06211afa 100%) !important;
  box-shadow: 0 8px 18px #000c, inset 0 1px 2px #fff4 !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}
.ting-hud[hidden] {
  display: none !important;
}
.ting-hud-head {
  text-align: center;
  margin: 0 !important;
  padding-right: 6px;
  border-right: 1px solid #e5c66c44;
  line-height: 1.1;
}
.ting-hud-head strong {
  color: #ffe58f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  display: block;
}
.ting-hud-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.ting-mini-tile.tile {
  width: 23px !important;
  height: 32px !important;
  border-radius: 3px !important;
  background-color: #f9f4e6 !important;
  box-shadow: 0 2px 0 #cfc7b2, 0 4px 6px #000a !important;
  pointer-events: none;
}
.ting-mini-tile .badge-wild,
.ting-mini-tile .badge-ting {
  display: none !important;
}

.actions.actions-octagon {
  position: absolute !important;
  z-index: 32 !important;
  left: 44.5% !important;
  right: 4.5% !important;
  top: 72.8% !important;
  bottom: auto !important;
  width: auto !important;
  height: 54px !important;
  transform: translateY(-50%) !important;
  transition: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 4px !important;
}
.action.octagon {
  width: 52px !important;
  height: 52px !important;
  border: 0 !important;
  background-color: transparent !important;
  background-size: 100% 100% !important;
  background-repeat: no-repeat !important;
  box-shadow: none !important;
  filter: drop-shadow(0 7px 11px #000b);
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease;
}
.action.octagon span {
  display: none !important;
}
.action.octagon[data-action="peng"] {
  background-image: url('../assets/btn-oct-peng.png') !important;
}
.action.octagon[data-action="gang"] {
  background-image: url('../assets/btn-oct-gang.png') !important;
}
.action.octagon[data-action="hu"] {
  width: 56px !important;
  height: 56px !important;
  background-image: url('../assets/btn-oct-hu.png') !important;
  filter: drop-shadow(0 0 14px #ffcf58cc) drop-shadow(0 7px 11px #000b);
  animation: huOctagonGlow 1.15s ease-in-out infinite alternate;
}
.action.octagon[data-action="pass"] {
  background-image: url('../assets/btn-oct-pass.png') !important;
}
.action.octagon:active {
  transform: scale(0.93) !important;
}
@keyframes huOctagonGlow {
  from { transform: scale(1); filter: drop-shadow(0 0 9px #ffcf5699); }
  to { transform: scale(1.06); filter: drop-shadow(0 0 18px #ffe378); }
}

/* ============================================================================
   8. 底部双排 7×2 严格等宽对齐的自动理牌 3D 手牌区 (Y = 77.4% ~ 96.2%)
   ============================================================================ */
.self-hand {
  position: absolute !important;
  z-index: 26 !important;
  left: 5.2% !important;
  right: 5.2% !important;
  top: 77.4% !important;
  bottom: auto !important;
  width: 89.6% !important;
  height: auto !important;
  transform: none !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 7px !important;
  padding: 0 !important;
  filter: drop-shadow(0 14px 18px #000d) !important;
}

.hand-row {
  width: 100% !important;
  margin: 0 !important;
  transform: none !important;
  display: grid !important;
  grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  gap: 4px !important;
  justify-items: center !important;
  align-items: end !important;
}
.hand-row-upper {
  z-index: 1;
}
.hand-row-lower {
  z-index: 3;
}

.self-hand .tile,
.self-hand .tile.atlas-tile {
  position: relative !important;
  width: 100% !important;
  max-width: 58px !important;
  height: min(61px, 7.1dvh) !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 6px 6px 5px 5px !important;
  background-color: #f6f0de !important;
  box-shadow:
    0 -5px 0 #2d8764,
    0 -6px 0 #6fd0ab,
    0 5px 0 #d8d0ba,
    0 8px 0 #286e52,
    0 12px 15px #000c !important;
  overflow: visible !important;
  transition: transform 0.18s cubic-bezier(0.2, 0.85, 0.25, 1.2), filter 0.18s !important;
}

.self-hand .tile.drawn {
  outline: 2.5px solid #ffd859e6 !important;
  outline-offset: -1px !important;
  filter: drop-shadow(0 0 8px #ffd85988) !important;
  animation: drawnSortIn 0.42s cubic-bezier(0.2, 0.9, 0.25, 1.2) both;
}
.self-hand .tile.drawn::after {
  content: "新";
  position: absolute;
  z-index: 9;
  left: 2px;
  bottom: 2px;
  padding: 1px 3px;
  border-radius: 4px;
  background: linear-gradient(145deg, #ffe680, #c88719);
  color: #3b2202;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 1px 3px #0008;
  pointer-events: none;
}
@keyframes drawnSortIn {
  0% { transform: translateY(-18px) scale(1.06); }
  100% { transform: translateY(0) scale(1); }
}

.self-hand .tile:hover {
  transform: translateY(-6px) !important;
  filter: brightness(1.06) !important;
}
.self-hand .tile.selected {
  z-index: 10 !important;
  transform: translateY(-16px) scale(1.05) !important;
  filter: drop-shadow(0 0 12px #ffe378) !important;
}

.badge-wild {
  position: absolute;
  z-index: 8;
  top: -14px;
  right: 1px;
  width: 24px;
  height: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  clip-path: polygon(0% 25%, 22% 55%, 50% 0%, 78% 55%, 100% 25%, 88% 100%, 12% 100%);
  background: linear-gradient(180deg, #fff4b2 0%, #f0b942 55%, #b87914 100%);
  color: #5a2c02;
  font-style: normal;
  filter: drop-shadow(0 2px 4px #000a);
  pointer-events: none;
}
.badge-wild i {
  display: none;
}
.badge-wild b {
  margin-top: 4px;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.badge-ting,
.draw-hint {
  display: none !important;
}

/* ============================================================================
   9. 全机型屏幕自适应媒体查询（小屏 iPhone SE / 短屏浏览器 / 细长全面屏）
   ============================================================================ */
@media (max-height: 740px) {
  .seat-top .top-hand .tile-back-3d {
    width: 19px;
    height: 25px;
    flex-basis: 19px;
  }
  .seat-top .melds {
    transform: scale(0.72);
  }
  .seat-left .side-hand,
  .seat-right .side-hand {
    top: 74px !important;
  }
  .seat-left .side-hand .tile-back-3d,
  .seat-right .side-hand .tile-back-3d {
    width: 17px;
    height: 23px;
    flex-basis: 23px;
    margin-bottom: -9px !important;
  }
  .seat-left .melds,
  .seat-right .melds {
    top: 222px !important;
    transform: scale(0.68) !important;
  }
  .wall-rack-4d {
    width: 304px !important;
    height: 292px !important;
  }
  .river-3d {
    width: 238px !important;
    height: 224px !important;
  }
  .river-3d .tile {
    width: 22px !important;
    height: 30px !important;
  }
  .ting-hud {
    height: 42px !important;
    padding: 0 10px !important;
  }
  .action.octagon {
    width: 46px !important;
    height: 46px !important;
  }
  .action.octagon[data-action="hu"] {
    width: 50px !important;
    height: 50px !important;
  }
  .self-hand {
    gap: 5px !important;
  }
  .self-hand .tile,
  .self-hand .tile.atlas-tile {
    height: min(52px, 6.8dvh) !important;
  }
}

@media (max-width: 390px) {
  .wall-rack-4d {
    width: 302px !important;
    height: 296px !important;
  }
  .river-3d {
    width: 236px !important;
    height: 226px !important;
  }
  .river-3d .tile {
    width: 22px !important;
    height: 30px !important;
  }
  .river-north,
  .river-south {
    width: 146px;
  }
  .river-west,
  .river-east {
    width: 48px;
  }
  .self-melds {
    left: 33% !important;
    transform: translateY(-50%) scale(0.84) !important;
  }
  .action.octagon {
    width: 46px !important;
    height: 46px !important;
  }
  .action.octagon[data-action="hu"] {
    width: 50px !important;
    height: 50px !important;
  }
}

/* 结算弹窗：3D 抓鸟翻转开奖展示 */
.bird-showcase {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border: 1px solid #ebd07a45;
  border-radius: 15px;
  background: radial-gradient(circle at 50% 0%, #2a6e5940, #041d1878);
  text-align: center;
}
.bird-showcase > small {
  display: block;
  margin-bottom: 8px;
  color: #ffe28a;
  font-size: 11px;
  letter-spacing: 2px;
}
.bird-cards {
  display: flex;
  justify-content: center;
  gap: 12px;
  perspective: 600px;
}
.bird-card-3d {
  position: relative;
  padding: 5px;
  border-radius: 10px;
  background: #ffffff0a;
  border: 1px solid #ffffff18;
  transform-style: preserve-3d;
  animation: birdFlip3D 0.55s cubic-bezier(0.2, 0.85, 0.25, 1.2) both;
}
.bird-card-3d.hit {
  border-color: #ffe27a;
  background: linear-gradient(145deg, #f5cf6738, #196b5245);
  box-shadow: 0 0 16px #ffd86655;
}
.bird-card-3d .tile {
  width: 34px !important;
  height: 47px !important;
  pointer-events: none;
}
.bird-hit-tag {
  position: absolute;
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 8px;
  color: #332004;
  background: linear-gradient(145deg, #ffe78c, #ce8c1d);
  font-size: 9px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 3px 8px #0009;
}

@keyframes birdFlip3D {
  from { opacity: 0; transform: rotateY(180deg) scale(0.6); }
  to { opacity: 1; transform: rotateY(0deg) scale(1); }
}
