I'm currently homebrewing a world that my wife and I are playing. She's controlling 3 of the PCs in the party, I'm controlling 1 at the moment as an NPC (at the start, she began with 1, and eventually took over the others as she got more comfortable--we're mostly playing it as a way to get her more comfortable with 3.5 and tabletop RPGs in general as she's never played them before).

I have an awesome hook that gives me more than enough fuel for bad guys to populate the world, twists and themes to run with (tl;dr: Ancient/Great Wyrm Red Dragon didn't want to die, was turned into a Dracolich, then decided he could deify himself if he gathered enough magical items, so he attracted an evil following to help him do this; as a result, magical items are very sought after, somewhat rare, and bands of ogres, goblins, and evil dragon shaman are raiding villages and getting more and more brash about hitting towns and small cities with their armies to loot magical items--lesser evil dragons are beholden to the dracolich and either flee their territory or deliver any magical items they gather via these ogre/goblin bands as couriers--this basically sets up infinite ways for me to create encounters, and a storyline for her to follow as she tries to figure out what's going on since at the moment she doesn't have much of an idea), but I'm kinda lost on how to put this all together.

I've never DMed before, so that's probably part of my issue. Basically what I've been doing is trying to stay one day ahead of her when creating, but the result is I feel like anytime we're not playing I'm scrambling to keep up instead of planning ahead. I'd love to have a world fleshed out instead of a few scraps of the map designed and one or two towns/dungeons, but I'm just not sure how much detail to go into and how to best keep track of it all. I've written up a few encounters, but we took a break for a few weeks (she got Middle Earth: Shadow of Mordor and couldn't stop playing), and somehow in the process I've mixed everything up and have kinda lost track of what I had in mind for the creatures/characters I put together.

How do you do it? How do you manage huge worlds and prepare for players to go completely against what you expect them to do (she did this in the first three nights, attacking a green dragon that I had fully intended for her to negotiate with--it was a young one and her party started at level 5, so they barely managed to kill it without being totally wiped out)?