@font-face {
    font-family: "Coming Soon";
    font-weight: 400;
    font-display: swap;
    src:
        local("Coming Soon"),
        url("coming-soon.woff2");
}

:root {
    --grey: #141414;
    --grey-darkest: #0a0a0a;
    --grey-transparent: rgba(0, 0, 0, 0.7);
    --red: #d20000;
    --green: #71903a;
    --tab-radius: 40px;
    --default-img: url("../img/background.webp");
    --large-distance: clamp(30px, 9vw, 95px);
}

* {
    padding: 0;
    margin: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--red) var(--grey);
}

*,
::after,
::before {
    box-sizing: border-box;
}

:focus-visible {
    outline: 2px solid var(--red);
}

html {
    font-size: 100%;
    min-height: 100vh;
    background: var(--red) linear-gradient(to top, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0)) fixed;
}

body {
    font-size: 1.25rem;
    line-height: 1.5;
    font-family: "Coming Soon", cursive;
    font-weight: 400;
    color: #ffffff;
    background: var(--grey) var(--default-img) center top / cover no-repeat;
    border-radius: 60px;
    max-width: 1600px;
    margin: clamp(15px, 3vw, 30px);
    padding: 30px 30px clamp(30px, 10vw, 120px) 30px;
    position: relative;
    z-index: 1;
    /* hyphens: auto; */

    @media (max-width: 767px) {
        &:not(:has(#logout)):has(#bingo) {
            padding-bottom: 0;
        }
    }

    @media (min-width: 768px) {
        margin: 60px;
        min-height: calc(100vh - clamp(30px, 10vw, 120px));
    }

    @media (min-width: 1720px) {
        margin: 60px auto;
    }

    &:not(.index, .odlot)::before {
        content: "";
        display: block;
        position: absolute;
        z-index: -1;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        backdrop-filter: saturate(0);
        border-radius: 60px;
        background: linear-gradient(to bottom, var(--grey) 60px, rgba(20, 20, 20, 0.7) 800px);
    }

    &:is(.index, .odlot) {
        background-image: url("../img/background-index.webp");

        @media (max-width: 767px) {
            background-position-y: 80px;
        }
    }

    &:not(.screenshot-active) {
        .bingo-button.active.active-bingo {
            box-shadow: 0 0 10px rgba(210, 0, 0, 0.5), inset 0 0 50px 0 var(--grey-transparent);
            animation: glowing-border 4s infinite forwards;
        }
    }
}

::selection {
    background: var(--red);
}

strong,
b {
    font-weight: 700;
}

img {
    max-width: 100%;
}

a {
    color: inherit;
}

.flex {
    display: flex;
}

.inline-flex {
    display: inline-flex;
}

.align-items-center {
    align-items: center;
}

.sr-only {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    width: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
}

header {
    padding-bottom: var(--large-distance);
    justify-content: space-between;
    gap: 30px;

    @media (max-width: 575px) {
        &.flex {
            display: grid;
            justify-content: center;
            margin-bottom: 30px;
        }
    }

    @media (min-width: 992px) {
        padding-right: 20px;
    }

    ul {
        column-gap: 20px;
        list-style: none;
        line-height: 0;

        a {
            display: block;

            &:is(:hover, :focus) {
                animation: shake 400ms ease-in-out forwards;
            }
        }
    }
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    50% {
        transform: translateX(4px);
    }

    75% {
        transform: translateX(-4px);
    }

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

#logo {
    column-gap: 20px;
    text-decoration: none;

    img {
        transition: all 1500ms cubic-bezier(0, 0.2, 0, 1);

        @media (max-width: 767px) {
            max-width: 66px;
        }
    }

    &:is(:hover, :focus) img {
        transform: rotate3d(1, 1, 0, 720deg);
    }
}

form {
    &#logout {
        position: fixed;
        top: 0;
        right: 0;

        @media (min-width: 768px) {
            top: 20px;
            right: 20px;
        }
    }

    &#odlot {
        input {
            text-align: center;
            font-size: 1.625rem;
            letter-spacing: 4px;
            padding: 10px 30px;
            border-radius: 30px;
            background: var(--grey);
            border: 1px solid rgba(255, 255, 255, 0.3);
            width: 100%;
            max-width: 350px;

            p+& {
                margin-top: 20px;
            }
        }

        button {
            margin: 60px auto 0 auto;
        }
    }

    input {
        color: inherit;
        font-family: inherit;
    }

    select,
    ::picker(select) {
        appearance: none;
    }

    select {
        font-family: inherit;
        cursor: pointer;
        color: inherit;
        text-align: center;
        font-size: 12px;
        padding: 6px 6px 4px 6px;
        border-radius: 30px;
        background: var(--grey);
        border: 1px solid rgba(255, 255, 255, 0.3);
        width: 70px;
        margin: 0 -10px;

        label+& {
            z-index: 1;
            margin-top: -30px;
        }

        option:first-of-type {
            border-radius: 8px 8px 0 0;
        }

        option:last-of-type {
            border-radius: 0 0 8px 8px;
        }
    }

    ::picker(select) {
        text-align: center;
        font-size: 14px;
        padding: 13px 12px 11px 12px;
        border-radius: 30px;
        background: var(--grey);
        border: 1px solid rgba(255, 255, 255, 0.3);
        color: inherit;
    }
}

#actions {
    border: none;
    gap: 20px;
    padding: 20px;
    background: var(--grey-transparent);
    border-radius: 30px;
    margin-top: 30px;

    @media (max-width: 767px) {
        body:not(:has(#logout)) & {
            display: none;
        }

        button:has(img[src*="download"]) {
            display: none;
        }
    }

    @media (min-width: 768px) {
        flex-direction: column;
        position: absolute;
        top: calc(50% - 30px);
        right: -85px;
        margin: 0;
    }

    @media (min-width: 768px) and (max-width: 1399px) {
        gap: 15px;
        padding: 15px;
    }

    @media (min-width: 768px) and (max-width: 1499px) {
        background: var(--grey-darkest);
    }

    @media (min-width: 1300px) {
        right: calc(clamp(90px, 7.5vw, 160px) * -1);
    }
}

button,
.button {
    color: inherit;
    border: none;
    font-family: inherit;
    text-decoration: none;

    &:not(.not-interactive) {
        cursor: pointer;
    }

    &#addPhrase {
        font-weight: 700;
        margin: 30px auto 0 auto;
    }
}

button:not(.bingo-button),
.button {
    background: var(--red);
    font-size: 1.625rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    line-height: 1;
    width: 50px;
    aspect-ratio: 1 / 1;
    transition: transform 200ms linear, background 200ms linear, opacity 200ms linear;
    position: relative;
    outline: none !important;
    user-select: none;

    &:not(.not-interactive):is(:hover, :focus) {
        transform: scale(1.2);
    }

    &:not(:has(img)) {
        padding-top: 4px;
    }

    &#save {
        background: var(--green);
    }

    &.logout {
        background: var(--grey);

        @media (max-width: 767px) {
            border-top-right-radius: 0;
            background: var(--grey-darkest);
        }
    }

    img {
        width: 26px;
        filter: drop-shadow(2px 2px rgba(0, 0, 0, 0.25));
    }

    &.not-active,
    #bonus:not(:checked)+& {
        background: var(--grey-darkest);
        opacity: 0.6;
    }
}

main {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
    position: relative;

    ul {
        list-style: none;
        display: grid;
        font-size: clamp(1.375rem, 4.2vw, 1.625rem);
        line-height: 1.4;

        &#tabs {
            gap: 30px;
            justify-content: center;
            max-width: 350px;
            margin-left: auto;
            margin-right: auto;

            @media (min-width: 768px) {
                max-width: 700px;
                grid-template-columns: repeat(2, 1fr);
            }

            @media (min-width: 1200px) {
                max-width: unset;
                grid-template-columns: repeat(3, 1fr);
            }

            a {
                min-height: 400px;
                text-decoration: none;
                border-radius: var(--tab-radius);
                background: var(--grey-darkest);
                overflow: hidden;
                transition: transform 200ms linear;

                &:is(:hover, :focus) {
                    transform: scale(1.05);
                }

                &::before,
                h2::after {
                    display: grid;
                    place-items: center;
                    background: var(--red);
                    color: #fff;
                    flex-shrink: 0;
                    border-radius: 50%;
                    line-height: 1;
                    aspect-ratio: 1/1;
                    padding-top: 4px;
                }

                li.add-bingo & {
                    justify-content: center;
                    font-size: 38px;
                    flex-direction: column;
                    gap: 30px;
                    padding: 20px;

                    &::before {
                        content: "\+";
                        font-size: 62px;
                        width: 80px;
                        margin-top: 30px;
                        text-shadow: 1px 1px #fff;
                        padding-right: 2px;
                    }
                }

                li:not(.add-bingo) & {
                    text-align: left;
                    align-items: end;
                    background: var(--grey-darkest) var(--default-img) center / cover no-repeat;

                    h2 {
                        color: inherit;
                        font-size: inherit;
                        font-weight: inherit;
                        gap: 20px;
                        padding: 120px 20px 20px 20px;
                        align-items: end;
                        justify-content: space-between;
                        width: 100%;
                        background-image: linear-gradient(to top, rgba(0, 0, 0, 0.9) 40px, rgba(0, 0, 0, 0));

                        @media (min-width: 768px) {
                            padding-bottom: 25px;
                        }

                        @media (min-width: 992px) {
                            padding-left: 30px;
                        }

                        &::after {
                            content: "\279c";
                            font-size: 1.625rem;
                            width: 50px;
                        }
                    }
                }
            }
        }

        &#bingo {
            gap: 1px;
            backdrop-filter: blur(5px);
            border-radius: var(--tab-radius);
            grid-template-columns: repeat(5, 1fr);

            &.edit-mode {
                grid-template-columns: repeat(3, 1fr);
            }

            @media (max-width: 767px) {
                margin-left: -30px;
                margin-right: -30px;
            }

            li {
                &:last-child :is(p, .bingo-button) {
                    border-bottom-right-radius: var(--tab-radius);
                }

                &:nth-last-child(3) p,
                &:nth-last-child(5) .bingo-button {
                    border-bottom-left-radius: var(--tab-radius);
                }

                @media (min-width: 768px) {
                    &:first-child :is(p, .bingo-button) {
                        border-top-left-radius: var(--tab-radius);
                    }

                    &:nth-child(3) p,
                    &:nth-child(5) .bingo-button {
                        border-top-right-radius: var(--tab-radius);
                    }
                }
            }

            p,
            .bingo-button {
                padding: 10px 4px;
                background: var(--grey-transparent);
                text-align: center;
                display: flex;
                flex-wrap: wrap;
                align-content: center;
                justify-content: center;
                height: 100%;
                width: 100%;
                max-width: 100%;
                word-break: break-word;
                word-wrap: break-word;
                position: relative;
                border: 2px solid transparent;
                font-size: 0.875rem;

                @media (min-width: 768px) {
                    padding: 13px 10px;
                    font-size: 1rem;
                }

                @media (min-width: 992px) {
                    font-size: inherit;
                }
            }

            .bingo-button {
                min-height: clamp(100px, 10vw, 160px);
                transition: all 200ms linear;
                overflow: hidden;

                &:focus-visible {
                    z-index: 1;
                }

                span,
                img {
                    position: relative;
                    z-index: 1;
                }

                &::before {
                    content: "";
                    display: block;
                    position: absolute;
                    top: 0;
                    right: 0;
                    bottom: 0;
                    left: 0;
                    pointer-events: none;
                    box-shadow: all 200ms linear;
                }

                &.active {
                    background: var(--red);
                    border-color: var(--red);

                    &::before {
                        box-shadow: inset 0 0 50px 0 var(--grey-transparent), inset 0 0 400px 0 var(--grey-transparent);
                    }

                    &.active-bingo:before {
                        box-shadow: 0 0 10px rgba(210, 0, 0, 0.5), inset 0 0 50px 0 var(--grey-transparent);
                    }

                    &[disabled] {
                        cursor: not-allowed;
                    }
                }
            }
        }
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        line-height: 1.2;
        color: var(--red);
    }

    h1 {
        font-size: clamp(2.1875rem, 5vw, 3.125rem);
        margin-bottom: var(--large-distance);
        border-radius: 10px;

        :is(.index, .odlot) & {
            text-shadow: 0 3px rgba(0, 0, 0, 0.25);
        }
    }

    :is(h1, h2, h3, h4, h5, h6)::selection {
        color: #fff;
    }

    #player-name {
        color: #fff;
        font-weight: normal;
        position: relative;
        display: block;
        text-align: center;
        font-size: 1.25rem;
        width: max-content;
        max-width: 100%;
        min-width: 100px;
        margin: 0 auto 10px auto;
        padding: 0 60px 0 50px;

        &:is(:hover, :focus-within) button {
            opacity: 1;
            pointer-events: all;
        }

        #player-name-editable {
            padding: 5px 10px;
            border: 1px dashed rgba(255, 255, 255, 0.1);
            border-radius: 30px;
            display: inline-block;
            transition: border 200ms linear;

            &.individual {
                border-color: transparent;

                &:not(:hover, :focus) {
                    margin-right: -10px;
                }
            }

            &:is(:hover, :focus) {
                border-color: rgba(255, 255, 255, 0.3);
            }
        }

        button {
            position: absolute;
            top: 50%;
            right: 0;
            transform: translateY(-50%);
            opacity: 0;
            pointer-events: none;
        }
    }
}

#dialog {
    color: inherit;
    height: 80vh;
    max-height: 710px;
    padding: 60px 50px;
    gap: 30px;
    flex-wrap: wrap;
    position: fixed;
    justify-content: center;
    align-content: end;
    align-items: end;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: 100%;
    max-width: calc(100vw - 30px);
    border-radius: var(--tab-radius);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 40px, rgba(0, 0, 0, 0)), url("../img/bingo.webp") center bottom / cover, var(--grey);
    transition: transform 200ms linear;
    border: none;

    @media (min-width: 992px) {
        max-width: 800px;
    }

    &::backdrop {
        background: var(--grey-transparent);
    }

    &[open] {
        display: flex;
    }

    h2 {
        width: 100%;
        color: inherit;
        font-size: 3.75rem;
        text-transform: uppercase;
        border-radius: var(--tab-radius);
    }
}

@keyframes glowing-border {

    0%,
    66% {
        box-shadow: 0 0 10px rgba(210, 0, 0, 0.5), inset 0 0 50px 0 var(--grey-transparent);
    }

    33% {
        box-shadow: 0 0 20px var(--red), inset 0 0 50px 0 var(--grey-transparent);
    }
}

@media print {
    .no-print {
        display: none;
    }

    body {
        margin: 40px;
        padding-bottom: 30px;
        font-size: 1.125rem;
    }

    header {
        padding-bottom: calc(var(--large-distance) / 3);
    }

    header ul a img {
        max-height: 30px;
    }

    main h1 {
        margin-bottom: calc(var(--large-distance) / 3);
    }

    main ul {
        font-size: 1rem;
    }

    main ul#bingo {
        gap: 3px;
    }

    #logo img {
        max-width: 60px;
    }
}