/* Live stage: larger fixed camera area, compact header, viewers drop list, status dot */
.live-stage {
  grid-template-columns: minmax(200px, 0.5fr) minmax(0, 2.2fr);
}

.live-video-area {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.live-video-grid {
  overflow: hidden;
  align-content: stretch;
  gap: 6px;
  padding: 8px;
  grid-auto-rows: minmax(0, 1fr);
}

.live-video-frame,
.live-video-empty {
  min-height: 0;
}

.live-media-description strong {
  display: none;
}

.live-session-context {
  position: relative;
  z-index: 5;
  gap: 8px;
  padding: 6px 12px;
}

.live-host-chip {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 9px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  text-align: left;
}

.live-host-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.live-host-text strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-host-text small {
  overflow: hidden;
  color: #c2b5d5;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-avatar {
  position: relative;
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(135deg, #a337df, #1689dc);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.live-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.live-avatar-host {
  width: 40px;
  height: 40px;
  border: 2px solid #ffd76a;
}

.live-avatar-sm {
  width: 24px;
  height: 24px;
  margin-left: -8px;
  border: 2px solid #1d1631;
  font-size: 11px;
}

.live-avatar-sm:first-child {
  margin-left: 0;
}

.live-header-btn {
  flex: 0 0 auto;
  padding: 4px 10px;
}

.live-guest-count {
  flex: 0 0 auto;
  color: #c2b5d5;
  font-size: 12px;
}

.live-viewers {
  position: relative;
  flex: 0 0 auto;
}

.live-viewers-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 6px;
  border: 1px solid rgba(183, 142, 255, 0.36);
  border-radius: 999px;
  background: rgba(25, 20, 43, 0.88);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
}

.live-viewers-avatars {
  display: inline-flex;
  align-items: center;
}

.live-viewers-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  width: 240px;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(183, 142, 255, 0.4);
  border-radius: 12px;
  background: #1a1330;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

.live-viewers-menu[hidden] {
  display: none;
}

.live-viewer-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: #fff;
  cursor: pointer;
  text-align: left;
}

.live-viewer-row:hover,
.live-viewer-row:focus-visible {
  background: rgba(163, 55, 223, 0.25);
}

.live-viewer-row small {
  display: block;
  color: #b7a9ce;
  font-size: 11px;
}

.live-viewers-empty {
  margin: 0;
  padding: 8px;
  color: #b7a9ce;
  font-size: 12px;
}

.live-status-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff2e4d;
  box-shadow: 0 0 8px 2px rgba(255, 46, 77, 0.7);
}

.live-status-dot.is-on {
  background: #22e06b;
  box-shadow: 0 0 8px 2px rgba(34, 224, 107, 0.75);
}

.live-exit-x {
  display: inline-flex;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #e5334b;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.live-host-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 0;
  color: #fff;
  font-size: 12px;
}

.live-host-tools select {
  margin-left: 4px;
  padding: 4px 8px;
  border: 1px solid rgba(183, 142, 255, 0.4);
  border-radius: 8px;
  background: #1a1330;
  color: #fff;
}

.live-host-guests {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 768px) {
  .live-container .live-video-grid {
    gap: 3px;
    padding: 0;
    align-content: stretch;
  }
}

.live-container:has(.live-stage) .live-sidebar {
  display: none;
}

.live-chat-input-row .chat-input {
  min-width: 0;
  flex: 1 1 auto;
  width: auto;
}

@media (min-width: 769px) {
  .live-stage {
    grid-template-columns: minmax(280px, 0.7fr) minmax(0, 2.2fr);
  }
}

@media (max-width: 768px) {
  .live-container .live-session-context {
    flex-wrap: nowrap;
    gap: 5px;
    padding: 6px 8px;
  }
  .live-container .live-host-chip {
    flex: 1 1 0;
    min-width: 0;
  }
  .live-container .live-guest-count {
    font-size: 11px;
  }
  .live-container .live-header-btn {
    padding: 3px 7px;
  }
}


/* Single full-size stage with the chat floating over the cameras */
.live-container .live-stage {
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}

.live-container .live-stage .live-video-area {
  grid-column: 1;
  grid-row: 2;
}

.live-container .live-stage .live-video-grid {
  flex: 1 1 0;
  height: auto;
  min-height: 0;
}

.live-tile-off {
  display: none !important;
}

.live-container .live-stage .live-chat-panel {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 20;
  width: min(420px, calc(100% - 16px));
  max-height: 42%;
  border: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

.live-container .live-stage .live-chat-box {
  min-height: 0;
  padding: 6px 4px;
  background: transparent;
  box-shadow: none;
  gap: 6px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 22%);
}

.live-container .live-stage .live-chat-message {
  align-self: flex-start;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.live-container .live-stage .live-controls-bar,
.live-container .live-stage .live-chat-style-controls {
  pointer-events: auto;
}

.live-container .live-stage .live-controls-bar {
  border: 0;
  background: transparent;
  padding: 4px 0 0;
}

.live-container .live-stage .live-chat-input-row .chat-input {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.live-container .live-stage .live-chat-style-controls {
  display: none;
}

.live-layout-picker {
  display: flex;
  max-width: 100%;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 4px;
}

.live-layout-option {
  display: flex;
  flex: 0 0 auto;
  width: 54px;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 2px;
  border: 1px solid rgba(183, 142, 255, 0.35);
  border-radius: 10px;
  background: rgba(25, 20, 43, 0.85);
  color: #c9bde0;
  cursor: pointer;
  font-size: 10px;
}

.live-layout-option svg {
  width: 30px;
  height: 44px;
}

.live-layout-option rect {
  fill: rgba(255, 255, 255, 0.35);
}

.live-layout-option.is-active {
  border-color: #ffd76a;
  box-shadow: 0 0 10px rgba(255, 215, 106, 0.55);
  color: #fff;
}

.live-layout-option.is-active rect {
  fill: #ffd76a;
}

.live-host-tools {
  width: 100%;
}

@media (max-width: 768px) {
  .live-container .live-stage {
    display: flex;
    flex-direction: column;
  }
  .live-container .live-stage .live-video-area {
    flex: 1 1 0;
    min-height: 0;
    order: 1;
  }
  .live-container .live-stage .live-chat-panel {
    order: 0;
    flex: none;
    max-height: 36%;
    left: 6px;
    bottom: 6px;
    width: calc(100% - 12px);
  }
}

.live-container.live-stage-ended .live-sidebar {
  display: flex !important;
}


@media (max-width: 768px) {
  .live-container .live-stage .live-media-controls {
    order: 1;
    flex: 0 0 auto;
  }
  .live-container .live-stage .live-video-grid {
    order: 2;
  }
  .live-container .live-header-btn {
    flex: 0 0 auto;
    min-height: 0;
    width: auto;
  }
  .live-container .live-media-description {
    display: none;
  }
}

.live-tile-avatar { display:none; position:absolute; inset:0; z-index:1; flex-direction:column; align-items:center; justify-content:center; gap:10px; background:radial-gradient(circle at 30% 20%, #5b38ff55, transparent 60%), linear-gradient(135deg, #1a0833, #0c1c44); color:#fff; font-size:clamp(28px, 8vw, 64px); font-weight:800; }
.live-tile-avatar img { width:min(45%, 120px); aspect-ratio:1; border-radius:50%; object-fit:cover; box-shadow:0 0 0 3px #ffd700, 0 0 22px rgba(255,60,170,.7); }
.live-tile-avatar-name { font-size:clamp(12px, 2vw, 16px); font-weight:600; max-width:90%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.live-video-frame.camera-off .live-tile-avatar { display:flex; }
.live-video-frame.camera-off .live-video-player { visibility:hidden; }
.live-video-frame { position:relative; }
.live-video-label { z-index:2; }
.live-container .live-stage .live-media-description { display:block; font-size:12px; line-height:1.3; }

/* With several cameras the chat gets its own strip under the grid instead of covering tiles */
.live-container .live-stage.live-multi {
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.live-container .live-stage.live-multi .live-chat-panel {
  position: relative;
  left: auto;
  bottom: auto;
  grid-column: 1;
  grid-row: 3;
  width: 100%;
  height: clamp(130px, 24vh, 220px);
  max-height: none;
  display: flex;
  flex-direction: column;
  padding: 6px 10px 8px;
  background: linear-gradient(180deg, rgba(26, 8, 51, 0.92), rgba(12, 28, 68, 0.95));
  border-top: 1px solid rgba(255, 215, 0, 0.45);
  pointer-events: auto;
}
.live-container .live-stage.live-multi .live-chat-box {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-mask-image: none;
  mask-image: none;
}
@media (max-width: 768px) {
  .live-container .live-stage.live-multi .live-video-area { order: 1; }
  .live-container .live-stage.live-multi .live-chat-panel {
    order: 2;
    flex: 0 0 auto;
    height: clamp(120px, 26vh, 190px);
    width: 100%;
  }
}
