The big, open workspace near Beijing's business district has that startup feel: High ceilings, treadmills and snack stations, as well as hundreds of 20-somethings sitting in front of glowing screens.

And lots of rainbow flags and pins. Indeed, the staff here shows far more gay pride than most Chinese dare.

That's because they work for Blued, a gay dating app that's quickly become the most popular in the world. It boasts 40 million registered users while based in a country where most LGBT men and women still feel locked in the closet — where homosexuality, while no longer illegal, is still officially labelled "abnormal."

It helps that the CEO of Blued has become something of an icon in the nascent Chinese gay movement, fighting his way from a youth spent desperately looking for love online in small-town internet cafés.

"Back in my time, we felt depressed, isolated and lonely. I felt so tiny," said Ma Baoli, thinking back 20 years. "I wanted to find a lover, but it was so hard."

His corner office at Blued is decorated with pictures of near-naked men wrapped in rainbow banners, alongside official portraits of him shaking hands with top business and government officials.

It's a strange mix in China.

"I want to be able to stand up and tell people that there is a guy named Geng Le in China, who is gay, living a very happy life, who even has his own adopted baby," said Ma, referring to the pseudonym he has used since his days writing an underground blog about gay life in the small coastal city of Qinghuangdao.

Leading a double life

Back then, he needed to hide. He said he first fell in love with a man while at the police academy in the 1990s.

For years, he led a double life. Publicly, he wore a cop's uniform and enforced laws that included a ban on homosexuality (which was outlawed in China until 1997), and was married to a woman. Privately, Ma ran a website popular with China's stigmatized gay community, estimated to be 70 million people.

This photo of Ma and his boyfriend was taken in the 1990s, when he fell in love while training at a police academy. (Submitted by Ma Baoli)

Eventually, Ma could no longer sustain this elaborate ruse. He left the police force, split from his wife, came out and put his efforts into building Blued, which is now valued at about $600 million US. (Its better-known rival, Grindr, which has about 30 million registered users, was recently taken over by Chinese gaming company Kunlun Tech for almost $250 million.​)

Blued operates mostly in China and Southeast Asia, but has plans to expand to Mexico and Brazil and eventually to North America and Europe. It's also moving beyond dating to offer adoption services to gay couples and free HIV testing clinics in China.

Behind the scenes, Ma uses his profile and political connections to lobby officials to improve LGBT rights and protections.

"We are trying to push forward the LGBT movement and change things for the better," said Ma. "I think when things are as difficult as they are now, it is normal when LGBT people feel hopeless, without security."

Indeed, Beijing's approach to homosexuality has been ambiguous and sometimes contradictory.

"The government has its 'Three No's,'" said Xiaogang Wei, the executive director of the LGBT group Beijing Gender. "Don't support homosexuality, don't oppose and don't promote."

Last month, as Canada and many other countries celebrated Pride, China's sole rainbow gathering was in Shanghai. Organizers said the government limited the event to 200 people.

The 'dark side of society'

In 2016, Beijing banned depictions of gay people on TV and the internet in a sweeping crackdown on "vulgar, immoral and unhealthy content." Regulations said any reference to homosexuality promotes the "dark side of society," lumping gay content in with sexual violence and incest.

A recent report by Human Rights Watch examines how Chinese parents threatened, coerced and sometimes physically forced their adolescent and adult LGBT children to submit to conversion therapy. (Kin Cheung/Associated Press)

A popular Chinese drama called "Addicted" was immediately taken off internet streaming services because it followed two gay men through their relationships.

Yet in April, when Chinese microblogging site Sina Weibo decided to impose its own, apparently unofficial ban on gay content — erasing more than 50,000 posts in one day — Beijing seemed to mirror the disapproval of internet users.

"It's personal choice as to whether you approve of homosexuality or not," wrote the Communist Party's official voice, the People's Daily. "But rationally speaking, it should be consensus that everyone should respect other people's sexual orientations."

In light of that and the online #IAmGay campaign condemning the company's censorship, Weibo apologized and withdrew its ban.

Still, LGBT activists say conservative social attitudes in China are just as big a problem as government restrictions.

"Traditional family values are still very prominent," said Wang Xu, with the LGBT group Common Language. "There's Confucian values that you have to obey your parents, and there's societal norms that you have to get married by a certain age and have children and carry on the family bloodline." She said all of this was accentuated in the decades of China's One Child policy, which put great social expectations on everyone.

Verbal and physical violence by parents against gay children is not uncommon, with some parents committing their offspring to psychiatric hospitals or forcing them to undergo conversion therapy, which is widely offered.

The government doesn't release official statistics on any of this, but LBGT groups say family and social disapproval — especially outside large cities — means only about five per cent of gay Chinese have been ready to come out publicly.

Closely regulated

In light of this, Ma's app walks a fine line. At Blued's headquarters, there are several rows of workers who scan profiles, pictures and posts on the dating app in real-time, around the clock, to make sure nothing runs afoul of China's regulations.

The offices of Blued in Beijing have the feel of a Silicon Valley startup. (Saša Petricic/CBC)

Ma said pornography is part of the government's concern, but it's equally worried about LGBT activism becoming an "uncontrollable" movement that threatens "social stability."

He dismisses that, but said it's been challenging to get officials to understand what gay Chinese people need. On the other hand, he said if they ever do, China's top-down political system means LGBT rights and social acceptance could be decreed and imposed in ways that are impossible in the West.

"In other words," Ma said, "whenever the government is ready to change its approach to gay rights, the whole Chinese society will have to be ready to embrace that."

Additional reporting by Zhao Qian