/* ActGram Live — Instagram-style Go Live (matches story/call full-bleed) */
.ag-live-screen {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: #0F172A;
  font-family: 'DM Sans', sans-serif;
  color: #fff;
  overflow: hidden;
}

.ag-live-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0F172A;
  z-index: 1;
}

.ag-live-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0%, transparent 22%),
    linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 34%);
  z-index: 2;
}

.ag-live-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) 12px 10px;
  max-width: 720px;
  margin: 0 auto;
  box-sizing: border-box;
  pointer-events: none;
}

.ag-live-top > * {
  pointer-events: auto;
}

.ag-live-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none !important;
  background: rgba(15, 23, 42, 0.55) !important;
  color: #fff !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 18px;
  box-shadow: none !important;
  pointer-events: auto;
  position: relative;
  z-index: 9;
}

.ag-live-host-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.ag-live-host-chip img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
}

.ag-live-host-name {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(140px, 28vw);
  color: #fff !important;
}

.ag-live-host-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7) !important;
  font-weight: 600;
}

.ag-live-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  background: #EF4444;
  color: #fff !important;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  flex-shrink: 0;
}

.ag-live-viewers {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.5);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  color: #fff !important;
}

.ag-live-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.ag-live-comments {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 88px;
  z-index: 5;
  max-height: min(38vh, 280px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  scrollbar-width: none;
  max-width: 520px;
  box-sizing: border-box;
}

.ag-live-comments::-webkit-scrollbar { display: none; }

.ag-live-comment {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

.ag-live-comment-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.ag-live-comment-body {
  background: rgba(15, 23, 42, 0.42);
  border-radius: 14px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.35;
  max-width: 100%;
}

.ag-live-comment-name {
  font-weight: 800;
  color: #fff !important;
}

.ag-live-comment-text {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92) !important;
  word-break: break-word;
}

.ag-live-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  padding: 12px 12px max(16px, env(safe-area-inset-bottom));
  max-width: 720px;
  margin: 0 auto;
  box-sizing: border-box;
  pointer-events: none;
}

.ag-live-bottom > * {
  pointer-events: auto;
}

.ag-live-preview-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* Beat global input { background:white !important } from design-system */
.ag-live-screen .ag-live-title-input,
.ag-live-screen input.ag-live-title-input {
  width: 100% !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  background: rgba(15, 23, 42, 0.55) !important;
  color: #fff !important;
  border-radius: 14px !important;
  padding: 12px 14px !important;
  font-size: 14px !important;
  font-family: 'DM Sans', sans-serif !important;
  outline: none !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
}

.ag-live-screen .ag-live-title-input::placeholder,
.ag-live-screen input.ag-live-title-input::placeholder {
  color: rgba(255, 255, 255, 0.55) !important;
}

.ag-live-start-btn {
  width: 100%;
  border: none !important;
  border-radius: 14px;
  padding: 14px;
  background: #EF4444 !important;
  color: #fff !important;
  font-size: 15px;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35) !important;
}

.ag-live-live-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  position: relative;
  z-index: 11;
}

.ag-live-live-controls--host {
  justify-content: flex-end;
}

.ag-live-screen .ag-live-comment-input,
.ag-live-screen input.ag-live-comment-input {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  background: rgba(15, 23, 42, 0.55) !important;
  color: #fff !important;
  border-radius: 99px !important;
  padding: 11px 16px !important;
  font-size: 13.5px !important;
  font-family: 'DM Sans', sans-serif !important;
  outline: none !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
}

.ag-live-screen .ag-live-comment-input::placeholder,
.ag-live-screen input.ag-live-comment-input::placeholder {
  color: rgba(255, 255, 255, 0.55) !important;
}

.ag-live-screen .ag-live-comment-input:focus,
.ag-live-screen input.ag-live-comment-input:focus,
.ag-live-screen .ag-live-title-input:focus,
.ag-live-screen input.ag-live-title-input:focus {
  border-color: rgba(255, 255, 255, 0.4) !important;
  box-shadow: none !important;
  background: rgba(15, 23, 42, 0.65) !important;
  color: #fff !important;
}

.ag-live-end-btn {
  border: none !important;
  border-radius: 99px !important;
  padding: 11px 18px !important;
  min-height: 40px;
  background: #EF4444 !important;
  color: #fff !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35) !important;
  pointer-events: auto !important;
  position: relative;
  z-index: 12;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.ag-live-end-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

/* Home story-row LIVE rings — peer to existing story chips */
.home-live-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.home-live-ring-avatar {
  position: relative;
  padding: 2.5px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F97316, #EF4444 55%, #DC2626);
}

.home-live-ring-avatar::after {
  content: '';
  position: absolute;
  inset: 2.5px;
  border-radius: 50%;
  background: #fff;
  z-index: 0;
}

.home-live-ring-avatar img {
  position: relative;
  z-index: 1;
  display: block;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  margin: 2.5px;
}

.home-live-badge {
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);
  z-index: 2;
  background: #EF4444;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.4px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1.5px solid #fff;
}

.home-live-ring-name {
  font-size: 11px;
  font-weight: 600;
  color: #0F172A;
  white-space: nowrap;
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Mobile — keep controls clear of edges / home indicator */
@media (max-width: 767px) {
  .ag-live-top {
    max-width: none;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .ag-live-bottom {
    max-width: none;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .ag-live-comments {
    max-width: none;
    right: 12px;
    bottom: 96px;
    max-height: 32vh;
  }

  .ag-live-host-name {
    max-width: 36vw;
  }
}

/* Desktop — stage the live feed like stories (full-bleed, readable chrome) */
@media (min-width: 768px) {
  .ag-live-screen {
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: #000;
  }

  .ag-live-video {
    object-fit: contain;
    background: #000;
  }

  .ag-live-top,
  .ag-live-bottom {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(560px, calc(100% - 48px));
    max-width: 560px;
  }

  .ag-live-comments {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(480px, calc(100% - 64px));
    bottom: 100px;
    max-height: 36vh;
  }

  .ag-live-host-name {
    max-width: 220px;
  }
}
