/* ShortDramaRank 内容优先（无封面）皮肤 — v=20261109a
 *
 * 由 nginx sub_filter 注入到全站 </head> 前，排在所有原样式表之后。
 * 不改任何静态 HTML：剧封面由 content-first.js 从 DOM 真正删除，本表负责
 * 首屏防闪 + 把「海报墙」重新排版成信息密集的文字榜单。
 *
 * 明确区分：
 *   剧封面  .poster-art / .mini-poster / .similar-poster / .detail-poster /
 *           .featured-poster / .poster-fallback / img[data-cover-img]  -> 全部移除
 *   App 图标 .app-icon* / .app-detail-icon / .app-rank-logo / .watch-app-icon
 *           -> 保留（来自 App Store，稳定可用，是应用身份不是剧封面）
 *
 * 配色沿用站点：#202821 文字 / #285e48 主色 / #dfe3dc 分隔 / #229ed9 Telegram 蓝。
 */

/* ---------------------------------------------------------------------------
   1. 封面：全站隐藏（JS 会进一步 remove 节点，这里是 JS 未执行时的兜底）
   --------------------------------------------------------------------------- */
[data-poster-frame],
.poster-fallback,
.poster-fallback-mark,
img[data-cover-img],
.similar-poster,
.chart-cover-fallback,
.featured-poster,
.drama-card-poster-link,
.poster-missing {
  display: none !important;
}

/* 隐藏海报后，原来按「图 + 文」两列排的容器要退回单列，避免留出空列 */
.detail-hero,
.app-drama-item,
.watch-landing-hero {
  grid-template-columns: minmax(0, 1fr) !important;
}

/* ---------------------------------------------------------------------------
   2. 首页：6 列海报墙 -> 3 列带序号的文字榜单
   --------------------------------------------------------------------------- */
body[data-static-page="home"] .simple-poster-grid,
.poster-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 0 30px !important;
  align-items: stretch !important;
  counter-reset: sdrCardRank !important;
}

body[data-static-page="home"] .simple-drama-card,
.poster-grid > .drama-card {
  position: relative !important;
  display: grid !important;
  grid-template-columns: 30px minmax(0, 1fr) !important;
  gap: 10px !important;
  align-items: start !important;
  min-width: 0 !important;
  padding: 13px 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-top: 1px solid #e3e7e0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
  counter-increment: sdrCardRank !important;
}

body[data-static-page="home"] .simple-drama-card::before,
.poster-grid > .drama-card::before {
  content: counter(sdrCardRank, decimal-leading-zero) !important;
  display: block !important;
  padding-top: 1px !important;
  color: #aab6a9 !important;
  font: 700 12px/1.5 Manrope, system-ui, -apple-system, "Segoe UI", sans-serif !important;
  font-variant-numeric: tabular-nums !important;
}

body[data-static-page="home"] .simple-drama-card:hover,
.poster-grid > .drama-card:hover {
  background: #f4f7f1 !important;
  transform: none !important;
  box-shadow: none !important;
}

body[data-static-page="home"] .simple-drama-card h3,
.poster-grid > .drama-card h3 {
  margin: 0 0 4px !important;
  font-size: 14px !important;
  font-weight: 650 !important;
  line-height: 1.45 !important;
  letter-spacing: -.01em !important;
  overflow-wrap: anywhere !important;
}

body[data-static-page="home"] .simple-drama-card h3 a,
.poster-grid > .drama-card h3 a {
  color: #202821 !important;
  text-decoration: none !important;
}

body[data-static-page="home"] .simple-drama-card h3 a:hover,
.poster-grid > .drama-card h3 a:hover {
  color: #285e48 !important;
  text-decoration: underline !important;
}

body[data-static-page="home"] .simple-drama-card .card-meta,
body[data-static-page="home"] .simple-drama-card p,
.poster-grid > .drama-card p,
.poster-grid > .drama-card small {
  margin: 0 !important;
  color: #6c756b !important;
  font-size: 11px !important;
  line-height: 1.5 !important;
}

/* ---------------------------------------------------------------------------
   3. App 页 / 剧目录页：mini-poster 行 -> 带序号 + 箭头的紧凑文字行
   --------------------------------------------------------------------------- */
.app-drama-list,
.catalog-drama-list,
.similar-list,
.app-featured-dramas > div[data-drama-section] {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 0 26px !important;
  counter-reset: sdrListRank !important;
}

/* 相似剧位于详情页右侧窄栏，2 列会把剧名挤成碎行，强制单列 */
.similar-list { grid-template-columns: minmax(0, 1fr) !important; gap: 0 !important; }

.app-drama-list > a,
.catalog-drama-list > a,
.similar-list > a,
.app-featured-dramas > div[data-drama-section] > a,
.app-featured-dramas.app-current-charts > div > a {
  position: relative !important;
  display: grid !important;
  grid-template-columns: 30px minmax(0, 1fr) 14px !important;
  gap: 10px !important;
  align-items: start !important;
  min-width: 0 !important;
  padding: 11px 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-top: 1px solid #e3e7e0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  counter-increment: sdrListRank !important;
}

.app-drama-list > a::before,
.catalog-drama-list > a::before,
.similar-list > a::before,
.app-featured-dramas > div[data-drama-section] > a::before,
.app-featured-dramas.app-current-charts > div > a::before {
  content: counter(sdrListRank, decimal-leading-zero) !important;
  display: block !important;
  color: #aab6a9 !important;
  font: 700 11px/1.6 Manrope, system-ui, -apple-system, "Segoe UI", sans-serif !important;
  font-variant-numeric: tabular-nums !important;
}

.app-drama-list > a::after,
.catalog-drama-list > a::after,
.similar-list > a::after,
.app-featured-dramas > div[data-drama-section] > a::after,
.app-featured-dramas.app-current-charts > div > a::after {
  content: "\2192" !important;
  display: block !important;
  color: #9aa89a !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
}

.app-drama-list > a:hover,
.catalog-drama-list > a:hover,
.similar-list > a:hover,
.app-featured-dramas > div[data-drama-section] > a:hover,
.app-featured-dramas.app-current-charts > div > a:hover {
  background: #f4f7f1 !important;
}

.app-drama-list > a > span,
.catalog-drama-list > a > span,
.similar-list > a > span,
.app-featured-dramas > div[data-drama-section] > a > span:last-child,
.app-featured-dramas.app-current-charts > div > a > span:last-child {
  min-width: 0 !important;
  display: block !important;
}

.app-drama-list > a strong,
.catalog-drama-list > a strong,
.similar-list > a strong,
.app-featured-dramas > div[data-drama-section] > a strong,
.app-featured-dramas.app-current-charts > div > a strong {
  display: block !important;
  margin: 0 0 3px !important;
  color: #202821 !important;
  font-size: 13px !important;
  font-weight: 650 !important;
  line-height: 1.45 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  -webkit-line-clamp: 2 !important;
}

.app-drama-list > a small,
.catalog-drama-list > a small,
.similar-list > a small,
.app-featured-dramas > div[data-drama-section] > a small,
.app-featured-dramas.app-current-charts > div > a small {
  display: block !important;
  margin: 0 !important;
  color: #6c756b !important;
  font-size: 11px !important;
  line-height: 1.5 !important;
  white-space: normal !important;
}

/* 纯文字标题列表（首页 new / 搜索结果）保持紧凑 */
.simple-title-list article,
.app-featured-dramas > div:not([data-drama-section]) > a {
  padding: 11px 0 !important;
  border-top: 1px solid #e3e7e0 !important;
}

/* ---------------------------------------------------------------------------
   4. 剧详情页：主图移除后标题区补一点呼吸
   --------------------------------------------------------------------------- */
.detail-hero {
  padding: 24px !important;
}

.detail-main h1,
.detail-hero h1 {
  font-size: clamp(24px, 3vw, 34px) !important;
  line-height: 1.2 !important;
  letter-spacing: -.025em !important;
}

/* ---------------------------------------------------------------------------
   5. 数据库驱动的「最热 / 最新」区块（content-first.js 生成）
   --------------------------------------------------------------------------- */
#sdrLiveFeeds {
  box-sizing: border-box;
  display: block;
  width: 100%;
  max-width: 1180px;
  margin: 26px auto 0;
  padding: 22px 24px 24px;
  border: 1px solid #dfe3dc;
  border-radius: 10px;
  background: #fff;
  color: #202821;
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  box-shadow: 0 2px 14px rgba(20, 32, 24, .05);
}

#sdrLiveFeeds *,
#sdrLiveFeeds *::before,
#sdrLiveFeeds *::after { box-sizing: border-box; }

.sdr-feeds-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #edf0ea;
  font-size: 11px;
  color: #6c756b;
}

.sdr-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef4ed;
  color: #285e48;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #285e48;
  text-decoration: none;
  cursor: pointer;
}

#sdrLiveFeeds .sdr-live-badge:hover,
#sdrLiveFeeds .sdr-live-badge:focus-visible {
  background: #dcebdd;
  color: #1e4d38;
}

.sdr-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3fa76a;
  box-shadow: 0 0 0 0 rgba(63, 167, 106, .55);
  animation: sdrPulse 2.2s infinite;
}

@keyframes sdrPulse {
  70% { box-shadow: 0 0 0 7px rgba(63, 167, 106, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 167, 106, 0); }
}

.sdr-feeds-head small { margin-inline-start: auto; font-size: 10px; color: #8a9489; }

.sdr-feed-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 30px;
}

.sdr-feed-col h3 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: #202821;
}

.sdr-feed-col h3 span { font-size: 10px; font-weight: 600; color: #8a9489; }

.sdr-rank-list { list-style: none; margin: 0; padding: 0; counter-reset: none; }

.sdr-rank-list li { margin: 0; padding: 0; }

.sdr-rank-list li a {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 14px;
  gap: 10px;
  align-items: start;
  padding: 9px 0;
  border-top: 1px solid #edf0ea;
  color: inherit;
  text-decoration: none;
}

.sdr-rank-list li:first-child a { border-top: 0; }

.sdr-rank-list li a:hover { background: #f6f9f4; }

.sdr-num {
  color: #aab6a9;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
}

#sdrLiveFeeds .sdr-body {
  display: block;
  min-width: 0;
}

.sdr-title {
  display: block;
  min-width: 0;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
  color: #202821;
  overflow-wrap: anywhere;
}

.sdr-meta {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.5;
  color: #6c756b;
  overflow-wrap: anywhere;
}

.sdr-arrow { color: #9aa89a; font-size: 13px; line-height: 1.5; }

.sdr-rank-list li a:hover .sdr-title { color: #285e48; text-decoration: underline; }

.sdr-feed-empty { margin: 8px 0 0; font-size: 11px; color: #8a9489; }

/* ---------------------------------------------------------------------------
   6. 列表页 Telegram 通栏 CTA（剧详情页已有 #tgDramaCta，不重复插入）
   --------------------------------------------------------------------------- */
#tgFeedCta {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 1180px;
  margin: 16px auto 0;
  padding: 18px 22px;
  border-radius: 10px;
  background: linear-gradient(115deg, #229ed9 0%, #1b83bd 52%, #12639a 100%);
  color: #fff;
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(34, 158, 217, .2);
}

#tgFeedCta:visited { color: #fff; }
#tgFeedCta:hover, #tgFeedCta:focus-visible { color: #fff; filter: brightness(1.05); }
#tgFeedCta:focus-visible { outline: 2px solid #ffb000; outline-offset: 3px; }

#tgFeedCta .tg-feed-plane { display: block; width: 34px; height: 34px; flex: 0 0 auto; }
#tgFeedCta .tg-feed-copy { flex: 1 1 auto; min-width: 0; }
#tgFeedCta .tg-feed-badge {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 5px; padding: 3px 8px;
  border: 1px solid rgba(255,255,255,.35); border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
#tgFeedCta .tg-feed-badge i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #ffd166; box-shadow: 0 0 0 0 rgba(255,209,102,.7);
  animation: sdrGold 2s infinite;
}
@keyframes sdrGold {
  70% { box-shadow: 0 0 0 6px rgba(255,209,102,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,209,102,0); }
}
#tgFeedCta .tg-feed-title { display: block; font-size: 16px; font-weight: 750; line-height: 1.35; }
#tgFeedCta .tg-feed-body { display: block; margin-top: 4px; font-size: 11px; line-height: 1.5; opacity: .92; }
#tgFeedCta .tg-feed-button {
  display: inline-flex; align-items: center; gap: 7px;
  flex: 0 0 auto; padding: 10px 15px;
  border-radius: 999px; background: #fff; color: #12639a;
  font-size: 12px; font-weight: 750; white-space: nowrap;
}
#tgFeedCta .tg-feed-button span { font-size: 14px; line-height: 1; }

/* ---------------------------------------------------------------------------
   7. 响应式 / RTL
   --------------------------------------------------------------------------- */
@media (max-width: 900px) {
  body[data-static-page="home"] .simple-poster-grid,
  .poster-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 0 20px !important; }
  .app-drama-list, .catalog-drama-list, .similar-list,
  .app-featured-dramas > div[data-drama-section] { grid-template-columns: minmax(0, 1fr) !important; }
  .sdr-feed-grid { grid-template-columns: minmax(0, 1fr); gap: 18px 0; }
}

@media (max-width: 620px) {
  body[data-static-page="home"] .simple-poster-grid,
  .poster-grid { grid-template-columns: minmax(0, 1fr) !important; }
  #sdrLiveFeeds { margin-top: 18px; padding: 16px; }
  #tgFeedCta { flex-wrap: wrap; gap: 10px; padding: 16px; }
  #tgFeedCta .tg-feed-plane { width: 28px; height: 28px; }
  #tgFeedCta .tg-feed-button { width: 100%; justify-content: center; }
  .sdr-feeds-head small { margin-inline-start: 0; }
}

[dir="rtl"] .sdr-arrow,
[dir="rtl"] .app-drama-list > a::after,
[dir="rtl"] .catalog-drama-list > a::after,
[dir="rtl"] .similar-list > a::after { transform: scaleX(-1); display: inline-block; }

@media (prefers-reduced-motion: reduce) {
  .sdr-live-dot, #tgFeedCta .tg-feed-badge i { animation: none !important; }
}
