body:has(.livebox) header.top { z-index: 40 !important; }
body:has(.livebox) .side { z-index: 30 !important; }

body:has(.livebox) .watch:not(.stage-wide) {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 340px !important;
  height: calc(100dvh - 58px) !important;
  max-height: calc(100dvh - 58px) !important;
  overflow: hidden !important;
  align-items: stretch !important;
}
body:has(.livebox) .player-col {
  min-width: 0 !important;
  min-height: 0 !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: auto !important;
}
body:has(.livebox) .watch:not(.stage-wide) .player:has(.livebox) {
  position: relative !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  height: 100% !important;
  max-height: calc(100dvh - 58px) !important;
  min-height: 0 !important;
  aspect-ratio: auto !important;
  overflow: hidden !important;
  background: #000 !important;
  z-index: 1 !important;
}
body:has(.livebox) .watch.stage-wide {
  grid-template-columns: minmax(0, 1fr) !important;
  height: calc(100dvh - 58px) !important;
}
body:has(.livebox) .watch.stage-wide .player:has(.livebox) {
  position: relative !important;
  width: 100% !important;
  height: calc(100dvh - 58px) !important;
  min-height: 0 !important;
  aspect-ratio: auto !important;
  overflow: hidden !important;
  background: #000 !important;
}

body:has(.livebox) .livebox {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 2 !important;
  overflow: hidden !important;
  background: #000 !important;
}
body:has(.livebox) .livebox-video {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  background: #000 !important;
}
body:has(.livebox) .channel-row {
  position: static !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  z-index: 1 !important;
  background: transparent !important;
  padding: 0.85rem 1rem 1rem !important;
}
body:has(.livebox) .chatbox {
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

body:has(.livebox) .livebox-bar {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 6 !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 2px !important;
  height: 48px !important;
  padding: 0 8px !important;
  overflow: visible !important;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.88)) !important;
}
body .livebox-bar .kb,
body .yt-bar button.dock-play,
body .yt-bar button.dock-btn {
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  flex: 0 0 40px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #fff !important;
  box-shadow: none !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  display: inline-grid !important;
  place-items: center !important;
}
body .livebox-bar .kb svg,
body .yt-bar button svg {
  width: 22px !important;
  height: 22px !important;
  display: block !important;
  fill: currentColor !important;
  background: none !important;
}
body .livebox .ic-play,
body .livebox .ic-pause,
body .livebox .ic-vol,
body .livebox .ic-mute,
body .dock-play .ic-play,
body .dock-play .ic-pause {
  position: static !important;
  inset: auto !important;
  width: 22px !important;
  height: 22px !important;
  margin: 0 !important;
  background: none !important;
  animation: none !important;
  transform: none !important;
}
body .livebox:not(.is-paused) .ic-play,
body .livebox.is-paused .ic-pause,
body .livebox:not(.is-muted) .ic-mute,
body .livebox.is-muted .ic-vol,
body .stage-dock.is-playing .dock-play .ic-play,
body .stage-dock.is-paused .dock-play .ic-pause,
body .stage-dock:not(.is-playing) .dock-play .ic-pause {
  display: none !important;
}
body .livebox:not(.is-paused) .ic-pause,
body .livebox.is-paused .ic-play,
body .livebox:not(.is-muted) .ic-vol,
body .livebox.is-muted .ic-mute,
body .stage-dock.is-playing .dock-play .ic-pause,
body .stage-dock.is-paused .dock-play .ic-play,
body .stage-dock:not(.is-playing) .dock-play .ic-play {
  display: grid !important;
}
body .livebox-bar button:not(.kb),
body .livebox-end button {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 30px !important;
  min-height: 0 !important;
  flex: 0 0 auto !important;
  padding: 0 10px !important;
  border: 0 !important;
  border-radius: 4px !important;
  background: #c62828 !important;
  color: #fff !important;
  box-shadow: none !important;
}
body .livebox-go {
  width: auto !important;
  min-width: 0 !important;
  height: auto !important;
  padding: 12px 18px !important;
  background: #c45100 !important;
  color: #fff !important;
  border: 0 !important;
}
body .livebox-vol,
body .yt-vol {
  width: 84px !important;
  min-width: 84px !important;
  max-width: 84px !important;
  height: 4px !important;
  flex: 0 0 84px !important;
  padding: 0 !important;
  opacity: 1 !important;
  accent-color: #fff !important;
}
body .yt-bar,
body .livebox-bar {
  pointer-events: auto !important;
}
body .yt-fill::after,
body button.dock-choice::before {
  display: block !important;
  content: "" !important;
}
body button.dock-choice.on::before { content: "✓" !important; display: block !important; }

@media (max-width: 980px) {
  body:has(.livebox) .watch,
  body:has(.livebox) .watch:not(.stage-wide) {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    grid-template-columns: 1fr !important;
  }
  body:has(.livebox) .player-col { height: auto !important; overflow: visible !important; }
  body:has(.livebox) .chatbox {
    height: 70vh !important;
    border-left: 0 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  }
  body:has(.livebox) .livebox-vol { width: 0 !important; min-width: 0 !important; max-width: 0 !important; flex: 0 0 0 !important; }
  body:has(.livebox) .player:has(.livebox) {
    flex: 0 0 auto !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
    max-height: 70dvh !important;
  }
}

html[data-theme="light"] body:has(.livebox),
html[data-theme="light"] body:has(.livebox) .watch,
html[data-theme="light"] body:has(.livebox) .shell,
html[data-theme="light"] body:has(.livebox) .maincol {
  background: var(--bg) !important;
  color: var(--fg) !important;
}
html[data-theme="light"] body:has(.livebox) .chatbox,
html[data-theme="light"] body:has(.livebox) .channel-row,
html[data-theme="light"] body:has(.livebox) .watch .channel-row {
  background: var(--surface) !important;
  color: var(--fg) !important;
  border-color: var(--line) !important;
}
html[data-theme="light"] body:has(.livebox) .chatbox,
html[data-theme="light"] body:has(.livebox) .chat-line,
html[data-theme="light"] body:has(.livebox) .watch h1,
html[data-theme="light"] body:has(.livebox) .watch p {
  color: var(--fg) !important;
}
html[data-theme="light"] body:has(.livebox) .player,
html[data-theme="light"] body:has(.livebox) .livebox {
  background: #000 !important;
}
