/* Live party room, solo broadcast, Lucky Gifts event, Streamer Center */
:root {
  --ap-bottom-bar-h: 58px;
}

/* Deter casual capture in browser; native app uses FLAG_SECURE */
html.ap-secure-live,
body.ap-secure-live {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html.ap-secure-live video,
body.ap-secure-live video,
html.ap-secure-live canvas,
body.ap-secure-live canvas,
html.ap-secure-live #liveLocalVideo,
html.ap-secure-live #liveRemoteVideo,
html.ap-secure-live .live-room-stage,
html.ap-secure-live .party-room-stage {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  pointer-events: auto;
}

/* Full black overlay when screenshot/recording attempt is detected */
.ap-capture-shield {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s linear;
}
.ap-capture-shield.is-on {
  opacity: 1;
}

/* Browser cannot protect streams — force official app for audience */
.ap-live-app-only-gate {
  position: fixed;
  inset: 0;
  z-index: 2147482900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #07080c;
  color: #fff;
}
.ap-live-app-only-card {
  max-width: 360px;
  text-align: center;
}
.ap-live-app-only-card i {
  font-size: 2rem;
  color: #c9a227;
  margin-bottom: 12px;
}
.ap-live-app-only-card h1 {
  font-size: 1.25rem;
  margin: 0 0 10px;
  font-weight: 700;
}
.ap-live-app-only-card p {
  margin: 0 0 20px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.78);
}
.ap-live-app-only-btn {
  display: inline-block;
  padding: 12px 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #d4a84b, #9a7218);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.ap-live-app-only-back {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 10px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.9rem;
}

.live-dark {
  background: #0a0618;
  color: #fff;
  min-height: 100dvh;
  overflow: hidden;
}

.live-dark * {
  box-sizing: border-box;
}

.party-room {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background: #000;
  padding-bottom: calc(var(--ap-bottom-bar-h) + env(safe-area-inset-bottom, 0));
}

.party-room::before {
  display: none;
}

.party-room-stage {
  position: absolute;
  bottom: 28%;
  left: 0;
  right: 0;
  height: 22%;
  background: linear-gradient(180deg, transparent, rgba(80, 40, 200, 0.15));
  transform: perspective(400px) rotateX(55deg);
  opacity: 0.5;
  pointer-events: none;
}

.party-header {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top, 0)) 10px 6px;
  gap: 6px;
  flex-shrink: 0;
  min-height: 0;
}

.party-host {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 128px;
  max-width: min(58vw, calc(100vw - 132px));
  flex: 1 1 auto;
  flex-shrink: 1;
  position: relative;
  overflow: hidden;
}

.party-host>img {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 50%;
  border: 2px solid #fbbf24;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.party-host {
  flex: 1 1 auto;
  min-width: 128px;
  max-width: min(58vw, calc(100vw - 132px));
}

.party-host-meta {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.party-host-meta .name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.25;
}

.party-host-meta .sub {
  font-size: 10px;
  color: #cbd5e1;
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  line-height: 1.2;
}

.live-room-id-line,
#liveRoomId.live-room-id-line,
#partyRoomId {
  display: block;
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(52vw, 200px);
}

.party-host-meta .name {
  color: #fff;
}

.party-follow-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1a1000;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.party-header-center {
  text-align: center;
  flex: 0 0 auto;
  min-width: 32px;
}

.party-crown {
  font-size: 22px;
  filter: drop-shadow(0 0 8px gold);
}

.party-header-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
  overflow: visible;
  min-width: 0;
}

.party-viewers {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-direction: row;
  flex-wrap: nowrap;
  max-width: min(55vw, 260px);
  overflow: visible;
  padding-bottom: 2px;
}

.party-viewers .ap-top-gifter {
  margin-left: -6px;
  flex-shrink: 1;
  min-width: 0;
}

.party-viewers .ap-top-gifter:first-child {
  margin-left: 0;
}

.party-viewer-count {
  flex-shrink: 0 !important;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  border: none;
  color: inherit;
  cursor: pointer;
  pointer-events: auto !important;
  touch-action: manipulation;
  position: relative;
  z-index: 40;
  overflow: visible;
  margin-left: 4px;
}

.party-viewers.is-clickable,
#partyViewerAvatars.is-clickable {
  cursor: pointer;
  pointer-events: auto !important;
  position: relative;
  z-index: 35;
  touch-action: manipulation;
}

.party-header-right,
.live-room .party-header-right {
  pointer-events: auto !important;
  position: relative;
  z-index: 36;
}

.party-viewer-count.live-joined-count {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  color: #fff;
}

#apGiftHitPad,
#apJoinedHitPad {
  position: fixed !important;
  z-index: 14950 !important;
  pointer-events: auto !important;
  touch-action: manipulation !important;
  border: 0 !important;
  background: transparent !important;
  -webkit-tap-highlight-color: transparent;
}

#liveViewerCount,
.party-viewer-count,
.live-joined-count,
#partyViewerAvatars {
  position: relative !important;
  z-index: 14900 !important;
  pointer-events: auto !important;
  touch-action: manipulation !important;
}
#partyLiveActions,
.party-live-actions,
#partyBtnUsersAll,
#partyInvitePill,
#partyViewerAvatars,
#liveViewerCount,
.party-viewer-count,
.live-joined-count,
#partyBottomBar,
#liveBtnGift,
#partyBtnGift,
#partyBtnTools,
#liveBtnMic,
#partyBottomBar .party-bottom-actions,
.party-header-right {
  pointer-events: auto !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.15);
}

.party-header,
.live-room .party-header {
  position: relative;
  z-index: 14100 !important;
  pointer-events: none !important;
}

.party-header > *,
.live-room .party-header > * {
  pointer-events: auto !important;
}

.party-header-right,
#partyViewerAvatars,
#liveViewerCount,
.party-viewer-count.live-joined-count,
#partyLiveActions,
#partyBtnUsersAll,
#partyInvitePill {
  position: relative;
  z-index: 14100 !important;
  touch-action: manipulation;
}

#liveBtnGift,
#partyBtnGift,
.party-btn-gift.ap-btn-gift-hero,
#partyBtnTools,
#liveBtnMic,
.ap-btn-grid {
  position: relative;
  z-index: 14100 !important;
  pointer-events: auto !important;
  touch-action: manipulation;
}

.party-bottom-bar,
#partyBottomBar {
  z-index: 14000 !important;
}

/* Closed sheets must never leave an invisible tap shield */
.gift-sheet:not(.open),
.party-tools-sheet:not(.open),
.party-requests-sheet:not(.open),
#partyRequestsSheet:not(.open),
.party-music-sheet:not(.open),
.ap-topup-sheet:not(.open),
.ap-surprise-sheet:not(.open),
.ap-modal-overlay:not(.open) {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.party-chat-mic-invite {
  pointer-events: auto !important;
  position: relative;
  z-index: 40;
}

.party-chat-mic-actions button {
  pointer-events: auto !important;
  position: relative;
  z-index: 41;
  min-height: 36px;
  touch-action: manipulation;
}

.party-close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.party-ticker {
  display: none !important;
}

.party-ticker-inner {
  display: inline-block;
  animation: party-ticker-scroll 18s linear infinite;
}

@keyframes party-ticker-scroll {
  0% {
    transform: translateX(100%);
  }

  100% {
    transform: translateX(-100%);
  }
}

.party-win-banner {
  display: none !important;
}

.party-room-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
  z-index: 5;
}

.party-seats-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.party-seats {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 10px 12px;
  max-width: 360px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.party-seat-row {
  display: grid;
  gap: 8px 6px;
  justify-items: center;
  align-items: start;
  width: 100%;
}

.party-seat-row--lg {
  grid-template-columns: repeat(3, 1fr);
}

.party-seat-row--md {
  grid-template-columns: repeat(3, 1fr);
}

.party-seat-row--sm {
  grid-template-columns: repeat(5, 1fr);
}

.party-seats-ref .party-seat.is-host {
  grid-column: auto;
  grid-row: auto;
}

.party-seats-ref .party-seat.is-host .seat-avatar {
  width: 72px;
  height: 72px;
}

.party-seats-9 {
  grid-template-columns: repeat(3, 1fr);
  max-width: 360px;
  gap: 12px 10px;
  padding: 12px;
}

.party-widget {
  background: rgba(0, 0, 0, 0.55);
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 10px;
  color: #f1f5f9;
  backdrop-filter: blur(6px);
}

.party-widget strong {
  display: block;
  font-size: 11px;
  color: #fff;
}

.party-widget .bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  margin-top: 4px;
  overflow: hidden;
}

.party-widget .bar i {
  display: block;
  height: 100%;
  width: 35%;
  background: #fbbf24;
  border-radius: 4px;
}

.party-seat.is-empty {
  opacity: 0.85;
  pointer-events: auto;
  cursor: pointer;
}

.seat-avatar--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 2px dashed rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  width: 56px;
  height: 56px;
}

.seat-plus {
  font-size: 22px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 300;
}

.party-seat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.party-seats:not(.party-seats-ref) .party-seat.is-host {
  grid-column: 2 / span 2;
  grid-row: 1;
}

.party-seats:not(.party-seats-ref) .party-seat.is-host .seat-avatar {
  width: 88px;
  height: 88px;
  border-width: 3px;
  border-color: #fbbf24;
}

.party-seat.is-host .seat-name {
  font-size: 12px;
  font-weight: 800;
}

.seat-avatar {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  overflow: hidden;
  background: linear-gradient(135deg, #4c1d95, #831843);
}

.seat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.seat-avatar .mic-off,
.seat-avatar .mic-live {
  display: none !important;
}

.seat-crown {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
}

.seat-name {
  font-size: 10px;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.9);
}

.seat-gifts {
  font-size: 10px;
  color: #f9a8d4;
}

.party-win-banner {
  display: none;
  margin: 0 10px 6px;
  padding: 8px 12px;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.95), rgba(168, 85, 247, 0.9));
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.party-win-banner.is-flash {
  display: block;
  pointer-events: none;
}

.party-chat-msg.system.is-tappable,
.party-chat-msg.party-chat-msg--gift.is-tappable {
  cursor: pointer;
}

.party-chat-sys-user,
.party-chat-gift-tap {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  /* pan-y so dragging on a name/gift still scrolls the chat feed */
  touch-action: pan-y;
  -webkit-tap-highlight-color: rgba(251, 191, 36, 0.35);
}

.party-chat-gift-ico.party-chat-gift-tap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  font-size: 18px;
}

.gift-sheet-panel .gift-grid button {
  pointer-events: auto !important;
  touch-action: manipulation;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.party-chat-row {
  flex-shrink: 0;
  display: flex;
  gap: 0;
  min-height: 120px;
  max-height: min(36vh, 280px);
  border-top: none;
  background: transparent;
  position: relative;
  z-index: 28;
  /* Row shell must not form a full-width tap shield over gift/tools */
  pointer-events: none;
  transition: transform 0.28s ease, opacity 0.28s ease, max-height 0.28s ease, min-height 0.28s ease;
  will-change: transform, opacity;
}

.party-chat-swipe-handle,
.party-chat-controls,
.party-chat-zone,
.party-chat-feed,
.party-chat-msg,
.party-chat-hide-btn,
.party-chat-tabs,
.party-chat-tabs button {
  pointer-events: auto;
}

.party-chat-swipe-handle {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  width: 56px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
}

.party-chat-swipe-handle span {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.party-chat-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 8px 6px 10px;
  flex-shrink: 0;
  z-index: 6;
  pointer-events: auto;
}

.party-chat-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 4px;
  flex-shrink: 0;
}

.party-chat-tabs button {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 8px 4px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 250, 252, 0.92);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  position: relative;
  z-index: 2;
  min-width: 28px;
  min-height: 44px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.party-chat-tabs button.active {
  background: rgba(245, 158, 11, 0.52);
  border-color: rgba(251, 191, 36, 0.45);
  color: #fff;
}

.party-chat-zone {
  flex: 1;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  padding-top: 4px;
  touch-action: pan-y;
}

/* Taller chat panel on solo live (class is on the zone in live-room.html) */
.party-chat-zone.live-chat-tall .party-chat-feed {
  max-height: min(42vh, 340px);
}

.live-chat-ticker {
  flex-shrink: 0;
  padding: 4px 12px 4px 0;
  font-size: 10px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.85);
  background: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  order: 2;
}

.live-chat-ticker .live-watch-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #bbf7d0;
  background: rgba(22, 101, 52, 0.75);
  border: 1px solid rgba(34, 197, 94, 0.45);
  vertical-align: middle;
}

.party-chat-feed {
  /* flex-end on the scroll container breaks pan-y scroll on iOS/Android WebViews */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  padding: 4px 12px 8px 0;
  overflow-x: hidden;
  overflow-y: scroll;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 72px;
  height: min(36vh, 280px);
  max-height: min(36vh, 280px);
  width: 100%;
  max-width: 100%;
  pointer-events: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y !important;
  overscroll-behavior: contain;
  background: transparent;
  scrollbar-width: thin;
}

/* Keeps newest messages at the bottom when the feed is not full — without breaking scroll */
.party-chat-feed::before {
  content: '';
  flex: 1 1 0;
  min-height: 0;
  pointer-events: none;
}

.party-chat-msg {
  align-self: flex-start;
  /* NEVER shrink in the feed — overflow:hidden + flex-shrink crushed bubbles flat */
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  height: auto !important;
  min-height: auto !important;
  box-sizing: border-box;
  width: auto;
  max-width: 92%;
  min-width: 0;
  padding: 5px 9px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
  line-height: 1.35;
  color: #f8fafc;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  box-shadow: none;
  overflow: visible;
  touch-action: pan-y !important;
}

.party-chat-msg .lvl {
  display: inline-block;
  min-width: 16px;
  text-align: center;
  background: rgba(34, 197, 94, 0.72);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  border-radius: 4px;
  padding: 1px 4px;
  margin-right: 4px;
}

.party-chat-msg .user {
  color: #7dd3fc;
  font-weight: 700;
}

.party-chat-msg.system {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.22);
  color: #fde68a;
}

.party-chat-msg.party-chat-mic-invite {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  margin: 4px 0;
  border-radius: 12px;
  background: rgba(201, 162, 39, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.5);
  max-width: 94%;
}

.party-chat-mic-invite .party-chat-avatar-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.party-chat-mic-body {
  flex: 1;
  min-width: 0;
}

.party-chat-mic-text {
  font-size: 12px;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 6px;
}

.party-chat-mic-actions {
  display: flex;
  gap: 6px;
  position: relative;
  z-index: 41;
  pointer-events: auto !important;
}

.party-chat-mic-actions button {
  border: none;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  padding: 6px 12px;
  cursor: pointer;
  touch-action: manipulation;
}

.party-chat-mic-deny {
  background: rgba(255, 255, 255, 0.14);
  color: #e5e7eb;
}

.party-chat-mic-agree {
  background: linear-gradient(90deg, #f59e0b, #ea580c);
  color: #fff;
}

.party-chat-mic-invite.is-resolved {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  opacity: 0.88;
}

.party-chat-mic-resolved {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.82);
}

.live-chat-compose {
  flex-shrink: 0;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 0;
  background: transparent;
  border-top: none;
}

.live-chat-compose.is-open {
  display: flex;
}

.live-chat-compose.ap-compose-inline {
  display: flex !important;
  flex: 1 1 0%;
  min-width: 0;
  max-width: none;
  overflow: hidden;
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

.live-chat-compose input {
  flex: 1 1 auto;
  min-width: 0;
  width: 0;
  border: none;
  border-radius: 20px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 14px;
}

.live-chat-compose input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.live-chat-compose button {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.party-bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  /* Above FX (9000) and chat; BELOW gift/tools sheets (32000) */
  z-index: 14000;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--ap-bottom-bar-h);
  padding: 8px 10px 10px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.97), rgba(0, 0, 0, 0.88));
  pointer-events: auto !important;
  overflow: visible;
  transition: bottom 0.2s ease;
  isolation: isolate;
  touch-action: manipulation;
}

#partyBottomBar .party-btn-gift,
#liveBtnGift,
#partyBtnGift,
.party-btn-gift.ap-btn-gift-hero {
  position: relative;
  z-index: 14250 !important;
  pointer-events: auto !important;
  touch-action: manipulation;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
}

#partyBottomBar .party-btn-gift i,
#liveBtnGift i,
#partyBtnGift i,
.party-btn-gift.ap-btn-gift-hero i {
  line-height: 1 !important;
  margin: 0 !important;
  display: block !important;
}

.party-bottom-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  position: relative;
  z-index: 14200 !important;
  pointer-events: auto !important;
  flex: 0 0 auto;
  flex-shrink: 0;
  touch-action: manipulation;
  isolation: isolate;
}

#partyBtnTools,
#liveBtnMic,
#partyBtnGift,
#liveBtnGift,
#partyBottomBar .ap-btn-grid,
#partyBottomBar .ap-btn-mic-ring {
  position: relative;
  z-index: 14100 !important;
  pointer-events: auto !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
}

.party-bottom-bar>* {
  flex-shrink: 0;
}

.party-bottom-bar .ap-compose-inline {
  flex-shrink: 1;
}

.party-btn-follow {
  border: none;
  padding: 10px 22px;
  border-radius: 24px;
  background: linear-gradient(90deg, #f59e0b, #ea580c);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}

.party-btn-join-seat {
  border: none;
  padding: 10px 16px;
  border-radius: 24px;
  background: linear-gradient(90deg, #8b5cf6, #6d28d9);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  pointer-events: auto !important;
  touch-action: manipulation;
  position: relative;
  z-index: 72;
}

.party-btn-join-seat {
  display: none !important;
}

.party-btn-join-seat[hidden],
.party-btn-join-seat.ap-btn-follow-hidden {
  display: none !important;
  pointer-events: none !important;
}

.party-requests-sheet.open,
#partyRequestsSheet.open {
  display: flex !important;
  pointer-events: auto !important;
  z-index: 15050 !important;
}

.party-requests-sheet.open .party-requests-panel,
#partyRequestsSheet.open .party-requests-panel {
  pointer-events: auto !important;
}

.party-requests-sheet.open .party-req-row button,
#partyRequestsSheet.open .party-req-row button {
  pointer-events: auto !important;
  touch-action: manipulation;
  position: relative;
  z-index: 3;
}

.party-bottom-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.party-bottom-actions button {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.party-btn-gift {
  width: 48px !important;
  height: 48px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #ec4899, #be185d) !important;
  font-size: 20px !important;
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.55);
  position: relative;
  z-index: 14250;
  pointer-events: auto !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(236, 72, 153, 0.35);
}

.party-host-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 10px 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 26;
  pointer-events: auto;
  touch-action: manipulation;
  background: transparent;
}

/* Host / admin control bars permanently removed from live UI */
#liveHostBar,
.live-host-bar,
#partyHostBar,
.party-host-bar {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Live host controls: host-only (never viewers) — kept for legacy selectors; bars stay hidden */
body:not(.ap-is-host):not(.ap-can-moderate) .live-host-bar,
body:not(.ap-is-host):not(.ap-can-moderate) #liveHostBar,
body:not(.ap-is-host):not(.ap-can-moderate) .live-host-bar-toggle,
body:not(.ap-is-host):not(.ap-can-moderate) .live-host-bar-actions,
.live-host-bar[hidden],
#liveHostBar[hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.ap-is-host .party-header {
  box-shadow: none;
}

/* Host already has "You are hosting" in the header — hide overlapping mode badge */
body.ap-is-host .party-meta-row.party-meta-row--live,
body.ap-is-host #liveModeBadge {
  display: none !important;
}

body.ap-is-host .party-host-meta .sub #partyHostLabel {
  color: #fbbf24;
  font-weight: 800;
}

body:not(.ap-is-host):not(.ap-can-moderate) .party-host-bar {
  display: none !important;
}

/* Party/live host bars stay hidden (tools → Basic Tools + people sheet) */
body.ap-is-host .party-host-bar,
body.ap-can-moderate .party-host-bar,
body.ap-is-host .live-host-bar,
body.ap-is-host #liveHostBar,
body.ap-is-host .live-host-bar:not([hidden]),
body.ap-is-host #liveHostBar:not([hidden]),
body.ap-is-host .live-host-bar.is-collapsed:not([hidden]),
body.ap-is-host #liveHostBar.is-collapsed:not([hidden]),
body.ap-is-host .live-host-bar:not(.is-collapsed):not([hidden]),
body.ap-is-host #liveHostBar:not(.is-collapsed):not([hidden]) {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

.live-host-bar-toggle {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  border: none;
  border-radius: 999px;
  min-height: 42px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #111827;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.live-host-bar.is-collapsed .live-host-bar-toggle {
  width: auto !important;
  max-width: none !important;
  flex: 0 0 auto !important;
  align-self: center !important;
}

.live-host-bar-toggle i {
  font-size: 12px;
}

.live-host-bar:not(.is-collapsed) .live-host-bar-toggle {
  align-self: flex-end;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.live-host-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.live-host-bar.is-collapsed .live-host-bar-actions {
  display: none !important;
}

.party-chat-hide-btn {
  writing-mode: horizontal-tb !important;
  transform: none !important;
  min-width: 28px;
  min-height: 28px !important;
  padding: 6px !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #e2e8f0 !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Large phone-friendly hide control (replaces All / Room / Chat tabs) */
.party-chat-hide-btn--solo {
  display: inline-flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 52px !important;
  min-height: 78px !important;
  padding: 10px 8px !important;
  border-radius: 14px !important;
  background: rgba(0, 0, 0, 0.55) !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  color: #fff !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  pointer-events: auto !important;
  touch-action: manipulation;
  z-index: 30;
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(245, 158, 11, 0.35);
}

.party-chat-hide-btn--solo i {
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
}

.party-chat-hide-btn--solo span {
  writing-mode: horizontal-tb;
  transform: none;
  line-height: 1.1;
  pointer-events: none;
}

/* Fixed above bottom bar — escapes live-overlay stacking (z-index 12) */
.live-show-chat-fab {
  position: fixed !important;
  left: 12px;
  bottom: calc(var(--ap-bottom-bar-h) + 18px + env(safe-area-inset-bottom, 0));
  z-index: 130 !important;
  min-width: 56px;
  height: 56px;
  padding: 0 16px;
  gap: 8px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: auto !important;
  touch-action: manipulation;
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(245, 158, 11, 0.35);
}

.live-show-chat-fab[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.party-chat-mod-btn {
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  margin-left: auto;
  flex-shrink: 0;
  font-size: 14px;
  cursor: pointer;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 6;
  pointer-events: auto !important;
}

.party-chat-mod-btn:active,
.party-chat-mod-btn:hover {
  color: #111827;
  background: #fbbf24;
}

.ap-chat-mod-menu {
  position: fixed;
  z-index: 16000;
  min-width: 212px;
  max-width: min(280px, calc(100vw - 24px));
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: auto !important;
}

.ap-chat-mod-menu button {
  border: none;
  background: transparent;
  color: #f9fafb;
  text-align: left;
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.ap-chat-mod-menu button i {
  width: 18px;
  flex-shrink: 0;
  text-align: center;
  opacity: 0.9;
  margin: 0;
}

.ap-chat-mod-menu button span {
  flex: 1;
  text-align: left;
  line-height: 1.2;
}

.ap-chat-mod-menu button:active,
.ap-chat-mod-menu button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.ap-chat-mod-menu [data-cmod="block"] {
  color: #fb7185;
}

.ap-chat-mod-menu [data-cmod="cancel"] {
  color: #9ca3af;
  font-weight: 500;
}

.party-host-action.is-active,
#liveBtnMuteAllChat.is-active,
#partyBtnMuteAllChat.is-active {
  background: rgba(239, 68, 68, 0.22) !important;
  color: #fecaca !important;
}

body.ap-chat-hidden .live-show-chat-fab:not([hidden]) {
  display: inline-flex !important;
  animation: ap-chat-fab-in 0.28s ease;
}

.live-show-chat-fab i,
.live-show-chat-fab span {
  pointer-events: none;
}

.live-show-chat-fab i {
  font-size: 18px;
}

@keyframes ap-chat-fab-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.92);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

body.ap-chat-hidden .party-chat-row,
body.ap-chat-hidden #partyChatRow {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

body.ap-chat-hidden .live-chat-ticker,
body.ap-chat-hidden .party-chat-feed,
body.ap-chat-hidden .party-chat-zone,
body.ap-chat-hidden .party-chat-controls {
  display: none !important;
  pointer-events: none !important;
}

body.ap-live-session-minimized .party-chat-row,
body.ap-live-session-minimized #partyChatRow,
body.ap-live-session-minimized .live-show-chat-fab,
body.ap-live-session-minimized .party-chat-feed,
body.ap-live-session-minimized .live-chat-ticker,
body.ap-live-session-minimized .live-overlay {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Keep camera full-bleed under chrome — no opaque bands */
body[data-live-page="live-room"] .live-remote-video,
body[data-live-page="live-room"] .live-local-video,
body[data-live-page="live-room"] .live-fallback-video {
  z-index: 3;
}

.party-minimize-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  flex-shrink: 0;
}

.party-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.party-host-action {
  flex: 1 1 calc(25% - 6px);
  min-width: 80px;
  border: none;
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: auto;
  touch-action: manipulation;
  position: relative;
  z-index: 1;
}

@media (max-width: 420px) {
  .live-host-bar .party-host-action {
    flex: 1 1 calc(50% - 6px);
  }
}

#liveBtnHostMute.is-muted {
  background: rgba(239, 68, 68, 0.45);
}

.party-host-action.is-active {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
}

.party-req-badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  font-size: 10px;
  margin-left: 4px;
}

.party-audience-bar {
  flex-shrink: 0;
  padding: 0 10px 8px;
  position: relative;
  z-index: 24;
}

.party-audience-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.party-audience-title {
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.party-audience-title i {
  color: #a78bfa;
}

.party-audience-manage {
  border: none;
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(139, 92, 246, 0.35);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.party-audience-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.party-audience-scroll::-webkit-scrollbar {
  display: none;
}

.party-audience-chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 52px;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  padding: 0;
}

.party-audience-chip img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(167, 139, 250, 0.85);
}

.party-audience-chip span {
  font-size: 9px;
  font-weight: 600;
  max-width: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-audience-empty {
  margin: 0;
  font-size: 10px;
  color: #94a3b8;
  text-align: center;
  padding: 4px 8px 0;
}

.party-viewers.is-clickable,
#partyViewerAvatars.is-clickable {
  cursor: pointer;
}

body.ap-is-host #partyViewerAvatars.is-clickable,
#partyViewerAvatars.is-clickable {
  outline: none;
}

.party-requests-sheet {
  position: fixed;
  inset: 0;
  z-index: 1250;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  padding: env(safe-area-inset-top, 0) 0 0;
  overflow: hidden;
  pointer-events: none;
}

.party-requests-sheet.open {
  display: flex;
  pointer-events: auto;
  z-index: 15050;
}

body.party-requests-open .party-bottom-bar,
body.party-requests-open #partyBottomBar {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(100%);
  z-index: 1 !important;
}

/* Ghost overlay catch — closed sheets must never steal gift taps */
.ap-modal-overlay:not(.open),
.gift-sheet:not(.open),
.party-tools-sheet:not(.open),
.party-requests-sheet:not(.open),
.party-music-sheet:not(.open),
.ap-topup-sheet:not(.open),
.ap-surprise-sheet:not(.open) {
  pointer-events: none !important;
  visibility: hidden;
}

body.party-requests-open .party-host-bar,
body.party-requests-open .live-host-bar {
  opacity: 0;
  pointer-events: none;
}

.party-requests-panel {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  max-height: min(72dvh, 560px);
  background: rgba(18, 10, 40, 0.98);
  border-radius: 20px 20px 0 0;
  padding: 16px 14px calc(20px + env(safe-area-inset-bottom, 0));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
  position: relative;
  z-index: 1;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
}

.party-requests-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.party-requests-head h3 {
  margin: 0;
  font-size: 16px;
}

.party-requests-head button,
#partyRequestsClose {
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 20;
  pointer-events: auto !important;
  touch-action: manipulation;
}

.party-viewer-count.live-joined-count {
  font-size: 11px;
  padding: 5px 11px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  color: #fff;
  overflow: visible;
  flex-shrink: 0 !important;
  min-width: fit-content;
}

.party-requests-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 12px;
}

.party-requests-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.party-requests-subtitle {
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.party-online-dot {
  color: #4ade80;
  font-size: 11px;
}

/* Host-only tools (video/audio mode/flip) stay host-only; room admins get the bar + mod tools */
body:not(.ap-is-host) .host-only-tool {
  display: none !important;
}

body.ap-can-moderate .live-host-bar,
body.ap-can-moderate #liveHostBar,
body.ap-can-moderate .live-host-bar:not([hidden]),
body.ap-can-moderate #liveHostBar:not([hidden]),
body.ap-can-moderate .live-host-bar.is-collapsed:not([hidden]),
body.ap-can-moderate #liveHostBar.is-collapsed:not([hidden]),
body.ap-can-moderate .live-host-bar:not(.is-collapsed):not([hidden]),
body.ap-can-moderate #liveHostBar:not(.is-collapsed):not([hidden]),
body.ap-can-moderate .party-live-actions .live-host-bar,
body.ap-can-moderate .party-live-actions #liveHostBar {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.ap-is-host .mod-only-tool,
body.ap-can-moderate .mod-only-tool {
  display: flex !important;
}

body:not(.ap-is-host):not(.ap-can-moderate) .mod-only-tool {
  display: none !important;
}

.ap-kick-duration-sheet {
  position: fixed;
  inset: 0;
  z-index: 15000;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
}

.ap-kick-duration-sheet.open {
  display: flex;
}

.ap-kick-duration-panel {
  width: 100%;
  max-width: 420px;
  background: #111827;
  border-radius: 16px;
  padding: 16px;
  color: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.ap-kick-duration-panel h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.ap-kick-duration-panel p {
  margin: 0 0 12px;
  font-size: 13px;
  color: #9ca3af;
}

.ap-kick-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, #ef4444, #b91c1c);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  touch-action: manipulation;
}

.ap-kick-opt i {
  width: 18px;
  text-align: center;
}

.ap-kick-cancel {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
  font-weight: 600;
  cursor: pointer;
}

#partyBtnLock.is-active .ico {
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.45);
}

.party-req-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

.party-req-row img {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  grid-row: 1 / span 2;
}

.party-req-row .info {
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
  grid-column: 2;
}

.party-req-row .info strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-req-row button {
  border: none;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  min-width: 58px;
  pointer-events: auto !important;
  touch-action: manipulation;
  position: relative;
  z-index: 2;
}

.party-req-row .accept {
  background: #22c55e;
  color: #fff;
}

.party-req-row .deny {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.party-req-actions {
  grid-column: 3;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
  min-width: 0;
}

.party-req-actions .party-admin-toggle,
.party-req-row .party-admin-toggle {
  background: #f59e0b;
  color: #111827;
  font-weight: 800;
}

.party-req-actions .party-admin-toggle.deny,
.party-req-row .party-admin-toggle.deny {
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
}

.party-requests-empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
  padding: 24px 0;
}

/* —— Immersive live/party (no app header or bottom nav) —— */
html.ap-live-immersive,
body[data-live-page='live-room'],
body[data-live-page='party-room'] {
  --social-bottom-nav-h: 0px;
}

html.ap-live-immersive .social-bridge-header,
html.ap-live-immersive #ap-bridge-header,
html.ap-live-immersive #social-bottom-nav-mount,
html.ap-live-immersive .social-bottom-nav,
html.ap-live-immersive .navbar,
html.ap-live-immersive footer.site-footer,
html.ap-live-immersive header.site-header,
body[data-live-page='live-room'] .social-bridge-header,
body[data-live-page='party-room'] .social-bridge-header,
body[data-live-page='live-room'] #ap-bridge-header,
body[data-live-page='party-room'] #ap-bridge-header,
body[data-live-page='live-room'] #social-bottom-nav-mount,
body[data-live-page='party-room'] #social-bottom-nav-mount,
body[data-live-page='live-room'] .social-bottom-nav,
body[data-live-page='party-room'] .social-bottom-nav,
body[data-live-page='live-room'] .navbar,
body[data-live-page='party-room'] .navbar,
body[data-live-page='live-room'] header.site-header,
body[data-live-page='party-room'] header.site-header {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

html.ap-live-immersive body,
html.ap-live-immersive.social-bridge-mode body,
html.ap-live-immersive.social-native body,
html.ap-live-immersive.social-app body,
body[data-live-page='live-room'],
body[data-live-page='party-room'] {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin: 0 !important;
  background: #000 !important;
  overflow: hidden;
}

body[data-live-page='live-room'] .party-room,
body[data-live-page='party-room'] .party-room,
body[data-live-page='live-room'] .live-room {
  min-height: 100dvh;
  height: 100dvh;
}

.ap-chat-backdrop {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.ap-chat-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.ap-chat-panel-title {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
}

.ap-chat-panel-close {
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.ap-chat-dismiss-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ap-compose-hidden {
  display: none !important;
}

.party-bottom-bar .party-btn-follow:not(.ap-btn-follow-hidden) {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
  max-width: 52%;
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #ea580c);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.45);
}

.party-tools-sheet {
  position: fixed;
  inset: 0;
  /* Above bottom bar so PK / tools stay tappable */
  z-index: 32000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: env(safe-area-inset-top, 0) 0 max(12px, env(safe-area-inset-bottom, 0));
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
  pointer-events: none;
}

.party-tools-sheet.open {
  display: flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.party-tools-sheet .party-tools-panel {
  width: min(100%, 420px);
  max-height: min(78dvh, 600px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 20px 20px 0 0;
  margin: 0 auto;
  background: rgba(14, 14, 18, 0.94);
  padding: 14px 12px calc(28px + env(safe-area-inset-bottom, 0px));
  position: relative;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.party-tools-panel h3,
.party-tools-title {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
  margin: 14px 0 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.party-tools-panel section:first-of-type .party-tools-title,
.party-tools-panel > .party-tools-title:first-child {
  margin-top: 4px;
}

.party-tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 8px;
}

.party-tools-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.party-tools-grid a,
.party-tools-grid button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  color: #fff;
  font-size: 10px;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  padding: 0 2px;
  -webkit-tap-highlight-color: transparent;
}

.party-tools-grid .ico {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.party-tools-grid .ico.msg {
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
}

.party-tools-grid .ico.sound {
  background: linear-gradient(145deg, #6366f1, #4338ca);
}

.party-tools-grid .ico.share {
  background: linear-gradient(145deg, #22c55e, #15803d);
}

.party-tools-grid .ico.report {
  background: linear-gradient(145deg, #ef4444, #b91c1c);
}

.party-tools-grid .ico.store {
  background: linear-gradient(145deg, #f97316, #c2410c);
}

.party-tools-grid .ico.vip {
  background: linear-gradient(145deg, #a855f7, #6b21a8);
}

.party-tools-grid .ico.coins {
  background: linear-gradient(135deg, #fbbf24, #d97706);
}

.party-tools-grid .ico.admins {
  background: linear-gradient(145deg, #64748b, #334155);
}

.party-tools-grid .ico.bubble {
  background: linear-gradient(145deg, #38bdf8, #0284c7);
}

.party-tools-grid .ico.fan {
  background: linear-gradient(145deg, #f472b6, #db2777);
}

.party-tools-grid .ico.livedata {
  background: linear-gradient(145deg, #2dd4bf, #0f766e);
}

.party-tools-grid .ico.management {
  background: linear-gradient(145deg, #94a3b8, #475569);
}

.party-tools-grid .ico.ambient,
.party-tools-grid .ico.music {
  background: linear-gradient(145deg, #a78bfa, #6d28d9);
}

.party-tools-grid .ico.record {
  background: linear-gradient(145deg, #52525b, #27272a);
}

.party-tools-grid .ico.intro {
  background: linear-gradient(145deg, #60a5fa, #1d4ed8);
}

.party-tools-grid .ico.flip,
.party-tools-grid .ico.beauty,
.party-tools-grid .ico.mirror,
.party-tools-grid .ico.effects,
.party-tools-grid .ico.noise {
  background: linear-gradient(145deg, #475569, #1e293b);
}

.party-tools-grid .ico.rank {
  background: linear-gradient(145deg, #f59e0b, #b45309);
}

.party-tools-grid .ico.pk {
  background: linear-gradient(145deg, #ff4d9a, #5b6cff);
  font-weight: 900;
  letter-spacing: -0.04em;
  font-size: 15px;
  overflow: hidden;
}

.party-tools-grid .ico.pk .ap-pk-ico-mark {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  line-height: 1;
}

.party-tools-grid .ico.pk .ap-pk-ico-mark b {
  color: #ff6bb5;
  font-style: normal;
}

.party-tools-grid .ico.pk .ap-pk-ico-mark i {
  color: #7dd3fc;
  font-style: normal;
  font-weight: 900;
}

.party-tools-grid .ico.games {
  background: linear-gradient(145deg, #60a5fa, #2563eb);
}

.party-tools-grid .ico.giftc,
.party-tools-grid .ico.gallery,
.party-tools-grid .ico.lucky,
.party-tools-grid .ico.wish {
  background: linear-gradient(145deg, #fb7185, #e11d48);
}

.party-tools-grid .ico.backpack,
.party-tools-grid .ico.collection {
  background: linear-gradient(145deg, #38bdf8, #1d4ed8);
}

.party-tools-grid .ico.trade {
  background: linear-gradient(145deg, #fbbf24, #ca8a04);
}

.party-tools-grid .ico.bg {
  background: linear-gradient(145deg, #8b5cf6, #5b21b6);
}

.party-tools-grid .ico.minimize {
  background: linear-gradient(145deg, #64748b, #334155);
}

.ap-tool-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ap-tool-badge--on {
  background: #22c55e;
  color: #052e16;
}

.ap-tool-badge--off {
  background: #71717a;
  color: #fafafa;
}

.ap-tool-close-fab {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  z-index: 2;
  cursor: pointer;
}

body:not(.ap-is-host) .host-only-tool,
body:not(.ap-is-host) .host-only-tools-section {
  display: none !important;
}

/* Live data mini panel (DOM only) */
.ap-host-data-sheet {
  position: fixed;
  inset: 0;
  z-index: 16000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.ap-host-data-sheet.open {
  display: flex;
  pointer-events: auto;
}

.ap-host-data-panel {
  width: min(100%, 420px);
  max-height: 70dvh;
  overflow: auto;
  border-radius: 18px 18px 0 0;
  background: rgba(14, 14, 18, 0.96);
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0));
  color: #fff;
}

.ap-host-data-panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.ap-host-data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ap-host-data-grid .cell {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px;
}

.ap-host-data-grid .cell span {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 4px;
}

.ap-host-data-grid .cell strong {
  font-size: 16px;
  font-weight: 700;
}

.ap-host-data-close {
  width: 100%;
  margin-top: 14px;
  border: none;
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

/* Solo live broadcast */
.live-room {
  position: fixed;
  inset: 0;
  z-index: 12;
  background: #000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

.live-room video,
.live-room .live-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.live-room .live-bg {
  background: #111 center/cover no-repeat;
  z-index: 0;
}

.live-room .live-remote-video,
.live-room .live-local-video {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.live-room .live-local-video.is-host-only {
  z-index: 2;
}

.live-room .live-fallback-video {
  z-index: 1;
  object-fit: cover;
  pointer-events: none;
}

.live-room .live-bg {
  pointer-events: none;
}

.live-room .live-remote-video video,
.live-room .live-local-video video {
  pointer-events: none;
}

.live-room .live-remote-video>div,
.live-room .live-local-video>div {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.live-room .live-overlay {
  position: relative;
  z-index: 12;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  /* Empty overlay pads (incl. above bottom bar) must not steal gift/tools taps */
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0%, transparent 14%, transparent 78%, rgba(0, 0, 0, 0.3) 100%);
  /* Extra gap so last chat lines never sit under "Say something" / gift bar */
  padding-bottom: calc(var(--ap-bottom-bar-h, 58px) + env(safe-area-inset-bottom, 0px) + 12px);
}

.live-room .live-overlay > * {
  pointer-events: auto;
}

.live-room .live-overlay > .live-spacer,
.live-room .live-overlay > .party-chat-row {
  pointer-events: none !important;
}

.live-room .live-overlay .party-chat-controls,
.live-room .live-overlay .party-chat-zone,
.live-room .live-overlay .party-chat-feed,
.live-room .live-overlay .party-chat-msg,
.live-room .live-overlay .party-chat-mod-btn,
.live-room .live-overlay .party-chat-hide-btn,
.live-room .live-overlay .party-chat-tabs,
.live-room .live-overlay .party-chat-tabs button,
.live-room .live-overlay .party-chat-swipe-handle {
  pointer-events: auto !important;
}

.live-room .live-spacer {
  pointer-events: none !important;
}

.live-room .party-header {
  position: relative;
  flex-shrink: 0;
  z-index: 30;
}

.live-room .party-stats-bar,
.live-room .party-widgets {
  flex-shrink: 0;
}

.live-room .party-ticker {
  flex-shrink: 0;
  margin-bottom: 0;
}

.live-room .live-spacer {
  flex: 1;
  min-height: 12px;
  pointer-events: none;
}

.live-room .party-chat-row {
  flex: 0 1 auto;
  flex-shrink: 1;
  max-height: min(34vh, 260px);
  min-height: 96px;
  margin-bottom: 2px;
  /* Chat paints under bottom bar z-index; clearance is padding on overlay */
  position: relative;
  z-index: 20;
}

.live-room .party-chat-zone {
  max-height: min(34vh, 260px);
  overflow: hidden;
  touch-action: pan-y;
}

.live-room .party-chat-feed {
  max-height: min(32vh, 240px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
  padding-bottom: 14px !important;
}

.live-room .live-chat-compose {
  flex-shrink: 0;
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: auto;
}

/* Lucky Gifts event */
.lucky-page {
  min-height: 100dvh;
  background: linear-gradient(180deg, #fdf9f0 0%, #f5e6c8 40%, #e8c56a 100%);
  padding-bottom: 80px;
}

.lucky-hero {
  text-align: center;
  padding: calc(12px + env(safe-area-inset-top, 0)) 16px 16px;
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.2), transparent);
}

.lucky-hero h1 {
  font-size: 26px;
  font-weight: 900;
  color: #6b4f10;
  text-shadow: none;
  margin: 8px 0;
}

.lucky-hero .dates {
  font-size: 12px;
  color: #78350f;
  font-weight: 600;
}

.lucky-pool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff8c42, #c9a227);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 4px 16px rgba(107, 79, 16, 0.25);
}

.lucky-main-tabs {
  display: flex;
  gap: 10px;
  padding: 0 16px;
  margin-top: 8px;
}

.lucky-main-tabs a {
  flex: 1;
  text-align: center;
  padding: 12px;
  border-radius: 16px;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  color: #6b4f10;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(201, 162, 39, 0.25);
}

.lucky-main-tabs a.active {
  background: #fff;
  color: #6b4f10;
  box-shadow: 0 4px 12px rgba(107, 79, 16, 0.12);
  border-color: #c9a227;
}

.lucky-sub-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
}

.lucky-sub-tabs button {
  flex: 1;
  border: none;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.75);
  color: #6b4f10;
  border: 1px solid rgba(201, 162, 39, 0.2);
}

.lucky-sub-tabs button.active {
  background: #c9a227;
  color: #fff;
}

.lucky-gift-slider {
  margin: 0 12px 12px;
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  padding: 12px 0;
  border: 1px solid rgba(201, 162, 39, 0.2);
  box-shadow: 0 4px 12px rgba(107, 79, 16, 0.08);
}

.lucky-gift-track {
  display: flex;
  transition: transform 0.4s ease;
}

.lucky-gift-slide {
  flex: 0 0 100%;
  text-align: center;
  padding: 0 16px;
}

.lucky-gift-slide h4 {
  font-size: 15px;
  color: #6b4f10;
  margin-bottom: 10px;
  font-weight: 800;
}

.lucky-gift-icons {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 32px;
}

.lucky-board {
  margin: 0 12px;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(180deg, #fffdf8, #fdf9f0);
  padding: 12px;
  border: 1px solid rgba(201, 162, 39, 0.25);
  box-shadow: 0 -4px 20px rgba(107, 79, 16, 0.08);
}

.lucky-board-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 12px;
  color: #78350f;
}

.lucky-board-top .timer {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1px;
  color: #6b4f10;
}

.lucky-rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(201, 162, 39, 0.15);
}

.lucky-rank-row .rank-badge {
  width: 36px;
  text-align: center;
  font-size: 18px;
}

.lucky-rank-row img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #c9a227;
  object-fit: cover;
}

.lucky-rank-row .info {
  flex: 1;
  min-width: 0;
}

.lucky-rank-row .info .name {
  font-weight: 700;
  font-size: 13px;
  color: #6b4f10;
}

.lucky-rank-row .scores {
  display: flex;
  gap: 12px;
  font-size: 11px;
  margin-top: 4px;
  color: #78350f;
}

.lucky-rank-row .btn-receive {
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
  color: #78350f;
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
}

.lucky-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0));
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #374151;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
}

/* Streamer Center */
.streamer-page {
  min-height: 100dvh;
  background: linear-gradient(180deg, #f3e8ff 0%, #faf6ee 28%);
  padding-bottom: 88px;
}

.streamer-top {
  text-align: center;
  padding: calc(16px + env(safe-area-inset-top, 0)) 16px 20px;
}

.streamer-top .back {
  position: absolute;
  left: 12px;
  top: calc(12px + env(safe-area-inset-top, 0));
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #374151;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.streamer-top h1 {
  font-size: 18px;
  color: #374151;
  margin: 0;
}

.streamer-top .uid {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 4px;
}

.streamer-top .streamer-agency {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: #8a6914;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff8e1;
  border: 1px solid #f0e6d0;
}

.streamer-top .streamer-agency i {
  color: #c9a227;
  font-size: 11px;
}

.streamer-top .streamer-agency.unassigned {
  color: #6b7280;
  background: #f3f4f6;
  border-color: #e5e7eb;
  font-weight: 500;
}

.streamer-card {
  margin: 0 14px 14px;
  background: #fff;
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.streamer-policy-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 4px;
}

.streamer-policy-card {
  display: block;
  text-decoration: none;
  color: #3d2e08;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(201, 162, 39, 0.22);
  background: #fffdf8;
}

.streamer-policy-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  object-position: center center;
  background: #0b0614;
}

.streamer-policy-card span {
  display: block;
  padding: 8px 8px 10px;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.streamer-card h2 {
  font-size: 15px;
  color: #374151;
  margin: 0 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.streamer-card h2 a {
  font-size: 12px;
  color: #ea580c;
  font-weight: 600;
  text-decoration: none;
}

.streamer-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.streamer-pills button {
  flex: 1 1 auto;
  min-width: 88px;
  border: none;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: #f3f4f6;
  color: #6b7280;
}

.streamer-pills button.active {
  background: #ffedd5;
  color: #ea580c;
}

.streamer-period-days {
  margin: 0 0 12px;
  font-size: 12px;
  color: #6b7280;
}

.streamer-period-days strong {
  color: #111827;
}

.streamer-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.streamer-metrics .metric {
  text-align: center;
}

.streamer-metrics .val {
  font-size: 22px;
  font-weight: 800;
  color: #111827;
}

.streamer-metrics .lbl {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
}

.streamer-daily-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.streamer-daily-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: #f9fafb;
  border-radius: 10px;
  font-size: 13px;
}

.streamer-daily-row strong {
  font-weight: 800;
  color: #111827;
}

.streamer-daily-row .sub {
  font-size: 11px;
  color: #9ca3af;
}

.streamer-daily-row .hrs {
  font-weight: 800;
  color: #ea580c;
  white-space: nowrap;
}

.streamer-metrics--split {
  grid-template-columns: repeat(2, 1fr);
}

.metric--live .val {
  color: #c2410c;
}

.metric--party .val {
  color: #7c3aed;
}

.streamer-daily-title {
  font-size: 13px;
  margin: 16px 0 8px;
  font-weight: 800;
}

.streamer-daily-title--live {
  color: #c2410c;
}

.streamer-hint {
  font-size: 12px;
  color: #6b7280;
  margin: -4px 0 10px;
  line-height: 1.45;
}

.streamer-balance-card .metric--points .val {
  color: #b45309;
}

.streamer-balance-card .metric--coins .val {
  color: #2563eb;
}

.streamer-balance-card .metric--lifetime .val {
  color: #059669;
}

.metric--points .val {
  color: #b45309;
}

.metric--coins .val {
  color: #2563eb;
}

.streamer-daily-title--party {
  color: #7c3aed;
}

.streamer-daily-title--points {
  color: #b45309;
}

.streamer-daily-title--sent {
  color: #2563eb;
}

.streamer-daily-title--recv {
  color: #059669;
}

.streamer-daily-row--points .hrs {
  color: #b45309;
}

.streamer-daily-row--sent .hrs {
  color: #2563eb;
}

.streamer-daily-row--recv .hrs {
  color: #059669;
}

.streamer-daily-row .sub-count {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 600;
  margin-left: 6px;
}

.streamer-daily-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
}

.streamer-daily-pager button {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  cursor: pointer;
}

.streamer-daily-pager button:disabled {
  opacity: 0.4;
  cursor: default;
}

.streamer-daily-pager span {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
}

.streamer-daily-row--live .hrs {
  color: #c2410c;
}

.streamer-daily-row--party .hrs {
  color: #7c3aed;
}

.streamer-cover-box {
  background: #f9fafb;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
  border: 2px dashed #e5e7eb;
}

.streamer-cover-box p {
  font-size: 12px;
  color: #6b7280;
  margin: 8px 0 12px;
}

.streamer-cover-box .btn-upload {
  border: none;
  padding: 10px 20px;
  border-radius: 999px;
  background: #ffedd5;
  color: #ea580c;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.streamer-start {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0));
  border: none;
  width: calc(100% - 32px);
  padding: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #ea580c);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(234, 88, 12, 0.35);
  z-index: 20;
}

/* Coins QR recharge */
.recharge-page {
  min-height: 100dvh;
  background: #faf6ee;
  padding: calc(12px + env(safe-area-inset-top, 0)) 16px 32px;
}

.recharge-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.recharge-header a {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8b6914;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.recharge-header h1 {
  font-size: 18px;
  color: #5c4210;
  margin: 0;
  flex: 1;
}

.recharge-qr-card {
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(201, 162, 39, 0.12);
  border: 1px solid rgba(201, 162, 39, 0.2);
}

.recharge-qr-card img {
  width: min(240px, 70vw);
  height: auto;
  border-radius: 12px;
  margin: 0 auto 12px;
  display: block;
}

.recharge-qr-card .amount {
  font-size: 28px;
  font-weight: 800;
  color: #9a7218;
}

.recharge-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.recharge-amounts button {
  flex: 1 1 calc(33% - 8px);
  min-width: 90px;
  border: 2px solid rgba(201, 162, 39, 0.35);
  border-radius: 12px;
  padding: 12px 8px;
  background: #fff;
  font-weight: 700;
  color: #5c4210;
  cursor: pointer;
}

.recharge-amounts button.active {
  border-color: #c9a227;
  background: #fffbeb;
}

.recharge-field label {
  display: block;
  font-size: 12px;
  color: #8b6914;
  margin-bottom: 6px;
}

.recharge-field input {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e8d9a8;
  font-size: 15px;
  margin-bottom: 12px;
}

.recharge-submit {
  width: 100%;
  border: none;
  padding: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #e8c56a, #c9a227);
  color: #3d2e08;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
}

.recharge-note {
  font-size: 11px;
  color: #8b6914;
  margin-top: 12px;
  text-align: center;
}

/* --- Enhanced party / live (dynamic) --- */
.party-room-grid-floor {
  display: none !important;
}

.party-room-grid-floor--legacy {
  position: absolute;
  bottom: 0;
  left: -10%;
  right: -10%;
  height: 35%;
  background:
    linear-gradient(180deg, transparent 0%, rgba(88, 28, 180, 0.2) 40%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 24px);
  transform: perspective(500px) rotateX(62deg);
  transform-origin: bottom center;
  opacity: 0.55;
  pointer-events: none;
}

.party-seat {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.party-seat.is-speaking .seat-avatar {
  box-shadow: 0 0 0 3px #fbbf24, 0 0 20px rgba(251, 191, 36, 0.6);
  animation: seat-pulse 1.2s ease-in-out infinite;
}

.party-seat.is-muted .seat-avatar {
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.85);
  opacity: 0.72;
  filter: grayscale(0.35);
}

.party-seat.is-muted.is-speaking .seat-avatar {
  animation: none;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.85);
}

@keyframes seat-pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.04);
  }
}

.seat-avatar .mic-live {
  display: none !important;
}

.party-seats:not(.party-seats-ref):not(.party-seats-9) .party-seat:not(.is-host):nth-child(2) {
  grid-column: 1;
  grid-row: 1;
}

.party-seats:not(.party-seats-ref):not(.party-seats-9) .party-seat:not(.is-host):nth-child(3) {
  grid-column: 4;
  grid-row: 1;
}

.party-seats:not(.party-seats-ref):not(.party-seats-9) .party-seat.is-host {
  grid-column: 2 / span 2;
  grid-row: 1;
  justify-self: center;
}

.party-win-banner.is-flash {
  animation: win-flash 0.5s ease 3;
}

@keyframes win-flash {

  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.35);
  }
}

.live-room .party-header-center {
  display: none !important;
}

/* Connection / live status — inline above chat feed */
.ap-room-status-strip {
  display: none;
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  top: auto;
  z-index: 2;
  flex-shrink: 0;
  justify-content: flex-start;
  align-items: stretch;
  padding: 0 0 4px;
  pointer-events: none;
  order: 1;
}

.party-chat-zone>.ap-room-status-strip {
  width: 100%;
}

.party-chat-zone>.party-chat-feed {
  order: 3;
}

.ap-room-status-strip.is-visible {
  display: flex;
}

.live-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(8, 8, 16, 0.88);
  color: #fde68a;
  pointer-events: auto;
  width: auto;
  max-width: min(100%, 300px);
  white-space: normal;
  text-align: left;
  line-height: 1.35;
  overflow: visible;
  text-overflow: unset;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(251, 191, 36, 0.35);
  backdrop-filter: blur(8px);
}

.live-status-dismiss {
  flex-shrink: 0;
  margin-left: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.live-status-badge.is-warn::before {
  content: '';
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fbbf24;
  border-radius: 50%;
  animation: ap-loader-spin 0.8s linear infinite;
}

.live-remote-video,
.live-local-video {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.live-remote-video video,
.live-local-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.live-remote-video>div,
.live-local-video>div {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.live-local-video.is-host-only {
  z-index: 2;
}

.live-fallback-video {
  z-index: 0;
  object-fit: cover;
}

.live-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 20000;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  text-align: center;
  max-width: 85%;
}

.live-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Toast above gift sheet so send failures stay visible */
.social-toast {
  z-index: 20000 !important;
}

/* Camera above poster when stream is active */
.live-room .live-local-video.is-host-only,
.live-room.ap-has-video-stream .live-remote-video {
  z-index: 3;
}

.live-room.ap-has-video-stream .live-bg {
  display: none !important;
}

.gift-sheet {
  position: fixed;
  inset: 0;
  z-index: 32000;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  pointer-events: none;
  touch-action: manipulation;
}

.gift-sheet.open {
  display: flex;
  pointer-events: auto;
}

.gift-sheet:not(.open) {
  display: none !important;
  background: transparent !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.gift-sheet-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: min(62vh, 520px);
  min-height: 280px;
  overflow: hidden;
  background: #14121c;
  border-radius: 16px 16px 0 0;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0));
  position: relative;
  z-index: 1;
  pointer-events: auto;
  touch-action: manipulation;
}

.gift-sheet-close {
  position: absolute;
  right: 12px;
  top: 12px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}

.gift-sheet h3 {
  color: #fff;
  margin: 0 0 8px;
  font-size: 16px;
}

.gift-balance {
  color: #f9a8d4;
  font-size: 12px;
  margin: 0 0 12px;
}

.gift-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.gift-grid button {
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 10px 4px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 96px;
  overflow: visible;
}

.gift-grid .g {
  font-size: 28px;
  line-height: 1;
}

.gift-grid .gift-name {
  display: block;
  width: 100%;
  max-width: 100%;
  font-size: 10px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.92;
}

.gift-grid small,
.gift-grid .gift-coin-cost {
  display: block;
  width: 100%;
  margin-top: 2px;
  color: #fbbf24;
  font-weight: 800;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.gift-recharge-link {
  display: block;
  text-align: center;
  margin-top: 14px;
  color: #fbbf24;
  font-weight: 700;
  font-size: 13px;
}

.party-btn-follow.is-following {
  background: rgba(255, 255, 255, 0.2);
  color: #fde68a;
}

#liveBtnMic.is-muted {
  background: rgba(239, 68, 68, 0.5) !important;
}

.streamer-dual-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.streamer-mode-btn {
  border: none;
  border-radius: 16px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 800;
  color: #fff;
}

.streamer-mode-btn i {
  font-size: 28px;
}

.streamer-mode-btn small {
  font-weight: 500;
  opacity: 0.9;
  font-size: 11px;
}

.streamer-mode-live {
  background: linear-gradient(145deg, #f59e0b, #ea580c);
}

.streamer-mode-party {
  background: linear-gradient(145deg, #8b5cf6, #6d28d9);
}

.streamer-dual-btns--solo {
  grid-template-columns: 1fr;
}

.streamer-mode-btn-full {
  width: 100%;
}

.streamer-link-pill {
  padding: 8px 14px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
}

.streamer-bottom-spacer {
  height: 24px;
}

/* Vertical live discovery feed (TikTok-style) */
.live-feed-scroll {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  pointer-events: none;
}

.live-feed-scroll:not([aria-hidden="true"]) {
  pointer-events: auto;
}

.live-feed-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #0a0618 center/cover no-repeat;
  transition: background-image 0.35s ease;
  pointer-events: none;
}

.live-feed-backdrop:not([aria-hidden="true"]) {
  pointer-events: auto;
}

body.live-feed-mode .live-room {
  z-index: 20;
}

body.live-feed-mode .live-feed-scroll {
  z-index: 8;
}

.live-feed-scroll::-webkit-scrollbar {
  display: none;
}

.live-feed-slide {
  height: 100dvh;
  min-height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  background: #0a0618 center/cover no-repeat;
}

body.live-feed-mode .live-room .live-bg {
  opacity: 1;
}

/* Feed swipe: show placeholder bg until real stream connects */
body.live-feed-mode .live-room:not(.ap-has-video-stream) .live-remote-video,
body.live-feed-mode .live-room:not(.ap-has-video-stream) .live-local-video,
body.live-feed-mode .live-room:not(.ap-has-video-stream) .live-fallback-video {
  opacity: 0;
  pointer-events: none;
}

body.live-feed-mode .live-room.ap-has-video-stream .live-remote-video,
body.live-feed-mode .live-room.ap-has-video-stream .live-local-video,
body.live-feed-mode .live-room.ap-has-video-stream .live-fallback-video {
  opacity: 1;
  pointer-events: none;
  z-index: 3;
}

body.live-feed-mode .live-room.ap-has-video-stream .live-bg {
  opacity: 0;
}

body.live-feed-mode.ap-has-video-stream .live-feed-backdrop {
  opacity: 0;
  transition: opacity 0.25s ease;
}

body.live-feed-mode .live-room .live-remote-video:has(video),
body.live-feed-mode .live-room .live-local-video:has(video) {
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 3;
}

body.live-feed-mode .live-room .live-overlay {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.65) 0%, transparent 20%, transparent 50%, rgba(0, 0, 0, 0.75) 100%);
}

.live-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: rgba(239, 68, 68, 0.85);
  color: #fff;
  pointer-events: none;
  flex-shrink: 0;
}

.live-mode-badge.is-host {
  background: rgba(245, 158, 11, 0.9);
  color: #1a1000;
}

.live-swipe-hint {
  position: fixed;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 48;
  writing-mode: vertical-rl;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  animation: swipe-hint-pulse 2s ease-in-out infinite;
}

.live-swipe-hint.is-hidden {
  display: none;
}

@keyframes swipe-hint-pulse {

  0%,
  100% {
    opacity: 0.45;
    transform: translateY(-50%);
  }

  50% {
    opacity: 1;
    transform: translateY(calc(-50% - 6px));
  }
}

.live-pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  margin-right: 4px;
  animation: live-pulse-dot 1.2s ease-in-out infinite;
}

@keyframes live-pulse-dot {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.85);
  }
}

.live-viewers-label {
  font-size: 10px;
  font-weight: 600;
  color: #cbd5e1;
  margin-left: 2px;
}

#liveRoomId,
#liveSubLabel {
  color: #cbd5e1;
}

.live-status-badge.is-ok {
  background: rgba(22, 101, 52, 0.92);
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.55);
}

.live-status-badge.is-ok::before {
  display: none;
}

.live-status-badge.is-err {
  background: rgba(127, 29, 29, 0.92);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.55);
}

.live-status-badge.is-err::before {
  display: none;
}

.live-status-badge.is-warn {
  background: rgba(120, 53, 15, 0.92);
  color: #fef3c7;
  border-color: rgba(245, 158, 11, 0.55);
}

body.ap-live-status-visible .live-room .live-overlay,
body.ap-live-status-visible .party-room {
  padding-top: 0;
}

.party-meta-row.party-meta-row--live {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 52px);
  left: 12px;
  z-index: 18;
  margin: 0;
  pointer-events: none;
}

.party-meta-row.party-meta-row--live .live-mode-badge {
  font-size: 9px;
  padding: 4px 8px;
  opacity: 0.85;
}

.live-room .party-viewers {
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: nowrap;
}

.live-room .party-viewers span:not(.party-viewer-count):not(.live-viewers-label):not(.ap-top-gifter) {
  display: none;
}

.live-room .party-viewers .ap-top-gifter {
  display: inline-flex;
}

.live-room .party-viewers .ap-top-gifter em {
  display: none;
}

.party-viewer-count {
  font-size: 14px;
  font-weight: 800;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 12px;
  pointer-events: auto !important;
}

/* AP Services room entry — host cover (no branded preloader) */
.ap-live-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: #0a0618;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  overflow: hidden;
}

.ap-live-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: none !important;
}

/* Host cover above video briefly — fades as soon as stream is attached */
.ap-live-sticky-poster {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #0a0618 center/cover no-repeat;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.ap-live-sticky-poster.is-gone {
  opacity: 0;
}
.live-room.ap-has-video-stream .ap-live-sticky-poster {
  opacity: 0;
  pointer-events: none;
}

body.ap-room-active .ap-live-loader {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.ap-live-loader-cover {
  position: absolute;
  inset: 0;
  background-color: #0a0618;
  background-size: cover;
  background-position: center;
  transform: scale(1.03);
  filter: blur(0);
  transition: transform 0.5s ease, filter 0.5s ease;
}

.ap-live-loader.is-hidden .ap-live-loader-cover {
  transform: scale(1);
}

.ap-live-loader-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.55) 55%, rgba(0, 0, 0, 0.82) 100%);
  pointer-events: none;
}

.ap-live-loader-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 24px calc(28px + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 420px;
}

.ap-live-loader-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  margin: 0 auto 12px;
  display: block;
}

.ap-live-loader-avatar[hidden] {
  display: none !important;
}

.ap-live-loader-label {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  margin: 0 0 10px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.ap-live-loader-pulse {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
}

.ap-live-loader-pulse::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55);
  animation: ap-loader-live-pulse 1.4s ease infinite;
}

@keyframes ap-loader-live-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55);
    opacity: 1;
  }

  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    opacity: 0.75;
  }
}

.ap-live-loader-skip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  padding: 10px 22px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

.ap-live-loader-skip:active {
  transform: scale(0.98);
  background: rgba(0, 0, 0, 0.6);
}

/* legacy loader bits — hidden if any remain in DOM */
.ap-live-loader-logo,
.ap-live-loader-brand,
.ap-live-loader-steps,
.ap-live-loader-spin {
  display: none !important;
}

/* Room stats bar */
.party-stats-bar {
  position: relative;
  z-index: 18;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 0 10px 6px;
  font-size: 10px;
  color: #e2e8f0;
}

.party-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.party-stat strong {
  color: #fde68a;
}

.party-stat-pct {
  color: #7dd3fc;
}

.party-rule-btn {
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.party-room-id {
  margin-left: auto;
  font-size: 9px;
  color: #cbd5e1;
}

/* Side widgets */
.party-widgets {
  position: relative;
  z-index: 14;
  display: flex;
  gap: 8px;
  padding: 0 10px 6px;
  align-items: stretch;
}

.party-widgets-live {
  max-width: 55%;
}

.party-widget-team {
  flex: 1;
  min-width: 0;
}

.party-widget-chest {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 4px 8px !important;
}

.party-widget-chest .chest-ico {
  font-size: 18px;
  line-height: 1;
}

.party-widget-chest span:last-child {
  font-size: 11px;
  font-weight: 800;
  color: #fde68a;
}

.party-event-pill {
  position: relative;
  top: auto;
  right: auto;
  z-index: 1;
  min-width: 72px;
  width: auto;
  max-width: none;
  min-height: 44px;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(180deg, #ec4899, #be185d);
  border: none;
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.45);
  line-height: 1.2;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-shrink: 0;
  white-space: normal;
}

.party-event-pill--inline {
  margin-left: 0;
  max-width: none;
}

.party-event-pill .pill-title {
  display: block;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.party-event-pill .pill-sub {
  display: block;
  font-size: 9px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.1;
}

.party-event-pill .pill-title i {
  margin-right: 3px;
}

.party-invite-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 0 10px 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 40;
  pointer-events: auto !important;
}

.party-invite-row .party-event-pill,
.party-invite-row .party-users-btn {
  pointer-events: auto !important;
  touch-action: manipulation;
  position: relative;
  z-index: 41;
}

.party-live-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 10px 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 80;
  pointer-events: auto !important;
}

.party-live-actions .party-users-btn {
  margin: 0;
  flex-shrink: 0;
  order: 1;
  position: relative;
  z-index: 81;
  pointer-events: auto !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.party-live-actions .party-event-pill {
  margin: 0;
  flex-shrink: 0;
  order: 2;
  position: relative;
  z-index: 81;
  pointer-events: auto !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Keep people + Invite friends pinned to the right for everyone (host bar removed) */
body.ap-is-host .party-live-actions,
body.ap-can-moderate .party-live-actions {
  justify-content: flex-end;
}

body.ap-is-host .party-live-actions .party-users-btn,
body.ap-can-moderate .party-live-actions .party-users-btn,
body.ap-is-host .party-live-actions .party-event-pill,
body.ap-can-moderate .party-live-actions .party-event-pill {
  margin-left: 0;
  margin-right: 0;
}

.party-host-bar,
.party-meta-row.party-meta-row--live {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
}

.party-host-bar,
#partyHostBar {
  display: none !important;
}

.party-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 0 10px 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 22;
  pointer-events: auto;
}

.party-meta-row .live-mode-badge {
  position: relative;
  top: auto;
  left: auto;
  flex-shrink: 1;
  min-width: 0;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-meta-row .party-event-pill {
  margin-left: auto;
  max-width: 42%;
}

.party-meta-row--live {
  padding-bottom: 4px;
}

body.ap-is-host[data-live-page="live-room"] .party-widgets-live {
  display: none;
}

.party-event-pill-live {
  top: auto;
}

.party-event-pill .coins {
  font-size: 9px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-weight: 700;
  white-space: nowrap;
}

.party-event-pill .coins i {
  font-size: 8px;
}

/* TikTok-style live feed rail */
.live-feed-rail {
  position: absolute;
  right: 10px;
  bottom: 28%;
  z-index: 22;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  pointer-events: auto;
}

body.live-feed-mode .live-feed-rail {
  display: flex;
}

.live-rail-btn {
  border: none;
  background: none;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.live-rail-btn i {
  font-size: 28px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.live-rail-follow {
  position: relative;
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
}

.live-rail-follow img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #fff;
  object-fit: cover;
}

.live-rail-plus {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.live-rail-gift i {
  color: #f472b6;
}

/* Modals: rules, seat, profile */
.ap-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  touch-action: manipulation;
}

.ap-modal-overlay.open {
  display: flex;
}

#apRulesModal.open {
  pointer-events: auto;
}

#apRulesModal .ap-rules-modal {
  pointer-events: auto;
  touch-action: manipulation;
}

.ap-modal-overlay.align-bottom {
  align-items: flex-end;
  padding: 0;
}

.ap-rules-modal {
  background: #fff;
  border-radius: 20px;
  padding: 20px 18px;
  max-width: 340px;
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
}

.ap-rules-modal h2 {
  margin: 0 0 12px;
  font-size: 18px;
  color: #111;
}

.ap-rules-modal p,
.ap-rules-modal li {
  font-size: 12px;
  color: #444;
  line-height: 1.5;
}

.ap-rules-modal ul {
  padding-left: 18px;
  margin: 0 0 16px;
}

.ap-rules-ok {
  width: 100%;
  border: none;
  padding: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #ea580c);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
}

.ap-seat-sheet-panel {
  width: 100%;
  background: linear-gradient(180deg, #1e1b2e, #0f0d18);
  border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(28px + env(safe-area-inset-bottom, 0));
  text-align: center;
}

.ap-seat-badge {
  width: 80px;
  height: 80px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #b45309);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  box-shadow: 0 0 24px rgba(251, 191, 36, 0.4);
}

.ap-seat-sheet-panel h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.ap-seat-divider {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin: 16px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ap-seat-divider::before,
.ap-seat-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
}

.ap-seat-action {
  width: 100%;
  border: none;
  margin-top: 16px;
  padding: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #fcd9b8, #f59e0b);
  color: #1a1000;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
}

.ap-seat-desc {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
  margin: 0 0 12px;
  line-height: 1.45;
}

.ap-seat-steps {
  text-align: left;
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}

.ap-seat-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

.ap-seat-step span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.25);
  color: #fcd34d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.ap-viewer-onboard .ap-onboard-step {
  display: none;
  text-align: left;
}

.ap-viewer-onboard .ap-onboard-step.is-active {
  display: block;
}

.ap-viewer-onboard .ap-onboard-step h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.ap-viewer-onboard .ap-onboard-step p {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.5;
}

.ap-onboard-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 16px 0 8px;
}

.ap-onboard-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
}

.ap-onboard-dots span.active {
  background: #fbbf24;
}

.ap-profile-sheet-panel {
  width: 100%;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom, 0));
  max-height: min(88vh, 720px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ap-profile-hero-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.ap-profile-head-info {
  flex: 1;
  min-width: 0;
  padding-top: 4px;
}

.ap-profile-head-info h3 {
  margin: 0;
  font-size: 17px;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ap-profile-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.ap-profile-head img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid #a855f7;
  object-fit: cover;
}

.ap-profile-head .info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.ap-profile-head .info h3 {
  margin: 0;
  font-size: 17px;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ap-profile-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  font-size: 13px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
}

.ap-profile-id-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-profile-id-row button {
  flex-shrink: 0;
  border: none;
  background: rgba(245, 184, 0, 0.15);
  color: #d97706;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
}

.ap-profile-badges {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
  align-items: center;
  max-width: 100%;
}

.ap-profile-badges span {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  flex-shrink: 0;
}

#apProfileRoleBadge {
  display: inline-flex;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  background: transparent;
}

#apProfileRoleBadge .ap-role-badge {
  font-size: 10px;
  padding: 2px 7px;
}

.ap-profile-social-stats {
  display: flex;
  gap: 18px;
  margin-top: 10px;
}

.ap-profile-stat strong {
  display: block;
  font-size: 16px;
  color: #111;
  line-height: 1.2;
}

.ap-profile-stat span {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}

.ap-profile-gift-btn {
  width: 100%;
  border: none;
  padding: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #ea580c);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  margin-top: 12px;
}

/* Enhanced gift sheet */
.gift-sheet-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 10px;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.gift-sheet-tabs button {
  border: none;
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.gift-sheet-tabs button.active {
  background: #fbbf24;
  color: #1a1000;
}

.gift-recipients {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 12px;
  padding: 4px 0;
  -webkit-overflow-scrolling: touch;
}

.gift-recipient {
  flex-shrink: 0;
  text-align: center;
  border: none;
  background: none;
  color: #fff;
  cursor: pointer;
  padding: 0;
  opacity: 0.65;
}

.gift-recipient.is-active {
  opacity: 1;
}

.gift-recipient img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid transparent;
  object-fit: cover;
}

.gift-recipient.is-active img {
  border-color: #fbbf24;
}

.gift-recipient span {
  display: block;
  font-size: 9px;
  margin-top: 2px;
  max-width: 48px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gift-qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 8px;
}

.gift-qty-btns {
  display: flex;
  gap: 6px;
}

.gift-qty-btns button {
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.gift-qty-btns button.active {
  background: #fbbf24;
  color: #1a1000;
}

.gift-send-btn {
  border: none;
  padding: 10px 24px;
  border-radius: 999px;
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
  color: #1a1000;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}

.gift-grid button.is-selected {
  outline: 2px solid #fbbf24;
  background: rgba(251, 191, 36, 0.2);
}

.gift-grid .gift-tag {
  font-size: 8px;
  background: rgba(236, 72, 153, 0.8);
  padding: 1px 4px;
  border-radius: 4px;
  margin-top: 2px;
}

.party-tools-section {
  font-size: 11px !important;
  color: rgba(255, 255, 255, 0.45) !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 8px 0 10px !important;
}

.party-tools-grid-6 {
  grid-template-columns: repeat(3, 1fr) !important;
}

.party-tools-panel-full {
  max-height: 70vh;
}

.party-seat .seat-num {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 9px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.55);
  z-index: 2;
}

.party-seats-9 .party-seat.is-host {
  grid-column: 2;
  grid-row: 2;
}

.party-seats-9 .party-seat.is-host .seat-avatar {
  width: 72px;
  height: 72px;
}

.party-seats-9 .seat-avatar {
  width: 52px;
  height: 52px;
}

/* ========== Reference live UI (screenshot match) ========== */
.party-hour-badge {
  background: rgba(0, 0, 0, 0.45);
  padding: 2px 8px;
  border-radius: 999px;
  color: #fde68a !important;
}

.party-hour-badge strong {
  color: #fff !important;
}

.party-music-bar strong {
  color: #7dd3fc !important;
}

.ap-top-gifter {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 50%;
  overflow: visible;
  flex-shrink: 0;
}

.ap-top-gifter img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  object-fit: cover;
  display: block;
  overflow: hidden;
}

.ap-top-gifter.has-crown img {
  border-color: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
}

.ap-top-gifter em {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-style: normal;
  font-weight: 800;
  color: #1a1000;
  background: #fbbf24;
  padding: 1px 4px;
  border-radius: 4px;
  white-space: nowrap;
  line-height: 1.1;
  z-index: 2;
  overflow: visible;
}

.ap-gift-fly {
  position: fixed;
  top: calc(52px + env(safe-area-inset-top, 0));
  left: 8px;
  right: 8px;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}

.ap-gift-fly.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.ap-gift-fly img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #fbbf24;
}

.ap-pk-overlay {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  display: none;
}

body.is-pk-mode .ap-pk-overlay,
html.is-pk-mode .ap-pk-overlay {
  display: block !important;
  visibility: visible !important;
}

/* —— Classic PK arena: upper video slots + score under arena + chat under score —— */
body.is-pk-mode {
  --pk-arena-top: calc(78px + env(safe-area-inset-top, 0px));
  --pk-arena-h: min(30vh, 260px);
  --pk-party-dock-h: 56px;
}

body.is-pk-mode .live-room {
  --pk-arena-top: calc(78px + env(safe-area-inset-top, 0px));
  --pk-arena-h: min(30vh, 260px);
  --pk-party-dock-h: 56px;
  --ap-pk-stage-top: var(--pk-arena-top);
  --ap-pk-stage-bottom: auto;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(251, 191, 36, 0.18), transparent 55%),
    linear-gradient(165deg, #1a1030 0%, #0b1220 45%, #111827 100%) !important;
}

body.is-pk-mode[data-pk-slots='2'] .live-room {
  background:
    radial-gradient(100% 70% at 20% 10%, rgba(236, 72, 153, 0.28), transparent 50%),
    radial-gradient(100% 70% at 80% 10%, rgba(59, 130, 246, 0.28), transparent 50%),
    linear-gradient(180deg, #1e1b4b 0%, #0f172a 55%, #020617 100%) !important;
}

body.is-pk-mode[data-pk-slots='3'] .live-room {
  background:
    radial-gradient(90% 60% at 15% 12%, rgba(168, 85, 247, 0.3), transparent 48%),
    radial-gradient(90% 60% at 50% 8%, rgba(34, 197, 94, 0.18), transparent 48%),
    radial-gradient(90% 60% at 85% 12%, rgba(56, 189, 248, 0.28), transparent 48%),
    linear-gradient(180deg, #0f172a 0%, #111827 100%) !important;
}

body.is-pk-mode[data-pk-slots='4'] .live-room,
body.is-pk-mode[data-pk-slots='6'] .live-room {
  background:
    radial-gradient(circle at 15% 18%, rgba(251, 113, 133, 0.25), transparent 40%),
    radial-gradient(circle at 50% 12%, rgba(250, 204, 21, 0.18), transparent 40%),
    radial-gradient(circle at 85% 18%, rgba(96, 165, 250, 0.28), transparent 40%),
    linear-gradient(180deg, #0c1222 0%, #020617 100%) !important;
}

body.is-pk-mode .live-room #liveBg.live-bg {
  opacity: 0.35;
  filter: saturate(0.9);
}

/* Rival dual-Agora video (right slot) */
.ap-pk-rival-media {
  position: absolute;
  top: var(--pk-arena-top);
  left: 50%;
  width: 50%;
  height: var(--pk-arena-h);
  z-index: 6;
  display: none;
  overflow: hidden;
  border-radius: 0 0 12px 0;
  background: #0f172a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

body.is-pk-mode.ap-pk-has-rival .ap-pk-rival-media,
body.is-pk-mode .ap-pk-rival-media:not([aria-hidden='true']) {
  display: block !important;
}

.ap-pk-rival-media video,
.ap-pk-rival-media canvas,
.ap-pk-rival-media > div {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* Upper arena video slots — NEVER full-screen during PK */
body.is-pk-mode .live-room .live-local-video,
body.is-pk-mode .live-room .live-fallback-video,
body.is-pk-mode .live-room .live-remote-video {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  bottom: auto !important;
  height: var(--pk-arena-h) !important;
  top: var(--pk-arena-top) !important;
  overflow: hidden !important;
  border-radius: 0 0 12px 12px;
  background: #0f172a !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Host: always left slot(s) */
body.is-pk-mode.ap-is-host .live-room .live-local-video,
body.is-pk-mode.ap-is-host .live-room .live-fallback-video {
  left: 0 !important;
  right: auto !important;
  width: 50% !important;
  z-index: 5 !important;
}

body.is-pk-mode.ap-is-host:not(.ap-pk-has-rival) .live-room .live-remote-video:empty {
  display: none !important;
}

/* Audience: host stream in left slot */
body.is-pk-mode:not(.ap-is-host) .live-room .live-remote-video {
  left: 0 !important;
  width: 50% !important;
  z-index: 5 !important;
}

body.is-pk-mode:not(.ap-is-host):not(.ap-pk-has-rival) .live-room .live-local-video,
body.is-pk-mode:not(.ap-is-host):not(.ap-pk-has-rival) .live-room .live-fallback-video {
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

/* Avoid using main remote host for dual rival when we have dedicated box */
body.is-pk-mode.ap-pk-has-rival.ap-is-host .live-room .live-remote-video:not(:empty) {
  left: 50% !important;
  width: 50% !important;
  z-index: 4 !important;
  display: block !important;
}

body.is-pk-mode .live-room .live-remote-video video,
body.is-pk-mode .live-room .live-local-video video,
body.is-pk-mode .live-room .live-fallback-video {
  object-fit: cover !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Label frame over the arena */
.ap-pk-stage {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: var(--pk-arena-top) !important;
  height: var(--pk-arena-h) !important;
  bottom: auto !important;
  z-index: 8 !important;
  display: flex !important;
  pointer-events: none !important;
}

body.is-pk-mode .ap-pk-side-r {
  background: linear-gradient(165deg, rgba(30, 27, 75, 0.2), rgba(15, 23, 42, 0.35));
}

body.is-pk-mode .ap-pk-side-l {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.12), transparent 65%);
}

body.is-pk-mode .ap-pk-waiting {
  background: linear-gradient(160deg, rgba(30, 27, 75, 0.55) 0%, rgba(15, 23, 42, 0.65) 100%);
}

/*
 * PK score/party bar sits DIRECTLY under the live arena (under video, above chat),
 * NOT fixed behind the chat near the bottom controls.
 */
.ap-pk-score-wrap,
.ap-pk-party-dock {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: calc(var(--pk-arena-top) + var(--pk-arena-h) + 2px) !important;
  bottom: auto !important;
  z-index: 45 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 4px !important;
  padding: 0 0 4px !important;
  pointer-events: none;
  margin: 0 !important;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.55), rgba(2, 6, 23, 0.15));
}

.ap-pk-overlay {
  z-index: 30 !important;
}

.ap-pk-party-dock-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}

body.is-pk-mode .ap-pk-bar {
  position: relative;
  width: 100%;
  height: 22px !important;
  margin: 0 !important;
  background: #3b82f6;
  overflow: visible;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  border-radius: 0 !important;
}

body.is-pk-mode .ap-pk-bar::before {
  display: none !important;
}

.ap-pk-center-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: #1a1000;
  background: linear-gradient(135deg, #fde047, #f59e0b);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

body.is-pk-mode .ap-pk-timer-pill,
body.is-pk-mode #apPkTimer {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;
  margin: 0 !important;
}

body.is-pk-mode .ap-pk-status {
  position: static !important;
  left: auto !important;
  transform: none !important;
  bottom: auto !important;
  max-width: none;
  margin: 0;
  padding: 2px 10px 0;
  background: transparent;
  font-size: 11px;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
}

body.is-pk-mode .ap-pk-stop-btn {
  pointer-events: auto;
}

/* Chat + compose stay usable during PK — never crush layout or block taps */
body.is-pk-mode .live-room .live-overlay {
  z-index: 40 !important;
  pointer-events: none !important;
  overflow: hidden !important;
  /* Clear fixed bottom bar so messages never sit under "Say something" / gift */
  padding-bottom: calc(var(--ap-bottom-bar-h, 64px) + env(safe-area-inset-bottom, 0px) + 16px) !important;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.22) 0%,
    transparent 12%,
    transparent 48%,
    rgba(0, 0, 0, 0.18) 78%,
    rgba(0, 0, 0, 0.35) 100%
  ) !important;
}

body.is-pk-mode .live-room .live-overlay > * {
  pointer-events: none;
}

/* Only interactive chat chrome receives taps inside the overlay */
body.is-pk-mode .live-room .live-overlay .party-header,
body.is-pk-mode .live-room .live-overlay .party-header-right,
body.is-pk-mode .live-room .live-overlay .party-host,
body.is-pk-mode .live-room .live-overlay .party-close,
body.is-pk-mode .live-room .live-overlay .party-minimize-btn,
body.is-pk-mode .live-room .live-overlay .party-follow-btn,
body.is-pk-mode .live-room .live-overlay .party-users-btn,
body.is-pk-mode .live-room .live-overlay .party-event-pill,
body.is-pk-mode .live-room .live-overlay .party-chat-controls,
body.is-pk-mode .live-room .live-overlay .party-chat-zone,
body.is-pk-mode .live-room .live-overlay .party-chat-feed,
body.is-pk-mode .live-room .live-overlay .party-chat-msg,
body.is-pk-mode .live-room .live-overlay .party-chat-hide-btn,
body.is-pk-mode .live-room .live-overlay .party-chat-tabs,
body.is-pk-mode .live-room .live-overlay .party-chat-tabs button,
body.is-pk-mode .live-room .live-overlay .live-show-chat-fab {
  pointer-events: auto !important;
}

/* Spacer fills remaining room; can shrink so chat never overflows into bottom bar */
body.is-pk-mode .live-spacer {
  flex: 1 1 0% !important;
  min-height: min(var(--pk-arena-h) + var(--pk-party-dock-h) + 4px, 42vh) !important;
  height: auto !important;
  max-height: none !important;
  pointer-events: none !important;
}

/* Chat stays ABOVE bottom bar (layout + z-index), not under gift/compose */
body.is-pk-mode .party-chat-row,
body.is-pk-mode #partyChatRow {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  flex: 0 1 auto !important;
  flex-shrink: 1 !important;
  min-height: 100px !important;
  max-height: min(28vh, 220px) !important;
  height: auto !important;
  margin: 0 8px 0 !important;
  padding-bottom: 0 !important;
  position: relative !important;
  z-index: 25 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

body.is-pk-mode .party-chat-zone,
body.is-pk-mode #partyChatZone {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: min(28vh, 220px) !important;
  overflow: hidden !important;
  pointer-events: auto !important;
}

/* CRITICAL: keep flex column — display:block broke message bubbles & scroll */
body.is-pk-mode .party-chat-feed,
body.is-pk-mode #partyChatFeed {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  visibility: visible !important;
  opacity: 1 !important;
  flex: 1 1 auto !important;
  min-height: 80px !important;
  height: min(24vh, 200px) !important;
  max-height: min(24vh, 200px) !important;
  overflow-x: hidden !important;
  overflow-y: scroll !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  pointer-events: auto !important;
  gap: 6px !important;
  padding: 4px 10px 12px 0 !important;
}

body.is-pk-mode .party-chat-feed::before {
  content: '' !important;
  flex: 1 1 0 !important;
  min-height: 0 !important;
  pointer-events: none !important;
  display: block !important;
}

body.is-pk-mode .party-chat-msg {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  flex: 0 0 auto !important;
  height: auto !important;
  max-width: 92% !important;
  color: #f8fafc !important;
  pointer-events: auto !important;
}

/* Bottom bar: gift always visible to the RIGHT of compose — never stacked over/under it */
body.is-pk-mode #partyBottomBar,
body.is-pk-mode .party-bottom-bar {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 14000 !important;
  pointer-events: auto !important;
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
  overflow: visible !important;
  gap: 8px !important;
  isolation: isolate !important;
}

body.is-pk-mode #partyBottomBar > *,
body.is-pk-mode .party-bottom-bar > * {
  pointer-events: auto !important;
}

/* Compose shrinks; gift/tools never get covered */
body.is-pk-mode .live-chat-compose,
body.is-pk-mode #liveChatCompose,
body.is-pk-mode .live-chat-compose.ap-compose-inline {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  position: relative !important;
  z-index: 1 !important;
  flex: 1 1 0% !important;
  flex-shrink: 1 !important;
  min-width: 0 !important;
  max-width: none !important;
  overflow: hidden !important;
}

body.is-pk-mode .party-bottom-actions {
  display: flex !important;
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  gap: 6px !important;
  position: relative !important;
  z-index: 5 !important;
  pointer-events: auto !important;
  margin-left: 0 !important;
}

body.is-pk-mode #liveBtnGift,
body.is-pk-mode .party-btn-gift,
body.is-pk-mode .ap-btn-gift-hero {
  pointer-events: auto !important;
  z-index: 6 !important;
  position: relative !important;
  opacity: 1 !important;
  visibility: visible !important;
  flex-shrink: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 46px !important;
  height: 46px !important;
  min-width: 46px !important;
  padding: 0 !important;
}

body.is-pk-mode #liveBtnGift i,
body.is-pk-mode .party-btn-gift i {
  line-height: 1 !important;
  margin: 0 !important;
  display: block !important;
}

body.is-pk-mode #partyBtnTools,
body.is-pk-mode #liveBtnMic {
  pointer-events: auto !important;
  z-index: 5 !important;
  position: relative !important;
  flex-shrink: 0 !important;
  display: flex !important;
}

body.is-pk-mode .live-chat-compose input,
body.is-pk-mode #liveChatInput {
  pointer-events: auto !important;
  color: #fff !important;
  background: rgba(255, 255, 255, 0.14) !important;
  -webkit-user-select: text !important;
  user-select: text !important;
  min-width: 0 !important;
}

body.is-pk-mode .live-chat-compose button,
body.is-pk-mode #liveChatSend,
body.is-pk-mode #apChatEmojiBtn {
  pointer-events: auto !important;
  flex-shrink: 0 !important;
}

/* PK labels/dock stay under chat + bottom bar so typing is never blocked */
body.is-pk-mode .ap-pk-overlay {
  z-index: 18 !important;
  pointer-events: none !important;
}

body.is-pk-mode .ap-pk-score-wrap,
body.is-pk-mode .ap-pk-party-dock {
  z-index: 20 !important;
  pointer-events: none !important;
}

body.is-pk-mode .ap-pk-stop-btn {
  pointer-events: auto !important;
  z-index: 21 !important;
}

body.is-pk-mode .ap-pk-rival-media {
  z-index: 6 !important;
  pointer-events: none !important;
}

body.is-pk-mode .party-chat-msg.is-pk-home {
  border-left: 3px solid #ec4899 !important;
  background: rgba(236, 72, 153, 0.14) !important;
}

body.is-pk-mode .party-chat-msg.is-pk-away {
  border-left: 3px solid #3b82f6 !important;
  background: rgba(59, 130, 246, 0.14) !important;
}

body.is-pk-mode .party-chat-pk-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 4px;
  vertical-align: middle;
}

body.is-pk-mode .party-chat-pk-tag.home {
  color: #fce7f3;
  background: rgba(236, 72, 153, 0.55);
}

body.is-pk-mode .party-chat-pk-tag.away {
  color: #dbeafe;
  background: rgba(59, 130, 246, 0.55);
}

.ap-pk-winner-overlay.draw .ap-pk-winner-text {
  background: linear-gradient(90deg, #94a3b8, #e2e8f0);
  -webkit-background-clip: text;
  background-clip: text;
}

.ap-pk-bar {
  position: relative;
  width: 100%;
  height: 18px;
  margin: 0;
  background: #3b82f6;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.ap-pk-bar-left {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 50%;
  background: linear-gradient(90deg, #ec4899, #f472b6);
  transition: width 0.35s ease;
  z-index: 1;
}

.ap-pk-score {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  z-index: 3;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  font-variant-numeric: tabular-nums;
}

.ap-pk-score-l {
  left: 10px;
}

.ap-pk-score-r {
  right: 10px;
}

.ap-pk-timer-pill,
#apPkTimer.ap-pk-timer-pill,
#apPkTimer {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  z-index: 15;
  min-width: 72px;
  text-align: center;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.ap-pk-stage {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--pk-arena-top, calc(78px + env(safe-area-inset-top, 0px)));
  height: var(--pk-arena-h, min(40vh, 340px));
  bottom: auto;
  z-index: 8;
  display: flex;
  pointer-events: none;
}

.ap-pk-side {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 6px 12px;
  gap: 4px;
  min-width: 0;
}

.ap-pk-side-topline {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.ap-pk-win {
  font-size: 11px;
  font-weight: 800;
  color: #fde68a;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 8px;
  border-radius: 999px;
}

.ap-pk-rank-chip {
  font-size: 10px;
  font-weight: 700;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 2px 8px;
  border-radius: 999px;
}

.ap-pk-emblem {
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
  margin-bottom: 2px;
}

.ap-pk-side-name {
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.75);
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 10px;
  border-radius: 999px;
}

/* Soft center seam — not a hard cut through the face */
.ap-pk-bolt {
  position: absolute;
  left: 50%;
  top: 10%;
  bottom: 10%;
  width: 22px;
  margin-left: -11px;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.ap-pk-bolt::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(56, 189, 248, 0.8) 18%,
    rgba(167, 139, 250, 0.9) 50%,
    rgba(56, 189, 248, 0.8) 82%,
    transparent 100%
  );
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.ap-pk-bolt-icon {
  position: relative;
  z-index: 2;
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.9));
}

.ap-pk-friend-chip {
  position: relative;
}

.ap-pk-friend-chip.is-live {
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.7);
}

.ap-pk-friend-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 8px;
  font-weight: 800;
  font-style: normal;
  letter-spacing: 0.04em;
  padding: 1px 4px;
  border-radius: 4px;
  background: #ef4444;
  color: #fff;
}

.ap-pk-friend-chip:not(.is-live) .ap-pk-friend-badge {
  background: rgba(15, 23, 42, 0.75);
}

.ap-pk-challenge-sheet {
  position: fixed;
  inset: 0;
  z-index: 17000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}

.ap-pk-challenge-sheet.open {
  display: flex !important;
}

.ap-pk-challenge-panel {
  width: min(360px, 100%);
  border-radius: 18px;
  padding: 18px 16px 14px;
  background: linear-gradient(165deg, #1e293b, #0f172a);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.ap-pk-challenge-panel h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 800;
}

.ap-pk-challenge-panel p {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.78);
}

.ap-pk-challenge-actions {
  display: flex;
  gap: 10px;
}

.ap-pk-challenge-decline,
.ap-pk-challenge-accept {
  flex: 1;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.ap-pk-challenge-decline {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.ap-pk-challenge-accept {
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff;
}

.ap-pk-friend-pick-title {
  margin: 0 0 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
}

.ap-pk-friend-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 140px;
  overflow: auto;
}

.ap-pk-friend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px 6px 6px;
  font-size: 12px;
  cursor: pointer;
}

.ap-pk-friend-chip img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.ap-pk-friend-chip.is-selected {
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.18);
}

.ap-pk-friend-empty {
  margin: 6px 0 0;
  font-size: 12px;
  color: #fbbf24;
  line-height: 1.35;
}

@keyframes ap-pk-bolt-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

.ap-pk-waiting {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(160deg, rgba(30, 27, 75, 0.72) 0%, rgba(15, 23, 42, 0.78) 55%, rgba(17, 24, 39, 0.8) 100%);
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  padding: 12px;
}

.ap-pk-rival-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(251, 191, 36, 0.85);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  background: #1e293b;
}

.ap-pk-rival-avatar[hidden] {
  display: none !important;
}

.ap-pk-match-cancel {
  pointer-events: auto;
  margin-top: 14px;
  min-height: 36px;
  padding: 8px 20px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.ap-pk-match-cancel:active {
  transform: scale(0.97);
}

.ap-pk-waiting[hidden] {
  display: none !important;
}

.ap-pk-waiting-ring {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #f472b6;
  border-right-color: #38bdf8;
  animation: ap-pk-radar-spin 1s linear infinite;
}

.ap-pk-status {
  position: static;
  left: auto;
  transform: none;
  bottom: auto;
  margin: 0;
  max-width: none;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  line-height: 1.35;
  pointer-events: none;
  z-index: 12;
  background: transparent;
  padding: 2px 10px 0;
  border-radius: 0;
}

/* Highlight tools PK control while in battle */
body.is-pk-mode #liveBtnPk .ico,
body.is-pk-mode #liveBtnPk {
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.85);
}

body.is-pk-mode #liveBtnPk.is-pk-stop .ico {
  background: linear-gradient(135deg, #dc2626, #ea580c);
}

/* Host Stop PK — sits under timer (pointer-events on; rest of overlay is none) */
.ap-pk-stop-btn {
  pointer-events: auto;
  margin-top: 2px;
  min-height: 32px;
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #ea580c);
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.4);
  cursor: pointer;
  z-index: 16;
  -webkit-tap-highlight-color: transparent;
}

.ap-pk-stop-btn[hidden] {
  display: none !important;
}

.ap-pk-stop-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.ap-pk-stop-btn:not([hidden]):active {
  transform: scale(0.97);
}

body:not(.ap-pk-can-end) .ap-pk-stop-btn {
  display: none !important;
}

body.ap-pk-can-end .ap-pk-stop-btn:not([hidden]) {
  display: inline-flex !important;
}

/* Once PK is live, hard-hide the types sheet even if a class is stuck */
body.is-pk-mode #apPkTypesSheet,
body.is-pk-mode .ap-pk-types-sheet {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* —— Room PK sheet (reference design) —— */
.ap-pk-types-sheet.ap-pk-room-sheet,
.ap-pk-types-sheet {
  position: fixed;
  inset: 0;
  z-index: 33000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
  padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
}

.ap-pk-types-sheet.open {
  display: flex !important;
  pointer-events: auto !important;
}

.ap-pk-room-panel.ap-pk-types-panel,
.ap-pk-types-panel.ap-pk-room-panel {
  width: min(100%, 440px);
  max-height: min(78dvh, 640px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(180deg, #2a2d3a 0%, #1a1c26 55%, #12141c 100%);
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0));
  color: #fff;
  position: relative;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

.ap-pk-room-panel .ap-pk-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.ap-pk-room-panel .ap-pk-view[hidden] {
  display: none !important;
}

.ap-pk-logo {
  display: inline-flex;
  align-items: baseline;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -0.06em;
  line-height: 1;
}

.ap-pk-logo b {
  color: #ff5ea8;
  font-style: normal;
}

.ap-pk-logo i {
  color: #6ec8ff;
  font-style: normal;
  font-weight: 900;
}

.ap-pk-room-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 22px;
}

.ap-pk-room-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ap-pk-room-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.ap-pk-room-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ap-pk-invitation-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
}

.ap-pk-invitation-btn .fas {
  display: none;
}

.ap-pk-swords {
  font-size: 14px;
  line-height: 1;
}

.ap-pk-help-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ap-pk-time-block {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.ap-pk-time-label {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  min-width: 36px;
}

.ap-pk-time-options {
  display: flex;
  flex: 1;
  gap: 10px;
}

.ap-pk-time-chip {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ap-pk-time-chip.is-selected {
  background: linear-gradient(90deg, #ff4fa3, #7b5cff);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 79, 163, 0.35);
}

.ap-pk-type-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.ap-pk-type-card {
  position: relative;
  border: 2px solid transparent;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  padding: 12px 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ap-pk-type-card.is-selected {
  border-color: #ff4fa3;
  background: rgba(255, 79, 163, 0.14);
  box-shadow: 0 0 0 1px rgba(255, 79, 163, 0.3);
}

.ap-pk-type-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.75);
}

.ap-pk-type-new {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 9px;
  font-weight: 800;
  color: #fbbf24;
}

.ap-pk-type-art {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-top: 8px;
}

.ap-pk-type-art--friend {
  background: linear-gradient(145deg, #fbbf24, #d97706);
}

.ap-pk-type-art--random {
  background: linear-gradient(145deg, #fb7185, #db2777);
}

.ap-pk-type-art--team {
  background: linear-gradient(145deg, #60a5fa, #2563eb);
}

.ap-pk-type-name {
  font-size: 12px;
  font-weight: 600;
}

.ap-pk-friend-pick {
  margin: 0 0 12px;
  max-height: min(28vh, 200px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ap-pk-friend-pick[hidden] {
  display: none !important;
}

.ap-pk-friend-pick-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
}

.ap-pk-friend-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow-y: auto;
  max-height: min(22vh, 160px);
  -webkit-overflow-scrolling: touch;
}

.ap-pk-friend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  padding: 5px 10px 5px 5px;
  cursor: pointer;
  font-size: 12px;
}

.ap-pk-friend-chip.is-selected {
  border-color: #ff4fa3;
  background: rgba(255, 79, 163, 0.18);
}

.ap-pk-friend-chip.is-live {
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.45);
}

.ap-pk-friend-chip img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.ap-pk-friend-badge {
  font-style: normal;
  font-size: 9px;
  font-weight: 800;
  color: #fda4af;
  text-transform: uppercase;
}

.ap-pk-friend-empty,
.ap-pk-friend-loading {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  margin: 0;
}

.ap-pk-confirm-btn {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, #ff4fa3, #6b7bff);
  box-shadow: 0 8px 24px rgba(107, 123, 255, 0.3);
  cursor: pointer;
  margin-top: 4px;
}

.ap-pk-confirm-btn[hidden] {
  display: none !important;
}

.ap-pk-confirm-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.ap-pk-room-cta[hidden] {
  display: none !important;
}

.ap-pk-room-cta {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 12px;
  margin-top: 4px;
  margin-bottom: 8px;
}

.ap-pk-random-btn {
  border: none;
  border-radius: 999px;
  min-height: 52px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #fff;
  background: linear-gradient(90deg, #ff4fa3 0%, #6b7bff 100%);
  box-shadow: 0 8px 22px rgba(107, 123, 255, 0.35);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ap-pk-random-title {
  font-size: 15px;
  font-weight: 800;
}

.ap-pk-random-sub {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.9;
}

.ap-pk-invite-room-btn {
  border: none;
  border-radius: 999px;
  min-height: 52px;
  padding: 12px 10px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: #3d2f66;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ap-pk-invite-room-btn:active,
.ap-pk-random-btn:active {
  transform: scale(0.98);
}

/* Invite a room */
.ap-pk-invite-head {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  margin-bottom: 14px;
}

.ap-pk-invite-head h3 {
  margin: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
}

.ap-pk-invite-back {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ap-pk-invite-head-spacer {
  width: 36px;
  height: 36px;
}

.ap-pk-room-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  margin-bottom: 12px;
}

.ap-pk-room-search i {
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
}

.ap-pk-room-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: #fff;
  font-size: 14px;
}

.ap-pk-room-search input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.ap-pk-room-invite-list {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: min(48vh, 360px);
  padding-bottom: 8px;
}

.ap-pk-room-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
}

.ap-pk-room-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  background: #333;
  flex-shrink: 0;
}

.ap-pk-room-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ap-pk-room-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-pk-room-viewers {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ap-pk-room-invite-cta {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #5b3fcc;
  cursor: pointer;
  flex-shrink: 0;
}

.ap-pk-room-invite-empty,
.ap-pk-room-invite-loading {
  text-align: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  padding: 24px 8px;
}

/* Matching circle */
.ap-pk-match-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ap-pk-match-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
}

.ap-pk-match-dur {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
}

.ap-pk-match-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 8px;
  gap: 16px;
}

.ap-pk-match-circle {
  position: relative;
  width: 168px;
  height: 168px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ap-pk-match-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ap-pk-match-ring-bg {
  stroke: rgba(255, 255, 255, 0.1);
}

.ap-pk-match-ring-fg {
  stroke: url(#none);
  stroke: #6b7bff;
  stroke: url(#apPkRingGrad);
  /* solid fallback + CSS gradient via stroke */
  stroke: #a855f7;
  filter: drop-shadow(0 0 6px rgba(168, 85, 247, 0.45));
  transition: stroke-dashoffset 0.9s linear;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
}

.ap-pk-match-circle::before {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba, rgba);
  pointer-events: none;
}

.ap-pk-match-secs {
  position: relative;
  z-index: 1;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, #60a5fa, #f472b6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ap-pk-match-hint {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  min-height: 1.2em;
}

.ap-pk-match-cancel {
  width: min(100%, 280px);
  border: none;
  border-radius: 999px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
}

/* legacy score styles superseded by .ap-pk-score-wrap block above */

.ap-chat-panel,
.ap-region-tabs,
.ap-quick-chips,
.ap-chat-panel-head,
.ap-chat-dismiss-btn {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  height: 0 !important;
  overflow: hidden !important;
}

.ap-chat-panel {
  display: none;
  flex-direction: column;
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--ap-bottom-bar-h) + env(safe-area-inset-bottom, 0));
  z-index: 44;
  max-height: min(32vh, 200px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: rgba(0, 0, 0, 0.94);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}

.ap-chat-panel.is-open {
  display: flex;
}

.ap-chat-panel .ap-region-tabs,
.ap-chat-panel .ap-quick-chips {
  display: none;
}

.ap-chat-panel.is-open .ap-region-tabs,
.ap-chat-panel.is-open .ap-quick-chips {
  display: flex;
}

.ap-quick-chips {
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px 4px;
  flex-shrink: 0;
  z-index: 14;
  max-height: 120px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ap-chip.is-follow-done {
  background: rgba(34, 197, 94, 0.25);
  border-color: #22c55e;
  color: #bbf7d0;
}

.ap-char-count {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.45);
  min-width: 14px;
  text-align: center;
  flex-shrink: 0;
}

.ap-char-count:empty,
.ap-char-count.is-empty {
  display: none;
  width: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
}

.live-chat-compose {
  position: relative;
}

.ap-compose-inline {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 4px 6px 4px 4px;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.ap-compose-inline input {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 999px;
  padding: 8px 10px;
  background: transparent;
  color: #fff;
  font-size: 14px;
}

.ap-compose-inline input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.ap-compose-inline .ap-chat-emoji-btn {
  width: 32px;
  height: 32px;
  color: rgba(255, 255, 255, 0.75);
}

.ap-compose-inline .ap-chat-photo-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.party-chat-media {
  margin-top: 4px;
}

.party-chat-image {
  display: block;
  max-width: min(180px, 100%);
  max-height: 140px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ap-compose-inline .ap-chat-send-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1a1000;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ap-compose-inline .ap-char-count {
  display: none !important;
}

.ap-chat-panel .live-chat-compose {
  display: none !important;
}

body[data-live-page="party-room"] .ap-guest-rail {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body[data-live-page="party-room"] .ap-guest-rail:not(:empty) {
  display: none !important;
}

.party-tools-panel-ref .ico.wish {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.ap-btn-grid {
  background: rgba(0, 0, 0, 0.45) !important;
  border-radius: 50% !important;
}

.ap-btn-backpack {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  border: none !important;
  background: rgba(14, 165, 233, 0.85) !important;
  color: #fff !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 16px !important;
  flex-shrink: 0;
  cursor: pointer;
}

.ap-bottom-ref .party-btn-gift.ap-btn-gift-hero {
  background: #fff !important;
  color: #ec4899 !important;
}

.ap-chip-more {
  background: rgba(255, 255, 255, 0.55) !important;
}

.ap-chip {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.92);
  color: #1a1a1a;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}


.ap-region-tabs {
  gap: 8px;
  padding: 8px 10px 0;
  flex-shrink: 0;
}

.ap-region-tabs button {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 8px 6px;
  background: rgba(255, 255, 255, 0.18);
  color: #e2e8f0;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.ap-region-tabs button.active {
  background: linear-gradient(90deg, #f59e0b, #ea580c);
  color: #fff;
}

.ap-guest-rail {
  position: absolute;
  right: 8px;
  bottom: 32%;
  z-index: 45;
  display: none;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  pointer-events: auto;
}

.ap-guest-wrap {
  position: relative;
  width: 64px;
  max-width: 72px;
  pointer-events: auto;
  z-index: 2;
  overflow: visible;
}

.ap-guest-seat {
  border: none;
  background: none;
  padding: 0;
  position: relative;
  cursor: pointer;
  text-align: center;
  width: 64px;
  max-width: 72px;
  pointer-events: auto;
  touch-action: manipulation;
  overflow: visible;
}

.ap-guest-avatar {
  position: relative;
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #4c1d95, #831843);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-sizing: border-box;
  line-height: 0;
  flex-shrink: 0;
}

.ap-guest-seat img,
.ap-guest-avatar img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 50%;
  border: none !important;
  object-fit: cover !important;
  object-position: center center !important;
  display: block;
  z-index: 1;
}

.ap-guest-gift {
  position: absolute;
  top: -2px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
  background: #ec4899;
  color: #fff;
  padding: 2px 6px;
  border-radius: 8px;
  pointer-events: none;
  z-index: 6;
  white-space: nowrap;
  min-width: 16px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  overflow: visible;
}

.ap-guest-name {
  display: block;
  font-size: 9px;
  color: #fff;
  margin-top: 2px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
}

@keyframes ap-emoji-float-up {
  0% {
    opacity: 0;
    transform: translate(-50%, 50%) scale(0.5);
  }

  12% {
    opacity: 1;
    transform: translate(calc(-50% + var(--drift-x, 0px) * 0.15), calc(50% - var(--rise, 24px) * 0.15)) scale(1.15);
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift-x, 0px)), calc(50% - var(--rise, 32px))) scale(1.25);
  }
}

.ap-seat-emoji-float {
  position: absolute;
  left: 50%;
  bottom: 50%;
  font-size: 22px;
  line-height: 1;
  pointer-events: none;
  z-index: 40;
  animation: ap-emoji-float-up 2.2s ease-out forwards;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

.seat-avatar,
.ap-guest-seat {
  overflow: visible;
}

.ap-guest-seat {
  position: relative;
}

.ap-guest-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 12;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #ef4444;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  pointer-events: auto !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

.ap-guest-remove:active {
  transform: scale(0.94);
}

.seat-avatar {
  overflow: hidden;
}

.party-host {
  overflow: hidden;
}

.party-viewer-count.live-joined-count {
  font-size: 11px;
  padding: 5px 11px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  pointer-events: auto !important;
  cursor: pointer;
  touch-action: manipulation;
  color: #fff;
  border: none;
  overflow: visible;
  flex-shrink: 0 !important;
  min-width: fit-content;
}

.ap-bottom-ref {
  justify-content: space-between;
  gap: 8px;
}

.ap-bottom-ref .party-bottom-actions {
  margin-left: 0;
  flex-shrink: 0;
  gap: 6px;
}

.ap-bottom-ref .party-bottom-actions button {
  width: 38px;
  height: 38px;
  font-size: 16px;
}

.ap-bottom-ref .party-btn-gift {
  width: 44px !important;
  height: 44px !important;
  font-size: 18px !important;
}

.ap-bottom-ref .party-btn-follow {
  padding: 8px 12px !important;
  font-size: 11px !important;
  flex-shrink: 0;
}

.ap-btn-chat-bubble {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.ap-btn-follow-compact {
  padding: 8px 14px !important;
  font-size: 12px !important;
}

.ap-btn-grid {
  position: relative;
}

.ap-notify-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  border: 1px solid #fff;
}

.live-chat-compose:not(.ap-compose-inline) #liveChatSend {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
  color: #1a1000 !important;
  border: none;
  font-size: 16px;
  flex-shrink: 0;
}

.live-chat-compose:not(.ap-compose-inline) input {
  background: rgba(255, 255, 255, 0.95) !important;
  color: #1a1a1a !important;
}

.live-chat-compose:not(.ap-compose-inline) input::placeholder {
  color: #9ca3af !important;
}

/* Tools sheet — reference layout */
.party-tools-panel-ref {
  max-height: 72vh;
  background: rgba(12, 8, 24, 0.94) !important;
  backdrop-filter: blur(12px);
}

.party-tools-title {
  font-size: 14px !important;
  color: #fff !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  margin: 0 0 12px !important;
  font-weight: 700;
}

.party-tools-grid-4 {
  grid-template-columns: repeat(4, 1fr) !important;
}

.party-tools-row2 {
  margin-bottom: 16px;
}

.party-tools-panel-ref .ico {
  width: 52px !important;
  height: 52px !important;
  border-radius: 50% !important;
  position: relative;
}

.party-tools-panel-ref .ico.msg {
  background: #3b82f6;
}

.party-tools-panel-ref .ico.sound {
  background: #6366f1;
}

.party-tools-panel-ref .ico.share {
  background: #22c55e;
}

.party-tools-panel-ref .ico.report {
  background: #ef4444;
}

.party-tools-panel-ref .ico.effects {
  background: #8b5cf6;
}

.party-tools-panel-ref .ico.minimize {
  background: #6366f1;
}

.party-tools-panel-ref .ico.coins {
  background: linear-gradient(135deg, #fbbf24, #d97706);
}

.party-tools-panel-ref .ico.store {
  background: #ef4444;
}

.party-tools-panel-ref .ico.vip {
  background: #a855f7;
}

.party-tools-panel-ref .ico.guardian {
  background: #3b82f6;
}

.party-tools-panel-ref .ico.backpack {
  background: #0ea5e9;
}

.party-tools-panel-ref .ico.gallery {
  background: #ec4899;
}

.party-tools-panel-ref .ico.collection {
  background: #f472b6;
}

.party-tools-panel-ref .ico.close {
  background: #6b7280;
}

.party-tools-panel-ref a,
.party-tools-panel-ref button {
  font-size: 11px !important;
  color: #f1f5f9 !important;
}

.ap-tool-msg .ap-notify-dot {
  top: 0;
  right: 0;
}

/* Gift sheet — reference */
.gift-sheet-panel .gift-grid {
  flex: 1;
  overflow-y: auto;
  min-height: 100px;
  -webkit-overflow-scrolling: touch;
}

.gift-sheet-panel .gift-qty-row {
  flex-shrink: 0;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
}

.gift-sheet-tabs button.active {
  background: transparent !important;
  color: #fbbf24 !important;
  border-bottom: 2px solid #fbbf24;
  border-radius: 0 !important;
}

.gift-sheet-tabs {
  flex-shrink: 0;
}

.gift-sheet-tabs button[data-cat] {
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  border-radius: 0;
  padding: 8px 10px;
  white-space: nowrap;
}

.gift-recipients {
  flex-shrink: 0;
}

.gift-tab-bell {
  margin-left: auto;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.6) !important;
}

.gift-xp-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 6px 0 8px;
  font-size: 10px;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 6px;
  flex-shrink: 0;
}

.gift-xp-lvl {
  color: #4ade80;
  font-weight: 800;
  flex-shrink: 0;
}

.gift-xp-text {
  flex: 1 1 120px;
  min-width: 0;
}

.gift-surprise-btn {
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: rgba(0, 0, 0, 0.4);
  color: #fbbf24;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.gift-balance-btn {
  border: none;
  background: none;
  color: #fbbf24;
  font-size: 13px;
  font-weight: 800;
  padding: 4px 0 8px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  flex-shrink: 0;
}

.gift-grid button {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 2px solid transparent;
  min-height: 96px;
}

.gift-grid button.is-selected {
  border-color: #fff !important;
  outline: none;
  background: rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.25);
}

.gift-grid small,
.gift-grid .gift-coin-cost {
  color: #fbbf24 !important;
}

.gift-send-btn {
  min-width: 100px;
  max-width: 58%;
  padding: 12px 14px !important;
  background: #fbbf24 !important;
  color: #1a1000 !important;
  font-size: 13px !important;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: auto !important;
  touch-action: manipulation;
  z-index: 2;
  position: relative;
  -webkit-tap-highlight-color: rgba(251, 191, 36, 0.35);
}

.gift-send-btn.is-sending {
  opacity: 0.85;
  cursor: wait;
}

.gift-send-error {
  display: none;
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(185, 28, 28, 0.35);
  color: #fecaca;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
}

.gift-send-error.is-visible {
  display: block;
}

.gift-qty-row {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.gift-qty-btns button {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border-radius: 999px !important;
  padding: 8px 16px !important;
}

.gift-qty-btns button.active {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #fff !important;
}

/* Mic link modal — never demote bottom bar under FX layer */
body.ap-live-overlay-open:not(.party-requests-open) .party-bottom-bar {
  z-index: 14000 !important;
  pointer-events: auto !important;
}

body.ap-live-overlay-open .party-chat-row {
  opacity: 0.85;
}

.ap-miclink-modal {
  max-width: 320px;
  width: 90%;
  text-align: center;
  margin: auto;
}

.ap-miclink-head {
  background: rgba(30, 30, 35, 0.95);
  color: #fff;
  padding: 12px;
  border-radius: 12px 12px 0 0;
  font-size: 13px;
  font-weight: 700;
}

.ap-miclink-body {
  background: #fff;
  color: #374151;
  padding: 20px 16px;
  border-radius: 0 0 12px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.ap-miclink-body p {
  margin: 0 0 14px;
}

.ap-miclink-primary {
  width: 100%;
  border: none;
  padding: 12px;
  border-radius: 999px;
  background: #e5a356;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}

.ap-miclink-cancel {
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  margin-top: 12px;
  cursor: pointer;
}

.ap-miclink-rejected p {
  font-size: 15px;
  color: #1a1a1a;
}

.ap-host-mic-invite-overlay {
  z-index: 12500;
  align-items: flex-start;
  justify-content: center;
  padding-top: max(12vh, calc(env(safe-area-inset-top, 0px) + 72px));
  /* Let taps reach gift / bottom bar — only the dialog itself captures clicks */
  background: transparent;
  pointer-events: none !important;
}

.ap-host-mic-invite-overlay.open .ap-host-mic-invite {
  pointer-events: auto !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.ap-host-mic-invite-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ap-host-mic-invite-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #e5a356;
  margin: 4px 0 10px;
  background: #f3f4f6;
}

.ap-host-mic-invite-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

.ap-host-mic-invite-actions .ap-host-mic-deny {
  flex: 1;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  font-weight: 800;
  font-size: 14px;
  padding: 12px;
  border-radius: 999px;
  cursor: pointer;
}

.ap-host-mic-invite-actions .ap-host-mic-agree {
  flex: 1.2;
  margin: 0;
}

/* Top-up sheet */
.ap-topup-sheet {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.ap-topup-sheet.open {
  display: flex;
}

.ap-topup-panel {
  width: 100%;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0));
  max-height: min(88dvh, 640px);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  color: #1a1a1a;
}

body.ap-keyboard-open .ap-topup-panel {
  max-height: calc(100dvh - var(--ap-kb-offset, 0px) - 16px);
  padding-bottom: calc(16px + var(--ap-kb-offset, 0px));
}

.ap-topup-recharge#apTopupSubmit {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 12px;
}

.ap-topup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ap-topup-head h2 {
  margin: 0;
  font-size: 18px;
}

.ap-topup-head button {
  border: none;
  background: none;
  font-size: 20px;
  color: #9ca3af;
  cursor: pointer;
}

.ap-topup-balance {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px;
}

.ap-topup-banner {
  background: linear-gradient(135deg, #1e3a8a, #312e81);
  color: #fff;
  padding: 12px;
  border-radius: 10px;
  font-size: 12px;
  margin-bottom: 12px;
}

.ap-topup-pay {
  width: 100%;
  border: 2px solid #fbbf24;
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
  cursor: pointer;
  font-weight: 700;
}

.ap-topup-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.ap-topup-pack {
  border: none;
  background: #f5f5f5;
  border-radius: 10px;
  padding: 12px 8px;
  cursor: pointer;
  text-align: center;
}

.ap-topup-pack.is-selected {
  background: #fff;
  border: 2px solid #fbbf24;
}

.ap-topup-pack strong {
  display: block;
  font-size: 13px;
  color: #1a1a1a;
}

.ap-topup-pack span {
  font-size: 11px;
  color: #6b7280;
}

.ap-topup-recharge {
  width: 100%;
  border: none;
  padding: 14px;
  border-radius: 999px;
  background: #ffd580;
  color: #1a1a1a;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  margin-bottom: 10px;
}

.ap-topup-agree {
  font-size: 11px;
  color: #b45309;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.ap-topup-agree a {
  color: #b45309;
}

.ap-topup-proof {
  border: 2px dashed rgba(201, 162, 39, 0.45);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  background: #fffdf8;
}

.ap-topup-proof.has-file {
  border-style: solid;
  border-color: #86efac;
  background: #f0fdf4;
}

.ap-topup-proof .rc-proof-placeholder .icon {
  font-size: 28px;
  color: #d97706;
  margin-bottom: 6px;
}

.ap-topup-proof .rc-proof-preview-wrap:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ap-topup-proof .rc-proof-preview-wrap[hidden],
.ap-topup-proof .rc-proof-placeholder[hidden] {
  display: none !important;
}

.ap-topup-proof .rc-proof-preview-wrap img {
  max-width: 100%;
  max-height: 120px;
  border-radius: 10px;
  object-fit: contain;
}

.ap-topup-proof .rc-proof-change {
  border: none;
  background: #fff;
  color: #b45309;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.rc-file-input-hidden {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

/* Surprise shop */
.ap-surprise-sheet {
  position: fixed;
  inset: 0;
  z-index: 56;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: stretch;
}

.ap-surprise-sheet.open {
  display: flex;
}

.ap-surprise-panel {
  width: 100%;
  background: #121218;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.ap-surprise-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}

.ap-surprise-head h2 {
  margin: 0;
  font-size: 20px;
  color: #fbbf24;
  font-family: Georgia, serif;
}

.ap-surprise-head button {
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
}

.ap-surprise-hero {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ap-surprise-card {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 3/4;
  border-radius: 16px;
  background: linear-gradient(180deg, #fce7f3, #fbcfe8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.ap-surprise-title {
  font-size: 18px;
  color: #b45309;
  font-weight: 800;
}

.ap-surprise-art {
  font-size: 64px;
}

.ap-surprise-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ap-surprise-foot strong {
  color: #fbbf24;
  display: block;
  margin-bottom: 4px;
}

.ap-surprise-foot p {
  margin: 0;
  font-size: 11px;
  color: #94a3b8;
}

.ap-surprise-foot em {
  color: #fbbf24;
  font-style: normal;
}

.ap-surprise-recharge {
  border: none;
  padding: 12px 24px;
  border-radius: 999px;
  background: #f5d1b0;
  color: #1a1a1a;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

body.ap-ref-ui .party-viewers {
  align-items: center;
}

body.ap-ref-ui .live-room .party-viewers span:not(.party-viewer-count):not(.ap-top-gifter):not(em) {
  display: none;
}

/* Solo video live: guest rail on right when guests are on stage */
body[data-live-page="live-room"] .ap-guest-rail {
  display: none;
}

body[data-live-page="live-room"].ap-has-live-guests .ap-guest-rail {
  display: flex !important;
  right: 10px;
  /* Keep clear of gift/tools/mic — rail used to grow into the action hit zone */
  bottom: calc(var(--ap-bottom-bar-h, 58px) + 96px + env(safe-area-inset-bottom, 0px));
  z-index: 45;
  pointer-events: none !important;
  max-height: min(36vh, 280px);
  overflow-x: hidden;
  overflow-y: auto;
  flex-direction: column-reverse;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

body[data-live-page="live-room"].ap-has-live-guests .ap-guest-rail .ap-guest-seat,
body[data-live-page="live-room"].ap-has-live-guests .ap-guest-rail .ap-guest-wrap {
  pointer-events: auto !important;
}

.ap-guest-wrap,
.ap-guest-seat {
  overflow: visible !important;
  max-width: 72px;
  position: relative;
}

.ap-guest-avatar,
.ap-guest-video {
  overflow: hidden !important;
  max-width: 72px;
}

.ap-guest-video video,
.ap-guest-video > div,
.ap-guest-video canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  pointer-events: none !important;
}

.ap-guest-seat.is-speaking .ap-guest-avatar {
  box-shadow: 0 0 0 2px #fbbf24, 0 0 16px rgba(251, 191, 36, 0.55);
  animation: seat-pulse 1.2s ease-in-out infinite;
}

.ap-guest-seat.is-muted .ap-guest-avatar {
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.9);
  opacity: 0.72;
  filter: grayscale(0.35);
}

.ap-guest-seat.is-muted.is-speaking .ap-guest-avatar {
  animation: none;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.9);
}

.ap-guest-mic-badge,
.ap-guest-status,
.ap-guest-remove {
  display: none !important;
}

.ap-guest-video {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  z-index: 1;
  background: #111;
}

.ap-guest-video video,
.ap-guest-video > div {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

.ap-guest-avatar:has(.ap-guest-video:not([hidden])) > img {
  opacity: 0;
}

body[data-live-page="live-room"]:not(.is-pk-mode) .live-room .live-local-video,
body[data-live-page="live-room"]:not(.is-pk-mode) .live-room .live-fallback-video {
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
}

body[data-live-page="live-room"]:not(.is-pk-mode) .live-room .live-local-video.is-host-only {
  z-index: 3;
}

/* Front-camera host preview only — selfie mirror. Back camera forced unflipped. */
body[data-live-page="live-room"] .live-local-host-mirror video {
  transform: scaleX(-1) !important;
}

body[data-live-page="live-room"] .live-local-video:not(.live-local-host-mirror) video,
body[data-live-page="live-room"] #liveLocalHost:not(.live-local-host-mirror) video,
body[data-live-page="live-room"] #liveLocalVideo {
  transform: none !important;
}

/* —— Reference bottom bar (Bigo-style) —— */
.ap-say-hi-pill {
  display: none !important;
}

.ap-btn-follow-hidden {
  display: none !important;
}

.ap-btn-mic-ring {
  position: relative;
  width: 42px !important;
  height: 42px !important;
  border-radius: 50% !important;
  border: 2px solid #fbbf24 !important;
  background: rgba(0, 0, 0, 0.45) !important;
  color: #fbbf24 !important;
}

.ap-btn-mic-ring.is-live,
.ap-btn-mic-ring.is-pending {
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.55);
  animation: ap-mic-pulse 1.2s ease-in-out infinite;
}

.ap-btn-mic-ring.is-muted {
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}

@keyframes ap-mic-pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.06);
  }
}

.ap-btn-gift-hero {
  position: relative;
  z-index: 14100 !important;
  width: 48px !important;
  height: 48px !important;
  border-radius: 50% !important;
  background: #fff !important;
  color: #ec4899 !important;
  box-shadow: 0 4px 18px rgba(236, 72, 153, 0.55) !important;
  overflow: visible !important;
  pointer-events: auto !important;
  touch-action: manipulation;
  isolation: isolate;
}

.ap-btn-gift-hero .ap-gift-glow {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.5), transparent 70%);
  animation: ap-gift-glow 1.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ap-gift-glow {

  0%,
  100% {
    opacity: 0.6;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

.ap-chat-emoji-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #6b7280;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
}

.ap-emoji-popover {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: calc(var(--ap-bottom-bar-h) + 8px + env(safe-area-inset-bottom, 0));
  z-index: 80;
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  background: rgba(18, 12, 32, 0.96);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  max-height: min(140px, 28vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ap-emoji-popover.is-open {
  display: flex;
}

.ap-emoji-popover button {
  border: none;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-size: 22px;
  width: 40px;
  height: 40px;
  cursor: pointer;
}

body.ap-keyboard-open .ap-chat-panel.is-open {
  bottom: calc(var(--ap-bottom-bar-h) + var(--ap-kb-offset, 0px) + env(safe-area-inset-bottom, 0));
}

body.ap-keyboard-open .party-bottom-bar {
  bottom: var(--ap-kb-offset, 0);
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

body.ap-keyboard-open .ap-emoji-popover.is-open {
  bottom: calc(var(--ap-bottom-bar-h) + var(--ap-kb-offset, 0px) + 8px + env(safe-area-inset-bottom, 0));
}

/* Expand chat history while composing / keyboard open — do not shrink */
body.ap-chat-open .party-chat-row,
body.ap-chat-open .live-room .party-chat-row,
body.ap-keyboard-open .party-chat-row,
body.ap-keyboard-open .live-room .party-chat-row {
  max-height: min(48vh, 420px) !important;
  min-height: 160px;
}

body.ap-chat-open .party-chat-zone,
body.ap-chat-open .party-chat-feed,
body.ap-keyboard-open .party-chat-zone,
body.ap-keyboard-open .party-chat-feed {
  max-height: min(48vh, 420px) !important;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-height: 680px) {
  .party-stats-bar {
    padding: 4px 8px;
    font-size: 9px;
  }

  .party-widgets {
    gap: 6px;
  }

  .party-widget {
    padding: 4px 8px;
    font-size: 9px;
  }

  .party-event-pill {
    display: flex;
    min-width: 68px;
    min-height: 42px;
    font-size: 9px;
    padding: 5px 6px;
  }

  .party-invite-row,
  .party-meta-row {
    padding-bottom: 6px;
  }

  .party-chat-row {
    max-height: min(32vh, 240px);
  }

  .party-chat-feed {
    max-height: min(32vh, 240px);
  }
}

@media (max-width: 380px) {
  .ap-bottom-ref .party-bottom-actions button {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .ap-bottom-ref .party-btn-gift {
    width: 38px !important;
    height: 38px !important;
  }

  .ap-compose-inline input {
    font-size: 13px;
    padding: 7px 8px;
  }
}

/* Expo / native WebView — RN container already insets below status bar */
html.ap-expo-app {
  --ap-expo-safe-top: 0px;
}

html.ap-expo-app .live-room .party-header,
html.ap-expo-app .party-room .party-header {
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
}

html.ap-expo-app .party-stats-bar {
  margin-top: 2px;
}

html.ap-expo-app .live-swipe-hint {
  top: 55%;
}

html.ap-expo-app .ap-emoji-popover button {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

html.ap-expo-app .gift-grid .g,
html.ap-expo-app .ap-chip {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.gift-rtp-banner {
  overflow: hidden;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 0;
  font-size: 10px;
  color: #fde68a;
  white-space: nowrap;
}

.gift-rtp-banner span {
  display: inline-block;
  padding-left: 100%;
  animation: gift-rtp-scroll 18s linear infinite;
}

@keyframes gift-rtp-scroll {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-100%);
  }
}

.gift-send-btn.is-disabled,
.gift-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  /* Keep clicks so we can show “not enough coins” instead of dead taps */
  pointer-events: auto;
}

.gift-grid button {
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(251, 191, 36, 0.25);
}

.gift-xp-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.gift-xp-row .gift-xp-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 8px;
}

.gift-xp-row .gift-xp-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #86efac);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.party-tools-panel-ref .ico.wish {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.ap-miclink-modal {
  background: #fff;
  border-radius: 16px;
  padding: 20px 16px 16px;
  max-width: 320px;
  width: 90%;
  margin: auto;
  color: #1a1a1a;
}

.ap-miclink-head {
  font-size: 17px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 12px;
}

.ap-miclink-body p {
  font-size: 13px;
  color: #6b7280;
  text-align: center;
  line-height: 1.45;
  margin: 0 0 16px;
}

.ap-miclink-primary {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 14px;
  background: linear-gradient(90deg, #f59e0b, #ea580c);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
}

.ap-miclink-cancel {
  width: 100%;
  border: none;
  background: none;
  color: #9ca3af;
  font-size: 13px;
  margin-top: 12px;
  cursor: pointer;
}

.ap-chip.is-follow-done {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
  color: #166534;
}

.ap-chip-more {
  background: rgba(0, 0, 0, 0.06);
}

/* Floating live debug panel */
.ap-live-debug-panel {
  position: fixed;
  top: 72px;
  right: 8px;
  z-index: 99999;
  width: min(260px, calc(100vw - 16px));
  max-height: min(420px, calc(100vh - 88px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
}

.ap-live-debug-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fbbf24;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.ap-live-debug-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  margin: 0;
}

.ap-live-debug-grid dt {
  margin: 0;
  color: #9ca3af;
  white-space: nowrap;
}

.ap-live-debug-grid dd {
  margin: 0;
  color: #f3f4f6;
  word-break: break-all;
}

.ap-live-debug-log {
  margin: 8px 0 0;
  padding: 6px 8px;
  max-height: 140px;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 9px;
  line-height: 1.4;
  white-space: pre-wrap;
  color: #d1d5db;
}

.ap-live-viewer-diag {
  display: none !important;
}

.ap-share-sheet-panel {
  max-height: 70vh;
  position: relative;
  z-index: 2;
  pointer-events: auto !important;
}

#apInAppShareSheet.open {
  z-index: 14000;
  pointer-events: auto !important;
}

.ap-share-user-row,
.ap-share-cancel,
.ap-share-copy-link,
.ap-share-status {
  pointer-events: auto !important;
  touch-action: manipulation;
}

.ap-share-sheet-title {
  margin: 0 0 4px;
  font-size: 18px;
  color: #111;
  text-align: center;
}

.ap-share-sheet-sub {
  margin: 0 0 14px;
  font-size: 12px;
  color: #6b7280;
  text-align: center;
}

.ap-share-user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 45vh;
  overflow-y: auto;
}

.ap-share-user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: #f9fafb;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

.ap-share-user-row img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.ap-share-user-row span {
  flex: 1;
  text-align: left;
  font-weight: 600;
  color: #111;
}

.ap-share-status {
  flex: 0 0 auto !important;
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
}

.ap-share-status.is-sent {
  color: #16a34a;
}

.ap-share-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.ap-share-link-btn {
  width: 100%;
  border: none;
  padding: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #1a1000;
  font-weight: 700;
  cursor: pointer;
}

.ap-share-loading,
.ap-share-empty {
  text-align: center;
  color: #6b7280;
  font-size: 13px;
  padding: 16px 8px;
}

.ap-share-copy-link {
  display: block;
  width: calc(100% - 16px);
  margin: 8px auto 0;
  padding: 12px 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

.ap-share-cancel {
  width: 100%;
  margin-top: 12px;
  border: none;
  padding: 12px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-weight: 700;
  cursor: pointer;
}

.ap-profile-admin-toggle {
  background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
  color: #111827 !important;
  border: none !important;
  font-weight: 800 !important;
}

.ap-profile-admin-toggle.is-revoke {
  background: rgba(239, 68, 68, 0.92) !important;
  color: #fff !important;
}

.ap-profile-leave-seat {
  background: rgba(239, 68, 68, 0.9) !important;
  color: #fff !important;
  border: none !important;
  font-weight: 800 !important;
}

.ap-profile-more-menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: #fff;
  padding: 13px 16px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  line-height: 1.2;
}

.ap-profile-more-menu button i {
  width: 18px;
  flex-shrink: 0;
  text-align: center;
  color: #6b7280;
}

.ap-profile-more-menu button span {
  flex: 1;
  text-align: left;
}

.ap-profile-more-menu button+button {
  border-top: 1px solid #f3f4f6;
}

.ap-profile-more-menu button[data-mod="kick"],
.ap-profile-more-menu button[data-mod="kick2"],
.ap-profile-more-menu button[data-mod="kick24"],
.ap-profile-more-menu button[data-mod="demote"] {
  color: #b91c1c;
}

.ap-profile-more-menu button[data-mod="admin-grant"] {
  color: #b45309;
  background: #fffbeb;
}

.ap-profile-more-menu button[data-mod="admin-grant"] i {
  color: #d97706;
}

.ap-profile-more-menu button[data-mod="admin-revoke"],
.ap-profile-more-menu button[data-mod="clear-chat"] {
  color: #b91c1c;
}

.party-joined-mod-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 12px 10px;
}

.party-joined-mod-bar[hidden] {
  display: none !important;
}

.party-joined-mod-btn {
  flex: 1 1 calc(50% - 4px);
  min-width: 120px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(251, 191, 36, 0.18);
  color: #fef3c7;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.party-joined-mod-btn i {
  color: #fbbf24;
}

.party-req-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
}

.party-req-actions .party-admin-toggle {
  white-space: nowrap;
}

.ap-profile-more-menu button[data-mod="kick"] i,
.ap-profile-more-menu button[data-mod="kick2"] i,
.ap-profile-more-menu button[data-mod="kick24"] i,
.ap-profile-more-menu button[data-mod="demote"] i {
  color: #ef4444;
}

.ap-live-viewer-diag span {
  white-space: nowrap;
}

.ap-live-viewer-diag #apVDiagSocketErr {
  color: #fecaca;
  max-width: min(92vw, 460px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-live-viewer-diag #apVDiagSocketUrl {
  max-width: min(92vw, 460px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-tap-for-sound {
  display: none;
  position: fixed;
  left: 50%;
  bottom: max(120px, calc(env(safe-area-inset-bottom) + 96px));
  transform: translateX(-50%);
  z-index: 12000;
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 800;
  color: #1a1205;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  animation: apTapSoundPulse 1.6s ease-in-out infinite;
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
}
.ap-tap-for-sound.is-visible {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

@keyframes apTapSoundPulse {

  0%,
  100% {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  }

  50% {
    box-shadow: 0 8px 28px rgba(255, 200, 80, 0.55);
  }
}

.ap-filter-sheet {
  position: fixed;
  inset: 0;
  z-index: 56;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: flex-end;
}

.ap-filter-sheet.open {
  display: flex;
}

.ap-filter-panel {
  width: 100%;
  background: linear-gradient(180deg, rgba(28, 24, 36, 0.98) 0%, #0c0c10 100%);
  border-radius: 22px 22px 0 0;
  padding: 14px 0 calc(18px + env(safe-area-inset-bottom, 0));
  color: #fff;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
}

.ap-filter-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
  padding: 0 16px;
}

.ap-filter-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.ap-filter-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.35;
}

.ap-filter-head button {
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.ap-filter-cats {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.ap-filter-cats::-webkit-scrollbar {
  display: none;
}

.ap-filter-cat {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #d1d5db;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.ap-filter-cat.is-on {
  background: #fff;
  color: #111;
  border-color: #fff;
}

.ap-filter-rail {
  display: flex;
  gap: 14px;
  padding: 4px 16px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.ap-filter-rail::-webkit-scrollbar {
  display: none;
}

.ap-filter-chip {
  flex: 0 0 auto;
  width: 72px;
  border: none;
  background: transparent;
  color: #e5e7eb;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  scroll-snap-align: center;
}

.ap-filter-swatch {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.ap-filter-chip.is-active .ap-filter-swatch {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35), inset 0 0 0 1px rgba(0, 0, 0, 0.2);
  transform: scale(1.06);
}

.ap-filter-name {
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  max-width: 72px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.85;
}

.ap-filter-chip.is-active .ap-filter-name {
  opacity: 1;
  color: #fff;
}

/* legacy grid class kept harmless if cached HTML appears */
.ap-filter-grid {
  display: flex;
  gap: 14px;
  padding: 4px 16px 8px;
  overflow-x: auto;
}

.ap-inroom-web {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  flex-direction: column;
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
}

.ap-inroom-web.open {
  display: flex;
}

.ap-inroom-web-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  flex-shrink: 0;
}

.ap-inroom-web-bar button {
  border: none;
  background: #f3f4f6;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
}

.ap-inroom-web iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}

/* Party fix batch — users list, chat avatars, profile sheet, gifts, drag seats */
.party-users-btn {
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fbbf24;
  margin-right: 6px;
  cursor: pointer;
  touch-action: manipulation;
  position: relative;
}

.party-users-btn .party-req-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  margin: 0;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  padding: 0 4px;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  text-align: center;
  pointer-events: none;
}

.party-users-btn .party-req-badge[hidden] {
  display: none !important;
}

.party-viewers.is-clickable,
#partyViewerAvatars.is-clickable {
  cursor: pointer;
  touch-action: manipulation;
}

.party-chat-msg {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: nowrap;
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  height: auto !important;
  max-width: 96%;
  min-width: 0;
  box-sizing: border-box;
  overflow: visible;
  position: relative;
}

.party-chat-avatar-btn,
.party-chat-user-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  touch-action: pan-y;
  flex-shrink: 0;
}

.party-chat-avatar-btn {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.party-chat-avatar-btn img {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  display: block;
  background: rgba(255, 255, 255, 0.12);
}

.party-chat-body {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  overflow: visible;
}

.party-chat-meta {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  line-height: 1.25;
  min-height: 22px;
  overflow: visible;
  position: relative;
  box-sizing: border-box;
}

.party-chat-meta .lvl,
.party-chat-meta .party-chat-admin-badge,
.party-chat-meta .ap-role-badge {
  flex-shrink: 0;
  font-size: 8px;
  padding: 1px 4px;
  margin: 0;
}

.party-chat-user-btn {
  flex: 1 1 auto;
  max-width: none;
  min-width: 0;
  text-align: left;
  overflow: hidden;
}

.party-chat-user-btn .user {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-chat-text {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal !important;
  display: block;
  font-size: 11px;
  line-height: 1.35;
}

.party-chat-user-btn .user {
  font-weight: 700;
  color: #fbbf24;
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.party-gift-analytics,
.party-gift-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.party-gift-stat-row,
.party-gift-history-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.party-gift-history-row img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.party-gift-stat-row strong {
  margin-left: auto;
  font-size: 12px;
  color: #fbbf24;
}

.party-seat.is-dragging {
  opacity: 0.55;
  transform: scale(0.96);
}

.party-seat.is-drop-target {
  outline: 2px dashed #fbbf24;
  outline-offset: 2px;
}

.ap-profile-actions--grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.ap-profile-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
  min-width: 0;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #f9fafb;
  color: #111827;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  overflow: hidden;
  padding: 8px 4px;
}

.ap-profile-action-btn span {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-profile-action-btn i {
  font-size: 16px;
  color: #7c3aed;
}

.ap-profile-action-btn--primary {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-color: transparent;
  color: #1a1000;
}

.ap-profile-action-btn--primary i {
  color: #1a1000;
}

.ap-profile-action-btn--ghost {
  grid-column: span 3;
  min-height: 44px;
  flex-direction: row;
}

.ap-emoji-popover {
  z-index: 45;
}

.ap-btn-mic-ring {
  z-index: 50;
  position: relative;
}

.ap-btn-mic-ring i {
  pointer-events: none;
}

/* Party background music sheet */
.party-music-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 env(safe-area-inset-bottom, 0px);
}

.party-music-sheet.open {
  display: flex;
}

.party-music-panel {
  width: 100%;
  max-width: 480px;
  background: #1a1028;
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  color: #fff;
  max-height: 70vh;
  overflow-y: auto;
}

.party-music-panel h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.party-music-panel p {
  margin: 0 0 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.party-music-track {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  text-align: left;
}

.party-music-track.is-playing {
  border-color: #ec4899;
  background: rgba(236, 72, 153, 0.18);
}

.party-music-track i {
  color: #f472b6;
}

.party-music-track span {
  flex: 1;
  font-weight: 700;
  font-size: 13px;
}

.party-music-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.party-music-actions button {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 11px;
  font-weight: 700;
  cursor: pointer;
}

.party-music-stop {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.party-music-close {
  background: linear-gradient(135deg, #ec4899, #be185d);
  color: #fff;
}

.party-tools-grid .ico.music {
  background: linear-gradient(135deg, #38bdf8, #6366f1);
}

.party-tools-grid .ico.bg {
  background: linear-gradient(135deg, #a855f7, #6366f1);
}

.seat-admin-badge,
.party-chat-admin-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fde68a;
  background: rgba(251, 191, 36, 0.22);
  border: 1px solid rgba(251, 191, 36, 0.45);
  vertical-align: middle;
}

.seat-admin-badge {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

/* Admin gold frame / corner tag removed — looked noisy on seats & chat */
.ap-admin-frame,
.seat-avatar.ap-admin-frame,
.ap-guest-avatar.ap-admin-frame,
.party-chat-avatar-btn.ap-admin-frame,
.ap-profile-avatar-wrap.ap-admin-frame,
.social-profile-avatar-wrap.ap-admin-frame {
  box-shadow: none !important;
}

.ap-admin-frame::before,
.seat-avatar.ap-admin-frame::before,
.ap-guest-avatar.ap-admin-frame::before,
.party-chat-avatar-btn.ap-admin-frame::before,
.ap-profile-avatar-wrap.ap-admin-frame::before,
.social-profile-avatar-wrap.ap-admin-frame::before {
  content: none !important;
  display: none !important;
}

.ap-admin-avatar-tag {
  display: none !important;
}

.party-seat.is-admin-user,
.ap-guest-seat.is-admin-user {
  overflow: visible;
}

/* Account info sheet avatar sizing */
.ap-profile-avatar-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0;
  flex-shrink: 0;
  border-radius: 50%;
}

.ap-profile-avatar-wrap > img {
  position: relative;
  z-index: 1;
  display: block;
  width: 72px !important;
  height: 72px !important;
  max-width: 72px !important;
  max-height: 72px !important;
  border-radius: 50%;
  object-fit: cover !important;
  border: 3px solid #fff !important;
  box-shadow: 0 0 0 2px #a855f7, 0 8px 24px rgba(168, 85, 247, 0.28);
}

.ap-profile-avatar-wrap.ap-admin-frame > img {
  border-color: #fff !important;
  box-shadow: 0 0 0 2px #a855f7, 0 8px 24px rgba(168, 85, 247, 0.28);
}

.ap-guest-avatar {
  position: relative;
  display: block;
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
  line-height: 0;
}

.ap-guest-avatar img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 50%;
  object-fit: cover !important;
  object-position: center center !important;
  display: block;
  z-index: 1;
}

/* Special admin ID chip */
.ap-admin-id {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  vertical-align: middle;
}

.ap-admin-id-tag {
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #1c1917;
  background: linear-gradient(135deg, #fde68a, #f59e0b 55%, #d97706);
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.45);
}

.ap-admin-id-num {
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, #b45309, #f59e0b, #fde68a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}

/* Hierarchy role badges: BD / Agency / Host */
.ap-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.4;
  vertical-align: middle;
  white-space: nowrap;
}

.ap-role-badge--bd {
  color: #1e3a8a;
  background: linear-gradient(135deg, #bfdbfe, #60a5fa);
}

.ap-role-badge--agency {
  color: #713f12;
  background: linear-gradient(135deg, #fde68a, #fbbf24);
}

.ap-role-badge--host {
  color: #14532d;
  background: linear-gradient(135deg, #bbf7d0, #4ade80);
}

.ap-role-badge--seller {
  color: #9a3412;
  background: linear-gradient(135deg, #fed7aa, #fb923c);
}

.ap-role-badge--admin {
  color: #1c1917;
  background: linear-gradient(135deg, #fde68a, #f59e0b 55%, #d97706);
}

.seat-name .ap-role-badge,
.ap-guest-name .ap-role-badge,
#liveHostName .ap-role-badge,
#partyHostName .ap-role-badge {
  font-size: 9px;
  padding: 1px 5px;
  margin-left: 2px;
}

#apProfileRoleBadge:empty {
  display: none;
}

.ap-profile-id-row.is-admin-id,
.social-profile-uid.is-admin-id {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ap-profile-id-row.is-admin-id .ap-admin-id {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.party-chat-msg--gift {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(236, 72, 153, 0.1);
  border: 1px solid rgba(236, 72, 153, 0.2);
  font-size: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.party-chat-gift-ico {
  font-size: 18px;
  line-height: 1;
}

.ap-seat-emoji-float--affection {
  font-size: 22px;
  filter: drop-shadow(0 2px 6px rgba(236, 72, 153, 0.45));
}

.party-music-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  color: #f9a8d4;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.party-bg-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.party-bg-tile {
  position: relative;
  min-height: 72px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  overflow: hidden;
}

.party-bg-tile span {
  position: absolute;
  left: 8px;
  bottom: 8px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
}

.party-bg-tile em {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 9px;
  font-style: normal;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fde68a;
}

.party-bg-tile.is-premium {
  border-color: rgba(251, 191, 36, 0.55);
}

/* Prevent name/detail letter-stacking when flex/grid cells shrink */
.party-host-meta .name,
.party-host-meta .sub,
.live-room-id-line,
#liveRoomId,
#partyRoomId,
.seat-name,
.ap-guest-name,
.ap-profile-head .info h3,
.ap-profile-id-row,
.party-chat-user-btn .user,
.party-req-row .info strong,
.gift-recipient span,
.party-event-pill .pill-title,
.ap-profile-action-btn span,
.party-gift-history-row span,
.party-gift-stat-row span {
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal !important;
  overflow-wrap: normal !important;
}

.party-chat-text {
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  max-width: 100% !important;
  min-width: 0 !important;
  font-size: 11px;
  line-height: 1.35;
}

/* Hard stop: live chat bubbles must never be flex-squashed */
.party-chat-feed > .party-chat-msg,
.live-room .party-chat-msg,
.party-room .party-chat-msg {
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  height: auto !important;
  min-height: auto !important;
  transform: none !important;
  scale: none !important;
}

/* ─── Game overlay ─── */
.ap-game-overlay {
  position: fixed;
  inset: 0;
  z-index: 16000;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.ap-game-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.ap-game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.6);
}
.ap-game-title {
  font-weight: 800;
  font-size: 0.9rem;
  color: #fde68a;
}
.ap-game-close {
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
}
.ap-game-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #0a0620;
}

/* Game tool buttons in tools sheet */
.ap-tool-game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  color: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  padding: 6px 2px;
}
.ap-tool-game .ico {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.party-tools-title--games {
  color: #fbbf24;
  font-size: 0.8rem;
  font-weight: 800;
  margin: 10px 0 4px;
  padding-left: 4px;
}
/* ——— Premium luxury gift sheet (UI only) ——— */
.gift-sheet--lux .gift-sheet-panel {
  background:
    linear-gradient(165deg, rgba(42, 32, 22, 0.98) 0%, rgba(22, 16, 28, 0.98) 45%, rgba(16, 14, 24, 0.99) 100%);
  border-top: 1px solid rgba(251, 191, 36, 0.28);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  max-height: min(62vh, 520px);
}

.gift-sheet--lux .gift-send-label {
  background: linear-gradient(90deg, #fde68a, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.gift-send-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-shrink: 0;
  padding: 0 2px;
  position: relative;
  z-index: 4;
}

.gift-all-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  padding: 6px 4px;
  min-height: 36px;
}

.gift-all-toggle input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  width: 46px;
  height: 26px;
  margin: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.24);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
  pointer-events: auto;
}

.gift-all-toggle input[type='checkbox']::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}

.gift-all-toggle input[type='checkbox']:checked {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  border-color: rgba(251, 191, 36, 0.55);
}

.gift-all-toggle input[type='checkbox']:checked::after {
  transform: translateX(20px);
}

.gift-all-toggle input[type='checkbox']:focus-visible {
  outline: 2px solid rgba(251, 191, 36, 0.55);
  outline-offset: 2px;
}

.gift-search-row {
  margin: 0 0 8px;
}

.gift-search-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
}

.gift-search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.gift-search-input:focus {
  border-color: rgba(251, 191, 36, 0.55);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.15);
}

.gift-sheet--lux .gift-sheet-tabs {
  gap: 2px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.gift-sheet--lux .gift-sheet-tabs button[data-cat] {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.5);
}

.gift-sheet--lux .gift-sheet-tabs button.active {
  color: #fbbf24 !important;
  border-bottom-color: #fbbf24;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.35);
}

.gift-sheet--lux .gift-grid {
  gap: 8px;
  padding: 2px 0 6px;
}

.gift-sheet--lux .gift-grid button.gift-card {
  position: relative;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.gift-sheet--lux .gift-grid button.gift-card .gift-card-glow {
  position: absolute;
  inset: auto -20% -40% -20%;
  height: 70%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.22), transparent 70%);
  pointer-events: none;
  opacity: 0.55;
}

.gift-sheet--lux .gift-grid button.gift-card .g {
  font-size: 32px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
  position: relative;
  z-index: 1;
}

.gift-sheet--lux .gift-grid button.gift-card.is-selected {
  border-color: rgba(251, 191, 36, 0.7);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.35), 0 8px 24px rgba(251, 191, 36, 0.18);
  transform: translateY(-2px);
}

.gift-sheet--lux .gift-grid button.gift-card .gift-fav-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(0, 0, 0, 0.35);
  z-index: 2;
}

.gift-sheet--lux .gift-grid button.gift-card.is-fav .gift-fav-btn {
  color: #f472b6;
}

.gift-grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 28px 12px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
}

.gift-sheet--lux .gift-send-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706 50%, #b45309) !important;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.4);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.gift-sheet--lux .gift-balance-btn {
  border: 1px solid rgba(251, 191, 36, 0.25);
  background: rgba(251, 191, 36, 0.08);
  border-radius: 999px;
}


/* ===== Live chrome stack: bar below sheets; gift/tools/PK above and tappable ===== */
#partyBottomBar.party-bottom-bar,
body[data-live-page='live-room'] #partyBottomBar,
.party-bottom-bar#partyBottomBar {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 8px !important;
  overflow: visible !important;
  z-index: 14000 !important;
  pointer-events: auto !important;
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  /* Lift above home indicator / gesture bar */
  bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
  padding: 8px 10px 10px !important;
  min-height: 56px !important;
}

/* When gift / tools / PK sheets open, keep bar UNDER them so Send + PK work */
body:has(#giftSheet.open) #partyBottomBar,
body:has(#partyToolsSheet.open) #partyBottomBar,
body:has(.ap-pk-types-sheet.open) #partyBottomBar,
body:has(.party-requests-sheet.open) #partyBottomBar,
body.ap-live-overlay-open #partyBottomBar {
  z-index: 12000 !important;
  pointer-events: none !important;
}

#giftSheet,
.gift-sheet {
  z-index: 32000 !important;
}
#giftSheet.open,
.gift-sheet.open {
  z-index: 32000 !important;
  pointer-events: auto !important;
}

#partyToolsSheet,
.party-tools-sheet {
  z-index: 32000 !important;
}
#partyToolsSheet.open,
.party-tools-sheet.open {
  z-index: 32000 !important;
  pointer-events: auto !important;
}

.ap-pk-types-sheet,
.ap-pk-types-sheet.open {
  z-index: 33000 !important;
}

#partyBottomBar #liveChatCompose,
#partyBottomBar .live-chat-compose.ap-compose-inline {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  max-width: none !important;
  overflow: hidden !important;
  z-index: 1 !important;
  position: relative !important;
}

#partyBottomBar .party-bottom-actions {
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  z-index: 5 !important;
  position: relative !important;
  pointer-events: auto !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

#partyBottomBar #liveBtnGift,
#partyBottomBar .party-btn-gift,
#partyBottomBar .ap-btn-gift-hero {
  flex-shrink: 0 !important;
  z-index: 6 !important;
  position: relative !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1 !important;
  text-align: center !important;
}

#partyBottomBar #liveBtnGift i,
#partyBottomBar .party-btn-gift i,
#partyBottomBar .ap-btn-gift-hero i {
  line-height: 1 !important;
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
  position: relative !important;
  top: 0 !important;
  left: 0 !important;
  transform: none !important;
}

#partyBottomBar #partyBtnTools,
#partyBottomBar #liveBtnMic {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

/* Send gift row */
.gift-sheet .gift-qty-row,
.gift-sheet--send-safe .gift-qty-row {
  flex-shrink: 0 !important;
  position: relative !important;
  z-index: 6 !important;
  background: transparent !important;
  padding-top: 10px !important;
  pointer-events: auto !important;
}
.gift-sheet .gift-send-btn,
#giftSendBtn {
  pointer-events: auto !important;
  z-index: 7 !important;
  position: relative !important;
  min-height: 44px !important;
}

/* Closed gift sheet MUST not paint over the live theme */
.gift-sheet:not(.open),
#giftSheet:not(.open) {
  display: none !important;
  background: transparent !important;
  pointer-events: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Open dim — soft only; panel keeps luxury gold theme (do not force flat black) */
#giftSheet.open,
.gift-sheet.open {
  background: rgba(0, 0, 0, 0.4) !important;
}

#giftSheet.open .gift-sheet-panel,
.gift-sheet.open .gift-sheet-panel {
  /* Let lux theme show through — only a soft fallback if lux class missing */
  background:
    linear-gradient(165deg, rgba(42, 32, 22, 0.98) 0%, rgba(22, 16, 28, 0.98) 50%, rgba(16, 14, 24, 0.99) 100%) !important;
  margin-bottom: 0 !important;
}

.live-room .live-overlay {
  padding-bottom: calc(var(--ap-bottom-bar-h, 58px) + max(12px, env(safe-area-inset-bottom, 0px)) + 12px) !important;
  overflow: hidden !important;
}

.live-room .party-chat-feed,
#partyChatFeed {
  padding-bottom: 12px !important;
}

.live-room .party-chat-row {
  z-index: 20 !important;
  pointer-events: none !important;
}
.live-room .party-chat-zone,
.live-room .party-chat-feed,
.live-room .party-chat-msg {
  pointer-events: auto !important;
}