variáveis ​​CSS não funcionam

First, declare your variable in :root. This ensures that all scopes can access it.
You do it like so:

:root {
	--bg-color: #0F0A0A; /* Blackish */
}

Whenever you use it, wrap it in a var() function like this:

body {
	background: var(--bg-color);
}

Now it should work! I tend to forget the var() part the most.
Repr