Pumpkin seeds, almonds, Brazil nuts, cashews...basically, nuts and seeds. Raw and unsalted should be healthier than roasted and salted, and you'll also be able to much more accurately gauge "how much is enough" that way (when things have a lot of salt, at least in my experience, it's much easier to over-eat).
Both phosphorus and magnesium would be covered with the addition of nuts and seeds. Keeping them varied can help a lot with your taste buds too (only having almonds can get old after a while -- cashews can be great sometimes, or Brazil nuts, pumpkin seeds, pistachios, pine nuts, macadamias, so on and so on).
I generally do think that the raw nuts/seeds are healthier, but mixing some roasted and salted nuts/seeds in with some raw ones can be a *very* tasty alternative
One or two handfuls should be plenty. It works for me because I prefer a higher-fat diet while generally cutting out refined carbohydrates and grains.
I have no idea what your diet is like, but a handful of nuts/seeds a day should have no problem fitting in.
If for some reason it doesn't, though, or you don't like nuts/seeds or are allergic to them, leafy green vegetables are a good source of magnesium (they're incredibly nutrient-dense in general and eating plenty of leafy greens would probably have numerous other benefits as well, just as an aside), as well as some foods listed here:
High Magnesium Foods
There's a lot to pick from! A handful of nuts/seeds or a tablespoon or two of nut/seed butter (like almond butter or cashew butter) is probably one of the easiest ways to do it, though. Just my own personal thoughts -- hope you find something that works for you. Good luck
P.S. If you go to [link removed], you can do a search for foods high in certain nutrients by hovering the cursor over the "Tools" tab, and then clicking "Nutrient search tool" from the drop-down menu. You can select magnesium, for example, on the "foods highest in ________" menu, and then click search, and it'll show you foods that are highest in magnesium. You can do this for any nutrient they have available on the search engine, and it can be very handy.