/**
 * Unified room shell chrome — top bar, mobile rail, page wrapper.
 * Stage + chat grid rules live in sl-room-viewer-layout.css
 */
body.sl-live-room-shell-enabled .sl-room-unified-page .vdchat-overlay,
body.sl-live-room-shell-enabled .sl-offline-room-shell {
  position: relative !important;
  padding: calc(48px + env(safe-area-inset-top, 0px)) 0 12px !important;
  min-height: min(78dvh, 920px) !important;
  background:
    radial-gradient(circle at top left, rgba(245, 158, 11, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.13), transparent 32%),
    linear-gradient(180deg, #070911 0%, #05070c 100%) !important;
}

@media (max-width: 860px) {
  body.sl-live-room-shell-enabled .sl-room-unified-page .vdchat-overlay,
  body.sl-live-room-shell-enabled .sl-offline-room-shell {
    padding: calc(46px + env(safe-area-inset-top, 0px)) 0 10px !important;
    min-height: auto !important;
  }
}

.sl-room-unified-page {
  width: min(100%, 1860px);
  margin: 0 auto;
  padding: 0 10px;
  box-sizing: border-box;
}

body.sl-live-room-shell-enabled .sl-room-unified-page .vdchat-overlay {
  margin-top: 0;
  border-radius: 14px;
  overflow: hidden;
}

.sl-room-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  background: rgba(7, 9, 16, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  color: #f8fafc;
  overflow: hidden;
}

.sl-room-topbar-main,
.sl-room-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: auto;
  flex-wrap: nowrap;
  max-width: min(56vw, 720px);
  overflow: hidden;
}

/* Keep Buy tokens and Exit from kissing — Exit needs a clear tap target. */
.sl-room-topbar-actions .sl-room-action.danger {
  margin-left: 4px;
}

/* Offline: tip/private already live in the stage — hide duplicates that crowd Exit */
body.sl-offline-room-active .sl-room-topbar-actions .sl-room-action[data-room-shell-action="tip"],
body.sl-offline-room-active .sl-room-topbar-actions .sl-room-action[data-room-shell-action="private"],
body.sl-offline-room-active .sl-room-topbar-actions .sl-room-action[data-room-shell-action="games"] {
  display: none !important;
}

.sl-room-model {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

/* Avatar + name identity acts as a profile-disclosure toggle (Stripchat parity). */
.sl-room-model-toggle {
  border: 1px solid transparent;
  background: transparent;
  padding: 3px 7px 3px 3px;
  border-radius: 999px;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
  max-height: 40px;
  overflow: hidden;
}

.sl-room-model-toggle:hover,
.sl-room-model-toggle:focus-visible,
.sl-room-model-toggle[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.13);
  outline: none;
}

.sl-room-model-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #0b0f1a;
}

.sl-room-model-id {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.sl-room-model strong {
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 34vw;
}

.sl-room-model-id > span {
  color: #99a8bd;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 34vw;
}

.sl-room-model-caret {
  flex: 0 0 auto;
  font-size: 11px;
  color: #94a3b8;
  transition: transform 0.18s ease;
}

.sl-room-model-toggle[aria-expanded="true"] .sl-room-model-caret {
  transform: rotate(180deg);
}

/* Follow button + live follower count (Stripchat parity). Sits right beside
   the model identity so viewers can follow without leaving the stream. */
.sl-room-follow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  border: 1px solid rgba(245, 178, 59, 0.55);
  background: rgba(245, 178, 59, 0.12);
  color: #f5b23b;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.sl-room-follow i {
  font-size: 12px;
}

.sl-room-follow:hover,
.sl-room-follow:focus-visible {
  background: rgba(245, 178, 59, 0.22);
  outline: none;
}

.sl-room-follow[disabled] {
  opacity: 0.6;
  cursor: default;
}

.sl-room-follow-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
}

/* Following state: solid fill so it reads as an active toggle. */
.sl-room-follow.is-following {
  background: #f5b23b;
  border-color: #f5b23b;
  color: #121212;
}

.sl-room-follow.is-following .sl-room-follow-count {
  background: rgba(0, 0, 0, 0.16);
}

.sl-room-follow.is-following:hover,
.sl-room-follow.is-following:focus-visible {
  background: #e0a026;
  border-color: #e0a026;
}

/* On tight mobile widths collapse the text label; keep the heart + count. */
@media (max-width: 560px) {
  /* Keep the identity + follow cluster from overflowing a phone-width topbar:
     drop the "Live room" sub-label, let the name truncate hard, and let the
     toggle shrink so the compact Follow pill (heart + count) always fits. */
  .sl-room-follow-label {
    display: none;
  }
  .sl-room-follow {
    padding: 6px 9px;
    gap: 5px;
  }
  .sl-room-topbar-main {
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
  }
  .sl-room-model-toggle {
    min-width: 0;
    flex: 0 1 auto;
    padding: 3px 4px 3px 3px;
    gap: 6px;
  }
  .sl-room-model strong {
    max-width: min(42vw, 160px);
  }
  .sl-room-model-id span {
    display: none;
  }
}

.sl-room-meta-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.sl-room-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.045);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.sl-room-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.28);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sl-room-live-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18);
}

.sl-room-live-pill.is-offline {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.22);
}

.sl-room-live-pill.is-offline::before {
  background: #94a3b8;
  box-shadow: none;
}

.sl-room-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
  color: #f1f5f9 !important;
  text-decoration: none !important;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
}

.sl-room-topbar-actions .sl-room-wallet-chip,
.sl-room-topbar-actions .sl-room-meta-chip.sl-room-wallet-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: linear-gradient(180deg, rgba(12, 74, 110, 0.55), rgba(15, 23, 42, 0.95));
  color: #e0f2fe;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
}

.sl-room-topbar-actions .sl-room-wallet-chip i {
  color: #38bdf8;
}

.sl-room-action.primary {
  background: linear-gradient(135deg, #fde047 0%, #fbbf24 55%, #f59e0b 100%);
  border-color: rgba(251, 191, 36, 0.85);
  color: #111827 !important;
  box-shadow: 0 8px 18px rgba(251, 191, 36, 0.28);
}

.sl-room-action.danger {
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.55), rgba(69, 10, 10, 0.85));
  border-color: rgba(248, 113, 113, 0.4);
  color: #fecaca !important;
}

.sl-room-mobile-rail {
  display: none;
}

@media (max-width: 860px) {
  body.sl-live-room-shell-enabled.sl-room-unified-ready {
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }

  .sl-room-unified-page {
    padding: 0 6px;
  }

  .sl-room-topbar {
    height: 46px;
    padding: 0 8px;
  }

  .sl-room-action span {
    display: none;
  }

  .sl-room-action {
    width: 34px;
    justify-content: center;
    padding: 0;
  }

  /* On phones the bottom action rail already carries tip / private / games /
     tokens / profile, so the topbar only needs the model identity, the Follow
     pill and a way out. Hiding the duplicated actions frees the horizontal
     space the identity cluster needs (otherwise the name/avatar collapse and
     visually overlap the Follow pill). */
  .sl-room-topbar .sl-room-topbar-actions > *:not(.danger) {
    display: none;
  }

  .sl-room-meta-strip {
    display: none;
  }

  .sl-room-model strong {
    max-width: 42vw;
  }

  .sl-room-mobile-rail {
    position: fixed;
    left: 6px;
    right: 6px;
    bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    z-index: 10060;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 6px;
    border-radius: 12px;
    background: rgba(7, 9, 16, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(18px);
  }

  .sl-room-mobile-rail .sl-room-action {
    width: 100%;
    height: 44px;
    border-radius: 10px;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
  }

  .sl-room-mobile-rail .sl-room-action span {
    display: inline !important;
    font-size: 9px;
    line-height: 1;
  }
}
