If you thought she was 18 and of legal age, I don't think you did anything wrong. I do not believe strict liability applies to sexting. Besides your texts were not really that risque. Now you know she is only 12, you can stop texting her. I think it would be obvious to anyone that you believed her to be of legal age, and you are not a sex fiend, and you seem quite sorryy about the whole incident, even though it wasn't your fault. The key thing of course is to stop contact with her. I do not think you have anything to worry about. Unfortunately, some people on this site, like cbg and libran, take great joy in trying to make people like you feel bad. Ignore them.
If you are really worried, call around to a few lawyers and ask if they do a free initial consultation. Then ask if you have committed a crime, telling them all the details you mentioned here.
