* {
    /* all box sizes shall include padding and border */
    box-sizing: border-box;
    margin: 0;
    border: 0;
    padding: 0;
}

html, body {
    display: block;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: black;
}

#calculator {
    display: table;
    width: 100%;
    height: 100%;
}

#display {
    display: block;
    width: 100%;
    height: calc(1.6rem * 4);
    color: white;
    overflow: scroll;
    font-size: 1.4rem;
    font-family: Monospace;
}

#display div {
    display: block;
    width: 100%;
    min-height: 25%;
    vertical-align: middle;
}

#line_b {
    background: #000000;
}

#line_a {
    background: #111111;
}

#line_y {
    background: #222222;
}

#line_x {
    background: #333333;
}

#display div p {
    width: 100%;
    padding-top: 0.2rem;
    padding-left:0.1rem;
    text-align: left;
    vertical-align: middle;
    word-break: break-all;
    line-height: 1.05rem;
}

#display div p::first-letter {
    font-size: 60%;
    font-weight: bold;
    color: gray;
    vertical-align: middle;
}

#key_panel {
    display: table-row;
    height: 100%;
    font-family: sans-serif;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

table.keyboard {
    width: 100%;
    table-layout: fixed;
    font-weight: normal;
    font-size: 1.2em;
}

table.keyboard td {
    border: 0.15em solid #444444;
    border-radius: 0.7em;
    width: 100%;
    text-align: center;
    vertical-align: middle;
    overflow: auto;
}

.normkey {
    background: #111111;
    color: white;
}

.invkey {
    background: #444444;
    color: white;
}

.normkey:active {
    background: #444444;
}

.invkey:active {
    background: #111111;
}

@media screen and (orientation: portrait) {

    #function_panel {
        display: block;
        width: 100%;
        height: 42%;
    }

    #number_panel {
        display: block;
        width: 100%;
        height: 58%;
    }
}

@media screen and (orientation: landscape) {

    #function_panel {
        display: inline;
        float: left;
        width: 50%;
        height: 100%;
    }

    #number_panel {
        display: inline;
        float: right;
        width: 50%;
        height: 100%;
    }
}