/* Stream controls (assets/stream-ui.js): the bar on a stream tile, the menu on the share button, and zoom for people watching.
   One look for every theme: a dark, slightly see-through bar over the picture, 28 px buttons, the accent for what is on. */

/* ---------- the bar on a stream tile ---------- */
.sq-bar { position: absolute; top: 10px; inset-inline-end: 10px; z-index: 6; display: flex; align-items: center; gap: 2px; padding: 3px; max-width: calc(100% - 20px);
  background: rgba(12, 13, 17, .88); border: 1px solid var(--border, rgba(255, 255, 255, .14)); border-radius: 10px; color: #e9ebf1; font-size: 12px; font-weight: 600;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); cursor: default; }
.sq-bar > * { flex: none; }
.sq-live { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 7px; background: var(--red, #ed4245); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.sq-live i { width: 6px; height: 6px; border-radius: 50%; background: #fff; }
@media (prefers-reduced-motion: no-preference) { .sq-live i { animation: sqPulse 1.8s ease-in-out infinite; } }
@keyframes sqPulse { 50% { opacity: .35; } }
.sq-chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border-radius: 7px; white-space: nowrap; font-variant-numeric: tabular-nums; color: #dcdfe6; }
.sq-chip .ic { width: 14px; height: 14px; }
.sq-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--border, rgba(255, 255, 255, .16)); }
.sq-btn { height: 28px; min-width: 28px; padding: 0 8px; border: 0; border-radius: 7px; background: transparent; color: inherit; font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; transition: background-color .12s, transform .08s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; }
.sq-btn .ic { width: 15px; height: 15px; }
.sq-btn:hover { background: rgba(255, 255, 255, .13); }
.sq-btn:active { transform: scale(.95); }
.sq-btn:focus-visible { outline: 2px solid var(--accent-hi, var(--accent, #8b5cf6)); outline-offset: 1px; }
.sq-btn[disabled] { opacity: .4; cursor: not-allowed; }
.sq-btn.danger { color: #ff8f8f; }
.sq-btn.danger:hover { background: var(--red, #ed4245); color: #fff; }
.sq-btn.on { background: color-mix(in srgb, var(--accent, #8b5cf6) 40%, transparent); color: #fff; }
.sq-zoom { display: inline-flex; align-items: center; }
.sq-zoom .sq-pct { min-width: 48px; padding: 0 6px; font-variant-numeric: tabular-nums; }
.sq-zoom[data-z="1"] .sq-pct { opacity: .65; }
@media (max-width: 900px) { .sq-btn .sq-l { display: none; } }
/* a narrow tile sheds details so the bar never runs out of the picture: under 460 px the quality text goes (the button stays),
   under 340 px the viewer count and the zoom percentage go too (data-sqw is set from the tile's width in stream-ui.js) */
[data-sqw="s"] .sq-res, [data-sqw="xs"] .sq-res { display: none; }
[data-sqw="xs"] #stage-viewers, [data-sqw="xs"] .sq-pct { display: none; }
[data-sqw="xs"] .sq-sep { margin: 0 2px; }
[dir="rtl"] .sq-bar { direction: rtl; }

/* the bar rests when the call screen goes quiet, like the other controls */
.voice-call-screen .sq-bar { transition: opacity .25s ease; }
.voice-call-screen.ui-idle .sq-bar { opacity: 0; pointer-events: none; }
/* the phone layout keeps its own controls (pinch to zoom still works) */
@media (max-width: 700px) { #voice-call-screen .sq-bar { display: none !important; } }

/* ---------- zoom ---------- */
:is(#stage-screen-card, .ms-card) video { touch-action: none; transform-origin: 50% 50%; }
.sq-zoomed video { cursor: grab; }
.sq-zoomed.sq-panning video { cursor: grabbing; }
.sq-zchip { position: absolute; top: 6px; inset-inline-end: 6px; z-index: 5; display: none; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border: 0; border-radius: 7px; background: rgba(12, 13, 17, .82); color: #fff;
  font: 600 11px/1 inherit; font-variant-numeric: tabular-nums; cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.ms-card.sq-zoomed .sq-zchip { display: inline-flex; }
.sq-zchip .ic { width: 13px; height: 13px; }
.sq-zchip:hover { background: var(--accent, #8b5cf6); }

/* ---------- my own stream tile (when I share and watch someone else) ---------- */
.ms-card.ms-me { background: #000; cursor: default; display: flex; align-items: center; justify-content: center; }
.ms-me .ms-ph { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; text-align: center; color: #c7cbd6; font-size: 12px; }
.ms-me .ms-ph .ic { width: 30px; height: 30px; color: var(--accent, #8b5cf6); }
.ms-me .ms-ph b { color: #fff; font-size: 13px; }
.ms-me .ms-bar button { width: auto; }

/* ---------- the menu on the share button ---------- */
#vc-popover[data-kind="share"] { width: min(340px, calc(100vw - 16px)); padding: 8px; }
.sm-head { display: flex; align-items: center; gap: 10px; padding: 4px 6px 8px; font-size: 12px; color: var(--muted, #9aa1b4); }
.sm-head .sq-live { height: 24px; padding: 0 8px; }
.sm-head .sm-spacer { flex: 1; }
.sm-sec { margin: 10px 8px 6px; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted, #9aa1b4); }
.sm-chips { display: flex; gap: 4px; padding: 0 6px 4px; }
.sm-chip { flex: 1; min-height: 32px; padding: 0 6px; border: 1px solid var(--border, rgba(255, 255, 255, .14)); border-radius: 8px; background: transparent; color: inherit; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background-color .12s, border-color .12s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.sm-chip:hover { background: rgba(255, 255, 255, .08); }
.sm-chip.on { background: var(--accent, #8b5cf6); border-color: var(--accent, #8b5cf6); color: #fff; }
.sm-chip:focus-visible { outline: 2px solid var(--accent-hi, var(--accent, #8b5cf6)); outline-offset: 1px; }
.sm-src { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 2px 6px 4px; max-height: 210px; overflow: auto; }
.sm-src button { display: flex; flex-direction: column; gap: 4px; padding: 4px; border: 1px solid var(--border, rgba(255, 255, 255, .14)); border-radius: 8px; background: transparent; color: inherit; cursor: pointer; text-align: start; min-width: 0; }
.sm-src button:hover { border-color: var(--accent, #8b5cf6); background: rgba(255, 255, 255, .06); }
.sm-src img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 5px; background: #000; display: block; }
.sm-src span { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-note { padding: 6px 8px; font-size: 12px; color: var(--muted, #9aa1b4); }
#vc-popover[data-kind="share"] .vc-item.danger { color: #ff8f8f; }
#vc-popover[data-kind="share"] .vc-item.danger:hover { background: var(--red, #ed4245); color: #fff; }

/* ---------- full screen with several streams, in the equal-tile ("wall") call layout ---------- */
/* That layout turns the stream slot into `display: contents` with 4 ids of weight; in full screen `contents` becomes a plain block, so the
   streams were not a grid: the big stream stayed small and my own tile ran across the bottom. Same grid as the rule it replaces, with the
   extra weight to win. */
#voice-call-screen #voice-stage-grid:has(#stage-members.vl-wall) #stage-screen-slot.multi:fullscreen,
#voice-call-screen.vc-full #voice-stage-grid:has(#stage-members.vl-wall) #stage-screen-slot.multi {
  display: grid !important; grid-template-columns: repeat(var(--sc), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 8px; padding: 8px; box-sizing: border-box;
  background: #000; width: 100%; height: 100%; align-content: stretch;
}
#voice-call-screen.vc-full #voice-stage-grid:has(#stage-members.vl-wall) #stage-screen-slot.multi { padding: 0 8px; }
/* ...and the big stream's own tile size (--tw / --th) must not hold it small inside that grid */
#voice-call-screen #voice-stage-grid:has(#stage-members.vl-wall) #stage-screen-slot.multi:fullscreen > #stage-screen-card:not(:fullscreen),
#voice-call-screen.vc-full #voice-stage-grid:has(#stage-members.vl-wall) #stage-screen-slot.multi > #stage-screen-card:not(:fullscreen) {
  width: auto !important; height: auto !important; max-width: none !important; min-width: 0 !important; flex: none !important; margin: 0 !important; align-self: stretch !important;
}
