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

body {
    background-color: #02021a;
    font-family: 'Orbitron', sans-serif;
    color: white;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: fixed;
    margin: 0;
}

.top-nav {
    width: 100%;
    background-color: rgba(44, 62, 80, 0.8);
    padding: 10px 0;
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
    z-index: 100;
}

.top-nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background-color 0.2s, transform 0.1s;
}

.top-nav a:hover {
    background-color: #34495e;
}

.top-nav a.active {
    background-color: #ff4e50;
    box-shadow: 0 0 10px rgba(255, 78, 80, 0.5);
}

#stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: radial-gradient(ellipse at bottom, #1B2735 0%, #090A0F 100%);
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0.5;
    animation: twinkle var(--duration) infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.3); }
}

#game-title {
    position: absolute;
    top: 55px; /* Pushed down to clear top-nav */
    z-index: 30;
    font-size: 1.5rem;
    color: #0fa;
    text-shadow: 0 0 10px #0fa;
    letter-spacing: 2px;
}

#game-ui {
    position: absolute;
    top: 90px; /* Pushed down */
    left: 10px;
    right: 10px;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
}

#score-board {
    font-size: 0.9rem;
    color: #0fa;
    text-shadow: 0 0 5px #0fa;
}

#health-bar-container {
    width: 80px;
    height: 12px;
    background-color: #333;
    border: 1.5px solid white;
    border-radius: 4px;
    overflow: hidden;
}

#health-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ff4e50, #f9d423);
    transition: width 0.3s ease;
}

#game-canvas {
    width: 100%;
    height: calc(100vh - 220px); /* Adjusted height */
    margin-top: 90px; /* Pushed down */
    z-index: 10;
    display: block;
    background: transparent;
}

#control-panel {
    width: 100%;
    height: 180px;
    z-index: 20;
    background: rgba(0, 0, 0, 0.6);
    border-top: 2px solid #348aa7;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 20px;
}

#joystick-area {
    width: 120px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#joystick-base {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #348aa7;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 15px rgba(52, 138, 167, 0.5);
    touch-action: none;
}

#joystick-stick {
    width: 40px;
    height: 40px;
    background: #0fa;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px #0fa;
}

#fire-btn {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, #ff4e50, #ff0000);
    border: none;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    box-shadow: 0 0 20px rgba(255, 78, 80, 0.5);
    cursor: pointer;
    transition: transform 0.1s;
    touch-action: none;
}

#fire-btn:active {
    transform: scale(0.9);
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none !important;
}

#message-box {
    text-align: center;
    background: #02021a;
    padding: 30px;
    border-radius: 20px;
    border: 2px solid #0fa;
    box-shadow: 0 0 25px #0fa;
    width: 85%;
    max-width: 320px;
}

#status-text {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #0fa;
    text-shadow: 0 0 10px #0fa;
}

#final-score-p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

#start-btn {
    padding: 12px 24px;
    font-size: 1.1rem;
    background: #0fa;
    color: #02021a;
    border: none;
    border-radius: 10px;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 255, 170, 0.3);
}

#start-btn:hover {
    background: #fff;
    box-shadow: 0 0 20px #fff;
}