/* 视频详情页：竖版、横版共用一页。始终深色沉浸，评论/分享弹层沿用浅色/深色主题变量
   布局：顶栏（返回 / logo / 声音）→ 视频流（上下滑切换）→ 进度条 → 底部操作栏 */

:root { --vd-act-h: 56px; --vd-ink: #fff; --vd-ink-2: rgba(255, 255, 255, .78); --vd-ink-3: rgba(255, 255, 255, .55); }

html.vd, body.vd { height: 100%; background: #000; overflow: hidden; overscroll-behavior: none; }
body.vd { color: var(--vd-ink); }

/* ===== 顶栏：浮在视频上 ===== */
.vd-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 6; display: flex; align-items: center; justify-content: space-between;
  height: calc(48px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 6px 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .45), rgba(0, 0, 0, 0)); pointer-events: none; }
.vd-bar > * { pointer-events: auto; }
.vd-icon { width: 40px; height: 40px; display: grid; place-items: center; color: #fff; }
.vd-icon svg { width: 23px; height: 23px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); }
.vd-logo img { height: 17px; width: auto; filter: brightness(0) invert(1) drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); opacity: .92; }
#mute .ic-sound { display: none; }
body.sound #mute .ic-muted { display: none; }
body.sound #mute .ic-sound { display: block; }
.vd-unmute { position: fixed; z-index: 6; top: calc(56px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 16px;
  background: rgba(0, 0, 0, .5); color: #fff; font-size: 13px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.vd-unmute svg { width: 17px; height: 17px; }

/* ===== 视频流：每屏一条，上下滑切换 ===== */
.vd-feed { position: fixed; left: 0; right: 0; top: 0; bottom: calc(var(--vd-act-h) + env(safe-area-inset-bottom));
  overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.vd-feed::-webkit-scrollbar { display: none; }
.vd-tip { position: absolute; inset: 0; display: grid; place-items: center; padding: 0 32px; text-align: center; color: var(--vd-ink-3); font-size: 14px; line-height: 1.7; }
.vd-slide { position: relative; height: 100%; overflow: hidden; scroll-snap-align: start; scroll-snap-stop: always; background: #000; }

/* 背景：封面高斯模糊，横版上下留白和竖版两侧不至于一片死黑 */
.vd-bg { position: absolute; inset: -40px; background: center / cover no-repeat; filter: blur(36px) brightness(.45) saturate(1.2); transform: scale(1.1); }

/* 视频区：竖版铺满（接近屏幕比例时裁边铺满，否则完整显示），横版居中偏上，给下方文字留位置 */
.vd-media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.vd-media img, .vd-media video { width: 100%; height: 100%; object-fit: contain; background: transparent; }
.vd-slide.is-fill .vd-media img, .vd-slide.is-fill .vd-media video { object-fit: cover; }
.vd-slide.is-land .vd-media { inset: auto 0; top: 44%; transform: translateY(-50%); height: auto; aspect-ratio: var(--ar); }
.vd-media video { position: absolute; inset: 0; opacity: 0; transition: opacity .2s; }
.vd-slide.playing .vd-media video { opacity: 1; }

/* 横版：视频下方「全屏观看」 */
.vd-full { position: absolute; left: 50%; transform: translateX(-50%); display: none; align-items: center; gap: 5px;
  height: 30px; padding: 0 14px; border-radius: 15px; border: 1px solid rgba(255, 255, 255, .35); color: #fff; font-size: 13px;
  background: rgba(0, 0, 0, .25); }
.vd-full svg { width: 15px; height: 15px; }
.vd-slide.is-land .vd-full { display: flex; top: calc(44% + 50vw * var(--arh, .5625) + 14px); }

/* 暂停时的播放键、缓冲圈、失败提示 */
.vd-state { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.vd-slide.is-land .vd-state { top: 44%; }
.vd-play { display: none; width: 64px; height: 64px; border-radius: 50%; background: rgba(0, 0, 0, .35); place-items: center; }
.vd-play svg { width: 28px; height: 28px; margin-left: 4px; fill: rgba(255, 255, 255, .92); }
.vd-slide.paused .vd-play { display: grid; animation: vdPop .18s ease; }
@keyframes vdPop { from { transform: scale(1.25); opacity: 0; } }
.vd-spin { display: none; width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: vdSpin .8s linear infinite; }
.vd-slide.waiting .vd-spin { display: block; }
@keyframes vdSpin { to { transform: rotate(360deg); } }
.vd-err { display: none; padding: 10px 16px; border-radius: 8px; background: rgba(0, 0, 0, .55); font-size: 13px; color: var(--vd-ink-2); white-space: nowrap; }
.vd-slide.failed .vd-err { display: block; }
.vd-slide.failed .vd-play, .vd-slide.failed .vd-spin { display: none; }

/* 双击点赞的爱心 */
.vd-heart { position: absolute; z-index: 3; width: 92px; height: 92px; margin: -46px 0 0 -46px; pointer-events: none; fill: var(--brand);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .3)); animation: vdHeart .8s ease-out forwards; }
@keyframes vdHeart {
  0% { transform: scale(.4) rotate(var(--rot)); opacity: 0; }
  20% { transform: scale(1.1) rotate(var(--rot)); opacity: 1; }
  35% { transform: scale(.95) rotate(var(--rot)); }
  100% { transform: translateY(-70px) scale(1.25) rotate(var(--rot)); opacity: 0; }
}

/* ===== 视频信息：作者 / 标题 / 播放量 ===== */
.vd-info { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 60px 16px 18px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .55)); }
.vd-by { display: flex; align-items: center; gap: 8px; }
.vd-ava { flex: none; width: 34px; height: 34px; border-radius: 50%; overflow: hidden; border: 1px solid rgba(255, 255, 255, .6);
  background: rgba(255, 255, 255, .15); display: grid; place-items: center; font-size: 14px; font-weight: 600; }
.vd-ava img { width: 100%; height: 100%; object-fit: cover; }
/* 头像 + 名字整块可点，进自媒体主页 */
.vd-author { display: flex; align-items: center; gap: 8px; min-width: 0; color: inherit; }
.vd-name { min-width: 0; max-width: 55%; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
/* 关注：延续图文页的小方角样式（深色背景上用实色），不用胶囊 */
.vd-follow { flex: none; display: flex; align-items: center; gap: 2px; height: 24px; padding: 0 9px 0 6px; border-radius: 6px;
  background: var(--brand); color: #fff; font-size: 12px; font-weight: 600; }
.vd-follow svg { width: 12px; height: 12px; }
.vd-follow.on { padding: 0 9px; background: rgba(255, 255, 255, .18); color: var(--vd-ink-2); font-weight: 400; }
.vd-follow.on svg { display: none; }
.vd-title { margin-top: 10px; font-size: 15px; line-height: 1.55; text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vd-info.open .vd-title { display: block; max-height: 36vh; overflow-y: auto; }
.vd-info.open { background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .78) 40%); }
.vd-more { margin-top: 2px; font-size: 14px; font-weight: 600; color: #fff; }
.vd-meta { margin-top: 8px; font-size: 12px; color: var(--vd-ink-3); }

/* 流末尾 */
.vd-end { display: grid; place-content: center; gap: 14px; text-align: center; color: var(--vd-ink-3); font-size: 14px; }
.vd-end a { display: inline-block; height: 38px; line-height: 38px; padding: 0 22px; border-radius: 19px; background: rgba(255, 255, 255, .14); color: #fff; }

/* ===== 进度条：在底栏上方，手指按住变粗并显示时间 ===== */
.vd-progress { position: fixed; left: 0; right: 0; z-index: 5; bottom: calc(var(--vd-act-h) + env(safe-area-inset-bottom));
  height: 20px; margin-bottom: -9px; padding: 9px 0; touch-action: none; }
.vd-track { position: relative; height: 2px; background: rgba(255, 255, 255, .22); transition: height .15s; }
.vd-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255, 255, 255, .85); }
.vd-thumb { position: absolute; top: 50%; left: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; opacity: 0; transition: opacity .15s; }
.vd-time { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); display: none; padding: 4px 12px; border-radius: 8px;
  background: rgba(0, 0, 0, .55); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vd-time small { font-size: 14px; font-weight: 400; color: var(--vd-ink-3); }
.vd-progress.drag .vd-track { height: 4px; }
.vd-progress.drag .vd-thumb { opacity: 1; }
.vd-progress.drag .vd-time { display: block; }

/* ===== 底部操作栏 ===== */
.vd-act { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; align-items: center; gap: 2px;
  height: calc(var(--vd-act-h) + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom) 12px; background: #0E0E0F; }
.vd-input { flex: 1; min-width: 0; height: 36px; display: flex; align-items: center; gap: 6px; padding: 0 14px; margin-right: 6px;
  border-radius: 18px; background: rgba(255, 255, 255, .1); color: var(--vd-ink-3); font-size: 14px; }
.vd-input svg { width: 16px; height: 16px; }
/* 纯净版：剩下的点赞/分享平分布 */
.vd-act.act-pure .vd-btn { flex: 1; }
.vd-btn { flex: none; min-width: 50px; height: 44px; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0 4px;
  font-size: 13px; color: var(--vd-ink-2); font-variant-numeric: tabular-nums; }
.vd-btn svg { width: 23px; height: 23px; }
.vd-btn .heart { fill: none; stroke: currentColor; stroke-width: 1.7; }
.vd-btn.liked { color: var(--brand); }
.vd-btn.liked .heart { fill: currentColor; animation: pop .35s ease; }
@keyframes pop { 40% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* ===== 评论弹层（浅色 / 深色随系统） ===== */
.vc-sheet { display: flex; flex-direction: column; height: 72vh; padding: 0 0 env(safe-area-inset-bottom); color: var(--ink); }
.vc-head { position: relative; flex: none; padding: 16px 0 10px; text-align: center; font-size: 14px; font-weight: 600; }
.vc-close { position: absolute; right: 8px; top: 6px; width: 40px; height: 40px; font-size: 24px; color: var(--ink-3); }
.vc-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px; overscroll-behavior: contain; }
.vc-item { display: flex; gap: 10px; padding: 12px 0; }
.vc-item + .vc-item { border-top: 1px solid var(--line); }
.vc-ava { flex: none; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: var(--surface-2);
  display: grid; place-items: center; font-size: 13px; color: var(--ink-2); }
.vc-ava img { width: 100%; height: 100%; object-fit: cover; }
.vc-main { flex: 1; min-width: 0; }
.vc-nick { font-size: 13px; color: var(--ink-3); }
.vc-msg { margin-top: 4px; font-size: 15px; line-height: 1.6; word-break: break-word; }
.vc-when { margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.vc-like { flex: none; align-self: flex-start; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 32px; font-size: 11px; color: var(--ink-3); }
.vc-like svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.vc-like.on { color: var(--brand); }
.vc-like.on svg { fill: currentColor; }
.vc-empty { padding: 48px 0; text-align: center; font-size: 13px; color: var(--ink-3); }
.vc-foot { flex: none; padding: 8px 16px; border-top: 1px solid var(--line); }
.vc-foot button { width: 100%; height: 38px; padding: 0 14px; border-radius: 19px; background: var(--surface-2); color: var(--ink-3); font-size: 14px; text-align: left; }
/* 评论弹层不需要 .report-body 默认内边距 */
.report-body.vc-sheet { padding: 0 0 env(safe-area-inset-bottom); }
/* 页面文字是白色，底部弹层（评论 / 分享 / 写评论）要恢复正文颜色，否则白字落在浅色底上看不见 */
body.vd .report-body { color: var(--ink); }

/* 「轻触开启声音」5 秒后淡出，避免一直压在画面上 */
.vd-unmute { transition: opacity .4s; }
.vd-unmute.fade { opacity: 0; pointer-events: none; }
