:root {
  color-scheme: dark;
  --bg: #07070b;
  --bg2: #101018;
  --card: #181822;
  --line: rgba(255,255,255,.08);
  --ink: #f6f4ee;
  --muted: #9a9aa8;
  --yellow: #ffd84d;
  --pink: #ff6b9d;
  --blue: #7dd3fc;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tab: calc(56px + var(--safe-b));
  --font: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", ui-rounded, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #050508; color: var(--ink); font-family: var(--font); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

#stage {
  min-height: 100%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 400px at 50% -10%, rgba(255,216,77,.18), transparent 55%),
    #050508;
}
#phone {
  position: relative;
  width: min(430px, 100%);
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}
@media (min-width: 760px) {
  #phone {
    height: min(920px, 96dvh);
    border-radius: 28px;
    box-shadow: 0 30px 80px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06);
  }
}

.topbar {
  position: absolute; inset: 0 0 auto 0; z-index: 8;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  background: linear-gradient(to bottom, rgba(7,7,11,.92), rgba(7,7,11,0));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 950; letter-spacing: -.06em; font-size: 20px; }
.brand i { width: 22px; height: 22px; border-radius: 7px; background: var(--yellow); color: #111; display: grid; place-items: center; font-style: normal; font-size: 13px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.08); display: grid; place-items: center;
}
.searchbar {
  flex: 1; height: 36px; border-radius: 999px; background: rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--muted); font-size: 13px;
}

#main { height: 100%; overflow: auto; padding-bottom: var(--tab); }
#main.no-tab { padding-bottom: 0; }

.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 9;
  height: var(--tab); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(12,12,18,.92); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar button { color: var(--muted); font-size: 11px; font-weight: 700; display: grid; place-items: center; gap: 2px; }
.tabbar button.on { color: var(--yellow); }
.tabbar svg { width: 22px; height: 22px; }

.chips { display: flex; gap: 8px; overflow: auto; padding: 4px 2px 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: none; height: 30px; padding: 0 12px; border-radius: 999px;
  background: var(--card); color: var(--muted); font-size: 13px; font-weight: 700;
}
.chips button.on { background: var(--yellow); color: #111; }

.pad { padding: 58px 12px 18px; }
.h-row { display: flex; align-items: end; justify-content: space-between; margin: 8px 2px 12px; }
.h-row h2 { margin: 0; font-size: 18px; letter-spacing: -.04em; }
.h-row button { color: var(--muted); font-size: 12px; font-weight: 700; }

.banners { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; margin-bottom: 16px; }
.banner {
  position: relative; min-height: 148px; border-radius: 16px; overflow: hidden;
  isolation: isolate;
}
.banner img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.banner .shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.82), transparent 55%); }
.banner .txt { position: absolute; left: 10px; right: 10px; bottom: 10px; }
.banner b { display: block; font-size: 16px; }
.banner span { font-size: 12px; color: #ddd; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.poster { text-align: left; }
.poster .cover {
  position: relative; aspect-ratio: 3/4.2; border-radius: 12px; overflow: hidden; background: var(--card);
}
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster .tag {
  position: absolute; top: 6px; left: 6px; padding: 2px 6px; border-radius: 6px;
  background: var(--yellow); color: #111; font-size: 10px; font-weight: 900;
}
.poster .tag.hot { background: var(--pink); color: #fff; }
.poster .ep {
  position: absolute; right: 6px; bottom: 6px; font-size: 10px; font-weight: 800;
  background: rgba(0,0,0,.55); padding: 2px 6px; border-radius: 6px;
}
.poster p { margin: 7px 2px 0; font-size: 13px; font-weight: 800; line-height: 1.3; height: 2.6em; overflow: hidden; }
.poster small { display: block; margin: 2px 2px 0; color: var(--muted); font-size: 11px; }

.feed { height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; }
.feed::-webkit-scrollbar { display: none; }
.feed-item {
  position: relative; height: 100%; scroll-snap-align: start; background: #000; overflow: hidden;
}
.feed-item video, .feed-item .poster-bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.feed-item .poster-bg { filter: brightness(.55); }
.rail {
  position: absolute; right: 10px; bottom: calc(var(--tab) + 88px); z-index: 3;
  display: grid; gap: 16px; justify-items: center;
}
.rail button { color: #fff; font-size: 11px; font-weight: 800; display: grid; gap: 4px; place-items: center; }
.rail .av { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; }
.rail .plus { width: 18px; height: 18px; border-radius: 50%; background: var(--pink); color: #fff; font-size: 14px; margin-top: -10px; }
.feed-meta {
  position: absolute; left: 14px; right: 72px; bottom: calc(var(--tab) + 18px); z-index: 3;
  text-shadow: 0 1px 8px rgba(0,0,0,.6);
}
.feed-meta .cat { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--yellow); color: #111; font-size: 11px; font-weight: 900; margin-bottom: 8px; }
.feed-meta h3 { margin: 0 0 6px; font-size: 18px; }
.feed-meta p { margin: 0; font-size: 13px; color: #eee; line-height: 1.45; }
.hint { position: absolute; top: 46%; left: 0; right: 0; text-align: center; color: rgba(255,255,255,.7); font-size: 12px; z-index: 2; pointer-events: none; }

.list { display: grid; gap: 10px; }
.row {
  display: grid; grid-template-columns: 78px 1fr auto; gap: 10px; align-items: center;
  background: var(--card); border-radius: 14px; padding: 8px; text-align: left;
}
.row img { width: 78px; height: 104px; object-fit: cover; border-radius: 10px; }
.row h3 { margin: 0 0 6px; font-size: 15px; }
.row p { margin: 0; color: var(--muted); font-size: 12px; }
.progress { margin-top: 8px; height: 3px; background: rgba(255,255,255,.1); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--yellow); }

.me-head {
  margin: 8px 0 16px; padding: 18px; border-radius: 20px;
  background: linear-gradient(135deg, #2a2110, #16161f 55%);
}
.me-head h2 { margin: 0 0 4px; font-size: 22px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stats div { background: rgba(255,255,255,.06); border-radius: 12px; padding: 10px; text-align: center; }
.stats b { display: block; font-size: 18px; }
.stats span { color: var(--muted); font-size: 11px; }
.cell {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 12px; background: var(--card); border-radius: 14px; margin-bottom: 8px;
}

.player { position: absolute; inset: 0; z-index: 20; background: #000; }
.player video { width: 100%; height: 100%; object-fit: cover; }
.player .back {
  position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); left: 10px; z-index: 4;
  width: 40px; height: 40px; border-radius: 50%; background: rgba(0,0,0,.4);
}
.player .speed {
  position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: 12px; z-index: 4;
  padding: 6px 10px; border-radius: 999px; background: rgba(0,0,0,.45); font-size: 12px; font-weight: 800;
}
.player-rail { position: absolute; right: 10px; bottom: 140px; z-index: 4; display: grid; gap: 16px; justify-items: center; }
.player-rail button { color: #fff; font-size: 11px; font-weight: 800; display: grid; gap: 4px; place-items: center; }
.player-meta { position: absolute; left: 14px; right: 72px; bottom: 54px; z-index: 4; }
.player-meta h3 { margin: 0 0 6px; font-size: 18px; }
.bar { position: absolute; left: 12px; right: 12px; bottom: 18px; height: 3px; background: rgba(255,255,255,.25); border-radius: 99px; z-index: 4; }
.bar i { display: block; height: 100%; width: 0; background: var(--yellow); }

.sheet {
  position: absolute; inset: 0; z-index: 30; background: rgba(0,0,0,.45);
  display: grid; align-items: end;
}
.sheet .panel {
  background: #14141c; border-radius: 18px 18px 0 0; padding: 12px 12px calc(16px + var(--safe-b));
  max-height: 72%; overflow: auto;
}
.sheet h3 { margin: 4px 8px 12px; }
.ep-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.ep-grid button {
  height: 40px; border-radius: 10px; background: #22222c; font-weight: 800;
}
.ep-grid button.on { background: var(--yellow); color: #111; }

.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.toast {
  position: absolute; left: 50%; bottom: calc(var(--tab) + 16px); transform: translateX(-50%);
  z-index: 40; padding: 8px 14px; border-radius: 999px; background: rgba(20,20,28,.92);
  font-size: 13px; font-weight: 700; pointer-events: none;
}
