/* ==========================================================================
   海角短剧 · 播放页 /drama/<id>/play/?ep=N
   全屏竖版沉浸式播放：9:16 舞台居中，宽屏两侧用封面色模糊铺底；
   上滑 / 滚轮 / 方向键切集，右侧操作栏，底部选集面板。独立页面，不加载 style.css / app.js。
   ========================================================================== */
:root {
  --bg: #000;
  --surface: #17171e;
  --brand: #1ea0f8;
  --brand-soft: #5cc2ff;
  --accent: #ffb03a;
  --like: #ff4d6d;
  --text: #f4f4f6;
  --text-dim: rgba(255, 255, 255, .72);
  --text-faint: rgba(255, 255, 255, .45);
  --ease: cubic-bezier(.22, .61, .36, 1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body.dplay {
  background: var(--bg); color: var(--text); overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 宽屏两侧：同一张封面（或占位色）放大模糊，不让两边死黑 */
.dplay__bg {
  --h: 330;
  position: fixed; inset: -40px; z-index: 0; filter: blur(40px) brightness(.45); transform: scale(1.1);
  background-image:
    radial-gradient(70% 50% at 25% 15%, hsl(var(--h) 62% 34% / .8), transparent 62%),
    radial-gradient(60% 45% at 80% 55%, hsl(calc(var(--h) + 55) 58% 30% / .7), transparent 64%),
    linear-gradient(160deg, hsl(var(--h) 28% 16%), hsl(calc(var(--h) + 45) 24% 10%));
  background-size: cover; background-position: center;
}

.feed { position: fixed; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; }

/* ---------- 9:16 舞台 ---------- */
.stage {
  --h: 330;
  position: relative; height: 100%; width: 100%; max-width: calc(100vh * 9 / 16); max-width: calc(100dvh * 9 / 16);
  overflow: hidden; background: #000; touch-action: pan-x;
  box-shadow: 0 0 80px rgba(0, 0, 0, .6);
}
.stage__poster {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(70% 50% at 25% 15%, hsl(var(--h) 62% 34% / .6), transparent 62%),
    radial-gradient(60% 45% at 80% 55%, hsl(calc(var(--h) + 55) 58% 30% / .5), transparent 64%),
    linear-gradient(160deg, hsl(var(--h) 28% 16%), hsl(calc(var(--h) + 45) 24% 10%));
}
.stage__poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 没有真实视频源时，占位画面上标一下当前集数 */
.stage__epmark {
  position: absolute; left: 0; right: 0; top: 18%; text-align: center;
  font-size: 15px; letter-spacing: .3em; color: rgba(255, 255, 255, .28); pointer-events: none;
}
.stage__epmark b { display: block; font-size: 64px; letter-spacing: 0; font-weight: 800; color: rgba(255, 255, 255, .16); }
.stage.is-switching { transition: transform .35s var(--ease), opacity .35s var(--ease); }

/* 顶栏渐变 + 底部渐变，保证白字压得住画面 */
.stage::before, .stage::after { content: ""; position: absolute; left: 0; right: 0; pointer-events: none; z-index: 5; }
.stage::before { top: 0; height: 120px; background: linear-gradient(rgba(0, 0, 0, .6), transparent); }
.stage::after { bottom: 0; height: 48%; background: linear-gradient(transparent, rgba(0, 0, 0, .82)); }

/* ---------- 顶栏 ---------- */
.top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  height: 52px; padding: env(safe-area-inset-top, 0) 8px 0; display: flex; align-items: center; gap: 4px;
}
.top__btn {
  width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%;
  color: #fff; transition: background .2s var(--ease);
}
.top__btn:hover { background: rgba(255, 255, 255, .12); }
.top__crumb {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden;
}
.top__crumb a { flex-shrink: 0; }
.top__crumb a:hover { color: #fff; }
.top__crumb span:last-child { overflow: hidden; text-overflow: ellipsis; color: #fff; }
.top__sep { opacity: .45; font-size: 11px; flex-shrink: 0; }

/* ---------- 播放键 ---------- */
.play {
  position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; width: 100%;
}
.play__icon {
  position: relative; width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .18); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: playGlow 2.4s ease-in-out infinite; transition: transform .2s var(--ease), background .2s var(--ease);
}
.play__icon::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .5); animation: playRing 2.4s ease-out infinite;
}
.play__icon svg { margin-left: 4px; }
.play:hover .play__icon { background: rgba(30, 160, 248, .45); transform: scale(1.08); }
.play.is-hidden { opacity: 0; }
.play.is-hidden .play__icon { display: none; }
@keyframes playGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(30, 160, 248, .2); } 50% { box-shadow: 0 0 26px 4px rgba(30, 160, 248, .45); } }
@keyframes playRing { 0% { transform: scale(1); opacity: .7; } 70% { opacity: 0; } 100% { transform: scale(2); opacity: 0; } }

/* ---------- 左下信息 ---------- */
.info { position: absolute; left: 16px; right: 76px; bottom: calc(140px + env(safe-area-inset-bottom, 0px)); z-index: 20; }
.info__ep {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 1; padding: 5px 9px; border-radius: 5px;
  color: var(--brand-soft); background: rgba(30, 160, 248, .2);
}
.info__ep i { font-style: normal; color: var(--text-faint); }
.info h1 {
  margin: 9px 0 6px; font-size: 19px; line-height: 1.3; font-weight: 750;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.info__desc {
  font-size: 13px; line-height: 1.55; color: var(--text-dim); cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.info__desc.is-open { -webkit-line-clamp: 8; }
.info__tags { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 9px; font-size: 12.5px; }
.info__tags a { color: rgba(200, 210, 230, .9); }
.info__tags a:hover { color: var(--brand-soft); }

/* ---------- 右侧操作栏 ---------- */
.rail { position: absolute; right: 10px; bottom: calc(140px + env(safe-area-inset-bottom, 0px)); z-index: 20; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.rail__btn { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 52px; color: #fff; }
.rail__icon {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .12); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.rail__btn:hover .rail__icon { background: rgba(30, 160, 248, .3); }
.rail__btn:active .rail__icon { transform: scale(.9); }
.rail__label { font-size: 11px; white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); font-variant-numeric: tabular-nums; }
.rail__btn[aria-pressed="true"] .rail__icon { color: var(--like); background: rgba(255, 77, 109, .18); }
.rail__btn[aria-pressed="true"] .rail__icon svg { fill: currentColor; }
.rail__btn--fav[aria-pressed="true"] .rail__icon { color: var(--accent); background: rgba(255, 176, 58, .18); }
.rail__btn.is-pop .rail__icon { animation: pop .35s var(--ease); }
@keyframes pop { 50% { transform: scale(1.25); } }

/* ---------- 进度条 ---------- */
.prog { position: absolute; left: 0; right: 0; bottom: 0; z-index: 25; padding: 0 0 calc(14px + env(safe-area-inset-bottom, 0)); text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.prog__controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 10px; font-size: 13px; }
.prog__actions { display: flex; align-items: center; flex-shrink: 0; gap: 8px; }
.prog__speed { position: relative; display: inline-flex; align-items: center; }
.prog__speed-toggle, .prog__next { min-height: 44px; border: 0; border-radius: 0; background: transparent; color: rgba(255, 255, 255, .88); font: inherit; font-weight: 500; }
.prog__speed-toggle { position: relative; min-width: 68px; padding: 0 23px 0 6px; cursor: pointer; text-align: left; }
.prog__chevron { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); pointer-events: none; color: rgba(255, 255, 255, .72); }
.prog__speed-menu { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 50; width: 112px; display: grid; padding: 4px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 10px; background: rgba(20, 20, 27, .96); box-shadow: 0 8px 28px rgba(0, 0, 0, .4); }
.prog__speed-menu button { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 10px; border-radius: 6px; font-size: 13px; color: var(--text-dim); }
.prog__speed-menu button:hover, .prog__speed-menu button:focus-visible { background: rgba(255, 255, 255, .08); color: #fff; }
.prog__speed-menu button[aria-checked="true"] { color: var(--brand-soft); }
.prog__speed-menu button[aria-checked="true"]::after { content: '✓'; font-size: 12px; }
.prog__next { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 6px 0 14px; white-space: nowrap; }
.prog__next::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 1px; background: rgba(255, 255, 255, .22); }
.prog__next:hover:not(:disabled), .prog__speed-toggle:hover:not(:disabled) { color: #fff; }
.prog__speed-toggle:disabled, .prog__next:disabled { opacity: .45; cursor: default; }
.prog__time { white-space: nowrap; font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.prog__bar { position: relative; height: 14px; margin: 0 14px; display: flex; align-items: center; cursor: pointer; }
.prog__track { width: 100%; height: 3px; border-radius: 2px; overflow: hidden; background: rgba(255, 255, 255, .2); transition: height .15s; }
.prog__bar:hover .prog__track { height: 5px; }
.prog__fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), #38d0ff); border-radius: 0 2px 2px 0; }

/* 上滑提示 */
.hint {
  position: absolute; left: 50%; bottom: calc(108px + env(safe-area-inset-bottom, 0px)); z-index: 20; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: rgba(255, 255, 255, .4);
  white-space: nowrap; pointer-events: none; animation: bob 2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateX(-50%) translateY(-5px); } }

/* 连播倒计时 / 提示气泡 */
.toast {
  position: absolute; left: 50%; top: 40%; z-index: 40; transform: translate(-50%, -50%);
  padding: 10px 16px; border-radius: 10px; font-size: 13.5px; text-align: center;
  background: rgba(0, 0, 0, .78); color: #fff; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.is-on { opacity: 1; pointer-events: auto; }
.toast a { color: var(--brand-soft); margin-left: 6px; }

/* ---------- 选集面板 ---------- */
.mask { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .55); opacity: 0; pointer-events: none; transition: opacity .3s; }
.mask.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 210; width: 100%; max-width: 560px; max-height: 60vh; overflow-y: auto;
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom, 0)); border-radius: 18px 18px 0 0; background: var(--surface);
  transform: translate(-50%, 100%); transition: transform .35s cubic-bezier(.4, 0, .2, 1);
  overscroll-behavior: contain;
}
.sheet.is-open { transform: translate(-50%, 0); }
.sheet__head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.sheet__title { font-size: 16px; font-weight: 700; }
.sheet__sub { font-size: 12.5px; color: var(--text-faint); }
.sheet__close { margin-left: auto; width: 32px; height: 32px; display: grid; place-items: center; color: var(--text-faint); }
.sheet__close:hover { color: #fff; }
.sheet__name { margin: 2px 0 14px; font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eps { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 10px; }
.eps a {
  height: 44px; display: grid; place-items: center; border-radius: 9px; position: relative;
  background: rgba(255, 255, 255, .06); border: 1.5px solid transparent;
  font-size: 14px; color: var(--text-dim); font-variant-numeric: tabular-nums; transition: all .18s var(--ease);
}
.eps a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.eps a.is-seen { color: var(--text-faint); }
.eps a.is-active { color: var(--brand-soft); border-color: var(--brand); background: rgba(30, 160, 248, .15); font-weight: 650; }
.eps a.is-active::after {   /* 正在播：三根跳动的小竖条 */
  content: ""; position: absolute; right: 5px; top: 5px; width: 8px; height: 8px;
  background: linear-gradient(var(--brand-soft), var(--brand-soft)) 0 100% / 2px 60% no-repeat,
              linear-gradient(var(--brand-soft), var(--brand-soft)) 3px 100% / 2px 100% no-repeat,
              linear-gradient(var(--brand-soft), var(--brand-soft)) 6px 100% / 2px 40% no-repeat;
}
.sheet__auto { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.sheet__auto input { accent-color: var(--brand); width: 16px; height: 16px; }

@media (max-width: 767px) {
  .stage { max-width: 100%; box-shadow: none; }
  .info { left: 12px; right: 64px; }
  .info h1 { font-size: 17px; }
  .rail { right: 6px; gap: 14px; }
  .rail__icon { width: 38px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .play__icon, .play__icon::before, .hint { animation: none; }
}

/* 31: real media, explicit unavailable states, keyboard access. */
[hidden] { display: none !important; }
.stage__media { position: absolute; inset: 0; z-index: 2; }
.stage__media video { width: 100%; height: 100%; object-fit: contain; }
.play:disabled { cursor: default; }
.play:disabled .play__icon { opacity: .35; animation: none; }
.play:disabled .play__icon::before { animation: none; }
.play:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--brand-soft); outline-offset: -2px; }
.play.is-hidden:focus-visible { opacity: 1; }
.play.is-hidden:focus-visible .play__icon { display: grid; }
.play-state { position: absolute; top: 34%; left: 16px; right: 16px; z-index: 15; text-align: center; font-size: 13px; color: var(--text-dim); pointer-events: none; }
.prog__seek { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.prog__bar:focus-within { outline: 2px solid var(--brand-soft); }
.info__desc { width: 100%; text-align: left; }
.info { overflow-wrap: anywhere; }
.resume { color: var(--brand-soft); font-size: 12px; margin-top: 8px; }
.sheet:not(.is-open) { visibility: hidden; }
.sheet__empty { font-size: 13px; color: var(--text-dim); padding: 18px 0; }
.top { height: calc(52px + env(safe-area-inset-top, 0px)); }
@media (max-height: 450px) {
  .info__desc, .info__tags, .hint { display: none; }
  .rail { gap: 4px; bottom: calc(108px + env(safe-area-inset-bottom, 0px)); }
  .rail__icon { width: 28px; height: 28px; }
  .rail__icon svg { width: 20px; height: 20px; }
  .rail__btn { gap: 2px; }
  .rail__label { font-size: 10px; }
  .prog__controls { padding-right: 4px; padding-left: 4px; gap: 2px; font-size: 12px; }
  .prog__time { font-size: 10px; }
  .prog__actions { gap: 1px; }
  .prog__speed-toggle { min-width: 58px; }
  .prog__speed-menu { right: -45px; width: 172px; grid-template-columns: 1fr 1fr; }
  .prog__next { min-width: 44px; padding: 0 8px; }
  .prog__next span { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
