/* 錄影（規格八）：舞台錄影標示、成員面板錄影區塊、錄影檢視頁 */

/* ---- 錄影檢視頁（/rec/…）舞台左上：● 錄影中（由 XXX 開始）---- */
.rec-badge {
  position: absolute; z-index: 13; top: 6px; left: 6px; max-width: calc(100% - 170px);
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: rgba(200, 20, 30, .92); color: #fff; font-size: 14px; font-weight: 700; line-height: 1.3;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .45); pointer-events: none;
  flex-wrap: wrap; border-radius: 14px; /* 窄螢幕換行，完整顯示發起人名稱 */
}
.rec-badge-text { overflow-wrap: anywhere; animation: rec-blink 1.2s steps(1, end) infinite; }
.rec-badge-prep {
  flex: none; padding: 0 6px; border-radius: 999px; background: rgba(255, 255, 255, .25);
  font-size: 12px; font-weight: 600;
}
@keyframes rec-blink { 50% { opacity: .55; } }

/* ---- 房間：頂部列（房間名稱旁）的錄影標示：紅點＋錄影中＋發起人（截斷）；錄影者另有時間、大小、停止 ----
   頂部列不淡出、不蓋住舞台；完整說明（本機／伺服器、發起人）在 title */
.rec-top {
  flex: 0 1 auto; min-width: 0; max-width: 46%; height: 32px; overflow: hidden; /* 窄時內容截掉，不畫到旁邊的按鈕上 */
  display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border-radius: 999px;
  border: 1px solid rgba(229, 72, 77, .6); background: rgba(229, 72, 77, .14); color: var(--fg);
  font-size: 13px; line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.rec-top[hidden], .rec-chip[hidden] { display: none; }
.rec-top.mine { padding-right: 3px; max-width: 60%; }
.rec-dot {
  flex: none; width: 9px; height: 9px; border-radius: 50%; background: #e5484d;
  animation: rec-blink 1.2s steps(1, end) infinite;
}
.rec-top-label { flex: none; font-weight: 700; color: #ff6b6b; }
.rec-top-who { min-width: 2em; max-width: 9em; overflow: hidden; text-overflow: ellipsis; color: var(--fg-2); }
.rec-top-prep { flex: none; font-size: 12px; color: var(--fg-2); }
.rec-top-mine { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.rec-top-mine[hidden] { display: none; }
.rec-top-time { font-weight: 700; }
.rec-top-size { color: var(--fg-2); }
.rec-top-stop {
  border: 0; border-radius: 999px; padding: 0 10px; height: 26px; cursor: pointer;
  background: #e5484d; color: #fff; font: inherit; font-weight: 600;
}
.rec-top-stop:disabled { opacity: .6; cursor: default; }
/* 窄的頂部列（直式、窄視窗）：發起人更短，不顯示大小 */
@media (max-width: 899px) {
  .rec-top { gap: 5px; padding: 0 8px; }
  .rec-top-who { max-width: 4.5em; }
  .rec-top-size { display: none; }
}
/* 手機直式：頂部列同時有同步顯示標籤（.tx-screen-pill）時，錄影標示只留紅點（完整說明在 title／aria-label），
   房間名稱保留最小寬度：返回＋三個圖示鈕（約 212px）、紅點（約 33px）、同步顯示標籤的「跟隨／結束」鈕（約 84px）之外才分給名稱 */
@media (max-width: 520px) {
  .topbar:has(.tx-screen-pill:not([hidden])) .rec-top:not(.mine) { flex: none; gap: 0; padding: 0 9px; }
  .topbar:has(.tx-screen-pill:not([hidden])) .rec-top:not(.mine) > :not(.rec-dot) { display: none; }
  .topbar:has(.tx-screen-pill:not([hidden]), .rec-top:not([hidden])) .room-title { min-width: clamp(0px, 100vw - 337px, 56px); }
}
/* 沒有頂部列可放時（後備）：舞台左上 */
.rec-top.rec-top-floating { position: absolute; z-index: 13; top: 6px; left: 6px; background: rgba(20, 22, 28, .88); color: #fff; }

/* ---- 沒有頂部列的版面（手機橫式、舞台全螢幕）：舞台左上的小紅點＋時間（不蓋住畫面中央）----
   時間與停止鍵跟著舞台按鈕自動淡出，紅點一直都在 */
.rec-chip {
  display: none; position: absolute; z-index: 13; top: calc(6px + var(--safe-t, 0px)); left: calc(6px + var(--safe-l, 0px));
  align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; pointer-events: none; transition: background-color .25s;
}
.room[data-layout="landscape"] .rec-chip:not([hidden]),
.stage-wrap.fs > .rec-chip:not([hidden]) { display: inline-flex; }
.rec-chip-time, .rec-chip-stop { transition: opacity .25s, visibility .25s; }
.rec-chip-stop {
  pointer-events: auto; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; margin-right: -5px; padding: 0; border: 0; border-radius: 50%;
  background: #e5484d; cursor: pointer;
}
.rec-chip-stop[hidden] { display: none; }
.rec-chip-square { width: 8px; height: 8px; border-radius: 1px; background: #fff; }
.room.ui-idle .rec-chip { background-color: transparent; }
.room.ui-idle .rec-chip-time, .room.ui-idle .rec-chip-stop { visibility: hidden; opacity: 0; }
/* 有舞台錄影標籤時語音停靠列往下移，讓出左上角 */
.room[data-layout="landscape"] .stage-wrap[data-rec] .voice-dock,
.stage-wrap.fs[data-rec] .voice-dock { top: calc(36px + var(--safe-t, 0px)); }

@media (prefers-reduced-motion: reduce) {
  .rec-badge-text, .rec-dot { animation: none; }
  .rec-chip, .rec-chip-time, .rec-chip-stop { transition: none; }
}

/* ---- 成員面板：錄影區塊 ---- */
.rec-section {
  display: flex; flex-direction: column; gap: 8px; padding: 10px 2px 14px; margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.rec-subtitle { margin: 0; font-size: 14px; color: var(--fg-2); font-weight: 600; }
.rec-status { margin: 0; color: #ff6b6b; font-weight: 700; }
.rec-why { margin: 0; font-size: 13px; color: var(--fg-2); }
.rec-btn { min-height: var(--tap); }
.rec-policy {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer;
}
.rec-policy input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.rec-files-box { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.rec-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rec-file {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
}
.rec-file-name { font-size: 13px; overflow-wrap: anywhere; }
.rec-file-meta { grid-column: 1; font-size: 12px; color: var(--fg-2); }
.rec-download { grid-column: 2; grid-row: 1 / span 2; min-height: var(--tap); display: inline-flex; align-items: center; }

/* ---- 抽屜與加入畫面 ---- */
.rec-copyright { font-weight: 700; color: #ffcf66; }

/* 首頁頁尾 */
.home-footer { text-align: center; font-size: 13px; }
.home-footer a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 8px; color: var(--fg-2); }

/* ---- 錄影檢視頁：只有 16:9 舞台，無任何操作介面 ---- */
html.rec-view-page, html.rec-view-page body { background: #000; overflow: hidden; }
.rec-view {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #000;
}
.rec-view .stage-wrap.rec-wrap {
  width: min(100vw, 100vh * 16 / 9); height: auto; aspect-ratio: 16 / 9; background: #000;
}
.rec-view .rec-stage { width: 100%; cursor: none; }
/* 錄影檢視頁的 YouTube 不接受任何滑鼠操作（不顯示控制列、懸停標題） */
.rec-view .player-host iframe { pointer-events: none; }
.rec-view .chat-toasts { top: auto; bottom: 16px; right: 16px; max-height: none; }
.rec-view .rec-badge { max-width: calc(100% - 12px); font-size: 16px; }
.rec-web-blocked {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: #0b0c10; color: #9aa1b2; font-size: 20px; padding: 16px; text-align: center;
}
.rec-error { min-height: 100vh; display: flex; align-items: center; justify-content: center; color: #555; font-size: 14px; }

/* 成員面板：本機錄影提示與確認抽屜的錄影方式 */
.rec-local-hint { margin: 0; font-size: 13px; color: var(--fg-2); }
.rec-mode-list { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 8px; }
.rec-mode { display: flex; flex-direction: column; gap: 4px; }
.rec-mode .btn { width: 100%; }
.rec-mode-desc { margin: 0; font-size: 13px; color: var(--fg-2); }
