/* ==========================================================================
   冰哥短剧 · 播放器样式（v5，完整重写；其它文件里没有任何 .pl 规则）
   竖屏 = 红果短剧形态      横屏 = 爱奇艺 / 腾讯 / 优酷 / 芒果形态
   规则：
     · 竖屏：竖版画面铺满，两侧封面虚化补边
     · 横屏：纯黑底；横版素材(漫剧)自动铺满整屏且完整；竖版素材(短剧)完整显示，两侧黑边，绝不裁人
   ========================================================================== */

.pl {
  position: fixed; inset: 0; z-index: 100; background: #000; overflow: hidden;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
.pl-stage { position: absolute; inset: 0; overflow: hidden; }

/* 底图（封面虚化）：只在竖屏时给横版素材补边；横屏一律纯黑 */
.pl-bg {
  position: absolute; inset: 0; z-index: 1;
  background-size: cover; background-position: center;
  filter: blur(34px) brightness(.30) saturate(1.15); transform: scale(1.24);
  transition: opacity .3s;
}
.pl[data-mode="landscape"] .pl-bg { display: none; }

/* 画面主体 */
.pl-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 2; display: block; background: #000;
  object-fit: contain; object-position: 50% 50%;
}
.pl[data-fit="cover"] .pl-video { object-fit: cover; object-position: 50% 32%; }

/* 弹幕 */
.pl-dm { position: absolute; left: 0; right: 0; top: 8%; height: 40%; overflow: hidden; pointer-events: none; z-index: 3; }
.pl[data-mode="landscape"] .pl-dm { top: 12%; height: 46%; }
.pl-dm .dm {
  position: absolute; left: 100%; white-space: nowrap; font-size: 13px; font-weight: 600; color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .95), 0 0 3px rgba(0, 0, 0, .7);
  animation-name: dm-run; animation-timing-function: linear; animation-fill-mode: forwards; will-change: transform;
}
@keyframes dm-run { from { transform: translateX(0); } to { transform: translateX(calc(-100% - 100vw)); } }

/* 中央播放键（暂停时出现，点了立即播） */
.pl-center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 76px; height: 76px; z-index: 9; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  background: rgba(0, 0, 0, .42); border: 1.5px solid rgba(255, 255, 255, .3);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: opacity .18s, transform .18s; opacity: 1;
}
.pl-center svg { width: 38px; height: 38px; margin-left: 3px; }
.pl-center:active { transform: translate(-50%, -50%) scale(.94); }
.pl.playing .pl-center { opacity: 0; pointer-events: none; }
.pl.clean .pl-center { display: none !important; }

/* 加载 */
.pl-loading { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 8; display: none; }
.pl-loading.on { display: block; }
.pl-loading i {
  display: block; width: 30px; height: 30px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .2); border-top-color: #ff2d55; animation: plspin .8s linear infinite;
}
@keyframes plspin { to { transform: rotate(360deg); } }

/* ===== UI 层：不吃点击，只有按钮/控件吃 ===== */
.pl .ui { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.pl[data-mode="portrait"] .ui-l { display: none; }
.pl[data-mode="landscape"] .ui-p { display: none; }
.pl .ui button, .pl .ui .pl-bar, .pl .ui .pl-strip { pointer-events: auto; }

.pl-ico {
  width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center;
  color: #fff; background: rgba(0, 0, 0, .34); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.pl-ico svg { width: 22px; height: 22px; }
.pl-ico:active { background: rgba(0, 0, 0, .55); }

/* ---------------- 竖屏（红果） ---------------- */
.pl-p-top {
  position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 10px;
  padding: calc(8px + var(--safe-t)) 12px 26px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .62), transparent);
}
.pl-p-title { flex: 1; min-width: 0; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); }
.pl-p-title b { display: block; font-size: 15.5px; }
.pl-p-title span { font-size: 11.5px; color: rgba(255, 255, 255, .72); }
.pl-p-top .pl-ico.orient {
  width: auto; height: 34px; padding: 0 12px; border-radius: 17px;
  display: flex; align-items: center; gap: 5px; font-size: 12.5px;
}
.pl-p-top .pl-ico.orient svg { width: 17px; height: 17px; }

.pl-p-rail {
  position: absolute; right: 8px; bottom: calc(168px + var(--safe-b));
  display: flex; flex-direction: column; align-items: center; gap: 18px; z-index: 11;
}
.pl-p-rail button {
  display: flex; flex-direction: column; align-items: center; gap: 4px; width: 54px;
  color: #fff; font-size: 10.5px; text-shadow: 0 1px 5px rgba(0, 0, 0, .8);
}
.pl-p-rail button svg { width: 28px; height: 28px; filter: drop-shadow(0 1px 4px rgba(0, 0, 0, .55)); }
.pl-p-rail button.on { color: #ff4d6a; }

.pl-p-foot {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 14px calc(12px + var(--safe-b));
  background: linear-gradient(0deg, rgba(0, 0, 0, .9) 12%, rgba(0, 0, 0, .55) 55%, transparent);
  color: #fff;
}
.pl-ft-title { display: flex; align-items: center; gap: 8px; padding-right: 62px; }
.pl-ft-title b { font-size: 16px; max-width: 68%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-chip { flex: none; font-size: 11px; padding: 4px 10px; border-radius: 999px; background: rgba(255, 45, 85, .88); color: #fff; }
.pl-ft-desc {
  margin: 7px 62px 0 0; font-size: 12px; line-height: 1.55; color: rgba(255, 255, 255, .68);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* 进度条 */
.pl-bar { display: flex; align-items: center; gap: 9px; margin-top: 11px; }
.pl-time { font-size: 11px; color: rgba(255, 255, 255, .82); font-variant-numeric: tabular-nums; flex: none; }
.pl-track {
  position: relative; flex: 1; height: 3px; border-radius: 2px;
  background: rgba(255, 255, 255, .26); touch-action: none;
}
.pl-track .pl-buf { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255, 255, 255, .4); border-radius: 2px; }
.pl-track .pl-play { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #ff2d55, #ff6a3d); border-radius: 2px; z-index: 2; }
.pl-track .pl-knob {
  position: absolute; top: 50%; left: 0; width: 11px; height: 11px; border-radius: 50%; background: #fff;
  transform: translate(-50%, -50%); box-shadow: 0 0 6px rgba(0, 0, 0, .6); z-index: 3;
}
.pl-track::before { content: ''; position: absolute; left: 0; right: 0; top: -9px; bottom: -9px; }

.pl-p-tools { display: flex; align-items: center; gap: 6px; margin-top: 6px; overflow-x: auto; scrollbar-width: none; }
.pl-p-tools::-webkit-scrollbar { display: none; }
.pl-p-tools button {
  flex: none; display: flex; align-items: center; gap: 4px; height: 30px; padding: 0 9px; border-radius: 8px;
  font-size: 11.5px; color: rgba(255, 255, 255, .94); background: rgba(255, 255, 255, .12); white-space: nowrap;
}
.pl-p-tools button svg { width: 16px; height: 16px; }
.pl-p-tools button.on { background: rgba(255, 45, 85, .9); }
.pl-p-tools .sp { flex: 1; }

.pl-strip { display: flex; gap: 7px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.pl-strip::-webkit-scrollbar { display: none; }
.pl-strip button {
  flex: none; min-width: 40px; height: 32px; padding: 0 11px; border-radius: 8px;
  font-size: 12.5px; color: rgba(255, 255, 255, .8); background: rgba(255, 255, 255, .1);
}
.pl-strip button.on { background: #ff2d55; color: #fff; font-weight: 700; }

/* ---------------- 横屏（爱奇艺 / 腾讯 / 优酷 / 芒果） ---------------- */
.pl-l-top {
  position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px 30px; background: linear-gradient(180deg, rgba(0, 0, 0, .66), transparent);
}
.pl-l-title { flex: 1; min-width: 0; color: #fff; display: flex; align-items: baseline; gap: 10px; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); }
.pl-l-title b { font-size: 16px; max-width: 56%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-l-title span { font-size: 12px; color: rgba(255, 255, 255, .7); }

.pl-l-foot {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 18px 14px;
  background: linear-gradient(0deg, rgba(0, 0, 0, .86) 18%, rgba(0, 0, 0, .42) 62%, transparent);
}
.pl-l-foot .pl-bar { margin: 0 0 8px; }
.pl-l-tools { display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.pl-l-tools::-webkit-scrollbar { display: none; }
.pl-tool {
  flex: none; display: flex; align-items: center; gap: 5px; height: 34px; padding: 0 10px; border-radius: 8px;
  font-size: 12.5px; color: rgba(255, 255, 255, .92); white-space: nowrap;
}
.pl-tool svg { width: 19px; height: 19px; }
.pl-tool:active, .pl-tool.on { background: rgba(255, 255, 255, .16); }
.pl-tool.strong { background: rgba(255, 255, 255, .16); font-weight: 700; padding: 0 14px; }
.pl-l-tools .sp { flex: 1; min-width: 8px; }

/* 自动隐藏 / 清屏 */
.pl.hide-ui .ui { opacity: 0; pointer-events: none; transition: opacity .22s; }
.pl.hide-ui { cursor: none; }
.pl.clean .ui { opacity: 0 !important; visibility: hidden !important; pointer-events: none !important; }
.pl.clean .pl-tip, .pl.clean #codec-tip { display: none !important; }

.pl-clean-exit {
  position: absolute; right: 14px; bottom: calc(16px + var(--safe-b)); z-index: 30;
  padding: 8px 14px; border-radius: 999px; font-size: 12px; color: #fff;
  background: rgba(0, 0, 0, .5); border: 1px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(8px); transition: opacity .6s;
}
.pl-clean-exit.fade { opacity: .34; }

/* ---------------- 弹层 ---------------- */
.pl-mask { position: absolute; inset: 0; z-index: 20; background: rgba(0, 0, 0, .58); opacity: 0; visibility: hidden; transition: .2s; }
.pl-mask.on { opacity: 1; visibility: visible; }
.pl-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 76%; overflow-y: auto;
  background: #17171d; border-radius: 16px 16px 0 0; padding: 6px 0 calc(16px + var(--safe-b));
  transform: translateY(102%); transition: transform .24s ease; visibility: hidden;
}
.pl-sheet.on { transform: translateY(0); visibility: visible; }
.pl-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 10px; }
.pl-sheet-head b { font-size: 14.5px; color: #f2f2f6; }
.pl-sheet-head b small { font-size: 11.5px; color: #8b8b97; font-weight: 400; margin-left: 6px; }
.pl-sheet-x { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #b9b9c4; background: rgba(255, 255, 255, .08); }
.pl-sheet-x svg { width: 18px; height: 18px; }
.pl-opts { display: grid; gap: 8px; padding: 4px 16px 8px; }
.pl-opts button {
  height: 44px; border-radius: 10px; background: rgba(255, 255, 255, .07); color: #f2f2f6; font-size: 13.5px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2;
}
.pl-opts button small { font-size: 9.5px; color: #8b8b97; }
.pl-opts button.on { background: #e6002f; color: #fff; font-weight: 700; }
.pl-opts.ep button { height: 40px; font-size: 13px; }
.pl-sheet-tip { padding: 2px 16px 10px; font-size: 11.5px; color: #8b8b97; }

/* 播放异常 / 编码提示 */
.pl-tip {
  position: absolute; left: 12px; right: 12px; top: calc(58px + var(--safe-t)); z-index: 22; max-width: 430px;
  padding: 13px 14px; border-radius: 13px; background: rgba(20, 20, 24, .96);
  border: 1px solid rgba(255, 255, 255, .14); color: #f2f2f6; font-size: 12.5px; line-height: 1.65;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .55);
}
.pl-tip-tx b { display: block; color: #ff8095; font-size: 13px; margin-bottom: 3px; }
.pl-tip-tx span { color: rgba(255, 255, 255, .72); }
.pl-tip-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pl-tip-btns button { padding: 7px 13px; border-radius: 9px; font-size: 12px; background: rgba(255, 255, 255, .1); color: #fff; }
.pl-tip-btns button.on { background: #e6002f; font-weight: 700; }
.pl[data-mode="landscape"] .pl-tip { left: 18px; right: auto; top: auto; bottom: 92px; width: 440px; max-width: calc(100vw - 36px); }

/* 深链打开时的整页 loading */
.pl-loading-page {
  position: fixed; inset: 0; z-index: 120; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; background: #000; color: #8b8b97; font-size: 12.5px;
}
.pl-loading-page i {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .2); border-top-color: #ff2d55; animation: plspin .8s linear infinite;
}

/* 小屏压缩 */
@media (max-width: 400px) {
  .pl-p-tools button { font-size: 11px; padding: 0 8px; }
  .pl-ft-title b { font-size: 15px; }
  .pl-p-rail { bottom: calc(176px + var(--safe-b)); gap: 15px; }
}
@media (orientation: landscape) and (max-height: 460px) {
  .pl-l-top { padding: 6px 14px 22px; }
  .pl-l-foot { padding: 30px 14px 8px; }
  .pl-tool { height: 30px; font-size: 12px; }
  .pl-l-title b { font-size: 15px; }
}
