Set ::visible to false on panels when they are destroyed
Don’t try to upgrade CSS rules with no selector text

Fixes #4469