:root {
  --bg: #04060d;
  --glass: rgba(12, 18, 32, 0.55);
  --glass-strong: rgba(8, 12, 24, 0.82);
  --glass-border: rgba(255, 255, 255, 0.09);
  --text: #f0f4ff;
  --text-muted: #7d8aa8;
  --neon-cyan: #22d3ee;
  --neon-purple: #818cf8;
  --neon-pink: #f472b6;
  --neon-violet: #6366f1;
  --accent: var(--neon-violet);
  --accent-glow: rgba(99, 102, 241, 0.45);
  --sidebar-w: 290px;
  --topbar-h: 68px;
  --player-h: clamp(220px, 38vh, 420px);
  --radius: 16px;
  --radius-sm: 10px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Outfit", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input { font: inherit; }

.hidden { display: none !important; }

/* ── Ambient background ── */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: orbFloat 18s ease-in-out infinite;
}

.orb-1 {
  width: 55vw; height: 55vw;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.5), transparent 70%);
  top: -20%; left: -10%;
}

.orb-2 {
  width: 45vw; height: 45vw;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.35), transparent 70%);
  bottom: -15%; right: -5%;
  animation-delay: -6s;
}

.orb-3 {
  width: 30vw; height: 30vw;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.25), transparent 70%);
  top: 40%; left: 35%;
  animation-delay: -12s;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, black, transparent);
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(3%, 2%) scale(1.05); }
  66% { transform: translate(-2%, 3%) scale(0.97); }
}

/* ── FX layer ── */
.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.smoke-puff {
  position: fixed;
  border-radius: 50%;
  background: radial-gradient(circle, var(--smoke-color, #6366f1) 0%, transparent 70%);
  opacity: 0.55;
  transform: translate(-50%, -50%) scale(0.3);
  animation: smokeRise var(--dur, 1s) ease-out var(--delay, 0s) forwards;
  filter: blur(8px);
  mix-blend-mode: screen;
}

.click-ring {
  position: fixed;
  width: 20px; height: 20px;
  border: 2px solid var(--ring-color, #6366f1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: ringExpand 0.6s ease-out forwards;
  box-shadow: 0 0 20px var(--ring-color), inset 0 0 10px var(--ring-color);
}

.spark {
  position: fixed;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--spark-color, #22d3ee);
  box-shadow: 0 0 8px var(--spark-color);
  transform: translate(-50%, -50%);
  animation: sparkFly 0.5s ease-out forwards;
}

@keyframes smokeRise {
  0% { opacity: 0.6; transform: translate(calc(-50% + 0px), calc(-50% + 0px)) scale(0.2) rotate(0deg); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.8) rotate(var(--rot)); }
}

@keyframes ringExpand {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(4); }
}

@keyframes sparkFly {
  0% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--sx)), calc(-50% + var(--sy))); }
}

/* ── Glass utilities ── */
.glass {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border);
}

.glass-subtle {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.neon-frame {
  position: relative;
}

.neon-frame::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius) + 1px);
  background: linear-gradient(135deg, rgba(99,102,241,0.5), rgba(34,211,238,0.2), rgba(244,114,182,0.3));
  z-index: -1;
  opacity: 0.6;
  filter: blur(1px);
}

.neon-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  box-shadow: inset 0 0 30px rgba(99, 102, 241, 0.06);
  pointer-events: none;
}

#app {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--glass-border);
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.brand-icon {
  position: relative;
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--neon-violet), var(--neon-cyan));
  box-shadow: 0 0 28px var(--accent-glow), 0 0 60px rgba(34, 211, 238, 0.15);
  font-size: 0.85rem;
  color: white;
}

.brand-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 14px;
  border: 1px solid rgba(99, 102, 241, 0.4);
  animation: brandPulse 2.5s ease-in-out infinite;
}

@keyframes brandPulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.08); }
}

.brand h1 {
  margin: 0;
  font-family: "Syne", sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(90deg, #fff, var(--neon-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-tag {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--neon-cyan);
  opacity: 0.8;
}

.search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.search-wrap input,
.search-panel input {
  width: 100%;
  padding: 0.72rem 1rem 0.72rem 2.5rem;
  padding-right: 4rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.search-wrap input:focus,
.search-panel input:focus {
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12), 0 0 24px rgba(34, 211, 238, 0.08);
}

.search-hint {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.68rem;
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 0.12rem 0.4rem;
  background: rgba(255,255,255,0.04);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem 0.25rem 0.85rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 0.82rem;
  color: var(--neon-cyan);
}

.topbar-actions { display: flex; gap: 0.5rem; }

.icon-btn {
  width: 42px; height: 42px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor: pointer;
  transition: all 0.25s;
  font-size: 1.1rem;
}

.neon-hover:hover,
.icon-btn.active {
  border-color: rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  transform: translateY(-1px);
}

.mobile-only { display: none; }

/* ── Layout ── */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 0;
  overflow: hidden;
}

/* ── Sidebar (scrolls independently) ── */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--glass-border);
  overflow: hidden;
}

.sidebar-sticky {
  flex-shrink: 0;
  padding: 0.85rem 0.85rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(4, 6, 13, 0.4);
  backdrop-filter: blur(12px);
}

.sidebar-label {
  margin: 0 0 0.6rem 0.25rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--neon-cyan);
  opacity: 0.7;
}

.prefix-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.prefix-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 500;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.prefix-btn .pfx-icon { font-size: 0.85rem; }

.prefix-btn:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
}

.prefix-btn.active {
  color: white;
  border-color: var(--pfx-color, var(--accent));
  background: linear-gradient(135deg, color-mix(in srgb, var(--pfx-color, var(--accent)) 35%, transparent), rgba(255,255,255,0.05));
  box-shadow: 0 0 20px color-mix(in srgb, var(--pfx-color, var(--accent)) 40%, transparent), inset 0 0 12px rgba(255,255,255,0.05);
}

.prefix-btn.active .pfx-count {
  background: rgba(0,0,0,0.3);
  color: rgba(255,255,255,0.85);
}

.pfx-count {
  font-size: 0.65rem;
  opacity: 0.75;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
}

.category-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(99,102,241,0.4) transparent;
}

.category-list::-webkit-scrollbar { width: 4px; }
.category-list::-webkit-scrollbar-thumb {
  background: rgba(99,102,241,0.4);
  border-radius: 4px;
}

.category-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.3rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.category-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-color: rgba(255,255,255,0.08);
  transform: translateX(3px);
}

.category-btn.active {
  background: linear-gradient(90deg, rgba(99,102,241,0.18), rgba(34,211,238,0.06));
  color: var(--text);
  border-color: rgba(99,102,241,0.35);
  box-shadow: 0 0 16px rgba(99,102,241,0.12), inset 3px 0 0 var(--neon-cyan);
}

.cat-icon {
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.category-btn.active .cat-icon {
  background: rgba(99,102,241,0.25);
  box-shadow: 0 0 12px rgba(99,102,241,0.3);
}

.cat-text {
  flex: 1;
  min-width: 0;
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-btn .count {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: rgba(0,0,0,0.35);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.category-btn.active .count {
  color: var(--neon-cyan);
  border-color: rgba(34,211,238,0.25);
}

/* ── Main: player fixed, grid scrolls ── */
.main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 1rem 1.25rem 0;
}

.player-section {
  flex-shrink: 0;
  padding: 0.85rem;
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  z-index: 10;
}

.player-wrap {
  position: relative;
  width: 100%;
  height: var(--player-h);
  background: #000;
  border-radius: calc(var(--radius) - 4px);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 0 40px rgba(99,102,241,0.08);
}

.player-scanline {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px);
  pointer-events: none;
  z-index: 2;
  opacity: 0.4;
}

.player-mount {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #000;
}

.player-mount .clappr-container,
.player-mount [data-player] {
  width: 100% !important;
  height: 100% !important;
}

.player-mount .media-control[data-media-control] {
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
}

.player-mount .media-control-icon[data-media-control="fullscreen"] {
  display: none;
}

.player-placeholder,
.player-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  background: radial-gradient(ellipse at center, #0d1220, #04060d);
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.placeholder-ring {
  position: absolute;
  width: 100px; height: 100px;
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 50%;
  animation: placeholderRing 3s ease-in-out infinite;
}

@keyframes placeholderRing {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.15); opacity: 0.8; box-shadow: 0 0 30px rgba(99,102,241,0.3); }
}

.placeholder-icon { font-size: 2.5rem; opacity: 0.6; z-index: 1; }

.spinner-neon {
  width: 44px; height: 44px;
  border: 2px solid rgba(99,102,241,0.15);
  border-top-color: var(--neon-cyan);
  border-right-color: var(--neon-purple);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  box-shadow: 0 0 20px rgba(34,211,238,0.3);
}

@keyframes spin { to { transform: rotate(360deg); } }

.now-playing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
}

.now-playing-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.now-playing-logo-wrap {
  width: 52px; height: 52px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(99,102,241,0.1);
}

.now-playing-logo {
  width: 40px; height: 40px;
  object-fit: contain;
}

.now-playing h2 {
  margin: 0 0 0.15rem;
  font-size: 1.05rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-playing p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--neon-cyan);
  opacity: 0.75;
}

.now-playing-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn {
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.88rem;
  transition: all 0.2s;
}

.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-2px); }

.btn-neon {
  background: linear-gradient(135deg, var(--neon-violet), var(--neon-cyan));
  color: white;
  box-shadow: 0 4px 20px var(--accent-glow), 0 0 30px rgba(34,211,238,0.15);
}

.btn-neon:hover {
  box-shadow: 0 6px 28px var(--accent-glow), 0 0 40px rgba(34,211,238,0.25);
}

.btn-ghost {
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
}

.btn-ghost.active {
  color: #fbbf24;
  border-color: rgba(251,191,36,0.4);
  box-shadow: 0 0 16px rgba(251,191,36,0.15);
}

/* ── Scrollable channel area ── */
.main-scroll {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(99,102,241,0.35) transparent;
}

.main-scroll::-webkit-scrollbar { width: 6px; }
.main-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--neon-violet), var(--neon-cyan));
  border-radius: 6px;
  opacity: 0.5;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-top: 0.25rem;
}

.section-header h3 {
  margin: 0;
  font-family: "Syne", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.neon-badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.3);
  color: var(--neon-purple);
  box-shadow: 0 0 12px rgba(99,102,241,0.15);
}

.section-count:empty { display: none; }

/* ── Channel cards ── */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.85rem;
}

.channel-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding: 1rem 0.7rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(8px);
  cursor: pointer;
  text-align: center;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.channel-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99,102,241,0.08), transparent 60%);
  opacity: 0;
  transition: opacity 0.25s;
}

.channel-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(34,211,238,0.35);
  box-shadow: 0 12px 32px rgba(0,0,0,0.35), 0 0 24px rgba(34,211,238,0.1);
}

.channel-card:hover::before { opacity: 1; }

.channel-card.active {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 1px var(--neon-cyan), 0 0 30px rgba(34,211,238,0.25), inset 0 0 20px rgba(34,211,238,0.05);
  transform: translateY(-2px);
}

.channel-card.pop {
  animation: cardPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardPop {
  0% { transform: scale(1); }
  40% { transform: scale(0.92); }
  100% { transform: scale(1) translateY(-2px); }
}

.channel-card-logo-wrap {
  position: relative;
  width: 68px; height: 68px;
  display: grid;
  place-items: center;
}

.channel-card-logo {
  width: 64px; height: 64px;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(0,0,0,0.3);
  position: relative;
  z-index: 1;
  transition: filter 0.25s;
}

.channel-card:hover .channel-card-logo {
  filter: drop-shadow(0 0 8px rgba(34,211,238,0.4));
}

.channel-card-logo.fallback {
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  color: var(--text-muted);
}

.live-dot {
  position: absolute;
  top: -2px; right: -2px;
  width: 10px; height: 10px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid var(--bg);
  box-shadow: 0 0 8px #ef4444;
  animation: livePulse 1.5s ease-in-out infinite;
  z-index: 2;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.2); }
}

.channel-card-name {
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.channel-card-type {
  font-size: 0.62rem;
  color: var(--neon-cyan);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.7;
  position: relative;
  z-index: 1;
}

.channel-card-type.vod { color: var(--neon-purple); }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 36px; height: 36px;
  padding: 0 0.5rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(34,211,238,0.15);
}

.page-btn.active {
  background: linear-gradient(135deg, var(--neon-violet), var(--neon-purple));
  border-color: transparent;
  box-shadow: 0 0 16px var(--accent-glow);
}

.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Search overlay ── */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 13, 0.75);
  backdrop-filter: blur(12px);
  z-index: 200;
  display: grid;
  place-items: start center;
  padding-top: 10vh;
}

.search-panel {
  width: min(640px, 92vw);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5), 0 0 60px rgba(99,102,241,0.1);
}

.search-panel input {
  border: none;
  border-radius: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 1.1rem 1.25rem;
  background: rgba(0,0,0,0.3);
}

.search-results { max-height: 60vh; overflow-y: auto; }

.search-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.15s;
}

.search-item:hover {
  background: rgba(99,102,241,0.1);
}

.search-item img {
  width: 40px; height: 40px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(0,0,0,0.3);
}

.search-item-info strong { display: block; font-size: 0.9rem; }
.search-item-info span { font-size: 0.78rem; color: var(--text-muted); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  z-index: 300;
  font-size: 0.88rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 24px rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.3);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

/* ── Mobile ── */
@media (max-width: 900px) {
  html, body { overflow: auto; }
  #app { height: auto; min-height: 100vh; }

  .layout { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0; bottom: 0;
    width: min(var(--sidebar-w), 88vw);
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 60px rgba(0,0,0,0.5);
  }

  .sidebar.open { transform: translateX(0); }

  .mobile-only { display: grid; place-items: center; }
  .search-hint { display: none; }

  .main { overflow: visible; }
  .main-scroll { overflow: visible; }

  .now-playing { flex-direction: column; align-items: stretch; }
  .now-playing-actions { justify-content: stretch; }
  .now-playing-actions .btn { flex: 1; }

  :root { --player-h: clamp(200px, 32vh, 280px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .orb { animation: none; }
}

/* ── Lite mode (mobile, TV, low-end) ── */
body.lite-mode .orb,
body.lite-mode .grid-overlay,
body.lite-mode .player-scanline,
body.lite-mode .brand-pulse {
  display: none;
}

body.lite-mode .glass,
body.lite-mode .topbar,
body.lite-mode .sidebar {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.lite-mode .channel-card:hover {
  transform: none;
}

body.lite-mode .fx-layer {
  display: none;
}

@media (max-width: 600px) {
  .brand-tag { display: none; }
  .brand h1 { font-size: 1.1rem; }
  .search-wrap { max-width: none; }
  .topbar { padding: 0 0.75rem; gap: 0.5rem; }
  .channel-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.6rem;
  }
  .channel-card { padding: 0.75rem 0.5rem; }
  :root { --player-h: clamp(180px, 28vh, 240px); --topbar-h: 56px; }
}

@media (max-width: 900px) and (pointer: coarse) {
  .channel-card:active {
    transform: scale(0.98);
  }
}
