:root {
  --bg: #0f0f0f;
  --surface: #212121;
  --surface2: #272727;
  --text: #f1f1f1;
  --muted: #aaaaaa;
  --accent: #ff4d4f;
  --radius: 12px;
  --nav-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --phone-w: 430px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #1a1a1a;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
.stage {
  min-height: 100%;
  display: flex;
  justify-content: center;
  background: #1a1a1a;
}
.phone {
  width: min(100%, var(--phone-w));
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px #333;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + var(--safe-t)) 12px 8px;
  border-bottom: 1px solid #222;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 20;
}
.logo { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 18px; }
.logo-mark {
  width: 28px; height: 20px; background: var(--accent); border-radius: 6px;
  display: grid; place-items: center;
}
.logo-mark svg { width: 12px; height: 12px; }
.grow { flex: 1; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
}
.chips {
  display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 7px 14px; border-radius: 8px;
  background: var(--surface2); font-size: 13px; color: var(--text);
}
.chip.active { background: var(--text); color: #0f0f0f; font-weight: 600; }
.screens { flex: 1; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 8px); }
.screen { display: block; }
.feed { padding-bottom: 8px; }
.card {
  display: block;
  margin-bottom: 16px;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}
.cover-img.is-broken { display: none; }
.thumb {
  position: relative; width: 100%; aspect-ratio: 16/9;
  background: linear-gradient(135deg, #2a2a2a, #111);
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-meta { display: flex; gap: 12px; padding: 12px 12px 0; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent);
  display: grid; place-items: center; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.card-title {
  font-size: 15px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }
.player-wrap { background: #000; aspect-ratio: 16/9; position: relative; }
.player-wrap video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); font-size: 14px; background: rgba(0,0,0,.35);
  pointer-events: none;
}
.player-fallback.hide { display: none; }
.play-big {
  width: 64px; height: 64px; border-radius: 50%; background: rgba(255,77,79,.9);
  display: grid; place-items: center; margin: 0 auto 10px; pointer-events: auto; cursor: pointer;
}
.back-float {
  position: absolute; top: 10px; left: 10px; z-index: 5;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center;
}
.v-body { padding: 14px; }
.v-title { font-size: 17px; font-weight: 600; line-height: 1.4; }
.v-meta { margin-top: 8px; font-size: 13px; color: var(--muted); }
.v-meta a { color: var(--text); text-decoration: underline; }
.v-actions { display: flex; gap: 8px; margin-top: 14px; padding-bottom: 14px; border-bottom: 1px solid #222; }
.v-act {
  flex: 1; border: 0; background: var(--surface); color: var(--text);
  border-radius: 20px; padding: 10px 0; font-size: 12px; cursor: pointer;
}
.section-h { padding: 16px 14px 8px; font-size: 15px; font-weight: 600; }
.bottom {
  position: fixed; left: 50%; transform: translateX(-50%);
  width: min(100%, var(--phone-w));
  bottom: 0; height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b); background: var(--bg); border-top: 1px solid #222;
  display: flex; z-index: 30;
}
.bottom a {
  flex: 1; color: var(--muted); font-size: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.bottom a.active { color: var(--text); }
.bottom svg { width: 22px; height: 22px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }
.explore-tabs {
  display: flex; border-bottom: 1px solid #222; overflow-x: auto; scrollbar-width: none;
}
.explore-tabs a {
  flex: 1; min-width: 64px; text-align: center; padding: 12px 8px; font-size: 14px;
  color: var(--muted); border-bottom: 2px solid transparent;
}
.explore-tabs a.active { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; }
.cat-tile {
  background: var(--surface); border-radius: var(--radius); padding: 18px 12px; text-align: center;
}
.cat-tile .ico {
  width: 48px; height: 48px; margin: 0 auto 10px; border-radius: 50%;
  background: linear-gradient(145deg, #3a3a3a, #222); display: grid; place-items: center;
  font-size: 18px; font-weight: 700;
}
.cat-tile span { font-size: 13px; }
.search-bar { display: flex; gap: 8px; padding: 10px 12px; align-items: center; }
.search-bar input {
  flex: 1; height: 40px; border-radius: 20px; border: 0; background: var(--surface);
  color: var(--text); padding: 0 16px; font-size: 15px; outline: none;
}
.cancel { color: var(--text); font-size: 14px; white-space: nowrap; }
.lib-block h3 { padding: 12px 14px 8px; font-size: 15px; }
.lib-row {
  display: flex;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}
.lib-row .t {
  width: 140px; aspect-ratio: 16/9; border-radius: 8px; background: var(--surface);
  overflow: hidden; flex-shrink: 0;
}
.lib-row .t img { width: 100%; height: 100%; object-fit: cover; }
.lib-row p {
  font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}

/* Preview (shorts-like) */
.preview-root, .preview-full {
  height: calc(100dvh - var(--nav-h) - var(--safe-b));
  height: calc(100vh - var(--nav-h) - var(--safe-b));
}
.preview-full {
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  background: #000;
}
.shot {
  height: 100%;
  scroll-snap-align: start;
  position: relative;
  background: #000;
}
.shot-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.shot-ui {
  position: absolute;
  left: 0; right: 0; bottom: 72px;
  z-index: 2;
  padding: 0 20px;
  text-align: center;
  pointer-events: none;
}
.shot-ui h2 {
  font-size: 15px;
  margin-bottom: 6px;
  text-shadow: 0 1px 4px #000;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.shot-cat {
  font-size: 12px;
  color: #ccc;
  margin-bottom: 12px;
  text-shadow: 0 1px 3px #000;
}
.shot-ui .cta {
  pointer-events: auto;
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 12px 28px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
}
.shot-hint {
  position: absolute;
  top: 16px; left: 0; right: 0;
  text-align: center;
  color: #ccc;
  font-size: 12px;
  z-index: 2;
  text-shadow: 0 1px 3px #000;
}
.player-screen .bottom { /* keep nav */ }
.player-wrap video { position: relative; z-index: 1; }
.player-fallback { z-index: 2; }
.player-fallback.hide { display: none !important; }

.rec-hint {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 12px 16px;
}

/* 首页竖滑：沉浸，底栏半透明 */
.tab-home .bottom {
  background: linear-gradient(transparent, rgba(0,0,0,.85));
  border-top: none;
}
.home-float {
  position: absolute;
  top: calc(12px + var(--safe-t));
  left: 14px;
  z-index: 5;
  pointer-events: none;
}
.home-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255,77,79,.9);
  color: #fff;
  text-shadow: none;
}
.discover-tops {
  display: flex;
  gap: 8px;
  padding: 0 12px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.discover-tops::-webkit-scrollbar { display: none; }
.discover-top-item {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 20px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
}
.home-swipe .shot-hint { top: 48px; }

.thumb-text {
  display: flex;
  align-items: center;
  justify-content: center;
}
.thumb-placeholder {
  font-size: 28px;
  font-weight: 700;
  color: #666;
  opacity: .9;
}

/* 图文：双列相册（有真实封面） */
.feed:has(> .card-photo) {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 8px 12px 16px;
}
.feed:has(> .card-photo) > .card-text,
.feed:has(> .card-photo) > .empty {
  grid-column: 1 / -1;
}
.card.card-photo {
  margin-bottom: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid #2a2a2a;
}
.photo-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: linear-gradient(145deg, #2a2a2a, #151515);
  overflow: hidden;
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-meta {
  padding: 8px 10px 10px;
}
.card.card-photo .card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  -webkit-line-clamp: 2;
}
.card.card-photo .card-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

/* SEO list: crawlable links, visually hidden from normal UI (not display:none) */
.seo-list {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.seo-h1 { font-size: 1rem; }

/* 小说：无封面时用阅读列表样式，避免空 16:9 占位难看 */
.card.card-text {
  margin-bottom: 10px;
  padding: 0 12px;
}
.feed:has(> .card-photo) > .card-text {
  padding: 0;
  margin-bottom: 0;
}
.text-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 10px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid #2a2a2a;
  transition: background .15s ease;
}
.card.card-text:active .text-card {
  background: var(--surface2);
}
.text-card-mark {
  width: 42px;
  height: 54px;
  flex-shrink: 0;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 700;
  color: #f0d0d0;
  background:
    linear-gradient(145deg, rgba(255,77,79,.22), transparent 55%),
    linear-gradient(160deg, #3a2a32 0%, #1c1a24 55%, #162028 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.06),
    2px 0 0 rgba(255,77,79,.35);
  letter-spacing: 0;
}
.text-card-main {
  flex: 1;
  min-width: 0;
}
.text-card-tag {
  font-size: 11px;
  color: var(--accent);
  opacity: .9;
  margin-bottom: 4px;
  letter-spacing: .02em;
}
.card.card-text .card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  -webkit-line-clamp: 2;
}
.card.card-text .card-sub {
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
}
.text-card-go {
  flex-shrink: 0;
  color: #555;
  font-size: 22px;
  line-height: 1;
  padding: 0 2px 0 4px;
}
.reader {
  padding: 16px 16px 32px;
  max-width: 100%;
}
.reader-title {
  font-size: 20px;
  line-height: 1.4;
  font-weight: 700;
  margin-bottom: 10px;
}
.reader-meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 18px;
}
.reader-meta a { color: var(--text); text-decoration: underline; }
.reader-body {
  font-size: 16px;
  line-height: 1.75;
  color: #e8e8e8;
  word-break: break-word;
}
.reader-body p { margin: 0 0 1em; }
.reader-body img { max-width: 100%; height: auto; border-radius: 8px; }
.reader-nav {
  display: flex;
  gap: 8px;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid #222;
}
.reader-nav .v-act { text-align: center; text-decoration: none; }

/* series reader */
.series-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}
.series-name {
  color: var(--accent);
  font-weight: 600;
}
.series-progress { color: var(--muted); flex-shrink: 0; }

.chapter-toc {
  margin: 8px 0 20px;
  padding: 0 12px 12px;
}
.chapter-toc-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-left: 2px;
  padding-right: 2px;
}
.chapter-toc-count {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.chapter-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid #2a2a2a;
}
.chapter-list li {
  border-bottom: 1px solid #2a2a2a;
}
.chapter-list li:last-child { border-bottom: 0; }
.chapter-list li.is-current {
  background: rgba(255, 77, 79, 0.12);
}
.chapter-link {
  display: block;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
}
.chapter-link.current {
  color: var(--accent);
  font-weight: 600;
}
a.chapter-link:active { background: var(--surface2); }
