:root {
    --back: #373737;
    --color: #D4D4D4;
    --red_color: #FF000F;
    --brand_color: rgb(20, 137, 78);

    --back_trs: rgba(55, 55, 55, 0.25);
    --color_trs: rgba(212, 212, 212, 0.15);
    --color_grd: rgba(212, 212, 212, 0.40);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, sans-serif;
}

body {
    background: var(--back);
    color: var(--color);
    padding: .5rem;

    @media screen and (width < 700px) {
        overflow: hidden;
    }
}

.main-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;

    width: 100%;
    height: 100%;
    min-height: calc(100vh - 1rem);

    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 10;
        background: var(--back);
        padding: 2rem 4rem;

        display: none;
        flex-direction: column;
        align-items: center;
        justify-content: center;

        h1 {
            font-size: 1.75rem;
            text-align: center;
        }

        p {
            font-size: 1.25rem;
            text-align: center;
        }

        @media screen and (width < 700px) {
            display: flex;
            overflow: auto;
        }
    }

    main {
        width: 100%;

        display: flex;
        align-items: center;
        justify-content: center;
        gap: clamp(0.5rem, 10vw, 14rem);

        .grid-container {
            width: 100%;
            max-width: 400px;

            display: flex;
            flex-direction: column;
            gap: .5rem;

            .header-title {
                margin-bottom: 1rem;
            }

            .control-data-collection {
                width: 100%;

                display: flex;
                align-items: center;
                gap: .5rem;

                .toggle-data-collection-container {
                    cursor: pointer;
                    width: 60px;
                    height: 26px;
                    border-radius: 13px;
                    background: var(--color_trs);
                    transition: .3s ease-in-out;
                    position: relative;

                    display: block;

                    &::after {
                        position: absolute;
                        content: "";
                        top: 2px;
                        left: 2px;
                        transition: .3s ease-in-out;

                        height: 22px;
                        aspect-ratio: 1;
                        border-radius: 50%;
                        background: var(--color);
                    }

                    &:has(input[type="checkbox"]:checked) {
                        background: var(--brand_color);

                        &::after {
                            transform: translateX(26px);
                        }
                    }
                }

                input[type="number"] {
                    width: 100%;
                    border: 0;
                    outline: none;
                    border-radius: 4px;
                    padding-left: .25rem;
                    padding-block: .125rem;
                    background: var(--color_trs);
                    color: var(--color);
                    font-size: 1rem;

                    opacity: 0;
                    visibility: hidden;
                    transition: .2s;

                    &::placeholder {
                        user-select: none;
                        color: var(--color);
                        font-size: 1rem;
                    }
                }

                &:has(input[type="checkbox"]:checked) {
                    input[type="number"] {
                        opacity: 1;
                        visibility: visible;
                    }
                }
            }

            .image-grid-container {
                width: 100%;
                max-width: 500px;

                display: grid;
                grid-template-columns: repeat(20, auto);
                grid-gap: 1px;

                .pixel-container {
                    background: var(--color_trs);
                    aspect-ratio: 1;
                    border-radius: 2px;
                    transition: .2s;

                    &.is-visited,
                    &:hover {
                        background: var(--color);
                    }

                    &.nohover {
                        background: var(--color_trs);
                    }
                }

                &:has(.nohover) {
                    cursor: crosshair;
                }
            }

            .footer-buttons {
                width: 100%;
                max-width: 500px;

                display: flex;
                align-items: center;
                gap: .5rem;

                .clear-pixel {
                    user-select: none;
                    background: transparent;
                    border: 0;
                    outline: none;
                    padding: 2px;
                    border-radius: 4px;
                    cursor: pointer;
                    transition: .2s;

                    &.active {
                        background: var(--color_trs);
                    }
                }

                .button {
                    user-select: none;
                    background: transparent;
                    color: var(--color);
                    border: 1px solid currentColor;
                    outline: none;
                    padding: .25rem 1rem;
                    border-radius: 4px;
                    font-size: 1rem;
                    cursor: pointer;
                    transition: .2s;

                    &:hover {
                        background: var(--color);
                        color: var(--back);
                    }

                    &.save-example {
                        opacity: 0;
                        visibility: hidden;
                        transition: .2s;
                    }
                }
            }
        }

        .layers-container {
            display: flex;
            align-items: center;
            gap: .5rem;

            #layer-1,
            #layer-2 {
                margin-right: clamp(1rem, 10vw, 8rem);
            }

            .layer {
                display: flex;
                flex-direction: column;
                gap: 2px;

                .neuron-container {
                    height: 32px;
                    width: 50px;
                    border: 1px solid var(--color);
                    background: var(--back);
                    border-radius: 2px;

                    position: relative;
                    overflow: hidden;

                    .activation-level {
                        position: absolute;
                        top: 3%;
                        left: 3%;
                        height: 94%;
                        transition: width .2s;

                        background: var(--color);
                        border-radius: 1px;
                    }
                }

                &.labels {
                    .label {
                        height: 32px;
                        width: 50px;
                        border: 1px solid transparent;

                        display: flex;
                        align-items: center;
                        justify-content: center;

                        font-size: 1.75rem;
                        font-weight: 600;
                        font-family: "Homemade Apple", serif;
                    }
                }
            }
        }

        #neurons-connections {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1;
        }
    }

    &:has(input[type="checkbox"]:checked) {
        .footer-buttons {
            .button {
                &.save-example {
                    opacity: 1;
                    visibility: visible;
                }
            }
        }
    }
}