:root {
  color-scheme: dark;
  --bg: #08111c;
  --surface: #101a27;
  --surface-2: #162334;
  --surface-3: #1f3145;
  --text: #f7f8fb;
  --muted: #97a8bb;
  --line: rgba(255,255,255,.10);
  --accent: #65d7ff;
  --focus: #ffd65a;
  --danger: #ff9a94;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: radial-gradient(circle at 88% -10%, rgba(42,109,168,.28) 0, transparent 28%), linear-gradient(180deg, #08111c 0, #060d16 100%); }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }

.app-shell { width: 100vw; height: 100vh; background: radial-gradient(circle at 90% -20%, rgba(32,90,150,.38) 0, transparent 30%), transparent; }
.topbar { height: 88px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 clamp(24px, 3vw, 56px); border-bottom: 1px solid var(--line); background: rgba(8,12,20,.92); backdrop-filter: blur(18px); }
.topbar-left { min-width: 0; display: flex; align-items: center; gap: 20px; }
.back-button { min-height: 48px; display: flex; align-items: center; gap: 9px; padding: 0 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); font-weight: 750; }
.back-button span { color: var(--accent); font-size: 23px; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand > span:last-child { display: flex; align-items: baseline; gap: 6px; font-size: 23px; letter-spacing: -.7px; }
.brand small { color: var(--accent); font-size: 10px; letter-spacing: 2px; }
.brand-mark { width: 46px; height: 46px; border-radius: 14px; background: var(--accent); display: flex; align-items: center; justify-content: center; gap: 3px; }
.brand-mark i { width: 3px; border-radius: 4px; background: #07101b; }
.brand-mark i:nth-child(1) { height: 13px; }
.brand-mark i:nth-child(2) { height: 22px; }
.brand-mark i:nth-child(3) { height: 16px; }
.topbar-center { font-size: 17px; font-weight: 700; color: var(--muted); }
.topbar-actions { justify-self: end; display: flex; align-items: center; gap: 18px; }
.clock, #playerClock { font-size: 25px; font-weight: 750; font-variant-numeric: tabular-nums; }
.round-button { width: 50px; height: 50px; border: 1px solid var(--line); border-radius: 15px; background: rgba(18,31,46,.92); font-size: 21px; }

.home-screen, .category-screen, .section-placeholder, .settings-screen { height: calc(100vh - 88px); padding: clamp(34px,5vw,72px); }
.home-screen { display: flex; flex-direction: column; justify-content: center; }
.home-heading h1 { margin: 8px 0; font-size: clamp(38px,4vw,60px); letter-spacing: -2.5px; }
.home-heading p { margin: 0; color: var(--muted); font-size: 18px; }
.home-grid { height: min(29vh,280px); display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: clamp(12px,1.3vw,22px); margin-top: 36px; }
.home-tile { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(155deg, rgba(27,45,66,.96), rgba(12,19,29,.96)); text-align: left; }
.home-tile > span { color: var(--accent); font-size: 48px; }
.home-tile b { margin-top: auto; font-size: clamp(20px,1.7vw,27px); }
.home-tile small { margin-top: 5px; color: var(--muted); font-size: 14px; }
.home-help { margin-top: 26px; color: var(--muted); font-size: 14px; }

.category-screen { display: block; padding: 20px clamp(24px, 4vw, 64px); }
.category-page-card { width: 100%; height: 100%; padding: 18px 0 14px; display: grid; grid-template-rows: auto minmax(0,1fr) auto; gap: 12px; }
.category-heading { text-align: left; }
.category-heading .eyebrow { font-size: 11px; }
.category-heading h2 { margin: 3px 0 0; font-size: clamp(30px,3vw,42px); letter-spacing: -1.4px; }
.category-chooser { min-height: 0; display: grid; grid-template-columns: 1fr; grid-auto-rows: minmax(68px, 1fr); gap: 10px; overflow-y: auto; padding: 5px 7px; align-content: start; }
.category-choice { min-height: 68px; max-height: 82px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px; padding: 0 clamp(20px, 3vw, 38px); border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(160deg, rgba(24,38,56,.98), rgba(14,22,32,.98)); font-size: clamp(20px, 2vw, 26px); text-align: left; }
.category-choice b, .category-choice span { display: block; }
.category-choice span { color: var(--accent); font-size: 18px; }

.media-screen { height: calc(100vh - 88px); padding: 24px; }
.media-layout { width: 100%; height: 100%; display: grid; grid-template-columns: 270px minmax(0,1fr); border: 1px solid var(--line); border-radius: 28px; overflow: hidden; background: linear-gradient(180deg, rgba(17,26,39,.96), rgba(11,18,28,.96)); }
.media-categories { min-height: 0; padding: 22px 16px; border-right: 1px solid var(--line); background: rgba(8,14,22,.78); display: flex; flex-direction: column; }
.media-category-list { min-height: 0; display: grid; gap: 8px; overflow-y: auto; padding: 4px; }
.media-browser { min-width: 0; min-height: 0; padding: 28px; display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.media-stage { min-height: 0; display: grid; grid-template-columns: minmax(0,1fr) minmax(340px,.8fr); gap: 22px; }
.media-screen.mode-categories .media-layout { grid-template-columns: 1fr; }
.media-screen.mode-categories .media-browser { display: none; }
.media-screen.mode-categories .media-categories { border-right: 0; padding: 34px; background: transparent; }
.media-screen.mode-categories .media-category-list { grid-template-columns: 1fr; gap: 12px; max-width: 860px; }
.media-screen.mode-categories .nav-item { min-height: 78px; padding: 16px 20px; font-size: 20px; border-radius: 18px; background: linear-gradient(160deg, rgba(24,38,56,.98), rgba(14,22,32,.98)); border: 1px solid var(--line); }
.media-screen.mode-grid .media-layout,
.media-screen.mode-detail .media-layout { grid-template-columns: 1fr; }
.media-screen.mode-grid .media-categories,
.media-screen.mode-detail .media-categories { display: none; }
.media-screen.mode-grid .media-stage { grid-template-columns: 1fr; }
.media-screen.mode-grid .media-detail { display: none; }
.media-screen.mode-detail .media-stage { grid-template-columns: minmax(0,1fr) minmax(360px,.78fr); }
.media-grid { min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; justify-content: stretch; overflow: hidden; padding: 7px; align-content: start; }
.media-card, .episode-button { text-align: left; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(160deg, rgba(18,28,42,.98), rgba(11,18,28,.98)); }
.media-card.selected { border-color: rgba(101,215,255,.55); background: linear-gradient(160deg, rgba(22,37,54,.98), rgba(11,18,28,.98)); }
.media-card { min-width: 0; min-height: 0; overflow: hidden; display: grid; grid-template-columns: clamp(120px,34%,190px) minmax(0,1fr); grid-template-rows: auto; align-items: stretch; padding: 0; }
.media-art { width: 100%; aspect-ratio: 2/3; overflow: hidden; background: radial-gradient(circle at 30% 20%, rgba(101,215,255,.18), transparent 34%), #070c13; display: grid; place-items: center; color: var(--muted); font-weight: 800; }
.media-art img { width: 100%; height: 100%; padding: 3px; object-fit: contain; }
.media-copy { min-width: 0; padding: 16px; display: grid; align-content: center; gap: 12px; }
.media-copy b { display: -webkit-box; overflow: hidden; text-overflow: ellipsis; white-space: normal; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; min-height: 2.7em; }
.media-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.media-detail { min-height: 0; display: grid; grid-template-rows: 240px minmax(0,1fr); border: 1px solid var(--line); border-radius: 24px; overflow: hidden; background: rgba(11,18,28,.88); }
.media-poster { background: radial-gradient(circle at 30% 20%, rgba(101,215,255,.22), transparent 34%), linear-gradient(180deg, #16283b, #0d1723); display: grid; place-items: center; color: var(--muted); font-size: 18px; font-weight: 800; text-align: center; }
.media-poster img { width: 100%; height: 100%; object-fit: cover; }
.media-detail-body { min-height: 0; display: grid; grid-template-rows: auto auto auto auto minmax(0,1fr); gap: 12px; padding: 20px; }
.media-detail-body h2 { margin: 0; font-size: 30px; letter-spacing: -1px; }
.media-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.media-meta span { padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,.08); color: #dce5ef; font-size: 12px; font-weight: 700; }
.media-detail-body p { margin: 0; color: rgba(255,255,255,.86); line-height: 1.5; }
.media-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.episode-groups { min-height: 0; overflow-y: auto; display: grid; gap: 14px; align-content: start; }
.episode-group { display: grid; gap: 8px; }
.episode-group h3 { margin: 0; color: var(--accent); font-size: 14px; letter-spacing: 1px; }
.episode-list { display: grid; gap: 8px; }
.episode-button { min-height: 62px; padding: 0 16px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.episode-button small { color: var(--muted); }
.media-footer { margin-top: 16px; }

.media-screen.mode-detail { padding: 18px 24px 14px; }
.media-screen.mode-detail .media-browser {
  padding: 0;
  grid-template-rows: minmax(0,1fr) auto;
}
.media-screen.mode-detail .content-header { display: none; }
.media-screen.mode-detail .media-stage { display: block; min-height: 0; }
.media-screen.mode-detail .media-grid { display: none; }
.media-screen.mode-detail .media-detail {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(300px,31vw) minmax(0,1fr);
  grid-template-rows: minmax(0,1fr);
  border-radius: 26px;
  background: linear-gradient(135deg, rgba(19,31,46,.98), rgba(7,13,21,.98));
}
.media-screen.mode-detail .media-poster {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: radial-gradient(circle at 50% 30%, rgba(101,215,255,.16), transparent 38%), #05090f;
}
.media-screen.mode-detail .media-poster img { width: 100%; height: 100%; padding: 28px; object-fit: contain; }
.media-screen.mode-detail .media-detail-body {
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto auto auto auto auto minmax(0,1fr);
  gap: 18px;
  padding: clamp(28px,3vw,52px);
  overflow: hidden;
}
.media-screen.mode-detail .media-detail-body h2 {
  font-size: clamp(40px,4vw,62px);
  line-height: 1.05;
}
.media-screen.mode-detail .media-meta { gap: 10px; }
.media-screen.mode-detail .media-meta span { padding: 8px 13px; font-size: 17px; }
.media-screen.mode-detail .media-detail-body > p {
  max-width: 95ch;
  max-height: 8.7em;
  overflow-y: auto;
  padding-right: 10px;
  font-size: clamp(19px,1.35vw,23px);
  line-height: 1.45;
}
.media-screen.mode-detail .media-actions { gap: 14px; }
.media-screen.mode-detail .media-actions .primary-button { min-height: 64px; display: inline-flex; align-items: center; padding: 0 28px; font-size: 19px; text-decoration: none; }
.media-screen.mode-detail .episode-groups { padding: 4px 10px 8px 2px; gap: 20px; }
.media-screen.mode-detail .episode-group h3 { font-size: 18px; }
.media-screen.mode-detail .episode-list { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.media-screen.mode-detail .episode-button { min-height: 76px; padding: 12px 18px; font-size: 17px; }
.media-screen.mode-detail .episode-button div { min-width: 0; }
.media-screen.mode-detail .episode-button b { display: block; font-size: 19px; white-space: normal; overflow-wrap: anywhere; }
.media-screen.mode-detail .episode-button small { display: block; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-screen.mode-detail .media-footer { margin-top: 8px; min-height: 42px; }

.section-placeholder { display: grid; place-items: center; }
.placeholder-card { display: grid; justify-items: center; text-align: center; }
.placeholder-icon { width: 110px; height: 110px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 30px; color: var(--accent); background: var(--surface); font-size: 48px; }
.placeholder-card h1 { margin: 24px 0 8px; font-size: 50px; }
.placeholder-card p { margin: 0 0 28px; color: var(--muted); font-size: 18px; }

.settings-screen { display: grid; place-items: center; }
.settings-card { width: min(650px,100%); }
.settings-card h1 { margin: 8px 0 30px; font-size: 50px; }
.settings-account { display: flex; align-items: center; gap: 18px; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.settings-account > span { color: var(--accent); font-size: 36px; }
.settings-account small, .settings-account b { display: block; }
.settings-account small { color: var(--muted); }
.settings-account b { margin-top: 4px; font-size: 22px; }
.danger-button { width: 100%; min-height: 58px; margin-top: 18px; border: 1px solid rgba(255,100,100,.35); border-radius: 14px; background: rgba(255,80,80,.10); color: var(--danger); font-weight: 800; }
.settings-group { margin-top: 28px; }
.settings-group > small, .eyebrow { color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: 2px; }
.format-options { display: grid; gap: 10px; margin-top: 12px; }
.format-option { min-height: 70px; display: grid; grid-template-columns: 55px 1fr 28px; align-items: center; gap: 14px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; }
.format-option > span { color: var(--accent); font-weight: 900; }
.format-option b, .format-option small { display: block; }
.format-option small { margin-top: 3px; color: var(--muted); }
.format-option i { display: none; color: var(--focus); font-style: normal; font-size: 22px; }
.format-option.active { border-color: var(--accent); background: var(--surface-2); }
.format-option.active i { display: block; }

.tv-layout { height: calc(100vh - 88px); display: grid; grid-template-columns: 300px minmax(0,1fr); }
.app-shell.category-active .tv-layout { grid-template-columns: minmax(0,1fr); }
.app-shell.category-active .category-rail { display: none; }
.category-rail { min-height: 0; display: flex; flex-direction: column; padding: 24px 18px 18px; border-right: 1px solid var(--line); background: rgba(8,14,22,.78); }
.rail-main, .rail-groups { display: grid; gap: 8px; }
.rail-groups { overflow-y: auto; min-height: 0; padding: 4px; scrollbar-width: thin; }
.rail-heading { padding: 26px 14px 11px; color: #718096; font-size: 11px; font-weight: 850; letter-spacing: 2px; }
.nav-item { width: 100%; min-height: 56px; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 11px 14px; border: 1px solid transparent; border-radius: 13px; background: transparent; text-align: left; color: #c8d0db; font-size: 16px; }
.nav-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item b { padding: 3px 8px; border-radius: 99px; background: rgba(255,255,255,.07); font-size: 12px; }
.nav-item.active { color: white; background: var(--surface-3); border-color: var(--line); }
.account-card { min-height: 68px; display: flex; align-items: center; gap: 13px; margin-top: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-2); text-align: left; }
.account-card > span:last-child { min-width: 0; }
.account-card b, .account-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-card small { color: var(--muted); margin-top: 2px; }
.account-icon { font-size: 22px; color: var(--accent); }

.channel-browser { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; padding: 30px clamp(28px,3vw,52px) 20px; }
.content-header { display: flex; justify-content: space-between; align-items: end; gap: 30px; padding-bottom: 22px; }
.content-header h1 { margin: 5px 0 0; font-size: clamp(34px,3vw,50px); line-height: 1; letter-spacing: -2px; }
.search-box { width: min(340px,36vw); min-height: 52px; display: flex; align-items: center; gap: 11px; padding: 0 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: white; font-size: 16px; }

.browse-stage { min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(430px,1.3fr) minmax(360px,.9fr); gap: clamp(20px,2vw,34px); }
.empty-state { align-self: stretch; display: grid; place-content: center; justify-items: center; text-align: center; }
.loader-mark { color: var(--accent); font-size: 52px; }
.empty-state h2 { margin: 15px 0 5px; font-size: 27px; }
.empty-state p { color: var(--muted); }
.channel-grid { min-width: 0; min-height: 0; display: grid; align-content: start; gap: 10px; overflow: hidden; padding: 7px; }
.channel-card { position: relative; min-width: 0; min-height: 94px; display: grid; grid-template-columns: 58px minmax(0,1fr) auto 42px; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(160deg, rgba(18,28,42,.98), rgba(11,18,28,.98)); cursor: pointer; }
.channel-card.selected { border-color: rgba(101,215,255,.55); background: linear-gradient(160deg, rgba(22,37,54,.98), rgba(11,18,28,.98)); }
.channel-logo { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 10px; background: radial-gradient(circle,#293d54,#121b28); }
.channel-logo img { width: 40px; height: 40px; object-fit: contain; }
.channel-logo span { color: var(--accent); font-size: 17px; font-weight: 900; }
.channel-meta { min-width: 0; display: grid; gap: 7px; }
.channel-meta b, .channel-meta small, .channel-meta p { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; }
.channel-meta b { font-size: 17px; }
.channel-now { color: #dce5ef; font-size: 13px; }
.channel-action { color: var(--accent); font-size: 20px; }
.favorite-button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(255,255,255,.06); }
.favorite-button.on { color: var(--focus); }

.program-progress { width: 100%; height: 8px; border-radius: 999px; background: rgba(255,255,255,.10); overflow: hidden; }
.program-progress i { display: block; width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #8ef7bf); }
.progress-label-live { color: #e8f7ff !important; }

.mini-player { min-width: 0; align-self: start; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(180deg, rgba(16,23,34,.98), rgba(12,18,27,.98)); }
.mini-video-wrap { position: relative; aspect-ratio: 16/9; display: grid; place-items: center; background: #030507; }
.mini-video-wrap video { width: 100%; height: 100%; object-fit: contain; }
.mini-placeholder { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted); pointer-events: none; }
.mini-placeholder span { width: 64px; height: 64px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--accent); font-size: 24px; }
.mini-placeholder small { font-size: 14px; }
.mini-info { display: block; padding: 18px 20px 22px; }
.mini-info > div { min-width: 0; }
.mini-info h2 { overflow: hidden; margin: 7px 0 0; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; }
.mini-details p { overflow: hidden; margin: 10px 0 4px; color: #dce5ef; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.mini-details > small { display: block; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; margin-top: 6px; }
#miniDescription { margin-top: 10px; white-space: normal; line-height: 1.45; color: rgba(255,255,255,.86); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; }

.browser-footer { min-height: 58px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.remote-legend, .dialog-legend, .player-legend { color: var(--muted); font-size: 13px; }
.remote-legend b, .dialog-legend b { color: var(--focus); margin: 0 4px 0 10px; }
.pagination { display: flex; align-items: center; gap: 12px; }
.pagination button { width: 48px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 26px; }
.pagination span { min-width: 70px; text-align: center; color: var(--muted); font-weight: 700; }

.primary-button { min-height: 58px; padding: 0 24px; border: 0; border-radius: 14px; background: var(--accent); color: #06101a; font-weight: 850; }
.primary-button.full { width: 100%; }
.primary-button span { margin-left: 18px; }
.form-message { min-height: 22px; color: #ff8d84 !important; }

dialog { border: 0; color: white; background: transparent; }
dialog::backdrop { background: rgba(2,5,10,.88); backdrop-filter: blur(14px); }
.login-dialog { width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; padding: 0; }
.login-dialog[open] { display: grid; place-items: center; background: radial-gradient(circle at 80% 0, rgba(24,51,77,.86) 0, transparent 42%), var(--bg); }
.login-card { width: min(570px,calc(100vw - 40px)); padding: 46px; border: 1px solid var(--line); border-radius: 26px; background: var(--surface); }
.login-brand { margin-bottom: 38px; }
.login-card h1 { margin: 9px 0 12px; font-size: clamp(42px,5vw,62px); line-height: .95; letter-spacing: -3px; }
.login-card > p { color: var(--muted); font-size: 17px; }
.login-fields label { display: block; margin: 18px 0 7px; color: #d4dbe4; font-size: 15px; }
.login-fields input { width: 100%; min-height: 60px; padding: 0 17px; border: 1px solid var(--line); border-radius: 13px; background: #0a1019; color: white; font-size: 20px; }
.login-card .primary-button { margin-top: 4px; font-size: 18px; }
.login-help { display: block; margin-top: 20px; color: var(--muted); text-align: center; }

.player-dialog { width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; padding: 0; }
.player-dialog[open] { display: block; background: rgba(0,0,0,.94); }
.player-card { width: 100%; height: 100%; padding: 0; background: #000; }
.video-wrap { position: relative; width: 100%; height: 100%; overflow: hidden; display: grid; place-items: center; background: #000; }
.video-wrap video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.video-message { position: absolute; color: var(--muted); z-index: 3; }
.player-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 26px 30px 34px; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.58) 0, rgba(0,0,0,.14) 26%, rgba(0,0,0,.10) 58%, rgba(0,0,0,.82) 100%); }
.player-topbar, .player-status, .player-channel { display: flex; align-items: center; gap: 16px; }
.player-topbar { justify-content: space-between; }
.player-channel h2 { margin: 0; font-size: 34px; letter-spacing: -1.2px; }
.player-status .round-button { pointer-events: auto; }
.player-bottom { display: grid; gap: 18px; align-self: stretch; width: 100%; max-width: 100%; }
.player-epg { display: grid; gap: 14px; width: 100%; padding: 20px 24px 18px; border-radius: 24px; background: linear-gradient(180deg, rgba(8,14,22,.62), rgba(8,14,22,.44)); border: 1px solid rgba(255,255,255,.10); backdrop-filter: blur(12px); }
.player-epg-now small { display: block; margin-bottom: 8px; color: var(--accent); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; }
.player-epg-now strong { display: block; font-size: clamp(28px, 3vw, 40px); letter-spacing: -1.4px; }
.player-epg-now p { margin: 10px 0 0; color: rgba(255,255,255,.88); font-size: 18px; line-height: 1.5; max-width: min(110ch, 100%); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.player-progress { height: 10px; }
.player-meta-line { display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #d9e6f1; }
.player-overlay > .player-topbar, .player-overlay > .player-bottom { transition: opacity .2s ease, transform .2s ease; }
.player-overlay.player-ui-hidden { background: transparent; }
.player-overlay.player-ui-hidden > .player-topbar { opacity: 0; transform: translateY(-16px); }
.player-overlay.player-ui-hidden > .player-bottom { opacity: 0; transform: translateY(16px); pointer-events: none; }
.live-badge.is-vod i { background: var(--accent); }
.vod-controls { display: flex; align-items: stretch; justify-content: center; gap: 12px; pointer-events: auto; }
.player-control {
  min-width: 132px;
  min-height: 72px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 10px 16px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 16px;
  background: rgba(13,23,34,.94);
  color: white;
}
.player-control span { color: var(--accent); font-size: 27px; font-weight: 900; }
.player-control small { font-size: 14px; font-weight: 750; }
.player-control.primary-control { min-width: 150px; background: rgba(26,49,68,.97); border-color: rgba(101,215,255,.5); }
.player-control:disabled { opacity: .35; cursor: default; }
.episode-control { min-width: 165px; }
.seek-feedback {
  justify-self: center;
  margin: 0 auto;
  padding: 12px 20px;
  border: 1px solid rgba(101,215,255,.45);
  border-radius: 14px;
  background: rgba(5,12,19,.92);
  color: #dceaf5;
  font-size: 18px;
  font-weight: 750;
}
.seek-feedback span { color: var(--focus); font-size: 30px; font-weight: 900; }
.skip-outro-button {
  justify-self: end;
  min-height: 58px;
  padding: 0 22px;
  border: 2px solid var(--focus);
  border-radius: 15px;
  background: rgba(8,16,24,.96);
  color: white;
  font-size: 17px;
  font-weight: 850;
  pointer-events: auto;
}
.skip-outro-button span { margin: 0 8px; color: var(--focus); }

.live-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: 1.5px; }
.live-badge i { width: 8px; height: 8px; border-radius: 50%; background: #ff5a5a; }

/* TV readability: designed for viewing from roughly three metres away. */
:root { --muted: #b7c4d2; }
.back-button { min-height: 54px; padding: 0 20px; font-size: 17px; font-weight: 800; }
.brand > span:last-child { gap: 7px; font-size: 26px; }
.brand small { font-size: 12px; }
.topbar-center { color: #c5d0dc; font-size: 20px; font-weight: 750; }
.clock, #playerClock { font-size: 29px; font-weight: 800; }

.home-heading p { font-size: 21px; }
.home-tile b { font-size: clamp(24px,1.9vw,31px); }
.home-tile small, .home-help { font-size: 17px; line-height: 1.35; }

.category-heading .eyebrow { font-size: 13px; }
.category-heading h2 { font-size: clamp(38px,3.4vw,52px); }
.category-chooser {
  min-width: 0;
  grid-template-columns: minmax(0,1fr);
  grid-auto-rows: minmax(76px,1fr);
  gap: 11px;
  overflow-x: hidden;
  padding: 7px 12px 7px 7px;
}
.category-choice {
  width: 100%;
  min-width: 0;
  min-height: 76px;
  max-height: 90px;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 22px;
  padding: 0 clamp(24px,3vw,42px);
  font-size: clamp(24px,2vw,30px);
}
.category-choice b { min-width: 0; overflow-wrap: anywhere; }
.category-choice span { font-size: 22px; white-space: nowrap; }

.media-screen.mode-categories .media-category-list {
  grid-template-columns: minmax(0,1fr);
  max-width: none;
  overflow-x: hidden;
  padding: 7px;
}
.media-screen.mode-categories .nav-item { min-height: 80px; padding: 16px 26px; font-size: 25px; }
.media-card { min-height: 0; grid-template-rows: auto; }
.media-copy b {
  -webkit-line-clamp: 3;
  font-size: 19px;
  line-height: 1.3;
  min-height: 3.9em;
  overflow-wrap: anywhere;
}
.media-copy small { font-size: 15px; }
.media-title-badge {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 11px;
  background: rgba(3,8,14,.94);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,.26);
}
.media-data-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.media-copy .media-data-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px;
  background: rgba(7,14,23,.92);
  color: #e8f1fa;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
.media-year-badge span { color: var(--accent); }
.media-copy .media-rating-badge { border-color: rgba(255,214,90,.28); background: rgba(50,41,12,.88); }
.media-rating-badge span { color: var(--focus); font-size: 17px; }
.media-copy .media-watch-badge { border-color: rgba(142,247,191,.32); background: rgba(15,62,44,.86); color: #bafbd8; }
.media-copy .media-genre {
  display: -webkit-box;
  overflow: hidden;
  color: #c8d5e2;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.35;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.media-copy .media-genre-loading { color: #8293a5; font-size: 14px; font-weight: 600; }
.media-card-hint { align-self: end; color: var(--accent); font-size: 16px; font-weight: 800; }
.media-card-hint b { display: inline; min-height: 0; margin-left: 5px; padding: 0; background: none; border: 0; box-shadow: none; color: inherit; font-size: 22px; }
.media-detail-body h2 { font-size: 36px; line-height: 1.15; overflow-wrap: anywhere; }
.media-meta span { font-size: 15px; }
.media-detail-body p { color: rgba(255,255,255,.92); font-size: 18px; }

.content-header h1 { font-size: clamp(40px,3.2vw,56px); line-height: 1.05; overflow-wrap: anywhere; }
.search-box input { font-size: 19px; }
.channel-card {
  min-height: 112px;
  grid-template-columns: 68px minmax(0,1fr) auto 46px;
  gap: 16px;
  padding: 14px;
}
.channel-logo { width: 62px; height: 62px; }
.channel-logo img { width: 50px; height: 50px; }
.channel-meta b { font-size: 22px; line-height: 1.2; white-space: normal; overflow-wrap: anywhere; }
.channel-now { color: #e5edf5; font-size: 17px; }
.mini-info h2 { margin-top: 7px; font-size: 25px; line-height: 1.25; white-space: normal; overflow-wrap: anywhere; }
.mini-details p { color: #e5edf5; font-size: 19px; line-height: 1.35; white-space: normal; }
.mini-details > small { font-size: 16px; line-height: 1.35; white-space: normal; }

.remote-legend, .dialog-legend, .player-legend { font-size: 16px; }
.player-channel h2 { font-size: 40px; line-height: 1.15; overflow-wrap: anywhere; }
.player-epg-now p { color: rgba(255,255,255,.94); font-size: 21px; line-height: 1.45; }
.category-choice:focus-visible, .media-card:focus-visible, .channel-card:focus-visible, .nav-item:focus-visible {
  transform: none !important;
}
.category-choice:hover, .media-screen.mode-categories .nav-item:hover { transform: none !important; }
.category-choice:focus-visible, .media-screen.mode-categories .nav-item:focus-visible {
  outline: 0;
  box-shadow: inset 0 0 0 5px var(--focus), 0 10px 28px rgba(0,0,0,.32);
}

button:focus-visible, input:focus-visible, [tabindex="0"]:focus-visible {
  outline: 5px solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 8px rgba(255,214,90,.16), 0 16px 42px rgba(0,0,0,.42);
  transform: scale(1.025);
  z-index: 10;
}

@media (hover:hover) and (pointer:fine) {
  button, [tabindex="0"] { transition: transform .14s ease, border-color .14s ease, background-color .14s ease, box-shadow .14s ease; }
  .home-tile:hover, .nav-item:hover, .channel-card:hover, .category-choice:hover, .format-option:hover,
  .account-card:hover, .primary-button:hover, .danger-button:hover, .back-button:hover, .round-button:hover,
  .pagination button:hover:not(:disabled) {
    border-color: var(--accent);
    background-color: #20364a;
    box-shadow: 0 12px 32px rgba(0,0,0,.35), 0 0 0 3px rgba(101,215,255,.16);
    transform: translateY(-2px) scale(1.018);
    z-index: 8;
  }
  .channel-card:hover .channel-action, .home-tile:hover > span { color: white; }
  button:active, [tabindex="0"]:active { transform: scale(.985); }
}

@media (max-width: 1350px) {
  .tv-layout { grid-template-columns: 270px minmax(0,1fr); }
  .browse-stage { grid-template-columns: minmax(390px,1fr) minmax(320px,.8fr); }
}

@media (max-height: 900px) and (min-width: 901px) {
  .channel-browser { padding-top: 20px; padding-bottom: 12px; }
  .content-header { padding-bottom: 14px; }
  .content-header h1 { font-size: clamp(36px,2.7vw,46px); }
  .channel-grid { gap: 8px; padding: 5px 7px; }
  .channel-card {
    min-height: 92px;
    grid-template-columns: 58px minmax(0,1fr) auto 42px;
    gap: 13px;
    padding: 10px 12px;
  }
  .channel-logo { width: 52px; height: 52px; }
  .channel-logo img { width: 43px; height: 43px; }
  .channel-meta { gap: 5px; }
  .channel-meta b { font-size: 20px; }
  .channel-now { font-size: 15px; }
  .browser-footer { min-height: 48px; }
}

@media (max-width: 1200px) {
  .media-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (min-width: 1500px) {
  .media-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
}

@media (max-width: 900px) {
  html, body { overflow: auto; }
  .app-shell { min-height: 100vh; height: auto; }
  .topbar { grid-template-columns: 1fr auto; }
  .topbar-center { display: none; }
  .home-screen { height: auto; min-height: calc(100vh - 88px); }
  .home-grid { height: auto; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .home-tile { min-height: 190px; }
  .category-chooser { grid-template-columns: 1fr; }
  .media-screen { padding: 16px; }
  .media-screen.mode-detail .media-detail { grid-template-columns: 1fr; grid-template-rows: 240px minmax(0,1fr); }
  .media-screen.mode-detail .media-poster { border-right: 0; border-bottom: 1px solid var(--line); }
  .media-screen.mode-detail .media-poster img { padding: 14px; }
  .media-screen.mode-detail .media-detail-body { padding: 24px 20px; }
  .media-screen.mode-detail .episode-list { grid-template-columns: 1fr; }
  .media-layout, .media-stage, .media-screen.mode-detail .media-stage { grid-template-columns: 1fr; }
  .media-categories { border-right: 0; border-bottom: 1px solid var(--line); }
  .media-screen.mode-categories .media-categories { padding: 22px 16px; }
  .media-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .tv-layout { height: auto; grid-template-columns: 1fr; }
  .category-rail { display: none; }
  .channel-browser { min-height: calc(100vh - 88px); }
  .browse-stage { grid-template-columns: 1fr; }
  .mini-player { grid-row: 1; }
  .channel-grid { grid-template-columns: 1fr; overflow: visible; }
  .remote-legend { display: none; }
  .player-overlay { padding: 20px 18px 24px; }
  .player-meta-line { display: grid; gap: 6px; }
  .vod-controls { flex-wrap: wrap; gap: 8px; }
  .player-control, .player-control.primary-control, .episode-control { min-width: 112px; min-height: 62px; padding: 8px 10px; }
  .player-control small { font-size: 12px; }
}

@media (max-width: 600px) {
  .topbar { height: 72px; padding: 0 16px; }
  .clock { display: none; }
  .brand-mark { width: 40px; height: 40px; }
  .channel-browser { padding: 24px 14px; }
  .content-header { display: block; }
  .search-box { width: 100%; margin-top: 16px; }
  .category-page-card, .login-card { padding: 28px 20px; }
  .media-browser { padding: 20px 14px; }
  .media-grid { grid-template-columns: 1fr; }
  .channel-card { grid-template-columns: 52px minmax(0,1fr) 38px; }
  .channel-action { display: none; }
  .mini-info { padding: 18px 16px 20px; }
}

/* Responsive display system: TV, desktop, ultrawide and foldable layouts. */
html, body, .app-shell { min-width: 0; min-height: 0; }
@supports (height: 100dvh) {
  html, body { height: 100dvh; }
  .app-shell { height: 100dvh; }
  .home-screen, .category-screen, .section-placeholder, .settings-screen,
  .media-screen, .tv-layout { height: calc(100dvh - 88px); }
}
.topbar {
  padding-left: max(clamp(16px,3vw,56px), env(safe-area-inset-left));
  padding-right: max(clamp(16px,3vw,56px), env(safe-area-inset-right));
}
.home-screen, .category-screen, .section-placeholder, .settings-screen,
.media-screen, .channel-browser {
  padding-left: max(clamp(16px,4vw,64px), env(safe-area-inset-left));
  padding-right: max(clamp(16px,4vw,64px), env(safe-area-inset-right));
}
.home-screen > *, .category-page-card, .media-layout,
.channel-browser > *, .settings-card, .placeholder-card {
  width: 100%; max-width: 2880px; margin-left: auto; margin-right: auto;
}
@media (min-width: 2201px) { .media-grid { grid-template-columns: repeat(5,minmax(0,1fr)); } }
@media (min-width: 3001px) { .media-grid { grid-template-columns: repeat(6,minmax(0,1fr)); } }

/* 720p and other short landscape screens retain a complete, unclipped UI. */
@media (max-height: 760px) and (min-width: 901px) {
  .topbar { height: 72px; }
  .home-screen, .category-screen, .section-placeholder, .settings-screen,
  .media-screen, .tv-layout { height: calc(100vh - 72px); }
  @supports (height: 100dvh) {
    .home-screen, .category-screen, .section-placeholder, .settings-screen,
    .media-screen, .tv-layout { height: calc(100dvh - 72px); }
  }
  .brand-mark { width: 40px; height: 40px; }
  .round-button { width: 44px; height: 44px; }
  .channel-browser { padding-top: 12px; padding-bottom: 8px; }
  .content-header { padding-bottom: 8px; }
  .content-header h1 { font-size: 34px; }
  .channel-grid { gap: 6px; }
  .channel-card { min-height: 76px; padding: 7px 10px; }
  .channel-logo { width: 46px; height: 46px; }
  .channel-logo img { width: 38px; height: 38px; }
  .channel-meta { gap: 3px; }
  .channel-meta b { font-size: 18px; }
  .channel-now { font-size: 14px; }
  .browser-footer { min-height: 38px; }
  .media-screen { padding-top: 10px; padding-bottom: 8px; }
  .media-browser { padding-top: 16px; padding-bottom: 10px; }
  .media-grid { gap: 12px; }
  .media-copy { padding: 11px; gap: 7px; }
  .media-copy b { font-size: 16px; }
  .media-footer { min-height: 36px; margin-top: 5px; }
}

/* 2K/4K browsers that expose physical viewport pixels get larger TV controls. */
@media (min-width: 2200px) and (min-height: 1200px) {
  body { font-size: 20px; }
  .topbar { height: 112px; }
  .home-screen, .category-screen, .section-placeholder, .settings-screen,
  .media-screen, .tv-layout { height: calc(100vh - 112px); }
  @supports (height: 100dvh) {
    .home-screen, .category-screen, .section-placeholder, .settings-screen,
    .media-screen, .tv-layout { height: calc(100dvh - 112px); }
  }
  .brand-mark { width: 62px; height: 62px; border-radius: 18px; }
  .brand > span:last-child { font-size: 32px; }
  .brand small { font-size: 14px; }
  .back-button { min-height: 66px; font-size: 22px; }
  .topbar-center { font-size: 25px; }
  .clock, #playerClock { font-size: 36px; }
  .round-button { width: 66px; height: 66px; font-size: 28px; }
  .home-heading h1 { font-size: clamp(64px,3vw,92px); }
  .home-heading p { font-size: 27px; }
  .home-grid { height: min(31vh,440px); gap: 28px; }
  .home-tile { padding: 34px; border-radius: 28px; }
  .home-tile > span { font-size: 68px; }
  .home-tile b { font-size: 36px; }
  .home-tile small, .home-help { font-size: 22px; }
  .category-chooser { grid-auto-rows: minmax(100px,1fr); gap: 16px; }
  .category-choice { min-height: 100px; max-height: 122px; font-size: 32px; border-radius: 22px; }
  .media-screen.mode-categories .nav-item { min-height: 104px; font-size: 31px; }
  .media-browser { padding: 38px; }
  .media-grid { gap: 24px; }
  .media-copy { padding: 22px; gap: 15px; }
  .media-copy b { font-size: 24px; }
  .media-copy small, .media-copy .media-data-badge { font-size: 19px; }
  .media-copy .media-genre { font-size: 20px; }
  .content-header h1 { font-size: 68px; }
  .search-box { width: min(480px,30vw); min-height: 68px; }
  .search-box input { font-size: 24px; }
  .channel-card { min-height: 138px; grid-template-columns: 84px minmax(0,1fr) auto 58px; padding: 18px; }
  .channel-logo { width: 76px; height: 76px; }
  .channel-logo img { width: 64px; height: 64px; }
  .channel-meta b { font-size: 28px; }
  .channel-now { font-size: 21px; }
  .mini-info h2 { font-size: 31px; }
  .mini-details p { font-size: 24px; }
  .mini-details > small, .remote-legend, .dialog-legend, .player-legend { font-size: 20px; }
}

/* Foldables, tablets and narrow browser windows switch to scroll-safe flow. */
@media (max-width: 900px) {
  html, body { width: 100%; min-height: 100%; overflow-x: hidden; }
  .app-shell { width: 100%; }
  .home-screen, .category-screen, .section-placeholder, .settings-screen,
  .media-screen, .tv-layout { height: auto; min-height: calc(100dvh - 88px); }
  .topbar { position: sticky; top: 0; z-index: 50; }
  .media-layout { height: auto; min-height: calc(100dvh - 120px); }
  .media-browser { min-height: calc(100dvh - 120px); }
  .category-page-card { min-height: calc(100dvh - 128px); }
  .media-card { grid-template-columns: clamp(108px,34%,160px) minmax(0,1fr); }
  .media-art img { object-fit: contain; }
  .player-topbar, .player-bottom {
    padding-left: max(18px,env(safe-area-inset-left));
    padding-right: max(18px,env(safe-area-inset-right));
  }
}
@media (max-width: 600px) {
  .home-screen, .category-screen, .section-placeholder, .settings-screen,
  .media-screen, .tv-layout { min-height: calc(100dvh - 72px); }
  .brand > span:last-child { font-size: 20px; }
  .brand small { display: none; }
  .back-button { min-height: 44px; padding: 0 12px; font-size: 14px; }
  .home-screen { padding-top: 28px; padding-bottom: max(28px,env(safe-area-inset-bottom)); }
  .home-grid { gap: 12px; }
  .home-tile { min-height: 150px; padding: 18px; }
  .home-tile > span { font-size: 40px; }
  .home-tile b { font-size: 23px; }
  .home-tile small { font-size: 15px; }
  .media-card { grid-template-columns: minmax(105px,34%) minmax(0,1fr); }
  .media-copy { padding: 13px; gap: 9px; }
  .media-copy b { font-size: 17px; min-height: 0; }
  .media-screen.mode-detail .media-detail { min-height: calc(100dvh - 110px); }
}
@media (orientation: landscape) and (max-height: 600px) and (max-width: 1200px) {
  .home-screen { justify-content: flex-start; overflow-y: auto; }
  .home-grid { grid-template-columns: repeat(5,minmax(150px,1fr)); overflow-x: auto; padding: 5px; }
  .home-tile { min-height: 170px; }
  .mini-player { display: none; }
}

/* Low-power Smart TV mode, enabled automatically by the MSX launch URL. */
.performance-mode *, .performance-mode *::before, .performance-mode *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
.performance-mode .topbar, .performance-mode dialog::backdrop,
.performance-mode .player-epg {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.performance-mode button:focus-visible, .performance-mode input:focus-visible,
.performance-mode [tabindex="0"]:focus-visible,
.performance-mode .category-choice:focus-visible,
.performance-mode .media-screen.mode-categories .nav-item:focus-visible {
  transform: none !important;
  box-shadow: 0 0 0 4px var(--focus) !important;
}
.performance-mode .home-tile, .performance-mode .category-choice,
.performance-mode .media-card, .performance-mode .channel-card,
.performance-mode .mini-player, .performance-mode .media-layout {
  box-shadow: none !important;
  background-image: none !important;
  background-color: #111d2a !important;
}
.performance-mode .category-choice, .performance-mode .nav-item {
  content-visibility: auto;
  contain-intrinsic-size: auto 82px;
}
.performance-mode .channel-card:hover, .performance-mode .home-tile:hover,
.performance-mode .nav-item:hover, .performance-mode .category-choice:hover {
  transform: none !important;
  box-shadow: none !important;
}
