/* TV app concept: video + live source aggregation. Reuses ../styles.css design tokens. */

.topbar__tools { display: flex; align-items: center; gap: 12px; padding-top: 14px; flex: none; }
.concept-page { height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.concept-toolbar { display: flex; align-items: center; gap: 14px; min-height: 60px; }
.toolbar-spacer { flex: 1; }
.toolbar-divider { width: 1px; height: 34px; background: var(--line); flex: none; }

.source-pill {
  display: inline-flex; align-items: center; gap: 10px;
  height: 54px; padding: 0 18px; border-radius: 999px;
  border: 1px solid rgba(229, 178, 115, .24);
  background: rgba(229, 178, 115, .055);
  color: var(--amber); font-size: 18px; letter-spacing: .04em;
  cursor: pointer; outline: none; white-space: nowrap;
}
.source-pill:hover, .source-pill.focused { border-color: rgba(229, 178, 115, .48); background: rgba(229, 178, 115, .1); box-shadow: none; }
.source-pill .source-dot { color: var(--sage); }

.source-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; flex: none; }
.source-dot--off { background: var(--faint); box-shadow: none; }

.src-badge {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: rgba(8, 8, 7, .5);
  color: var(--muted); font-size: 14px; letter-spacing: .04em; white-space: nowrap;
}
.src-badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.src--fongmi { color: var(--amber); border-color: rgba(229, 178, 115, .32); background: rgba(229, 178, 115, .07); }
.src--lunatv { color: var(--sage); border-color: rgba(169, 192, 176, .3); background: rgba(169, 192, 176, .06); }
.src--local { color: var(--muted); border-color: var(--line-strong); }
.src--hdmi { color: #9fb4c4; border-color: rgba(159, 180, 196, .28); background: rgba(159, 180, 196, .06); }

.quality-badge {
  display: inline-flex; align-items: center; height: 28px; padding: 0 10px;
  border-radius: 8px; border: 1px solid rgba(240, 232, 220, .14);
  background: rgba(8, 8, 7, .48); color: rgba(240, 232, 220, .7);
  font-size: 13px; letter-spacing: .06em; white-space: nowrap;
}
.mini-kicker { font-size: 12px; letter-spacing: .22em; color: var(--faint); text-transform: uppercase; }
.meta-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 16px; }
.meta-line .sep { color: var(--faint); }

/* ---------- video library ---------- */
.video-page .video-head { min-height: 60px; }
.video-page .video-feature { flex: none; }
.video-page .video-grid { align-content: start; padding: 4px 4px 6px; }
.feature-top { position: absolute; z-index: 3; top: 24px; left: 32px; right: 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.feature-top__right { display: flex; align-items: center; gap: 8px; }
.video-feature__source { margin-top: 12px; }
.video-feature__title { max-width: 900px; }
.poster__source { position: absolute; right: 10px; top: 10px; z-index: 3; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 999px; background: rgba(8, 8, 7, .62); border: 1px solid rgba(240, 232, 220, .12); font-size: 13px; color: rgba(240, 232, 220, .7); }
.poster__source i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.poster__source.src--fongmi { color: var(--amber); }
.poster__source.src--lunatv { color: var(--sage); }
.poster__source.src--local { color: var(--muted); }
.poster__quality { position: absolute; left: 10px; bottom: 10px; z-index: 3; height: 25px; padding: 0 8px; border-radius: 7px; background: rgba(8, 8, 7, .58); border: 1px solid rgba(240, 232, 220, .12); color: rgba(240, 232, 220, .64); font-size: 12px; display: inline-flex; align-items: center; }
.poster__meta { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 18px; }
.poster__meta i { display: inline-block; vertical-align: 1px; margin-right: 6px; }

/* ---------- video detail ---------- */
.video-detail__body {
  align-items: flex-start; justify-content: center; gap: 48px;
  padding: 58px 56px 46px; overflow: hidden;
}
.detail-info {
  flex: 1; align-self: stretch; min-height: 0; max-width: 780px;
  display: flex; flex-direction: column;
}
.detail-scroll {
  flex: 0 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding-right: 14px;
  scrollbar-width: none;
}
.detail-scroll::-webkit-scrollbar { display: none; }
.detail-scroll.is-scrollable {
  padding-bottom: 34px;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 30px), transparent 100%);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 30px), transparent 100%);
}
.detail-scroll.is-scrollable.is-scrolled {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 24px, #000 calc(100% - 30px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 24px, #000 calc(100% - 30px), transparent 100%);
}
.detail-foot { flex: none; margin-top: auto; padding-top: 18px; }
.detail-actions {
  flex: none; display: flex; flex-wrap: wrap; gap: 12px;
}
.detail-sources-card {
  width: 390px; flex: none; align-self: center;
  padding: 24px; border: 1px solid var(--line); border-radius: 22px;
  background: linear-gradient(158deg, rgba(26, 23, 19, .92), rgba(9, 9, 8, .96));
  box-shadow: 0 26px 70px rgba(0, 0, 0, .3);
}
.detail-sources-card h3 { margin: 6px 0 0; font-family: var(--serif); font-size: 30px; font-weight: 400; letter-spacing: .05em; }
.detail-sources-card .source-card-sub { margin-top: 8px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.line-list { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.line-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px 13px; border: 1px solid var(--line); border-radius: 14px;
  background: rgba(240, 232, 220, .025); text-align: left; cursor: pointer; outline: none;
}
.line-row:hover, .line-row.focused { border-color: rgba(229, 178, 115, .42); background: rgba(229, 178, 115, .06); box-shadow: none; }
.line-row.active { border-color: rgba(229, 178, 115, .4); background: rgba(229, 178, 115, .07); }
.line-row__main { min-width: 0; flex: 1; }
.line-row__name { display: block; font-size: 17px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-row__meta { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.line-row__check { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; color: transparent; flex: none; font-size: 15px; }
.line-row.active .line-row__check { color: #24170c; background: var(--amber); border-color: var(--amber); }
.auto-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.mini-switch { width: 58px; height: 34px; padding: 3px; border-radius: 999px; border: 1px solid var(--line-strong); background: rgba(240, 232, 220, .08); cursor: pointer; outline: none; flex: none; }
.mini-switch::after { content: ""; display: block; width: 26px; height: 26px; border-radius: 50%; background: var(--muted); transition: transform .2s var(--ease), background .2s var(--ease); }
.mini-switch.on { background: rgba(229, 178, 115, .18); border-color: rgba(229, 178, 115, .45); }
.mini-switch.on::after { transform: translateX(23px); background: var(--amber); }
.source-health { margin-top: 14px; padding: 11px 12px; border: 1px dashed var(--line-strong); border-radius: 12px; font-size: 13px; line-height: 1.65; color: var(--faint); }
.source-health strong { color: var(--sage); font-weight: 400; }
.episode-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.episode-btn { min-width: 46px; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(240, 232, 220, .03); color: var(--muted); font-size: 15px; cursor: pointer; outline: none; }
.episode-btn:hover, .episode-btn.focused { border-color: rgba(229, 178, 115, .4); color: var(--amber); background: rgba(229, 178, 115, .07); box-shadow: none; }
.episode-btn.active { color: var(--amber); border-color: rgba(229, 178, 115, .35); background: rgba(229, 178, 115, .08); }
.detail-actions .btn { min-height: 52px; font-size: 18px; padding: 0 18px; }
.detail-note { font-size: 14px; }

/* ---------- search overlay ---------- */
.panel--search { width: min(1220px, 88%); }
.search-box { display: flex; align-items: center; gap: 12px; height: 78px; margin-top: 22px; padding: 0 20px; border: 1px solid rgba(229, 178, 115, .26); border-radius: 18px; background: rgba(8, 8, 7, .62); }
.search-box svg { width: 28px; height: 28px; color: var(--amber); flex: none; }
.search-box input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 24px; letter-spacing: .03em; }
.search-box input::placeholder { color: var(--faint); }
.search-box .search-go { border: 0; background: transparent; color: var(--amber); font-size: 18px; padding: 10px 4px; cursor: pointer; outline: none; }
.hot-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.hot-row span { color: var(--faint); font-size: 14px; }
.hot-chip { height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(240, 232, 220, .03); color: var(--muted); font-size: 15px; cursor: pointer; outline: none; }
.hot-chip:hover, .hot-chip.focused { border-color: rgba(229, 178, 115, .4); color: var(--amber); background: rgba(229, 178, 115, .07); box-shadow: none; }
.search-status { display: flex; align-items: center; gap: 12px; margin-top: 18px; color: var(--muted); font-size: 14px; }
.search-status .src-badge { height: 28px; font-size: 13px; }
.search-results { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.search-result { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: rgba(240, 232, 220, .025); text-align: left; cursor: pointer; outline: none; }
.search-result:hover, .search-result.focused { border-color: rgba(229, 178, 115, .42); background: rgba(229, 178, 115, .06); box-shadow: none; }
.search-result__art { width: 66px; aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden; position: relative; flex: none; }
.search-result__art .cover { position: absolute; inset: 0; font-size: 24px; }
.search-result__body { min-width: 0; flex: 1; }
.search-result__title { display: block; font-size: 20px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result__meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.search-result__side { flex: none; text-align: right; }
.search-result__side .src-badge { height: 27px; font-size: 12px; }
.search-result__side--muted { font-size: 16px; color: var(--faint); }
.search-result__lines { margin-top: 6px; color: var(--faint); font-size: 12px; }
.search-empty { padding: 34px 10px; text-align: center; color: var(--faint); font-size: 18px; }

/* ---------- source manager ---------- */
.panel--sources { width: min(1180px, 88%); }
.source-manager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.source-block { padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: rgba(240, 232, 220, .025); }
.source-block__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.source-block__head h3 { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 400; }
.source-block__sub { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.source-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(8, 8, 7, .28); }
.source-row__main { min-width: 0; flex: 1; }
.source-row__name { display: block; font-size: 17px; color: var(--ink); }
.source-row__meta { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.source-row__state { text-align: right; flex: none; font-size: 13px; color: var(--sage); }
.source-row__state .latency { display: block; margin-top: 4px; color: var(--faint); font-size: 12px; }
.source-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.source-note { margin-top: 14px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--faint); font-size: 13px; line-height: 1.7; }

/* ---------- live ---------- */
.live-page { height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.live-page .live { flex: 1; min-height: 0; height: auto; grid-template-columns: 370px minmax(0, 1fr) 410px; }
.live-tools { display: flex; align-items: center; gap: 10px; min-height: 60px; }
.live-tools .chips { flex: none; }
.live-tools .toolbar-spacer { flex: 1; }
.live-tabs--sources .live-tab { font-size: 17px; padding: 0 8px; }
.live-cats .live-cat { font-size: 17px; }
.live-list { padding: 16px 12px; }
.live-tabs { margin-bottom: 10px; }
.live-cats { margin-bottom: 8px; }
.channel { padding: 10px 11px; }
.channel__meta { min-width: 0; flex: 1; }
.channel__now { margin-top: 3px; font-size: 17px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel__src { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); }
.channel__src i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.channel__src.src--fongmi { color: var(--amber); }
.channel__src.src--lunatv { color: var(--sage); }
.channel__fav { margin-left: auto; color: var(--amber); font-size: 15px; opacity: .9; }
.channel__health { width: 7px; height: 7px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 7px rgba(169, 192, 176, .5); flex: none; margin-left: 4px; }
.live-main { gap: 10px; }
.live-main .live-screen { flex: 1; min-height: 0; }
.live-linebar { display: flex; align-items: center; gap: 8px; padding: 0 2px; }
.live-linebar__spacer { flex: 1; }
.line-pill { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border: 1px solid rgba(229, 178, 115, .24); border-radius: 999px; background: rgba(229, 178, 115, .055); color: var(--amber); font-size: 15px; cursor: pointer; outline: none; white-space: nowrap; }
.line-pill:hover, .line-pill.focused { border-color: rgba(229, 178, 115, .48); background: rgba(229, 178, 115, .1); box-shadow: none; }
.live-program { flex: none; padding: 0 2px 2px; }
.live-program__row { display: flex; align-items: center; gap: 10px; }
.live-program__next { margin-top: 5px; color: var(--faint); font-size: 15px; }
.live-quick { flex: none; }
.live-quick__item { min-height: 64px; }
.live-epg { padding: 18px 14px; }
.epg-dates { display: flex; gap: 6px; margin-top: 12px; }
.epg-date { flex: 1; height: 38px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--faint); font-size: 14px; cursor: pointer; outline: none; }
.epg-date.active, .epg-date.focused { border-color: rgba(229, 178, 115, .4); color: var(--amber); background: rgba(229, 178, 115, .07); box-shadow: none; }
.epg-item { align-items: center; gap: 10px; padding: 10px 4px; }
.epg-item__body { min-width: 0; flex: 1; }
.epg-item__name { font-size: 15px; color: var(--muted); line-height: 1.45; }
.epg-item__sub { margin-top: 3px; font-size: 12px; color: var(--faint); }
.epg-item.now .epg-item__name { color: var(--ink); }
.epg-remind { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--faint); font-size: 14px; cursor: pointer; outline: none; flex: none; }
.epg-remind:hover, .epg-remind.focused { border-color: rgba(229, 178, 115, .4); color: var(--amber); box-shadow: none; }
.epg-source { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; line-height: 1.7; }

/* live full screen */
.live-full { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 42%, rgba(74, 55, 38, .34), transparent 55%), #050505; }
.live-full__bg { position: absolute; inset: -8%; background: linear-gradient(135deg, #2b2119, #0b0b0a 64%); filter: saturate(.8); }
.live-full__shade { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(4, 4, 4, .94), transparent 48%), linear-gradient(180deg, rgba(4, 4, 4, .64), transparent 30%); }
.live-full__top { position: absolute; top: 44px; left: 56px; right: 56px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.live-full__channel { font-family: var(--serif); font-size: 44px; letter-spacing: .06em; }
.live-full__sub { margin-top: 8px; color: var(--muted); font-size: 18px; }
.live-full__center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.live-full__name { font-family: var(--serif); font-size: 86px; letter-spacing: .12em; text-shadow: 0 8px 40px rgba(0, 0, 0, .55); }
.live-full__now { color: rgba(240, 232, 220, .7); font-size: 26px; letter-spacing: .06em; }
.live-full__badges { display: flex; align-items: center; gap: 10px; justify-content: center; }
.live-full__bottom { position: absolute; left: 56px; right: 56px; bottom: 42px; }
.live-full__bottom .progress { margin-top: 12px; }
.live-full__meta { display: flex; align-items: center; justify-content: space-between; gap: 20px; color: rgba(240, 232, 220, .56); font-size: 17px; }
.live-full__actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.live-full__actions .icon-btn { background: rgba(8, 8, 7, .38); border-color: rgba(240, 232, 220, .16); }
.live-full__epg { position: absolute; left: 56px; right: 56px; bottom: 154px; display: flex; gap: 8px; overflow: hidden; }
.live-full__epg-item { flex: 1; min-width: 0; padding: 11px 12px; border: 1px solid rgba(240, 232, 220, .1); border-radius: 12px; background: rgba(8, 8, 7, .3); color: var(--faint); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-full__epg-item.now { border-color: rgba(229, 178, 115, .34); color: var(--amber); background: rgba(229, 178, 115, .07); }
.live-full__hint { position: absolute; right: 56px; top: 50%; color: var(--faint); font-size: 14px; }

/* player concept additions */
.player__source { position: absolute; z-index: 3; top: 44px; right: 56px; display: flex; align-items: center; gap: 8px; }
.player__source .src-badge { height: 34px; font-size: 15px; }
.player__auto { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 1px solid rgba(169, 192, 176, .24); border-radius: 999px; background: rgba(169, 192, 176, .06); color: var(--sage); font-size: 14px; }
.player__auto i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.player__episode { color: var(--muted); font-size: 15px; }
.player__controls .btn { min-height: 44px; font-size: 16px; padding: 0 14px; }
.player__pill { height: 40px; font-size: 15px; }
.player__hint { font-size: 14px; }

/* keep focus outlines inside cards */
.video-page .poster.focused { transform: none; }
.live-list, .live-epg { min-height: 0; overflow: hidden; }
.channel-list { min-height: 0; flex: 1; overflow: auto; -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 94%, transparent 100%); mask-image: linear-gradient(to bottom, #000 0%, #000 94%, transparent 100%); }
.epg-list { min-height: 0; flex: 1; overflow: auto; }

@media (max-width: 900px) {
  .topbar__tools { display: none; }
}

/* main app integration */
.live-full__bottom { display: block; }
.live-page .live-cats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; padding: 0 2px 10px; }
.live-page .live-cat { height: 48px; min-height: 48px; padding: 0; font-size: 18px; }
.search-box input.focused { outline: none !important; box-shadow: none !important; transform: none; }
.search-box:focus-within { border-color: rgba(229, 178, 115, .48); box-shadow: 0 0 0 4px rgba(229, 178, 115, .08); }
.video-empty { grid-column: 1 / -1; padding: 40px 12px; text-align: center; color: var(--faint); font-size: 19px; }
.live-full__bottom .progress { margin-top: 12px; }
.live-full__actions .player__spacer { flex: 1; }

/* real media */
.poster-img, .search-result__art .poster-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; filter: saturate(.78) brightness(.8);
}
.poster-large .poster-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(.82) brightness(.88); }
.player__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; z-index: 1; }
.video-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; height: 100%; }
.video-empty p { margin: 0; font-size: 20px; color: var(--muted); }

.poster__rank {
  position: absolute; left: 10px; top: 10px; z-index: 2;
  min-width: 40px; height: 40px; padding: 0 8px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(229, 178, 115, .94); color: #24170c;
  font-family: var(--serif); font-size: 22px; line-height: 1;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .32);
}
.poster--hot .poster__tag { left: auto; right: 10px; }
/* download page: compact task rows, grouped by state */
.torrent-page { height: 100%; }
.torrent-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
  padding: 2px 4px 10px; scrollbar-width: none; -ms-overflow-style: none; }
.torrent-list::-webkit-scrollbar { display: none; }
.torrent-section { display: flex; align-items: center; gap: 10px; margin: 16px 6px 4px;
  font-size: 15px; letter-spacing: .12em; color: rgba(240, 232, 220, .44); }
.torrent-section:first-child { margin-top: 0; }
.torrent-section__count { color: var(--amber); font-variant-numeric: tabular-nums; }
.torrent-section__line { flex: 1; height: 1px; background: var(--line); }
.torrent-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 16px;
  padding: 12px 16px; border: 0; border-radius: 14px; background: rgba(255, 255, 255, .022); }
.torrent-row__poster { width: 54px; height: 78px; border-radius: 8px; overflow: hidden; background: #17140f;
  display: grid; place-items: center; font-family: var(--serif); font-size: 26px; color: rgba(240, 232, 220, .38); }
.torrent-row__poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.torrent-row__poster--empty { background: linear-gradient(160deg, #221d17, #14110e); }
.torrent-row__poster--dl { background: linear-gradient(160deg, rgba(229, 178, 115, .14), rgba(20, 17, 14, .9)); color: var(--amber); }
.torrent-row__main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.torrent-row__title { font-size: 22px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.torrent-row__meta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.torrent-row__note { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.want-state { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  border: 1px solid rgba(240, 232, 220, .12); font-size: 12px; color: var(--muted); flex: none; }
.want-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.want-state.is-active { color: var(--amber); border-color: rgba(229, 178, 115, .28); }
.want-state.is-missing { color: var(--danger); border-color: rgba(217, 139, 120, .3); }
.want-state.is-ready { color: var(--sage); border-color: rgba(169, 192, 176, .32); }
.torrent-row__bar { display: flex; align-items: center; gap: 10px; }
.torrent-row__bar .progress { flex: 1; height: 6px; }
.torrent-row__pct { color: var(--amber); font-size: 18px; font-variant-numeric: tabular-nums; }
.torrent-row__actions { display: flex; align-items: center; gap: 8px; }
.torrent-page .btn { height: 40px; min-height: 40px; padding: 0 16px; font-size: 16px; border-radius: 10px; letter-spacing: .03em; }
.torrent-page .btn svg { width: 16px; height: 16px; }
.mikan-panel { padding: 16px 20px; border: 1px solid rgba(229, 178, 115, .18); border-radius: 18px; background: rgba(229, 178, 115, .045); }
.mikan-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.mikan-item { height: 48px; padding: 0 16px; font-size: 17px; }

/* real catalog readability */
.epg-item__name, .epg-item__sub { display: block; }
.live-page .channel__name { font-size: 22px; }
.video-feature__img { filter: saturate(.68) brightness(.52) blur(1px); }

/* live HLS layer */
.live-full__video { z-index: 0; background: #050505; }
.live-full__shade { z-index: 1; }
.live-full__top, .live-full__center, .live-full__epg, .live-full__bottom, .live-full__hint { z-index: 3; }


/* Configured catalogs can contain series and more than twelve episodes. */
.video-page .video-head .chip { font-size: 22px; padding: 0 16px; }
.video-page .concept-toolbar { flex-wrap: wrap; row-gap: 10px; }
.episode-strip { flex-wrap: nowrap; overflow-x: auto; padding: 4px; max-width: 100%; }
.episode-strip .episode-btn { flex: none; min-width: 64px; height: 60px; font-size: 24px; }
.detail-sources-card .line-list { max-height: 320px; overflow-y: auto; padding: 4px; }
.panel--sources .source-manager { max-height: 550px; overflow-y: auto; }
.panel--sources { display: flex; flex-direction: column; overflow: hidden; max-height: 88%; }
.panel--sources > * { flex-shrink: 0; }
.panel--sources .source-manager { flex: 1 1 auto; min-height: 160px; padding: 4px; }
.panel--sources .source-row__name { font-size: 22px; }
.panel--sources .source-row__meta, .panel--sources .source-row__state { font-size: 18px; }
.panel--sources .source-note { font-size: 18px; }
.panel--sources .panel__foot { margin-top: 14px; }

/* Actual media remains below its controls, unlike the original still-image prototype. */
.player > .player__video { z-index: 0; object-fit: contain; background: #050403; }
.player > .player__shade { z-index: 1; pointer-events: none; }
.player__loading { position: absolute; z-index: 4; left: 50%; bottom: 180px; transform: translateX(-50%); padding: 12px 20px; border: 1px solid var(--line); border-radius: 12px; background: rgba(12, 10, 8, .86); color: var(--ink); font-size: 22px; pointer-events: none; }
.player__loading[hidden] { display: none; }
.player > .player__center { z-index: 2; pointer-events: none; }
.player > .player__top, .player > .player__bottom, .player > .player__hint { z-index: 3; }
.live-full.is-playing .live-full__center { display: none; }
.live-screen__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.live-screen.is-playing .live-screen__center, .live-screen.is-playing .live-watermark { display: none; }

/* web boot splash: bridges the native splash while the catalog loads */
.boot-splash {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.6vmin; background: #080706; color: var(--ink);
  transition: opacity .35s var(--ease);
}
.boot-splash.hide { opacity: 0; pointer-events: none; }
.boot-splash__icon {
  width: 17vmin; height: 17vmin; border-radius: 4.2vmin;
  box-shadow: 0 4vmin 12vmin rgba(229, 178, 115, .12);
}
.boot-splash__title { font-family: var(--serif); font-size: 6vmin; letter-spacing: .16em; margin-top: .8vmin; }
.boot-splash__sub { font-size: 2vmin; color: var(--muted); letter-spacing: .08em; }
.boot-splash__line { width: 16vmin; height: 2px; margin-top: 1.2vmin; background: rgba(240,232,220,.1); overflow: hidden; border-radius: 2px; }
.boot-splash__line i { display: block; width: 42%; height: 100%; background: var(--amber); animation: bootSlide 1.1s ease-in-out infinite; }
@keyframes bootSlide { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }

/* player stacking + draggable progress */
.player__video { z-index: 0; pointer-events: none; }
.player__shade { z-index: 1; pointer-events: none; }
.player__top, .player__source, .player__center, .player__hint { z-index: 2; }
.player__center { pointer-events: none; }
.player__bottom { z-index: 3; }
.player__seek {
  position: relative; flex: 1; height: 26px; display: flex; align-items: center;
  cursor: pointer; touch-action: none; -webkit-user-select: none; user-select: none;
}
.player__seek .progress { width: 100%; height: 6px; pointer-events: none; }
.player__knob {
  position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%;
  background: var(--amber); transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(229, 178, 115, .12), 0 4px 12px rgba(0, 0, 0, .35);
  opacity: 0; transition: opacity .15s var(--ease); pointer-events: none;
}
.player:not(.controls-hidden) .player__knob { opacity: 1; }
.player.controls-hidden .player__knob { opacity: 0; }
.player.controls-hidden .player__seek { pointer-events: none; }

.poster__title--one { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }


.poster-img, .search-result__art .poster-img, .poster-large .poster-img { z-index:1; }
.poster__art::after { z-index:1; }
.poster__title { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; }
.poster__title--one { -webkit-line-clamp:1; }
.video-detail__body { justify-content:center; }
.poster-large { align-self:flex-start; }

/* video toolbar: page tabs on the left, one scope dropdown + search on the right */
.video-page .video-head { min-height: 44px; }
.video-page .video-head .video-toolbar { min-height: 0; gap: 18px; flex-wrap: nowrap; }
.video-page .video-head .video-toolbar .video-scope__pop {
  left: auto; right: 0; min-width: 158px; padding: 6px 6px 8px;
}
.video-page .video-head .video-toolbar .video-scope__pop .chip--text {
  height: 44px; min-height: 44px; font-size: 17px;
}
.scope-group { padding: 8px 14px 3px; font-size: 12px; letter-spacing: .14em; color: var(--faint); }
.scope-group--sep { margin-top: 5px; padding-top: 10px; border-top: 1px solid var(--line); }
.scope-count { margin-left: 8px; font-size: 13px; color: rgba(240, 232, 220, .38); font-variant-numeric: tabular-nums; }
.video-page .video-head .icon-btn--sm { width: 46px; height: 46px; }
.icon-btn--sm svg { width: 20px; height: 20px; }

/* recommend page: downloaded library as a flat poster wall */
.app .video-page .video-grid.video-library {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  align-content: start; gap: 26px 18px;
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 2px 4px 10px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.app .video-page .video-grid.video-library::-webkit-scrollbar { display: none; }
.app .video-page .video-library .poster {
  width: auto; height: 100%; display: flex; flex-direction: column;
}
.app .video-page .video-library .poster__art { border-radius: 14px; }
.app .video-page .video-library .poster__title-wrap {
  display: flex; align-items: flex-end; min-height: 54px; margin-top: 2px;
}
.app .video-page .video-library .poster__title {
  font-size: 20px; line-height: 1.34;
  white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.app .video-page .video-library .poster__meta {
  margin-top: 3px; font-size: 14px; line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app .video-page .video-library .poster__desc {
  margin-top: 4px; font-size: 15px; line-height: 1.5; color: rgba(240, 232, 220, .5);
  min-height: 68px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.app .video-page .video-library .poster.focused .poster__desc { color: rgba(240, 232, 220, .72); }
.app .video-page .video-library .poster__tag { display: none; }

/* the video tab bar stays box-free: focus is a color change only */
.video-page .video-head .video-toolbar .icon-btn {
  border-color: transparent; background: transparent;
}
.video-page .video-head .video-toolbar .icon-btn.focused,
.video-page .video-head .video-toolbar .icon-btn:hover {
  border-color: transparent; background: transparent; color: var(--amber); transform: none;
}

/* ---------- live grid · final overrides (loaded after styles.css) ---------- */
.live-page--grid .live-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.live-page--grid .live-tabs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 30px; height: 56px;
  padding: 0; border-bottom: 1px solid var(--line);
}
.live-page--grid .live-tab {
  position: relative; flex: 0 0 auto; min-width: 0; height: 56px; padding: 0 2px;
  border: 0; background: transparent; font-family: var(--serif);
  font-size: 30px; letter-spacing: .06em; color: rgba(240, 232, 220, .52);
  cursor: pointer; outline: none;
}
.live-page--grid .live-tab::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 2px;
  background: var(--amber); border-radius: 2px; transition: right .2s var(--ease);
}
.live-page--grid .live-tab.active { color: var(--ink); }
.live-page--grid .live-tab.active::after { right: 0; }
.live-page--grid .live-tab.focused { color: var(--amber); background: transparent; border: 0; box-shadow: none; }
.live-page--grid .live-cats { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin-bottom: 0; }
.live-page--grid .live-cat { height: 44px; min-height: 44px; padding: 0 18px; font-size: 20px; }
