/* 雙人合作連線面板（開發部檔，assets/coop-panel.js）：線上時接管作者大廳 .coop-setup15 的內容，沿用他的版位與按鈕樣式 */
.tw-coop { display: flex; flex-direction: column; gap: 8px; }
.tw-coop p { margin: 0; color: #a5a6ad; font-size: 12px; line-height: 1.6; }
.tw-coop .tw-coop-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tw-coop input { flex: 1; min-width: 110px; padding: 8px 10px; border-radius: 8px; border: 1px solid #666173; background: #161923; color: #f0e8d4; font: inherit; letter-spacing: .2em; }
.tw-coop .tw-coop-code { display: flex; align-items: baseline; gap: 10px; }
.tw-coop .tw-coop-code b { font-size: 28px; letter-spacing: .25em; color: #ffd77c; font-family: ui-monospace, monospace; user-select: text; -webkit-user-select: text; }
.tw-coop .tw-coop-code small { color: #a5a6ad; }
.tw-coop .tw-coop-players { display: flex; flex-direction: column; gap: 4px; }
.tw-coop .tw-coop-player { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 8px; background: #1b1e2a; border: 1px solid #3a3648; font-size: 12px; }
.tw-coop .tw-coop-player.empty > b, .tw-coop .tw-coop-player.empty > small { opacity: .55; }
.tw-coop .tw-coop-player.empty > button { padding: 4px 10px; font-size: 12px; min-height: 0; }
.tw-coop .tw-coop-player b { font-size: 13px; }
.tw-coop .tw-coop-player small { color: #e3c181; }
.tw-coop .tw-coop-chapter { display: flex; flex-direction: column; gap: 3px; padding: 5px 8px; border-radius: 8px; background: #221c2b; border: 1px solid #4a3a5a; }   /* 改造部模式：這間房要打的章節關卡，房主直接點、客人只看 */
.tw-coop .tw-coop-chips { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.tw-coop .tw-coop-chips > span { font-size: 12px; color: #c4f4ed; margin-right: 2px; white-space: nowrap; }
.tw-coop .tw-coop-chip { padding: 3px 7px; min-height: 0; font-size: 12px; border-radius: 7px; border: 1px solid #5a4a6a; background: #1b1e2a; color: #f0e8d4; }
.tw-coop .tw-coop-chip.selected { border-color: #ffd77c; background: #3a2d1f; color: #ffd77c; }
.tw-coop .tw-coop-chip:disabled { opacity: .4; }
.tw-coop .tw-coop-chip.selected:disabled { opacity: 1; }
.tw-coop .tw-coop-chapter small { font-size: 11px; color: #e3c181; }
.tw-coop .tw-coop-chapter small.locked { color: #f0a070; }
.tw-coop .tw-coop-msg:empty { display: none; min-height: 0; }
/* 面板＝直向 flex：標題固定、.tw-coop 中段可捲、.tw-coop-actions（開始／準備／離開）釘在底部；面板本身不捲（使用者 2026-11-04：底部兩顆鈕捲到邊框上怪怪的） */
#menu .coop-setup15 { display: flex; flex-direction: column; }
#menu .coop-setup15 > .tw-coop { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
#menu .coop-setup15 > .tw-coop-actions { flex: 0 0 auto; display: block; margin-top: 8px; }   /* block 讓裡面的 .tw-coop-row 撐滿寬度，兩顆鈕才會並排（flex 會縮成內容寬、第二顆掉到下一行） */
#menu .coop-setup15 > .tw-coop-actions[hidden] { display: none; }
#menu .coop-setup15 > .tw-coop-actions > .tw-coop-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }   /* 上面的 .tw-coop .tw-coop-row 規則管不到這裡（動作列在 .tw-coop 外面） */
#menu .coop-setup15 > .tw-coop-actions button:disabled { opacity: .45; }
.tw-coop .tw-coop-msg { min-height: 16px; font-size: 12px; color: #e3c181; }
.tw-coop .tw-coop-msg.error { color: #e3999b; }
.tw-coop button:disabled { opacity: .45; }
/* 手機橫向輸入房號時 iOS 鍵盤佔掉下半，WKWebView 會把整頁往上捲去找輸入框，畫面變成一片黑＋一條輸入列（soc 2026-10-06）。
   輸入框有焦點時把面板搬到頂端、收起說明與建房鈕，讓輸入框落在鍵盤上方的可見區，iOS 就不需要捲頁。
   狀態用 JS 加的 .tw-kb class（coop-panel.js 的 focusin／focusout，失焦後延遲 400ms 才拿掉）：直接綁 :focus-within 或 :has(:focus) 都會在按鈕 mousedown 的瞬間換版面，
   按鈕移位、click 落空（建房鈕被藏、加入鈕跳走，Playwright 都抓到）。 */
@media (min-aspect-ratio:1/1){
  #menu .coop-setup15.open.tw-kb { bottom:auto; top:max(4px,env(safe-area-inset-top)); }
  #menu .coop-setup15.open.tw-kb .tw-coop > p, #menu .coop-setup15.open.tw-kb [data-tw-coop="create"], #menu .coop-setup15.open.tw-kb .tw-coop-hint { display:none; }
}
/* 章節面板（.chapter-panel15 z-index 7）開著時，模式牌往上展開的「一般／雙人」選單（在 .lobby-bottom15，z-index 6）會被它蓋住點不到（soc 2026-10-06）→ 底列抬到面板之上；兩者本體不重疊，只有展開的選單會疊在面板上 */
#menu.lobby15 .lobby-bottom15 { z-index: 8; }
/* 面板在 iPhone 14（844×390）建完房後高 315px、bottom 89px → 頂端連同 × 一起被切出畫面（Ken 2026-10-06）：限高＋可捲動，矮螢幕收起說明文字 */
@media (min-aspect-ratio:1/1){
  #menu .coop-setup15 { max-height: calc(100% - 100px); overflow: hidden; }
}
@media (max-height:420px) and (min-aspect-ratio:1/1){
  #menu .coop-setup15 .tw-coop > p { display:none; }
  #menu .coop-setup15 { padding: 10px; }
}
/* 自己倒地的橫幅（coop-panel.js twCoopDownBanner） */
.tw-coop-banner { position:fixed; left:50%; top:max(64px,env(safe-area-inset-top)); transform:translateX(-50%); z-index:46; pointer-events:none; padding:10px 22px; border-radius:12px; background:#2a1b2fe6; border:2px solid #d98b8b; color:#ffd9d9; font-size:18px; font-weight:700; letter-spacing:1px; box-shadow:0 8px 30px #0008; }
@media (max-height:420px) and (min-aspect-ratio:1/1){ .tw-coop-banner { font-size:14px; padding:8px 16px; top:max(50px,env(safe-area-inset-top)); } }
/* 手機鍵盤輸入列（assets/keyboard-guard.js）：觸控裝置打字一律在頂端這條，不管 iOS 把版面縮成多矮都看得到 */
.tw-kbbar { position:fixed; left:0; right:0; top:0; z-index:2147483000; display:flex; align-items:center; gap:10px; padding:8px max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); background:#1d1a29f2; border-bottom:2px solid #82c5c9; box-shadow:0 6px 24px #000a; }
.tw-kbbar[hidden] { display:none; }
.tw-kbbar-label { color:#c4f4ed; font-size:13px; white-space:nowrap; }
.tw-kbbar-input { flex:1; min-width:0; padding:8px 12px; border-radius:8px; border:2px solid #e3c181; background:#161923; color:#f0e8d4; font:inherit; font-size:16px; letter-spacing:.08em; }
.tw-kbbar-ok { padding:8px 16px; border-radius:8px; border:0; background:#e3b04f; color:#2a1d10; font-weight:700; font-size:14px; }
.tw-coop-banner.wait { border-color:#82c5c9; background:#1b2430e6; color:#d6f4f0; font-size:15px; }
/* 真人雙人拉霸房（assets/coop-slots.js；needs/coop-rewards.md 第 5 項）：自己＝作者大機台，對方＝房間右側小機台 */
.tw-mini-slot { position:absolute; transform:translate(-50%,-50%); z-index:3; width:132px; padding:8px 10px 10px; border-radius:14px; background:linear-gradient(#3b2335,#24172a); border:3px solid #e3b67a; box-shadow:0 8px 24px #000a, inset 0 0 0 2px #00000055; text-align:center; pointer-events:none; }
.tw-mini-slot .tw-mini-name { font-size:12px; font-weight:800; color:#c4f4ed; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tw-mini-slot .tw-mini-tag { font-size:10px; color:#a5a6ad; margin-bottom:5px; }
.tw-mini-slot .tw-mini-reels { display:flex; gap:4px; justify-content:center; }
.tw-mini-slot .tw-mini-reels span { width:34px; height:34px; display:flex; align-items:center; justify-content:center; border-radius:6px; background:#f3e7cf; box-shadow:inset 0 2px 6px #0006; overflow:hidden; }
.tw-mini-slot .tw-mini-reels span > * { max-width:32px; max-height:32px; }
.tw-mini-slot .tw-mini-reels span svg, .tw-mini-slot .tw-mini-reels span img { width:30px; height:30px; }
.tw-mini-slot .tw-mini-reels span.moving { filter:blur(1px); }
.tw-mini-slot .tw-mini-out { margin-top:6px; font-size:13px; font-weight:800; color:#f0e8d4; }
.tw-mini-slot .tw-mini-out.win { color:#ffd77c; }
.tw-mini-slot .tw-mini-bet { font-size:11px; color:#e3c181; min-height:14px; }
body.tw-coop-slots .room-betting::before { content:'你的金幣 ' attr(data-tw-coins); display:block; font-size:12px; font-weight:800; color:#ffd77c; text-shadow:0 1px 3px #000; margin-bottom:2px; }
.room-exit.tw-waiting::after { content:'等隊友…'; position:absolute; left:50%; top:-20px; transform:translateX(-50%); white-space:nowrap; font-size:12px; font-weight:800; color:#c4f4ed; text-shadow:0 1px 3px #000; }
.tw-slots-float { position:absolute; left:50%; top:-10px; transform:translateX(-50%); font-size:22px; font-weight:800; color:#ffd77c; text-shadow:0 2px 8px #000; pointer-events:none; animation:twSlotsFloat 1.6s ease-out forwards; }
.tw-slots-float.big { font-size:34px; color:#fff1a8; }
@keyframes twSlotsFloat { from { opacity:1; transform:translate(-50%, 0); } to { opacity:0; transform:translate(-50%, -60px); } }
.tw-slots-jackpot { animation:twSlotsJackpot .3s ease-in-out 8 alternate; }
@keyframes twSlotsJackpot { from { box-shadow:0 0 0 #ffd77c00; } to { box-shadow:0 0 36px #ffd77c; } }
.tw-slots-toast { position:fixed; left:50%; top:max(70px, env(safe-area-inset-top)); transform:translateX(-50%); z-index:47; padding:8px 18px; border-radius:12px; background:#3a2a10ee; border:2px solid #ffd77c; color:#fff1c8; font-size:16px; font-weight:800; pointer-events:none; animation:twSlotsFloat 2.6s ease-out forwards; }
.tw-coop .tw-coop-player.offline { opacity:.55; border-style:dashed; }
.tw-coop .tw-coop-player.ready { border-color:#82c5c9; }
.tw-coop .tw-coop-player.ready small { color:#c4f4ed; }
/* 好友邀請（coop-panel.js twCoopInviteHtml／twCoopShowInvite） */
.tw-coop .tw-coop-invites { display:flex; flex-direction:column; gap:4px; max-height:150px; overflow-y:auto; -webkit-overflow-scrolling:touch; overscroll-behavior:contain; }
/* 好友多時（2026-10-13）：名單高度由 coop-panel.js twCoopInvFit 撐滿面板剩下的空間（150px 只是量之前的預設）；開著時收起規則說明；上方人數＋搜尋 */
.tw-coop.tw-coop-inviting .tw-coop-rules, .tw-coop.tw-coop-inviting .tw-coop-players, .tw-coop.tw-coop-inviting .tw-coop-msg:empty { display:none; }
.tw-coop .tw-coop-invhead { flex-wrap:nowrap; }
.tw-coop .tw-coop-invhead button { flex-shrink:0; white-space:nowrap; }
.tw-coop .tw-coop-invhead small { color:#a5a6ad; font-size:11px; white-space:nowrap; flex-shrink:0; }
.tw-coop .tw-coop-invhead input { min-width:60px; padding:5px 10px; font-size:12px; letter-spacing:0; }
.tw-coop .tw-coop-inv-none { padding:6px 2px; }
/* 矮螢幕（13 Pro／14／17：高 390～402）名單只有 106～118px：列距與房號字縮一點，一次看得到 3 個完整好友；「邀請」鈕本身高度不動（手指要點得到） */
.tw-coop.tw-coop-inviting .tw-coop-invites { gap:3px; }
.tw-coop.tw-coop-inviting .tw-coop-inv { padding:2px 8px; }
.tw-coop.tw-coop-inviting .tw-coop-code b { font-size:22px; }
.tw-coop .tw-coop-inv { display:flex; align-items:center; gap:8px; padding:5px 8px; border-radius:8px; background:#1b1e2a; border:1px solid #3a3648; font-size:12px; }
.tw-coop .tw-coop-inv b { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
.tw-coop .tw-coop-inv small { color:#a5a6ad; font-size:11px; }
.tw-coop .tw-coop-inv button { padding:4px 12px; font-size:12px; }
.tw-coop-inv-dot { width:8px; height:8px; border-radius:50%; background:#5a5868; flex-shrink:0; }
.tw-coop-inv-dot.on { background:#5fd38a; box-shadow:0 0 6px #5fd38a; }
.tw-coop-invcard { position:fixed; left:50%; top:max(10px, env(safe-area-inset-top)); transform:translateX(-50%); z-index:2147482000; width:min(420px, calc(100vw - 32px)); padding:12px 14px; border-radius:14px; background:#241d33f5; border:2px solid #82c5c9; box-shadow:0 12px 40px #000c; display:flex; flex-direction:column; gap:6px; color:#f0e8d4; }
.tw-coop-invcard b { font-size:15px; }
.tw-coop-invcard small { font-size:12px; color:#c4f4ed; }
.tw-coop-invcard > div { display:flex; gap:8px; justify-content:flex-end; }
.tw-coop-invcard button { padding:7px 18px; font-size:13px; }
.tw-coop [data-tw-coop="invite-toggle"] { padding:5px 12px; font-size:12px; min-height:0; }
/* 房號列：「房號」兩字不准拆行、說明字縮小可換行（10-08 版面檢查：iPhone 17 尺寸「房／號」上下兩字） */
.tw-coop .tw-coop-code > span { white-space:nowrap; flex-shrink:0; }
.tw-coop .tw-coop-code > b { flex-shrink:0; }
.tw-coop .tw-coop-code > small { min-width:0; font-size:11px; line-height:1.35; }

/* 開發部 2026-10-22：雙人拉霸房的「隊友的福利機」小卡（assets/coop-slots.js 掛進作者的 .company-partner-host）。
   作者把它固定在機台左上角（company-rooms.css：left:12px top:6px width:24%），桌機寬度機台旁有空位；手機橫向（max-height:500px）
   作者的機台是 height:100% 撐滿左欄，小卡整個壓在轉輪與機台的臉上（使用者 2026-10-22「單人就站很滿了」；874×402 與 844×390 都壓到）。
   這裡在手機橫向改成：有小卡時機台讓出 46px，小卡貼左欄底部排成一條橫列（名字＋15 格小圖示＋下注／返還），不再蓋到任何東西。
   選擇器加 .company-slot-body 提高優先序——company-rooms.css 在本檔之後載入。 */
@media (max-height:500px) {
  .company-slot-body:has(.company-partner) .company-machine { height: calc(100% - 46px); margin-bottom: 46px; }
  .company-slot-body .company-partner-host { left: 0; right: 0; top: auto; bottom: 0; width: auto; }
  .company-slot-body .company-partner { margin: 0; padding: 3px 6px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center; min-height: 40px; }
  .company-slot-body .company-partner-grid { grid-row: 1 / 3; margin: 0; gap: 1px; width: 62px; }
  .company-slot-body .company-partner-grid span { height: 11px; }
  .company-slot-body .company-partner-grid svg { width: 10px; height: 10px; }
  .company-slot-body .company-partner > b, .company-slot-body .company-partner p { margin: 0; font-size: 9px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
