:root {
  color-scheme: dark;
  --live-bg: #04110a;
  --live-panel: #0c1d13;
  --live-panel-alt: #12291b;
  --live-sidebar: #0a1710;
  --live-sidebar-hover: #12261a;
  --live-accent: #00a32a;
  --live-accent-soft: rgba(0, 163, 42, 0.22);
  --live-accent-2: #7fda8e;
  --live-green: #00a32a;
  --live-green-soft: rgba(0, 163, 42, 0.35);
  --live-text: #edf7ef;
  --live-muted: #a6c4ae;
  --live-border: rgba(140, 215, 158, 0.18);
  --live-now: #e53935;
  --live-now-glow: rgba(229, 57, 53, 0.45);
  --sidebar-collapsed: 72px;
  --sidebar-expanded: 280px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body.live-body {
  margin: 0;
  font-family: Inter, "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--live-bg);
  color: var(--live-text);
  overflow: hidden;
}

.live-shell {
  display: grid;
  grid-template-columns: var(--sidebar-collapsed) 1fr;
  height: 100vh;
  width: 100vw;
  background: var(--live-bg);
  transition: grid-template-columns 0.22s ease;
}

.live-shell.drawer-open {
  grid-template-columns: var(--sidebar-expanded) 1fr;
}

/* Sidebar — rail + drawer push layout (no overlay) */
.live-sidebar {
  display: flex;
  min-height: 0;
  min-width: 0;
  background: linear-gradient(180deg, var(--live-panel) 0%, var(--live-sidebar) 100%);
  border-right: 1px solid var(--live-border);
  overflow: hidden;
}

.sidebar-rail {
  width: var(--sidebar-collapsed);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  gap: 8px;
  border-right: 1px solid var(--live-border);
}

.sidebar-brand {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid var(--live-green);
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 4px;
  overflow: hidden;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 0 16px rgba(0, 255, 107, 0.35), 0 0 32px rgba(0, 163, 42, 0.2);
}
.sidebar-brand:hover,
.sidebar-brand:focus-visible {
  box-shadow: 0 0 22px rgba(0, 255, 107, 0.55), 0 0 44px rgba(0, 163, 42, 0.35);
  transform: scale(1.04);
}
.sidebar-brand .brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter:
    drop-shadow(0 0 6px rgba(0, 255, 107, 0.85))
    drop-shadow(0 0 14px rgba(0, 163, 42, 0.55))
    drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}
.sidebar-brand:hover {
  background: var(--live-sidebar-hover);
  transform: scale(1.04);
  box-shadow: 0 0 0 3px var(--live-accent-soft);
}

.sidebar-icons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  align-items: center;
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.sidebar-icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--live-muted);
  text-decoration: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  padding: 0;
  font: inherit;
}
.sidebar-icon-btn:hover,
.sidebar-icon-btn.active {
  background: var(--live-accent-soft);
  color: var(--live-accent-2);
}
.sidebar-icon-btn .ico { font-size: 18px; line-height: 1; }

.sidebar-drawer {
  flex: 1;
  min-width: 0;
  display: none;
  flex-direction: column;
  padding: 16px 14px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--live-panel-alt) 0%, var(--live-panel) 100%);
}

.live-shell.drawer-open .sidebar-drawer {
  display: flex;
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.drawer-brand-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.drawer-logo {
  width: 132px;
  height: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(0, 255, 107, 0.75)) drop-shadow(0 0 18px rgba(0, 163, 42, 0.45));
}
.drawer-sub { font-size: 12px; color: var(--live-muted); }
.drawer-close {
  background: transparent;
  border: 0;
  color: var(--live-text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  max-height: 42vh;
  overflow-y: auto;
}

.drawer-nav a,
.drawer-nav button.drawer-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--live-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}
.drawer-nav a:hover,
.drawer-nav button.drawer-nav-link:hover { background: rgba(0, 163, 42, 0.14); color: var(--live-accent-2); }
.drawer-nav a.active,
.drawer-nav button.drawer-nav-link.active {
  background: var(--live-accent-soft);
  color: var(--live-accent-2);
  box-shadow: inset 3px 0 0 var(--live-green);
}
.drawer-nav .nav-ico {
  width: 22px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.drawer-divider {
  height: 1px;
  background: var(--live-border);
  margin: 12px 0;
  flex-shrink: 0;
}

.drawer-section-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--live-muted);
  margin-bottom: 8px;
  flex-shrink: 0;
}

.drawer-search {
  margin-bottom: 18px;
  flex-shrink: 0;
}
.drawer-search input {
  width: 100%;
  border: 1px solid var(--live-border);
  background: rgba(0, 0, 0, 0.22);
  color: var(--live-text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}
.drawer-search input:focus {
  outline: none;
  border-color: var(--live-green);
  box-shadow: 0 0 0 2px var(--live-accent-soft);
}

.drawer-section-label {
  margin-top: 4px;
}

.drawer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.drawer-list li { margin-bottom: 4px; }
.drawer-list a,
.drawer-cat-btn,
.cat-load {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--live-muted);
  text-decoration: none;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.drawer-list a:hover,
.drawer-cat-btn:hover,
.cat-load:hover {
  background: rgba(0, 163, 42, 0.1);
  color: var(--live-text);
}
.drawer-cat-btn.cat-active,
.cat-load.cat-active {
  background: var(--live-accent-soft);
  color: var(--live-accent-2);
}
.drawer-list .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--live-muted);
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 8px;
  border-radius: 999px;
}

.cat-group { margin-bottom: 4px; }
.cat-details {
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid transparent;
}
.cat-details[open] {
  border-color: var(--live-border);
}
.cat-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px 4px 0;
  cursor: pointer;
  list-style: none;
  color: var(--live-text);
  font-size: 13px;
  font-weight: 600;
}
.cat-summary .cat-load {
  flex: 1;
  font-weight: 600;
  color: var(--live-text);
}
.cat-summary::-webkit-details-marker { display: none; }
.cat-summary-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.cat-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cat-children {
  list-style: none;
  margin: 0;
  padding: 0 0 6px 12px;
}
.cat-children .drawer-cat-btn {
  padding: 7px 10px 7px 18px;
  font-size: 12px;
}
.drawer-foot {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--live-border);
  flex-shrink: 0;
}
.drawer-link {
  color: var(--live-accent-2);
  font-size: 13px;
  text-decoration: none;
}
.drawer-link:hover { text-decoration: underline; }

/* Main */
.live-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--live-bg);
}

/* Up next strip — large image cards with title overlay */
.upnext-strip {
  flex: 0 0 auto;
  padding: 14px 18px 10px;
  background: linear-gradient(180deg, rgba(4, 17, 10, 0.98) 0%, rgba(4, 17, 10, 0.72) 100%);
  border-bottom: 1px solid var(--live-border);
}
.upnext-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x proximity;
}
.upnext-track::-webkit-scrollbar { height: 4px; }
.upnext-track::-webkit-scrollbar-thumb {
  background: var(--live-green-soft);
  border-radius: 999px;
}

.upnext-card {
  flex: 0 0 210px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  scroll-snap-align: start;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}
.upnext-card:hover {
  border-color: var(--live-green-soft);
  transform: translateY(-2px);
}
.upnext-card.active {
  border-color: var(--live-green);
  box-shadow: 0 0 0 1px var(--live-accent-soft);
}
.upnext-card.is-next { border-color: var(--live-green); }

.upnext-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #0a1710;
}

.upnext-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.upnext-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 10px;
  background: linear-gradient(
    to top,
    rgba(4, 17, 10, 0.92) 0%,
    rgba(4, 17, 10, 0.45) 48%,
    transparent 100%
  );
}

.upnext-label {
  align-self: flex-start;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  margin-bottom: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--live-muted);
}
.upnext-label.now {
  background: var(--live-green);
  color: #fff;
}
.upnext-label.next {
  background: var(--live-green);
  color: #fff;
}
.upnext-label.queue {
  background: rgba(0, 0, 0, 0.5);
  color: var(--live-accent-2);
}

.upnext-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.upnext-source {
  margin-top: 4px;
  font-size: 10px;
  color: var(--live-accent-2);
  opacity: 0.9;
}

/* Stage / player */
.live-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.stage-player {
  position: absolute;
  inset: 0;
  background: #000;
  overflow: hidden;
}
.stage-player .gtv-video,
.stage-player .gtv-fallback img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  border: 0;
  display: block;
}
.stage-player .gtv-embed {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  border: 0;
  display: block;
}
.stage-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(4, 17, 10, 0.94) 0%,
    rgba(4, 17, 10, 0.38) 38%,
    transparent 68%
  );
  pointer-events: none;
}

.stage-broadcast-bug {
  position: absolute;
  left: 22px;
  bottom: 78px;
  z-index: 7;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}
.stage-bug-logo {
  height: 52px;
  width: auto;
  display: block;
  filter: drop-shadow(0 0 10px rgba(0, 255, 107, 0.8)) drop-shadow(0 0 22px rgba(0, 163, 42, 0.5));
}
.stage-bug-tag {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 12px 7px 10px;
  background: linear-gradient(90deg, rgba(4, 17, 10, 0.88) 0%, rgba(4, 17, 10, 0.45) 100%);
  border-left: 3px solid var(--live-green);
  backdrop-filter: blur(4px);
}
.stage-bug-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--live-accent-2);
}
.stage-bug-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live-green);
  box-shadow: 0 0 10px var(--live-accent);
  animation: bug-pulse 2.2s ease-in-out infinite;
}
.stage-bug-text {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
@keyframes bug-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.92); }
}

.stage-meta {
  position: absolute;
  left: 24px;
  right: 120px;
  bottom: 148px;
  z-index: 6;
}
.stage-source {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.source-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--live-green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.stage-time { font-size: 12px; color: var(--live-muted); }
.stage-title {
  margin: 0 0 8px;
  font-size: clamp(22px, 3.2vw, 40px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.65);
}
.stage-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--live-muted);
  max-width: 720px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.stage-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.stage-tags span {
  font-size: 11px;
  color: var(--live-muted);
  background: rgba(0, 163, 42, 0.12);
  border: 1px solid var(--live-border);
  border-radius: 999px;
  padding: 4px 10px;
}

.stage-transport {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 16px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--live-border);
  background: rgba(4, 17, 10, 0.82);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.transport-time {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--live-accent-2);
  min-width: 40px;
}
.transport-seek {
  flex: 1;
  height: 6px;
  appearance: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
}
.transport-seek::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--live-green);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(0, 163, 42, 0.35);
}
.transport-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--live-green);
  border: 2px solid #fff;
}
.transport-seek:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.stage-player .gtv-dm-player,
.stage-player .gtv-dm-player iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.stage-controls {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--live-border);
  background: rgba(4, 17, 10, 0.72);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.live-stage.has-embed .stage-controls {
  top: 14px;
  right: 14px;
}
.ctrl-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--live-border);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.ctrl-btn:hover:not(:disabled) {
  background: rgba(0, 163, 42, 0.75);
  border-color: var(--live-green);
  transform: scale(1.05);
}
.ctrl-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.ctrl-btn.ctrl-primary { font-size: 13px; }
.ctrl-divider {
  width: 1px;
  height: 24px;
  background: var(--live-border);
  margin: 0 2px;
}

.theater-exit {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 12;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
body.theater-mode .theater-exit {
  pointer-events: auto;
}
body.theater-visible .theater-exit {
  opacity: 1;
}

/* Theater / auto-fullscreen immersion */
body.theater-mode {
  overflow: hidden;
}
body.theater-mode .live-sidebar,
body.theater-mode .upnext-strip {
  display: none;
}
body.theater-mode .live-main {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: #000;
  height: 100vh;
  width: 100vw;
}
body.theater-mode .live-stage {
  flex: 1 1 100%;
  height: 100%;
  min-height: 100vh;
  opacity: 0;
  transition: opacity 0.9s ease;
}
body.theater-visible .live-stage {
  opacity: 1;
}
body.theater-mode .stage-gradient,
body.theater-mode .stage-meta {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
body.theater-mode .stage-broadcast-bug,
body.theater-mode .stage-transport {
  opacity: 0.35;
  transition: opacity 0.3s ease;
}
body.theater-mode .live-stage:hover .stage-broadcast-bug,
body.theater-mode .live-stage:hover .stage-transport,
body.theater-mode .live-stage:focus-within .stage-broadcast-bug,
body.theater-mode .live-stage:focus-within .stage-transport {
  opacity: 1;
}
body.theater-mode .stage-broadcast-bug {
  bottom: 78px;
}
body.theater-mode .stage-controls {
  opacity: 0.35;
  transition: opacity 0.3s ease;
}
body.theater-mode .live-stage:hover .stage-controls,
body.theater-mode .live-stage:focus-within .stage-controls {
  opacity: 1;
}
body.theater-mode .stage-player .gtv-video,
.live-stage:fullscreen .stage-player .gtv-video,
.live-stage:-webkit-full-screen .stage-player .gtv-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  background: #000;
}
body.theater-mode .stage-player .gtv-embed,
body.theater-mode .stage-player .gtv-dm-player,
.live-stage:fullscreen .stage-player .gtv-embed,
.live-stage:fullscreen .stage-player .gtv-dm-player,
.live-stage:-webkit-full-screen .stage-player .gtv-embed,
.live-stage:-webkit-full-screen .stage-player .gtv-dm-player {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 56.25vw;
  min-height: 100vh;
  min-width: 177.78vh;
  transform: translate(-50%, -50%);
  background: #000;
}
body.theater-mode .stage-player .gtv-dm-player iframe,
.live-stage:fullscreen .stage-player .gtv-dm-player iframe,
.live-stage:-webkit-full-screen .stage-player .gtv-dm-player iframe {
  width: 100%;
  height: 100%;
}
.live-stage:fullscreen,
.live-stage:-webkit-full-screen {
  width: 100%;
  height: 100%;
  background: #000;
}
.live-stage:fullscreen .stage-player,
.live-stage:-webkit-full-screen .stage-player {
  position: absolute;
  inset: 0;
}

@media (max-width: 900px) {
  .upnext-card { flex-basis: 180px; }
  .stage-meta { left: 14px; right: 14px; bottom: 64px; }
  .drawer-nav { max-height: 36vh; }
}