/* ============================================================
   ARENA — Motion
   Fundo vivo, vidro fosco, movimento que responde ao que acontece.
   Cores com significado: violeta→ciano = ação · coral = ao vivo · menta = falando
   ============================================================ */

@font-face { font-family: "Sora"; font-weight: 400; font-display: swap; src: url("/fonts/sora-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Sora"; font-weight: 600; font-display: swap; src: url("/fonts/sora-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Sora"; font-weight: 700; font-display: swap; src: url("/fonts/sora-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 400; font-display: swap; src: url("/fonts/manrope-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 500; font-display: swap; src: url("/fonts/manrope-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 600; font-display: swap; src: url("/fonts/manrope-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 700; font-display: swap; src: url("/fonts/manrope-latin-700-normal.woff2") format("woff2"); }

:root {
  /* base */
  --bg: #07080d;
  --glass: rgba(14, 15, 24, .62);
  --glass-2: rgba(255, 255, 255, .05);
  --glass-3: rgba(255, 255, 255, .09);
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .16);
  --text: #f3f4fa;
  --muted: #9aa0b8;
  --dim: #6b7089;
  /* sinais */
  --g1: #7c5cff;           /* violeta */
  --g2: #22d3ee;           /* ciano */
  --g3: #ff4d9a;           /* rosa (só no fundo) */
  --accent: #7c5cff;
  --accent-2: #9a82ff;
  --g-mid: #5b8cff;         /* azul do meio do degradê */
  --grad: linear-gradient(110deg, var(--g1), var(--g-mid) 55%, var(--g2));
  /* as mesmas cores para rgba(): a marca troca todas (ver /marca.css, gerado pelo servidor) */
  --accent-rgb: 124, 92, 255;
  --g2-rgb: 34, 211, 238;
  --marca-h: 255;
  --live: #ff4d6d;
  --live-2: #ff7a59;
  --talk: #3ef0b0;
  --warn: #ffb547;
  /* forma e movimento */
  --r: 14px;
  --r-lg: 20px;
  --pill: 999px;
  --sidebar: 272px;
  --display: "Sora", system-ui, sans-serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font: 500 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 20px; }
p { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: #ff8fa3; font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::selection { background: rgba(var(--accent-rgb), .45); }
:focus-visible { outline: 2px solid var(--g2); outline-offset: 2px; }

/* ---------- fundo vivo: auroras que andam devagar ---------- */
body::before {
  content: none; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(28% 32% at 20% 30%, var(--g1), transparent 70%),
    radial-gradient(24% 28% at 80% 20%, var(--g2), transparent 70%),
    radial-gradient(26% 30% at 60% 85%, var(--g3), transparent 70%);
  filter: blur(70px) saturate(1.2);
  opacity: .55;
  will-change: transform;
  animation: aurora 24s var(--ease) infinite alternate;
}
@keyframes aurora {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  50% { transform: translate3d(4%, -3%, 0) rotate(8deg) scale(1.08); }
  100% { transform: translate3d(-4%, 3%, 0) rotate(-6deg) scale(1); }
}
body[data-bg="aurora"]::before, body:not([data-bg])::before { content: ""; }
/* na sala o vídeo é o protagonista: fundo mais discreto */
body:has(#screen-room:not([hidden]))::before { opacity: .32; animation-duration: 40s; }

/* ---------- marca ---------- */
.wordmark {
  display: inline-block;
  font: 700 38px/1 var(--display); letter-spacing: -.03em;
  background: linear-gradient(90deg, #fff 0%, var(--g2) 25%, var(--g1) 50%, #fff 75%);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 9s linear infinite;
}
.wordmark.small { font-size: 18px; letter-spacing: -.02em; }
.wm-chev { display: none; }
@keyframes shimmer { to { background-position: -300% 0; } }

/* ---------- campos e botões ---------- */
label { display: grid; gap: 7px; font-size: 13px; color: var(--muted); font-weight: 600; }
input, select {
  width: 100%; font: 500 15px/1.2 var(--body); color: var(--text);
  background: var(--glass-2); border: 0; border-radius: 12px; padding: 13px 14px;
  box-shadow: inset 0 0 0 1px var(--line);
  outline: none; transition: box-shadow .25s, background .25s;
}
input:hover, select:hover { box-shadow: inset 0 0 0 1px var(--line-2); }
input:focus-visible, select:focus-visible { box-shadow: inset 0 0 0 1px var(--g2), 0 0 0 4px rgba(var(--g2-rgb), .15); }
input::placeholder { color: var(--dim); }
select { cursor: pointer; }
select option { background: #12131c; color: var(--text); }

.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 15px/1 var(--display); letter-spacing: -.01em;
  color: var(--text); background: var(--glass-3);
  border: 0; border-radius: var(--pill); padding: 13px 20px; cursor: pointer;
  transition: transform .35s var(--spring), background .25s, box-shadow .25s, color .2s;
}
.btn:hover { background: rgba(255, 255, 255, .13); transform: translateY(-2px); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 8px 30px rgba(var(--accent-rgb), .35); }
.btn.primary:hover { box-shadow: 0 12px 38px rgba(var(--accent-rgb), .5); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.ghost:hover { background: var(--glass-2); }
.btn.small { padding: 9px 14px; font-size: 13px; }
.btn.link { background: none; padding: 4px 0; color: var(--g2); font: 600 13px/1 var(--body); overflow: visible; }
.btn.link:hover { color: #7ee8f8; transform: none; text-decoration: underline; }

/* brilho que atravessa o botão principal de tempos em tempos */
.btn.primary::after, .ctl.primary::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .42) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: shine 5s var(--ease) infinite;
}
@keyframes shine { 0%, 62% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }

/* ---------- telas ---------- */
.screen { min-height: 100dvh; }
.screen:not([hidden]) { animation: screenIn .6s var(--ease) both; }
@keyframes screenIn { from { transform: scale(.985); } to { transform: none; } }
.center { display: grid; place-items: center; padding: 24px 16px; }
.panel {
  width: 100%;
  background: var(--glass); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-radius: var(--r-lg);
  box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(0, 0, 0, .45);
  padding: 32px;
}
/* itens do login e do lobby entram em sequência */
.login > *, .lobby > * { animation: rise .7s var(--ease) both; }
.login > :nth-child(2), .lobby > :nth-child(2) { animation-delay: .06s; }
.login > :nth-child(3), .lobby > :nth-child(3) { animation-delay: .12s; }
.login > :nth-child(4), .lobby > :nth-child(4) { animation-delay: .18s; }
.login > :nth-child(5), .lobby > :nth-child(5) { animation-delay: .24s; }
.login > :nth-child(n+6), .lobby > :nth-child(n+6) { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* login */
.login { max-width: 410px; display: grid; gap: 18px; }
.login .lede { color: var(--muted); margin: -6px 0 4px; }
.login .btn.primary { margin-top: 4px; padding: 15px; font-size: 16px; }

/* lobby */
.lobby { max-width: 580px; display: grid; gap: 18px; }
.lobby-head { display: flex; justify-content: space-between; align-items: center; }
.room-list { list-style: none; margin: 0; padding: 2px; display: grid; gap: 8px; max-height: 46dvh; overflow: auto; }
.room-list li { animation: rise .5s var(--ease) both; }
.room-list li:nth-child(2) { animation-delay: .07s; }
.room-list li:nth-child(3) { animation-delay: .14s; }
.room-list li:nth-child(n+4) { animation-delay: .2s; }
.room-list.quiet li { animation: none; } /* atualização sozinha da lista: sem a entrada animada a cada 5 s */
.room-list button {
  width: 100%; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; align-items: center;
  background: var(--glass-2); color: var(--text); border: 0; border-radius: 16px;
  padding: 15px 18px; font: inherit;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .4s var(--spring), background .25s, box-shadow .25s;
}
.room-list button:hover { transform: translateY(-2px); background: var(--glass-3); box-shadow: inset 0 0 0 1px var(--line-2), 0 14px 34px rgba(0, 0, 0, .3); }
.r-name { font: 600 17px/1.2 var(--display); }
.r-people { grid-column: 1; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-people .on-air { color: var(--text); }
.r-people .on-air::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 5px 1px 1px; border-radius: 50%; background: var(--live); box-shadow: 0 0 8px var(--live); }
.r-meta { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 10px; align-items: center; }
.r-count { display: inline-flex; gap: 5px; align-items: center; color: var(--muted); font: 600 14px/1 var(--display); }
.r-count svg { width: 16px; height: 16px; fill: currentColor; }
.r-live {
  position: relative; border-radius: var(--pill);
  background: linear-gradient(110deg, var(--live), var(--live-2)); color: #fff;
  font: 700 11px/1 var(--display); letter-spacing: .04em; padding: 6px 9px;
}
.r-live::after { content: ""; position: absolute; inset: 0; border-radius: inherit; animation: ring 1.8s ease-out infinite; }
.room-list .empty { color: var(--muted); padding: 22px 6px; text-align: center; }
.new-room { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.lobby-foot { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); padding-top: 16px; }

/* ============================================================
   SALA
   ============================================================ */
.room {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  grid-template-rows: auto 1fr;
  height: 100dvh; overflow: hidden;
}
.room.users-hidden { grid-template-columns: 1fr; }
.room.users-hidden .sidebar { display: none; }
.topbar, .sidebar, .controls { background: rgba(10, 11, 18, .55); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }

/* cabeçalho */
.topbar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--line); min-width: 0;
}
.topbar .crumb { color: var(--dim); font: 600 15px/1 var(--display); }
.topbar h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* alguém está gravando a sala (o aviso vem dos programas nativos, que gravam) */
.rec-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--pill); white-space: nowrap;
  background: rgba(255, 77, 109, .14); box-shadow: inset 0 0 0 1px rgba(255, 77, 109, .5); color: var(--live); font: 600 12.5px/1 var(--body);
}
.rec-badge[hidden] { display: none; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
.conn { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; margin-left: 4px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; animation: blink 1.2s ease-in-out infinite; }
.dot.ok { background: var(--talk); box-shadow: 0 0 10px rgba(62, 240, 176, .6); animation: none; }
.dot.bad { background: var(--live); animation: none; }
@keyframes blink { 50% { opacity: .35; } }
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.people svg { width: 17px; height: 17px; fill: currentColor; }
#people-count { font: 600 14px/1 var(--display); min-width: 1ch; }
.room:not(.users-hidden) .people { box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .7); color: #c9bcff; background: rgba(var(--accent-rgb), .12); }

/* lista lateral */
.sidebar { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.side-title { font-size: 12px; color: var(--muted); font-weight: 600; padding: 16px 18px 8px; letter-spacing: .02em; }
.side-hint { color: var(--dim); font-size: 12px; padding: 10px 18px 16px; }
.participants { list-style: none; margin: 0; padding: 4px 10px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.p {
  position: relative; border-radius: 14px;
  display: grid; grid-template-columns: 34px 1fr auto; grid-template-areas: "av name badges" "vol vol vol";
  gap: 0 11px; align-items: center;
  padding: 8px 10px; cursor: default;
  transition: background .25s;
}
.p.enter { animation: slideIn .5s var(--spring) both; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
.p:not(.me) { cursor: pointer; }
.p:hover, .p.open { background: var(--glass-2); }
.p .av {
  grid-area: av; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font: 700 14px/1 var(--display); color: #0b0c14;
  transition: box-shadow .2s;
  position: relative; overflow: hidden; isolation: isolate;
}
/* faixa de luz atravessando o avatar; o atraso por posição faz a luz descer pela lista */
.p .av::after {
  content: ""; position: absolute; inset: -30%; pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, .8) 50%, transparent 62%);
  transform: translateX(-110%);
  animation: avSweep 4.5s cubic-bezier(.45, 0, .25, 1) infinite;
  animation-delay: calc(var(--i, 0) * .18s);
}
@keyframes avSweep {
  0% { transform: translateX(-110%); }
  26%, 100% { transform: translateX(110%); }
}
.p.speaking .av { box-shadow: 0 0 0 3px var(--talk), 0 0 14px 5px rgba(62, 240, 176, .26); }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 2px var(--talk), 0 0 0 6px rgba(62, 240, 176, .14); }
  50% { box-shadow: 0 0 0 3px var(--talk), 0 0 18px 8px rgba(62, 240, 176, .3); }
}
.p .name { grid-area: name; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p.me .name::after { content: " · você"; color: var(--muted); font-weight: 500; }
.p .badges { grid-area: badges; display: flex; gap: 6px; align-items: center; }
.badge { font: 700 11px/1 var(--display); letter-spacing: .03em; padding: 6px 9px; border: 0; border-radius: var(--pill); }
.badge.live {
  position: relative; cursor: pointer;
  background: linear-gradient(110deg, var(--live), var(--live-2)); color: #fff;
  transition: transform .3s var(--spring), filter .2s;
}
.badge.live::after { content: ""; position: absolute; inset: 0; border-radius: inherit; animation: ring 1.8s ease-out infinite; }
.badge.live:hover { transform: scale(1.06); filter: brightness(1.1); }
.badge.watch.active { background: #fff; color: var(--live); }
.badge.watch.active::after { animation: none; }
@keyframes ring { 0% { transform: scale(1); opacity: .9; } 80%, 100% { transform: scale(1.18, 1.6); opacity: 0; } }
.r-live::after, .badge.live::after { box-shadow: 0 0 0 2px rgba(255, 77, 109, .55); }
.badge.muted { background: none; padding: 0; color: #ff8fa3; display: inline-flex; }
.badge.muted svg { width: 17px; height: 17px; fill: currentColor; }
.p .vol { grid-area: vol; display: none; align-items: center; gap: 10px; padding: 10px 2px 2px; }
.p.open .vol { display: flex; animation: rise .35s var(--ease) both; }
.p .vol input { padding: 0; height: 4px; accent-color: var(--g1); box-shadow: none; background: transparent; }
.p .vol span { font: 600 12px/1 var(--display); color: var(--muted); min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

.scrim { display: none; }

/* área principal */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }

/* barra de seleção */
.streams { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px 14px 2px; align-items: center; }
.sgroup { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
.sgroup .scroller { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; padding: 9px 4px; margin: -5px 0; }
.sgroup .scroller::-webkit-scrollbar { display: none; }
.streams-title { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip {
  --h: var(--marca-h);
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; flex: none;
  font: 600 13px/1 var(--display); color: var(--text);
  background: hsl(var(--h) 80% 60% / .1); border: 0; border-radius: var(--pill); padding: 8px 13px; cursor: pointer;
  box-shadow: inset 0 0 0 1px hsl(var(--h) 85% 68% / .32);
  transition: transform .35s var(--spring), background .25s, color .2s, box-shadow .25s;
}
.chip svg { color: hsl(var(--h) 90% 74%); }
/* faixa de luz colorida passando pelos botões, da esquerda para a direita */
.chip::after {
  content: ""; position: absolute; inset: 0 -40%; z-index: -1; pointer-events: none;
  background: linear-gradient(110deg, transparent 36%, hsl(var(--h) 100% 82% / .6) 50%, transparent 64%);
  transform: translateX(-100%);
  animation: chipSweep 5s cubic-bezier(.45, 0, .25, 1) infinite;
  animation-delay: var(--sweep-delay, 0s);
}
@keyframes chipSweep {
  0% { transform: translateX(-100%); }
  22%, 100% { transform: translateX(100%); }
}
.chip:hover { background: hsl(var(--h) 80% 60% / .2); box-shadow: inset 0 0 0 1px hsl(var(--h) 90% 70% / .6); transform: translateY(-2px); }
.chip:active { transform: scale(.95); }
.chip.active {
  color: #0b0c14;
  background: linear-gradient(110deg, hsl(var(--h) 90% 70%), hsl(calc(var(--h) + 45) 90% 68%));
  box-shadow: 0 2px 9px hsl(var(--h) 90% 60% / .45);
}
.chip.active svg { color: #0b0c14; }
.chip.active::after { background: linear-gradient(110deg, transparent 36%, rgba(255, 255, 255, .75) 50%, transparent 64%); }
.chip .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 8px var(--live); }
.chip.layout { padding: 6px 13px 6px 8px; }
.chip.layout svg { width: 26px; height: 17px; flex: none; }
.chip.layout svg rect { fill: currentColor; opacity: .8; }
.chip.layout svg .ghost { fill: none; stroke: currentColor; stroke-width: 1.2; stroke-dasharray: 2 1.5; opacity: .7; }
.chip.pipall svg { width: 16px; height: 16px; fill: currentColor; }

/* palco */
.stage {
  flex: 1; min-height: 0;
  display: grid; gap: 12px; padding: 12px 14px;
  grid-template-columns: 1fr; grid-auto-rows: minmax(0, 1fr);
}
.stage[data-count="2"], .stage[data-count="3"], .stage[data-count="4"] { grid-template-columns: 1fr 1fr; }
.stage[data-count="5"], .stage[data-count="6"] { grid-template-columns: 1fr 1fr 1fr; }

.stage-empty {
  grid-column: 1 / -1; align-self: center; justify-self: center;
  display: grid; justify-items: center; gap: 10px; text-align: center; padding: 24px; max-width: 470px;
}
.stage-empty > * { animation: rise .7s var(--ease) both; }
.stage-empty > :nth-child(2) { animation-delay: .08s; }
.stage-empty > :nth-child(3) { animation-delay: .16s; }
.stage-empty > :nth-child(4) { animation-delay: .24s; }
.empty-mark { /* anel em gradiente girando */
  width: 64px; height: 64px; margin-bottom: 8px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--g1), var(--g2), var(--g3), var(--g1));
  -webkit-mask: radial-gradient(circle, transparent 26px, #000 27px);
  mask: radial-gradient(circle, transparent 26px, #000 27px);
  animation: spin 6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-title { font: 600 24px/1.2 var(--display); letter-spacing: -.02em; }
.empty-sub { color: var(--muted); }
.stage-empty .btn { margin-top: 10px; }

/* quadros de transmissão */
.tile {
  --ar: 1.7778;
  position: relative; min-height: 0; min-width: 0;
  container-type: size;
  display: grid; place-items: center;
}
.tile.enter { animation: tileIn .7s var(--spring) both; }
@keyframes tileIn { from { opacity: 0; transform: translateY(18px) scale(.94); } to { opacity: 1; transform: none; } }
.tile .frame {
  position: relative; container-type: size;
  width: min(100cqw, calc(100cqh * var(--ar)));
  height: min(100cqh, calc(100cqw / var(--ar)));
  background: #000; border-radius: 16px;
  box-shadow: 0 0 0 1px var(--line), 0 20px 50px rgba(0, 0, 0, .45);
  transition: transform .45s var(--spring), box-shadow .35s;
}
.tile:hover .frame { transform: translateY(-3px) scale(1.008); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .6), 0 30px 70px rgba(var(--accent-rgb), .25); }
.tile.rotated .frame { width: min(100cqw, calc(100cqh / var(--ar))); height: min(100cqh, calc(100cqw * var(--ar))); }
.tile.fill .frame {
  /* preencher sem exagero: corta no máximo ~10% das bordas; se o espaço for mais diferente
     que isso do formato do vídeo, o resto fica como faixa (não decepa a imagem) */
  width: min(100cqw, calc(100cqh * var(--ar) * 1.12));
  height: min(100cqh, calc(100cqw / var(--ar) * 1.12));
}
.tile.rotated.fill .frame { width: min(100cqw, calc(100cqh / var(--ar) * 1.12)); height: min(100cqh, calc(100cqw * var(--ar) * 1.12)); }
.tile video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; border-radius: inherit; }
.tile.fill video { object-fit: cover; }
.tile.rotated video {
  position: absolute; top: 50%; left: 50%;
  width: 100cqh; height: 100cqw;
  transform: translate(var(--zx, 0px), var(--zy, 0px)) translate(-50%, -50%) rotate(90deg) scale(var(--z, 1));
}

/* nome da transmissão (pílula de vidro com ponto pulsando) */
.tile .label {
  position: absolute; left: 12px; bottom: 12px; z-index: 3; max-width: calc(100% - 24px);
  display: flex; align-items: center; gap: 8px;
  background: rgba(7, 8, 13, .55); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-radius: var(--pill); padding: 7px 13px 7px 26px;
  font: 700 13px/1 var(--body);
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  white-space: nowrap; overflow: hidden;
}
.tile .label::before {
  content: ""; position: absolute; left: 11px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px;
  border-radius: 50%; background: var(--live);
  animation: livePulse 1.8s ease-out infinite;
}
.tile.self .label::before { background: var(--muted); animation: none; }
@keyframes livePulse { 50% { opacity: .35; } }
.tile .label .grip { color: var(--dim); font-size: 11px; letter-spacing: -1px; }
.tile .label .live-dot { display: none; }
.tile .label .aud { font-size: 12px; line-height: 1; }
.tile.has-audio .label .aud::before { content: "🔊"; }
.tile.no-audio .label .aud::before { content: "🔇"; opacity: .7; }
.stage.single .tile .label { cursor: default; }
.stage.single .tile .label .grip { display: none; }

/* ações do quadro (aparecem deslizando) */
.tile-actions {
  position: absolute; right: 12px; top: 12px; z-index: 3;
  display: flex; gap: 5px;
  opacity: 0; transform: translateY(-6px);
  transition: opacity .25s, transform .35s var(--spring);
}
.tile:hover .tile-actions, .tile:focus-within .tile-actions, .tile:fullscreen .tile-actions, .tile.pseudo-fs .tile-actions { opacity: 1; transform: none; }
.tile-actions .act {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px;
  background: rgba(7, 8, 13, .55); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  color: var(--text); border: 0; cursor: pointer;
  transition: transform .3s var(--spring), background .2s;
}
.tile-actions .act:hover { background: rgba(var(--accent-rgb), .55); transform: translateY(-2px); }
.tile-actions .act svg { width: 18px; height: 18px; fill: currentColor; }
.tile.rotated .act.vert, .tile.fill .act.fillbtn { background: var(--accent); }
.stage[data-layout="auto"] .act.unslot { display: none; }

/* volume do som da transmissão */
.tile .stream-vol {
  position: absolute; right: 12px; bottom: 12px; z-index: 3;
  display: flex; align-items: center; gap: 8px;
  background: rgba(7, 8, 13, .55); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-radius: var(--pill); padding: 4px 12px 4px 4px;
  opacity: 0; transform: translateY(6px);
  transition: opacity .25s, transform .35s var(--spring);
}
.tile .stream-vol .act { background: transparent; color: var(--text); border: 0; cursor: pointer; font-size: 15px; padding: 4px 6px; }
.tile .stream-vol input { width: 90px; height: 4px; padding: 0; background: transparent; accent-color: var(--g2); box-shadow: none; }
.tile.has-audio:hover .stream-vol, .tile.has-audio:focus-within .stream-vol, .tile.has-audio:fullscreen .stream-vol, .tile.has-audio.pseudo-fs .stream-vol { opacity: 1; transform: none; }
.tile.no-audio .stream-vol { display: none; }
/* quadro pequeno: só o essencial */
@container (max-width: 440px) {
  .tile .stream-vol input { display: none; }
  .tile .stream-vol { padding-right: 4px; }
  .tile-actions .act { width: 30px; height: 30px; border-radius: 9px; }
  .tile .label { font-size: 12px; padding: 6px 11px 6px 24px; left: 8px; bottom: 8px; }
}
@media (hover: none) {
  .tile-actions, .tile.has-audio .stream-vol { opacity: .92; transform: none; }
}

/* tela cheia: real (:fullscreen) ou por CSS (.pseudo-fs — iPhone) */
.tile:fullscreen, .tile.pseudo-fs { background: #000; }
.tile:fullscreen .frame, .tile.pseudo-fs .frame { border-radius: 0; box-shadow: none; transform: none; }
.tile.pseudo-fs { position: fixed; inset: 0; z-index: 100; }
.tile:fullscreen .label, .tile.pseudo-fs .label { bottom: max(12px, env(safe-area-inset-bottom)); }

/* janela flutuante */
.tile .pip-note {
  position: absolute; inset: 0; z-index: 4; display: none;
  place-items: center; text-align: center; padding: 16px;
  background: rgba(7, 8, 13, .9); color: var(--text);
  font: 600 15px/1.4 var(--display); border: 0; cursor: pointer;
}
.tile.in-pip .pip-note { display: grid; }
.tile.in-pip .tile-actions { display: none; }

/* prévia própria oculta */
.stage.hide-self .tile.self { display: none; }

/* arrastar */
.stage.reordering, .stage.reordering * { cursor: grabbing !important; }
.tile.dragging .frame { opacity: .55; transform: scale(.97); }
.tile.drop-target .frame { box-shadow: 0 0 0 2px var(--g2), 0 0 30px rgba(var(--g2-rgb), .35); }

/* quadrantes fixos */
.stage[data-layout="1"]   { grid-template-columns: 1fr; grid-template-rows: 1fr; grid-template-areas: "s0"; }
.stage[data-layout="2"]   { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; grid-template-areas: "s0 s1"; }
.stage[data-layout="2v"]  { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; grid-template-areas: "s0" "s1"; }
.stage[data-layout="4"]   { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; grid-template-areas: "s0 s1" "s2 s3"; }
.stage[data-layout="1+2"] { grid-template-columns: 1fr 1fr; grid-template-rows: 3fr 2fr; grid-template-areas: "s0 s0" "s1 s2"; }
.stage[data-layout="1+3"] { grid-template-columns: 3fr 1fr; grid-template-rows: 1fr 1fr 1fr; grid-template-areas: "s0 s1" "s0 s2" "s0 s3"; }
.stage[data-layout="3"]   { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr; grid-template-areas: "s0 s1 s2"; }
.stage[data-layout="3v"]  { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr 1fr; grid-template-areas: "s0" "s1" "s2"; }
.stage[data-layout="1+2s"] { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; grid-template-areas: "s0 s1" "s0 s2"; }
.stage[data-layout="1+3b"] { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 3fr 1fr; grid-template-areas: "s0 s0 s0" "s1 s2 s3"; }
/* tela + miniatura(s): o principal ocupa tudo e os pequenos flutuam nos cantos de baixo */
.stage[data-layout="pip"], .stage[data-layout="pip2"] { grid-template-columns: 1fr; grid-template-rows: 1fr; grid-template-areas: "s0"; }
.stage[data-layout^="pip"] > [data-slot="1"], .stage[data-layout^="pip"] > [data-slot="2"] {
  grid-area: 1 / 1 / -1 / -1 !important; align-self: end; z-index: 4;
  width: clamp(170px, 24%, 460px); height: auto; aspect-ratio: var(--ar, 1.7778); margin: 14px;
}
.stage[data-layout^="pip"] > .tile[data-slot="1"] .frame, .stage[data-layout^="pip"] > .tile[data-slot="2"] .frame { box-shadow: 0 0 0 1px rgba(255, 255, 255, .14), 0 18px 50px rgba(0, 0, 0, .65); }
.stage[data-layout^="pip"] > .slot-empty[data-slot="1"], .stage[data-layout^="pip"] > .slot-empty[data-slot="2"] { aspect-ratio: auto; min-height: 150px; background-color: rgba(16, 17, 28, .85); backdrop-filter: blur(10px); }
.stage[data-layout^="pip"] > [data-slot="1"] { justify-self: end; }
.stage[data-layout^="pip"] > [data-slot="2"] { justify-self: start; }
/* os controles do principal saem de baixo das miniaturas */
.stage[data-layout^="pip"] > .tile[data-slot="0"] .stream-vol { right: auto; left: 50%; transform: translate(-50%, 6px); }
.stage[data-layout^="pip"] > .tile[data-slot="0"].has-audio:hover .stream-vol { transform: translate(-50%, 0); }
.stage[data-layout="pip2"] > .tile[data-slot="0"] .label { bottom: auto; top: 12px; }
.chip.layout svg .mini { fill: currentColor; stroke: #0b0c14; stroke-width: 1; opacity: 1; }
.tile.unslotted { display: none; }
.slot-empty {
  min-width: 0; min-height: 0;
  display: grid; place-content: center; justify-items: center; gap: 12px;
  padding: 14px; text-align: center; color: var(--muted);
  background: rgba(255, 255, 255, .025); border-radius: 18px;
  box-shadow: inset 0 0 0 1px var(--line);
  background-image: radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 18px 18px;
  animation: rise .5s var(--ease) both;
}
.slot-empty p { font: 600 14px/1.3 var(--display); }
.slot-empty .sel { max-width: 100%; width: auto; }
.slot-empty.drop-target { box-shadow: inset 0 0 0 2px var(--g2); background-color: rgba(var(--g2-rgb), .06); }

/* ---------- barra de controles ---------- */
.controls {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  padding: 12px 16px; border-top: 1px solid var(--line);
}
.ctl-group { display: flex; align-items: center; gap: 8px; }
.ctl-group.exit { justify-content: flex-end; }
.ctl {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 14px/1 var(--display);
  color: var(--text); background: var(--glass-2);
  border: 0; border-radius: var(--pill); padding: 11px 16px; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .35s var(--spring), background .25s, color .2s, box-shadow .25s;
}
.ctl:hover { background: var(--glass-3); transform: translateY(-2px); }
.ctl:active { transform: scale(.95); }
.ctl:disabled { opacity: .6; cursor: progress; transform: none; }
.ctl .ico { width: 20px; height: 20px; fill: currentColor; flex: none; }
.ctl .ico.off { display: none; }
.ctl kbd { font: 600 11px/1 var(--display); color: var(--dim); padding: 3px 6px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--line-2); }
/* desligado (mic mudo, silenciado) = alerta */
.ctl.off { background: rgba(255, 77, 109, .16); color: #ff8fa3; box-shadow: inset 0 0 0 1px rgba(255, 77, 109, .35); }
.ctl.off .ico.on { display: none; }
.ctl.off .ico.off { display: block; }
/* prévia escondida = neutro, não é erro */
#preview.off { background: var(--glass-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }

/* ação principal: transmitir (+ ⚙ grudado) */
.ctl.primary {
  background: var(--grad); color: #fff; padding: 13px 22px; font-size: 15px;
  border-radius: var(--pill) 0 0 var(--pill);
  box-shadow: 0 8px 30px rgba(var(--accent-rgb), .35);
}
.ctl.primary:hover { box-shadow: 0 12px 38px rgba(var(--accent-rgb), .5); }
.ctl.primary.on { background: linear-gradient(110deg, var(--live), var(--live-2)); box-shadow: 0 8px 30px rgba(255, 77, 109, .4); }
.ctl.primary.on::after { animation: none; }
.ctl.primary.on .ico.on { display: none; }
.ctl.primary.on .ico.off { display: block; }
.ctl.attach {
  margin-left: -8px; padding: 13px 14px 13px 12px; background: #5b6cff; color: #fff;
  border-radius: 0 var(--pill) var(--pill) 0; box-shadow: inset 1px 0 0 rgba(255, 255, 255, .2);
}
.ctl.attach:hover, .ctl.attach.active { background: #7383ff; }
.ctl.primary.on + .ctl.attach { background: #e23d5d; }
.share-group #preview { margin-left: 4px; }
/* câmera: uma transmissão a mais, com quadro próprio (ligada = vermelho, como o Parar) */
.share-group #cam { margin-left: 4px; }
#cam.on { background: linear-gradient(110deg, var(--live), var(--live-2)); color: #fff; box-shadow: 0 8px 30px rgba(255, 77, 109, .4); }
#cam.on .ico.on { display: none; }
#cam.on .ico.off { display: block; }
.cam-panel {
  position: absolute; bottom: calc(100% + 14px); left: 50%; transform: translateX(-50%);
  width: min(340px, calc(100vw - 32px)); z-index: 40;
  display: grid; gap: 8px; padding: 16px;
  background: rgba(16, 17, 28, .92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-radius: 20px; box-shadow: 0 0 0 1px var(--line-2), 0 24px 60px rgba(0, 0, 0, .55);
}
.cam-panel strong { font: 600 15px/1 var(--display); }
.cam-panel p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.cam-opt {
  text-align: left; border: 0; border-radius: 12px; padding: 11px 12px; cursor: pointer;
  background: var(--glass-2); color: var(--text); font: 600 13.5px/1.25 var(--display);
  box-shadow: inset 0 0 0 1px var(--line); transition: background .2s;
}
.cam-opt:hover { background: var(--glass-3); }
.cam-opt.last { box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .65); }
.cam-opt small { display: block; margin-top: 3px; font-weight: 500; font-size: 12px; color: var(--muted); }

.ctl.danger { background: transparent; color: #ff8fa3; box-shadow: inset 0 0 0 1px rgba(255, 77, 109, .4); }
.ctl.danger:hover { background: rgba(255, 77, 109, .14); }

/* painel de opções da transmissão (abre com mola) */
.share-group { position: relative; }
.share-panel {
  position: absolute; bottom: calc(100% + 14px); left: 50%; transform: translateX(-50%);
  width: min(390px, calc(100vw - 32px)); z-index: 40;
  display: grid; gap: 13px; padding: 18px;
  background: rgba(16, 17, 28, .9); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-radius: 20px; box-shadow: 0 0 0 1px var(--line-2), 0 24px 60px rgba(0, 0, 0, .55);
}
.share-panel:not([hidden]) { animation: popIn .4s var(--spring) both; }
@keyframes popIn { from { opacity: 0; transform: translate(-50%, 10px) scale(.95); } to { opacity: 1; transform: translate(-50%, 0); } }
.share-panel label { font-size: 12px; }
.share-panel .sel { width: 100%; }
.hw-box { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.hw-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 700; }
.hw-btn { font: inherit; font-size: 12px; font-weight: 700; color: var(--text); background: var(--glass-3); border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.hw-btn:hover:not(:disabled) { border-color: var(--accent); }
.hw-btn:disabled { opacity: .6; cursor: progress; }
.hw-result { font-size: 12px; line-height: 1.5; color: var(--muted); display: grid; gap: 2px; }
.hw-result b { color: var(--text); font-weight: 700; }
.hw-result .ok { color: var(--talk); } .hw-result .warn { color: var(--warn); }
.share-panel label.hw-auto { display: flex; align-items: center; gap: 8px; font-size: 12px; cursor: pointer; }
.share-panel p { line-height: 1.5; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 11px; }

/* avisos */
.banner {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 30;
  background: var(--grad); color: #fff; border: 0; border-radius: var(--pill);
  padding: 12px 20px; font: 600 14px/1 var(--display); cursor: pointer;
  box-shadow: 0 10px 30px rgba(var(--accent-rgb), .4);
  animation: drop .5s var(--spring) both;
}
@keyframes drop { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.banner.update { position: fixed; top: 14px; z-index: 60; background: linear-gradient(110deg, #22c993, var(--talk)); color: #062018; }
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 90;
  width: max-content; max-width: min(560px, calc(100vw - 32px));
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.toast[hidden] { display: none; }
.toast-item {
  background: rgba(16, 17, 28, .9); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  color: var(--text); border-radius: 16px; max-width: 100%; overflow-wrap: anywhere;
  box-shadow: 0 0 0 1px var(--line-2), 0 20px 50px rgba(0, 0, 0, .5);
  padding: 13px 18px; font-size: 14px; line-height: 1.45; text-align: center;
  animation: toastIn .5s var(--spring) both;
}
.toast-item.out { animation: toastOut .22s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px) scale(.97); } }

/* janela flutuante com várias transmissões (Document PiP) */
.pip-body { margin: 0; background: #000; height: 100vh; overflow: hidden; }
.pip-body::before { display: none; }
.pip-stage { height: 100vh; padding: 6px; gap: 6px; }
.pip-stage .tile { grid-area: auto !important; animation: none; }
.pip-stage .tile.unslotted { display: grid; }
.pip-stage .tile-actions, .pip-stage .stream-vol, .pip-stage .label .grip { display: none; }
.pip-stage .tile .label { cursor: default; }
.pip-stage .tile .frame { border-radius: 10px; }

/* ---------- telas menores ---------- */
/* com o botão da câmera, a barra cheia não cabe numa tela de 1280: as teclas e os nomes de Áudio,
   Sons e Sair saem primeiro (a mesma ordem do programa nativo) */
@media (max-width: 1440px) {
  .ctl kbd, #eq .lbl, #sb .lbl, .ctl.danger .lbl { display: none; }
}
@media (max-width: 1100px) {
  .ctl-group.voice .lbl, .ctl kbd, #preview .lbl, #cam .lbl, .ctl.danger .lbl { display: none; }
}
@media (max-width: 800px) {
  .room, .room.users-hidden { grid-template-columns: 1fr; }
  .topbar { padding: 8px 10px; gap: 8px; }
  .topbar .crumb { display: none; }
  .topbar .wordmark.small { display: none; }
  .conn #status { display: none; }
  #invite { display: none; }
  /* lista vira gaveta */
  .sidebar {
    position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: min(300px, 86vw);
    background: rgba(12, 13, 21, .92);
    box-shadow: 20px 0 40px rgba(0, 0, 0, .5);
    transform: translateX(0); transition: transform .4s var(--spring);
  }
  .room.users-hidden .sidebar { display: flex; transform: translateX(-105%); box-shadow: none; }
  .room:not(.users-hidden) .scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(0, 0, 0, .5); animation: fade .3s both; }
  .streams { padding: 8px 10px 0; gap: 6px; }
  .sgroup { width: 100%; }
  .stage { padding: 8px; gap: 8px; }
  .stage[data-count="2"], .stage[data-count="3"], .stage[data-count="4"],
  .stage[data-count="5"], .stage[data-count="6"] { grid-template-columns: 1fr; }
  .stage[data-layout="2"]   { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; grid-template-areas: "s0" "s1"; }
  .stage[data-layout="1+3"] { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 3fr 1fr; grid-template-areas: "s0 s0 s0" "s1 s2 s3"; }
  .stage[data-layout="3"]   { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr 1fr; grid-template-areas: "s0" "s1" "s2"; }
  .stage[data-layout="1+2s"] { grid-template-columns: 1fr 1fr; grid-template-rows: 2fr 1fr; grid-template-areas: "s0 s0" "s1 s2"; }
  .stage[data-layout^="pip"] > [data-slot="1"], .stage[data-layout^="pip"] > [data-slot="2"] { width: 38%; margin: 8px; }
  .controls { grid-template-columns: auto 1fr auto; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
  .ctl { padding: 11px 13px; }
  .ctl-group.share-group { justify-content: center; }
  .ctl.primary .lbl { display: none; }
  .ctl.primary { padding: 13px 18px; }
  .panel { padding: 24px 20px; }
  .wordmark { font-size: 32px; }
  /* celular: menos vidro e fundo parado para poupar bateria com vídeo rodando */
  body:has(#screen-room:not([hidden]))::before { animation: none; }
  .tile .label, .tile-actions .act, .tile .stream-vol { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(7, 8, 13, .78); }
}
@keyframes fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ============================================================
   FUNDOS (escolha do usuário)
   ============================================================ */
.bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
body:has(#screen-room:not([hidden])) .bg { opacity: .6; }

/* estrelas cadentes */
.bg .stars { position: absolute; left: 0; top: 0; width: 1px; height: 1px; border-radius: 50%; background: transparent; }
.bg .stars.s1 { animation: twinkle 4s ease-in-out infinite alternate; }
.bg .stars.s2 { width: 2px; height: 2px; animation: twinkle 6s ease-in-out infinite alternate-reverse; }
.bg .stars.s3 { width: 2px; height: 2px; animation: twinkle 9s ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: .35; } to { opacity: 1; } }
.bg .sky { position: absolute; inset: 0; background: radial-gradient(120% 80% at 50% 0%, #141a3a 0%, #07080d 60%); }
.bg .meteor {
  position: absolute; width: 160px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .95), rgba(160, 200, 255, .35) 40%, transparent);
  filter: drop-shadow(0 0 6px rgba(180, 210, 255, .8));
  transform-origin: left center; opacity: 0;
  animation: shoot var(--dur, 9s) linear var(--delay, 0s) infinite;
}
@keyframes shoot {
  /* cabeça brilhante à esquerda; anda para baixo-esquerda deixando o rastro para cima-direita */
  0% { opacity: 0; transform: rotate(var(--ang, -32deg)) translateX(0); }
  1.5% { opacity: 1; }
  10% { opacity: 0; transform: rotate(var(--ang, -32deg)) translateX(-720px); }
  100% { opacity: 0; transform: rotate(var(--ang, -32deg)) translateX(-720px); }
}

/* grade retrô */
.bg .sun {
  position: absolute; left: 50%; top: 18%; width: 340px; height: 340px; margin-left: -170px; border-radius: 50%;
  background: linear-gradient(180deg, #ffd36e 0%, #ff6aa8 55%, var(--accent) 100%);
  -webkit-mask: repeating-linear-gradient(180deg, #000 0 14px, transparent 14px 18px); mask: repeating-linear-gradient(180deg, #000 0 14px, transparent 14px 18px);
  filter: drop-shadow(0 0 60px rgba(255, 106, 168, .45)); opacity: .85;
}
.bg .horizon { position: absolute; left: 0; right: 0; top: 0; bottom: 45%; background: linear-gradient(180deg, #07080d 0%, #170c2e 70%, #2a0f3f 100%); }
.bg .grid {
  position: absolute; left: -50%; right: -50%; bottom: 0; height: 45%;
  background:
    linear-gradient(transparent 0 calc(100% - 2px), rgba(255, 77, 154, .55) calc(100% - 2px)) 0 0 / 100% 60px,
    linear-gradient(90deg, transparent 0 calc(100% - 2px), rgba(var(--accent-rgb), .55) calc(100% - 2px)) 0 0 / 60px 100%,
    linear-gradient(180deg, #2a0f3f, #07080d);
  transform: perspective(260px) rotateX(62deg); transform-origin: top center;
  animation: gridMove 2.4s linear infinite;
}
@keyframes gridMove { to { background-position: 0 60px, 0 0, 0 0; } }

/* luzes flutuantes */
.bg .orb {
  position: absolute; bottom: -20vh; border-radius: 50%;
  width: var(--s, 160px); height: var(--s, 160px); left: var(--x, 50%);
  background: radial-gradient(circle at 35% 35%, var(--c, var(--accent)), transparent 70%);
  filter: blur(18px); opacity: .5;
  animation: floatUp var(--dur, 26s) linear var(--delay, 0s) infinite;
}
@keyframes floatUp {
  0% { transform: translate3d(0, 0, 0); opacity: 0; }
  10% { opacity: .55; }
  50% { transform: translate3d(var(--dx, 40px), -70vh, 0); }
  90% { opacity: .45; }
  100% { transform: translate3d(calc(var(--dx, 40px) * -1), -140vh, 0); opacity: 0; }
}

/* liso */
.bg .plain { position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% -10%, #1a1d33 0%, #07080d 60%); }

/* no celular, dentro da sala: fundo parado (poupa bateria com vídeo rodando) */
@media (max-width: 800px) {
  body:has(#screen-room:not([hidden])) .bg * { animation-play-state: paused; }
}

/* seletor de fundo */
.bg-menu {
  position: fixed; z-index: 80; width: 260px; padding: 8px;
  background: rgba(16, 17, 28, .92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-radius: 18px; box-shadow: 0 0 0 1px var(--line-2), 0 24px 60px rgba(0, 0, 0, .55);
  display: grid; gap: 4px;
}
.bg-menu:not([hidden]) { animation: menuIn .35s var(--spring) both; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.96); } to { opacity: 1; transform: none; } }
.bg-menu .bg-title { font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 10px 4px; }
.bg-opt {
  display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: center; text-align: left;
  background: transparent; color: var(--text); border: 0; border-radius: 12px; padding: 6px; cursor: pointer;
  font: 600 14px/1.2 var(--body); transition: background .2s;
}
.bg-opt:hover { background: var(--glass-3); }
.bg-opt[aria-checked="true"] { background: rgba(var(--accent-rgb), .2); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .6); }
.bg-opt small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; margin-top: 2px; }
.bg-swatch { width: 54px; height: 36px; border-radius: 9px; box-shadow: inset 0 0 0 1px var(--line-2); }
.bg-swatch.aurora { background: radial-gradient(60% 70% at 20% 30%, var(--accent), transparent), radial-gradient(60% 70% at 85% 25%, var(--g2), transparent), radial-gradient(60% 70% at 60% 95%, #ff4d9a, transparent), #07080d; }
.bg-swatch.stars { background: radial-gradient(1px 1px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 20%, #fff, transparent), radial-gradient(1.5px 1.5px at 45% 70%, #fff, transparent), radial-gradient(1px 1px at 85% 65%, #fff, transparent), linear-gradient(152deg, transparent 40%, rgba(255,255,255,.8) 41%, transparent 47%), #0c1029; }
.bg-swatch.grid { background: linear-gradient(180deg, #170c2e 55%, transparent 55%), repeating-linear-gradient(90deg, transparent 0 7px, rgba(255,77,154,.7) 7px 8px), repeating-linear-gradient(180deg, #2a0f3f 0 5px, rgba(var(--accent-rgb),.7) 5px 6px); }
.bg-swatch.orbs { background: radial-gradient(30% 45% at 30% 60%, rgba(var(--accent-rgb),.9), transparent), radial-gradient(25% 40% at 70% 40%, rgba(var(--g2-rgb),.8), transparent), radial-gradient(20% 30% at 55% 85%, rgba(255,77,154,.8), transparent), #07080d; }
.bg-swatch.plain { background: radial-gradient(120% 90% at 50% -10%, #2a2e4a, #07080d 70%); }
.bg-btn svg { width: 16px; height: 16px; fill: currentColor; }
@media (max-width: 800px) { .bg-btn .lbl { display: none; } }
.foot-actions { display: inline-flex; gap: 6px; align-items: center; color: var(--dim); }

/* ============================================================
   FUNDOS EM FOTO (servidor ou do usuário) com movimento
   ============================================================ */
/* zoom e panorâmica lentos (efeito Ken Burns) */
.bg .kb { position: absolute; inset: -7%; background: center / cover no-repeat #07080d; opacity: 0; transition: opacity 1.2s ease; animation: kenBurns 48s ease-in-out infinite alternate; }
.bg .kb.ready { opacity: 1; }
@keyframes kenBurns {
  0% { transform: scale(1) translate(0, 0); }
  50% { transform: scale(1.08) translate(-2%, 1%); }
  100% { transform: scale(1.14) translate(2%, -1.5%); }
}
.bg .kb-shade { position: absolute; inset: 0; background: radial-gradient(120% 100% at 50% 40%, rgba(7, 8, 13, .12), rgba(7, 8, 13, .62)); }
/* brilhos (fofos) */
.bg .sparkle { position: absolute; width: 14px; height: 14px; background: #fff; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); filter: drop-shadow(0 0 6px rgba(255, 220, 255, .9)); animation: sparkle 2.6s ease-in-out var(--delay, 0s) infinite; }
@keyframes sparkle { 0%, 100% { transform: scale(.3) rotate(0); opacity: .15; } 50% { transform: scale(1) rotate(45deg); opacity: 1; } }
/* brasas (tático) */
.bg .ember { position: absolute; bottom: -4vh; left: var(--x, 50%); width: 4px; height: 4px; border-radius: 50%; background: #ffb347; box-shadow: 0 0 8px 2px rgba(255, 140, 50, .85); animation: emberUp var(--dur, 9s) linear var(--delay, 0s) infinite; }
@keyframes emberUp { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: 1; } 100% { transform: translate(var(--dx, 40px), -95vh) scale(.4); opacity: 0; } }
/* poeira (retrô) */
.bg .dust { position: absolute; left: 0; top: 0; width: 2px; height: 2px; border-radius: 50%; }
.bg .dust.d1 { animation: dustDrift 40s linear infinite; }
.bg .dust.d2 { width: 3px; height: 3px; animation: dustDrift 26s linear infinite; }
@keyframes dustDrift { from { transform: translateX(0); } to { transform: translateX(-100vw); } }

/* seletor com grupos */
.bg-menu { width: min(560px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow-y: auto; overscroll-behavior: contain; }
.bg-menu .bg-group { font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 10px 2px; }
.bg-menu .bg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
/* fotos: miniaturas grandes, 3 por linha */
.bg-menu .bg-grid.photos { grid-template-columns: repeat(3, 1fr); }
.bg-grid.photos .bg-opt { grid-template-columns: 1fr; gap: 6px; padding: 6px; font-size: 12.5px; }
.bg-grid.photos .bg-swatch { width: 100%; height: auto; aspect-ratio: 16 / 9; }
@media (max-width: 560px) { .bg-menu .bg-grid { grid-template-columns: 1fr; } .bg-menu .bg-grid.photos { grid-template-columns: 1fr 1fr; } }
.bg-swatch { background-position: center; background-size: cover; background-repeat: no-repeat; }
.bg-swatch.custom { background-color: #1b1d2e; background-image: repeating-linear-gradient(45deg, #1b1d2e 0 6px, #24273d 6px 12px); }
.bg-upload {
  grid-column: 1 / -1; border: 0; border-radius: 12px; padding: 10px 12px; cursor: pointer;
  font: 600 13px/1.2 var(--body); color: var(--text); background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--line-2);
  transition: background .2s;
}
.bg-upload:hover { background: var(--glass-3); }

/* ============================================================
   FUNDOS DESENHADOS — Espaço, Fofos, Tático
   ============================================================ */
.bg svg { display: block; width: 100%; height: auto; overflow: visible; }
.bg .sky.violet { background: radial-gradient(120% 90% at 60% 20%, #2a1650 0%, #110a26 55%, #06050f 100%); }
.bg .sky.sunset { background: linear-gradient(180deg, #2a1f55 0%, #6b4b9a 45%, #d97fae 80%, #f6b4a6 100%); }
.bg .sky.plum { background: radial-gradient(120% 90% at 50% 110%, #6a2f6e 0%, #2b1335 55%, #120818 100%); }
.bg .sky.desert-sky { background: linear-gradient(180deg, #1a1230 0%, #4a2340 38%, #b0543f 66%, #e8964f 82%, #f3b468 100%); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { from { transform: translateY(-1.5vmin); } to { transform: translateY(1.5vmin); } }
@keyframes cloudPass { from { transform: translateX(110vw); } to { transform: translateX(-70vw); } }

/* planeta com anéis */
.bg .saturn { position: absolute; left: 72%; top: 34%; width: min(78vmin, 900px); margin: calc(min(78vmin, 900px) * -.33) 0 0 calc(min(78vmin, 900px) * -.42); animation: saturnSway 22s ease-in-out infinite alternate; filter: drop-shadow(0 0 40px rgba(255, 170, 120, .25)); }
@keyframes saturnSway { from { transform: translateY(-1.5vmin) rotate(-3deg); } to { transform: translateY(1.5vmin) rotate(3deg); } }
.bg .mini-planet { position: absolute; border-radius: 50%; animation: bob 12s ease-in-out infinite alternate; }
.bg .mini-planet.a { left: 9%; top: 16%; width: 7vmin; height: 7vmin; background: radial-gradient(circle at 35% 30%, #a7f3d0, #10b981 60%, #064e3b); box-shadow: inset -1vmin -1vmin 2vmin rgba(0, 0, 0, .5); }
.bg .mini-planet.b { right: 8%; bottom: 12%; width: 4vmin; height: 4vmin; background: radial-gradient(circle at 35% 30%, #fbcfe8, #ec4899 60%, #701a45); animation-duration: 9s; }

/* hiperespaço */
.bg .warp-core { position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, rgba(160, 200, 255, .35) 0%, rgba(var(--accent-rgb), .18) 18%, #05060f 62%); }
.bg .streak {
  position: absolute; left: 50%; top: 50%; width: 14vmin; height: 2px; border-radius: 2px; transform-origin: 0 50%;
  background: linear-gradient(90deg, transparent, var(--c, #fff));
  animation: warpGo var(--dur, 2.4s) cubic-bezier(.55, 0, 1, .45) var(--delay, 0s) infinite;
}
@keyframes warpGo {
  0% { transform: rotate(var(--a)) translateX(2vmin) scaleX(.05); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: rotate(var(--a)) translateX(80vmax) scaleX(1.8); opacity: 1; }
}

/* nuvens fofas */
.bg .fcloud { position: absolute; left: 0; width: var(--s, 20vmin); opacity: var(--o, 1); animation: cloudPass var(--dur, 70s) linear var(--delay, 0s) infinite; filter: drop-shadow(0 6px 18px rgba(120, 60, 120, .25)); }
.bg .fcloud svg { animation: bob 3.5s ease-in-out infinite alternate; }

/* coraçõezinhos */
.bg .heart { position: absolute; bottom: -12vh; left: var(--x, 50%); width: var(--s, 40px); opacity: 0; animation: heartUp var(--dur, 18s) linear var(--delay, 0s) infinite; }
.bg .heart svg { animation: wobble 2.8s ease-in-out infinite alternate; filter: drop-shadow(0 0 10px rgba(255, 140, 190, .45)); }
@keyframes heartUp {
  0% { transform: translate3d(0, 0, 0); opacity: 0; }
  10% { opacity: var(--o, .8); }
  50% { transform: translate3d(var(--dx, 30px), -60vh, 0); }
  90% { opacity: var(--o, .8); }
  100% { transform: translate3d(calc(var(--dx, 30px) * -1), -125vh, 0); opacity: 0; }
}
@keyframes wobble { from { transform: rotate(-12deg) scale(.95); } to { transform: rotate(12deg) scale(1.05); } }

/* deserto tático */
.bg .desert-sun { position: absolute; left: 24%; top: 50%; width: 34vmin; height: 34vmin; margin-left: -17vmin; border-radius: 50%; background: radial-gradient(circle, #ffe2a8 0%, #ffb35c 45%, rgba(255, 140, 70, 0) 72%); filter: blur(2px); animation: bob 20s ease-in-out infinite alternate; }
.bg .haze { position: absolute; left: 0; right: 0; bottom: 18%; height: 30%; background: linear-gradient(180deg, transparent, rgba(255, 190, 120, .25), transparent); animation: haze 6s ease-in-out infinite alternate; }
@keyframes haze { from { transform: scaleY(1) translateY(0); opacity: .6; } to { transform: scaleY(1.2) translateY(-1vh); opacity: 1; } }
.bg .town { position: absolute; left: 0; right: 0; bottom: 0; }
.bg .town svg { width: 100%; height: 38vh; }

/* radar */
.bg .radar-bg { position: absolute; inset: 0; background: radial-gradient(100% 100% at 50% 50%, #08170d 0%, #030805 75%), #030805; }
.bg .radar-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(62, 240, 120, .05) 1px, transparent 1px) 0 0 / 44px 44px, linear-gradient(90deg, rgba(62, 240, 120, .05) 1px, transparent 1px) 0 0 / 44px 44px; }
.bg .radar { position: absolute; left: 50%; top: 50%; width: 92vmin; height: 92vmin; margin: -46vmin 0 0 -46vmin; border-radius: 50%; overflow: hidden; }
.bg .radar-rings { position: absolute; inset: 0; border-radius: 50%; background: repeating-radial-gradient(circle, transparent 0 calc(12.5% - 1px), rgba(62, 240, 120, .28) calc(12.5% - 1px) 12.5%), linear-gradient(rgba(62, 240, 120, .25), rgba(62, 240, 120, .25)) 50% 0 / 1px 100% no-repeat, linear-gradient(90deg, rgba(62, 240, 120, .25), rgba(62, 240, 120, .25)) 0 50% / 100% 1px no-repeat; box-shadow: inset 0 0 0 1px rgba(62, 240, 120, .35), inset 0 0 80px rgba(62, 240, 120, .12); }
.bg .radar-sweep { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, rgba(62, 240, 120, 0) 0deg, rgba(62, 240, 120, 0) 300deg, rgba(62, 240, 120, .4) 359deg, rgba(160, 255, 190, .8) 360deg); animation: spin 4s linear infinite; }
.bg .blip { position: absolute; width: 1.4vmin; height: 1.4vmin; margin: -.7vmin; border-radius: 50%; background: #b9ffcf; box-shadow: 0 0 12px 3px rgba(62, 240, 120, .8); opacity: 0; animation: blip 4s linear var(--delay, 0s) infinite; }
@keyframes blip { 0% { opacity: 1; transform: scale(1.3); } 60% { opacity: .15; transform: scale(1); } 100% { opacity: 0; } }

/* miniaturas */
.bg-swatch { position: relative; overflow: hidden; display: grid; place-items: center; }
.bg-swatch svg { width: 74%; height: auto; max-height: 90%; }
.bg-swatch.saturn { background: #170c30; }
.bg-swatch.warp { background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(190, 220, 255, .65) 0 2deg, transparent 2deg 18deg), radial-gradient(circle, #3a3f80, #05060f 70%); }
.bg-swatch.clouds { background: linear-gradient(180deg, #4a3880, #d97fae); }
.bg-swatch.clouds svg { width: 64%; }
.bg-swatch.hearts { background: radial-gradient(circle at 50% 110%, #6a2f6e, #120818 80%); }
.bg-swatch.hearts svg { width: 34%; }
.bg-swatch.desert { background: linear-gradient(180deg, #4a2340 0%, #b0543f 50%, #f3b468 64%, #2a1820 65%); }
.bg-swatch.radar { background: conic-gradient(from 0deg at 50% 50%, transparent 0 300deg, rgba(62, 240, 120, .7) 360deg), repeating-radial-gradient(circle at 50% 50%, transparent 0 6px, rgba(62, 240, 120, .4) 6px 7px), #030805; }

/* ============================================================
   BORDAS DOS QUADROS (escolha em "Borda")
   ============================================================ */
@property --bang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.stage[data-border="none"] .tile .frame, .stage[data-border="none"] .tile:hover .frame { border-radius: 0; box-shadow: none; }
.stage[data-border="none"] .tile:hover .frame { transform: none; }
.stage[data-border="thin"] .tile .frame { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .55), 0 16px 40px rgba(0, 0, 0, .45); }
.stage[data-border="thin"] .tile:hover .frame { box-shadow: 0 0 0 1.5px #fff, 0 24px 60px rgba(0, 0, 0, .5); }
.stage[data-border="neon"] .tile .frame { box-shadow: 0 0 0 2px var(--g2), 0 0 18px rgba(var(--g2-rgb), .55), 0 0 50px rgba(var(--g2-rgb), .22); }
.stage[data-border="neon"] .tile:hover .frame { box-shadow: 0 0 0 2px #7ff0ff, 0 0 26px rgba(var(--g2-rgb), .75), 0 0 70px rgba(var(--g2-rgb), .3); }
.stage[data-border="person"] .tile .frame { box-shadow: 0 0 0 2px hsl(var(--ph, 255) 80% 62% / .9), 0 0 22px hsl(var(--ph, 255) 85% 60% / .3), 0 18px 44px rgba(0, 0, 0, .45); }
.stage[data-border="person"] .tile:hover .frame { box-shadow: 0 0 0 2px hsl(var(--ph, 255) 90% 70%), 0 0 30px hsl(var(--ph, 255) 85% 60% / .45), 0 24px 60px rgba(0, 0, 0, .5); }
.stage[data-border="person"] .tile.speaking .frame { box-shadow: 0 0 0 4px hsl(var(--ph, 255) 92% 69%), 0 0 40px hsl(var(--ph, 255) 92% 61% / .65); }
@keyframes talkGlow {
  0%, 100% { box-shadow: 0 0 0 3px hsl(var(--ph, 255) 90% 66%), 0 0 26px hsl(var(--ph, 255) 90% 60% / .5); }
  50% { box-shadow: 0 0 0 4px hsl(var(--ph, 255) 95% 72%), 0 0 54px hsl(var(--ph, 255) 95% 62% / .8); }
}
.stage[data-border="rainbow"] .tile .frame, .stage[data-border="rainbow"] .tile:hover .frame { box-shadow: 0 0 30px rgba(var(--accent-rgb), .35), 0 18px 44px rgba(0, 0, 0, .45); }
.stage[data-border="rainbow"] .tile .frame::before {
  content: ""; position: absolute; inset: -3px; border-radius: 19px; z-index: -1;
  background: conic-gradient(from var(--bang), var(--accent), var(--g2), #3ef0b0, #ffd166, #ff4d9a, var(--accent));
  animation: borderSpin 4s linear infinite;
}
@keyframes borderSpin { to { --bang: 360deg; } }
.tile:fullscreen .frame::before, .tile.pseudo-fs .frame::before { display: none; }
/* bolinha de exemplo nos botões */
.chip .border-dot { width: 14px; height: 14px; border-radius: 4px; flex: none; background: #0b0c14; }
.chip .border-dot.b-soft { box-shadow: 0 0 0 1px rgba(255, 255, 255, .25), 0 2px 6px rgba(0, 0, 0, .6); }
.chip .border-dot.b-none { border-radius: 0; background: #2a2d40; }
.chip .border-dot.b-thin { box-shadow: 0 0 0 1.5px #fff; }
.chip .border-dot.b-neon { box-shadow: 0 0 0 2px var(--g2), 0 0 8px var(--g2); }
.chip .border-dot.b-person { box-shadow: 0 0 0 2px #ff6fb0, 0 0 8px rgba(255, 111, 176, .7); }
.chip .border-dot.b-rainbow { background: conic-gradient(var(--accent), var(--g2), #3ef0b0, #ffd166, #ff4d9a, var(--accent)); box-shadow: inset 0 0 0 3px #0b0c14; }

/* ============================================================
   BARRA DE OPÇÕES RECOLHÍVEL
   ============================================================ */
.bar-fold {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px; flex: none;
  border: 0; border-radius: var(--pill); padding: 7px 12px 7px 9px; cursor: pointer;
  font: 600 12.5px/1 var(--display); color: var(--muted); background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--line);
  transition: color .2s, background .2s;
}
.bar-fold svg { width: 15px; height: 15px; transform: rotate(-90deg); }
.bar-fold:hover { color: var(--text); background: var(--glass-3); }
/* recolhida: só um resumo flutuando no canto, por cima do palco */
.streams.collapsed { position: absolute; z-index: 6; top: 10px; left: 14px; padding: 0; pointer-events: none; }
.streams.collapsed > * { pointer-events: auto; }
.bar-pill {
  display: inline-flex; align-items: center; gap: 10px; max-width: min(520px, calc(100vw - 40px));
  border: 0; border-radius: var(--pill); padding: 7px 10px 7px 9px; cursor: pointer;
  font: 600 13px/1 var(--display); color: var(--text);
  background: rgba(16, 17, 28, .78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .45), 0 10px 30px rgba(0, 0, 0, .45);
  animation: pillIn .45s var(--spring) both;
  transition: transform .3s var(--spring), box-shadow .25s;
}
@keyframes pillIn { from { opacity: 0; transform: translateX(-14px) scale(.96); } to { opacity: 1; transform: none; } }
.bar-pill:hover { transform: translateX(3px); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .8), 0 12px 34px rgba(var(--accent-rgb), .3); }
.bar-pill > svg { width: 26px; height: 17px; flex: none; color: hsl(var(--marca-h) 90% 74%); }
.bar-pill > svg rect { fill: currentColor; opacity: .85; }
.bar-pill > svg .ghost { fill: none; stroke: currentColor; stroke-width: 1.2; stroke-dasharray: 2 1.5; }
.bar-pill .bp-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* setas andando para a direita = "clique para abrir" */
.bp-arrows { display: inline-flex; flex: none; color: var(--g2); margin-left: 2px; }
.bp-arrows svg { width: 15px; height: 15px; margin-left: -7px; animation: arrowNudge 1.2s ease-in-out infinite; }
.bp-arrows svg:first-child { margin-left: 0; opacity: .45; animation-delay: -.15s; }
@keyframes arrowNudge { 0%, 100% { transform: translateX(0); opacity: .35; } 50% { transform: translateX(5px); opacity: 1; } }
.bp-arrows svg:first-child { animation-name: arrowNudgeA; }
@keyframes arrowNudgeA { 0%, 100% { transform: translateX(0); opacity: .2; } 50% { transform: translateX(5px); opacity: .6; } }

/* cada linha da barra recolhe: só a opção escolhida + seta andando */
.sgroup.folded .chip:not(.active):not(.keep) { display: none; }
.streams-title.clickable { cursor: pointer; user-select: none; }
.streams-title.clickable:hover { color: var(--text); }
.fold-arrow {
  flex: none; display: inline-grid; place-items: center; width: 34px; height: 30px; align-self: center;
  border: 0; border-radius: var(--pill); cursor: pointer; color: var(--g2);
  background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--line);
  transition: background .2s, transform .3s var(--spring);
}
.fold-arrow:hover { background: var(--glass-3); transform: translateX(2px); }
.fold-arrow > svg { width: 15px; height: 15px; transform: rotate(180deg); color: var(--muted); }
.fold-arrow .bp-arrows { margin: 0; }
.sgroup.unfolding .chip { animation: chipIn .4s var(--spring) both; animation-delay: calc(var(--k, 0) * 28ms); }
@keyframes chipIn { from { opacity: 0; transform: translateX(-12px) scale(.94); } to { opacity: 1; transform: none; } }

/* ============================================================
   EQUALIZADOR
   ============================================================ */
.ctl-group.voice { position: relative; }
#eq.tuned { color: var(--g2); box-shadow: inset 0 0 0 1px rgba(var(--g2-rgb), .45); }
#eq.active { background: var(--glass-3); }
.eq-panel {
  position: absolute; bottom: calc(100% + 14px); left: 0; z-index: 40;
  width: min(400px, calc(100vw - 24px)); display: grid; gap: 14px; padding: 16px 16px 14px;
  background: rgba(16, 17, 28, .92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-radius: 20px; box-shadow: 0 0 0 1px var(--line-2), 0 24px 60px rgba(0, 0, 0, .55);
}
.eq-panel:not([hidden]) { animation: eqIn .4s var(--spring) both; }
@keyframes eqIn { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
.eq-head strong { font: 600 15px/1 var(--display); }
.eq-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: rgba(255, 255, 255, .04); }
.eq-tabs button { border: 0; border-radius: 10px; padding: 9px 6px; cursor: pointer; background: transparent; color: var(--muted); font: 600 12.5px/1 var(--display); transition: background .2s, color .2s; }
.eq-tabs button[aria-selected="true"] { background: var(--glass-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.eq-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.eq-preset { border: 0; border-radius: var(--pill); padding: 8px 12px; cursor: pointer; font: 600 12.5px/1 var(--display); color: var(--text); background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--line); transition: transform .3s var(--spring), background .2s; }
.eq-preset:hover { transform: translateY(-1px); background: var(--glass-3); }
.eq-preset.active { color: #0b0c14; background: linear-gradient(110deg, var(--accent), var(--g2)); box-shadow: 0 2px 10px rgba(var(--g2-rgb), .35); }
.eq-preset.custom { cursor: default; background: linear-gradient(110deg, #ff4d9a, #ffb347); }
.eq-bands { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 10px 4px 8px; border-radius: 14px; background: rgba(255, 255, 255, .03); box-shadow: inset 0 0 0 1px var(--line); }
.eq-band { display: grid; justify-items: center; gap: 8px; }
.eq-val { font: 600 12px/1 var(--display); color: var(--text); font-variant-numeric: tabular-nums; min-width: 3ch; text-align: center; }
.eq-hz { font: 600 11px/1 var(--display); color: var(--muted); }
.eq-band input[type="range"] {
  writing-mode: vertical-lr; direction: rtl; width: 28px; height: 120px; padding: 0; margin: 0;
  background: transparent; box-shadow: none; accent-color: var(--g2); cursor: pointer;
}
.eq-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.eq-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }
.eq-switch input { width: 18px; height: 18px; accent-color: var(--g2); flex: none; padding: 0; box-shadow: none; }
.eq-switch span { display: grid; gap: 2px; }
.eq-switch small { color: var(--muted); font-size: 12px; }
.eq-mic { display: grid; gap: 12px; }
.eq-note { color: var(--muted); font-size: 12.5px; line-height: 1.45; border-top: 1px solid var(--line); padding-top: 10px; }
@media (max-width: 800px) { .eq-panel { position: fixed; left: 12px; right: 12px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* ============================================================
   ENQUADRAMENTO: recorte do vídeo + zoom
   ============================================================ */
.tile .vwrap { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; background: #000; touch-action: none; }
.tile video { transform-origin: 50% 50%; transform: translate(var(--zx, 0px), var(--zy, 0px)) scale(var(--z, 1)); }
.tile.zoomed .vwrap { cursor: grab; }
.tile.zoomed .vwrap:active { cursor: grabbing; }
.zoom-badge {
  position: absolute; left: 12px; top: 12px; z-index: 3; border: 0; cursor: pointer;
  font: 600 12px/1 var(--display); color: var(--text); padding: 7px 11px; border-radius: var(--pill);
  background: rgba(7, 8, 13, .6); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 0 0 1px rgba(var(--g2-rgb), .5);
  animation: pillIn .35s var(--spring) both;
}
.zoom-badge:hover { background: rgba(var(--g2-rgb), .25); }
.stage[data-layout="pip2"] > .tile[data-slot="0"] .zoom-badge { top: 52px; }

/* ============================================================
   SONS (soundboard)
   ============================================================ */
.sb-panel { width: min(440px, calc(100vw - 24px)); }
.sb-head { display: flex; align-items: baseline; justify-content: space-between; }
.sb-head strong { font: 600 15px/1 var(--display); }
.sb-count { font: 600 12px/1 var(--display); color: var(--muted); }
.sb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; max-height: 46vh; overflow-y: auto; padding: 10px; margin: -8px; }
.sb-cell { position: relative; }
.sb-btn {
  --h: var(--marca-h);
  width: 100%; display: grid; justify-items: center; gap: 6px; padding: 12px 8px 10px; border: 0; cursor: pointer;
  border-radius: 14px; color: var(--text); font: 600 12.5px/1.15 var(--display);
  background: linear-gradient(160deg, hsl(var(--h) 70% 55% / .22), hsl(calc(var(--h) + 40) 70% 50% / .1));
  box-shadow: inset 0 0 0 1px hsl(var(--h) 80% 70% / .35);
  transition: transform .3s var(--spring), box-shadow .2s;
}
.sb-btn:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px hsl(var(--h) 85% 72% / .7), 0 8px 22px hsl(var(--h) 80% 55% / .25); }
.sb-btn:active { transform: scale(.94); }
.sb-btn.hit { animation: sbHit .5s var(--spring); }
@keyframes sbHit { 0% { transform: scale(.9); box-shadow: 0 0 0 0 hsl(var(--h) 90% 65% / .8); } 100% { transform: none; box-shadow: 0 0 0 14px hsl(var(--h) 90% 65% / 0); } }
.sb-emoji { font-size: 24px; line-height: 1; }
.sb-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-del {
  position: absolute; top: 4px; right: 4px; border: 0; cursor: pointer; border-radius: var(--pill);
  min-width: 22px; height: 22px; padding: 0 6px; font: 700 12px/1 var(--display);
  color: var(--muted); background: rgba(7, 8, 13, .6); opacity: 0; transition: opacity .2s, background .2s;
}
.sb-cell:hover .sb-del, .sb-del:focus-visible, .sb-del.confirm { opacity: 1; }
.sb-del:hover { color: #fff; background: rgba(255, 77, 109, .6); }
.sb-del.confirm { color: #fff; background: #e23d5d; }
@media (hover: none) { .sb-del { opacity: .8; } }
.sb-empty { grid-column: 1 / -1; color: var(--muted); font-size: 13px; line-height: 1.5; padding: 8px 2px; }
.sb-add { justify-self: start; }
.sb-form { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .03); box-shadow: inset 0 0 0 1px var(--line); }
.sb-file { display: block; cursor: pointer; }
.sb-file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.sb-file span { display: block; padding: 11px 12px; border-radius: 12px; font-size: 13px; color: var(--text); background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--line-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-file:hover span { background: var(--glass-3); }
.sb-row { display: flex; gap: 8px; }
.sb-row.end { justify-content: flex-end; }
.sb-emo { width: 56px; text-align: center; font-size: 18px; }
.sb-nm { flex: 1; min-width: 0; }
.sb-msg { font-size: 12.5px; color: var(--muted); min-height: 1em; }
.sb-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sb-vol { display: inline-flex; align-items: center; gap: 8px; }
.sb-vol input { width: 120px; height: 4px; padding: 0; background: transparent; box-shadow: none; accent-color: var(--g2); }

/* formato do quadro: fixo sobrepõe o formato vindo da transmissão (--ar no próprio quadro) */
.stage[data-frame="16x9"] .tile { --ar: 1.7778 !important; }
.stage[data-frame="4x3"] .tile { --ar: 1.3333 !important; }
.stage[data-frame="21x9"] .tile { --ar: 2.3333 !important; }
.stage[data-frame="9x16"] .tile { --ar: .5625 !important; }
.chip .frame-ico { flex: none; height: 12px; border-radius: 2px; box-shadow: inset 0 0 0 1.6px currentColor; }
.chip .frame-ico.f-auto { width: 16px; box-shadow: none; border: 1.6px dashed currentColor; }
.chip .frame-ico.f-16x9 { width: 21px; }
.chip .frame-ico.f-4x3 { width: 16px; }
.chip .frame-ico.f-21x9 { width: 28px; }
.chip .frame-ico.f-9x16 { width: 8px; height: 14px; }

/* enquanto VOCÊ transmite: nada de animação decorativa (sobra placa de vídeo para o jogo) */
body.streaming::before, body.streaming .bg, body.streaming .bg *,
body.streaming .chip::after, body.streaming .p .av::after, body.streaming .bp-arrows svg { animation-play-state: paused !important; }
body.streaming .bg { opacity: .35; }
body.streaming .chip::after, body.streaming .p .av::after { display: none; }

/* lembrar neste aparelho */
.remember { display: flex; align-items: center; gap: 10px; flex-direction: row; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.remember input { width: 18px; height: 18px; padding: 0; box-shadow: none; accent-color: var(--accent); flex: none; }
.remembered { font-size: 13px; color: var(--talk); line-height: 1.5; margin: 0; }
.remembered .btn.link { color: var(--muted); }
/* sala fixa */
.room-list li.pinned > button { box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .45), 0 8px 26px rgba(var(--accent-rgb), .14); }
.r-pin { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 6px; vertical-align: -3px; color: #a58bff; }
.r-pin svg { width: 15px; height: 15px; fill: currentColor; }

/* explosão ao abrir a sala */
.boom-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 9999; pointer-events: none; }
#screen-room.shake { animation: shake .45s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px); }
  20%, 80% { transform: translate(4px, -2px); }
  30%, 50%, 70% { transform: translate(-6px, 3px); }
  40%, 60% { transform: translate(6px, -3px); }
}
.bg-fx { display: grid; gap: 8px; margin: 10px 6px 4px; padding-top: 10px; border-top: 1px solid var(--line); }
.bg-fx-title { font-size: 12px; font-weight: 700; color: var(--muted); }
.bg-fx-row { display: flex; flex-wrap: wrap; gap: 6px; }
#screen-room.shake-hard { animation: shakeHard .7s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shakeHard {
  8% { transform: translate(-10px, 6px) rotate(-.4deg); }
  16% { transform: translate(12px, -8px) rotate(.4deg); }
  26% { transform: translate(-9px, 5px); }
  38% { transform: translate(7px, -4px); }
  52% { transform: translate(-4px, 3px); }
  70% { transform: translate(2px, -1px); }
  100% { transform: none; }
}
@media (prefers-reduced-motion: reduce) { #screen-room.shake, #screen-room.shake-hard { animation: none; } }

/* ============================================================
   PWA + AJUSTE AO APARELHO  (html[data-dev|data-size|data-lite|data-standalone|data-orient])
   ============================================================ */
/* toque: sem atraso de clique duplo, sem flash azul, sem zoom ao focar campo no iPhone */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
button, .ctl, .chip, a { touch-action: manipulation; }
html[data-touch="1"] input, html[data-touch="1"] select, html[data-touch="1"] textarea { font-size: 16px; }
html[data-touch="1"] .controls, html[data-touch="1"] .streams, html[data-touch="1"] .topbar { -webkit-user-select: none; user-select: none; }
html[data-touch="1"] video { -webkit-touch-callout: none; }
html[data-inroom="1"], html[data-inroom="1"] body { overscroll-behavior: none; }
/* navegador antigo sem dvh: usa vh */
.room { height: 100vh; height: 100dvh; }
.screen { min-height: 100vh; min-height: 100dvh; }

/* entalhe / ilha / barra de gestos: nada fica embaixo deles */
.center {
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.topbar {
  padding-top: max(10px, env(safe-area-inset-top));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
.controls {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
@media (max-width: 800px) {
  .topbar { padding-top: max(8px, env(safe-area-inset-top)); padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .controls { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .sidebar { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); padding-left: env(safe-area-inset-left); }
  .lobby-foot { flex-wrap: wrap; gap: 8px 12px; }
}

/* app instalado: a barra de status do iPhone fica por cima do Arena (black-translucent) */
html[data-standalone="1"] body { background-color: #07080d; }

/* --- celulares pequenos (SE, Galaxy A0x, Moto E: lado menor < 360 px) --- */
html[data-size="xs"] .panel { padding: 20px 16px; border-radius: 20px; }
html[data-size="xs"] .wordmark { font-size: 28px; }
html[data-size="xs"] .lede { font-size: 14px; }
html[data-size="xs"] .room-list button { padding: 12px; }
.foot-actions { flex-wrap: wrap; }
.foot-actions .btn { white-space: nowrap; }

/* barra de controles do celular: os botões encolhem pela largura real para "Sair" nunca ficar fora da tela */
@media (max-width: 460px) {
  .controls { gap: 4px; }
  .ctl-group { gap: 4px; }
  .ctl { padding: 10px; }
  .ctl.primary { padding: 11px 13px; }
}
@media (max-width: 380px) {
  .ctl { padding: 9px 8px; }
  .ctl.primary { padding: 10px 10px; }
  .ctl .ico { width: 18px; height: 18px; }
  .controls { padding-left: max(6px, env(safe-area-inset-left)); padding-right: max(6px, env(safe-area-inset-right)); }
}
@media (max-width: 340px) {
  .ctl { padding: 8px 7px; }
  .ctl-group, .controls { gap: 2px; }
}

/* --- tablets: barra lateral fixa e botões com rótulo quando cabe --- */
@media (min-width: 801px) and (max-width: 1100px) {
  html[data-size="tablet"] .ctl { padding: 12px 15px; }
}

/* --- celular deitado na sala: tudo compacto para o vídeo ganhar altura --- */
@media (orientation: landscape) and (max-height: 520px) {
  .room .topbar { padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: 4px; gap: 6px; }
  .room .topbar h1 { font-size: 14px; }
  .room .topbar .btn, .room .topbar .ctl { padding-top: 6px; padding-bottom: 6px; }
  .room .streams { padding-top: 4px; padding-left: max(10px, env(safe-area-inset-left)); }
  .stage { padding: 4px max(4px, env(safe-area-inset-left)) 4px max(4px, env(safe-area-inset-right)); gap: 4px; }
  .stage[data-count="2"], .stage[data-count="3"], .stage[data-count="4"] { grid-template-columns: 1fr 1fr; }
  .controls { padding-top: 4px; padding-bottom: max(4px, env(safe-area-inset-bottom)); }
  .ctl { padding: 8px 11px; }
  .ctl .lbl, .ctl kbd { display: none; }
  .ctl.primary { padding: 9px 14px; }
}

/* --- modo leve: aparelho modesto ou escolha do usuário --- */
html[data-lite="1"] *, html[data-lite="1"] *::before, html[data-lite="1"] *::after { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
html[data-lite="1"] .topbar, html[data-lite="1"] .sidebar, html[data-lite="1"] .controls { background: rgba(10, 11, 18, .94); }
html[data-lite="1"] .panel, html[data-lite="1"] .bg-menu, html[data-lite="1"] .eq-panel, html[data-lite="1"] .sb-panel { background-color: rgba(14, 15, 24, .97); }
html[data-lite="1"] body::before, html[data-lite="1"] .bg, html[data-lite="1"] .bg *,
html[data-lite="1"] .bp-arrows svg { animation-play-state: paused !important; }
html[data-lite="1"] .chip::after, html[data-lite="1"] .p .av::after, html[data-lite="1"] .btn.primary::after { display: none; }
html[data-lite="1"] .screen:not([hidden]) { animation: none; }

/* --- cartão de instalar --- */
.install-card {
  display: grid; grid-template-columns: 40px 1fr auto auto; align-items: center; gap: 12px;
  margin-top: 14px; padding: 12px 10px 12px 12px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), .16), rgba(var(--g2-rgb), .1));
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .35);
}
.install-card[hidden] { display: none; }
.install-card img { width: 40px; height: 40px; border-radius: 10px; }
.install-txt { display: grid; gap: 2px; min-width: 0; font-size: 13px; color: var(--muted); line-height: 1.35; }
.install-txt strong { color: var(--text); font-size: 14px; }
.install-txt b { color: var(--text); font-weight: 600; }
.install-card .btn.primary { padding: 10px 16px; font-size: 14px; }
.install-card .btn[hidden] { display: none; }
.install-x { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.install-x:hover { background: var(--glass-2); color: var(--text); }
/* --- Arena para Windows (o programa nativo, servido em /nativo/) --- */
.native-card a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.native-note { grid-column: 1 / -1; margin: 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.native-note b { color: var(--text); font-weight: 600; }
.native-login { margin: 14px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.native-login[hidden] { display: none; }
.native-login a { color: var(--text); font-weight: 600; text-underline-offset: 3px; }
.ios-share { width: 17px; height: 17px; fill: var(--g2); vertical-align: -3px; }
@media (max-width: 420px) {
  .install-card { grid-template-columns: 40px 1fr auto; }
  .install-card .btn.primary { grid-column: 1 / -1; width: 100%; }
  .install-x { grid-row: 1; grid-column: 3; }
}

/* --- linha do aparelho --- */
.device-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 12px 0 0; font-size: 12px; color: var(--dim); }
.device-line[hidden] { display: none; }
.device-line .dl-lite { font-size: 12px; padding: 0; }

/* ============================================================
   MARCA (logo do panda) + FUNDO "Arena" em vídeo
   ============================================================ */
.wm-chev {
  display: inline-block; width: 1.15em; height: 1.15em; margin-right: .32em; vertical-align: -.2em;
  /* --marca-simbolo: o /marca.css de um cliente com marca própria aponta para o símbolo dele (ver MARCA_V no servidor) */
  border-radius: 28%; background: var(--marca-simbolo, url("/brand/simbolo-128.webp")) center / cover no-repeat;
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .45), 0 0 18px rgba(var(--accent-rgb), .35);
}
.wordmark.small .wm-chev { width: 1.35em; height: 1.35em; vertical-align: -.3em; }
/* marca sem logo (white label): o nome escrito no lugar, e a inicial no lugar do símbolo */
.brand-name {
  display: inline-block; margin: 22px 0 12px; line-height: 1.05; letter-spacing: -.01em;
  font: 700 clamp(36px, 7vw, 54px)/1.05 var(--display); color: var(--text);
}
.brand-name::after {
  content: ""; display: block; width: 42%; min-width: 48px; height: 4px; margin: 14px auto 0;
  border-radius: 2px; background: var(--grad);
}
.wordmark.word-text {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font: 700 19px/1 var(--display); color: var(--text);
  background: none; animation: none; -webkit-background-clip: border-box; background-clip: border-box;
}
.wordmark.word-text .wm-chev { margin-right: 0; width: 28px; height: 28px; vertical-align: 0; font-size: 15px; }
html:not([data-marca-imagens~="simbolo"]) .wm-chev {
  display: inline-grid; place-items: center; background: var(--grad); color: #fff; font: 700 .7em/1 var(--display);
}
/* marca com o símbolo mas sem o letreiro (o ARENA38): a inicial fica no HTML para quem não tem o símbolo, e
   aqui some (ela aparecia por cima do desenho) */
html[data-marca-imagens~="simbolo"] .wordmark.word-text .wm-chev { color: transparent; font-size: 0; }
.brand { margin: -14px -10px -4px; line-height: 0; text-align: center; }
.brand-logo {
  width: 100%; height: auto; display: block;
  /* fundo preto do desenho some sobre o painel; bordas esfumadas */
  mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(52% 60% at 50% 52%, #000 74%, transparent 100%);
  mask-image: radial-gradient(52% 60% at 50% 52%, #000 74%, transparent 100%);
  animation: brandIn 1s var(--ease) both;
}
@keyframes brandIn { from { opacity: 0; transform: scale(.94); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
html[data-size="xs"] .brand { margin: -16px -8px -6px; }
video.brand-logo { aspect-ratio: 596 / 400; object-fit: cover; background: transparent; }
@media (max-height: 700px) { .brand-logo { max-height: 34vh; width: auto; margin: 0 auto; } }

.bg .arena-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
body[data-bg="arena"]:has(#screen-room:not([hidden])) .bg { opacity: .5; }
.bg-swatch.arena {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 54 36'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='1'%3E%3Cstop offset='0' stop-color='%238b5cf6'/%3E%3Cstop offset='1' stop-color='%233b82f6'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M2 14h12M2 22h10M40 13h12M42 23h10' stroke='%23a78bfa' stroke-width='.8' opacity='.7'/%3E%3Cpath d='M27 5 39 30H15Z' fill='none' stroke='url(%23g)' stroke-width='3' stroke-linejoin='round'/%3E%3Cpath d='M9 6l3 4-3 4-3-4zM46 25l3 4-3 4-3-4zM44 4l2 3-2 3-2-3z' fill='%236d28d9' fill-opacity='.4' stroke='%23ffb066' stroke-width='.7'/%3E%3C/svg%3E") center / cover no-repeat,
    radial-gradient(circle at 50% 55%, #1a1240, #05050f 75%);
}

/* ---------- fundo próprio da tela de login (triângulo + diamantes) ---------- */
.login-bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: #010005 url("/brand/login.jpg") center / cover no-repeat;
  background-image: image-set(url("/brand/login.webp") type("image/webp"), url("/brand/login.jpg") type("image/jpeg"));
  animation: loginZoom 38s ease-in-out infinite alternate;
}
/* marca sem a foto da entrada: luzes nas cores da marca */
html:not([data-marca-imagens~="login"]) .login-bg {
  background:
    radial-gradient(38% 48% at 22% 30%, rgba(var(--accent-rgb), .30), transparent 70%),
    radial-gradient(34% 44% at 80% 22%, rgba(var(--g2-rgb), .24), transparent 70%),
    radial-gradient(38% 48% at 62% 88%, rgba(255, 77, 154, .14), transparent 70%),
    #05050b;
  animation: none;
}
.login-bg::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 100% at 50% 45%, rgba(1, 0, 5, 0) 45%, rgba(1, 0, 5, .65) 100%);
}
@keyframes loginZoom { from { transform: scale(1.02); } to { transform: scale(1.09) translateY(-1.2%); } }
/* celular em pé: mostra o triângulo inteiro em vez de só o meio dele */
@media (orientation: portrait) {
  .login-bg { background-size: 200% auto; background-position: 50% 38%; }
}
body:has(#screen-login:not([hidden])) .bg { opacity: 0; }
body:has(#screen-login:not([hidden]))::before { opacity: 0; }
html[data-lite="1"] .login-bg { animation: none; }

/* logo animado também no lobby (menor, centralizado) */
.brand-lobby { margin: -18px auto -8px; width: min(100%, 360px); }
.lobby-head h2 { margin: 0; }
html[data-size="xs"] .brand-lobby, html[data-size="sm"] .brand-lobby { width: min(100%, 300px); }
@media (max-height: 760px) { .brand-lobby { width: min(100%, 280px); margin-bottom: -12px; } }

/* fundo principal: logo do panda */
.bg-swatch.panda { background: url("/brand/fundo-mini.jpg") center / cover no-repeat, #05040f; }
body[data-bg="panda"] .bg .kb-shade { background: radial-gradient(120% 100% at 50% 42%, rgba(7, 8, 13, .08), rgba(7, 8, 13, .6)); }
body[data-bg="panda"]:has(#screen-room:not([hidden])) .bg { opacity: .4; }
.bg .kb.arena { inset: 0; animation: arenaZoom 30s ease-in-out infinite alternate; }
@keyframes arenaZoom { from { transform: scale(1); } to { transform: scale(1.05) translateY(-.8%); } }

/* cabeçalho do menu de fundo: título + Fechar, sempre visível ao rolar */
.bg-menu { padding-top: 0; }
.bg-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  margin: 0 -8px; padding: 8px 8px 6px 8px;
  background: #10111c; border-radius: 18px 18px 0 0; box-shadow: 0 8px 12px -10px rgba(0, 0, 0, .6);
}
.bg-head .bg-title { padding: 6px 10px 4px; }
.bg-close {
  display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer;
  padding: 8px 12px; border-radius: 999px; font: 600 13px/1 var(--body);
  color: var(--text); background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--line-2);
}
.bg-close span { font-size: 18px; line-height: 0; }
.bg-close:hover { background: var(--glass-3); }
html[data-touch="1"] .bg-close { padding: 10px 14px; }

/* menu de fundo: nunca maior que a tela visível; no celular vira uma folha da tela toda, com o Fechar sempre no topo */
.bg-menu { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); }
@media (max-width: 560px) {
  .bg-menu {
    top: max(8px, env(safe-area-inset-top)) !important; bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px !important; right: 8px; width: auto; max-height: none;
    -webkit-overflow-scrolling: touch;
  }
}

/* tempo de transmissão no chip de quem está ao vivo e no botão Parar */
.chip .live-time, .label .live-time { margin-left: 7px; font-size: .86em; font-variant-numeric: tabular-nums; opacity: .75; }
.chip .live-time:empty, .label .live-time:empty { display: none; }
#share .lbl { font-variant-numeric: tabular-nums; }

/* nome ARENA com a letra do logo (imagem recortada do próprio logo) */
.wordmark.word-img { display: inline-flex; align-items: center; gap: 8px; background: none; animation: none; -webkit-background-clip: border-box; background-clip: border-box; }
.wordmark.word-img img { height: 22px; width: auto; display: block; filter: drop-shadow(0 0 10px rgba(var(--accent-rgb), .45)); }
.wordmark.word-img .wm-chev { margin-right: 0; width: 28px; height: 28px; vertical-align: 0; }
@media (max-width: 800px) { .wordmark.word-img img { height: 18px; } .wordmark.word-img .wm-chev { width: 24px; height: 24px; } }
.share-panel label.hw-auto input { width: 16px; height: 16px; flex: none; margin: 0; padding: 0; accent-color: var(--accent); }
.share-panel label.hw-auto { justify-content: flex-start; text-align: left; }
.switch-btn { font: inherit; font-size: 13px; font-weight: 700; color: #fff; background: var(--grad); border: 0; border-radius: 12px; padding: 10px 14px; cursor: pointer; }
.switch-btn:hover:not(:disabled) { filter: brightness(1.1); }
.switch-btn:disabled { opacity: .6; cursor: progress; }

/* ---------- subsalas ---------- */
.subrooms { display: grid; gap: 6px; margin-bottom: 14px; }
.sub-box { display: grid; gap: 2px; }
.sub-btn { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; width: 100%; font: inherit; color: var(--text); background: var(--glass-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; cursor: pointer; }
.sub-btn:hover:not(:disabled) { border-color: var(--accent); }
.sub-btn:disabled { cursor: default; }
.sub-btn.cur { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.sub-btn .sn { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sub-btn .sc { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.sub-btn.busy { opacity: .6; }
.sub-people { list-style: none; margin: 2px 0 4px; padding: 0 0 0 14px; display: grid; gap: 3px; }
.sub-people li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; min-width: 0; }
.sub-av { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 10.5px; font-weight: 800; color: #fff; background: var(--glass-3); border: 1px solid var(--line-2); }
.sub-box.cur .sub-av { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.sub-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sub-live { flex: none; font-size: 9.5px; font-weight: 800; letter-spacing: .04em; color: #fff; background: var(--live); border-radius: 4px; padding: 1px 5px; }
.r-subs { display: grid; gap: 6px; padding: 0 14px 12px; }
.r-sub { display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; text-align: left; font: inherit; color: var(--text); background: var(--glass-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; cursor: pointer; }
.r-sub:hover { border-color: var(--accent); }
.r-sub .t { font-size: 13px; font-weight: 700; }
.r-sub .n { font-size: 12px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.r-sub .w { grid-column: 1 / -1; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-sub .w .on-air { color: var(--live); font-weight: 700; }
.r-sub.live { border-color: var(--live); }

/* ---------- sorteio de times ---------- */
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.draw-open { font: inherit; font-size: 12px; font-weight: 700; color: var(--text); background: var(--glass-3); border: 1px solid var(--line-2); border-radius: var(--pill); padding: 5px 11px; cursor: pointer; white-space: nowrap; }
.draw-open:hover { border-color: var(--accent); }
.draw-modal, .draw-result { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(4, 5, 10, .62); backdrop-filter: blur(6px); }
.draw-modal[hidden], .draw-result[hidden] { display: none; }
.draw-card { width: min(560px, 100%); max-height: calc(100dvh - 32px); display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto auto auto; gap: 12px; background: rgba(16, 17, 28, .96); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 20px; box-shadow: 0 30px 90px rgba(0, 0, 0, .6); color: var(--text); }
.draw-result .draw-card { grid-template-rows: auto auto minmax(0, 1fr); width: min(640px, 100%); }
.draw-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.draw-top h2 { margin: 0; font: 700 20px/1.2 var(--display); letter-spacing: -.01em; }
.draw-x { font: 400 26px/1 var(--body); color: var(--muted); background: none; border: 0; cursor: pointer; padding: 0 4px; }
.draw-x:hover { color: var(--text); }
.draw-dest { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.draw-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 700; }
.draw-tools .btn.link { font-size: 12.5px; }
.draw-list { list-style: none; margin: 0; padding: 4px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px; border: 1px solid var(--line); border-radius: var(--r); background: var(--glass-2); min-height: 120px; align-content: start; }
.draw-list label { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; cursor: pointer; min-width: 0; }
.draw-list label:hover { background: var(--glass-3); }
.draw-list input { width: 16px; height: 16px; flex: none; margin: 0; accent-color: var(--accent); }
.draw-list .dn { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.draw-list .dw { margin-left: auto; font-size: 11px; color: var(--dim); white-space: nowrap; flex: none; }
.draw-empty { padding: 12px; color: var(--muted); font-size: 13px; }
.draw-err { margin: 0; color: var(--live); font-size: 13px; font-weight: 600; }
.draw-go { width: 100%; justify-content: center; }
.draw-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; overflow-y: auto; min-height: 0; }
@media (max-width: 520px) { .draw-teams { grid-template-columns: 1fr; } }
.draw-team { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; background: var(--glass-2); min-width: 0; }
.draw-team.mine { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.draw-team h3 { margin: 0 0 8px; font: 700 14px/1.3 var(--display); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.draw-team ul { margin: 0; padding: 0 0 0 18px; display: grid; gap: 4px; font-size: 13.5px; }
.draw-mine { font: 800 10px/1 var(--body); letter-spacing: .04em; color: #fff; background: var(--accent); border-radius: 4px; padding: 3px 6px; }

/* ============================================================
   BARRA DE EXIBIÇÃO (acima das transmissões) — uma linha:
   [Assistir  Todas · Só voz | ● Luiza 12:03 · ● Rafael 4:10 · Janela flutuante]      [▦ Exibição ▾]
   ============================================================ */
.streams.viewbar { display: flex; flex-wrap: nowrap; align-items: center; gap: 12px; padding: 10px 14px 4px; position: relative; z-index: 30; }
.vb-watch { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.vb-label { flex: none; font: 600 12px/1 var(--body); color: var(--muted); }
.vb-scroller { display: flex; align-items: center; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 6px 2px; margin: -6px 0;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.vb-scroller::-webkit-scrollbar { display: none; }
.vb-sep { flex: none; width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; }
.vb-empty { font-size: 13px; color: var(--muted); white-space: nowrap; }
.vb-right { position: relative; flex: none; }
.vb-display { display: inline-flex; align-items: center; gap: 8px; font: 600 13px/1 var(--display); color: var(--text); background: var(--glass-2); border: 0; border-radius: var(--pill); padding: 8px 12px 8px 10px; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line-2); transition: background .2s, box-shadow .2s; }
.vb-display:hover, .vb-display.open { background: var(--glass-3); box-shadow: inset 0 0 0 1px var(--accent); }
.vb-display svg:not(.vb-caret) { width: 24px; height: 16px; flex: none; color: var(--g2); }
.vb-display svg rect, .vb-opt svg rect { fill: currentColor; opacity: .8; }
.vb-display svg .ghost, .vb-opt svg .ghost { fill: none; stroke: currentColor; stroke-width: 1.2; stroke-dasharray: 2 1.5; opacity: .7; }
.vb-display svg .mini, .vb-opt svg .mini { fill: currentColor; stroke: #0b0c14; stroke-width: 1; opacity: 1; }
.vb-caret { width: 14px; height: 14px; color: var(--muted); transition: transform .25s var(--ease); }
.vb-display.open .vb-caret { transform: rotate(180deg); }
.vb-panel {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 50;
  width: min(440px, calc(100vw - 24px)); max-height: min(70vh, 620px); overflow-y: auto; overscroll-behavior: contain;
  display: grid; gap: 16px; padding: 16px;
  background: rgba(16, 17, 28, .94); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-radius: 20px; box-shadow: 0 0 0 1px var(--line-2), 0 24px 60px rgba(0, 0, 0, .55);
  animation: eqIn .3s var(--spring) both;
}
.vb-phead { display: flex; align-items: center; justify-content: space-between; }
.vb-phead strong { font: 600 15px/1 var(--display); }
.vb-x { font: 400 24px/1 var(--body); color: var(--muted); background: none; border: 0; cursor: pointer; padding: 0 4px; }
.vb-x:hover { color: var(--text); }
.vb-sec { display: grid; gap: 8px; }
.vb-sec h4 { margin: 0; font: 600 12px/1 var(--body); color: var(--muted); }
.vb-opts { display: grid; gap: 6px; }
.vb-opts.lay { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.vb-opts.seg { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
.vb-opts.two { grid-template-columns: 1fr 1fr; }
.vb-opt { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 0; text-align: center;
  font: 600 12px/1.2 var(--display); color: var(--text); background: var(--glass-2); border: 0; border-radius: 12px; padding: 10px 6px; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line); transition: background .2s, box-shadow .2s, transform .2s var(--spring); }
.vb-opt:hover { background: var(--glass-3); transform: translateY(-1px); }
.vb-opt.on { background: color-mix(in srgb, var(--accent) 20%, transparent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.vb-opts.lay .vb-opt svg { width: 34px; height: 22px; flex: none; color: var(--muted); }
.vb-opts.lay .vb-opt.on svg { color: var(--g2); }
.vb-ot { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.vb-opts.seg .vb-opt { flex-direction: row; padding: 10px 8px; }
/* formatos: o desenho em cima e o nome embaixo, os 5 numa linha no computador (lado a lado, em 4
   colunas, o "Fixa 21:9" saía cortado em "Fixa 2…"); no celular, menos colunas, e o nome quebra em
   vez de ser cortado */
.vb-opts.frames { grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); }
.vb-opts.frames .vb-opt { flex-direction: column; gap: 7px; padding: 10px 4px; }
.vb-opts.frames .vb-ot { white-space: normal; overflow-wrap: anywhere; }
.vb-opts.two .vb-opt { align-items: flex-start; text-align: left; padding: 12px; gap: 5px; }
.vb-opts.two .vb-ot { font-size: 13px; }
.vb-od { font: 500 11.5px/1.4 var(--body); color: var(--muted); white-space: normal; }
.vb-opt .frame-ico { flex: none; height: 12px; border-radius: 2px; box-shadow: inset 0 0 0 1.6px currentColor; }
.vb-opt .frame-ico.f-auto { width: 16px; box-shadow: none; border: 1.6px dashed currentColor; }
.vb-opt .frame-ico.f-16x9 { width: 21px; }
.vb-opt .frame-ico.f-4x3 { width: 16px; }
.vb-opt .frame-ico.f-21x9 { width: 28px; }
.vb-opt .frame-ico.f-9x16 { width: 8px; height: 14px; }
.vb-opts.frames .frame-ico { margin: 1px 0; } /* todos ocupam 14 px de altura: os nomes ficam na mesma linha */
.vb-opts.frames .frame-ico.f-9x16 { margin: 0; }
.vb-opt .border-dot { width: 14px; height: 14px; border-radius: 4px; flex: none; background: #0b0c14; }
.vb-opt .border-dot.b-soft { box-shadow: 0 0 0 1px rgba(255, 255, 255, .25), 0 2px 6px rgba(0, 0, 0, .6); }
.vb-opt .border-dot.b-none { border-radius: 0; background: #2a2d40; }
.vb-opt .border-dot.b-thin { box-shadow: 0 0 0 1.5px #fff; }
.vb-note { margin: 0; font-size: 12px; color: var(--dim); }
@media (max-width: 800px) {
  .streams.viewbar { padding: 8px 10px 2px; gap: 8px; }
  .vb-label, .vb-btxt { display: none; }
  .vb-display { padding: 8px 10px; }
  /* no celular o painel vira uma folha presa embaixo, acima dos botões */
  .vb-panel { position: fixed; top: auto; left: 10px; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); width: auto; max-height: 62vh; }
  .vb-opts.lay { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- escolher o microfone (setinha grudada no botão Microfone) ---------- */
/* botão dividido: [🎤 Microfone | ^] como uma peça só, mesma altura, sem vão */
.split { display: inline-flex; align-items: stretch; flex: none; }
.split > .ctl { transform: none !important; }
.mic-split > #mic { border-radius: var(--pill) 0 0 var(--pill); }
.ctl.attach.mic-attach { margin-left: -1px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px 0 9px;
  background: var(--glass-2); color: var(--text); border-radius: 0 var(--pill) var(--pill) 0; box-shadow: inset 0 0 0 1px var(--line); }
.mic-split:hover > .ctl:not(.off) { background: var(--glass-3); }
.ctl.attach.mic-attach:hover, .ctl.attach.mic-attach.active { background: var(--glass-3); }
#mic.off + .ctl.attach.mic-attach { background: rgba(255, 77, 109, .16); color: #ff8fa3; box-shadow: inset 0 0 0 1px rgba(255, 77, 109, .35); }
.ctl.attach .ico { width: 16px; height: 16px; }
.mic-panel { width: min(360px, calc(100vw - 24px)); }
.mic-field { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.mic-field .sel { width: 100%; }
.mic-meter { height: 8px; border-radius: 999px; background: var(--glass-3); overflow: hidden; }
.mic-bar { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--talk), #b8f36a); transition: width .08s linear; }
.mic-bar.hot { background: linear-gradient(90deg, var(--talk), var(--warn) 70%, var(--live)); }
.mic-state { margin: 0; }
.vb-opts.lay .vb-opt { min-height: 74px; }
.vb-opts.lay .vb-ot { white-space: normal; font-size: 11px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* painéis que abrem dos botões de baixo ficam por cima dos quadros das transmissões */
.controls { position: relative; z-index: 35; }

/* voz do anúncio (painel Sons) */
.voice-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.voice-row .sel { width: 100%; min-width: 0; font-size: 13px; padding-top: 8px; padding-bottom: 8px; }

@media (max-width: 800px) { .ctl.attach.mic-attach { padding: 0 9px 0 6px; } }
@media (max-width: 380px) { .ctl.attach.mic-attach { padding: 0 7px 0 5px; } }

/* mesma peça única para [Transmitir | ⚙] */
.share-split > #share { border-radius: var(--pill) 0 0 var(--pill); }
.share-split > .ctl.attach { margin-left: 0; padding-top: 0; padding-bottom: 0; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 380px) { .share-split > .ctl.attach { padding-left: 8px; padding-right: 10px; } }

.draw-caps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.draw-caps label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); min-width: 0; }
.draw-caps .sel { width: 100%; min-width: 0; font-size: 13px; }
@media (max-width: 520px) { .draw-caps { grid-template-columns: 1fr; } }
.draw-team li.cap { font-weight: 700; }
.draw-cap { margin-left: 8px; font: 800 10px/1 var(--body); color: #1a1205; background: #ffc94d; border-radius: 4px; padding: 3px 6px; white-space: nowrap; }

.bg-fx-note { display: block; font-size: 12px; color: var(--muted); margin: -2px 0 8px; }
.bg-fx-row { flex-wrap: wrap; }

/* trocar de nome */
.rename-btn { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; margin-left: auto; padding: 0; color: var(--muted); background: var(--glass-2); border: 1px solid var(--line); border-radius: 50%; cursor: pointer; }
.rename-btn:hover { color: var(--text); border-color: var(--accent); }
.rename-btn svg { width: 14px; height: 14px; }
.rename-card { grid-template-rows: auto auto auto auto; width: min(420px, 100%); }
.rename-field { display: grid; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.rename-field input { font: 600 16px/1.2 var(--body); color: var(--text); background: var(--glass-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; }
.rename-field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.p.me { grid-template-columns: 34px minmax(0, 1fr) auto auto; grid-template-areas: "av name badges ren" "vol vol vol vol"; }
.p.me .rename-btn { grid-area: ren; margin-left: 0; }

/* região principal do login: não entra no layout */
main.contents { display: contents; }

/* microfone que não liga (bloqueado, ausente, em uso): âmbar, diferente de "Mudo" */
.ctl.off.blocked { background: rgba(255, 176, 32, .16); color: #ffc861; box-shadow: inset 0 0 0 1px rgba(255, 176, 32, .55); }
.ctl.blocked::after {
  content: ""; position: absolute; top: 7px; left: 9px; width: 8px; height: 8px; border-radius: 50%;
  background: #ffb020; box-shadow: 0 0 0 2px rgba(10, 11, 18, .9); animation: blockedPing 1.6s ease-in-out infinite;
}
@keyframes blockedPing { 50% { box-shadow: 0 0 0 2px rgba(10, 11, 18, .9), 0 0 0 6px rgba(255, 176, 32, .25); } }
@media (prefers-reduced-motion: reduce) { .ctl.blocked::after { animation: none; } }

/* nome na lista = botão do volume (mesma aparência de antes) */
.p button.name {
  background: none; border: 0; padding: 0; margin: 0; color: inherit; font: inherit; font-weight: 700;
  text-align: left; cursor: pointer; min-width: 0; border-radius: 6px;
}
.p button.name:focus-visible { outline: 2px solid var(--g1); outline-offset: 3px; }

/* celular deitado: a lista também vira gaveta (a lateral fixa comia 1/3 da largura do vídeo) */
@media (orientation: landscape) and (max-height: 520px) {
  .room, .room.users-hidden { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: min(320px, 50vw);
    background: rgba(12, 13, 21, .94);
    box-shadow: 20px 0 40px rgba(0, 0, 0, .5);
    transform: translateX(0); transition: transform .4s var(--spring);
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) env(safe-area-inset-left);
    overflow-y: auto; overscroll-behavior: contain;
  }
  .sidebar .participants { flex: none; overflow: visible; }
  .room.users-hidden .sidebar { display: flex; transform: translateX(-105%); box-shadow: none; }
  .room:not(.users-hidden) .scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(0, 0, 0, .5); animation: fade .3s both; }
}
/* celular em pé: com subsalas cheias, a gaveta inteira rola (a lista "Na sala" não some espremida) */
@media (max-width: 800px) and (max-height: 760px) {
  .sidebar { overflow-y: auto; overscroll-behavior: contain; }
  .sidebar .participants { flex: none; overflow: visible; }
}

/* sorteio: cada um vai para o time quando clicar em Pronto */
.draw-team li { display: list-item; }
.draw-ok { display: none; margin-left: 8px; font: 800 10px/1 var(--body); color: #06210f; background: #4ade80; border-radius: 4px; padding: 3px 6px; white-space: nowrap; }
.draw-ok::before { content: "✓ "; }
.draw-team li.ready .draw-ok { display: inline-block; }
.draw-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.draw-ready-count { margin: 0 auto 0 0; color: var(--muted); font-size: 13px; }
.draw-ready-go { flex: 1 1 100%; justify-content: center; }
.draw-ready-go:disabled { opacity: 1; background: color-mix(in srgb, #4ade80 18%, transparent); color: #b8f5cc; box-shadow: inset 0 0 0 1px rgba(74, 222, 128, .45); cursor: default; }
.draw-actions .btn.ghost { flex: 1 1 0; justify-content: center; }
.draw-split[hidden] { display: none; }
.draw-ready-side {
  width: 100%; margin: 2px 0 10px; font: inherit; font-size: 13px; font-weight: 700; color: var(--text);
  background: var(--glass-3); border: 1px solid var(--line-2); border-radius: var(--pill); padding: 8px 12px; cursor: pointer;
}
.draw-ready-side.go { background: color-mix(in srgb, #4ade80 20%, transparent); border-color: rgba(74, 222, 128, .6); color: #d7fbe3; }
.draw-ready-side:hover { border-color: var(--accent); }
.draw-ready-side:disabled { opacity: .6; cursor: progress; }
@media (prefers-reduced-motion: no-preference) {
  .draw-ready-side.go { animation: readyPulse 2.4s ease-in-out infinite; }
  @keyframes readyPulse { 50% { box-shadow: 0 0 0 4px rgba(74, 222, 128, .18); } }
}

/* subsalas: setinha para recolher a lista de quem está em cada uma */
.sub-row { display: flex; gap: 4px; align-items: stretch; min-width: 0; }
.sub-row .sub-btn { flex: 1; min-width: 0; }
.sub-btn .sn { flex: 1; }
.sub-fold {
  flex: none; width: 32px; display: grid; place-items: center; padding: 0; cursor: pointer;
  color: var(--muted); background: var(--glass-2); border: 1px solid var(--line); border-radius: 12px;
}
.sub-fold:hover { color: var(--text); border-color: var(--accent); }
.sub-fold:focus-visible { outline: 2px solid var(--g1); outline-offset: 2px; }
.sub-fold svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.sub-fold[aria-expanded="false"] svg { transform: rotate(-90deg); }
.sub-row .sub-btn.cur + .sub-fold { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }


/* ===== sala leve =====
   Na sala o que importa é a voz, o vídeo e o jogo rodando ao lado. Animação contínua obriga o navegador
   a redesenhar a tela o tempo todo, e o desfoque (vidro) é refeito a cada quadro do vídeo, então:
   fundo parado, brilhos decorativos só nas primeiras passadas e painéis fixos com fundo sólido.
   Painéis e janelas que abrem e fecham continuam com o vidro. */
body:has(#screen-room:not([hidden]))::before,
body:has(#screen-room:not([hidden])) .bg,
body:has(#screen-room:not([hidden])) .bg * { animation-play-state: paused !important; }
#screen-room .p .av::after, #screen-room .chip::after, #screen-room .ctl.primary::after,
#screen-room .btn.primary::after, #screen-room .empty-mark { animation-iteration-count: 2; }
#screen-room :is(.topbar, .sidebar, .controls) {
  background: rgba(10, 11, 18, .88); backdrop-filter: none; -webkit-backdrop-filter: none;
}
#screen-room :is(.tile .label, .tile-actions .act, .tile .stream-vol, .zoom-badge, .bar-pill, .slot-empty) {
  background-color: rgba(7, 8, 13, .76); backdrop-filter: none; -webkit-backdrop-filter: none;
}
/* indicadores de AO VIVO e de chamada: pulsam algumas vezes para chamar atenção e depois ficam fixos
   (uma animação sem fim faz a tela redesenhar 60x/s, o dobro de um vídeo a 30 fps) */
#screen-room .badge.live::after, #screen-room .tile .label::before, #screen-room .draw-ready-side.go { animation-iteration-count: 3; }

/* puxar pessoas entre as subsalas: arrastar o nome ou tocar nele */
.sub-people li { flex-wrap: wrap; }
.sub-people li.pullable { cursor: grab; }
.sub-people li.pullable:active { cursor: grabbing; }
button.sub-nm {
  background: none; border: 0; padding: 0; margin: 0; color: inherit; font: inherit; text-align: left; cursor: inherit;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 6px;
}
button.sub-nm:hover { color: #fff; text-decoration: underline dotted rgba(255, 255, 255, .45); text-underline-offset: 3px; }
button.sub-nm:focus-visible { outline: 2px solid var(--g1); outline-offset: 2px; }
.pull-menu { flex: none; width: calc(100% - 26px); box-sizing: border-box; min-width: 0; display: grid; gap: 4px; margin: 4px 0 2px 26px; padding: 6px; border-radius: 12px; background: rgba(16, 17, 28, .96); box-shadow: 0 0 0 1px var(--line-2), 0 12px 30px rgba(0, 0, 0, .45); }
.pull-menu button { white-space: normal; overflow-wrap: anywhere; font: inherit; font-size: 12.5px; font-weight: 600; text-align: left; color: var(--text); background: var(--glass-2); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; cursor: pointer; }
.pull-menu button:hover, .pull-menu button:focus-visible { border-color: var(--accent); outline: none; }
body.pulling .sub-box { border-radius: 14px; outline: 1px dashed rgba(255, 255, 255, .22); outline-offset: 3px; }
.sub-box.drop-on { outline: 2px solid var(--accent) !important; outline-offset: 3px; background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 14px; }

/* lobby e login parados há 20 s: tudo que é decorativo para (volta ao mexer o mouse ou o teclado) */
html[data-idle] *:not(.toast-item), html[data-idle] *::before, html[data-idle] *::after { animation-play-state: paused !important; }
/* na sala, a foto do fundo e a aurora ficam paradas de vez: sem animação nenhuma o navegador
   solta a camada que guardava o fundo na memória da placa de vídeo (~8 MB em 1080p, ~30 MB em 4K) */
body:has(#screen-room:not([hidden]))::before,
body:has(#screen-room:not([hidden])) .bg .kb { animation: none !important; }
