@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 {
    --size: 7;
    --board-size: 85vmin;
    --border-size: 10px;
    --red: #e23838;
    --orange: #f78200;
    --yellow: #ffb900;
    --green: #5ebd3e;
    --blue: #009cdf;
    --purple: #973999;
}

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

#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 {
    font-size: calc(var(--board-size) / 3.35);
    text-align: center;
    margin-top: -10px;
    filter: url(#goo);
}

h1 span:nth-child(1) {
    color: var(--red);
}

h1 span:nth-child(2) {
    color: var(--yellow);
}

h1 span:nth-child(3) {
    color: var(--blue);
}

h1 span:nth-child(4) {
    color: var(--orange);
}

h1 span:nth-child(5) {
    color: var(--green);
}

h1 span:nth-child(6) {
    color: var(--purple);
}

.filter {
    display: none;
}

main {
    position: relative;
    width: calc(var(--board-size) + 21px);
    height: calc(var(--board-size) / var(--size) + var(--board-size) + 21px);
    margin: auto;
    margin-top: calc(var(--board-size) / var(--size) * -1 / 1.2);
}

.top {
    position: relative;
    width: calc(var(--board-size) + 21px);
    height: calc(var(--board-size) / var(--size) / 1.5);
    border-top: calc(var(--board-size) / var(--size) / 3) solid transparent;
    z-index: 100;
}

.tab {
    position: absolute;
    left: 50%;
    bottom: calc((var(--board-size) / var(--size) / 1.5) * -2 / 30);
    width: calc(var(--board-size) / var(--size) * 2.8);
    height: calc((var(--board-size) / var(--size) / 1.5) * 32 / 30);
    transform: translateX(-50%);
}

.score {
    display: grid;
    position: relative;
    place-items: center;
    font-size: calc(var(--board-size) / 11);
    font-weight: bold;
    color: white;
    height: calc(var(--board-size) / var(--size) / 1.5 + var(--border-size));
    margin: auto;
    margin-bottom: calc(-1 * var(--border-size));
    transform: translateY(-1px);
}

.board {
    display: grid;
    position: relative;
    grid-template-columns: repeat(var(--size), 1fr);
    width: calc(var(--board-size) + 1px);
    height: calc(var(--board-size) + 1px);
    gap: 1px;
    border-radius: 7px;
    margin: auto;
    padding: var(--border-size);
    overflow: hidden;
    background: linear-gradient(to bottom right, var(--red), var(--orange), var(--yellow), var(--green), var(--blue), var(--purple));
}

.board::before {
    content: '';
    position: absolute;
    top: 0;
    left: var(--border-size);
    width: calc(var(--board-size) + 1px);
    height: var(--border-size);
    background: linear-gradient(to right, var(--red), var(--orange), var(--yellow), var(--green), var(--blue), var(--purple));
    background-size: 215%;
    background-position: 5%;
    z-index: 1;
}

.board::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: var(--border-size);
    width: calc(var(--board-size) + 1px);
    height: var(--border-size);
    background: linear-gradient(to right, var(--red), var(--orange), var(--yellow), var(--green), var(--blue), var(--purple));
    background-size: 215%;
    background-position: 95%;
}

.cell {
    width: calc(var(--board-size) / var(--size) - 1px);
    height: calc(var(--board-size) / var(--size) - 1px);
    background-color: white;
}

.shape {
    display: grid;
    position: absolute;
    place-items: center;
    cursor: pointer;
    width: calc(var(--board-size) / var(--size));
    height: calc(var(--board-size) / var(--size) * 0.8);
    will-change: transform;
    transition: opacity 0.5s ease-in;
}

.shape img {
    height: calc(var(--board-size) / var(--size) * 0.8);
}

.shape::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: calc(var(--board-size) / var(--size));
    height: calc(var(--board-size) / var(--size));
    transform: translateY(-50%);
}

.visible {
    opacity: 1;
}

.invisible {
    opacity: 0;
}

.disappear {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.selected {
    background-color: whitesmoke;
}

.upper {
    z-index: 100;
}

.move {
    transition: transform 0.2s ease;
}

.fall {
    transition: transform 0.2s linear;
}

.hidden {
    display: none;
}

.volley {
    animation: volley 0.5s ease-in-out forwards;
}

#designed {
    position: relative;
    text-align: center;
    color: white;
    font-size: 9.2px;
    margin-top: -12px;
}

@keyframes volley {

    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

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

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

    h1 {
        display: none;
    }
}

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

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

    .score, #designed {
        color: black;
    }
}

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

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

    h1 {
        font-size: 121px;
        filter: url(#goo-big);
    }

    main {
        width: calc(var(--board-size-big) + 31px);
        height: calc(var(--board-size-big) / var(--size) + var(--board-size-big) + 31px);
        margin-top: calc(var(--board-size-big) / var(--size) * -1);
    }

    .top {
        border-top: calc(var(--board-size-big) / var(--size) / 3) solid transparent;
        width: calc(var(--board-size-big) + 31px);
        height: calc(var(--board-size-big) / var(--size) / 1.5);
    }

    .tab {
        bottom: calc((var(--board-size-big) / var(--size) / 1.5) * -2 / 30);
        width: calc(var(--board-size-big) / var(--size) * 2.5);
        height: calc((var(--board-size-big) / var(--size) / 1.5) * 32 / 30);
    }

    .score {
        font-size: calc(var(--board-size-big) / 11.5);
        height: calc(var(--board-size-big) / var(--size) / 1.5 + var(--border-size));
        margin-bottom: calc(-1 * var(--border-size));
    }

    .board {
        width: calc(var(--board-size-big) + 1px);
        height: calc(var(--board-size-big) + 1px);
        padding: var(--border-size);
    }

    .board::before, .board::after {
        width: calc(var(--board-size-big) + 1px);
    }

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

    .shape {
        width: calc(var(--board-size-big) / var(--size));
        height: calc(var(--board-size-big) / var(--size) * 0.8);
    }

    .shape img {
        height: calc(var(--board-size-big) / var(--size) * 0.8);
    }

    .shape::after {
        width: calc(var(--board-size-big) / var(--size));
        height: calc(var(--board-size-big) / var(--size));
    }

    #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;
}