/* Global Styles */

body {
    background: #111;
    height: 100vh;
    overflow: hidden;
    font-family: "Kode Mono";
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr 1fr;
    grid-template-columns: 1fr;
}

@media (max-width: 768px) {
    .game-container {
        padding-bottom: 3rem;
    }
}

@media (min-width: 769px) {
    body {
        display: flex;
    }
}

.hidden {
    display: none;
}

.visible {
    display: block !important;
}

.visible-flex {
    display: flex !important;
}

/* Title & Logo */

.logo {
    display: none;
}

.title {
    text-decoration: none;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 8rem;
    max-height: 155px;
}

@media (min-width: 769px) {
    .title {
        grid-column: 2;
        margin-top: 2rem;
    }

    .logo {
        margin-left: 2rem;
        height: 2.5rem;
        width: 2.5rem;
        margin-bottom: 1rem;
        display: block;
    }
}

/* Canvas */

#game {
    display: none;
}

#end-tv {
    display: none;
}

/* UI */

.game-title {
    font-family: Crushed;
    position: relative;
    left: -4rem;
    font-size: 2.5rem;
    top: -2rem;
    margin-bottom: 0;
}

.game-title span {
    display: inline-block;
    transform: rotate(5deg);
    position: absolute;
    top: 0.4rem;
    left: 7.5rem;
    color: #edea12;
    text-shadow:
        0 0 5px #fff,
        0 0 10px #00aaff,
        0 0 20px #00aaff,
        0 0 40px #00aaff;
    animation: flicker 10s infinite;
}

@keyframes flicker {
    0%, 75% {
        opacity: 1;
    }

    76% {
        opacity: 0.2;
    }

    77% {
        opacity: 1;
    }

    78% {
        opacity: 0.1;
    }

    79% {
        opacity: 1;
    }

    /* Completely dead */
    80%, 88% {
        opacity: 0;
    }

    89% {
        opacity: 0.3;
    }

    90% {
        opacity: 1;
    }

    91% {
        opacity: 0;
    }

    92%, 100% {
        opacity: 1;
    }
}

.heading {
    display: flex;
    justify-content: space-between;
}

.close {
    color: white;
    background-color: transparent;
    border: none;
    padding-left: 4rem;
}

.close:hover {
    cursor: pointer;
}

#start {
    position: absolute;
    width: 220px;
    height: 170px;
    background: transparent;
    border: none;
    font-family: Crushed;
    font-size: 1rem;
    font-weight: 700;
    color: #191970;
    border-radius: 16px;
    text-transform: uppercase;
    box-shadow:
        0 0 10px #4283a3,
        0 0 20px #30576a,
        0 0 40px #30576a;
    top: calc(50% - 200px + 115px);
    left: calc(50% - 250px + 140px);
}

#start:hover,
#reset:hover {
    cursor: pointer;
}

#info-container {
    width: 85%;
    display: flex;
    justify-content: space-between;
    position: absolute;
    display: none;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 1rem;
}

@media (min-width: 769px) {
    #info-container {
        bottom: 2rem;
    }
}

#instruction-container {
    color: white;
    background: black;
    display: grid;
    grid-template-rows: auto 1fr;
    justify-content: center;
    width: 70%;
    justify-self: center;
    align-self: center;
    padding: 2rem;
    border: 1px solid white;
    height: fit-content;
    position: absolute;
    left: 2rem;
    transform: translateX(-200%);
    transition: transform 0.7s;
    font-family: Crushed;
    z-index: 1;
}

@media (min-width: 769px) {
    #instruction-container {
        width: 20%;
    }
}

#instruction-container.open {
    transform: translateX(0);
}

#instruction-container p {
    font-size: 0.75rem;
    font-family: "Kode Mono";
}

#instructions-button {
    height: fit-content;
    padding: 1rem 2rem;
    background: transparent;
    border: 1px solid white;
    color: white;
    position: absolute;
    top: 2rem;
    left: 2rem;
    font-family: Crushed;
    text-transform: uppercase;
}

#instructions-button:hover {
    cursor: pointer;
}

#leaderboard-container {
    color: white;
    background: black;
    display: grid;
    grid-template-rows: auto 1fr;
    justify-content: center;
    justify-self: center;
    align-self: center;
    border: 1px solid white;
    height: fit-content;
    font-family: Crushed;
    width: fit-content;
    margin-bottom: 2rem;
    display: none;
    padding: 0 2rem;
    position: absolute;
}

#leaderboard-container.open {
    display: grid;
}

#leaderboard-container .score-container {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
}

@media (min-width: 769px) {
    #leaderboard-container .score-container {
        flex-direction: column;
        gap: 0;
    }
}

#leaderboard-container .score {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-family: "Kode Mono";
    margin-bottom: 0.5rem;
}

#leaderboard-button {
    height: fit-content;
    padding: 1rem 2rem;
    background: transparent;
    border: 1px solid white;
    color: white;
    position: absolute;
    top: 2rem;
    right: 2rem;
    font-family: Crushed;
    text-transform: uppercase;
}

#leaderboard-button:hover {
    cursor: pointer;
}

.score-column-1,
.score-column-2 {
    display: flex;
    flex-direction: column;
}

@media (min-width: 769px) {
    #leaderboard-container {
        position: absolute;
        right: 2rem;
        transform: translateX(200%);
        transition: transform 0.7s;
        grid-row: unset;
        width: auto;
        padding: 2rem;
        margin-bottom: 0;
        display: block;
    }

    #leaderboard-container.open {
        transform: translateX(0);
    }
}

/* Game */

#game {
    grid-row: 2;
    grid-column: 2;
    width: 80%;
    height: 100%;
    margin: 0 auto;
}

.game-container {
    background: #111;
    color: white;
    font-family: monospace;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    margin: 0 auto;
}

canvas {
    display: block;
    cursor: pointer;
    touch-action: none;
}

#start-tv {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    height: 170px;
}

@media (min-width: 769px) {
    #start-tv {
        max-width: 100vw;
    }
}

#end-tv {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    height: 170px;
}

@media (min-width: 769px) {
    #end-tv {
        max-width: 100vw;
    }
}

#initials-canvas {
    position: absolute;
    top: calc(50% + 125px);
    left: 50%;
    transform: translateX(-50%);
    display: none;
}

#end {
    display: none;
    position: absolute;
    width: 220px;
    height: 170px;
    background: transparent;
    border: none;
    font-family: Crushed;
    font-size: 1rem;
    font-weight: 700;
    color: #111;
    border-radius: 16px;
    text-transform: uppercase;
    box-shadow:
        0 0 10px #a34242,
        0 0 20px #6a3030,
        0 0 40px #6a3030;
    top: calc(50% - 200px + 115px);
    left: calc(50% - 250px + 140px);
}

#name-entry {
    position: fixed;
    top: 75%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    font-family: Crushed;
    color: white;
    border-radius: 16px;
    padding: 1rem 1.25rem;
    width: min(90vw, 340px);
    z-index: 9999;
}

#player-initials {
    width: 100%;
    padding: 0.75rem;
    font-family: monospace;
    font-size: 1.75rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.4rem;
    background: #111;
    color: white;
    border: none;
}

#submit-score {
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: 1px solid white;
    color: white;
    font-family: Crushed;
    text-transform: uppercase;
    cursor: pointer;
}