body {
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent scrollbars */
    background-color: #000;
    font-family: sans-serif;
}

canvas:not(#radar-canvas) {
    display: block; /* Removes bottom margin/padding */
    width: 100vw !important;
    height: 100vh !important;
    position: absolute;
    top: 0;
    left: 0;
}

#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(0, 255, 0, 0.8);
    font-size: 64px;
    font-weight: 300;
    pointer-events: none;
    z-index: 100;
}

#hud-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    background-color: rgba(50, 60, 70, 0.8);
    color: white;
    font-family: monospace;
    font-size: 16px;
    padding: 15px;
    border-radius: 5px;
    pointer-events: none;
    z-index: 100;
}
#hud-health { color: #4CAF50; font-weight: bold; }
#hud-gold { color: #FFD700; font-weight: bold; }

#radar-canvas {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background-color: rgba(0, 20, 0, 0.7);
    border: 2px solid #555;
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
}

#ui-container {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 100;
}

#altitude-wrapper {
    width: 20px;
    height: 200px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid white;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

#altitude-fill {
    width: 100%;
    height: 0%;
    background-color: #4CAF50;
    position: absolute;
    bottom: 0;
    transition: height 0.1s;
}

#altitude-label {
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
}

/* Intro Screen */
#intro-screen {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 0;
    box-sizing: border-box;
    overflow-y: auto;
    z-index: 300;
}
.intro-modal {
    background-color: #222;
    color: white;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
}
.intro-modal h1 {
    margin-top: 0;
    font-size: 32px;
}
.intro-modal p {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 30px;
    color: #ccc;
}
#player-name-input {
    width: 80%;
    padding: 15px;
    font-size: 18px;
    border: none;
    border-radius: 5px;
    margin-bottom: 20px;
    background-color: white;
    color: black;
}
#join-btn {
    width: 85%;
    padding: 15px;
    font-size: 20px;
    font-weight: bold;
    color: white;
    background-color: #4CAF50;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}
#join-btn:hover {
    background-color: #45a049;
}

#game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    border: 2px solid red;
    z-index: 1000;
}

#game-over h1 {
    color: red;
    font-size: 48px;
    margin-top: 0;
}

#game-over button {
    padding: 10px 20px;
    font-size: 20px;
    cursor: pointer;
    background-color: #fff;
    border: none;
    border-radius: 5px;
    margin-top: 20px;
}

#game-over button:hover {
    background-color: #ccc;
}

/* Main Menu Styles */
#main-menu {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 10, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1000;
    color: white;
    overflow-y: auto;
    padding-top: 30px;
    padding-bottom: 50px;
}

#menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 80%;
    margin-bottom: 20px;
}

#menu-header h1 {
    font-size: 48px;
    margin: 0;
    color: #4CAF50;
}

#gold-display {
    font-size: 32px;
    font-weight: bold;
    color: #FFD700;
}

#plane-selection {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.plane-card {
    background-color: #222;
    border: 2px solid #555;
    border-radius: 10px;
    padding: 20px;
    width: 250px;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.plane-card:hover {
    transform: translateY(-10px);
    border-color: #fff;
}

.plane-card.selected {
    border-color: #4CAF50;
    box-shadow: 0 0 20px #4CAF50;
}

.plane-card.premium {
    border-color: #FFD700;
    background: linear-gradient(145deg, #222, #332200);
}

.plane-card.premium.selected {
    border-color: #FFD700;
    box-shadow: 0 0 30px #FFD700;
}

.plane-card h2 {
    margin-top: 0;
    text-align: center;
}

.plane-card ul {
    padding-left: 20px;
}

.sub-btn {
    width: 100%;
    padding: 10px;
    background-color: #FFD700;
    color: black;
    border: none;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
    margin-top: 10px;
}

#upgrades-and-vip {
    display: flex;
    gap: 40px;
    align-items: center;
    margin-bottom: 30px;
}

#upgrades {
    text-align: center;
}

#upgrades button {
    padding: 10px 20px;
    margin: 0 5px;
    font-size: 16px;
    cursor: pointer;
    background-color: #333;
    color: white;
    border: 1px solid #555;
    border-radius: 5px;
}

#upgrades button:hover {
    background-color: #555;
}

#vip-banner {
    background: linear-gradient(135deg, #111, #331133);
    border: 2px solid #ff00ff;
    padding: 15px 30px;
    border-radius: 10px;
    text-align: center;
}

#vip-banner h3 {
    margin-top: 0;
    color: #ff00ff;
}

.vip-btn {
    background-color: #ff00ff;
    color: white;
    font-weight: bold;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
}

#start-btn {
    padding: 15px 50px;
    font-size: 24px;
    font-weight: bold;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 50px;
}

#start-btn:hover {
    background-color: #45a049;
}

/* Modal Styles */
.modal-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background-color: #222;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    color: white;
    border: 2px solid #FFD700;
}

.modal-content button {
    margin: 10px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
}

/* Floating Gold Effect */
.floating-gold {
    position: absolute;
    color: #FFD700;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 5px #000;
    pointer-events: none;
    z-index: 500;
    animation: floatUp 1s ease-out forwards;
}

@keyframes floatUp {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, calc(-50% - 50px)) scale(1.5); opacity: 0; }
}


.ad-balloon-banner, .ad-sign-banner, .ad-notice-banner, .ad-planet-banner { position: absolute; background: rgba(255, 255, 255, 0.9); border: 4px solid #ffaa00; border-radius: 8px; padding: 10px; text-align: center; color: #333; font-weight: bold; pointer-events: none; display: none; box-shadow: 0 4px 15px rgba(0,0,0,0.5); z-index: 100; transform-origin: top left; text-transform: uppercase; letter-spacing: 1px; }
.ad-planet-banner { background: rgba(0, 0, 0, 0.8); border-color: #00ffff; color: #fff; box-shadow: 0 0 40px #00ffff; }

/* Responsive UI for Mobile */
@media (max-width: 800px) {
    #main-menu {
        justify-content: flex-start;
        overflow-y: auto;
        padding: 40px 0;
    }
    #menu-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    #menu-header h1 {
        font-size: 36px;
    }
    #plane-selection {
        flex-direction: column;
        gap: 15px;
    }
    .plane-card {
        width: 85vw;
        max-width: 320px;
        margin: 0 auto;
    }
    #upgrades-and-vip {
        flex-direction: column;
        gap: 20px;
        width: 85vw;
        max-width: 320px;
    }
    #upgrades {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    #upgrades button {
        width: 100%;
        padding: 15px;
        margin: 0;
    }
    #vip-banner {
        width: 100%;
        box-sizing: border-box;
    }
    .intro-modal {
        width: 90vw;
        padding: 20px;
        box-sizing: border-box;
    }
    .modal-content {
        width: 90vw;
        padding: 20px;
        box-sizing: border-box;
    }
    .intermission-upgrades {
        flex-direction: column !important;
        gap: 15px !important;
    }
    #hud-panel {
        font-size: 12px;
        padding: 8px;
        top: 10px;
        left: 10px;
    }
    #hud-panel div {
        margin-bottom: 2px !important;
        margin-top: 2px !important;
    }
    #hud-name { font-size: 14px !important; }
    #radar-canvas {
        width: 100px !important;
        height: 100px !important;
        bottom: 10px;
        right: 10px;
    }
    #tutorial-panel {
        font-size: 11px !important;
        padding: 8px !important;
        bottom: 10px !important;
        left: 10px !important;
        width: 180px;
    }
    #tutorial-panel h3 {
        font-size: 12px !important;
        margin-bottom: 5px !important;
    }
    #tutorial-panel ul {
        padding-left: 15px !important;
    }
    #mission-panel {
        font-size: 10px !important;
        padding: 6px !important;
        top: 10px !important;
        right: 10px !important;
    }
    #mission-title { font-size: 12px !important; }
    #mission-objective { font-size: 10px !important; }
}

/* Mobile Touch Controls */
#mobile-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let touches pass through the container itself */
    z-index: 900;
}

#mobile-controls .joystick-base, #mobile-controls .action-buttons {
    position: absolute;
    pointer-events: auto; /* Enable touch on buttons */
}

#mobile-controls #joystick-left, #mobile-controls #joystick-right {
    bottom: 30px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid rgba(0, 255, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    position: absolute;
    pointer-events: auto;
}
#mobile-controls #joystick-left {
    left: 40px;
}
#mobile-controls #joystick-right {
    right: 40px;
}

#mobile-controls .joystick-stick {
    position: absolute;
    top: 35px;
    left: 35px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
    transform: translate(0, 0);
}

#mobile-controls .action-buttons {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    pointer-events: auto;
}

.m-btn {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #00ffff;
    color: #00ffff;
    border-radius: 50%;
    font-weight: bold;
    font-size: 16px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.m-btn:active, .m-btn.active {
    background: rgba(0, 255, 255, 0.5);
    color: #fff;
    box-shadow: 0 0 20px #00ffff;
}

.m-throttle {
    width: 60px;
    height: 60px;
    border-radius: 10px;
}

.m-fire {
    width: 70px;
    height: 70px;
    border-color: #ff0000;
    color: #ff0000;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}
.m-fire:active, .m-fire.active {
    background: rgba(255, 0, 0, 0.5);
    color: #fff;
    box-shadow: 0 0 20px #ff0000;
}

.m-boost {
    width: 60px;
    height: 60px;
    border-color: #ff00ff;
    color: #ff00ff;
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
}
.m-boost:active, .m-boost.active {
    background: rgba(255, 0, 255, 0.5);
    color: #fff;
    box-shadow: 0 0 20px #ff00ff;
}
