:root {
  --bg: #09090c;
  --bg-soft: #0d0d12;
  --panel: rgba(18, 18, 24, .88);
  --panel-solid: #121218;
  --panel-2: #17171f;
  --stroke: rgba(255,255,255,.08);
  --stroke-strong: rgba(255,255,255,.14);
  --text: #f7f7fb;
  --muted: #9898a8;
  --muted-2: #686878;
  --accent: #22c55e;
  --accent-2: #10b981;
  --accent-soft: rgba(34, 197, 94, .14);
  --broadcast-start: color-mix(in srgb, var(--accent) 46%, #080b10);
  --broadcast-end: color-mix(in srgb, var(--accent-2) 46%, #080b10);
  --broadcast-gradient: linear-gradient(110deg, var(--broadcast-start), var(--broadcast-end));
  --broadcast-ink: #ffffff;
  --broadcast-status-ink: color-mix(in srgb, var(--accent) 16%, #e2e7ee);
  --green: #22c55e;
  --danger: #ff5f6d;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow: 0 24px 80px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  color-scheme: dark;
}
body {
  background:
    radial-gradient(circle at 75% 15%, rgba(16, 185, 129, .14), transparent 34%),
    radial-gradient(circle at 15% 80%, rgba(34, 197, 94, .10), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  position: relative;
  display: flex;
  flex-direction: column;
}
button, input { font: inherit; }
button { color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.mobile-only { display: none; }

/* Granulado suave de fundo */
.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: .042;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='1'/%3E%3C/svg%3E");
}

/* Custom Titlebar para Electron Desktop */
.desktop-titlebar {
  height: 36px;
  background: rgba(11, 11, 15, 0.95);
  border-bottom: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 999;
  user-select: none;
  flex-shrink: 0;
}
.titlebar-drag-region {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 14px;
  -webkit-app-region: drag;
}
.titlebar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}
.titlebar-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #94a3b8;
}
.window-controls {
  display: flex;
  align-items: center;
  height: 100%;
  -webkit-app-region: no-drag;
}
.win-btn {
  width: 46px;
  height: 100%;
  border: 0;
  background: transparent;
  color: #94a3b8;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.win-btn svg {
  width: 14px;
  height: 14px;
}
.win-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.win-btn.close-btn:hover {
  background: #ef4444;
  color: #fff;
}

#app {
  position: relative;
  z-index: 1;
  flex: 1;
  height: calc(100% - 36px);
  min-height: 0;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.screen { height: 100%; width: 100%; overflow: hidden; display: flex; flex-direction: column; }

/* -------------------------------------------------------------
   LANDING PAGE (Zero Overflow)
------------------------------------------------------------- */
.landing-screen {
  justify-content: space-between;
  position: relative;
  isolation: isolate;
}
.landing-screen::before {
  content: ""; position: absolute; width: 530px; height: 530px; left: -230px; top: 150px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.04); box-shadow: 0 0 0 90px rgba(255,255,255,.012), 0 0 0 180px rgba(255,255,255,.009); z-index: -1;
}
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--text); }
.brand-logo-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.15));
}
.brand.compact .brand-logo-img {
  width: 28px;
  height: 28px;
}
.brand-text { font-size: 15px; font-weight: 800; letter-spacing: .11em; }
.brand-text b { color: var(--accent); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.desktop-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 999px;
  padding: 6px 14px;
  color: #4ade80;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}
.desktop-pill:hover {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.4);
  transform: translateY(-1px);
}
.desktop-pill svg {
  width: 15px;
  height: 15px;
}
.status-pill {
  display: flex; align-items: center; gap: 8px;
  color: #b7b7c2; font-size: 12px; font-weight: 600;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--stroke); background: rgba(255,255,255,.025);
}
.status-dot, .live-dot { width: 8px; height: 8px; background: var(--green); border-radius: 50%; box-shadow: 0 0 0 4px rgba(34,197,94,.18); }

.landing-content {
  flex: 1;
  display: grid;
  grid-template-columns: 1.1fr .85fr;
  align-items: center;
  gap: 50px;
  padding: 10px 0;
  min-height: 0;
}
.eyebrow { display: inline-block; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .2em; margin-bottom: 12px; }
.eyebrow.small { font-size: 10px; margin-bottom: 8px; }
.hero-copy h1 { margin: 0; max-width: 680px; font-size: clamp(38px, 4.6vw, 68px); line-height: 1.02; letter-spacing: -.04em; font-weight: 800; }
.hero-copy h1 span { color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.35); }
.hero-copy > p { max-width: 580px; margin: 16px 0 0; color: #aaaaba; line-height: 1.6; font-size: 15px; }
.feature-row { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.mini-feature {
  display: flex; align-items: center; gap: 10px; min-width: 130px; padding: 8px 12px 8px 8px;
  border-radius: 12px; border: 1px solid var(--stroke); background: rgba(255,255,255,.02);
}
.mini-feature .mini-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 8px;
  flex-shrink: 0;
}
.mini-feature .mini-icon svg {
  width: 14px;
  height: 14px;
}
.mini-feature p { margin: 0; color: #c8c8d1; font-size: 11px; font-weight: 600; }

.panel { border: 1px solid var(--stroke); background: linear-gradient(180deg, rgba(22,22,30,.92), rgba(14,14,20,.92)); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.join-card { padding: 26px; border-radius: var(--radius-xl); position: relative; overflow: hidden; }
.join-card::before { content: ""; position: absolute; height: 2px; left: 28px; right: 28px; top: 0; background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent); opacity: .9; }
.card-kicker { font-size: 10px; letter-spacing: .18em; color: var(--accent); font-weight: 800; }
.card-head h2 { margin: 6px 0 4px; font-size: 22px; letter-spacing: -.03em; }
.card-head p { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.join-form label { display: block; color: #c9c9d2; font-size: 11px; font-weight: 600; margin: 0 0 6px 2px; }
.code-wrap {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; border: 1px solid var(--stroke-strong); border-radius: 12px; background: #0c0c11; transition: .2s ease;
}
.code-wrap.nick-wrap { margin-bottom: 12px; }
.code-wrap:focus-within { border-color: color-mix(in srgb, var(--accent) 65%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent); }
.code-wrap span { color: var(--accent); font-size: 16px; font-weight: 800; }
.code-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; color: white; background: transparent; font-weight: 600; font-size: 13px; letter-spacing: .03em; }
.code-wrap input#roomCode { font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.code-wrap input::placeholder { color: #4f4f5c; }
.btn { border: 0; cursor: pointer; border-radius: 12px; height: 46px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px; font-weight: 700; transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-full { width: 100%; }
.btn-primary { margin-top: 12px; background: linear-gradient(110deg, var(--accent), var(--accent-2)); color: #06110a; font-weight: 800; box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 25%, transparent); }
.btn-secondary { background: #181820; border: 1px solid var(--stroke); }
.btn-secondary:hover { border-color: var(--stroke-strong); background: #1d1d26; }
.divider { display: flex; align-items: center; gap: 10px; color: #555563; margin: 12px 0; font-size: 10px; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--stroke); }
.privacy-note { margin: 14px 0 0; color: var(--muted-2); font-size: 10px; text-align: center; }
.landing-footer { height: 44px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--stroke); color: #575764; font-size: 10px; font-weight: 700; letter-spacing: .16em; flex-shrink: 0; }

/* Abas de Navegação na Tela Inicial (Criar Sala vs Entrar) */
.landing-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 16px;
  gap: 4px;
}
.landing-tab {
  flex: 1;
  height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.landing-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}
.landing-tab.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.landing-tab svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.landing-panel {
  display: flex;
  flex-direction: column;
}
.landing-panel.hidden {
  display: none !important;
}
.join-room-status { margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.join-password-group .code-wrap { border-color: rgba(34,197,94,.55); margin-bottom: 8px; }
.join-password-group .field-icon { color: var(--accent); }
.join-password-group.attention .code-wrap { animation: passwordAttention .65s ease-out 2; }
.join-room-status.error { color: #fca5a5; }
@keyframes passwordAttention {
  0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
  50% { box-shadow: 0 0 0 5px rgba(34,197,94,.18); }
}
@media (prefers-reduced-motion: reduce) { .join-password-group.attention .code-wrap { animation: none; } }

/* Indicador de Cadeado no Topo Central (SALA ATUAL) */
.room-meta-header {
  display: flex;
  align-items: center;
  gap: 4px;
}
.meta-lock-icon {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  color: var(--accent);
}
.meta-lock-icon.hidden {
  display: none !important;
}

/* -------------------------------------------------------------
   ROOM & STAGE (Zero Overflow, Dock Centralizado e Seguro)
------------------------------------------------------------- */
.room-screen {
  background: transparent;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.room-header {
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--stroke);
  background: rgba(11,11,15,.88);
  backdrop-filter: blur(18px);
  position: relative;
  z-index: 20;
  flex-shrink: 0;
}
.header-right { display: flex; align-items: center; gap: 8px; }
.brand.compact .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
.brand.compact .brand-text { font-size: 13px; }
.room-meta { position: absolute; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; }
.room-meta small { display: block; color: #828292; font-size: 9px; letter-spacing: .18em; font-weight: 800; margin-bottom: 2px; }
.room-code { padding: 0; border: 0; background: none; display: flex; gap: 6px; align-items: center; color: #e2e8f0; font-size: 13px; font-weight: 700; cursor: pointer; letter-spacing: .05em; }
.room-code svg { width: 14px; height: 14px; color: var(--accent); }

.room-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.people-sidebar {
  border-right: 1px solid var(--stroke);
  background: rgba(12, 12, 17, 0.88);
  backdrop-filter: blur(20px);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.sidebar-head { display: flex; justify-content: space-between; align-items: center; padding: 0 6px 12px; flex-shrink: 0; }
.sidebar-head h3 { margin: 0; font-size: 15px; letter-spacing: -.02em; font-weight: 700; }
.sidebar-head h3 b { color: #8e8e9e; font-size: 12px; margin-left: 4px; }
.sidebar-people-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  flex-shrink: 0;
}
.sidebar-people-icon svg {
  width: 17px;
  height: 17px;
}
.participants-list { display: flex; flex-direction: column; gap: 6px; flex: 1; overflow-y: auto; min-height: 0; padding-right: 2px; }
.person-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; color: #d1d1da; transition: .18s; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.04); flex-shrink: 0; }
.person-row:hover { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.08); }
.person-avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: white; border: 1px solid rgba(255,255,255,.08); background: linear-gradient(135deg, #252531, #17171f); position: relative; flex-shrink: 0; }
.person-avatar-img { width: 100%; height: 100%; border-radius: 9px; object-fit: cover; display: block; }
.person-copy { min-width: 0; flex: 1; }
.person-copy strong { display: block; font-size: 12px; font-weight: 600; color: #f1f5f9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-copy small { display: block; color: #8e8e9e; font-size: 10px; margin-top: 2px; }
.person-tag { color: var(--accent); background: var(--accent-soft); padding: 3px 6px; border-radius: 6px; font-size: 8px; letter-spacing: .08em; font-weight: 800; }
.sidebar-note { margin-top: auto; display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--stroke); background: rgba(255,255,255,.02); flex-shrink: 0; }
.shield-icon { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; background: rgba(34,197,94,.12); color: var(--green); }
.shield-icon svg { width: 15px; height: 15px; }
.sidebar-note strong { display: block; font-size: 11px; color: #e2e8f0; }
.sidebar-note small { display: block; margin-top: 2px; color: #8e8e9e; font-size: 10px; line-height: 1.35; }

.stage-shell {
  min-width: 0;
  height: 100%;
  min-height: 0;
  position: relative;
  padding: 12px 16px 82px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.stage-topbar { height: 32px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; margin-bottom: 6px; }
.stage-title span { display: block; font-size: 10px; color: #8e8e9e; font-weight: 800; letter-spacing: .14em; margin-bottom: 2px; }
.stage-title strong { font-size: 13px; color: #e2e8f0; font-weight: 700; }
.layout-switcher { display: flex; padding: 3px; border: 1px solid var(--stroke); border-radius: 10px; background: #101016; }
.layout-btn, .icon-btn { border: 0; cursor: pointer; background: transparent; display: grid; place-items: center; color: #8e8e9e; }
.layout-btn { width: 30px; height: 26px; border-radius: 6px; }
.layout-btn svg { width: 15px; height: 15px; }
.layout-btn.active { background: #21212a; color: white; }

/* GRID CONTAINER */
.stream-grid {
  flex: 1;
  min-height: 0;
  height: 100%;
  position: relative;
  z-index: 1;
  overflow: hidden;
  display: grid;
  gap: 10px;
}

/* Modo Grade Adaptativo */
.stream-grid.layout-grid {
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
}

/* Modo Destaque (Spotlight) */
.stream-grid.layout-focus {
  grid-template-columns: minmax(0, 1fr) 220px;
  grid-template-rows: 100%;
  align-items: stretch;
}
.stream-grid.layout-focus .stream-tile.focused {
  grid-column: 1;
  grid-row: 1;
  height: 100%;
  max-height: 100%;
  width: 100%;
}
.stream-grid.layout-focus .stream-tile:not(.focused) {
  grid-column: 2;
  height: auto;
  max-height: 140px;
  aspect-ratio: 16/9;
}

.stream-tile {
  min-width: 0;
  height: 100%;
  max-height: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 0;
  background: #111117;
  cursor: pointer;
  transition: transform .2s ease;
  z-index: 2;
  display: flex;
}
.stream-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #08080b; }

.tile-gradient { position: absolute; inset: auto 0 0; height: 70px; background: linear-gradient(transparent, rgba(0,0,0,.8)); pointer-events: none; z-index: 2; }
.tile-label { position: absolute; left: 12px; bottom: 10px; z-index: 3; display: flex; align-items: center; gap: 8px; }
.tile-label strong { font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.tile-label small { color: #cbd5e1; font-size: 10px; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.tile-actions { position: absolute; top: 10px; right: 10px; z-index: 10; display: flex; align-items: center; gap: 6px; opacity: 0; transform: translateY(-4px); transition: opacity .18s ease, transform .18s ease; }
.stream-tile:hover .tile-actions, .stream-tile.focused .tile-actions, .stream-tile.touch-active .tile-actions { opacity: 1; transform: translateY(0); }
.tile-action { height: 30px; width: 30px; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; background: rgba(14,14,20,.88); backdrop-filter: blur(12px); color: #cbd5e1; display: grid; place-items: center; cursor: pointer; transition: all .15s ease; }
.tile-action:hover { background: rgba(30,30,42,.95); color: #fff; border-color: rgba(255,255,255,.25); transform: translateY(-1px); }
.tile-action:active { transform: translateY(0); }
.tile-action.muted { background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.5); color: #f87171; }
.tile-action.muted:hover { background: rgba(239, 68, 68, 0.35); color: #fff; }
.tile-action svg { width: 15px; height: 15px; pointer-events: none; }

/* Suporte Nativo a Fullscreen no Card */
.stream-tile:fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border: 0 !important;
  background: #000 !important;
}
.stream-tile:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border: 0 !important;
  background: #000 !important;
}
.stream-tile:fullscreen video,
.stream-tile:-webkit-full-screen video {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

/* Centralização do empty stage */
.empty-tile-wrapper {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: auto;
}
.empty-tile {
  border: 2px dashed rgba(255,255,255,.12);
  background: rgba(18, 18, 24, .6);
  backdrop-filter: blur(16px);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  max-width: 440px;
  width: 100%;
  margin: auto;
  cursor: default;
}
.empty-tile-inner { text-align: center; color: #64748b; padding: 20px; }
.empty-tile-inner svg { width: 32px; height: 32px; margin-bottom: 8px; color: var(--accent); }
.empty-tile-inner strong { display: block; font-size: 14px; color: #e2e8f0; font-weight: 700; }
.empty-tile-inner small { font-size: 12px; color: #94a3b8; margin-top: 4px; display: block; line-height: 1.4; }

/* DOCK DE CONTROLES INFERIOR — 100% Centralizado no Stage e Livre de Cortes */
.room-controls-wrap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  z-index: 30;
  pointer-events: auto;
}
.room-controls {
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid var(--stroke-strong);
  background: rgba(16,16,22,.94);
  backdrop-filter: blur(22px);
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
}
.control-btn { min-width: 140px; height: 48px; border: 0; border-radius: 10px; background: #1a1a22; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 0 12px; transition: .18s ease; }
.control-btn:hover { background: #22222d; }
.control-btn.active { background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.primary-control { background: #f8fafc; color: #06110a; }
.primary-control:hover { background: #ffffff; }
.primary-control.active { color: var(--broadcast-ink); background: var(--broadcast-gradient); box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 24%, transparent); }
.danger-control { min-width: 100px; color: #ffb8be; background: rgba(255,95,109,.08); }
.danger-control:hover { background: rgba(255,95,109,.16); }
.control-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.06); flex: 0 0 auto; }
.primary-control .control-icon { background: rgba(0,0,0,.08); }
.primary-control.active .control-icon { background: rgba(0,0,0,.12); }
.control-icon svg { width: 16px; height: 16px; }
.control-text { min-width: 0; text-align: left; }
.control-text strong, .control-text small { display: block; white-space: nowrap; }
.control-text strong { font-size: 12px; font-weight: 700; }
.control-text small { color: #8e8e9e; font-size: 10px; margin-top: 1px; }
.primary-control .control-text small { color: #475569; }
.primary-control.active .control-text small { color: var(--broadcast-status-ink); font-weight: 500; }
.danger-control .control-text small { color: #fda4af; }

/* Split button de controle de tela */
.screen-control-group {
  position: relative;
  display: flex;
  align-items: stretch;
}

.screen-control-group.is-streaming #screenBtn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  padding-right: 10px;
}

.camera-control-group {
  position: relative;
  display: flex;
  align-items: stretch;
}

.camera-control-group.has-dropdown #cameraBtn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  padding-right: 10px;
}

.camera-device-popover {
  width: 300px;
}

.camera-devices-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 2px;
}

.camera-device-pill {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.camera-device-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.camera-device-pill.active {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.4);
  color: #4ade80;
  font-weight: 700;
}

.camera-device-pill svg {
  flex-shrink: 0;
}

.camera-device-pill span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.control-dropdown-btn {
  width: 32px;
  height: 48px;
  border: 0;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
  background: #1a1a22;
  color: #94a3b8;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.18s ease;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}
.control-dropdown-btn:hover {
  background: #22222d;
  color: #fff;
}
.control-dropdown-btn.active,
.control-dropdown-btn.open {
  background: var(--accent-soft);
  color: var(--accent);
}
.control-dropdown-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.control-dropdown-btn.open svg {
  transform: rotate(180deg);
}

/* Upward Popover de Qualidade estilo Discord */
.stream-quality-popover {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  width: 280px;
  background: rgba(16, 16, 22, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8),
              0 0 0 1px rgba(255, 255, 255, 0.04),
              inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 60;
  animation: popoverFadeUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popoverFadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.popover-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
}
.popover-header-title svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  color: var(--accent);
}
.popover-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.popover-section {
  margin-bottom: 10px;
}
.popover-section-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  color: #8e8e9e;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.popover-pills {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.popover-pill {
  flex: 1;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.12s ease;
}
.popover-pill:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.popover-pill.active {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.35);
  color: #4ade80;
  font-weight: 700;
}

.popover-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.popover-action-btn {
  width: 100%;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  transition: all 0.15s ease;
}
.popover-action-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}
.popover-action-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  color: #94a3b8;
}

/* Ícone de campo flat nos inputs */
.code-wrap .field-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  color: var(--accent);
  flex-shrink: 0;
  margin: 0;
  display: block;
}

/* -------------------------------------------------------------
   MODAIS MODERNOS (Glassmorphism de Alto Padrão)
------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 7, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: modalOverlayFade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalOverlayFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalPopIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-card {
  width: min(440px, 100%);
  background: rgba(16, 16, 22, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 22px 24px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.85),
              0 0 0 1px rgba(255, 255, 255, 0.04),
              inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: modalPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.modal-head,
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-head-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  display: grid;
  place-items: center;
  color: #f1f5f9;
  flex-shrink: 0;
}

.modal-head-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.modal-head h2,
.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.modal-subtext,
.modal-header small {
  display: block;
  font-size: 11px;
  color: #8e8e9e;
  margin-top: 2px;
  font-weight: 500;
}

.modal-head .close-btn,
.modal-header .close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.modal-head .close-btn svg,
.modal-header .close-btn svg {
  width: 16px;
  height: 16px;
}

.modal-head .close-btn:hover,
.modal-header .close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.setting-group label, .join-card .entry-label {
  display: block;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Segmented pill selectors (Perfeição visual sem quebra de borda) */
.pill-group {
  display: grid;
  gap: 5px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.resolution-pills {
  grid-template-columns: repeat(4, 1fr);
}

.fps-pills {
  grid-template-columns: repeat(3, 1fr);
}

.pill-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 2px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.pill-btn span {
  font-size: 9px;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.pill-btn.active {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.35);
  color: #4ade80;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.pill-btn.active span {
  color: #86efac;
}

/* Info Box / Bitrate */
.bitrate-info-box {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bitrate-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 600;
}

.bitrate-title svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.bitrate-val {
  font-size: 11px;
  font-weight: 800;
  color: #4ade80;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  padding: 3px 8px;
  border-radius: 6px;
  font-family: var(--font-mono, monospace);
}

/* Audio Row */
.audio-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
}

.audio-toggle-info strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #f1f5f9;
}

.audio-toggle-info small {
  display: block;
  font-size: 10px;
  color: #64748b;
  margin-top: 1px;
}

/* Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 22px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(16px);
}

.modal-footer {
  margin-top: 18px;
}

.modal-footer.modal-actions-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-footer .btn {
  margin-top: 0 !important;
  height: 44px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-footer .btn-secondary {
  box-shadow: none !important;
  background: #181820;
  border: 1px solid var(--stroke);
  color: #94a3b8;
}

.modal-footer .btn-secondary:hover {
  background: #1e1e28;
  border-color: var(--stroke-strong);
  color: #ffffff;
}

.modal-footer .btn-primary {
  margin-top: 0 !important;
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.25);
}

/* Profile Modal & Avatar Upload */
.profile-modal-card {
  width: min(440px, 100%);
}
.avatar-upload-section {
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
}
.avatar-preview-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}
.avatar-preview-box {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1e1e28, #13131b);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  position: relative;
}
.avatar-preview-initials {
  font-size: 22px;
  font-weight: 800;
  color: #f1f5f9;
}
.avatar-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-upload-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.avatar-upload-info strong {
  font-size: 14px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.avatar-upload-info small {
  font-size: 11px;
  color: var(--muted);
}
.avatar-btn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 11px;
  border-radius: 8px;
}
.btn-ghost {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}
.btn-ghost:hover {
  background: rgba(239, 68, 68, 0.12);
}
.upload-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.upload-label svg {
  width: 14px;
  height: 14px;
}

.toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 15px); z-index: 80; padding: 10px 16px; border-radius: 11px; color: #f8fafc; background: #1e293b; border: 1px solid rgba(255,255,255,.14); box-shadow: 0 12px 36px rgba(0,0,0,.45); font-size: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Menu de Contexto Customizado (Botão Direito no Vídeo) */
.stream-context-menu {
  position: fixed;
  z-index: 200;
  width: 250px;
  background: rgba(18, 18, 26, 0.96);
  border: 1px solid var(--stroke-strong);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(24px);
  user-select: none;
}
.menu-header {
  padding: 2px 6px 8px;
}
.menu-header strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.menu-header small {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 1px;
}
.menu-divider {
  height: 1px;
  background: var(--stroke);
  margin: 6px 0;
}
.menu-volume-control {
  padding: 4px 6px;
}
.menu-volume-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.vol-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.05em;
}
.vol-val {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
}
.vol-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.vol-mute-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.vol-mute-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.vol-mute-btn.muted {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}
.vol-mute-btn svg {
  width: 15px;
  height: 15px;
}
.vol-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #232330;
  outline: none;
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}
.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: #d1d1da;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.menu-item svg {
  width: 15px;
  height: 15px;
  color: #94a3b8;
}
.menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

/* Indicador Discreto de Som Mutado no Card */
.muted-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.85);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}
.muted-badge svg {
  width: 13px;
  height: 13px;
}

/* -------------------------------------------------------------
   HUD & SUTIL INDICADOR DE REDE / LATÊNCIA (Top Bar)
------------------------------------------------------------- */
.net-stats-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(18, 18, 24, 0.7);
  border: 1px solid var(--stroke);
  border-radius: 20px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  user-select: none;
}
.net-stats-pill:hover {
  background: rgba(34, 197, 94, 0.1);
  border-color: var(--accent);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.2);
}
.net-stats-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
  animation: pulseDot 2s infinite;
}
.net-stats-text {
  font-family: var(--font-mono, monospace);
  color: #e2e8f0;
}
.net-stats-loss {
  font-size: 9px;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  padding: 1px 5px;
  border-radius: 4px;
}

.net-stats-quality {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
  padding: 1px 6px;
  border-radius: 6px;
  line-height: 1.35;
  white-space: nowrap;
  display: inline-block;
}
.net-stats-quality.hidden {
  display: none !important;
}

.tile-badge .tile-quality {
  font-size: 9px;
  font-weight: 800;
  color: #4ade80;
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
  display: inline-block;
}
.tile-badge .tile-quality:empty {
  display: none !important;
}

/* -------------------------------------------------------------
   MODAL DE QUALIDADE DA CONEXÃO & DIAGNÓSTICO
------------------------------------------------------------- */
.stats-modal-card {
  width: min(100%, 460px);
}

.stats-modal-body {
  padding: 4px 0 0;
}

.stats-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 0.15s ease;
}

.stat-box:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.04em;
}

.stat-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1px;
}

.stat-value-row strong {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-mono, monospace);
}

.stat-tag {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
}

.stat-tag.success {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.stat-tag.warning {
  background: rgba(234, 179, 8, 0.12);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.25);
}

.stat-tag.danger {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.stat-tag.neutral {
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stats-infra-banner {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 11px 13px;
}

.infra-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.infra-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
}

.infra-title svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.infra-badge {
  font-size: 9px;
  font-weight: 800;
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25);
  padding: 2px 6px;
  border-radius: 5px;
}

.stats-infra-banner p {
  margin: 0 0 8px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
}

.session-transfer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #94a3b8;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.session-transfer-row strong {
  font-size: 11px;
  color: #4ade80;
  font-family: var(--font-mono, monospace);
}

/* -------------------------------------------------------------
   RESPONSIVIDADE (Mobile com scroll)
------------------------------------------------------------- */
@media (max-width: 920px) {
  .landing-content { grid-template-columns: minmax(0, 1fr); gap: 24px; justify-items: center; align-content: center; }
  .hero-copy { width: 100%; max-width: 680px; text-align: center; }
  .hero-copy :is(h1, p) { margin-inline: auto; }
  .feature-row { justify-content: center; }
  .join-card { width: min(100%, 480px); }
  .hero-copy h1 { font-size: clamp(34px, 6.5vw, 54px); }
  .room-body { grid-template-columns: 200px minmax(0,1fr); }
  .control-btn { min-width: 115px; }
  .stream-grid.layout-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  html, body { overflow: auto; height: auto; min-height: 100vh; }
  #app { height: auto; min-height: 100vh; overflow: visible; }
  .mobile-only { display: grid; }
  .shell { width: min(100% - 24px, 1180px); }
  .topbar { height: 60px; }
  .status-pill { display: none; }
  .landing-screen { height: auto; min-height: 100vh; overflow: visible; }
  .landing-content { padding: 20px 0 24px; align-items: start; }
  .hero-copy h1 { font-size: clamp(30px, 8.5vw, 44px); }
  .hero-copy > p { font-size: 13px; line-height: 1.55; }
  .feature-row { margin-top: 16px; gap: 6px; }
  .mini-feature { min-width: 0; flex: 1; padding-right: 6px; }
  .mini-feature p { font-size: 10px; }
  .join-card { border-radius: 20px; padding: 20px 16px; }
  .landing-footer { height: 44px; font-size: 8px; }
  .landing-footer span:last-child { display: none; }

  .room-screen { height: auto; min-height: 100vh; overflow: visible; }
  .room-header { height: 54px; padding: 0 12px; }
  .brand.compact .brand-text { display: none; }
  .room-meta { left: 50%; }
  .room-meta small { display: none; }
  .room-code { font-size: 12px; }
  .icon-btn { width: 34px; height: 34px; border: 1px solid var(--stroke); border-radius: 9px; background: #111117; position: relative; }
  .icon-btn svg { width: 16px; height: 16px; }
  #peopleBadge { position: absolute; right: -3px; top: -4px; min-width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #06110a; font-size: 8px; font-weight: 800; border: 2px solid #0b0b0f; }
  
  .room-body { display: flex; flex-direction: column; height: auto; max-height: none; overflow: visible; min-height: calc(100vh - 54px); }
  .people-sidebar {
    position: relative;
    inset: auto;
    width: 100%;
    min-height: auto;
    height: auto;
    transform: none;
    border-right: 0;
    border-top: 1px solid var(--stroke);
    background: rgba(12, 12, 17, 0.95);
    padding: 16px 14px 92px;
    box-shadow: none;
    order: 2;
  }
  .stage-shell { order: 1; height: auto; max-height: none; overflow: visible; padding: 10px 10px 16px; }
  .stage-topbar { height: 34px; }
  .stream-grid { height: auto; max-height: none; min-height: auto; gap: 8px; }
  .stream-grid.layout-grid { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .stream-grid.layout-focus { display: flex; flex-direction: column; }
  .stream-grid.layout-focus .stream-tile.focused { order: -1; min-height: 50vh; }
  .stream-tile { min-height: 200px; aspect-ratio: 16/10; border-radius: 14px; }
  .stream-grid.layout-focus .stream-tile:not(.focused) { min-height: 130px; aspect-ratio: 16/8; }
  
  .room-controls-wrap { position: fixed; left: 0; right: 0; bottom: 0; transform: none; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(9,9,13,.96) 32%); }
  .room-controls { width: 100%; justify-content: center; border-radius: 14px; padding: 5px; gap: 4px; }
  .control-btn { min-width: 0; flex: 1; height: 48px; justify-content: center; padding: 0 4px; }
  .control-text { display: none; }
  .control-icon { width: 30px; height: 30px; background: rgba(255,255,255,.04); }
  .danger-control { flex: .7; }
  .toast { bottom: 74px; max-width: calc(100% - 24px); text-align: center; }
  .tile-actions { opacity: 0.9; transform: none; }
}

/* -------------------------------------------------------------
   MODO PAISAGEM MOBILE (Landscape Imersivo Widescreen)
------------------------------------------------------------- */
@media (orientation: landscape) and (max-height: 540px) {
  html, body, #app { height: 100vh !important; max-height: 100vh !important; overflow: hidden !important; }
  .desktop-titlebar { display: none !important; }
  .room-screen { height: 100vh !important; max-height: 100vh !important; overflow: hidden !important; }
  .room-header { display: none !important; }
  .stage-topbar { display: none !important; }
  
  .room-body {
    display: flex !important;
    height: 100vh !important;
    max-height: 100vh !important;
    width: 100vw !important;
    overflow: hidden !important;
  }
  
  .people-sidebar {
    position: fixed !important;
    inset: 0 0 0 auto !important;
    z-index: 70 !important;
    width: min(75vw, 280px) !important;
    height: 100vh !important;
    min-height: 100vh !important;
    transform: translateX(105%) !important;
    transition: transform 0.22s ease !important;
  }
  .people-sidebar.open { transform: translateX(0) !important; }

  .stage-shell {
    flex: 1 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    padding: 0 !important;
    overflow: hidden !important;
    position: relative !important;
  }

  .stream-grid {
    height: 100vh !important;
    max-height: 100vh !important;
    width: 100vw !important;
    gap: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  .stream-grid.layout-grid,
  .stream-grid.layout-focus {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100vh !important;
  }

  .stream-tile {
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    border: 0 !important;
    aspect-ratio: auto !important;
    min-height: 0 !important;
    background: #050508 !important;
  }
  .stream-tile video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  .stream-grid.layout-focus .stream-tile:not(.focused) {
    display: none !important;
  }

  /* Dock Flutuante e Inteligente em Landscape */
  .room-controls-wrap {
    position: fixed !important;
    left: 50% !important;
    bottom: max(6px, env(safe-area-inset-bottom)) !important;
    transform: translateX(-50%) !important;
    z-index: 50 !important;
    padding: 0 !important;
    background: transparent !important;
    transition: opacity 0.35s ease, transform 0.35s ease !important;
  }
  .room-controls-wrap.idle-hide {
    opacity: 0.12 !important;
    transform: translateX(-50%) translateY(8px) !important;
  }
  .room-controls-wrap:hover,
  .room-controls-wrap:focus-within,
  .room-controls-wrap.active-touch {
    opacity: 1 !important;
    transform: translateX(-50%) translateY(0) !important;
  }

  .room-controls {
    border-radius: 12px !important;
    padding: 3px 6px !important;
    gap: 4px !important;
    background: rgba(14, 14, 20, 0.82) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    backdrop-filter: blur(24px) !important;
  }
  .control-btn {
    min-width: 0 !important;
    width: 40px !important;
    height: 38px !important;
    padding: 0 !important;
    justify-content: center !important;
  }
  .control-icon {
    width: 26px !important;
    height: 26px !important;
  }
  .control-icon svg {
    width: 15px !important;
    height: 15px !important;
  }
  .control-text { display: none !important; }
  .tile-actions { opacity: 0.95 !important; transform: none !important; }
}

/* Banner de Reconexão */
.reconnecting-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.22);
  border: 1px solid rgba(239, 68, 68, 0.5);
  backdrop-filter: blur(16px);
  color: #fca5a5;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  animation: bannerPulse 2s infinite ease-in-out;
}
@keyframes bannerPulse {
  0%, 100% { opacity: 0.95; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.75; transform: translateX(-50%) scale(0.98); }
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444;
}

.stream-health { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; background: #101116; color: #c1c5ce; z-index: 2; font-size: .9rem; }
.stream-health.hidden { display: none; }

#peopleSidebar .participants-list { flex: 1; }
@media (max-width: 680px) {
  html, body { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  #app { height: 100%; min-height: 0; overflow: hidden; }
  #room { overflow-y: auto; }
  .room-body { min-height: calc(100dvh - 54px); }
}

