/* ==========================================================================
   MB666 — 真人直播桌台版面
   五大區塊:直播區 / 投注區 / 籌碼區 / 牌路區 / 聊天室
   ========================================================================== */

.room {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr) 320px;
  grid-template-areas:
    "road stage chat"
    "road bet   chat";
  grid-template-rows: auto 1fr;
  gap: 14px;
  align-items: start;
  padding: 14px var(--sp-4) 24px;
  max-width: 1680px;
  margin: 0 auto;
}

.col-road  { grid-area: road; }
.col-stage { grid-area: stage; min-width: 0; }
.col-bet   { grid-area: bet;  min-width: 0; }
.col-chat  { grid-area: chat; }

.panel {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.panel__hd {
  display: flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.02);
}
.panel__t { font-size: 13px; font-weight: 700; letter-spacing: .06em; }
.panel__t .ico { color: var(--gold-2); margin-right: 6px; }
.panel__tools { margin-left: auto; display: flex; gap: 4px; color: var(--txt-3); }
.panel__tools button { width: 26px; height: 26px; border-radius: var(--r-sm); display: grid; place-items: center; }
.panel__tools button:hover { background: rgba(255,255,255,.07); color: var(--txt-1); }
.panel__bd { padding: 14px; }

/* ==========================================================================
   1. 直播區
   ========================================================================== */
.stage {
  position: relative;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
}

/* 直播畫面(示意稿為實拍照片;正式版換成 <video> 接 HLS / WebRTC) */
.stage__video { position: absolute; inset: 0; background: #05070a; }
.stage__video img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 38%;
}
/* 上下暗角,確保疊層文字可讀 */
.stage__scrim {
  position: absolute; inset: 0; z-index: 2;
  background:
    linear-gradient(180deg, rgba(0,0,0,.66) 0%, rgba(0,0,0,.04) 24%,
                    rgba(0,0,0,.10) 52%, rgba(0,0,0,.58) 82%, rgba(0,0,0,.82) 100%);
}

/* 疊層 */
.stage__ov { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.stage__ov > * { pointer-events: auto; }

.stage__top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(0,0,0,.65), transparent);
}
.stage__name { font-size: 14px; font-weight: 700; letter-spacing: .04em; }
.stage__round { font-size: 12px; color: rgba(255,255,255,.88); font-family: var(--font-num); letter-spacing: .06em; }
.stage__topR { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px; border-radius: var(--r-pill);
  background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.14);
  font-size: 12px; color: rgba(255,255,255,.95);
  backdrop-filter: blur(6px);
}
.pill .ico { width: 14px; height: 14px; }

/* 倒數計時 */
.timer {
  position: absolute; top: 52px; right: 14px;
  width: 76px; height: 76px;
}
.timer svg { transform: rotate(-90deg); }
.timer__track { stroke: rgba(0,0,0,.5); }
.timer__bar { stroke: var(--gold-2); stroke-linecap: round; transition: stroke-dashoffset .95s linear, stroke .3s; }
.timer.is-urgent .timer__bar { stroke: var(--red-soft); }
.timer__num {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-num); font-size: 28px; font-weight: 800;
  color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.7);
}
.timer.is-urgent .timer__num { color: var(--red-soft); }

/* 狀態橫幅 —— 用 margin auto 置中,避開 translateX(-50%) 造成的半像素模糊 */
.stage__state {
  position: absolute; left: 0; right: 0; top: 40%;
  width: max-content; max-width: 92%;
  margin: 0 auto;
  padding: 9px 28px;
  border-radius: var(--r-pill);
  font-size: 16px; font-weight: 800; letter-spacing: .16em; text-indent: .16em;
  background: rgba(0,0,0,.7);
  border: 1px solid rgba(255,255,255,.22);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
}
.stage__state.is-open { color: #7ee2b0; border-color: rgba(126,226,176,.45); }
.stage__state.is-stop { color: var(--red-soft); border-color: rgba(255,107,107,.45); }
.stage__state.is-deal { color: var(--gold-1); border-color: rgba(243,223,166,.5); }

/* 荷官資訊 */
.dealer-card {
  position: absolute; left: 12px; bottom: 12px;
  display: flex; align-items: center; gap: 9px;
  padding: 6px 14px 6px 6px;
  border-radius: var(--r-pill);
  background: rgba(0,0,0,.5);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(8px);
}
.dealer-card__pic {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--gold-2);
  background: linear-gradient(150deg, #3a4757, #1a2430);
  display: grid; place-items: center; color: var(--gold-1);
  overflow: hidden;
}
.dealer-card__pic img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.dealer-card__n { font-size: 13px; font-weight: 700; line-height: 1.2; }
.dealer-card__s { font-size: 12px; color: rgba(255,255,255,.78); letter-spacing: .06em; }

/* 直播區下方控制列 */
.stage__bar {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  background: var(--bg-2);
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.stage__bar::-webkit-scrollbar { display: none; }
.stage__bar .spacer { margin-left: auto; }
.limit-txt { font-size: 12px; color: var(--txt-3); white-space: nowrap; }
.limit-txt b { color: var(--gold-1); font-family: var(--font-num); font-weight: 700; }

/* 開牌區(疊在直播畫面上) */
.reveal {
  position: absolute; left: 0; right: 0; bottom: 14px;
  display: flex; justify-content: center; gap: 10px;
  flex-wrap: wrap;
  padding: 0 12px;
  z-index: 4;
}
.reveal__grp {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 8px 12px 7px;
  border-radius: var(--r-md);
  background: rgba(0,0,0,.46);
  border: 1px solid rgba(255,255,255,.10);
  backdrop-filter: blur(6px);
}
.reveal__grp.is-win { border-color: var(--gold-2); box-shadow: 0 0 0 1px var(--gold-2), 0 6px 22px rgba(217,180,90,.25); }
.reveal__lbl { font-size: 12px; letter-spacing: .1em; color: rgba(255,255,255,.92); }
.reveal__lbl b { color: var(--gold-1); }
.reveal__row { display: flex; gap: 5px; }
.reveal__pts {
  font-family: var(--font-num); font-size: 12px; font-weight: 700;
  color: var(--gold-1); letter-spacing: .04em;
}

/* ==========================================================================
   2. 投注區
   ========================================================================== */
.bets { display: grid; gap: 10px; }

.bets--tiengow  { grid-template-columns: repeat(4, 1fr); }
.bets--niuniu   { grid-template-columns: repeat(3, 1fr); }
.bets--side     { grid-template-columns: repeat(4, 1fr); }

.spot {
  position: relative;
  min-height: 108px;
  padding: 12px 12px 40px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(255,255,255,.06), transparent 60%),
    linear-gradient(180deg, rgba(15,92,66,.30), rgba(6,37,27,.55));
  transition: .18s var(--ease);
  overflow: hidden;
  text-align: left;
  display: block;
  width: 100%;
}
.spot:hover { border-color: rgba(243,223,166,.5); transform: translateY(-2px); }
.spot.is-picked { border-color: var(--gold-2); box-shadow: var(--glow-gold); }
.spot.is-win { animation: winFlash 1.1s ease 3; }
.spot.is-locked { opacity: .5; pointer-events: none; filter: grayscale(.4); }
@keyframes winFlash {
  0%, 100% { box-shadow: 0 0 0 1px var(--gold-2); }
  50% { box-shadow: 0 0 0 2px var(--gold-1), 0 0 30px rgba(243,223,166,.45); }
}

.spot__nm { font-size: 16px; font-weight: 800; letter-spacing: .08em; }
.spot__nm .sub { font-size: 12px; font-weight: 500; color: var(--txt-3); letter-spacing: .04em; margin-left: 6px; }
.spot__odds {
  display: inline-block; margin-top: 4px;
  font-family: var(--font-num); font-size: 12px; color: var(--gold-1);
  letter-spacing: .04em;
}
.spot__mini { position: absolute; right: 10px; top: 10px; display: flex; gap: 3px; }
.spot__amt {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 34px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 11px;
  background: rgba(0,0,0,.34);
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--txt-3);
}
.spot__amt b { font-family: var(--font-num); font-size: 14px; color: var(--txt-1); }
.spot__amt .me { color: var(--gold-1); }
.spot__stack {
  position: absolute; right: 10px; bottom: 40px;
  display: flex;
}
.spot__stack .chip-s { margin-left: -12px; }
.spot__stack .chip-s:first-child { margin-left: 0; }

.spot--side { min-height: 74px; padding: 10px 10px 34px; }
.spot--side .spot__nm { font-size: 13px; letter-spacing: .04em; }
.spot--side .spot__amt { height: 28px; }

/* ---------- 投注區收合(只想看直播時把版面讓出來) ---------- */
.panel__fold {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--txt-2);
  transition: .2s var(--ease);
}
.panel__fold:hover { background: rgba(255,255,255,.08); color: var(--txt-1); }
.panel__fold .ico { transition: transform .25s var(--ease); }

.fold-sum {
  display: none;
  align-items: center; gap: 12px;
  margin-left: auto;
  font-size: 12px; color: var(--txt-2);
}
.fold-sum b { color: var(--gold-1); }

.col-bet .panel__bd { transition: max-height .3s var(--ease), opacity .2s, padding .3s; }

.col-bet.is-folded .panel__bd {
  max-height: 0; opacity: 0;
  padding-top: 0; padding-bottom: 0;
  overflow: hidden;
}
.col-bet.is-folded .chipbar,
.col-bet.is-folded .betsum { display: none; }
.col-bet.is-folded .panel__fold .ico { transform: rotate(-90deg); }
.col-bet.is-folded .panel__hd .limit-txt { display: none; }
.col-bet.is-folded .fold-sum { display: flex; }
.col-bet.is-folded .panel { border-color: rgba(217,180,90,.28); }

/* 收合後不需要為手機固定籌碼列預留底部空間 */
body.is-room:has(.col-bet.is-folded) { padding-bottom: 8px; }

/* ==========================================================================
   3. 籌碼區
   ========================================================================== */
.chipbar {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px;
  padding: 6px 12px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
}
/* 上下留出空間給選中籌碼的外框與位移,避免被 overflow 切掉 */
.chips {
  display: flex; align-items: center; gap: 11px;
  overflow-x: auto; overflow-y: visible;
  padding: 15px 7px 9px;
  scrollbar-width: none;
  flex: 1; min-width: 0;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  position: relative;
  width: 54px; height: 54px;
  flex: none;
  border-radius: 50%;
  transition: transform .16s var(--ease);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.5));
}
.chip:hover { transform: translateY(-3px); }
.chip.is-on { transform: translateY(-6px) scale(1.05); }
/* 用 outline 取代 ::after,不佔版位也不會被祖先裁切 */
.chip.is-on::after {
  content: ""; position: absolute; inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--gold-1);
  box-shadow: 0 0 16px rgba(243,223,166,.55), inset 0 0 10px rgba(243,223,166,.25);
}
.chip.is-on::before {
  content: ""; position: absolute; left: 50%; bottom: -7px;
  width: 5px; height: 5px; margin-left: -2.5px;
  border-radius: 50%; background: var(--gold-1);
  box-shadow: 0 0 8px var(--gold-1);
}
.chip svg { width: 100%; height: 100%; display: block; }

.chip-s { width: 24px; height: 24px; flex: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.chip-s svg { width: 100%; height: 100%; }

.chipbar__acts { display: flex; gap: 7px; flex: none; }
.act {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  width: 58px; height: 54px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.01));
  font-size: 12px; color: var(--txt-2);
  transition: .16s var(--ease);
}
.act:hover { color: var(--txt-1); border-color: rgba(255,255,255,.3); }
.act--confirm {
  width: 92px;
  border-color: transparent; color: #2b1d05; font-weight: 800;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 55%, var(--gold-3));
}
.act--confirm:hover { filter: brightness(1.07); color: #2b1d05; }
.act[disabled] { opacity: .38; pointer-events: none; }

.betsum {
  display: flex; align-items: center; gap: 14px;
  margin-top: 10px; padding: 9px 14px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  font-size: 12px; color: var(--txt-3);
  flex-wrap: wrap;
}
.betsum b { font-family: var(--font-num); font-size: 15px; color: var(--txt-1); margin-left: 5px; }
.betsum .gold b { color: var(--gold-1); }
.betsum .win b { color: #4fd39a; }

/* ==========================================================================
   4. 牌路區
   ========================================================================== */
.road-stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 11px; }
.road-stat__i {
  padding: 8px 6px; border-radius: var(--r-sm);
  background: rgba(255,255,255,.03); border: 1px solid var(--line);
  text-align: center;
}
.road-stat__n { font-family: var(--font-num); font-size: 20px; font-weight: 800; line-height: 1.1; }
.road-stat__l { font-size: 12px; color: var(--txt-3); margin-top: 2px; }
.c-bank { color: var(--red-soft); }
.c-play { color: #6ba8ff; }
.c-tie  { color: #4fd39a; }

.road-bar { height: 6px; border-radius: 3px; overflow: hidden; display: flex; margin-bottom: 12px; }
.road-bar i { display: block; height: 100%; }

.roadmap {
  --cell: 22px;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(6, var(--cell));
  grid-auto-columns: var(--cell);
  gap: 1px;
  padding: 6px;
  border-radius: var(--r-sm);
  background:
    repeating-linear-gradient(0deg, transparent 0 calc(var(--cell)), rgba(255,255,255,.05) calc(var(--cell)) calc(var(--cell) + 1px)),
    repeating-linear-gradient(90deg, transparent 0 calc(var(--cell)), rgba(255,255,255,.05) calc(var(--cell)) calc(var(--cell) + 1px)),
    rgba(0,0,0,.28);
  overflow-x: auto;
  scrollbar-width: thin;
}
.roadmap--bead { grid-auto-flow: column; }
.rc { display: grid; place-items: center; }
.rc i {
  width: 17px; height: 17px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800; font-style: normal; color: #fff;
}
.rc .b { background: linear-gradient(160deg, #f16a6a, #c62828); }
.rc .p { background: linear-gradient(160deg, #6ba8ff, #1f5fd0); }
.rc .t { background: linear-gradient(160deg, #58d9a1, #17875c); }
/* 大路(空心圈) */
.roadmap--big .rc i { background: none; border: 2px solid transparent; }
.roadmap--big .rc .b { border-color: #e05555; }
.roadmap--big .rc .p { border-color: #4f8ff0; }

.road-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.road-tabs button {
  flex: 1; height: 28px; border-radius: var(--r-sm);
  font-size: 12px; color: var(--txt-3);
  border: 1px solid var(--line);
}
.road-tabs button.is-on { color: var(--bg-0); font-weight: 700; background: linear-gradient(180deg, var(--gold-1), var(--gold-2)); border-color: transparent; }

/* 近期結果列表 */
.hist { margin-top: 12px; }
.hist__i {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 2px;
  border-bottom: 1px dashed var(--line);
  font-size: 12px; color: var(--txt-2);
}
.hist__i:last-child { border-bottom: 0; }
.hist__no { font-family: var(--font-num); color: var(--txt-3); width: 46px; flex: none; }
.hist__res {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff;
}
.hist__amt { margin-left: auto; font-family: var(--font-num); }
.hist__amt.up { color: #4fd39a; }
.hist__amt.dn { color: var(--red-soft); }

/* ==========================================================================
   5. 聊天室
   ========================================================================== */
.col-chat .panel { display: flex; flex-direction: column; height: calc(100vh - var(--head-h) - 38px); max-height: 860px; }
.chat {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 12px 12px 4px;
  display: flex; flex-direction: column; gap: 10px;
}
.msg { display: flex; gap: 8px; }
.msg__pic {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #0b0f14;
  background: linear-gradient(150deg, #8fa3b8, #5c6d80);
}
.msg__bd { min-width: 0; }
.msg__nm { font-size: 12px; color: var(--txt-3); display: flex; align-items: center; gap: 5px; }
.msg__nm .lv {
  font-size: 10px; font-weight: 800; padding: 0 5px; height: 15px;
  display: inline-grid; place-items: center; border-radius: 3px;
  background: rgba(217,180,90,.18); color: var(--gold-1);
}
.msg__tx {
  margin-top: 3px; padding: 7px 10px;
  border-radius: 3px var(--r-md) var(--r-md) var(--r-md);
  background: rgba(255,255,255,.055);
  font-size: 13px; line-height: 1.5; word-break: break-word;
}
.msg--me { flex-direction: row-reverse; }
.msg--me .msg__pic { background: linear-gradient(150deg, var(--gold-1), var(--gold-3)); }
.msg--me .msg__nm { justify-content: flex-end; }
.msg--me .msg__tx {
  border-radius: var(--r-md) 3px var(--r-md) var(--r-md);
  background: linear-gradient(180deg, rgba(217,180,90,.22), rgba(217,180,90,.12));
  color: #f7ecd2;
}
.msg--sys {
  align-self: center;
  font-size: 12px; color: var(--txt-3);
  background: rgba(255,255,255,.04);
  padding: 4px 12px; border-radius: var(--r-pill);
  text-align: center;
}
.msg--sys b { color: var(--gold-1); }
.msg--dealer .msg__pic { background: linear-gradient(150deg, #d97b6a, #a8412f); color: #fff; }

.quick { display: flex; gap: 6px; padding: 8px 12px 0; overflow-x: auto; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.quick button {
  flex: none; height: 26px; padding: 0 11px;
  border-radius: var(--r-pill); border: 1px solid var(--line);
  font-size: 12px; color: var(--txt-2); white-space: nowrap;
}
.quick button:hover { border-color: var(--gold-2); color: var(--gold-1); }

.chat-in {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
}
.chat-in input {
  flex: 1; min-width: 0; height: 36px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: rgba(0,0,0,.3);
  color: var(--txt-1); font-size: 13px; outline: none;
}
.chat-in input:focus { border-color: var(--gold-2); }
.chat-in input::placeholder { color: var(--txt-3); }
.chat-in__send {
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  color: #2b1d05;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
}

/* 線上人數 */
.online { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--txt-3); }

/* ==========================================================================
   手機分頁切換(投注/牌路/聊天)
   ========================================================================== */
.mtabs { display: none; }

/* ==========================================================================
   響應式
   ========================================================================== */

/* 平板橫式 / 小筆電:聊天收窄 */
@media (max-width: 1280px) {
  .room { grid-template-columns: 254px minmax(0, 1fr) 276px; gap: 12px; }
  .chip { width: 48px; height: 48px; }
  .act { width: 52px; height: 48px; }
  .act--confirm { width: 82px; }
}

/* 平板橫式:兩欄 —— 牌路移到投注區下方,聊天固定右側 */
@media (max-width: 1024px) {
  .room {
    grid-template-columns: minmax(0, 1fr) 268px;
    grid-template-areas:
      "stage chat"
      "bet   chat"
      "road  chat";
    grid-template-rows: auto auto 1fr;
    padding: 12px 12px 20px;
  }
  .col-chat .panel { height: calc(100vh - var(--head-h) - 34px); position: sticky; top: calc(var(--head-h) + 12px); }
  .roadmap { --cell: 20px; }
}

/* 平板直式:單欄堆疊 */
@media (max-width: 860px) {
  .room {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "stage" "bet" "road" "chat";
    grid-template-rows: none;
  }
  .col-chat .panel { height: 380px; position: static; }
  .bets--tiengow { grid-template-columns: repeat(2, 1fr); }
}

/* 手機:直播置頂固定,下方分頁切換 */
@media (max-width: 640px) {
  .room {
    display: block;
    padding: 0 0 8px;
  }
  .col-stage { position: sticky; top: var(--head-h); z-index: 40; background: var(--bg-0); }
  .stage { border-radius: 0; border-left: 0; border-right: 0; }
  .stage__bar { border-radius: 0; border-left: 0; border-right: 0; margin-bottom: 0; }
  .timer { width: 58px; height: 58px; top: 46px; right: 10px; }
  .timer__num { font-size: 21px; }
  .stage__state { font-size: 12px; padding: 6px 18px; }
  .dealer-card { padding: 4px 11px 4px 4px; }
  .dealer-card__pic { width: 28px; height: 28px; }
  /* 開牌區改為單行橫向捲動,避免蓋住荷官資訊 */
  .reveal {
    bottom: 6px; gap: 6px;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 0 8px 2px;
    scrollbar-width: none;
  }
  .reveal::-webkit-scrollbar { display: none; }
  .reveal__grp { padding: 5px 8px; flex: none; }
  .stage__ov .dealer-card { display: none; }

  .mtabs {
    display: flex;
    z-index: 39;
    background: var(--bg-1);
    border-bottom: 1px solid var(--line);
  }
  .mtabs button {
    flex: 1; height: 44px;
    display: flex; align-items: center; justify-content: center; gap: 5px;
    font-size: 13px; font-weight: 700; color: var(--txt-3);
    border-bottom: 2px solid transparent;
  }
  .mtabs button .ico { width: 16px; height: 16px; }
  .mtabs button.is-on { color: var(--gold-1); border-bottom-color: var(--gold-2); }

  /* 分頁切換:投注 / 牌路 / 聊天(籌碼列固定顯示) */
  .col-bet, .col-road, .col-chat { padding: 0 12px; }
  .col-bet > .panel { margin-top: 12px; }
  .col-bet > .betsum { margin-bottom: 12px; }
  .col-road > .panel, .col-chat > .panel { margin: 12px 0; }
  .col-bet > .panel, .col-bet > .betsum, .col-road, .col-chat { display: none; }
  body[data-mtab="bet"]  .col-bet > .panel  { display: block; }
  body[data-mtab="bet"]  .col-bet > .betsum { display: flex; }
  body[data-mtab="road"] .col-road { display: block; }
  body[data-mtab="chat"] .col-chat { display: block; }

  .panel { border-radius: var(--r-md); }
  .col-chat .panel { height: 62vh; }

  .bets--tiengow, .bets--niuniu { grid-template-columns: repeat(2, 1fr); }
  .bets--side { grid-template-columns: repeat(2, 1fr); }
  .spot { min-height: 92px; padding: 10px 10px 36px; }
  .spot__nm { font-size: 14px; }

  /* 籌碼列固定在底部導覽之上 */
  .chipbar {
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 75;
    margin: 0; border-radius: 0;
    border-left: 0; border-right: 0; border-bottom: 0;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
    background: rgba(13, 17, 23, .97);
    backdrop-filter: blur(12px);
  }
  .chip { width: 46px; height: 46px; }
  .act { width: 46px; height: 46px; font-size: 11px; }
  .act--confirm { width: 72px; }
  .room .tabbar { display: none; }
  body.is-room { padding-bottom: 78px; }
  .betsum { font-size: 12px; gap: 10px; }
  .roadmap { --cell: 21px; }
}

@media (max-width: 380px) {
  .chip { width: 42px; height: 42px; }
  .act { width: 42px; height: 44px; }
  .act--confirm { width: 64px; }
}

/* ==========================================================================
   遊戲體驗:翻牌 / 下注回饋 / 飄字
   ========================================================================== */

/* 3D 翻牌 */
.flip { position: relative; display: inline-block; perspective: 700px; }
.flip__in {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transform: rotateY(180deg);
  transition: transform .55s cubic-bezier(.3, .8, .3, 1);
}
.flip.is-open .flip__in { transform: rotateY(0deg); }
.flip__f, .flip__b {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flip__b { transform: rotateY(180deg); }
.flip svg { display: block; width: 100%; height: 100%; }

/* 下注時籌碼落入 */
@keyframes chipDrop {
  0%   { transform: translateY(-26px) scale(.7); opacity: 0; }
  60%  { transform: translateY(2px)   scale(1.06); opacity: 1; }
  100% { transform: translateY(0)     scale(1); opacity: 1; }
}
.spot__stack .chip-s { animation: chipDrop .28s var(--ease) both; }

/* 投注區被點擊的回饋 */
@keyframes spotTap {
  0% { box-shadow: 0 0 0 0 rgba(243,223,166,.55); }
  100% { box-shadow: 0 0 0 14px rgba(243,223,166,0); }
}
.spot.is-tap { animation: spotTap .5s ease-out; }

/* 已確認注單 */
.spot.is-locked-in { border-color: rgba(126,226,176,.55); }
.spot.is-locked-in .spot__amt .me { color: #7ee2b0; }

/* 中央飄字 */
.floatwin {
  position: absolute; left: 50%; top: 40%;
  transform: translate(-50%, -50%);
  z-index: 30;
  font-family: var(--font-num);
  font-size: 44px; font-weight: 700; letter-spacing: .03em;
  color: var(--gold-1);
  text-shadow: 0 2px 0 rgba(0,0,0,.5), 0 0 26px rgba(243,223,166,.65);
  pointer-events: none;
  animation: floatWin 2.2s cubic-bezier(.2, .8, .3, 1) forwards;
}
.floatwin.is-lose { color: #ff8f8f; text-shadow: 0 2px 0 rgba(0,0,0,.5), 0 0 22px rgba(255,107,107,.5); }
@keyframes floatWin {
  0%   { opacity: 0; transform: translate(-50%, -20%) scale(.7); }
  22%  { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  70%  { opacity: 1; transform: translate(-50%, -58%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -96%) scale(.96); }
}

/* 快捷鍵提示 */
.kbd {
  display: inline-grid; place-items: center;
  min-width: 17px; height: 17px; padding: 0 4px; margin-left: 5px;
  border-radius: 4px; border: 1px solid var(--line-strong);
  background: rgba(0,0,0,.4);
  font-family: var(--font-num); font-size: 11px; color: var(--txt-3);
}

/* ==========================================================================
   投注抽屜把手(手機橫向 / 全版模式使用)
   ========================================================================== */
.drawer-handle {
  display: none;
  position: fixed; right: 0; top: 50%;
  transform: translateY(-50%);
  z-index: 560;
  flex-direction: column; align-items: center; gap: 4px;
  width: 34px; padding: 14px 0;
  border-radius: var(--r-md) 0 0 var(--r-md);
  background: rgba(9, 13, 18, .86);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.16); border-right: 0;
  color: var(--gold-1);
  font-size: 12px; font-weight: 700; letter-spacing: .1em;
  writing-mode: vertical-rl;
  box-shadow: -6px 0 20px rgba(0,0,0,.5);
  transition: transform .28s var(--ease);
}
.drawer-handle .ico { writing-mode: horizontal-tb; }
.drawer-handle .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--red-soft);
  box-shadow: 0 0 8px var(--red-soft);
  display: none;
}
.drawer-handle.has-bet .dot { display: block; }

/* ==========================================================================
   全版直播模式(Theater)
   直播滿版 + 疊層下注抽屜 + 無底色聊天壓在右側
   ========================================================================== */

body.is-theater { overflow: hidden; }

body.is-theater .hd,
body.is-theater .mtabs,
body.is-theater .betsum,
body.is-theater .stage__bar { display: none !important; }

body.is-theater .room {
  display: block; padding: 0; max-width: none; gap: 0;
}

/* --- 直播畫面滿版 --- */
body.is-theater .col-stage { position: fixed; inset: 0; z-index: 500; }
body.is-theater .stage {
  position: absolute; inset: 0;
  aspect-ratio: auto;
  border: 0; border-radius: 0;
}
body.is-theater .stage__video img { object-position: center 42%; }
body.is-theater .stage__scrim {
  background:
    linear-gradient(180deg, rgba(0,0,0,.72) 0%, rgba(0,0,0,.06) 18%,
                    rgba(0,0,0,.12) 46%, rgba(0,0,0,.62) 78%, rgba(0,0,0,.88) 100%),
    linear-gradient(270deg, rgba(0,0,0,.55) 0%, transparent 34%);
}
body.is-theater .stage__top { padding: 14px 18px; }
body.is-theater .timer { top: 66px; right: 20px; width: 88px; height: 88px; }
body.is-theater .timer__num { font-size: 32px; }
body.is-theater .stage__state { top: 34%; font-size: 17px; padding: 10px 32px; }
body.is-theater .dealer-card { left: 18px; bottom: 116px; display: flex; }
body.is-theater .reveal { bottom: 116px; justify-content: center; }

/* --- 聊天:無底色,直接壓在視訊右側 --- */
/* 讓出頂部 58px,避免蓋住「離開全版」等控制鍵 */
body.is-theater .col-chat {
  position: fixed; z-index: 520;
  top: 58px; right: 0; bottom: 108px;
  width: 330px; padding: 0;
  display: block;
  pointer-events: none;
}
/* 全版時把退出鍵做成金色,一眼看得到 */
body.is-theater #btnTheater {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  border-color: transparent;
  color: #2b1d05; font-weight: 700;
  box-shadow: 0 2px 10px rgba(0,0,0,.5);
}
body.is-theater #btnTheater:hover { filter: brightness(1.08); }
body.is-theater .col-chat .panel {
  height: 100%; max-height: none;
  background: none; border: 0; border-radius: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
}
body.is-theater .col-chat .panel__hd {
  background: none; border: 0;
  justify-content: flex-end;
  padding-right: 18px;
  pointer-events: auto;
}
body.is-theater .col-chat .panel__t { display: none; }
body.is-theater .online { text-shadow: 0 1px 3px rgba(0,0,0,.9); color: rgba(255,255,255,.9); }

body.is-theater .chat {
  padding: 0 18px 6px 10px;
  gap: 5px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 16%);
  mask-image: linear-gradient(180deg, transparent 0, #000 16%);
  pointer-events: auto;
}
/* 彈幕式單行呈現 */
body.is-theater .msg { display: block; }
body.is-theater .msg__pic { display: none; }
body.is-theater .msg__bd { display: block; }
body.is-theater .msg__nm {
  display: inline; margin-right: 4px;
  color: var(--gold-1); font-size: 13px; font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,.95);
}
body.is-theater .msg__nm .lv { display: none; }
body.is-theater .msg__nm::after { content: "："; color: rgba(255,255,255,.72); }
body.is-theater .msg__tx {
  display: inline; margin: 0; padding: 0;
  background: none !important;
  border-radius: 0;
  color: #fff; font-size: 13px; font-weight: 500;
  text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 0 14px rgba(0,0,0,.8);
}
body.is-theater .msg--me .msg__nm { color: #7ee2b0; }
body.is-theater .msg--dealer .msg__nm { color: #ff9d8a; }
body.is-theater .msg--sys {
  align-self: stretch; text-align: left;
  background: none; padding: 0;
  color: rgba(255,255,255,.82);
  text-shadow: 0 1px 3px rgba(0,0,0,.95);
}
body.is-theater .quick { padding: 6px 18px 0 10px; pointer-events: auto; }
body.is-theater .quick button {
  background: rgba(0,0,0,.42);
  backdrop-filter: blur(6px);
  border-color: rgba(255,255,255,.18);
}
body.is-theater .chat-in {
  border-top: 0; padding: 8px 18px 10px 10px;
  pointer-events: auto;
}
body.is-theater .chat-in input {
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
  border-color: rgba(255,255,255,.2);
}

/* --- 籌碼列:浮動在底部中央 --- */
body.is-theater .col-bet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 540;
  padding: 0;
}
body.is-theater .chipbar {
  position: absolute; left: 0; right: 0; bottom: 16px;
  width: min(720px, calc(100vw - 380px));
  margin: 0 auto;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: rgba(9, 13, 18, .78);
  backdrop-filter: blur(16px);
  border-color: rgba(255,255,255,.16);
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}

/* --- 投注抽屜 --- */
body.is-theater .col-bet > .panel {
  display: block;
  position: absolute; left: 50%; bottom: 92px;
  transform: translate(-50%, 18px);
  width: min(760px, calc(100vw - 380px));
  max-height: 56vh; overflow-y: auto;
  border-radius: var(--r-lg);
  background: rgba(9, 13, 18, .88);
  backdrop-filter: blur(18px);
  border-color: rgba(255,255,255,.16);
  box-shadow: 0 20px 60px rgba(0,0,0,.65);
  opacity: 0; pointer-events: none;
  transition: opacity .24s var(--ease), transform .24s var(--ease);
}
body.is-theater.is-betopen .col-bet > .panel {
  opacity: 1; pointer-events: auto;
  transform: translate(-50%, 0);
}

/* --- 牌路浮層 --- */
body.is-theater .col-road {
  position: fixed; left: 16px; top: 76px; z-index: 520;
  width: 286px; padding: 0;
  display: block;
  opacity: 0; pointer-events: none;
  transform: translateX(-14px);
  transition: opacity .24s var(--ease), transform .24s var(--ease);
}
body.is-theater.is-roadopen .col-road { opacity: 1; pointer-events: auto; transform: none; }
body.is-theater .col-road .panel {
  background: rgba(9, 13, 18, .86);
  backdrop-filter: blur(16px);
  border-color: rgba(255,255,255,.16);
  box-shadow: 0 16px 50px rgba(0,0,0,.6);
  margin: 0;
}

/* 全版模式改用抽屜控制,一般模式的收合狀態在此失效 */
body.is-theater .col-bet.is-folded .panel__bd {
  max-height: none; opacity: 1; padding: 14px; overflow: visible;
}
body.is-theater .col-bet.is-folded .chipbar { display: flex; }
body.is-theater .fold-sum,
body.is-theater .panel__fold { display: none; }

/* --- 只在全版模式顯示的控制 --- */
.tctl-only { display: none; }
body.is-theater .tctl-only { display: inline-flex; }
body.is-theater .pill.is-on { background: var(--gold-2); color: #2b1d05; border-color: transparent; }

/* 全版模式的響應式 */
@media (max-width: 1100px) {
  body.is-theater .col-chat { width: 260px; }
  body.is-theater .chipbar,
  body.is-theater .col-bet > .panel { width: min(640px, calc(100vw - 300px)); }
}

@media (max-width: 860px) {
  body.is-theater .col-chat { width: 220px; bottom: 96px; }
  body.is-theater .col-road { width: 240px; }
  body.is-theater .chipbar,
  body.is-theater .col-bet > .panel { width: calc(100vw - 250px); }
}

@media (max-width: 640px) {
  /* 手機:聊天壓在畫面下半右側,籌碼列全寬 */
  body.is-theater .col-chat {
    width: 62%; top: auto; height: 42vh; bottom: 92px;
  }
  body.is-theater .col-chat .panel__hd,
  body.is-theater .quick { display: none; }
  body.is-theater .chat { padding: 0 10px 4px; }
  body.is-theater .chat-in { padding: 6px 10px 8px; }
  body.is-theater .chipbar {
    left: 0; right: 0; bottom: 0;
    transform: none; width: 100%;
    border-radius: 0;
    padding: 4px 8px calc(6px + env(safe-area-inset-bottom));
  }
  body.is-theater .col-bet > .panel {
    left: 0; right: 0; bottom: 84px;
    width: 100%; max-width: none;
    transform: translateY(18px);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    max-height: 50vh;
  }
  body.is-theater.is-betopen .col-bet > .panel { transform: none; }
  body.is-theater .col-road {
    left: 0; right: 0; top: auto; bottom: 84px;
    width: 100%; max-height: 52vh; overflow-y: auto;
  }
  body.is-theater .timer { width: 62px; height: 62px; top: 54px; right: 12px; }
  body.is-theater .timer__num { font-size: 22px; }
  body.is-theater .dealer-card { display: none; }
  body.is-theater .reveal { bottom: 96px; }
  body.is-theater .stage__state { font-size: 13px; }
}

/* ==========================================================================
   手機橫向:直播滿版,投注收成右側抽屜(預設收起,不擋畫面)
   ========================================================================== */
@media (orientation: landscape) and (max-height: 560px) {

  body.is-room { padding-bottom: 0; overflow: hidden; }
  .hd, .mtabs, .tabbar, .stage__bar, .betsum { display: none !important; }

  .room { display: block; padding: 0; max-width: none; }

  /* --- 直播滿版 --- */
  .col-stage { position: fixed; inset: 0; z-index: 10; }
  .stage {
    position: absolute; inset: 0;
    aspect-ratio: auto; border: 0; border-radius: 0;
  }
  .stage__video img { object-position: center 40%; }
  .stage__top { padding: 8px 12px; }
  .stage__name { font-size: 13px; }
  .timer { width: 56px; height: 56px; top: 42px; right: 12px; }
  .timer__num { font-size: 20px; }
  .stage__state { top: 36%; font-size: 13px; padding: 7px 20px; }
  .dealer-card { left: 10px; bottom: 10px; padding: 3px 10px 3px 3px; }
  .dealer-card__pic { width: 26px; height: 26px; }
  .dealer-card__n { font-size: 12px; }
  .dealer-card__s { display: none; }
  .reveal { bottom: 8px; gap: 6px; flex-wrap: nowrap; overflow-x: auto; justify-content: center; }

  /* --- 把手:右緣直立,永遠可按;抽屜開啟時貼著抽屜邊緣一起移動 --- */
  .drawer-handle { display: flex; }
  body.is-betopen .drawer-handle {
    transform: translateY(-50%) translateX(calc(-1 * min(300px, 78vw)));
  }
  /* 橫向已是滿版直播,不再提供全版切換,避免兩套版面打架 */
  #btnTheater, #btnTheaterBar { display: none; }

  /* --- 投注區:右側抽屜,預設收起 --- */
  .col-bet {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
    width: 300px; max-width: 78vw;
    padding: 0;
    display: flex; flex-direction: column;
    background: rgba(8, 11, 16, .94);
    backdrop-filter: blur(18px);
    border-left: 1px solid var(--line-strong);
    box-shadow: -12px 0 40px rgba(0,0,0,.6);
    transform: translateX(100%);
    transition: transform .28s var(--ease);
  }
  body.is-betopen .col-bet { transform: none; }

  .col-bet > .panel {
    display: block;
    flex: 1; min-height: 0; overflow-y: auto;
    margin: 0; border: 0; border-radius: 0;
    background: none;
    max-height: none; opacity: 1; pointer-events: auto;
    position: static; transform: none; width: auto;
  }
  .col-bet > .panel .panel__hd { position: sticky; top: 0; z-index: 2; background: rgba(8,11,16,.96); }
  .col-bet > .panel .panel__bd { padding: 10px; max-height: none; opacity: 1; overflow: visible; }
  .col-bet .panel__hd .limit-txt { display: none; }
  .col-bet .fold-sum, .col-bet .panel__fold { display: none; }

  .bets--tiengow, .bets--niuniu, .bets--side { grid-template-columns: repeat(2, 1fr); gap: 7px; }
  .spot { min-height: 74px; padding: 8px 9px 30px; }
  .spot__nm { font-size: 13px; }
  .spot__odds { font-size: 12px; }
  .spot__amt { height: 26px; padding: 0 8px; font-size: 11px; }
  .spot--side { min-height: 58px; padding: 7px 8px 28px; }

  /* --- 籌碼列:抽屜底部,不再固定在畫面前方 --- */
  .chipbar {
    position: static; transform: none;
    width: auto; margin: 0;
    border: 0; border-top: 1px solid var(--line); border-radius: 0;
    background: rgba(8, 11, 16, .96);
    padding: 4px 8px calc(6px + env(safe-area-inset-bottom));
    flex-wrap: wrap; gap: 6px;
  }
  .chips { padding: 12px 4px 7px; gap: 8px; flex: 1 1 100%; }
  .chip { width: 42px; height: 42px; }
  .chipbar__acts { flex: 1 1 100%; }
  .chipbar__acts .act { flex: 1; width: auto; height: 38px; font-size: 11px; }
  .act--confirm { flex: 1.6; }

  /* --- 聊天:左下透明疊層,不擋荷官 --- */
  .col-chat {
    display: block;
    position: fixed; left: 0; bottom: 0; z-index: 20;
    width: 48%; height: 52%;
    padding: 0;
    pointer-events: none;
  }
  .col-chat .panel {
    height: 100%; max-height: none;
    background: none; border: 0; border-radius: 0;
    display: flex; flex-direction: column; justify-content: flex-end;
  }
  .col-chat .panel__hd, .col-chat .quick { display: none; }
  .chat {
    padding: 0 8px 4px 10px; gap: 3px;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22%);
    mask-image: linear-gradient(180deg, transparent 0, #000 22%);
    pointer-events: auto;
  }
  .msg { display: block; }
  .msg__pic { display: none; }
  .msg__nm {
    display: inline; margin-right: 4px;
    color: var(--gold-1); font-size: 12px; font-weight: 700;
    text-shadow: 0 1px 3px rgba(0,0,0,.95);
  }
  .msg__nm .lv { display: none; }
  .msg__nm::after { content: "："; color: rgba(255,255,255,.72); }
  .msg__tx {
    display: inline; margin: 0; padding: 0;
    background: none !important; border-radius: 0;
    color: #fff; font-size: 12px; font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 0 12px rgba(0,0,0,.8);
  }
  .msg--me .msg__nm { color: #7ee2b0; }
  .msg--dealer .msg__nm { color: #ff9d8a; }
  .msg--sys {
    align-self: stretch; text-align: left;
    background: none; padding: 0;
    color: rgba(255,255,255,.82);
    text-shadow: 0 1px 3px rgba(0,0,0,.95);
  }
  .chat-in { border-top: 0; padding: 4px 8px 8px 10px; pointer-events: auto; }
  .chat-in input { height: 30px; background: rgba(0,0,0,.5); backdrop-filter: blur(8px); }
  .chat-in__send { width: 30px; height: 30px; }

  /* --- 牌路:左側浮層,預設收起 --- */
  .tctl-only { display: inline-flex; }
  .col-road {
    display: block;
    position: fixed; left: 10px; top: 40px; z-index: 40;
    width: 250px; padding: 0;
    opacity: 0; pointer-events: none;
    transform: translateX(-12px);
    transition: opacity .24s var(--ease), transform .24s var(--ease);
  }
  body.is-roadopen .col-road { opacity: 1; pointer-events: auto; transform: none; }
  .col-road .panel {
    margin: 0;
    max-height: calc(100vh - 56px); overflow-y: auto;
    background: rgba(8, 11, 16, .92);
    backdrop-filter: blur(16px);
    border-color: rgba(255,255,255,.16);
  }
  .roadmap { --cell: 18px; }
}
