/* Стиль плеєра; фірмовий колір підставляє сервер зі сторінки «Сайт». */

:root {
  --green: #62d001;
  --green-rgb: 98, 208, 1;
  --green-dark: #52ad01;
  --on-green: #fff;          /* текст на фірмовому кольорі */
  --ink: #1e1e1e;
  --ink-soft: #5e5e5e;
  --line: #e4e6e8;
  --bg: #ffffff;
  --bg-soft: #f6f7f8;
  --player-bg: #000000;
  --radius: 6px;
  --header-h: 60px;
  --sidebar-w: 290px;
  --font: Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color-scheme: light;
}

/* Темна тема. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --green-dark: #7ae61c;
    --ink: #eceded;
    --ink-soft: #9b9fa3;
    --line: #2c2f31;
    --bg: #141618;
    --bg-soft: #1d2022;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --green-dark: #7ae61c;
  --ink: #eceded;
  --ink-soft: #9b9fa3;
  --line: #2c2f31;
  --bg: #141618;
  --bg-soft: #1d2022;
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* hidden має пріоритет над display із класів. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  font-family: Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-family: var(--font);
  color: #1e1e1e;
  color: var(--ink);
  background: #ffffff;
  background: var(--bg);
}

/* 100dvh з урахуванням панелі мобільного браузера. */
@supports (height: 100dvh) {
  body { height: 100dvh; }
}

body { display: flex; flex-direction: column; overflow: hidden; }

kbd {
  font: 500 11px Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font: 500 11px var(--font);
  background: #f6f7f8;
  background: var(--bg-soft);
  border: 1px solid #e4e6e8;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 5px;
  margin-right: 2px;
  color: #5e5e5e;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------ шапка */

.site-header {
  flex: 0 0 60px;
  flex: 0 0 var(--header-h);
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  background: #ffffff;
  background: var(--bg);
  border-bottom: 1px solid #e4e6e8;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand__mark { height: 34px; width: auto; display: block; }

/* Окремий логотип для темної теми. */
.brand__mark--dark, .login__mark--dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand__mark--light,
  :root:not([data-theme="light"]) .login__mark--light { display: none; }
  :root:not([data-theme="light"]) .brand__mark--dark { display: block; }
  :root:not([data-theme="light"]) .login__mark--dark { display: inline; }
}
:root[data-theme="dark"] .brand__mark--light,
:root[data-theme="dark"] .login__mark--light { display: none; }
:root[data-theme="dark"] .brand__mark--dark { display: block; }
:root[data-theme="dark"] .login__mark--dark { display: inline; }

/* Темний логотип на світлій плашці; вмикається на сторінці «Сайт». */
@media (prefers-color-scheme: dark) {
  :root.brand-plate:not([data-theme="light"]) .brand__mark:not(.brand__mark--dark),
  :root.brand-plate:not([data-theme="light"]) .login__mark:not(.login__mark--dark) {
    background: #fff; border-radius: 4px; padding: 3px;
  }
}
:root.brand-plate[data-theme="dark"] .brand__mark:not(.brand__mark--dark),
:root.brand-plate[data-theme="dark"] .login__mark:not(.login__mark--dark) {
  background: #fff; border-radius: 4px; padding: 3px;
}
.brand__name { font-size: 19px; font-weight: 500; letter-spacing: .2px; }
.brand__name sup { font-size: 9px; vertical-align: super; }

.site-nav { display: flex; gap: 22px; margin-left: 8px; }
.site-nav__link {
  position: relative;
  font-size: 14px;
  text-decoration: none;
  color: #1e1e1e;
  color: var(--ink);
  padding: 18px 0;
}
.site-nav__link.is-active::after,
.site-nav__link:hover::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 12px;
  height: 3px;
  background: #62d001;
  background: var(--green);
}

.account { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.account__name { font-weight: 500; }
.account__name[hidden], .channels__note[hidden] { display: none; }

.btn {
  font: 500 13px Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font: 500 13px var(--font);
  border-radius: 6px;
  border-radius: var(--radius);
  border: 1px solid #e4e6e8;
  border: 1px solid var(--line);
  background: #ffffff;
  background: var(--bg);
  color: #1e1e1e;
  color: var(--ink);
  padding: 7px 14px;
  cursor: pointer;
}
.btn:hover { border-color: var(--green); color: var(--green-dark); }
.btn--green { background: var(--green); border-color: var(--green); color: var(--on-green); }
.btn--green:hover { background: var(--green-dark); border-color: var(--green-dark); color: var(--on-green); }
.btn--ghost { background: transparent; }
#tvBtn.is-on { border-color: var(--green); color: var(--green-dark); }

/* ------------------------------------------------------------ каркас */

.tv {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 290px 1fr;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 0;
}

/* ------------------------------------------------------------ бічний список */

.channels {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid #e4e6e8;
  border-right: 1px solid var(--line);
  background: #ffffff;
  background: var(--bg);
}

.channels__head { padding: 12px; border-bottom: 1px solid var(--line); }

.channels__search {
  width: 100%;
  font: 14px Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font: 14px var(--font);
  padding: 8px 10px;
  border: 1px solid #e4e6e8;
  border: 1px solid var(--line);
  border-radius: 6px;
  border-radius: var(--radius);
  outline: none;
}
.channels__search:focus { border-color: var(--green); }

.channels__list { flex: 1 1 auto; overflow-y: auto; margin: 0; padding: 6px; list-style: none; }

.channels__hint {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0;
  padding: 10px 12px;
  border-top: 1px solid #e4e6e8;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: #5e5e5e;
  color: var(--ink-soft);
}
.channels__hint span { white-space: nowrap; }

/* Текст оператора під списком каналів. */
.channels__note {
  flex: none;
  max-height: 30%;
  overflow-y: auto;
  padding: 10px 12px;
  border-top: 1px solid #e4e6e8;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.45;
  color: #5e5e5e;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.ch {
  position: relative;
  display: grid;
  grid-template-columns: 22px 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 6px;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  overflow: hidden;
}
.ch:hover { background: var(--bg-soft); }
.ch.is-active { background: var(--green); color: var(--on-green); }
.ch.is-active .ch__num { color: var(--on-green); }

.ch__num { font-size: 12px; color: var(--ink-soft); text-align: right; font-variant-numeric: tabular-nums; }
/* Плашка під логотипом однакова для всіх і в обох темах. */
.ch__logo {
  width: 44px; height: 28px;
  box-sizing: content-box;
  object-fit: contain;
  background: #eef1f3;
  border-radius: 3px;
  padding: 2px;
}

.ch__text { min-width: 0; display: grid; }
.ch__name { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Поточна передача — другий рядок картки каналу. */
.ch__prog {
  font-size: 11px;
  color: #5e5e5e;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ch__prog:empty { display: none; }
.ch.is-active .ch__prog { color: var(--on-green); opacity: .85; }
.fs-list .ch__prog { color: #9a9a9a; }
.fs-list .ch.is-active .ch__prog { color: var(--on-green); opacity: .85; }

/* Залишок передачі. */
.ch__bar {
  position: absolute;
  left: 0; bottom: 0;
  height: 2px;
  background: #62d001;
  background: var(--green);
  opacity: .75;
}
.ch.is-active .ch__bar { background: var(--on-green); opacity: .6; }

/* ------------------------------------------------------------ плеєр */

.player {
  position: relative;
  background: #000000;
  background: var(--player-bg);
  min-height: 0;
  overflow: hidden;
}

#video { width: 100%; height: 100%; display: block; background: #000; }

/* Запасний рядок для старих телевізорів без inset. */
.overlay { position: absolute; top: 0; right: 0; bottom: 0; left: 0; inset: 0; pointer-events: none; }
.overlay > * { pointer-events: auto; }

/* Екранна індикація каналу. */
.osd {
  position: absolute;
  top: 20px; left: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 12px;
  background: rgba(0, 0, 0, .68);
  border-left: 4px solid #62d001;
  border-left: 4px solid var(--green);
  border-radius: 4px;
  color: #fff;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .25s, transform .25s;
}
.osd.is-shown { opacity: 1; transform: none; }
.osd__logo {
  width: 52px; height: 34px;
  box-sizing: content-box;
  object-fit: contain;
  background: #eef1f3;
  border-radius: 3px;
  padding: 2px;
}
.osd__text { display: grid; line-height: 1.35; }
.osd__num { font-size: 11px; color: var(--green); letter-spacing: 1px; }
.osd__name { font-size: 19px; font-weight: 500; }
.osd__prog { font-size: 13px; color: #fff; margin-top: 2px; }
.osd__prog:empty { display: none; }
.osd__next { font-size: 11px; color: #9a9a9a; }
.osd__next:empty { display: none; }
.osd { max-width: min(520px, 70%); }
.osd__name, .osd__prog, .osd__next {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ------------------------------------------------------------ інфо-бар */

.infobar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 24;   /* під статусом і програмою, над відео */
  padding: 56px 36px 88px;
  background: linear-gradient(to top, rgba(0, 0, 0, .9) 0%, rgba(0, 0, 0, .66) 55%, rgba(0, 0, 0, 0) 100%);
  color: #fff;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.infobar.is-shown { opacity: 1; transform: none; }
.infobar__head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.infobar__logo {
  width: 60px; height: 38px; box-sizing: content-box; padding: 2px;
  object-fit: contain; background: #eef1f3; border-radius: 4px;
}
.infobar__ch { display: grid; line-height: 1.25; min-width: 0; }
.infobar__num { font-size: 12px; letter-spacing: 1px; color: #62d001; color: var(--green); }
.infobar__name { font-size: 18px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.infobar__badge {
  font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 3px; background: #e5322d; color: #fff;
}
.infobar__badge.is-rec { background: #62d001; background: var(--green); color: #0b0b0b; color: var(--on-green); }
.infobar__clock { margin-left: auto; font-size: 20px; font-variant-numeric: tabular-nums; color: #e6e6e6; }
.infobar__title {
  font-size: 30px; font-weight: 600; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.infobar__desc {
  margin-top: 4px; max-width: 60em; font-size: 14px; line-height: 1.45; color: #cfcfcf;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.infobar__desc:empty { display: none; }
.infobar__bar { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.infobar__bar[hidden] { display: none; }
/* Смуга перемотки пальцем чи мишею із запасом зверху й знизу. */
.infobar.is-shown .infobar__bar { pointer-events: auto; cursor: pointer; touch-action: none; padding: 10px 0; margin-top: 4px; margin-bottom: -10px; }
.infobar__t { font-size: 14px; font-variant-numeric: tabular-nums; color: #d8d8d8; }
.infobar__track { position: relative; flex: 1 1 auto; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .25); }
.infobar__fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: #62d001; background: var(--green); }
.infobar__pos {
  position: absolute; top: 50%; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px;
  border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(0, 0, 0, .35);
}
.infobar__meta { display: flex; gap: 24px; margin-top: 8px; font-size: 14px; color: #bdbdbd; }
.infobar__meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.infobar__meta span:empty { display: none; }
/* «Ще 20 хв» не обрізається. */
.infobar__meta span:first-child { flex: none; }
.infobar__hints { margin-top: 12px; font-size: 13px; color: #9a9a9a; }
.infobar__hints:empty, html.no-hints .infobar__hints { display: none; }
.infobar__hints b {
  display: inline-block; min-width: 22px; padding: 1px 6px; margin-right: 4px;
  border: 1px solid rgba(255, 255, 255, .35); border-radius: 4px; text-align: center; font-weight: 500; color: #fff;
}
@media (max-width: 860px) {
  .infobar { padding: 32px 16px 72px; }
  .infobar__title { font-size: 19px; }
  .infobar__clock { font-size: 15px; }
  .infobar__desc { display: none; }
}
/* Компактний бар на телефоні. */
@media (max-width: 560px) {
  .infobar { padding: 10px 12px 62px; transition: opacity .25s, transform .25s, padding-bottom .2s; }
  .player:not(.is-awake) .infobar { padding-bottom: 10px; }
  .infobar__head { gap: 8px; margin-bottom: 4px; }
  .infobar__logo { width: 40px; height: 26px; }
  .infobar__num { font-size: 10px; }
  .infobar__name { font-size: 14px; }
  .infobar__badge { font-size: 10px; padding: 1px 6px; }
  .infobar__clock { font-size: 13px; }
  .infobar__title { font-size: 15px; }
  .infobar__bar { margin-top: 6px; gap: 8px; }
  .infobar__t { font-size: 12px; }
  .infobar__meta { margin-top: 4px; gap: 12px; font-size: 12px; }
  .infobar__hints { display: none; }
}

/* Програма: передачі з архіву. */
.prog.is-rec { opacity: 1; cursor: pointer; }
.prog.is-rec:hover, .prog.is-rec:focus { background: rgba(255, 255, 255, .08); outline: none; }
.prog.is-rec:focus-visible, html.is-tv .prog.is-rec:focus { box-shadow: inset 3px 0 0 #62d001; box-shadow: inset 3px 0 0 var(--green); }
.prog.is-playing { background: rgba(var(--green-rgb), .22); }
.prog__rec { display: inline-block; margin-top: 3px; font-size: 11px; color: #62d001; color: var(--green); }

/* Набір номера каналу. */
.dial {
  position: absolute;
  top: 20px; right: 20px;
  padding: 10px 20px;
  background: rgba(0, 0, 0, .75);
  border: 2px solid #62d001;
  border: 2px solid var(--green);
  border-radius: 4px;
  color: #fff;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: 4px;
  font-variant-numeric: tabular-nums;
}

/* Коротке повідомлення поверх відео. */
.toast {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  max-width: min(520px, 90%);
  padding: 9px 16px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .78);
  border-left: 3px solid #62d001;
  border-left: 3px solid var(--green);
  color: #fff;
  font-size: 14px;
  text-align: center;
  pointer-events: none;
  z-index: 30;
  animation: fade-in .2s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Скарга на канал. */
.complaint {
  position: absolute;
  right: 16px;
  bottom: 64px;
  min-width: 220px;
  padding: 6px;
  border-radius: 6px;
  background: rgba(12, 12, 12, .94);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  z-index: 30;   /* над шаром статусу */
}
.complaint__title {
  padding: 8px 12px 6px;
  font-size: 12px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #62d001;
  color: var(--green);
}
.complaint button {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
  font: 14px var(--font);
  text-align: left;
  cursor: pointer;
}
.complaint button:hover, .complaint button:focus-visible { background: rgba(255, 255, 255, .12); }

/* Улюблений канал: зірочка в панелі й позначка в списку. */
.ctl.is-on { color: #62d001; color: var(--green); border-color: var(--green); }
.ch.is-fav .ch__name::after { content: " ★"; font-size: 10px; color: var(--green); }
.ch.is-active.is-fav .ch__name::after { color: var(--on-green); }

/* Вибір звукової доріжки. */
.tracks {
  position: absolute;
  right: 16px;
  bottom: 64px;
  min-width: 180px;
  padding: 6px;
  border-radius: 6px;
  background: rgba(12, 12, 12, .94);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  z-index: 30;   /* над шаром статусу */
}
.tracks button {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
  font: 14px var(--font);
  text-align: left;
  cursor: pointer;
}
.tracks button:hover, .tracks button:focus-visible { background: rgba(255, 255, 255, .12); }
.tracks button.is-on { background: #62d001; background: var(--green); color: var(--on-green); }

/* Статус і помилка. */
.status {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  text-align: center;
  padding: 24px;
}
.status__text { margin: 0; font-size: 15px; max-width: 520px; line-height: 1.5; }

.spinner {
  width: 42px; height: 42px;
  border: 3px solid rgba(255,255,255,.22);
  border-top-color: #62d001;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.status.is-error .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Панель керування. */
.controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 30;   /* над заглушкою */
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(to top, rgba(0,0,0,.82), rgba(0,0,0,0));
  opacity: 0;
  transition: opacity .2s;
}
/* Панель лише на таймері wake(). */
.player .controls { opacity: 0; }
.player.is-awake .controls, .controls:focus-within { opacity: 1; }

.controls__spacer { flex: 1 1 auto; }

.ctl {
  min-width: 38px; height: 34px;
  font-size: 17px; line-height: 1;
  color: #fff;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 6px;
  border-radius: var(--radius);
  cursor: pointer;
}
.ctl:hover { background: var(--green); border-color: var(--green); color: var(--on-green); }

.vol { width: 96px; accent-color: var(--green); cursor: pointer; }

/* Список каналів поверх відео, зокрема у fullscreen. */
.fs-list {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  z-index: 28;   /* над заглушкою */
  width: min(340px, 80vw);
  display: flex;
  flex-direction: column;
  background: rgba(12, 12, 12, .93);
  border-right: 2px solid #62d001;
  border-right: 2px solid var(--green);
  color: #fff;
  animation: slide-in .18s ease-out;
}
@keyframes slide-in { from { transform: translateX(-100%); } to { transform: none; } }

.fs-list__head {
  padding: 14px 16px;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #62d001;
  color: var(--green);
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.fs-list__items { flex: 1 1 auto; overflow-y: auto; margin: 0; padding: 6px; list-style: none; }

.fs-list .ch { color: #fff; }
.fs-list .ch:hover { background: rgba(255,255,255,.1); }
.fs-list .ch.is-active { background: var(--green); color: var(--on-green); }
.fs-list .ch__num { color: #9a9a9a; }

/* ------------------------------------------------------------ вхід */

.login-page { display: flex; align-items: center; justify-content: center; }
.login {
  width: min(380px, 92vw);
  padding: 32px;
  border: 1px solid #e4e6e8;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: center;
}
.login__mark { height: 56px; margin-bottom: 12px; }
.login h1 { font-size: 20px; font-weight: 500; margin: 0 0 4px; }
.login p { font-size: 13px; color: var(--ink-soft); margin: 0 0 22px; line-height: 1.5; }
.login .login__support { font-size: 12px; margin: 18px 0 0; }
.login label { display: block; text-align: left; font-size: 12px; color: var(--ink-soft); margin: 0 0 4px; }
.login input {
  width: 100%;
  font: 15px Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font: 15px var(--font);
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid #e4e6e8;
  border: 1px solid var(--line);
  border-radius: 6px;
  border-radius: var(--radius);
  outline: none;
}
.login input:focus { border-color: var(--green); }
.login .btn { width: 100%; padding: 11px; font-size: 15px; }
.login__error { color: #c62828; font-size: 13px; min-height: 18px; margin: 10px 0 0; }

/* ------------------------------------------------------------ вузькі екрани */

@media (max-width: 860px) {
  /* Плеєр 16:9 на всю ширину, решта висоти — список. */
  .tv { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  /* max-height для низьких екранів. */
  .player { order: 1; aspect-ratio: 16 / 9; width: 100%; max-height: 64dvh; }
  .channels {
    order: 2;
    min-height: 0;
    border-right: none;
    border-top: 1px solid #e4e6e8;
    border-top: 1px solid var(--line);
  }
  .site-nav { display: none; }
  .site-header { gap: 12px; padding: 0 12px; }
  .brand__name { font-size: 16px; }
  .channels__hint { display: none; }
  .account__name {
    max-width: 34vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .btn { padding: 7px 10px; }

  .osd { top: 10px; left: 10px; padding: 8px 12px; max-width: 80%; }
  .osd__logo { width: 40px; height: 26px; }
  .osd__name { font-size: 16px; }
  .osd__prog { font-size: 12px; }

  .fs-list { width: min(300px, 86vw); }
  .guide { width: min(340px, 92vw); }
}

/* Телефон у ландшафті: список збоку. */
@media (max-width: 940px) and (orientation: landscape) and (max-height: 560px) {
  .tv { grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .channels {
    order: 1;
    border-right: 1px solid #e4e6e8;
    border-right: 1px solid var(--line);
    border-top: none;
  }
  .player { order: 2; aspect-ratio: auto; max-height: none; height: 100%; }
  .site-header { flex: 0 0 44px; }
  .brand__mark { height: 26px; }
  /* У бічному списку лише номер, логотип і назва. */
  .channels .ch__prog { display: none; }
  .channels .ch { grid-template-columns: 20px 38px minmax(0, 1fr); gap: 8px; }
  .channels .ch__logo { width: 38px; height: 24px; }
  .channels__head { padding: 8px; }
}

/* Панель на сенсорному екрані по дотику, з більшими кнопками. */
@media (hover: none), (pointer: coarse), (pointer: none) {
  /* На приставках панель лише на wake(). */
  .controls:focus-within { opacity: 0; }
  .player.is-awake .controls { opacity: 1; }
  .ctl { min-width: 46px; height: 42px; font-size: 20px; }
  .vol { width: 84px; height: 22px; }
  .ch { padding: 10px 8px; }
}

/* Псевдоповноекранний режим для iOS Safari. */
.player.is-pseudo-fs {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  z-index: 9999;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  /* Без 16:9 у повному екрані. */
  aspect-ratio: auto;
}

/* Нативний fullscreen на весь екран. */
.player:fullscreen,
.player:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  aspect-ratio: auto;
}

/* Відступи керування від вирізу камери й жестової смуги. */
.player:fullscreen .controls,
.player.is-pseudo-fs .controls {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.player:fullscreen .osd,
.player.is-pseudo-fs .osd {
  left: max(20px, env(safe-area-inset-left));
}

/* ------------------------------------------------------------ програма передач */

.guide {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  z-index: 28;   /* над заглушкою */
  width: min(420px, 85vw);
  display: flex;
  flex-direction: column;
  background: rgba(12, 12, 12, .93);
  border-left: 2px solid #62d001;
  border-left: 2px solid var(--green);
  color: #fff;
  animation: slide-in-right .18s ease-out;
}
@keyframes slide-in-right { from { transform: translateX(100%); } to { transform: none; } }

.guide__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  font-size: 13px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: #62d001;
  color: var(--green);
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.guide__head span { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guide__close {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  font-size: 13px; line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 4px;
  cursor: pointer;
}
.guide__close:hover { background: var(--green); border-color: var(--green); color: var(--on-green); }

.guide__items { flex: 1 1 auto; overflow-y: auto; margin: 0; padding: 6px; list-style: none; }

.prog {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  border-radius: var(--radius);
  line-height: 1.4;
}
.prog + .prog { border-top: 1px solid rgba(255, 255, 255, .07); }
.prog__time { font-size: 12px; color: #9a9a9a; font-variant-numeric: tabular-nums; }
.prog__title { font-size: 13px; }
.prog__cat { font-size: 11px; color: #8a8a8a; }
.prog__cat:empty { display: none; }

.prog.is-now { background: rgba(var(--green-rgb), .14); }
.prog.is-now .prog__time { color: var(--green); }
.prog.is-past { opacity: .45; }

.guide__empty { padding: 18px 16px; font-size: 13px; color: #9a9a9a; line-height: 1.5; }
.guide__day { position: sticky; top: 0; z-index: 1; padding: 6px 16px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #bdbdbd; background: rgba(20, 20, 20, .92); }

/* ------------------------------------------------------------ режим телевізора

   Вмикається автоматично за User-Agent смарт-ТВ або вручну через ?tv=1.
   Дивляться з 3 метрів і керують пультом, тому: шапка й бічний список
   ховаються, відео займає весь екран, а єдиний спосіб навігації — накладний
   список каналів зі стрілками й OK. Усе збільшене й відсунуте від країв,
   бо телевізори обрізають краї картинки (overscan). */

/* Кнопки панелі з адмінки, окремо для кожного пристрою. */
html.no-btn-pause #playBtn, html.no-btn-pause #liveBtn { display: none !important; }
html.no-btn-zap #prevBtn, html.no-btn-zap #nextBtn { display: none !important; }
html.no-btn-list #listBtn { display: none !important; }
html.no-btn-guide #guideBtn { display: none !important; }
html.no-btn-fav #favBtn { display: none !important; }
html.no-btn-pip #pipBtn { display: none !important; }
html.no-btn-complaint #complaintBtn { display: none !important; }
html.no-btn-mute #muteBtn { display: none !important; }
html.no-btn-volume .vol { display: none !important; }
html.no-btn-fullscreen #fsBtn, html.no-btn-fullscreen #fsQuick { display: none !important; }
html.no-btn-theme #themeBtn { display: none !important; }
html.no-btn-tvmode #tvBtn { display: none !important; }
html.no-btn-logout #logoutBtn { display: none !important; }

/* Без підказки про клавіші на телевізорі. */
html.is-tv .channels__hint { display: none; }

/* Фокус пульта. */
.ch.is-focused,
.ctl:focus-visible,
.btn:focus-visible,
.guide__close:focus-visible {
  outline: 3px solid #62d001;
  outline: 3px solid var(--green);
  outline-offset: 2px;
}
html.is-tv .ch.is-focused {
  outline-width: 4px;
  background: rgba(98, 208, 1, .18);
  background: rgba(var(--green-rgb), .18);
}
html.is-tv .ch.is-focused.is-active { background: var(--green); color: var(--on-green); }

/* Постійна кнопка «на весь екран» для сенсорних екранів. */
/* Поза повним екраном кнопка списку зайва. */
.player:not(:fullscreen):not(.is-pseudo-fs) #listBtn { display: none; }

.fs-quick { display: none; }

@media (hover: none) {
  .fs-quick {
    display: block;
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 46px;
    height: 46px;
    font-size: 21px;
    line-height: 1;
    color: #fff;
    background: rgba(0, 0, 0, .55);
    border: 1px solid rgba(255, 255, 255, .4);
    border-radius: 8px;
    cursor: pointer;
    z-index: 30;   /* над заглушкою й статусом */
    transition: opacity .2s;
  }
  /* Приховання лише візуальне. */
  .player.is-awake .fs-quick { opacity: 0; }
}

/* Без стрілок перемикання у вбудованому плеєрі на телефоні; правило з префіксним селектором окреме. */
@media (hover: none) {
  #prevBtn, #nextBtn { display: none; }

  .player:fullscreen #prevBtn,
  .player:fullscreen #nextBtn { display: inline-block; }

  .player.is-pseudo-fs #prevBtn,
  .player.is-pseudo-fs #nextBtn { display: inline-block; }
}

@media (hover: none) {
  .player:-webkit-full-screen #prevBtn,
  .player:-webkit-full-screen #nextBtn { display: inline-block; }
}

@media (hover: none) {
  /* Повзунок гучності стискається. */
  .vol { flex: 0 1 84px; min-width: 44px; }
  .controls { flex-wrap: nowrap; }
  .ctl { flex: 0 0 auto; }
  /* Другорядні кнопки на телефоні — лише в повному екрані. */
  #favBtn, #complaintBtn { display: none; }
  .player:fullscreen #favBtn, .player:fullscreen #complaintBtn,
  .player.is-pseudo-fs #favBtn, .player.is-pseudo-fs #complaintBtn { display: inline-block; }
}

@media (hover: none) {
  .player:-webkit-full-screen #favBtn,
  .player:-webkit-full-screen #complaintBtn { display: inline-block; }
}

/* ------------------------------------------------------------ пауза й ефір */

/* Прямий ефір: зелена крапка — наживо, сіра з часом — відставання. */
.live {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 500 11px Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font: 500 11px var(--font);
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 3px;
  padding: 4px 9px;
  cursor: pointer;
}
.live:hover { background: rgba(255, 255, 255, .22); }
.live__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #62d001;
  background: var(--green);
}
.live.is-behind { cursor: pointer; }
.live.is-behind .live__dot { background: #9a9a9a; }
.live.is-live { cursor: default; }

/* Позначка паузи поверх картинки. */
.paused {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  pointer-events: none;
}
.paused__icon { font-size: 54px; line-height: 1; }
.paused__text { font-size: 17px; font-weight: 500; letter-spacing: 1px; }
.paused__hint { font-size: 13px; color: #cfcfcf; }
.paused__hint:empty { display: none; }

@media (hover: none) {
  .live { font-size: 10px; padding: 4px 7px; }
}

/* ------------------------------------------------------- категорії каналів */
.channels__groups {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .5rem;
}
.grp {
  font: inherit;
  font-size: .76rem;
  line-height: 1;
  padding: .34rem .55rem;
  border: 1px solid #e4e6e8;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.grp:hover { border-color: var(--green); }
.grp.is-on {
  background: #62d001;
  background: var(--green);
  border-color: #62d001;
  border-color: var(--green);
  color: #fff;
  color: var(--on-green);
}

/* Заголовок категорії в списку без фільтра. */
.ch-group {
  padding: .45rem .75rem .25rem;
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #5e5e5e;
  color: var(--ink-soft);
  position: sticky;
  top: 0;
  background: #ffffff;
  background: var(--bg);
  z-index: 1;
}

/* --------------------------------------------- заглушка недоступного каналу */
.slate {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  background: var(--player-bg);
  z-index: 25;
  overflow: hidden;
}
video.slate__img { object-fit: cover; }
.slate__img {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .5;
}
.slate__box {
  position: relative;
  text-align: center;
  color: #fff;
  padding: 1rem 1.25rem;
  max-width: 32rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .8);
}
.slate__title { font-size: 1.15rem; font-weight: 600; }
.slate__text { margin-top: .35rem; font-size: .9rem; opacity: .85; line-height: 1.5; }

/* Канал поза розкладом притемнений. */
.ch.is-offair { opacity: .45; }

/* Без анімацій на старих телевізорах і слабких приставках. */
html.no-anim *, html.no-anim *::before, html.no-anim *::after {
  transition: none !important;
  animation: none !important;
}
html.no-hints .channels__hint { display: none; }
html.no-search .channels__search { display: none; }
html.no-groups .channels__groups { display: none !important; }

/* Минула передача із запису. */
.prog.is-past.is-rec { opacity: .85; }
