input[type="radio"] {
    display: none;
}

input[type="radio"] + label {
    padding: 2px;
    margin: 0;
    white-space: nowrap;
    background-color: #ffffff;
    border: 1px solid #a8a8a8;
}

input[type="radio"]:checked + label {
    background-color: #a8a8a8 !important;
}

input[type="radio"] + label + div {
    display: none;
}

input[type="radio"]:checked + label + div {
    display: grid;
    grid-template-columns: repeat(8, minmax(25px, auto));
    grid-template-rows: repeat(6, minmax(25px, auto));
    gap: 0px;
    touch-action: manipulation;
    -ms-touch-action: manipulation;
}

input[type="radio"]:checked + label + div > div:not([class="btn"]) {
    border: dotted 1px black;
}

button, .btn, #keypad > label {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    -webkit-appearance: none;
    padding: 2px;
    margin: 0px;
    overflow: hidden;
    white-space: nowrap;
    background-color: #ffffff;
    border: 1px solid #a8a8a8;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mathbtn {
    pointer-events:none;
    font-size: 14px;
}

#keypad {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
}

#keypad > label {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

#switchinput {
    opacity: 0;
    grid-column: 1 / span 1;
    width: 0;
    height: 0;
}

#switchinput + label, #switchinput {
    grid-column: 1 / span 1;
    grid-row: 2;
}

#switchinput + label::before {
    content: "Show Keypad";
}

#switchinput:checked + label::before {
    content: "Show / Use Keyboard";
}

#switchinput:not(:checked) + label ~ * {
    display: none;
}

#mainView {
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

#mainView > nav {
    grid-column: 1;
    grid-row: 1;
}

#mainView > nav + div {
    grid-column: 1;
    grid-row: 2;
    overflow-y: auto;
}

#mainView > nav + div + div {
    grid-column: 1;
    grid-row: 3;
}