/* ============================================================
   pages.css — 首页 / 分类 / 搜索 / 我的 四页样式（frontend-pages）
   只服务这四个页面；token、通用组件全部复用 base.css。
   色：深松墨绿 + 铜金 + 米纸白；标题宋体；结构线承担层级，不做装饰堆叠。
   ============================================================ */

/* ============================================================
   首页
   ============================================================ */

/* ---- Hero：全站唯一强视觉锚点 ---- */
.home-hero {
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: clamp(400px, 42vw, 540px);
  margin-top: calc(-1 * clamp(22px, 3vw, 40px));
  margin-inline: calc(-1 * var(--gutter));
  padding: clamp(30px, 4vw, 62px) var(--gutter) clamp(30px, 3.6vw, 54px);
  overflow: hidden;
  isolation: isolate;
}

.home-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.home-hero-bg .home-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  filter: blur(10px) saturate(1.25) brightness(0.92);
  transform: scale(1.08);
  opacity: 1;
}
.home-hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    /* 右端节目单信息栏的软性压暗：只压最右一条，保证小字可读，不参与左侧文字 */
    linear-gradient(270deg, rgba(12, 19, 16, 0.45) 0%, rgba(12, 19, 16, 0.24) 20%, transparent 46%),
    /* 左深右浅：保证标题 / 按钮 / 元信息可读，左侧 alpha 不动 */
    linear-gradient(90deg, rgba(12, 19, 16, 0.96) 0%, rgba(12, 19, 16, 0.88) 36%, rgba(12, 19, 16, 0.3) 72%, rgba(12, 19, 16, 0.48) 100%),
    /* 底部收回到 ink-900，与「最新更新」行自然衔接 */
    linear-gradient(180deg, rgba(12, 19, 16, 0.48) 0%, rgba(12, 19, 16, 0.06) 32%, rgba(12, 19, 16, 0.22) 76%, var(--ink-900) 100%),
    /* 极淡铜金反光，扫在模糊海报上呼应品牌色 */
    radial-gradient(60% 80% at 72% 38%, rgba(201, 164, 91, 0.1), transparent 70%);
}

.home-hero-loading {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 320px;
}

.home-hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(272px, 24vw, 344px);
  gap: clamp(26px, 3.6vw, 60px);
  align-items: end;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
}

/* 左侧：片名 / 元信息 / 行动 */
.hero-main {
  min-width: 0;
  padding-left: clamp(16px, 2.2vw, 28px);
  border-left: 1px solid var(--brass-a24);
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11.5px;
  letter-spacing: 0.32em;
  color: var(--brass);
}
.hero-kicker::after {
  content: "";
  width: clamp(36px, 5vw, 64px);
  height: 1px;
  background: linear-gradient(90deg, var(--brass-dim), transparent);
  flex: 0 0 auto;
}

.hero-title {
  margin: 12px 0 14px;
  max-width: 17ch;
  font-family: var(--font-display);
  font-size: clamp(34px, 4.3vw, 58px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.035em;
  color: var(--paper);
  text-wrap: balance;
}

.hero-meta {
  gap: 8px 16px;
  font-size: 12.5px;
  color: var(--paper-2);
}
.hero-meta .hero-score {
  color: var(--muted);
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
}
.hero-meta .hero-score b {
  font-family: var(--font-num);
  font-size: 17px;
  line-height: 1;
  font-weight: 600;
  color: var(--brass-bright);
}
.hero-meta .hero-tag {
  color: var(--screen);
  border-color: var(--brass-a40);
  background: rgba(12, 19, 16, 0.45);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}
.hero-cta {
  height: 44px;
  padding: 0 24px;
  font-size: 14px;
  letter-spacing: 0.08em;
}
.hero-actions .btn-primary {
  font-weight: 600;
  padding-inline: 28px;
}

.hero-resume {
  margin-top: 15px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}
.hero-resume-link {
  color: var(--paper-2);
  border-bottom: 1px solid var(--brass-a40);
  padding-bottom: 1px;
  transition: color 0.18s, border-color 0.18s;
}
.hero-resume-link:hover {
  color: var(--brass-bright);
  border-color: var(--brass);
}

/* 右侧：节目单 */
.hero-program {
  min-width: 0;
  padding-left: clamp(16px, 2.2vw, 28px);
  border-left: 1px solid var(--line);
}
.program-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.program-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--paper-2);
}
.program-note {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  white-space: nowrap;
}
.program {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.program:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.program:hover .program-name {
  color: var(--brass-bright);
}
.program-thumb {
  position: relative;
  flex: 0 0 58px;
  width: 58px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid var(--brass-a14);
  border-radius: 2px;
  background: var(--ink-750);
}
.program-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.program-thumb img.is-loaded {
  opacity: 1;
}
.program-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding-top: 1px;
}
.program-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 14px;
}
.program-idx {
  font-family: var(--font-num);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--brass-dim);
}
.program-type {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.program-name {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.42;
  color: var(--paper);
  transition: color 0.18s;
}
.program-sub {
  font-size: 11px;
  color: var(--muted);
}
.program-empty {
  padding: 14px 0;
  font-size: 12px;
  color: var(--muted);
}

/* Hero 失败态 */
.home-hero-inner--error {
  grid-template-columns: 1fr;
  align-items: center;
}
.home-hero-inner--error .hero-main {
  padding-left: 0;
  border-left: 0;
  max-width: 640px;
}
.home-hero-inner--error .error-box {
  margin-top: 18px;
  align-items: flex-start;
  text-align: left;
}

/* ---- 首页横排 ---- */
.home-rows {
  margin-top: 0;
}
.home-row {
  margin-bottom: 0;
  padding: clamp(18px, 2.2vw, 28px) 0 clamp(22px, 2.6vw, 32px);
  border-top: 1px solid var(--line-soft);
}
.home-row:first-child {
  border-top: 0;
}
.home-row .row-head {
  margin-bottom: 18px;
}
.home-row-scroll {
  margin-top: 2px;
}

.row-empty {
  padding: 22px 0;
  font-size: 12.5px;
  color: var(--muted-2);
}

.row-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  font-size: 12.5px;
  color: var(--muted);
  border: 1px dashed var(--brass-a24);
  border-radius: var(--radius);
  background: rgba(18, 28, 23, 0.45);
}
.row-error-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-note {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 6px;
  padding: clamp(16px, 2.2vw, 24px) 0 6px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  line-height: 1.75;
  color: var(--muted-2);
}
.home-note b {
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--brass-dim);
}

/* ---- 首页响应式 ---- */
@media (max-width: 1080px) {
  .home-hero-inner {
    grid-template-columns: minmax(0, 1fr) clamp(248px, 27vw, 312px);
    gap: 28px;
  }
}

@media (max-width: 900px) {
  .home-hero {
    min-height: 0;
  }
  .home-hero-inner {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 24px;
  }
  .hero-main {
    border-left: 0;
    padding-left: 0;
  }
  /* 手机竖排：文字区在上、节目单海报在下，文字区要多压一点保证小字对比度，
     下半段留亮让模糊海报颜色透出来。 */
  .home-hero-bg::after {
    background:
      linear-gradient(90deg, rgba(12, 19, 16, 0.95) 0%, rgba(12, 19, 16, 0.88) 46%, rgba(12, 19, 16, 0.6) 78%, rgba(12, 19, 16, 0.66) 100%),
      linear-gradient(180deg, rgba(12, 19, 16, 0.56) 0%, rgba(12, 19, 16, 0.42) 36%, rgba(12, 19, 16, 0.16) 66%, var(--ink-900) 100%),
      radial-gradient(70% 80% at 60% 42%, rgba(201, 164, 91, 0.06), transparent 72%);
  }
  .hero-program {
    border-left: 0;
    padding-left: 0;
    padding-top: 16px;
    border-top: 1px solid var(--line);
  }
  .program-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }
  .program {
    flex-direction: column;
    gap: 8px;
    padding: 0;
    border-bottom: 0;
  }
  .program-thumb {
    flex: 0 0 auto;
    width: 100%;
  }
  .program-body {
    padding-top: 0;
  }
  .program-name {
    font-size: 12.5px;
  }
  .program-sub,
  .program-note {
    display: none;
  }
}

@media (max-width: 680px) {
  .home-hero {
    padding-top: 26px;
    padding-bottom: 30px;
  }
  .hero-title {
    font-size: clamp(34px, 8.6vw, 46px);
    max-width: 14ch;
  }
  .hero-meta {
    font-size: 12px;
  }
  .hero-actions {
    width: 100%;
  }
  .hero-actions .hero-cta {
    flex: 1 1 auto;
  }
  .home-note {
    flex-direction: column;
    gap: 4px;
  }
}

/* ============================================================
   分类页
   ============================================================ */

.cat-lede {
  margin: -6px 0 22px;
  max-width: 78ch;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--muted);
}

.cat-filters {
  margin-bottom: 24px;
}
.cat-chips {
  gap: 8px;
}
.chip-skeleton {
  position: relative;
  display: inline-block;
  width: 64px;
  height: 30px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--ink-750);
}
.chip-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(239, 231, 214, 0.06), transparent);
  animation: shimmer 1.4s infinite;
}

.cat-grid {
  margin-top: 2px;
}
.cat-content {
  min-height: 180px;
}
.category-page .pager {
  flex-wrap: wrap;
}

@media (max-width: 680px) {
  .cat-filters .filter-line {
    gap: 10px;
  }
  .cat-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
  .cat-chips::-webkit-scrollbar {
    display: none;
  }
  .cat-chips .chip {
    flex: 0 0 auto;
  }
  .cat-chips .chip-skeleton {
    flex: 0 0 auto;
  }
}

/* ============================================================
   搜索页
   ============================================================ */

.search-scope {
  flex: 0 0 auto;
}
.search-body {
  min-height: 180px;
}
.search-page .pager {
  flex-wrap: wrap;
}

.search-suggest {
  padding: clamp(16px, 2.2vw, 26px) 0;
}
.suggest-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--paper);
}
.suggest-title::before {
  content: "";
  flex: 0 0 auto;
  width: 18px;
  height: 1px;
  background: var(--brass);
}
.search-hot .chip {
  height: 32px;
  padding: 0 15px;
  font-size: 13px;
}
.search-tip {
  margin-top: 18px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted-2);
}

.search-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 0;
  margin: 0 0 20px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--muted);
}
.search-summary-main {
  color: var(--paper-2);
}
.search-summary-main b {
  margin: 0 2px 0 3px;
  font-family: var(--font-num);
  font-size: 16px;
  font-weight: 600;
  color: var(--brass-bright);
}
.search-summary-time,
.search-summary-sites {
  margin-left: 14px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

/* 结果卡：来源站 + 更新备注 + 多片源徽标 */
.search-grid .cap-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.search-grid .cap-sub .search-site {
  flex: 0 0 auto;
  max-width: 52%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-grid .cap-sub .search-remark {
  flex: 0 1 auto;
  min-width: 0;
}
.search-grid .cap-sub .search-badge {
  flex: 0 0 auto;
  height: 17px;
  padding: 0 5px;
  font-size: 10px;
  letter-spacing: 0.02em;
}

@media (max-width: 680px) {
  .search-summary-time,
  .search-summary-sites {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }
  .search-summary {
    gap: 4px 16px;
  }
}

/* ============================================================
   我的（观看记录 / 收藏 / 设置）
   ============================================================ */

.lib-tabs {
  margin-bottom: 22px;
}
.lib-tabs .num {
  margin-left: 7px;
  font-family: var(--font-num);
  font-size: 11px;
  opacity: 0.72;
}
.lib-content {
  min-height: 120px;
}

/* ---- 观看记录 ---- */
.lib-history {
  border-top: 1px solid var(--line-soft);
}
.lib-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
}
.lib-poster {
  position: relative;
  display: block;
  width: 64px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid var(--brass-a14);
  border-radius: 2px;
  background: var(--ink-750);
}
.lib-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.lib-poster img.is-loaded {
  opacity: 1;
}
.lib-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.lib-titleline {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  min-width: 0;
}
.lib-title {
  max-width: 100%;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--paper);
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.18s;
}
.lib-title:hover {
  color: var(--brass-bright);
}
.lib-time {
  font-size: 11.5px;
  color: var(--muted-2);
}
.lib-meta {
  font-size: 12px;
  color: var(--muted);
}
.lib-ep {
  height: 19px;
  font-size: 10.5px;
}
.lib-progress {
  max-width: 380px;
}
.lib-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lib-actions .btn {
  white-space: nowrap;
}

/* ---- 收藏 ---- */
.fav-cell {
  position: relative;
  min-width: 0;
}
.fav-remove {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--paper-2);
  background: rgba(10, 16, 13, 0.78);
  border: 1px solid rgba(244, 233, 200, 0.22);
  border-radius: 2px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0.5;
  transition: opacity 0.18s, color 0.18s, border-color 0.18s;
}
.fav-cell:hover .fav-remove,
.fav-remove:focus-visible {
  opacity: 1;
}
.fav-remove:hover {
  color: #e2a496;
  border-color: rgba(181, 68, 46, 0.55);
}
@media (hover: none) {
  .fav-remove {
    opacity: 0.9;
  }
}

/* ---- 设置面板 ---- */
.lib-settings {
  margin-top: clamp(28px, 4vw, 50px);
}
.lib-set-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.lib-set-head h2 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--paper);
}
.lib-set-head p {
  font-size: 12px;
  color: var(--muted);
}
.lib-set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px 28px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
}
.lib-set-row:last-of-type {
  border-bottom: 0;
}
.lib-set-label {
  min-width: 0;
}
.lib-set-label b {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--paper);
}
.lib-set-label span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}
.lib-set-control {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.lib-select {
  height: 36px;
  min-width: 210px;
  padding: 0 12px;
  font-size: 13px;
  color: var(--paper);
  background: var(--ink-900);
  border: 1px solid var(--ink-600);
  border-radius: 2px;
  transition: border-color 0.18s;
}
.lib-select:hover {
  border-color: var(--brass-dim);
}
.lib-set-hint {
  font-size: 11px;
  color: var(--muted-2);
}
.lib-set-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}
.lib-storage {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted-2);
}

/* 自动连播开关 */
.lib-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.lib-switch-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.lib-switch-track {
  position: relative;
  display: block;
  width: 42px;
  height: 24px;
  background: var(--ink-900);
  border: 1px solid var(--ink-600);
  border-radius: 12px;
  transition: background 0.2s, border-color 0.2s;
}
.lib-switch-track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.2s;
}
.lib-switch-input:checked + .lib-switch-track {
  background: var(--brass-a24);
  border-color: var(--brass-dim);
}
.lib-switch-input:checked + .lib-switch-track::after {
  transform: translateX(18px);
  background: var(--brass-bright);
}
.lib-switch-input:focus-visible + .lib-switch-track {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .lib-row {
    grid-template-columns: 54px minmax(0, 1fr);
  }
  .lib-poster {
    width: 54px;
  }
  .lib-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

@media (max-width: 680px) {
  .lib-set-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .lib-set-control {
    align-items: flex-start;
    width: 100%;
  }
  .lib-select {
    width: 100%;
    min-width: 0;
  }
  .lib-set-btns {
    justify-content: flex-start;
  }
}
