/* 經典天堂倖存者：防跑版（文字、按鈕不超出框、不折行、不互相蓋住）——這份最後載入
   規則：名稱、標題、按鈕這類單行的字一律不折行；放不下由 js/fit.js 等比例縮小（最小 9px），還放不下才出現省略號
   檢查方法：瀏覽器主控台貼上 docs/跑版檢查.md 的掃描程式，電腦版、直式、橫式各跑一次 */

/* ---------- 單行元件：不折行、不超出框（字會自動縮小） ---------- */
.btn, .vb, .mini, .ttl, .sect, .nm, .pn, .i-nm, .en-nm, .pv-n, .pv-s, .cr-cn, .qt, .tn, .plv, .rc, .best,
.cxm .cn, .cxm .cc, .sel-info i, .st-rl, .st-rv, .vh-inf .nm, .vh-inf .sub3, .srow span, .vh-notice, .pflash, .card .lv {
  white-space: nowrap; overflow-x: clip; overflow-y: visible; text-overflow: ellipsis; min-width: 0;
}
.btn, .vb, .mini { max-width: 100%; box-sizing: border-box; }
.pflash { max-width: 92%; }
/* 分頁鈕：一排放不下就換到下一排，不會擠到字折成兩行或跑出視窗 */
.tabs { flex-wrap: wrap; }
.tabs > button { flex: none; }

/* ---------- 角色欄（選角）：資訊框的字上下不被切、名字不超出職業卡 ---------- */
.sel-info i { line-height: 1.35; }
.sel-slot .sn, .sel-slot .sl { white-space: nowrap; overflow-x: clip; text-overflow: ellipsis; max-width: 62%; }

/* ---------- 視窗：最寬就是畫面可用的寬度（扣掉邊距），不會超出畫面被切 ---------- */
.scr > .frame { max-width: 100%; }

/* ---------- 章節卡：文字區可以縮窄，名稱放不下就縮小字 ---------- */
.chap .bd { min-width: 0; flex: 1; }

/* ---------- 每日任務：任務名稱一行放得下 ---------- */
.quest .qt { width: 300px; }

/* ---------- 村莊：電腦版視窗不夠寬時，聊天框移到按鈕列上面，不跟「出發」疊在一起 ---------- */
@media (min-width: 761px) and (max-width: 1240px) and (pointer: fine) {
  .chat { bottom: 70px; }
}

/* ---------- 直式手機 ---------- */
@media (max-width: 640px), (max-aspect-ratio: 4 / 5) {
  /* 寬度用 100%（扣掉捲軸），不用 100vw，右邊才不會被切掉一截 */
  .sel-stage, .cr-stage { width: 100% !important; }
  /* 建角兩個步驟：最下面一條不透明的按鈕列；內容捲到下面會藏到按鈕列後面，不會跟「退回／確認」疊在一起 */
  .cr-stage { padding-bottom: 108px !important; }
  .cr-scr { scroll-padding-bottom: 110px; }   /* 跳到輸入框（例如沒取名字就按確認）時捲到按鈕列上面，不會被擋住 */
  .cr-stage::after { content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 92px; z-index: 3; pointer-events: none;
    background: linear-gradient(rgba(5, 4, 3, 0), rgba(5, 4, 3, .9) 28%, #050403 58%); }
  .cr-stage .obtn.cr-back, .cr-stage .obtn.next, .st-stage .obtn.st-back, .st-stage .obtn.st-ok { z-index: 4; }
  .cr-stage .msg.cr-msg, .st-stage .msg.st-msg { position: fixed !important; left: 8px; right: 8px; top: auto; bottom: 58px; z-index: 4; margin: 0; pointer-events: none; }
  /* 章節卡片：跟著視窗寬度，不超出框 */
  .chap { width: 100%; }
}

/* ---------- 橫式手機：能力值畫面改成左右兩欄（原本 4:3 縮太小，詳細能力的字會被切掉） ---------- */
@media (max-height: 520px) and (orientation: landscape) {
  .st-stage { width: 100% !important; aspect-ratio: auto; min-height: 100vh; box-sizing: border-box; padding: 8px 12px 104px;
    background-size: cover; background-position: 60% top;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "t t" "l r" "b r" "n n"; align-items: start; gap: 8px 14px; }
  .st-title, .st-left, .st-right, .st-btns2, .st-name, .st-msg { position: relative; left: auto; top: auto; bottom: auto; }
  .st-title { grid-area: t; width: 150px; }
  .st-left { grid-area: l; width: 100%; }
  .st-right { grid-area: r; width: 100%; margin-bottom: 24px; }
  .st-btns2 { grid-area: b; width: 100%; }
  .st-name { grid-area: n; justify-self: center; width: min(300px, 70vw); }
  .st-stage::after { content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 86px; z-index: 3; pointer-events: none;
    background: linear-gradient(rgba(5, 4, 3, 0), rgba(5, 4, 3, .9) 28%, #050403 58%); }
  .cr-scr { scroll-padding-bottom: 100px; }
  .st-stage .obtn.st-back, .st-stage .obtn.st-ok { position: fixed; bottom: 10px; z-index: 4; }
  .st-stage .obtn.st-back { left: 10px; right: auto; width: 100px; }
  .st-stage .obtn.st-ok { right: 10px; left: auto; width: 150px; }
  .st-stage .msg.st-msg { position: fixed !important; left: 8px; right: 8px; bottom: 54px; z-index: 4; margin: 0; pointer-events: none; }
}
