/* Source presentation. No provider, capacity, pagination or input logic here. */

/* Shared search fields retain explicit labels and a visible submit action. */
.source-search, .live-search, .games-search-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: var(--space-2); width: min(640px,100%); margin: 0 0 var(--space-2); }
.source-search input, .live-search input, .games-search-form input, .global-search-form input { width: 100%; min-width: 0; height: max(44px,var(--control-min)); padding: 0 var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface-subtle); color: var(--color-text); font-size: var(--text-base); }
.source-search button, .live-search button, .games-search-form button { min-width: 88px; }
.source-search-status { min-height: 1.5em; margin-bottom: var(--space-4); font-size: var(--text-xs); }
.global-search-intro { margin-bottom: var(--space-5); }
.global-search-intro h1 { font-size: var(--text-page-title); font-weight: var(--weight-semibold); letter-spacing: -.035em; line-height: 1.2; }
.global-search-intro > p:last-child { max-width: 65ch; color: var(--color-text-muted); font-size: var(--text-sm); line-height: 1.6; }
.global-search-form { display: grid; grid-template-columns: 24px minmax(0,1fr) auto; align-items: center; gap: var(--space-3); max-width: 960px; padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4); margin-bottom: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-card); background: var(--color-surface); }
.global-search-form svg { width: 24px; height: 24px; fill: none; stroke: var(--color-text-muted); stroke-width: 1.7; stroke-linecap: round; }
.global-search-form input { border: 0; background: transparent; }

/* Detail is content-driven: long titles never escape an absolute-position box. */
.detail-view { width: min(var(--content-max),calc(100% - 2 * var(--page-gutter))); margin: 0 auto; padding: var(--space-6) 0 var(--space-12); }
.detail-hero { position: relative; display: flex; align-items: flex-end; min-height: 400px; margin: 0 0 var(--space-6); border: 0; border-radius: var(--radius-card); background-color: var(--color-surface-subtle); background-size: cover; background-position: center 25%; overflow: hidden; }
.detail-copy { position: relative; z-index: 1; width: min(100%,660px); padding: clamp(24px,3vw,40px); }
.detail-copy h1 { margin-bottom: var(--space-3); font-size: clamp(1.75rem,3vw,2.75rem); font-weight: var(--weight-semibold); line-height: 1.15; letter-spacing: -.04em; overflow-wrap: anywhere; }
.detail-copy > p { font-size: var(--text-sm); line-height: 1.6; }
.detail-copy .eyebrow { color: var(--color-text-muted); }
.detail-copy #detail-meta { color: var(--color-text-muted); font-size: var(--text-sm); }
.detail-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-6); }
.detail-actions button { min-height: var(--control-min); }
.detail-hero.no-backdrop { display: grid; grid-template-columns: minmax(120px,220px) minmax(0,1fr); align-items: center; gap: var(--space-8); min-height: 360px; padding: var(--space-8); }
.detail-hero.no-backdrop .hero-shade { display: none; }
.detail-hero.no-backdrop .detail-copy { padding: 0; width: 100%; }
.detail-poster-fallback { width: 100%; max-height: 380px; aspect-ratio: 2/3; object-fit: cover; border-radius: var(--radius-control); }
.detail-hero.no-backdrop:has(.detail-poster-fallback[hidden]) { grid-template-columns: minmax(0,1fr); }

/* YouTube preserves 16:9 artwork and two-line titles across all collections. */
.youtube-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); gap: var(--space-5) var(--space-4); }
.youtube-card { display: block; width: 100%; min-width: 0; padding: 0; border: 0; border-radius: var(--radius-control); background: transparent; color: var(--color-text); text-align: left; }
.youtube-thumb { position: relative; display: block; width: 100%; aspect-ratio: 16/9; overflow: hidden; border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface-raised); }
.youtube-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.youtube-card > strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; margin-top: var(--space-2); font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1.4; }
.youtube-card > small { display: block; margin-top: var(--space-1); color: var(--color-text-muted); font-size: var(--text-xs); line-height: 1.5; }
.youtube-note summary { cursor: pointer; min-height: var(--control-compact); display: inline-flex; align-items: center; font-weight: var(--weight-semibold); }
.youtube-note p { margin: var(--space-2) 0 0; }
.youtube-note { max-width: 85ch; padding: var(--space-2) var(--space-3); margin-bottom: var(--space-4); border-left: 2px solid var(--color-border); color: var(--color-text-muted); font-size: var(--text-xs); line-height: 1.6; }
.youtube-playlist-item > .youtube-card { display: grid; grid-template-columns: 180px minmax(0,1fr); gap: var(--space-1) var(--space-4); padding: var(--space-3); border: 1px solid var(--color-border); background: var(--color-surface); }
.youtube-playlist-item > .youtube-card .youtube-thumb { grid-row: 1/3; }
.youtube-playlist-item > .youtube-card strong { align-self: end; min-height: 0; margin: 0; }
.youtube-playlist-item > .youtube-card small { align-self: start; margin: 0; }

/* Live channels: logo, now/next and independent actions, no nested buttons. */
.live-channel-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: var(--space-3); }
.live-channel { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: var(--space-2); min-width: 0; min-height: 96px; padding: var(--space-3); border: 1px solid rgba(255,255,255,.075); border-radius: var(--radius-card); background: var(--color-surface-subtle); }
.live-channel-play { display: grid; grid-template-columns: 48px minmax(0,1fr); align-items: center; gap: var(--space-3); min-width: 0; min-height: 64px; padding: 0; border-radius: var(--radius-sm); background: transparent; text-align: left; color: var(--color-text); }
.live-channel-logo { display: grid; place-items: center; width: 48px; height: 48px; overflow: hidden; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface-subtle); color: var(--color-text-muted); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.live-channel-logo img { width: 100%; height: 100%; object-fit: contain; }
.live-channel-copy { display: grid; gap: var(--space-1); min-width: 0; }
.live-channel-copy strong, .live-channel-copy span, .live-channel-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-channel-copy strong { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.live-channel-copy span { font-size: var(--text-xs); }
.live-channel-copy small, .live-channel-copy .live-program-time { color: var(--color-text-muted); font-size: .6875rem; }
.live-channel-actions { display: flex; flex-direction: column; gap: var(--space-2); }
.live-favorite, .live-history-remove { display: grid; place-items: center; width: var(--control-min); height: var(--control-min); border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; color: var(--color-text-muted); font-size: var(--text-lg); }
.live-favorite.active { color: var(--color-danger-text); border-color: var(--color-border); }
.live-history-remove { font-size: var(--text-xl); }
.live-genres { display: flex; gap: var(--space-2); overflow-x: auto; margin-block: var(--space-3); padding-bottom: var(--space-1); }
.live-genres button { flex-shrink: 0; min-height: var(--control-min); padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-pill); background: transparent; color: var(--color-text-muted); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.live-genres button.active { background: var(--color-surface-elevated); color: var(--color-text); border-color: var(--color-text-muted); }

/* Guide geometry and virtual-row heights stay in the existing Guide renderer. */
.live-guide-row { display: grid; grid-template-columns: var(--guide-channel-width) var(--guide-timeline-width); min-height: 5.25rem; border-bottom: 1px solid var(--color-border); }
.live-guide-programmes { position: relative; min-height: 5.25rem; background: repeating-linear-gradient(90deg,transparent 0,transparent calc(16.6667% - 1px),var(--color-border) calc(16.6667% - 1px),var(--color-border) 16.6667%); }
.windowed-rows .live-guide-row { min-height: 0; height: var(--guide-row-height); }
.windowed-rows .live-guide-programmes { min-height: 0; height: 100%; }
.live-guide-scroll { --guide-channel-width: 210px; --guide-timeline-width: 900px; position: relative; min-height: 360px; max-height: min(68vh,720px); overflow: auto; overscroll-behavior: contain; border: 1px solid var(--color-border); border-radius: var(--radius-card); background: var(--color-surface-subtle); scrollbar-color: var(--color-border) var(--color-surface-subtle); }
.live-guide-time-row { position: sticky; top: 0; z-index: 7; display: grid; grid-template-columns: var(--guide-channel-width) var(--guide-timeline-width); height: 50px; border-bottom: 1px solid var(--color-border); background: var(--color-surface); }
.live-guide-corner { position: sticky; left: 0; z-index: 9; display: flex; align-items: center; padding-inline: var(--space-4); border-right: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-muted); font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: .1em; }
.live-guide-time { position: absolute; top: 0; bottom: 0; padding: var(--space-4) 0 0 var(--space-3); border-left: 1px solid var(--color-border); color: var(--color-text-muted); font-size: var(--text-xs); white-space: nowrap; }
.live-guide-channel { position: sticky; left: 0; z-index: 5; display: grid; grid-template-columns: 48px minmax(0,1fr); align-items: center; gap: var(--space-3); min-width: 0; padding: var(--space-3); border-right: 1px solid var(--color-border); background: var(--color-surface); text-align: left; }
.live-guide-channel .live-channel-logo { width: 48px; height: 48px; border-radius: var(--radius-sm); }
.live-guide-program { position: absolute; top: 7px; bottom: 7px; min-width: 2px; padding: var(--space-3); overflow: hidden; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface-raised); text-align: left; }
.live-guide-program.current { border-color: var(--color-text-muted); background: var(--color-surface-elevated); box-shadow: inset 3px 0 var(--color-brand); }
.live-guide-program strong, .live-guide-program small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-guide-program strong { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.live-guide-program small { margin-top: var(--space-2); color: var(--color-text-muted); font-size: var(--text-xs); }
.live-guide-toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; margin-block: var(--space-4); }
.live-guide-toolbar h2 { margin: 0; font-size: var(--text-lg); }
.live-guide-navigation { display: flex; gap: var(--space-2); }
#live-guide-help, #live-guide-status { margin-block: var(--space-2) var(--space-3); font-size: var(--text-xs); line-height: 1.5; }

/* Games use the same artwork/copy system while preserving platform ratios. */
.game-card { position: relative; display: grid; grid-template-rows: auto minmax(0,1fr); min-width: 0; padding: 0; overflow: hidden; border: 0; border-radius: var(--radius-control); background: transparent; color: var(--color-text); text-align: left; }
.game-card-art { position: relative; display: block; width: 100%; aspect-ratio: 3/4; overflow: hidden; background: var(--color-surface-subtle); }
.game-card-art img, .game-card-art > .artwork-fallback { display: block; width: 100%; height: 100%; object-fit: contain; }
.game-card-copy { display: grid; gap: var(--space-1); padding: var(--space-3) var(--space-1); min-width: 0; }
.game-card-copy strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1.4; }
.game-card-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text-muted); font-size: var(--text-xs); }
.game-card-resume { position: absolute; left: var(--space-3); bottom: var(--space-3); padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-pill); background: var(--color-background); color: var(--color-text); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.game-grid-landscape .game-card { flex: 0 0 var(--landscape-width); }
.game-grid-landscape .game-card-art { aspect-ratio: 16/9; }

@media (hover: hover) {
  .youtube-card:hover .youtube-thumb, .game-card:hover, .live-channel:hover { border-color: var(--color-text-muted); }
  .live-guide-program:hover, .live-guide-channel:hover, .live-favorite:hover, .live-history-remove:hover { background: var(--color-surface-hover); }
  .youtube-card:hover > strong { text-decoration: underline; text-underline-offset: .2em; }
}
@media (min-width: 1500px) { .live-channel-grid { grid-template-columns: repeat(4,minmax(0,1fr)); } }
@media (max-width: 1099px) { .live-channel-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 700px) {
  .source-search, .live-search, .games-search-form { width: 100%; }
  .source-search button, .live-search button, .games-search-form button { min-width: 76px; padding-inline: var(--space-3); }
  .global-search-intro { margin-bottom: var(--space-4); }
  .global-search-form { grid-template-columns: 24px minmax(0,1fr); }
  .global-search-form button { grid-column: 1/-1; }
  .detail-view { width: calc(100% - 2 * var(--page-gutter)); padding-block: var(--space-5) calc(var(--bottom-nav-height) + var(--space-8) + env(safe-area-inset-bottom)); }
  .detail-hero { min-height: 0; padding-top: 170px; overflow: hidden; background-position: center top; background-size: auto 340px; background-repeat: no-repeat; }
  .detail-hero .hero-shade { background: linear-gradient(0deg,var(--color-surface-subtle) 55%,transparent); }
  .detail-copy { padding: var(--space-5); width: 100%; }
  .detail-copy h1 { font-size: clamp(1.75rem,7vw,2.5rem); }
  .detail-actions { display: grid; grid-template-columns: minmax(0,1fr); }
  .detail-hero.no-backdrop { display: flex; flex-direction: column; gap: var(--space-5); padding: var(--space-5); }
  .detail-poster-fallback { width: min(50%,180px); }
  .youtube-grid { grid-template-columns: minmax(0,1fr); gap: var(--space-6); }
  .youtube-playlist-item > .youtube-card { grid-template-columns: 112px minmax(0,1fr); padding: var(--space-2); gap: var(--space-2); }
  .youtube-playlist-item > .youtube-card strong { font-size: var(--text-sm); }
  .live-channel-grid { grid-template-columns: minmax(0,1fr); }
  .live-channel { min-height: 88px; gap: var(--space-2); padding: var(--space-3); }
  .live-guide-scroll { --guide-channel-width: 160px; max-height: 65vh; }
  .live-guide-channel { grid-template-columns: 40px minmax(0,1fr); gap: var(--space-2); padding: var(--space-2); }
  .live-guide-channel .live-channel-logo { width: 40px; height: 40px; }
  .live-guide-channel-copy strong { font-size: var(--text-xs); }
  .live-guide-navigation { width: 100%; }
  .live-guide-navigation button { flex: 1; min-width: 0; padding-inline: var(--space-2); }
  .game-card-copy { padding: var(--space-3); }
  .game-grid-landscape .game-card { flex-basis: var(--landscape-width); }
}
