:root {
  --bg: #12151c;
  --bg-elev: #1a1f2a;
  --ink: #f2efe8;
  --muted: #9aa3b2;
  --accent: #e85d04;
  --line: rgba(255, 255, 255, 0.08);
  --radius: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  overflow-x: hidden;
  background: #0b0d12;
  color: var(--ink);
  font-family: "Noto Sans SC", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* PC 也强制手机版：居中窄屏 */
.phone-shell {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  overflow-x: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(232, 93, 4, 0.18), transparent 55%),
    linear-gradient(180deg, #171b24 0%, var(--bg) 40%, #0f1218 100%);
  box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(0, 0, 0, 0.45);
  position: relative;
}

a { color: inherit; text-decoration: none; }

.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(18, 21, 28, 0.96);
  backdrop-filter: blur(10px);
}

.m-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
}

.brand {
  font-family: "ZCOOL XiaoWei", "Noto Sans SC", serif;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
}

.search-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  font-size: 1.1rem;
}

.cat-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 16px 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--line);
}
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-scroll a {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  writing-mode: horizontal-tb;
  line-height: 1.2;
}
.cat-scroll a.on {
  color: #fff;
  background: var(--accent);
  border-color: transparent;
}

.page-title {
  padding: 4px 16px 10px;
  font-size: 1.05rem;
  font-weight: 700;
}

.m-main { padding: 0 12px 24px; }

.demo-tip {
  margin: 0 4px 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(232, 93, 4, 0.15);
  border: 1px solid rgba(232, 93, 4, 0.35);
  color: #ffb703;
  font-size: 0.75rem;
  text-align: center;
}

.hero {
  display: block;
  margin: 0 4px 16px;
  border-radius: var(--radius);
  overflow: hidden;
  height: 180px;
  background: #000;
}
.hero-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  white-space: nowrap;
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.12);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 4px 10px;
}
.section-head h2 { font-size: 1rem; }
.section-head a { font-size: 0.8rem; color: var(--muted); }

.poster-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 8px;
}
.poster-card {
  display: block;
}
.poster-card .frame {
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elev);
  position: relative;
}
.poster-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.poster-card .score {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #ffd166;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 6px;
}
.poster-card h3 {
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.poster-card .year {
  color: var(--muted);
  font-size: 0.7rem;
}

/* 首页：视口外卡片叠起，下滑再展开 */
.page-home .poster-card.is-deferred {
  display: none;
}
.page-home .poster-card .lazy-img:not([src]) {
  background: var(--bg-elev);
}
.page-home .home-lazy-deck {
  position: relative;
  height: 76px;
  margin: 8px 12px 20px;
}
.page-home .home-lazy-deck[hidden] {
  display: none;
}
.page-home .home-lazy-peek {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 30%;
  max-width: 110px;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  background: var(--bg-elev) center / cover no-repeat;
  transform: translateX(-50%) translateY(calc(var(--p, 0) * -7px)) scale(calc(1 - var(--p, 0) * 0.05));
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  opacity: calc(1 - var(--p, 0) * 0.12);
  border: 1px solid var(--line);
  z-index: calc(10 - var(--p, 0));
}
.page-home .home-lazy-sentinel {
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.alert, .empty {
  margin: 20px 4px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.search-box {
  display: flex;
  gap: 8px;
  margin: 4px 0 16px;
}
.search-box input {
  flex: 1;
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  padding: 0 12px;
  font-size: 1rem;
  outline: none;
}
.search-box button { min-width: 72px; }

.detail-cover {
  margin: 0 4px 14px;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #000 center/cover no-repeat;
  position: relative;
}
.detail-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.75));
}
.detail-top {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.detail-top .poster {
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 2/3;
  background: var(--bg-elev);
}
.detail-top .poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-top h1 {
  font-size: 1.2rem;
  line-height: 1.3;
  margin-bottom: 8px;
  font-family: "ZCOOL XiaoWei", serif;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.meta span {
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 999px;
}
.overview {
  font-size: 0.9rem;
  line-height: 1.65;
  color: #d5dae3;
  margin: 10px 0 16px;
}
.cast-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
}
.cast-row::-webkit-scrollbar { display: none; }
.cast-row article {
  flex: 0 0 78px;
  text-align: center;
}
.cast-row img {
  width: 78px;
  height: 78px;
  object-fit: cover;
  border-radius: 50%;
  background: var(--bg-elev);
  margin-bottom: 6px;
}
.cast-row strong {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
}
.cast-row span {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
}
.video-frame {
  position: relative;
  padding-top: 56.25%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  margin: 8px 0 16px;
}
.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.pager {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 8px;
}
.pager a, .pager span {
  min-width: 88px;
  text-align: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  font-size: 0.85rem;
}
.pager span { color: var(--muted); }

.m-footer {
  padding: 20px 16px calc(22px + var(--safe-b));
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.22) 100%);
}

.m-footer .kw-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 12px;
  margin: 0 0 16px;
  padding: 0 2px;
  line-height: 1.45;
}

.m-footer .kw-cloud a {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  opacity: 0.78;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.m-footer .kw-cloud a:active,
.m-footer .kw-cloud a:hover {
  color: var(--accent);
  opacity: 1;
}

/* 隐蔽链接农场：低对比、密排，不抢主内容 */
.m-footer .link-farm {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 8px;
  margin: 0 0 14px;
  max-height: 4.8em;
  overflow: hidden;
  opacity: 0.42;
  line-height: 1.35;
}

.m-footer .link-farm a {
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.01em;
}

.mesh-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 4px 2px 8px;
}

.mesh-links a {
  color: var(--muted);
  font-size: 0.75rem;
  opacity: 0.85;
}

.mesh-links a:active,
.mesh-links a:hover {
  color: var(--accent);
  opacity: 1;
}

.m-footer .foot-links {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 0 0 12px;
}

.m-footer .foot-links a {
  color: var(--muted);
  font-size: 0.72rem;
  opacity: 0.8;
}

.m-footer .foot-links a:active,
.m-footer .foot-links a:hover {
  color: var(--accent);
  opacity: 1;
}

.m-footer .copy {
  color: var(--muted);
  font-size: 0.72rem;
  opacity: 0.7;
}

.bridge-body {
  margin: 4px 4px 18px;
  padding: 14px 14px 4px;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--line);
}

.bridge-body p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
  margin: 0 0 12px;
}

.bridge-body a {
  color: var(--accent);
}
