/* RemoteRecord guest page: the studio's screen (screen.js), Discord-style stage. Everything is prefixed rrs-.
   Uses the guest page tokens (style.css) with fallbacks, so it also works on its own. */
.rrs {
  --rrs-live: #ed4245;
  --rrs-green: #23a55a;
  --rrs-panel: #111214;
  --rrs-tile: #232428;
  --rrs-btn: #2b2d31;
  --rrs-text: var(--text, #f2f2fa);
  --rrs-dim: var(--dim, #9a9ab8);
  --rrs-mint: var(--mint, #5df2c8);
  --rrs-accent: var(--accent, #8b5cf6);
  display: block;
}
.rrs [hidden] { display: none !important; }
.rrs-card, .rrs-bar { display: none; }
.rrs[data-view="card"] .rrs-card { display: block; }
.rrs[data-view="bar"] .rrs-bar { display: flex; }
.rrs button { font: inherit; -webkit-tap-highlight-color: transparent; }
.rrs button:focus-visible { outline: 3px solid rgba(139, 92, 246, .7); outline-offset: 2px; }

/* "The studio stopped sharing" */
.rrs-toast {
  margin: 0 0 12px; padding: 11px 14px; border-radius: 14px; font-weight: 700; font-size: 15px;
  color: var(--rrs-text); background: rgba(237, 66, 69, .1); border: 1px solid rgba(237, 66, 69, .35);
}

/* compact bar: the singer hid the screen */
.rrs-bar {
  align-items: center; gap: 12px; margin: 0 0 12px; padding: 8px 8px 8px 12px; border-radius: 16px;
  background: var(--card, #161625); border: 1px solid var(--line, #262640);
}
.rrs-bar-ico { width: 38px; height: 38px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: rgba(237, 66, 69, .14); color: #ff8e90; }
.rrs-bar-ico svg { width: 20px; height: 20px; fill: currentColor; }
.rrs-bar-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.rrs-bar-text b { font-size: 15px; font-weight: 800; }
.rrs-bar-text small { font-size: 13px; color: var(--rrs-dim); font-weight: 600; }
.rrs-pill {
  min-height: 44px; padding: 10px 16px; border-radius: 999px; border: 0; cursor: pointer; white-space: nowrap;
  font-size: 15px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--rrs-accent), #6d28d9);
}
.rrs-pill:active { transform: scale(.97); }

/* the card (inline, top of the session view) */
.rrs-card {
  margin: 0 0 12px; border-radius: 18px; overflow: hidden; background: var(--card, #161625);
  border: 1px solid rgba(237, 66, 69, .45); box-shadow: 0 10px 30px rgba(0, 0, 0, .35), 0 0 0 1px rgba(237, 66, 69, .1);
}
.rrs-stage { position: relative; background: #000; }
.rrs-view { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; cursor: zoom-in; touch-action: manipulation; }
.rrs-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }

.rrs-wait {
  position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 16px; text-align: center; color: var(--rrs-text); font-weight: 700; font-size: 15px;
  background: radial-gradient(320px 160px at 50% 45%, rgba(139, 92, 246, .22), transparent 70%), #08080e;
}
.rrs-wait.rrs-over { background: rgba(0, 0, 0, .55); }
.rrs-spin { width: 30px; height: 30px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .2); border-top-color: #fff; animation: rrs-spin .9s linear infinite; }
.rrs-wait:has(.rrs-pill:not([hidden])) .rrs-spin { display: none; }
@keyframes rrs-spin { to { transform: rotate(360deg); } }

/* top bar: LIVE - Studio's screen - delay - full screen */
.rrs-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: center; gap: 8px;
  padding: 8px 8px 18px 10px; background: linear-gradient(rgba(0, 0, 0, .72), rgba(0, 0, 0, 0));
  pointer-events: none; transition: opacity .35s;
}
.rrs-top button { pointer-events: auto; }
.rrs-live {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px 3px 6px; border-radius: 5px; flex: none;
  background: var(--rrs-live); color: #fff; font-size: 11px; font-weight: 900; letter-spacing: 1px; line-height: 1.2;
}
.rrs-live i { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: rrs-blink 1.4s ease-in-out infinite; }
@keyframes rrs-blink { 50% { opacity: .25; } }
.rrs-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; font-size: 14px; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
.rrs-delay { flex: none; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .5); color: #e6e6f2; font-size: 12px; font-weight: 700; white-space: nowrap; }
.rrs-grow { flex: 1; }
.rrs-icon {
  width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #fff; background: rgba(0, 0, 0, .55);
}
.rrs-icon svg { width: 22px; height: 22px; fill: currentColor; }
.rrs-go-small, .rrs-go-set { display: none; }
.rrs-full .rrs-go-set { display: flex; }
.rrs-go-set[aria-pressed="true"] { background: var(--rrs-accent); }

/* recording + count-in over the picture */
.rrs-rec {
  position: absolute; left: 10px; bottom: 10px; z-index: 3; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px; border-radius: 999px; background: var(--rrs-live); color: #fff;
  font-size: 12px; font-weight: 900; letter-spacing: 1.2px; box-shadow: 0 4px 16px rgba(237, 66, 69, .5); pointer-events: none;
}
.rrs-rec i { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: rrs-blink .9s ease-in-out infinite; }
.rrs-count { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 10px; background: rgba(0, 0, 0, .35); pointer-events: none; }
.rrs-count b { font-size: 84px; line-height: 1; font-weight: 900; color: var(--red, #f43f5e); text-shadow: 0 0 40px rgba(244, 63, 94, .7), 0 2px 0 #000; }
.rrs-count small { align-self: flex-end; margin-bottom: 14%; font-size: 16px; font-weight: 700; color: #ddd; }
.rrs-count.rrs-tick b { animation: rrs-pop .25s ease-out; }
@keyframes rrs-pop { from { transform: scale(1.35); } to { transform: scale(1); } }

.rrs-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 4px 2px 14px; font-size: 13px; font-weight: 600; color: var(--rrs-dim); }
.rrs-link {
  min-height: 44px; padding: 8px 10px; border: 0; background: none; cursor: pointer; white-space: nowrap;
  color: var(--rrs-dim); font-weight: 800; text-decoration: underline; text-underline-offset: 3px;
}

/* participant tiles + control bar: full screen only */
.rrs-people, .rrs-ctrls, .rrs-rotate { display: none; }

/* ======================================================== full screen */
html.rrs-lock, html.rrs-lock body { overflow: hidden !important; overscroll-behavior: none; }
.rrs-stage.rrs-full {
  position: fixed; inset: 0; z-index: 2147483000; width: 100%; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; background: #000; color: #fff;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.rrs-stage.rrs-full::backdrop { background: #000; }
.rrs-full .rrs-view { flex: none; width: 100%; cursor: default; order: 1; }
.rrs-full .rrs-go-full { display: none; }
.rrs-full .rrs-go-small { display: flex; }
.rrs-full .rrs-top { position: relative; flex: none; padding: 10px 10px 10px 14px; background: none; pointer-events: auto; order: 0; }
.rrs-full .rrs-title { font-size: 16px; }
.rrs-full .rrs-delay { font-size: 13px; }
.rrs-full .rrs-rec { left: 50%; transform: translateX(-50%); top: 10px; bottom: auto; }
.rrs-full .rrs-count b { font-size: 120px; }

.rrs-full .rrs-rotate {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex: none; align-self: center;
  margin: 12px 16px 0; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .08); order: 2;
  color: #e6e6f2; font-size: 13px; font-weight: 700; text-align: center;
}
.rrs-full .rrs-rotate[hidden] { display: none !important; }
.rrs-rotate svg { width: 24px; height: 24px; flex: none; }

/* portrait: picture on top, the two tiles, the control bar at the bottom */
.rrs-full .rrs-people {
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 200px); align-content: center;
  gap: 10px; flex: 1; min-height: 0; padding: 12px 12px 10px; order: 3;
}
.rrs-tile {
  position: relative; display: flex; align-items: center; justify-content: center; height: 100%; min-height: 96px;
  border-radius: 16px; background: var(--rrs-tile); border: 2px solid transparent; transition: border-color .12s, box-shadow .12s, opacity .35s;
}
.rrs-tile[data-speaking="1"] { border-color: var(--rrs-green); box-shadow: 0 0 0 3px rgba(35, 165, 90, .22); }
.rrs-av {
  width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 900; color: #fff; background: linear-gradient(135deg, #8b5cf6, #5b21b6);
  transition: box-shadow .12s;
}
.rrs-tile[data-who="me"] .rrs-av { background: linear-gradient(135deg, #22d3ee, #0e7490); }
.rrs-tile[data-speaking="1"] .rrs-av { box-shadow: 0 0 0 3px var(--rrs-tile), 0 0 0 6px var(--rrs-green), 0 0 calc(10px + 24px * var(--lv, 1)) rgba(35, 165, 90, .6); }
.rrs-tile[data-who="me"][data-talking="1"] { border-color: var(--rrs-mint); }
.rrs-tile[data-who="me"][data-muted="1"] .rrs-av { opacity: .7; }
.rrs-name {
  position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 7px; background: rgba(0, 0, 0, .6); font-size: 13px; font-weight: 700; color: #fff;
}
.rrs-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrs-muted { display: inline-flex; flex: none; color: var(--rrs-live); }
.rrs-muted svg { width: 15px; height: 15px; fill: currentColor; }
.rrs-name .cut { stroke: #141416; }

.rrs-full .rrs-ctrls {
  display: flex; justify-content: center; align-items: flex-start; gap: 8px; flex: none;
  padding: 12px 10px max(14px, env(safe-area-inset-bottom)); background: var(--rrs-panel); transition: opacity .35s; order: 4;
}
.rrs-ctl {
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 68px; padding: 0; border: 0; background: none;
  color: #dbdee1; font-size: 12px; font-weight: 700; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
}
.rrs-ctl-ico {
  width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--rrs-btn); color: #fff; transition: background .15s, box-shadow .15s, transform .08s;
}
.rrs-ctl-ico svg { width: 26px; height: 26px; fill: currentColor; }
.rrs-ctl:active .rrs-ctl-ico { transform: scale(.94); }
.rrs-ctl[data-act="mute"] .rrs-ico-off { display: none; }
.rrs-ctl[data-act="mute"][aria-pressed="true"] .rrs-ico-on { display: none; }
.rrs-ctl[data-act="mute"][aria-pressed="true"] .rrs-ico-off { display: flex; background: var(--rrs-live); }
.rrs-ctl .cut { stroke: var(--rrs-live); }
.rrs-ctl-talk .rrs-ctl-ico { background: rgba(93, 242, 200, .14); color: var(--rrs-mint); box-shadow: inset 0 0 0 2px rgba(93, 242, 200, .55); }
.rrs-ctl-talk[aria-pressed="true"] .rrs-ctl-ico { background: var(--rrs-mint); color: #03251c; box-shadow: 0 0 0 5px rgba(93, 242, 200, .25), 0 0 26px rgba(93, 242, 200, .6); }
.rrs-ctl-talk[aria-pressed="true"] small { color: var(--rrs-mint); }
.rrs-ctl-talk:disabled { opacity: .4; cursor: default; }
.rrs-ctl[data-act="hear"][aria-pressed="true"] .rrs-ctl-ico { background: var(--rrs-accent); }
.rrs-ctl-exit .rrs-ctl-ico { background: #3a3c42; }

/* settings sheet: the guest's own sound, reachable while watching the screen (full screen only) */
.rrs-set { display: none; }
.rrs-full .rrs-set:not([hidden]) {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 6;
  width: min(440px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 8px;
  padding: 12px 16px 14px; border-radius: 18px; background: var(--rrs-panel);
  box-shadow: 0 -10px 34px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06);
}
.rrs-full.rrs-idle .rrs-set { display: none; } /* hides with the controls; comes back when they tap */
.rrs-set-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.rrs-set-head b { font-size: 15px; font-weight: 900; color: #fff; }
.rrs-set-row { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; }
.rrs-set-ico { width: 24px; height: 24px; flex: none; color: #9aa0a6; }
.rrs-set-ico svg { width: 22px; height: 22px; fill: currentColor; }
.rrs-set-lbl { flex: 0 0 44px; font-weight: 800; font-size: 14px; color: #e6e6f2; }
.rrs-set-lbl-wide { flex: 0 0 auto; }
.rrs-set-row input[type="range"] { flex: 1; min-width: 0; height: 40px; margin: 0; accent-color: var(--rrs-accent); }
.rrs-set-row b { flex: 0 0 44px; text-align: right; font-size: 13px; color: #c7cace; font-variant-numeric: tabular-nums; }
.rrs-set-end { flex: none; font-size: 12px; color: #9aa0a6; font-weight: 700; }
.rrs-set-note { margin: 4px 0 0; font-size: 12px; color: #9aa0a6; line-height: 1.3; }

/* landscape: the picture fills the screen, everything else floats over it and hides after 3 s (tap to show) */
@media (orientation: landscape) {
  .rrs-full .rrs-view { position: absolute; inset: 0; width: auto; height: auto; aspect-ratio: auto; }
  .rrs-full .rrs-top {
    position: absolute; top: 0; left: 0; right: 0; z-index: 4;
    padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 28px max(14px, env(safe-area-inset-left));
    background: linear-gradient(rgba(0, 0, 0, .78), rgba(0, 0, 0, 0));
  }
  .rrs-full .rrs-rec { top: 62px; transition: top .35s; }
  .rrs-full .rrs-count b { font-size: min(36vh, 180px); }
  .rrs-full .rrs-rotate { display: none !important; }
  .rrs-full .rrs-people {
    position: absolute; z-index: 4; right: max(12px, env(safe-area-inset-right)); top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; gap: 10px; padding: 0; flex: none;
  }
  .rrs-full .rrs-tile { width: 92px; height: 86px; min-height: 0; border-radius: 14px; background: rgba(35, 36, 40, .9); }
  .rrs-full .rrs-av { width: 44px; height: 44px; font-size: 19px; margin-bottom: 20px; }
  .rrs-full .rrs-name { left: 5px; right: 5px; bottom: 5px; justify-content: center; padding: 2px 5px; font-size: 11px; }
  .rrs-full .rrs-ctrls {
    position: absolute; z-index: 4; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%);
    gap: 10px; padding: 9px 14px; border-radius: 999px; background: rgba(17, 18, 20, .9);
  }
  .rrs-full .rrs-ctl { min-width: 0; }
  .rrs-full .rrs-ctl small { display: none; }
  .rrs-full .rrs-ctl-talk .rrs-ctl-ico { width: 60px; height: 60px; margin: -2px 0; }
  .rrs-full.rrs-idle .rrs-top, .rrs-full.rrs-idle .rrs-ctrls { opacity: 0; pointer-events: none; }
  .rrs-full.rrs-idle .rrs-people { pointer-events: none; }
  .rrs-full.rrs-idle .rrs-tile:not([data-speaking="1"]) { opacity: 0; }
  .rrs-full.rrs-idle .rrs-rec { top: max(12px, env(safe-area-inset-top)); }
}

@media (max-width: 360px) {
  .rrs-ctl { min-width: 60px; }
  .rrs-ctl-ico { width: 52px; height: 52px; }
  .rrs-title { font-size: 13px; }
}
