.numpre {
    padding:0;
    width: 100%;
    height: auto;
    display: flex;
    flex-wrap: nowrap;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 1rem;
}

.btns {
    display:flex;
    flex-direction: row;
    gap: .5rem;
}
.btns > button {
    flex: 1 1 auto;
}

div.numpre-nav-bar {
    flex:0 0 100%;
    width: 100%;
    margin: 0;
    padding: 0 1rem;
    display:flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0;
}

div.numpre-history {
    flex: 1 1 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: 3px;
}

div.numpre-history > button {
    flex: 0 1 36px;
    border: none;
    padding: 0 16px;
    margin:0;
    background-color: transparent;
    color: var(--color-secondary);
    border-radius: .5rem;
    display: flex;
    justify-content:center;
    align-items:center;
}
div.numpre-history > button:disabled {
    color: var(--disabled);
    background-color: transparent;
}
div.numpre-history > button:hover {
    background-color: var(--bg-secondary);
}
div.numpre-history > button:disabled:hover {
    background-color: transparent;
}

div.numpre-timer {
    flex: 1 1 auto;
    display:flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
}

svg.numpre-board {
   flex: 1 1 auto;
   max-width: 500px; 
}

svg.numpre-board g[data-type="cell"] rect:active {
    fill: var(--same-number);
}

div.numpre-controls {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: normal;
    gap: 1rem;
}

div.numpre-numpad {
    flex-basis: 100%;
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: min(1vw, 3px);
}
div.numpre-numpad > button {
    padding:0;
    display:flex;
    justify-content: center;
    align-items: center;
}
div.numpre-numpad > button.active {
    color: red;
}
div.numpre-numpad > button > svg {
    width: 100%;
    height: auto;
}
div.numpre-action-controls {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 1rem;
}
div.pen-mode {
    display:flex;
    flex-wrap:nowrap;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: .2rem;
}
div.pen-mode svg {
    width: 1.5rem;
    height: auto;
}
div.pen-mode > label {
    flex: 0 0 fit-content;
    border:1px solid var(--secondary);
    border-radius: 0;
    line-height: 2rem;
    margin:0;
    padding: .5rem 1rem;
    color: var(--secondary);
    background-color: var(--bg-secondary);
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: .5rem;
}
div.pen-mode > label:first-child {
    border-radius: .5rem 0 0 .5rem;
}

div.pen-mode > label:last-child {
    border-radius: 0 .5rem .5rem 0;
}
label.order-mode {
    margin:0;
    padding: .5rem 1rem;
    color: var(--secondary);
    background-color: var(--bg-secondary);
    border: 1px solid var(--secondary);
    border-radius: .5rem;
    display: flex;
    flex-direction: row-reverse;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: .5rem;
}
label.order-mode:has(input:checked) {
    flex-direction: row;
}
label.order-mode > input[type="checkbox"] {
    display: none;
}
label.order-mode svg {
    width: 1.5rem;
    height: auto;
}
button.numpre-check {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: .5rem;
    margin:0;
    padding: .5rem 1rem;
    border: 1px solid var(--secondary);
    border-radius: .5rem;
    color: var(--secondary);
    background-color: var(--bg-secondary);
}
button.numpre-check svg {
    width: 1.5rem;
    height: auto;
}

@media screen and (min-width: 768px) {
    div.numpre {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: flex-start;
    }
    svg.numpre-board {
        flex: 1 0 500px;
    }
    div.numpre-controls {
        flex-shrink:0;
        flex-basis: 180px;
    }
    div.numpre-numpad {
        grid-template-columns: repeat(3, 1fr);
    }
}

