/* 연재 시리즈 페이지 전용 — 홈 중복 섹션 숨김 (원본 시안 정책 유지) */
#todayNewEpisodes,
#seriesOngoing,
#aiFilmsShorts,
#seriesCompleted,
#curatorPick,
#creatorSpotlight {
  display: none !important;
}

/*
 * 카탈로그 썸네일 — 쇼츠 '오늘의 짧은 추천'(.shorts-scroll-thumb)과 동일 비율(32/25)
 * · PC(≥1025px): 1행 style-wide-quad(4장)만 common 1.4:1 유지 — 1행 내 높이 통일
 * · 모바일·태블릿(≤1024px): 전 카드 32/25
 */
body[data-page="series"] #seriesCatalogGrid .series-card .poster-wrap {
  aspect-ratio: 32 / 25 !important;
}

@media (min-width: 1025px) {
  body[data-page="series"] #seriesCatalogGrid .series-card.style-wide-quad .poster-wrap {
    aspect-ratio: 1.4 / 1 !important;
  }
}

/* ── 카탈로그 그리드: 2열 포탈(사이드바 380px) 안에서 행별 열 수 유지 ──
   1행 와이드 4열 + 2행 이후 포스터 6열 (common.css 1400px 4열 강제 규칙 보정) */
@media (min-width: 1025px) {
  body[data-page="series"] #seriesCatalogGrid .series-card.style-wide-quad {
    width: calc((100% - (16px * 3)) / 4) !important;
    min-width: 0 !important;
    max-width: calc((100% - (16px * 3)) / 4) !important;
  }

  body[data-page="series"] #seriesCatalogGrid .series-card.style-play-inline,
  body[data-page="series"] #seriesCatalogGrid .series-card.style-poster-hover {
    width: calc((100% - (16px * 5)) / 6) !important;
    min-width: 0 !important;
    max-width: calc((100% - (16px * 5)) / 6) !important;
  }

  /*
   * 1행 대형 카드(style-wide-quad) — 에피소드 상태는 좌측, 평점·조회수는 우측 정렬
   * (common.css .series-meta-row { justify-content:flex-start } 덮어씀)
   */
  body[data-page="series"] #seriesCatalogGrid .series-card.style-wide-quad .series-meta-row {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  body[data-page="series"] #seriesCatalogGrid .series-card.style-wide-quad .series-meta-row > span:first-child {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body[data-page="series"] #seriesCatalogGrid .series-card.style-wide-quad .rating-views-combined.catalog-rating-stats {
    flex: 0 0 auto !important;
    justify-content: flex-start !important;
    margin-left: auto !important;
    gap: 4px !important;
    width: auto !important;
    max-width: 100%;
  }

  /*
   * 2행+ 포스터 카드(style-poster-hover) — 에피소드 메타(S1 · EP02 · 연재중) PC 한 단계 확대
   * · common.css 11px → 12px (1행 wide-quad meta-row 13px 유지)
   */
  body[data-page="series"] #seriesCatalogGrid .series-card.style-poster-hover .series-meta-row,
  body[data-page="series"] #seriesCatalogGrid .series-card.style-play-inline .series-meta-row {
    font-size: 12px !important;
  }
}

/* 1400px 이하 뷰포트에서도 연재 페이지는 포스터 6열 유지 */
@media (min-width: 1025px) and (max-width: 1600px) {
  body[data-page="series"] #seriesCatalogGrid .series-card.style-play-inline,
  body[data-page="series"] #seriesCatalogGrid .series-card.style-poster-hover {
    width: calc((100% - (16px * 5)) / 6) !important;
    max-width: calc((100% - (16px * 5)) / 6) !important;
  }

  body[data-page="series"] #seriesCatalogGrid .series-card.style-wide-quad {
    width: calc((100% - (16px * 3)) / 4) !important;
    max-width: calc((100% - (16px * 3)) / 4) !important;
  }
}

/*
 * 이번 주 인기 연재 위젯 — 시네마틱 가로 썸네일 (PC 사이드바 · 모바일 탭 공통)
 * 64×44 · border-radius 6px
 */
#weeklyPopular .sidebar-rank-thumb,
#weeklyPopularMobile .sidebar-rank-thumb {
  width: 64px;
  height: 44px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  line-height: 0;
  color: transparent;
  text-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/*
 * 전체 연재 시리즈 카탈로그 — 해시태그 라인(#Cyberpunk · #신작소식 등) 숨김
 * (메타 정보 과다 노출 방지 — 장르·평점·크리에이터·업데이트만 유지)
 */
body[data-page="series"] #seriesCatalogGrid .series-card .tag-pill-container {
  display: none !important;
}

/*
 * 연재 카탈로그 카드 본문 — 제목 · 에피소드 · 평점 행 간격 통일
 * · common.css margin-bottom(6px) + title-assist-wrapper 유무 + JS 인라인 margin이
 *   겹치면서 기기·카드마다 1↔2행 / 2↔3행 간격이 달라지는 문제 해소
 */
body[data-page="series"] #seriesCatalogGrid .series-card .series-body {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

body[data-page="series"] #seriesCatalogGrid .series-card .series-card-title,
body[data-page="series"] #seriesCatalogGrid .title-assist-wrapper,
body[data-page="series"] #seriesCatalogGrid .title-assist-wrapper > .series-card-title {
  margin: 0 !important;
}

body[data-page="series"] #seriesCatalogGrid .series-card .series-meta-row {
  margin: 0 !important;
}

body[data-page="series"] #seriesCatalogGrid .series-card .series-rating-views,
body[data-page="series"] #seriesCatalogGrid .series-card .rating-views-combined {
  margin: 0 !important;
}

/*
 * 전체 연재 카탈로그 — 평점·조회수 (쇼츠 .shorts-scroll-stats 와 동일)
 * · ★ 4.85 · 198.3K 좌측 인라인 · 배지 없음 · 평점 골드 · 조회수 회색 텍스트
 */
body[data-page="series"] #seriesCatalogGrid .catalog-rating-stats,
body[data-page="series"] #seriesCatalogGrid .series-rating-views.catalog-rating-stats,
body[data-page="series"] #seriesCatalogGrid .rating-views-combined.catalog-rating-stats {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 4px !important;
  width: 100% !important;
  margin: 0 !important;
  font-size: 12px !important;
  color: rgba(255, 255, 255, 0.48) !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box !important;
  min-height: 1.2em !important;
}

body[data-page="series"] #seriesCatalogGrid .catalog-stat-dot:empty,
body[data-page="series"] #seriesCatalogGrid .catalog-views-text:empty,
body[data-page="series"] #seriesCatalogGrid .catalog-stat-rating:empty {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

body[data-page="series"] #seriesCatalogGrid .catalog-rating-stats .catalog-stat-rating,
body[data-page="series"] #seriesCatalogGrid .catalog-rating-stats .rating-container {
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
  color: var(--accent-gold) !important;
  font-weight: 600 !important;
  font-size: inherit !important;
  flex-shrink: 0;
}

/* 평점(★·숫자) — 조회수와 동일 행 크기 (common.css 별 13px/13.5px 덮어씀) */
body[data-page="series"] #seriesCatalogGrid .catalog-rating-stats .rating-star,
body[data-page="series"] #seriesCatalogGrid .catalog-rating-stats .rating-value,
body[data-page="series"] #seriesCatalogGrid .catalog-rating-stats .rating-container .rating-star,
body[data-page="series"] #seriesCatalogGrid .rating-views-combined.catalog-rating-stats .rating-container .rating-star,
body[data-page="series"] #seriesCatalogGrid .series-rating-views.catalog-rating-stats .rating-container .rating-star {
  color: var(--accent-gold) !important;
  font-weight: 700 !important;
  font-size: 1em !important;
  line-height: 1.2 !important;
}

body[data-page="series"] #seriesCatalogGrid .catalog-rating-stats .rating-star {
  font-weight: 900 !important;
}

body[data-page="series"] #seriesCatalogGrid .catalog-stat-dot {
  opacity: 0.55;
  flex-shrink: 0;
  font-size: inherit !important;
}

body[data-page="series"] #seriesCatalogGrid .catalog-views-text {
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(255, 255, 255, 0.48) !important;
  font-weight: 600 !important;
  font-size: 1em !important;
  line-height: 1.2 !important;
  flex-shrink: 1;
  min-width: 0;
  margin-left: 0 !important;
  background: none !important;
  border: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  letter-spacing: normal !important;
}

/* 숫자만 있을 때도 조회수임을 알 수 있게 기존 카드 톤의 눈 아이콘을 붙인다 */
body[data-page="series"] #seriesCatalogGrid .catalog-views-text::before {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.22em;
  vertical-align: -0.08em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8 11 8-11-8-11-8z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8 11 8-11-8-11-8z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* 숫자만 있을 때도 조회수임을 알 수 있게 기존 카드 톤의 눈 아이콘을 붙인다 */
body[data-page="series"] #seriesCatalogGrid .catalog-views-text::before {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.22em;
  vertical-align: -0.08em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8 11 8-11-8-11-8z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* 1행 wide-quad — meta-row 우측 평점·조회수 블록 */
body[data-page="series"] #seriesCatalogGrid .series-card.style-wide-quad .rating-views-combined.catalog-rating-stats {
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: 100%;
  margin-left: auto !important;
}

body[data-page="series"] #seriesCatalogGrid .series-card .tag-pill-container {
  margin: 0 !important;
}

/*
 * 전체 연재 시리즈 카탈로그 — 푸터 제작자·출시일 가독성 (홈 장르 메타와 동일 톤)
 * · common.css 0.38 / 0.25 저명도 규칙 덮어씀
 * · 출시일(2일 전 등)도 제작자와 같은 위계로 밝기 보강
 */
body[data-page="series"] #seriesCatalogGrid .series-card .series-card-footer {
  border-top-color: rgba(255, 255, 255, 0.075) !important;
  /* 구분선 ↔ 제작자·출시일 텍스트 사이 여백 50% 축소 (8px → 4px) */
  padding-top: 4px !important;
}

/* 1행 wide-quad — 인라인 10px 기준 절반 */
body[data-page="series"] #seriesCatalogGrid .series-card.style-wide-quad .series-card-footer {
  padding-top: 5px !important;
}

/*
 * 크리에이터명 — 남는 공간을 모두 쓰고, 정말 넘칠 때만 말줄임
 *
 * 기존 문제 (공간이 남는데도 "by Alex ⋯", "by AI One S⋯" 처럼 잘림)
 * · 이름 칸(span)이 내용 폭만 차지하고 늘어나지 않아, 카드에 남는 여백을 못 썼다.
 * · 이름이 링크(button.creator-profile-link)로 렌더될 때 common.css 의
 *   max-width:100% 가 이름 칸 폭 기준으로 잡히는데, 그 칸에는 "by " 접두어도 같이
 *   들어 있어서 접두어 폭만큼 이름 끝이 항상 깎였다.
 *   → 링크가 없는 크리에이터(Lumen Works, Nova Frame)만 이름이 온전히 보였던 이유.
 * · 모바일에서는 추가로 65% 폭 제한이 걸려 더 짧게 잘렸다.
 */
body[data-page="series"] #seriesCatalogGrid .series-card .series-card-footer .creator-name-update {
  color: rgba(255, 255, 255, 0.52) !important;
  /* 업데이트 문구를 뺀 남는 공간을 모두 차지 */
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: none !important;
}

/*
 * 링크 이름은 "by " 접두어 폭(약 1.6em)을 뺀 나머지까지 허용하고, 그 안에서만 말줄임.
 * 부모 span 이 아니라 링크가 직접 자르므로 이름이 통째로 사라지지 않고 앞부분이 남는다.
 * (링크에는 .creator-name-update 도 함께 붙으므로 위 규칙보다 뒤에 와야 max-width 가 적용됨)
 */
body[data-page="series"] #seriesCatalogGrid .series-card .series-card-footer .creator-profile-link {
  max-width: calc(100% - 1.6em) !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body[data-page="series"] #seriesCatalogGrid .series-card .series-card-footer .realtime-update-str {
  color: rgba(255, 255, 255, 0.48) !important;
  /* 업데이트 문구는 자기 폭만 차지하고 줄어들지 않는다 */
  flex: 0 0 auto !important;
  font-weight: 500 !important;
}

/*
 * 전체 연재 시리즈 카탈로그 — 썸네일 우상단 연재중·완결 배지 숨김 (NEW만 유지)
 */
body[data-page="series"] #seriesCatalogGrid .series-card .series-badge-absolute:has(.badge-ongoing),
body[data-page="series"] #seriesCatalogGrid .series-card .series-badge-absolute:has(.badge-completed),
body[data-page="series"] #seriesCatalogGrid .series-card .series-badge-absolute:has(.badge-complete) {
  display: none !important;
}

/*
 * 숏폼 시리즈 배지 — 공통 mock 의 seriesDefaultFormat 이 shortform 일 때만 렌더된다.
 * 카드 비율(16:9)은 그대로 두고 배지로만 알린다. 9:16 전용 카드는 AI 단편·쇼츠 페이지에서 다룬다.
 */
body[data-page="series"] #seriesCatalogGrid .series-format-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.2;
  background: rgba(120, 180, 255, 0.16);
  color: #9ec5ff;
  border: 1px solid rgba(120, 180, 255, 0.32);
  vertical-align: middle;
}

/* ── 연재 시리즈 페이지 모바일 전용 (≤768px) ── */
@media (max-width: 768px) {
  /*
   * 카탈로그 — 평점·조회수 동일 크기 (쇼츠 조회수 12px 기준)
   */
  body[data-page="series"] #seriesCatalogGrid .catalog-rating-stats {
    font-size: 13px !important;
    gap: 4px !important;
    justify-content: flex-start !important;
  }

  body[data-page="series"] #seriesCatalogGrid .catalog-rating-stats .rating-star,
  body[data-page="series"] #seriesCatalogGrid .catalog-rating-stats .rating-value,
  body[data-page="series"] #seriesCatalogGrid .catalog-rating-stats .rating-container,
  body[data-page="series"] #seriesCatalogGrid .catalog-rating-stats .rating-container .rating-star,
  body[data-page="series"] #seriesCatalogGrid .catalog-views-text {
    font-size: 1em !important;
    line-height: 1.2 !important;
  }

  body[data-page="series"] #seriesCatalogGrid .catalog-views-text {
    color: rgba(255, 255, 255, 0.48) !important;
  }

  /*
   * 인기 & 업데이트 — 탭 카드 텍스트 (홈 주간·월간 인기 탭과 동일 수준으로 확대)
   */
  body[data-page="series"] #weeklyPopularMobile .sidebar-rank-title {
    font-size: 0.88rem !important;
  }

  body[data-page="series"] #weeklyPopularMobile .sidebar-rank-meta {
    font-size: 0.75rem !important;
  }

  body[data-page="series"] #weeklyPopularMobile .sidebar-rank-meta .sidebar-rank-hot,
  body[data-page="series"] #weeklyPopularMobile .sidebar-rank-meta > span:first-child {
    font-size: 0.70rem !important;
  }

  body[data-page="series"] #weeklyPopularMobile .sidebar-rank-num {
    font-size: 1.26rem !important;
  }

  /* 실시간(새 에피소드) · 완결작 탭 — 카드 제목·메타 한 단계 확대 */
  body[data-page="series"] #newEpisodeUpdatesMobile .sidebar-ranking-item > div:first-child .lang-ko,
  body[data-page="series"] #newEpisodeUpdatesMobile .sidebar-ranking-item > div:first-child .lang-en,
  body[data-page="series"] #bingeCompleteWatchMobile .sidebar-ranking-item > div:first-child .lang-ko,
  body[data-page="series"] #bingeCompleteWatchMobile .sidebar-ranking-item > div:first-child .lang-en {
    font-size: 0.88rem !important;
  }

  body[data-page="series"] #newEpisodeUpdatesMobile .sidebar-ranking-item > div:first-child > span:last-child,
  body[data-page="series"] #bingeCompleteWatchMobile .sidebar-ranking-item > div:first-child > span:last-child {
    font-size: 0.74rem !important;
  }

  body[data-page="series"] #newEpisodeUpdatesMobile .sidebar-ranking-item > div:last-child,
  body[data-page="series"] #bingeCompleteWatchMobile .sidebar-ranking-item > div:last-child {
    font-size: 0.78rem !important;
  }

  /*
   * 이달의 크리에이터 — 카드 내 요소 10% 확대 (가독성)
   * · 설명(p) 한 단계 추가 확대
   */
  body[data-page="series"] #sidebarCreatorHighlightMobile > div:last-child {
    padding: 15px !important;
    gap: 11px !important;
  }

  body[data-page="series"] #sidebarCreatorHighlightMobile > div:last-child > div:first-child > div:first-child {
    width: 40px !important;
    height: 40px !important;
    font-size: 12px !important;
  }

  body[data-page="series"] #sidebarCreatorHighlightMobile > div:last-child > div:first-child > div:last-child > div:first-child {
    font-size: 0.94rem !important;
  }

  body[data-page="series"] #sidebarCreatorHighlightMobile > div:last-child > div:first-child > div:last-child > div:last-child {
    font-size: 0.75rem !important;
  }

  body[data-page="series"] #sidebarCreatorHighlightMobile > div:last-child > p {
    font-size: 0.88rem !important;
    line-height: 1.45 !important;
  }

  body[data-page="series"] #sidebarCreatorHighlightMobile > div:last-child > div:last-child > div:first-child {
    font-size: 0.75rem !important;
    margin-bottom: 7px !important;
  }

  body[data-page="series"] #sidebarCreatorHighlightMobile > div:last-child > div:last-child button {
    font-size: 0.75rem !important;
    padding: 4px 9px !important;
  }

  /*
   * 카드 하단 장르·푸터 메타 — 홈과 동일 가독성 보강
   * · 장르 라인(포털 연재 카드): text-muted보다 살짝 밝게
   * · 구분선: border-top 미세 강화
   * · 카탈로그 제작자·출시일 색상은 상단 전역 규칙 적용
   */
  body[data-page="series"] .series-card-footer {
    border-top-color: rgba(255, 255, 255, 0.075);
  }

  body[data-page="series"] .series-card-footer > span:first-child:not(.creator-name-update) {
    color: rgba(255, 255, 255, 0.52);
  }

  /* 모바일 카탈로그 — 출시일 폰트 크기를 제작자와 동일하게 */
  body[data-page="series"] #seriesCatalogGrid .series-card .series-card-footer .creator-name-update {
    font-size: 12px !important;
  }

  body[data-page="series"] #seriesCatalogGrid .series-card .series-card-footer .realtime-update-str {
    font-size: 12px !important;
  }

  /* 모바일 카탈로그 — 구분선 ↔ 푸터 텍스트 여백 50% 축소 (common 10px → 5px) */
  body[data-page="series"] #seriesCatalogGrid .series-card .series-card-footer {
    padding-top: 5px !important;
  }

  /*
   * 모바일 카탈로그 — 제목(화이트) AI 단편·쇼츠와 동일 14px
   * · common.css 0.94rem(≈15px) 덮어씀
   */
  body[data-page="series"] #seriesCatalogGrid .series-card .series-card-title,
  body[data-page="series"] #seriesCatalogGrid .title-assist-wrapper > .series-card-title {
    font-size: 14px !important;
    line-height: 1.35 !important;
    margin-bottom: 0 !important;
  }

  body[data-page="series"] #seriesCatalogGrid .title-assist-wrapper {
    margin-bottom: 0 !important;
  }

  /* 모바일 — 본문 3행 gap은 전역 규칙(6px) 유지, common.css margin·내부 gap 덮어씀 */
  body[data-page="series"] #seriesCatalogGrid .series-card .series-meta-row {
    margin: 0 !important;
  }

  body[data-page="series"] #seriesCatalogGrid .series-card .series-rating-views,
  body[data-page="series"] #seriesCatalogGrid .series-card .rating-views-combined {
    margin: 0 !important;
  }

  /* wide-quad: 에피소드·평점이 meta-row 안에 세로 배치될 때 내부 간격도 6px로 통일 */
  body[data-page="series"] #seriesCatalogGrid .series-card.style-wide-quad .series-meta-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 6px !important;
  }

  body[data-page="series"] #seriesCatalogGrid .series-card.style-wide-quad .rating-views-combined.catalog-rating-stats {
    margin-top: 0 !important;
    width: 100% !important;
    justify-content: flex-start !important;
    gap: 4px !important;
  }
}

/* 새 에피소드 업데이트 0건·실패 — 섹션 폭을 유지하고 카드는 키우지 않는다 */
body[data-page="series"] .js-new-episode-updates-list .catalog-widget-empty {
  margin: 4px 0;
  padding: 8px 2px;
  font-size: 0.78rem;
  color: var(--text-muted, #9aa3b5);
}
