:root {
  --bg: #07080d;
  --elev: #10121a;
  --soft: #171a24;
  --line: rgba(232, 214, 170, 0.12);
  --ink: #f4efe4;
  --muted: #9a937f;
  --gold: #e8c872;
  --violet: #9d7cff;
  --live: #ff5d73;
  --font: "Figtree", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); }
a { color: var(--gold); text-decoration: none; }
.tv { min-height: 100%; display: flex; flex-direction: column; }
.tv-bar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16,18,26,.95), rgba(7,8,13,.9));
  position: sticky; top: 0; z-index: 5;
}
.tv-brand { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.tv-brand .mark {
  width: 38px; height: 38px; border-radius: 12px;
  background: conic-gradient(from 210deg, #e8c872, #9d7cff, #e8c872);
  display: grid; place-items: center; color: #111; font-weight: 700; font-family: var(--display);
}
.tv-brand strong { display: block; font-family: var(--display); font-size: 15px; }
.tv-brand span { color: var(--muted); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.tv-search {
  flex: 1; max-width: 420px;
  background: var(--soft); border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 10px 16px; outline: none;
}
.tv-meta { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; }
.live-pill {
  background: rgba(255,93,115,.15); color: #ff8a9a; border: 1px solid rgba(255,93,115,.35);
  padding: 4px 10px; border-radius: 999px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
}
.tv-main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  min-height: 0;
}
.stage { padding: 16px 16px 24px; }
.screen {
  position: relative;
  background: #000;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 16 / 9;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
.screen video { width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
.osd {
  position: absolute; left: 16px; bottom: 56px;
  background: linear-gradient(90deg, rgba(0,0,0,.7), transparent);
  padding: 10px 16px; border-radius: 12px; pointer-events: none;
  max-width: 80%;
}
.osd-name { font-family: var(--display); font-size: 22px; }
.osd-sub { color: #cfc6b0; font-size: 12px; margin-top: 4px; }
.err {
  position: absolute; inset: auto 16px 16px 16px;
  background: rgba(80,10,20,.88); color: #fecdd3; padding: 10px 14px; border-radius: 10px; font-size: 13px;
}
.rail {
  border-left: 1px solid var(--line);
  background: rgba(16,18,26,.7);
  display: flex; flex-direction: column; min-height: 0;
}
.rail-head {
  padding: 14px 16px 8px;
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
}
.rail-list { overflow: auto; padding: 0 10px 24px; display: flex; flex-direction: column; gap: 6px; }
.ch {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  background: transparent; border: 1px solid transparent; color: inherit;
  border-radius: 14px; padding: 8px; cursor: pointer;
}
.ch img { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: #1c1f2a; }
.ch b { display: block; font-size: 13px; }
.ch i { display: block; font-style: normal; color: var(--muted); font-size: 11px; }
.ch:hover { background: rgba(255,255,255,.04); }
.ch.on {
  background: linear-gradient(90deg, rgba(232,200,114,.16), rgba(157,124,255,.08));
  border-color: rgba(232,200,114,.25);
}
.ch.hide { display: none; }
@media (max-width: 900px) {
  .tv-main { grid-template-columns: 1fr; }
  .rail { border-left: 0; border-top: 1px solid var(--line); max-height: 42vh; }
  .tv-search { max-width: none; }
  .tv-brand span, .live-pill { display: none; }
}
