* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --sky: #73d7ff;
    --dark: #10182b;
    --white: #ffffff;
    --yellow: #ffd43b;
    --orange: #ff7a18;
    --red: #ff3d4f;
    --green: #36d47c;
    --blue: #2478ff;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
    background: #08111f;
}

/* =================================
   GAME CONTAINER
================================= */

#gameContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--sky);
}

#gameArea {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

#gameCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
}


/* =================================
   HUD
================================= */

#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 70px;
    z-index: 20;

    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    align-items: center;

    padding: 10px 24px;

    color: white;

    background:
        linear-gradient(
            180deg,
            rgba(7, 17, 35, 0.9),
            rgba(7, 17, 35, 0.55),
            transparent
        );

    pointer-events: none;
}

.hud-item {
    display: flex;
    flex-direction: column;
    gap: 3px;

    font-weight: 800;
    font-size: 18px;

    text-shadow:
        2px 2px 0 #000,
        0 0 8px rgba(0, 0, 0, 0.4);
}

.hud-item:nth-child(2) {
    align-items: center;
}

.hud-item:nth-child(4) {
    align-items: center;
}

.hud-item:nth-child(5) {
    align-items: flex-end;
}

.hud-label {
    font-size: 10px;
    letter-spacing: 2px;
    opacity: 0.85;
}

.hud-center {
    text-align: center;

    font-size: 24px;
    font-weight: 1000;
    letter-spacing: 2px;

    text-shadow:
        3px 3px 0 #000,
        0 0 15px rgba(255, 255, 255, 0.4);
}


/* =================================
   SCREENS
================================= */

.screen {
    position: fixed;
    inset: 0;
    z-index: 100;

    display: flex;
    justify-content: center;
    align-items: center;

    background:
        radial-gradient(
            circle at center,
            rgba(34, 90, 160, 0.2),
            rgba(4, 10, 25, 0.88)
        );

    backdrop-filter: blur(5px);
}

.screen.hidden {
    display: none;
}


/* =================================
   MENU CARD
================================= */

.menu-card {
    width: min(92%, 520px);

    padding: 45px 40px;

    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 28px;

    text-align: center;

    color: white;

    background:
        linear-gradient(
            145deg,
            rgba(28, 46, 78, 0.97),
            rgba(9, 19, 38, 0.98)
        );

    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);

    animation: cardIn 0.55s ease;
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.94);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* =================================
   GAME LOGO
================================= */

.game-logo {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;

    font-weight: 1000;
    line-height: 0.9;
    letter-spacing: 2px;

    transform: skew(-4deg);
}

.game-logo span {
    font-size: clamp(34px, 7vw, 58px);

    color: #fff;

    text-shadow:
        4px 4px 0 #2478ff,
        7px 7px 0 #07132d;
}

.game-logo strong {
    font-size: clamp(42px, 9vw, 60px);

    color: var(--yellow);

    text-shadow:
        4px 4px 0 #ff641e,
        7px 7px 0 #07132d;
}

.subtitle {
    margin-bottom: 30px;

    color: #b8c7e4;

    font-size: 15px;
    letter-spacing: 1px;
}


/* =================================
   BUTTONS
================================= */

.game-btn {
    width: 100%;

    padding: 15px 22px;
    margin-top: 12px;

    border: 0;
    border-radius: 14px;

    cursor: pointer;

    color: white;

    background:
        linear-gradient(
            180deg,
            #ff9b2f,
            #f15a24
        );

    font-size: 17px;
    font-weight: 900;
    letter-spacing: 1px;

    box-shadow:
        0 6px 0 #a93716,
        0 12px 24px rgba(0, 0, 0, 0.3);

    transition:
        transform 0.12s ease,
        box-shadow 0.12s ease,
        filter 0.2s ease;
}

.game-btn:hover {
    filter: brightness(1.12);
    transform: translateY(-2px);

    box-shadow:
        0 8px 0 #a93716,
        0 16px 28px rgba(0, 0, 0, 0.35);
}

.game-btn:active {
    transform: translateY(5px);

    box-shadow:
        0 1px 0 #a93716,
        0 5px 12px rgba(0, 0, 0, 0.3);
}

.game-btn.secondary {
    background:
        linear-gradient(
            180deg,
            #33476d,
            #1c2c4c
        );

    box-shadow:
        0 5px 0 #0c1629,
        0 10px 20px rgba(0, 0, 0, 0.3);
}


/* =================================
   CONTROLS
================================= */

.controls {
    margin-top: 30px;

    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 18px;

    color: #b8c7e4;
    font-size: 12px;
}

.controls div {
    display: flex;
    align-items: center;
    gap: 5px;
}

kbd {
    min-width: 30px;
    padding: 7px 9px;

    border-radius: 6px;
    border: 1px solid #627393;

    background: #101c32;

    color: white;

    font-size: 11px;
    font-weight: 900;

    box-shadow: 0 3px 0 #060c18;
}


/* =================================
   RESULT CARD
================================= */

.result-card h1 {
    margin: 10px 0 10px;

    font-size: clamp(30px, 6vw, 45px);
    font-weight: 1000;

    color: var(--yellow);

    text-shadow: 3px 3px 0 #7d4814;
}

.result-card p {
    color: #c5d1e7;
    line-height: 1.6;
}

.result-icon {
    font-size: 70px;

    animation: trophyFloat 1.5s ease-in-out infinite;
}

@keyframes trophyFloat {
    0%,
    100% {
        transform: translateY(0) rotate(-3deg);
    }

    50% {
        transform: translateY(-10px) rotate(3deg);
    }
}


/* =================================
   RESULT STATS
================================= */

.result-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 12px;

    margin: 25px 0;
}

.result-stats div {
    padding: 16px;

    border-radius: 14px;

    background: rgba(255, 255, 255, 0.07);

    border: 1px solid rgba(255, 255, 255, 0.08);
}

.result-stats span {
    display: block;

    margin-bottom: 5px;

    color: #8fa3c6;

    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
}

.result-stats strong {
    font-size: 24px;
    color: white;
}


/* =================================
   FINAL SCORE
================================= */

.final-score {
    margin: 25px 0;
    padding: 18px;

    border-radius: 16px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 212, 59, 0.12),
            rgba(255, 122, 24, 0.08)
        );

    border: 1px solid rgba(255, 212, 59, 0.25);
}

.final-score span {
    display: block;

    color: #aebdd5;

    font-size: 11px;
    letter-spacing: 2px;
}

.final-score strong {
    display: block;

    margin-top: 5px;

    color: var(--yellow);

    font-size: 38px;
}


/* =================================
   MOBILE CONTROLS
================================= */

#mobileControls {
    position: absolute;

    left: 0;
    right: 0;
    bottom: 20px;

    z-index: 30;

    display: none;

    justify-content: space-between;
    align-items: flex-end;

    padding: 0 20px;

    pointer-events: none;
}

.mobile-left {
    display: flex;
    gap: 12px;
}

.control-btn {
    width: 62px;
    height: 62px;

    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;

    background: rgba(11, 27, 52, 0.75);

    color: white;

    font-size: 25px;
    font-weight: 900;

    box-shadow:
        0 6px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);

    backdrop-filter: blur(5px);

    pointer-events: auto;

    user-select: none;
    -webkit-user-select: none;

    touch-action: manipulation;
}

.control-btn:active {
    transform: scale(0.9);
    background: rgba(36, 120, 255, 0.8);
}

.jump-btn {
    width: 76px;
    height: 76px;

    background: rgba(241, 90, 36, 0.8);
}


/* =================================
   MESSAGE BOX
================================= */

.message-box {
    position: fixed;

    left: 50%;
    top: 90px;

    z-index: 200;

    transform: translateX(-50%);

    padding: 12px 22px;

    border-radius: 30px;

    color: white;

    background: rgba(8, 18, 35, 0.9);

    border: 1px solid rgba(255, 255, 255, 0.15);

    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);

    font-size: 14px;
    font-weight: 800;

    pointer-events: none;

    animation: messageIn 0.25s ease;
}

.message-box.hidden {
    display: none;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translate(-50%, -15px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}


/* =================================
   RESPONSIVE
================================= */

@media (max-width: 768px) {

    #hud {
        min-height: 58px;

        padding:
            8px 12px;

        grid-template-columns:
            repeat(5, 1fr);
    }

    .hud-item {
        font-size: 13px;
    }

    .hud-label {
        font-size: 8px;
        letter-spacing: 1px;
    }

    .hud-center {
        font-size: 15px;
    }

    .menu-card {
        padding: 35px 25px;
        border-radius: 22px;
    }

    .controls {
        gap: 10px;
    }

    #mobileControls {
        display: flex;
    }

    .result-icon {
        font-size: 55px;
    }
}


@media (max-width: 480px) {

    #hud {
        padding: 7px 8px;
    }

    .hud-item {
        font-size: 11px;
    }

    .hud-center {
        font-size: 12px;
        letter-spacing: 0;
    }

    .hud-label {
        font-size: 7px;
    }

    .game-btn {
        padding: 13px 18px;
        font-size: 14px;
    }

    .result-stats strong {
        font-size: 20px;
    }

    .final-score strong {
        font-size: 30px;
    }

    .control-btn {
        width: 56px;
        height: 56px;
    }

    .jump-btn {
        width: 68px;
        height: 68px;
    }
}


/* =================================
   LANDSCAPE MOBILE
================================= */

@media (max-height: 500px) {

    .menu-card {
        max-height: 92vh;
        overflow-y: auto;
        padding: 20px;
    }

    .game-logo strong {
        font-size: 40px;
    }

    .game-logo span {
        font-size: 25px;
    }

    .subtitle {
        margin-bottom: 15px;
    }

    .controls {
        margin-top: 15px;
    }

    #mobileControls {
        bottom: 10px;
    }

    .control-btn {
        width: 50px;
        height: 50px;
    }

    .jump-btn {
        width: 60px;
        height: 60px;
    }
}


/* =================================
   ACCESSIBILITY
================================= */

button {
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
    outline: 3px solid var(--yellow);
    outline-offset: 3px;
}


/* =================================
   SCROLLBAR
================================= */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0a1426;
}

::-webkit-scrollbar-thumb {
    background: #3b4f70;
    border-radius: 10px;
}