:root {
  --bg-base:     #08090e;
  --bg-surface:  #0e1018;
  --bg-elevated: #151821;
  --bg-card:     #1a1f2e;

  --border:        rgba(255,255,255,.07);
  --border-active: rgba(99,179,237,.3);

  --accent:      #3b82f6;
  --accent-glow: rgba(59,130,246,.3);
  --accent-soft: rgba(59,130,246,.11);
  --red:         #ef4444;

  --txt-1: #eef2ff;
  --txt-2: #7c88a0;
  --txt-3: #3e4a5e;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;

  --sidebar-w:    310px;
  --header-h:     58px;
  --mobile-nav-h: 62px;

  --ease:   cubic-bezier(.22,1,.36,1);
  --font:   'Sora', sans-serif;
  --mono:   'JetBrains Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--txt-1);
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

input, select, textarea { font-size: 16px !important; }

img    { display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

::-webkit-scrollbar       { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-card); border-radius: 99px; }

#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  grid-template-areas: "header header" "sidebar main";
  height: 100dvh;
  overflow: hidden;
  transition: grid-template-columns .3s var(--ease);
}

#app.sidebar-hidden {
  grid-template-columns: 0 1fr;
}

#app.sidebar-hidden #sidebar {
  transform: translateX(-100%);
  pointer-events: none;
}

#header {
  grid-area: header;
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  background: rgba(8,9,14,.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100;
  flex-shrink: 0;
}

.logo { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.logo-text {
  font-size: 1rem; font-weight: 700; letter-spacing: -.02em;
  background: linear-gradient(90deg, #fff 55%, var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo-badge {
  font-size: .58rem; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--accent);
  background: var(--accent-soft); border: 1px solid var(--accent-glow);
  padding: 2px 7px; border-radius: 99px;
}

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration { display: none; -webkit-appearance: none; }

.search-clear {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--txt-3); display: flex; align-items: center;
  padding: 2px; border-radius: 4px;
  transition: color .15s;
}
.search-clear[hidden] { display: none; }
.search-clear:hover { color: var(--txt-1); }

#search-results-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 12px 40px rgba(0,0,0,.55);
  z-index: 500;
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  animation: fadeUp .18s var(--ease) both;
}
#search-results-dropdown::-webkit-scrollbar { width: 3px; }
#search-results-dropdown::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 99px; }

.sr-header {
  padding: 8px 14px 5px;
  font-size: .58rem; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--txt-3);
  border-bottom: 1px solid var(--border);
}

.sr-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid rgba(255,255,255,.03);
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover, .sr-item.active, .sr-item.focused { background: var(--bg-elevated); }
.sr-item.active { background: var(--accent-soft); }

.sr-logo {
  width: 34px; height: 34px; border-radius: 6px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  overflow: hidden; display: grid; place-items: center;
  flex-shrink: 0;
}
.sr-logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.sr-letter { font-size: .85rem; font-weight: 700; color: var(--accent); }

.sr-info { flex: 1; min-width: 0; }
.sr-name {
  font-size: .8rem; font-weight: 600; color: var(--txt-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sr-meta {
  font-size: .62rem; color: var(--txt-3); margin-top: 1px;
  display: flex; align-items: center; gap: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sr-item.active .sr-name { color: var(--accent); }

.sr-empty {
  padding: 20px 14px;
  text-align: center;
  font-size: .78rem; color: var(--txt-3);
}

.header-search {
  flex: 1;
  display: flex;
  justify-content: center;
}
.header-search-inner {
  position: relative;
  width: 100%; max-width: 480px;
}
.header-search input {
  width: 100%;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 8px 36px 8px 38px;
  font-family: var(--font); font-size: .84rem; color: var(--txt-1);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.header-search input::placeholder { color: var(--txt-3); }
.header-search input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.header-search .search-icon {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%); color: var(--txt-3);
  pointer-events: none; display: flex;
}

.header-meta { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.channel-total { font-size: .7rem; font-family: var(--mono); color: var(--txt-3); white-space: nowrap; }
.channel-total span { color: var(--accent); }

.live-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: .68rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--red);
  background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.2);
  padding: 4px 11px; border-radius: 99px;
}
.live-dot {
  width: 6px; height: 6px; background: var(--red);
  border-radius: 50%; animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.35; transform:scale(.65); }
}

#sidebar-toggle {
  display: flex;
  width: 36px; height: 36px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-sm); align-items: center; justify-content: center;
  color: var(--txt-2); transition: background .2s, color .2s;
  flex-shrink: 0;
}
#sidebar-toggle:hover { background: var(--bg-card); color: var(--txt-1); }

#sidebar {
  grid-area: sidebar;
  display: flex; flex-direction: column;
  background: rgba(12,14,20,.85);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: transform .35s var(--ease);
  min-height: 0;
  will-change: transform;
}

.sidebar-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-label {
  font-size: .6rem; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--txt-3); margin-bottom: 8px;
}

#sidebar-search-section { display: none; }

.sidebar-search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 8px 12px;
  color: var(--txt-3); transition: border-color .2s, box-shadow .2s;
}
.sidebar-search-wrap:focus-within {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#sidebar-search-input {
  flex: 1; background: none; border: none; outline: none;
  font-family: var(--font); font-size: .84rem; color: var(--txt-1);
}
#sidebar-search-input::placeholder { color: var(--txt-3); }

.custom-select {
  position: relative;
}
.custom-select-trigger {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 7px 10px;
  cursor: pointer; transition: border-color .2s, box-shadow .2s;
  user-select: none;
}
.custom-select:focus .custom-select-trigger,
.custom-select[aria-expanded="true"] .custom-select-trigger {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
.country-flag { font-size: 1rem; line-height: 1; flex-shrink: 0; width: 20px; text-align: center; }
.custom-select-value {
  flex: 1; font-family: var(--font); font-size: .8rem; color: var(--txt-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.select-caret {
  width: 14px; height: 14px; color: var(--txt-3);
  flex-shrink: 0; pointer-events: none;
  transition: transform .2s var(--ease);
}
.custom-select[aria-expanded="true"] .select-caret { transform: rotate(180deg); }

.custom-select-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-md); list-style: none;
  max-height: 220px; overflow-y: auto; overflow-x: hidden;
  z-index: 300;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  display: none;
  padding: 4px;
}
.custom-select-list::-webkit-scrollbar { width: 3px; }
.custom-select-list::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 99px; }
.custom-select[aria-expanded="true"] .custom-select-list { display: block; }

.custom-select-option {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--r-sm);
  font-size: .8rem; color: var(--txt-2);
  cursor: pointer; transition: background .12s, color .12s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.custom-select-option:hover { background: var(--bg-elevated); color: var(--txt-1); }
.custom-select-option.selected { background: var(--accent-soft); color: var(--accent); }
.custom-select-option .opt-flag { font-size: .95rem; flex-shrink: 0; width: 20px; text-align: center; }
.custom-select-option .opt-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }

.cat-tabs { display: flex; gap: 5px; flex-wrap: wrap; }
.cat-tab {
  font-size: .68rem; font-weight: 500; color: var(--txt-2);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 99px; padding: 4px 11px;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.cat-tab:hover,
.cat-tab:focus-visible { border-color: var(--border-active); color: var(--txt-1); outline: none; }
.cat-tab.active { background: var(--accent-soft); border-color: var(--border-active); color: var(--accent); }

.channel-count {
  font-size: .66rem; font-family: var(--mono); color: var(--txt-3);
  padding: 7px 14px 5px; flex-shrink: 0;
}
.channel-count span { color: var(--accent); }

.ch-fav-btn {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; flex-shrink: 0;
  color: var(--txt-3);
  opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
}
.ch-fav-btn svg { width: 13px; height: 13px; }
.ch-fav-btn.is-fav { color: #f43f5e; opacity: 1; }
.channel-item:hover .ch-fav-btn { opacity: 1; }
.ch-fav-btn:hover { color: #f43f5e; background: rgba(244,63,94,.1); }

.sr-fav-btn {
  opacity: 1;
  margin-left: auto;
  flex-shrink: 0;
}

.cat-tab[data-cat="favs"].active {
  background: rgba(244,63,94,.12);
  border-color: rgba(244,63,94,.35);
  color: #f43f5e;
}
.cat-tab[data-cat="favs"] svg { fill: currentColor; }
#channel-list {
  flex: 1; overflow-y: auto;
  padding: 4px 6px 12px;
  display: flex; flex-direction: column; gap: 1px;
  list-style: none;
  min-height: 0;
}

.channel-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-md);
  cursor: pointer; border: 1px solid transparent;
  transition: background .13s, border-color .13s;
  position: relative; overflow: hidden;
  height: 54px;
  flex-shrink: 0;
  box-sizing: border-box;
}
.channel-item::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--accent-soft), transparent);
  opacity: 0; transition: opacity .15s; pointer-events: none;
}
.channel-item:hover { background: var(--bg-elevated); }
.channel-item:hover::before { opacity: 1; }
.channel-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.channel-item.active { background: var(--accent-soft); border-color: var(--border-active); }
.channel-item.active::before { opacity: 1; }

.ch-logo-wrap {
  width: 38px; height: 38px; border-radius: 7px;
  background: var(--bg-card); overflow: hidden;
  flex-shrink: 0; display: grid; place-items: center;
  border: 1px solid var(--border);
}
.ch-logo-wrap img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.ch-logo-wrap .ch-letter { font-size: .9rem; font-weight: 700; color: var(--accent); }

.ch-info { flex: 1; min-width: 0; }
.ch-name {
  font-size: .79rem; font-weight: 600; color: var(--txt-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.3;
}
.active .ch-name { color: var(--accent); }
.ch-meta {
  font-size: .63rem; color: var(--txt-3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 4px;
}
.ch-flag { font-size: .7rem; line-height: 1; }

.ch-now-badge {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); box-shadow: 0 0 6px var(--accent-glow);
  animation: pulse 1.8s ease-in-out infinite;
  display: none;
}
.active .ch-now-badge { display: block; }

.skel-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; min-height: 54px; }
.skel-logo {
  width: 38px; height: 38px; border-radius: 7px; flex-shrink: 0;
  background: linear-gradient(90deg,var(--bg-card) 25%,var(--bg-elevated) 50%,var(--bg-card) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
.skel-text { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.skel-line {
  height: 9px; border-radius: 99px;
  background: linear-gradient(90deg,var(--bg-card) 25%,var(--bg-elevated) 50%,var(--bg-card) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
.skel-line.wide { width: 70%; }
.skel-line.narrow { width: 40%; }
@keyframes shimmer { 0%{background-position:-200% 0} 100%{background-position:200% 0} }

#load-bar {
  height: 2px; background: var(--accent-soft);
  position: relative; flex-shrink: 0; overflow: hidden;
}
#load-bar::after {
  content: ''; position: absolute; top: 0; left: -60%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: loadSlide 1.2s ease-in-out infinite;
}
#load-bar.done { display: none; }
@keyframes loadSlide { to { left: 100%; } }

#main {
  grid-area: main;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
  min-height: 0;

  will-change: width;
}

#player-wrap {
  position: relative; background: #000;
  flex: 1; width: 100%; overflow: hidden; min-height: 0;
}
#video-el { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.player-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 10; }

.now-playing-badge {
  position: absolute; top: 12px; left: 12px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(8,9,14,.78); border: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-radius: var(--r-md); padding: 7px 13px 7px 8px;
  max-width: 260px; opacity: 0; pointer-events: none;
}
.now-playing-badge.visible { animation: badgeLifecycle 5s var(--ease) forwards; }
@keyframes badgeLifecycle {
  0%   { opacity:0; transform:translateY(-6px); }
  10%  { opacity:1; transform:translateY(0); }
  72%  { opacity:1; transform:translateY(0); }
  100% { opacity:0; transform:translateY(-6px); }
}
.now-logo {
  width: 30px; height: 30px; border-radius: 6px;
  background: var(--bg-card); overflow: hidden;
  flex-shrink: 0; display: grid; place-items: center;
  font-weight: 700; color: var(--accent); font-size: .85rem;
}
.now-logo img { width:100%; height:100%; object-fit:contain; padding:3px; }
.now-info { min-width: 0; }
.now-label   { font-size:.56rem; font-weight:600; letter-spacing:.1em; text-transform:uppercase; color:var(--txt-3); }
.now-ch-name { font-size:.8rem; font-weight:700; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.mute-hint {
  position: absolute; bottom: 14px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 7px;
  background: rgba(8,9,14,.82); border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-radius: 99px; padding: 7px 16px 7px 12px;
  font-size: .75rem; font-weight: 600; color: var(--txt-1);
  cursor: pointer; pointer-events: all;
  white-space: nowrap;
  animation: mute-hint-in .3s var(--ease) both;
}
.mute-hint[hidden] { display: none; }
.mute-hint:hover { background: rgba(30,35,50,.9); border-color: var(--border-active); }
@keyframes mute-hint-in {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#resume-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 20;
}
#resume-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(8,9,14,.82); color: #fff;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 99px;
  padding: 10px 20px 10px 14px;
  font-family: var(--font); font-size: .85rem; font-weight: 600;
  cursor: pointer; transition: background .18s, border-color .18s;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
#resume-btn svg { width: 16px; height: 16px; flex-shrink: 0; fill: var(--accent); }
#resume-btn:hover,
#resume-btn:active { background: rgba(30,36,52,.9); border-color: var(--border-active); }

.buffer-overlay {
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,.5); backdrop-filter:blur(4px); -webkit-backdrop-filter:blur(4px);
  opacity:0; pointer-events:none; transition: opacity .25s ease;
}
.buffer-overlay.show { opacity:1; pointer-events:none; }
.spinner {
  width:42px; height:42px;
  border:3px solid rgba(255,255,255,.1); border-top-color:var(--accent);
  border-radius:50%; animation:spin .8s linear infinite;
}
@keyframes spin { to{transform:rotate(360deg)} }

.error-overlay {
  position:absolute; inset:0; display:none;
  flex-direction:column; align-items:center; justify-content:center;
  gap:12px; background:rgba(0,0,0,.9); text-align:center; padding:24px;
}
.error-overlay.show { display:flex; }
.error-icon { font-size:2.2rem; }
.error-msg  { font-size:.86rem; color:var(--txt-2); max-width:260px; line-height:1.6; white-space:pre-line; }
.error-retry {
  background:var(--accent); color:#fff; border-radius:var(--r-sm);
  padding:8px 20px; font-size:.8rem; font-weight:600;
  font-family:var(--font); cursor:pointer; border:none;
  transition:opacity .2s; pointer-events:all;
}
.error-retry:hover { opacity:.8; }

.idle-screen {
  position:absolute; inset:0;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:14px; background:radial-gradient(ellipse at center,#13172a 0%,#08090e 70%);
}
.idle-screen.hidden { display:none; }
.idle-icon {
  width:68px; height:68px;
  background:var(--accent-soft); border:1px solid var(--border-active);
  border-radius:var(--r-xl); display:grid; place-items:center;
  animation:float 3.5s ease-in-out infinite;
}
.idle-icon svg { width:30px; height:30px; color:var(--accent); }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
.idle-title { font-size:1.05rem; font-weight:700; color:var(--txt-1); }
.idle-sub   { font-size:.8rem; color:var(--txt-3); text-align:center; max-width:220px; line-height:1.5; }

#info-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-top: 1px solid var(--border);
  min-height: 68px; flex-shrink: 0; background: var(--bg-base);
}
.info-thumb {
  width: 44px; height: 44px; border-radius: var(--r-sm);
  background: var(--bg-card); overflow: hidden; flex-shrink: 0;
  display: grid; place-items: center; border: 1px solid var(--border);
}
.info-thumb img { width:100%; height:100%; object-fit:contain; padding:4px; }
.info-thumb .no-logo { font-size:1.1rem; }
.info-body { flex: 1; min-width: 0; }
.info-ch-name {
  font-size: .95rem; font-weight: 700; color: var(--txt-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.info-ch-name.idle { color: var(--txt-3); font-weight: 400; font-size: .83rem; }
.info-ch-sub { font-size: .72rem; color: var(--txt-3); margin-top: 2px; }
.info-actions { display: flex; gap: 7px; margin-left: auto; flex-shrink: 0; }
.info-btn {
  width: 34px; height: 34px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--txt-2);
  cursor: pointer; transition: all .18s;
}
.info-btn:hover,
.info-btn:focus-visible { background: var(--bg-card); color: var(--txt-1); border-color: var(--border-active); outline: none; }
.info-btn svg { width: 15px; height: 15px; }

#suggestions-panel { display: none; }

#mobile-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--mobile-nav-h); background: rgba(8,9,14,.97);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border); z-index: 200;
  align-items: stretch;
}
.mob-tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: .58rem; font-weight: 600; letter-spacing: .04em;
  color: var(--txt-3); padding: 0;
  border-radius: 0; cursor: pointer; transition: color .18s;
}
.mob-tab svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.mob-tab.active { color: var(--accent); }

#toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 9px 18px;
  font-size: .8rem; color: var(--txt-1); z-index: 9999;
  opacity: 0; transition: all .26s var(--ease);
  white-space: nowrap; pointer-events: none;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes fadeUp {
  from { opacity:0; transform:translateY(6px); }
  to   { opacity:1; transform:translateY(0); }
}

@media (max-width: 900px) {


  #app {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-h) 1fr;
    grid-template-areas: "header" "main";
    transition: none;
  }


  #app.sidebar-hidden {
    grid-template-columns: 1fr;
  }


  #header         { gap: 10px; padding: 0 14px; }
  .header-search  { display: none; }
  .channel-total  { display: none; }


  #sidebar {
    position: fixed;
    top: var(--header-h); left: 0; bottom: var(--mobile-nav-h);
    width: min(var(--sidebar-w), 88vw);
    z-index: 150;
    transform: translateX(-100%);
    box-shadow: 4px 0 40px rgba(0,0,0,.6);
  }
  #sidebar.open { transform: translateX(0); }


  #app.sidebar-hidden #sidebar { transform: translateX(-100%); pointer-events: none; }
  #app.sidebar-hidden #sidebar.open { transform: translateX(0); pointer-events: auto; }

  #sidebar-search-section { display: block; }


  .sidebar-overlay {
    display: none; position: fixed;
    inset: 0; top: var(--header-h); bottom: var(--mobile-nav-h);
    background: rgba(0,0,0,.6); z-index: 140;
  }
  .sidebar-overlay.show { display: block; }


  #mobile-nav { display: flex; }


  #main {
    height: calc(100dvh - var(--header-h));
    min-height: 0;
    padding-bottom: var(--mobile-nav-h);
  }


  #player-wrap { flex: none; height: 42dvh; min-height: 180px; }


  #info-bar { display: none; }

  #suggestions-panel {
    display: flex; flex-direction: column;
    flex: 1; min-height: 0;
    border-top: 1px solid var(--border);
    overflow: hidden;
    background: var(--bg-base);
  }


  #toast { bottom: calc(var(--mobile-nav-h) + 10px); }


  .sug-header-top {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-surface);
  }

  .sug-now { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }

  .sug-now-thumb {
    width: 38px; height: 38px; border-radius: var(--r-sm);
    background: var(--bg-card); border: 1px solid var(--border);
    overflow: hidden; flex-shrink: 0;
    display: grid; place-items: center;
    font-size: .9rem; font-weight: 700; color: var(--accent);
  }
  .sug-now-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }

  .sug-now-text { flex: 1; min-width: 0; }
  .sug-now-name {
    font-size: .8rem; font-weight: 600; color: var(--txt-1);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .sug-now-sub {
    font-size: .63rem; color: var(--txt-3); margin-top: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  .sug-controls { display: flex; gap: 6px; flex-shrink: 0; }

  .sug-btn {
    width: 36px; height: 36px;
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--r-sm); display: grid; place-items: center;
    color: var(--txt-2); cursor: pointer; transition: all .18s;
  }
  .sug-btn:hover,
  .sug-btn:active   { background: var(--bg-card); color: var(--txt-1); border-color: var(--border-active); }
  .sug-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .sug-btn svg { width: 15px; height: 15px; }


  .sug-header-bottom {
    display: flex; align-items: center;
    padding: 8px 14px 6px; flex-shrink: 0;
  }
  .sug-label {
    font-size: .6rem; font-weight: 600; letter-spacing: .1em;
    text-transform: uppercase; color: var(--txt-3);
  }


  #suggestions-list {
    list-style: none;
    display: flex; flex-direction: column; gap: 5px;
    overflow-y: auto; overflow-x: hidden;
    padding: 6px 10px 10px;
    flex: 1; min-height: 0;
    -webkit-overflow-scrolling: touch;
  }
  #suggestions-list::-webkit-scrollbar { width: 2px; }
  #suggestions-list::-webkit-scrollbar-thumb { background: var(--bg-card); border-radius: 99px; }

  .sug-item {
    display: flex; flex-direction: row; align-items: center; gap: 11px;
    flex-shrink: 0; padding: 9px 11px;
    border-radius: var(--r-md); border: 1px solid var(--border);
    background: var(--bg-elevated);
    cursor: pointer; transition: border-color .15s, background .15s;
    position: relative; overflow: hidden;
  }
  .sug-item:hover,
  .sug-item:active { background: var(--bg-card); border-color: var(--border-active); }

  .sug-logo {
    width: 44px; height: 44px; border-radius: var(--r-sm);
    background: var(--bg-card); border: 1px solid var(--border);
    overflow: hidden; display: grid; place-items: center;
    flex-shrink: 0; position: relative;
  }
  .sug-logo img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
  .sug-letter   { font-size: 1rem; font-weight: 700; color: var(--accent); }

  .sug-live-badge {
    position: absolute; top: 3px; left: 3px;
    font-size: .42rem; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; background: var(--red); color: #fff;
    border-radius: 3px; padding: 1px 4px; line-height: 1.4; display: none;
  }
  .sug-item[data-online="1"] .sug-live-badge { display: block; }

  .sug-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
  .sug-name {
    font-size: .79rem; font-weight: 600; color: var(--txt-1);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3;
  }
  .sug-cat { font-size: .62rem; color: var(--txt-3); white-space: nowrap; }

  .sug-arrow { width: 16px; height: 16px; color: var(--txt-3); flex-shrink: 0; opacity: .4; }
}

@media (max-width: 480px) {

  #player-wrap { height: 36dvh; min-height: 160px; }

  .logo-text  { font-size: .9rem; }
  .logo-badge { display: none; }

  .idle-icon     { width: 54px; height: 54px; }
  .idle-icon svg { width: 24px; height: 24px; }
  .idle-title    { font-size: .9rem; }
  .idle-sub      { font-size: .75rem; }

  .sug-header-top { padding: 8px 12px; }
  .sug-now-thumb  { width: 34px; height: 34px; }
  .sug-now-name   { font-size: .76rem; }
  .sug-btn        { width: 34px; height: 34px; }
  #suggestions-list { padding: 5px 8px 8px; }
  .sug-item       { padding: 8px 10px; }
  .sug-logo       { width: 40px; height: 40px; }
  .sug-name       { font-size: .74rem; }
}

.about-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--txt-2);
  cursor: pointer; transition: all .18s; flex-shrink: 0;
}
.about-btn:hover { background: var(--bg-card); color: var(--txt-1); border-color: var(--border-active); }

@media (max-width: 900px) {
  .about-btn { display: none; }
}

#about-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  align-items: center; justify-content: center;
  padding: 20px;
}
#about-overlay.open { display: flex; }

#about-modal {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 100%; max-width: 480px;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 52px 28px 28px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  animation: modalIn .25s var(--ease) both;
}
@keyframes modalIn {
  from { opacity:0; transform:translateY(16px) scale(.97); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}
#about-modal::-webkit-scrollbar { width: 3px; }
#about-modal::-webkit-scrollbar-thumb { background: var(--bg-card); border-radius: 99px; }

#about-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-sm); display: grid; place-items: center;
  color: var(--txt-2); cursor: pointer; transition: all .18s;
}
#about-close:hover { background: var(--bg-card); color: var(--txt-1); border-color: var(--border-active); }

.about-hero {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 8px; margin-bottom: 28px;
}
.about-title {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -.03em;
  background: linear-gradient(90deg, #fff 50%, var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.about-tagline { font-size: .82rem; color: var(--txt-3); line-height: 1.5; }

.about-section { margin-bottom: 20px; }
.about-section-title {
  font-size: .6rem; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--txt-3); margin-bottom: 10px;
}
.about-text {
  font-size: .82rem; color: var(--txt-2); line-height: 1.7; margin-bottom: 8px;
}
.about-text:last-child { margin-bottom: 0; }
.about-text a { color: var(--accent); text-decoration: none; }
.about-text a:hover { text-decoration: underline; }

.about-dev {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px;
}
.about-dev-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--bg-card); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 1.4rem; flex-shrink: 0;
}
.about-dev-name { font-size: .88rem; font-weight: 600; color: var(--txt-1); margin-bottom: 4px; }
.about-dev-bio  { font-size: .74rem; color: var(--txt-3); line-height: 1.5; margin-bottom: 6px; }
.about-dev-link {
  font-size: .72rem; font-weight: 600; color: var(--accent);
  text-decoration: none; transition: opacity .15s;
}
.about-dev-link:hover { opacity: .75; }

.donate-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: #0070ba; color: #fff;
  border-radius: var(--r-md); padding: 11px 20px;
  font-family: var(--font); font-size: .84rem; font-weight: 600;
  text-decoration: none; margin-top: 12px;
  transition: opacity .2s, transform .15s;
  border: none; cursor: pointer;
}
.donate-btn:hover { opacity: .88; transform: translateY(-1px); }
.donate-btn:active { transform: translateY(0); }

.about-divider {
  height: 1px; background: var(--border); margin: 20px 0;
}

.about-meta {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; flex-wrap: wrap;
  font-size: .65rem; font-family: var(--mono); color: var(--txt-3);
}
.about-dot { opacity: .4; }

@media (max-width: 480px) {
  #about-overlay { padding: 0; align-items: flex-end; }
  #about-modal {
    max-width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0;
    max-height: 88dvh;
    padding: 52px 20px 32px;
  }
}

#help-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  align-items: center; justify-content: center;
  padding: 20px;
}
#help-overlay.open { display: flex; }

#help-modal {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 100%; max-width: 480px;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 52px 28px 28px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  animation: modalIn .25s var(--ease) both;
}
#help-modal::-webkit-scrollbar { width: 3px; }
#help-modal::-webkit-scrollbar-thumb { background: var(--bg-card); border-radius: 99px; }

#help-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-sm); display: grid; place-items: center;
  color: var(--txt-2); cursor: pointer; transition: all .18s;
}
#help-close:hover { background: var(--bg-card); color: var(--txt-1); border-color: var(--border-active); }

.help-steps { display: flex; flex-direction: column; gap: 14px; }
.help-step {
  display: flex; gap: 14px; align-items: flex-start;
}
.help-step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); border: 1px solid var(--border-active);
  color: var(--accent); font-size: .78rem; font-weight: 700;
  display: grid; place-items: center; flex-shrink: 0;
  margin-top: 1px;
}
.help-step-title {
  font-size: .84rem; font-weight: 600; color: var(--txt-1); margin-bottom: 3px;
}
.help-step-desc {
  font-size: .78rem; color: var(--txt-2); line-height: 1.6;
}
.help-step-desc strong { color: var(--txt-1); }
.help-step-desc em { color: var(--accent); font-style: normal; }

.help-controls { display: flex; flex-direction: column; gap: 8px; }
.help-ctrl {
  display: flex; align-items: center; gap: 12px;
  font-size: .8rem; color: var(--txt-2);
}
.help-ctrl-key {
  min-width: 42px; padding: 3px 8px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 6px; font-family: var(--mono); font-size: .72rem;
  color: var(--txt-1); text-align: center;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  #help-overlay { padding: 0; align-items: flex-end; }
  #help-modal {
    max-width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0;
    max-height: 88dvh; padding: 52px 20px 32px;
  }
}

#install-banner {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border-active);
  border-radius: var(--r-md); padding: 10px 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  z-index: 9998; white-space: nowrap;
  animation: fadeUp .3s var(--ease) both;
}
.install-banner-text { font-size: .8rem; color: var(--txt-1); }
.install-banner-btn {
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--r-sm);
  padding: 5px 14px; font-family: var(--font);
  font-size: .78rem; font-weight: 600; cursor: pointer;
  transition: opacity .2s;
}
.install-banner-btn:hover { opacity: .85; }
.install-banner-dismiss {
  color: var(--txt-3); font-size: .8rem; padding: 2px 4px;
  border-radius: 4px; transition: color .15s;
}
.install-banner-dismiss:hover { color: var(--txt-1); }

@media (max-width: 600px) {
  #install-banner {
    left: 12px; right: 12px; bottom: 72px;
    transform: none; white-space: normal;
    flex-wrap: wrap;
  }
  .install-banner-text { flex: 1 100%; }
}

.donate-qr-wrap {
  display: flex; align-items: center; gap: 16px;
  margin-top: 16px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px;
}
.donate-qr {
  width: 150px; height: 150px; border-radius: var(--r-sm);
  object-fit: cover; flex-shrink: 0;
}
.donate-bank { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; }
.donate-bank-row { display: flex; flex-direction: column; gap: 2px; }
.donate-bank-label {
  font-size: .58rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--txt-3);
}
.donate-bank-value {
  font-size: .8rem; font-weight: 500; color: var(--txt-1);
}
.donate-bank-acct {
  font-family: var(--mono); font-size: .84rem;
  color: var(--accent); letter-spacing: .05em;
  word-break: break-all;
}
.donate-acct-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.donate-copy-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent-soft); border: 1px solid var(--accent-glow);
  border-radius: var(--r-sm); padding: 3px 9px;
  font-family: var(--font); font-size: .68rem; font-weight: 600;
  color: var(--accent); cursor: pointer; white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s;
}
.donate-copy-btn:hover { background: rgba(59,130,246,.2); }
.donate-copy-btn.copied {
  background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.3);
  color: #22c55e;
}

.player-playpause-btn {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(8,9,14,.82); color: #fff;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 99px;
  padding: 10px 20px 10px 14px;
  font-family: var(--font); font-size: .85rem; font-weight: 600;
  cursor: pointer; pointer-events: all;
  opacity: 0; z-index: 10;
  transition: opacity .2s var(--ease), background .18s, border-color .18s, transform .15s;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  white-space: nowrap;
}
.player-playpause-btn[hidden] { display: none; }
.player-playpause-btn svg { width: 16px; height: 16px; flex-shrink: 0; fill: var(--accent); }
.player-playpause-btn:hover { background: rgba(30,36,52,.9); border-color: var(--border-active); }
.player-playpause-btn:active { transform: translate(-50%, -50%) scale(.96); }

#player-wrap .player-overlay::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(0,0,0,0);
  transition: background .2s var(--ease);
  pointer-events: none;
  z-index: 9;
}
#player-wrap.controls-visible:not(:has(.error-overlay.show)) .player-overlay::before {
  background: rgba(0,0,0,.25);
}
#player-wrap.controls-visible .player-playpause-btn:not([hidden]) {
  opacity: 1;
}
