/* Per-screen layout. Tokens live in base.css. */

/* ---------- login ---------- */
.login__body { flex: 1 1 auto; min-height: 0; display: flex; gap: var(--sp-5); padding-top: var(--sp-3); }
.login__form { flex: 1 1 48rem; max-width: 90rem; display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.login__types, .login__buttons { display: flex; gap: var(--sp-2); }
.login__buttons { margin-top: var(--sp-2); }
.login__status { min-height: 2rem; font-size: var(--fs-m); color: var(--c-muted); }
.login__status.is-error { color: var(--c-error); }
.login__saved { flex: 1 1 32rem; display: flex; flex-direction: column; gap: var(--sp-2); min-height: 0; }
.login__saved-title { font-size: var(--fs-l); color: var(--c-muted); }
.login__saved-list { position: relative; flex: 1 1 auto; overflow: hidden; display: flex; flex-direction: column; gap: var(--sp-1); }
.saved-row { flex: 0 0 auto; display: flex; align-items: center; gap: var(--sp-2); height: 3.5rem; padding: 0 var(--sp-3); border-radius: var(--radius); background: var(--c-panel); font-size: var(--fs-m); }
.saved-row__name { flex: 1 1 auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.saved-row__type { color: var(--c-muted); font-size: var(--fs-s); }
.saved-row.is-active { box-shadow: inset 0.3rem 0 0 var(--c-accent); }

/* ---------- home ---------- */
.home__tiles { flex: 1 1 auto; display: flex; flex-wrap: nowrap; align-items: center; justify-content: center; gap: var(--sp-3); }
.tile {
  position: relative; flex: 0 1 var(--tile-w); min-width: 0; height: var(--tile-h); padding: var(--sp-3); border-radius: calc(var(--radius) * 2);
  background: var(--c-panel); display: flex; flex-direction: column; justify-content: flex-end; gap: var(--sp-1); overflow: hidden;
}
.tile__label { font-size: var(--fs-l); font-weight: 600; }
.tile__sub { font-size: var(--fs-s); color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile__logo { position: absolute; right: var(--sp-3); top: var(--sp-3); max-width: 40%; max-height: 40%; object-fit: contain; }
.tile--continue { flex-basis: calc(var(--tile-w) * 1.5); background: var(--c-panel-2); }
.tile.is-focused { transform: scale(1.05); }

/* ---------- live channels ---------- */
.chan__body, .posters__body { flex: 1 1 auto; min-height: 0; display: flex; gap: var(--sp-3); }
.chan__side, .posters__side { flex: 0 0 var(--sidebar-w); }
.chan__main, .posters__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.chan__list, .posters__grid { flex: 1 1 auto; min-height: 0; }
.chan__search, .posters__search { flex: 0 0 auto; }
.chan__info { flex: 0 0 var(--info-w); padding: var(--sp-3); background: var(--c-bg-2); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; gap: var(--sp-3); }
.chan__info-name { font-size: var(--fs-xl); font-weight: 600; }
.chan__info-cat { font-size: var(--fs-s); color: var(--c-muted); }
.chan__info-time { font-size: var(--fs-s); color: var(--c-accent); }
.chan__info-title { font-size: var(--fs-l); }
.chan__info-desc { font-size: var(--fs-m); color: var(--c-muted); line-height: 1.35; max-height: 16rem; overflow: hidden; }
.chan__info-none { color: var(--c-dim); }

.chan-row {
  height: var(--row-h); margin-bottom: 0.25rem; display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-3); border-radius: var(--radius); background: var(--c-bg-2);
}
.chan-row__num { flex: 0 0 4rem; text-align: right; font-size: var(--fs-m); color: var(--c-muted); font-variant-numeric: tabular-nums; }
.chan-row__logo { flex: 0 0 var(--logo-w); height: calc(var(--row-h) - 1rem); display: flex; align-items: center; justify-content: center; }
.chan-row__logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.chan-row__logo img.is-broken { visibility: hidden; }
.chan-row__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.chan-row__name { font-size: var(--fs-m); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chan-row__epg { font-size: var(--fs-s); color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1em; }
.chan-row__bar { height: 0.2rem; background: var(--c-line); border-radius: 0.1rem; overflow: hidden; max-width: 60%; }
.chan-row__fill { display: block; height: 100%; background: var(--c-accent); transform-origin: 0 50%; }
.chan-row__quality { flex: 0 0 auto; font-size: var(--fs-xs); font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 0.25rem; border: 0.1rem solid var(--c-muted); color: var(--c-muted); }
.chan-row__fav { flex: 0 0 1.5rem; font-size: var(--fs-m); color: var(--c-yellow); visibility: hidden; }
.chan-row.is-fav .chan-row__fav { visibility: visible; }

/* ---------- movies / series ---------- */
.poster { width: var(--vl-col-w, var(--poster-w));   /* --vl-col-w: VirtualList widens the posters so the grid fills the width */
   margin-right: var(--sp-3); margin-bottom: var(--sp-3); display: flex; flex-direction: column; gap: 0.3rem; padding: 0.3rem; border-radius: var(--radius); }
.poster__art { width: 100%; height: calc((var(--vl-col-w, var(--poster-w)) - 0.6rem) * 1.5); background: var(--c-panel); border-radius: var(--radius); overflow: hidden; display: block; }
.poster__art img { width: 100%; height: 100%; object-fit: cover; }
.poster__art img.is-broken { visibility: hidden; }
.poster__name { font-size: var(--fs-s); height: 2.5em; line-height: 1.25; overflow: hidden; }
.poster__meta { font-size: var(--fs-xs); color: var(--c-muted); height: 1.25em; }
.poster.is-focused .poster__art { transform: scale(1.04); }  /* not on .poster itself: the virtual list positions it with transform */

.detail { position: absolute; inset: var(--header-h) var(--gutter) var(--legend-h) var(--gutter); background: var(--c-bg); display: flex; gap: var(--sp-4); z-index: 5; }
.detail--series { flex-direction: column; }
.detail__top { display: flex; gap: var(--sp-4); flex: 0 0 auto; max-height: 45%; }
.detail__art { flex: 0 0 calc(var(--poster-w) * 1.6); }
.detail--series .detail__art { flex-basis: var(--poster-w); }
.detail__art img { width: 100%; border-radius: var(--radius); }
.detail__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.detail__title { font-size: var(--fs-xxl); font-weight: 600; }
.detail__meta { font-size: var(--fs-m); color: var(--c-muted); }
.detail__plot { font-size: var(--fs-m); line-height: 1.4; max-width: 100rem; max-height: 12em; overflow: hidden; }
.detail__buttons { display: flex; gap: var(--sp-3); }
.detail__cols { flex: 1 1 auto; min-height: 0; display: flex; gap: var(--sp-3); }
.detail__seasons { flex: 0 0 var(--sidebar-w); position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 0.25rem; }
.detail__episodes { flex: 1 1 auto; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 0.25rem; }
.detail__none { color: var(--c-muted); padding: var(--sp-3); }
.season-item { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; height: var(--cat-h); padding: 0 var(--sp-3); border-radius: var(--radius); background: var(--c-bg-2); font-size: var(--fs-m); }
.season-item__count { color: var(--c-dim); font-size: var(--fs-s); }
.season-item.is-selected { box-shadow: inset 0.3rem 0 0 var(--c-accent); }
.ep-row { flex: 0 0 auto; display: flex; flex-direction: column; gap: 0.2rem; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius); background: var(--c-bg-2); }
.ep-row__title { font-size: var(--fs-m); }
.ep-row__sub { font-size: var(--fs-s); color: var(--c-accent); }
.ep-row__plot { font-size: var(--fs-s); color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- EPG grid ---------- */
.epg__info { flex: 0 0 7.5rem; padding: var(--sp-2) 0; overflow: hidden; }
.epg__info-chan { font-size: var(--fs-s); color: var(--c-muted); }
.epg__info-title { font-size: var(--fs-l); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.epg__info-time { font-size: var(--fs-s); color: var(--c-accent); }
.epg__info-desc { font-size: var(--fs-s); color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.epg__timebar { flex: 0 0 2.5rem; display: flex; }
.epg__corner { flex: 0 0 var(--epg-chan-w); }
.epg__ticks { flex: 1 1 auto; position: relative; overflow: hidden; border-bottom: 0.1rem solid var(--c-line); }
.epg__tick { position: absolute; bottom: 0.3rem; padding-left: 0.4rem; border-left: 0.1rem solid var(--c-line); font-size: var(--fs-s); color: var(--c-muted); white-space: nowrap; }
.epg__body { flex: 1 1 auto; min-height: 0; position: relative; }
.epg__rows { position: absolute; inset: 0; }
.epg__nowwrap { position: absolute; top: 0; bottom: 0; left: var(--epg-chan-w); right: 0; pointer-events: none; }
.epg__now { position: absolute; top: 0; bottom: 0; width: 0.15rem; background: var(--c-live); }
.epg-row { height: var(--epg-row-h); margin-bottom: 0.2rem; display: flex; }
.epg-row.is-focused { outline: none; background: transparent !important; }
.epg-row__chan { flex: 0 0 var(--epg-chan-w); display: flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-2); background: var(--c-bg-2); border-radius: var(--radius); margin-right: 0.2rem; overflow: hidden; }
.epg-row.is-focused .epg-row__chan { background: var(--c-selected); box-shadow: inset 0.3rem 0 0 var(--c-accent); }
.epg-row__num { flex: 0 0 3rem; text-align: right; color: var(--c-muted); font-size: var(--fs-s); }
.epg-row__name { flex: 1 1 auto; font-size: var(--fs-s); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.epg-row__progs { flex: 1 1 auto; position: relative; overflow: hidden; }
.epg-prog {
  position: absolute; top: 0; bottom: 0; padding: 0.3rem var(--sp-2); display: flex; flex-direction: column; justify-content: center;
  background: var(--c-panel); border-right: 0.2rem solid var(--c-bg); border-radius: var(--radius); overflow: hidden;
}
.epg-prog.is-live { background: var(--c-panel-2); }
.epg-prog.is-past { color: var(--c-muted); }
.epg-prog--empty { color: var(--c-dim); justify-content: center; }
.epg-prog__title { font-size: var(--fs-s); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.epg-prog__time { font-size: var(--fs-xs); color: var(--c-muted); white-space: nowrap; }

/* ---------- settings ---------- */
.settings__list { flex: 1 1 auto; min-height: 0; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 0.25rem; }
.settings__section { flex: 0 0 auto; font-size: var(--fs-s); color: var(--c-accent); text-transform: uppercase; letter-spacing: 0.08em; padding: var(--sp-3) var(--sp-3) var(--sp-1); }
.set-row { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, clamp(30rem, 40%, 60rem)) minmax(0, 1fr); align-items: center; gap: var(--sp-3); min-height: 3.5rem; padding: 0 var(--sp-3); border-radius: var(--radius); background: var(--c-bg-2); }
.set-row__label { font-size: var(--fs-m); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-row__value { font-size: var(--fs-m); color: var(--c-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-row--active .set-row__label::before { content: "\25CF  "; color: var(--c-accent); }

/* small canvas (big UI size on a small window, js/ui/ui-scale.js): the lists get the room */
body.is-narrow { --sidebar-w: 16rem; }
body.is-narrow .chan__info { display: none; }
/* ultrawide (32:9): sidebar / info / guide channel column widths are fluid (clamp() in base.css) */
