:root {
  --bg: #121826;
  --panel: #1a2336;
  --panel-2: #222d45;
  --line: #2c3a58;
  --text: #e9edf5;
  --muted: #94a0b8;
  --live: #ff5a4e;
  --accent: #5ab0ff;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { display: grid; grid-template-columns: 340px 1fr; height: 100%; }

/* ---------- Список каналов ---------- */
.side { display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); min-height: 0; }
.side-head { padding: 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.side-head input[type=search], .side-head select {
  width: 100%; padding: 9px 11px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
}
.fav-only { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; }

.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.ch {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center;
  padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line); position: relative;
}
.ch:hover { background: var(--panel-2); }
.ch.active { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--live); }
.ch .logo { width: 44px; height: 32px; object-fit: contain; background: #fff1; border-radius: 4px; }
.ch .logo.none { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.ch .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch .prog { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch .mini { height: 2px; background: var(--line); margin-top: 5px; border-radius: 2px; overflow: hidden; }
.ch .mini i { display: block; height: 100%; background: var(--live); }
.ch .star { color: var(--muted); background: none; border: 0; cursor: pointer; font-size: 18px; padding: 4px; }
.ch .star.on { color: #ffc94d; }
.empty { padding: 24px 16px; color: var(--muted); }

/* ---------- Основная часть ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto; }
.player-wrap { position: relative; background: #000; aspect-ratio: 16 / 9; max-height: 68vh; width: 100%; }
video { width: 100%; height: 100%; background: #000; display: block; }
.msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; background: #000c; }

.now { padding: 14px 20px 6px; }
.now-top { display: flex; align-items: center; gap: 10px; }
.now h1 { font-size: 20px; margin: 0; flex: 1; }
.fav { background: none; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); cursor: pointer; font-size: 18px; padding: 2px 10px; }
.fav[aria-pressed=true] { color: #ffc94d; border-color: #ffc94d66; }
.list-btn { display: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; cursor: pointer; }
.now-title { margin: 6px 0 8px; font-size: 17px; }
.bar { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; max-width: 560px; }
.bar i { display: block; height: 100%; background: var(--live); width: 0; }
.now-time { color: var(--muted); font-size: 13px; margin: 6px 0 0; min-height: 1.4em; }

.epg { padding: 10px 20px 30px; }
.days { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; }
.day { flex: none; padding: 6px 12px; border: 1px solid var(--line); background: transparent; border-radius: 999px; cursor: pointer; color: var(--muted); }
.day.active { background: var(--accent); border-color: var(--accent); color: #07131f; font-weight: 600; }
.epg-list { list-style: none; margin: 0; padding: 0; max-width: 820px; }
.pr { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pr .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.pr .ti { font-weight: 600; }
.pr .ds { color: var(--muted); font-size: 13px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pr.cur .t, .pr.cur .ti { color: var(--live); }
.pr.past { opacity: .55; }

/* ---------- Мобильная версия ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0; z-index: 10; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .list-btn { display: block; }
  .player-wrap { max-height: none; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
