3. The solution set of the equation $x^{2}+x-1=x \pi^{x^{2}-1}+\left(x^{2}-1\right) \pi^{x}$ is $A$ (where $\pi$ is an irrational number, $\pi=3.141 \cdots$, and $x$ is a real number), then the sum of the squares of all elements in $A$ is ( ).
A. 0
B. 1
C. 2
D. 4