/* LineTV — "control room" dark theme.
   Palette: blue-graphite ink, phosphor cyan for selection/progress,
   tally red for on-air, amber for replay (archive). Type: Onest. */

@font-face {
  font-family: "Onest";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../vendor/fonts/onest-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../vendor/fonts/onest-cyrillic-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../vendor/fonts/onest-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../vendor/fonts/onest-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #0f1420;
  --panel: #151b29;
  --raised: #1c2335;
  --hover: #222a3f;
  --line: #283149;
  --line-soft: rgba(140, 160, 200, 0.10);
  --text: #e8ecf4;
  --muted: #8b95ab;
  --faint: #5d6780;
  --signal: #4fd1e8;
  --signal-soft: rgba(79, 209, 232, 0.14);
  --tally: #ff4b55;
  --tally-soft: rgba(255, 75, 85, 0.16);
  --replay: #f2b34b;
  --replay-soft: rgba(242, 179, 75, 0.16);
  --ok: #43d19e;

  --rail-w: 76px;
  --browser-w: 352px;
  --r-s: 6px;
  --r-m: 10px;
  --r-l: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 400 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
svg { width: 20px; height: 20px; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.tnum, .tl-time, .clock, .nn-when, .epg-time, .count { font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px;
  border-radius: var(--r-m); border: 1px solid var(--line);
  background: var(--raised); color: var(--text);
  font-weight: 550; font-size: 13.5px; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--hover); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--signal); border-color: var(--signal); color: #062029; }
.btn-primary:hover { background: #7fe0f0; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--raised); color: var(--text); }
.icon-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: var(--r-m);
  border: 0; background: transparent; color: var(--text);
  transition: background .15s, color .15s, opacity .15s;
}
.icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); }
.icon-btn:disabled { opacity: .32; }
.icon-btn .badge {
  position: absolute; right: 1px; top: 3px;
  font-size: 9.5px; font-weight: 700; line-height: 1;
  padding: 2px 3px; border-radius: 4px; background: var(--signal); color: #062029;
}
.icon-btn .badge:empty { display: none; }

/* ---------- layout ---------- */
.app {
  --left-w: var(--browser-w);
  --right-w: 380px;
  display: grid;
  grid-template-columns: var(--rail-w) var(--left-w) minmax(0, 1fr) var(--right-w);
  grid-template-areas: "rail browser stage side";
  height: 100vh; height: 100dvh;
}
.app.left-compact { --left-w: 92px; }
.app.left-hidden { --left-w: 0px; }
.app.right-closed { --right-w: 0px; }
.app.left-hidden .browser { display: none; }
.app.right-closed .side { display: none; }
.app.is-resizing, .app.is-resizing * { cursor: col-resize !important; user-select: none !important; }
.app.is-resizing video { pointer-events: none; }

/* resizers */
.browser, .side { position: relative; }
.resizer { position: absolute; top: 0; bottom: 0; width: 8px; z-index: 6; cursor: col-resize; touch-action: none; }
.resizer::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background .15s; }
.resizer:hover::after, .app.is-resizing .resizer::after { background: var(--signal); }
.resizer-left { right: -4px; }
.resizer-right { left: -4px; }
.app.left-compact .resizer-left { display: none; }

/* panel buttons in the list header */
.panel-btns { display: flex; gap: 2px; margin-left: auto; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; color: var(--muted); }
.icon-btn.sm svg { width: 18px; height: 18px; }
.icon-btn.sm:hover { color: var(--text); }
#leftExpand { display: none; }
.app.left-compact #leftExpand { display: inline-grid; }
.app.left-compact #leftCompact { display: none; }

/* compact list: logos + numbers only */
.app.left-compact .browser-head { padding: 12px 6px 8px; }
.app.left-compact .browser-title { flex-direction: column; align-items: center; gap: 4px; }
.app.left-compact .browser-title h1, .app.left-compact .count, .app.left-compact .search, .app.left-compact .filters { display: none; }
.app.left-compact .panel-btns { flex-direction: column; margin: 0; }
.app.left-compact .channel-scroll { padding: 4px 6px 16px; }
.app.left-compact .ch { grid-template-columns: 1fr; justify-items: center; padding: 0; position: relative; }
.app.left-compact .ch-body, .app.left-compact .ch-fav { display: none; }
.app.left-compact .ch-num { position: absolute; left: 2px; top: 2px; font-size: 10px; text-align: left; }
.app.left-compact .ch.is-active { box-shadow: inset 0 0 0 2px var(--signal); }

/* channel list over the video (does not shrink the picture) */
.list-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(3, 6, 12, .35); }
.app.list-overlay .browser {
  display: flex !important;
  position: fixed; z-index: 40; top: 0; bottom: 0; left: var(--rail-w);
  width: min(380px, 92vw);
  box-shadow: 18px 0 50px rgba(0, 0, 0, .5);
  animation: drawer-in-left .2s var(--ease);
}
.app.list-overlay.video-only .browser { left: 0; }
.app.list-overlay .resizer-left { display: none; }
@keyframes drawer-in-left { from { opacity: 0; transform: translateX(-16px); } }

/* video only */
.app.video-only { --left-w: 0px !important; --right-w: 0px !important; grid-template-columns: 0 0 minmax(0, 1fr) 0; }
.app.video-only .rail, .app.video-only .side, .app.video-only .nownext { display: none; }
.app.video-only:not(.list-overlay) .browser { display: none; }
#btnVideoOnly.is-on { color: var(--signal); }

/* docked side panel */
.side {
  grid-area: side; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--panel); border-left: 1px solid var(--line-soft);
}
.side-head { display: flex; align-items: center; gap: 6px; padding: 10px 8px 8px 12px; border-bottom: 1px solid var(--line-soft); }
.side-tabs { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.side-tab {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 34px; padding: 0 9px; border-radius: 9px; border: 0;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 580;
}
.side-tab svg { width: 17px; height: 17px; }
.side-tab:hover { background: var(--raised); color: var(--text); }
.side-tab.is-on { background: var(--raised); color: var(--text); box-shadow: inset 0 -2px 0 var(--signal); }
.side-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
#paneInfo { overflow-y: auto; padding-bottom: 12px; }
.pane-title { padding: 14px 18px 10px; }
.pane-title h2 { margin: 0; font-size: 16px; font-weight: 650; }
.pane-h { margin: 14px 18px 6px; font-size: 13px; font-weight: 650; color: var(--muted); }
#paneInfo .diag-grid { flex: none; overflow: visible; }
.epg-sources { margin: 4px 18px 0; display: grid; gap: 8px; }
.epg-source { padding: 10px 12px; border-radius: var(--r-m); background: var(--ink); border: 1px solid var(--line-soft); font-size: 12.5px; }
.epg-source b { display: block; font-size: 13px; margin-bottom: 2px; overflow-wrap: anywhere; }
.epg-source.is-error { border-color: rgba(255, 75, 85, .45); }
.epg-source.is-error .src-state { color: var(--tally); }
.epg-source.is-ok .src-state { color: var(--ok); }
.epg-source.is-loading .src-state { color: var(--replay); }

/* archive pane */
.arch-status { margin: 0 18px 10px; padding: 10px 12px; border-radius: var(--r-m); background: var(--ink); border: 1px solid var(--line-soft); font-size: 13px; }
.arch-status b { display: block; margin-bottom: 2px; }
.arch-status.is-ok { border-color: rgba(67, 209, 158, .45); }
.arch-status.is-ok b { color: var(--ok); }
.arch-status.is-fail { border-color: rgba(255, 75, 85, .45); }
.arch-status.is-fail b { color: var(--tally); }
.arch-status.is-unknown b { color: var(--replay); }
.arch-status .btn { margin-top: 8px; height: 32px; }
.arch-pick { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 0 18px 10px; }
.field-inline { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.field-inline input { height: 36px; padding: 0 10px; border-radius: 9px; background: var(--ink); border: 1px solid var(--line); color: var(--text); color-scheme: dark; }
.arch-pick .btn { height: 36px; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; padding: 4px 2px; }
.slot { height: 34px; border-radius: 8px; border: 1px solid var(--line); background: transparent; font-variant-numeric: tabular-nums; font-size: 13px; }
.slot:hover:not(:disabled) { border-color: var(--replay); color: var(--replay); }
.slot:disabled { opacity: .3; }
.slot.is-watching { background: var(--replay); color: #2b1d02; border-color: var(--replay); }
.list-note { padding: 6px 10px 10px; color: var(--muted); font-size: 12.5px; }
.ch-rec.is-declared { background: transparent; box-shadow: inset 0 0 0 1.5px var(--replay); }
.ch-rec.is-failed { display: none; }

/* rail */
.rail {
  grid-area: rail;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 0;
  background: var(--ink);
  border-right: 1px solid var(--line-soft);
}
.rail-logo { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 14px; }
.rail-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 64px; padding: 9px 0 7px; border: 0; border-radius: var(--r-m);
  background: transparent; color: var(--faint);
  font-size: 10.5px; font-weight: 550;
  transition: color .15s, background .15s;
}
.rail-btn svg { width: 22px; height: 22px; }
.rail-btn:hover { color: var(--text); background: var(--panel); }
.rail-btn.is-active { color: var(--signal); background: var(--signal-soft); }
.rail-spacer { flex: 1; }

/* browser (channel list) */
.browser {
  grid-area: browser;
  display: flex; flex-direction: column; min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--line-soft);
}
.browser-head { padding: 18px 16px 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.browser-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.browser-title h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.count { color: var(--faint); font-size: 12.5px; }
.search {
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px; border-radius: var(--r-m);
  background: var(--ink); border: 1px solid var(--line);
  color: var(--faint);
  transition: border-color .15s;
}
.search:focus-within { border-color: var(--signal); color: var(--signal); }
.search input { flex: 1; min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.search input::placeholder { color: var(--faint); }
.search svg { width: 18px; height: 18px; }
.filters { display: flex; gap: 8px; min-width: 0; }
select, .field input {
  height: 38px; padding: 0 12px; border-radius: var(--r-m);
  background: var(--ink); border: 1px solid var(--line); color: var(--text); outline: 0;
}
.filters select {
  flex: 1; min-width: 0;
  appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b95ab' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
select:focus, .field input:focus { border-color: var(--signal); }
.seg { display: flex; padding: 3px; gap: 2px; border-radius: var(--r-m); background: var(--ink); border: 1px solid var(--line); }
.seg button { display: grid; place-items: center; width: 34px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--faint); }
.seg button svg { width: 17px; height: 17px; }
.seg button.is-on { background: var(--raised); color: var(--text); }

.channel-scroll { position: relative; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 4px 8px 16px; overscroll-behavior: contain; }
.channel-scroll:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--line); }

/* channel row */
.ch {
  display: grid;
  grid-template-columns: 30px 44px minmax(0, 1fr) 28px;
  align-items: center; gap: 10px;
  padding: 0 6px 0 4px;
  border-radius: var(--r-m);
  cursor: pointer; user-select: none;
  contain: layout paint;
}
.ch:hover { background: var(--hover); }
.ch.is-active { background: var(--raised); box-shadow: inset 3px 0 0 var(--signal); }
.ch-num { color: var(--faint); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.ch-logo {
  position: relative; width: 44px; height: 44px; border-radius: 9px; overflow: hidden;
  display: grid; place-items: center;
  background: #e9edf5;
}
.ch-logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.ch-logo .initials { font-weight: 700; font-size: 15px; color: #fff; letter-spacing: .02em; }
.ch-logo.is-fallback { background: var(--fb, #33405e); }
.ch-body { min-width: 0; display: grid; gap: 3px; }
.ch-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 580; font-size: 14px; }
.ch-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-rec { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--replay); }
.ch-prog { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-bar { height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.ch-bar i { display: block; height: 100%; width: 0; background: var(--muted); border-radius: 2px; }
.ch.is-active .ch-bar i { background: var(--signal); }
.ch-fav { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 7px; background: transparent; color: var(--faint); opacity: 0; transition: opacity .15s; }
.ch-fav svg { width: 17px; height: 17px; }
.ch:hover .ch-fav, .ch-fav.is-on { opacity: 1; }
.ch-fav.is-on { color: var(--replay); }
.ch-fav:hover { background: rgba(255, 255, 255, .06); color: var(--text); }

/* playing indicator (equalizer) */
.eq { display: none; gap: 2px; align-items: flex-end; height: 12px; flex: none; }
.eq i { width: 3px; background: var(--signal); border-radius: 1px; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.35s; }
.eq i:nth-child(3) { animation-delay: -.7s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 12px; } }
.ch.is-active.is-playing .eq { display: inline-flex; }
.ch.is-active.is-loading .ch-num::after { content: ""; display: inline-block; width: 10px; height: 10px; border: 2px solid var(--signal); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
.ch.is-active.is-loading .ch-num span { display: none; }
.ch.is-active.is-error { box-shadow: inset 3px 0 0 var(--tally); }

/* grid tiles */
.grid-mode .ch {
  grid-template-columns: 1fr; grid-template-rows: 1fr auto;
  justify-items: center; align-content: center; gap: 6px;
  padding: 8px 6px; background: var(--ink); border: 1px solid var(--line-soft);
}
.grid-mode .ch:hover { background: var(--raised); }
.grid-mode .ch.is-active { box-shadow: inset 0 0 0 2px var(--signal); }
.grid-mode .ch-num, .grid-mode .ch-fav { display: none; }
.grid-mode .ch-logo { width: 56px; height: 56px; }
.grid-mode .ch-name { font-size: 12px; font-weight: 550; max-width: 100%; justify-content: center; }

.empty, .onboard { padding: 28px 22px; color: var(--muted); }
.empty h2, .onboard h2 { margin: 0 0 8px; color: var(--text); font-size: 17px; font-weight: 650; }
.empty p, .onboard p { margin: 0 0 16px; max-width: 34ch; }
.onboard form { display: grid; gap: 10px; }
.onboard input { height: 42px; padding: 0 12px; border-radius: var(--r-m); background: var(--ink); border: 1px solid var(--line); color: var(--text); outline: 0; }
.onboard input:focus { border-color: var(--signal); }
.onboard .btn { justify-content: center; height: 42px; }

/* ---------- stage ---------- */
.stage { grid-area: stage; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #000; }
.screen { position: relative; flex: 1; min-height: 0; background: #000; overflow: hidden; outline: 0; }
.screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.screen::before, .screen::after {
  content: ""; position: absolute; left: 0; right: 0; pointer-events: none; z-index: 1;
  opacity: 0; transition: opacity .3s;
}
.screen::before { top: 0; height: 140px; background: linear-gradient(rgba(5, 8, 14, .78), transparent); }
.screen::after { bottom: 0; height: 190px; background: linear-gradient(transparent, rgba(5, 8, 14, .9)); }
.screen.ui-on::before, .screen.ui-on::after { opacity: 1; }
.screen.ui-off { cursor: none; }

.screen-top {
  position: absolute; z-index: 3; left: 0; right: 0; top: 0;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 20px;
  opacity: 0; transform: translateY(-6px); transition: opacity .25s, transform .25s var(--ease);
  pointer-events: none;
}
.screen.ui-on .screen-top { opacity: 1; transform: none; pointer-events: auto; }
.on-air { display: flex; align-items: center; gap: 12px; min-width: 0; }
.on-air img { width: 44px; height: 44px; border-radius: 9px; object-fit: contain; background: #e9edf5; padding: 4px; flex: none; }
.on-air-text { min-width: 0; }
.on-air-name { font-size: 17px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 6px rgba(0, 0, 0, .5); }
.on-air-meta { color: #b9c1d3; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tally {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  height: 26px; padding: 0 11px 0 9px; border-radius: 13px;
  background: var(--tally); color: #fff; font-size: 12px; font-weight: 650;
  box-shadow: 0 0 0 4px var(--tally-soft), 0 0 22px rgba(255, 75, 85, .45);
}
.tally::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.tally.is-replay { background: var(--replay); color: #2b1d02; box-shadow: 0 0 0 4px var(--replay-soft); }
.tally.is-replay::before { background: #2b1d02; }
.screen-actions { display: flex; gap: 4px; }
#btnList { flex: none; }
.icon-btn.glass, .screen-actions .icon-btn { background: rgba(10, 14, 22, .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

.screen-center { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; pointer-events: none; padding: 24px; }
.screen-center > * { pointer-events: auto; grid-area: 1 / 1; }
.status {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-radius: 999px;
  background: rgba(10, 14, 22, .72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-weight: 550; font-size: 14px;
}
.spinner { width: 20px; height: 20px; border: 2.5px solid rgba(255, 255, 255, .2); border-top-color: var(--signal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.idle-hint { display: grid; justify-items: center; gap: 10px; color: var(--faint); pointer-events: none; }
.idle-hint svg { width: 46px; height: 46px; }
.idle-hint p { margin: 0; font-size: 15px; }
.error-card {
  width: min(460px, 100%); padding: 22px 22px 18px; border-radius: var(--r-l);
  background: rgba(21, 27, 41, .94); border: 1px solid var(--line); border-top: 3px solid var(--tally);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.error-card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 650; }
.error-card p { margin: 0 0 16px; color: var(--muted); }
.error-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.unmute {
  align-self: end; margin-bottom: 120px;
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 999px; border: 0; background: var(--text); color: var(--ink); font-weight: 650;
}
.unmute svg { width: 18px; height: 18px; }

.osd {
  position: absolute; z-index: 4; right: 24px; top: 72px;
  padding: 10px 16px; border-radius: var(--r-m);
  background: rgba(10, 14, 22, .8); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.osd small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }

/* controls */
.controls {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 0;
  padding: 0 16px 12px;
  opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s var(--ease);
  pointer-events: none;
}
.screen.ui-on .controls { opacity: 1; transform: none; pointer-events: auto; }
.timeline { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.tl-time { color: #c3cadb; font-size: 12px; min-width: 40px; }
.tl-time:last-child { text-align: right; }
.tl-track { position: relative; flex: 1; height: 22px; cursor: pointer; touch-action: none; }
.tl-track::before { content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .18); transition: height .15s, top .15s; }
.tl-avail, .tl-fill { position: absolute; left: 0; top: 9px; height: 4px; border-radius: 2px; width: 0; transition: height .15s, top .15s; }
.tl-avail { background: rgba(255, 255, 255, .34); }
.tl-fill { background: var(--signal); }
.tl-track:hover::before, .tl-track:hover .tl-avail, .tl-track:hover .tl-fill { top: 8px; height: 6px; }
.screen.is-replay .tl-fill { background: var(--replay); }
.tl-now { position: absolute; top: 4px; width: 2px; height: 14px; margin-left: -1px; border-radius: 1px; background: var(--tally); left: 0; display: none; }
.screen.is-replay .tl-now { display: block; }
.tl-track.is-disabled { cursor: default; }
.tl-tip { position: absolute; bottom: 24px; transform: translateX(-50%); padding: 3px 7px; border-radius: 6px; background: var(--text); color: var(--ink); font-size: 12px; font-weight: 650; white-space: nowrap; pointer-events: none; }
.ctrl-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.ctrl-group { display: flex; align-items: center; gap: 4px; min-width: 0; }
.ctrl-right { justify-content: flex-end; }
.volume { display: flex; align-items: center; }
.volume input { width: 0; opacity: 0; transition: width .2s var(--ease), opacity .2s; accent-color: var(--signal); }
.volume:hover input, .volume input:focus-visible { width: 86px; opacity: 1; margin-right: 6px; }
.live-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; margin-left: 4px;
  border-radius: 15px; border: 1px solid rgba(255, 255, 255, .18); background: transparent;
  font-size: 12.5px; font-weight: 650; color: #fff; white-space: nowrap; flex: none;
}
.live-btn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tally); }
.live-btn:disabled { border-color: transparent; padding-left: 4px; }
.live-btn:not(:disabled) .dot { background: var(--faint); }
.live-btn:not(:disabled):hover { background: var(--tally); border-color: var(--tally); }
.live-btn:not(:disabled):hover .dot { background: #fff; }
.clock { color: #c3cadb; font-size: 12.5px; margin-left: 6px; white-space: nowrap; }
.archive-group { gap: 6px; }
.chip-btn {
  height: 30px; padding: 0 9px; border-radius: 8px; white-space: nowrap; flex: none;
  border: 1px solid rgba(255, 255, 255, .14); background: rgba(10, 14, 22, .4);
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.chip-btn:hover:not(:disabled) { border-color: var(--replay); color: var(--replay); }
.chip-btn:disabled { opacity: .3; }

/* now / next strip */
.nownext {
  flex: none;
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto; gap: 28px; align-items: start;
  padding: 16px 24px 18px;
  background: var(--ink); border-top: 1px solid var(--line-soft);
}
.nn-when { color: var(--muted); font-size: 12.5px; margin-bottom: 3px; }
.nn-cur .nn-when { color: var(--signal); }
.nn-title { font-size: 17px; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nn-next .nn-title { font-size: 15px; color: #c3cadb; font-weight: 520; }
.nn-desc { margin: 4px 0 0; color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 72ch; }
.nn-desc:empty { display: none; }
.nn-actions { display: flex; gap: 4px; }
.nn-actions .btn.is-on { color: var(--replay); }
.app.is-fullscreen .nownext { display: none; }

/* drawers inside the screen */
.drawer {
  position: absolute; z-index: 5; top: 12px; right: 12px; bottom: 12px;
  width: min(380px, calc(100% - 24px));
  display: flex; flex-direction: column;
  background: rgba(21, 27, 41, .96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  animation: drawer-in .22s var(--ease);
}
@keyframes drawer-in { from { opacity: 0; transform: translateX(16px); } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 12px 10px 18px; }
.drawer-head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.drawer-sub { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.day-tabs { display: flex; gap: 6px; padding: 0 14px 10px; overflow-x: auto; scrollbar-width: none; flex: none; }
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab { flex: none; height: 30px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 550; }
.day-tab.is-on { background: var(--text); border-color: var(--text); color: var(--ink); }
.epg-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; overscroll-behavior: contain; }
.epg-row {
  display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 2px 10px;
  width: 100%; padding: 9px 10px; border: 0; border-radius: var(--r-m); background: transparent; text-align: left;
}
.epg-row.is-clickable:hover { background: var(--hover); }
.epg-row.is-future { cursor: default; }
.epg-time { color: var(--muted); font-size: 13px; padding-top: 1px; }
.epg-title { font-size: 13.5px; font-weight: 520; color: var(--text); }
.epg-row.is-past .epg-title { color: #b4bccd; }
.epg-row.is-future .epg-title { color: var(--muted); }
.epg-desc { grid-column: 2; color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.epg-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; margin-left: 6px; border-radius: 5px; font-size: 11px; font-weight: 650; vertical-align: 1px; }
.epg-tag.live { background: var(--tally); color: #fff; }
.epg-tag.rec { background: var(--replay-soft); color: var(--replay); }
.epg-tag.watching { background: var(--replay); color: #2b1d02; }
.epg-row.is-now { background: var(--signal-soft); }
.epg-row.is-now .epg-time { color: var(--signal); }
.epg-row.is-watching { box-shadow: inset 3px 0 0 var(--replay); }
.epg-prog { grid-column: 2; height: 3px; margin-top: 5px; border-radius: 2px; background: var(--line); overflow: hidden; }
.epg-prog i { display: block; height: 100%; background: var(--signal); }
.epg-empty { padding: 24px 12px; color: var(--muted); }
.epg-bind { padding: 0 12px 16px; display: grid; gap: 8px; text-align: left; min-width: 0; }
.epg-bind-row { display: flex; gap: 6px; min-width: 0; }
.epg-bind-row input { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border-radius: 9px; background: var(--ink); border: 1px solid var(--line); color: var(--text); color-scheme: dark; }
.epg-bind-row input:focus { border-color: var(--signal); outline: 0; }
.epg-bind-row .btn { flex: none; height: 36px; }
.link-btn.epg-bind-open { justify-self: start; }
.epg-bind-row[hidden] { display: none; }
.link-btn.epg-unbind { display: block; margin: 4px 0 0; text-align: left; }
.link-btn.epg-unbind[hidden] { display: none; }

.diag-grid { margin: 0; padding: 4px 18px 8px; overflow-y: auto; flex: 1; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 14px; align-content: start; font-size: 13px; }
.diag-grid dt { color: var(--muted); }
.diag-grid dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.diag-grid dd.bad { color: var(--tally); }
.diag-grid dd.good { color: var(--ok); }
.diag-warn { margin: 0 18px 10px; padding: 10px 12px; border-radius: var(--r-m); background: var(--replay-soft); color: #f7d18f; font-size: 12.5px; }
.diag-warn p { margin: 0 0 4px; }
.drawer-actions { display: flex; gap: 8px; padding: 10px 18px 4px; flex-wrap: wrap; }
.drawer-note { margin: 4px 18px 14px; color: var(--faint); font-size: 12px; }

/* ---------- guide ---------- */
.guide {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  background: var(--ink);
  animation: fade-in .18s ease;
}
@keyframes fade-in { from { opacity: 0; } }
.guide-head { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.guide-head h2 { margin: 0; font-size: 19px; font-weight: 650; flex: none; }
.guide-head .day-tabs { padding: 0; flex: 1; min-width: 0; }
.guide-tools { display: flex; gap: 8px; align-items: center; flex: none; }
.guide-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.guide-ruler { position: relative; height: 34px; flex: none; overflow: hidden; border-bottom: 1px solid var(--line-soft); background: var(--panel); }
.guide-ruler span { position: absolute; top: 9px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; transform: translateX(6px); white-space: nowrap; }
.guide-ruler span::before { content: ""; position: absolute; left: -6px; top: -9px; height: 34px; border-left: 1px solid var(--line-soft); }
.guide-scroll { position: relative; flex: 1; overflow: auto; overscroll-behavior: contain; }
.guide-canvas { position: relative; }
.g-row { position: absolute; left: 0; height: 64px; border-bottom: 1px solid var(--line-soft); }
.g-ch {
  position: sticky; left: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  width: 200px; height: 100%; padding: 0 12px;
  background: var(--panel); border-right: 1px solid var(--line); cursor: pointer;
}
.g-ch:hover { background: var(--hover); }
.g-ch.is-active { box-shadow: inset 3px 0 0 var(--signal); }
.g-ch .ch-logo { width: 38px; height: 38px; }
.g-ch-name { font-size: 13px; font-weight: 580; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-prog {
  position: absolute; top: 5px; bottom: 5px;
  padding: 7px 10px; border-radius: 8px; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line-soft);
  text-align: left; color: var(--text);
}
.g-prog:hover { background: var(--hover); }
.g-prog.is-past { color: #a7b0c3; }
.g-prog.is-now { background: var(--signal-soft); border-color: rgba(79, 209, 232, .35); }
.g-prog.is-watching { border-color: var(--replay); }
.g-prog.is-future { color: var(--muted); cursor: default; }
.g-prog b { display: block; font-size: 12.5px; font-weight: 580; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-prog small { display: block; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.g-nowline { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--tally); z-index: 1; pointer-events: none; }
.g-empty { position: absolute; top: 5px; bottom: 5px; display: flex; align-items: center; padding: 0 12px; color: var(--faint); font-size: 12.5px; }

/* ---------- settings dialog ---------- */
.settings {
  width: min(560px, calc(100vw - 24px)); padding: 0; border-radius: var(--r-l);
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.settings::backdrop { background: rgba(3, 6, 12, .7); }
.settings-body { display: grid; gap: 14px; padding: 4px 18px 8px; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field select { width: 100%; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; }
.check input { margin-top: 3px; accent-color: var(--signal); width: 16px; height: 16px; }
.field-note { margin: 0; color: var(--faint); font-size: 12.5px; }
.field-row { display: flex; gap: 6px; align-items: center; min-width: 0; }
.field-row input { flex: 1; min-width: 0; }
.field-refresh { flex: none; width: 38px; height: 38px; border: 1px solid var(--line); background: var(--ink); color: var(--muted); }
.field-refresh:hover:not(:disabled) { color: var(--signal); border-color: var(--signal); }
.field-refresh svg { width: 18px; height: 18px; }
.field-refresh.is-busy { opacity: 1; color: var(--signal); border-color: var(--signal); cursor: progress; }
.field-refresh.is-busy svg { animation: ltv-spin .8s linear infinite; }
@keyframes ltv-spin { to { transform: rotate(-360deg); } }
@media (prefers-reduced-motion: reduce) { .field-refresh.is-busy svg { animation-duration: 2.4s; } }
.settings-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 12px 18px 16px; border-top: 1px solid var(--line-soft); margin-top: 8px; }
.settings-foot .btn-primary { margin-left: auto; }

/* ---------- popover menu ---------- */
.menu {
  position: fixed; z-index: 80; min-width: 200px; max-height: 60vh; overflow-y: auto;
  padding: 6px; border-radius: var(--r-m);
  background: var(--raised); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(0, 0, 0, .5);
}
.menu h4 { margin: 4px 10px 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.menu button { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; text-align: left; font-size: 13.5px; }
.menu button:hover { background: var(--hover); }
.menu button.is-on { color: var(--signal); }
.menu button.is-on::after { content: "✓"; }
.menu small { color: var(--muted); font-size: 12px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; width: min(520px, calc(100vw - 32px)); }
.toast { pointer-events: auto; padding: 10px 16px; border-radius: var(--r-m); background: var(--text); color: var(--ink); font-weight: 550; font-size: 13.5px; box-shadow: 0 12px 30px rgba(0, 0, 0, .4); animation: toast-in .2s var(--ease); }
.toast.is-error { background: var(--tally); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- fullscreen ---------- */
.app.is-fullscreen { grid-template-columns: 1fr; grid-template-areas: "stage"; }
.app.is-fullscreen .rail, .app.is-fullscreen .browser { display: none; }

/* ---------- tablet & phone ---------- */
@media (max-width: 1100px) {
  :root { --browser-w: 300px; }
  .nownext { grid-template-columns: minmax(0, 1fr) auto; }
  .nn-next { display: none; }
}
@media (max-width: 900px) {
  body { overflow: hidden; }
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "stage" "browser" "rail";
  }
  .stage { display: contents; }
  .screen { grid-area: stage; flex: none; aspect-ratio: 16 / 9; max-height: 56vh; width: 100%; }
  .nownext { grid-area: nownext; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 10px 14px; }
  .nn-desc { display: none; }
  .nn-title { font-size: 15px; }
  .nn-actions .btn span { display: none; }
  .nn-actions .btn { padding: 0 10px; }
  .browser { border-right: 0; }
  .browser-head { padding: 12px 12px 8px; gap: 8px; }
  .browser-title { display: none; }
  .rail {
    flex-direction: row; justify-content: space-around; padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line-soft); background: var(--panel);
  }
  .rail-logo, .rail-spacer { display: none; }
  .rail-btn { width: auto; flex: 1; padding: 7px 0 5px; }
  .ch-fav { opacity: 1; }
  .screen-top { padding: 10px 12px; }
  .on-air img { width: 34px; height: 34px; }
  .on-air-name { font-size: 15px; }
  .controls { padding: 0 8px 4px; }
  .archive-group .chip-btn[data-shift="-60"], .archive-group .chip-btn[data-shift="60"] { display: none; }
  .clock, .volume input { display: none; }
  .drawer { top: 6px; right: 6px; bottom: 6px; }
  .app.is-fullscreen .screen { aspect-ratio: auto; max-height: none; height: 100%; }
  .app.is-fullscreen { grid-template-rows: 1fr; }
  .app.is-fullscreen .nownext, .app.is-fullscreen .rail { display: none; }
  .g-ch { width: 132px; }
  .app { --left-w: auto; --right-w: 0px; }
  .side {
    position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; height: 62vh;
    border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0;
    box-shadow: 0 -20px 50px rgba(0, 0, 0, .5);
  }
  .resizer { display: none; }
  .panel-btns, #btnList { display: none; }
  .app.left-hidden .browser, .app.left-compact .browser { display: flex; }
  .guide-head { flex-wrap: wrap; gap: 10px; }
  .guide-head .day-tabs { order: 3; flex-basis: 100%; }
}
@media (max-width: 520px) {
  .ctrl-row { gap: 4px; }
  .archive-group { display: none; }
  .archive-group.is-on { display: flex; }
  #btnPip { display: none; }
  .screen-actions .icon-btn { width: 36px; height: 36px; }
  .error-card { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* player controls adapt to the width of the video area (side panels can make it narrow) */
.screen { container-type: inline-size; container-name: screen; }
.ctrl-group { flex-wrap: nowrap; }
@container screen (max-width: 980px) {
  .clock { display: none; }
  .archive-group .chip-btn[data-shift="-300"], .archive-group .chip-btn[data-shift="300"] { display: none; }
}
@container screen (max-width: 760px) {
  .volume input { display: none; }
  #btnAudio, #btnSubs { display: none; }
  .tl-time { min-width: 34px; font-size: 11px; }
}
@container screen (max-width: 560px) {
  .archive-group .chip-btn[data-shift="-10"], .archive-group .chip-btn[data-shift="10"] { display: none; }
  #btnPip, #btnQuality { display: none; }
  .screen-actions .icon-btn { width: 34px; height: 34px; }
  .on-air-meta { display: none; }
}

#liveText::after { content: "LIVE"; }
#liveText[data-mode="replay"]::after { content: "Вернуться в LIVE"; }
@container screen (max-width: 980px) {
  #liveText[data-mode="replay"]::after { content: "LIVE"; }
}
.ctrl-row > .ctrl-group:first-child { min-width: 0; }

/* ---- 2.1.3: no left rail on desktop; navigation icons at the top of the channel list ---- */
.top-nav { display: flex; align-items: center; gap: 2px; margin: -4px -4px 0; }
.top-logo { display: grid; place-items: center; width: 34px; height: 34px; margin-right: 6px; }
.nav-btn {
  flex-direction: row; width: 38px; height: 34px; padding: 0; justify-content: center;
  border-radius: 9px;
}
.nav-btn svg { width: 20px; height: 20px; }
.nav-btn[data-action="settings"] { margin-left: auto; }
.when-nav-hidden { display: none; }
@media (min-width: 901px) {
  :root { --rail-w: 0px; }
  .rail { display: none !important; }
  .app.left-hidden .when-nav-hidden, .app.video-only .when-nav-hidden, .app.list-overlay .when-nav-hidden { display: inline-grid; }
  .app.list-overlay .when-nav-hidden { display: none; }
  /* compact list: icons stacked */
  .app.left-compact .top-nav { flex-direction: column; margin: 0 0 6px; gap: 4px; }
  .app.left-compact .top-logo { margin: 0 0 4px; }
  .app.left-compact .nav-btn[data-action="settings"] { margin-left: 0; }
}
@media (max-width: 900px) {
  .top-nav { display: none; }
}

/* ---- 2.2: compact programme rows, full titles, day navigation, report, toasts ---- */
.epg-row { grid-template-columns: 44px minmax(0, 1fr); gap: 1px 8px; padding: 6px 10px; border-radius: 8px; }
.epg-time { font-size: 12.5px; }
.epg-title { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.epg-desc { font-size: 12px; }
.epg-tag { height: 16px; font-size: 10.5px; margin-left: 5px; }
.day-tabs { gap: 4px; align-items: center; }
.day-tab { height: 28px; padding: 0 9px; font-size: 12px; }
.day-nav { flex: none; height: 28px; min-width: 28px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 12px; font-weight: 600; }
.day-nav:hover:not(:disabled) { background: var(--raised); }
.day-nav:disabled { opacity: .3; }
.nn-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
/* below the player toolbar, never on top of buttons */
.toasts { top: 72px; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); justify-items: center; width: min(460px, calc(100vw - 28px)); }
.toast { font-size: 13px; padding: 9px 14px; }
.toast:nth-child(n+4) { display: none; }
.ch-report { display: grid; gap: 6px; margin: 4px 18px 0; }
.rep-card { padding: 8px 10px; border-radius: var(--r-m); background: var(--ink); border: 1px solid var(--line-soft); font-size: 12.5px; }
.rep-card b { display: block; font-size: 13px; margin-bottom: 4px; }
.rep-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.rep-chip { padding: 1px 7px; border-radius: 6px; background: var(--raised); color: var(--muted); font-size: 11.5px; }
.rep-chip.good { color: var(--ok); }
.rep-chip.bad { color: var(--tally); }
.rep-meta { color: var(--faint); margin-top: 4px; font-size: 11.5px; }
.rep-err { color: #f3a1a7; margin-top: 3px; font-size: 11.5px; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .toasts { top: auto; bottom: 72px; right: 50%; transform: translateX(50%); justify-items: center; }
}

.side { container-type: inline-size; container-name: side; }
@container side (max-width: 390px) {
  .side-tab span { display: none; }
  .side-tab { padding: 0 11px; }
  .side-tab.is-on span { display: inline; }
}

/* ==== 2.3: minimal TV layout — video first, fewer permanent elements ==== */
/* channel rows: logo · name / current programme · state · favourite (no numbers, no equaliser) */
.ch { grid-template-columns: 38px minmax(0, 1fr) auto 26px; gap: 10px; padding: 0 4px 0 8px; }
.ch-logo { width: 38px; height: 38px; border-radius: 8px; }
.ch-logo img { padding: 3px; }
.ch-logo .initials { font-size: 13px; }
.ch-body { gap: 2px; }
.ch-name { font-size: 13.5px; gap: 5px; }
.ch-prog { font-size: 12px; }
.ch-rec { width: 13px; height: 13px; flex: none; color: var(--replay); background: none; border-radius: 0; }
.ch.is-active { background: var(--raised); box-shadow: inset 3px 0 0 var(--signal); }
.ch.is-active.is-error { box-shadow: inset 3px 0 0 var(--tally); }
.ch-state { display: none; }
.ch-state[data-k="live"] {
  display: inline-flex; align-items: center; height: 16px; padding: 0 5px; border-radius: 4px;
  background: var(--tally); color: #fff; font-size: 10px; font-weight: 750; letter-spacing: .05em;
}
.ch-state[data-k="arch"] { display: inline-grid; place-items: center; color: var(--replay); }
.ch-state[data-k="arch"] svg { width: 16px; height: 16px; }
.ch-state[data-k="loading"] { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--signal); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.ch-state[data-k="err"] { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--tally); color: #fff; font-size: 11px; font-weight: 800; }
.app.left-compact .ch-state, .grid-mode .ch-state { position: absolute; top: 3px; right: 3px; }
.app.left-compact .ch-state[data-k="live"], .grid-mode .ch-state[data-k="live"] { width: 9px; height: 9px; padding: 0; border-radius: 50%; font-size: 0; box-shadow: 0 0 0 2px var(--panel); }
.grid-mode .ch { position: relative; }

/* player top bar: only "channel list" and "side panel" (+ guide/settings when the list is hidden) */
#btnSide.is-on, #btnCinema.is-on, #btnFit.is-on { color: var(--signal); }
.app.video-only .screen-top { display: none; }

/* now / next — a compact overlay over the video instead of a permanent bar */
.screen::after { height: 280px; }
.np {
  position: absolute; z-index: 3; left: 20px; bottom: 94px;
  width: max-content; max-width: min(620px, calc(100% - 40px));
  padding: 11px 14px 12px; border-radius: 14px;
  background: rgba(10, 14, 22, .66); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .06);
  opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s var(--ease); pointer-events: none;
}
.screen.ui-on .np, .screen.np-pinned .np { opacity: 1; transform: none; pointer-events: auto; }
.np:has(#onAir[hidden]), .screen:has(#errorCard:not([hidden])) .np { display: none; }
.np-head { display: flex; align-items: center; gap: 9px; min-width: 0; }
.np-head img { width: 28px; height: 28px; border-radius: 7px; object-fit: contain; background: #e9edf5; padding: 3px; flex: none; }
.np-ch { font-size: 14.5px; font-weight: 650; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-meta { color: var(--replay); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.np-meta:empty { display: none; }
.np-fav { margin-left: auto; width: 28px; height: 28px; }
.np-fav.is-on { color: var(--replay); }
.np .tally { height: 19px; padding: 0 7px; gap: 4px; border-radius: 5px; font-size: 10.5px; font-weight: 750; letter-spacing: .05em; box-shadow: none; }
.np .tally::before { display: none; }
.np .tally svg { width: 13px; height: 13px; }
.np .tally.is-replay { box-shadow: none; letter-spacing: 0; }
.np-cur { margin-top: 7px; }
.np-when { color: #b9c1d3; font-size: 12px; font-variant-numeric: tabular-nums; }
.np-when:empty { display: none; }
.np-title { font-size: 17px; font-weight: 620; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.np-desc { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.np-desc:empty { display: none; }
.np-next { margin-top: 6px; font-size: 12.5px; color: #c3cadb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-next .np-when { margin-right: 8px; }
.np-next:has(.np-next-title:empty) { display: none; }
@container screen (max-width: 640px) {
  .np { left: 10px; bottom: 84px; max-width: calc(100% - 20px); padding: 7px 10px; }
  .np-desc, .np-next { display: none; }
  .np-title { font-size: 14px; -webkit-line-clamp: 1; }
}
@media (max-width: 900px) {
  /* phone-size video: only channel + LIVE (+ archive time); the programme is in the list row */
  .np-cur, .np-next, .np-fav, .np-head img { display: none; }
}

/* friendly playback errors */
.error-card[data-kind="nosignal"] { border-top-color: var(--replay); }
.err-reason { margin: 0 0 6px !important; color: var(--text) !important; font-weight: 550; }
.err-reason:empty { display: none; }

/* picture scaling: contain by default, crop/stretch only on user command (Z) */
.screen[data-fit="cover"] video { object-fit: cover; }
.screen[data-fit="fill"] video { object-fit: fill; }

/* compact day picker: ‹ [calendar] › + quick buttons */
.daypick { position: relative; display: flex; align-items: center; gap: 4px; padding: 0 14px 10px; flex: none; min-width: 0; }
.dp-nav { flex: none; height: 30px; min-width: 30px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 16px; line-height: 1; }
.dp-nav:hover:not(:disabled) { background: var(--raised); }
.dp-nav:disabled { opacity: .3; }
.dp-cur { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; min-width: 0; border-radius: 8px; border: 1px solid var(--line); background: var(--raised); font-size: 12.5px; font-weight: 600; }
.dp-cur span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-cur svg { width: 16px; height: 16px; color: var(--signal); }
.dp-cur:hover, .dp-cur[aria-expanded="true"] { border-color: var(--signal); }
.daypick .dp-next { margin-right: auto; }
.dp-quick { flex: none; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.dp-quick:hover:not(:disabled) { color: var(--text); background: var(--raised); }
.dp-quick.is-on { color: var(--text); border-color: var(--line); }
.dp-quick:disabled { opacity: .3; }
.dp-cal { position: absolute; z-index: 20; top: 36px; left: 14px; width: 256px; padding: 10px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(0, 0, 0, .55); }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-head b { font-size: 13px; font-weight: 650; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-wd { font-size: 11px; color: var(--faint); padding: 2px 0 4px; }
.dp-day { height: 30px; border: 0; border-radius: 7px; background: transparent; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.dp-day:hover:not(:disabled) { background: var(--hover); }
.dp-day:disabled { color: var(--faint); opacity: .45; }
.dp-day.is-today { box-shadow: inset 0 0 0 1px var(--signal); }
.dp-day.is-on { background: var(--signal); color: #062029; font-weight: 700; }
.arch-pick { padding-top: 0; }

/* compact EPG status tags: LIVE badge, archive / watching as icons with tooltip */
.epg-tag.live { letter-spacing: .05em; font-weight: 750; }
.epg-tag.is-icon { padding: 0 3px; background: transparent; }
.epg-tag.is-icon svg { width: 14px; height: 14px; }
.epg-tag.rec.is-icon { color: var(--replay); }
.epg-tag.watching.is-icon { color: var(--replay); }

@media (max-width: 900px) {
  .np { bottom: 78px; }
}
/* LIVE: forward chips make no sense — hide them instead of showing disabled buttons */
.archive-group:not(.is-on) .chip-btn:disabled { display: none; }
.ch[data-state="arch"] .ch-rec { display: none; }

/* ==== 2.3.1: compact EPG / archive list ==== */
/* only the list scrolls; title, date bar and tabs stay put */
.side-pane > .pane-title, .side-pane > .daypick, .side-pane > .arch-status, .side-pane > .arch-pick { flex: none; }
.epg-list { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 2px 6px 10px; }
/* fixed columns: time | title (one line, …) | LIVE / archive icon, right-aligned */
.epg-row {
  position: relative; display: grid; grid-template-columns: 46px minmax(0, 1fr) 40px; align-items: center; gap: 0 8px;
  height: 44px; padding: 0 8px 0 10px; margin: 0; border-radius: 8px;
}
.epg-row + .epg-row { margin-top: 1px; }
.epg-time { font-size: 12.5px; padding: 0; }
.epg-title {
  display: block; font-size: 13px; line-height: 44px; height: 44px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: unset;
}
.epg-mark { display: flex; justify-content: flex-end; align-items: center; }
.epg-mark .epg-tag { margin: 0; }
.epg-tag.live { height: 17px; padding: 0 5px; border-radius: 4px; font-size: 10px; }
.epg-tag.is-icon svg { width: 15px; height: 15px; }
.epg-desc { display: none; }
/* current programme: compact background + LIVE, progress as a 2px line — same height */
.epg-row.is-now { background: var(--signal-soft); }
.epg-row .epg-prog { position: absolute; left: 64px; right: 56px; bottom: 5px; height: 2px; margin: 0; grid-column: auto; }
.epg-row.is-watching { box-shadow: inset 3px 0 0 var(--replay); }
.epg-row.is-selected:not(.is-now) { background: var(--raised); }
.epg-row:focus-visible { outline-offset: -2px; }
/* details of the hovered / focused / selected programme, under the list (does not scroll with it) */
.epg-detail {
  flex: none; margin: 0 8px 8px; padding: 9px 12px; border-radius: var(--r-m);
  background: var(--ink); border: 1px solid var(--line-soft); max-height: 132px; overflow-y: auto;
}
.det-when { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.det-title { font-size: 13.5px; font-weight: 600; line-height: 1.35; margin-top: 2px; overflow-wrap: anywhere; }
.det-desc { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
/* date bar: full date, ‹ › and calendar; quick buttons wrap to the next line if the panel is narrow */
.daypick { flex-wrap: wrap; row-gap: 6px; }
.dp-cur { flex: none; }
.dp-cur span { overflow: visible; text-overflow: clip; }
@media (max-width: 900px) {
  .epg-row { height: 48px; }
  .epg-title { line-height: 48px; height: 48px; }
  .dp-nav, .dp-cur, .dp-quick { height: 36px; }
  .dp-nav { min-width: 36px; }
  .epg-detail { max-height: 96px; }
}
.dp-quicks { display: inline-flex; gap: 2px; margin-left: auto; }
.daypick .dp-next { margin-right: 0; }
/* archive status: one compact block, full reason in the tooltip */
.arch-status { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 10px; align-items: center; padding: 8px 10px; flex: none; }
.arch-status b { margin: 0; font-size: 12.5px; }
.arch-reason { grid-column: 1; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arch-status .btn { grid-column: 2; grid-row: 1 / span 2; margin: 0; height: 30px; padding: 0 10px; font-size: 12.5px; }
#archSub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.arch-pick .field-inline { grid-auto-flow: column; align-items: center; gap: 8px; }
.arch-pick .field-inline input, .arch-pick .btn { height: 32px; }

/* ==== 2.3.2: one dark tooltip style, compact archive pane, dark scrollbars ==== */
.ui-tip {
  position: fixed; z-index: 120; pointer-events: none;
  padding: 6px 9px; border-radius: 7px;
  background: #0b0f18; color: var(--text); border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .55);
  font-size: 12px; line-height: 1.4; white-space: pre-line; overflow-wrap: anywhere;
  max-height: 9.5em; overflow: hidden;
}
* { scrollbar-width: thin; scrollbar-color: #343e57 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #343e57; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* archive pane: title + depth, one status line, date bar, start time, list */
#paneArchive .pane-title { padding: 12px 16px 6px; }
#archSub { -webkit-line-clamp: 1; }
.arch-status {
  display: flex; align-items: center; gap: 8px; margin: 0 14px 8px; padding: 5px 6px 5px 10px; min-height: 34px;
  grid-template-columns: none;
}
.arch-status b { font-size: 12.5px; font-weight: 650; display: inline-flex; align-items: center; gap: 7px; }
.arch-status b::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.arch-status.is-ok b::before { background: var(--ok); }
.arch-status.is-fail b::before { background: var(--tally); }
.arch-status.is-unknown b::before { background: var(--replay); }
.arch-status .arch-recheck { margin-left: auto; width: 28px; height: 28px; }
.arch-status .arch-recheck svg { width: 16px; height: 16px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--signal); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
#paneArchive .daypick { padding-bottom: 6px; }
.arch-pick { padding: 0 14px 8px; gap: 6px; }
.arch-pick .field-inline { font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.arch-pick { flex-wrap: nowrap; align-items: center; }
.arch-quick { display: inline-flex; margin-right: auto; }
.arch-quick .dp-quicks { margin-left: 0; }
.arch-pick .field-inline input { width: 116px; }
#archGo { gap: 6px; padding: 0 12px; }
#archGo svg { width: 14px; height: 14px; }
@container side (max-width: 380px) {
  #archGo span { display: none; }
  #archGo { padding: 0 10px; }
}

/* ==== 2.3.7 ==== */
/* archive icons in one aligned column; calm colours; softer active row */
.ch { grid-template-columns: 38px minmax(0, 1fr) 16px auto 26px; gap: 8px; }
.ch-rec { width: 15px; height: 15px; color: #6f7c99; opacity: .75; justify-self: center; }
.ch-rec.is-ok { color: #c9a463; opacity: 1; }
.ch.is-active { background: rgba(79, 209, 232, .07); box-shadow: inset 2px 0 0 rgba(79, 209, 232, .85); }
.ch.is-active:hover { background: rgba(79, 209, 232, .1); }
.ch.is-active .ch-name { color: #fff; }
.app.left-compact .ch-rec, .grid-mode .ch-rec { display: none; }
/* fullscreen: only the video area, whatever panels / Cinema mode were active (video was squeezed to 0 px) */
.app.is-fullscreen, .app.is-fullscreen.video-only, .app.is-fullscreen.left-compact, .app.is-fullscreen.left-hidden {
  grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: minmax(0, 1fr) !important;
  grid-template-areas: "stage" !important;
}
.app.is-fullscreen .side, .app.is-fullscreen .rail, .app.is-fullscreen .resizer { display: none !important; }
.app.is-fullscreen:not(.list-overlay) .browser { display: none !important; }
.app.is-fullscreen .stage, .app.is-fullscreen .screen { width: 100%; height: 100%; max-height: none; aspect-ratio: auto; }
#btnStop:disabled { opacity: .32; }

/* ==== 2.4: programme rows with separate actions, description inside the right panel ==== */
/* time | title (button: select + description) | status · ▶ archive · ⓘ info — all actions right-aligned in fixed slots */
.epg-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 0 6px;
  height: 44px; padding: 0 4px 0 10px; cursor: default;
}
.epg-row.is-clickable:hover, .epg-row:hover { background: var(--hover); }
.epg-row.is-now, .epg-row.is-now:hover { background: var(--signal-soft); }
.epg-row.is-selected, .epg-row.is-selected:hover { background: var(--raised); box-shadow: inset 2px 0 0 var(--signal); }
.epg-row.is-watching { box-shadow: inset 3px 0 0 var(--replay); }
.epg-title {
  min-width: 0; height: 44px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer;
  color: var(--text); font: inherit; font-size: 13px; font-weight: 520; line-height: 44px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.epg-row.is-past .epg-title { color: #b4bccd; }
.epg-row.is-future .epg-title { color: var(--muted); }
.epg-title:hover { color: #fff; }
.epg-title:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; border-radius: 4px; }
.epg-acts { display: grid; grid-template-columns: 38px 30px 30px; align-items: center; justify-items: center; }
.epg-status { display: inline-flex; justify-content: center; }
.epg-status .epg-tag { margin: 0; }
.epg-act, .epg-act-slot { width: 30px; height: 30px; }
.epg-act {
  display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.epg-act svg { width: 16px; height: 16px; }
.epg-act:hover { background: var(--raised); color: var(--text); }
.epg-act:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.epg-act.act-play { color: var(--replay); }
.epg-act.act-play.is-dim { color: #8d97ad; }
.epg-act.act-play:hover { color: #ffd27a; }
.epg-row .epg-prog { left: 62px; right: 104px; bottom: 4px; }
.epg-mark { display: none; }
@media (max-width: 900px) {
  .epg-row, .epg-title { height: 48px; line-height: 48px; }
  .epg-acts { grid-template-columns: 38px 40px 40px; }
  .epg-act, .epg-act-slot { width: 40px; height: 40px; }
  .epg-row .epg-prog { right: 124px; }
}
/* description: a block inside the panel under the list; the text scrolls on its own */
.side-pane > .epg-list { flex: 1 1 0; min-height: 96px; }
.prog-info {
  flex: 0 1 auto; min-height: 0; overflow: hidden; max-height: 58%; display: flex; flex-direction: column;
  margin: 0 8px 8px; padding: 10px 12px 12px; border-radius: var(--r-m);
  background: var(--ink); border: 1px solid var(--line); box-shadow: 0 -10px 24px rgba(0, 0, 0, .28);
}
.prog-info[hidden] { display: none; }
.pi-head { display: flex; align-items: center; gap: 8px; flex: none; }
.pi-state {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 5px;
  background: var(--raised); color: var(--muted); font-size: 11px; font-weight: 650;
}
.pi-state svg { width: 13px; height: 13px; }
.pi-state.is-live { background: var(--tally); color: #fff; letter-spacing: .05em; font-weight: 750; }
.pi-state.is-arch, .pi-state.is-watching { color: var(--replay); background: var(--replay-soft); }
.pi-close { margin-left: auto; width: 30px; height: 30px; }
.pi-title { flex: none; margin: 8px 0 2px; font-size: 15px; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; outline: none; }
.pi-meta { flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.pi-actions { flex: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pi-actions .btn { height: 32px; padding: 0 12px; gap: 6px; font-size: 12.5px; }
.pi-actions .btn svg { width: 14px; height: 14px; }
.pi-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tally); }
.pi-note { flex: none; margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.pi-desc {
  flex: 1 1 auto; min-height: 3em; margin-top: 10px; padding-right: 4px; overflow-y: auto; overscroll-behavior: contain;
  color: #c9d0de; font-size: 13px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere;
}
.pi-desc:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 4px; }
.pi-desc.is-empty { color: var(--faint); font-style: italic; }
@media (max-width: 900px) { .prog-info { max-height: 62%; } .prog-info .pi-close { width: 40px; height: 40px; } }
/* tablets / small laptops: panels never squeeze the video below ~1/3 of the window */
@media (min-width: 901px) and (max-width: 1279px) {
  .app { grid-template-columns: var(--rail-w) min(var(--left-w), 32vw) minmax(0, 1fr) min(var(--right-w), 36vw); }
}

/* ==== 2.4.3 ==== */
/* channel list: the archive clock at the right edge of the row (LIVE / star to its left) */
.app:not(.left-compact) #channelList:not(.grid-mode) .ch { grid-template-columns: 38px minmax(0, 1fr) 26px auto 16px; }
/* fixed columns: a hidden LIVE mark (display: none) must not shift the clock away from the edge */
.app:not(.left-compact) #channelList:not(.grid-mode) .ch-fav { grid-column: 3; grid-row: 1; }
.app:not(.left-compact) #channelList:not(.grid-mode) .ch-state { grid-column: 4; grid-row: 1; }
.app:not(.left-compact) #channelList:not(.grid-mode) .ch-rec { grid-column: 5; grid-row: 1; justify-self: end; }
/* programme rows: one «АРХИВ» pill instead of ▶ (no second ▶ for the programme being watched) */
.epg-acts { grid-template-columns: 38px 48px 30px; }
.epg-act.act-play.is-pill, .epg-act.act-play.is-pill:hover { width: 48px; background: transparent; }
.epg-act.act-play.is-pill .pill {
  display: inline-flex; align-items: center; height: 16px; padding: 0 4px; border-radius: 4px;
  border: 1px solid #4c9bff; background: rgba(76, 155, 255, .12); color: #7db7ff;
  font-size: 8.5px; font-weight: 750; letter-spacing: .05em; line-height: 1;
}
.epg-act.act-play.is-pill:hover .pill { background: rgba(76, 155, 255, .24); color: #fff; }
.epg-act.act-play.is-pill.is-dim .pill { border-color: rgba(76, 155, 255, .45); color: #8fa6c8; background: transparent; }
.epg-act.act-play.is-pill.is-on .pill { background: #3d8bff; border-color: #3d8bff; color: #fff; }
.epg-row .epg-prog { right: 118px; }
@media (max-width: 900px) {
  .epg-acts { grid-template-columns: 38px 54px 40px; }
  .epg-act.act-play.is-pill { width: 54px; }
  .epg-act.act-play.is-pill .pill { height: 18px; font-size: 9.5px; padding: 0 5px; }
  .epg-row .epg-prog { right: 140px; }
}

/* ==== 2.4.5 ==== */
/* technical information only with ?debug=1 */
.no-tech .tech-only { display: none !important; }
/* programme search in the TV guide */
.guide-search { flex: 0 1 260px; min-width: 150px; height: 38px; }
.guide-results { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 18px 18px; display: grid; align-content: start; gap: 2px; }
.guide-results[hidden], .guide-body[hidden] { display: none; }
.gs-head { margin: 4px 0 8px; color: var(--muted); font-size: 12.5px; }
.gs-row {
  display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  width: 100%; min-height: 48px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.gs-row:hover, .gs-row:focus-visible { background: var(--hover); outline: 0; }
.gs-row.is-now { background: var(--signal-soft); }
.gs-row.is-future { color: var(--muted); }
.gs-when { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.gs-main { display: grid; gap: 2px; min-width: 0; }
.gs-main b { font-weight: 560; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-main small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-tag { height: 16px; padding: 0 4px; border-radius: 4px; font-size: 8.5px; font-weight: 750; letter-spacing: .05em; display: inline-flex; align-items: center; }
.gs-tag.is-live { background: var(--tally); color: #fff; }
.gs-tag.is-arch { border: 1px solid #4c9bff; color: #7db7ff; background: rgba(76, 155, 255, .12); }
@media (max-width: 900px) {
  .guide-search { order: 2; flex: 1 1 100%; }
  .gs-row { grid-template-columns: 84px minmax(0, 1fr) auto; gap: 8px; }
}

/* ==== 2.4.6 ==== */
/* ⤢ in the programme card opens the whole description in a modal window */
.pi-full { width: 30px; height: 30px; margin-left: auto; }
.pi-full[hidden] { display: none; }
.pi-full:not([hidden]) + .pi-close { margin-left: 0; }
@media (max-width: 900px) { .prog-info .pi-full { width: 40px; height: 40px; } }
/* group filter for the programme search in the TV guide */
.guide-group { flex: 0 1 200px; min-width: 120px; height: 38px; }
@media (max-width: 900px) { .guide-group { order: 2; flex: 1 1 40%; } .guide-search { flex: 1 1 50%; } }

/* ==== 2.4.7 ==== */
/* category picker: counts right-aligned, muted, no brackets */
.cat-pick { position: relative; flex: 1; min-width: 0; display: flex; }
.cat-pick > select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.cat-btn {
  flex: 1; min-width: 0; height: 38px; padding: 0 32px 0 12px; border-radius: var(--r-m);
  background: var(--ink); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 14px; text-align: left;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b95ab' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; cursor: pointer;
}
.cat-btn:focus-visible, .cat-btn[aria-expanded="true"] { border-color: var(--signal); outline: 0; }
.cat-btn:disabled { opacity: .45; cursor: default; }
.cat-btn-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-menu {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; width: max(100%, 260px); max-width: min(420px, 90vw);
  max-height: min(60vh, 520px); overflow-y: auto; overscroll-behavior: contain; padding: 4px;
  background: var(--panel, #141a26); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
  outline: 0;
}
.cat-menu[hidden] { display: none; }
.cat-opt {
  display: flex; align-items: center; gap: 12px; min-height: 34px; padding: 0 10px; border-radius: 7px;
  font-size: 13.5px; color: var(--text); cursor: pointer;
}
.cat-opt.is-active { background: var(--raised); }
.cat-opt.is-selected { color: var(--signal); }
.cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count { flex: none; margin-left: auto; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ==== 2.4.8 ==== */
.desc-modal {
  width: min(680px, calc(100vw - 32px)); max-height: min(80vh, 760px); padding: 0; border: 1px solid var(--line);
  border-radius: 14px; background: var(--panel); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, .55);
}
.desc-modal[open] { display: flex; flex-direction: column; }
.desc-modal::backdrop { background: rgba(3, 6, 12, .72); }
.dm-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 14px 10px 20px; flex: none; }
.dm-headtext { flex: 1; min-width: 0; }
.dm-channel { margin: 0 0 4px; color: var(--muted); font-size: 12.5px; }
.dm-title { margin: 0; font-size: 19px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.dm-meta { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.dm-text {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 12px;
  color: #d3d9e5; font-size: 15px; line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere;
}
.dm-text[aria-busy="true"] { opacity: .7; }
.dm-text:focus-visible { outline: 2px solid var(--signal); outline-offset: -4px; }
.dm-note { flex: none; margin: 0 20px 8px; color: var(--muted); font-size: 12.5px; }
.dm-note[hidden] { display: none; }
.dm-foot { flex: none; display: flex; justify-content: flex-end; gap: 8px; padding: 10px 20px 16px; border-top: 1px solid var(--line-soft); }
.dm-foot .btn { gap: 6px; }
.dm-foot .btn svg { width: 14px; height: 14px; }
.dm-foot .btn[hidden] { display: none; }
@media (max-width: 600px) { .desc-modal { max-height: calc(100vh - 32px); } .dm-text { font-size: 14.5px; } }

/* 2.4.11: longer Polish / English titles stay on one line */
.browser-title h1 { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.browser-title .count { white-space: nowrap; flex: none; }
/* 2.4.11: the archive pill is wider in Polish (ARCHIWUM) and English (ARCHIVE) */
html { --pill-w: 48px; }
html[lang=en] { --pill-w: 58px; }
html[lang=pl] { --pill-w: 66px; }
.epg-acts { grid-template-columns: 38px var(--pill-w) 30px; }
.epg-act.act-play.is-pill, .epg-act.act-play.is-pill:hover { width: var(--pill-w); }
.epg-row .epg-prog { right: calc(70px + var(--pill-w)); }
@media (max-width: 900px) {
  html { --pill-w: 54px; }
  html[lang=en] { --pill-w: 64px; }
  html[lang=pl] { --pill-w: 74px; }
  .epg-acts { grid-template-columns: 38px var(--pill-w) 40px; }
  .epg-row .epg-prog { right: calc(86px + var(--pill-w)); }
}

/* 2.4.13: language in the top navigation — the current one, the others in a drop-down
   (desktop; in the compact list and on phones it is in the settings) */
.lang-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 2px; height: 30px; padding: 0 6px 0 8px;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 650; letter-spacing: .04em;
}
.lang-btn svg { width: 14px; height: 14px; transform: rotate(90deg); }
.lang-btn:hover, .lang-btn[aria-expanded="true"] { color: var(--text); background: var(--panel); }
.lang-btn + .nav-btn[data-action="settings"] { margin-left: 2px; }
@media (min-width: 901px) { .app.left-compact .lang-btn { display: none; } }
/* «Вернуться в LIVE» is drawn by CSS: per language */
html[lang=pl] #liveText[data-mode="replay"]::after { content: "Wróć do LIVE"; }
html[lang=en] #liveText[data-mode="replay"]::after { content: "Back to LIVE"; }
@container screen (max-width: 980px) { html[lang] #liveText[data-mode="replay"]::after { content: "LIVE"; } }
/* 2.4.13: a movie playing (not LIVE) */
.ch-state[data-k="vod"] { display: inline-grid; place-items: center; color: var(--signal); }
.ch-state[data-k="vod"] svg { width: 14px; height: 14px; }

/* ==== 2.4.14: what is on now under every channel ==== */
.ch-bar[hidden] { display: none; }
.ch-bar { height: 2px; margin-top: 1px; }
.grid-mode .ch-body { width: 100%; justify-items: center; gap: 3px; }
.grid-mode .ch-prog { font-size: 10.5px; max-width: 100%; text-align: center; }
.grid-mode .ch-bar { width: 70%; }
.g-ch-txt { min-width: 0; display: grid; gap: 2px; }
.g-ch-now { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==== 2.4.15: login by the code from the customer panel ==== */
.onboard [hidden], #setCodeRow[hidden], #setPlaylistRow[hidden] { display: none !important; }
.ob-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; margin: 0 0 16px; border-radius: var(--r-m); background: var(--ink); border: 1px solid var(--line); }
.ob-tab { height: 34px; border: 0; border-radius: calc(var(--r-m) - 3px); background: transparent; color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.ob-tab:hover { color: var(--text); }
.ob-tab.is-on { background: var(--raised); color: var(--text); }
.onboard input.code-input { height: 42px; font-size: 17px; font-weight: 600; letter-spacing: .06em; text-align: center; font-variant-numeric: tabular-nums; padding: 0 8px; width: 100%; min-width: 0; }
.onboard input.code-input::placeholder { color: var(--faint); }
.onboard .ob-msg { margin: 0; color: var(--tally); font-size: 13px; }
.onboard .ob-msg.is-info { color: var(--muted); }
.onboard .btn:disabled { opacity: .55; cursor: default; }
#setCodeRow .code-info { flex: 1; min-width: 0; color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#setCodeRow > .btn { justify-self: start; height: 34px; }

/* 2.4.34: own confirmation dialog instead of the browser's confirm() */
.ask-modal { width: min(440px, calc(100vw - 32px)); padding: 20px 20px 16px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, .55); }
.ask-modal::backdrop { background: rgba(3, 6, 12, .72); }
.ask-text { margin: 0 0 18px; font-size: 15.5px; line-height: 1.5; overflow-wrap: anywhere; }
.ask-foot { display: flex; justify-content: flex-end; gap: 10px; }
.ask-foot .btn { height: 38px; padding: 0 16px; }

/* ==== 2.4.35: Xtream Codes — login form, films / series catalogue, film card ==== */
.xt-only[hidden], #setXtRow[hidden], .filters[hidden], .ob-tab[hidden] { display: none !important; }
.ob-tabs { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 1fr; }
.ob-tab { padding: 0 6px; white-space: nowrap; }
.onboard .ob-field { display: grid; gap: 5px; font-size: 12.5px; color: var(--muted); }
.onboard .ob-field input, .onboard .ob-field select { width: 100%; min-width: 0; }
.onboard .ob-field select { height: 42px; }
.onboard .ob-note { margin: 0; color: var(--faint); font-size: 12px; max-width: none; }
#setXtRow .code-info { flex: 1; min-width: 0; color: var(--text); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#setXtRow .xt-sub { color: var(--faint); font-size: 12px; }
#setXtRow > .btn { justify-self: start; height: 34px; }

/* ==== 2.4.37: media library (Films / Series) — covers the video area, the player stays underneath ==== */
.stage { position: relative; }
.library[hidden], .lib-cats[hidden], .lib-browse[hidden], .lib-detail[hidden], .lib-items[hidden], .lib-empty[hidden],
.lib-to-player[hidden], .ld-series[hidden], .ld-msg[hidden], .ld-orig[hidden], .ld-actions .btn[hidden], .lib-back-btn[hidden],
.lib-progress[hidden], .lib-rating[hidden], .lib-favmark[hidden], .search[hidden] { display: none !important; }
.library {
  position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: radial-gradient(1200px 500px at 85% -10%, rgba(79, 209, 232, .07), transparent 60%), var(--ink);
}
.lib-browse { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.lib-head { padding: 22px 28px 14px; display: grid; gap: 14px; }
.lib-titlebar { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.lib-titlebar h2 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.015em; white-space: nowrap; }
.lib-to-player { margin-left: auto; align-self: center; height: 34px; gap: 7px; max-width: 46%; }
.lib-to-player span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-to-player svg { width: 13px; height: 13px; flex: none; }
.lib-tools { display: flex; gap: 10px; align-items: center; min-width: 0; }
.lib-search { flex: 1; min-width: 0; max-width: 460px; }
.lib-tools select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; min-width: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b95ab' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; height: 40px;
}
.lib-cat-select { flex: 0 1 300px; }
.lib-items { position: relative; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 6px 28px 28px; overscroll-behavior: contain; }
.lib-items:focus-visible { outline: none; }
.lib-empty { padding: 40px 28px; color: var(--muted); }
.lib-empty h3 { margin: 0 0 6px; color: var(--text); font-size: 17px; }
.lib-empty p { margin: 0; }

/* cards */
.lib-card { display: flex; flex-direction: column; gap: 8px; padding: 0; border: 0; background: transparent; color: var(--text); text-align: left; font: inherit; cursor: pointer; min-width: 0; }
.lib-poster {
  position: relative; flex: 1; min-height: 0; border-radius: 12px; overflow: hidden; background: var(--panel);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35); outline: 2px solid transparent; outline-offset: 2px; transition: transform .18s ease, outline-color .15s;
}
.lib-card:hover .lib-poster, .lib-card:focus-visible .lib-poster { transform: translateY(-3px); outline-color: var(--signal); }
.lib-card:focus-visible { outline: none; }
.lib-img { position: absolute; inset: 0; display: grid; place-items: center; }
.lib-img img { width: 100%; height: 100%; object-fit: cover; }
.lib-img.is-fallback, .ld-poster.is-fallback {
  background: linear-gradient(160deg, var(--fb, #33405e), #10151f); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12px; text-align: center;
}
.is-fallback svg { width: 28px; height: 28px; color: rgba(255, 255, 255, .35); }
.is-fallback .ph-initials { font-size: 26px; font-weight: 750; color: #fff; letter-spacing: .03em; }
.is-fallback .ph-title { font-size: 12px; color: rgba(255, 255, 255, .7); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lib-rating { position: absolute; top: 8px; left: 8px; z-index: 1; padding: 3px 7px; border-radius: 7px; background: rgba(8, 11, 18, .78); color: #ffd166; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lib-favmark { position: absolute; top: 7px; right: 7px; z-index: 1; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(8, 11, 18, .78); color: #ffd166; }
.lib-favmark svg { width: 13px; height: 13px; }
.lib-progress { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; height: 4px; background: rgba(255, 255, 255, .18); }
.lib-progress i { display: block; height: 100%; background: var(--signal); }
.lib-card-body { flex: none; min-width: 0; display: grid; gap: 2px; }
.lib-name { font-size: 13.5px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; min-height: 1em; }
.lib-plot { display: none; }
/* list mode */
.lib-items.is-list .lib-card { flex-direction: row; gap: 14px; align-items: stretch; padding: 6px; border-radius: 12px; }
.lib-items.is-list .lib-card:hover, .lib-items.is-list .lib-card:focus-visible { background: var(--panel); }
.lib-items.is-list .lib-poster { flex: none; width: 66px; border-radius: 8px; box-shadow: none; }
.lib-items.is-list .lib-card:hover .lib-poster { transform: none; }
.lib-items.is-list .lib-card-body { align-content: center; gap: 4px; }
.lib-items.is-list .lib-name { font-size: 15px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.lib-items.is-list .lib-plot { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; color: var(--faint); line-height: 1.4; }
.lib-items.is-list .is-fallback .ph-title, .lib-items.is-list .is-fallback svg { display: none; }
.lib-items.is-list .is-fallback .ph-initials { font-size: 15px; }
.lib-items.is-list .lib-rating { top: auto; bottom: 4px; left: 4px; font-size: 10px; padding: 1px 4px; }

/* left panel: categories */
.lib-cats { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 16px; display: flex; flex-direction: column; gap: 1px; }
.lib-cat {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 7px 12px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.lib-cat svg { width: 16px; height: 16px; flex: none; }
.lib-cat:hover { background: var(--raised); color: var(--text); }
.lib-cat.is-on { background: var(--signal-soft); color: var(--signal); font-weight: 600; }
.lib-cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-cat-n { flex: none; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.lib-cat-sep { height: 1px; margin: 6px 6px; background: var(--line-soft); flex: none; }
.app.lib-mode .browser-head .search, .app.lib-mode .browser-head .filters, .app.lib-mode #channelList,
.app.lib-mode #emptyState, .app.lib-mode #onboard { display: none !important; }

/* detail page */
.lib-detail { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; position: relative; }
.ld-hero { position: relative; min-height: 420px; display: flex; align-items: flex-end; }
.ld-backdrop { position: absolute; inset: 0; overflow: hidden; }
.ld-backdrop img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
/* 2.4.43: no backdrop from the panel — the poster itself, sharp (it was blurred) */
.lib-detail.has-blur .ld-backdrop img { object-position: center 20%; opacity: .7; }
.ld-backdrop::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(15, 20, 32, .95) 0%, rgba(15, 20, 32, .7) 45%, rgba(15, 20, 32, .25) 100%), linear-gradient(180deg, rgba(15, 20, 32, 0) 40%, var(--ink) 100%); }
.ld-back { position: absolute; top: 18px; left: 24px; z-index: 2; height: 36px; gap: 6px; background: rgba(15, 20, 32, .6); backdrop-filter: blur(6px); }
.ld-back svg { width: 16px; height: 16px; }
.ld-hero-inner { position: relative; z-index: 1; display: flex; gap: 28px; align-items: flex-end; padding: 80px 32px 26px; width: 100%; }
.ld-poster { flex: none; position: relative; width: 210px; aspect-ratio: 2 / 3; border-radius: 14px; overflow: hidden; background: var(--panel); box-shadow: 0 18px 50px rgba(0, 0, 0, .6); display: grid; place-items: center; }
.ld-poster img { width: 100%; height: 100%; object-fit: cover; }
.ld-info { flex: 1; min-width: 0; max-width: 760px; }
.ld-title { margin: 0; font-size: clamp(24px, 3.2vw, 40px); font-weight: 750; line-height: 1.1; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.ld-orig { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.ld-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ld-chips:empty { display: none; }
.ld-chip { padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .1); font-size: 13px; font-variant-numeric: tabular-nums; }
.ld-chip.is-rating { color: #ffd166; font-weight: 700; }
.ld-chip.is-quality { color: var(--signal); border-color: rgba(79, 209, 232, .35); }
.ld-genre { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.ld-genre:empty { display: none; }
.ld-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.ld-actions .btn { height: 44px; padding: 0 18px; gap: 8px; font-size: 14.5px; }
.ld-actions .btn svg { width: 16px; height: 16px; }
.ld-watch { padding: 0 24px !important; font-weight: 650; }
.ld-fav.is-on { color: #ffd166; border-color: rgba(255, 209, 102, .4); }
.ld-resume { position: relative; margin-top: 12px; max-width: 320px; border-radius: 2px; }
.ld-body { padding: 4px 32px 40px; max-width: 1100px; }
.ld-msg { margin: 0 0 12px; color: var(--muted); }
.ld-plot { margin: 0; font-size: 15.5px; line-height: 1.65; color: #d7dce7; white-space: pre-line; overflow-wrap: anywhere; max-width: 820px; }
.ld-plot:empty { display: none; }
.ld-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 20px 0 0; font-size: 14px; max-width: 820px; }
.ld-dl:empty { display: none; }
.ld-dl dt { color: var(--faint); }
.ld-dl dd { margin: 0; overflow-wrap: anywhere; }
.ld-series { margin-top: 28px; }
.ld-seasons { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.ld-season { flex: none; height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.ld-season:hover { color: var(--text); }
.ld-season.is-on { background: var(--text); color: var(--ink); border-color: var(--text); }
.ld-episodes { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.ld-ep { display: flex; align-items: center; gap: 6px; border-radius: 12px; }
.ld-ep:hover { background: var(--panel); }
.ld-ep.is-next { background: var(--signal-soft); }
.ld-ep-main { flex: 1; min-width: 0; display: flex; gap: 14px; align-items: center; padding: 8px; border: 0; border-radius: 12px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.ld-ep-main:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.ld-ep-thumb { position: relative; flex: none; width: 150px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--raised); display: grid; place-items: center; }
.ld-ep-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ld-ep-thumb > svg { position: relative; z-index: 1; width: 26px; height: 26px; color: #fff; opacity: 0; transition: opacity .15s; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .6)); }
.ld-ep-main:hover .ld-ep-thumb > svg, .ld-ep-main:focus-visible .ld-ep-thumb > svg { opacity: 1; }
.ld-ep-num { position: absolute; left: 8px; bottom: 6px; z-index: 1; font-size: 18px; font-weight: 750; color: rgba(255, 255, 255, .85); text-shadow: 0 1px 6px rgba(0, 0, 0, .7); }
.ld-ep-txt { flex: 1; min-width: 0; display: grid; gap: 3px; }
.ld-ep-title { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-ep-meta { font-size: 12.5px; color: var(--muted); }
.ld-ep-meta:empty { display: none; }
.ld-ep.is-watched .ld-ep-title::after { content: " ✓"; color: var(--signal); }
.ld-ep-plot { margin: 2px 0 0; font-size: 13px; color: var(--faint); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ld-ep-dl { flex: none; margin-right: 6px; }

/* tablet */
@media (max-width: 1200px) {
  .ld-poster { width: 170px; }
  .ld-hero-inner { padding: 76px 24px 22px; gap: 22px; }
  .ld-body { padding: 4px 24px 36px; }
  .lib-head { padding: 18px 20px 12px; }
  .lib-items { padding: 6px 20px 24px; }
}
/* phone: the library covers the whole screen above the bottom bar; categories as a drop-down */
@media (max-width: 900px) {
  .library { position: fixed; inset: 0 0 calc(58px + env(safe-area-inset-bottom)) 0; z-index: 40; }
  .lib-cat-select { display: block; flex: 1 1 100%; }
  .lib-tools { flex-wrap: wrap; }
  .lib-search { flex: 1 1 100%; max-width: none; order: -1; }
  .lib-tools #libSort { flex: 1; }
  .lib-head { padding: 14px 14px 10px; gap: 10px; }
  .lib-titlebar h2 { font-size: 21px; }
  .lib-items { padding: 4px 14px 20px; }
  .ld-hero { min-height: 0; }
  .ld-hero-inner { flex-direction: column; align-items: flex-start; padding: 64px 16px 16px; gap: 16px; }
  .ld-poster { width: 132px; }
  .ld-back { top: 12px; left: 12px; }
  .ld-actions .btn { height: 42px; padding: 0 14px; }
  .ld-actions .ld-watch { flex: 1 1 100%; justify-content: center; }
  .ld-body { padding: 0 16px 28px; }
  .ld-ep-thumb { width: 108px; }
  .ld-ep-plot { -webkit-line-clamp: 1; }
}

/* ==== 2.4.38: Films / Series take the whole window on a computer: the channel list, the EPG panel and the empty
   player are hidden; only the top icon bar stays. Back in «Каналы» the usual three columns return. ==== */
@media (min-width: 901px) {
  .app.lib-mode {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "browser" "stage" !important;
  }
  .app.lib-mode .browser { display: flex !important; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .app.lib-mode .browser-head { padding: 10px 20px; }
  .app.lib-mode .browser-title, .app.lib-mode .lib-cats, .app.lib-mode .resizer, .app.lib-mode #libCats { display: none !important; }
  .app.lib-mode .top-nav { flex-direction: row !important; margin: 0; gap: 4px; }
  .app.lib-mode .top-logo { margin: 0 8px 0 0 !important; }
  .app.lib-mode .nav-btn[data-action="settings"] { margin-left: auto !important; }
  .app.lib-mode .side, .app.lib-mode #listBackdrop { display: none !important; }
  .app.lib-mode .when-nav-hidden { display: none !important; }
  .app.lib-mode .library { inset: 0; }
  .lib-head { padding: 22px 32px 16px; }
  .lib-items { padding: 6px 32px 32px; }
}
.lib-meta-r { color: #ffd166; font-weight: 600; }
.lib-tools { flex-wrap: wrap; }
.lib-search { flex: 1 1 260px; }
@media (min-width: 901px) {
  .app.lib-mode .lang-btn { margin-left: auto; }
  .app.lib-mode .lang-btn ~ .nav-btn[data-action="settings"] { margin-left: 4px !important; }
}

/* ==== 2.4.39: cinematic film / series page: taller hero with a wide backdrop, bigger poster, «Похожие» row ==== */
.ld-hero { min-height: clamp(440px, 58vh, 700px); }
.ld-backdrop img { object-position: center 20%; }
.lib-detail.has-backdrop .ld-backdrop img { animation: ld-kenburns 24s ease-out both; }
@keyframes ld-kenburns { from { transform: scale(1.06); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .lib-detail.has-backdrop .ld-backdrop img { animation: none; } }
.ld-backdrop::after {
  background:
    radial-gradient(120% 90% at 70% 30%, rgba(15, 20, 32, 0) 0%, rgba(15, 20, 32, .35) 60%, rgba(15, 20, 32, .8) 100%),
    linear-gradient(90deg, rgba(15, 20, 32, .96) 0%, rgba(15, 20, 32, .78) 32%, rgba(15, 20, 32, .2) 70%, rgba(15, 20, 32, .05) 100%),
    linear-gradient(180deg, rgba(15, 20, 32, .55) 0%, rgba(15, 20, 32, 0) 22%, rgba(15, 20, 32, 0) 55%, var(--ink) 100%);
}
.ld-hero-inner { padding: 96px 40px 34px; gap: 36px; }
.ld-poster { width: clamp(220px, 19vw, 300px); border-radius: 16px; box-shadow: 0 24px 70px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06); }
.ld-title { font-size: clamp(28px, 3.8vw, 54px); text-shadow: 0 2px 24px rgba(0, 0, 0, .5); }
.ld-plot { font-size: 16px; }
.ld-body { padding: 6px 40px 8px; }
.ld-similar { padding: 26px 40px 40px; }
.ld-sim-title { margin: 0 0 14px; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.ld-sim-row { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(130px, 11vw, 180px); gap: 18px; overflow-x: auto; padding: 4px 4px 12px; scrollbar-width: thin; scroll-snap-type: x proximity; }
.ld-sim-card { scroll-snap-align: start; }
.ld-sim-card .lib-poster { flex: none; aspect-ratio: 2 / 3; }
.ld-similar[hidden] { display: none; }
@media (max-width: 1200px) {
  .ld-hero-inner { padding: 84px 24px 24px; gap: 26px; }
  .ld-poster { width: 200px; }
  .ld-body { padding: 4px 24px 8px; }
  .ld-similar { padding: 22px 24px 32px; }
}
@media (max-width: 900px) {
  .ld-hero { min-height: 0; }
  .ld-hero-inner { padding: 64px 16px 16px; gap: 16px; }
  .ld-poster { width: 150px; }
  .ld-body { padding: 0 16px 4px; }
  .ld-similar { padding: 20px 16px 28px; }
  .ld-sim-row { grid-auto-columns: 118px; gap: 12px; }
}

/* ==== 2.4.40: TV remote / keyboard navigation — one clearly visible selection in the Lynvizo cyan ==== */
.kbd-nav :focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; box-shadow: 0 0 0 7px rgba(79, 209, 232, .22); }
.kbd-nav .ch:focus-visible { outline-offset: -3px; box-shadow: none; background: var(--signal-soft); }
.kbd-nav .ch-fav:focus-visible { outline-offset: -2px; box-shadow: none; color: var(--signal); }
.kbd-nav .lib-card:focus-visible { outline: none; box-shadow: none; }
.kbd-nav .lib-card:focus-visible .lib-poster { outline: 3px solid var(--signal); outline-offset: 3px; transform: translateY(-3px) scale(1.035);
  box-shadow: 0 0 0 8px rgba(79, 209, 232, .2), 0 14px 34px rgba(0, 0, 0, .55); }
.kbd-nav .lib-card:focus-visible .lib-name { color: var(--signal); }
.kbd-nav .lib-items.is-list .lib-card:focus-visible { background: var(--panel); outline: 3px solid var(--signal); outline-offset: -3px; }
.kbd-nav .g-ch:focus-visible, .kbd-nav .g-prog:focus-visible { outline-offset: -3px; box-shadow: none; }
.kbd-nav .ld-ep-main:focus-visible { outline: 3px solid var(--signal); outline-offset: -3px; box-shadow: none; background: var(--signal-soft); }
.kbd-nav .ld-plot:focus-visible { outline-offset: 6px; border-radius: 6px; box-shadow: none; }
.ld-plot:focus { outline: none; }
.kbd-nav .ld-plot:focus-visible { outline: 3px solid var(--signal); }
.kbd-nav .lib-items:focus-visible, .kbd-nav .channel-scroll:focus-visible { outline: none; box-shadow: none; }
/* the guide's channel column is sticky: keep selected programmes out from under it */
.guide-scroll { scroll-padding-left: 200px; }
@media (max-width: 900px) { .guide-scroll { scroll-padding-left: 132px; } }

/* «Похожие»: big ‹ › at the carousel edges (mouse / touch scrolling still works) */
.ld-sim-wrap { position: relative; }
.ld-sim-arrow {
  position: absolute; top: calc(50% - 30px); transform: translateY(-50%); z-index: 3;
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .16); color: #fff;
  background: rgba(15, 20, 32, .78); backdrop-filter: blur(8px); box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  transition: background .15s, color .15s, transform .15s, opacity .15s;
}
.ld-sim-arrow svg { width: 26px; height: 26px; }
.ld-sim-arrow.is-prev { left: -8px; }
.ld-sim-arrow.is-prev svg { transform: rotate(180deg); }
.ld-sim-arrow.is-next { right: -8px; }
.ld-sim-arrow:hover { background: var(--signal); color: var(--ink); transform: translateY(-50%) scale(1.06); }
.ld-sim-arrow[hidden] { display: none; }
@media (max-width: 900px) {
  .ld-sim-arrow { width: 40px; height: 40px; }
  .ld-sim-arrow svg { width: 20px; height: 20px; }
  .ld-sim-arrow.is-prev { left: -4px; }
  .ld-sim-arrow.is-next { right: -4px; }
}
@media (hover: none) and (pointer: coarse) { .ld-sim-arrow { opacity: .85; } }
.ch:focus-visible .ch-fav, .ch-fav:focus-visible { opacity: 1; }
.kbd-nav .screen:focus-visible { outline-offset: -3px; box-shadow: none; }
/* one selection at a time: while the remote is used, the mouse hover look stays off */
.kbd-nav .lib-card:hover:not(:focus-visible) .lib-poster { transform: none; outline-color: transparent; }
.kbd-nav .ch:hover:not(:focus-visible), .kbd-nav .ld-ep:hover { background: transparent; }
.kbd-nav .ch.is-active:hover:not(:focus-visible) { background: var(--raised); }
.kbd-nav .ld-ep.is-next:hover { background: var(--signal-soft); }
/* room for the selected poster's ring and lift inside the carousel */
.ld-sim-row { padding: 12px 10px 14px; margin: -8px -10px 0; }
