/* 播放器结构。各版本只改变量和少量外观 */
.pl {
  --pl-radius: 14px;
  --pl-fg: #fff;
  --pl-dim: rgba(255, 255, 255, .7);
  --pl-track: rgba(255, 255, 255, .26);
  --pl-buf: rgba(255, 255, 255, .42);
  --pl-fill: #fff;
  --pl-glass: rgba(28, 28, 32, .58);
  --pl-glass-edge: rgba(255, 255, 255, .14);
  --pl-hover: rgba(255, 255, 255, .14);
  --pl-menu: rgba(36, 36, 40, .86);
  --pl-accent: #fff;
  position: relative; outline: none; user-select: none; -webkit-user-select: none;
  font-variant-numeric: tabular-nums; -webkit-tap-highlight-color: transparent;
}
.pl-stage { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--pl-radius); overflow: hidden; isolation: isolate; }
.pl video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; display: block; cursor: pointer; }
.pl[data-idle] video { cursor: none; }
.pl button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.pl svg { width: 22px; height: 22px; display: block; }

/* 控件条：overlay 浮在画面上，below 放在画面下面 */
.pl-bar { color: var(--pl-fg); }
.pl[data-controls="overlay"] .pl-bar, .pl[data-fs] .pl-bar {
  position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 3;
  padding: 6px 10px 6px; border-radius: 16px;
  background: var(--pl-glass); -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%);
  box-shadow: inset 0 1px 0 var(--pl-glass-edge), 0 8px 30px rgba(0, 0, 0, .25);
  transition: opacity .22s ease, transform .3s cubic-bezier(.2, .9, .25, 1);
}
.pl[data-idle] .pl-bar { opacity: 0; transform: translateY(8px); pointer-events: none; }
.pl[data-controls="below"]:not([data-fs]) .pl-bar { padding: 10px 4px 2px; }

.pl-scrub { position: relative; height: 22px; display: flex; align-items: center; cursor: pointer; touch-action: none; outline: none; }
.pl-segs { display: flex; gap: 3px; width: 100%; height: 8px; align-items: center; }
.pl-seg { position: relative; height: 4px; border-radius: 4px; background: var(--pl-track); overflow: hidden; min-width: 2px; transition: height .16s ease; }
.pl[data-hover] .pl-seg, .pl[data-drag] .pl-seg { height: 6px; }
.pl[data-hover] .pl-seg.on, .pl[data-drag] .pl-seg.on { height: 9px; }
.pl-seg i { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0); }
.pl-buf { background: var(--pl-buf); }
.pl-fill { background: var(--pl-fill); }
.pl[data-loop] .pl-seg { opacity: .45; }
.pl[data-loop] .pl-seg.loop { opacity: 1; }
.pl-knob { position: absolute; left: -7px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--pl-fill); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); scale: 0; transition: scale .16s cubic-bezier(.2, .9, .3, 1.2); pointer-events: none; }
.pl[data-hover] .pl-knob, .pl[data-drag] .pl-knob, .pl-scrub:focus-visible .pl-knob { scale: 1; }
.pl[data-drag] .pl-knob { scale: 1.2; }
.pl-scrub:focus-visible .pl-segs { outline: 2px solid var(--pl-accent); outline-offset: 4px; border-radius: 4px; }

.pl-prev {
  position: absolute; left: 0; bottom: 30px; width: 200px; pointer-events: none; opacity: 0; translate: 0 6px;
  transition: opacity .15s ease, translate .2s ease; z-index: 4;
}
.pl[data-hover] .pl-prev, .pl[data-drag] .pl-prev { opacity: 1; translate: 0 0; }
.pl-pimg { width: 200px; height: 112px; border-radius: 10px; background: #111 no-repeat; box-shadow: 0 0 0 1px rgba(255, 255, 255, .22), 0 10px 30px rgba(0, 0, 0, .4); }
.pl-prev.noimg .pl-pimg { display: none; }
.pl-pmeta { margin: 6px auto 0; width: fit-content; max-width: 100%; text-align: center; color: #fff; line-height: 1.3; padding: 4px 9px; border-radius: 8px; background: rgba(20, 20, 24, .66); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.pl-ptime { display: block; font-size: 14px; font-weight: 650; }
.pl-pchap { display: block; font-size: 12px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl[data-controls="below"]:not([data-fs]) .pl-pmeta { color: var(--pl-fg); background: var(--pl-menu); box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }

.pl-row { display: flex; align-items: center; gap: 12px; height: 40px; }
.pl-grp { display: flex; align-items: center; gap: 2px; flex: none; }
.pl-btn { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--pl-fg); transition: background .12s ease, transform .1s ease; }
.pl-btn:hover { background: var(--pl-hover); }
.pl-btn:active { transform: scale(.9); }
.pl-btn:focus-visible, .pl-time:focus-visible { outline: 2px solid var(--pl-accent); outline-offset: 1px; }
html:not(.kbd) .pl :focus-visible { outline: none; }
.pl-loopbtn[aria-pressed="true"] { color: var(--pl-accent); background: var(--pl-hover); }
.pl-time { font-size: 13px; font-weight: 550; color: var(--pl-dim); padding: 4px 8px; border-radius: 8px; white-space: nowrap; }
.pl-time:hover { color: var(--pl-fg); }
.pl-chap { flex: 1; min-width: 0; text-align: center; font-size: 13px; font-weight: 550; color: var(--pl-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-chapn { font-weight: 650; color: var(--pl-fg); margin-right: 8px; }
.pl-rate { width: auto; min-width: 46px; padding: 0 8px; font-size: 13px; font-weight: 650; }
.pl[data-rate] .pl-rate { color: var(--pl-accent); }

.pl-volwrap { display: flex; align-items: center; }
.pl-vol { position: relative; width: 0; height: 22px; overflow: hidden; display: flex; align-items: center; cursor: pointer; touch-action: none; transition: width .22s cubic-bezier(.2, .9, .25, 1), margin .22s; outline: none; }
.pl-vol::before { content: ""; position: absolute; left: 0; right: 0; height: 4px; border-radius: 4px; background: var(--pl-track); }
.pl-volfill { position: absolute; left: 0; right: 0; height: 4px; border-radius: 4px; background: var(--pl-fill); transform-origin: 0 50%; }
.pl-volwrap:hover .pl-vol, .pl-vol:focus-visible, .pl-vol[data-drag] { width: 72px; margin: 0 8px 0 2px; }

.pl-ratewrap { position: relative; }
.pl-menu {
  position: absolute; bottom: calc(100% + 10px); left: 50%; translate: -50% 0; min-width: 96px; padding: 5px; border-radius: 14px; z-index: 6;
  background: var(--pl-menu); -webkit-backdrop-filter: blur(30px) saturate(170%); backdrop-filter: blur(30px) saturate(170%);
  box-shadow: inset 0 1px 0 var(--pl-glass-edge), 0 12px 40px rgba(0, 0, 0, .35);
  transform-origin: 50% 100%; scale: .92; opacity: 0; pointer-events: none; visibility: hidden; transition: scale .2s cubic-bezier(.2, .9, .3, 1.1), opacity .14s ease, visibility 0s linear .14s;
}
.pl-menu.open { scale: 1; opacity: 1; pointer-events: auto; visibility: visible; transition-delay: 0s; }
.pl-menu button { display: flex; width: 100%; padding: 7px 10px 7px 26px; border-radius: 9px; font-size: 13.5px; font-weight: 550; color: var(--pl-fg); position: relative; }
.pl-menu button:hover { background: var(--pl-hover); }
.pl-menu button[aria-checked="true"]::before { content: ""; position: absolute; left: 10px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--pl-accent); }

.pl-big {
  position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%; z-index: 2; display: grid; place-items: center;
  background: rgba(20, 20, 24, .5); -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 8px 30px rgba(0, 0, 0, .3); color: #fff !important;
  transition: opacity .2s ease, scale .25s cubic-bezier(.2, .9, .3, 1.2);
}
.pl-big svg { width: 32px; height: 32px; margin-left: 4px; }
.pl .pl-big { background: rgba(20, 20, 24, .5); }  /* .pl button 把背景清掉了，大播放钮要盖回来，浅色画面上才看得见 */
.pl-big:hover { scale: 1.06; }
.pl-big:active { scale: .94; }
.pl[data-state="playing"] .pl-big { opacity: 0; scale: .8; pointer-events: none; }

.pl-flash {
  position: absolute; left: 50%; top: 50%; z-index: 2; translate: -50% -50%; min-width: 72px; height: 72px; padding: 0 22px; border-radius: 36px;
  display: flex; align-items: center; justify-content: center; gap: 8px; color: #fff; font-size: 17px; font-weight: 650; pointer-events: none;
  background: rgba(20, 20, 24, .5); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); opacity: 0;
}
.pl-flash svg { width: 30px; height: 30px; }
.pl-flash.txt svg { width: 24px; height: 24px; }
.pl-flash.go { animation: pl-flash .6s ease-out; }
@keyframes pl-flash { 0% { opacity: 0; scale: .86; } 18% { opacity: 1; scale: 1; } 70% { opacity: 1; } 100% { opacity: 0; scale: 1.04; } }

.pl-toast {
  position: absolute; left: 16px; top: 16px; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 14px; border-radius: 12px; max-width: calc(100% - 32px);
  color: #fff; font-size: 13.5px; font-weight: 550; background: rgba(20, 20, 24, .62); -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14); opacity: 0; translate: 0 -6px; pointer-events: none; visibility: hidden; transition: opacity .2s ease, translate .3s cubic-bezier(.2, .9, .25, 1), visibility 0s linear .2s;
}
.pl-toast:empty { display: none; }
.pl-toast.show { opacity: 1; translate: 0 0; pointer-events: auto; visibility: visible; transition-delay: 0s; }
.pl-toast button { padding: 4px 10px; border-radius: 8px; background: rgba(255, 255, 255, .16) !important; font-size: 13px; font-weight: 650; }
.pl-toast button:hover { background: rgba(255, 255, 255, .26) !important; }

.pl-keys {
  position: absolute; right: 16px; top: 16px; z-index: 4; width: 280px; padding: 14px 16px; border-radius: 16px; color: #fff; font-size: 13px;
  background: rgba(20, 20, 24, .72); -webkit-backdrop-filter: blur(30px) saturate(160%); backdrop-filter: blur(30px) saturate(160%);
}
.pl-keys-h { font-weight: 650; margin-bottom: 8px; }
.pl-key { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; color: rgba(255, 255, 255, .78); }
.pl-key kbd { font: 600 12px/1.4 ui-monospace, "SF Mono", Menlo, monospace; color: #fff; }

.pl[data-wait] .pl-stage::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px; border-radius: 50%; z-index: 2;
  border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: pl-spin .8s linear infinite;
}
@keyframes pl-spin { to { rotate: 1turn; } }

.pl[data-fs] { background: #000; display: flex; flex-direction: column; justify-content: center; }
.pl[data-fs] .pl-stage { border-radius: 0; aspect-ratio: auto; height: 100%; }

@media (prefers-reduced-motion: reduce) {
  .pl *, .pl *::before { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .pl-flash.go { animation: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .pl-bar, .pl-menu, .pl-big, .pl-toast, .pl-keys, .pl-flash { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; background: #1c1c1f !important; }
}

/* 文档面板 */
.wg-sheet-back { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(0, 0, 0, 0); transition: background .25s ease; }
.wg-sheet-back.open { background: rgba(0, 0, 0, .42); }
.wg-sheet {
  width: min(980px, calc(100vw - 48px)); height: calc(100vh - 64px); display: flex; flex-direction: column; border-radius: 20px; overflow: hidden;
  background: var(--sheet-bg, #fff); color: var(--sheet-fg, #111); box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  scale: .6; opacity: 0; transition: scale .34s cubic-bezier(.2, .95, .25, 1), opacity .18s ease;
}
.wg-sheet-back.open .wg-sheet { scale: 1; opacity: 1; }
.wg-sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 12px 20px; border-bottom: 1px solid var(--sheet-line, rgba(0, 0, 0, .08)); }
.wg-sheet-head > div { flex: 1; min-width: 0; }
.wg-sheet-kind { font-size: 12px; opacity: .7; }
.wg-sheet-name { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wg-sheet-btn { font: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 10px; border: 0; cursor: pointer; text-decoration: none; color: inherit; background: var(--sheet-btn, rgba(0, 0, 0, .06)); }
.wg-sheet-btn:hover { filter: brightness(.95); }
.wg-sheet-doc { flex: 1; width: 100%; border: 0; background: #525659; }
@media (prefers-reduced-motion: reduce) { .wg-sheet, .wg-sheet-back { transition: opacity .15s ease !important; scale: 1 !important; } }

/* 搜索面板 */
.pal-back { position: fixed; inset: 0; z-index: 90; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; background: rgba(0, 0, 0, .32); opacity: 0; transition: opacity .18s ease; }
.pal-back.open { opacity: 1; }
.pal {
  width: min(640px, calc(100vw - 32px)); border-radius: 18px; overflow: hidden; color: var(--pal-fg, #111);
  background: var(--pal-bg, rgba(255, 255, 255, .9)); -webkit-backdrop-filter: blur(30px) saturate(170%); backdrop-filter: blur(30px) saturate(170%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 30px 80px rgba(0, 0, 0, .35); scale: .97; transition: scale .25s cubic-bezier(.2, .95, .25, 1);
}
.pal-back.open .pal { scale: 1; }
.pal-top { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--pal-line, rgba(0, 0, 0, .08)); }
.pal-top svg { width: 18px; height: 18px; opacity: .5; flex: none; }
.pal-in { flex: 1; height: 54px; border: 0; outline: 0; background: none; color: inherit; font: inherit; font-size: 17px; }
.pal-in::placeholder { color: var(--pal-dim, #888); }
.pal-list { max-height: min(56vh, 460px); overflow: auto; padding: 6px; overscroll-behavior: contain; }
.pal-h { padding: 10px 12px 4px; font-size: 12px; font-weight: 650; color: var(--pal-dim, #888); }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: inherit; text-decoration: none; }
.pal-item[aria-selected="true"] { background: var(--pal-sel, rgba(0, 0, 0, .06)); }
.pal-item .a { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item .b { font-size: 12.5px; color: var(--pal-dim, #888); white-space: nowrap; }
.pal-item .t { flex: none; width: 52px; font-size: 12.5px; font-weight: 650; color: var(--pal-accent, #06c); font-variant-numeric: tabular-nums; }
.pal-item mark { background: none; color: var(--pal-accent, #06c); }
.pal-none { padding: 26px 16px; text-align: center; color: var(--pal-dim, #888); font-size: 14px; }
.pal-foot { display: flex; gap: 16px; padding: 9px 16px; font-size: 12px; color: var(--pal-dim, #888); border-top: 1px solid var(--pal-line, rgba(0, 0, 0, .08)); }
.pal-foot kbd { font: inherit; font-weight: 650; }

/* 手机：收起次要按钮，进度条和播放、时间、循环、倍速、全屏留着 */
@media (max-width: 640px) {
  .pl[data-controls="overlay"]:not([data-fs]) .pl-bar { left: 8px; right: 8px; bottom: 8px; padding: 2px 6px; border-radius: 12px; }
  .pl-row { gap: 2px; height: 36px; }
  .pl-btn { width: 34px; height: 34px; }
  .pl-back, .pl-fwd, .pl-keysbtn, .pl-pipbtn, .pl-chap, .pl-vol { display: none; }
  .pl-time { font-size: 12px; padding: 4px 6px; }
  .pl-row > .pl-grp:last-child { margin-left: auto; }
  .pl-big { width: 60px; height: 60px; margin: -30px 0 0 -30px; }
  .pl-big svg { width: 26px; height: 26px; }
}
