:root {
  --pink: #fb7299;
  --pink-dark: #e85c86;
  --pink-soft: #fff0f4;
  --text: #18191c;
  --text2: #61666d;
  --text3: #9499a0;
  --line: #e3e5e7;
  --bg: #ffffff;
  --bg2: #f6f7f8;
  --top-h: 56px;
  --tab-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  -webkit-user-select: none;
  user-select: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; }
[hidden] { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  height: calc(var(--top-h) + var(--safe-top)); padding: var(--safe-top) 20px 0;
  display: flex; align-items: center; gap: 16px;
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #f1f2f3;
}
.avatar-btn { width: 36px; height: 36px; flex: none; }
.top-tabs { flex: 1; display: flex; justify-content: center; gap: 40px; font-size: 17px; color: var(--text2); }
.top-tabs a { position: relative; padding: 14px 2px; }
.top-tabs a.active { color: var(--pink); font-weight: 600; }
.top-tabs a.active::after {
  content: ""; position: absolute; left: 50%; bottom: 6px; width: 16px; height: 3px; margin-left: -8px;
  border-radius: 2px; background: var(--pink);
}
.timer {
  flex: none; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 16px; background: var(--pink-soft); color: var(--pink); font-weight: 600; font-variant-numeric: tabular-nums;
}
.timer.urgent { background: var(--pink); color: #fff; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: 0.75; } }

/* ---------- 底栏 ---------- */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  height: calc(var(--tab-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  display: flex; justify-content: center; gap: 12%;
  background: rgba(255, 255, 255, 0.97); border-top: 1px solid #f1f2f3;
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 64px; color: var(--text2); font-size: 11px; }
.tabbar svg { width: 26px; height: 26px; }
.tabbar a.active { color: var(--pink); }

main#views { padding: calc(var(--top-h) + var(--safe-top) + 16px) 20px calc(var(--tab-h) + var(--safe-bottom) + 24px); }
body.video-mode .topbar, body.video-mode .tabbar { display: none; }
body.video-mode main#views { padding: 0; }

/* ---------- 头像 ---------- */
.av {
  border-radius: 50%; overflow: hidden; flex: none; background: var(--bg2);
  display: flex; align-items: center; justify-content: center; object-fit: cover;
}
.av.emoji { line-height: 1; }

/* ---------- 视频卡片 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px 18px; }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.vcard { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cover { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--bg2); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .shade {
  position: absolute; inset: auto 0 0 0; height: 44px; padding: 0 10px 8px;
  display: flex; align-items: flex-end; gap: 12px; color: #fff; font-size: 13px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
}
.cover .shade .dur { margin-left: auto; }
.cover .shade span { display: flex; align-items: center; gap: 4px; }
.cover .shade svg { width: 15px; height: 15px; }
.cover .progress { position: absolute; inset: auto 0 0 0; height: 3px; background: rgba(255,255,255,.4); }
.cover .progress i { display: block; height: 100%; background: var(--pink); }
.vmeta { display: flex; gap: 10px; min-width: 0; }
.vmeta .av { width: 36px; height: 36px; font-size: 20px; }
.vmeta .txt { min-width: 0; flex: 1; }
.vtitle {
  font-size: 15px; line-height: 21px; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vsub { margin-top: 4px; font-size: 13px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.more { display: flex; justify-content: center; padding: 28px 0 8px; color: var(--text3); font-size: 13px; }
.empty { padding: 120px 20px; text-align: center; color: var(--text3); line-height: 1.8; }
.empty b { display: block; font-size: 17px; color: var(--text2); margin-bottom: 6px; font-weight: 600; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #f1f2f3; border-top-color: var(--pink); animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 频道 ---------- */
.ups { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.upcard { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 12px; background: var(--bg2); }
.upcard .av { width: 56px; height: 56px; }
.upcard .name { font-size: 16px; font-weight: 600; }
.upcard .sign { margin-top: 4px; font-size: 13px; color: var(--text3); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.uphead { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.uphead .av { width: 72px; height: 72px; }
.uphead h1 { margin: 0; font-size: 22px; }
.uphead p { margin: 6px 0 0; color: var(--text3); font-size: 14px; }
.back {
  display: inline-flex; align-items: center; gap: 4px; margin: 0 0 16px -6px; padding: 6px; color: var(--text2); font-size: 15px;
}
.back svg { width: 22px; height: 22px; }

/* ---------- 历史 ---------- */
.mehead { display: flex; align-items: center; gap: 16px; padding: 8px 0 24px; }
.mehead .av { width: 64px; height: 64px; font-size: 36px; }
.mehead .name { font-size: 20px; font-weight: 600; }
.mehead .sub { color: var(--text3); font-size: 13px; margin-top: 4px; }
.mehead .switch { margin-left: auto; padding: 8px 16px; border-radius: 18px; border: 1px solid var(--line); color: var(--text2); font-size: 14px; }
.section-title { font-size: 17px; font-weight: 600; margin: 4px 0 16px; }

/* ---------- 播放页 ---------- */
.vpage { display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 100vh; }
@media (max-width: 900px) { .vpage { grid-template-columns: 1fr; } }
.vmain { min-width: 0; }
.player-wrap { position: sticky; top: 0; z-index: 5; background: #000; padding-top: var(--safe-top); }
.player { position: relative; aspect-ratio: 16 / 9; background: #000; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.player .perr {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #fff; font-size: 15px;
}
.player .perr button { padding: 8px 20px; border-radius: 18px; background: var(--pink); color: #fff; }
.pback {
  position: absolute; z-index: 6; left: 12px; top: calc(var(--safe-top) + 10px); width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.35); color: #fff;
}
.pback svg { width: 24px; height: 24px; }
.vinfo { padding: 16px 24px 40px; }
.uprow { display: flex; align-items: center; gap: 12px; }
.uprow .av { width: 48px; height: 48px; }
.uprow .name { color: var(--pink); font-size: 16px; font-weight: 500; }
.uprow .fans { color: var(--text3); font-size: 13px; margin-top: 2px; }
.vinfo h1 { font-size: 19px; line-height: 1.45; margin: 16px 0 8px; font-weight: 500; }
.vstats { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--text3); font-size: 13px; }
.vstats span { display: flex; align-items: center; gap: 4px; }
.vstats svg { width: 15px; height: 15px; }
.actions { display: flex; gap: 8px; margin: 20px 0 8px; }
.actions div { width: 76px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text2); font-size: 13px; }
.actions svg { width: 30px; height: 30px; color: var(--text2); }
.desc { margin-top: 14px; color: var(--text2); font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.desc.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.desc-toggle { color: var(--text3); font-size: 13px; margin-top: 4px; }
.parts { display: flex; gap: 8px; overflow-x: auto; margin-top: 18px; padding-bottom: 4px; }
.parts a { flex: none; padding: 8px 14px; border-radius: 6px; background: var(--bg2); font-size: 14px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.parts a.on { background: var(--pink-soft); color: var(--pink); }
.vside { border-left: 1px solid #f1f2f3; padding: calc(var(--safe-top) + 16px) 16px 40px; }
@media (max-width: 900px) { .vside { border-left: 0; padding-top: 0; } }
.rel { display: flex; gap: 10px; padding: 8px 0; }
.rel .cover { width: 150px; flex: none; border-radius: 6px; }
.rel .cover .shade { height: 28px; padding: 0 6px 4px; font-size: 11px; }
.rel .t { font-size: 14px; line-height: 20px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rel .s { margin-top: 6px; font-size: 12px; color: var(--text3); }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; z-index: 60; left: 50%; top: 40%; transform: translateX(-50%);
  max-width: 80vw; padding: 12px 20px; border-radius: 8px; background: rgba(0, 0, 0, 0.75); color: #fff; font-size: 15px; text-align: center;
}
.warn-banner {
  position: fixed; z-index: 40; left: 50%; top: calc(var(--safe-top) + 12px); transform: translateX(-50%);
  padding: 10px 22px; border-radius: 22px; background: var(--pink); color: #fff; font-size: 15px; font-weight: 500;
  box-shadow: 0 6px 20px rgba(251, 114, 153, 0.4);
}

/* ---------- 锁屏 ---------- */
.lock {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(160deg, #fff 0%, #fff5f8 60%, #ffe4ec 100%);
  -webkit-user-select: none; user-select: none;
}
.lock-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.lock-logo { width: 84px; height: 84px; border-radius: 20px; box-shadow: 0 8px 24px rgba(251, 114, 153, 0.35); margin-bottom: 28px; }
#lock-body { width: 100%; display: flex; flex-direction: column; align-items: center; }
.lock .who { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; }
.lock .who .av { width: 76px; height: 76px; font-size: 44px; box-shadow: 0 0 0 4px #fff, 0 4px 14px rgba(0,0,0,.08); }
.lock .who .name { font-size: 20px; font-weight: 600; }
.lock .hint { color: var(--text2); font-size: 14px; line-height: 1.7; margin-bottom: 18px; }
.lock .hint b { color: var(--pink); }
.lock .big { font-size: 22px; font-weight: 600; margin: 4px 0 10px; }
.lock form { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.lock input {
  width: 100%; height: 50px; padding: 0 18px; border-radius: 25px; border: 1.5px solid var(--line); background: #fff;
  font-size: 17px; outline: none; text-align: center; -webkit-user-select: text; user-select: text;
}
.lock input:focus { border-color: var(--pink); }
.lock .btn { height: 50px; border-radius: 25px; background: var(--pink); color: #fff; font-size: 17px; font-weight: 600; }
.lock .btn:disabled { opacity: 0.6; }
.lock .err { min-height: 22px; color: #f25d59; font-size: 14px; }
.lock .link { margin-top: 18px; color: var(--text3); font-size: 14px; }
.lock .accounts { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; margin-bottom: 22px; }
.lock .accounts button { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 15px; color: var(--text2); }
.lock .accounts .av { width: 64px; height: 64px; font-size: 36px; }
.lock .accounts button.sel .av { box-shadow: 0 0 0 3px var(--pink); }
.lock .waiting { display: flex; align-items: center; gap: 8px; margin-top: 18px; color: var(--text3); font-size: 13px; }
.lock .waiting i { width: 8px; height: 8px; border-radius: 50%; background: #3ec07c; }
.lock .waiting i.off { background: #c9ccd0; }
