/* ============================================================
 * 媒体仓库 —— 应用内"影视媒体"视图（#vodView）
 * 侧栏保留，主舞台原地切换：body.is-vod 时接管 #chatArea
 * 风格：沿用主站变量（浅灰底/白卡/品牌紫），轻杂志版式
 * 依赖：style.css 中的 CSS 变量与基础样式
 * ========================================================== */

/* ---------- 视图切换（body.is-vod 由 vod.js 控制） ---------- */
body.is-vod #welcome,
body.is-vod #messages,
body.is-vod #typing,
body.is-vod #btnScrollBottom,
body.is-vod #composerDock,
body.is-vod .panel__top { display: none !important; } /* 顶栏仅在任务模式存在 */

body.is-vod .stage {
  overflow: hidden;          /* 视图内部自带滚动区 */
  padding: 0;
  scroll-behavior: auto;
}

#vodView { display: none; }

body.is-vod #vodView {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0;
  position: relative;        /* 详情抽屉的定位上下文 */
  animation: vod-in .32s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes vod-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 顶栏（固定，不随内容滚动） ---------- */
.vod__top {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px 12px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
}

.vod__back {
  display: flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  font-size: 13px; font-weight: 600; color: var(--text-soft);
  transition: color .15s, transform .15s;
  flex-shrink: 0;
}
.vod__back:hover { color: var(--text); }
.vod__back:active { transform: scale(.95); }

/* 退出密码登录：顶栏右侧图标按钮，点击清除有效期并回到密码门 */
.vod__logout {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  border-radius: 50%;
  background: transparent;
  flex-shrink: 0;
  transition: background .15s, transform .15s;
}
.vod__logout:hover { background: rgba(73, 73, 75, .1); }
.vod__logout:active { transform: scale(.92); }

.vod__brand {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0;
}
.vod__brand img { display: block; flex-shrink: 0; }
.vod__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px; font-weight: 600; letter-spacing: .01em;
  white-space: nowrap;
}
.vod__count {
  font-size: 12px; font-weight: 600; color: var(--text-mute);
  background: var(--chip-bg);
  padding: 2px 9px; border-radius: var(--r-pill);
  white-space: nowrap;
}

/* ---------- 可滚动内容区 ---------- */
.vod__scroll {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 0 24px 40px;
}
.vod__scroll::-webkit-scrollbar { width: 6px; }
.vod__scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; }

/* ---------- 分类筛选胶囊 ---------- */
.vod__chips {
  display: flex; gap: 8px;
  padding: 16px 0 4px;
  overflow-x: auto; scrollbar-width: none;
  cursor: grab;          /* PC 端可拖拽滑动 */
}
.vod__chips::-webkit-scrollbar { display: none; }
.vod__chips.is-dragging { cursor: grabbing; user-select: none; }

.chip {
  height: 32px; padding: 0 14px;
  border-radius: 5px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  font-size: 13px; font-weight: 600; color: var(--text-soft);
  white-space: nowrap;
  transition: background .15s, color .15s, transform .15s;
  flex-shrink: 0;
}
.chip:hover { background: var(--chip-hover); }
.chip:active { transform: scale(.95); }
.chip.is-active {
  background: var(--brand-soft); color: var(--brand-deep);
}

/* ---------- 海报网格 ---------- */
.vod__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* PC 端固定一排 5 个 */
  align-items: stretch;                   /* 同行卡片拉伸等高，避免横竖卡混排导致行高参差 */
  gap: 20px 14px;
  padding-top: 18px;
}

.vod-card {
  position: relative;
  cursor: pointer;
  aspect-ratio: 16 / 8;   /* 卡片容器统一 16:8，横竖图都在此比例容器内 */
  /* 常驻悬浮阴影（横竖图卡片统一） */
  box-shadow: 0 10px 22px -8px rgba(20, 20, 30, .22), 0 2px 6px rgba(20, 20, 30, .08);
  animation: card-in .45s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: var(--d, 0s);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ---------- 基础卡片布局：图在左（2/3 比例撑满容器高），文字紧凑靠左贴靠图片右缘 ---------- */
.vod-card:not(.is-land) {
  display: flex;
  align-items: center;   /* 文字组相对图片垂直居中 */
  gap: 12px;
  border-radius: 5px;
  overflow: hidden;      /* 裁切毛玻璃背景溢出边缘 */
}
/* 空白文字区：当前图片放大模糊 + 白色提亮层 = 毛玻璃背景 */
.vod-card:not(.is-land)::before {
  content: '';
  position: absolute; inset: -12px;
  background: linear-gradient(rgba(255, 255, 255, .68), rgba(255, 255, 255, .68)),
              var(--cardbg, none) center / cover no-repeat;
  filter: blur(14px) saturate(1.15);
}
.vod-card:not(.is-land) .vod-card__pic,
.vod-card:not(.is-land) .vod-card__info {
  position: relative; z-index: 1;  /* 内容抬到毛玻璃之上 */
}
.vod-card:not(.is-land) .vod-card__pic {
  height: 100%;
  aspect-ratio: 2 / 3;   /* 宽度随容器高自动推导（约容器宽 1/3） */
  flex-shrink: 0;
}
.vod-card__info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 2px;              /* 行与行紧凑挨在一起 */
  /* 毛玻璃背景上的文字悬浮阴影 */
  text-shadow: 0 1px 2px rgba(255, 255, 255, .9), 0 2px 8px rgba(20, 20, 40, .28);
}
/* 集数 + 分类：同一行水平排列，集数在前 */
.vod-card__meta {
  display: flex; align-items: center;
  gap: 2px;
}
.vod-card:not(.is-land) .vod-card__cat,
.vod-card:not(.is-land) .vod-card__name { margin: 0; }

/* 分类/集数徽标：毛玻璃底（横图卡仍用图片上的深色角标） */
.vod-card:not(.is-land) .vod-card__cat,
.vod-card:not(.is-land) .vod-card__eps {
  padding: 2px;          /* 文字到背景边界间距 2px */
  border-radius: 5px;
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(8px) saturate(1.2);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
}
.vod-card:not(.is-land) .vod-card__eps { color: var(--text-soft); }

.vod-card__pic {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 5px;
  overflow: hidden;
  background: var(--chip-bg);
}
.vod-card__pic img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}

/* ---------- 横图卡片：整宽填满 16:8 容器，文字信息叠加在图片上 ---------- */
.vod-card.is-land {
  display: flex; flex-direction: column;
}
.vod-card.is-land .vod-card__pic {
  width: 100%;
  flex: 1 1 auto; min-height: 0;
  aspect-ratio: 16 / 8;   /* 与卡片容器同比例，同行拉伸时填满行高 */
}
.vod-card.is-land .vod-card__pic img { height: 100%; }
.vod-card.is-land .vod-card__pic::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0; height: 58%;
  background: linear-gradient(180deg, transparent, rgba(10, 10, 16, .72));
  pointer-events: none;
}
.vod-card.is-land .vod-card__eps {
  position: absolute; top: 8px; right: 8px; margin: 0;
  z-index: 1;
}
.vod-card.is-land .vod-card__name {
  position: absolute; left: 10px; right: 10px; bottom: 26px;
  margin: 0; z-index: 1;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}
.vod-card.is-land .vod-card__cat {
  position: absolute; left: 10px; right: 10px; bottom: 8px;
  margin: 0; z-index: 1;
  color: rgba(255, 255, 255, .8);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .45);
}
/* 无分类时标题直接贴底 */
.vod-card.is-land:not(:has(.vod-card__cat)) .vod-card__name { bottom: 8px; }

/* 集数角标：竖图卡显示在名称下方，横图卡叠加图片右上角 */
.vod-card__eps {
  padding: 2px 8px;
  border-radius: 5px;
  background: rgba(12, 12, 16, .62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff; font-size: 11px; font-weight: 600;
  letter-spacing: .02em;
}

/* 无海报占位：首字 + 品牌渐变纹理 */
.vod-card__ph {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  background:
    radial-gradient(120% 100% at 20% 0%, rgba(122, 90, 245, .28), transparent 55%),
    radial-gradient(110% 90% at 90% 100%, rgba(58, 108, 231, .22), transparent 50%),
    linear-gradient(160deg, #efeef6, #e6e4f2);
}
.vod-card__ph span {
  font-family: var(--font-display);
  font-size: 42px; font-weight: 600;
  color: rgba(122, 90, 245, .55);
}

.vod-card__name {
  font-size: 13px; font-weight: 600; line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;          /* 超长最多两排，超出省略号截断 */
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vod-card__cat {
  font-size: 11.5px; color: var(--text-mute);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 到底提示（全部加载完且滑到底，两排小灰字居中） ---------- */
.vod__end {
  padding: 30px 0 6px;
  text-align: center;
  color: var(--text-mute);
  font-size: 12px; line-height: 2;
}
.vod__end p { margin: 0; }

.vod__start {
  margin-top: 14px;
  height: 34px; padding: 0 20px;
  border-radius: 5px;
  background: var(--brand); color: #fff;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-brand);
  transition: background .15s, transform .15s;
}
.vod__start:hover { background: var(--brand-deep); }
.vod__start:active { transform: scale(.95); }

/* ---------- 加载中 / 空状态 ---------- */
.vod__tip {
  padding: 80px 0; text-align: center;
  color: var(--text-mute); font-size: 14px;
}

/* ---------- 加载骨架屏：卡片占位（数据可显示后才被真实卡片替换） ----------
 * 放在 .vod__grid 内，随网格自适应：PC 端一排 5 个、移动端（≤640px）一排 1 个
 * 结构模拟基础竖图卡：图块在左（2/3），文字条在右 */
.vod-skel {
  display: flex; align-items: center; gap: 12px;
  aspect-ratio: 16 / 8;
  border-radius: 5px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 10px 22px -8px rgba(20, 20, 30, .12), 0 2px 6px rgba(20, 20, 30, .05);
}
.vod-skel__pic {
  height: 100%;
  aspect-ratio: 2 / 3;
  flex-shrink: 0;
  border-radius: 0; /* 图块贴边占满左侧，与竖图卡一致 */
}
.vod-skel__info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding-right: 16px;
}
.vod-skel__line--t { width: 62%; height: 12px; border-radius: 4px; }
.vod-skel__line--s { width: 34%; height: 10px; border-radius: 4px; }

/* 分类胶囊骨架：与真实 chip 同高同圆角 */
.chip-skel { height: 32px; width: 66px; border-radius: 5px; flex-shrink: 0; }
.chip-skel:nth-child(2) { width: 52px; }
.chip-skel:nth-child(3) { width: 78px; }
.chip-skel:nth-child(4) { width: 58px; }
.chip-skel:nth-child(5) { width: 70px; }
.chip-skel:nth-child(6) { width: 48px; }

.vod__empty {
  padding: 72px 0 40px; text-align: center;
  animation: card-in .45s cubic-bezier(.2, .8, .2, 1) both;
}
.vod__empty img { opacity: .5; margin: 0 auto 18px; }
.vod__empty-title {
  margin: 0; font-family: var(--font-display);
  font-size: 20px; font-weight: 600;
}
.vod__empty-desc {
  margin: 8px auto 0; max-width: 420px;
  font-size: 13.5px; color: var(--text-soft);
}

/* ============================================================
 * 影片选集弹窗（全屏，白色毛玻璃 + 当前海报氛围背景）
 * 由 vod.js 动态创建，点击影片卡片打开，点击播放集调用 vod.php 播放
 * ========================================================== */

/* 弹窗打开时锁定背后影视列表滚动 */
body.is-vod-modal .vod__scroll { overflow: hidden; }

.vod-modal {
  position: fixed; inset: 0; z-index: 1100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: vod-modal-fade .25s ease both;
}
.vod-modal[hidden] { display: none; }
@keyframes vod-modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* 氛围背景：当前海报放大裁切 + 深度模糊，上覆白色毛玻璃层 */
.vod-modal__bg {
  position: absolute; inset: -40px;
  background: #e9e7f2 center / cover no-repeat;
  filter: blur(48px) brightness(1.12) saturate(1.15);
  transform: scale(1.12);
}
.vod-modal__bg.no-poster { background-image: none !important; }
.vod-modal__bg::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(255, 255, 255, .62);
}

/* 面板：白色毛玻璃卡片 */
.vod-modal__panel {
  position: relative;
  width: min(520px, 94vw);
  max-height: min(76vh, 620px);
  display: flex; flex-direction: column;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 20px;
  box-shadow:
    0 30px 80px rgba(20, 20, 40, .28),
    0 4px 16px rgba(20, 20, 40, .10);
  padding: 22px;
  overflow: hidden;
  animation: card-in .4s cubic-bezier(.2, .8, .2, 1) both;
}

.vod-modal__close {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .65);
  /* 常驻悬浮阴影 */
  box-shadow:
    0 6px 16px rgba(20, 20, 40, .22),
    0 2px 5px rgba(20, 20, 40, .12);
  font-size: 13px; color: var(--text-soft);
  transition: background .15s, color .15s, transform .15s;
  z-index: 1;
}
.vod-modal__close:hover { background: var(--chip-hover); color: var(--text); }
.vod-modal__close:active { transform: scale(.92); }

/* 头部：海报缩略 + 标题/分类 */
.vod-modal__head {
  display: flex; gap: 14px; align-items: flex-start;
  padding-right: 34px; /* 给关闭按钮留位 */
}
.vod-modal__pic {
  width: 84px; aspect-ratio: 2 / 3;
  border-radius: 10px; overflow: hidden;
  background: var(--chip-bg);
  box-shadow: 0 8px 18px -6px rgba(20, 20, 30, .3);
  flex-shrink: 0;
}
.vod-modal__pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vod-modal__pic span {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 32px; font-weight: 600;
  color: rgba(122, 90, 245, .55);
}
.vod-modal__title {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600; line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vod-modal__cat {
  display: inline-block; margin-top: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-mute);
  background: var(--chip-bg);
  padding: 2px 10px; border-radius: var(--r-pill);
}

/* 播放集列表 */
.vod-modal__eps {
  margin-top: 18px;
  display: flex; flex-direction: column;
  min-height: 0; flex: 1;
}
.vod-modal__label {
  margin: 0 0 10px;
  font-size: 12.5px; font-weight: 600; color: var(--text-mute);
}
.vod-modal__list {
  overflow-y: auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
  padding-right: 2px;
}
.vod-modal__list::-webkit-scrollbar { width: 6px; }
.vod-modal__list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; }

.vod-modal__ep {
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .68);
  box-shadow: var(--shadow-soft);
  font-size: 12.5px; font-weight: 600; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .15s, color .15s, transform .15s;
}
.vod-modal__ep:hover {
  background: var(--brand-soft); color: var(--brand-deep);
}
.vod-modal__ep:active { transform: scale(.95); }

.vod-modal__none {
  margin: 0;
  padding: 18px 0 8px;
  text-align: center;
  font-size: 13px; color: var(--text-mute);
}

/* ============================================================
 * 访问密码门（影迷广场 / 午夜剧场共用，覆盖整个影视视图）
 * 由 vod.js 控制：有效期外进入时显示，验证通过 30 分钟内免输入
 * ========================================================== */

.vod__gate {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 24px 24px;   /* 弹窗停靠在页面上方约 1/3 处 */
  background: var(--bg);
  animation: vod-modal-fade .25s ease both;
}
.vod__gate[hidden] { display: none; }

/* 移动端返回按钮：门覆盖视图顶栏时兜底退出（PC 端隐藏） */
.vod__gate-back {
  display: none;
  position: absolute; top: 14px; left: 14px;
  align-items: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(20, 20, 40, .18), 0 2px 5px rgba(20, 20, 40, .10);
  font-size: 13px; font-weight: 600; color: var(--text-soft);
  transition: color .15s, transform .15s;
  z-index: 1;
}
.vod__gate-back:hover { color: var(--text); }
.vod__gate-back:active { transform: scale(.95); }

.vod__gate-box {
  width: min(360px, 100%);
  padding: 0;
  text-align: center;
}
.vod__gate-box > img { opacity: .85; margin-bottom: 12px; }
.vod__gate-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px; font-weight: 600;
}
.vod__gate-desc {
  margin: 8px 0 18px;
  font-size: 12.5px; color: var(--text-mute);
}

/* 6 位方形输入格：居中排列，仅输入框带光晕 */
.vod__gate-row {
  display: flex; justify-content: center; gap: 10px;
}
.vod__gate-cell {
  width: 42px; height: 42px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--bg);
  text-align: center;
  font-size: 20px; font-weight: 600;
  caret-color: var(--brand);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.vod__gate-cell:focus {
  outline: none;
  border-color: var(--brand);
  /* 品牌色光晕 */
  box-shadow: 0 0 0 3px var(--brand-soft), 0 0 18px 2px var(--brand-soft);
}
.vod__gate-cell.is-filled {
  border-color: var(--brand);
  box-shadow: 0 0 10px 1px var(--brand-soft);
}
.vod__gate-cell.is-err {
  border-color: #e5484d;
  box-shadow: 0 0 0 3px rgba(229, 72, 77, .16);
  animation: gate-shake .4s ease;
}
@keyframes gate-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.vod__gate-err {
  margin: 12px 0 0;
  font-size: 12px; font-weight: 600;
  color: #e5484d;
}

/* ============================================================
 * 移动端
 * ========================================================== */
@media (max-width: 900px) {
  /* 密码门覆盖视图顶栏，提供左上角返回按钮兜底退出 */
  .vod__gate-back { display: flex; }
}

@media (max-width: 640px) {
  .vod__top { padding: 10px 14px; gap: 10px; }
  .vod__title { font-size: 18px; }
  .vod__back span { display: none; }
  .vod__back { width: 34px; padding: 0; justify-content: center; }

  .vod__gate-row { gap: 8px; }
  .vod__gate-cell { width: 38px; height: 38px; font-size: 18px; }

  .vod__scroll { padding: 0 14px 28px; }

  .vod__grid {
    grid-template-columns: repeat(1, 1fr); /* 移动端一排 1 个 */
    gap: 16px;
  }
  .vod-card__name { font-size: 12px; }

  .vod-modal { padding: 14px; }
  .vod-modal__panel { padding: 16px; border-radius: 16px; }
  .vod-modal__title { font-size: 16px; }
  .vod-modal__list { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}
