@media only screen and (min-width: 1401px) {
    #hud {
        display: none !important;
    }

    #hud.active {
        display: none !important;
    }
}

@media only screen and (max-width: 1400px) {
    #hud.active {
        display: block !important;
    }

    .instructions-container {
        display: none !important;
    }
}

@media only screen and (max-width: 854px) {

    #end-screen {
        max-width: 100vw;
        height: auto;
        aspect-ratio: 854 / 480;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        margin: 0;
    }

    #pause-menu,
    #in-game-settings {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
    }

    canvas {
        width: 100%;
        height: auto;
    }
}

@media only screen and (max-width: 1000px) {
    body {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
    }

    .title-container h1 {
        display: none !important;
    }

    #game-container {
        width: 100%;
        height: auto;
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
    }

    canvas {
        width: 100% !important;
        height: auto !important;
        max-width: 100%;
        display: block;
        margin: 0 auto;
    }

    #pause-menu,
    #in-game-settings,
    #end-screen {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
    }

    #hud {
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
    }

    .pause-content {
        padding: 20px !important;
        transform: scale(0.9);
        overflow-y: hidden;
    }

    .pause-buttons {
        gap: 8px !important;
        margin-bottom: 0 !important;
    }

    .pause-buttons .game-btn {
        transform: scale(0.9);
    }

    .end-content {
        padding: 20px !important;
        transform: scale(0.9);
        overflow-y: hidden;
    }

    .end-buttons {
        gap: 10px !important;
    }

    .end-content h2 {
        font-size: 36px !important;
        margin: 10px 0 !important;
    }

    .pause-content h2 {
        font-size: 48px !important;
        margin: 10px 0 20px 0 !important;
    }

    #end-message {
        font-size: 18px !important;
        margin: 10px 0 20px 0 !important;
    }

    .end-screen-btn {
        width: 200px !important;
        font-size: 18px !important;
        padding: 10px 15px !important;
    }
}

@media only screen and (max-height: 700px) {
    .title-container h1 {
        display: none !important;
    }

    .pause-level-indicator {
        font-size: 20px;
    }
}

@media only screen and (max-width: 600px) {
    .pause-content {
        transform: scale(1);
        padding: 15px !important;
    }

    .end-content {
        transform: scale(1);
        padding: 15px !important;
    }

    .pause-content h2 {
        font-size: 48px !important;
    }

    .end-content h2 {
        font-size: 28px !important;
    }

    .pause-buttons .game-btn,
    .end-screen-btn {
        font-size: 24px !important;
        padding: 8px 12px !important;
    }

    #end-message {
        font-size: 16px !important;
    }

    .pause-level-indicator {
        font-size: 16px;
    }
}

@media only screen and (max-height: 600px) {
    .pause-content {
        transform: scale(0.8);
    }

    .end-content {
        transform: scale(0.8);
    }
}

@media only screen and (max-height: 480px) {

    #game-container {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    #canvas {
        max-height: 100vh;
    }

    #pause-menu,
    #in-game-settings,
    #end-screen {
        max-height: 100vh;
        width: 100%;
    }

    #hud {
        max-height: 100vh;
    }

    .pause-content {
        transform: scale(0.9);
    }

    .pause-level-indicator {
        font-size: 16px !important;
    }

}

@media only screen and (max-height: 440px) {
    .mobile-button {
        width: 48px;
        height: 48px;
    }
}

@media only screen and (max-height: 360px) {
    .mobile-button {
        width: 48px;
        height: 48px;
    }

    #hud img {
        width: 24px;
        height: 24px;
    }
}