/* ==========================================================================
   全屏竖屏视频流（TikTok 风格）—— 前台样式
   颜色/尺寸集中在本文件顶部变量，改样式优先改变量
   ========================================================================== */

:root {
  --c-bg: #000;
  --c-text: #fff;
  --c-sub: rgba(255, 255, 255, .7);
  --c-dim: rgba(255, 255, 255, .55);
  --c-pink: #ff2d55;
  --c-cyan: #25f4ee;
  --c-link: #4ea3ff;
  --tabbar-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Helvetica, Arial, "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 隐藏属性优先于各区块的 display 声明 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; }

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* ------------------------------------------------------------------ 顶栏 */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  height: calc(60px + var(--safe-top));
  padding: var(--safe-top) 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.top-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  height: 160px;
  background: linear-gradient(rgba(0, 0, 0, .55), transparent);
  pointer-events: none;
}

.icon-btn {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  pointer-events: auto;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5));
}
.icon-btn svg { width: 24px; height: 24px; display: block; }

.tabs {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 22px;
  pointer-events: auto;
}

.top-right {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  pointer-events: auto;
}

/* 语言下拉（点地球图标弹出） */
.lang-menu {
  position: fixed;
  top: calc(56px + var(--safe-top));
  right: 12px;
  z-index: 40;
  min-width: 132px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(28, 28, 28, .96);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
  backdrop-filter: blur(12px);
}
.lang-menu button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  text-align: left;
  color: rgba(255, 255, 255, .82);
}
.lang-menu button:active { background: rgba(255, 255, 255, .08); }
.lang-menu button.on {
  color: #fff;
  font-weight: 600;
  background: rgba(255, 45, 85, .18);
}
.tab {
  position: relative;
  font-size: 16px;
  font-weight: 600;
  color: rgba(255, 255, 255, .68);
  padding-bottom: 7px;
  cursor: pointer;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
  transition: color .15s;
}
.tab.active { color: #fff; }
.tab.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: #fff;
  transform: translateX(-50%);
}

/* ------------------------------------------------------------------ 视频流 */
.feed {
  position: fixed;
  inset: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: #000;
}
.feed::-webkit-scrollbar { display: none; }

.slide {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #000;
}

.slide .cover {
  position: absolute;
  inset: 0;
  background: #0b0b0b center/cover no-repeat;
  opacity: 1;
  transition: opacity .35s ease;
  z-index: 1;
}
.slide.playing .cover.hide,
.slide .cover.hide { opacity: 0; }

.slide video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  z-index: 0;
}

.slide iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 0;
  background: #000;
}

/* 无播放源占位 */
.no-source {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  gap: 8px;
  text-align: center;
  color: rgba(255, 255, 255, .55);
  font-size: 13px;
  letter-spacing: .08em;
  background: repeating-linear-gradient(45deg, #0a0a0a, #0a0a0a 12px, #0e0e0e 12px, #0e0e0e 24px);
}

.gradient-top,
.gradient-bottom {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  pointer-events: none;
}
.gradient-top { top: 0; height: 160px; background: linear-gradient(rgba(0, 0, 0, .55), transparent); }
.gradient-bottom { bottom: 0; height: 260px; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); }

/* 播放/暂停 */
.play-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: 82px;
  height: 82px;
  margin: -41px 0 0 -41px;
  opacity: 0;
  transform: scale(.85);
  transition: opacity .18s, transform .18s;
  pointer-events: none;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .55));
}
.slide.paused .play-icon { opacity: .9; transform: scale(1); }

/* 加载圈 */
.video-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid rgba(255, 255, 255, .22);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .9s linear infinite;
  display: none;
}
.slide.loading .video-loading { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 进度条 */
.progress-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  height: 2px;
  z-index: 6;
  background: rgba(255, 255, 255, .18);
  pointer-events: none;
}
.progress-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: rgba(255, 255, 255, .85);
}

/* 2 倍速提示 */
.speed-indicator {
  position: absolute;
  top: calc(64px + var(--safe-top));
  left: 50%;
  z-index: 6;
  transform: translateX(-50%);
  padding: 5px 12px;
  border-radius: 99px;
  background: rgba(0, 0, 0, .55);
  font-size: 12px;
  letter-spacing: .04em;
  opacity: 0;
  transition: opacity .18s;
  pointer-events: none;
}
.slide.speed2 .speed-indicator { opacity: 1; }

/* ------------------------------------------------------------ 右侧操作栏 */
.side-actions {
  position: absolute;
  right: 8px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 58px);
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.avatar-wrap { position: relative; width: 48px; height: 48px; margin-bottom: 4px; }
.avatar-wrap .avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  background: #2a2a2a center/cover no-repeat;
  overflow: hidden;
}
.avatar-wrap .follow-badge {
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  border-radius: 50%;
  background: var(--c-pink);
  display: grid;
  place-items: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}
.avatar-wrap .follow-badge svg { width: 12px; height: 12px; }

.act {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #fff;
}
.act svg {
  width: 34px;
  height: 34px;
  display: block;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .45));
  transition: transform .12s;
}
.act:active svg { transform: scale(.88); }
.act.liked svg { fill: var(--c-pink); stroke: var(--c-pink); }
.act .count {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}

.disc {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1c1c1c center/cover no-repeat;
  border: 1px solid rgba(255, 255, 255, .18);
  animation: spin 6s linear infinite;
  animation-play-state: paused;
  position: relative;
  overflow: hidden;
}
.disc::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .65);
}
.disc.on { animation-play-state: running; }

/* ------------------------------------------------------------ 左下信息区 */
.bottom-info {
  position: absolute;
  left: 14px;
  right: 82px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
  z-index: 8;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}
.bottom-info .username {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bottom-info .desc {
  font-size: 14px;
  line-height: 1.32;
  max-height: 56px;
  overflow: hidden;
  margin-bottom: 8px;
  word-break: break-word;
}
.bottom-info .desc .tag { color: var(--c-link); }
.bottom-info .music {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, .92);
}
.bottom-info .music svg { width: 14px; height: 14px; flex: none; }
.bottom-info .music span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------------- 底部导航 */
.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  align-items: stretch;
  background: rgba(0, 0, 0, .92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: .5px solid rgba(255, 255, 255, .12);
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: rgba(255, 255, 255, .6);
  font-size: 10px;
}
.tab-item svg { width: 23px; height: 23px; display: block; }
.tab-item.active { color: #fff; }
.tab-item.plus { justify-content: center; gap: 0; }

.plus-btn {
  position: relative;
  width: 34px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--c-cyan), var(--c-pink));
  display: grid;
  place-items: center;
  box-shadow: -2.5px 0 0 rgba(37, 244, 238, .55), 2.5px 0 0 rgba(255, 45, 85, .55);
}
.plus-btn svg { width: 16px; height: 16px; }

/* --------------------------------------------------------------- 空态 */
.empty {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
  padding: 0 32px;
  background: #000;
}
.empty-title { font-size: 17px; font-weight: 700; }
.empty-desc { font-size: 13px; color: var(--c-dim); line-height: 1.5; }
.empty-link {
  margin-top: 6px;
  font-size: 13px;
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 99px;
  padding: 8px 20px;
}

/* --------------------------------------------------------- 首次访问引导 */
.guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, .55);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  animation: fade .3s ease;
}
.guide-arrow {
  width: 46px;
  height: 46px;
  animation: floatUp 1.4s ease-in-out infinite;
}
.guide-arrow svg { width: 46px; height: 46px; }
.guide-text { font-size: 15px; letter-spacing: .08em; color: rgba(255, 255, 255, .9); }
@keyframes floatUp {
  0%, 100% { transform: translateY(8px); opacity: .55; }
  50% { transform: translateY(-6px); opacity: 1; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------- 搜索面板 */
.search-panel {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, .92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: fade .18s ease;
}
.search-inner { padding: calc(14px + var(--safe-top)) 14px 0; }
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .1);
}
.search-box svg { width: 18px; height: 18px; flex: none; }
.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
}
.search-box input::placeholder { color: rgba(255, 255, 255, .45); }
.search-cancel { font-size: 14px; color: var(--c-sub); flex: none; }

.search-result {
  margin-top: 12px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
.sr-item {
  display: flex;
  gap: 10px;
  padding: 10px 4px;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  cursor: pointer;
}
.sr-item .sr-thumb {
  width: 46px;
  height: 62px;
  flex: none;
  border-radius: 6px;
  background: #1a1a1a center/cover no-repeat;
}
.sr-item .sr-txt { min-width: 0; }
.sr-item .sr-user { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.sr-item .sr-desc {
  font-size: 12px;
  color: var(--c-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sr-empty { padding: 24px 0; text-align: center; font-size: 13px; color: var(--c-dim); }

/* ------------------------------------------------- iOS 内嵌浏览器引导页 */
.safari-guide {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px 20px;
  background: radial-gradient(120% 80% at 50% 0%, #43102f 0%, #2c0a2c 45%, #1c051d 100%);
  overflow-y: auto;
}
.sg-card {
  width: 100%;
  max-width: 380px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  padding: 22px 20px 18px;
  text-align: center;
}
.sg-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;
}
.sg-heart { color: #ff4d97; font-size: 17px; }
.sg-langs { display: flex; justify-content: center; gap: 8px; margin: 12px 0 18px; }
.sg-langs button {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, .22);
  color: rgba(255, 255, 255, .72);
}
.sg-langs button.on { background: #ff4d97; border-color: #ff4d97; color: #fff; }
.sg-title { font-size: 21px; margin: 0 0 8px; line-height: 1.3; }
.sg-desc { font-size: 13px; line-height: 1.55; color: rgba(255, 255, 255, .7); margin: 0 0 16px; }
.sg-steps {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  text-align: left;
  display: grid;
  gap: 10px;
}
.sg-steps li {
  display: flex;
  gap: 9px;
  font-size: 12.5px;
  line-height: 1.5;
  color: rgba(255, 255, 255, .86);
}
.sg-steps b {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 77, 151, .22);
  color: #ff8fbb;
  font-size: 11px;
  display: grid;
  place-items: center;
  font-weight: 600;
}
.sg-btn-primary,
.sg-btn-ghost {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}
.sg-btn-primary { background: #ff4d97; color: #fff; }
.sg-btn-ghost { background: rgba(255, 255, 255, .1); color: #fff; }
.sg-url {
  font-size: 11px;
  color: rgba(255, 255, 255, .45);
  word-break: break-all;
  margin-top: 4px;
}

/* ------------------------------------------------------------- 桌面适配 */
/* 保持与手机一致的全宽竖屏流，仅把右侧按钮贴边显示 */
@media (min-width: 900px) {
  .side-actions { right: 16px; }
  .bottom-info { right: 110px; }
}

/* ------------------------------------------------------- 右侧互动按钮状态 */
.avatar-wrap .follow-badge {
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: transform .15s, background .15s;
}
.avatar-wrap .follow-badge:active { transform: scale(.88); }
.avatar-wrap .follow-badge .i-check { display: none; }
.avatar-wrap.followed .follow-badge { background: #fff; }
.avatar-wrap.followed .follow-badge .i-plus { display: none; }
.avatar-wrap.followed .follow-badge .i-check { display: block; }

.act.liked svg,
.act.starred svg { animation: act-pop .32s ease; }
.act.starred svg { fill: #ffb400; stroke: #ffb400; }
@keyframes act-pop {
  0% { transform: scale(.75); }
  55% { transform: scale(1.28); }
  100% { transform: scale(1); }
}

/* --------------------------------------------------- 底部弹层（评论/分享） */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
}
.sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  opacity: 0;
  transition: opacity .2s;
}
.sheet.on .sheet-mask { opacity: 1; }
.sheet-panel {
  position: relative;
  width: 100%;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  background: #141414;
  border-radius: 16px 16px 0 0;
  padding: 14px 16px calc(14px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform .24s ease;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .5);
}
.sheet.on .sheet-panel { transform: translateY(0); }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
}
.sheet-title { font-size: 15px; font-weight: 600; }
.sheet-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: #fff;
  opacity: .7;
}
.sheet-close svg { width: 18px; height: 18px; }

.comment-list {
  overflow-y: auto;
  max-height: 52vh;
  padding: 2px 0 8px;
  -webkit-overflow-scrolling: touch;
}
.comment-empty {
  color: rgba(255, 255, 255, .45);
  font-size: 13px;
  text-align: center;
  padding: 28px 0;
}
.comment-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.comment-ava {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #2c2c2c center/cover no-repeat;
}
.comment-body { flex: 1; min-width: 0; }
.comment-name {
  font-size: 12px;
  color: rgba(255, 255, 255, .55);
  margin-bottom: 3px;
}
.comment-text {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}
.comment-form {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.comment-form input {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: 0;
  border-radius: 20px;
  background: #232323;
  color: #fff;
  padding: 0 14px;
  font-size: 14px;
  outline: none;
}
.comment-send {
  flex: none;
  height: 40px;
  padding: 0 16px;
  border-radius: 20px;
  background: var(--c-pink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.share-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px 6px;
  padding: 8px 0 16px;
}
.share-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
}
.share-item:active .si { transform: scale(.92); }
.share-item .si {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #262626;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  transition: transform .12s;
}
.share-item .si svg { width: 22px; height: 22px; }
.share-item b {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, .72);
}
.si-tg { background: #229ed9; }
.si-wa { background: #25d366; color: #fff; }
.si-x { background: #000; border: 1px solid rgba(255, 255, 255, .28); }

@media (min-width: 900px) {
  .sheet-panel { width: 480px; margin: 0 auto; }
}

/* ------------------------------------------------------------- 横屏播放 */
.wide {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wide-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

/* 视频/ iframe 全部按比例装进屏幕，竖视频左右留黑边，横视频铺满 */
.wide-stage video,
.wide-stage iframe {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
  border: 0;
}

.wide-close {
  position: absolute;
  top: calc(10px + var(--safe-top));
  right: 12px;
  z-index: 2;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  backdrop-filter: blur(6px);
}
.wide-close svg { width: 20px; height: 20px; display: block; }

.wide-hint {
  position: absolute;
  left: 50%;
  bottom: calc(30px + var(--safe-bottom));
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 99px;
  background: rgba(0, 0, 0, .55);
  color: rgba(255, 255, 255, .88);
  font-size: 13px;
  white-space: nowrap;
}

/* 横屏播放时锁住纵向视频流，避免滑动切走当前视频 */
body.wide-on .feed { overflow: hidden; }
