/* Preset-only collection and channel pages. All colours resolve from the
   content palette; the app navigation and drama feed keep their own geometry. */
.dr-theme[data-dr-route]:is([data-dr-route^="topic/"], [data-dr-route^="live/"]) .dr-main:has(> :is(.dr-collections, .dr-collection-detail, .dr-live-directory, .dr-live-watch)):has(> .dr-floating-back) {
  padding-inline: var(--dr-page-inset);
  padding-block-start: calc(12px + env(safe-area-inset-top));
}

.dr-theme .dr-main :is(.dr-collections, .dr-collection-detail, .dr-live-directory, .dr-live-watch) {
  min-width: 0;
  color: var(--dr-content-text);
}

.dr-theme .dr-main :is(.dr-collection-heading__line, .dr-collection-section__head, .dr-collection-card__footer, .dr-collection-detail__top) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.dr-theme .dr-main .dr-collection-heading { margin: 0 0 24px; }
.dr-theme .dr-main .dr-collection-heading__line { min-height: 40px; padding-left: 40px; }
.dr-theme .dr-main .dr-collection-heading h1 { min-width: 0; font-size: 23px; line-height: 1.4; font-weight: 700; overflow-wrap: anywhere; }
.dr-theme .dr-main .dr-collection-heading__line > svg { width: 26px; height: 26px; flex: 0 0 26px; color: var(--dr-content-accent); }
.dr-theme .dr-main .dr-collection-heading > p { margin-top: 12px; color: var(--dr-content-muted); font-size: 14px; line-height: 1.65; }

.dr-theme .dr-main .dr-collection-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 48px;
  margin-bottom: 24px;
  padding: 2px 4px 2px 14px;
  border: 1px solid var(--dr-content-line);
  border-radius: 14px;
  background: var(--dr-content-surface);
}

.dr-theme .dr-main .dr-collection-search > svg { width: 20px; height: 20px; flex: 0 0 20px; color: var(--dr-content-muted); }
.dr-theme .dr-main .dr-collection-search input { flex: 1; min-width: 0; width: 0; min-height: 42px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--dr-content-text); font-size: 14px; }
.dr-theme .dr-main .dr-collection-search input::placeholder { color: var(--dr-content-muted); }
.dr-theme .dr-main .dr-collection-search button { flex: 0 0 auto; min-height: 44px; padding: 0 14px; border-radius: 10px; background: var(--dr-content-accent); color: var(--dr-content-on-accent); font-size: 13px; font-weight: 650; }
.dr-theme .dr-main .dr-collection-search:focus-within { border-color: var(--dr-content-accent); box-shadow: 0 0 0 2px var(--dr-content-accent-soft); }
.dr-theme .dr-main .dr-collection-section__head { align-items: flex-start; margin: 0 0 16px; }
.dr-theme .dr-main .dr-collection-section__head > div { min-width: 0; }
.dr-theme .dr-main .dr-collection-section__head h2 { font-size: 18px; font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
.dr-theme .dr-main .dr-collection-section__head p { margin-top: 4px; font-size: 12px; line-height: 1.5; color: var(--dr-content-muted); }
.dr-theme .dr-main .dr-collection-sort { display: flex; flex: 0 0 auto; gap: 2px; padding: 3px; border-radius: 12px; background: var(--dr-content-fill); }
.dr-theme .dr-main .dr-collection-sort a { display: grid; place-items: center; min-height: 38px; padding: 0 12px; border-radius: 9px; color: var(--dr-content-muted); font-size: 13px; }
.dr-theme .dr-main .dr-collection-sort a[aria-current] { background: var(--dr-content-surface); color: var(--dr-content-accent); font-weight: 650; box-shadow: var(--dr-content-shadow); }

.dr-theme .dr-main .dr-collection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
.dr-theme .dr-main .dr-collection-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--dr-content-line); border-radius: 16px; background: var(--dr-content-surface); }
.dr-theme .dr-main .dr-collection-card__cover { display: block; position: relative; overflow: hidden; aspect-ratio: 16 / 9; background: var(--dr-content-fill); }
.dr-theme .dr-main .dr-collection-card__cover img { width: 100%; height: 100%; object-fit: cover; }
.dr-theme .dr-main .dr-collection-card__cover-mark { position: absolute; bottom: 8px; right: 8px; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #ffffff40; border-radius: 9px; background: #09090980; color: #fff; backdrop-filter: blur(8px); }
.dr-theme .dr-main .dr-collection-card__cover-mark svg { width: 20px; height: 20px; }
.dr-theme .dr-main .dr-collection-card__body { display: flex; flex: 1; flex-direction: column; min-width: 0; padding: 12px; }
.dr-theme .dr-main .dr-collection-card__eyebrow { margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dr-content-accent); font-size: 12px; line-height: 1.5; }
.dr-theme .dr-main .dr-collection-card h3 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 15px; line-height: 1.5; font-weight: 650; overflow-wrap: anywhere; }
.dr-theme .dr-main .dr-collection-card__summary { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-top: 8px; color: var(--dr-content-muted); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.dr-theme .dr-main .dr-collection-card__footer { flex-wrap: wrap; row-gap: 4px; margin-top: auto; padding-top: 12px; color: var(--dr-content-muted); font-size: 11px; line-height: 1.5; }
.dr-theme .dr-main .dr-collection-card__footer > span:empty { display: none; }
.dr-theme .dr-main .dr-collection-card__footer > a { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; margin-left: auto; color: var(--dr-content-accent); font-size: 12px; white-space: nowrap; }
.dr-theme .dr-main .dr-collection-card__footer svg { width: 16px; height: 16px; }
.dr-theme .dr-main .dr-collection-card--lead { grid-column: 1 / -1; }
.dr-theme .dr-main .dr-collection-card--lead .dr-collection-card__cover { aspect-ratio: 2 / 1; max-height: 248px; }
.dr-theme .dr-main .dr-collection-card--lead .dr-collection-card__body { padding: 16px; }
.dr-theme .dr-main .dr-collection-card--lead h3 { font-size: 20px; }
.dr-theme .dr-main .dr-collection-card--lead .dr-collection-card__summary { font-size: 13px; }

/* The existing detail component retains relation sorting and mac_ulog state.
   A cover and title form one compact editorial card; content panels follow. */
.dr-theme .dr-main .dr-collection-detail__top { min-height: 40px; margin-bottom: 16px; padding-left: 40px; font-size: 13px; color: var(--dr-content-muted); }
.dr-theme .dr-main .dr-collection-detail__top > a { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; color: var(--dr-content-accent); }
.dr-theme .dr-main .dr-collection-detail__top svg { width: 16px; height: 16px; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__crumb { display: none; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__head { display: flex; flex-direction: column; gap: 0; padding: 0; margin: 0 0 24px; overflow: hidden; border-radius: 18px; border-color: var(--dr-content-line); background: var(--dr-content-surface); box-shadow: none; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__pic { width: 100%; max-width: none; flex: 0 0 auto; border-radius: 0; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__pic img { width: 100%; height: auto; max-height: 248px; aspect-ratio: 2 / 1; object-fit: cover; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__body { width: 100%; padding: 16px; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__title { margin: 0; font-size: 22px; line-height: 1.4; font-weight: 700; overflow-wrap: anywhere; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__sub { margin: 8px 0 0; font-size: 14px; line-height: 1.65; color: var(--dr-content-muted); overflow-wrap: anywhere; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__stats { gap: 8px 16px; margin: 16px 0 0; padding: 12px 0 0; border-top: 1px solid var(--dr-content-line); }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__stats:not(:has(li)) { display: none; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__stats li { gap: 5px; color: var(--dr-content-muted); font-size: 12px; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__stats em { color: var(--dr-content-text); font-size: 16px; font-weight: 650; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__actions { margin-top: 16px; }
.dr-theme .dr-main .dr-collection-detail [data-component="topic_detail"] .pb-topic-detail__follow { min-height: 44px; gap: 8px; padding: 0 20px; border-radius: 12px; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__follow::before { content: ""; width: 17px; height: 17px; background: currentColor; 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='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3h10a1 1 0 0 1 1 1v17l-6-4-6 4V4a1 1 0 0 1 1-1Z'/%3E%3C/svg%3E") center / contain no-repeat; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__panel { margin-bottom: 24px; padding: 16px; border-radius: 16px; box-shadow: none; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__panel-title { margin-bottom: 12px; font-size: 18px; line-height: 1.5; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__panel-body { color: var(--dr-content-muted); font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__panel-body :is(img, video, iframe) { max-width: 100%; }
.dr-theme .dr-main .dr-collection-detail :is(.pb-topic-detail__vod, .pb-topic-detail__art) { padding: 0; border: 0; background: transparent; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__vod-head { align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__vod-head .pb-topic-detail__panel-title { width: 100%; margin: 0; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__vod-sort { display: flex; width: 100%; gap: 6px; }
.dr-theme .dr-main .dr-collection-detail [data-component="topic_detail"] .pb-topic-detail__vod-sort-tab { flex: 1; min-height: 44px; padding: 6px 8px; border-radius: 11px; font-size: 12px; line-height: 1.5; white-space: normal; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
.dr-theme .dr-main .dr-collection-detail .pb-topic-detail__art-rows { overflow: hidden; padding: 0 12px; border: 1px solid var(--dr-content-line); border-radius: 14px; background: var(--dr-content-surface); }

/* A directory uses station logos and clear names instead of video posters. */
.dr-theme .dr-main .dr-live-categories { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 24px; padding-bottom: 2px; scroll-padding-inline: 2px; }
.dr-theme .dr-main .dr-live-categories > a { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; min-height: 44px; max-width: 100%; padding: 8px 16px; border: 1px solid var(--dr-content-line); border-radius: 13px; background: var(--dr-content-surface); color: var(--dr-content-muted); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.dr-theme .dr-main .dr-live-categories > a[aria-current] { border-color: var(--dr-content-gold-border); background: var(--dr-content-accent-soft); color: var(--dr-content-accent); font-weight: 650; }
.dr-theme .dr-main .dr-live-section__icon { flex: 0 0 22px; width: 22px; height: 22px; margin-top: 4px; color: var(--dr-content-muted); }
.dr-theme .dr-main .dr-live-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.dr-theme .dr-main .dr-live-channel { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 92px; padding: 14px; border: 1px solid var(--dr-content-line); border-radius: 16px; background: var(--dr-content-surface); }
.dr-theme .dr-main .dr-live-channel__logo { display: grid; place-items: center; flex: 0 0 72px; width: 72px; height: 52px; overflow: hidden; border-radius: 10px; background: var(--dr-content-fill); }
.dr-theme .dr-main .dr-live-channel__logo img { width: 100%; height: 100%; object-fit: contain; }
.dr-theme .dr-main .dr-live-channel__body { flex: 1; min-width: 0; }
.dr-theme .dr-main .dr-live-channel h3 { color: var(--dr-content-text); font-size: 15px; font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
.dr-theme .dr-main .dr-live-channel p { margin-top: 4px; color: var(--dr-content-muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.dr-theme .dr-main .dr-live-channel__play { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; background: var(--dr-content-accent-soft); color: var(--dr-content-accent); }
.dr-theme .dr-main .dr-live-channel__play svg { width: 19px; height: 19px; }
.dr-theme .dr-main .dr-live-channel:hover { border-color: var(--dr-content-gold-border); }

/* The shared stream player keeps its video and handlers. Flatten only its
   visual deck so the real channel title comes before the screen. */
.dr-theme .dr-main .dr-live-watch .pb-live-player { display: flex; gap: 0; }
.dr-theme .dr-main .dr-live-watch .pb-live-player__deck { display: contents; }
.dr-theme .dr-main .dr-live-watch .pb-live-player__info { order: -1; padding: 0; margin-bottom: 16px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.dr-theme .dr-main .dr-live-watch .pb-live-player__brand { display: grid; grid-template-columns: minmax(0, 1fr) 60px; align-items: start; gap: 12px; }
.dr-theme .dr-main .dr-live-watch .pb-live-player__brand:not(:has(.pb-live-player__logo)) { grid-template-columns: minmax(0, 1fr); }
.dr-theme .dr-main .dr-live-watch .pb-live-player__head { grid-area: 1 / 1; min-width: 0; min-height: 40px; }
.dr-theme .dr-main .dr-live-watch .pb-live-player__logo { grid-area: 1 / 2; flex: 0 0 auto; width: 60px; max-width: none; height: 44px; aspect-ratio: auto; border-radius: 10px; background: var(--dr-content-fill); box-shadow: none; }
.dr-theme .dr-main .dr-live-watch .pb-live-player__logo img { object-fit: contain; }
.dr-theme .dr-main .dr-live-watch .pb-live-player__title { margin: 0; padding-left: 40px; font-size: 21px; line-height: 1.45; overflow-wrap: anywhere; }
.dr-theme .dr-main .dr-live-watch .pb-live-player__sub { display: block; margin: 6px 0 0; color: var(--dr-content-muted); font-size: 13px; line-height: 1.5; }
.dr-theme .dr-main .dr-live-watch .pb-live-player__meta { display: none; }
.dr-theme .dr-main .dr-live-watch .pb-live-player__intro { margin-top: 12px; color: var(--dr-content-muted); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.dr-theme .dr-main .dr-live-watch .pb-live-player__cinema { padding: 0; margin-bottom: 16px; background: transparent; }
.dr-theme[data-dr-route="live/play"] .dr-main:has(> .dr-floating-back) .dr-live-watch .pb-live-player__cinema-inner { padding: 0; }
.dr-theme .dr-main .dr-live-watch .pb-live-player__crumb { display: none; }
.dr-theme .dr-main .dr-live-watch .live-player__stage { height: auto; min-height: 0; aspect-ratio: 16 / 9; border: 1px solid var(--dr-content-line); border-radius: 14px; box-shadow: none; }
.dr-theme .dr-main .dr-live-watch .live-player__badge { display: none; }
.dr-theme .dr-main .dr-live-watch .pb-live-player__controls { gap: 12px; }
.dr-theme .dr-main .dr-live-watch .live-player__lines { align-items: flex-start; gap: 12px; padding: 14px; border-radius: 14px; box-shadow: none; }
.dr-theme .dr-main .dr-live-watch .live-player__lines-label { flex-basis: 100%; font-size: 14px; color: var(--dr-content-text); }
.dr-theme .dr-main .dr-live-watch .live-player__lines-chips { gap: 8px; width: 100%; }
.dr-theme .dr-main .dr-live-watch .live-player__line { min-height: 44px; max-width: 100%; padding: 8px 16px; border-radius: 10px; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.dr-theme .dr-main .dr-live-watch .live-player__bar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 8px; border-radius: 14px; box-shadow: none; }
.dr-theme .dr-main .dr-live-watch .live-player__bar:not(:has([data-mac-live-channels-open])) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dr-theme .dr-main .dr-live-watch .live-player__bar-item { display: flex; flex-direction: column; gap: 8px; min-height: 72px; padding: 12px 4px; border-radius: 10px; text-align: center; font-size: 12px; line-height: 1.5; }
.dr-theme .dr-main .dr-live-watch .live-player__bar-ico { width: 21px; height: 21px; flex-basis: 21px; }
.dr-theme .dr-main .dr-live-watch .live-player__channels-panel { right: max(0px, calc((100vw - 680px) / 2)); width: min(88vw, 388px); border-radius: 20px 0 0 20px; }
.dr-theme .dr-main .dr-live-watch .live-player__channels-head { padding: 20px 16px; }
.dr-theme .dr-main .dr-live-watch .live-player__channels-title { font-size: 18px; }
.dr-theme .dr-main .dr-live-watch .live-player__channels-sub { line-height: 1.6; overflow-wrap: anywhere; }
.dr-theme .dr-main .dr-live-watch .live-player__channels-close { border-radius: 12px; }
.dr-theme .dr-main .dr-live-watch .live-player__channels-list { padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }
.dr-theme .dr-main .dr-live-watch .live-player__channel { min-height: 72px; padding: 12px; border-radius: 12px; }
.dr-theme .dr-main .dr-live-watch .live-player__channel-logo { flex-basis: 56px; width: 56px; background: var(--dr-content-fill); }
.dr-theme .dr-main .dr-live-watch .live-player__channel-logo img { object-fit: contain; }
.dr-theme .dr-main .dr-live-watch .live-player__channel-name { white-space: normal; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5; }
.dr-theme .dr-main .dr-live-watch .live-player__channel-now { max-width: 70px; padding: 4px 6px; font-size: 11px; line-height: 1.4; text-align: center; }

.dr-theme .dr-main :is(.dr-collections, .dr-collection-detail, .dr-live-directory, .dr-live-watch) .pb-empty-state { margin-block: 16px 0; padding: 32px 20px; }
.dr-theme .dr-main :is(.dr-collections, .dr-live-directory) .bili-paging { margin-top: 24px; }
.dr-theme .dr-main :is(.dr-collections, .dr-collection-detail, .dr-live-directory, .dr-live-watch) :is(a, button, input, [role="button"]):focus-visible { outline: 2px solid var(--dr-content-accent); outline-offset: 3px; }

@media (min-width: 560px) {
  .dr-theme .dr-main .dr-live-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dr-theme .dr-main .dr-live-channel { gap: 10px; padding: 12px; }
  .dr-theme .dr-main .dr-live-channel__logo { flex-basis: 60px; width: 60px; height: 48px; }
  .dr-theme .dr-main .dr-live-channel__play { flex-basis: 28px; width: 28px; height: 28px; }
  .dr-theme .dr-main .dr-collection-detail .pb-topic-detail__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 360px) {
  .dr-theme .dr-main .dr-collection-heading h1 { font-size: 22px; }
  .dr-theme .dr-main .dr-collection-section__head h2 { font-size: 17px; }
  .dr-theme .dr-main .dr-collection-sort a { padding-inline: 10px; }
  .dr-theme .dr-main .dr-collection-card__body { padding: 10px; }
  .dr-theme .dr-main .dr-collection-card--lead .dr-collection-card__body { padding: 14px; }
  .dr-theme .dr-main .dr-collection-card h3 { font-size: 14px; }
  .dr-theme .dr-main .dr-collection-card--lead h3 { font-size: 19px; }
  .dr-theme .dr-main .dr-live-channel { gap: 10px; padding: 12px; }
  .dr-theme .dr-main .dr-live-watch .pb-live-player__brand { grid-template-columns: minmax(0, 1fr) 48px; gap: 8px; }
  .dr-theme .dr-main .dr-live-watch .pb-live-player__logo { width: 48px; height: 40px; }
  .dr-theme .dr-main .dr-live-watch .pb-live-player__title { font-size: 19px; }
}
