/* Hallmark · macrostructure: Catalogue · theme: studied-DNA (source: https://www.rongyok.tv/) · anchor hue: jade */
/* Hallmark · pre-emit critique: P5 H4 E5 S5 R5 V4 */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { background: var(--color-paper); color: var(--color-ink); scroll-padding-top: 84px; }
body { margin: 0; padding-bottom: calc(76px + env(safe-area-inset-bottom)); font-family: var(--font-body); font-size: var(--text-md); line-height: 1.65; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
button, select, .local-mark { white-space: nowrap; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible, input:focus-visible, select:focus-visible, video:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); font-style: normal; min-width: 0; overflow-wrap: anywhere; }
.shell { max-width: 1240px; margin-inline: auto; padding-inline: max(var(--space-md), env(safe-area-inset-left)); }
.masthead { background: var(--color-paper); color: var(--color-ink); border-bottom: var(--rule-width) solid var(--color-rule); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); min-height: 76px; }
.brand { display: inline-flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) 0; min-height: 48px; border: 0; background: var(--color-paper); color: var(--color-accent); font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.04em; }
.brand-domain { color: var(--color-ink); }
.header-actions { display: flex; align-items: center; gap: var(--space-sm); }
.local-mark { font-family: var(--font-label); font-size: 9px; color: var(--color-muted); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-sm); padding: 2px var(--space-xs); }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-ink); }
.catalog-controls { padding-top: var(--space-xl); }
.search-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--space-sm); scroll-margin-top: var(--space-xl); }
.search-field { min-width: 0; }
.search-field label { display: block; font-size: var(--text-sm); font-weight: 600; margin-bottom: var(--space-sm); }
.search-input-wrap { position: relative; }
.search-input-wrap > svg { position: absolute; left: var(--space-md); top: 14px; color: var(--color-muted); pointer-events: none; }
.search-input-wrap input { width: 100%; min-width: 0; height: 48px; border: var(--rule-width) solid var(--color-rule); background: var(--color-surface); color: var(--color-ink); border-radius: var(--radius-md); padding: var(--space-sm) 40px var(--space-sm) 40px; -webkit-appearance: none; appearance: none; }
input::-webkit-search-cancel-button { -webkit-appearance: none; }
input::placeholder { color: var(--color-muted); opacity: 0.85; }
.clear-search { position: absolute; right: 2px; top: 2px; height: 44px; width: 36px; border: 0; background: var(--color-surface); color: var(--color-muted); font-size: 24px; border-radius: var(--radius-sm); line-height: 1; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 48px; border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-md); padding: var(--space-sm) var(--space-lg); background: var(--color-surface); color: var(--color-ink); font-weight: 600; font-size: var(--text-sm); }
.button-primary { background: var(--color-accent); color: var(--color-accent-ink); border-color: var(--color-accent); }
.button-small { min-height: 44px; padding-inline: var(--space-lg); }
.button-more { min-width: 180px; }
.button[aria-busy="true"] { cursor: progress; }
.search-help { font-size: var(--text-xs); color: var(--color-muted); margin-top: var(--space-sm); }
.provider-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); padding-block: var(--space-xl); }
.provider-tab { display: inline-flex; align-items: center; gap: var(--space-sm); border: var(--rule-width) solid var(--color-rule); background: var(--color-surface); color: var(--color-muted); min-height: 44px; border-radius: var(--radius-md); padding: var(--space-sm) var(--space-md); font-size: var(--text-xs); font-weight: 600; }
.provider-tab[aria-selected="true"] { background: var(--color-accent-soft); color: var(--color-accent); border-color: var(--color-accent); }
.provider-count { font-size: 10px; font-weight: 400; color: inherit; opacity: 0.8; }
.provider-count:empty { display: none; }
.sync-notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-sm) var(--space-md); border-bottom: var(--rule-width) solid var(--color-rule); padding: 0 0 var(--space-lg); margin-bottom: var(--space-xl); color: var(--color-muted); font-size: var(--text-xs); }
.sync-notice[data-state="active"] #sync-text { color: var(--color-accent); }
.sync-notice[data-state="partial"] #sync-text { color: var(--color-warning); }
.text-button { min-height: 44px; padding: 0; background: var(--color-paper); color: var(--color-accent); border: 0; font-size: var(--text-xs); }
.featured-story { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: var(--space-lg); align-items: center; padding: var(--space-lg); margin-bottom: var(--space-2xl); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-lg); background: var(--color-surface); color: var(--color-ink); }
.feature-poster { min-width: 0; align-self: start; }
.feature-copy { min-width: 0; }
.feature-source { color: var(--color-accent); font-size: var(--text-xs); margin-bottom: var(--space-xs); }
.feature-copy h2 { font-size: var(--text-lg); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: clip; }
.feature-copy .poster-meta { margin-block: var(--space-xs) var(--space-md); }
.feature-description { display: none; color: var(--color-muted); font-size: var(--text-sm); }
.feature-copy .button { min-height: 44px; padding-inline: var(--space-md); font-size: var(--text-xs); }
.catalog-heading { display: flex; flex-direction: column; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.catalog-heading h1 { font-size: var(--text-xl); font-weight: 600; line-height: 1.5; }
.result-count { color: var(--color-muted); font-size: var(--text-xs); margin-top: var(--space-xs); }
.fetched-at { font-size: var(--text-xs); color: var(--color-muted); }
.catalog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-xl) var(--space-sm); }
.poster-card { min-width: 0; display: flex; flex-direction: column; align-items: stretch; text-align: left; border: 0; padding: 0; background: var(--color-paper); color: var(--color-ink); border-radius: var(--radius-md); white-space: normal; }
.poster-frame { width: 100%; position: relative; overflow: clip; aspect-ratio: 3 / 4; background: var(--color-subtle); color: var(--color-muted); border-radius: var(--radius-md); display: grid; place-items: center; }
.poster-frame img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; background: var(--color-subtle); color: var(--color-muted); }
.poster-placeholder { font-size: var(--text-xs); text-align: center; padding: var(--space-sm); }
.poster-provider { position: absolute; inset: auto auto var(--space-xs) var(--space-xs); max-width: calc(100% - 8px); padding: 2px var(--space-xs); border-radius: var(--radius-sm); background: var(--color-poster-label); color: var(--color-ink); font-size: 8px; font-weight: 600; white-space: nowrap; }
.poster-card h3 { font-family: var(--font-body); font-size: var(--text-xs); font-weight: 400; line-height: 1.7; margin-top: var(--space-sm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: clip; }
.poster-meta { display: flex; flex-wrap: wrap; gap: 2px var(--space-sm); color: var(--color-muted); font-size: 10px; margin-top: var(--space-xs); }
.skeleton { pointer-events: none; }
.skeleton .poster-frame { opacity: 0.72; }
.skeleton-line { height: 10px; width: 88%; background: var(--color-subtle); color: var(--color-muted); border-radius: var(--radius-sm); margin-top: var(--space-md); }
.skeleton-line-short { width: 46%; margin-top: var(--space-sm); }
.notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-md); border: var(--rule-width) solid var(--color-rule); padding: var(--space-lg); border-radius: var(--radius-md); margin-bottom: var(--space-xl); font-size: var(--text-sm); overflow-wrap: anywhere; }
.notice p { margin-top: var(--space-xs); }
.notice-error { border-color: var(--color-error); background: var(--color-error-bg); color: var(--color-error); }
.notice-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.empty-state { text-align: center; padding: var(--space-3xl) var(--space-lg); border: var(--rule-width) dashed var(--color-rule); border-radius: var(--radius-md); }
.empty-state > svg { color: var(--color-muted); margin-bottom: var(--space-lg); }
.empty-state h2 { font-size: var(--text-lg); }
.empty-state p { font-size: var(--text-sm); color: var(--color-muted); margin: var(--space-sm) auto var(--space-xl); max-width: 40rem; }
.pagination { padding-block: var(--space-2xl); text-align: center; }
.pagination p { color: var(--color-muted); font-size: var(--text-xs); margin-top: var(--space-md); }
.footer { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-sm); border-top: var(--rule-width) solid var(--color-rule); padding-block: var(--space-2xl); color: var(--color-muted); font-size: var(--text-xs); }
.footer-brand { color: var(--color-accent); font-size: var(--text-lg); font-weight: 600; }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding-bottom: env(safe-area-inset-bottom); border-top: var(--rule-width) solid var(--color-rule); background: var(--color-paper); color: var(--color-muted); }
.bottom-nav button { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: var(--space-xs); height: 70px; padding: var(--space-sm); border: 0; background: var(--color-paper); color: var(--color-muted); font-size: var(--text-xs); }
.bottom-nav button[aria-current="page"] { color: var(--color-accent); }
.bottom-nav button[aria-busy="true"] { opacity: 0.6; cursor: progress; }
dialog { position: fixed; inset: 0; margin: auto; width: calc(100% - 16px); max-width: 820px; height: fit-content; max-height: calc(100dvh - 24px); padding: 0; border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-lg); background: var(--color-paper); color: var(--color-ink); overflow: auto; }
dialog::backdrop { background: var(--color-overlay); }
.dialog-topbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1; border-bottom: var(--rule-width) solid var(--color-rule); padding: var(--space-sm) var(--space-lg); background: var(--color-paper); color: var(--color-muted); font-size: var(--text-sm); }
.dialog-close { border: 0; background: var(--color-paper); color: var(--color-ink); width: 44px; min-height: 44px; font-size: 28px; line-height: 1; border-radius: var(--radius-sm); }
.detail-content { padding: var(--space-lg); }
.detail-summary { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: start; gap: var(--space-lg); }
.detail-summary .poster-frame { max-width: 180px; }
.detail-summary h2 { font-size: var(--text-lg); line-height: 1.65; margin-bottom: var(--space-sm); }
.detail-description { color: var(--color-muted); font-size: var(--text-sm); margin-top: var(--space-xl); white-space: pre-line; overflow-wrap: anywhere; }
.detail-tags { display: flex; gap: var(--space-sm); flex-wrap: wrap; margin-top: var(--space-md); }
.detail-tag { font-size: var(--text-xs); border: var(--rule-width) solid var(--color-rule); padding: 2px var(--space-sm); border-radius: var(--radius-sm); color: var(--color-muted); }
.detail-start { margin-top: var(--space-lg); padding-inline: var(--space-md); }
.player-section { margin-top: var(--space-xl); padding-top: var(--space-lg); border-top: var(--rule-width) solid var(--color-rule); }
.player-section h3 { font-size: var(--text-md); margin-bottom: var(--space-md); }
.player-intro { padding: var(--space-xl) var(--space-lg); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-md); background: var(--color-subtle); color: var(--color-muted); font-size: var(--text-sm); }
.player-media { width: 100%; overflow: clip; background: var(--color-video-bg); color: var(--color-ink); border-radius: var(--radius-md); }
.local-video { display: block; width: 100%; height: min(60dvh, 560px); min-height: 180px; object-fit: contain; background: var(--color-video-bg); color: var(--color-ink); }
.player-navigation { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--space-sm); margin-top: var(--space-md); }
.player-navigation .button { padding-inline: var(--space-sm); font-size: var(--text-xs); }
.player-current { text-align: center; white-space: nowrap; font-size: var(--text-sm); }
.player-status { margin-top: var(--space-sm); min-height: 1.65em; font-size: var(--text-xs); color: var(--color-muted); }
.player-status[data-state="error"] { color: var(--color-error); }
.player-error { margin-block: var(--space-md) 0; }
.episode-section { margin-top: var(--space-xl); border-top: var(--rule-width) solid var(--color-rule); padding-top: var(--space-lg); }
.episode-section h3 { font-size: var(--text-md); margin-bottom: var(--space-md); }
.episode-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-sm); }
.episode-list li { min-width: 0; }
.episode-button { display: flex; width: 100%; min-height: 48px; justify-content: space-between; align-items: center; gap: var(--space-md); text-align: left; padding: var(--space-sm) var(--space-md); background: var(--color-surface); color: var(--color-ink); border: var(--rule-width) solid var(--color-rule); border-radius: var(--radius-sm); font-size: var(--text-sm); overflow-wrap: anywhere; white-space: normal; }
.episode-button[aria-current="true"] { border-color: var(--color-accent); background: var(--color-accent-soft); color: var(--color-accent); }
.episode-label { display: flex; flex-direction: column; min-width: 0; }
.episode-label > span:first-child { white-space: nowrap; }
.episode-original { color: var(--color-muted); font-size: var(--text-xs); }
.episode-list .episode-locked { color: var(--color-muted); font-size: var(--text-xs); white-space: nowrap; }
.detail-note { font-size: var(--text-xs); color: var(--color-muted); margin-top: var(--space-md); }
.detail-loading { color: var(--color-muted); padding-block: var(--space-xl); }
@media (hover: hover) and (pointer: fine) {
  .provider-tab:hover:not([aria-selected="true"]), .button:hover:not(:disabled), .clear-search:hover, .dialog-close:hover, .icon-button:hover { background: var(--color-subtle); color: var(--color-ink); }
  .button-primary:hover:not(:disabled) { background: var(--color-accent-hover); color: var(--color-accent-ink); border-color: var(--color-accent-hover); }
  .poster-card:hover h3 { color: var(--color-accent); }
  .poster-card:hover .poster-frame { outline: 2px solid var(--color-accent); outline-offset: 2px; }
  .episode-button:hover:not([aria-current="true"]) { background: var(--color-subtle); color: var(--color-ink); }
  .bottom-nav button:hover, .text-button:hover { color: var(--color-accent); }
  input:hover { background: var(--color-subtle); color: var(--color-ink); }
}
@media (min-width: 414px) { .brand { font-size: 1.25rem; } }
@media (min-width: 600px) {
  .shell { padding-inline: var(--space-xl); }
  .header-inner { min-height: 84px; }
  .brand { font-size: 1.5rem; }
  .brand > svg { width: 32px; height: 32px; }
  .search-form { max-width: 680px; }
  .provider-tab { font-size: var(--text-sm); padding-inline: var(--space-lg); }
  .provider-count { font-size: var(--text-xs); }
  .catalog-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-xl) var(--space-lg); }
  .poster-card h3 { font-size: var(--text-sm); }
  .poster-meta { font-size: var(--text-xs); }
  .poster-provider { font-size: 9px; inset: auto auto var(--space-sm) var(--space-sm); padding: 2px var(--space-sm); }
  .featured-story { grid-template-columns: 144px minmax(0, 1fr); padding: var(--space-xl); gap: var(--space-xl); }
  .feature-copy h2 { font-size: var(--text-2xl); }
  .feature-description { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: clip; margin-bottom: var(--space-lg); }
  .feature-copy .button { font-size: var(--text-sm); padding-inline: var(--space-xl); }
  .catalog-heading { flex-direction: row; justify-content: space-between; align-items: end; }
  .episode-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-summary { grid-template-columns: 168px minmax(0, 1fr); gap: var(--space-xl); }
  .detail-summary h2 { font-size: var(--text-2xl); }
  .detail-content { padding: var(--space-2xl); }
}
@media (min-width: 960px) {
  .shell { padding-inline: var(--space-2xl); }
  .catalog-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-2xl) var(--space-lg); }
  .featured-story { grid-template-columns: 168px minmax(0, 1fr); padding: var(--space-2xl); }
  .feature-description { max-width: 64ch; }
  .bottom-nav { padding-inline: max(var(--space-2xl), calc((100% - 900px) / 2)); }
}
@media (prefers-reduced-motion: no-preference) { .poster-card h3 { transition: color var(--dur-fast) var(--ease-out); } }
