/* 相册视频播放器（自绘控件，替代浏览器原生 controls）
 * 设计要点：海报先行 → 点播放才建立连接 → 浏览器按 Range 分段拉流
 * 进度条分块显示已缓冲区间，直观体现「分段加载」
 */

.mp {
  position: relative;
  width: min(94vw, 900px);
  aspect-ratio: 16 / 9;
  background: #0a110f;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: pan-y;
  outline: none;
}
.mp-stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #000;
}
.mp-poster {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%; object-fit: contain;
  background: linear-gradient(135deg, #16211e, #0a110f);
  transition: opacity .32s ease;
}
/* 全局懒加载 img.miyo-img.on{opacity:1} 特异性更高，这里必须 !important + visibility，
   否则封面会一直盖在 <video> 上，出现「进度条在动画面不动」。JS 侧另有 inline !important 兜底。 */
.mp-poster.hide { opacity: 0 !important; visibility: hidden; pointer-events: none; }
.mp-video {
  width: 100%; height: 100%; object-fit: contain; display: block;
  background: #000; opacity: 0; transition: opacity .3s ease;
}
.mp-video.on { opacity: 1; }
.mp-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  color: rgba(232, 244, 240, .62); font-size: 12px; letter-spacing: .1em;
}
.mp-fallback i { font-size: 30px; opacity: .7; }

/* 大播放键 */
.mp-big {
  position: absolute; z-index: 3; left: 50%; top: 50%;
  width: 62px; height: 62px; margin: -31px 0 0 -31px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: linear-gradient(135deg, rgba(74, 124, 111, .96), rgba(137, 170, 161, .92));
  color: #fff; box-shadow: 0 10px 28px rgba(20, 45, 38, .45), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .2s ease, opacity .2s ease;
}
.mp-big svg { width: 24px; height: 24px; margin-left: 2px; }
.mp-big:active { transform: scale(.93); }
.mp-big.hide { opacity: 0; pointer-events: none; transform: scale(.8); }

/* 时长角标 */
.mp-dur {
  position: absolute; right: 10px; top: 10px; z-index: 3;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(10, 20, 17, .58); color: #eaf4f0;
  font-size: 11px; letter-spacing: .4px; font-variant-numeric: tabular-nums;
  backdrop-filter: blur(6px);
}

/* 加载中 */
.mp-spin {
  position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.mp-spin.on { opacity: 1; }
.mp-spin i {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .22); border-top-color: #9fd8c8;
  animation: mpSpin .8s linear infinite;
}
@keyframes mpSpin { to { transform: rotate(360deg); } }

/* 拖动提示 */
.mp-tip {
  position: absolute; z-index: 6; left: 50%; top: 18%;
  transform: translateX(-50%) scale(.96); opacity: 0;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(12, 22, 19, .72); color: #eaf4f0; font-size: 12.5px;
  letter-spacing: .4px; font-variant-numeric: tabular-nums;
  transition: opacity .18s ease, transform .18s ease; pointer-events: none;
  backdrop-filter: blur(6px);
}
.mp-tip.on { opacity: 1; transform: translateX(-50%) scale(1); }

/* 出错 */
.mp-err {
  position: absolute; inset: 0; z-index: 7; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(8, 15, 13, .9); color: #dfece8; font-size: 13px;
}
.mp-err.on { display: flex; }
.mp-err button {
  border: 0; border-radius: 999px; padding: 8px 18px; cursor: pointer;
  background: rgba(74, 124, 111, .92); color: #fff; font: inherit; font-size: 13px;
}

/* 控制条 */
.mp-ctrl {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: 26px 10px 9px;
  background: linear-gradient(180deg, rgba(6, 12, 10, 0), rgba(5, 10, 8, .9));
  transition: opacity .26s ease, transform .26s ease;
}
.mp.no-chrome .mp-ctrl { opacity: 0; pointer-events: none; transform: translateY(8px); }
.mp.no-chrome .mp-dur { opacity: 0; }
.mp-btn {
  width: 30px; height: 30px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 9px; background: transparent;
  color: #e8f2ee; cursor: pointer; font: inherit; font-size: 11.5px;
  transition: background .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.mp-btn:active { background: rgba(255, 255, 255, .16); }
.mp-btn svg { width: 17px; height: 17px; }
.mp-btn.mp-rate { font-weight: 700; letter-spacing: .2px; }
.mp-time {
  flex: none; color: #dcebe6; font-size: 11.5px; letter-spacing: .3px;
  font-variant-numeric: tabular-nums; padding: 0 2px;
}
.mp-time b { font-weight: 500; color: #fff; }

/* 进度条：底层轨道 + 已缓冲分段 + 已播放 + 拖拽点 */
.mp-track {
  position: relative; flex: 1 1 auto; height: 22px; min-width: 40px;
  display: flex; align-items: center; cursor: pointer;
  touch-action: none;
}
.mp-track::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  height: 4px; margin-top: -2px; border-radius: 99px;
  background: rgba(255, 255, 255, .20);
}
.mp-buf { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; }
.mp-seg {
  position: absolute; top: 0; height: 100%; border-radius: 99px;
  background: rgba(210, 238, 230, .42);
}
.mp-played {
  position: absolute; left: 0; top: 50%; height: 4px; margin-top: -2px;
  border-radius: 99px; width: 0;
  background: linear-gradient(90deg, #a9dccd, #5d9e8e);
}
.mp-knob {
  position: absolute; top: 50%; left: 0; width: 11px; height: 11px;
  margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
  opacity: 0; transition: opacity .16s ease;
}
.mp:hover .mp-knob, .mp.scrubbing .mp-knob { opacity: 1; }

/* 音量 */
.mp-vol { display: flex; align-items: center; flex: none; }
.mp-vol-track {
  width: 0; height: 4px; border-radius: 99px; overflow: hidden;
  background: rgba(255, 255, 255, .26); cursor: pointer;
  transition: width .22s ease, margin-left .22s ease;
}
.mp:hover .mp-vol-track, .mp.vol-open .mp-vol-track { width: 54px; margin-left: 6px; }
.mp-vol-track i {
  display: block; height: 100%; width: 100%; border-radius: 99px;
  background: #cfeee4; transform-origin: left center;
}

/* 全屏 */
.mp:fullscreen, .mp:-webkit-full-screen {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  aspect-ratio: auto !important; border-radius: 0; box-shadow: none;
}
.mp:fullscreen .mp-video, .mp:-webkit-full-screen .mp-video { height: 100%; }

@media (max-width: 560px) {
  .mp { width: 100%; border-radius: 10px; }
  .mp-ctrl { gap: 5px; padding: 22px 7px 7px; }
  .mp-btn { width: 30px; height: 30px; }
  .mp-btn svg { width: 17px; height: 17px; }
  .mp-time { font-size: 10.5px; padding: 0; }
  .mp-vol, .mp-btn.mp-pip { display: none; }
  .mp-big { width: 54px; height: 54px; margin: -27px 0 0 -27px; }
  .mp-big svg { width: 21px; height: 21px; }
  .mp-dur { top: 8px; right: 8px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .mp-big, .mp-ctrl, .mp-tip, .mp-poster, .mp-video { transition: none; }
}
