html {
  -webkit-text-size-adjust: 100%;
}
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: #000;
  color: #fff;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  height: 100dvh;
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

#topbar {
  padding-top: calc(var(--safe-top) + 8px);
  padding-bottom: 8px;
  background: rgba(20, 20, 20, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: opacity 0.18s ease;
}

body.theater #topbar {
  opacity: 0;
  pointer-events: none;
}

#player-wrap {
  position: relative;
  flex: 1 1 auto;
}
#player {
  position: absolute;
  inset: 0;
  border: 0;
  width: 100%;
  height: 100%;
}

@media (min-width: 1024px) {
  #layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-rows: 1fr;
    height: calc(100dvh - var(--safe-top));
  }
  #sidebar {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #d1d5db;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.icon-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.chan-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
}
.chan-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
.chan-item.active {
  background: rgba(37, 99, 235, 0.22);
  border: 1px solid rgba(37, 99, 235, 0.35);
}
.fav-btn {
  color: #9ca3af;
  border-radius: 8px;
  padding: 6px;
  font-size: 18px;
  line-height: 1;
}
.fav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.fav-btn.is-fav {
  color: #facc15;
}
.del-btn {
  color: #ef4444;
  border-radius: 8px;
  padding: 6px;
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
}
.del-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fff;
}
.edit-only {
  display: none;
}
.edit-mode .edit-only {
  display: inline-flex;
}
.edit-mode .hide-when-edit {
  display: none;
}

.sheet {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 60;
}
.sheet.open {
  display: block;
}
.sheet .scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.sheet .panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 16px 16px 0 0;
  background: rgba(12, 12, 12, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  transform: translateY(110%);
  transition: transform 0.2s ease;
}
.sheet.open .panel {
  transform: translateY(0%);
}
#channels-panel {
  height: min(82dvh, 700px);
  padding-bottom: calc(var(--safe-bottom) + 10px);
}

#m-list {
  max-height: calc(78dvh - 80px);
}

#toast {
  position: fixed;
  top: calc(var(--safe-top) + 10px);
  left: 50%;
  transform: translate(-50%, -140%);
  background: rgba(30, 30, 30, 0.92);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 600;
  z-index: 70;
  transition: transform 0.28s ease;
  pointer-events: none;
}
#toast.show {
  transform: translate(-50%, 0);
}

#toast.toast-info {
  background: rgba(30, 30, 30, 0.92);
}

#toast.toast-error {
  background: rgba(127, 29, 29, 0.92);
}

#rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ef4444;
  animation: pulse 1.6s infinite;
  display: none;
}
.rec-on #rec-dot {
  display: inline-block;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

/* Remove any ads/overlays injected into top document */
#dontfoid,
.ad,
[id*="ad-"],
[class*="ad-"],
[class*="ads-"] {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}
