:root {
  --bg: #0c0d10;
  --panel: #15161a;
  --tile: #1d1f25;
  --hover: #272a32;
  --active: #33364a;
  --text: #f2f3f5;
  --muted: #8f96a3;
  --accent: #ff3d5a;
  --accent2: #ffb703;
  --brand: linear-gradient(90deg, var(--accent), var(--accent2));
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  display: flex;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 "gg sans", "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

/* ---------- marka ---------- */

.brand-name, .brand-tv { font-weight: 900; letter-spacing: .06em; }
.brand-name {
  background: var(--brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-tv {
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: .8em;
}

.brand { padding: 14px 14px 4px; font-size: 22px; display: flex; align-items: center; }

/* ---------- panel boczny ---------- */

#sidebar {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid #000;
}

.filters { display: grid; grid-template-columns: 1fr 120px; gap: 8px; padding: 10px 12px 6px; }

.filters input, .filters select {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 8px;
}
.filters input:focus, .filters select:focus { outline: none; border-color: var(--accent); }

#tabs { display: flex; gap: 6px; padding: 6px 12px; }
#tabs button {
  flex: 1;
  padding: 7px 4px;
  background: var(--tile);
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
}
#tabs button.on { background: var(--brand); color: #1a0b0e; }

#chips {
  display: flex;
  gap: 6px;
  padding: 4px 12px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
#chips::-webkit-scrollbar { display: none; }
#chips button {
  flex-shrink: 0;
  padding: 4px 10px;
  background: var(--tile);
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
#chips button.on { background: var(--text); color: var(--bg); font-weight: 700; }

#count { padding: 0 14px 6px; font-size: 12px; color: var(--muted); }

#list {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  grid-auto-rows: max-content;
  gap: 8px;
  padding: 0 12px 14px;
}

.ch {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--tile);
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left;
  transition: background .12s ease, transform .12s ease;
}
.ch:hover { background: var(--hover); }
.ch:active { transform: scale(.98); }
.ch.active { background: var(--active); border-color: var(--accent); }

.ch .logo {
  height: 52px;
  display: grid;
  place-items: center;
  background: #ffffff10;
  border-radius: 6px;
}
.ch .logo img { max-width: 90%; max-height: 40px; object-fit: contain; }
.ch .logo img.none { visibility: hidden; }

.ch .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch .meta { font-size: 12px; color: var(--muted); min-height: 1em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ch .star {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: #000a;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  opacity: 0;
  transition: opacity .12s ease;
}
.ch:hover .star, .ch .star.on, .ch:focus-within .star { opacity: 1; }
.ch .star.on { color: var(--accent2); }

.empty { grid-column: 1 / -1; padding: 24px 8px; text-align: center; color: var(--muted); }

/* ---------- główna część ---------- */

main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid #000;
}

#title {
  flex: 1;
  margin: 0;
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#title .chname { color: var(--text); font-weight: 700; margin-left: 12px; letter-spacing: 0; }
#viewers { color: var(--muted); }

header button {
  min-width: 36px;
  padding: 6px 10px;
  background: var(--tile);
  border: 0;
  border-radius: 8px;
  font-size: 16px;
}
header button:hover { background: var(--hover); }
#fav.on { color: var(--accent2); }
#menu { display: none; }

/* ---------- przewijający się pasek ---------- */

.ticker {
  overflow: hidden;
  background: var(--brand);
  color: #1a0b0e;
  font-weight: 900;
  letter-spacing: .18em;
  font-size: 12px;
  line-height: 22px;
  white-space: nowrap;
  user-select: none;
}
.track {
  display: inline-block;
  animation: scroll 40s linear infinite;
}
.track span { display: inline-block; padding-right: 2.2em; }
@keyframes scroll { to { transform: translateX(-50%); } }

/* ---------- ekran ---------- */

.screen { position: relative; flex: 1; min-height: 0; background: #000; }
#video { width: 100%; height: 100%; display: block; object-fit: contain; }

#now {
  position: absolute;
  left: 16px;
  top: 14px;
  padding: 6px 12px;
  background: #000b;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}
#now.show { opacity: 1; transform: none; }

#status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}
#status[hidden] { display: none; }

#unmute {
  position: absolute;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
}

/* ---------- trybuny ---------- */

.stands {
  flex-shrink: 0;
  height: 96px;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 0 18px;
  overflow-x: auto;
  overflow-y: hidden;
  background:
    linear-gradient(180deg, #000 0, transparent 14px),
    repeating-linear-gradient(180deg, #1a1b22 0 12px, #14151a 12px 24px);
  border-top: 2px solid var(--accent);
  padding-bottom: 10px;
  scrollbar-width: none;
}
.stands::-webkit-scrollbar { display: none; }

.stands .none { margin: auto; color: var(--muted); font-size: 13px; }

.fan {
  position: relative;
  flex-shrink: 0;
  width: 58px;
  height: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: sit .45s cubic-bezier(.2, .9, .3, 1.2) both;
}
.fan .head {
  z-index: 1;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--c);
  background: var(--c);
  overflow: hidden;
  font-weight: 800;
  color: #fff;
}
.fan .head img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fan .body {
  margin-top: -6px;
  width: 44px;
  height: 30px;
  border-radius: 16px 16px 4px 4px;
  background: var(--c);
  filter: brightness(.8);
}
.fan .fname {
  margin-top: 3px;
  max-width: 100%;
  padding: 1px 6px;
  border-radius: 999px;
  background: #000a;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@keyframes sit { from { transform: translateY(70px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .track { animation: none; }
  .ch, #now { transition: none; }
  .fan { animation: none; }
}

@media (max-width: 700px) {
  #menu { display: block; }
  #sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10;
    width: min(360px, 90vw);
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .menu-open #sidebar { transform: none; box-shadow: 0 0 40px #000a; }
  header { padding: 8px 10px; }
}
