
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;

    overflow: hidden;

    background: #030a10;
    color: #e9f4f1;

    font-family: Arial, sans-serif;

    user-select: none;
    -webkit-user-select: none;

    overscroll-behavior: none;
}

body {
    position: fixed;
    inset: 0;
}

#game-container {
    position: fixed;
    inset: 0;

    width: 100%;
    height: 100vh;
    height: 100dvh;

    background: #07131d;

    overflow: hidden;
    isolation: isolate;
}

canvas {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    display: block;

    touch-action: none;
}


/* --------------------------------
   SCREENS
-------------------------------- */

.screen {
    position: absolute;
    inset: 0;

    z-index: 1000;

    display: flex;

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

    padding:
        env(safe-area-inset-top, 10px)
        env(safe-area-inset-right, 10px)
        env(safe-area-inset-bottom, 10px)
        env(safe-area-inset-left, 10px);

    background: rgba(2, 10, 16, 0.88);
}

.hidden {
    display: none !important;
}


/* --------------------------------
   PANELS
-------------------------------- */

.panel {
    width: 430px;
    max-width: 94%;

    max-height: 90%;
    overflow-y: auto;

    padding: 30px;

    text-align: center;

    background:
        linear-gradient(
            145deg,
            #0b2835,
            #06131e
        );

    border: 1px solid #24776e;

    border-radius: 15px;

    box-shadow: 0 0 35px #000;
}

h1 {
    font-size: 48px;
    letter-spacing: 5px;
    margin-top: 8px;
}

h1 span {
    color: #39c6b3;
}

h2 {
    color: #39c6b3;
    letter-spacing: 3px;
}

p {
    color: #aac8c5;
    line-height: 1.6;
}


/* --------------------------------
   BUTTONS
-------------------------------- */

button {
    display: block;

    width: 100%;
    min-height: 46px;

    margin: 10px 0;

    border: 1px solid #399d91;
    border-radius: 7px;

    background: #12554f;
    color: white;

    font-size: 15px;
    font-weight: bold;

    cursor: pointer;

    touch-action: manipulation;
}

button:hover {
    background: #21877b;
}

button:active {
    transform: scale(0.97);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

small {
    display: block;
    margin-top: 22px;

    color: #6da9a1;
    font-size: 10px;
}

.version {
    margin-top: 22px;

    color: #5ce4c5;

    font-size: 11px;
    letter-spacing: 3px;
}


/* --------------------------------
   HUD
-------------------------------- */

#hud {
    position: absolute;

    z-index: 900;

    top: max(12px, env(safe-area-inset-top));
    left: max(15px, env(safe-area-inset-left));
    right: max(15px, env(safe-area-inset-right));

    display: flex;

    justify-content: space-between;
    align-items: flex-start;

    pointer-events: none;
}

.hud-panel {
    padding: 10px 13px;

    background: rgba(5, 25, 34, 0.78);

    border: 1px solid #205c58;
    border-radius: 8px;

    backdrop-filter: blur(5px);
}

#missionLabel {
    display: block;

    color: #8fe5d5;

    font-size: 13px;
    letter-spacing: 1px;
}

#hud span {
    font-size: 12px;
    color: #a9d4ca;

    margin-right: 8px;
}

.bar {
    width: 180px;
    max-width: 38vw;

    height: 9px;

    margin: 8px 0;

    background: #17323b;

    border-radius: 10px;

    overflow: hidden;
}

#energyBar {
    width: 100%;
    height: 100%;

    background: #39c6b3;

    transition: width 0.2s linear;
}

#hud .pause-button {
    display: flex;

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

    width: 46px;
    height: 46px;

    min-height: 46px;

    margin: 0;

    background: #0b4848cc;

    border: 1px solid #39c6b3;
    border-radius: 9px;

    color: white;

    font-size: 23px;

    pointer-events: auto;
}


/* --------------------------------
   MOBILE CONTROLS
-------------------------------- */

#controls {
    position: static;

    display: contents;

    pointer-events: none;
}

#controls button {
    position: fixed;

    z-index: 10010;

    display: flex;

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

    min-width: 54px;
    min-height: 54px;

    width: 65px;
    height: 65px;

    margin: 0;
    padding: 4px;

    border: 2px solid #48bba9;
    border-radius: 50%;

    background: rgba(9, 42, 51, 0.88);

    color: white;

    font-size: 12px;
    font-weight: bold;

    pointer-events: auto;

    touch-action: none;

    user-select: none;
    -webkit-user-select: none;
}

/* The JavaScript positions all buttons.
   These are fallback positions before JS runs. */

#controls [data-key="left"] {
    left: 12%;
    top: 84%;
}

#controls [data-key="right"] {
    left: 25%;
    top: 84%;
}

#controls [data-key="jump"] {
    left: 76%;
    top: 84%;
}

#controls [data-key="fire"] {
    left: 89%;
    top: 84%;

    border-color: #d2a45d;
    background: rgba(91, 53, 25, 0.9);
}


/* --------------------------------
   ROTATE DEVICE MESSAGE
-------------------------------- */

#rotateNotice {
    display: none;

    position: fixed;
    inset: 0;

    z-index: 50000;

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

    padding: 25px;

    text-align: center;

    background: #06131e;
}

.rotate-icon {
    color: #39c6b3;
    font-size: 70px;
}

#rotateNotice h2 {
    font-size: 21px;
}

#rotateNotice p {
    font-size: 14px;
}


/* --------------------------------
   MOBILE
-------------------------------- */

@media (max-width: 600px) {

    .panel {
        width: 94%;
        padding: 20px;
    }

    h1 {
        font-size: 38px;
        letter-spacing: 3px;
    }

    h2 {
        font-size: 21px;
    }

    .bar {
        width: 135px;
    }

    #hud span {
        font-size: 11px;
    }

}


/* --------------------------------
   LANDSCAPE GAME MODE
-------------------------------- */

@media (
    orientation: portrait
) and (
    max-width: 800px
) {

    #rotateNotice {
        display: flex;
    }

}


/* --------------------------------
   SHORT LANDSCAPE SCREENS
-------------------------------- */

@media (
    orientation: landscape
) and (
    max-height: 450px
) {

    .panel {
        padding: 13px;
    }

    h1 {
        font-size: 32px;
        margin: 5px 0;
    }

    h2 {
        font-size: 19px;
        margin: 5px 0;
    }

    p {
        font-size: 12px;
        margin: 5px 0;
    }

    .panel button {
        min-height: 36px;
        margin: 5px 0;
    }

}


/* --------------------------------
   REDUCED MOTION
-------------------------------- */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }

}