Seeing the edges of my shadowcube, driving me mad

So I’ve been working on this for literally months. I’ve even resorted to ChatGPT, Claude, etc. As you can see in the picture, the edges of my shadow cube are projected as shadows.

Can anyone help with this? The only solution I’ve had is to increase the shadow map to an ungodly 2800 pixels but I’m making a retro style game here and like the chunky shadows.

Maybe this article will help. OpenGL is not matter focus on the algorithm.

Or use cascade shadow mapping maybe it will help.