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


:root {

    --green: #4caf50;

    --light-green: #7ed957;

    --diamond: #42e8e0;

    --danger: #e84b4b;

}


html,
body {

    width: 100%;

    min-height: 100%;

}


body {

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background:
        #101510;

    color:
        #ffffff;

    overflow-x:
        hidden;

    user-select:
        none;

}


/* =========================================
BACKGROUND
========================================= */

.background {

    position:
        fixed;

    inset:
        0;

    background:

        linear-gradient(
            rgba(0, 0, 0, 0.55),
            rgba(0, 0, 0, 0.78)
        ),

        repeating-linear-gradient(

            0deg,

            #253725 0px,

            #253725 40px,

            #1d301d 40px,

            #1d301d 80px

        );

    z-index:
        -5;

}


/* =========================================
SCREENS
========================================= */

.screen {

    display:
        none;

    min-height:
        100vh;

}


.screen.active {

    display:
        flex;

}


/* =========================================
MAIN MENU
========================================= */

#mainMenu {

    justify-content:
        center;

    align-items:
        center;

    padding:
        25px;

}


.menu-card {

    width:
        min(
            650px,
            100%
        );

    padding:
        44px 34px;

    background:

        linear-gradient(

            145deg,

            rgba(
                34,
                34,
                34,
                0.98
            ),

            rgba(
                15,
                15,
                15,
                0.98
            )

        );

    border:
        5px solid #585858;

    box-shadow:

        0 0 0 5px #1d1d1d,

        0 20px 60px rgba(
            0,
            0,
            0,
            0.65
        );

    text-align:
        center;

}


.academy-label {

    color:
        #9b9b9b;

    text-transform:
        uppercase;

    letter-spacing:
        3px;

    font-size:
        12px;

    margin-bottom:
        18px;

}


.menu-card h1 {

    font-size:
        clamp(
            38px,
            7vw,
            68px
        );

    line-height:
        0.95;

    text-transform:
        uppercase;

    text-shadow:
        4px 4px 0 #151515;

}


.menu-card h1 span {

    display:
        block;

    color:
        #60c953;

    margin-top:
        10px;

}


.subtitle {

    color:
        #c9c9c9;

    max-width:
        500px;

    margin:
        25px auto 30px;

    line-height:
        1.6;

}


/* =========================================
BUTTONS
========================================= */

.menu-buttons {

    display:
        grid;

    gap:
        13px;

    max-width:
        390px;

    margin:
        25px auto;

}


.minecraft-btn {

    width:
        100%;

    padding:
        15px 20px;

    background:
        #555555;

    color:
        white;

    border:
        3px solid #777777;

    border-bottom-color:
        #292929;

    border-right-color:
        #292929;

    font-weight:
        800;

    font-size:
        17px;

    cursor:
        pointer;

    transition:

        transform 0.15s,

        filter 0.15s;

}


.minecraft-btn:hover {

    filter:
        brightness(
            1.18
        );

    transform:
        translateY(
            -2px
        );

}


.minecraft-btn:active {

    transform:
        translateY(
            2px
        );

}


.minecraft-btn.primary {

    background:
        #3c8f3d;

    border-top-color:
        #69c76b;

    border-left-color:
        #69c76b;

    border-right-color:
        #1f551f;

    border-bottom-color:
        #1f551f;

}


.small-btn {

    border:
        none;

    padding:
        10px 14px;

    cursor:
        pointer;

    border-radius:
        5px;

    font-weight:
        700;

}


/* =========================================
MENU STATS
========================================= */

.menu-stats {

    display:
        grid;

    grid-template-columns:
        repeat(
            2,
            1fr
        );

    gap:
        12px;

    margin-top:
        25px;

}


.menu-stats div {

    background:
        #171717;

    padding:
        13px;

    border:
        2px solid #3f3f3f;

}


.menu-stats span {

    display:
        block;

    color:
        #aaaaaa;

    font-size:
        12px;

    margin-bottom:
        5px;

}


.menu-stats strong {

    color:
        #f6e65c;

    font-size:
        20px;

}


/* =========================================
GAME
========================================= */

#gameScreen {

    flex-direction:
        column;

    width:
        100%;

    min-height:
        100vh;

    background:
        #111111;

}


/* =========================================
HUD
========================================= */

#hud {

    width:
        100%;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    flex-wrap:
        wrap;

    gap:
        7px;

    padding:
        9px;

    background:
        #181818;

    border-bottom:
        4px solid #444444;

}


.hud-item {

    min-width:
        90px;

    background:
        #292929;

    border:
        2px solid #464646;

    padding:
        7px 10px;

    text-align:
        center;

}


.hud-item.level-item {

    min-width:
        150px;

}


.hud-item small {

    display:
        block;

    color:
        #aaaaaa;

    font-size:
        9px;

    letter-spacing:
        1px;

}


.hud-item strong {

    display:
        block;

    margin-top:
        4px;

    font-size:
        14px;

}


.hud-button {

    width:
        42px;

    height:
        42px;

    border:
        2px solid #555555;

    background:
        #292929;

    color:
        white;

    cursor:
        pointer;

    font-size:
        18px;

}


/* =========================================
POWER STATUS
========================================= */

.power-status-bar {

    width:
        100%;

    min-height:
        43px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    flex-wrap:
        wrap;

    gap:
        7px;

    padding:
        7px 10px;

    background:
        #101010;

    border-bottom:
        3px solid #333333;

}


.power-status-empty {

    color:
        #777777;

    font-size:
        12px;

    font-weight:
        700;

}


.power-status-item {

    display:
        flex;

    align-items:
        center;

    gap:
        8px;

    min-width:
        128px;

    padding:
        6px 9px;

    background:
        #202020;

    border:
        2px solid #444444;

    font-size:
        12px;

    font-weight:
        800;

}


.power-status-item.speed {

    border-color:
        #3d96c7;

}


.power-status-item.speed strong {

    color:
        #6fd5ff;

}


.power-status-item.apple {

    border-color:
        #c69c2f;

}


.power-status-item.apple strong {

    color:
        #ffd95c;

}


.power-status-item.shield {

    border-color:
        #4fbcd2;

}


.power-status-item.shield strong {

    color:
        #7eeaff;

}


.power-status-item[hidden],
.power-status-empty[hidden] {

    display:
        none !important;

}


/* =========================================
GAME CONTAINER
========================================= */

#gameContainer {

    width:
        100%;

    flex:
        1;

    display:
        flex;

    justify-content:
        center;

    align-items:
        center;

    position:
        relative;

    padding:
        12px;

}


#gameCanvas {

    display:
        block;

    width:
        min(
            100%,
            1200px
        );

    height:
        auto;

    max-height:
        calc(
            100vh - 155px
        );

    background:
        #272727;

    image-rendering:
        pixelated;

    border:
        5px solid #444444;

    box-shadow:
        0 15px 45px rgba(
            0,
            0,
            0,
            0.7
        );

}


#gameMessage {

    position:
        absolute;

    top:
        26px;

    left:
        50%;

    transform:
        translateX(
            -50%
        );

    max-width:
        90%;

    background:
        rgba(
            0,
            0,
            0,
            0.86
        );

    padding:
        10px 18px;

    border:
        2px solid #555555;

    font-weight:
        700;

    text-align:
        center;

    opacity:
        0;

    pointer-events:
        none;

    transition:
        opacity 0.22s;

    z-index:
        10;

}


#gameMessage.show {

    opacity:
        1;

}


/* =========================================
MODALS
========================================= */

.modal {

    position:
        fixed;

    inset:
        0;

    z-index:
        1000;

    display:
        none;

    justify-content:
        center;

    align-items:
        center;

    padding:
        20px;

    background:
        rgba(
            0,
            0,
            0,
            0.83
        );

}


.modal.show {

    display:
        flex;

}


.modal-card {

    position:
        relative;

    width:
        min(
            720px,
            100%
        );

    max-height:
        90vh;

    overflow-y:
        auto;

    padding:
        35px;

    background:
        #252525;

    border:
        4px solid #585858;

    box-shadow:

        0 0 0 4px #111111,

        0 20px 60px black;

}


.modal-card h2 {

    margin-bottom:
        25px;

    font-size:
        30px;

    text-align:
        center;

}


.close-btn {

    position:
        absolute;

    top:
        10px;

    right:
        10px;

    width:
        38px;

    height:
        38px;

    background:
        #a63232;

    color:
        white;

    border:
        2px solid #d25b5b;

    cursor:
        pointer;

    font-size:
        17px;

}


/* =========================================
INSTRUCTIONS
========================================= */

.instructions-grid {

    display:
        grid;

    grid-template-columns:
        repeat(
            2,
            1fr
        );

    gap:
        15px;

}


.instruction {

    padding:
        20px;

    background:
        #181818;

    border:
        2px solid #3c3c3c;

}


.instruction span {

    font-size:
        30px;

}


.instruction h3 {

    margin:
        10px 0 7px;

    color:
        #67cf5c;

}


.instruction p {

    color:
        #bbbbbb;

    line-height:
        1.5;

}


/* =========================================
SETTINGS
========================================= */

.settings-card {

    max-width:
        520px;

}


.setting-group {

    margin:
        17px 0;

    padding:
        18px;

    background:
        #171717;

    border:
        2px solid #404040;

}


.setting-group label {

    display:
        block;

    margin-bottom:
        10px;

    font-weight:
        700;

}


.setting-group select {

    width:
        100%;

    padding:
        12px;

    border:
        2px solid #555555;

    background:
        #303030;

    color:
        white;

    font-size:
        16px;

}


.toggle-row {

    display:
        flex;

    justify-content:
        space-between;

    align-items:
        center;

    gap:
        15px;

}


.setting-info {

    margin-top:
        22px;

    background:
        #171717;

    padding:
        17px;

    border-left:
        4px solid #4caf50;

}


.setting-info p {

    color:
        #bbbbbb;

    margin:
        8px 0;

    line-height:
        1.5;

}


/* =========================================
LEVEL SELECT
========================================= */

.level-select-grid {

    display:
        grid;

    grid-template-columns:
        repeat(
            2,
            1fr
        );

    gap:
        12px;

}


.level-card {

    padding:
        16px;

    background:
        #171717;

    border:
        2px solid #444444;

    color:
        white;

    text-align:
        left;

    cursor:
        pointer;

    transition:

        border-color 0.15s,

        transform 0.15s;

}


.level-card strong,
.level-card span {

    display:
        block;

}


.level-card span {

    margin-top:
        6px;

    color:
        #aaaaaa;

    font-size:
        13px;

}


.level-card.locked {

    opacity:
        0.45;

    cursor:
        not-allowed;

}


.level-card:not(.locked):hover {

    border-color:
        #67cf5c;

    transform:
        translateY(
            -2px
        );

}


/* =========================================
RESULTS
========================================= */

.game-modal {

    z-index:
        1500;

}


.result-card {

    max-width:
        460px;

    text-align:
        center;

}


.result-card .minecraft-btn {

    margin-top:
        10px;

}


.big-icon {

    font-size:
        65px;

    margin-bottom:
        10px;

}


.result-card p {

    color:
        #bbbbbb;

    margin-bottom:
        20px;

}


.result-grid {

    display:
        grid;

    grid-template-columns:
        1fr 1fr;

    gap:
        10px;

}


.result-score {

    background:
        #151515;

    border:
        2px solid #444444;

    padding:
        15px;

    margin-bottom:
        20px;

    color:
        #aaaaaa;

}


.result-score strong {

    display:
        block;

    margin-top:
        5px;

    color:
        #f3e55c;

    font-size:
        28px;

}


.result-card.danger h2 {

    color:
        #ef5350;

}


/* =========================================
MOBILE CONTROLS
========================================= */

#mobileControls {

    display:
        none;

    grid-template-columns:
        repeat(
            3,
            64px
        );

    grid-template-rows:
        repeat(
            2,
            64px
        );

    justify-content:
        center;

    gap:
        7px;

    padding:
        12px;

}


.control-btn {

    border:
        3px solid #656565;

    background:
        #343434;

    color:
        white;

    font-size:
        25px;

    border-radius:
        7px;

    touch-action:
        none;

}


.control-btn:active,
.control-btn.pressed {

    background:
        #4d8d44;

    transform:
        scale(
            0.94
        );

}


.control-btn.up {

    grid-column:
        2;

    grid-row:
        1;

}


.control-btn.left {

    grid-column:
        1;

    grid-row:
        2;

}


.control-btn.down {

    grid-column:
        2;

    grid-row:
        2;

}


.control-btn.right {

    grid-column:
        3;

    grid-row:
        2;

}


/* =========================================
TABLET
========================================= */

@media (
    max-width: 850px
) {

    #hud {

        padding:
            6px;

        gap:
            5px;

    }


    .hud-item {

        min-width:
            78px;

        padding:
            5px 7px;

    }


    .hud-item.level-item {

        min-width:
            130px;

    }


    .hud-item strong {

        font-size:
            12px;

    }


    .hud-button {

        width:
            36px;

        height:
            36px;

    }


    .power-status-bar {

        min-height:
            40px;

        padding:
            5px 7px;

    }


    .power-status-item {

        min-width:
            110px;

        padding:
            5px 7px;

        font-size:
            11px;

    }


    #gameContainer {

        padding:
            7px;

    }

}


/* =========================================
MOBILE
========================================= */

@media (
    max-width: 700px
) {

    #gameScreen {

        min-height:
            100vh;

    }


    #gameCanvas {

        width:
            100%;

        max-height:
            none;

        border-width:
            3px;

    }


    #mobileControls {

        display:
            grid;

    }


    .instructions-grid,
    .level-select-grid {

        grid-template-columns:
            1fr;

    }


    .menu-card {

        padding:
            35px 20px;

    }


    .menu-stats {

        grid-template-columns:
            1fr;

    }


    .result-grid {

        grid-template-columns:
            1fr;

    }

}


@media (
    max-width: 480px
) {

    .modal-card {

        padding:
            28px 18px;

    }


    .hud-item {

        min-width:
            70px;

    }


    .control-btn {

        width:
            60px;

        height:
            60px;

    }

}