/* 第 14 輪 D1：共用自適應 CSS（手機／平板／桌面一套規則）。載在所有 hall 樣式最後面，只放「版面」規則，不動各頁邏輯。
   斷點：≤ 480 手機、481–1024 平板、> 1024 桌面；字級用 clamp；安全區用 env(safe-area-inset-*)；觸控目標 ≥ 44px；金額千分位＋等寬數字。 */
:root {
  --r-gut: clamp(10px, 3.2vw, 20px);
  --r-fs: clamp(14px, 3.4vw, 16px);
  --r-fs-s: clamp(12.5px, 3vw, 14px);
  --r-fs-h: clamp(17px, 4.6vw, 22px);
  --r-tap: 44px;
  --r-sat: env(safe-area-inset-top, 0px); --r-sab: env(safe-area-inset-bottom, 0px); --r-sal: env(safe-area-inset-left, 0px); --r-sar: env(safe-area-inset-right, 0px);
}
/* 數字：等寬、不斷行（金額、等級、數量） */
.coin + b, .gw-coins b, #progCoin, #progLv, #progTxt, .cs-big, .cs-coin, .bg-cell .cnt, .pg-coin b, .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.gw-coins { flex-shrink: 0; min-width: 96px; justify-content: flex-end; }
/* 長字不要撐破版面：彈窗內容一律可斷行 */
#gwin, #r6, #r11ov, #r11help, #modal, #sheet, #boardwin, #statcard, #pop, #dlg { overflow-wrap: anywhere; word-break: normal; }
#gwin .gw-body, #r6 .r6-card, #r11ov .r11card { overflow-x: hidden; }
#gwin img, #r6 img, #r11ov img { max-width: 100%; }
#gwin table, #r6 table, #r11ov table { max-width: 100%; }
/* 彈窗內表單與按鈕：觸控裝置至少 44px */
body.touch #gwin button, body.touch #r6 button, body.touch #r11ov button, body.touch #r11help button, body.touch #modal button, body.touch #sheet button, body.touch #boardwin button, body.touch #creator button, body.touch #statcard button:not(.cs-x),
body.touch #gwin select, body.touch #r6 select, body.touch #r11ov select, body.touch #creator select, body.touch #statcard select { min-height: var(--r-tap); }
body.touch #gwin input:not([type=checkbox]):not([type=radio]):not([type=range]), body.touch #r6 input:not([type=checkbox]):not([type=radio]):not([type=range]), body.touch #r11ov input:not([type=checkbox]):not([type=radio]):not([type=range]), body.touch #creator input:not([type=checkbox]):not([type=radio]):not([type=range]), body.touch #sheet input:not([type=checkbox]):not([type=radio]):not([type=range]), body.touch #modal input:not([type=checkbox]):not([type=radio]):not([type=range]) { min-height: var(--r-tap); font-size: max(16px, 1em); }
body.touch #gwin input[type=checkbox], body.touch #r6 input[type=checkbox], body.touch #r11ov input[type=checkbox], body.touch #creator input[type=checkbox] { width: 24px; height: 24px; }
/* 抽屜裡的按鈕（選單）與關閉鍵 */
body.mui #mbDrawer .mb-x { min-width: var(--r-tap); min-height: var(--r-tap); }
body.mui #mbDrawer .mb-item { min-height: var(--r-tap); }
/* 彈窗：平板（觸控、寬 ≥ 700）全螢幕太空，改置中卡片；手機維持 mobile.css 的全螢幕 */
@media (min-width: 700px) and (pointer: coarse) {
  body.mui #gwin, body.mui #r6, body.mui #r11ov, body.mui #modal { padding: 16px !important; align-items: center !important; justify-content: center !important; background: rgba(40,30,60,.5) !important; }
  body.mui #gwin .gw-card, body.mui #r6 .r6-card, body.mui #r11ov .r11card { width: min(820px, 100%) !important; height: auto; max-height: calc(100dvh - 32px) !important; border-radius: 20px !important; }
  body.mui #modal .card { width: min(520px, 100%) !important; height: auto; max-height: calc(100dvh - 32px) !important; border-radius: 20px !important; }
  body.mui #gwin .gw-body { padding-bottom: 16px; }
  body.mui #gwClose, body.mui #r6 .r6-x, body.mui #r11ov .pf-x { position: static !important; left: auto; right: auto; bottom: auto; width: var(--r-tap) !important; height: var(--r-tap) !important; border-radius: 50% !important; }
  body.mui #gwClose::after, body.mui #r6 .r6-x::after, body.mui #r11ov .pf-x::after { content: none; }
  body.mui #gwin .gw-card header { padding-top: 10px; }
}
/* 小螢幕高度（橫向手機／平板橫式）：彈窗吃滿高度、內容可捲 */
@media (max-height: 520px) {
  #gwin .gw-card, #r6 .r6-card, #r11ov .r11card, #modal .card { max-height: calc(100dvh - 12px) !important; }
}
/* 場景名牌不要壓在彈窗上 */
#labels { z-index: 2; }
#statcard { z-index: 20; }
/* 角色狀態欄開著時，場景名牌、跳／互動鍵不要蓋在上面 */
body.statopen #labels, body.statopen #nameplate, body.statopen #rlayer, body.statopen #r11jump, body.statopen #joy, body.statopen #act, body.statopen #mbBig, body.statopen #minimap, body.statopen #mbFold, body.statopen #btnQuests { visibility: hidden; }
/* 勾選框／滑桿：觸控點擊區 ≥ 44px（勾選框靠外層 label 撐高；滑桿直接撐高） */
body.touch #gwin label:has(input[type=checkbox]), body.touch #r6 label:has(input[type=checkbox]), body.touch #r11ov label:has(input[type=checkbox]), body.touch #creator label:has(input[type=checkbox]), body.touch #sheet label:has(input[type=checkbox]) { min-height: var(--r-tap); display: inline-flex; align-items: center; gap: 8px; }
body.touch #gwin input[type=range], body.touch #r6 input[type=range], body.touch #r11ov input[type=range] { min-height: var(--r-tap); padding: 0; }
/* 太小的註解字放大到 12px */
.lk-pure, .lvb, #gwin em, #gwin .ti, #r6 small, #r11ov small, #boardwin .bw-dot { font-size: max(12px, 1em); }
/* D1 補強（Mac 矩陣巡查後）：觸控按鈕一律 ≥ 44px（部分彈窗的 .primary／✕／分頁鈕原本卡在 42px）；彈窗內小字不低於 12px */
body.touch :is(#gwin,#r6,#r11ov,#r11help,#modal,#sheet,#boardwin,#creator,#statcard,#pop,#dlg) :is(button,select,.primary,.r6-x,.bw-x,.bs-go,.pf-x) { min-height: var(--r-tap) !important; box-sizing: border-box; }
body.touch :is(#r6 .r6-x,#boardwin .bw-x,#r11ov .pf-x) { min-width: var(--r-tap); }
:is(#gwin,#r6,#r11ov,#r11help,#modal,#sheet,#boardwin,#statcard,#pop,#dlg) :is(small,.lk-rar,.lk-price,.cs-sub) { font-size: max(12px, 1em); }
.bs-tags span { font-size: 12px !important; }
