With its Carnival reputation and skin-baring beach life, Brazil may look like a liberal bastion. But unease over a worsening economy and deteriorating public safety, plus a backlash against recent gay-rights gains, are propelling a conservative rise that will shape the next administration, regardless of who wins the presidency.