/* ===================================================================
   Assistir Junto — tema
   =================================================================== */
:root {
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dock-h: 76px;
  --side-w: 372px;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #f43f5e;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07070d;
  --bg-2: #0d0d17;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .08);
  --surface-3: rgba(255, 255, 255, .12);
  --solid: #12121e;
  --border: rgba(255, 255, 255, .08);
  --border-2: rgba(255, 255, 255, .14);
  --text: #f4f4fb;
  --muted: #9a9ab3;
  --shadow: 0 24px 60px -12px rgba(0, 0, 0, .6);
  --glass: rgba(14, 14, 24, .62);
  --name-l: 70%;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f3f8;
  --bg-2: #ffffff;
  --surface: rgba(20, 20, 50, .04);
  --surface-2: rgba(20, 20, 50, .07);
  --surface-3: rgba(20, 20, 50, .11);
  --solid: #ffffff;
  --border: rgba(20, 20, 50, .09);
  --border-2: rgba(20, 20, 50, .16);
  --text: #15152a;
  --muted: #6b6b85;
  --shadow: 0 24px 60px -18px rgba(30, 30, 80, .28);
  --glass: rgba(255, 255, 255, .72);
  --name-l: 40%;
}

:root[data-accent="violet"] { --a1: #8b5cf6; --a2: #ec4899; --a-rgb: 139, 92, 246; }
:root[data-accent="blue"]   { --a1: #3b82f6; --a2: #06b6d4; --a-rgb: 59, 130, 246; }
:root[data-accent="green"]  { --a1: #10b981; --a2: #84cc16; --a-rgb: 16, 185, 129; }
:root[data-accent="orange"] { --a1: #f97316; --a2: #f43f5e; --a-rgb: 249, 115, 22; }
:root[data-accent="pink"]   { --a1: #ec4899; --a2: #a855f7; --a-rgb: 236, 72, 153; }
:root { --grad: linear-gradient(135deg, var(--a1), var(--a2)); }

/* ===================================================================
   Base
   =================================================================== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--a1); outline-offset: 2px; }

.ico {
  width: 20px; height: 20px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
kbd {
  display: inline-block; min-width: 22px; padding: 1px 7px;
  border-radius: 6px; border: 1px solid var(--border-2); border-bottom-width: 2px;
  background: var(--surface); font: 600 12px/1.6 var(--font); text-align: center;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text);
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 14px; white-space: nowrap;
  transition: transform .15s var(--ease), background .2s, box-shadow .2s, filter .2s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn.primary {
  border: 0; color: #fff; background: var(--grad);
  box-shadow: 0 10px 30px -10px rgba(var(--a-rgb), .8);
}
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 14px 34px -10px rgba(var(--a-rgb), .95); }
.btn.big { width: 100%; padding: 14px; font-size: 15px; }
.btn.big .ico { transform: rotate(-90deg); }

.icon-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: background .2s, transform .15s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:active { transform: scale(.94); }

/* Campos */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
input:not([type]), input[type="text"] {
  width: 100%; padding: 12px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text); font-size: 15px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:not([type]):focus { border-color: var(--a1); box-shadow: 0 0 0 4px rgba(var(--a-rgb), .18); background: var(--surface-2); }
input::placeholder { color: var(--muted); opacity: .8; }
.select {
  padding: 9px 12px; border-radius: 10px; min-width: 0; max-width: 100%;
  border: 1px solid var(--border-2); background: var(--solid); color: var(--text); font-size: 13px;
}

/* Avatares */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  font-weight: 800; color: #fff; font-size: 14px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: box-shadow .15s;
}
.avatar.xl { width: 72px; height: 72px; font-size: 28px; margin: 0 auto 14px; box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .5); }
.speaking .avatar, .avatar.speaking { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--ok), 0 0 18px rgba(34, 197, 94, .6); }

/* ===================================================================
   Lobby
   =================================================================== */
.lobby {
  position: relative; height: 100%; overflow-y: auto;
  display: grid; place-items: center; padding: 32px 20px;
}
.aurora { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.aurora span {
  position: absolute; width: 55vmax; height: 55vmax; border-radius: 50%;
  filter: blur(90px); opacity: .35; animation: drift 22s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { background: var(--a1); top: -25vmax; left: -15vmax; }
.aurora span:nth-child(2) { background: var(--a2); bottom: -30vmax; right: -20vmax; animation-delay: -7s; }
.aurora span:nth-child(3) { background: #06b6d4; top: 30%; left: 40%; width: 30vmax; height: 30vmax; opacity: .15; animation-delay: -14s; }
:root[data-theme="light"] .aurora span { opacity: .22; }
@keyframes drift { to { transform: translate(8vmax, 6vmax) scale(1.15); } }

.lobby-grid {
  position: relative; width: 100%; max-width: 1080px;
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.brand b { font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--grad); box-shadow: 0 8px 24px -6px rgba(var(--a-rgb), .7);
}
.brand-mark svg { width: 16px; height: 16px; fill: #fff; stroke: none; margin-left: 2px; }
.brand.small { font-size: 16px; }
.brand.small .brand-mark { width: 32px; height: 32px; border-radius: 10px; }

.hero h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1.04; letter-spacing: -.035em; margin: 26px 0 16px; font-weight: 800; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 16.5px; color: var(--muted); max-width: 540px; margin: 0 0 28px; }
.lead b { color: var(--text); }
.features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.features li {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.features b { display: block; font-size: 14px; }
.features small { color: var(--muted); font-size: 12.5px; }
.f-ico {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center;
  background: rgba(var(--a-rgb), .15); color: var(--a1);
}
.f-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.join-card {
  background: var(--glass); border: 1px solid var(--border-2); border-radius: 26px;
  padding: 32px 28px 24px; box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%);
  text-align: left;
}
.join-card h2 { margin: 0; text-align: center; font-size: 22px; letter-spacing: -.02em; }
.join-card > .muted { text-align: center; margin: 4px 0 22px; }
.error { color: var(--danger); min-height: 1em; margin: 12px 0 0; font-size: 13px; text-align: center; }

/* ===================================================================
   Sala — estrutura
   =================================================================== */
.room { height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px; padding-top: max(12px, env(safe-area-inset-top));
}
.room-pill {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 5px 5px 5px 14px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--border);
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(34, 197, 94, .18); animation: breathe 2s infinite; flex-shrink: 0; }
@keyframes breathe { 50% { box-shadow: 0 0 0 7px rgba(34, 197, 94, .05); } }
.room-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: 99px; padding: 7px 12px;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 13px;
  transition: filter .2s, transform .15s;
}
.pill-btn:hover { filter: brightness(1.1); }
.pill-btn:active { transform: scale(.96); }
.pill-btn .ico { width: 16px; height: 16px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.net-status {
  display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted);
  padding: 7px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border);
  max-width: 260px;
}
.net-status span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.net-status.ok i { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.net-status.wait i { background: var(--warn); animation: blink 1s infinite; }
.net-status.bad i, .net-status.off i { background: var(--danger); }
.net-status.bad, .net-status.off { color: var(--danger); }
@keyframes blink { 50% { opacity: .3; } }

.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar { width: 32px; height: 32px; font-size: 12px; margin-left: -8px; box-shadow: 0 0 0 2px var(--bg); }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .more { background: var(--surface-3); color: var(--text); }

.layout {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) var(--side-w); gap: 14px;
  padding: 0 18px 18px;
}
.main-col { display: flex; flex-direction: column; gap: 12px; min-height: 0; min-width: 0; }

/* ===================================================================
   Palco
   =================================================================== */
.stage {
  position: relative; flex: 1; min-height: 220px;
  border-radius: 22px; overflow: hidden;
  background: #000; border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage-empty {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; padding: 24px; color: #f4f4fb;
  background:
    radial-gradient(600px 300px at 50% 0%, rgba(var(--a-rgb), .28), transparent 70%),
    radial-gradient(500px 260px at 80% 100%, rgba(236, 72, 153, .14), transparent 70%),
    #0b0b14;
}
.stage-empty h3 { margin: 10px 0 0; font-size: 20px; letter-spacing: -.02em; }
.stage-empty p { margin: 0 0 14px; max-width: 440px; color: #a3a3bd; }
.empty-art {
  width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 0 0 10px rgba(255, 255, 255, .025), 0 0 0 20px rgba(255, 255, 255, .015);
  animation: float 5s ease-in-out infinite;
}
.empty-art svg { width: 38px; height: 38px; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@keyframes float { 50% { transform: translateY(-6px); } }

.stage-top {
  position: absolute; left: 14px; right: 14px; top: 14px; z-index: 3;
  display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; pointer-events: none;
}
.stage-label, .stats-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 99px;
  background: rgba(10, 10, 18, .55); color: #fff; font-size: 12.5px; font-weight: 600;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .1);
}
.stage-label .rec { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); animation: blink 1.4s infinite; }
.stats-chip { font-variant-numeric: tabular-nums; font-weight: 500; gap: 10px; flex-wrap: wrap; border-radius: 14px; }
.stats-chip b { font-weight: 700; }
.stats-chip .warn { color: #fbbf24; }

.stage-tools {
  position: absolute; right: 14px; bottom: 14px; z-index: 3;
  display: flex; gap: 6px; opacity: 0; transform: translateY(6px);
  transition: opacity .25s, transform .25s var(--ease);
}
.stage:hover .stage-tools, .stage:focus-within .stage-tools { opacity: 1; transform: none; }
.tool-btn {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .12); color: #fff;
  background: rgba(10, 10, 18, .55); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: background .2s, transform .15s;
}
.tool-btn:hover { background: rgba(255, 255, 255, .2); }
.tool-btn:active { transform: scale(.92); }
.tool-btn.on { background: var(--grad); border-color: transparent; }
.tool-btn .ico { width: 18px; height: 18px; }

/* Reações */
.reaction-layer { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.reaction {
  position: absolute; bottom: -10px; display: flex; flex-direction: column; align-items: center;
  animation: rise 3.2s var(--ease) forwards;
}
.reaction .e { font-size: 42px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .45)); }
.reaction .n {
  font-size: 11px; font-weight: 700; color: #fff; padding: 2px 8px; border-radius: 99px;
  background: rgba(0, 0, 0, .45); backdrop-filter: blur(8px); white-space: nowrap;
}
@keyframes rise {
  0%   { transform: translate(0, 0) scale(.4); opacity: 0; }
  12%  { transform: translate(0, -60px) scale(1.15); opacity: 1; }
  50%  { transform: translate(var(--dx, 20px), -40vh) scale(1); }
  100% { transform: translate(calc(var(--dx, 20px) * -1), -80vh) scale(.9); opacity: 0; }
}

/* ===================================================================
   Participantes (estilo chamada em grupo)
   =================================================================== */
.tiles {
  display: flex; gap: 10px; overflow-x: auto; flex-shrink: 0;
  padding: 2px; scrollbar-width: thin; scroll-snap-type: x proximity;
}
.tiles:empty { display: none; }
.tile {
  position: relative; flex: 0 0 auto; width: 156px; aspect-ratio: 16 / 10;
  border-radius: 16px; overflow: hidden; scroll-snap-align: start;
  background: var(--surface); border: 1px solid var(--border);
  display: grid; place-items: center;
  transition: box-shadow .15s, border-color .2s, transform .2s var(--ease);
}
.tile.clickable { cursor: pointer; }
.tile.clickable:hover { transform: translateY(-2px); border-color: var(--border-2); }
.tile.watching { border-color: rgba(var(--a-rgb), .9); box-shadow: 0 0 0 1px rgba(var(--a-rgb), .9); }
.tile.speaking { box-shadow: 0 0 0 2px var(--ok), 0 0 22px rgba(34, 197, 94, .35); border-color: transparent; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile video.mirror { transform: scaleX(-1); }
.tile .avatar { width: 48px; height: 48px; font-size: 19px; }
.tile .t-foot {
  position: absolute; left: 6px; right: 6px; bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.tile .t-name {
  flex: 1; min-width: 0; padding: 3px 8px; border-radius: 8px;
  background: rgba(10, 10, 18, .55); color: #fff; font-size: 11.5px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; backdrop-filter: blur(8px);
}
.tile .t-badges { display: flex; gap: 4px; }
.tile .t-badge {
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  background: rgba(10, 10, 18, .55); color: #fff; backdrop-filter: blur(8px);
}
.tile .t-badge.off { background: rgba(244, 63, 94, .85); }
.tile .t-badge.live { background: var(--grad); }
.tile .t-badge .ico { width: 13px; height: 13px; }

/* ===================================================================
   Barra de controles (dock)
   =================================================================== */
.dock {
  align-self: center; flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 8px; border-radius: 24px;
  background: var(--glass); border: 1px solid var(--border-2);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
}
.dock-btn {
  position: relative; display: flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 16px 0 8px; border-radius: 16px;
  border: 0; background: transparent; color: var(--text); font-weight: 700; font-size: 13.5px;
  transition: background .2s, transform .15s var(--ease);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.dock-btn:hover { background: var(--surface-2); }
.dock-btn:active { transform: scale(.95); }
.dock-ico {
  position: relative; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); transition: background .2s, color .2s;
}
.dock-btn.on .dock-ico { background: var(--text); color: var(--bg); }
.dock-btn.off .dock-ico { background: var(--danger); color: #fff; }
.dock-btn.accent .dock-ico { background: var(--grad); color: #fff; box-shadow: 0 6px 18px -6px rgba(var(--a-rgb), .9); }
.dock-btn.accent.live .dock-ico { background: var(--danger); box-shadow: 0 6px 18px -6px rgba(244, 63, 94, .9); }
.dock-btn.danger .dock-ico { background: var(--danger); color: #fff; }
.dock-btn.danger:hover { background: rgba(244, 63, 94, .12); }
.dock-btn.ptt-hold .dock-ico { background: var(--ok); color: #fff; }

/* nível do microfone: anel em volta do ícone */
.lvl {
  position: absolute; inset: -3px; border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 calc(var(--lvl, 0) * 4px) rgba(34, 197, 94, .55);
  transition: box-shadow .08s linear;
}

.dock-split { display: flex; align-items: center; border-radius: 16px; }
.dock-split .dock-btn { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 10px; }
.dock-caret {
  display: flex; align-items: center; gap: 2px;
  height: 52px; padding: 0 10px; border: 0;
  border-left: 1px solid var(--border); border-radius: 0 16px 16px 0;
  background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 700;
  transition: background .2s, color .2s;
}
.dock-caret:hover { background: var(--surface-2); color: var(--text); }
.dock-caret .ico { width: 16px; height: 16px; }

.react-wrap { position: relative; }
.react-pop {
  position: absolute; bottom: calc(100% + 14px); left: 50%; transform: translateX(-50%);
  display: flex; gap: 2px; padding: 6px; border-radius: 99px; z-index: 30;
  background: var(--solid); border: 1px solid var(--border-2); box-shadow: var(--shadow);
  animation: pop .22s var(--ease);
}
.react-pop button {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; font-size: 24px;
  transition: transform .15s var(--ease), background .15s;
}
.react-pop button:hover { transform: scale(1.25) translateY(-3px); background: var(--surface-2); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px) scale(.92); } }

/* ===================================================================
   Painel lateral (abas)
   =================================================================== */
.side {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  overflow: hidden;
}
.tabs { position: relative; display: flex; gap: 4px; padding: 6px; margin: 10px 10px 0; border-radius: 14px; background: var(--surface); }
.tab {
  position: relative; z-index: 1; flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; background: transparent; color: var(--muted); padding: 9px 6px; border-radius: 10px;
  font-weight: 700; font-size: 13px; transition: color .2s;
}
.tab .ico { width: 17px; height: 17px; }
.tab.active { color: var(--text); }
.tab-ink {
  position: absolute; z-index: 0; top: 6px; bottom: 6px; left: 6px; border-radius: 10px;
  background: var(--solid); box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
  transition: transform .3s var(--ease), width .3s var(--ease);
}
:root[data-theme="dark"] .tab-ink { background: var(--surface-3); }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  display: inline-grid; place-items: center; font-size: 11px; font-weight: 800;
  background: var(--danger); color: #fff; animation: pop-in .3s var(--ease);
}
.count { font-size: 11.5px; font-weight: 800; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--text); }
@keyframes pop-in { from { transform: scale(0); } }

.panel { display: none; flex: 1; min-height: 0; flex-direction: column; padding: 12px; }
.panel.active { display: flex; animation: fade .25s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

/* Chat */
.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 4px 4px 8px; overscroll-behavior: contain; }
.msg-group { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; animation: msg-in .25s var(--ease); }
.msg-group .avatar { width: 28px; height: 28px; font-size: 11px; }
.msg-group.mine { flex-direction: row-reverse; }
.bubbles { display: flex; flex-direction: column; gap: 3px; min-width: 0; max-width: 82%; }
.mine .bubbles { align-items: flex-end; }
.msg-who { font-size: 12px; font-weight: 700; margin: 0 0 2px 12px; }
.bubble {
  padding: 8px 12px; border-radius: 16px; background: var(--surface-2);
  word-wrap: break-word; overflow-wrap: anywhere; width: fit-content; max-width: 100%;
  animation: msg-in .22s var(--ease);
}
.bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.bubble .time { font-size: 10.5px; opacity: .6; margin-left: 8px; float: right; margin-top: 4px; }
.msg-group:not(.mine) .bubble { border-bottom-left-radius: 6px; }
.mine .bubble { background: var(--grad); color: #fff; border-bottom-right-radius: 6px; }
.msg-system {
  align-self: center; margin: 10px 0 2px; padding: 4px 12px; border-radius: 99px;
  font-size: 12px; color: var(--muted); background: var(--surface); text-align: center;
}
@keyframes msg-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.typing { min-height: 20px; font-size: 12px; color: var(--muted); padding: 0 6px; display: flex; align-items: center; gap: 6px; }
.typing .dots { display: inline-flex; gap: 3px; }
.typing .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: dot 1.2s infinite; }
.typing .dots i:nth-child(2) { animation-delay: .15s; }
.typing .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 30% { transform: translateY(-4px); opacity: 1; } 0%, 60%, 100% { opacity: .4; } }
.composer {
  display: flex; gap: 8px; align-items: center; padding: 5px 5px 5px 4px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--border);
  transition: border-color .2s, box-shadow .2s;
}
.composer:focus-within { border-color: rgba(var(--a-rgb), .7); box-shadow: 0 0 0 4px rgba(var(--a-rgb), .14); }
.composer input { border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 9px 10px; }
.send-btn {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; border: 0;
  display: grid; place-items: center; background: var(--grad); color: #fff;
  transition: transform .15s, filter .2s;
}
.send-btn:hover { filter: brightness(1.1); }
.send-btn:active { transform: scale(.92); }
.send-btn .ico { width: 18px; height: 18px; }

/* Pessoas */
.user-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.user-list li { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 14px; transition: background .2s; }
.user-list li.clickable { cursor: pointer; }
.user-list li.clickable:hover, .user-list li.watching { background: var(--surface-2); }
.u-main { flex: 1; min-width: 0; }
.uname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.usub { font-size: 12px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.utags { display: flex; gap: 4px; color: var(--muted); }
.utags .ico { width: 16px; height: 16px; }
.utags .red { color: var(--danger); }
.utags .acc { color: var(--a1); }

/* Mixer */
.mixer { gap: 12px; overflow-y: auto; }
.strip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 9px;
  transition: opacity .2s;
}
.strip.muted { opacity: .55; }
.strip-head { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.strip-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(var(--a-rgb), .15); color: var(--a1); }
.strip-ico .ico { width: 16px; height: 16px; }
.strip-name { flex: 1; }
.pct { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; min-width: 38px; text-align: right; }
.mute-btn {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.mute-btn .ico { width: 16px; height: 16px; }
.mute-btn.on { background: var(--danger); border-color: var(--danger); color: #fff; }

.fader, .fs-vol {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; margin: 4px 0; padding: 0; border: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--a1) var(--v, 100%), var(--surface-3) var(--v, 100%));
  cursor: pointer;
}
.fader::-webkit-slider-thumb, .fs-vol::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 4px rgba(var(--a-rgb), .9), 0 2px 6px rgba(0, 0, 0, .3);
}
.fader::-moz-range-thumb, .fs-vol::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; border: 0;
  background: #fff; box-shadow: 0 0 0 4px rgba(var(--a-rgb), .9);
}
.fader.small { height: 4px; }
.meter { height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--ok), #d9f99d 70%, #fb923c);
  background-size: 220px 100%; transition: width .08s linear;
}
.sink-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); font-weight: 600; }
.sink {
  flex: 1; min-width: 0; padding: 6px 8px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--solid); color: var(--text); font-size: 12px;
}
.people-mix { display: flex; flex-direction: column; gap: 8px; }
.people-mix:not(:empty) { border-top: 1px dashed var(--border-2); padding-top: 10px; margin-top: 2px; }
.person { display: grid; grid-template-columns: 1fr 100px 38px; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; }
.person .pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .pct { min-width: 0; }
.person .pq { grid-column: 1 / -1; margin-top: -4px; font-size: 11px; color: var(--muted); font-weight: 500; }
.person .pq.bad { color: var(--warn); }

/* ===================================================================
   Modal de configurações
   =================================================================== */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5, 5, 12, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade-bg .2s; }
@keyframes fade-bg { from { opacity: 0; } }
.modal-card {
  position: relative; width: min(620px, 100%); max-height: min(760px, 92dvh);
  display: flex; flex-direction: column;
  background: var(--solid); border: 1px solid var(--border-2); border-radius: 26px;
  box-shadow: var(--shadow); animation: sheet .3s var(--ease);
}
@keyframes sheet { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 8px; }
.modal-head h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.seg { display: flex; gap: 4px; margin: 8px 22px 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1; white-space: nowrap; border: 0; background: transparent; color: var(--muted);
  padding: 8px 12px; border-radius: 10px; font-weight: 700; font-size: 13px; transition: background .2s, color .2s;
}
.seg button.active { background: var(--solid); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.modal-body { overflow-y: auto; padding: 12px 22px 24px; overscroll-behavior: contain; }
.set-page { display: none; flex-direction: column; gap: 6px; }
.set-page.active { display: flex; animation: fade .25s var(--ease); }
.set-group { padding: 12px 0; border-bottom: 1px solid var(--border); }
.set-title { font-weight: 700; margin-bottom: 8px; display: flex; gap: 8px; align-items: baseline; }
.set-help { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.set-help b { color: var(--text); }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.set-row .set-title { margin: 0; }
.set-row .set-help { margin-top: 3px; }
.set-row .select { max-width: 55%; }
.switch-row { cursor: pointer; }

.choice { display: flex; flex-wrap: wrap; gap: 6px; }
.choice button {
  position: relative; border: 1px solid var(--border-2); background: var(--surface);
  color: var(--text); padding: 8px 14px; border-radius: 11px; font-weight: 700; font-size: 13px;
  transition: background .2s, border-color .2s, transform .15s;
}
.choice button:hover { background: var(--surface-2); }
.choice button:active { transform: scale(.96); }
.choice button.active { background: rgba(var(--a-rgb), .16); border-color: var(--a1); color: var(--text); box-shadow: inset 0 0 0 1px var(--a1); }
.choice button:disabled { opacity: .35; cursor: not-allowed; }
.choice .hw {
  margin-left: 6px; font-size: 9.5px; font-weight: 800; padding: 1px 5px; border-radius: 5px;
  background: var(--ok); color: #fff; vertical-align: 1px;
}
.swatches button { width: 38px; height: 38px; padding: 0; border-radius: 50%; border: 3px solid var(--solid); box-shadow: 0 0 0 1px var(--border-2); }
.swatches button.active { box-shadow: 0 0 0 2px var(--text); }
.sw-violet { background: linear-gradient(135deg, #8b5cf6, #ec4899) !important; }
.sw-blue { background: linear-gradient(135deg, #3b82f6, #06b6d4) !important; }
.sw-green { background: linear-gradient(135deg, #10b981, #84cc16) !important; }
.sw-orange { background: linear-gradient(135deg, #f97316, #f43f5e) !important; }
.sw-pink { background: linear-gradient(135deg, #ec4899, #a855f7) !important; }

.switch {
  -webkit-appearance: none; appearance: none; flex-shrink: 0;
  width: 46px; height: 28px; border-radius: 99px; margin: 0;
  background: var(--surface-3); position: relative; cursor: pointer; transition: background .25s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .25s var(--ease);
}
.switch:checked { background: var(--grad); }
.switch:checked::after { transform: translateX(18px); }

.keys { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.keys li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.keys kbd { color: var(--text); }

/* ===================================================================
   Avisos
   =================================================================== */
.toast {
  position: fixed; bottom: 28px; left: 50%; z-index: 60;
  transform: translate(-50%, 140px); opacity: 0;
  max-width: min(92vw, 520px); text-align: center;
  background: var(--solid); color: var(--text); border: 1px solid var(--border-2);
  padding: 12px 18px; border-radius: 14px; font-weight: 600; box-shadow: var(--shadow);
  transition: transform .35s var(--ease), opacity .35s; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.unlock {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 70;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px; border: 0; border-radius: 99px;
  background: var(--grad); color: #fff; font-weight: 800;
  box-shadow: 0 10px 34px rgba(var(--a-rgb), .6); animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { box-shadow: 0 10px 44px rgba(var(--a-rgb), 1); } }

/* ===================================================================
   Tela cheia
   =================================================================== */
.fs-chat, .fs-bar { display: none; }
.stage:fullscreen { border: 0; border-radius: 0; }
.stage:fullscreen .stage-tools { display: none; }
.stage:fullscreen .stage-top { opacity: 0; transition: opacity .4s; }
.stage:fullscreen.active .stage-top { opacity: 1; }
.stage:fullscreen.idle { cursor: none; }

.stage:fullscreen .fs-chat {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 8px;
  position: absolute; right: 22px; bottom: 92px; z-index: 5;
  width: min(360px, 38vw); max-height: 55vh; pointer-events: none; transition: opacity .35s;
}
.stage.chat-hidden .fs-chat { opacity: 0 !important; }
.fs-messages {
  display: flex; flex-direction: column; gap: 6px; overflow: hidden;
  mask-image: linear-gradient(to bottom, transparent 0, #000 60px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 60px);
}
.fs-msg {
  align-self: flex-end; max-width: 100%;
  padding: 8px 13px; border-radius: 16px 16px 5px 16px;
  font-size: 14px; line-height: 1.35; color: #fff;
  background: rgba(14, 12, 28, .42);
  backdrop-filter: blur(12px) saturate(140%); -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, .09);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
  overflow-wrap: anywhere;
  animation: fs-in .3s cubic-bezier(.2, .9, .3, 1.2);
  transition: opacity 1.2s ease;
}
.fs-msg .who { font-weight: 800; margin-right: 6px; }
.fs-msg.system { font-style: italic; font-size: 12px; opacity: .8; background: rgba(14, 12, 28, .25); }
.fs-msg.faded { opacity: .12; }
.stage.active .fs-msg.faded, .stage.typing .fs-msg.faded { opacity: .85; }
@keyframes fs-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }

.fs-form { pointer-events: none; opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
.stage.active .fs-form, .stage.typing .fs-form { opacity: 1; transform: none; pointer-events: auto; }
.fs-form input {
  padding: 11px 16px !important; border-radius: 99px !important; font-size: 14px; color: #fff !important;
  background: rgba(14, 12, 28, .5) !important; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .15) !important;
}
.fs-form input::placeholder { color: rgba(255, 255, 255, .55); }

.stage:fullscreen .fs-bar {
  display: flex; align-items: center; gap: 6px;
  position: absolute; left: 50%; bottom: 22px; z-index: 5;
  transform: translate(-50%, 10px);
  padding: 7px 10px; border-radius: 99px;
  background: rgba(14, 12, 28, .55); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .1);
  opacity: 0; transition: opacity .3s, transform .3s;
}
.stage.active .fs-bar { opacity: 1; transform: translate(-50%, 0); }
.fs-btn {
  width: 42px; height: 42px; border: 0; border-radius: 50%; display: grid; place-items: center;
  background: transparent; color: #fff; transition: background .15s;
}
.fs-btn:hover { background: rgba(255, 255, 255, .15); }
.fs-btn.off { background: rgba(244, 63, 94, .8); }
.fs-mix { display: flex; align-items: center; gap: 6px; margin: 0 4px; color: #fff; }
.fs-mix .ico { width: 18px; height: 18px; opacity: .85; }
.fs-vol { width: 90px; }
.fs-sep { width: 1px; height: 24px; background: rgba(255, 255, 255, .16); margin: 0 4px; }
.stage:fullscreen .react-pop { position: absolute; bottom: 86px; }

/* ===================================================================
   Responsivo
   =================================================================== */
@media (max-width: 1180px) {
  :root { --side-w: 330px; }
  .dock-label { display: none; }
  .dock-btn { padding: 0 7px; }
  .brand.small .brand-name { display: none; }
}

@media (max-width: 1000px) {
  .lobby-grid { grid-template-columns: 1fr; gap: 28px; max-width: 520px; }
  .hero { text-align: center; }
  .hero .lead { margin-left: auto; margin-right: auto; }
  .features { text-align: left; }
}

/* Tablet e celular: palco em cima, abas embaixo, controles fixos no rodapé */
@media (max-width: 900px) {
  :root { --dock-h: 72px; }
  .topbar { padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); gap: 10px; }
  .net-status span { display: none; }
  .net-status { padding: 9px; }
  .avatar-stack { display: none; }

  .layout { display: flex; flex-direction: column; gap: 10px; padding: 0 12px; }
  .main-col { display: contents; }
  .stage { flex: none; aspect-ratio: 16 / 9; min-height: 0; max-height: 46dvh; border-radius: 18px; }
  .stage-tools { opacity: 1; transform: none; right: 10px; bottom: 10px; }
  .stage-top { left: 10px; top: 10px; right: 10px; }
  .tool-btn { width: 36px; height: 36px; border-radius: 10px; }
  .tiles { order: 2; }
  .tile { width: 118px; border-radius: 14px; }
  .tile .avatar { width: 38px; height: 38px; font-size: 15px; }
  .side { order: 3; flex: 1; border-radius: 18px; }
  .dock {
    order: 4; align-self: stretch; justify-content: space-around;
    margin: 0 -12px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0; border-bottom: 0; gap: 2px;
  }
  .dock-btn { flex-direction: column; gap: 3px; height: auto; padding: 4px 6px; border-radius: 14px; }
  .dock-ico { width: 46px; height: 46px; border-radius: 50%; }
  .lvl { border-radius: 50%; }
  .dock-btn:hover { background: transparent; }
  .dock-label { display: block; font-size: 10.5px; font-weight: 700; color: var(--muted); }
  .dock-split .dock-btn { padding-right: 6px; }
  .dock-caret { height: 46px; margin-bottom: 18px; padding: 0 4px; border-radius: 0 14px 14px 0; border-left: 0; }
  .dock-caret span { display: none; }
  .react-pop { left: auto; right: -40px; transform: none; flex-wrap: wrap; width: 200px; border-radius: 22px; justify-content: center; }
  @keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.92); } }

  .modal { place-items: end center; padding: 0; }
  .modal-card {
    width: 100%; max-height: 90dvh; border-radius: 26px 26px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet-up .35s var(--ease);
  }
  .modal-card::before { content: ''; width: 40px; height: 5px; border-radius: 99px; background: var(--surface-3); margin: 10px auto 0; }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  .set-row { flex-wrap: wrap; }
  .set-row .select { max-width: 100%; flex: 1 1 100%; }
  .switch-row { flex-wrap: nowrap; }

  .toast { bottom: calc(var(--dock-h) + 18px + env(safe-area-inset-bottom)); }
}

@media (max-width: 520px) {
  .room-pill { padding-left: 12px; }
  .pill-btn span { display: none; }
  .pill-btn { padding: 8px; }
  .brand.small { display: none; }
  .features { grid-template-columns: 1fr; }
  .join-card { padding: 26px 20px 20px; border-radius: 22px; }
  .tab span { display: none; }
  .tab { padding: 10px 6px; }
  .stage-label { font-size: 11.5px; padding: 6px 10px; }
  .stats-chip { font-size: 11px; }
  .dock-ico { width: 44px; height: 44px; }
}

/* Toque: sem hover */
@media (hover: none) {
  .stage-tools { opacity: 1; transform: none; }
}

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

/* Ferramentas do palco só com transmissão; faixa de participantes sem barra de rolagem */
.stage:not(.has-stream) .stage-tools { display: none; }
.tiles { scrollbar-width: none; }
.tiles::-webkit-scrollbar { display: none; }

@media (max-width: 900px) {
  .empty-art { width: 56px; height: 56px; border-radius: 18px; box-shadow: none; }
  .empty-art svg { width: 26px; height: 26px; }
  .stage-empty { gap: 4px; padding: 14px; }
  .stage-empty h3 { font-size: 16px; margin-top: 4px; }
  .stage-empty p { font-size: 12.5px; margin-bottom: 8px; }
}
@media (max-width: 520px) {
  .empty-art { display: none; }
  .unlock { width: calc(100% - 32px); justify-content: center; font-size: 13px; }
}

/* Avatar do quadro um pouco acima do nome */
.tile .avatar { margin-bottom: 20px; }
@media (max-width: 900px) {
  .tile .avatar { width: 32px; height: 32px; font-size: 13px; margin-bottom: 22px; }
}
/* Medidor do portão de voz */
.gate-meter { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.gm-bar { position: relative; flex: 1; height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.gm-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 99px; background: var(--muted); transition: width .08s linear, background .15s; }
.gm-bar.open i { background: linear-gradient(90deg, var(--ok), #a3e635); }
.gm-bar.echo i { background: var(--warn); }
.gm-bar b { position: absolute; top: -2px; bottom: -2px; width: 2px; left: 0; background: var(--text); border-radius: 2px; transition: left .15s; }
.gm-state { min-width: 130px; font-size: 12.5px; font-weight: 700; color: var(--muted); text-align: right; }
.gm-state.open { color: var(--ok); }
.gm-state.echo { color: var(--warn); }

/* IA de voz Krisp */
.krisp-card { margin: 4px 0 8px; padding: 2px 14px; border-radius: 16px; background: rgba(var(--a-rgb), .08); border: 1px solid rgba(var(--a-rgb), .25); }
.krisp-card .set-row:last-child { border-bottom: 0; }
.krisp-status { margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; font-weight: 600; background: var(--surface); color: var(--muted); }
.krisp-status.bvc, .krisp-status.ready { color: var(--ok); }
.krisp-status.nc { color: var(--warn); }
.krisp-status.error, .krisp-status.unsupported { color: var(--danger); }

/* ===================================================================
   Celular — ajustes finos (iPhone 11, SE, mini e Androids pequenos)
   =================================================================== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* iPhone dá zoom ao tocar em campos com fonte < 16px: isso "cortava" a tela */
@media (hover: none), (max-width: 900px) {
  input:not([type]), input[type="text"], select, textarea, .select, .sink { font-size: 16px !important; }
}

/* ---------- Em pé ---------- */
@media (max-width: 900px) and (orientation: portrait), (max-width: 900px) and (min-height: 521px) {
  .topbar { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .room-pill { flex: 1; min-width: 0; }
  .top-right { gap: 8px; flex-shrink: 0; }
  .layout { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }

  /* Barra de botões: divide a largura igualmente, nunca sai da tela */
  .dock { gap: 0; padding-left: 6px; padding-right: 6px; justify-content: space-between; }
  .dock > *, .dock-btn { flex: 1 1 0; min-width: 0; }
  .dock-split { flex: 1.25 1 0; justify-content: center; }
  .dock-split .dock-btn { flex: 0 1 auto; }
  .react-wrap { display: flex; justify-content: center; }
  .react-wrap .dock-btn { flex: 0 1 auto; }
  .dock-btn { padding: 4px 2px; align-items: center; }
  .dock-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dock-caret { flex: 0 0 auto; width: 18px; padding: 0; justify-content: center; }

  .tile { width: 104px; }
  .tabs { margin: 8px 8px 0; }
  .panel { padding: 10px; }
}
@media (max-width: 380px) and (orientation: portrait) {
  .dock-ico { width: 40px; height: 40px; }
  .dock-ico .ico { width: 18px; height: 18px; }
  .dock-label { font-size: 9.5px; }
  .net-status { display: none; }
  .tile { width: 92px; }
}
/* Telas em pé baixas (iPhone SE, mini): tira os quadros de pessoas para sobrar chat */
@media (max-width: 900px) and (orientation: portrait) and (max-height: 640px) {
  .tiles { display: none; }
}

/* ---------- Deitado (qualquer celular: altura pequena) ---------- */
/* Vídeo à esquerda ocupando a altura toda, controles flutuando por cima,
   chat/pessoas numa coluna à direita. Respeita o notch (safe-area). */
@media (orientation: landscape) and (max-height: 520px) {
  .room {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(230px, 34vw, 340px);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 8px;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  .layout, .main-col { display: contents; }

  .stage {
    grid-column: 1; grid-row: 1 / 3;
    width: 100%; height: 100%; min-height: 0; max-height: none; aspect-ratio: auto;
    border-radius: 0; border: 0; box-shadow: none;
  }
  .stage-top { top: max(8px, env(safe-area-inset-top)); left: 8px; right: 8px; }
  .stage-tools { top: max(8px, env(safe-area-inset-top)); bottom: auto; right: 8px; opacity: 1; transform: none; }
  .tool-btn { width: 34px; height: 34px; }
  .stage-label { font-size: 11px; padding: 5px 9px; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
  .stats-chip { font-size: 10.5px; }
  .stage-empty h3 { font-size: 15px; }
  .stage-empty p { font-size: 12px; }
  .empty-art { display: none; }

  .tiles { display: none; }

  .topbar { grid-column: 2; grid-row: 1; padding: max(6px, env(safe-area-inset-top)) 8px 6px 0; gap: 6px; }
  .topbar .brand, .avatar-stack, .net-status span { display: none; }
  .room-pill { flex: 1; min-width: 0; padding: 3px 3px 3px 10px; gap: 6px; }
  .room-name { font-size: 13px; }
  .pill-btn { padding: 7px; }
  .pill-btn span { display: none; }
  .top-right { gap: 6px; }
  .net-status { padding: 8px; }
  .icon-btn { width: 34px; height: 34px; border-radius: 10px; }

  .side {
    grid-column: 2; grid-row: 2; min-height: 0;
    margin: 0 8px calc(6px + env(safe-area-inset-bottom)) 0; border-radius: 14px;
  }
  .tabs { margin: 5px 5px 0; padding: 3px; }
  .tab { padding: 6px 4px; }
  .tab span { display: none; }
  .tab-ink { top: 3px; bottom: 3px; }
  .panel { padding: 6px 8px 8px; }
  .composer { padding: 3px 3px 3px 2px; }
  .composer input { padding: 6px 8px; }
  .send-btn { width: 34px; height: 34px; }
  .typing { min-height: 14px; }

  /* Controles flutuando sobre o vídeo */
  .dock {
    grid-column: 1; grid-row: 2; align-self: end; justify-self: center; z-index: 6;
    position: relative; order: 0; margin: 0 0 calc(8px + env(safe-area-inset-bottom));
    padding: 5px 8px; gap: 4px; border-radius: 20px; border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(14, 12, 28, .55); color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  }
  .dock-btn { flex-direction: row; padding: 2px; height: auto; color: #fff; }
  .dock-label { display: none; }
  .dock-ico { width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
  .dock-caret { height: 40px; margin: 0; padding: 0 2px; color: rgba(255, 255, 255, .7); border: 0; }
  .dock-caret span { display: none; }
  .react-pop { left: 50%; right: auto; transform: translateX(-50%); width: auto; flex-wrap: nowrap; }

  .modal { place-items: end center; padding: 0; }
  .modal-card { width: min(680px, 100%); max-height: 94dvh; border-radius: 22px 22px 0 0; }
  .modal-head { padding: 12px 18px 4px; }
  .seg { margin: 4px 18px; }
  .modal-body { padding: 8px 18px 16px; }

  .unlock { top: max(8px, env(safe-area-inset-top)); font-size: 12.5px; padding: 9px 14px; }
  .toast { bottom: 70px; }
}

/* Celular deitado: controles e botões do vídeo somem quando ninguém toca (como num player) */
@media (orientation: landscape) and (max-height: 520px) {
  .dock, .stage-tools { transition: opacity .35s, transform .35s var(--ease); }
  body.ui-idle .dock { opacity: 0; transform: translateY(12px); pointer-events: none; }
  body.ui-idle .stage-tools, body.ui-idle .stage-top { opacity: 0; pointer-events: none; }
}

/* Em pé e muito baixo (iPhone SE 1ª geração, Androids pequenos): tudo mais compacto */
@media (max-width: 900px) and (orientation: portrait) and (max-height: 600px) {
  .topbar { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: 6px; }
  .icon-btn { width: 36px; height: 36px; }
  .layout { gap: 6px; }
  .stage { aspect-ratio: auto; height: 32dvh; max-height: 32dvh; border-radius: 14px; }
  .stage-label { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
  .tabs { margin: 5px 5px 0; padding: 3px; }
  .tab { padding: 6px 4px; }
  .tab-ink { top: 3px; bottom: 3px; }
  .panel { padding: 6px 8px 8px; }
  .composer input { padding: 6px 8px; }
  .send-btn { width: 36px; height: 36px; }
  .typing { min-height: 12px; }
  .dock { padding-top: 5px; padding-bottom: calc(5px + env(safe-area-inset-bottom)); }
  .dock-ico { width: 40px; height: 40px; }
  .dock-label { font-size: 9.5px; }
}

/* Configurações: cabeçalho e abas nunca encolhem (em telas baixas ficavam cortados) */
.modal-head, .seg { flex-shrink: 0; }
.modal-body { flex: 1 1 auto; min-height: 0; }

/* ===================================================================
   Admin da sala e permissões de transmissão
   =================================================================== */
.role-chip {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  padding: 3px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 800;
  background: rgba(245, 158, 11, .16); color: #f59e0b;
}
.role-chip .ico { width: 13px; height: 13px; }
.crown { display: inline-flex; vertical-align: -2px; color: #f59e0b; }
.crown .ico { width: 15px; height: 15px; }
.tile .t-badge.crown-b { background: rgba(245, 158, 11, .9); }

.dock-btn.locked .dock-ico { background: var(--surface-2); color: var(--text); box-shadow: none; }

.admin-bar { margin: -4px 0 8px; padding: 0 12px; border-radius: 14px; background: rgba(245, 158, 11, .08); border: 1px solid rgba(245, 158, 11, .25); }
.admin-bar .set-row { border-bottom: 0; padding: 10px 0; }

.u-acts { display: flex; gap: 4px; flex-shrink: 0; }
.perm-btn {
  height: 30px; padding: 0 10px; border-radius: 9px; font-size: 12px; font-weight: 700;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; transition: background .2s, border-color .2s;
}
.perm-btn:hover { background: var(--surface-3); }
.perm-btn.on { border-color: var(--a1); background: rgba(var(--a-rgb), .16); }
.perm-btn:disabled { opacity: .45; cursor: default; }
.perm-btn.icon-only { width: 30px; padding: 0; color: #f59e0b; }
.perm-btn.icon-only .ico { width: 15px; height: 15px; }
.perm-btn.sure { background: #f59e0b; color: #fff; border-color: #f59e0b; }

.requests {
  position: fixed; top: max(70px, calc(env(safe-area-inset-top) + 60px)); right: 16px; z-index: 65;
  display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 32px));
}
.stage:fullscreen .requests { position: absolute; top: 20px; }
.req-card {
  display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center;
  padding: 14px; border-radius: 18px; background: var(--solid); color: var(--text);
  border: 1px solid var(--border-2); box-shadow: var(--shadow); animation: sheet .3s var(--ease);
}
.req-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(245, 158, 11, .16); color: #f59e0b; }
.req-text { display: flex; flex-direction: column; min-width: 0; }
.req-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-text span { font-size: 12.5px; color: var(--muted); }
.req-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.req-btn {
  flex: 1; height: 38px; border-radius: 11px; font-weight: 700;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text);
}
.req-btn.yes { border: 0; background: var(--grad); color: #fff; }
@media (max-width: 900px) {
  .requests { left: 50%; right: auto; transform: translateX(-50%); top: max(64px, calc(env(safe-area-inset-top) + 56px)); }
  .role-chip span { display: none; }
}
