/* ============================================================================
   实况图 + 图片帖背景音乐 —— 样式层
   ---------------------------------------------------------------------------
   · .ph.live        信息流里的实况图(静态图铺底, 动态段叠上去, 左上 LIVE 角标)
   · .lb-livevid     大图查看器里的动态段
   · .pmusic         帖子底部的背景音乐胶囊(旋转唱片 + 歌名 + 波形)
   · .lpanel         发帖页的实况图面板
   · .mchip / .music-modal  已选音乐胶囊 / 选歌弹窗
   颜色全部走站内 CSS 变量(--bg-*, --text-*, --accent...), 换主题不用改这里。
   ============================================================================ */

/* ---------------------------- 实况图: 信息流 ---------------------------- */
.ph.live {
  position: relative;
  overflow: hidden;              /* 圆角裁切, 动态段不能溢出去 */
  isolation: isolate;
}
.ph.live > img { position: relative; z-index: 1; }
.ph.live > video.lvvid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;             /* 与静态图同一裁切方式, 切到动态时不跳 */
  z-index: 2;
  opacity: 0;
  transition: opacity .18s ease;
  pointer-events: none;
  background: #000;
}
.ph.live.lvplaying > video.lvvid { opacity: 1; }

/* LIVE 角标: 平时半透明, 播放时变实心并轻微脉动 */
.ph.live .lvtag {
  position: absolute;
  z-index: 3;
  top: 6px;
  left: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px 2px 4px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.5;
  color: #fff;
  background: rgba(0, 0, 0, .48);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  user-select: none;
  transition: background .18s ease, transform .18s ease;
}
.ph.live .lvtag svg { display: block; }
.ph.live .lvtag:hover { background: rgba(0, 0, 0, .68); }
.ph.live.lvplaying .lvtag {
  background: var(--accent, #ff3b6b);
  box-shadow: 0 0 0 0 rgba(255, 59, 107, .55);
  animation: lvpulse 1.6s ease-out infinite;
}
/* 带原声播放时角标加一个小喇叭, 让「现在有声音」这件事看得见 */
.ph.live.lvsound .lvtag::after {
  content: "";
  width: 9px;
  height: 9px;
  margin-left: 1px;
  background: currentColor;
  -webkit-mask: var(--spk) center / contain no-repeat;
  mask: var(--spk) center / contain no-repeat;
}
.ph.live .lvtag,
.xhs-cover .xhs-live {
  --spk: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'><path d='M4 9v6h4l5 4V5L8 9H4z'/><path d='M17 8.6a4.6 4.6 0 010 6.8'/></svg>");
}
@keyframes lvpulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 59, 107, .5); }
  70%  { box-shadow: 0 0 0 7px rgba(255, 59, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 59, 107, 0); }
}

/* ---------------------- 多图帖自动轮播 (信息流 / 详情页) ------------------ */
/* 一框一张, 3.6 秒自动翻页并循环; 右上角 n/N, 底部进度点。
   用叠放 + opacity 切换而不是横向 translate: 图片高度不一致时不会跳版。 */
.pgc {
  position: relative;
  width: 100%;
  max-width: 560px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-hover, #15151c);
  isolation: isolate;
}
.pgc-track {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 72vh;
}
.pgc-track > .ph {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.015);
  transition: opacity .5s ease, transform 4.2s ease-out;
  pointer-events: none;
  z-index: 1;
}
.pgc-track > .ph.on {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  z-index: 2;
}
.pgc-track > .ph > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 右上角 n/N */
.pgc-n {
  position: absolute;
  z-index: 4;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.6;
  color: #fff;
  background: rgba(0, 0, 0, .46);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.pgc-n b { font-weight: 800; }

/* 底部进度点: 当前那颗拉长, 一眼看出还有几张 */
.pgc-dots {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: 9px;
  display: flex;
  justify-content: center;
  gap: 5px;
  pointer-events: auto;
}
.pgc-dots i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .42);
  box-shadow: 0 0 3px rgba(0, 0, 0, .5);
  cursor: pointer;
  transition: width .25s ease, background .25s ease;
}
.pgc-dots i.on {
  width: 16px;
  background: #fff;
}

/* 轮播里的实况图角标位置微调(右上角被 n/N 占了) */
.pgc .ph.live .lvtag { top: 8px; left: 8px; }

/* ---------------------- 实况图: 探索页瀑布流卡片 ------------------------- */
/* 时长按/悬停在封面上就能播, 与信息流共用 postmedia.js 的同一套逻辑 */
.xhs-cover.live { position: relative; overflow: hidden; }
.xhs-cover.live > img { position: relative; z-index: 1; }
.xhs-cover.live > video.lvvid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  opacity: 0;
  transition: opacity .18s ease;
  pointer-events: none;
  background: #000;
}
.xhs-cover.live.lvplaying > video.lvvid { opacity: 1; }

.xhs-live {
  position: absolute;
  z-index: 3;
  top: 7px;
  left: 7px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, .52);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.xhs-cover.live.lvplaying .xhs-live { background: var(--accent, #ff3b6b); }
.xhs-cover.live .xhs-live svg { display: block; }

/* 卡片上的音乐条: 只做「这条帖配了歌」的提示, 播放留给详情页 */
.xhs-music {
  position: absolute;
  z-index: 3;
  left: 7px;
  bottom: 7px;
  right: 7px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 14px);
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.3;
  color: #fff;
  background: rgba(0, 0, 0, .46);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.xhs-music svg { flex: 0 0 auto; display: block; }

/* ---------------------------- 实况图: 大图查看器 ------------------------- */
.lb-stage { position: relative; }
.lb-livevid {
  position: absolute;
  inset: auto;
  max-width: min(92vw, 1100px);
  max-height: 86vh;
  width: auto;
  height: auto;
  border-radius: 12px;
  background: #000;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
  z-index: 2;
}
.lb-stage.lvplaying .lb-livevid { opacity: 1; }
.lb-live-tag {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}
.lb-live-tag:active { transform: translateX(-50%) scale(.96); }

/* ---------------------------- 图片帖背景音乐 ---------------------------- */
.pmusic {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 9px 0 2px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--line, rgba(255, 255, 255, .09));
  border-radius: 999px;
  background: linear-gradient(120deg,
      rgba(255, 59, 107, .10), rgba(120, 80, 255, .08) 55%, rgba(255, 255, 255, .02));
  width: fit-content;
  max-width: 100%;
  transition: border-color .18s ease, transform .18s ease;
}
.pmusic:hover { border-color: rgba(255, 59, 107, .38); }
.pmusic.playing { border-color: rgba(255, 59, 107, .55); }

/* 唱片: 圆形封面 + 中心孔, 播放时匀速旋转 */
.pm-disc {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  background: #1a1a20;
  color: var(--text-dim, #9aa);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset;
}
.pm-disc img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}
.pm-hole {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .78);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .16);
}
.pmusic.playing .pm-disc { animation: pmsingle 8s linear infinite; }
.pmusic.playing .pm-hole { box-shadow: 0 0 0 2px rgba(255, 255, 255, .3); }
@keyframes pmsingle { to { transform: rotate(360deg); } }

.pm-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.pm-meta b {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text, #eceff4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}
.pm-meta span {
  font-size: 11px;
  color: var(--text-dim, #8b93a1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}

/* 波形: 平时静态细条, 播放时跳动(纯装饰, 让"在放歌"这件事一眼看得出来) */
.pm-wave {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  margin-left: 2px;
}
.pm-wave i {
  width: 2px;
  height: 4px;
  border-radius: 1px;
  background: currentColor;
  color: var(--accent, #ff3b6b);
  opacity: .55;
}
.pmusic.playing .pm-wave i { animation: pmwave .9s ease-in-out infinite; }
.pmusic.playing .pm-wave i:nth-child(2) { animation-delay: .15s; }
.pmusic.playing .pm-wave i:nth-child(3) { animation-delay: .3s; }
.pmusic.playing .pm-wave i:nth-child(4) { animation-delay: .45s; }
@keyframes pmwave {
  0%, 100% { height: 4px; opacity: .5; }
  50%      { height: 13px; opacity: 1; }
}

/* ---------------------------- 发帖页: 实况图面板 ------------------------- */
.lpanel {
  margin: 10px 0 4px;
  padding: 12px;
  border: 1px solid var(--line, rgba(255, 255, 255, .1));
  border-radius: 14px;
  background: rgba(255, 255, 255, .025);
}
.lpanel[hidden] { display: none; }
.lp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--accent, #ff3b6b);
}
.lp-head > div { display: flex; flex-direction: column; line-height: 1.3; }
.lp-head b { font-size: 13px; color: var(--text, #eceff4); }
.lp-head span { font-size: 11.5px; color: var(--text-dim, #8b93a1); }

.lp-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lp-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 88px;
  padding: 8px;
  border: 1px dashed rgba(255, 255, 255, .18);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color .18s ease, background .18s ease;
  overflow: hidden;
}
.lp-slot:hover { border-color: var(--accent, #ff3b6b); background: rgba(255, 59, 107, .06); }
.lp-slot.on { border-style: solid; border-color: rgba(255, 59, 107, .6); }
.lp-slot b { font-size: 12px; font-weight: 600; color: var(--text, #eceff4); }
.lp-slot i { font-size: 10.5px; font-style: normal; color: var(--text-dim, #8b93a1); }
.lp-prev {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 46px;
  color: var(--text-dim, #8b93a1);
  overflow: hidden;
}
.lp-prev img, .lp-prev video {
  max-width: 100%;
  max-height: 46px;
  border-radius: 8px;
  display: block;
}
.lp-note {
  margin-top: 9px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-dim, #8b93a1);
  word-break: break-word;
}
.lp-note code {
  padding: 0 3px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .07);
  font-size: 10.5px;
}
.lp-acts { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.lp-acts .hint { font-size: 11.5px; }

/* 已上传的实况图缩略图(upgrid 里) */
.upitem.has-live { position: relative; }
.upitem.has-live::after {
  content: "LIVE";
  position: absolute;
  left: 4px;
  top: 4px;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #fff;
  background: var(--accent, #ff3b6b);
}

/* ---------------------------- 发帖页: 已选音乐胶囊 ----------------------- */
.mchip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 2px;
  padding: 6px 10px 6px 6px;
  border: 1px solid rgba(255, 59, 107, .35);
  border-radius: 999px;
  background: rgba(255, 59, 107, .08);
  width: fit-content;
  max-width: 100%;
}
.mchip[hidden] { display: none; }
.mc-disc {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 59, 107, .18);
  color: var(--accent, #ff3b6b);
  overflow: hidden;
  flex: 0 0 auto;
}
.mc-disc img { width: 100%; height: 100%; object-fit: cover; }
.mc-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.mc-txt b {
  font-size: 12px;
  color: var(--text, #eceff4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46vw;
}
.mc-txt span { font-size: 10.5px; color: var(--text-dim, #8b93a1); }
.mc-x {
  border: 0;
  background: transparent;
  color: var(--text-dim, #8b93a1);
  font-size: 13px;
  cursor: pointer;
  padding: 0 2px;
}
.mc-x:hover { color: var(--text, #fff); }

/* ---------------------------- 发帖页: 选歌弹窗 --------------------------- */
.modal.music-modal {
  width: min(520px, 94vw);
  /* 2026-10-31 修：手机上原来用 vh，键盘一弹（focus 输入框）可视区变矮，
     弹窗被算到可视区外面 → 看不到，缩放页面才重新排回来。改 dvh + 兜底。 */
  max-height: min(86vh, 86dvh, 720px);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  min-height: 0;
  animation: mmIn .22s cubic-bezier(.22, 1, .36, 1);
}
@keyframes mmIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.mm-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 10px;
  color: var(--accent, #ff3b6b);
  border-bottom: 1px solid var(--line, rgba(255, 255, 255, .08));
}
.mm-head b { flex: 1; font-size: 14px; color: var(--text, #eceff4); }
.mm-x {
  border: 0;
  background: transparent;
  color: var(--text-dim, #8b93a1);
  font-size: 15px;
  cursor: pointer;
  padding: 2px 4px;
}
.mm-x:hover { color: #fff; }

/* 选歌弹窗专用遮罩兜底：占满可视区、内容区可滚（手机键盘弹出也不会把弹窗挤出屏幕） */
#musicMask {
  height: 100vh;
  height: 100dvh;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}
#musicMask .mm-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.mm-search {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line, rgba(255, 255, 255, .06));
}
.mm-search input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line, rgba(255, 255, 255, .14));
  border-radius: 10px;
  background: rgba(0, 0, 0, .28);
  color: var(--text, #eceff4);
  font-size: 13px;
  outline: none;
}
.mm-search input:focus { border-color: var(--accent, #ff3b6b); }

.mm-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 8px;
  min-height: 120px;
}
.mm-tip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 34px 12px;
  color: var(--text-dim, #8b93a1);
  font-size: 12px;
  text-align: center;
}
.mm-loading { padding: 30px 0; text-align: center; font-size: 12px; color: var(--text-dim); }

.mm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s ease;
  position: relative;         /* 底部试听进度条定位用 */
  overflow: hidden;
}
.mm-row:hover, .mm-row.on { background: rgba(255, 255, 255, .06); }
.mm-row img, .mm-row .mm-ph {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, .06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}
.mm-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.mm-info b {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text, #eceff4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mm-info span {
  font-size: 11px;
  color: var(--text-dim, #8b93a1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mm-dur { font-size: 11px; color: var(--text-dim, #8b93a1); flex: 0 0 auto; }

/* ---- 列表内试听: 每行一个播放键 + 行底一条细进度 ---- */
.mm-pv {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line, rgba(255, 255, 255, .14));
  border-radius: 50%;
  background: rgba(255, 255, 255, .04);
  color: var(--text-dim, #9aa3b2);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease, transform .12s ease;
}
.mm-pv svg { display: block; }
.mm-pv:hover {
  color: var(--text, #fff);
  border-color: rgba(255, 59, 107, .55);
  background: rgba(255, 59, 107, .12);
}
.mm-pv:active { transform: scale(.92); }
.mm-row.pv-on { background: rgba(255, 59, 107, .08); }
.mm-row.pv-on .mm-pv {
  color: #fff;
  border-color: var(--accent, #ff3b6b);
  background: var(--accent, #ff3b6b);
  box-shadow: 0 0 0 0 rgba(255, 59, 107, .45);
  animation: lvpulse 1.6s ease-out infinite;
}
.mm-row.pv-on .mm-info b { color: var(--accent, #ff3b6b); }

.mm-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: transparent;
  pointer-events: none;
}
.mm-bar b {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 0 2px 2px 0;
  background: var(--accent, #ff3b6b);
  transition: width .18s linear;
}
.mm-vip {
  padding: 0 5px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  color: #ffcf5c;
  border: 1px solid rgba(255, 207, 92, .5);
}
.mm-foot {
  padding: 8px 16px 12px;
  border-top: 1px solid var(--line, rgba(255, 255, 255, .06));
}
.mm-foot .hint { font-size: 11px; }

/* 手机: 宫格里实况角标小一点, 音乐胶囊不要顶到边 */
@media (max-width: 640px) {
  .ph.live .lvtag { font-size: 9px; padding: 1px 5px 1px 3px; top: 4px; left: 4px; }
  .pmusic { padding: 5px 10px 5px 5px; gap: 8px; }
  .pm-disc { width: 30px; height: 30px; }
  .pm-meta b, .pm-meta span { max-width: 52vw; }
  .lp-slots { grid-template-columns: 1fr 1fr; }
  .music-modal { max-height: 88vh; }
}

/* 用户开了「减少动态效果」就别转圈/跳动 */
@media (prefers-reduced-motion: reduce) {
  .pmusic.playing .pm-disc,
  .pmusic.playing .pm-wave i,
  .ph.live.lvplaying .lvtag { animation: none; }
}
