Qubits in phase space: Wigner-function approach to quantum-error correction and the mean-king problem