For me your style snippet works. Hard to say why the style seems to be ignored in your case without knowing the rest of your styling and config. Perhaps you can try to add the 'important' statement first:
.box {
background-color:#3F0166 !important;
}
Otherwise try to precise your styles:
div#box1.box {
background-color:#3F0166 !important;
}
div#box2.box {
background-color:#3F0166 !important;
}
I would recommend using the developer tools of your fav browser to try changes in realtime.