/* ---- 飛盤戰術白板（規格 D）----
   戰術板與影片是工作區（.workspace）裡的兩個窗格；.room[data-ws] = video | split | tactics（tactics/drawer.js）
   - 桌機、手機橫式：並排窗格，中間是可拖曳的分隔線
   - 手機直式：從底部拉出的面板，停在影片下緣（split）或拉到頂（tactics） */
.tx-drawer {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--bg-2); color: var(--fg);
}
.tx-drawer[hidden] { display: none; }

.tx-grip { display: none; flex: none; justify-content: center; padding: 8px 0 4px; touch-action: none; cursor: grab; }
.tx-grip span { width: 40px; height: 5px; border-radius: 3px; background: var(--fg-2); opacity: .6; }
.tx-pull, .ws-divider, .ws-modes { display: none; }
.tx-probe { position: fixed; left: 0; top: var(--safe-t); width: 0; height: 0; visibility: hidden; pointer-events: none; }

/* 模式切換：只看影片｜並排｜只看戰術板 */
.ws-modes { flex: none; gap: 2px; padding: 3px; border-radius: 12px; background: var(--bg); }
.ws-mode {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; min-height: 38px; padding: 0;
  border: 0; border-radius: 9px; background: transparent; color: var(--fg-2); cursor: pointer; touch-action: manipulation;
}
.ws-mode .icon { width: 22px; height: 22px; }
.ws-mode:hover { color: var(--fg); }
.ws-mode[aria-pressed="true"] { background: var(--accent); color: #fff; }

.tx-head {
  flex: none; display: flex; align-items: center; gap: 4px; min-height: 52px;
  padding: 4px calc(8px + var(--safe-r)) 4px 8px;
}
/* 標題只拿剩下的空間（basis 0）：狀態標籤與按鈕先排滿，標題至少留 44px */
.tx-title {
  flex: 1 1 0; min-width: 44px; min-height: var(--tap); display: flex; align-items: center; gap: 6px;
  border: 0; border-radius: 10px; background: transparent; color: var(--fg); font-size: 16px; font-weight: 600;
  padding: 0 8px; cursor: pointer; text-align: left;
}
.tx-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-title .icon { flex: none; color: var(--fg-2); }
.tx-btn {
  flex: none; min-width: var(--tap); min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 0 8px; border: 0; border-radius: 10px; background: transparent; color: var(--fg); cursor: pointer;
  font-size: 13px; touch-action: manipulation;
}
.tx-btn .icon { width: 22px; height: 22px; display: inline-flex; }
.tx-btn .icon svg, .tx-title .icon svg, .tx-toggle .icon svg { width: 100%; height: 100%; }
.tx-title .icon, .tx-toggle .icon { width: 22px; height: 22px; display: inline-flex; }
.tx-btn[hidden] { display: none; }
/* 長按顯示名稱：不跳出系統選單、不選取文字 */
.tx-btn, .tx-title, .tx-chip, .tx-status-btn, .tx-pill-btn, .tx-fit-btn { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.tx-btn:disabled { opacity: .35; cursor: default; }
.tx-btn[aria-pressed="true"] { background: var(--accent); color: #fff; }
.tx-btn:not(:disabled):active { filter: brightness(1.3); }
.tx-btn-text { display: none; }
.tx-present[aria-pressed="true"] { background: #d9480f; }

.tx-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* 同步顯示／跟隨的狀態標籤（標題列，標題旁）與頂部列的同一個標籤（.tx-screen-pill）
   顏色：簡報中＝橘（與同步顯示鈕相同）、跟隨中＝藍、別人在簡報但沒跟隨＝灰底藍框、唯讀＝灰 */
.tx-status, .tx-screen-pill {
  flex: 0 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 3px 0 10px;
  border-radius: 999px; background: var(--bg-3); color: var(--fg); font-size: 12px; line-height: 1; white-space: nowrap;
  --c: var(--fg-2);
}
.tx-status[hidden], .tx-screen-pill[hidden] { display: none; }
.tx-status[data-kind="presenting"], .tx-screen-pill[data-kind="presenting"] { background: rgba(217, 72, 15, .24); --c: #ff7a3d; }
.tx-status[data-kind="following"], .tx-screen-pill[data-kind="following"] { background: rgba(79, 140, 255, .24); --c: #7fb0ff; }
.tx-status[data-kind="available"], .tx-screen-pill[data-kind="available"] { box-shadow: inset 0 0 0 1px rgba(79, 140, 255, .6); --c: #7fb0ff; }
.tx-status[data-kind="readonly"] { padding-right: 10px; color: var(--fg-2); }
.tx-status-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.tx-status-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.tx-status-btn, .tx-pill-btn {
  flex: none; position: relative; height: 26px; padding: 0 10px; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .16); color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; touch-action: manipulation;
}
/* 視覺上小，但可點範圍至少 44px 高 */
.tx-status-btn::before, .tx-pill-btn::before { content: ''; position: absolute; left: -4px; right: -4px; top: -9px; bottom: -9px; }
.tx-status-btn[hidden], .tx-pill-btn[hidden] { display: none; }
.tx-status-btn:active, .tx-pill-btn:active { filter: brightness(1.3); }
.tx-status[data-kind="presenting"] .tx-status-btn, .tx-screen-pill[data-kind="presenting"] .tx-pill-btn { background: #d9480f; }
.tx-status[data-kind="following"] .tx-status-btn, .tx-screen-pill[data-kind="following"] .tx-pill-btn { background: var(--accent); }
/* 主持人結束別人的同步顯示 */
.tx-status[data-kind] .tx-status-btn.tx-status-end, .tx-screen-pill[data-kind] .tx-status-btn.tx-status-end { background: #d9480f; }
.stage-btn.tx-screen-pill .tx-status-end { height: 32px; }
/* 手機：只留短字（範圍等補充字在 title） */
@media (max-width: 599px), (orientation: landscape) and (max-height: 540px) {
  .tx-status-more { display: none; }
}
/* 手機橫式的戰術板窗格很窄（標題列還有版面切換鈕）：標籤只留顏色點與動作鈕，完整狀態在 title／動作鈕的名稱 */
@media (orientation: landscape) and (max-height: 540px) {
  .tx-status:not([data-kind="readonly"]) .tx-status-label { display: none; }
  .tx-status { gap: 4px; padding-left: 8px; }
}

/* ---- 完整場地（.tx-fit）：收起工具列與步驟列，球場填滿窗格；簡報／跟隨中保留標題列（狀態標籤與動作仍可用） ----
   進入：功能列最右邊的按鈕（.tx-fit-row）；結束：戰術板窗格右下角的按鈕（.tx-fit-btn，只在完整場地中出現，
   data-shown 控制淡入淡出：約 3 秒後自動淡出，點場地空白處再顯示；淡出後不可點，點擊直接落在場地上）
   結束鈕固定在窗格的右下角，不跟著場地的大小與縮放移動：完整場地中舞台（.tx-stage）就是窗格的下半部，
   下緣已讓出 --safe-b（margin），手機橫式的窗格右緣已讓出 --safe-r（padding）→ 貼著舞台右下角即是窗格右下角 */
.tx-fit-btn {
  position: absolute; z-index: 2; right: 8px; bottom: 8px; width: 44px; height: 44px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px;
  background: rgba(10, 20, 12, .55); color: #fff; cursor: pointer; touch-action: manipulation;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .25);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s;
}
.tx-fit-btn[data-shown="true"] { opacity: 1; visibility: visible; transition: opacity .25s ease, visibility 0s; }
.tx-drawer:not(.tx-fit) .tx-fit-btn { display: none; }
@starting-style { .tx-fit-btn[data-shown="true"] { opacity: 0; } } /* 進入完整場地時（從 display:none）也淡入 */
.tx-fit-btn .icon { width: 22px; height: 22px; display: inline-flex; }
.tx-fit-btn .icon svg { width: 100%; height: 100%; }
.tx-fit-btn:hover { background: rgba(10, 20, 12, .8); }
.tx-drawer.tx-fit .tx-tools, .tx-drawer.tx-fit .tx-steps { display: none; }
.tx-drawer.tx-fit:not([data-status="presenting"]):not([data-status="following"]):not([data-status="available"]) .tx-head { display: none; }
.tx-drawer.tx-fit .tx-stage { margin: 0 0 var(--safe-b); min-height: 0; }
.room[data-layout="portrait"][data-ws="split"] .tx-drawer.tx-fit .tx-stage { margin: 0 0 var(--safe-b); }

.tx-tools {
  flex: none; display: flex; align-items: center; gap: 2px; padding: 0 6px;
  overflow-x: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.tx-sep { flex: none; width: 1px; height: 26px; background: var(--line); margin: 0 4px; }
.tx-flex { flex: 1; }
.tx-addbtn span:not(.icon) { font-weight: 700; }
.tx-add-o { color: #7fb0ff; }
.tx-add-d { color: #ff8a8c; }
.tx-color-dot {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; position: relative;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .5);
}
.tx-color-dot::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: var(--w, 10px); height: 2px;
  transform: translate(-50%, -50%); background: rgba(0, 0, 0, .45);
}

.tx-stage { flex: 1; min-height: 120px; position: relative; margin: 4px 0; background: #234d2b; }
.tx-board { position: absolute; inset: 0; overflow: hidden; }
.tx-svg { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.tx-board[data-tool="move"] .tx-svg { cursor: grab; }
.tx-board:not([data-tool="move"]):not(.tx-readonly) .tx-svg { cursor: crosshair; }
.tx-marker.tx-editable { cursor: move; }
.tx-board:not([data-tool="move"]) .tx-marker, .tx-board.tx-readonly .tx-marker { pointer-events: none; }
.tx-board[data-tool="eraser"] .tx-drawing { cursor: not-allowed; }
.tx-label, .tx-text { pointer-events: none; font-family: system-ui, -apple-system, "PingFang TC", "Noto Sans TC", sans-serif; }
.tx-draft { opacity: .75; pointer-events: none; }
.tx-handle-hit { cursor: move; }
.tx-corner-hit[data-corner="nw"], .tx-corner-hit[data-corner="se"] { cursor: nwse-resize; }
.tx-corner-hit[data-corner="ne"], .tx-corner-hit[data-corner="sw"] { cursor: nesw-resize; }
.tx-corners.is-locked .tx-corner-hit { cursor: pointer; }
.tx-callouts { pointer-events: none; }

/* 步驟列：導覽（上一步／步驟／下一步）＋功能（新增、刪除、播放、速度）
   窗格夠寬排成一列；窄（手機直式、窄的橫式窗格）時分兩列：上排只有導覽、下排是功能鈕
   （.tx-steps-2row 由 steps.js 依步驟列寬度切換；不用 container query：WebKit 旋轉畫面時會當掉） */
.tx-steps { flex: none; padding: 2px 6px calc(4px + var(--safe-b)); border-top: 1px solid var(--line); }
.tx-steps-in { display: flex; align-items: center; gap: 2px; }
.tx-steps-nav { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 2px; }
.tx-steps-fn { flex: none; display: flex; align-items: center; gap: 2px; }
.tx-steps-2row .tx-steps-in { flex-direction: column; align-items: stretch; gap: 0; }
.tx-steps-2row .tx-steps-fn .tx-sep-lead { display: none; }
.tx-steps-2row .tx-steps-fn .tx-sep-mid { flex: 1; background: transparent; }
.tx-chips {
  display: flex; gap: 4px; overflow-x: auto; min-width: 100px; flex: 1 1 100px; scrollbar-width: none;
  padding: 2px 0; /* 拖曳中浮起的陰影不被裁掉 */
}
.tx-chips::-webkit-scrollbar { display: none; }
.tx-chip {
  flex: none; min-width: var(--tap); min-height: var(--tap); border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--fg); font-weight: 600; cursor: pointer; touch-action: manipulation;
}
.tx-chip[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tx-chip:disabled { cursor: default; }
/* 長按拖曳排序：拿起的步驟放大加陰影跟著指標，其他步驟滑開讓出放下的位置 */
.tx-chips-dragging { cursor: grabbing; }
.tx-chip-shift { transition: transform .15s ease; }
.tx-chip-lifted {
  position: relative; z-index: 1; cursor: grabbing; scale: 1.12;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .45), 0 0 0 2px var(--accent);
}
.tx-speed { font-variant-numeric: tabular-nums; min-width: 52px; }
/* 匯出 GIF：匯出中以百分比取代圖示（寬度固定，不推動其他按鈕） */
.tx-gif { min-width: 44px; font-size: 12px; font-variant-numeric: tabular-nums; }
.tx-gif.tx-busy { opacity: 1; color: var(--accent, currentColor); cursor: progress; }

/* 抽屜內的抽屜內容 */
.tx-menu { display: flex; flex-direction: column; gap: 10px; }
.tx-menu .field-label { margin-top: 4px; }
.tx-inline { display: flex; gap: 8px; align-items: center; }
.tx-inline .input { flex: 1; min-width: 0; }
.tx-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.tx-swatch {
  width: var(--tap); height: var(--tap); border-radius: 50%; border: 3px solid transparent; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}
.tx-swatch[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.tx-range { flex: 1; min-height: var(--tap); accent-color: var(--accent); }
/* 朝向方向盤 */
.tx-facing { display: flex; gap: 12px; align-items: center; }
.tx-dial-wrap { flex: none; width: min(46vw, 200px); aspect-ratio: 1; }
.tx-dial {
  width: 100%; height: 100%; display: block; color: var(--fg); cursor: grab; touch-action: none; border-radius: 50%;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.tx-dial:active { cursor: grabbing; }
.tx-dial:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tx-dial text { pointer-events: none; font-family: system-ui, -apple-system, "PingFang TC", "Noto Sans TC", sans-serif; }
.tx-dial-atk { fill: #ffd400; }
.tx-facing-quick { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tx-facing-quick .btn { font-size: 14px; }
.tx-dial-readout { color: var(--fg); font-weight: 700; }
.tx-dial-hint { margin: 0; }
.tx-choice-text { margin: 0; line-height: 1.5; }
.tx-holders { display: flex; flex-wrap: wrap; gap: 6px; }
.tx-holder {
  min-width: var(--tap); min-height: var(--tap); padding: 0 10px; border-radius: 999px; border: 2px solid var(--c, #888);
  background: var(--bg); color: var(--fg); font-weight: 700; cursor: pointer;
}
.tx-holder[aria-pressed="true"] { background: var(--c, var(--accent)); color: #fff; }
.tx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tx-grid .btn { font-size: 14px; }
.tx-grid-2 { grid-template-columns: 1fr 1fr; } /* 兩個 PNG 匯出並排；手機上留給文字多一點寬度 */
.tx-grid-2 .btn { padding: 0 6px; }
.tx-plays { display: flex; flex-direction: column; gap: 6px; max-height: 50dvh; overflow-y: auto; }
.tx-play-row { display: flex; align-items: center; gap: 4px; border-radius: 10px; background: var(--bg); padding: 2px; }
.tx-play-row[aria-current="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.tx-play-name {
  flex: 1; min-width: 0; min-height: var(--tap); display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 10px; border: 0; background: transparent; color: var(--fg); font-size: 15px; cursor: pointer; text-align: left;
}
.tx-play-name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-play-meta { flex: none; color: var(--fg-2); font-size: 12px; }

/* ---- 手機直式：底部面板。top 由 drawer.js 設定（並排＝影片下緣；全螢幕＝安全區頂端），拖把手切換 ---- */
.room[data-layout="portrait"] .tx-drawer {
  position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; top: var(--safe-t);
  border-radius: 14px 14px 0 0; box-shadow: 0 -8px 32px rgba(0, 0, 0, .5);
  transition: top .22s ease-out;
}
.room[data-layout="portrait"] .tx-drawer.tx-dragging { transition: none; }
/* 打開：從畫面底部外往上滑到停靠點（drawer.js 以 Web Animations 播放 translateY(100%) → 0）；
   關閉：從目前位置往下滑出畫面。面板高度＝視窗底部到 top，translateY(100%) 剛好完全離開畫面 */
.room[data-layout="portrait"] .tx-drawer.tx-leaving { transform: translateY(100%); transition: transform .26s cubic-bezier(.4, 0, .8, .6); }
.room[data-layout="portrait"] .tx-grip { display: flex; }
.room[data-layout="portrait"] .tx-head { touch-action: none; min-height: 48px; padding-top: 0; padding-bottom: 0; }
/* 球場以外的地方也可上下拖動面板（drawer.js）：只留水平捲動給瀏覽器（工具列、步驟列），垂直移動交給頁面判斷。
   每個水平捲動容器都要各自設定（touch-action 只往上累計到最近的捲動容器）；球場（.tx-svg）本身是 none */
.room[data-layout="portrait"] .tx-drawer,
.room[data-layout="portrait"] .tx-tools,
.room[data-layout="portrait"] .tx-chips { touch-action: pan-x; }
/* 並排（影片下方）高度有限：工具列與球場的間距收緊 */
.room[data-layout="portrait"][data-ws="split"] .tx-stage { min-height: 96px; margin: 2px 0; }
/* 面板蓋住底部的畫圖工具列與浮動按鈕 */
.room.tx-open[data-layout="portrait"] .fab-draw,
.room.tx-open[data-layout="portrait"] .board-toolbar { display: none; }

/* ---- 桌機、手機橫式：工作區窗格 ---- */
.room:not([data-layout="portrait"]) .tx-drawer {
  position: relative; z-index: 1; flex: 1 1 0; min-width: min(360px, 40%);
  border-left: 1px solid var(--line);
}
.room[data-ws="split"]:not([data-layout="portrait"]) .stage-wrap:not(.fs) {
  flex: 0 1 auto; width: calc(var(--ws-ratio, .5) * 100% - 4px); min-width: min(320px, 35%);
}
/* 只看戰術板：舞台留在版面中（影片與聲音繼續），縮在戰術板底下 */
.room[data-ws="tactics"]:not([data-layout="portrait"]) .stage-wrap:not(.fs) {
  position: absolute; z-index: 0; left: 0; top: 0; flex: none; width: 320px; height: 180px; overflow: hidden;
  pointer-events: none;
}
.room[data-ws="tactics"]:not([data-layout="portrait"]) .tx-drawer { border-left: 0; }
.room[data-ws="tactics"][data-layout="landscape"] .fab { display: none; }
/* 版面切換的轉場（drawer.js 在切換期間加上 .ws-anim，結束後移除）：舞台容器的寬度從起點移到終點，
   戰術板窗格用剩下的寬度（一起移動）。窗格內容固定排成 --tx-anim-w 寬並貼齊右緣，由窗格左緣揭開／蓋上 → 轉場中不重排。
   只看戰術板：轉場中舞台留在版面中縮到 0（結束後才回到戰術板底下的 320×180），內部的舞台保持至少 320 寬（播放器不會變成 0 大小） */
.room.ws-anim:not([data-layout="portrait"]) .stage-wrap:not(.fs) {
  flex: 0 1 auto; min-width: 0; overflow: hidden; transition: width .28s cubic-bezier(.3, .7, .2, 1);
}
.room.ws-anim[data-ws="video"]:not([data-layout="portrait"]) .stage-wrap:not(.fs) { width: 100%; }
.room.ws-anim[data-ws="tactics"]:not([data-layout="portrait"]) .stage-wrap:not(.fs) {
  position: relative; left: auto; top: auto; width: 0; height: 100%; pointer-events: none;
}
.room.ws-anim[data-ws="tactics"]:not([data-layout="portrait"]) .stage-wrap:not(.fs) > .stage { flex: none; min-width: 320px; }
.room.ws-anim:not([data-layout="portrait"]) .tx-drawer { min-width: 0; overflow: hidden; }
.room.ws-anim:not([data-layout="portrait"]) .tx-drawer > * { flex-shrink: 0; width: var(--tx-anim-w, 100%); align-self: flex-end; }
.room.ws-anim.ws-prep .stage-wrap, .room.ws-anim.ws-prep .fab { transition: none !important; }
.room.ws-anim[data-layout="landscape"] .fab { transition: right .28s cubic-bezier(.3, .7, .2, 1), opacity .25s, visibility .25s; }

/* 橫式並排：舞台填滿窗格寬度，右下的畫圖鍵／面板鍵疊在舞台上 → 播放器底部的時間、設定、全螢幕與進度條讓出右側 */
.room[data-ws="split"][data-layout="landscape"] .stage-wrap:not(.fs) .pc-mbottom { right: 84px; }

.room:not([data-layout="portrait"]) .ws-modes { display: inline-flex; }
.room:not([data-layout="portrait"]) .ws-divider:not([hidden]) {
  display: block; position: relative; z-index: 2; flex: none; width: 8px; cursor: col-resize; touch-action: none;
  background: var(--bg-3); border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
/* 中間的握把；::before 加寬可點範圍（手機橫式） */
.ws-divider::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 2px; height: 36px; border-radius: 1px;
  transform: translate(-50%, -50%); background: var(--fg-2);
}
.ws-divider::before { content: ''; position: absolute; top: 0; bottom: 0; left: -8px; right: -8px; }
.ws-divider:hover, .ws-divider:focus-visible, .room.ws-resizing .ws-divider { background: var(--accent); }
.ws-divider:hover::after, .ws-divider:focus-visible::after, .room.ws-resizing .ws-divider::after { background: #fff; }
/* 拖曳中：iframe 不攔截指標、不選取文字；拖過最小寬度（放開即切成單一窗格）時將收起的那一側變淡 */
.room.ws-resizing { user-select: none; -webkit-user-select: none; cursor: col-resize; }
.room.ws-resizing iframe { pointer-events: none; }
.room[data-ws-snap="video"] .tx-drawer, .room[data-ws-snap="tactics"] .stage-wrap { opacity: .45; }

/* 手機橫式：高度有限，縮小標題列 */
@media (orientation: landscape) and (max-height: 540px) {
  .tx-drawer { padding-right: var(--safe-r); }
  .room[data-ws="tactics"] .tx-drawer { padding-left: var(--safe-l); }
  .tx-head { min-height: 48px; padding: 2px 8px; }
  .tx-stage { min-height: 100px; }
  .ws-mode { min-height: 40px; width: 40px; }
  /* 模式切換鈕的「只看影片」即關閉 */
  .tx-head [data-testid="tx-close"] { display: none; }
}

/* ---- 桌機 ---- */
@media (min-width: 900px) and (min-height: 541px) {
  .tx-btn-text { display: inline; }
  .tx-toggle { display: none; } /* 改用頂部列的模式切換鈕 */
  /* 只看影片時工作區右緣的拉環 */
  .room[data-ws="video"] .tx-pull {
    display: block; position: absolute; z-index: 45; right: 0; top: 50%; transform: translateY(-50%);
    width: 18px; height: 88px; padding: 0; border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px;
    background: var(--bg-3); cursor: w-resize; touch-action: none; opacity: .7;
  }
  .room[data-ws="video"] .tx-pull::after { content: ''; position: absolute; left: 7px; top: 28px; bottom: 28px; width: 3px; border-radius: 2px; background: var(--fg-2); }
  .tx-pull:hover { opacity: 1; }
  /* 自動淡出（ui/idle.js）：拉環疊在舞台右緣，與舞台按鈕一起淡出（滑鼠裝置淡出後不可點，移動滑鼠即恢復） */
  .tx-pull { transition: opacity .25s; }
  .room.ui-idle[data-ws="video"] .tx-pull { opacity: 0; pointer-events: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tx-chip-shift, .tx-fit-btn, .tx-fit-btn[data-shown="true"] { transition: none; }
  .tx-drawer, .room[data-layout="portrait"] .tx-drawer, .room[data-layout="portrait"] .tx-drawer.tx-leaving,
  .room.ws-anim .stage-wrap, .room.ws-anim .fab { animation: none; transition: none; }
}

/* ---- 錄影檢視頁：簡報模式時覆蓋整個舞台 ---- */
.tx-rec { position: absolute; inset: 0; z-index: 10; background: #234d2b; }
.tx-rec[hidden] { display: none; }

/* ---- 同步顯示的範圍（戰術板｜整個畫面）---- */
.tx-present-group { flex: none; display: flex; align-items: center; }
.tx-present-group .tx-present { border-radius: 10px 0 0 10px; }
.tx-present-mode { padding: 0; border-radius: 0 10px 10px 0; }
.tx-caret { width: 0; height: 0; border: 5px solid transparent; border-top-color: currentColor; border-bottom: 0; }
.tx-present-group[data-mode="board"] .tx-present-mode,
.tx-present-group[data-mode="screen"] .tx-present-mode { background: #d9480f; color: #fff; box-shadow: inset 1px 0 rgba(255, 255, 255, .3); }
.tx-mode-option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 56px; margin-bottom: 8px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-3); color: var(--fg);
  text-align: left; cursor: pointer; touch-action: manipulation;
}
.tx-mode-option[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tx-mode-option:disabled { opacity: .45; cursor: default; }
.tx-mode-name { font-size: 15px; font-weight: 600; }
.tx-mode-desc { font-size: 13px; color: var(--fg-2); }
/* 整個畫面模式、戰術板關著時：狀態標籤在頂部列的房間名稱旁（不蓋住影片）。
   頂部列不淡出 → 這個「畫面正被別人帶著走」的提示與停止／恢復跟隨的入口一直都在。
   手機橫式沒有頂部列：放進舞台右上的按鈕列（加上 .stage-btn：跟其他舞台按鈕一起自動淡出、點畫面就回來），
   不另外浮在影片中央或左上角擋住畫面 */
.topbar .tx-screen-pill { flex: 0 1 auto; max-width: 46%; }
/* 名稱旁多了標籤時：代碼與人數不換行（超出就截掉） */
.topbar .room-meta { white-space: nowrap; overflow: hidden; }
.stage-btn.tx-screen-pill {
  width: auto; max-width: 260px; height: 44px; padding: 0 5px 0 12px; border-radius: 999px; gap: 6px;
  background: rgba(17, 19, 24, .82); cursor: default;
}
.stage-btn.tx-screen-pill .tx-pill-btn { height: 32px; }

/* ---- 長按顯示按鈕名稱（public/js/ui/press-hint.js）---- */
.press-hint {
  position: fixed; z-index: 1000; left: 0; top: 0; max-width: min(70vw, 280px); padding: 7px 12px; border-radius: 9px;
  background: #f4f6fb; color: #111318; font-size: 14px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .5); pointer-events: none;
}

/* 全員設定（tactics-ui.js openTeamSetup）：兩隊各一區（人數、顏色、朝向） */
.tx-team { gap: 8px; }
.tx-team-sec {
  display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; border-radius: 12px;
  background: var(--bg); box-shadow: inset 3px 0 0 var(--c);
}
.tx-team-head { display: flex; align-items: center; gap: 8px; }
.tx-team-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px rgba(255, 255, 255, .4); }
.tx-team-name { flex: 1; min-width: 0; font-weight: 700; }
.tx-stepper { flex: none; display: flex; align-items: center; gap: 4px; }
.tx-step-btn { min-width: var(--tap); padding: 0; font-size: 20px; line-height: 1; }
.tx-step-n { min-width: 4.5em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.tx-team-now { color: var(--fg); margin-left: 2px; }
/* 調色盤排成一列（8 色）：窄螢幕上每格縮到可用寬度（最大 44px），色塊緊鄰、間距小 */
.tx-team .tx-swatches { display: grid; grid-template-columns: repeat(8, minmax(0, var(--tap))); gap: 4px; }
.tx-team .tx-swatch { width: 100%; height: auto; aspect-ratio: 1; }
.tx-team-facing { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tx-team-facing .seg { min-width: 0; padding: 0 4px; background: var(--bg-3); color: var(--fg); font-size: 13px; }
.tx-team-facing .seg[aria-pressed="true"] { background: var(--accent); color: #fff; }
.tx-team-hint { margin: 0; font-size: 13px; }

/* 手機：功能列第二排（全員設定、+O、+D、飛盤、範本 … 真實比例、重設視圖）在 360–393px 內排得下，不需要水平捲動
   按鈕寬度仍 ≥ 44px */
@media (max-width: 599px), (orientation: landscape) and (max-height: 540px) {
  .tx-row2 .tx-btn { padding: 0 4px; gap: 2px; }
}
@media (max-width: 380px) {
  .tx-row2 { gap: 0; padding: 0 2px; }
}
