Made a bunch of changes

Created a config array to set common configuration used by the script.

Created a method to calculate the elapsed time and return it with a friendly description.

Changed the location of the <style> tag. This tag does not need to be inside the <head> tag, the specification does not require that. But you surely can't have more than one <html> tag as this is the document root.

Added a few more CSS classes to become easier to change the styles. And so made the user status as a ribbon to have nice look by default.

And as last point, cleaned the code.