No advice, I'm afraid, just my personal experience of once being a 12-year old who self-harmed and engaged in risky behaviours.
I was just deeply, deeply sad. I felt rejected by everyone - my family, my peers, everyone. I honestly believed that there was something in me that repulsed people, and if only I knew what it was, I would fix it.
I did stupid things in the hope of garnering some kind of sympathy. If I couldn't be liked, maybe people feeling sorry for me and being kind to me would do instead. Of course, it backfired because people just got fed up of my attention-seeking antics, but not being mature enough to realise that, I just ramped things up.
I just wanted SOMEONE to see how utterly miserable I was, so they could help me. I have anxiety and depression to this day, and to self-soothe now I sometimes imagine myself as an adult giving younger me a big hug and telling her it will be OK.
I tried very hard to be what I thought people wanted me to be. Looking back I can see that trying to be something you're not just puts people off even more - even kids can sense fakery and inauthenticity.
I never felt I belonged anywhere. We moved around a lot, so I had no stability. I was always having to make yet another group of new friends, so there was no history, no solid ground to build on. Just try to be liked, get liked by a few, repelled by most, then move on and start the whole process again.
I just wanted so much to feel part of something. I never felt wanted at home, I was bullied throughout school, and had no special abilities that would mean I could join a gymnastics club or sports club or other social hobby thing. I didn't fit anywhere, so I tried to mold myself into someone who would fit somewhere. I found that I became more acceptable to the cool kids if I did risky, age-inappropriate things like drinking, smoking, sneaking out. I thought I'd found the formula for social success - "if I do this, people hate me less".
I don't know if this is any help at all, but I just wanted to show that when kids do daft and/or dangerous things, it's very rarely because they're happy with themselves and their place in the world.
I hope you and your DD find a way forward.