:root {
  --accent: #fe2c55;
  --sheet-bg: #1c1c1e;
  --panel: rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  margin: 0;
  background: #0d0d0f;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
}

body { display: flex; justify-content: center; }
[hidden] { display: none !important; }

/* ---------- 顶部栏 ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: 100%;
  max-width: 480px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .55), transparent);
}

.tabs { display: flex; gap: 30px; }

.tab {
  position: relative;
  padding: 6px 0;
  font-size: 16px;
  color: rgba(255, 255, 255, .6);
  cursor: pointer;
  user-select: none;
}

.tab.active { color: #fff; font-weight: 600; }

.tab.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  border-radius: 2px;
  background: #fff;
}

/* ---------- 视频流 ---------- */
.feed {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }

.video-item {
  position: relative;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  overflow: hidden;
  background: #000;
}

.video-player {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.video-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .45) 0%, transparent 22%, transparent 52%, rgba(0, 0, 0, .78) 100%);
}

.video-info {
  position: absolute;
  left: 16px;
  right: 82px;
  bottom: 26px;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .85);
}

.author { font-size: 16px; font-weight: 600; margin-bottom: 8px; }

.desc {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.music { font-size: 12px; color: rgba(255, 255, 255, .82); }

/* ---------- 右侧操作栏 ---------- */
.actions {
  position: absolute;
  right: 10px;
  bottom: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.act {
  width: 50px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.act .icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.act svg { width: 26px; height: 26px; fill: #fff; }
.act .num { font-size: 12px; text-shadow: 0 1px 3px #000; }
.act.liked .icon svg,
.act.liked .num { fill: var(--accent); color: var(--accent); }
.act.avatar .icon {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, #ff8a3d, #fe2c55);
}
.act.avatar .num { font-size: 11px; }

/* ---------- 播放状态 ---------- */
.play-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s;
}
.play-hint svg { width: 30px; height: 30px; fill: #fff; margin-left: 3px; }
.video-item.paused .play-hint { opacity: 1; }

.video-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #000;
  font-size: 14px;
  color: rgba(255, 255, 255, .75);
}
.video-error button {
  padding: 8px 18px;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 20px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.feed-loading {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  padding: 6px 14px;
  border-radius: 16px;
  background: rgba(0, 0, 0, .6);
  font-size: 12px;
  color: rgba(255, 255, 255, .85);
}

.empty-tip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: rgba(255, 255, 255, .65);
  font-size: 14px;
  line-height: 2;
}
.empty-tip a { color: #4da3ff; }

/* ---------- 评论抽屉 ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, .45);
}

.sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 101%);
  z-index: 50;
  width: 100%;
  max-width: 480px;
  height: 68vh;
  display: flex;
  flex-direction: column;
  background: var(--sheet-bg);
  border-radius: 16px 16px 0 0;
  transition: transform .25s ease;
}
.sheet.open { transform: translate(-50%, 0); }

.sheet-head {
  position: relative;
  height: 50px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  font-size: 15px;
}
.sheet-close {
  position: absolute;
  right: 12px;
  top: 8px;
  width: 34px;
  height: 34px;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, .65);
  font-size: 26px;
  cursor: pointer;
}

.comment-list { flex: 1; overflow-y: auto; padding: 12px 16px; }
.sheet-empty { padding: 40px 0; text-align: center; color: rgba(255, 255, 255, .45); font-size: 13px; }

.comment-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.comment-avatar {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  background: #3a3a3e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #ddd;
}
.comment-body { min-width: 0; flex: 1; }
.comment-nick { font-size: 12px; color: rgba(255, 255, 255, .55); margin-bottom: 4px; }
.comment-text { font-size: 14px; line-height: 1.5; word-break: break-word; }
.comment-time { font-size: 11px; color: rgba(255, 255, 255, .35); margin-top: 4px; }

.comment-form { flex: none; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255, 255, 255, .08); }
.comment-form input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  background: #2a2a2e;
  color: #fff;
  font-size: 14px;
  outline: none;
}
.comment-form input::placeholder { color: rgba(255, 255, 255, .35); }
.comment-form input:focus { border-color: rgba(255, 255, 255, .35); }
.comment-input-row { display: flex; gap: 8px; margin-top: 8px; }
.comment-input-row button {
  flex: none;
  width: 68px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.96);
  z-index: 100;
  max-width: 80vw;
  padding: 10px 18px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .82);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

@media (min-width: 481px) {
  .feed, .topbar, .sheet { box-shadow: 0 0 60px rgba(0, 0, 0, .6); }
}
