Yup, it's electrons. Chemistry is all about electrons. Elements behave as they do because of the number and configuration of their electrons, and how they can (or can't) combine with those of other atoms. For instance, as you say, noble gases have stable configurations and are reluctant to form compounds; alkali metals have a single valence electron and readily form M+ cations etc. It's not always (or usually) as simple as that. We can have a good try at explaining the known chemical properties given the electron configuration, but it is much harder to work the other way around - to predict properties a priori from the electron configuration - to look at the periodic table and say e.g. "oh yes, element 79 will be a yellow metal and element 80 will be a liquid at room temperature".
Taking a step further back, it all comes down to mathematics - to the stable solutions of the Schrodinger equation for 1, 2, 3, 4... etc. electrons. It is one of the wonders of nature that simple mathematics produces such huge variety - take an element, add a proton and an electron (maybe a couple of neutrons) and you get an element with completely different properties.
To consider one of your questions, why is carbon a solid but N, O and F form diatomic gases? Well, carbon, having 4 valence electrons, can form 4 strong bonds to other carbon atoms and make structures like diamond and graphite, which are more stable than C2 molecules. What kind of solid structures do you think N, O or F could form? How many bonds would they have, and how strong are these bonds compared to the X2 molecules?