* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #0a0a0a;
    font-family: 'Poppins', sans-serif;
    overflow: hidden;
    touch-action: none;
}

/* Lazy Loader Styles */
#game-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5000;
    transition: opacity 0.5s ease-out;
}

.loader-content {
    text-align: center;
}

.loader-animation {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 30px;
}

.loader-kid {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    z-index: 2;
}

.loader-maulavi {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    margin-top: -30px;
    margin-left: -30px;
}

.m1 { animation: spin-around-1 2s linear infinite; }
.m2 { animation: spin-around-2 2s linear infinite; }
.m3 { animation: spin-around-3 2s linear infinite; }
.m4 { animation: spin-around-4 2s linear infinite; }
.m5 { animation: spin-around-5 2s linear infinite; }
.m6 { animation: spin-around-6 2s linear infinite; }
.m7 { animation: spin-around-7 2s linear infinite; }
.m8 { animation: spin-around-8 2s linear infinite; }

@keyframes spin-around-1 { 0% { transform: rotate(0deg) translateX(75px) rotate(0deg); } 100% { transform: rotate(360deg) translateX(75px) rotate(-360deg); } }
@keyframes spin-around-2 { 0% { transform: rotate(45deg) translateX(75px) rotate(-45deg); } 100% { transform: rotate(405deg) translateX(75px) rotate(-405deg); } }
@keyframes spin-around-3 { 0% { transform: rotate(90deg) translateX(75px) rotate(-90deg); } 100% { transform: rotate(450deg) translateX(75px) rotate(-450deg); } }
@keyframes spin-around-4 { 0% { transform: rotate(135deg) translateX(75px) rotate(-135deg); } 100% { transform: rotate(495deg) translateX(75px) rotate(-495deg); } }
@keyframes spin-around-5 { 0% { transform: rotate(180deg) translateX(75px) rotate(-180deg); } 100% { transform: rotate(540deg) translateX(75px) rotate(-540deg); } }
@keyframes spin-around-6 { 0% { transform: rotate(225deg) translateX(75px) rotate(-225deg); } 100% { transform: rotate(585deg) translateX(75px) rotate(-585deg); } }
@keyframes spin-around-7 { 0% { transform: rotate(270deg) translateX(75px) rotate(-270deg); } 100% { transform: rotate(630deg) translateX(75px) rotate(-630deg); } }
@keyframes spin-around-8 { 0% { transform: rotate(315deg) translateX(75px) rotate(-315deg); } 100% { transform: rotate(675deg) translateX(75px) rotate(-675deg); } }

.loader-text {
    color: #00ff00;
    font-family: 'Bungee', cursive;
    font-size: 1.2rem;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

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

#game-canvas {
    background: #1a1a1a;
    display: block;
    box-shadow: 0 0 50px rgba(0, 255, 0, 0.1);
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    pointer-events: none;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 10;
}

#status-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-box {
    background: rgba(0, 0, 0, 0.8);
    color: #00ff00;
    padding: 10px 20px;
    border-radius: 5px;
    font-family: 'Bungee', cursive;
    font-size: 1rem;
    border: 1px solid #00ff00;
    text-shadow: 0 0 5px #00ff00;
}

.arcade-link {
    background: rgba(0, 255, 0, 0.2);
    color: #00ff00;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
    transition: all 0.2s;
    font-family: 'Bungee', cursive;
    font-size: 0.9rem;
    border: 1px solid #00ff00;
}

.arcade-link:hover {
    background: rgba(0, 255, 0, 0.4);
    box-shadow: 0 0 15px #00ff00;
}

.arcade-link svg {
    width: 20px;
    height: 20px;
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 4000; /* Higher than UI but lower than loader */
}

.modal {
    background: #111;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 90%;
    width: 450px;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.2);
    border: 2px solid #00ff00;
    color: #00ff00;
    max-height: 90vh;
    overflow-y: auto;
}

.modal h1 {
    font-family: 'Bungee', cursive;
    font-size: 2.5rem;
    margin-bottom: 20px;
    line-height: 1.2;
    letter-spacing: 2px;
}

.modal p {
    color: #00cc00;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.instructions {
    background: rgba(0, 255, 0, 0.05);
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 30px;
    text-align: left;
    border: 1px solid rgba(0, 255, 0, 0.2);
}

.instructions p {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #00aa00;
}

.btn {
    background: #00ff00;
    color: #000;
    border: none;
    padding: 15px 40px;
    font-family: 'Bungee', cursive;
    font-size: 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 10px #00ff00;
}

.btn:hover {
    background: #00cc00;
    box-shadow: 0 0 20px #00ff00;
    transform: scale(1.05);
}

.hidden {
    display: none !important;
}

/* Mobile Controls Overlay */
#mobile-controls {
    position: absolute;
    bottom: 30px;
    left: 30px;
    display: none; /* Hidden by default on all screens */
    grid-template-areas: 
        ". up ."
        "left . right"
        ". down .";
    gap: 10px;
    z-index: 2000;
    pointer-events: auto;
}

.ctrl-btn {
    width: 80px;
    height: 80px;
    background: rgba(0, 255, 0, 0.3);
    border: 3px solid #00ff00;
    border-radius: 50%;
    color: #00ff00;
    font-size: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.1s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.2);
}

#ctrl-up { grid-area: up; }
#ctrl-down { grid-area: down; }
#ctrl-left { grid-area: left; }
#ctrl-right { grid-area: right; }

.ctrl-btn.active {
    background: #00ff00 !important;
    color: #000 !important;
    transform: scale(0.9);
    box-shadow: 0 0 25px #00ff00;
}

/* Only show on mobile when game is active */
@media (max-width: 1024px) {
    #mobile-controls.visible {
        display: grid !important;
    }
}

@media (max-width: 1024px) {
    body {
        overflow-y: auto;
        height: auto;
    }

    #game-container {
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 80px;
        height: auto;
        min-height: 100vh;
        overflow-y: visible;
    }

    #ui-layer {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 3000;
        padding: 10px 15px;
        background: rgba(10, 10, 10, 0.9);
        backdrop-filter: blur(5px);
        align-items: center;
        border-bottom: 1px solid #222;
    }

    #game-canvas {
        margin-top: 0;
        margin-bottom: 20px;
        border: 1px solid #333;
        box-shadow: 0 0 20px rgba(0,0,0,0.5);
        max-width: 95vw;
        height: auto;
    }

    #status-container {
        flex-direction: row;
        gap: 10px;
    }

    .status-box {
        font-size: 0.8rem;
        padding: 8px 12px;
        margin: 0;
    }

    .status-box .label {
        display: none;
    }

    .status-box:nth-child(2)::before {
        content: "Lv. ";
    }

    .arcade-link {
        padding: 10px;
    }

    .arcade-link .link-text {
        display: none;
    }

    .arcade-link svg {
        margin: 0;
        width: 28px;
        height: 28px;
    }

    #mobile-controls.visible {
        display: grid !important;
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        margin: 30px auto;
        gap: 15px;
        padding-bottom: 50px; /* Space at the bottom */
    }

    .ctrl-btn {
        width: 65px;
        height: 65px;
        font-size: 24px;
        background: rgba(0, 255, 0, 0.1);
        border-width: 2px;
    }

    .modal {
        padding: 20px;
    }

    .modal h1 {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }

    .modal p {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }

    .instructions {
        padding: 15px;
        margin-bottom: 20px;
    }

    .instructions p {
        font-size: 0.8rem;
        margin-bottom: 5px;
    }

    .btn {
        padding: 10px 30px;
        font-size: 1.2rem;
    }
}
