/* ==========================================================================
 * 卿梦 · 全屏视频（2.6.8-f26 焊死式独立播放器）
 * 独立页 /video/ 与广场视频 Tab 共用；暗底沉浸，不继承站点明暗主题。
 *
 * 结构：整页只有一个 <video>，切换视频只换 src，不再是一条一条堆 DOM。
 * 布局：.qm-reel 固定满屏 → .qm-reel-stage 铺满 → 覆盖层（顶栏/互动/文案）。
 * 关键：滚动条、body 滚动、地址栏伸缩都被排除在外，上滑永远只换「数据」，
 *       下一条视频不可能从底下冒出来。
 * ==========================================================================*/

body.qm-reel-body {
  margin: 0;
  height: 100%;
  background: #000;
  color: #fff;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
body.qm-reel-body .qm-sr { position: absolute; left: -9999px; }

.qm-reel-main { height: 100dvh; }

/* 广场里的视频 Tab：站点头尾、底部按钮全部收起，只留三个 Tab */
body.qm-reel-embed-on { height: 100dvh; }
body.qm-reel-embed-on .qm-header,
body.qm-reel-embed-on .qm-footer,
body.qm-reel-embed-on .qm-tabbar,
body.qm-reel-embed-on .qm-backtop,
body.qm-reel-embed-on .qm-drawer,
body.qm-reel-embed-on .qm-drawer-mask { display: none !important; }
body.qm-reel-embed-on .qm-tabs-sticky {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  margin: 0;
  padding-top: env(safe-area-inset-top, 0px);
  background: #000;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 0;
  box-shadow: none;
}
body.qm-reel-embed-on .qm-tabs-sticky a { color: rgba(255, 255, 255, .64); }
body.qm-reel-embed-on .qm-tabs-sticky a.on {
  background: rgba(255, 255, 255, .16);
  color: #fff;
  box-shadow: none;
}
body.qm-reel-embed-on .qm-container { padding: 0; }
body.qm-reel-embed-on .qm-page { padding: 0 !important; }

.qm-reel {
  --reel-w: 100%;
  --reel-top: var(--qm-reel-top, 0px);
  --reel-dy: 0px;
  position: fixed;
  inset: 0;
  height: 100dvh;      /* 老浏览器兜底 */
  height: 100svh;
  overflow: hidden;
  background: #000;
  color: #fff;
  touch-action: none;  /* 竖向手势全归 JS，页面不许滚 */
  overscroll-behavior: contain;
}
/* 嵌在广场里：从三个 Tab 下沿开始铺到底（不遮 Tab，也不被 Tab 遮） */
.qm-reel--embed {
  top: var(--reel-top, 0px);
  height: auto;
  bottom: 0;
  z-index: 30;
}

/* ---------- 唯一的播放器 ---------- */
.qm-reel-stage {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: var(--reel-w);
  transform: translateX(-50%) translateY(var(--reel-dy, 0px));
  z-index: 1;
  background: #000;
  overflow: hidden;
  transition: transform .24s cubic-bezier(.22, .61, .36, 1);
}
/* 拖动跟手时不要过渡，松手才回弹 */
.qm-reel.is-dragging .qm-reel-stage { transition: none; }
.qm-reel-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;      /* 完整显示，不裁掉画面 */
  background: #000;
}
/* 手机竖屏：比例接近时铺满（仍然 contain，不裁画面） */
@media (max-width: 900px) {
  .qm-reel-video { object-fit: contain; }
}
/* 桌面端保持竖屏比例居中，两侧留黑 */
@media (min-width: 901px) {
  .qm-reel { --reel-w: min(520px, 100vw); }
  .qm-reel-stage { box-shadow: 0 0 0 1px rgba(255, 255, 255, .06); }
}

/* 底部压暗，保证文字可读 */
.qm-reel-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, 0) 26%),
    linear-gradient(0deg, rgba(0, 0, 0, .68) 0%, rgba(0, 0, 0, 0) 42%);
}

.qm-reel-tap {
  position: absolute;
  inset: 0;
  z-index: 3;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.qm-reel-playicon {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: 74px;
  height: 74px;
  margin: -37px 0 0 -37px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .4);
  color: #fff;
  opacity: 1;
  transition: opacity .2s ease;
  pointer-events: none;
}
.qm-reel.is-playing .qm-reel-playicon { opacity: 0; }

.qm-reel-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  height: 2px;
  background: rgba(255, 255, 255, .18);
}
.qm-reel-progress i { display: block; height: 100%; width: 0; background: rgba(255, 255, 255, .95); transition: width .1s linear; }

.qm-reel-mute {
  position: absolute;
  right: 14px;
  bottom: 18px;
  z-index: 7;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .42);
  color: #fff;
  cursor: pointer;
  opacity: .9;
}
.qm-reel-mute.is-on { background: rgba(255, 255, 255, .22); }

/* ---------- 顶部条 ---------- */
.qm-reel-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) calc((100% - var(--reel-w)) / 2 + 16px) 30px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .6), rgba(0, 0, 0, 0));
  pointer-events: none;
}
.qm-reel-top > * { pointer-events: auto; }
.qm-reel-back {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-decoration: none;
}
.qm-reel-title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.qm-reel-title b { font-size: 16px; letter-spacing: .04em; }
.qm-reel-title span { font-size: 11px; color: rgba(255, 255, 255, .62); }
.qm-reel-post {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--qm-primary, #6c5ce7);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

/* ---------- 右侧互动 ---------- */
.qm-reel-side {
  position: absolute;
  right: calc((100% - var(--reel-w)) / 2 + 12px);
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.qm-reel-av { position: relative; display: block; text-decoration: none; }
.qm-reel-av .qm-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .9);
  object-fit: cover;
  display: block;
}
.qm-reel-follow {
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--qm-primary, #6c5ce7);
  color: #fff;
  border: 2px solid #000;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.qm-reel-follow[hidden] { display: none !important; }
.qm-reel-follow.is-on { background: #34c759; }

.qm-reel-act {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: 0;
  background: none;
  padding: 0;
  color: #fff;
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .55);
}
.qm-reel-act svg { width: 28px; height: 28px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5)); }
.qm-reel-act em { font-style: normal; line-height: 1; }
.qm-reel-act.on, .qm-reel-act.liked { color: #ff4d6d; }
.qm-reel-act.on svg, .qm-reel-act.liked svg { fill: currentColor; }
.qm-reel-act.is-bump { animation: qm-reel-bump .36s ease; }
@keyframes qm-reel-bump {
  0% { transform: scale(1); }
  45% { transform: scale(1.28); }
  100% { transform: scale(1); }
}

/* ---------- 左下文案 ---------- */
.qm-reel-info {
  position: absolute;
  left: calc((100% - var(--reel-w)) / 2 + 16px);
  right: calc((100% - var(--reel-w)) / 2 + 84px);
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  z-index: 8;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .6);
}
.qm-reel-info h2 { margin: 0 0 6px; font-size: 16px; line-height: 1.4; font-weight: 700; }
.qm-reel-info h2[hidden] { display: none !important; }
.qm-reel-info h2 a { color: #fff; text-decoration: none; }
.qm-reel-info p { margin: 0 0 6px; font-size: 13px; line-height: 1.6; color: rgba(255, 255, 255, .9); }
.qm-reel-info p[hidden] { display: none !important; }
.qm-reel-author { margin-bottom: 6px; color: #fff; }
.qm-reel-author .qm-identity-name, .qm-reel-author .qm-ident-name { color: #fff; }
.qm-reel-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 4px; }
.qm-reel-tags:empty { display: none; }
.qm-reel-tags a { font-size: 12px; color: rgba(255, 255, 255, .92); text-decoration: none; }
.qm-reel-time { font-size: 11px; color: rgba(255, 255, 255, .55); margin: 0; }

/* ---------- 提示 / 序号 ---------- */
.qm-reel-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 20;
  transform: translate(-50%, -50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  font-size: 12px;
  color: rgba(255, 255, 255, .88);
  pointer-events: none;
  transition: opacity .5s ease;
}
.qm-reel-hint.is-hide { opacity: 0; }

.qm-reel-count {
  position: absolute;
  right: calc((100% - var(--reel-w)) / 2 + 12px);
  top: calc(env(safe-area-inset-top, 0px) + 58px);
  z-index: 9;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .38);
  font-size: 11px;
  color: rgba(255, 255, 255, .78);
  pointer-events: none;
}

.qm-reel-loading {
  position: absolute;
  left: 50%;
  bottom: 86px;
  z-index: 15;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  font-size: 12px;
  color: rgba(255, 255, 255, .85);
}
.qm-reel-loading[hidden] { display: none !important; }
.qm-reel-loading span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  animation: qm-reel-spin .7s linear infinite;
}
@keyframes qm-reel-spin { to { transform: rotate(360deg); } }

/* ---------- 空状态 ---------- */
.qm-reel-empty {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
  color: rgba(255, 255, 255, .86);
}
.qm-reel-empty svg { width: 44px; height: 44px; opacity: .7; }
.qm-reel-empty h2 { margin: 0; font-size: 20px; color: #fff; }
.qm-reel-empty p { margin: 0; font-size: 13px; color: rgba(255, 255, 255, .6); max-width: 320px; line-height: 1.7; }
.qm-reel-empty .qm-btn { background: #fff; color: #111; }

/* ---------- 评论抽屉 ---------- */
.qm-reel-sheet { position: fixed; inset: 0; z-index: 9998; }
.qm-reel-sheet[hidden] { display: none !important; }
.qm-reel-sheet-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.qm-reel-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 74dvh;
  display: flex;
  flex-direction: column;
  background: var(--qm-surface, #fff);
  color: var(--qm-text, #16181d);
  border-radius: 18px 18px 0 0;
  transform: translateY(102%);
  transition: transform .28s cubic-bezier(.32, .72, 0, 1);
  overflow: hidden;
}
.qm-reel-sheet.is-open .qm-reel-sheet-panel { transform: none; }
@media (min-width: 720px) {
  .qm-reel-sheet-panel { max-width: 480px; left: auto; right: 24px; bottom: 24px; border-radius: 16px; }
}
.qm-reel-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--qm-divider, rgba(0, 0, 0, .07));
}
.qm-reel-sheet-head b { font-size: 14px; }
.qm-reel-sheet-x {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--qm-surface-2, #f2f3f6);
  color: var(--qm-text-2, #5a6070);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.qm-reel-clist {
  flex: 1 1 auto;
  min-height: 120px;
  margin: 0;
  padding: 12px 18px;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.qm-reel-c { display: flex; gap: 10px; padding: 10px 0; }
.qm-reel-c img.qm-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}
.qm-reel-c-main { min-width: 0; flex: 1 1 auto; }
.qm-reel-c-top { display: flex; align-items: baseline; gap: 8px; }
.qm-reel-c-top b { font-size: 13px; }
.qm-reel-c-top span { font-size: 11px; color: var(--qm-text-3, #9aa0ae); }
.qm-reel-c p { margin: 3px 0 0; font-size: 13px; line-height: 1.6; word-break: break-word; }
.qm-reel-cmore-wrap { padding: 0 18px 8px; text-align: center; }
.qm-reel-cmore {
  border: 0;
  background: none;
  color: var(--qm-primary, #6c5ce7);
  font-size: 12px;
  cursor: pointer;
  padding: 6px;
}
.qm-reel-cmore[hidden] { display: none !important; }
.qm-reel-cempty { padding: 26px 0; text-align: center; font-size: 13px; color: var(--qm-text-3, #9aa0ae); }
.qm-reel-cform {
  display: flex;
  gap: 8px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--qm-divider, rgba(0, 0, 0, .07));
  background: var(--qm-surface, #fff);
}
.qm-reel-cform input {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--qm-border, #e3e6ee);
  background: var(--qm-surface-2, #f6f7fa);
  font-size: 13px;
  outline: none;
}
.qm-reel-cform input:focus { border-color: var(--qm-primary, #6c5ce7); }
.qm-reel-cform button {
  flex: none;
  height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--qm-primary, #6c5ce7);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.qm-reel-cform button:disabled { opacity: .5; cursor: not-allowed; }

/* 轻提示 */
.qm-reel-toast {
  position: fixed;
  left: 50%;
  bottom: 15%;
  z-index: 10000;
  transform: translateX(-50%) translateY(8px);
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .78);
  color: #fff;
  font-size: 12.5px;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
.qm-reel-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 480px) {
  .qm-reel-side { right: calc((100% - var(--reel-w)) / 2 + 8px); gap: 16px; }
  .qm-reel-act svg { width: 26px; height: 26px; }
  .qm-reel-info { left: calc((100% - var(--reel-w)) / 2 + 14px); right: calc((100% - var(--reel-w)) / 2 + 74px); }
  .qm-reel-info h2 { font-size: 15px; }
  .qm-reel-title span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .qm-reel-progress i { transition: none; }
  .qm-reel-act.is-bump { animation: none; }
}

/* ==========================================================================
 * 2.6.8-f26：嵌入广场 / 声音 / 发布悬浮按钮
 * ==========================================================================*/

/* 广场视频 Tab：序号挪到左上，右上留给发布 */
.qm-reel--embed .qm-reel-count { top: 12px; right: auto; left: 12px; }
.qm-reel--embed .qm-reel-side { bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
.qm-reel--embed .qm-reel-info { bottom: calc(30px + env(safe-area-inset-bottom, 0px)); }
/* 嵌入时右上没有独立顶栏，静音钮贴进度条上方，避开右侧互动条 */
.qm-reel--embed .qm-reel-mute { bottom: calc(50px + env(safe-area-inset-bottom, 0px)); }

/* 发布视频（只出现在广场 Tab） */
.qm-reel-fab {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 7px 13px 7px 10px;
  border-radius: 999px;
  background: var(--qm-primary, #6c5ce7);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .38);
}
.qm-reel-fab b { font-weight: 600; }
.qm-reel-fab:active { transform: scale(.96); }

/* 声音被浏览器拦下时的提示（点一下就有声） */
.qm-reel-sound-tip {
  position: absolute;
  left: 50%;
  bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  z-index: 21;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, .66);
  color: #fff;
  font-size: 12.5px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: qm-reel-tip 2.2s ease-in-out infinite;
}
.qm-reel-sound-tip[hidden] { display: none !important; }
@keyframes qm-reel-tip {
  0%, 100% { opacity: .92; }
  50% { opacity: 1; box-shadow: 0 0 0 6px rgba(255, 255, 255, .12); }
}
.qm-reel-sound-tip svg { width: 15px; height: 15px; }

/* 静音按钮：没开声音时更显眼 */
.qm-reel-mute:not(.is-on) { animation: qm-reel-mute 2.4s ease-in-out infinite; }
@keyframes qm-reel-mute {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .3); }
  50% { box-shadow: 0 0 0 5px rgba(255, 255, 255, .08); }
}

/* 空状态也要铺满整个播放器区域 */
body.qm-reel-embed-on .qm-reel-empty {
  position: fixed;
  top: var(--qm-reel-top, 0px);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 31;
  height: auto;
  background: #000;
}

/* 加载中提示别挡住互动条 */
.qm-reel--embed .qm-reel-loading { bottom: 112px; }
