* {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

:root {
    color: #222;
    font-size: 1em;
    line-height: 1.4;
    width: 100vw;
}

body {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    text-align: center;
    margin: 1rem 0 0;
    overflow-x: hidden;

    header {
        padding: 1rem;
      
        & .emulator-title {
            margin-block-start: 0;
            margin-block-end: 0;
            font-family: Silkscreen, sans-serif;
            color: #1cff28;
        }

        & .start-button {
            width: fit-content;
            padding: 0.4rem;
            align-self: center;

            &:hover {
                cursor: pointer;
            }
        }
    }

    canvas {
        background: #eee;
        width: 768px;
        height: 720px;
        align-self: center;
    }

    & #nesfile {
        align-self: center;
    }

    dialog {
        opacity: 0;

        .player1-controller, .player2-controller {
            display: flex;
            flex-direction: column;
            margin-bottom: 3rem;
            align-self: self-end;
            padding-right: 1.5rem;

            article {
                display: flex;
                justify-content: flex-end;

                & .key {
                    align-self: center;
                    height: 20%;
                    width: 50%;
                    margin-left: 0.5rem;
                }
            }
        }

        & .dialog-buttons {
            display: flex;
            padding: 1rem;
            justify-content: space-between;

            .save-button, .close-button {
                width: fit-content;
                padding: 0.2rem;
                
                &:hover {
                    cursor: pointer;
                }
            }
        }
    }

    .show-button {
        width: fit-content;
        align-self: center;
        padding: 0.2rem;
        margin-bottom: 4rem;

        &:hover {
            cursor: pointer;
        }
    }
    
    dialog[open] {
        opacity: 1;
        position-area: center;
    }
}

.missing {
    border-color: red;
}

::backdrop {
    background-image: linear-gradient(
        45deg,
        darkred,
        red,
        dodgerblue,
        green
    );
    opacity: 0.75;
}

.hidden {
    display: none;
}

@media (max-width: 768px) {
    body {
        canvas {
            width: 100%;
            height: auto;
        }
    }
}