/* ==========================================================================
   作品视频播放器 · 与站点墨黑 / 牛血红 / 等宽字体体系一致
   ========================================================================== */
.modal-media-box:has(.zp) { background: transparent; overflow: visible; }

.zp {
  --zp-accent: #c9908a;
  --zp-max-h: min(64vh, 680px);
  position: relative;
  isolation: isolate;
  width: min(100%, calc(var(--zp-max-h) * var(--zp-r, 1.7778)));
  aspect-ratio: var(--zp-r, 16 / 9);
  margin-inline: auto;
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 40%, #1d1b1f 0%, #0b0b0d 70%);
  box-shadow: 0 22px 50px rgba(14, 14, 16, .16), 0 0 0 1px rgba(14, 14, 16, .06);
  color: #fff;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.zp:focus-visible { box-shadow: 0 22px 50px rgba(14, 14, 16, .16), 0 0 0 2px #fff, 0 0 0 4px var(--oxblood); }
.zp video {
  position: absolute; inset: 0;
  width: 100% !important; height: 100% !important; max-height: none !important;
  object-fit: contain; background: transparent; cursor: pointer;
}
.zp.is-portrait { --zp-max-h: min(70vh, 720px); }
.zp.is-fullscreen { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; }

/* 底部渐变遮罩，保证白色控件在任意画面上可读 */
.zp::after {
  content: ""; position: absolute; inset: auto 0 0; height: 46%; z-index: 1; pointer-events: none;
  background: linear-gradient(to top, rgba(8, 8, 10, .72), rgba(8, 8, 10, .28) 45%, transparent);
  transition: opacity .4s var(--ease-out, ease);
}
.zp.is-ready.is-idle::after, .zp.is-ready.is-idle-start::after { opacity: 0; }

/* ---------- 中央大播放键 ---------- */
.zp-big {
  position: absolute; z-index: 3; left: 50%; top: 50%;
  display: none; align-items: center; gap: 12px;
  padding: 10px 22px 10px 12px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, .34); border-radius: 999px;
  background: rgba(20, 18, 22, .42);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  color: #fff; font: 500 13px/1 var(--type-mono); letter-spacing: .08em;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .28);
  cursor: pointer;
  transition: transform .35s var(--ease-out, ease), background .25s, opacity .3s;
}
.zp-big svg { width: 40px; height: 40px; padding: 11px 9px 11px 13px; border-radius: 50%; background: #fff; fill: var(--ink); }
.zp-big:hover { transform: translate(-50%, -50%) scale(1.04); background: rgba(91, 26, 26, .62); }
.zp-big:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
/* 只在开始前、播完后出现；中途暂停交给控制条，避免遮挡画面 */
.zp.is-ready.is-idle-start:not(.is-loading):not(.is-error) .zp-big,
.zp.is-ready.is-ended:not(.is-playing) .zp-big { display: inline-flex; }
.zp.is-ended .zp-big span::before { content: "重播 · "; }
.zp.has-resume .zp-big span::before { content: "继续 · "; }

/* ---------- 缓冲指示 ---------- */
.zp-spinner {
  position: absolute; z-index: 3; left: 50%; top: 50%; width: 42px; height: 42px; margin: -21px 0 0 -21px;
  border-radius: 50%; border: 2px solid rgba(255, 255, 255, .18); border-top-color: #fff;
  opacity: 0; pointer-events: none; transition: opacity .2s;
  animation: zp-spin .9s linear infinite;
}
.zp.is-loading .zp-spinner { opacity: 1; transition-delay: .18s; }
@keyframes zp-spin { to { transform: rotate(360deg); } }

/* ---------- 出错兜底 ---------- */
.zp-error {
  position: absolute; z-index: 4; inset: 0; display: grid; place-content: center; gap: 14px;
  padding: 24px; text-align: center; background: rgba(10, 10, 12, .82);
  font-size: 13px; line-height: 1.7; color: rgba(255, 255, 255, .86);
}
.zp-error[hidden] { display: none; }
.zp-error p { margin: 0; max-width: 30em; }
.zp-error div { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.zp-error button, .zp-error a {
  padding: 8px 16px; border-radius: 999px; font-size: 12px; color: #fff; text-decoration: none;
  border: 1px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .08); cursor: pointer;
}
.zp-error button { background: #fff; color: var(--ink); border-color: #fff; }

/* ---------- 控制条 ---------- */
.zp-bar {
  position: absolute; z-index: 2; left: 10px; right: 10px; bottom: 10px;
  display: flex; align-items: center; gap: 4px;
  padding: 4px 6px; border-radius: 12px;
  font: 500 11px/1 var(--type-mono); letter-spacing: .02em;
  opacity: 1; transform: none;
  transition: opacity .35s var(--ease-out, ease), transform .35s var(--ease-out, ease);
}
.zp:not(.is-ready) .zp-bar,
.zp:not(.is-ready) .zp-big { display: none; }
.zp.is-idle .zp-bar, .zp.is-idle-start .zp-bar { opacity: 0; transform: translateY(6px); pointer-events: none; }
.zp.is-idle { cursor: none; }
.zp.is-idle video { cursor: none; }

.zp-btn {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px;
  border: 0; border-radius: 9px; background: transparent; color: #fff; cursor: pointer;
  transition: background .2s;
}
.zp-btn svg { width: 19px; height: 19px; fill: currentColor; }
.zp-btn:hover { background: rgba(255, 255, 255, .14); }
.zp-btn:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.zp-rate { width: auto; min-width: 38px; padding: 0 6px; font: inherit; font-size: 11px; }

.zp-time { flex: none; display: flex; gap: 5px; padding: 0 6px 0 2px; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, .7); }
.zp-time b { font-weight: 500; color: #fff; }
.zp-time i { font-style: normal; opacity: .5; }

/* 进度条：缓冲（浅）+ 已播（红）+ 拖柄 */
.zp-track { position: relative; flex: 1; min-width: 60px; height: 30px; display: flex; align-items: center; cursor: pointer; touch-action: none; outline: none; }
.zp-rail { position: relative; width: 100%; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .2); overflow: hidden; transition: height .2s var(--ease-out, ease); }
.zp-buffered, .zp-played { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; }
.zp-buffered { background: rgba(255, 255, 255, .34); transition: width .3s linear; }
.zp-played { background: linear-gradient(90deg, #fff, var(--zp-accent)); }
.zp-thumb {
  position: absolute; top: 50%; left: 0; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px;
  border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(201, 144, 138, .35), 0 2px 6px rgba(0, 0, 0, .4);
  transform: scale(0); transition: transform .2s var(--ease-out, ease);
}
.zp-track:hover .zp-rail, .zp-track:focus-visible .zp-rail, .zp.is-scrubbing .zp-rail { height: 5px; }
.zp-track:hover .zp-thumb, .zp-track:focus-visible .zp-thumb, .zp.is-scrubbing .zp-thumb { transform: scale(1); }
.zp-track:focus-visible .zp-rail { box-shadow: 0 0 0 2px rgba(255, 255, 255, .5); }
.zp-tip {
  position: absolute; bottom: 30px; left: 0; transform: translateX(-50%);
  padding: 5px 8px; border-radius: 7px; background: rgba(14, 14, 16, .86); color: #fff;
  font: inherit; font-variant-numeric: tabular-nums; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.zp-track:hover .zp-tip, .zp.is-scrubbing .zp-tip { opacity: 1; }

.zp-vol { display: flex; align-items: center; }
.zp-vol input {
  --v: 100%;
  width: 0; opacity: 0; margin: 0; height: 3px; border-radius: 3px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background: linear-gradient(90deg, #fff var(--v), rgba(255, 255, 255, .25) var(--v));
  transition: width .25s var(--ease-out, ease), opacity .2s, margin .25s;
}
.zp-vol:hover input, .zp-vol:focus-within input { width: 64px; opacity: 1; margin: 0 8px 0 2px; }
.zp-vol input::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 0; }
.zp-vol input::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 0; }

/* ---------- 片段切换：带缩略图与时长 ---------- */
.modal-clip-tabs { gap: 8px; }
.clip-tab {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 4px 12px 4px 4px; border-radius: 12px;
  border: 1px solid #e3e3e8; background: #fff; color: #3a3a42;
  font-size: 12px; line-height: 1.3; text-align: left; cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.clip-tab:hover { border-color: #c9c9d0; }
.clip-tab.is-active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); background: #fafafb; }
.clip-tab__thumb {
  position: relative; flex: none; width: 52px; height: 34px; border-radius: 8px; overflow: hidden; background: #111;
}
.clip-tab__thumb img { width: 100%; height: 100%; object-fit: cover; }
.clip-tab__thumb em {
  position: absolute; right: 3px; bottom: 3px; padding: 1px 4px; border-radius: 4px;
  background: rgba(10, 10, 12, .78); color: #fff; font: 500 9px/1.3 var(--type-mono); font-style: normal;
}
.clip-tab__text { display: grid; gap: 2px; }
.clip-tab__text small { font: 500 9px/1 var(--type-mono); letter-spacing: .1em; color: #8a8a93; text-transform: uppercase; }

@media (max-width: 640px) {
  .zp { border-radius: 12px; --zp-max-h: 62svh; }
  .zp-bar { left: 4px; right: 4px; bottom: 4px; gap: 0; }
  .zp-rate, .zp-vol input, [data-zp-pip] { display: none; }
  .zp-btn { width: 32px; height: 32px; }
  .zp-big { padding: 8px 16px 8px 8px; }
}
@media (hover: none) {
  .zp-vol input { display: none; }
  .zp-thumb { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .zp *, .zp::after { transition: none !important; }
  .zp-spinner { animation-duration: 2.4s; }
}
