:root {
  color-scheme: dark;
  --bg: #0d1014;
  --card: #161a21;
  --card2: #1d222b;
  --text: #eef1f6;
  --muted: #8b93a3;
  --accent: #4c7dff;
  --border: #232833;
  --focus: #ffcc4d;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

/* 容器 WebView 背景透明，不设这条会透出宿主壁纸 */
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}

img { display: block; }

/* ── 顶栏 ── */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, #12161d 70%, rgba(18, 22, 29, .92));
  border-bottom: 1px solid var(--border);
  padding: 12px 14px 0;
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand h1 { margin: 0; font-size: 18px; letter-spacing: .5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.status { margin-left: auto; font-size: 12px; color: var(--muted); }

.search { display: flex; gap: 8px; margin: 10px 0; }
.search input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 15px; outline: none;
}
.search input:focus { border-color: var(--accent); }
.search button, .more button, .detail-head button, .drawer-head button {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--card2); color: var(--text); font-size: 14px; cursor: pointer;
}

.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; font-size: 13px;
  background: var(--card); border: 1px solid var(--border); color: var(--muted); cursor: pointer;
}
.tab.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ── 内容区 ── */
main { padding: 14px 12px 40px; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 620px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.card2 {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; cursor: pointer; transition: transform .12s ease, border-color .12s ease;
}
.card2:active, .card2.focus { transform: scale(.98); border-color: var(--focus); box-shadow: 0 0 0 2px rgba(255, 204, 77, .45); }
.thumb { position: relative; aspect-ratio: 16 / 10; background: #0a0c10; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .dur {
  position: absolute; right: 6px; bottom: 6px; padding: 1px 6px; border-radius: 6px;
  background: rgba(0, 0, 0, .68); font-size: 11px; color: #dfe3ea;
}
.cname {
  margin: 0; padding: 8px 9px 10px; font-size: 13px; line-height: 1.4; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.more, .empty, .loading { text-align: center; padding: 22px 0; color: var(--muted); font-size: 13px; }
.more button { cursor: pointer; }

/* ── 分类抽屉 ── */
.drawer {
  position: fixed; inset: 0; z-index: 40; background: rgba(8, 10, 14, .96);
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.drawer-search { padding: 10px 16px 0; }
.drawer-search input {
  width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); outline: none;
}
.drawer-list { flex: 1; overflow-y: auto; padding: 12px 16px 30px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.chip {
  padding: 8px 13px; border-radius: 999px; background: var(--card); border: 1px solid var(--border);
  font-size: 13px; color: var(--text); cursor: pointer;
}
.chip.focus { border-color: var(--focus); box-shadow: 0 0 0 2px rgba(255, 204, 77, .45); }

/* ── 详情 ── */
.detail {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.detail-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--border); background: #12161d;
}
.muted { color: var(--muted); font-size: 12px; }
.detail-body { flex: 1; overflow-y: auto; padding: 14px; }
.dcov { width: 100%; max-height: 240px; object-fit: cover; border-radius: 12px; background: #0a0c10; }
.detail-body h2 { margin: 12px 0 6px; font-size: 16px; line-height: 1.45; }
.eps { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.eps button {
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--accent);
  background: rgba(76, 125, 255, .14); color: var(--accent); font-size: 14px; font-weight: 600; cursor: pointer;
}
.eps button.focus { border-color: var(--focus); box-shadow: 0 0 0 2px rgba(255, 204, 77, .45); }
.content {
  white-space: pre-wrap; word-break: break-word; font: 12.5px/1.7 inherit;
  color: var(--muted); background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; margin: 0;
}

/* ── 轻提示 ── */
.toast {
  position: fixed; left: 50%; bottom: 12%; transform: translateX(-50%);
  z-index: 90; max-width: 82vw; padding: 10px 16px; border-radius: 10px;
  background: rgba(20, 24, 32, .96); border: 1px solid var(--border);
  font-size: 13px; color: var(--text); text-align: center;
}
