/* 經典天堂倖存者：天堂原版介面圖（客戶端拆出來的視窗框、按鈕、對話框、關閉鈕、選取框、捲軸）
   圖：assets/ui/orig/（tools/拆介面.py）、assets/ui/o/（tools/介面切圖.py 去掉字的原版按鈕）
   這份最後載入，蓋過 game.css／lobby.css／modes.css 的按鈕與視窗樣式 */

/* ---------- 按鈕：原版「確認」按鈕（去字） ---------- */
.btn, .vb {
  background: none !important; box-shadow: none !important; border-radius: 0 !important;
  border-style: solid; border-width: 9px 20px; border-image: url(../assets/ui/o/btn_n.png?v=2) 9 30 fill / 9px 20px stretch;
  color: #ece3c8; font-weight: 700; text-shadow: 0 1px 1px #000, 0 0 2px #000; letter-spacing: 1px; padding: 0 6px; min-height: 34px; line-height: 16px;
}
.btn:hover, .vb:hover { filter: none; border-image-source: url(../assets/ui/o/btn_h.png?v=2); color: #fff6dc; }
.btn:active, .vb:active { border-image-source: url(../assets/ui/o/btn_p.png?v=2); }
.btn:disabled { filter: grayscale(1) brightness(.55); }
.btn.big { font-size: 19px; min-height: 40px; padding: 0 14px; }
.btn.sm { font-size: 14px; min-height: 30px; border-width: 7px 16px; border-image-width: 7px 16px; padding: 0 4px; }
.btn.on, .tabs button.on { border-image-source: url(../assets/ui/o/btn_h.png?v=2); color: #ffe9a8; }
.vb { min-height: 44px; }
.vb.go { color: #ffe9a8; }
.mini {
  background: none !important; border-radius: 0; border-style: solid; border-width: 5px 9px;
  border-image: url(../assets/ui/o/mini_n.png?v=2) 5 12 fill / 5px 9px stretch; color: #ece3c8; padding: 0 4px; line-height: 15px; text-shadow: 0 1px 1px #000;
}
.mini:hover { border-image-source: url(../assets/ui/o/mini_h.png?v=2); }
.mini:active, .mini.on { border-image-source: url(../assets/ui/o/mini_p.png?v=2); color: #fff; }

/* ---------- 視窗：原版視窗框（選角畫面的資訊框 s6487，tools/介面切圖.py 重組成 o/frame.png：去掉原圖下面那條底欄，內框一路包到底） ---------- */
.frame {
  background: none !important; outline: none !important; box-shadow: 0 8px 30px rgba(0, 0, 0, .7) !important; border-radius: 0 !important;
  border-style: solid; border-width: 24px; border-image: url(../assets/ui/o/frame.png?v=2) 33 fill / 24px stretch;
  padding: 4px 8px 8px;
}
.ttl { font-size: 19px; color: #e8d29a; letter-spacing: 2px; text-shadow: 0 1px 0 #000, 0 0 6px rgba(0, 0, 0, .9); margin-bottom: 8px; }
.frame.pnl { padding: 2px 6px 6px; }
.pnl-x { width: 30px !important; height: 28px !important; background: url(../assets/ui/orig/s6125.png?v=2) center / 24px 22px no-repeat !important; border: 0 !important;
  font-size: 0 !important; image-rendering: pixelated; right: -10px !important; top: -12px !important; }
.pnl-x:active { background-image: url(../assets/ui/orig/s6126.png?v=2) !important; }

/* ---------- 確認視窗：原版彈出框（s6247；tools/介面切圖.py 把放按鈕的底欄加高成 o/popup.png）
   跟原版一樣：文字在內框、按鈕在下面的底欄；右上角原圖的紅叉疊一顆透明按鈕，按了＝取消 ---------- */
#dlg .frame { position: relative; border-width: 26px 22px 52px 18px; border-image: url(../assets/ui/o/popup.png?v=2) 26 22 52 18 fill / 26px 22px 52px 18px stretch;
  min-width: 300px; padding: 6px 10px 8px; }
#dlg .frame > .row { position: absolute; left: 0; right: 0; top: calc(100% + 7px); margin: 0; flex-wrap: nowrap; }
#dlg .frame > .row .btn { min-height: 34px; font-size: 16px; padding: 0 12px; }
.dlg-x { position: absolute; right: -20px; top: -22px; width: 24px; height: 24px; border: 0; padding: 0; background: transparent; cursor: pointer; }
.dlg-x:active { background: url(../assets/ui/orig/s6126.png?v=2) center / 18px 17px no-repeat; }
/* 免責聲明是長文字：用一般視窗框 */
#legal .frame { border-width: 24px; border-image: url(../assets/ui/o/frame.png?v=2) 33 fill / 24px stretch; padding: 4px 8px 8px; }
.dlg-txt { color: #e9e1c8; }

/* ---------- 道具格、選取框（原版背包的格子與選取框 s536） ---------- */
.ic { background: #0b0907 !important; border: 1px solid #2c261c !important; box-shadow: inset 0 0 0 1px #000, inset 0 0 6px rgba(0, 0, 0, .9) !important; border-radius: 0 !important; }
.ic.on { border-color: transparent !important; box-shadow: none !important; background: #0b0907 url(../assets/ui/orig/s536.png?v=2) center / 100% 100% no-repeat !important; }
.ic.t2 { border-color: #2e4a66 !important; }
.ic.t3 { border-color: #6a4a18 !important; }
.ic.chk { border-color: #4a8a54 !important; }
.grid, .slist, .info, .notice, .how2, .tlist, .tcard, .quest, .tier, .prod, .dcard, .pcard, .cxm, .cxl, .srow { border-radius: 0 !important; }
.grid, .info, .slist { background: rgba(0, 0, 0, .55) !important; border: 1px solid #3a3226 !important; }

/* ---------- 輸入框：原版聊天輸入框的深色凹框 ---------- */
.inp, .fld input { background: #050403 !important; border: 1px solid #4a4030 !important; box-shadow: inset 0 1px 3px #000; border-radius: 0 !important; color: #f0e6c8 !important; }

/* ---------- 捲軸：原版捲軸（s2039 軌道、s2044 拉桿） ---------- */
.scr ::-webkit-scrollbar, .pnl-body::-webkit-scrollbar, .grid::-webkit-scrollbar, .slist::-webkit-scrollbar, .scr::-webkit-scrollbar { width: 12px; }
.scr ::-webkit-scrollbar-track, .scr::-webkit-scrollbar-track, .pnl-body::-webkit-scrollbar-track { background: url(../assets/ui/orig/s2039.png?v=2) center / 12px 100% no-repeat, #000; }
.scr ::-webkit-scrollbar-thumb, .scr::-webkit-scrollbar-thumb, .pnl-body::-webkit-scrollbar-thumb { background: url(../assets/ui/orig/s2044.png?v=2) center / 11px 16px no-repeat, #3a3226; border: 1px solid #000; }

/* ---------- 村莊上方資訊、下方按鈕 ---------- */
.vh-top { background: none !important; border-radius: 0 !important; box-shadow: none !important; border-style: solid; border-width: 14px; border-image: url(../assets/ui/o/frame.png?v=2) 33 fill / 14px stretch; padding: 0 6px 0 0 !important; }

/* ---------- 選角畫面（原版 800×600：背景 s6421、職業卡、資訊框 s6410、確認／刪除／退回） ---------- */
.sel-scr { background: #000; padding: 0; }
.sel-stage { position: relative; width: min(100vw, calc(100vh * 4 / 3)); aspect-ratio: 4 / 3; background: #000 url(../assets/ui/orig/s6421.png?v=2) center / 100% 100% no-repeat; }
.sel-list { position: absolute; left: 3%; top: 7%; width: 42.1%; display: flex; flex-direction: column; gap: 1.6%; }
.sel-slot { position: relative; cursor: pointer; line-height: 0; }
.sel-slot img { width: 100%; height: auto; display: block; }
.sel-slot .sn { position: absolute; right: 7%; bottom: 13%; font-size: clamp(11px, 1.7vw, 15px); line-height: 1.2; color: #fff2cc; font-weight: 900; text-shadow: 0 0 3px #000, 0 1px 2px #000, 0 0 6px #000; }
.sel-slot .sl { position: absolute; right: 7%; top: 13%; font-size: clamp(10px, 1.4vw, 13px); line-height: 1.2; color: #ffd76a; font-weight: 700; text-shadow: 0 0 3px #000, 0 0 6px #000; }
.sel-show { position: absolute; left: 50%; top: 3%; width: 46%; height: 57%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.sel-show img { max-height: 90%; max-width: 100%; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .85)); }
.sel-nm { font-size: clamp(14px, 2.3vw, 20px); font-weight: 900; color: #f6e6b6; text-shadow: 0 2px 2px #000, 0 0 8px #000; line-height: 1.4; }
.sel-info { position: absolute; left: 54.5%; top: 57%; width: 43.1%; aspect-ratio: 345 / 220; background: url(../assets/ui/o/sel_info.png?v=2) center / 100% 100% no-repeat; } /* s6410 去掉框外黑底（tools/介面切圖.py unbg） */
.sel-info i { position: absolute; left: 43%; max-width: 47%; overflow: hidden; text-overflow: ellipsis; transform: translateY(-50%); font-style: normal; font-size: clamp(10px, 1.55vw, 14px); color: #f0e6c8; white-space: nowrap; line-height: 1; }
.sel-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #d4c7a2; font-size: 14px; padding: 12%; text-align: center; background: rgba(0, 0, 0, .6); }
.sel-btns { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.obtn { position: absolute; pointer-events: auto; border: 0; padding: 0; cursor: pointer; background: transparent center / 100% 100% no-repeat; }
.obtn:disabled { filter: grayscale(1) brightness(.5); cursor: default; }
.obtn.ok { left: 3%; bottom: 3%; width: 18.75%; aspect-ratio: 150 / 34; background-image: url(../assets/ui/orig/s6489.png?v=2); }
.obtn.ok:hover { background-image: url(../assets/ui/orig/s6490.png?v=2); }
.obtn.ok:active { background-image: url(../assets/ui/orig/s6491.png?v=2); }
.obtn.del { left: 23.5%; bottom: 3.7%; width: 7.25%; aspect-ratio: 58 / 24; background-image: url(../assets/ui/orig/s6407.png?v=2); }
.obtn.del:hover { background-image: url(../assets/ui/orig/s6408.png?v=2); }
.obtn.del:active { background-image: url(../assets/ui/orig/s6409.png?v=2); }
.obtn.back { right: 3%; bottom: 3%; width: 11%; aspect-ratio: 88 / 35; background-image: url(../assets/ui/orig/s6415.png?v=2); }
.obtn.back:hover { background-image: url(../assets/ui/orig/s6416.png?v=2); }
.obtn.back:active { background-image: url(../assets/ui/orig/s6417.png?v=2); }
/* 沒有角色：提示放在拱門裡（人物站的位置），不壓在資訊框上 */
.sel-hint { position: absolute; left: 76.3%; top: 36%; transform: translate(-50%, -50%); z-index: 2; text-align: center; white-space: nowrap; pointer-events: none;
  font-size: clamp(14px, 2vw, 18px); line-height: 1.7; font-weight: 700; color: #ffe9a8; text-shadow: 0 0 6px #000, 0 2px 3px #000, 0 0 12px #000; }
/* 直式手機：上半部是原版拱門場景（背景高 --sh、只取拱門那一段），人物站在拱門裡；下面資訊框、角色卡 2×2；按鈕固定在最下面
   人物、資訊框、提示的位置都跟著 --sh 算（矮螢幕自動縮小，一個畫面放得下） */
@media (max-width: 640px), (max-aspect-ratio: 4 / 5) {
  /* 背景：手機專用 o/sel_portrait.png（tools/介面切圖.py：以拱門為中心裁、右邊鏡像補齊淡進黑色），拱門永遠在畫面正中間 */
  .sel-stage { --sh: 75vh; --ax: 50%;
    width: 100%; aspect-ratio: auto; min-height: 100vh; box-sizing: border-box; padding: 0 0 80px;
    display: flex; flex-direction: column; align-items: center;
    background: #050403 url(../assets/ui/o/sel_portrait.png?v=2) no-repeat; background-size: auto var(--sh); background-position: 50% 0; }
  .sel-stage::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: calc(var(--sh) + 1vh); pointer-events: none;
    background: linear-gradient(rgba(5, 4, 3, 0) calc(var(--sh) * .66), #050403 calc(var(--sh) * .99)); }
  .sel-info { position: relative; left: auto; top: auto; order: 1; width: min(310px, 84vw); margin-top: calc(var(--sh) * .573); flex: none; z-index: 2; }
  .sel-list { position: relative; left: auto; top: auto; order: 2; width: min(380px, 94vw); margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; z-index: 2; }
  .sel-btns { position: fixed; inset: auto 0 0 0; height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 12px; box-sizing: border-box; pointer-events: auto; z-index: 5;
    background: linear-gradient(rgba(5, 4, 3, 0), rgba(5, 4, 3, .92) 35%, #050403); }
  .sel-btns .obtn { position: static; }
  .sel-btns .obtn.ok { width: 140px; } .sel-btns .obtn.del { width: 64px; } .sel-btns .obtn.back { width: 96px; margin-left: auto; }
  .sel-slot .sn { font-size: 13px; bottom: 10%; } .sel-slot .sl { font-size: 11px; top: 10%; } .sel-info i { font-size: 13px; }
  .sel-hint { left: var(--ax); top: calc(var(--sh) * .36); }
}
@media (max-width: 640px) and (max-height: 700px), (max-aspect-ratio: 4 / 5) and (max-height: 700px) {
  .sel-stage { --sh: 64vh; }
  .sel-info { width: min(288px, 80vw); }
}

/* ---------- 聊天（天堂樣式：左下角、原版公頻／盟頻分頁、原版輸入框 p11142） ---------- */
.chat { position: absolute; left: 8px; bottom: 10px; width: 400px; pointer-events: auto; z-index: 2; }
.chat-log { height: 150px; overflow-y: auto; padding: 4px 6px; background: rgba(0, 0, 0, .42); font-size: 13px; line-height: 1.45; color: #fff;
  text-shadow: 0 0 2px #000, 0 1px 1px #000; touch-action: pan-y; overscroll-behavior: contain; word-break: break-all; }
.cl b { font-weight: 400; margin-right: 2px; }
.cl .cn { cursor: pointer; }
.cl .cn:hover { text-decoration: underline; }
.c-world { color: #f4e2b0; } .c-world b { color: #ffc35a; }
.c-clan { color: #9ff2a6; } .c-clan b { color: #6ee07a; }
.c-whisper { color: #ffa6f0; } .c-whisper b { color: #ff7ce8; }
.c-sys { color: #ff8f7a; } .c-sys b { color: #ff6a50; }
.cl.gm .cn { color: #ff6a50; font-weight: 700; }
.chat-in { display: flex; align-items: center; gap: 4px; height: 30px; padding: 0 6px; background: url(../assets/ui/orig/p11142.png?v=2) center / 100% 100% no-repeat; }
.chat-tab { width: 32px; height: 15px; cursor: pointer; image-rendering: pixelated; flex: none;  display: none; }   /* 11-16 使用者：不要公頻／盟頻分頁圖，直接打字送出；盟頻開頭打 @ */
.chat-in input { flex: 1; min-width: 0; height: 20px; background: transparent; border: 0; outline: none; color: #fff; font: inherit; font-size: 14px; }
.chat-in input::placeholder { color: rgba(220, 205, 170, .55); }
.chat-in .mini { flex: none; font-size: 12px; }
.chat-tab.off { cursor: default; }
@media (max-width: 760px), (pointer: coarse) {
  .chat { left: 6px; right: 6px; width: auto; bottom: 108px; }
  /* 收起來：只留最近幾行字、上緣淡出，沒有黑底 */
  .chat-log { height: 56px; font-size: 12px; background: none; -webkit-mask-image: linear-gradient(transparent, #000 40%); mask-image: linear-gradient(transparent, #000 40%); }
  .chat:not(.open) .chat-in { display: none; }
  /* 打字中：下面的按鈕先收起來、聊天貼到最下面；訊息區上淡下深的半透明，不是一大塊黑 */
  .chat.open .chat-log { height: 30vh; background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .5) 35%, rgba(0, 0, 0, .66));
    -webkit-mask-image: linear-gradient(transparent, #000 12%); mask-image: linear-gradient(transparent, #000 12%); }
  .chat-in input { font-size: 16px; }   /* iPhone 輸入框小於 16px 會自動放大 */
}

/* ---------- 直式村莊：最下面兩排按鈕（出發佔兩格），聊天在按鈕正上方 ---------- */
@media (max-width: 760px), (pointer: coarse) {
  .vh-btns { left: 6px; right: 6px; bottom: 6px; max-width: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .vb { min-width: 0; height: 40px; min-height: 40px; font-size: 14px; padding: 0 2px; border-width: 8px 12px; border-image-width: 8px 12px; letter-spacing: 0; }
  .vb.go { grid-column: span 2; font-size: 16px; }
  .chat { bottom: 98px; }
  #vhud.mall .chat { bottom: 142px; }
  #vhud #chatBox.open { bottom: 6px; }
  #chatBox.open ~ .vh-btns { display: none; }
}

/* ---------- 建角畫面（原版 800×600：職業大圖、職業徽章、男女鈕、角色命名框 s6526、下一步／退回） ---------- */
.cr-scr { background: #000; padding: 0; }
.cr-stage { position: relative; width: min(100vw, calc(100vh * 4 / 3)); aspect-ratio: 4 / 3; background: #000 center / 100% 100% no-repeat; }
.cr-title { position: absolute; left: 3%; top: 3%; width: 15.6%; }
.cr-sub { position: absolute; left: 3.4%; top: 10.5%; font-size: clamp(12px, 1.6vw, 14px); color: #d8c8a0; text-shadow: 0 1px 2px #000, 0 0 6px #000; }
.cr-info { position: absolute; left: 3%; top: 16%; width: 34%; box-sizing: border-box; padding: 4px 8px; border-style: solid; border-width: 18px;
  border-image: url(../assets/ui/o/frame.png?v=2) 33 fill / 18px stretch; color: #e9e1c8; font-size: clamp(12px, 1.6vw, 14px); line-height: 1.7; }
.cr-cn { font-size: clamp(17px, 2.6vw, 22px); font-weight: 900; color: #f4d27a; text-shadow: 0 2px 2px #000; }
.cr-d { margin: 2px 0 6px; }
.cr-st { display: flex; flex-wrap: wrap; gap: 0 12px; font-size: 0.92em; color: #bfae84; }
.cr-st b { color: #ffe9a8; }
.cr-classes { position: absolute; left: 0; right: 0; bottom: 11%; display: flex; justify-content: center; align-items: flex-end; gap: 0.5%; }
.cr-gender { display: contents; }
.cr-cls, .cr-g { width: 8.5%; aspect-ratio: 68 / 69; border: 0; padding: 0; background: transparent center / 100% 100% no-repeat; cursor: pointer; }
.cr-g:first-of-type { margin-left: 3%; }
.cr-cls:hover, .cr-g:hover { filter: brightness(1.25); }
.cr-name { position: absolute; left: 33.4%; bottom: 25%; width: 33.25%; aspect-ratio: 266 / 28; background: url(../assets/ui/orig/s6526.png?v=2) center / 100% 100% no-repeat, rgba(0, 0, 0, .62); box-shadow: 0 0 0 3px rgba(0, 0, 0, .45); }
.cr-name input { position: absolute; left: 29%; top: 8%; width: 68%; height: 84%; box-sizing: border-box; background: transparent; border: 0; outline: none; color: #fff2cc;
  font: inherit; font-size: clamp(13px, 1.8vw, 16px); padding: 0 6px; }
.cr-name input::placeholder { color: rgba(220, 205, 170, .5); }
.cr-msg { position: absolute; left: 0; right: 0; bottom: 21%; text-shadow: 0 1px 2px #000, 0 0 6px #000; }
.cr-stage .obtn.cr-back { left: 3%; right: auto; }
.obtn.next { right: 3%; bottom: 3%; width: 12%; aspect-ratio: 96 / 35; background-image: url(../assets/ui/orig/s6418.png?v=2); }
.obtn.next:hover { background-image: url(../assets/ui/orig/s6419.png?v=2); }
.obtn.next:active { background-image: url(../assets/ui/orig/s6420.png?v=2); }
@media (max-width: 640px), (max-aspect-ratio: 4 / 5) {
  /* 職業大圖高＝100vh（寬 133.33vh）；把人物的臉（--fx，ui.js ART_FX）對到畫面中間，左右不會露出黑邊 */
  .cr-stage { width: 100vw; aspect-ratio: auto; min-height: 100vh; background-size: auto 100vh; background-position: max(calc(100vw - 133.33vh), min(0px, calc(50vw - var(--fx, .62) * 133.33vh))) 0;
    display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 10px 70px; box-sizing: border-box; }
  .cr-title, .cr-sub, .cr-info, .cr-classes, .cr-name, .cr-msg { position: static; }
  .cr-title { width: 125px; align-self: flex-start; }
  .cr-sub { align-self: flex-start; }
  .cr-info { width: 100%; margin-top: auto; }
  .cr-classes { flex-wrap: wrap; gap: 4px; width: 100%; }
  .cr-cls, .cr-g { width: 17vw; max-width: 64px; }
  .cr-g:first-of-type { margin-left: 8px; }
  .cr-name { width: min(266px, 92vw); position: relative; left: auto; bottom: auto; }
  .cr-stage .obtn.cr-back, .cr-stage .obtn.next { position: fixed; bottom: 12px; }
  .cr-stage .obtn.cr-back { left: 10px; right: auto; width: 100px; }
  .cr-stage .obtn.next { right: 10px; left: auto; width: 110px; }
}

/* ---------- 視窗內部：原版道具格 s5479、升級卡、清單、分隔標題 ---------- */
.ic { background: #0b0907 url(../assets/ui/orig/s5479.png?v=2) center / 100% 100% no-repeat !important; border: 0 !important; box-shadow: none !important; }
.ic.t2 { box-shadow: inset 0 0 0 1px rgba(90, 150, 220, .55) !important; }
.ic.t3 { box-shadow: inset 0 0 0 1px rgba(230, 160, 50, .7) !important; }
.ic.chk { box-shadow: inset 0 0 0 2px #5fd07a !important; }
.ic.on { background: #0b0907 url(../assets/ui/orig/s536.png?v=2) center / 100% 100% no-repeat !important; box-shadow: none !important; }
.ic.eq.empty { background: #0b0907 url(../assets/ui/orig/s5479.png?v=2) center / 100% 100% no-repeat !important; opacity: .7; }
.card { background: none !important; border-radius: 0 !important; box-shadow: 0 6px 20px rgba(0, 0, 0, .7) !important; border-style: solid !important; border-width: 18px !important;
  border-image: url(../assets/ui/o/frame.png?v=2) 33 fill / 18px stretch !important; padding: 2px 6px 6px !important; }
.card:hover { filter: brightness(1.18); transform: translateY(-2px); }
.card .ic { background: #050403 !important; border: 1px solid #3a3226 !important; }
.sect { color: #e8d29a; font-size: 15px; border-bottom: 1px solid rgba(160, 130, 70, .45); padding-bottom: 3px; }
.srow { border-bottom: 1px solid rgba(90, 76, 50, .5) !important; }
.srow.on { background: rgba(160, 120, 50, .28) !important; box-shadow: inset 2px 0 0 #e8c060; }
.tcard, .quest, .tier, .prod, .dcard, .pcard, .cxm, .tline { border: 1px solid #3a3226 !important; background: rgba(0, 0, 0, .5) !important; }
.tcard.lock, .pcard.lock { opacity: .55; }
.dcard.on, .pcard.on, .quest.done, .tier.ok { border-color: #c9a24e !important; box-shadow: inset 0 0 0 1px rgba(201, 162, 78, .45); }
.chap { border-radius: 0 !important; border: 1px solid #3a3226 !important; }
.chap:hover { border-color: #c9a24e !important; }

/* 聊天：說明灰字、捲軸細一點、背景淡一點 */
.c-tip { color: #a89a78; font-size: 12px; } .c-tip b { color: #8c7d5a; }
.chat-log { background: rgba(0, 0, 0, .35); scrollbar-width: thin; scrollbar-color: #5a4a2a transparent; }
.chat-log::-webkit-scrollbar { width: 6px; } .chat-log::-webkit-scrollbar-thumb { background: #5a4a2a; } .chat-log::-webkit-scrollbar-track { background: transparent; }

/* 選角：人物站在拱門正中間（背景 s6421 拱門開口 x 540～680／800 → 中心 76.3%；腳底 57% 在資訊框上緣），原版選角動畫
   動畫每一格 160×270、腳底在格子的 (82, 237.5) → translate(-51%, -88%) 讓腳底剛好落在 (76.3%, 57%) */
.sel-fig { position: absolute; left: 76.3%; top: 57%; height: 46%; aspect-ratio: 160 / 270; transform: translate(-51%, -88%); pointer-events: none; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .8)); }
.sel-show { display: none; }
@media (max-width: 640px), (max-aspect-ratio: 4 / 5) {
  /* 直式：拱門在畫面正中間；腳底＝場景高 × 57%，人物高＝場景高 × 46%（跟電腦版同比例） */
  .sel-fig { left: var(--ax, 50%); top: calc(var(--sh, 75vh) * .57); height: calc(var(--sh, 75vh) * .46); z-index: 1; }
}
/* 建角：角色命名＝原版標籤＋原版輸入框（拆成兩段，框就是輸入框本身） */
.cr-name { display: flex; align-items: center; background: none !important; box-shadow: none !important; }
.cr-lab { height: 100%; width: auto; flex: none; filter: drop-shadow(0 0 3px #000) drop-shadow(0 0 2px #000); }
.cr-name input { position: static !important; flex: 1; min-width: 0; height: 100% !important; width: auto !important; box-sizing: border-box;
  background: url(../assets/ui/o/name_box.png?v=2) center / 100% 100% no-repeat, rgba(0, 0, 0, .55) !important; padding: 0 8px !important; }

/* ---------- 關卡實景圖（tools/關卡圖.py 從天堂原版地圖裁的 assets/ui/stage/<關卡編號>.jpg）：傳送師卡片、章節卡片、讀取畫面 ---------- */
.tcard .pic { width: 236px; min-height: 110px; background-position: center; box-shadow: inset 0 0 0 1px #3a3226, inset 0 0 18px rgba(0, 0, 0, .55); }
.chap .pic { box-shadow: inset 0 0 0 1px #3a3226, inset 0 0 18px rgba(0, 0, 0, .55); }
.load-pic { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); width: min(540px, 86vw); aspect-ratio: 540 / 252;
  background: #000 center / cover no-repeat; background-clip: padding-box; border-style: solid; border-width: 18px;
  border-image: url(../assets/ui/o/frame.png?v=2) 33 / 18px stretch; filter: drop-shadow(0 8px 24px rgba(0, 0, 0, .85)); }
@media (max-width: 760px) {
  .tcard { flex-direction: column; gap: 0; }
  .tcard .pic { width: 100%; min-height: 0; aspect-ratio: 540 / 210; }
  .tcard .bd { padding: 6px 10px 8px; }
  .chap { display: block; }
  .chap .pic { width: 100%; height: auto; aspect-ratio: 540 / 210; }
}
@media (max-height: 520px) and (orientation: landscape) { .load-pic { top: 40%; width: min(400px, 56vw); } }

/* ===== 聊天頻道鈕與選單（11-17 使用者：［一般］［血盟］［組隊］［世界］） ===== */
.chat-ch { flex: none; background: rgba(0, 0, 0, .35); border: 1px solid rgba(160, 130, 70, .55); border-radius: 2px; padding: 0 4px; height: 18px; line-height: 16px; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.chat-ch:hover { border-color: #e8c060; }
.chat-ch.c-say { color: #f4e2b0; } .chat-ch.c-clan { color: #6ee07a; } .chat-ch.c-shout { color: #ffb347; } .chat-ch.c-party { color: #7ad0ff; }
.chat-menu { position: absolute; left: 6px; bottom: 32px; z-index: 30; min-width: 230px; max-width: calc(100vw - 24px); background: rgba(12, 10, 8, .96); border: 1px solid #6a5428; box-shadow: 0 4px 14px rgba(0, 0, 0, .7); padding: 3px 0; }
.chat-menu .cm-i { display: block; padding: 4px 9px 5px; cursor: pointer; white-space: nowrap; }
.chat-menu .cm-i b { display: block; font-weight: 700; }
.chat-menu .cm-i small { display: block; font-size: 11px; color: #bfae84; white-space: nowrap; overflow: hidden; }
.chat-menu .cm-i:hover { background: rgba(160, 120, 50, .25); }
.chat-menu .cm-i.on { background: rgba(160, 120, 50, .35); }
.chat-menu .cm-i.off { opacity: .45; cursor: default; }
.chat-menu .cm-i.c-say b { color: #f4e2b0; } .chat-menu .cm-i.c-clan b { color: #6ee07a; } .chat-menu .cm-i.c-shout b { color: #ffb347; } .chat-menu .cm-i.c-party b { color: #7ad0ff; }
.c-say { color: #f4e2b0; } .c-say b { color: #ffc35a; }
.c-shout { color: #ffd9a0; } .c-shout b { color: #ff9a2a; font-weight: 700 !important; }
.c-party { color: #bfe6ff; } .c-party b { color: #7ad0ff; }
