This is really cool! How did you figure out the solution?
I created a prototype with extra space at the bottom right to confirm that a solution existed, and then looked for ways to reduce that space.