In a defeat for the gay-rights movement, California voters have put a stop to gay marriage, creating uncertainty about the legal status of 18,000 same-sex couples who tied the knot during a four-month window of opportunity opened by the state’s highest court.