:root {
  color-scheme: dark;
  --bg: #0d131a;
  --panel: #141c25;
  --border: #2a3543;
  --muted: #9aaabb;
  --text: #f5f8fa;
  --accent: #51dfbd;
  --accent-dark: #103d36;
}
* { box-sizing: border-box; }
html { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { margin: 0; min-width: 280px; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .4; cursor: not-allowed; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.app { margin: auto; max-width: 1600px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 74px; padding: 0 32px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 23px; font-weight: 800; letter-spacing: -.7px; }
.brand-mark { width: 28px; height: 28px; border: 3px solid var(--accent); display: inline-grid; place-items: center; border-radius: 8px; transform: rotate(-10deg); }
.brand-mark span { width: 8px; height: 8px; border-radius: 100%; background: var(--accent); }
.brand-accent { color: var(--accent); }
.source-link { color: #d3deea; text-decoration: none; font-size: 13px; }
.source-link:hover, footer a:hover { text-decoration: underline; }
.layout { display: grid; grid-template-columns: 350px minmax(0, 1fr); min-height: 0; flex: 1; }
.sidebar { border-right: 1px solid var(--border); background: #111923; display: flex; flex-direction: column; min-width: 0; max-height: calc(100vh - 112px); }
.sidebar-head { padding: 28px 20px 14px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 1.7px; }
h1, h2 { margin: 0; line-height: 1.2; letter-spacing: -.6px; }
h1 { font-size: 26px; margin-bottom: 22px; }
h2 { font-size: clamp(19px, 2.2vw, 27px); overflow-wrap: anywhere; }
.count { display: inline-block; border: 1px solid var(--border); border-radius: 12px; color: var(--muted); padding: 4px 9px; font-size: 13px; font-weight: 600; vertical-align: middle; letter-spacing: normal; }
.search-wrap { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: #1b2530; padding: 0 13px; border-radius: 10px; min-height: 44px; }
.search-wrap:focus-within { border-color: var(--accent); }
.search-icon { font-size: 23px; color: var(--muted); line-height: 1; }
input[type=search] { width: 100%; min-width: 0; border: none; outline: none; background: transparent; color: var(--text); font-size: 14px; }
input::placeholder { color: #8293a6; }
.results-info { font-size: 12px; margin: 12px 0 0; color: var(--muted); min-height: 18px; }
.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 12px; }
.filters label { min-width: 0; color: #d0deec; font-size: 12px; font-weight: 600; }
.filters select { display: block; width: 100%; height: 42px; margin-top: 5px; padding: 0 27px 0 9px; background: #1b2530; color: var(--text); border: 1px solid var(--border); border-radius: 8px; font-size: 12px; }
.filters select:disabled { opacity: .55; }
.filter-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.filter-button { background: #263341; border: 1px solid #405061; color: #e8f1f7; border-radius: 8px; min-height: 42px; padding: 9px 10px; font-size: 12px; }
.filter-button[aria-pressed="true"] { color: #0b2925; background: var(--accent); border-color: var(--accent); }
.filter-note { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.empty-state { color: #c2d0dd; padding: 14px 20px; line-height: 1.5; font-size: 13px; }
.channel-list { padding: 4px 9px 12px; margin: 0; list-style: none; overflow-y: auto; overscroll-behavior: contain; flex: 1; min-height: 80px; }
.channel-list:empty { flex: 0 0 auto; }
.channel-row { list-style: none; display: flex; align-items: center; gap: 3px; }
.channel-item { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; text-align: left; border: 1px solid transparent; background: transparent; color: var(--text); border-radius: 10px; padding: 10px 7px; min-height: 60px; }
.channel-item:hover { background: #1e2a37; }
.channel-item.selected { border-color: #267c6c; background: #15342f; }
.favorite-button { flex: 0 0 43px; height: 44px; border: 1px solid transparent; background: transparent; border-radius: 9px; color: #bac9d7; font-size: 23px; }
.favorite-button:hover { background: #263644; }
.favorite-button[aria-pressed="true"] { color: var(--accent); }
.channel-icon { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 9px; background: #263544; font-size: 13px; font-weight: 800; color: #d9e8f2; }
.selected .channel-icon { background: #256858; color: #f0fff9; }
.channel-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.channel-name { font-size: 13.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-group { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-caret { margin-left: auto; color: var(--accent); opacity: 0; }
.selected .play-caret { opacity: 1; }
.more-button { margin: 0 14px 15px; padding: 12px; background: #263644; border: 1px solid var(--border); color: var(--text); border-radius: 9px; }
.playlist-alert { background: #352922; border: 1px solid #866442; margin: 0 16px 12px; border-radius: 10px; padding: 13px; font-size: 13px; }
.playlist-alert p { margin: 0 0 10px; }
.small-button { border: 1px solid #c1966b; color: #f6e5d2; background: #473326; border-radius: 7px; padding: 7px 10px; }
.main-panel { min-width: 0; padding: 35px clamp(20px, 4.5vw, 72px) 24px; display: flex; flex-direction: column; }
.player-header { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 25px; }
.live-badge { border: 1px solid #315948; border-radius: 8px; padding: 7px 9px; white-space: nowrap; color: #a6e5ce; font-size: 10px; letter-spacing: 1px; font-weight: 750; }
.live-badge i { display: inline-block; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; margin-right: 4px; }
.screen { position: relative; width: 100%; aspect-ratio: 16 / 9; border: 1px solid #2d3948; background: #050a0e; border-radius: 13px; overflow: hidden; }
video { width: 100%; height: 100%; display: block; background: #050a0e; object-fit: contain; }
.placeholder { pointer-events: none; position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; background: radial-gradient(ellipse at 50% 45%, #1d3540, #090f15 70%); text-align: center; padding: 20px; }
.placeholder strong { font-size: clamp(17px, 2vw, 23px); }
.placeholder p { color: var(--muted); font-size: 13px; margin: 0; }
.tv-icon { color: var(--accent); font-size: 52px; line-height: 1; margin-bottom: 6px; }
.player-actions { border: 1px solid var(--border); border-top: none; border-radius: 0 0 11px 11px; margin-top: -10px; padding: 22px 20px 16px; background: var(--panel); }
.status-row { display: flex; align-items: flex-start; gap: 9px; }
.status-dot { background: #78899a; border-radius: 100%; flex: 0 0 7px; height: 7px; margin-top: 6px; }
.status-dot.loading { background: #efc66c; }
.status-dot.playing { background: var(--accent); }
.status-dot.error { background: #f37b78; }
.player-status { margin: 0; font-size: 12.5px; color: #c7d2df; line-height: 1.5; overflow-wrap: anywhere; }
.action-buttons { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 17px; }
.action-button { min-height: 39px; background: #263341; border: 1px solid #334558; border-radius: 8px; color: #f1f5fb; font-weight: 650; padding: 9px 14px; font-size: 12px; }
.action-button:hover:not(:disabled) { background: #354858; }
.action-button.primary { color: #06251f; background: var(--accent); border-color: var(--accent); }
.action-button.primary:hover:not(:disabled) { background: #86f6d8; }
.tip { display: flex; gap: 10px; border: 1px solid #2a3d4a; border-radius: 9px; padding: 13px 16px; margin-top: 22px; color: #aabac8; font-size: 12px; line-height: 1.7; }
.tip span { font-size: 18px; color: #8acfc3; }
.tip p { margin: 0; }
footer { border-top: 1px solid var(--border); padding: 12px 25px; color: var(--muted); font-size: 11px; text-align: center; }
@media (max-width: 850px) {
  .topbar { padding: 0 18px; height: 62px; }
  .brand { font-size: 20px; }
  .layout { display: flex; flex-direction: column; }
  .main-panel { order: 0; padding: 22px 16px; }
  .sidebar { order: 1; border-right: 0; border-top: 1px solid var(--border); max-height: none; }
  .sidebar-head { padding: 23px 16px 11px; }
  .channel-list { max-height: 410px; }
  .player-header { margin-bottom: 17px; }
  .player-actions { padding: 19px 12px 12px; }
  .action-buttons { gap: 7px; }
  .action-button { flex: 1 1 auto; }
  .tip { margin-top: 15px; }
}
@media (max-width: 380px) {
  .brand { font-size: 18px; }
  .source-link { font-size: 11px; }
  .main-panel { padding: 17px 10px; }
  .placeholder p { font-size: 11px; }
  .live-badge { font-size: 9px; padding: 5px; }
  .filters { gap: 6px; }
  .filters select { padding-left: 5px; font-size: 11px; }
  .filter-button { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color .12s ease; }
}
