Oh, the other way to do it is to create a code block and copy first the html then in <style>...code here...</style> to put the css and in <script> ...code here</script> to put the javascript.
I don't think the current accordion block let's you do that.
I wrote an article about this in the past, take a look, if you need further assistance let me know. I am planning to make also a video for this article.
https://www.ui-workarounds.com/boosting-your-squarespace-accordion-with-videos-images-tables-lists-and-titles/