/* === Broadcast Go-Live Button === */
#broadcast-go-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border: 1px solid var(--green-dim);
  background: transparent;
  color: var(--green);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.25s;
  margin: 12px 0;
}

#broadcast-go-live svg {
  stroke: var(--green);
  transition: all 0.25s;
}

#broadcast-go-live:hover {
  background: var(--green-muted);
  box-shadow: 0 0 16px rgba(0, 255, 65, 0.25), inset 0 0 8px rgba(0, 255, 65, 0.05);
  text-shadow: 0 0 6px var(--green-glow);
}

#broadcast-go-live.is-live {
  border-color: var(--danger);
  color: var(--danger);
  animation: livePulse 2s ease-in-out infinite;
}

#broadcast-go-live.is-live svg {
  stroke: var(--danger);
}

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 51, 51, 0.15); }
  50% { box-shadow: 0 0 20px rgba(255, 51, 51, 0.35); }
}

/* === Broadcast TV Frame === */
#broadcast-tv {
  margin: 24px auto;
  max-width: 640px;
}

#broadcast-tv-bezel {
  background: #080808;
  border: 2px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  box-shadow:
    0 0 30px rgba(0, 255, 65, 0.08),
    inset 0 0 60px rgba(0, 0, 0, 0.5);
  position: relative;
}

/* Scanline overlay on the TV */
#broadcast-tv-bezel::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.12) 3px,
    rgba(0, 0, 0, 0.12) 6px
  );
  pointer-events: none;
  z-index: 2;
}

#broadcast-tv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  z-index: 3;
  position: relative;
}

#broadcast-tv-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--danger);
  font-weight: bold;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 3px;
}

.broadcast-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 6px rgba(255, 51, 51, 0.7);
  animation: liveDotBlink 1.2s ease-in-out infinite;
}

@keyframes liveDotBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

#broadcast-tv-host {
  color: var(--green-dim);
  font-size: 11px;
  letter-spacing: 1px;
}

/* TV Screen */
#broadcast-tv-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

#broadcast-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

/* Static / No Signal */
#broadcast-tv-static {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background:
    repeating-radial-gradient(circle at 50% 50%, transparent 0, transparent 1px, rgba(0, 255, 65, 0.02) 1px, transparent 2px);
  z-index: 1;
}

#broadcast-tv-static .static-text {
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 6px;
  color: var(--green-dim);
  opacity: 0.5;
  text-transform: uppercase;
  animation: staticFlicker 3s ease-in-out infinite;
}

#broadcast-tv-static .static-subtext {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim, #666);
  letter-spacing: 1px;
  opacity: 0.6;
}

@keyframes staticFlicker {
  0%, 100% { opacity: 0.5; }
  5% { opacity: 0.2; }
  10% { opacity: 0.6; }
  50% { opacity: 0.4; }
  55% { opacity: 0.7; }
}

/* Hide static when video is playing */
#broadcast-tv-screen.has-video #broadcast-tv-static {
  display: none;
}

/* Hide LIVE indicator and tap notice when no signal */
#broadcast-tv-status {
  visibility: hidden;
}

#broadcast-tv-bezel.is-live #broadcast-tv-status {
  visibility: visible;
}

/* Tap notice */
#broadcast-tap-notice {
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim, #666);
  letter-spacing: 1px;
  padding: 6px 0;
  display: none;
}

#broadcast-tv-bezel.is-live #broadcast-tap-notice {
  display: block;
}

#broadcast-tv-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 6px 14px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
  z-index: 3;
  position: relative;
}

#broadcast-viewer-count::before {
  content: '[ ';
}
#broadcast-viewer-count::after {
  content: ' ]';
}

/* === Thumbnail Shelf === */
#broadcast-shelf {
  margin-top: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--green-dim, #1a3a1a) transparent;
}

#broadcast-shelf::-webkit-scrollbar {
  height: 4px;
}

#broadcast-shelf::-webkit-scrollbar-track {
  background: transparent;
}

#broadcast-shelf::-webkit-scrollbar-thumb {
  background: var(--green-dim, #1a3a1a);
  border-radius: 2px;
}

#broadcast-shelf-track {
  display: flex;
  gap: 10px;
  padding: 6px 2px;
  width: max-content;
  min-width: 100%;
}

.shelf-thumb {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  min-width: 80px;
  padding: 8px 6px;
  border: 1px solid var(--border, #222);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
  transition: all 0.2s;
  cursor: pointer;
}

.shelf-thumb:hover {
  border-color: var(--green-dim, #1a3a1a);
  background: rgba(0, 255, 65, 0.03);
  box-shadow: 0 0 10px rgba(0, 255, 65, 0.08);
}

.shelf-thumb-img {
  width: 64px;
  height: 36px;
  background: #0a0a0a;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.shelf-thumb-img svg {
  stroke: var(--green-dim, #2a5a2a);
  opacity: 0.6;
}

.shelf-thumb:hover .shelf-thumb-img svg {
  stroke: var(--green, #00ff41);
  opacity: 0.9;
}

.shelf-thumb-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim, #555);
  white-space: nowrap;
}

.shelf-thumb.active {
  border-color: var(--green, #00ff41);
  background: rgba(0, 255, 65, 0.06);
}

.shelf-thumb.active .shelf-thumb-img svg {
  stroke: var(--green, #00ff41);
  opacity: 1;
}

.shelf-thumb.active .shelf-thumb-label {
  color: var(--green, #00ff41);
}

.shelf-thumb:hover .shelf-thumb-label {
  color: var(--green-dim, #2a5a2a);
}

/* === Shelf Overlay === */
#shelf-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 4, 4, 0.95);
  z-index: 5;
  display: flex;
  flex-direction: column;
  transition: opacity 0.2s, visibility 0.2s;
}

#shelf-overlay.shelf-overlay-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#shelf-overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #222);
  flex-shrink: 0;
}

#shelf-overlay-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--green, #00ff41);
}

#shelf-overlay-close {
  background: none;
  border: 1px solid var(--border, #222);
  color: var(--text-dim, #666);
  font-size: 18px;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 2px;
  font-family: var(--mono);
  transition: all 0.2s;
}

#shelf-overlay-close:hover {
  border-color: var(--green-dim, #1a3a1a);
  color: var(--green, #00ff41);
}

#shelf-overlay-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--green-dim, #1a3a1a) transparent;
}

.shelf-overlay-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text-dim, #555);
  text-transform: uppercase;
  opacity: 0.5;
}

/* === Mobile === */
@media (max-width: 768px) {
  #broadcast-tv {
    margin: 16px 0;
    max-width: 100%;
  }

  #broadcast-go-live {
    font-size: 11px;
    padding: 8px 14px;
  }

  .shelf-thumb {
    min-width: 70px;
    padding: 6px 4px;
  }

  .shelf-thumb-img {
    width: 56px;
    height: 32px;
  }

  .shelf-thumb-label {
    font-size: 8px;
    letter-spacing: 1.5px;
  }
}
