/* ============================================
   三公游戏 H5 — 横屏赌桌布局 (百家乐/牛牛惯例)
   上3 / 左右各1 / 下3  座位环绕
   中央牌区 + 倒计时 + 下注信息
   左上哈希按钮 / 右上头像+用户名 / 右下操作按钮
   保留全部动画: 获取中/大哈希/分割/飞牌/赔付
   ============================================ */

:root {
  --gold: #d4af37;
  --gold-light: #f5e7a3;
  --gold-dark: #8a6d1f;
  --gold-bright: #ffd76a;
  --burgundy: #7a1e2d;
  --felt: #0a5c36;
  --felt-dark: #07472a;
  --wood: #5a3820;
  --wood-light: #7a4f2e;
  --cream: #fff8e1;
  --danger: #c0392b;
}

/* ============ 场景/房间容器 ============ */
#scene-room {
  min-height: 100vh;
  padding: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(212,175,55,.10), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(122,30,45,.18), transparent 45%),
    linear-gradient(180deg, #1a1108 0%, #0d0804 100%);
}
.room-body {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.room-center {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}
.table-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  /* padding: clamp(46px, 8vh, 70px) clamp(8px, 2vw, 20px) clamp(10px, 2vh, 20px); */
}

/* ============ 椭圆赌桌 (横屏) ============ */
.table-felt {
  position: relative;
  width: min(94vw, 1200px);
  height: min(78vh, 650px);
  max-width: none;
  max-height: none;
  background: radial-gradient(circle at 50% 42%, #128a52 0%, var(--felt) 58%, var(--felt-dark) 100%);
  /* border: clamp(5px, 1vw, 12px) solid; */
  border-image: linear-gradient(135deg, var(--wood-light), var(--wood) 45%, #3a220f 60%, var(--wood-light)) 1;
  border-radius: 80% / 50%;
  box-shadow:
    0 0 0 clamp(2px, .5vw, 5px) rgba(212,175,55,.55),
    0 0 0 clamp(6px, 1.3vw, 14px) #3a2410,
    0 0 50px rgba(212,175,55,.25),
    0 24px 60px rgba(0,0,0,.75);
  /* overflow: hidden; */
}
.table-felt::before {
  content: "";
  position: absolute;
  inset: clamp(10px, 2vh, 24px);
  border: 2px dashed rgba(245,231,163,.4);
  border-radius: 80% / 50%;
  pointer-events: none;
}
.table-felt::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 80% / 50%;
  box-shadow: inset 0 0 70px rgba(0,0,0,.5);
  pointer-events: none;
}

/* ============ 左上角: 哈希按钮 (fixed) ============ */
.hash-fab {
  position: fixed;
  top: clamp(8px, 1.5vh, 14px);
  left: clamp(8px, 1.5vw, 14px);
  z-index: 100;
  background: linear-gradient(180deg,#ffeda8,#ffd76a 30%,#d4af37 55%,#a67c00);
  color: #2b1d0e;
  font-size: clamp(11px, 2vh, 15px);
  font-weight: 700;
  border: 1px solid #7a5c13;
  border-radius: 22px;
  padding: clamp(6px, 1.2vh, 10px) clamp(14px, 2.4vw, 24px);
  cursor: pointer;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 4px 16px rgba(0,0,0,.55), 0 0 14px rgba(212,175,55,.35);
  letter-spacing: 1px;
  transition: box-shadow .2s, transform .1s;
}
.hash-fab:hover { box-shadow: 0 0 22px rgba(212,175,55,.6), inset 0 2px 0 rgba(255,255,255,.45); }
.hash-fab:active { transform: scale(.96); }

/* 暗藏数据: room.js 仍通过 ID 更新 */
.hash-data { display: none; }

/* ============ 右上角: 头像 + 用户名 (fixed) ============ */
.header-right {
  position: fixed;
  top: clamp(8px, 1.5vh, 14px);
  right: clamp(8px, 1.5vw, 14px);
  z-index: 100;
}
.user-capsule {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1vw, 10px);
  background: rgba(10,8,5,.78);
  /* border: 1px solid rgba(212,175,55,.5); */
  border-radius: 24px;
  padding: clamp(4px, .8vh, 7px) clamp(10px, 1.4vw, 16px);
  box-shadow: 0 4px 16px rgba(0,0,0,.55);
}
.user-menu { position: relative; cursor: pointer; display: flex; }
.user-menu .avatar {
  width: clamp(28px, 5vh, 40px);
  height: clamp(28px, 5vh, 40px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(15px, 3.2vh, 22px);
  background: linear-gradient(160deg, rgba(90,56,32,.97), rgba(43,29,14,.98));
  border: 2px solid var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(212,175,55,.3), 0 3px 10px rgba(0,0,0,.55);
  cursor: pointer;
  transition: box-shadow .2s, transform .1s;
}
.user-menu .avatar:hover { box-shadow: 0 0 0 2px rgba(212,175,55,.5), 0 0 16px rgba(212,175,55,.6); }
.user-menu .avatar:active { transform: scale(.95); }
.user-capsule-name {
  font-size: clamp(11px, 2vh, 15px);
  font-weight: 700;
  color: var(--gold-light);
  max-width: clamp(60px, 14vw, 120px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  background: linear-gradient(160deg, rgba(60,38,16,.99), rgba(28,18,8,.99));
  border: 1px solid var(--gold-dark);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.7), 0 0 12px rgba(212,175,55,.16);
  padding: 8px;
  display: none;
  z-index: 110;
}
.user-menu.open .user-dropdown { display: block; }
.user-info { padding: 6px 8px; border-bottom: 1px solid rgba(212,175,55,.2); margin-bottom: 4px; }
.user-info .p-name { font-size: 15px; font-weight: 700; color: var(--gold-light); }
.user-info .p-sub { font-size: 12px; color: rgba(255,248,225,.6); }
.dropdown-item { padding: 8px 10px; border-radius: 6px; font-size: 14px; cursor: pointer; color: var(--cream); white-space: nowrap; }
.dropdown-item:hover { background: rgba(212,175,55,.18); }
.dropdown-item.danger { color: #ff9a8a; }
.dropdown-item.danger:hover { background: rgba(192,57,43,.25); }

/* ============ 中央组合: 牌区 + 倒计时 + 下注信息 ============ */
.table-center {
  position: absolute;
  left: 50%;
  top: 55%;
  transform: translate(-50%, -50%);
  width: clamp(280px, 42vw, 380px);
  max-width: 46%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(2px, .6vh, 6px);
  z-index: 2;
  pointer-events: none;
}
.tc-title {
  font-size: clamp(26px, 7vh, 48px);
  font-weight: 900;
  letter-spacing: clamp(6px, 1.5vw, 14px);
  color: var(--gold-bright);
  text-shadow: 0 0 16px rgba(212,175,55,.85), 0 3px 6px rgba(0,0,0,.85);
  white-space: nowrap;
}
.tc-state {
  font-size: clamp(10px, 2.2vh, 15px);
  color: rgba(255,233,168,.9);
  letter-spacing: 2px;
}

/* 倒计时: 牌区标题下方 */
.header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.header-center .cd-big {
  font-size: clamp(24px, 6vh, 42px);
  line-height: 1.1;
  color: var(--gold-light);
  font-family: "Consolas", monospace;
  font-weight: 800;
  text-shadow: 0 0 16px rgba(212,175,55,.65);
}
.header-center .cd-sub {
  font-size: clamp(9px, 1.8vh, 13px);
  color: rgba(245,231,163,.75);
  text-align: center;
}

/* 下注信息: 牌区最下方小面板 */
.table-under {
  width: min(100%, 320px);
  max-height: clamp(60px, 14vh, 100px);
  overflow-y: auto;
  background: rgba(10,8,5,.75);
  border: 1px solid rgba(212,175,55,.4);
  border-radius: 10px;
  padding: clamp(3px, .8vh, 6px) clamp(8px, 1.5vw, 12px);
  font-size: clamp(9px, 1.8vh, 13px);
  color: var(--cream);
  text-align: left;
}
.table-under::-webkit-scrollbar { width: 4px; }
.table-under::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 2px; }
.tu-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 1px 0;
  border-bottom: 1px dashed rgba(212,175,55,.18);
}
.tu-row:last-child { border-bottom: none; }
.tu-row-name { color: rgba(245,231,163,.85); }
.tu-row-val { font-weight: 800; color: var(--gold-light); font-family: "Consolas", monospace; }
.tu-row-balance { margin-top: 2px; border-top: 1px solid rgba(212,175,55,.45); padding-top: 2px; }
.tu-row-balance .tu-row-name { color: var(--gold); }
.tu-row-balance .tu-row-val { color: var(--gold-bright); text-shadow: 0 0 12px rgba(212,175,55,.7); font-size: clamp(11px, 2vh, 15px); }

/* ============ 余额条: 台子中下位置 (独立显示) ============ */
.balance-bar {
  position: absolute;
  left: 50%;
  bottom: clamp(16px, 1.6vh, 14px);
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1vw, 12px);
  /* background: rgba(10,8,5,.78); */
  /* border: 1px solid rgba(212,175,55,.5); */
  border-radius: 22px;
  padding: clamp(3px, .8vh, 6px) clamp(14px, 2.4vw, 28px);
  box-shadow: 0 4px 16px rgba(0,0,0,.55), 0 0 12px rgba(212,175,55,.18);
  white-space: nowrap;
}
.balance-bar .bb-lbl {
  font-size: clamp(10px, 1.9vh, 14px);
  color: rgba(245,231,163,.75);
}
.balance-bar .bb-val {
  font-size: clamp(15px, 3vh, 22px);
  font-weight: 800;
  color: var(--gold-bright);
  font-family: "Consolas", monospace;
  text-shadow: 0 0 12px rgba(212,175,55,.7);
}

/* ============ 座位 (上3 / 左右各1 / 下3) ============ */
.seats { position: absolute; inset: 0; z-index: 3; }

.seat {
  position: absolute;
  width: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: none;
  box-shadow: none;
  text-align: center;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
}
.seat:active { transform: scale(.95); }
.seat.betted .seat-badge { box-shadow: 0 0 0 3px rgba(212,175,55,.6), 0 0 22px rgba(212,175,55,.55); }
.seat.me .seat-badge { box-shadow: 0 0 0 3px rgba(153,255,102,.55), 0 0 24px rgba(153,255,102,.5); }
.seat.winner .seat-badge { box-shadow: 0 0 0 3px rgba(153,255,102,.7), 0 0 30px rgba(153,255,102,.7); }
.seat.loser .seat-badge { box-shadow: 0 0 0 3px rgba(192,57,43,.7), 0 0 22px rgba(192,57,43,.55); }

/* 座位子元素顺序固定: 徽章最上 → 牌 → 总注 → 我的 */
.seat-badge { order: 0; }
.seat-cards { order: 1; }
.seat-total { order: 2; }
.seat-mine { order: 3; }

/* 座位号圆形徽章(类似头像) */
.seat-badge {
  position: relative;
  width: clamp(38px, 6.5vh, 54px);
  height: clamp(38px, 6.5vh, 54px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 40% 32%, rgba(122,79,46,.95) 0%, rgba(58,36,16,.98) 55%, rgba(32,19,8,.99) 100%);
  border: clamp(2px, .4vw, 3px) solid var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(212,175,55,.35), 0 4px 14px rgba(0,0,0,.6), inset 0 2px 4px rgba(255,255,255,.15);
  z-index: 1;
  transition: box-shadow .2s;
}
.seat-badge b {
  font-size: clamp(17px, 3.4vh, 26px);
  font-weight: 900;
  color: var(--gold-bright);
  text-shadow: 0 0 10px rgba(212,175,55,.8), 0 2px 4px rgba(0,0,0,.7);
}
.seat-badge::after {
  content: "";
  position: absolute;
  inset: clamp(3px, .5vh, 5px);
  border: 1px dashed rgba(245,231,163,.45);
  border-radius: 50%;
  pointer-events: none;
}

/* 徽章下方: 扑克牌行 */
.seat-cards { display: flex; justify-content: center; gap: 2px; 
  /* min-height: clamp(24px, 4vh, 30px);  */
  align-items: center; }
.seat-cards .card, .seat-cards .card-back { width: clamp(18px, 2.8vh, 24px); height: clamp(26px, 4vh, 34px); }

/* 总注: 一行 */
.seat-total {
  font-size: clamp(9px, 1.6vh, 12px);
  color: var(--cream);
  background: rgba(10,8,5,.6);
  border: 1px solid rgba(212,175,55,.3);
  border-radius: 6px;
  padding: 1px 6px;
  white-space: nowrap;
}
.seat-total .lbl { font-size: clamp(7px, 1.2vh, 10px); color: rgba(245,231,163,.7); margin-right: 3px; }
.seat-total .val { font-weight: 800; color: var(--gold-bright); text-shadow: 0 0 8px rgba(212,175,55,.5); }

/* 我的下注: 一行(带输赢差额) */
.seat-mine {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: clamp(8px, 1.4vh, 11px);
  color: #9f6;
  /* min-height: 12px; */
  background: rgba(10,8,5,.6);
  border: 1px solid rgba(153,255,102,.25);
  border-radius: 6px;
  /* padding: 1px 6px; */
  white-space: nowrap;
}
.seat-mine .lbl { font-size: clamp(7px, 1.2vh, 10px); color: rgba(153,255,102,.8); }
.seat-mine .val { font-weight: 800; color: #9f6; }
.seat-diff { font-size: clamp(9px, 1.5vh, 12px); font-weight: 800; }
.seat-diff.win { color: #9f6; text-shadow: 0 0 6px rgba(153,255,102,.6); }
.seat-diff.lose { color: #ff8a7a; text-shadow: 0 0 6px rgba(255,138,122,.5); }

/* 开牌结果: 按座位方位绝对定位 */
.seat-hand-tip {
  position: absolute;
  font-size: clamp(9px, 1.7vh, 13px);
  font-weight: 700;
  color: var(--gold-bright, #ffd76a);
  text-shadow: 0 0 8px rgba(212,175,55,.7), 0 2px 4px rgba(0,0,0,.8);
  letter-spacing: 1px;
  background: rgba(10,8,5,.65);
  border: 1px solid rgba(212,175,55,.35);
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
  z-index: 4;
  animation: tipIn .4s ease;
}

/* 上排座位(3/4/5): 结果显示在下方 */
.seat-3 .seat-hand-tip, .seat-4 .seat-hand-tip, .seat-5 .seat-hand-tip {
  left: 105%;
  top: 45%;
  margin-top: 4px;
  transform: translateX(-50%);
}
/* 下排座位(1/6/8): 结果显示在下方(朝桌面外, 避免压徽章) */
.seat-6 .seat-hand-tip, .seat-8 .seat-hand-tip {
  left: 105%;
  top: 45%;
  margin-top: 4px;
  transform: translateX(-50%);
}
/* 左侧座位(2): 结果显示在右边 */
.seat-2 .seat-hand-tip {
  left: 76%;
  top: 59%;
  margin-left: 6px;
  transform: translateY(-50%);
}

.seat-1 .seat-hand-tip {
  left: 85%;
  top: 55%;
  margin-top: 6px;
  transform: translateY(-50%);
}
/* 右侧座位(7): 结果显示在左边 */
.seat-7 .seat-hand-tip {
  right: 80%;
  top: 60%;
  margin-right: 6px;
  transform: translateY(-50%);
}
.seat-hand-tip { margin-top: 0; }

/* 输赢差额: 也按方位显示在座位外侧(与点数/牌型标签错开) */
.seat .seat-diff {
  position: absolute;
  z-index: 4;
  background: rgba(10,8,5,.7);
  border: 1px solid rgba(212,175,55,.4);
  border-radius: 6px;
  padding: 1px 8px;
  white-space: nowrap;
  letter-spacing: 1px;
  animation: tipIn .4s ease;
}
.seat-3 .seat-diff, .seat-4 .seat-diff, .seat-5 .seat-diff {
  left: 50%;
  top: calc(100% + 22px);
  transform: translateX(-50%);
}
.seat-1 .seat-diff, .seat-6 .seat-diff, .seat-8 .seat-diff {
  left: 50%;
  top: calc(100% + 18px);
  transform: translateX(-50%);
}
.seat-2 .seat-diff {
  left: calc(100% + 6px);
  top: calc(50% + 16px);
}
.seat-7 .seat-diff {
  right: calc(100% + 6px);
  top: calc(50% + 16px);
}
.seat-diff { margin: 0; }
.seat-diff.win, .seat-diff.lose { text-shadow: 0 0 6px rgba(0,0,0,.8); }
.seat-badge { animation: badgeIn .35s ease; }
@keyframes badgeIn {
  0% { transform: scale(.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.seat { width: clamp(80px, 12vw, 120px); }

/* 座位位置 (椭圆边缘): 上3 / 左右各1 / 下3 */
.seat-1 { left: 20%;   bottom: 4%; }
.seat-2 { left: 0%; top: 50%; }
.seat-3 { left: 8%;   top: 14%; }
.seat-4 { left: 30%;  top: 6%; }
.seat-5 { left: 56%;  top: 6%; }
.seat-6 { left: 80%;  bottom: 63%; }
.seat-7 { left: 87%;  top: 50%; }
.seat-8 { left: 65%;  bottom: 4%; }


/* ============ 扑克牌 (座位内) ============ */
.card-back, .card {
  width: clamp(16px, 2.8vh, 25px);
  height: clamp(24px, 4.2vh, 36px);
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,.5);
  flex: 0 0 auto;
  position: relative;
  font-size: clamp(7px, 1.2vh, 10px);
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.card-back {
  background: repeating-linear-gradient(45deg, rgba(255,215,106,.4) 0 3px, rgba(122,30,45,.65) 3px 6px);
  border: 1px solid var(--gold);
}
.card-back::after {
  content: "♠";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(245,231,163,.6);
  font-size: clamp(8px, 1.4vh, 11px);
}
.card { background: linear-gradient(180deg,#fffef8,#f7efd8); border: 1px solid #c9a94e; color: #222; overflow: hidden; animation: flipIn .3s ease; }
.card .c-rank { font-weight: 800; font-size: clamp(8px, 1.4vh, 11px); }
.card.hidden-rank .c-rank { visibility: hidden; }

@keyframes flipIn {
  0% { transform: rotateY(90deg) scale(.8); opacity: 0; }
  100% { transform: rotateY(0) scale(1); opacity: 1; }
}

/* ============ 右下角操作按钮 ============ */
.player-list-fab, .settle-history-fab {
  position: fixed;
  right: clamp(8px, 1.5vw, 14px);
  z-index: 90;
  background: linear-gradient(180deg,#ffeda8,#ffd76a 30%,#d4af37 55%,#a67c00);
  color: #2b1d0e;
  font-size: clamp(9px, 1.6vh, 13px);
  font-weight: 700;
  border: 1px solid #7a5c13;
  border-radius: 24px;
  padding: clamp(5px, .9vh, 8px) clamp(10px, 1.8vw, 18px);
  cursor: pointer;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.45), 0 4px 16px rgba(0,0,0,.5), 0 0 14px rgba(212,175,55,.35);
  letter-spacing: 1px;
  transition: box-shadow .2s, transform .1s;
}
.player-list-fab { bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(44px, 9vh, 60px)); }
.settle-history-fab { bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(8px, 1.5vh, 14px)); }
.player-list-fab:hover, .settle-history-fab:hover { box-shadow: 0 0 22px rgba(212,175,55,.6); }
.player-list-fab:active, .settle-history-fab:active { transform: scale(.96); }

/* ============ 开奖哈希弹层 ============ */
.hash-modal-block {
  font-size: clamp(14px, 2.6vh, 17px);
  color: var(--gold-bright);
  text-align: center;
  margin-bottom: 8px;
}
.hash-modal-value {
  font-size: clamp(14px, 3vh, 20px);
  font-weight: 700;
  color: var(--gold-light);
  text-shadow: 0 0 12px rgba(212,175,55,.5);
  word-break: break-all;
  line-height: 1.5;
  text-align: center;
  margin-bottom: 12px;
  background: rgba(0,0,0,.3);
  border: 1px solid rgba(212,175,55,.3);
  border-radius: 8px;
  padding: 10px 12px;
}

/* ============ 开奖哈希弹层: 最近20局列表 ============ */
#hash-modal .history-modal-box {
  width: 360px;
  max-width: 94vw;
}
.hash-history-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold-light);
  text-align: center;
  letter-spacing: 1px;
  margin: 2px 0 8px;
  padding-top: 10px;
  /* border-top: 1px solid rgba(212,175,55,.25); */
}
#hash-history-list {
  min-height: 160px;
}
#hash-history-list .hash-h-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
#hash-history-list .hash-h-item:hover {
  background: rgba(212,175,55,.12);
}
#hash-history-list .h-hash {
  font-size: 13px;
  color: var(--cream);
  word-break: break-all;
  line-height: 1.4;
}

/* ============ 下注模态框 ============ */
.bet-modal {
  position: fixed;
  inset: 0;
  background: rgba(10,6,2,.75);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bet-modal-box {
  width: min(94vw, 380px);
  max-height: min(88vh, 460px);
  overflow-y: auto;
  padding: 18px 20px 14px;
  background: linear-gradient(160deg, rgba(90,56,32,.97), rgba(43,29,14,.98));
  border: 2px solid var(--gold);
  border-radius: 14px;
  box-shadow: 0 0 0 4px rgba(58,36,16,.9), 0 0 40px rgba(212,175,55,.32), 0 18px 44px rgba(0,0,0,.7);
  text-align: center;
}
.bet-modal-title { font-size: 18px; font-weight: 800; color: var(--gold-bright); letter-spacing: 2px; margin-bottom: 4px; text-shadow: 0 0 10px rgba(212,175,55,.5); }
.bet-modal-sub { font-size: 14px; color: rgba(245,231,163,.7); margin-bottom: 14px; }
/* 两列: 左=下注记录, 右=下注功能 */
.bet-modal-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 12px;
}
.bet-modal-records {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}
.bet-modal-records-list {
  flex: 1;
  min-height: 0;
  max-height: min(220px, 40vh);
}
.bet-modal-records-list .br-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bet-modal-records-list .br-amt {
  flex: 0 0 auto;
  margin-left: 6px;
}
.bet-modal-bet {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.bet-modal-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.bet-modal-chips .chip { height: 38px; font-size: 14px; }
.chip {
  background: radial-gradient(circle at 40% 35%, #fff2c0, var(--gold) 55%, var(--gold-dark));
  color: #2b1d0e;
  border-radius: 50%;
  height: 40px;
  border: 2px dashed rgba(90,56,32,.7);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0,0,0,.5);
}
.chip:hover { transform: translateY(-2px); }
.chip.selected { box-shadow: 0 0 0 3px var(--cream), 0 4px 8px rgba(0,0,0,.5); }
.bet-modal-custom { text-align: left; margin-bottom: 10px; }
.bet-modal-custom label { display: block; font-size: 13px; color: var(--gold-light); margin-bottom: 4px; }
.bet-modal-custom input {
  width: 100%;
  padding: 9px 12px;
  background: rgba(0,0,0,.45);
  border: 1px solid var(--gold-dark);
  border-radius: 6px;
  color: var(--cream);
  font-size: 16px;
  outline: none;
  box-shadow: inset 0 1px 4px rgba(0,0,0,.5);
}
.bet-modal-custom input:focus { border-color: var(--gold); box-shadow: 0 0 10px rgba(212,175,55,.4); }
.bet-modal-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.bet-modal-actions .gold-btn { width: 100%; background: linear-gradient(180deg,#ffeda8,#ffd76a 30%,#d4af37 55%,#a67c00); color: #2b1d0e; border: 1px solid #7a5c13; padding: 12px; font-size: 17px; font-weight: 700; border-radius: 8px; cursor: pointer; letter-spacing: 2px; }
.bet-modal-actions .cmd-btn { padding: 12px 18px; background: linear-gradient(180deg,#5c4a1e,#2e220e); color: var(--gold-light); border: 1px solid var(--gold-dark); border-radius: 6px; cursor: pointer; }
#bet-modal.hidden, .history-modal.hidden, .deal-overlay.hidden { display: none !important; }

/* ============ 弹框通用 ============ */
.history-modal {
  position: fixed;
  inset: 0;
  background: rgba(10,6,2,.78);
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
}
.history-modal-box {
  width: min(92vw, 550px);
  max-width: none;
  max-height: min(86vh, 470px);
  padding: 16px 18px 12px;
  background: linear-gradient(160deg, rgba(60,38,16,.99), rgba(28,18,8,.99));
  border: 2px solid var(--gold);
  border-radius: 14px;
  box-shadow: 0 0 0 4px rgba(58,36,16,.9), 0 0 40px rgba(212,175,55,.32), 0 18px 44px rgba(0,0,0,.7);
  display: flex;
  flex-direction: column;
}
.history-modal-title { font-size: 18px; font-weight: 800; color: var(--gold-bright); text-align: center; letter-spacing: 2px; margin-bottom: 4px; text-shadow: 0 0 10px rgba(212,175,55,.5); }
.history-modal-meta { font-size: 13px; color: rgba(245,231,163,.7); text-align: center; margin-bottom: 8px; word-break: break-all; line-height: 1.5; }
.history-modal-list { flex: 1; overflow-y: auto; font-size: 14px; margin-bottom: 10px; min-height: 90px; }
.history-modal-list .h-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 6px;
  border-bottom: 1px solid rgba(212,175,55,.12);
  flex-wrap: wrap;
}
.h-item .h-name { color: var(--cream); }
.h-item .h-point { color: var(--gold-light); font-size: 13px; }
.h-item .h-amt.win { color: #9f6; font-weight: 700; }
.h-item .h-amt.lose { color: #ff8a7a; font-weight: 700; }
.h-item .h-comm { font-size: 12px; color: #e8b04a; text-align: right; flex-basis: 100%; margin-top: 2px; }
.history-modal-actions { display: flex; gap: 10px; justify-content: center; }
.history-modal-actions .cmd-btn {
  padding: 8px 14px;
  background: linear-gradient(180deg,#5c4a1e,#2e220e);
  color: var(--gold-light);
  border: 1px solid var(--gold-dark);
  border-radius: 6px;
  cursor: pointer;
}
.history-modal-actions .cmd-btn:disabled { opacity: .4; cursor: not-allowed; }

/* 玩家列表项 */
#player-modal-list .pl-item {
  display: flex;
  justify-content: space-between;
  padding: 5px 6px;
  border-bottom: 1px solid rgba(212,175,55,.12);
  font-size: 14px;
}
#player-modal-list .pl-item .pl-name { color: var(--cream); }
#player-modal-list .pl-item .pl-bet { color: var(--gold-light); font-size: 13px; }
#player-modal-list .pl-item.me { background: rgba(212,175,55,.1); border-radius: 4px; }

/* ============ 管理中心弹框 ============ */
#agent-modal .history-modal-box { min-height: 320px; }
.agent-modal-title { font-size: 18px; font-weight: 700; color: var(--gold-bright); text-align: center; margin-bottom: 8px; text-shadow: 0 0 10px rgba(212,175,55,.5); }
.agent-modal-desc { text-align: center; color: #ccc; margin: 8px 0; line-height: 1.6; font-size: 13px; }
.agent-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: nowrap; overflow-x: auto; }
.agent-tab {
  flex: 1 0 auto;
  padding: 7px 10px;
  background: rgba(212,175,55,.1);
  border: 1px solid rgba(212,175,55,.35);
  color: #e8d28a;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
  transition: all .2s;
}
.agent-tab:hover { background: rgba(212,175,55,.2); }
.agent-tab.active { background: linear-gradient(135deg, #d4af37, #e6c658); color: #1a1205; font-weight: 700; border-color: #d4af37; }
.agent-pane { min-height: 120px; max-height: 300px; overflow-y: auto; padding: 8px; background: rgba(0,0,0,.25); border-radius: 8px; border: 1px solid rgba(212,175,55,.2); }
.load-tip { text-align: center; color: #aaa; padding: 20px 0; }
.agent-stats { display: flex; gap: 8px; margin-bottom: 10px; }
.stat-card { flex: 1; text-align: center; padding: 10px 4px; background: rgba(212,175,55,.08); border: 1px solid rgba(212,175,55,.25); border-radius: 8px; }
.stat-num { font-size: 17px; font-weight: 700; color: #e8d28a; margin-bottom: 2px; }
.stat-label { font-size: 13px; color: #aaa; }
.rate-info { text-align: center; font-size: 13px; color: #ccc; padding: 6px; background: rgba(0,0,0,.2); border-radius: 6px; line-height: 1.5; }
.create-user-form .form-row { margin-bottom: 8px; }
.create-user-form label { display: block; font-size: 13px; color: #ccc; margin-bottom: 3px; }
.create-user-form input, .create-user-form select {
  width: 100%; padding: 7px 10px; background: rgba(0,0,0,.35);
  border: 1px solid rgba(212,175,55,.3); border-radius: 6px; color: #eee; font-size: 16px; outline: none;
}
.create-user-form select option { background: #1c1407; color: #eee; }
.team-list { display: flex; flex-direction: column; gap: 5px; }
.team-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; background: rgba(212,175,55,.06); border: 1px solid rgba(212,175,55,.15); border-radius: 6px; font-size: 13px; }
.team-name { color: #eee; font-size: 13px; }
.team-name em { font-style: normal; font-size: 12px; color: var(--gold-bright); background: rgba(212,175,55,.15); padding: 1px 5px; border-radius: 4px; margin-left: 3px; }
.apply-tag { color: #ffb347; font-size: 13px; margin-left: 3px; }
.team-meta { font-size: 13px; color: #aaa; }
#agent-modal .gold-btn.big { width: 100%; margin-top: 8px; background: linear-gradient(180deg,#ffeda8,#ffd76a 30%,#d4af37 55%,#a67c00); color: #2b1d0e; border: 1px solid #7a5c13; padding: 11px; font-size: 17px; font-weight: 700; border-radius: 8px; cursor: pointer; letter-spacing: 2px; }

/* ============================================
   动画层 (全部保留)
   ============================================ */

/* A. 获取中遮罩 */
.deal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,6,2,.88);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.deal-overlay .deal-cards { padding-top: 10px; }
#fetching-overlay { cursor: default; }
.fetching-spinner {
  width: clamp(44px, 9vh, 60px);
  height: clamp(44px, 9vh, 60px);
  border-radius: 50%;
  border: 4px solid rgba(212,175,55,.18);
  border-top-color: var(--gold-bright, #ffd76a);
  animation: spin 1s linear infinite;
  margin-bottom: 18px;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.fetching-text {
  font-size: clamp(18px, 4vh, 26px);
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--gold-light, #f5e7a3);
  text-shadow: 0 0 18px rgba(212,175,55,.65);
  animation: fetchingPulse 1.2s ease-in-out infinite;
  text-align: center;
  padding: 0 6vw;
}
.fetching-sub { margin-top: 8px; font-size: clamp(10px, 1.8vh, 13px); letter-spacing: 2px; color: rgba(245,231,163,.6); }
@keyframes fetchingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

/* B. 大哈希展示 */
.deal-title {
  color: var(--gold-light);
  font-size: clamp(16px, 3.2vh, 22px);
  letter-spacing: 5px;
  margin-bottom: 14px;
  text-shadow: 0 0 16px rgba(212,175,55,.6);
}
.hash-show {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 14px 20px;
  border: 2px solid rgba(212,175,55,.5);
  border-radius: 16px;
  background: radial-gradient(circle at 50% 0%, rgba(212,175,55,.14), rgba(10,6,2,.6));
  box-shadow: 0 0 30px rgba(212,175,55,.2), inset 0 0 24px rgba(0,0,0,.45);
  max-width: min(88vw, 720px);
}
.hash-show-label { font-size: clamp(10px, 1.8vh, 13px); letter-spacing: 3px; color: rgba(245,231,163,.7); }
.hash-show-block { font-size: clamp(12px, 2.2vh, 14px); color: var(--gold-bright, #ffd76a); letter-spacing: 1px; }
.hash-show-value {
  font-size: clamp(13px, 3.2vh, 22px);
  font-weight: 700;
  color: var(--gold-bright, #ffd76a);
  text-shadow: 0 0 14px rgba(212,175,55,.8);
  word-break: break-all;
  line-height: 1.5;
  text-align: center;
  font-family: "Consolas", monospace;
}
.hash-pop { animation: hashPop .6s ease; }
@keyframes hashPop {
  0% { transform: scale(.4); opacity: 0; }
  60% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* C. 分割高亮 */
.deal-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: flex-start;
  max-width: min(94vw, 820px);
  max-height: 46vh;
  overflow-y: auto;
}
.deal-card-slot { display: flex; flex-direction: column; align-items: center; margin: 2px; }
.deal-card-slot .slot-seat { color: rgba(245,231,163,.65); font-size: clamp(10px, 1.6vh, 12px); margin-bottom: 4px; }
.deal-card-slot .slot-cards { display: flex; gap: 3px; }
.split-slot { margin: 2px; }
.split-slot .slot-cards { gap: 4px; }
.hash-char {
  min-width: clamp(20px, 4vh, 30px);
  height: clamp(26px, 5.5vh, 40px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(13px, 2.8vh, 20px);
  font-weight: 800;
  font-family: "Consolas", monospace;
  border: 2px solid rgba(212,175,55,.22);
  border-radius: 7px;
  background: rgba(0,0,0,.42);
  color: rgba(245,231,163,.4);
  transition: all .35s ease;
  transform: scale(.92);
}
.hash-char.valid { border-color: rgba(212,175,55,.5); color: #ffe9a8; }
.hash-char.invalid { border-color: rgba(192,57,43,.4); color: rgba(255,138,122,.5); }
.hash-char[data-active="1"] {
  transform: scale(1);
  background: radial-gradient(circle at 50% 40%, rgba(212,175,55,.42), rgba(122,30,45,.5));
  color: #fff6d5;
  border-color: var(--gold-bright, #ffd76a);
  box-shadow: 0 0 14px rgba(212,175,55,.75);
  animation: charPulse .6s ease;
}
@keyframes charPulse {
  0% { transform: scale(1.25); box-shadow: 0 0 24px rgba(212,175,55,1); }
  100% { transform: scale(1); box-shadow: 0 0 14px rgba(212,175,55,.75); }
}
.slot-active { animation: slotFlash .4s ease; }
@keyframes slotFlash {
  0% { opacity: .35; transform: scale(.96); }
  100% { opacity: 1; transform: scale(1); }
}
/* 呼吸框（分割区槽位框） */
.slot-breathe {
  animation: slotBreathe 1.2s ease-in-out infinite;
}
@keyframes slotBreathe {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(212,175,55,.0); }
  50% { transform: scale(1.04); box-shadow: 0 0 16px rgba(212,175,55,.7); }
}
/* 槽位/大哈希变淡（飞牌与发完时，不消失） */
.slot-dim, .hash-show.dim { opacity: .35; transition: opacity .4s ease; }
.deal-card-slot .slot-type { color: var(--gold-light); font-size: clamp(10px, 1.8vh, 13px); font-weight: 700; letter-spacing: 2px; margin-top: 3px; }

/* D. 飞牌 */
.flying-card {
  pointer-events: none;
  width: clamp(22px, 5vh, 34px) !important;
  height: clamp(32px, 7vh, 50px) !important;
  border-radius: 5px;
  box-shadow: 0 4px 14px rgba(0,0,0,.6);
  opacity: 0;
  z-index: 500 !important;
}

/* E. 赔付筹码 */
.fly-chip {
  width: clamp(18px, 3.6vh, 26px);
  height: clamp(18px, 3.6vh, 26px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-bright, #ffd76a);
  font-size: clamp(14px, 2.8vh, 20px);
  background: radial-gradient(circle at 40% 35%, #fff2c0, var(--gold, #d4af37) 55%, #8a6d1f);
  border: 2px solid rgba(90,56,32,.8);
  box-shadow: 0 3px 8px rgba(0,0,0,.55);
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}

.skip-tip {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: rgba(245,231,163,.55);
  letter-spacing: 2px;
  animation: fetchingPulse 2s ease-in-out infinite;
  white-space: nowrap;
}

@keyframes tipIn {
  0% { transform: translateY(-6px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes dealIn {
  0% { transform: translateY(-40px) rotate(-12deg) scale(.7); opacity: 0; }
  100% { transform: translateY(0) rotate(0) scale(1); opacity: 1; }
}
.deal-card-slot .card,
.deal-card-slot .card-back {
  width: clamp(24px, 4.5vh, 40px);
  height: clamp(34px, 7vh, 58px);
  animation: dealIn .35s ease backwards;
}
.deal-card-slot .card .c-rank { font-size: clamp(12px, 2.3vh, 16px); }

/* ============ 竖屏回退 ============ */
@media (orientation: portrait) {
  .table-wrap { padding: clamp(44px, 10vh, 60px) 6px 8px; }
  .table-felt {
    width: 96vw;
    height: max(320px, 54vh);
  }
  .table-center { width: clamp(240px, 70vw, 320px); max-width: 80%; }
  .tc-title { font-size: clamp(24px, 7vw, 32px); }
  .seat { width: clamp(74px, 20vw, 102px); padding: 3px 5px; }
  .seat-cards { min-height: 28px; }
  .card-back, .card { width: clamp(17px, 5vw, 24px); height: clamp(25px, 6.6vw, 34px); }

  /* 座位环绕 (竖屏) */
  .seat-1 { left: 4%; bottom: 5%; }
  .seat-2 { left: 2.5%; top: 45%; }
  .seat-3 { left: 4%; top: 4%; }
  .seat-4 { left: 23%; top: 2%; }
  .seat-5 { right: 23%; top: 2%; }
  .seat-6 { right: 4%; top: 4%; }
  .seat-7 { right: 2.5%; top: 45%; }
  .seat-8 { right: 4%; bottom: 5%; }
}

/* ============================================
   字体缩放适配(横屏/多设备) — 统一覆盖
   :root 定义 --fs-* 变量(基于 vmin=高度), 随设备平滑缩放
   本块置于文件末尾, 同选择器按加载顺序生效
   ============================================ */
/* 哈希大字 */
.hash-modal-block,
.hash-modal-value,
.hash-show-block,
.hash-show-value { font-size: var(--fs-xs); }

/* 弹窗标题 / 大数字 */
.history-modal-title,
.bet-modal-title,
.agent-modal-title,
.transfer-balance b,
.transfer-confirm-info .tc-row b,
.stat-num,
.income-sum-item .num,
.cu-confirm-text b,
.p-name,
.deal-title,
#agent-modal .gold-btn.big { font-size: var(--fs-xs); }

/* 正文 */
.history-modal-list,
.bet-modal-records-list,
.bet-modal-sub,
.hash-history-label,
.cmd-btn,
.msg,
.dropdown-item,
.agent-tab,
.promo-title,
.create-user-form input,
.create-user-form select,
.bet-modal-custom input,
.bet-modal-chips .chip,
.cu-info-row,
.cu-confirm-text,
.transfer-balance,
.transfer-actions .gold-btn,
.transfer-confirm-info .tc-row,
.income-section-title,
.player-list,
#player-modal-list .pl-item { font-size: var(--fs-xs); }

/* 次要信息 */
.history-modal-meta,
.h-item .h-point,
.bet-modal-records-title,
.bet-modal-custom label,
.create-user-form label,
.stat-label,
.rate-info,
.team-meta,
.team-item,
.team-name,
.apply-tag,
.promo-desc,
.promo-need,
.promo-status,
.promo-progress,
.income-tbl,
.income-sum-item .lbl,
.agent-modal-desc,
.mini-btn,
#tf-logs-list .h-item .h-name,
#player-modal-list .pl-item .pl-bet { font-size: var(--fs-xs); }

/* 辅助 */
.h-item .h-comm,
.user-info .p-sub,
.p-sub,
.team-name em,
.cu-hint,
.form-hint { font-size: var(--fs-xs); }

/* 横屏刘海屏: 弹窗顶部/底部安全区留白 */
@media (orientation: landscape) and (max-height: 480px) {
  .history-modal-box,
  .bet-modal-box {
    padding-top: max(14px, env(safe-area-inset-top, 0px));
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }
}