Tabs: Centre Caption Vertically

HTML

<div class="frame">
    <div class="tab">
        <div class="tab-rounded"></div>
        <div class="tab-caption">Oans</div>
    </div>
</div>

CSS

* {
    box-sizing: border-box;
}
.frame {
    position: absolute;
    left: 0px;
    top: 0px;
    width: 100px;
    height: 600px;
    padding: 4px;
    background-color: green;
    display: -webkit-flex;
    display: -moz-flex;
    display: -ms-flex;
    display: flex;
    -webkit-flex-direction: column;
    -moz-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-justify-content: space-between;
    -moz-justify-content: space-between;
    -ms-justify-content: space-between;
    justify-content: space-between;
}
.tab {
    position: relative;
    margin-top: 2px;
    margin-bottom: 2px;
    -webkit-flex-grow: 10;
    -moz-flex-grow: 10;
    -ms-flex-grow: 10;
    flex-grow: 10;
    -webkit-flex-shrink: 0;
    -moz-flex-shrink: 0;
    -ms-flex-shrink: 0;
    flex-shrink: 0;
}
.tab-caption {
    position: absolute;
    /* width: 100%;*/  /* width before rotation! */
    top: 50%;
    height: 2px;  /* actual text will overlap! */
    margin-top: -1px;  /* subtract half the height */
    line-height: 0px;  /* centre the text on the base line */
    text-align: center;
    font-weight: bold;
    background-color: yellow;
    left: 50%;
    -ms-transform: translateX(-50%) rotate(90deg) ;
    -webkit-transform: translateX(-50%) rotate(90deg);
    transform: translateX(-50%) rotate(90deg);
    white-space: nowrap;
}

JavaScript

/*
  The width of the div tab-caption (yellow) is set to 100%.
  This happens BEFORE rotation!
  Caption that are shorter than this width will be correctly
  centred.
  Caption that are longer will overlap!
  How to fix this?
*/