/* [claude code] 2026-08-05 建立 — wolves_crash client 樣式
   🔴 配色遵循台灣慣例：紅 = 賺 / 漲、綠 = 賠 / 跌（與西方相反）。
      贏分、紅機、收手成交一律用紅；輸掉、爆炸用綠。 */

:root {
  --bg: #0d1020;
  --bg2: #151a30;
  --card: #1b2140;
  --line: #2b3358;
  --fg: #e8ecff;
  --muted: #8e97c4;
  --gain: #ff4d5e;   /* 紅 = 賺 */
  --gain-dim: #7d2634;
  --loss: #35c46a;   /* 綠 = 賠 */
  --accent: #6c7dff;
  --warn: #ffc44d;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* 🔴 任何 `display: xxx` 的規則都會蓋掉 HTML 的 hidden 屬性（瀏覽器只給 hidden 一個
   優先權極低的 display:none）。本檔的 .modal 是 flex、.chip / button.chip 是 inline-flex，
   沒有這條兜底就會出現「明明寫了 hidden，彈窗跟登出鈕還是一直在畫面上」。
   （wovles_dadatg v1.3 線上事故就是這個，同一個雷不要踩第二次。）*/
[hidden] { display: none !important; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #1c2450 0%, var(--bg) 60%);
  color: var(--fg);
  font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  min-height: 100vh;
}

/* ── topbar ───────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 14px;
  background: rgba(13, 16, 32, .82);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.logo { font-size: 20px; }
.brand-name { letter-spacing: .5px; }
.brand-ver { font-size: 11px; color: var(--muted); font-weight: 400; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  font-size: 13px; color: var(--fg); white-space: nowrap;
}
.chip.balance b { color: var(--warn); font-variant-numeric: tabular-nums; }
button.chip { cursor: pointer; font-family: inherit; }
button.chip:hover { border-color: var(--accent); }

/* ── 通用 ─────────────────────────────────── */
.view { padding: 16px; max-width: 1080px; margin: 0 auto; }
.muted { color: var(--muted); font-size: 13px; }
code { background: #0a0d1c; padding: 1px 5px; border-radius: 5px; color: #ffb4c0; font-size: 12px; }
pre { background: #0a0d1c; padding: 10px 12px; border-radius: 10px; overflow-x: auto; margin: 8px 0; }
pre code { background: none; color: #cdd6ff; }

.btn {
  cursor: pointer; font-family: inherit; font-size: 15px; font-weight: 600;
  padding: 11px 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--fg);
  transition: transform .06s, filter .12s;
}
.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #7b8bff, #5566e8); border-color: #7b8bff; }
.btn.block { width: 100%; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.ghost { background: transparent; }

/* ── 身分列 / 登入（v1.1：大廳優先，登入改成彈窗）───────── */
.chip.cta { background: linear-gradient(180deg, #7b8bff, #5566e8); border-color: #7b8bff; font-weight: 600; }
.chip.mode { background: var(--gain-dim); border-color: var(--gain); color: #ffd9de; }

/* 大廳頂端的模式提示條：guest / trial 才出現，登入後自動收起 */
.mode-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 11px 14px; margin-bottom: 14px;
  background: linear-gradient(90deg, rgba(108,125,255,.16), rgba(255,77,94,.10));
  border: 1px solid var(--line); border-radius: var(--radius);
}
.mode-banner-text { font-size: 13px; line-height: 1.7; color: #c3cbf0; flex: 1; min-width: 220px; }
.mode-banner-text b { color: var(--fg); }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab {
  flex: 1; cursor: pointer; font-family: inherit; font-size: 14px;
  padding: 8px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--muted);
}
.tab.on { background: var(--bg2); color: var(--fg); border-color: var(--accent); }
.field { display: block; margin-bottom: 12px; }
.field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field input {
  width: 100%; padding: 11px 12px; font-size: 15px; font-family: inherit;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; color: var(--fg);
}
.field input:focus { outline: none; border-color: var(--accent); }
.auth-err { color: var(--gain); font-size: 13px; margin: 4px 0 10px; }
.auth-note { color: var(--muted); font-size: 12px; text-align: center; margin: 12px 0 0; line-height: 1.7; }

/* ── 大廳：文件 / 報告入口（比照 wolves_bingo 的 lobby-docs）───
   [claude code] 2026-08-07 v2.16 預設收起（`<details>` 原生摺疊），之後文件變多也不佔版面。 */
.lobby-docs { max-width: 520px; margin: 0 auto 16px; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.lobby-docs > summary { list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; font-weight: 700; letter-spacing: .5px; }
.lobby-docs > summary::-webkit-details-marker { display: none; }
.lobby-docs > summary:hover { color: var(--accent); }
.lobby-docs .ld-chev { color: var(--muted); font-size: 12px; transition: transform .15s; }
.lobby-docs[open] > summary .ld-chev { transform: rotate(180deg); }
.lobby-docs-body { padding: 2px 14px 14px; }
.doc-link { display: flex; flex-direction: column; gap: 4px; text-decoration: none;
  padding: 10px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
.doc-link:hover { border-color: var(--accent); }
.dl-title { color: var(--fg); font-weight: 600; font-size: 14px; }
.dl-hint { color: var(--muted); font-size: 12px; }

/* ── 大廳 ─────────────────────────────────── */
.lobby-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.lobby-head h2 { margin: 0; font-size: 20px; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.game-card {
  display: flex; flex-direction: column; gap: 8px; padding: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; position: relative; transition: border-color .15s, transform .1s;
}
.game-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.game-card.wip { opacity: .55; cursor: not-allowed; }
.game-card.wip:hover { transform: none; border-color: var(--line); }
.card-top { display: flex; align-items: center; gap: 8px; }
.card-emoji { font-size: 26px; }
.card-name { font-weight: 700; font-size: 16px; }
.card-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-desc {
  color: #c3cbf0; font-size: 13px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-tags { display: flex; gap: 5px; flex-wrap: nowrap; overflow: hidden; }
.card-tag { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--bg2); color: var(--muted); white-space: nowrap; }
.card-meta { margin-top: auto; display: flex; gap: 10px; font-size: 12px; color: var(--muted); padding-top: 6px; }
.wip-badge { position: absolute; top: 10px; right: 10px; font-size: 11px; background: var(--warn); color: #201400; padding: 2px 7px; border-radius: 999px; font-weight: 700; }
.lobby-wip { margin-top: 26px; }
.lobby-wip h3 { font-size: 15px; color: var(--muted); margin: 0 0 10px; }

/* ── 遊戲 ─────────────────────────────────── */
.game-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.game-title { font-weight: 700; font-size: 17px; flex: 1; }

/* [claude code] 2026-08-06 v1.4 走勢條：留著可橫捲（每顆點進去看單局明細），但把捲軸本身藏起來。
   原本 `overflow-x: auto` 在桌機會長出一條跨整個版面的灰色橫捲軸，正好卡在標題與圖表中間 ——
   那是整頁最顯眼的位置，卻只是個瀏覽器元件。改成：捲軸隱藏 + 右緣淡出，
   「右邊還有東西」用視覺暗示，滑鼠仍可 shift+滾輪 / 觸控仍可滑。 */
.history-strip {
  display: flex; gap: 5px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 10px;
  scrollbar-width: none; -ms-overflow-style: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent);
          mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent);
}
.history-strip::-webkit-scrollbar { display: none; }
.hist {
  flex: 0 0 auto; font-size: 12px; padding: 3px 9px; border-radius: 999px;
  background: var(--bg2); border: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
.hist.red { background: var(--gain-dim); border-color: var(--gain); color: #ffd9de; font-weight: 700; }
.hist.bust { color: var(--loss); }

.stage { position: relative; border-radius: var(--radius); overflow: hidden; background: #080b18; border: 1px solid var(--line); }
#stage { display: block; width: 100%; height: auto; }
.stage-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none; text-align: center;
}
.multiplier {
  font-size: clamp(38px, 9vw, 68px); font-weight: 800; letter-spacing: -1px;
  font-variant-numeric: tabular-nums; text-shadow: 0 0 28px rgba(0, 0, 0, .8);
}
.multiplier.crashed { color: var(--loss); }
.multiplier.red { color: var(--gain); }
.phase-text { font-size: 14px; color: var(--muted); margin-top: 4px; }
.fair-line { font-size: 11px; color: #5c6699; margin-top: 6px; word-break: break-all; padding: 0 12px; }

/* ── 注格（雙注）───────────────────────────── */
.bet-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; margin-top: 12px; }
.slot { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.slot.active { border-color: var(--warn); }
.slot.cashed { border-color: var(--gain); }
.slot-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.slot-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.slot-row input {
  flex: 1; min-width: 0; padding: 9px 10px; font-size: 15px; font-family: inherit;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.slot-row input:focus { outline: none; border-color: var(--accent); }
.stepper { cursor: pointer; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg2); color: var(--fg); font-size: 18px; font-family: inherit; }
.chips-row { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 9px; }
.chip-bet { cursor: pointer; font-family: inherit; font-size: 12px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg2); color: var(--muted); }
.chip-bet:hover { border-color: var(--accent); color: var(--fg); }
.auto-row { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 13px; color: var(--muted); }
.auto-row input[type=number] { width: 90px; flex: 0 0 auto; }
.btn-action { width: 100%; font-size: 16px; padding: 13px; }
.btn-action.bet { background: linear-gradient(180deg, #7b8bff, #5566e8); border-color: #7b8bff; }
.btn-action.cashout { background: linear-gradient(180deg, #ff6b7a, #e03a4e); border-color: #ff6b7a; }
.btn-action.cancel { background: transparent; }
.slot-note { font-size: 12px; color: var(--muted); margin-top: 7px; min-height: 17px; text-align: center; }
.slot-note.win { color: var(--gain); font-weight: 700; }
.slot-note.lose { color: var(--loss); }

/* ── 牌桌 / 即時動態 ───────────────────────── */
.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.table-panel { margin-top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table-head { display: flex; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.table-list { max-height: 220px; overflow-y: auto; }

/* [claude code] 2026-08-06 v1.4 寬螢幕：牌桌 / 即時動態拉上來跟遊戲並排（左欄上下放）。
   兩塊面板跟「誰在場上、剛剛發生什麼」一樣是這款的主資訊，
   原本擺在注格下面要捲一段才看得到，等於在共享局遊戲裡看不到別人。
   grid-column 指定位置 → DOM 仍是「遊戲先」，窄螢幕不用改順序就對。
   1180px 是實測門檻：左欄 320 + 右欄至少 760（雙注要 2×300 才不折行）+ padding。 */
/* 🔴 v2.4 起飛機也有兩種版面 → 這整段只給**橫版**用（`:not(.portrait)`）。
   直式的規則在下面「飛機直式」那段，兩者共用同一份 DOM。 */
@media (min-width: 1180px) {
  #viewGame:not(.portrait) { max-width: 1400px; }
  /* 🔴 左欄用絕對定位貼齊遊戲欄的高度，不要用 grid 兩欄 + stretch ——
     grid 的列高是「兩欄取較高者」，而即時動態最多會塞到 40 筆，
     內容一長就換成它把整列撐高，遊戲欄跟著被拉成 2600px（實測踩過）。
     絕對定位讓「遊戲欄多高、左欄就多高」是單向的，面板永遠只在自己框內捲。 */
  #viewGame:not(.portrait) .game-body { position: relative; }
  #viewGame:not(.portrait) .game-body > .panels {
    position: absolute; top: 0; bottom: 0; left: 0; width: 320px;
    grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; gap: 12px;
  }
  #viewGame:not(.portrait) .game-body > .game-col { margin-left: 332px; }
  /* 兩塊面板平分左欄高度、各自內捲 → 左右兩欄等高，不會有一邊拖長 */
  #viewGame:not(.portrait) .game-body .table-panel { margin-top: 0; display: flex; flex-direction: column; min-height: 0; }
  #viewGame:not(.portrait) .game-body .table-list { flex: 1; max-height: none; min-height: 0; }
}
.table-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; padding: 7px 12px; font-size: 13px; border-bottom: 1px solid rgba(43, 51, 88, .5); }
.table-row:last-child { border-bottom: none; }
.table-row .amt { color: var(--muted); font-variant-numeric: tabular-nums; }
.table-row .res { font-variant-numeric: tabular-nums; min-width: 92px; text-align: right; }
.table-row.cashed .res { color: var(--gain); font-weight: 700; }
.table-row.lost .res { color: var(--loss); }
.table-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }

/* 即時動態：新的一筆從上面滑進來 */
.feed-row { display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 13px;
  border-bottom: 1px solid rgba(43, 51, 88, .5); animation: feedIn .22s ease-out; }
.feed-row:last-child { border-bottom: none; }
.feed-row .f-who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-row .f-val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.feed-row.win .f-val { color: var(--gain); }
.feed-row.lose .f-val { color: var(--loss); }
.feed-row.bet .f-val { color: var(--muted); font-weight: 400; }
.feed-row.round { background: rgba(108, 125, 255, .10); }
.feed-row.round .f-who { color: var(--muted); }
@keyframes feedIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* 走勢條的每一顆都可以點進去看那一局的明細 */
.hist { cursor: pointer; transition: transform .1s, border-color .1s; }
.hist:hover { transform: translateY(-1px); border-color: var(--accent); }

/* 單局明細 */
.rd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.rd-kpi { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; }
.rd-kpi .k { color: var(--muted); font-size: 11px; }
.rd-kpi .v { font-size: 18px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.rd-kpi .v.red { color: var(--gain); }
.rd-kpi .v.green { color: var(--loss); }
.rd-fair { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12px; line-height: 1.8; }
.rd-fair .lbl { color: var(--muted); }
.rd-fair .val { word-break: break-all; color: #cdd6ff; }
.rd-verdict { margin-top: 10px; font-size: 13px; font-weight: 600; }
.rd-verdict.good { color: var(--gain); }
.rd-verdict.bad { color: var(--warn); }
.rec-row.clickable { cursor: pointer; }
.rec-row.clickable:hover { background: rgba(108, 125, 255, .08); }

/* ── 公平性面板 ───────────────────────────── */
.fair-panel { margin-top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.fair-panel summary { cursor: pointer; padding: 12px; font-size: 14px; }
.fair-body { padding: 0 14px 14px; font-size: 13px; line-height: 1.75; color: #c3cbf0; }
.verify-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.verify-row input { flex: 1; min-width: 120px; padding: 8px 10px; font-size: 12px; font-family: inherit;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; color: var(--fg); }
.verify-out { margin-top: 8px; font-size: 13px; }
.verify-out.good { color: var(--gain); }
.verify-out.bad { color: var(--warn); }

/* ── 飛機：直式版面（可切換，橫版仍是預設）─────
   [claude code] 2026-08-06 v2.4 使用者要「直版 / 橫版可切換」。
   🔴 橫版那套一個像素都沒動（CLAUDE.md：飛機那套很有 FEEL、不要動），
      直式是**另外加**的一組覆蓋：整頁收成 560px、面板改單欄、兩注並排，
      畫布長寬比由 crash.js 的 setLayout() 換（直式畫得更高，爬升感更明顯）。*/
#viewGame.portrait { max-width: 560px; }
#viewGame.portrait .game-body > .game-col { margin-left: 0; }
#viewGame.portrait .panels { grid-template-columns: 1fr 1fr; gap: 8px; }
#viewGame.portrait .table-list { max-height: 150px; }
#viewGame.portrait .multiplier { font-size: clamp(44px, 13vw, 66px); }
/* 兩注並排：直式的一屏要同時看得到飛機與兩個注格，堆成上下就得捲 */
#viewGame.portrait .bet-slots { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
/* 直式的注格壓扁一點：畫布已經很高，注格再厚就把收手鈕頂出視窗 */
#viewGame.portrait .slot { padding: 8px 9px; }
#viewGame.portrait .slot-head { margin-bottom: 5px; }
#viewGame.portrait .chips-row { margin-bottom: 6px; }
#viewGame.portrait .auto-row { margin-bottom: 6px; }
#viewGame.portrait .slot-note { min-height: 0; margin-top: 5px; }
#viewGame.portrait .slot-row { gap: 4px; margin-bottom: 6px; }
#viewGame.portrait .stepper { width: 30px; height: 32px; flex: 0 0 30px; font-size: 16px; }
#viewGame.portrait .slot-row input { padding: 7px 8px; font-size: 14px; }
#viewGame.portrait .chip-bet { padding: 3px 7px; font-size: 11px; }
#viewGame.portrait .auto-row { font-size: 12px; gap: 5px; }
#viewGame.portrait .auto-row input[type=number] { width: 62px; }
#viewGame.portrait .btn-action { font-size: 14px; padding: 11px 4px; }
@media (max-width: 430px) {
  /* 真的很窄（手機直握）就落回單欄，兩注並排會擠到按不到 */
  #viewGame.portrait .bet-slots { grid-template-columns: 1fr; }
  #viewGame.portrait .panels { grid-template-columns: 1fr; }
}

/* 直式 + 螢幕夠寬：**兩塊面板（縮窄）在左、飛機在右、兩注橫跨最下面**（v2.6 使用者指定）。
   🔴 這裡的重點是「整頁仍然是直的」：飛機欄**限寬 560px**（畫布 1.05 比例 → 比寬還高），
      整塊置中，不要因為螢幕寬就把飛機攤成橫的（v2.5 攤到 780×470，使用者說「不像直版」）。
   🔴 面板的清單一定要有 max-height：grid 的列高是「兩欄取較高者」，即時動態塞滿 40 筆
      就會把飛機那一欄一起撐高（橫版當初為此改用絕對定位，見上面 1180px 那段）。 */
@media (min-width: 1000px) {
  /* 🔴 飛機欄的**寬度跟著高度預算走**（343px ＝ 畫布以外的固定高度，與 crash.js 的常數同一個）：
     螢幕矮 → 欄變窄 → 畫布仍然「比寬還高」，而且注格（收手鈕）不會被頂出視窗。
     寫死 560px 的話，720px 高的螢幕會變成 544×446 的橫畫布 + 按鈕掉出畫面（實測過）。 */
  #viewGame.portrait {
    max-width: 800px;
    --stage-w: clamp(300px, calc(100vh - 343px), 560px);
    /* 畫布實際高度（跟 crash.js 的 `min(1.05×寬, clamp(280, 100vh−343, 620))` 同一條式子）。
       左欄靠它把自己鎖住 —— 🔴 改 crash.js 的比例 / 上限，這裡要一起改。 */
    --stage-h: min(calc(var(--stage-w) * 1.05), clamp(280px, calc(100vh - 343px), 620px));
  }
  #viewGame.portrait .game-body {
    display: grid;
    grid-template-columns: 210px minmax(0, var(--stage-w));
    grid-template-rows: auto auto;
    gap: 12px 14px; align-items: start; justify-content: center;
  }
  /* game-col 只是包裝：拆掉它，讓畫布與注格各自成為 grid 項目（注格才排得到最下面一整列） */
  #viewGame.portrait .game-body > .game-col { display: contents; }
  /* 🔴 左欄「高度鎖成畫布高度」，兩塊各半、各自內捲 ——
     grid 的列高是「兩欄取較高者」，即時動態一長就會把下面的注格整個往下推
     （使用者：「不會過長把下面投注區往下推」）。這跟橫版用絕對定位解的是同一個問題。 */
  #viewGame.portrait .game-body > .panels {
    grid-column: 1; grid-row: 1; grid-template-columns: 1fr; grid-template-rows: 1fr 1fr;
    gap: 10px; height: var(--stage-h);
  }
  #viewGame.portrait .game-body .table-panel {
    display: flex; flex-direction: column; min-height: 0;
  }
  #viewGame.portrait .game-body .table-list { flex: 1; max-height: none; min-height: 0; }
  #viewGame.portrait .stage { grid-column: 2; grid-row: 1; }
  #viewGame.portrait .bet-slots { grid-column: 1 / -1; grid-row: 2; margin-top: 0; }
  #viewGame.portrait .table-panel { margin-top: 0; }
  #viewGame.portrait .table-list { max-height: 240px; }
  /* 左欄縮窄了 → 字級與內距跟著收，才不會每一列都換行 */
  #viewGame.portrait .table-head { padding: 8px 10px; font-size: 12px; }
  #viewGame.portrait .table-row,
  #viewGame.portrait .feed-row { padding: 6px 10px; font-size: 12px; gap: 6px; }
  #viewGame.portrait .table-row .res { min-width: 0; }
}

/* ── modal / toast ─────────────────────────── */
.modal { position: fixed; inset: 0; background: rgba(4, 6, 14, .78); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 16px; }
.modal-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  width: 100%; max-width: 620px; max-height: 84vh; display: flex; flex-direction: column; padding: 14px; }
.modal-box.narrow { max-width: 380px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 700; }
.modal-body { overflow-y: auto; font-size: 13px; }
.rec-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 8px 4px; border-bottom: 1px solid rgba(43, 51, 88, .6); }
.rec-row .r-main { color: #c3cbf0; }
.rec-row .r-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.rec-row .r-val { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.r-val.plus { color: var(--gain); }
.r-val.minus { color: var(--loss); }

.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; }
.toast { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 16px; font-size: 14px;
  animation: toastIn .18s ease-out; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.toast.err { border-color: var(--warn); color: var(--warn); }
.toast.win { border-color: var(--gain); color: #ffd9de; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }


/* ── 百人牛牛（bull）：直式桌台 ─────────────────
   [claude code] 2026-08-06 v2.2 參考 old_project/slot_town 的手機直式桌台重做：
   上面莊家開牌 → 賠付分檔 → 中間四門（籌碼堆在區內）→ 兩側路人 → 下面籌碼列。
   🔴 同一份 DOM 支援兩種版面（見本段末的 .view.wide）—— 直式是預設，寬版是選項。 */
.view.portrait { max-width: 560px; }

.bull-road { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 8px;
  scrollbar-width: none; -ms-overflow-style: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 30px), transparent);
          mask-image: linear-gradient(90deg, #000 calc(100% - 30px), transparent); }
.bull-road::-webkit-scrollbar { display: none; }

/* 桌面：深綠絨布，跟飛機的太空藍區隔開（使用者：風格可以不同）*/
.bt {
  position: relative; border-radius: 18px; padding: 10px 10px 8px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(90, 200, 150, .10), transparent 60%),
    linear-gradient(180deg, #123024, #0d2018 60%, #0b1a14);
  border: 1px solid #2a5c46;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, .55), 0 8px 26px rgba(0, 0, 0, .45);
}
.bt-chiplayer { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 20; }

/* 莊家 */
.bt-banker { background: linear-gradient(180deg, rgba(255, 196, 77, .10), rgba(0, 0, 0, .18));
  border: 1px solid #3d6b52; border-radius: 14px; padding: 8px 10px; }
.bt-banker.player { border-color: var(--warn); box-shadow: 0 0 18px rgba(255, 196, 77, .18); }
.bt-banker-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.bt-who { font-size: 13px; font-weight: 700; }
.bt-who b.me { color: var(--warn); }
.bt-share { font-size: 11px; color: var(--muted); margin-left: 5px; }
.bt-stat { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.bt-pnl { font-weight: 700; font-variant-numeric: tabular-nums; }
.bt-pnl.up { color: var(--gain); }
.bt-pnl.down { color: var(--loss); }
.bt-leaving { color: var(--warn); }
.bt-actions { margin-left: auto; display: flex; gap: 5px; }
.bt-hand { display: flex; gap: 4px; justify-content: center; }
.bt-level { text-align: center; font-size: 13px; font-weight: 800; color: var(--warn); min-height: 18px; margin-top: 3px; }

/* 🔴 賠付分檔：牌型 ↔ 倍數擺在一起（使用者：看不出來倍數怎麼和牌型一起）*/
.bt-tiers { display: flex; gap: 4px; margin: 8px 0; }
.bt-tier { flex: 1; text-align: center; border-radius: 9px; padding: 4px 2px;
  background: rgba(0, 0, 0, .28); border: 1px solid #2f5c47; }
.bt-tier .t-name { display: block; font-size: 10px; color: #9fd8bd; }
.bt-tier .t-odds { display: block; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bt-tier.hit { border-color: var(--warn); background: rgba(255, 196, 77, .16); }
.bt-tier.hit .t-odds { color: var(--warn); }

/* 兩側路人 + 中間四門 */
.bt-arena { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 6px; align-items: start; }
.bt-crowd { display: flex; flex-direction: column; gap: 5px; }
.bt-seat { display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: rgba(0, 0, 0, .3); border: 1px solid #2f5c47; border-radius: 10px; padding: 3px 1px; }
.bt-seat .s-face { font-size: 17px; line-height: 1.1; }
.bt-seat .s-name { font-size: 8px; color: var(--muted); max-width: 40px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.bt-seat .s-amt { font-size: 9px; color: var(--warn); font-variant-numeric: tabular-nums; }
.bt-seat.me { border-color: var(--warn); }

.bt-doors { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
/* [claude code] 2026-08-06 v2.4 門的下緣留一條「籌碼道」（padding-bottom）——
   籌碼原本往門中心飛，正好蓋在牌面上、牌型看不出來。落點計算在 bull.js 的 CHIP_LANE，
   🔴 兩邊要一起改，不然籌碼會壓回牌上。 */
.bt-door { position: relative; min-height: 142px; cursor: pointer; overflow: hidden;
  border-radius: 13px; padding: 5px 6px 48px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(0, 0, 0, .25));
  border: 1px solid #35664f; transition: border-color .12s, transform .07s, box-shadow .15s; }
.bt-door:hover { border-color: #6fd6a6; }
.bt-door:active { transform: scale(.985); }
.bt-door.has-mine { border-color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }
.bt-door.won { border-color: var(--gain); background: linear-gradient(180deg, var(--gain-dim), rgba(0, 0, 0, .3)); }
.bt-door.lost { opacity: .55; }
.d-top { display: flex; align-items: baseline; justify-content: space-between; }
.d-name { font-size: 12px; font-weight: 800; }
.d-level { font-size: 12px; font-weight: 800; color: var(--warn); }
.d-hand { display: flex; gap: 3px; justify-content: center; margin: 4px 0 2px; }
/* 🔴 門內的賠付四階：全部列出來（不是「×1.87 ~ ×3.24」的範圍），中的那階亮起來 */
.d-tiers { display: flex; gap: 2px; margin-top: 2px; }
.d-tier { flex: 1; font-style: normal; text-align: center; font-size: 10px; padding: 2px 0;
  border-radius: 5px; background: rgba(0, 0, 0, .3); color: #9fd8bd;
  font-variant-numeric: tabular-nums; transition: background .15s, color .15s; }
.d-tier.dim { opacity: .35; }
.d-tier.hit { background: var(--gain-dim); color: #ffd9de; font-weight: 900; font-size: 12px;
  box-shadow: 0 0 0 1px var(--gain); opacity: 1; }
.d-tier.hit.lose { background: rgba(255, 255, 255, .06); color: var(--muted); box-shadow: 0 0 0 1px var(--line); }
.d-foot { position: absolute; left: 0; right: 0; bottom: 3px; display: flex;
  justify-content: space-between; padding: 0 7px; font-size: 10px; color: var(--muted); }
.d-mine { color: var(--warn); font-weight: 700; font-variant-numeric: tabular-nums; }
.d-all { font-variant-numeric: tabular-nums; }

/* 牌（直式桌台用小張）*/
.pcard { width: 26px; height: 36px; border-radius: 5px; display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1; font-weight: 800;
  background: #fbfcff; color: #16182c; border: 1px solid #c9d0ee; }
.pcard.back { background: repeating-linear-gradient(45deg, #1d4436, #1d4436 4px, #2a6049 4px, #2a6049 8px);
  border-color: #3d7a5e; color: transparent; }
.pcard.red { color: #d92b3f; }
.pcard .r { font-size: 12px; }
.pcard .s { font-size: 9px; }
.bt-banker .pcard { width: 32px; height: 44px; }
.bt-banker .pcard .r { font-size: 14px; }

.bt-phase { display: flex; align-items: baseline; justify-content: center; gap: 10px; margin-top: 8px;
  font-size: 13px; font-weight: 600; }
.bt-timer { font-size: 20px; font-weight: 800; color: var(--warn); font-variant-numeric: tabular-nums; }

/* 飛出去的籌碼（物件池；抄 slot_town 的作法）*/
.bt-chip-sprite { position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 9px; font-weight: 900; color: #fff;
  border: 2px dashed rgba(255, 255, 255, .8); box-shadow: 0 3px 8px rgba(0, 0, 0, .5); will-change: transform; }
.bt-chip-sprite.c1 { background: radial-gradient(circle at 50% 35%, #cfd6e6, #8a93ad); color: #1a1a2a; }
.bt-chip-sprite.c2 { background: radial-gradient(circle at 50% 35%, #56a6ff, #2060c0); }
.bt-chip-sprite.c3 { background: radial-gradient(circle at 50% 35%, #ff6b6b, #c01f38); }
.bt-chip-sprite.c4 { background: radial-gradient(circle at 50% 35%, #c79bff, #7a3fd0); }
.bt-chip-sprite.c5 { background: radial-gradient(circle at 50% 35%, #ffd24a, #c98a00); color: #2a1a00; }
.bt-float { position: absolute; transform: translate(-50%, -50%); font-weight: 900; font-size: 18px;
  color: var(--gain); white-space: nowrap; z-index: 22; pointer-events: none;
  text-shadow: 0 0 12px rgba(255, 77, 94, .8), 0 2px 4px rgba(0, 0, 0, .9);
  animation: btFloat 1.4s ease-out forwards; }
@keyframes btFloat {
  0% { transform: translate(-50%, -50%) scale(.5); opacity: 0; }
  25% { transform: translate(-50%, -95%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -200%) scale(1); opacity: 0; }
}

/* 籌碼列：圓形籌碼（桌台的語言，不是方形按鈕）*/
.bt-chipbar { display: flex; gap: 8px; justify-content: center; margin: 10px 0 6px; flex-wrap: wrap; }
.chip-coin { width: 52px; height: 52px; border-radius: 50%; cursor: pointer; font-family: inherit;
  font-size: 12px; font-weight: 900; color: #fff; border: 3px dashed rgba(255, 255, 255, .75);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .45); transition: transform .1s, box-shadow .12s; }
.chip-coin:hover { transform: translateY(-2px); }
.chip-coin.on { transform: translateY(-4px); box-shadow: 0 0 0 3px var(--warn), 0 6px 14px rgba(0, 0, 0, .5); }
.chip-coin.c1 { background: radial-gradient(circle at 50% 35%, #cfd6e6, #8a93ad); color: #1a1a2a; }
.chip-coin.c2 { background: radial-gradient(circle at 50% 35%, #56a6ff, #2060c0); }
.chip-coin.c3 { background: radial-gradient(circle at 50% 35%, #ff6b6b, #c01f38); }
.chip-coin.c4 { background: radial-gradient(circle at 50% 35%, #c79bff, #7a3fd0); }
.chip-coin.c5 { background: radial-gradient(circle at 50% 35%, #ffd24a, #c98a00); color: #2a1a00; }

.bt-mybar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.bt-mine { font-size: 13px; color: var(--muted); }
.bull-tableleft { font-size: 12px; color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.bull-tableleft.low { color: var(--warn); font-weight: 700; }
.bull-tableleft.full { color: var(--loss); font-weight: 700; }
.bull-note { font-size: 13px; color: var(--muted); margin: 8px 2px 0; min-height: 18px; }
.bull-note.win { color: var(--gain); font-weight: 700; }
.bull-note.lose { color: var(--loss); }

/* 次要資訊往下疊（摺疊）
   [claude code] 2026-08-06 v2.4 「本局牌桌」與「即時動態」兩塊改**左右並排**（使用者：比較平衡）。
   窄畫面（手機 / 直式桌台的實際寬度）自動落回上下疊 —— 兩欄各剩 260px 會把每一列擠到換行。 */
.bt-folds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: start; }
@media (max-width: 700px) { .bt-folds { grid-template-columns: 1fr; } }
.bt-fold { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 12px; margin-top: 8px; }
.bt-fold > summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.bt-fold .table-list { max-height: 190px; overflow-y: auto; margin-top: 6px; }

/* 上莊彈窗的試算 */
.bank-preview { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 4px 0 12px; }
.bank-preview div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 3px 0; }
.bank-preview span { color: var(--muted); }
.bank-preview b { font-variant-numeric: tabular-nums; }
#bankShare { width: 100%; }

/* ── 寬版（可切換；直式才是預設）──────────────
   [claude code] 2026-08-06 v2.2 使用者問「這二種介面有辦法共存嗎」→ 同一份 DOM、兩種模式。
   寬版把四門攤成一直排（每一手牌看得更清楚），路人改橫向一列。切換鈕在遊戲標題列，記在 localStorage。 */
@media (min-width: 900px) {
  .view.wide { max-width: 1100px; }
  .view.wide .bt-doors { grid-template-columns: 1fr; }
  /* 寬版的門是「一橫排」（名稱 | 牌 | 賠付四階），牌會被垂直置中 → 籌碼道要留更多，
     不然籌碼會貼著牌的下緣（實測 padding 48 時只差 3px）。 */
  .view.wide .bt-door { min-height: 96px; padding: 5px 8px 56px;
    display: grid; grid-template-columns: 78px 1fr 130px; align-items: center; gap: 8px; }
  .view.wide .d-hand { margin: 0; }
  .view.wide .d-tiers { max-width: 220px; margin-left: auto; }
  .view.wide .bt-arena { grid-template-columns: 1fr; }
  .view.wide .bt-crowd { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .view.wide .bt-crowd.right { display: none; }
  .view.wide .pcard { width: 32px; height: 44px; }
  .view.wide .pcard .r { font-size: 14px; }
}

@media (max-width: 640px) {
  .view { padding: 10px; }
  .bet-slots { grid-template-columns: 1fr; }
  .panels { grid-template-columns: 1fr; }
  .table-list { max-height: 160px; }

  /* 🔴 手機把頂列壓到一排。
     實測（375px、試玩中狀態）原本 5 顆 chip 會折成三排、頂列高 123px，
     在 812px 高的機子上等於先吃掉 15% 畫面 —— 違反「手機一屏可見」的精神。
     收掉三個「知道也沒差」的東西，資訊本身都還在（版本看 /api/meta、暱稱看我的紀錄）。 */
  .brand-ver { display: none; }          /* 版本號是給開發看的 */
  .btn-label { display: none; }          /* 「🧾 我的紀錄」→🧾、「登入 / 建立帳號」→登入 */
  .chip.mode:not([hidden]) ~ .chip.nick { display: none; }  /* 試玩中已經講了身分，暱稱(訪客xxxx)重複 */
}
