/* =========================================================
   Minecraft Parkour Adventure
   style.css
   ========================================================= */


/* =========================================================
   RESET
   ========================================================= */

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

html {
    width: 100%;
    height: 100%;
}

body {
    width: 100%;
    min-height: 100vh;
    overflow: hidden;

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

    background:
        linear-gradient(
            rgba(8, 18, 26, 0.35),
            rgba(4, 10, 16, 0.78)
        ),
        linear-gradient(
            135deg,
            #4f9e3f,
            #326d31 40%,
            #193c29
        );

    color: #ffffff;

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


/* =========================================================
   ROOT VARIABLES
   ========================================================= */

:root {
    --green: #59c83f;
    --green-dark: #2b7b2b;
    --green-light: #86e566;

    --emerald: #27e89f;
    --emerald-dark: #0d9e70;

    --stone: #73787d;
    --stone-dark: #3f4448;

    --brown: #6d4c2e;
    --brown-dark: #3f2c1e;

    --lava: #ff5a19;
    --lava-yellow: #ffb31a;

    --ice: #8fe9ff;
    --soul: #66564c;

    --panel: rgba(18, 27, 33, 0.94);
    --panel-light: rgba(41, 56, 65, 0.92);

    --border: rgba(255, 255, 255, 0.14);

    --shadow:
        0 18px 45px rgba(0, 0, 0, 0.4);

    --pixel-shadow:
        4px 4px 0 rgba(0, 0, 0, 0.35);
}


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

#background {
    position: fixed;
    inset: 0;
    z-index: -10;

    overflow: hidden;

    background:
        linear-gradient(
            rgba(255, 255, 255, 0.04) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.04) 1px,
            transparent 1px
        ),
        radial-gradient(
            circle at 20% 25%,
            rgba(120, 220, 100, 0.22),
            transparent 30%
        ),
        radial-gradient(
            circle at 80% 65%,
            rgba(38, 184, 125, 0.18),
            transparent 28%
        ),
        linear-gradient(
            180deg,
            #3473a2 0%,
            #6ab2d8 35%,
            #79bb61 36%,
            #2e7638 70%,
            #12321f 100%
        );

    background-size:
        48px 48px,
        48px 48px,
        auto,
        auto,
        auto;
}

#background::before {
    content: "";

    position: absolute;
    left: -5%;
    right: -5%;
    bottom: -80px;

    height: 290px;

    background:
        repeating-linear-gradient(
            90deg,
            #315f31 0,
            #315f31 60px,
            #28542a 60px,
            #28542a 120px
        );

    clip-path: polygon(
        0 45%,
        8% 30%,
        15% 44%,
        24% 20%,
        33% 43%,
        41% 29%,
        50% 46%,
        59% 21%,
        69% 42%,
        78% 26%,
        87% 43%,
        100% 25%,
        100% 100%,
        0 100%
    );

    opacity: 0.7;
}

#background::after {
    content: "";

    position: absolute;
    inset: 0;

    background:
        radial-gradient(
            circle at center,
            transparent 35%,
            rgba(0, 0, 0, 0.4) 100%
        );

    pointer-events: none;
}


/* =========================================================
   GENERAL SCREEN SYSTEM
   ========================================================= */

.screen {
    position: fixed;
    inset: 0;

    width: 100%;
    height: 100%;

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

    padding: 24px;

    overflow: auto;
}

.screen.hidden,
.overlay-screen.hidden,
.hidden {
    display: none !important;
}

.screen.active {
    display: flex;
}


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

#mainMenu {
    z-index: 10;
}

.menu-card {
    width: min(650px, 95vw);

    padding: 38px;

    border: 2px solid var(--border);
    border-radius: 20px;

    background:
        linear-gradient(
            180deg,
            rgba(29, 43, 50, 0.97),
            rgba(14, 23, 28, 0.96)
        );

    box-shadow: var(--shadow);

    text-align: center;

    backdrop-filter: blur(12px);

    animation: menuAppear 0.55s ease;
}

@keyframes menuAppear {
    from {
        opacity: 0;
        transform: translateY(25px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* =========================================================
   LOGO
   ========================================================= */

.game-logo {
    margin-bottom: 12px;
}

.logo-small {
    display: inline-block;

    margin-bottom: 8px;

    color: #cbcbcb;

    font-size: 14px;
    font-weight: 800;
    letter-spacing: 5px;

    text-transform: uppercase;
}

.game-logo h1 {
    font-size: clamp(38px, 8vw, 68px);
    line-height: 0.95;

    text-transform: uppercase;

    color: #ffffff;

    text-shadow:
        0 4px 0 #1d1d1d,
        0 8px 14px rgba(0, 0, 0, 0.45);
}

.game-logo h1 span {
    display: block;

    margin-top: 10px;

    color: var(--green-light);

    font-size: 0.66em;

    letter-spacing: 3px;
}

.menu-description {
    margin: 18px 0 26px;

    color: #d6e0e4;

    font-size: 17px;
}


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

button {
    font: inherit;
}

.menu-buttons {
    display: grid;
    gap: 12px;
}

.menu-btn {
    position: relative;

    width: 100%;

    padding: 15px 20px;

    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 9px;

    background:
        linear-gradient(
            180deg,
            #4b555b,
            #333c41
        );

    color: #ffffff;

    font-size: 17px;
    font-weight: 800;

    cursor: pointer;

    box-shadow:
        0 5px 0 #1b2125,
        0 9px 16px rgba(0, 0, 0, 0.2);

    transition:
        transform 0.12s ease,
        filter 0.12s ease,
        box-shadow 0.12s ease;
}

.menu-btn:hover {
    filter: brightness(1.15);

    transform: translateY(-2px);
}

.menu-btn:active {
    transform: translateY(3px);

    box-shadow:
        0 2px 0 #1b2125,
        0 4px 9px rgba(0, 0, 0, 0.22);
}

.primary-btn {
    border-color: rgba(159, 255, 130, 0.38);

    background:
        linear-gradient(
            180deg,
            #60d246,
            #31912e
        );

    box-shadow:
        0 5px 0 #1f6623,
        0 9px 18px rgba(25, 150, 52, 0.24);
}


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

.menu-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;

    margin-top: 24px;
}

.menu-stat-box {
    padding: 15px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: rgba(0, 0, 0, 0.22);
}

.stat-label {
    display: block;

    margin-bottom: 7px;

    color: #9fb1ba;

    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;

    text-transform: uppercase;
}

.menu-stat-box strong {
    color: var(--green-light);

    font-size: 20px;
}


/* =========================================================
   PANELS
   ========================================================= */

.panel {
    width: min(760px, 96vw);
    max-height: 90vh;

    padding: 28px;

    border: 2px solid var(--border);
    border-radius: 18px;

    background:
        linear-gradient(
            180deg,
            rgba(28, 40, 47, 0.98),
            rgba(14, 22, 27, 0.98)
        );

    box-shadow: var(--shadow);

    overflow-y: auto;

    animation: panelAppear 0.35s ease;
}

.large-panel {
    width: min(1080px, 96vw);
}

@keyframes panelAppear {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 24px;
}

.panel-tag {
    margin-bottom: 5px;

    color: var(--green-light);

    font-size: 12px;
    font-weight: 900;
    letter-spacing: 2px;

    text-transform: uppercase;
}

.panel h2 {
    font-size: clamp(28px, 5vw, 40px);
}

.close-btn {
    flex-shrink: 0;

    width: 45px;
    height: 45px;

    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;

    background: #3e474d;

    color: #ffffff;

    font-size: 20px;
    font-weight: 800;

    cursor: pointer;

    transition:
        background 0.18s ease,
        transform 0.18s ease;
}

.close-btn:hover {
    background: #c04444;
    transform: rotate(5deg);
}


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

#levelSelectScreen {
    z-index: 20;

    background: rgba(4, 10, 14, 0.58);

    backdrop-filter: blur(6px);
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.level-card {
    min-height: 200px;

    padding: 18px;

    border: 2px solid rgba(255, 255, 255, 0.11);
    border-radius: 12px;

    background:
        linear-gradient(
            145deg,
            rgba(74, 89, 97, 0.95),
            rgba(39, 48, 53, 0.95)
        );

    color: white;

    text-align: left;

    cursor: pointer;

    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        filter 0.18s ease;
}

.level-card.unlocked:hover {
    transform: translateY(-5px);

    border-color: var(--green-light);

    filter: brightness(1.1);
}

.level-card.locked {
    opacity: 0.52;

    cursor: not-allowed;

    filter: grayscale(0.35);
}

.level-number {
    display: block;

    margin-bottom: 10px;

    color: var(--green-light);

    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1px;

    text-transform: uppercase;
}

.level-card strong {
    display: block;

    margin-bottom: 8px;

    font-size: 19px;
}

.level-description {
    display: block;

    min-height: 54px;

    color: #ccd6da;

    font-size: 13px;
    line-height: 1.5;
}

.level-stars {
    display: block;

    margin-top: 13px;

    color: #ffd84d;

    font-size: 23px;
}

.level-best-time {
    display: block;

    margin-top: 8px;

    color: #aab8be;

    font-size: 12px;
}


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

#instructionsScreen {
    z-index: 20;

    background: rgba(4, 10, 14, 0.58);

    backdrop-filter: blur(6px);
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.instruction-card {
    padding: 18px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: rgba(255, 255, 255, 0.045);
}

.instruction-icon {
    margin-bottom: 10px;

    font-size: 30px;
}

.instruction-card h3 {
    margin-bottom: 7px;

    color: #ffffff;
}

.instruction-card p {
    color: #bfcdd3;

    font-size: 14px;
    line-height: 1.6;
}

.danger-card {
    border-color: rgba(255, 87, 54, 0.3);

    background: rgba(156, 49, 26, 0.12);
}


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

#settingsScreen {
    z-index: 20;

    background: rgba(4, 10, 14, 0.58);

    backdrop-filter: blur(6px);
}

.settings-panel {
    width: min(670px, 96vw);
}

.settings-list {
    display: grid;
    gap: 12px;

    margin-bottom: 20px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 17px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: rgba(255, 255, 255, 0.045);
}

.setting-row h3 {
    margin-bottom: 5px;
}

.setting-row p {
    color: #aebdc4;

    font-size: 13px;
}

.toggle-btn {
    min-width: 90px;

    padding: 10px 13px;

    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;

    background: #49535a;

    color: white;

    font-weight: 800;

    cursor: pointer;
}

.toggle-btn.active {
    background: var(--green-dark);
}

.setting-value {
    padding: 9px 12px;

    border-radius: 8px;

    background: rgba(255, 255, 255, 0.08);

    color: #dce5e8;

    font-weight: 700;
}

.danger-btn {
    width: 100%;

    padding: 13px 18px;

    border: 1px solid rgba(255, 115, 115, 0.35);
    border-radius: 9px;

    background: #7f2929;

    color: #ffffff;

    font-weight: 800;

    cursor: pointer;

    transition:
        filter 0.15s ease,
        transform 0.15s ease;
}

.danger-btn:hover {
    filter: brightness(1.15);

    transform: translateY(-2px);
}


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

#gameScreen {
    z-index: 12;

    display: block;

    padding: 0;

    overflow: hidden;

    background: #69abd0;
}


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

#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;

    z-index: 150;

    min-height: 72px;

    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;

    padding: 10px 14px;

    background:
        linear-gradient(
            180deg,
            rgba(10, 17, 21, 0.93),
            rgba(10, 17, 21, 0.68)
        );

    border-bottom: 1px solid rgba(255, 255, 255, 0.13);

    backdrop-filter: blur(7px);
}

.hud-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-group-right {
    justify-content: flex-end;
}

.hud-box,
.timer-box {
    min-width: 76px;

    padding: 8px 11px;

    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;

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

    text-align: center;
}

.hud-label {
    display: block;

    margin-bottom: 3px;

    color: #9fb0b8;

    font-size: 9px;
    font-weight: 900;
    letter-spacing: 1px;

    text-transform: uppercase;
}

.hud-box strong,
.timer-box strong {
    font-size: 15px;
}

.timer-box {
    min-width: 95px;

    border-color: rgba(255, 214, 77, 0.2);
}

#hudTimer {
    color: #ffdf54;

    font-size: 23px;
}

#hudStars {
    color: #ffd84a;

    letter-spacing: 1px;
}

.hud-action-btn {
    width: 42px;
    height: 42px;

    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 8px;

    background: #39454b;

    color: white;

    font-size: 17px;

    cursor: pointer;

    transition:
        filter 0.15s ease,
        transform 0.15s ease;
}

.hud-action-btn:hover {
    filter: brightness(1.2);
    transform: translateY(-2px);
}


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

#gameViewport {
    position: absolute;
    inset: 0;

    overflow: hidden;

    background:
        linear-gradient(
            180deg,
            #5ca7d2 0%,
            #8bd4ed 65%,
            #c9effa 100%
        );
}

#gameViewport::before {
    content: "";

    position: absolute;
    inset: 0;

    background:
        radial-gradient(
            circle at 13% 18%,
            rgba(255, 255, 255, 0.9) 0 32px,
            transparent 33px
        ),
        radial-gradient(
            circle at 18% 18%,
            rgba(255, 255, 255, 0.85) 0 42px,
            transparent 43px
        ),
        radial-gradient(
            circle at 75% 28%,
            rgba(255, 255, 255, 0.73) 0 29px,
            transparent 30px
        );

    opacity: 0.6;

    pointer-events: none;
}


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

#gameWorld {
    position: absolute;
    top: 0;
    left: 0;

    width: 7000px;
    height: 100%;

    transform: translate3d(0, 0, 0);

    will-change: transform;
}


/* =========================================================
   PLAYER — STEVE
   ========================================================= */

#player {
    position: absolute;

    left: 120px;
    bottom: 140px;

    width: 38px;
    height: 72px;

    z-index: 80;

    transform-origin: center bottom;

    will-change:
        left,
        bottom,
        transform;
}

.steve-head {
    position: absolute;
    top: 0;
    left: 5px;

    width: 28px;
    height: 27px;

    background: #c98b64;

    border: 2px solid rgba(0, 0, 0, 0.28);

    overflow: hidden;
}

.steve-hair {
    position: absolute;
    top: 0;
    left: 0;

    width: 100%;
    height: 8px;

    background: #38261a;
}

.steve-face {
    position: absolute;
    inset: 0;
}

.eye {
    position: absolute;
    top: 12px;

    width: 4px;
    height: 5px;

    background: #ffffff;

    border-bottom: 2px solid #4376a0;
}

.left-eye {
    left: 6px;
}

.right-eye {
    right: 6px;
}

.steve-body {
    position: absolute;
    top: 27px;
    left: 5px;

    width: 28px;
    height: 26px;

    background:
        linear-gradient(
            90deg,
            #16aeb4,
            #2ad2ce
        );

    border-left: 2px solid rgba(0, 0, 0, 0.2);
    border-right: 2px solid rgba(0, 0, 0, 0.2);
}

.steve-arm {
    position: absolute;
    top: 28px;

    width: 7px;
    height: 25px;

    background: #bd7f59;

    transform-origin: top center;
}

.left-arm {
    left: -1px;
}

.right-arm {
    right: -1px;
}

.steve-leg {
    position: absolute;
    top: 53px;

    width: 12px;
    height: 19px;

    background: #303f84;

    transform-origin: top center;
}

.left-leg {
    left: 6px;
}

.right-leg {
    right: 6px;
}


/* PLAYER ANIMATIONS */

#player.running .left-leg {
    animation: leftLegRun 0.22s infinite alternate;
}

#player.running .right-leg {
    animation: rightLegRun 0.22s infinite alternate;
}

#player.running .left-arm {
    animation: rightLegRun 0.22s infinite alternate;
}

#player.running .right-arm {
    animation: leftLegRun 0.22s infinite alternate;
}

@keyframes leftLegRun {
    from {
        transform: rotate(15deg);
    }

    to {
        transform: rotate(-15deg);
    }
}

@keyframes rightLegRun {
    from {
        transform: rotate(-15deg);
    }

    to {
        transform: rotate(15deg);
    }
}

#player.jumping {
    transform: scaleY(1.02);
}

#player.landing {
    animation: playerLand 0.16s ease;
}

@keyframes playerLand {
    0% {
        transform: scaleY(0.82) scaleX(1.12);
    }

    100% {
        transform: scaleY(1) scaleX(1);
    }
}


/* =========================================================
   PLATFORM BASE STYLES
   ========================================================= */

.platform {
    position: absolute;

    height: 32px;

    border: 2px solid rgba(0, 0, 0, 0.23);

    box-shadow:
        inset 0 -7px rgba(0, 0, 0, 0.13),
        0 5px 8px rgba(0, 0, 0, 0.2);
}


/* GRASS */

.platform.grass {
    background:
        linear-gradient(
            180deg,
            #6cc449 0 11px,
            #68492f 11px 100%
        );
}

.platform.grass::before {
    content: "";

    position: absolute;
    top: -4px;
    left: -2px;
    right: -2px;

    height: 7px;

    background: #82d45a;
}


/* STONE */

.platform.stone {
    background:
        repeating-linear-gradient(
            90deg,
            #7c8184 0 32px,
            #686d70 32px 64px
        );
}


/* ICE */

.platform.ice {
    background:
        linear-gradient(
            180deg,
            #cbf7ff,
            #70d1ef
        );

    border-color: rgba(255, 255, 255, 0.5);

    box-shadow:
        inset 0 -7px rgba(23, 123, 167, 0.15),
        0 5px 8px rgba(0, 0, 0, 0.18);
}


/* SOUL SAND */

.platform.soul {
    background:
        radial-gradient(
            circle at 25% 40%,
            #78695f 0 5px,
            transparent 6px
        ),
        radial-gradient(
            circle at 70% 55%,
            #50443f 0 6px,
            transparent 7px
        ),
        #66564c;
}


/* END BLOCK */

.platform.end {
    background:
        repeating-linear-gradient(
            45deg,
            #dac97b 0 18px,
            #c6b568 18px 36px
        );
}


/* MOVING PLATFORM */

.platform.moving {
    border-color: rgba(113, 255, 106, 0.35);

    box-shadow:
        0 0 18px rgba(81, 255, 101, 0.18),
        inset 0 -7px rgba(0, 0, 0, 0.13);
}


/* FALLING PLATFORM */

.platform.falling {
    border-color: rgba(255, 194, 79, 0.42);
}

.platform.falling.warning {
    animation: platformWarning 0.13s infinite alternate;
}

@keyframes platformWarning {
    from {
        transform: translateX(-2px);
    }

    to {
        transform: translateX(2px);
    }
}


/* BREAKING PLATFORM */

.platform.breaking {
    background:
        linear-gradient(
            120deg,
            transparent 42%,
            rgba(0, 0, 0, 0.45) 43%,
            rgba(0, 0, 0, 0.45) 47%,
            transparent 48%
        ),
        #765237;
}


/* =========================================================
   LAVA
   ========================================================= */

.lava {
    position: absolute;

    height: 50px;

    overflow: hidden;

    background:
        repeating-linear-gradient(
            90deg,
            #ff3615 0 28px,
            #ff7a13 28px 56px,
            #f9b31c 56px 82px
        );

    border-top: 5px solid #ffba1f;

    box-shadow:
        0 0 20px rgba(255, 75, 22, 0.8),
        0 0 45px rgba(255, 69, 13, 0.45);

    animation: lavaPulse 0.8s infinite alternate;
}

.lava::before {
    content: "";

    position: absolute;
    top: -3px;
    left: -40px;

    width: calc(100% + 80px);
    height: 14px;

    background:
        radial-gradient(
            circle at 15px 6px,
            #ffe154 0 7px,
            transparent 8px
        );

    background-size: 40px 15px;

    animation: lavaFlow 1.8s linear infinite;
}

@keyframes lavaPulse {
    from {
        filter: brightness(0.9);
    }

    to {
        filter: brightness(1.18);
    }
}

@keyframes lavaFlow {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(40px);
    }
}


/* =========================================================
   SPIKES
   ========================================================= */

.spike {
    position: absolute;

    width: 34px;
    height: 30px;

    background:
        linear-gradient(
            135deg,
            transparent 49%,
            #c3c9cc 50%
        );

    clip-path: polygon(
        50% 0,
        100% 100%,
        0 100%
    );

    filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.35));
}


/* =========================================================
   CHECKPOINT
   ========================================================= */

.checkpoint {
    position: absolute;

    width: 44px;
    height: 100px;

    z-index: 45;
}

.checkpoint-pole {
    position: absolute;
    left: 8px;
    bottom: 0;

    width: 6px;
    height: 95px;

    background: #b9c1c4;

    border: 1px solid rgba(0, 0, 0, 0.3);
}

.checkpoint-flag {
    position: absolute;
    top: 8px;
    left: 14px;

    width: 30px;
    height: 24px;

    background: #5f6970;

    clip-path: polygon(
        0 0,
        100% 18%,
        75% 53%,
        100% 85%,
        0 100%
    );
}

.checkpoint.active .checkpoint-flag {
    background: var(--green);

    box-shadow:
        0 0 12px rgba(86, 255, 82, 0.7);

    animation: checkpointWave 0.65s infinite alternate;
}

.checkpoint.active {
    filter:
        drop-shadow(0 0 8px rgba(105, 255, 94, 0.6));
}

@keyframes checkpointWave {
    from {
        transform: skewY(-3deg);
    }

    to {
        transform: skewY(4deg);
    }
}


/* =========================================================
   EMERALDS
   ========================================================= */

.collectible {
    position: absolute;

    z-index: 60;
}

.emerald {
    width: 24px;
    height: 34px;

    background:
        linear-gradient(
            135deg,
            #b7ffe8,
            #18d48b 42%,
            #08794f
        );

    clip-path: polygon(
        50% 0,
        100% 23%,
        82% 84%,
        50% 100%,
        18% 84%,
        0 23%
    );

    box-shadow:
        0 0 13px rgba(26, 255, 165, 0.8);

    animation:
        collectibleFloat 1s ease-in-out infinite alternate,
        collectibleGlow 0.8s infinite alternate;
}

@keyframes collectibleFloat {
    from {
        transform: translateY(-4px);
    }

    to {
        transform: translateY(5px);
    }
}

@keyframes collectibleGlow {
    from {
        filter: brightness(0.9);
    }

    to {
        filter: brightness(1.4);
    }
}


/* =========================================================
   DIAMOND
   ========================================================= */

.diamond {
    width: 28px;
    height: 31px;

    background:
        linear-gradient(
            135deg,
            #e6ffff,
            #66e8ff 35%,
            #00aac9
        );

    clip-path: polygon(
        20% 0,
        80% 0,
        100% 35%,
        50% 100%,
        0 35%
    );

    box-shadow:
        0 0 16px rgba(59, 231, 255, 0.9);

    animation:
        collectibleFloat 0.8s ease-in-out infinite alternate,
        diamondSpin 1.7s linear infinite;
}

@keyframes diamondSpin {
    0% {
        transform: rotateY(0deg);
    }

    100% {
        transform: rotateY(360deg);
    }
}


/* =========================================================
   POWER UPS
   ========================================================= */

.power-up {
    position: absolute;

    width: 35px;
    height: 35px;

    z-index: 60;

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

    border: 2px solid rgba(255, 255, 255, 0.45);
    border-radius: 8px;

    background:
        linear-gradient(
            180deg,
            #6357d5,
            #392b97
        );

    font-size: 21px;

    box-shadow:
        0 0 18px rgba(121, 94, 255, 0.6);

    animation: powerUpFloat 1s infinite alternate ease-in-out;
}

@keyframes powerUpFloat {
    from {
        transform: translateY(-4px) rotate(-2deg);
    }

    to {
        transform: translateY(5px) rotate(2deg);
    }
}


/* =========================================================
   FINISH PORTAL
   ========================================================= */

.finish-portal {
    position: absolute;

    width: 78px;
    height: 115px;

    z-index: 55;

    border: 11px solid #29262f;

    background:
        radial-gradient(
            circle at center,
            #e454ff,
            #8c22c5 48%,
            #3f1262 100%
        );

    box-shadow:
        0 0 18px rgba(207, 58, 255, 0.8),
        0 0 42px rgba(170, 42, 255, 0.42);

    animation: portalGlow 0.8s infinite alternate;
}

.finish-portal::after {
    content: "";

    position: absolute;
    inset: 7px;

    background:
        repeating-linear-gradient(
            45deg,
            rgba(255, 255, 255, 0.17) 0 7px,
            transparent 7px 14px
        );

    animation: portalMotion 1s linear infinite;
}

@keyframes portalGlow {
    from {
        filter: brightness(0.9);
    }

    to {
        filter: brightness(1.25);
    }
}

@keyframes portalMotion {
    from {
        transform: translateY(-8px);
    }

    to {
        transform: translateY(8px);
    }
}


/* =========================================================
   PARTICLES
   ========================================================= */

#particleContainer {
    position: absolute;
    inset: 0;

    pointer-events: none;

    z-index: 90;
}

.particle {
    position: absolute;

    width: 8px;
    height: 8px;

    background: #d2b17a;

    pointer-events: none;

    animation: particleFade 0.55s ease forwards;
}

@keyframes particleFade {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }

    100% {
        opacity: 0;
        transform:
            translate(
                var(--particle-x, 15px),
                var(--particle-y, -20px)
            )
            scale(0.3);
    }
}


/* =========================================================
   POWER-UP STATUS
   ========================================================= */

.power-up-status {
    position: absolute;
    top: 86px;
    left: 50%;

    z-index: 170;

    transform: translateX(-50%);

    min-width: 230px;

    display: flex;
    align-items: center;
    gap: 11px;

    padding: 10px 14px;

    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 9px;

    background: rgba(14, 21, 27, 0.88);

    box-shadow: var(--shadow);

    backdrop-filter: blur(7px);
}

#powerUpIcon {
    font-size: 27px;
}

#powerUpName {
    display: block;

    margin-bottom: 6px;

    font-size: 13px;
}

.power-up-timer {
    width: 160px;
    height: 7px;

    overflow: hidden;

    border-radius: 20px;

    background: rgba(255, 255, 255, 0.12);
}

.power-up-timer-bar {
    width: 100%;
    height: 100%;

    background:
        linear-gradient(
            90deg,
            #5fe756,
            #e5e550
        );

    transition: width 0.1s linear;
}


/* =========================================================
   LEVEL START MESSAGE
   ========================================================= */

.level-message {
    position: absolute;
    top: 50%;
    left: 50%;

    z-index: 200;

    transform: translate(-50%, -50%);

    min-width: 280px;

    padding: 18px 26px;

    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;

    background: rgba(12, 19, 23, 0.87);

    text-align: center;

    pointer-events: none;

    opacity: 0;

    backdrop-filter: blur(6px);
}

.level-message.show {
    animation: levelMessageAnimation 2s ease forwards;
}

.level-message strong {
    display: block;

    margin-bottom: 7px;

    color: var(--green-light);

    font-size: 29px;
}

.level-message span {
    color: #dce4e6;

    font-size: 15px;
}

@keyframes levelMessageAnimation {
    0% {
        opacity: 0;
        transform:
            translate(-50%, -35%)
            scale(0.9);
    }

    20%,
    75% {
        opacity: 1;

        transform:
            translate(-50%, -50%)
            scale(1);
    }

    100% {
        opacity: 0;

        transform:
            translate(-50%, -65%)
            scale(1.04);
    }
}


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

#mobileControls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 20px;

    z-index: 180;

    display: none;
    align-items: flex-end;
    justify-content: space-between;

    padding: 0 24px;

    pointer-events: none;
}

.mobile-direction-controls {
    display: flex;
    gap: 12px;
}

.mobile-control-btn {
    width: 68px;
    height: 68px;

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

    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;

    background: rgba(20, 31, 37, 0.78);

    color: #ffffff;

    font-size: 27px;
    font-weight: 900;

    box-shadow:
        0 5px 0 rgba(0, 0, 0, 0.42);

    backdrop-filter: blur(4px);

    pointer-events: auto;

    touch-action: none;
}

.mobile-control-btn:active {
    transform: translateY(4px);

    box-shadow:
        0 1px 0 rgba(0, 0, 0, 0.4);
}

.jump-control-btn {
    width: 82px;
    height: 82px;

    flex-direction: column;

    border-color: rgba(133, 255, 104, 0.33);

    background: rgba(43, 122, 43, 0.84);

    font-size: 26px;
}

.jump-control-btn span {
    margin-top: 2px;

    font-size: 10px;

    text-transform: uppercase;
}


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

.overlay-screen {
    position: fixed;
    inset: 0;

    z-index: 1000;

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

    padding: 20px;

    background: rgba(4, 8, 11, 0.72);

    backdrop-filter: blur(8px);
}

.overlay-card {
    width: min(480px, 95vw);
    max-height: 92vh;

    padding: 30px;

    overflow-y: auto;

    border: 2px solid rgba(255, 255, 255, 0.13);
    border-radius: 17px;

    background:
        linear-gradient(
            180deg,
            #26343b,
            #121c21
        );

    box-shadow: var(--shadow);

    text-align: center;

    animation: overlayAppear 0.3s ease;
}

@keyframes overlayAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.overlay-icon {
    margin-bottom: 14px;

    font-size: 48px;
}

.overlay-card h2 {
    margin-bottom: 10px;

    font-size: clamp(28px, 7vw, 42px);
}

.overlay-card > p:not(.panel-tag) {
    margin-bottom: 22px;

    color: #bbc9cf;

    line-height: 1.5;
}

.overlay-card .menu-btn {
    margin-top: 11px;
}


/* =========================================================
   LEVEL COMPLETE
   ========================================================= */

.complete-stars {
    margin: 16px 0 22px;

    color: #ffd950;

    font-size: 41px;

    letter-spacing: 4px;

    text-shadow:
        0 0 15px rgba(255, 216, 61, 0.35);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;

    margin-bottom: 16px;
}

.result-box {
    padding: 14px;

    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9px;

    background: rgba(0, 0, 0, 0.24);
}

.result-box span {
    display: block;

    margin-bottom: 5px;

    color: #9eafb7;

    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;

    text-transform: uppercase;
}

.result-box strong {
    color: #ffffff;

    font-size: 20px;
}

.large-result {
    margin: 20px 0;
}

.large-result strong {
    color: var(--green-light);

    font-size: 29px;
}

.overlay-actions {
    display: grid;
}


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

.game-over-card {
    border-color: rgba(255, 82, 82, 0.22);
}

.danger-text {
    color: #ff7777;
}


/* =========================================================
   VICTORY SCREEN
   ========================================================= */

.victory-card {
    width: min(580px, 95vw);

    border-color: rgba(217, 87, 255, 0.4);

    box-shadow:
        0 0 40px rgba(177, 56, 255, 0.18),
        var(--shadow);
}

.victory-portal {
    width: 82px;
    height: 82px;

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

    margin: 0 auto 18px;

    border: 10px solid #28202d;

    background:
        radial-gradient(
            circle,
            #f99aff,
            #a034d0 50%,
            #4d1468
        );

    box-shadow:
        0 0 28px rgba(206, 74, 255, 0.7);

    font-size: 38px;

    animation: portalGlow 0.7s infinite alternate;
}

.victory-message {
    color: #d8c7de !important;
}


/* =========================================================
   DAMAGE EFFECT
   ========================================================= */

.damage-flash {
    position: fixed;
    inset: 0;

    z-index: 3000;

    background: rgba(255, 35, 35, 0.35);

    opacity: 0;

    pointer-events: none;
}

.damage-flash.active {
    animation: damageFlash 0.35s ease;
}

@keyframes damageFlash {
    0% {
        opacity: 0;
    }

    30% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

body.screen-shake {
    animation: screenShake 0.25s linear;
}

@keyframes screenShake {
    0%,
    100% {
        transform: translate(0, 0);
    }

    20% {
        transform: translate(-5px, 2px);
    }

    40% {
        transform: translate(5px, -2px);
    }

    60% {
        transform: translate(-3px, -2px);
    }

    80% {
        transform: translate(3px, 2px);
    }
}


/* =========================================================
   GAME OBJECT HELPERS
   ========================================================= */

.world-label {
    position: absolute;

    z-index: 70;

    padding: 8px 11px;

    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;

    background: rgba(13, 20, 24, 0.78);

    color: #ffffff;

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

    white-space: nowrap;
}

.level-decoration {
    position: absolute;

    pointer-events: none;
}

.grass-particle {
    width: 6px;
    height: 13px;

    background: #57a844;
}

.stone-block {
    background:
        repeating-linear-gradient(
            90deg,
            #686d70 0 25px,
            #777d80 25px 50px
        );

    border: 2px solid rgba(0, 0, 0, 0.2);
}


/* =========================================================
   SPECIAL GAME STATES
   ========================================================= */

#gameWorld.slow-motion {
    filter: saturate(0.8);
}

#player.shielded::after {
    content: "";

    position: absolute;
    top: -9px;
    left: -10px;

    width: 58px;
    height: 89px;

    border: 3px solid rgba(88, 218, 255, 0.8);
    border-radius: 45%;

    box-shadow:
        0 0 17px rgba(91, 224, 255, 0.65),
        inset 0 0 17px rgba(91, 224, 255, 0.2);

    animation: shieldPulse 0.65s infinite alternate;

    pointer-events: none;
}

@keyframes shieldPulse {
    from {
        opacity: 0.65;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1.05);
    }
}


/* =========================================================
   RESPONSIVE — TABLET
   ========================================================= */

@media (max-width: 950px) {

    .level-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #hud {
        grid-template-columns: 1fr auto;
    }

    .hud-center {
        position: absolute;
        top: 82px;
        left: 50%;

        transform: translateX(-50%);
    }

    .hud-group-right {
        justify-content: flex-end;
    }

}


/* =========================================================
   RESPONSIVE — MOBILE
   ========================================================= */

@media (max-width: 700px) {

    body {
        overflow: hidden;
    }

    .screen {
        padding: 12px;
    }

    .menu-card {
        width: 100%;

        padding: 24px 18px;
    }

    .game-logo h1 {
        font-size: 38px;
    }

    .menu-description {
        margin-bottom: 18px;

        font-size: 14px;
    }

    .menu-btn {
        padding: 13px 16px;

        font-size: 15px;
    }

    .menu-stats {
        grid-template-columns: 1fr;

        margin-top: 16px;
    }


    /* PANELS */

    .panel {
        width: 100%;
        max-height: 94vh;

        padding: 18px;
    }

    .panel-header {
        margin-bottom: 17px;
    }

    .panel h2 {
        font-size: 27px;
    }


    /* LEVEL GRID */

    .level-grid {
        grid-template-columns: 1fr;
    }

    .level-card {
        min-height: auto;
    }

    .level-description {
        min-height: auto;
    }


    /* INSTRUCTIONS */

    .instructions-grid {
        grid-template-columns: 1fr;
    }


    /* SETTINGS */

    .setting-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .toggle-btn,
    .setting-value {
        width: 100%;

        text-align: center;
    }


    /* HUD */

    #hud {
        min-height: 58px;

        display: flex;
        align-items: center;
        justify-content: space-between;

        padding: 6px 8px;
    }

    .hud-group {
        gap: 4px;
    }

    .hud-box {
        min-width: 52px;

        padding: 5px 6px;
    }

    .hud-label {
        font-size: 7px;
    }

    .hud-box strong {
        font-size: 11px;
    }

    #hudLives {
        font-size: 11px;
    }

    .hud-center {
        position: absolute;
        top: 65px;
        left: 50%;

        transform: translateX(-50%);
    }

    .timer-box {
        min-width: 75px;

        padding: 5px 8px;
    }

    #hudTimer {
        font-size: 18px;
    }

    .hud-group-right .hud-box {
        display: none;
    }

    .hud-action-btn {
        width: 34px;
        height: 34px;

        border-radius: 6px;

        font-size: 14px;
    }


    /* POWER-UP */

    .power-up-status {
        top: 105px;

        min-width: 190px;

        padding: 8px 11px;
    }

    .power-up-timer {
        width: 120px;
    }


    /* MOBILE CONTROLS */

    #mobileControls {
        display: flex;

        bottom: 16px;

        padding: 0 15px;
    }

    .mobile-control-btn {
        width: 58px;
        height: 58px;

        border-radius: 14px;

        font-size: 22px;
    }

    .jump-control-btn {
        width: 72px;
        height: 72px;
    }


    /* OVERLAYS */

    .overlay-card {
        padding: 22px 17px;
    }

    .results-grid {
        grid-template-columns: 1fr 1fr;
    }

}


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

@media (max-width: 430px) {

    .game-logo h1 {
        font-size: 33px;
    }

    .logo-small {
        font-size: 10px;
        letter-spacing: 3px;
    }

    .menu-stat-box {
        padding: 11px;
    }

    .hud-group:first-child .hud-box:nth-child(3) {
        display: none;
    }

    .mobile-direction-controls {
        gap: 8px;
    }

    .mobile-control-btn {
        width: 54px;
        height: 54px;
    }

    .jump-control-btn {
        width: 68px;
        height: 68px;
    }

    .level-message {
        min-width: 230px;

        padding: 14px 18px;
    }

    .level-message strong {
        font-size: 23px;
    }

}


/* =========================================================
   TOUCH DEVICES
   ========================================================= */

@media (hover: none) and (pointer: coarse) {

    #mobileControls {
        display: flex;
    }

}


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

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

    #hud {
        min-height: 48px;

        padding: 4px 8px;
    }

    .hud-box {
        padding: 4px 6px;
    }

    .hud-center {
        top: 53px;
    }

    #mobileControls {
        bottom: 9px;
    }

    .mobile-control-btn {
        width: 49px;
        height: 49px;

        font-size: 19px;
    }

    .jump-control-btn {
        width: 60px;
        height: 60px;
    }

    .menu-card {
        transform: scale(0.9);
    }

}


/* =========================================================
   SCROLLBAR
   ========================================================= */

.panel::-webkit-scrollbar,
.overlay-card::-webkit-scrollbar {
    width: 8px;
}

.panel::-webkit-scrollbar-track,
.overlay-card::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.panel::-webkit-scrollbar-thumb,
.overlay-card::-webkit-scrollbar-thumb {
    background: #536168;

    border-radius: 10px;
}


/* =========================================================
   ACCESSIBILITY
   ========================================================= */

button:focus-visible {
    outline: 3px solid #a8ff8e;
    outline-offset: 3px;
}


/* =========================================================
   UTILITY ANIMATIONS
   ========================================================= */

.fade-in {
    animation: fadeIn 0.35s ease forwards;
}

.fade-out {
    animation: fadeOut 0.35s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}


/* =========================================================
   LEVEL COMPLETE CONFETTI
   ========================================================= */

.confetti {
    position: fixed;

    width: 9px;
    height: 15px;

    z-index: 2500;

    pointer-events: none;

    animation: confettiFall 2.5s linear forwards;
}

@keyframes confettiFall {
    from {
        transform:
            translateY(-30px)
            rotate(0deg);

        opacity: 1;
    }

    to {
        transform:
            translateY(110vh)
            rotate(720deg);

        opacity: 0;
    }
}


/* =========================================================
   END OF FILE
   ========================================================= */