/* ==========================================================================
   DAS Video Lightbox — 通用视频灯箱播放器
   用途：点击按钮 / 卡片播放按钮 → 小屏弹层播放，带播放控制条
   控件：播放暂停 / 可拖拽进度条 / 时间 / 静音 / 音量滑块 / 全屏 / 关闭
   命名空间：.das-vlb  （挂在 body 直属节点，不受 .legacy-content 全局规则影响）
   ========================================================================== */

.das-vlb {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 10, 14, .84);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity .26s ease;
}

.das-vlb.is-open {
  display: flex;
}

.das-vlb.is-visible {
  opacity: 1;
}

/* 弹层小屏窗口：桌面最大 880px，同时受视口宽度与 150vh（≈16:9 高度上限）约束 */
.das-vlb-stage {
  position: relative;
  width: min(880px, 92vw, 150vh);
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 42px 110px rgba(0, 0, 0, .62), 0 0 0 1px rgba(255, 255, 255, .08);
  transform: translateY(16px) scale(.975);
  opacity: 0;
  transition: transform .34s cubic-bezier(.34, 1.2, .64, 1), opacity .26s ease;
}

.das-vlb.is-visible .das-vlb-stage {
  transform: none;
  opacity: 1;
}

.das-vlb video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  outline: none;
}

/* 加载中提示 */
.das-vlb.is-loading .das-vlb-buffer {
  opacity: 1;
}

.das-vlb-buffer {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .22);
  border-top-color: #8cd23c;
  animation: das-vlb-spin .8s linear infinite;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
  z-index: 5;
}

@keyframes das-vlb-spin {
  to { transform: rotate(360deg); }
}

/* ---------- 关闭按钮 ---------- */
.das-vlb-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 8;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(10, 14, 18, .6);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .2s ease, transform .2s ease;
}

.das-vlb-close:hover {
  background: rgba(10, 14, 18, .92);
  transform: scale(1.07);
}

.das-vlb-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

/* ---------- 中央播放按钮 ---------- */
.das-vlb-bigplay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 50%;
  background: rgba(255, 255, 255, .94);
  color: #10161c;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .42), 0 0 0 8px rgba(255, 255, 255, .08);
  transition: transform .28s cubic-bezier(.34, 1.4, .64, 1), opacity .24s ease, visibility .24s;
}

.das-vlb-bigplay:hover {
  transform: translate(-50%, -50%) scale(1.08);
}

.das-vlb-bigplay svg {
  width: 26px;
  height: 26px;
  margin-left: 4px;
  fill: currentColor;
}

/* 播放中 / 暂停时的中央按钮可见性 —— 与控件条联动 */
.das-vlb.is-playing .das-vlb-bigplay,
.das-vlb.is-playing .das-vlb-buffer {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.das-vlb.is-playing.is-loading .das-vlb-buffer {
  opacity: 1;
  visibility: visible;
}

/* 播放中且鼠标静止 2.4s（.is-idle）时隐藏控件条，避免遮挡画面
   注意：关闭按钮始终保持可见（减弱不透明度），否则播放中无法点关闭 */
.das-vlb.is-idle .das-vlb-controls {
  opacity: 0;
  pointer-events: none;
}

.das-vlb.is-idle .das-vlb-close {
  opacity: .38;
}

.das-vlb.is-idle .das-vlb-close:hover {
  opacity: 1;
}

.das-vlb.is-idle .das-vlb-stage {
  cursor: none;
}

.das-vlb.is-idle .das-vlb-close {
  cursor: pointer;
}

/* ---------- 底部控件条 ---------- */
.das-vlb-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 12px;
  background: linear-gradient(0deg, rgba(0, 0, 0, .86) 0%, rgba(0, 0, 0, .58) 38%, rgba(0, 0, 0, .18) 72%, rgba(0, 0, 0, 0) 100%);
  color: #fff;
  opacity: 0;
  transition: opacity .25s ease;
}

.das-vlb:hover .das-vlb-controls,
.das-vlb.is-paused .das-vlb-controls {
  opacity: 1;
}

.das-vlb-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .2s ease;
}

.das-vlb-btn:hover {
  background: rgba(255, 255, 255, .18);
}

.das-vlb-btn svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

/* 进度条 */
.das-vlb-progress {
  position: relative;
  flex: 1 1 auto;
  min-width: 70px;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.das-vlb-progress::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .38);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  transition: height .15s ease;
}

.das-vlb-progress:hover::before,
.das-vlb-progress.is-drag::before {
  height: 6px;
}

.das-vlb-bar {
  position: absolute;
  left: 0;
  top: 50%;
  height: 4px;
  width: 0;
  border-radius: 2px;
  transform: translateY(-50%);
  transition: height .15s ease;
}

.das-vlb-progress:hover .das-vlb-bar,
.das-vlb-progress.is-drag .das-vlb-bar {
  height: 6px;
}

.das-vlb-bar {
  background: #8cd23c;
}

.das-vlb-knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 7px rgba(0, 0, 0, .45);
  opacity: 0;
  transition: opacity .18s ease;
  pointer-events: none;
}

.das-vlb-progress:hover .das-vlb-knob,
.das-vlb-progress.is-drag .das-vlb-knob,
.das-vlb-volume:hover .das-vlb-knob,
.das-vlb-volume.is-drag .das-vlb-knob {
  opacity: 1;
}

/* 时间 */
.das-vlb-time {
  flex: 0 0 auto;
  font-size: 12px;
  line-height: 1;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
  color: rgba(255, 255, 255, .92);
  white-space: nowrap;
}

/* 音量 */
.das-vlb-volume {
  position: relative;
  flex: 0 0 auto;
  width: 82px;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.das-vlb-volume::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .38);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  transition: height .15s ease;
}

.das-vlb-volume:hover::before,
.das-vlb-volume.is-drag::before {
  height: 6px;
}

.das-vlb-volume .das-vlb-bar {
  background: #fff;
}

.das-vlb.is-muted .das-vlb-volume .das-vlb-bar {
  width: 0 !important;
}

.das-vlb.is-muted .das-vlb-volume .das-vlb-knob {
  left: 0 !important;
}

/* 全屏 */
.das-vlb-stage:fullscreen,
.das-vlb-stage:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
  transform: none;
}

/* 滚动锁定 */
html.das-vlb-lock,
body.das-vlb-lock {
  overflow: hidden !important;
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .das-vlb {
    padding: 12px;
  }

  .das-vlb-stage {
    width: min(100%, 560px);
  }

  .das-vlb-controls {
    gap: 8px;
    padding: 16px 12px 10px;
  }

  .das-vlb-time {
    font-size: 11px;
  }

  .das-vlb-volume {
    width: 58px;
  }

  .das-vlb-btn {
    width: 32px;
    height: 32px;
  }

  .das-vlb-bigplay {
    width: 58px;
    height: 58px;
  }

  .das-vlb-bigplay svg {
    width: 22px;
    height: 22px;
  }
}
