like you said, you didn't mean for it to come off the way it did, and you can't control how another person will react.
I would apologize once again, but instead of saying I'm sorry, empathize and think about what about the joke may have hurt them, so they feel understood and heard. after that response, you simply give them space and let them reach out to you when ready.
you may feel intensely about it being your fault, and feel the need to put yourself down. but, remind yourself that it isn't your fault, you didn't mean for it to come off the way that it did, and your genuinely apologetic about it. we cannot control how another person will react.
instead, make sense of their reaction with empathy, to the best of your ability ofc, and as a friend, learn from it so you better understand their tendencies.