/* 自訂播放器介面（player-controls.js）
   圖層：播放器 1 → 空舞台 2 → 共享網頁 3 → 畫布 4 → 本介面 5 → 錯誤 6 → 加入同步播放 7 → 畫圖中畫布 8 → 閒置攔截 9 → 聊天浮層 10+
   控制層透明，不遮蓋 YouTube 的標誌與廣告；data-shown 控制顯示，隱藏時 visibility:hidden（不可點、不可聚焦） */
.pc {
  --pc-red: #ff0033;
  --pc-menu-bg: rgba(28, 28, 28, .92);
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  color: #fff; font-size: 13px; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.pc[hidden] { display: none; }
.pc-hit {
  position: absolute; inset: 0; pointer-events: auto; background: transparent; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  /* 右下角（寬 25%、高 22%，下緣在控制列之上）挖空：YouTube 標誌與「略過廣告」永遠可以直接點到 iframe */
  --pc-hole-top: calc(100% - var(--pc-hole-b, 0px) - 22%);
  --pc-hole-bot: calc(100% - var(--pc-hole-b, 0px));
  clip-path: polygon(0 0, 100% 0, 100% var(--pc-hole-top), 75% var(--pc-hole-top), 75% var(--pc-hole-bot), 100% var(--pc-hole-bot), 100% 100%, 0 100%);
}
.pc.pc-cursor-hidden .pc-hit { cursor: none; }
.pc-chrome { transition: opacity .25s, visibility .25s; }
.pc:not([data-shown="true"]) .pc-chrome { opacity: 0; visibility: hidden; }
/* 電腦版隱藏時仍可用 Tab 聚焦（聚焦後顯示），但不可點 */
.pc[data-mode="desktop"]:not([data-shown="true"]) .pc-chrome { visibility: visible; }
.pc:not([data-shown="true"]) .pc-chrome, .pc:not([data-shown="true"]) .pc-chrome * { pointer-events: none !important; }
/* 控制層有全螢幕鍵（桌機控制列、手機影片右下角）：隱藏舞台右上角重複的那顆。
   畫圖模式、共享網頁分頁時控制層不顯示 → 保留舞台那顆（全螢幕一定退得出來） */
.stage-wrap.pc-has-bar:not(.drawing) .stage:not([data-tab="web"]) [data-testid="stage-fullscreen"] { display: none; }
.pc-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* 畫圖模式（筆跡優先）、共享網頁分頁：整層不顯示、不攔截 */
.stage-wrap.drawing .pc, .stage[data-tab="web"] .pc { display: none; }
/* 疑似 YouTube 廣告（播放中時間不動）：點擊穿透到 iframe，不蓋住「略過廣告」等 */
.pc.pc-passthrough .pc-hit { pointer-events: none; }
.pc.pc-passthrough .pc-chrome { opacity: 0; visibility: hidden; }

/* 「YouTube 設定」模式（選畫質，player-controls.js enterYtSettings）：裁切還原、點擊穿透到 iframe（同上），
   提示條在影片正中央且精簡（YouTube 的控制列在底部、手機版齒輪在右上角，都不能擋）；
   舞台右上角按鈕先收起，不蓋住 YouTube 上緣的按鈕 */
.pc-ytset {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 2;
  display: flex; align-items: center; gap: 8px; width: max-content; max-width: min(360px, calc(100% - 32px));
  padding: 4px 4px 4px 12px; border-radius: 10px; background: var(--pc-menu-bg); color: #fff;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .4); pointer-events: auto;
}
.pc-ytset[hidden] { display: none; }
.pc-ytset-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 12px; line-height: 1.3; }
.pc-ytset-hint { color: #ccc; font-size: 11px; }
.pc-ytset-done {
  flex: none; min-width: 56px; min-height: 36px; padding: 0 12px; border: 0; border-radius: 8px;
  background: var(--accent, #3ea6ff); color: var(--accent-fg, #fff); font: inherit; font-weight: 600; cursor: pointer;
}
.stage.yt-settings .stage-controls, .stage.yt-settings .stage-emoji { display: none; }

/* 按鈕 */
.pc-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: #fff; cursor: pointer; pointer-events: auto;
  opacity: .92; -webkit-tap-highlight-color: transparent;
}
.pc-btn:hover { opacity: 1; }
.pc-btn .pc-ico, .pc-btn .icon { display: inline-flex; }
.pc-btn .icon, .pc-btn svg { width: 26px; height: 26px; }
.pc-btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.pc-btn[hidden] { display: none; }
.pc-unavail { visibility: hidden !important; pointer-events: none !important; }
.pc-time { font-variant-numeric: tabular-nums; white-space: nowrap; padding: 0 8px; line-height: 44px; text-shadow: 0 0 2px rgba(0, 0, 0, .6); }
.pc-spacer { flex: 1; }

/* 進度條（共用） */
.pc-prog { position: relative; display: flex; align-items: center; cursor: pointer; pointer-events: auto; touch-action: none; outline-offset: -2px; }
.pc-prog-track { position: relative; flex: 1; height: 3px; background: rgba(255, 255, 255, .25); transition: height .1s; }
.pc-prog-buf, .pc-prog-played, .pc-prog-hover { position: absolute; left: 0; top: 0; bottom: 0; width: 0; }
.pc-prog-buf { background: rgba(255, 255, 255, .4); }
.pc-prog-hover { background: rgba(255, 255, 255, .5); display: none; }
.pc-prog-played { background: var(--pc-red); }
.pc-prog-thumb {
  position: absolute; top: 50%; left: 0; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px;
  border-radius: 50%; background: var(--pc-red); transform: scale(0); transition: transform .1s;
}
.pc-prog-tip {
  position: absolute; bottom: calc(100% + 2px); left: 0; transform: translateX(-50%);
  padding: 3px 8px; border-radius: 4px; background: var(--pc-menu-bg); color: #fff;
  font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; display: none;
}
.pc-prog-tip.on { display: block; }
.pc-prog[aria-disabled="true"] { cursor: not-allowed; }
.pc-prog[aria-disabled="true"] .pc-prog-played { background: rgba(255, 255, 255, .7); }

/* 中央操作回饋 */
.pc-feedback {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  min-width: 64px; height: 64px; padding: 0 14px; border-radius: 32px; gap: 6px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .55); opacity: 0; pointer-events: none; visibility: hidden;
}
.pc-feedback .icon, .pc-feedback svg { width: 32px; height: 32px; display: block; }
.pc-fb-text { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pc-feedback.on { visibility: visible; animation: pc-fb .65s ease-out forwards; }
@keyframes pc-fb {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(.9); }
  60% { opacity: .9; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.25); }
}

/* ---------- 電腦版 ---------- */
.pc[data-mode="desktop"] .pc-m, .pc[data-mode="desktop"] .pc-scrim, .pc[data-mode="mobile"] .pc-d { display: none; }
.pc-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 0 12px;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, .65)); pointer-events: none;
}
.pc-bottom .pc-vol-slider { pointer-events: auto; }
.pc-bottom .pc-prog { height: 16px; margin: 0 0 -2px; }
.pc-bottom .pc-prog:hover .pc-prog-track, .pc-bottom .pc-prog.dragging .pc-prog-track, .pc-bottom .pc-prog:focus-visible .pc-prog-track { height: 5px; }
.pc-bottom .pc-prog:hover .pc-prog-thumb, .pc-bottom .pc-prog.dragging .pc-prog-thumb, .pc-bottom .pc-prog:focus-visible .pc-prog-thumb { transform: scale(1); }
.pc-bottom .pc-prog:hover .pc-prog-hover { display: block; }
.pc-bottom .pc-prog-tip { bottom: 20px; }
.pc-bar { display: flex; align-items: center; justify-content: space-between; height: 48px; }
.pc-left, .pc-right { display: flex; align-items: center; min-width: 0; }
.pc-left { overflow: hidden; }
.pc-gear.on .icon { transform: rotate(30deg); }
.pc-gear .icon { transition: transform .2s; }

/* 音量：滑入展開滑桿 */
.pc-vol { display: flex; align-items: center; }
.pc-vol-slider {
  width: 0; height: 44px; overflow: hidden; display: flex; align-items: center; cursor: pointer;
  transition: width .2s, margin .2s; touch-action: none; outline-offset: -2px;
}
.pc-vol:hover .pc-vol-slider, .pc-vol:focus-within .pc-vol-slider, .pc-vol.active .pc-vol-slider { width: 64px; margin-right: 6px; overflow: visible; }
.pc-vol-track { position: relative; flex: 1; height: 3px; margin: 0 6px; background: rgba(255, 255, 255, .25); }
.pc-vol-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #fff; }
.pc-vol-thumb { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; }

/* 齒輪選單 */
.pc-menu {
  position: absolute; right: 12px; bottom: 64px; min-width: 250px; max-width: calc(100% - 24px);
  max-height: calc(100% - 76px); overflow: auto; padding: 8px 0; border-radius: 12px;
  background: var(--pc-menu-bg); pointer-events: auto; box-shadow: 0 4px 24px rgba(0, 0, 0, .4);
}
.pc-menu[hidden] { display: none; }
/* 開啟彈出、關閉反向縮回（ui/anim.js） */
.pc-menu { transform-origin: bottom right; animation: ui-pop-in .12s ease-out; }
.pc-menu.closing { animation: ui-pop-out .12s ease-in forwards; }
.pc-mi {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 14px 0 16px;
  border: 0; background: transparent; color: #fff; font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.pc-mi:hover, .pc-mi:focus-visible { background: rgba(255, 255, 255, .12); outline: none; }
.pc-mi-value { margin-left: auto; color: #ddd; }
.pc-mi-chev, .pc-mi-check { display: inline-flex; width: 22px; justify-content: center; }
.pc-mi-chev .icon, .pc-mi-chev svg, .pc-mi-check .icon, .pc-mi-check svg { width: 18px; height: 18px; }
.pc-mi-back { border-bottom: 1px solid rgba(255, 255, 255, .15); margin-bottom: 6px; font-weight: 600; }
.pc-mi[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

/* ---------- 手機版（仿 YouTube App） ---------- */
.pc-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); pointer-events: none; }
.pc-center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: clamp(20px, 9vw, 72px); pointer-events: none;
}
.pc-mprev, .pc-mnext { width: 52px; height: 52px; background: rgba(0, 0, 0, .3); }
.pc-mprev .icon, .pc-mprev svg, .pc-mnext .icon, .pc-mnext svg { width: 28px; height: 28px; }
.pc-mplay { width: 64px; height: 64px; background: rgba(0, 0, 0, .35); }
.pc-mplay .icon, .pc-mplay svg { width: 38px; height: 38px; }
.pc-mbottom { position: absolute; left: 0; right: 0; bottom: 0; height: 74px; pointer-events: none; }
.pc-mrow { position: absolute; z-index: 1; left: 0; right: 0; bottom: 28px; display: flex; align-items: center; padding: 0 4px 0 10px; pointer-events: none; }
.pc-mrow .pc-time { font-size: 12px; }
/* 細進度條：可點區 44px 高，線條貼近底部 */
/* 按鈕列（z 1）蓋在進度條可點區上緣之上：點全螢幕/齒輪下緣不會變成拖曳進度 */
.pc-mbottom .pc-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 44px; align-items: flex-end; padding: 0 12px 9px; }
.pc-mbottom .pc-prog-thumb { transform: scale(1); width: 12px; height: 12px; margin: -6px 0 0 -6px; }
.pc-mbottom .pc-prog.dragging .pc-prog-track { height: 6px; }
.pc-mbottom .pc-prog.dragging .pc-prog-thumb { transform: scale(1.5); }
.pc-mbottom .pc-prog-tip { bottom: 26px; padding: 6px 12px; font-size: 15px; font-weight: 600; border-radius: 8px; }
.pc-mbottom .pc-prog.dragging ~ * { visibility: hidden; }
.pc[data-mode="mobile"].pc-dragging .pc-center { opacity: 0; }
/* 中央回饋（快轉秒數、音量）顯示中：先藏起中央按鈕，不讓兩個圖示疊在一起（player-controls.js flash） */
.pc[data-mode="mobile"].pc-fb-over .pc-center { opacity: 0; }

/* 雙擊快轉漣漪 */
/* 長按 2 倍速中的提示（player-controls.js）：影片上方中央的小膠囊，控制層隱藏時也顯示 */
.pc-boost {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 3;
  padding: 4px 12px; border-radius: 999px; background: rgba(0, 0, 0, .6); color: #fff;
  font-size: 13px; font-weight: 600; line-height: 1.4; white-space: nowrap; pointer-events: none;
}
.pc-boost[hidden] { display: none; }
.pc-ripple {
  position: absolute; top: 0; bottom: 0; width: 38%; display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: rgba(255, 255, 255, .12); opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .2s, visibility .2s;
}
.pc-ripple.left { left: 0; border-radius: 0 50% 50% 0 / 0 50% 50% 0; }
.pc-ripple.right { right: 0; border-radius: 50% 0 0 50% / 50% 0 0 50%; }
.pc-ripple.on { opacity: 1; visibility: visible; }
.pc-ripple-text { position: relative; z-index: 1; font-size: 15px; font-weight: 600; text-shadow: 0 0 3px rgba(0, 0, 0, .7); font-variant-numeric: tabular-nums; }
.pc-ripple::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 80px; height: 80px; margin: -40px 0 0 -40px;
  border-radius: 50%; background: rgba(255, 255, 255, .25); transform: scale(0); opacity: 0;
}
.pc-ripple.pulse::after { animation: pc-ripple .55s ease-out; }
@keyframes pc-ripple { from { transform: scale(0); opacity: 1; } to { transform: scale(4); opacity: 0; } }

/* 手機播放設定抽屜 */
.pc-sheet { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.pc-speeds { flex-wrap: wrap; }
.pc-speeds .seg { flex: 1 0 64px; min-height: 44px; }
.pc-speeds .seg[aria-disabled="true"] { opacity: .5; }

/* 減少動態效果 */
@media (prefers-reduced-motion: reduce) {
  .pc-chrome, .pc-prog-track, .pc-prog-thumb, .pc-vol-slider, .pc-ripple, .pc-gear .icon { transition: none; }
  .pc-feedback.on { animation: none; opacity: 1; }
  .pc-ripple.pulse::after { animation: none; }
  .pc-menu, .pc-menu.closing { animation: none; }
}
