/* ShotGram v112 — fixes. Loads last. */

/* 1 · DM: only NEW bubbles fade in (the whole thread used to flash dark on
       every message because every bubble replayed the animation). */
.room-body .bubble-row { animation: none !important; }
.room-body .bubble-row.fresh { animation: bubble-in .16s ease-out both !important; }

/* 2 · Call controls: labels never overlap, one line, centred under each key */
.call-overlay:not(.minimized) .call-controls .call-btn::after {
  max-width: 64px; overflow: hidden; text-overflow: ellipsis; text-align: center;
  font-size: 11.5px; letter-spacing: 0;
}
.call-overlay:not(.minimized):not(.incoming) .call-controls { gap: 2px !important; padding: 16px 6px 14px; }
.call-overlay:not(.minimized):not(.incoming) .call-controls .call-btn { width: 56px; height: 56px; }

/* 3 · Minimised call pill: brand glass instead of the green bar, and the
       page underneath moves down so the chat header is never hidden */
.call-overlay.minimized {
  background: linear-gradient(135deg, rgba(18, 22, 48, .96), rgba(40, 14, 58, .96)) !important;
  border: 1px solid rgba(var(--violet-rgb, 139, 92, 255), .45);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 0 0 1px rgba(var(--cyan-rgb, 0, 216, 255), .12) inset;
  height: 54px !important;
}
.call-overlay.minimized .call-status { color: #34f5a4 !important; font-weight: 700; }
body.call-minimized { --call-pill: calc(70px + env(safe-area-inset-top, 0px)); }
body.call-minimized.chat-open .room {
  top: calc(var(--room-top, 0px) + var(--call-pill)) !important;
  height: calc(var(--room-h, 100dvh) - var(--call-pill)) !important;
}
body.call-minimized.chat-open .room-head { padding-top: 8px !important; }

/* 4 · Profile cover: shown at the same 3:1 frame it was cropped in, so it
       is never zoomed or cut; no white rule under it */
.cover {
  height: auto !important; aspect-ratio: 3 / 1; max-height: 220px;
  border-bottom: 0 !important; background-position: center !important;
}
.cover::after { background: linear-gradient(to bottom, rgba(6, 7, 15, 0) 40%, rgba(6, 7, 15, .65)); }

/* 5 · Creators Lab link dot */
.social-dot.social-creators { background: linear-gradient(135deg, #00c2a8, #6c4dff); color: #fff; }

/* 6 · Friends state on the follow button */
.pa-btn[data-follow] svg { width: 17px; height: 17px; }

/* 7 · Majlis v112 — live camera on seats, cleaner control bar, a chat that
       takes the bottom half like a real room (rooms up, chat down) */
.majlis { grid-template-rows: auto minmax(0, 1fr) minmax(150px, 34vh) auto; }
.mj-ring { overflow: visible; }
.mj-ring video.mj-cam {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  border-radius: 50%; z-index: 1; background: #000;
}
.mj-ring video.mj-cam.mirror { transform: scaleX(-1); }
.mj-ring.has-cam .avatar { visibility: hidden; }
.mj-ring.has-cam { border-color: #22d3ee; }
.mj-ring .mj-mute, .mj-ring .mj-crown { z-index: 2; }
/* a seat with the camera on grows so the face is actually visible */
.mj-seat .mj-ring.has-cam { width: 74px; height: 74px; }
.mj-seat.host .mj-ring.has-cam { width: 104px; height: 104px; }

.mj-chat { display: flex; flex-direction: column; min-height: 0; padding: 6px 12px 0;
  border-top: 1px solid rgba(255, 255, 255, .08); background: linear-gradient(to bottom, rgba(0,0,0,.18), rgba(0,0,0,.35)); }
.mj-msgs { flex: 1; max-height: none; min-height: 0; }
.mj-send { padding: 6px 0 2px; }

.mj-bar { gap: 6px; padding: 8px 10px 10px; }
.mj-btn { min-width: 0; padding: 8px 2px; font-size: 11.5px; border-radius: 14px; }
.mj-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mj-btn[hidden] { display: none; }
.mj-btn:disabled { opacity: .5; }

/* 8 · Clan home (v112): hero + rooms, no tab strip */
.clan-home-rooms { display: grid; gap: 10px; padding: 4px 12px 16px; }
.clan-home-cta {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; border: 0; width: 100%;
  color: #fff; text-align: start; cursor: pointer;
  background: linear-gradient(135deg, color-mix(in srgb, var(--clan-color, #5865f2) 70%, #000), color-mix(in srgb, var(--clan-color-2, #a855f7) 70%, #000));
  box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
}
.clan-home-cta .grow { display: grid; gap: 2px; }
.clan-home-cta b { font-size: 16px; }
.clan-home-cta small { opacity: .8; font-size: 12.5px; }
.clan-home-cta svg { width: 26px; height: 26px; }
.clan-owner-badge { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: rgba(251, 191, 36, .18); color: #fbbf24; }
#clanSettings { position: relative; }
#clanSettings .dot-badge { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--magenta, #ff2ed1); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; }

/* 9 · v113 — one rule for every direction arrow in Arabic */
html.rtl svg.sg-dir { transform: scaleX(-1) !important; }
[data-back] svg.sg-dir { width: 24px; height: 24px; }
html.rtl .sec-panel[open] > summary > svg.sg-dir { transform: rotate(90deg) !important; }

/* 10 · v114 Majlis layout: persistent message box between chat and controls */
.majlis { grid-template-rows: auto minmax(0, 1fr) minmax(120px, 30vh) auto auto !important; }
.majlis > .mj-live { display: contents; }
.majlis .mj-top { order: 1; }
.majlis .mj-stage { order: 2; }
.majlis .mj-chat { order: 3; }
.majlis > .mj-send { order: 4; padding: 6px 12px 2px; background: rgba(0, 0, 0, .35); }
.majlis .mj-bar { order: 5; }
.majlis > .mj-send .input { width: 100%; font-size: 16px; border-radius: 999px; background: rgba(0,0,0,.35); border-color: rgba(255,255,255,.15); color: #fff; }

/* 11 · v114 voice dock = one slim bar above the tab bar (tap → Majlis) */
.voice-dock:not(.expanded) .voice-stage,
.voice-dock:not(.expanded) .voice-people,
.voice-dock:not(.expanded) #dockExpand,
.voice-dock:not(.expanded) .voice-controls .voice-ctl:not(#ctlMic):not(#ctlLeave) { display: none !important; }
.voice-dock:not(.expanded) {
  display: flex !important; align-items: center; gap: 8px; padding: 8px 10px !important; border-radius: 18px !important;
  background: linear-gradient(135deg, rgba(20, 24, 54, .97), rgba(48, 16, 64, .97)) !important;
  border: 1px solid rgba(var(--violet-rgb, 139, 92, 255), .4); box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.voice-dock:not(.expanded) .voice-dock-head { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.voice-dock:not(.expanded) .voice-controls { display: flex; gap: 6px; margin: 0 !important; padding: 0 !important; }
.voice-dock:not(.expanded) .voice-ctl { width: 40px; height: 40px; min-width: 0; padding: 0 !important; border-radius: 50%; }
.voice-dock:not(.expanded) .voice-ctl span { display: none; }
.voice-dock:not(.expanded) #dockCount { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#persistentVoice:not(:empty) { left: 12px !important; right: 12px; width: auto !important; bottom: calc(108px + env(safe-area-inset-bottom)) !important; }
#persistentVoice .voice-dock-head { cursor: pointer; }

/* 12 · v114 Majlis camera viewer (tap a seat with the camera on) */
.mj-viewer { position: absolute; inset: 0; z-index: 30; background: #000; display: grid; }
.mj-viewer video { width: 100%; height: 100%; object-fit: cover; }
.mj-viewer.contain video { object-fit: contain; }
.mj-viewer video.mirror { transform: scaleX(-1); }
.mj-viewer-top { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 10px); left: 12px; right: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #fff; text-shadow: 0 1px 4px #000; }
.mj-viewer-more { position: absolute; right: 14px; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); width: 46px; height: 46px;
  border-radius: 50%; border: 0; color: #fff; background: rgba(0,0,0,.45); display: grid; place-items: center; }
html.rtl .mj-viewer-more { right: auto; left: 14px; }

/* 13 · v114 voice recording bar inside the composer */
.room-bar .vn-hint.vn-hint-inline {
  position: absolute; top: 50%; transform: translateY(-50%); left: auto; right: auto;
  inset-inline-start: 54px; inset-inline-end: 104px; height: 46px; padding: 0 14px;
  display: flex; align-items: center; gap: 10px; border-radius: 999px;
  background: linear-gradient(90deg, #3a0d1c, #24112f); color: #fff; font-size: 13px; z-index: 5;
  border: 1px solid rgba(255, 59, 107, .45);
}
.vn-hint-inline .rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff3b6b; animation: vnBlink 1s infinite; flex: none; }
.vn-hint-inline .vn-rec-time { font-variant-numeric: tabular-nums; min-width: 34px; }
.vn-hint-inline .vn-rec-wave { flex: 1; display: flex; align-items: center; gap: 3px; height: 22px; overflow: hidden; }
.vn-hint-inline .vn-rec-wave i { flex: 1; max-width: 4px; border-radius: 2px; background: rgba(255,255,255,.75); height: 30%; animation: vnWave 1s ease-in-out infinite; }
.vn-hint-inline .vn-rec-wave i:nth-child(3n) { animation-delay: .15s; } .vn-hint-inline .vn-rec-wave i:nth-child(3n+1) { animation-delay: .35s; }
.vn-hint-inline .vn-rec-tip { font-size: 11.5px; opacity: .75; white-space: nowrap; }
@media (max-width: 380px) { .vn-hint-inline .vn-rec-tip { display: none; } }
@keyframes vnBlink { 50% { opacity: .25; } }
@keyframes vnWave { 0%, 100% { height: 25%; } 50% { height: 95%; } }

/* 14 · v114 photo / video bubbles never collapse while the image loads */
.bubble .dm-image, .bubble [data-open-dm-image] img, .bubble .bubble-media img, .bubble .bubble-media video {
  min-height: 160px; min-width: 140px; background: rgba(255,255,255,.06); object-fit: cover;
}
.room-body .bubble-img { min-height: 180px; min-width: 150px; max-height: 360px; object-fit: cover; background: rgba(255,255,255,.06); display: block; }
.room-body .bubble-video { min-height: 180px; min-width: 150px; background: #000; }

/* 15 · v114 sheets, dialogs and toasts always show ABOVE the Majlis / calls
       (they opened behind the room, so its settings "did nothing") */
.sheet-backdrop, .modal-backdrop { z-index: 2600 !important; }
.toast { z-index: 2700 !important; }

/* 16 · v123 Majlis: every seat fits on screen, the chat floats over the room
        (see-through) instead of a dark block, tidy control bar */
.majlis { grid-template-rows: auto auto minmax(0, 1fr) auto auto !important; }
.majlis .mj-stage { overflow: visible !important; padding: 2px 14px 6px !important; gap: 8px !important; }
.majlis .mj-seats { gap: 8px 6px !important; }
.majlis .mj-ring { width: 54px !important; height: 54px !important; }
.majlis .mj-seat.host .mj-ring { width: 72px !important; height: 72px !important; }
.majlis .mj-seat.host .mj-ring.has-cam { width: 96px !important; height: 96px !important; }
.majlis .mj-seat .mj-ring.has-cam { width: 64px !important; height: 64px !important; }
.majlis .mj-seat span, .majlis .mj-seat small, .majlis .mj-name { font-size: 11px !important; }
.majlis .mj-ring .avatar { width: 100% !important; height: 100% !important; }
.majlis .mj-chat {
  background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,.28) 40%, rgba(0,0,0,.45)) !important;
  border-top: 0 !important; justify-content: flex-end;
}
.majlis .mj-msgs { mask-image: linear-gradient(to bottom, transparent, #000 18%); -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%); }
.majlis .mj-msgs > * { background: rgba(10, 10, 20, .45) !important; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.majlis > .mj-send { background: rgba(0, 0, 0, .25) !important; padding: 6px 12px 4px !important; }
.majlis > .mj-send .input { background: rgba(255,255,255,.08) !important; border-color: rgba(255,255,255,.14) !important; }
.majlis .mj-bar { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px !important;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px)) !important; background: rgba(0,0,0,.3) !important; }
.majlis .mj-btn { height: 58px; display: grid !important; place-items: center; align-content: center; gap: 3px; border-radius: 16px !important;
  background: rgba(255,255,255,.08) !important; border: 1px solid rgba(255,255,255,.08) !important; font-weight: 700; }
.majlis .mj-btn.on { background: rgba(var(--violet-rgb, 139, 92, 255), .28) !important; border-color: rgba(var(--violet-rgb, 139, 92, 255), .5) !important; }
.majlis .mj-btn.off { background: rgba(255, 59, 107, .18) !important; border-color: rgba(255, 59, 107, .35) !important; }
.majlis .mj-btn.danger { background: #ef4444 !important; border-color: transparent !important; }
.majlis .mj-btn svg { width: 21px; height: 21px; }

/* 17 · v127 LIVE, phone: a clean host screen while broadcasting and one share
        button for viewers */
.is-broadcasting .live-subs-only, .is-broadcasting .live-creator-readiness { display: none !important; }
.is-broadcasting .live-battle-invite {
  padding: 6px 12px !important; min-height: 0 !important; border-radius: 999px !important; width: auto !important;
  align-self: flex-start; gap: 8px !important; background: rgba(10, 12, 28, .55) !important;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.is-broadcasting .live-battle-invite .live-battle-bolt { width: 28px !important; height: 28px !important; font-size: 11px !important; border-radius: 9px !important; }
.is-broadcasting .live-battle-invite small { display: none !important; }
.is-broadcasting .live-creator-chat-form { position: relative; z-index: 3; }
@media (max-width: 760px) {
  .live-watch-screen #liveShareBtn { display: none !important; }   /* the side rail already has Share */
}
/* hearts pop instantly and never block the next tap */
.live-watch-screen .live-heart-burst, .live-watch-screen .burst-heart { pointer-events: none !important; }

/* 18 · v128 LIVE tools (TikTok-style): top tool stack, effects + settings sheets */
.live-top-tools { display: flex; flex-direction: column; gap: 10px; }
.lfx-sheet h3, .lset-sheet h3 { font-size: 18px; margin: 0 0 12px; }
.lfx-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.lfx-item { display: grid; justify-items: center; gap: 6px; padding: 6px 2px; border: 0; background: none; color: #fff; font-size: 12px; }
.lfx-swatch { width: 58px; height: 58px; border-radius: 16px; border: 2px solid transparent;
  background: linear-gradient(135deg, #3a3f63, #1b1e33); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.lfx-item.on .lfx-swatch { border-color: #fe2c55; box-shadow: 0 0 0 3px rgba(254,44,85,.25); }
.lfx-none { background: repeating-linear-gradient(45deg, #2a2d45 0 6px, #1b1e33 6px 12px); }
.lfx-beauty { background: radial-gradient(circle at 40% 35%, #ffd9c7, #e9a68f 60%, #b06a5a); }
.lfx-glow { background: radial-gradient(circle at 50% 40%, #fff3d6, #f2b6c9 55%, #8a63c9); }
.lfx-warm { background: linear-gradient(135deg, #ffb46b, #e0663a); }
.lfx-cool { background: linear-gradient(135deg, #8fd3ff, #3f6fd8); }
.lfx-vivid { background: linear-gradient(135deg, #ff2fa6, #00e1ff 60%, #fff04a); }
.lfx-mono { background: linear-gradient(135deg, #e9e9e9, #2b2b2b); }
.lfx-film { background: linear-gradient(135deg, #c9a46b, #3b3226); }
.lset-group { border-radius: 18px; background: rgba(255,255,255,.05); margin-bottom: 12px; overflow: hidden; }
.lset-row { display: flex; align-items: center; gap: 12px; padding: 14px; color: #fff; cursor: pointer; }
.lset-row + .lset-row { border-top: 1px solid rgba(255,255,255,.06); }
.lset-row svg { width: 22px; height: 22px; flex: none; }
.lset-row b { display: block; font-size: 15px; }
.lset-row small { display: block; color: rgba(255,255,255,.55); font-size: 12.5px; margin-top: 2px; }
.lset-seg { display: flex; background: rgba(255,255,255,.08); border-radius: 10px; padding: 3px; }
.lset-seg button { border: 0; background: none; color: rgba(255,255,255,.7); padding: 6px 10px; border-radius: 8px; font-weight: 700; font-size: 13px; }
.lset-seg button.on { background: #fff; color: #111; }

/* 19 · v129 minimised voice call: a small pill next to the Dynamic Island
        (avatar · green timer · hang up), draggable, never blocks the page */
.call-overlay.minimized:not(.pip) {
  top: calc(var(--sa-t, env(safe-area-inset-top, 0px)) + 4px) !important;
  left: var(--pill-x, 50%) !important; transform: translateX(-50%);
  width: auto !important; min-width: 0; max-width: 220px; height: 38px !important;
  padding: 0 4px 0 4px !important; gap: 6px;
  background: rgba(10, 12, 24, .82) !important;
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid rgba(52, 245, 164, .45) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45) !important;
  touch-action: none;
}
.call-overlay.minimized:not(.pip) .call-person { gap: 6px !important; }
.call-overlay.minimized:not(.pip) .call-person .avatar { width: 28px !important; height: 28px !important; }
.call-overlay.minimized:not(.pip) .call-name { display: none !important; }
.call-overlay.minimized:not(.pip) .call-status { font-size: 13px !important; font-variant-numeric: tabular-nums; margin: 0 2px !important; }
.call-overlay.minimized:not(.pip) .call-status::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-end: 6px;
  border-radius: 50%; background: #34f5a4; box-shadow: 0 0 8px #34f5a4; vertical-align: 1px; animation: pillBlink 1.6s ease-in-out infinite; }
@keyframes pillBlink { 50% { opacity: .35; } }
.call-overlay.minimized:not(.pip) .call-pill-end { width: 30px !important; height: 30px !important; margin: 0 !important; }
.call-overlay.minimized:not(.pip) .call-pill-end svg { width: 15px !important; height: 15px !important; }
/* the page no longer has to move out of the way */
body.call-minimized { --call-pill: 0px !important; }
body.call-minimized.chat-open .room-head { padding-top: 0 !important; }

/* 20 · v130 the other person's shared screen, inside the call */
.call-screen-view { position: absolute; inset: 0; z-index: 6; background: #000; display: grid; place-items: center; }
.call-screen-view img { width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-select: none; }
.call-screen-tag { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 58px); left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: rgba(0,0,0,.55); color: #fff; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.call-screen-tag svg { width: 16px; height: 16px; }
.call-screen-close { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 54px); inset-inline-end: 14px; width: 38px; height: 38px;
  border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; }
.call-screen-view.small { inset: auto; top: calc(env(safe-area-inset-top, 0px) + 60px); inset-inline-end: 12px; width: 34%; height: auto; aspect-ratio: 9 / 19;
  border-radius: 16px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.6); }
.call-screen-view.small .call-screen-tag { display: none; }
.call-screen-view.small .call-screen-close { top: 6px; inset-inline-end: 6px; width: 28px; height: 28px; }
.call-overlay.peer-screen .call-controls { z-index: 7; }
.call-overlay.minimized .call-screen-view { display: none; }

/* 21 · v131 post page: the comment box always sits right on top of the
        keyboard (it was hidden under it), in both keyboard modes */
html.sg-keyboard-open .comment-bar, body.keyboard-open .comment-bar {
  position: fixed !important; left: 0; right: 0; bottom: auto !important;
  top: calc(var(--vv-top, 0px) + var(--vv-h, 100vh)) !important; transform: translateY(-100%);
  z-index: 1500; padding-bottom: 8px !important;
}
html.sg-keyboard-open .quick-reactions, body.keyboard-open .quick-reactions { display: none; }
.post-stats { display: none !important; }   /* duplicated the counts under the post */
