/* 經典天堂倖存者：天堂原版介面圖（客戶端拆出來的視窗框、按鈕、對話框、關閉鈕、選取框、捲軸）
   圖：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/orig/s6410.png?v=2) center / 100% 100% no-repeat; }
.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); }
/* 直式：上面人物、資訊框，下面 4 格角色卡、按鈕；可以上下捲 */
@media (max-width: 640px), (max-aspect-ratio: 4 / 5) {
  .sel-stage { width: 100vw; aspect-ratio: auto; min-height: 100vh; background-size: cover; background-position: center top;
    display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 0 18px; box-sizing: border-box; }
  .sel-show, .sel-list, .sel-btns { position: static; }
  .sel-info { position: relative; left: auto; top: auto; }
  .sel-show { order: 1; width: 100%; height: 30vh; }
  .sel-info { order: 2; width: min(345px, 92vw); flex: none; }
  .sel-list { order: 3; width: min(337px, 92vw); gap: 6px; }
  .sel-btns { order: 4; display: flex; align-items: center; gap: 10px; width: min(337px, 92vw); pointer-events: auto; }
  .obtn { position: static; }
  .obtn.ok { width: 150px; } .obtn.del { width: 70px; } .obtn.back { width: 100px; margin-left: auto; }
  .sel-slot .sn { font-size: 14px; } .sel-slot .sl { font-size: 12px; } .sel-info i { font-size: 13px; }
}

/* ---------- 聊天（天堂樣式：左下角、原版公頻／盟頻分頁、原版輸入框 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; }
.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; }
@media (max-width: 760px), (pointer: coarse) {
  .chat { left: 6px; right: 6px; width: auto; bottom: 108px; }
  .chat-log { height: 52px; font-size: 12px; background: rgba(0, 0, 0, .3); }
  .chat:not(.open) .chat-in { display: none; }
  .chat.open .chat-log { height: 34vh; background: rgba(0, 0, 0, .62); }
  .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; }
}

/* ---------- 建角畫面（原版 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) {
  .cr-stage { width: 100vw; aspect-ratio: auto; min-height: 100vh; background-size: cover; background-position: 62% top;
    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; }

/* 選角：人物站在拱門中間（腳底對齊拱門地板 68%／57%），原版選角動畫 */
.sel-fig { position: absolute; left: 68%; 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) {
  .sel-fig { position: relative; left: auto; top: auto; transform: none; height: 30vh; order: 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; }
