@import url("fonts/m_plus_rounded_1c.css");

:root {
    --background: #612ea7;
    --background-second: #961880;
    --highlight: #ffe99f;
    --primary: #46c1a4;
    --secondary: #1f2269;

    height: 100%;
}

body {
    background: var(--background);
    background-blend-mode: multiply;
    background-size: 30%;
    font-family: "M PLUS Rounded 1c", sans-serif;

    background-image: url(bg.png);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;

    position: fixed;
}

main {
    margin: 0 auto;
    margin-top: 1vh;
    padding: 10px;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
}

table.board {
    background-color: var(--background);
    width: 800px;
    height: 800px;
    border-spacing: 5px;
    border-radius: 10px;
    table-layout: fixed;
    padding: 2px;

    border: 4px rgba(29, 29, 27, .15) solid;
    box-shadow: inset 0px 2px 0px 0px rgba(255, 255, 255, .15), 0px 3px 0px 0px rgba(255, 255, 255, 0.15);

    position: relative;
    z-index: 1;

    -ms-user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -khtml-user-select: none;
    user-select: none;
}

@media screen and (max-width: 500px) {
    table.board {
        border-spacing: 2px;
    }
}

table.board td {
    text-align: center;
    font-weight: bold;
    font-size: min(200%, 1.5em);
    color: var(--secondary);
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 7px;
    box-shadow: var(--secondary) 0px 2px 4px 0px,
        var(--primary) 0px 0px 0px 0px inset;
    border-collapse: collapse;
    border-style: solid;
    border: 3px solid transparent;
    transition: background-color, border-color 0.5s;
    opacity: 0.3;
    border: 2px solid transparent;
    box-sizing: border-box;
    position: relative;
}

table.board:not(.disabled) td.possible:hover {
    border-color: var(--primary);
    background-color: var(--highlight);
    cursor: pointer;
}

table.board td.possible {
    background-color: var(--highlight);
    opacity: 1;
    position: relative;
    z-index: 1;
}

table.board td.placed {
    opacity: 1;
    border: 2px solid white;
}

table.board td.current:after {
    content: "";
    display: block;

    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 3px solid var(--primary);
    border-radius: inherit;
    animation: 1s pulse infinite alternate;
    z-index: 2;
    box-sizing: border-box;
}

@keyframes pulse {
    from {
        transform: scale(1.1);
    }

    to {
        transform: scale(1.3);
    }
}

table.board:not(.disabled) td.possible:active {
    transform: translateY(2px);
    box-shadow: var(--secondary) 0px 0px 0px 0px,
        var(--primary) 0px 0px 0px 0px inset;
}

#buttonToolbar {
    padding: 10px 0;
    display: flex;
    align-content: center;
    justify-content: space-between;
}

#buttonToolbar .group {
    display: flex;
    margin-right: 13px;
}

#buttonToolbar .group:last-child {
    margin-right: 0;
}

#buttonToolbar .group:nth-child(2) {
    justify-content: center;
}

#buttonToolbar .group:last-child {
    justify-content: right;
}

#buttonToolbar button {
    margin-right: 13px;
}

#buttonToolbar button:last-child {
    margin-right: 0;
}

main button {
    background-color: #fff;
    color: var(--secondary);
    box-shadow: 0px 6px 0px 0px #301a6b;
    font-size: inherit;
    padding: 7px;
    padding-right: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 6px;
    font-family: inherit;
    height: 42px;
}

main button::before {
    content: "";
    display: inline-block;
    width: 30px;
    height: 100%;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    z-index: 2;
    position: relative;
    margin-right: 10px;
}

main button.noIcon::before {
    display: none;
}

main button.noIcon {
    font-size: 2em;
    line-height: 100%;
    padding: 7px 15px;
}

#undoButton::before {
    background-image: url(img/undo.svg);
}

#solveButton::before {
    background-image: url(img/solve.svg);
}

#restartButton::before {
    background-image: url(img/restart.svg);
}

main button:not(:disabled):hover {
    background-color: #cbb6e9;
}

main button:not(:disabled):active {
    margin-top: 4px;
    margin-bottom: 2px;
    box-shadow: 0px 2px 0px 0px #301a6b;
}

main button:disabled {
    opacity: 0.4;
    cursor: auto;
}

main button .lds-ellipsis {
    display: none;
}

main button.loading {
    width: auto;
}

main button.loading .lds-ellipsis {
    display: initial;
}

#cancelSolve {
    color: red;
}

select {
    height: calc(100% - 6px);
    padding: 0px 30px 0px 10px;
    border: medium none;
    font-size: 18px;
    line-height: 32px;
    color: var(--secondary);
    appearance: none;
    background-color: white;
    border-radius: 8px;
    position: relative;
    box-shadow: 0px 6px 0px 0px #301a6b;
    font-weight: bold;
    font-family: inherit;
    font-size: inherit;
    -webkit-appearance: none;
}

select:disabled {
    opacity: 0.4;
    cursor: auto;
}

option {
    color: black;
}

.label-select {
    position: relative;
}

.label-select:before {
    content: "";
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 10px solid var(--secondary);
    position: absolute;
    right: 11px;
    top: 16px;
    z-index: 1;
}

#overlay {
    position: fixed;
    width: 100%;
    height: 100%;
    padding: 10px;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-sizing: border-box;
}

.popup {
    background-color: white;
    border-radius: 10px;
    box-shadow: var(--secondary) 0px 2px 4px 0px,
        var(--primary) 0px 0px 0px 0px inset;
    padding: 10px;
    display: block;
    width: min(95%, 350px);
    text-align: center;
}

.popup header {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--secondary);
}

.popup main {
    margin: 0;
}

.popup footer {
    display: flex;
    justify-content: space-evenly;
}

.popup footer>* {
    margin-right: 10px;
}

.popup footer>*:last-child {
    margin-right: 0;
}

.popup button {
    cursor: pointer;
    border: medium none;
    background-color: rgb(86, 53, 220);
    border-radius: 7px;
    width: 160px;
    height: 42px;
    font-size: 17px;
    color: rgb(255, 255, 255);
    text-align: center;
    text-transform: uppercase;
    font-weight: bold;
    font-family: inherit;
}

.popup button:hover {
    background-color: rgb(64, 32, 194);
}

@media screen and (max-width: 500px) {
    table.board td {
        font-size: 3vw;
        border-radius: 5px;
    }

    main button {
        font-size: 4vw;
    }
}

.lds-ellipsis {
    display: inline-block;
    position: relative;
    width: 50px;
    height: 80px;
    margin: -30px 0;
    transform: scale(0.5);
}

.lds-ellipsis div {
    position: absolute;
    top: 33px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--secondary);
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.lds-ellipsis div:nth-child(1) {
    left: 8px;
    animation: lds-ellipsis1 0.6s infinite;
}

.lds-ellipsis div:nth-child(2) {
    left: 8px;
    animation: lds-ellipsis2 0.6s infinite;
}

.lds-ellipsis div:nth-child(3) {
    left: 32px;
    animation: lds-ellipsis2 0.6s infinite;
}

.lds-ellipsis div:nth-child(4) {
    left: 56px;
    animation: lds-ellipsis3 0.6s infinite;
}

@keyframes lds-ellipsis1 {
    0% {
        transform: scale(0);
    }

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

@keyframes lds-ellipsis3 {
    0% {
        transform: scale(1);
    }

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

@keyframes lds-ellipsis2 {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(24px, 0);
    }
}