/* ============================================
   Player Modal - 全屏沉浸式播放器（V2）
   对标设计稿：导航栏 + 全屏视频 + 右侧操作栏
             + 进度条 + 底部EP信息栏(#1c1c1e)
   ============================================ */

/* ---- 播放器容器 ---- */
.player-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: calc(var(--z-modal) + 5);
  background: #000;
  display: flex;
  flex-direction: column;
}

.player-modal.hidden {
  display: none;
}

/* ================================
  顶部导航栏（渐变透明，与 For You 一致）
  ================================ */
.player-nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
  gap: 8px;
}

.player-back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background 0.15s ease;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.player-back-btn:active {
  background: rgba(255,255,255,0.15);
}

.player-nav-title {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  flex: 1;
}

/* 右侧占位，保持标题居中 */
.player-nav-spacer {
  width: 36px;
  flex-shrink: 0;
}

/* ================================
   视频区域（全屏填充）
   ================================ */
.player-video-area {
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
  touch-action: none;          /* 由 JS 接管所有触控手势 */
}

/* ---- 暂停/播放状态图标（短暂闪现） ---- */
.play-state-indicator {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  z-index: 15;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.play-state-indicator.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.play-indicator-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

/* 滑动包装器：整屏滑动（视频+进度条+底部EP栏一起滑） */
.player-video-slide-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* 动画状态 */
.player-video-slide-wrapper.sliding {
  transition: transform 0.28s cubic-bezier(0.4, 0, 1, 1);
}

.player-video-slide-wrapper.slide-back {
  transition: transform 0.30s cubic-bezier(0, 0, 0.2, 1);
}

.drama-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  /* 无实际视频源时，防止 video 原生层拦截触摸事件（iOS/Android WebView） */
  pointer-events: none;
}

/* 视频占位背景（无视频源时显示海报） */
.player-video-placeholder {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.player-video-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---- 上滑提示箭头 ---- */
.swipe-hint {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0.55;
  pointer-events: none;
  animation: swipe-hint-pulse 2.5s ease-in-out infinite;
}

.swipe-hint span {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.5px;
}

@keyframes swipe-hint-pulse {
  0%, 100% { opacity: 0.3; transform: translateX(-50%) translateY(0); }
  50%      { opacity: 0.7; transform: translateX(-50%) translateY(-8px); }
}

/* ============================================
   播放器状态页（覆盖在视频区域上）
   - locked-state: 未解锁剧集
   - error-state:   加载失败
   ============================================ */

.player-state-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 8;
  background: #000;
  padding: 0 40px;
}

.player-state-overlay.show {
  display: flex;
  animation: state-fade-in 0.25s ease forwards;
}

@keyframes state-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 状态图标 */
.player-state-icon {
  opacity: 0.85;
  filter: drop-shadow(0 2px 12px rgba(255,255,255,0.1));
}

/* 加载中 GIF */
.player-loading-gif {
  width: 130px;
  height: 130px;
  object-fit: contain;
}

/* loading 状态页整体往上挪 */
#player-loading-state.show {
  padding-bottom: 80px; /* 用底部 padding 把内容往上推 */
}

/* 状态提示文字 */
.player-state-text {
  font-size: 15px;
  color: rgba(255,255,255,0.85);
  text-align: center;
  line-height: 1.5;
  margin: 0;
  max-width: 280px;
}

/* ---- Unlock Now 按钮（金色渐变） ---- */
.player-btn-unlock {
  background: linear-gradient(135deg, #F5D742, #F5A623);
  color: #000;
  font-size: 15px;
  font-weight: 700;
  padding: 13px 36px;
  border-radius: 24px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  letter-spacing: 0.3px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.player-btn-unlock:active {
  transform: scale(0.95);
  box-shadow: 0 4px 16px rgba(245,166,35,0.4);
}

/* ---- Try again 按钮（白色描边） ---- */
.player-btn-retry {
  background: transparent;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 32px;
  border-radius: 24px;
  border: 1.5px solid rgba(255,255,255,0.45);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.player-btn-retry:active {
  transform: scale(0.95);
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.65);
}

/* ================================
   右侧操作栏（Favorite + Speed）
   叠加在视频区域右下角
   ================================ */
.player-right-actions {
  position: absolute;
  right: 14px;
  bottom: 130px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 22px;
  align-items: center;
  pointer-events: auto; /* 防止 video 层遮挡 */
}

#player-right-actions .paction {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: transform 0.15s ease;
  background: none;
  border: none;
  color: #fff;
  padding: 2px;
}

#player-right-actions .paction:active {
  transform: scale(0.92);
}

.paction-fav-img,
.paction-speed-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

#player-right-actions .paction span {
  font-size: 11px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  white-space: nowrap;
  font-weight: 500;
}

/* 收藏激活状态 — 金色 */
#player-right-actions .paction.favorited .paction-fav-img {
  filter: drop-shadow(0 2px 6px rgba(249,171,16,0.5));
}
#player-right-actions .paction.favorited span {
  color: #F9AB10;
}

/* ================================
   进度条区域
   ================================ */
.player-progress-area {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 98px;
  z-index: 10;
  padding: 0;
  pointer-events: auto; /* 防止 video 层遮挡 */
}

.player-progress-bar {
  position: relative;
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  cursor: pointer;
}

.player-progress-filled {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 35%;
  background: #fff;
  border-radius: 2px;
  transition: width 0.3s linear;
}

.player-progress-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%);
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}

/* ================================
   底部剧集信息栏 (#1c1c1e)
   点击 → 弹出选集
   ================================ */
.player-ep-info {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  pointer-events: auto;
  background: #1E1F2A;
  cursor: pointer;
  border-radius: 9px;
}

.player-ep-info-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.player-ep-info-left svg {
  flex-shrink: 0;
  color: #fff;
  opacity: 0.85;
}

#player-ep-text {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
}

.player-ep-arrow {
  flex-shrink: 0;
  color: rgba(255,255,255,0.55);
  transition: transform 0.2s ease;
  margin-left: 10px;
}

.player-ep-info.expanded .player-ep-arrow {
  transform: rotate(180deg);
}

/* ===== 共享 Sheet 动画 ===== */
@keyframes sheet-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sheet-slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ---- 选集弹框（底部 Sheet 样式 — 对标设计稿） ---- */

.ep-picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.ep-picker-overlay.show {
  display: flex;
  animation: sheet-fade-in 0.2s ease forwards;
}

.ep-picker-modal {
  width: 100%;
  max-height: 70vh;
  background: #000000;
  border-radius: 16px 16px 0 0;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
  animation: sheet-slide-up 0.3s ease forwards;
  overflow-y: auto;
  scrollbar-width: none;
  position: relative;
}

.ep-picker-modal::-webkit-scrollbar { display: none; }

/* ---- 拖拽指示条顶部区域（独立背景 + 圆角对齐外层） ---- */
.ep-picker-top {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1B1B1B;
  border-radius: 16px 16px 0 0;
  margin: 0 -16px;
  padding: 0 16px;
}

/* ---- 拖拽指示条（Sheet 标识）---- */
.ep-picker-handle {
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  margin: 0 auto;
  flex-shrink: 0;
}

/* ---- 剧集信息头部（封面 + 元数据）---- */
.ep-picker-header-info {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 5px;
}

.ep-picker-poster {
  width: 64px;
  height: 84px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255,255,255,0.06);
}

.ep-picker-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ep-picker-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 23px;
}

.ep-picker-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ep-picker-title-row .ep-picker-fav-btn {
  margin-left: auto;
}

.ep-picker-drama-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* 收藏星标按钮 */
.ep-picker-fav-btn {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.35);
  transition: color 0.15s ease;
}

.ep-picker-fav-btn.favorited {
  color: #F5A623;
}

.ep-fav-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.ep-picker-ep-count {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  font-weight: 500;
  margin: 0;
  line-height: 1.3;
}

/* ---- 简介（位于 meta 区域内，Episode 下方）---- */
.ep-picker-synopsis {
  width: 100%;
  padding: 5px 10px;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  line-height: 1.55;
  margin: 0 0 10px 0;
  display: block;
  overflow: hidden;
}

/* ---- 选集网格 — 5列（对标设计稿）---- */
.ep-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.ep-picker-item {
  aspect-ratio: 1.15;
  border-radius: 6px;
  background: #fff;
  color: #1a1a1a;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* 当前播放集 — 金色高亮 */
.ep-picker-item.current {
  background: #F9AB10;
  color: #fff;
}

/* 已解锁（默认白底黑字，无需额外样式） */

/* 未解锁 — 锁图标右上角（使用图片资源） */
.ep-picker-item.locked {
  opacity: 1;
  color: #1a1a1a;
}

.ep-picker-item.locked::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 23px;
  height: 15px;
  background-image: url('../assets/images/lock-icon.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* ============================================
   倍速选择弹窗（底部 Sheet）
   0.5x / 0.75x / 1x / 1.25x / 1.5x / 2x / 2.5x / 3x
   4×2 网格，独立于 #player-modal
   ============================================ */

.speed-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: calc(var(--z-modal, 200) + 50);
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.speed-overlay.show {
  display: flex;
  animation: sheet-fade-in 0.2s ease forwards;
}

.speed-modal {
  width: 100%;
  max-height: 72vh;
  background: #000;
  border-radius: 16px 16px 0 0;
  padding: 14px 22px calc(21px + env(safe-area-inset-bottom, 0px));
  animation: sheet-slide-up 0.3s ease forwards;
  overflow-y: auto;
  scrollbar-width: none;
}

.speed-modal::-webkit-scrollbar { display: none; }

/* ============================================
   倍速弹窗拖拽指示条（参考选集弹窗）
   ============================================ */

/* 顶部容器（包裹 handle，与选集弹窗样式一致） */
.speed-top {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1B1B1B;
  border-radius: 16px 16px 0 0;
  margin: -14px -22px 0;
  padding: 0 22px;
}

/* 拖拽指示条 */
.speed-handle {
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  margin: 0 auto;
}

/* 标题 */
.speed-title {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  padding: 15px 1px;
}

/* 倍速按钮 4列 × 2行 */
.speed-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.speed-btn {
  height: 48px;
  border-radius: 8px;
  background: #fff;
  color: #000;
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.speed-btn:active {
  transform: scale(0.95);
}

/* 选中态 — 金色 */
.speed-btn.active {
  background: #F5A623;
  color: #fff;
}

/* ============================================
   剧集解锁弹窗（底部 Sheet）
   Price/Account + Membership + Coins
   对标设计稿：黑色半透明蒙版 + 底部圆角弹窗
   ============================================ */

.ep-unlock-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: calc(var(--z-modal, 200) + 60);
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.ep-unlock-overlay.show {
  display: flex;
  animation: sheet-fade-in 0.2s ease forwards;
}

.ep-unlock-modal {
  width: 100%;
  max-height: 80vh;
  background: #000;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: sheet-slide-up 0.3s ease forwards;
}

/* ---- 顶部栏：Price / Account / 关闭 ---- */
.ep-unlock-top {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  gap: 14px;
  background: #1B1B1B;
  flex-shrink: 0;
  position: relative;
}

.ep-unlock-info {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: #fff;
}

.ep-unlock-label {
  color: #fff;
  font-size: 16px;
}

.ep-unlock-coin-sm {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.ep-unlock-price,
.ep-unlock-account {
  font-weight: 600;
  color: #F9AB10;
}

.ep-unlock-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.ep-unlock-close:active {
  background: rgba(255,255,255,0.12);
}

/* ---- 滚动内容区 ---- */
.ep-unlock-body {
  flex: 1;
  padding: 0 20px 12px;
  overflow-y: auto;
}

/* ---- Section ---- */
.ep-unlock-section {
  margin-bottom: 18px;
  padding-top: 12px;
}

.ep-unlock-section--coins {
  margin-bottom: 0;
}

.ep-unlock-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.ep-unlock-crown-icon,
.ep-unlock-coins-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.ep-unlock-section-title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.ep-unlock-section-desc {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* ---- 订阅计划卡片列表 ---- */
.ep-unlock-plan-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ep-unlock-plan-card {
  width: 100%;
  background: rgba(155, 135, 96, 0.38);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s ease;
  text-align: left;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.ep-unlock-plan-card:active {
  transform: scale(0.98);
}

/* 选中状态 */
.ep-unlock-plan--selected {
  background: rgba(155, 135, 96, 0.38);
  border-color: rgba(255,255,255,0.7);
  border-width: 3px;
}

.ep-unlock-plan-name {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
  line-height: 1.3;
}

.ep-unlock-plan-price {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.ep-unlock-plan-desc {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  line-height: 1.4;
  margin-top: 2px;
}

/* ---- Coins 充值网格 2x2 ---- */
.ep-unlock-coins-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.ep-unlock-coin-card {
  background: #2B2D3C;
  border-radius: 12px;
  padding: 14px 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overflow: hidden;
}

.ep-unlock-coin-card:active {
  transform: scale(0.95);
  background: #35363F;
}

.ep-unlock-coin-amount-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.ep-unlock-coin-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: drop-shadow(0 0 4px rgba(255,200,0,0.4));
}

.ep-unlock-coin-amount {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}

.ep-unlock-coin-beans-bar {
  width: calc(100% + 20px);
  margin-left: -10px;
  margin-right: -10px;
  background: #636363;
  padding: 3px 0 5px;
  text-align: center;
  margin-top: 8px;
  border-radius: 0 0 12px 12px;
  flex-shrink: 0;
}

.ep-unlock-coin-beans-text {
  font-size: 11px;
  font-weight: 500;
  color: #ffffff;
}

/* ---- 底部固定栏：Use Coins to Unlock ---- */
.ep-unlock-footer {
  flex-shrink: 0;
  padding: 10px 20px calc(10px + env(safe-area-inset-bottom, 0px));
  background: #000;
}

.ep-unlock-use-coins-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #F5D742, #F5A623);
  color: #000;
  font-size: 15px;
  font-weight: 700;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  letter-spacing: 0.3px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.ep-unlock-use-coins-btn:active {
  transform: scale(0.96);
  box-shadow: 0 4px 16px rgba(245,166,35,0.4);
}
