/**
 * 前台直播購物單頁樣式表 (yt_video.css)
 * ----------------------------------------------------
 * 完整套用 test.html 之視覺畫面與容器樣式，並整合直播購物功能：
 * 1. 採用 Plus Jakarta Sans 與 Material Symbols Rounded 圖示（單一黑白灰毛玻璃風格）
 * 2. 完整封鎖 YouTube 原生控制項點擊（.yt-frame pointer-events: none + .card-overlay 遮罩阻絕外連與控制）
 * 3. 右側 .action-bar 整合：讚、分享、直式/橫式、線上客服、商品資訊、訂購
 * 4. 置底高透明可收合留言板，具備「已置底自動滾動、未置底浮現『▾ 有新留言』提示鈕」機制
 */

:root {
  --primary: #ff0050;
  --accent: #00f2fe;
  --bg-dark: #000000;
  --glass-bg: rgba(0, 0, 0, 0.42);
  --glass-bg-hover: rgba(255, 255, 255, 0.18);
  --glass-border: rgba(255, 255, 255, 0.16);
  --text-main: #ffffff;
  --mono-surface: #18181b;
  --mono-surface-light: #27272a;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

body {
  background-color: #0b0c10;
  color: var(--text-main);
  font-family: "Plus Jakarta Sans", "PingFang TC", "Microsoft JhengHei", sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background-image:
    radial-gradient(at 0% 0%, rgba(255, 255, 255, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(255, 255, 255, 0.04) 0px, transparent 50%);
}

/* =========================================================
   播放器主容器 (套用 test.html 手機螢幕比例與圓角框體)
   ========================================================= */

.app-container {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100vh;
  height: 100dvh;
  background-color: var(--bg-dark);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--glass-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    aspect-ratio 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    border-radius 0.3s ease;
}

@media (min-width: 480px) {
  .app-container {
    height: 88vh;
    max-height: 860px;
    border-radius: 36px;
  }
}

/* 橫式 16:9 劇院模式 (套用 test.html 定義) */
.app-container.landscape-mode {
  width: 100%;
  max-width: 100vw;
  height: auto !important;
  aspect-ratio: 16 / 9;
  border-radius: 0;
  margin: auto;
}

@media (min-width: 480px) {
  .app-container.landscape-mode {
    border-radius: 20px;
  }
}

@media (min-width: 600px) {
  .app-container.landscape-mode {
    max-width: 860px;
    height: 88vh !important;
    max-height: 520px;
    aspect-ratio: 16 / 9;
    border-radius: 28px;
  }
}

/* 手機真實橫放時：自動滿版填滿螢幕 */
@media (orientation: landscape) and (max-height: 500px) {
  .app-container {
    max-width: 100vw !important;
    max-height: 100vh !important;
    height: 100dvh !important;
    width: 100vw !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
}

/* 橫式模式下的緊湊排版 */
.app-container.landscape-mode .action-bar {
  bottom: 14px !important;
  right: 12px !important;
}

.app-container.landscape-mode .action-bar-items {
  gap: 6px !important;
}

.app-container.landscape-mode .action-bar:not(.is-collapsed) .action-bar-collapsible {
  /* 橫式模式下：加計文字高度 (約 16px) + 按鈕間距 (6px) = 22px，使圓圈對圓圈間距完全一致 */
  margin-top: 22px !important;
}

.app-container.landscape-mode .icon-circle,
.app-container.landscape-mode .action-collapse-btn {
  width: 34px !important;
  height: 34px !important;
}

.app-container.landscape-mode .icon-circle .material-symbols-rounded {
  font-size: 18px !important;
}

.app-container.landscape-mode .action-text {
  font-size: 10px !important;
}

.app-container.landscape-mode .bottom-overlay-stack {
  bottom: 10px !important;
  left: 14px !important;
  right: 68px !important;
  transition: right 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-container.landscape-mode .bottom-overlay-stack.is-rail-collapsed,
.app-container.landscape-mode:has(.action-bar.is-collapsed) .bottom-overlay-stack {
  right: 14px !important;
}

/* 橫式模式下的專屬高度三階預設後備值（實際精確高度由 JS 依裝置像素即時動態覆寫：1/4、1/3、1/2） */
.app-container.landscape-mode .chat-messages-scroll.height-stage-1 {
  max-height: max(48px, calc(25dvh - 45px));
}

.app-container.landscape-mode .chat-messages-scroll.height-stage-2 {
  max-height: max(56px, calc(33.3dvh - 50px));
}

.app-container.landscape-mode .chat-messages-scroll.height-stage-3 {
  max-height: calc(50dvh - 55px);
}

/* 橫式收合箭頭與送出按鈕完全對齊同高 (需求 3：bottom: 10px, height: 32px) */
.app-container.landscape-mode .action-bar.is-collapsed {
  bottom: 10px !important;
  right: 14px !important;
}

.app-container.landscape-mode .action-bar.is-collapsed .action-collapse-btn {
  width: 32px !important;
  height: 32px !important;
}

.app-container.landscape-mode .bottom-overlay-stack.is-rail-collapsed .chat-input-row,
.app-container.landscape-mode:has(.action-bar.is-collapsed) .chat-input-row {
  padding-right: 42px !important;
}

.app-container.landscape-mode .video-caption {
  font-size: 12px !important;
  -webkit-line-clamp: 1 !important;
  margin-bottom: 4px !important;
}

.app-container.landscape-mode .channel-avatar {
  width: 24px !important;
  height: 24px !important;
}

.app-container.landscape-mode .channel-avatar .avatar-icon {
  font-size: 18px !important;
}

/* =========================================================
   YouTube 播放器與防點擊控制遮罩層 (套用 test.html 機制)
   ========================================================= */

.feed-container {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.video-card {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #000;
}

/* YouTube 播放器本體：強制 pointer-events: none 禁止使用者點擊任何 YouTube 原生控制項 */
.yt-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none !important;
  user-select: none !important;
}

.yt-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none !important;
  user-select: none !important;
}

/* 遮罩層：完全覆蓋於 YouTube 上方，阻絕任何點擊操作或導外連結 */
.card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  cursor: default;
  user-select: none;
  background: linear-gradient(to bottom,
      rgba(0, 0, 0, 0.35) 0%,
      transparent 18%,
      transparent 65%,
      rgba(0, 0, 0, 0.78) 100%);
}

/* 直播偵測到暫停/未播放時的置中同步恢復按鈕（僅直播且暫停時出現） */
.live-resume-overlay-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(12, 12, 16, 0.78);
  backdrop-filter: blur(14px);
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65);
  transition: transform 0.2s ease, background 0.2s ease;
}

.live-resume-overlay-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translate(-50%, -50%) scale(1.04);
}

.live-resume-overlay-btn:active {
  transform: translate(-50%, -50%) scale(0.96);
}

.live-resume-overlay-btn .live-resume-icon {
  font-size: 24px;
  line-height: 1;
}

.live-resume-overlay-btn[hidden] {
  display: none !important;
}

/* =========================================================
   左上角即時在線人數標籤 (Live Online Pill - 無毛玻璃俐落風格)
   ========================================================= */

.top-left-bar {
  position: absolute;
  top: 20px;
  left: 16px;
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.top-left-bar[hidden] {
  display: none !important;
}

.live-online-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9999px;
  padding: 6px 13px;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: opacity 0.3s ease;
  user-select: none;
}

.live-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: pulseLiveDot 2s infinite ease-in-out;
}

@keyframes pulseLiveDot {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.45;
    transform: scale(0.8);
  }
}

.live-text-tag {
  color: #ef4444;
  font-weight: 800;
  letter-spacing: 0.5px;
  font-size: 0.74rem;
}

.online-divider {
  color: rgba(255, 255, 255, 0.28);
  font-size: 0.72rem;
  margin: 0 1px;
}

.online-icon {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
}

.online-unit {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.78);
}

/* =========================================================
   右側互動功能按鈕欄 (Action Bar - 全單一黑白灰毛玻璃風格)
   順序：按讚 -> 分享 -> 直式/橫式 -> 線上客服 -> 商品資訊 -> 訂購
   ========================================================= */

.action-bar {
  position: absolute;
  right: 14px;
  bottom: 24px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  transition: bottom 0.25s ease, right 0.25s ease;
}

.action-bar.is-collapsed {
  bottom: 16px;
  right: 14px;
}

.action-bar.is-collapsed .action-collapse-btn {
  width: 32px;
  height: 32px;
}

/* 可平滑升降收合的容器：
   加計其他按鈕下方的文字區塊高度 (gap 3px + 文字高 15px = 18px) + 項目間距 (12px) = 30px，
   讓無文字的箭頭圓圈與「直式/橫式」圓圈之間的視覺間距，跟下方有文字的各圓圈間距完全一致 */
.action-bar-collapsible {
  display: grid;
  grid-template-rows: 1fr;
  margin-top: 30px;
  opacity: 1;
  transition:
    grid-template-rows 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.24s ease,
    margin-top 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-bar.is-collapsed .action-bar-collapsible {
  grid-template-rows: 0fr;
  margin-top: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.action-bar-items {
  min-height: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 4px;
}

/* 收合時移除 padding 並裁切溢出，避免 CSS Grid 0fr 仍殘留 8px 高度將箭頭按鈕往上推 */
.action-bar.is-collapsed .action-bar-items {
  overflow: hidden;
  padding: 0;
}

/* 右側選單欄收合/展開三角形箭頭按鈕（與下方 .icon-circle 尺寸與間距完全一致） */
.action-collapse-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.45);
  transition: all 0.25s;
  padding: 0;
  overflow: visible;
}

.action-collapse-btn:hover {
  background: var(--glass-bg-hover);
  transform: scale(1.08);
}

.action-collapse-btn:active {
  transform: scale(0.92);
}

.triangle-arrow-icon {
  font-size: 13px;
  line-height: 1;
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-bar.is-collapsed .triangle-arrow-icon {
  transform: rotate(180deg);
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.2s;
  font-family: inherit;
  padding: 2px 4px;
  overflow: visible;
}

.action-btn:hover {
  transform: scale(1.08);
}

.action-btn:active {
  transform: scale(0.92);
}

.icon-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  display: flex;
  justify-content: center;
  align-items: center;
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.45);
  transition: all 0.25s;
  box-sizing: border-box;
  overflow: hidden;
  transform-origin: center center;
}

.icon-circle .material-symbols-rounded {
  font-size: 21px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover .icon-circle {
  background: var(--glass-bg-hover);
  border-color: rgba(255, 255, 255, 0.35);
}

.action-btn.liked .icon-circle {
  background: rgba(255, 255, 255, 0.28);
  border-color: #ffffff;
}

.action-text {
  font-size: 11px;
  font-weight: 600;
  color: #e4e4e7;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* =========================================================
   底部資訊區與置底可收合高透明留言板
   ========================================================= */

.bottom-overlay-stack {
  position: absolute;
  left: 14px;
  right: 72px;
  bottom: 16px;
  z-index: 35;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  transition: right 0.32s cubic-bezier(0.4, 0, 0.2, 1), bottom 0.25s ease;
}

/* 當預錄影片進度條存在時，將底部頻道簡介區與工具欄微幅上移避開進度條；並確保收合後簡介不與向上箭頭重疊 */
.app-container.has-video-controls .bottom-overlay-stack {
  bottom: 24px !important;
}

.app-container.has-video-controls .action-bar.is-collapsed {
  bottom: 20px;
}

.app-container.landscape-mode.has-video-controls .action-bar {
  bottom: 20px !important;
}

.app-container.landscape-mode.has-video-controls .action-bar.is-collapsed {
  bottom: 18px !important;
}

.app-container:has(.action-bar.is-collapsed) .bottom-overlay-stack:has(.chatroom-box[hidden]) .bottom-info,
.bottom-overlay-stack.is-rail-collapsed:has(.chatroom-box[hidden]) .bottom-info {
  padding-right: 46px !important;
}

/* 當右側欄位收合時，平滑向右延伸聊天室寬度 */
.bottom-overlay-stack.is-rail-collapsed,
.app-container:has(.action-bar.is-collapsed) .bottom-overlay-stack {
  right: 14px;
}

/* 當右側工具收合時，聊天室加寬，但輸入框列右側預留 42px 留白給 32px 工具欄按鈕並維持 10px 間距 (需求 3) */
.bottom-overlay-stack.is-rail-collapsed .chat-input-row,
.app-container:has(.action-bar.is-collapsed) .chat-input-row {
  padding-right: 42px;
}

.bottom-info {
  pointer-events: none;
}

.author-tag {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.85);
}

/* 簡約極小收合頻道簡介圖示按鈕 */
.intro-collapse-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
  transition: all 0.2s ease;
  pointer-events: auto;
}

.intro-collapse-icon-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

.intro-collapse-icon-btn .material-symbols-rounded {
  font-size: 15px;
  line-height: 1;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.intro-collapse-icon-btn.is-collapsed .material-symbols-rounded {
  transform: rotate(-90deg);
}

.channel-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}

.channel-avatar .avatar-icon {
  font-size: 22px;
  color: rgba(255, 255, 255, 0.9);
}

.channel-avatar .avatar-img,
.channel-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.badge-verified {
  color: #e4e4e7;
  font-size: 15px;
}

.video-caption {
  font-size: 12.5px;
  line-height: 1.38;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.25s ease, margin 0.25s ease;
}

.video-caption.is-collapsed {
  display: none;
}

/* 置底高透明留言板 */
.chatroom-box {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.chatroom-box[hidden] {
  display: none;
}

.chat-reconnect-box {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  pointer-events: auto;
}

.chat-reconnect-box[hidden] {
  display: none;
}

.chat-reconnect-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(24, 24, 27, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fafafa;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.chat-reconnect-pill:hover {
  background: rgba(39, 39, 42, 0.94);
  border-color: rgba(255, 255, 255, 0.5);
}

.chat-reconnect-pill:active {
  transform: scale(0.97);
}

.chat-reconnect-icon {
  font-size: 16px;
}

.chatroom-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chatroom-controls-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chat-pill-control {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(6px);
  color: #e4e4e7;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  white-space: nowrap;
}

.chat-pill-control:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.chat-pill-icon {
  font-size: 14px;
  line-height: 1;
}

.chatroom-collapsible-body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chatroom-collapsible-body[hidden] {
  display: none;
}

/* 當聊天室收合時，高度、字體及暱稱控制列一併收合隱藏 (需求 5) */
.chatroom-box.is-collapsed .chatroom-controls-group {
  display: none !important;
}

/* 聊天室下拉選單容器與彈出選項 (需求 3) */
.chat-dropdown-wrapper {
  position: relative;
  display: inline-flex;
}

.chat-dropdown-popover {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 55;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 135px;
  padding: 6px;
  background: rgba(18, 18, 22, 0.95);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
  pointer-events: auto;
}

.chat-dropdown-popover[hidden] {
  display: none;
}

.chat-dropdown-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  border: none;
  background: none;
  color: #e4e4e7;
  font-size: 11.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.15s;
}

.chat-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.chat-dropdown-item.is-active {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-weight: 700;
}

.chat-dropdown-item .dropdown-check {
  display: inline-block;
  width: 14px;
  color: #fbbf24;
  font-weight: 800;
  text-align: center;
}

.pinned-chat-banner {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 10px;
  background: rgba(24, 24, 27, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(251, 191, 36, 0.55);
  border-left: 3px solid #fbbf24;
  font-size: var(--chat-font-size, 13px);
  line-height: 1.38;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  transition: background 0.2s ease, border-color 0.2s ease, backdrop-filter 0.2s ease;
}

/* 置頂留言跟隨聊天室背景風格切換（透明底 / 模糊底）(需求 1) */
.chatroom-box.theme-blur .pinned-chat-banner {
  background: rgba(24, 24, 27, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(251, 191, 36, 0.55);
  border-left: 3px solid #fbbf24;
}

.chatroom-box.theme-transparent .pinned-chat-banner {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid transparent;
  border-left: 3px solid rgba(251, 191, 36, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 2px 6px rgba(0, 0, 0, 0.95);
}

.pinned-chat-banner[hidden] {
  display: none;
}

.pinned-chat-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12em 0.45em;
  border-radius: 0.35em;
  background: #fbbf24;
  color: #09090b;
  font-size: 0.8em;
  line-height: 1.25;
  font-weight: 800;
  text-shadow: none;
  flex-shrink: 0;
}

.pinned-chat-author,
.pinned-chat-text {
  font-size: inherit;
}

.pinned-chat-author {
  font-weight: 700;
  color: #fde68a;
}

.pinned-chat-text {
  color: #ffffff;
  word-break: break-word;
}

.chat-messages-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
  padding-right: 4px;
  max-height: max(180px, 35dvh);
  scroll-behavior: auto;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 聊天室高度三階段精確控制 (1/4, 1/3, 1/2，預設 1/4) */
.chat-messages-scroll.height-stage-1 {
  max-height: max(76px, calc(25dvh - 55px));
}

.chat-messages-scroll.height-stage-2 {
  max-height: max(90px, calc(33.3dvh - 65px));
}

.chat-messages-scroll.height-stage-3 {
  max-height: calc(50dvh - 75px);
}

/* 聊天室字體五階控制 (需求 3: 特大調大至 18px) */
.chat-messages-scroll.font-size-1 {
  --chat-font-size: 11px;
}

.chat-messages-scroll.font-size-2 {
  --chat-font-size: 12px;
}

.chat-messages-scroll.font-size-3 {
  --chat-font-size: 13px;
}

.chat-messages-scroll.font-size-4 {
  --chat-font-size: 15px;
}

.chat-messages-scroll.font-size-5 {
  --chat-font-size: 18px;
}

.chat-messages-scroll::-webkit-scrollbar {
  width: 3px;
}

.chat-messages-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}

.chat-msg-item {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  align-self: flex-start;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(2px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 3px 9px;
  border-radius: 10px;
  font-size: var(--chat-font-size, 12px);
  line-height: 1.35;
  max-width: 100%;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  transition: all 0.2s ease;
}

/* 背景風格：預設模糊毛玻璃底 (需求 3) */
.chatroom-box.theme-blur .chat-msg-item {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
}

/* 背景風格：純淨透明底 (需求 3) */
.chatroom-box.theme-transparent .chat-msg-item {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid transparent !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 2px 6px rgba(0, 0, 0, 0.95) !important;
}

.chatroom-box.theme-transparent .chat-msg-item.is-admin-msg {
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
}

.chatroom-box.theme-transparent .chat-msg-item.is-tagged-for-me {
  background: rgba(245, 158, 11, 0.2) !important;
  border: 1px solid #f59e0b !important;
}

.chatroom-box.theme-transparent .chat-msg-item.is-whisper-for-me {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.28), rgba(79, 70, 229, 0.28)) !important;
  border: 1px solid rgba(168, 85, 247, 0.7) !important;
}

.chat-msg-item.is-admin-msg {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
}

/* 官方小編 Tag 回覆給當前用戶（亮金醒目邊框與發光感） */
.chat-msg-item.is-tagged-for-me {
  background: rgba(245, 158, 11, 0.25);
  border: 1px solid #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
}

.chat-tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12em 0.42em;
  border-radius: 0.35em;
  background: #f59e0b;
  color: #09090b;
  font-size: 0.8em;
  line-height: 1.25;
  font-weight: 800;
  text-shadow: none;
}

/* 官方小編一對一私訊（獨特紫靛漸層與柔和霓虹） */
.chat-msg-item.is-whisper-for-me {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.38), rgba(79, 70, 229, 0.38));
  border: 1px solid rgba(168, 85, 247, 0.7);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.45);
}

.chat-whisper-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12em 0.42em;
  border-radius: 0.35em;
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: #ffffff;
  font-size: 0.8em;
  line-height: 1.25;
  font-weight: 800;
  text-shadow: none;
}

.chat-admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12em 0.42em;
  border-radius: 0.35em;
  background: #f4f4f5;
  color: #09090b;
  font-size: 0.8em;
  line-height: 1.25;
  font-weight: 800;
  text-shadow: none;
}

.chat-author-name {
  font-weight: 700;
  color: #d4d4d8;
}

.chat-msg-text {
  color: #ffffff;
  word-break: break-word;
}

/* 官方小編提供的 URL 專屬超連結樣式 */
.chat-official-link {
  color: #93c5fd;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
  font-weight: 600;
}

.chat-official-link:hover {
  color: #60a5fa;
  text-decoration-thickness: 2px;
}

/* 未置底時浮現的「▾ 有新留言」提示按鈕 */
.new-messages-indicator-btn {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(24, 24, 27, 0.88);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
}

.new-messages-indicator-btn[hidden] {
  display: none;
}

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-private-toggle-btn {
  height: 32px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.chat-private-toggle-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.22);
}

.chat-private-toggle-btn.is-private-active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.85), rgba(99, 102, 241, 0.85));
  border-color: rgba(192, 132, 252, 0.9);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.45);
}

.chat-private-toggle-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-input-field {
  flex: 1;
  min-width: 0;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(6px);
  color: #ffffff;
  padding: 0 12px;
  font-size: 12px;
  font-family: inherit;
}

.chat-input-field.is-private-mode {
  border-color: rgba(168, 85, 247, 0.78);
  background: rgba(46, 16, 101, 0.42);
}

.chat-input-field::placeholder {
  color: rgba(255, 255, 255, 0.58);
}

.chat-input-field:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-send-btn {
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.chat-send-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chat-login-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(225, 29, 72, 0.35);
}

.chat-login-btn:hover {
  filter: brightness(1.08);
}

/* =========================================================
   預錄影片正中央浮動播放控制圖示 HUD（點擊左/中/右顯示，無持續點擊自動隱藏）
   ========================================================= */

.video-playback-bar.video-center-hud {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  z-index: 46;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.video-playback-bar.video-center-hud.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.video-playback-bar[hidden] {
  display: none !important;
}

.video-playback-controls {
  display: inline-flex;
  align-items: center;
  gap: 36px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.video-ctrl-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: transparent;
  box-shadow: none;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.video-ctrl-btn .material-symbols-rounded {
  font-size: 32px;
  line-height: 1;
}

.video-ctrl-btn.is-primary {
  width: 56px;
  height: 56px;
  background: transparent;
  border: none;
}

.video-ctrl-btn.is-primary .material-symbols-rounded {
  font-size: 40px;
}

.video-ctrl-btn:hover {
  transform: scale(1.08);
}

.video-ctrl-btn:active,
.video-ctrl-btn.is-triggered {
  transform: scale(1.22);
}

/* =========================================================
   極簡進度條 Seekbar（僅預錄影片模式顯示並支援滑鼠與手機觸控拖曳；直播模式隱藏）
   ========================================================= */

.progress-line-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 18px;
  display: flex;
  align-items: flex-end;
  z-index: 60;
  cursor: pointer;
  padding-bottom: 0;
}

.progress-line-container[hidden] {
  display: none !important;
}

.progress-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.22);
  position: relative;
  transition: height 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-line-container:hover .progress-track,
.progress-line-container.dragging .progress-track {
  height: 8px;
}

.progress-line-bar {
  height: 100%;
  width: 0%;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
  position: relative;
}

/* 拖曳圓點 */
.progress-line-bar::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.9), 0 2px 4px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.progress-line-container:hover .progress-line-bar::after,
.progress-line-container.dragging .progress-line-bar::after {
  transform: translateY(-50%) scale(1);
}

/* 拖曳時浮動的時間提示框 */
.progress-tooltip {
  position: absolute;
  bottom: 24px;
  left: 0%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--glass-border);
  color: #ffffff;
  font-size: 12px;
  font-family: monospace;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  z-index: 70;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.progress-tooltip.show {
  opacity: 1;
}

/* =========================================================
   Toast 提示 (套用 test.html 樣式)
   ========================================================= */

.toast {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--glass-border);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: white;
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 100;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =========================================================
   原生 <dialog> 彈窗樣式（黑白灰極簡風格）
   ========================================================= */

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(4px);
}

dialog[open] {
  margin: auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  background: var(--mono-surface);
  color: #fafafa;
  width: min(92vw, 400px);
  padding: 18px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dialog-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  color: #fafafa;
}

.dialog-close-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--mono-surface-light);
  color: #fff;
  cursor: pointer;
}

.dialog-body {
  font-size: 0.86rem;
  line-height: 1.55;
  color: #e4e4e7;
}

.dialog-highlight-box {
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid #a1a1aa;
  padding: 11px 12px;
  border-radius: 8px;
  margin: 10px 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.btn-secondary {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--mono-surface-light);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #fff;
  background: #fafafa;
  color: #09090b;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}

.modal-product-hero {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 10px;
  background: #09090b;
}

.order-modal-buttons-stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 12px;
}

.order-modal-option-btn {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--mono-surface-light);
  color: #fafafa;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.order-modal-option-btn:hover {
  background: #3f3f46;
  border-color: rgba(255, 255, 255, 0.45);
}

.order-modal-option-btn.primary-order-btn {
  background: #f4f4f5;
  color: #09090b;
  border-color: #fff;
}

.order-modal-option-btn.primary-order-btn:hover {
  background: #e4e4e7;
}

.order-modal-option-btn[hidden] {
  display: none;
}

.order-opt-title {
  font-size: 0.9rem;
  font-weight: 800;
  display: block;
}

.order-opt-sub {
  font-size: 0.75rem;
  opacity: 0.78;
  display: block;
  margin-top: 2px;
}

/* =========================================================
   聊天室偏好設定對話框樣式 (需求 3 & 4)
   ========================================================= */

.settings-group {
  margin-bottom: 16px;
}

.settings-group:last-child {
  margin-bottom: 4px;
}

.settings-group-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 6px;
}

.settings-nickname-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.06);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
}

.settings-nickname-display {
  font-size: 0.92rem;
  font-weight: 800;
  color: #ffffff;
}

.settings-small-btn {
  padding: 4px 10px;
  font-size: 0.76rem;
}

.settings-subtext {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
  padding-left: 2px;
}

.settings-segmented-control {
  display: flex;
  background: rgba(0, 0, 0, 0.45);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  gap: 3px;
}

.settings-seg-btn {
  flex: 1;
  padding: 6px 4px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
  white-space: nowrap;
  text-align: center;
}

.settings-seg-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.settings-seg-btn.is-active {
  background: #ffffff;
  color: #09090b;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

/* =========================================================
   官網會員登入對話框樣式 (#loginDialog)
   ========================================================= */

.login-dialog-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-field-label {
  margin-top: 4px;
  color: #f4f4f5;
  font-weight: 700;
}

.login-field {
  width: 100%;
  min-height: 42px;
}

.login-captcha-row {
  display: grid;
  grid-template-columns: 102px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.login-captcha-row canvas {
  display: block;
  width: 102px;
  height: 42px;
  border-radius: 7px;
  background: #fff;
}

.login-captcha-input {
  min-width: 0;
  height: 42px;
}

.login-refresh-btn {
  padding: 8px 10px;
  white-space: nowrap;
}

.login-dialog-message {
  margin: 4px 0 0;
  color: #fca5a5;
  font-weight: 600;
}

.login-dialog-message.is-success {
  color: #86efac;
}

.login-dialog-message[hidden] {
  display: none;
}

.login-dialog-actions {
  width: 100%;
}

.login-dialog-actions>button {
  flex: 1;
}

.login-help-links {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 4px;
  font-size: 0.78rem;
}

.login-help-links a {
  color: #d4d4d8;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-help-links a:hover {
  color: #fff;
}