/* ==========================================
   Play Page Layout — 仿 maccmsbox_119 播放頁（920 播放器 + 260 側欄）
   （playlist-*／pl-*／episode-* 共用樣式已在 vod_detail.css 定義，此檔不重複）
   ========================================== */
.play-main {
  flex: 1;
  background: var(--bg-base);
}

/* ===== 播放器 Stage ===== */
.play-stage {
  background: #2b2b2b;
}

.play-stage-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  position: relative;
}

/* ===== 播放器 =====
   .play-aside 改用 absolute 定位（見下方），不再參與這裡的高度計算，
   所以 .play-stage-inner 的高度完全由 .player-wrap 自己的內容（影片比例＋工具列）決定，
   不會被右側「猜你喜歡」內容多寡牽動。 */
.player-wrap {
  background: #000;
  display: flex;
  flex-direction: column;
  width: calc(100% - 260px);
}

.player-box {
  position: relative;
  width: 100%;
  background: #000;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.player-box > iframe,
.player-box > div {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.player-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  min-height: 44px;
}

.ptb-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  color: var(--text-2);
  font-size: 18px;
  transition: color 0.2s, background 0.2s;
}
.ptb-btn:hover { color: var(--accent); background: var(--bg-card); }

.ptb-btn--text { font-size: 13px; }

.ptb-btn--refresh {
  margin-left: auto;
}

/* ===== 右侧 Aside =====
   absolute + top/right/bottom:0 讓它的高度直接鎖定成 .play-stage-inner 的高度
   （也就是 .player-wrap 的高度），且完全脫離文件流、不會反過來把那個高度撐大；
   內容超出這個高度時，靠自己的 overflow-y:auto 內部捲動，不會影響播放器。 */
.play-aside {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.pa-now {
  display: flex;
  gap: 12px;
  padding: 14px;
}

.pa-now-thumb {
  width: 60px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  aspect-ratio: 2/3;
  background: var(--bg-elevated) url("../img/load.gif") no-repeat center/cover;
}

.pa-now-thumb img { width: 100%; height: 100%; object-fit: cover; }

.pa-now-info { flex: 1; min-width: 0; }

.pa-now-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-1);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pa-now-ep {
  font-size: 12px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.pa-now-meta { font-size: 11px; color: var(--text-3); }

.pa-divider {
  height: 1px;
  background: var(--border);
  margin: 0 14px;
  flex-shrink: 0;
}

.pa-related-hd {
  padding: 10px 14px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}

.pa-related-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 12px;
  scroll-snap-type: y mandatory;
  /* 固定顯示 5 個完整 .pa-related-item 的高度：縮圖 75px（寬 50px × 2:3 比例）＋ 上下 padding 6px
     （見 .pa-related-item 的 padding）＝ 85px／個，5 個 = 425px。
     這個 height 只需要是「item 高度 × 5」，不需要另外加上 .pa-related-list 自己的
     padding-bottom——因為捲動內容超出視窗時，padding-bottom 只會在捲到最後一項之後才出現，
     不會在第 5 項後面插入空隙（實測驗證過：height 設成 item高度×5 時，第 6 項會剛好卡在
     視窗邊界、完全不可見，0px 露出）。不管實際內容有幾條，一律固定這個高度（內容不足 5 條
     時下面留白，不會縮小）；超過 5 條時靠捲動查看，配合 scroll-snap 一定停在完整項目的頂端。 */
  height: 425px;
}
.pa-related-list::-webkit-scrollbar { width: 4px; }
.pa-related-list::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }

.pa-related-item {
  display: flex;
  gap: 10px;
  padding: 5px 4px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.pa-related-item:hover { background: var(--bg-elevated); }
.pa-related-item:hover .pa-ri-name { color: var(--accent); }

.pa-ri-thumb {
  width: 50px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  aspect-ratio: 2/3;
  background: var(--bg-elevated) url("../img/load.gif") no-repeat center/cover;
}

.pa-ri-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.pa-related-item:hover .pa-ri-thumb img { transform: scale(1.06); }

.pa-ri-info { flex: 1; min-width: 0; }

.pa-ri-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
  transition: color 0.15s;
}

.pa-ri-meta { font-size: 11px; color: var(--text-3); margin-bottom: 3px; }

.pa-ri-remarks {
  font-size: 11px;
  color: var(--accent-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== 下方内容区 ===== */
.play-bottom {
  background: var(--bg-base);
}

.play-bottom-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 20px 0 48px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.play-content {
  flex: 1;
  min-width: 0;
}

/* ===== 右侧：与详情页同步（rank_col_home 组件） ===== */
.play-bot-aside {
  width: 260px;
  flex-shrink: 0;
}

/* ===== 面包屑 ===== */
.play-content .art-breadcrumb { margin-bottom: 14px; }

/* ===== 片名 + 评分栏 ===== */
.play-info-bar {
  padding: 20px 0 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.play-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.play-vod-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-1);
}

.play-desc-toggle-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: none;
  border: 1px solid var(--border-2);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.play-desc-toggle-btn:hover,
.play-desc-toggle-btn.is-open { color: var(--accent); border-color: var(--accent); }
.play-desc-toggle-btn.is-open iconify-icon { transform: rotate(180deg); }

.play-desc-panel {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-2);
}

.play-tag--score {
  background: none;
  color: var(--score-hi);
  font-weight: 700;
  font-size: 14px;
}

.play-tag-divider {
  width: 1px;
  height: 12px;
  background: var(--border-2);
}

.play-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.play-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 11px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  transition: opacity 0.2s;
}
.play-tag a { color: #fff; }
.play-tag:hover, .play-tag a:hover { opacity: 0.85; }

.play-tag--link { background: var(--bg-elevated); color: var(--text-2); }
.play-tag--link:hover { color: var(--accent); opacity: 1; }

/* ===== 通用区块标题 ===== */
.play-section { margin-bottom: 26px; }

.play-section-hd {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 16px;
  font-weight: 400;
  color: var(--text-1);
  margin-bottom: 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
}

.play-section-hd iconify-icon { color: var(--accent); }

/* ===== 推荐影片 Grid ===== */
.play-vod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

/* ==========================================
   Responsive
   ========================================== */
@media (min-width: 1200px) {
  /* adbar 只在桌機版隱藏，手機/平板保留 */
  .player-adbar { display: none; }
}

@media (max-width: 1100px) {
  .play-bot-aside { display: none; }
}

@media (max-width: 1199px) {
  /* 平板 + 手機：播放器全寬，隱藏側欄 */
  .player-wrap { width: 100%; }
  .play-aside { display: none; }
  /* 下方內容區（片名/評分/推薦）加回左右留白，避免貼邊；播放器本身維持全寬不動 */
  .play-bottom-inner { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 767px) {
  .play-bottom-inner { padding-bottom: 32px; flex-direction: column; padding-left: 0; padding-right: 0; }
  .play-content { padding: 0 12px; }
  .play-vod-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .play-vod-title { font-size: 18px; }
}
