/* 播放页（比照目标站）：≥1240px 左侧播放器＋信息条、右侧 380px 选集栏（选集列表 + 竖排来源页签）；
   以下上下堆叠。选集为 widget/playlist 共用样式（main.css），这里只覆写侧栏内的版本 */
.dg-pw-stage {
  margin-bottom: var(--module-gap);
  overflow: hidden;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.88);
}

.dg-pw-main {
  min-width: 0;
}

.dg-pw-player {
  background: var(--black);
}

.dg-player-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--black);
}

/* 第三方播放器常带固定宽高内联样式，强制填满容器 */
.dg-player-box > * {
  width: 100% !important;
  height: 100% !important;
}

.dg-pw-info {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 20px 15px;
}

.dg-pw-head {
  flex: 1 1 auto;
  min-width: 0;
}

.dg-pw-title {
  margin: 0;
  color: var(--text-soft);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.38;
}

.dg-pw-title a {
  color: inherit;
  transition: color 0.3s ease-in;
}

.dg-pw-title a:hover {
  color: var(--white);
}

.dg-pw-ep {
  margin-left: 10px;
  color: var(--text-muted);
  font-size: 0.75em;
  font-weight: 400;
}

/* 沿用详情页 tag 样式，播放页维持靠左 */
.dg-pw-tags.dg-vd-tags {
  justify-content: flex-start;
  margin-top: 10px;
  padding: 0;
  list-style: none;
}

.dg-pw-score {
  color: var(--score-green);
  font-weight: 700;
}

/* 工具列：70×70 图示在上、文字在下 */
.dg-pw-tools {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin: 0 -8px 0 0;
  padding: 0;
  list-style: none;
}

.dg-pw-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 70px;
  height: 70px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--text-dim);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.3s ease-in, background 0.3s ease-in;
}

.dg-pw-tool .mac-icon {
  width: 18px;
  height: 18px;
}

.dg-pw-tool:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
}

.dg-pw-tool--disabled,
.dg-pw-tool--disabled:hover {
  background: none;
  color: var(--text-muted);
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== 选集面板（全断点）：来源页签贴在面板上缘（同详情页），排序钮在页签列最右；集数按钮均分整行宽度的规则在 main.css ===== */
.dg-pw-side .dg-playlist .dg-module-hd {
  flex-wrap: nowrap;
  padding: 0 0 0 10px;
}

/* 标题仍在 DOM（h2 语义），来源页签本身已足够表意，视觉上隐藏 */
.dg-pw-side .dg-playlist .dg-module-title {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.dg-pw-side .dg-playlist-sources {
  flex: 1;
  order: 0;
  width: auto;
}

.dg-pw-side .dg-source-tab {
  height: 44px;
  padding: 0 14px;
  font-size: 13px;
}

/* 排序钮在 DOM 里排在页签前，用 order 排到最右 */
.dg-pw-side .dg-playlist-sort {
  order: 2;
  margin-right: 12px;
}

.dg-pw-side .dg-playlist-panel {
  padding: 16px;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ===== 桌机：右栏与左栏等高（绝对定位让选集栏不撑高整行），集数在面板内滚动 ===== */
@media (min-width: 1240px) {
  .dg-pw-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
  }

  .dg-pw-side {
    position: relative;
  }

  .dg-pw-side .dg-playlist {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
  }

  .dg-pw-side .dg-playlist .dg-module-hd {
    flex-shrink: 0;
  }

  .dg-pw-side .dg-playlist-empty {
    margin: 0;
  }

  .dg-pw-side .dg-playlist-panel {
    flex: 1;
    min-height: 0;
    padding: 16px 14px 16px 16px;
  }

  .dg-pw-side .dg-playlist-panel.dg-active {
    display: flex;
    flex-direction: column;
  }

  .dg-pw-side .dg-playlist-episodes-wrap {
    flex: 1;
    min-height: 0;
    max-height: none;
    padding-top: 6px;
  }

  .dg-pw-side .dg-episode--new::after {
    top: -4px;
    right: -3px;
  }
}

/* ===== 窄屏：上下堆叠，选集放在播放器下方 ===== */
@media (max-width: 1239px) {
  .dg-pw-side .dg-playlist {
    margin: 0;
    padding: 15px 20px 20px;
  }
}

@media (max-width: 767px) {
  .dg-play-main .dg-module-title {
    font-size: 20px;
  }

  /* 手机播放器贴齐屏幕两侧 */
  .dg-pw-stage {
    margin-right: calc(var(--gutter) * -1);
    margin-left: calc(var(--gutter) * -1);
    border-radius: 0;
  }

  .dg-pw-info {
    flex-direction: column;
    gap: 10px;
    padding: 15px;
  }

  .dg-pw-title {
    font-size: 20px;
  }

  .dg-pw-tools {
    justify-content: space-between;
    width: 100%;
    margin: 0;
  }

  .dg-pw-tool {
    width: 52px;
    height: 56px;
    font-size: 11px;
  }

  .dg-pw-side .dg-playlist {
    padding: 15px;
  }
}
