/* ============================================================
   115 视频 — B站列表 + 抖音刷视频
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #16161a;
  --bg-elev: #1c1c22;
  --surface: #22222a;
  --surface-2: #2b2b34;
  --line: rgba(255, 255, 255, 0.07);
  --text: #f1f2f3;
  --text-2: #9499a0;
  --text-3: #61666d;
  --pink: #fb7299;
  --pink-soft: rgba(251, 114, 153, 0.14);
  --blue: #00aeec;
  --douyin: #fe2c55;
  --radius: 10px;
  --nav-h: 56px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 100%; height: 100%; fill: currentColor; display: block; }
.hidden { display: none !important; }

/* ============ 风控提示 ============ */
#waf-banner {
  position: fixed; top: var(--nav-h); left: 0; right: 0; z-index: 90;
  padding: 8px 16px;
  background: rgba(254, 44, 85, 0.14);
  border-bottom: 1px solid rgba(254, 44, 85, 0.3);
  color: #ff9db0; font-size: 12px; text-align: center;
  backdrop-filter: blur(8px);
}

/* ============ 顶部导航 ============ */
#nav {
  position: sticky; top: 0; z-index: 80;
  height: var(--nav-h);
  background: rgba(22, 22, 26, 0.86);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1680px; height: 100%; margin: 0 auto;
  padding: 0 16px;
  display: flex; align-items: center; gap: 18px;
}

.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); flex: 0 0 auto; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--pink), #ff9db0);
  display: grid; place-items: center; padding: 6px; color: #fff;
  box-shadow: 0 2px 10px rgba(251, 114, 153, 0.4);
}
.brand-text { font-size: 17px; font-weight: 700; letter-spacing: 0.3px; }
.brand-text b { color: var(--pink); font-weight: 700; }

.nav-tabs { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.tab {
  position: relative; border: 0; background: none; cursor: pointer;
  color: var(--text-2); font-size: 14px; font-weight: 500;
  padding: 8px 12px; border-radius: 8px; transition: color .18s, background .18s;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.tab.active { color: var(--text); font-weight: 600; }
.tab.active::after {
  content: ""; position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%);
  width: 18px; height: 3px; border-radius: 2px; background: var(--pink);
}

.nav-search {
  flex: 1 1 auto; max-width: 460px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px;
  background: var(--surface); border: 1px solid transparent;
  border-radius: 18px; color: var(--text-3);
  transition: border-color .18s, background .18s;
}
.nav-search:focus-within { border-color: var(--pink); background: var(--bg-elev); }
.nav-search .i { width: 16px; height: 16px; flex: 0 0 auto; }
.nav-search input {
  flex: 1; border: 0; background: none; outline: none;
  color: var(--text); font-size: 13px; min-width: 0;
}
.nav-search input::placeholder { color: var(--text-3); }

.nav-right { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.count-pill {
  font-size: 12px; color: var(--text-2);
  background: var(--surface); padding: 5px 10px; border-radius: 12px;
  font-variant-numeric: tabular-nums;
}
.icon-btn {
  width: 34px; height: 34px; padding: 8px; border: 0; border-radius: 10px;
  background: none; color: var(--text-2); cursor: pointer;
  transition: background .18s, color .18s, transform .18s;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.spinning .i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 视图切换 ============ */
.view { display: none; }
.view.active { display: block; }
#view-feed.active { display: block; }

/* ============ 视频列表（B站风） ============ */
main#view-list { padding-bottom: 40px; }

.chips {
  position: sticky; top: var(--nav-h); z-index: 40;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 12px 16px 10px;
  background: linear-gradient(var(--bg) 72%, transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface);
  color: var(--text-2); font-size: 13px; padding: 6px 14px; border-radius: 16px;
  cursor: pointer; white-space: nowrap; transition: all .18s;
}
.chip:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.16); }
.chip.active {
  color: #fff; background: var(--pink); border-color: var(--pink);
  box-shadow: 0 4px 14px rgba(251, 114, 153, 0.28);
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 22px 18px;
  padding: 4px 16px 24px;
  align-items: start;
}
@media (max-width: 1400px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 10px; padding: 4px 10px 24px; }
  .chips { padding: 10px 10px 8px; }
  .nav-inner { gap: 10px; padding: 0 10px; }
  .brand-text { display: none; }
  .count-pill { display: none; }
  .nav-search { max-width: none; }
}

/* 卡片 */
.grid-card { cursor: pointer; position: relative; }
.cover {
  position: relative; width: 100%; height: 0; padding-bottom: 133.33%;
  border-radius: var(--radius); overflow: hidden; background: var(--surface);
  box-shadow: 0 0 0 1px var(--line) inset;
  transition: transform .22s cubic-bezier(.2, .8, .3, 1), box-shadow .22s;
}
.grid-card:hover .cover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(251, 114, 153, 0.35) inset;
}
.cover img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block; opacity: 0;
  transition: opacity .35s ease, transform .5s ease;
}
.cover img.loaded { opacity: 1; }
.grid-card:hover .cover img.loaded { transform: scale(1.04); }

/* 占位（无封面时）：按角色名生成渐变 */
.cover .ph {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 34px; font-weight: 700; color: rgba(255, 255, 255, 0.9);
  letter-spacing: 2px; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  background: linear-gradient(135deg, #3a3a46, #22222a);
}
.cover .ph .i { width: 26px; height: 26px; opacity: .5; }

/* 右下角角标：时长 / 大小 */
.badge {
  position: absolute; right: 6px; bottom: 6px;
  font-size: 11px; font-weight: 500; color: #fff;
  padding: 2px 6px; border-radius: 5px;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(4px);
  font-variant-numeric: tabular-nums;
  z-index: 2;
}
/* 底部渐变 + 播放按钮 */
.cover-play {
  position: absolute; inset: 0; z-index: 1;
  display: grid; place-items: center;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent 45%);
  opacity: 0; transition: opacity .2s;
}
.cover-play .i { width: 42px; height: 42px; color: #fff; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .5)); }
.grid-card:hover .cover-play { opacity: 1; }

.gc-body { padding: 8px 2px 0; }
.gc-title {
  font-size: 13.5px; line-height: 1.42; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 38px;
  color: var(--text); word-break: break-word;
}
.gc-meta {
  display: flex; align-items: center; gap: 6px;
  margin-top: 7px; font-size: 12px; color: var(--text-3);
  min-width: 0;
}
.gc-avatar {
  width: 18px; height: 18px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700; color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .1) inset;
}
.gc-up { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-dot { opacity: .5; }
.gc-tag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 骨架 */
.sk .cover {
  background: linear-gradient(90deg, #22222a 25%, #2c2c36 37%, #22222a 63%);
  background-size: 400% 100%;
  animation: sk 1.4s ease infinite;
}
.sk .sk-line { height: 12px; border-radius: 6px; margin-top: 9px;
  background: linear-gradient(90deg, #22222a 25%, #2c2c36 37%, #22222a 63%);
  background-size: 400% 100%; animation: sk 1.4s ease infinite;
}
.sk .sk-line.short { width: 55%; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.list-status {
  text-align: center; color: var(--text-3); font-size: 13px;
  padding: 10px 0 28px;
}
.list-status .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--pink); margin-right: 6px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ============ 刷视频（抖音风） ============ */
#view-feed { position: fixed; inset: 0; top: var(--nav-h); background: #000; }
.feed {
  height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }

.feed-card {
  position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #000;
}
.feed-card video {
  width: 100%; height: 100%; object-fit: contain; background: #000;
  display: block;
}
.feed-ph {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--text-3); font-size: 14px; gap: 10px;
  background: radial-gradient(circle at 50% 42%, #1d1d24, #0c0c0f 70%);
}
.feed-ph .i { width: 40px; height: 40px; opacity: .35; }

/* 右侧操作栏 */
.rail {
  position: absolute; right: 10px; bottom: 96px; z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.rail-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: 0; cursor: pointer; color: #fff; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.rail-item .i { width: 30px; height: 30px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .55)); transition: transform .18s; }
.rail-item:active .i { transform: scale(0.86); }
.rail-item .lbl { font-size: 11px; color: rgba(255, 255, 255, .92); text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.rail-item.on .i { color: var(--douyin); }
.rail-item.on .lbl { color: #fff; }

.rail-avatar { position: relative; margin-bottom: 4px; }
.rail-avatar .ava {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid #fff;
  display: grid; place-items: center; font-size: 15px; font-weight: 700; color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}
.rail-avatar .follow {
  position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%);
  width: 20px; height: 20px; border-radius: 50%; background: var(--douyin);
  display: grid; place-items: center; color: #fff; padding: 4px;
  box-shadow: 0 2px 6px rgba(254, 44, 85, .5);
}
.rail-avatar .follow.done { background: #555; box-shadow: none; }

/* 底部信息 */
.f-info {
  position: absolute; left: 12px; right: 78px; bottom: 22px; z-index: 5;
  color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
  pointer-events: none;
}
.f-user { font-size: 16px; font-weight: 700; margin-bottom: 7px; letter-spacing: .2px; }
.f-title { font-size: 13.5px; line-height: 1.5; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.f-tags { font-size: 13px; color: #ffd166; font-weight: 500; margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.f-music { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: rgba(255,255,255,.92); }
.f-music .disc {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto;
  background: conic-gradient(from 0deg, #2a2a30, #44444c, #2a2a30);
  display: grid; place-items: center; color: #fff; padding: 8px;
  animation: spin 6s linear infinite;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12);
}
.f-music .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 进度条 */
.f-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: rgba(255, 255, 255, .16); z-index: 6;
}
.f-progress > i { display: block; height: 100%; width: 0; background: rgba(255, 255, 255, .92); transition: width .2s linear; }

/* 双击爱心 */
.heart-burst {
  position: absolute; left: 50%; top: 45%; z-index: 9;
  width: 96px; height: 96px; margin: -48px 0 0 -48px; color: var(--douyin);
  pointer-events: none; animation: burst .75s cubic-bezier(.2, .9, .3, 1) forwards;
  filter: drop-shadow(0 4px 18px rgba(254, 44, 85, .6));
}
@keyframes burst {
  0% { transform: scale(.2) rotate(-18deg); opacity: 0; }
  35% { transform: scale(1.15) rotate(6deg); opacity: 1; }
  60% { transform: scale(1) rotate(0); opacity: 1; }
  100% { transform: scale(1.25) translateY(-32px); opacity: 0; }
}

.float-sound {
  position: fixed; right: 14px; top: calc(var(--nav-h) + 14px); z-index: 30;
  width: 36px; height: 36px; padding: 9px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .45); color: #fff; cursor: pointer;
  backdrop-filter: blur(8px);
}
.float-sound .i { width: 100%; height: 100%; }

/* ============ 设置面板 ============ */
.mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px; max-height: 86vh; overflow: hidden;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  animation: pop .22s cubic-bezier(.2, .9, .3, 1);
}
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.sheet-head h2 { font-size: 16px; font-weight: 600; }
.sheet-body { padding: 16px 18px 22px; overflow-y: auto; }

.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px;
}
.stat {
  background: var(--surface); border-radius: 10px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.stat-k { font-size: 11px; color: var(--text-3); }
.stat-v { font-size: 13.5px; font-weight: 600; color: var(--text); }

.row-group {
  background: var(--surface); border-radius: 12px; padding: 14px;
  margin-bottom: 12px;
}
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.row-main { min-width: 0; }
.row-title { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.row-sub { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.switch { position: relative; width: 44px; height: 26px; flex: 0 0 auto; }
.switch input { display: none; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 13px; background: var(--surface-2);
  cursor: pointer; transition: background .2s;
}
.switch .slider::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; transition: transform .2s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}
.switch input:checked + .slider { background: var(--pink); }
.switch input:checked + .slider::after { transform: translateX(18px); }

.warm-box { margin-top: 12px; }
.warm-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.warm-fill { height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--pink), #ff9db0); transition: width .4s; }
.warm-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.warm-actions { display: flex; gap: 6px; }

.btn-sm {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font-size: 12.5px; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  transition: all .18s; white-space: nowrap;
}
.btn-sm:hover { background: #34343e; }
.btn-sm.primary { background: var(--pink); border-color: var(--pink); color: #fff; font-weight: 600; }
.btn-sm.primary:hover { filter: brightness(1.06); }
.btn-sm.ghost { background: transparent; }
.btn-sm.danger { color: #ff7a90; border-color: rgba(254, 44, 85, .3); background: rgba(254, 44, 85, .08); }
.btn-sm:disabled { opacity: .45; cursor: not-allowed; }

select {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 8px; font-size: 13px; outline: none; cursor: pointer;
}
.sync-stats { font-size: 12px; color: var(--text-3); margin-top: 10px; line-height: 1.6; }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: rgba(30, 30, 36, .96); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 16px; font-size: 13px; z-index: 200;
  box-shadow: var(--shadow); animation: pop .2s ease;
  max-width: 86vw; text-align: center;
}
