@font-face {
    font-family: 'Roboto';
    src: url(../fonts/roboto-regular.woff);
}

@font-face {
    font-family: 'Roboto';
    src: url(../fonts/roboto-bold.woff);
    font-weight: bold;
}

:root {
    --board-size: 85vmin;
    --primary-color: steelblue;
    --select-color: #ecf2f7;
    --yellow: gold;
    --red: firebrick;
}

body {
    font-family: 'Roboto', sans-serif;
    transition: opacity 2s ease;
    background-color: white;
    overflow: hidden;
    margin: 0;
    opacity: 0;
}

#outer {
    display: table;
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
}

#middle {
    display: table-cell;
    vertical-align: middle;
}

#inner {
    margin-left: auto;
    margin-right: auto;
}

h1 {
    color: var(--primary-color);
    text-align: center;
    font-size: calc(var(--board-size) / 3.09);
    margin-top: -10px;
    margin-bottom: 8px;
} 

.numpad {
    display: flex;
    width: calc(var(--board-size) + 3px);
    height: calc(var(--board-size) / 9);
    justify-content: space-between;
    margin: auto;
    margin-bottom: 10px;
    opacity: 0;
    visibility: hidden;
}

.digit {
    display: grid;
    position: relative; 
    place-items: center;
    align-content: center;
    cursor: pointer;
    color: var(--primary-color);
    font-size: 8.5vmin;
    font-weight: bold;
}

.digit::after {
    content: '';
    position: absolute;
    left: calc(var(--board-size) / -38);
    right: calc(var(--board-size) / -38);
    top: -5px;
    bottom: -5px;
}

.bulb {
    width: calc(var(--board-size) / 5.6);
    fill: var(--primary-color);
    transform: translateY(5.2vmin);
    transition: fill 0.1s ease-in-out;
}

.on { 
    cursor: default !important;
    fill: var(--yellow);
}

.socket {
    fill: var(--primary-color);
}

.display {
    transition: opacity 0.2s ease;
    visibility: visible;
    opacity: 1;
}

.board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    border: 10px solid var(--primary-color);
    background-color: var(--primary-color);
    width: calc(var(--board-size) + 3px);
    height: calc(var(--board-size) + 3px);
    border-radius: 7px;
    gap: 1px 1px;
    margin: auto;
}

.cell {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    color: white;
    font-size: 6.5vmin;
    background-color: white;
    width: calc(var(--board-size) / 9 - 1px);
    height: calc(var(--board-size) / 9 - 1px);
}

.cell:nth-child(3),:nth-child(6) {
    margin-right: 2px;
}

.cell:nth-child(n + 19):nth-child(-n + 27) {
    margin-bottom: 2px;
}

.cell:nth-child(n + 46):nth-child(-n + 54) {
    margin-bottom: 2px;
}

.filled {
    cursor: default !important;
    color: var(--primary-color);
    transition: color 0.2s ease;
}

.selected, .shade {
    background-color: var(--select-color);
}

.shade {
    transition-property: background-color;
    transition-duration: 0.5s;
    transition-timing-function: ease-in-out;
}

.bold {
    font-weight: bold;
    transition-property: font-weight;
    transition-duration: 0.5s;
    transition-timing-function: ease-in-out;
}

.number {
    line-height: 90%;
}

.visible {
    opacity: 1;
}

.clear {
    transition: background-color 0.2s ease-in-out, font-weight 0.2s ease-in-out !important;
}

.reset {
    transition: color 0.2s ease;
}

.enabled {
    cursor: pointer;
}

.enabled .cell {
    cursor: pointer !important;
}

#designed {
    text-align: center;
    align-self: auto;
    color: white;
    font-size: 9px; 
    margin-top: -12px;
}

@keyframes correct {

    0% {
        color: white; 
    }
  
    37% {
        color: var(--primary-color); 
    } 

    75% {
        color: white; 
    } 
}

@keyframes incorrect {

    0% {
        color: white; 
    }
  
    37% {
        color: var(--red);
    } 

    75% {
        color: white; 
    } 
}

@keyframes pop {

    0% {
        transform: scale(1); 
    }
  
    50% {
        transform: scale(1.5); 
    } 

    100% {
        transform: scale(1); 
    } 
}

.correct {
    animation: correct 0.75s 4.5 ease forwards;
}

.incorrect {
    animation: incorrect 0.75s 3 ease forwards;
}

.pop {
    animation: pop 0.3s ease forwards;
}

@media (prefers-color-scheme: dark) {

    :root {
        --primary-color: white;
        --select-color: rgb(70, 70, 70);
    }
    
    body {
        background-color: black;
    }

    .cell {
        background-color: black;
        color: black;
    }

    .selected, .shade {
        background-color: var(--select-color);
    }

    .filled {
        color: var(--primary-color);
    }

    #designed {
        color: black;
    }

    @keyframes correct {

        0% {
            color: black; 
        }
      
        37% {
            color: var(--primary-color); 
        } 
    
        75% {
            color: black; 
        } 
    }

    @keyframes incorrect {

        0% {
            color: black; 
        }
      
        37% {
            color: var(--red); 
        } 
    
        75% {
            color: black; 
        } 
    }
}

@media (orientation: landscape) and (max-height: 460px) {

    h1 {
        display: none;
    }

    .board {
        margin-top: 0;
    }
}

@media (max-width: 320px), (max-height: 320px) {

    h1 {
        margin-top: -20px; 
    }
}

@media (min-width: 460px) and (min-height: 460px) {

    :root {
        --board-size-big: 400px;
    }

    h1 {
        font-size: 132px;
    }

    .numpad {
        width: calc(var(--board-size-big) + 3px);
        height: calc(var(--board-size-big) / 9);
    }

    .digit {
        font-size: 33px;
    }

    .digit::after {
        top: -5px;
        bottom: -5px;
        left: -13px;
        right: -13px;
    }

    .bulb {
        width: calc(var(--board-size-big) / 5.4);
        transform: translateY(25px);
    }

    .board {
        border: 15px solid var(--primary-color);
        width: calc(var(--board-size-big) + 3px);
        height: calc(var(--board-size-big) + 3px);
    }

    .cell {
        width: calc(var(--board-size-big) / 9 - 1px);
        height: calc(var(--board-size-big) / 9 - 1px);
        font-size: 25px;
    }

    #designed {
        font-size: 12.8px; 
        margin-top: -17px;
    }
}

.noselect {
    -webkit-tap-highlight-color: transparent;
          -webkit-touch-callout: none;
            -webkit-user-select: none; 
               -moz-user-select: none; 
                -ms-user-select: none; 
                    user-select: none; 
}