body {
    margin: 0;
    overflow: hidden;
    font-family: Arial, sans-serif;
    background-color: #000;
}

#loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 24px;
    z-index: 100;
}

#loading-text {
    /* Fun text effect */
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

#game-canvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;
    z-index: 101;
}

#game-over-text {
    font-size: 72px;
    font-weight: bold;
    color: #ff4444;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
    margin-bottom: 20px;
}

#restart-btn {
    padding: 15px 30px;
    font-size: 24px;
    color: white;
    background-color: #4CAF50;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

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

#info {
    position: absolute;
    top: 10px;
    left: 10px;
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
    z-index: 5;
}

#speed-info {
    margin-top: 5px;
}

#altitude-info {
    margin-top: 5px;
}

#mobile-controls {
    display: none; /* Hidden by default, shown via JS on touch devices */
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30vh;
    pointer-events: none; /* Area is passthrough, children have pointer-events */
}

/* Show controls only on touch devices */
.touch-enabled #mobile-controls {
    display: flex;
}

.touch-enabled #info .controls-info {
    display: none; /* Hide desktop instructions on mobile */
}

#joystick-area {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 120px;
    height: 120px;
    pointer-events: auto;
}

#joystick-base {
    position: relative;
    width: 120px;
    height: 120px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

#joystick-stick {
    position: absolute;
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    left: 30px;
    top: 30px;
    transform: translate(0px, 0px);
    transition: transform 0.1s ease-out;
}

#throttle-area {
    position: absolute;
    bottom: 20px;
    right: 30px;
    width: 60px;
    height: 150px;
    pointer-events: auto;
}

#throttle-track {
    position: relative;
    width: 20px;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    margin-left: 20px;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

#throttle-handle {
    position: absolute;
    width: 40px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 5px;
    left: -10px;
    bottom: 0%; /* 0-100% controlled by JS */
    transform: translateY(50%);
}

#fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.5);
    border: none;
    color: white;
    font-size: 20px;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}
#fullscreen-btn:hover {
    background: rgba(255,255,255,0.2);
}

#pc-lockon-btn {
    position: absolute;
    top: 10px;
    right: 50px;
    background: rgba(0, 150, 255, 0.7);
    border: none;
    color: white;
    font-size: 20px;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
    display: none; /* Hidden by default, shown on desktop */
}

#pc-lockon-btn:hover {
    background: rgba(0, 150, 255, 0.9);
}

/* Show PC lock-on button on non-touch devices */
body:not(.touch-enabled) #pc-lockon-btn {
    display: block;
}

#lockon-indicator {
    position: absolute;
    width: 50px;
    height: 50px;
    border: 2px solid #ff4444;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    display: none;
    pointer-events: none;
    z-index: 4;
    box-shadow: 0 0 10px #ff4444;
}

#underwater-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(ellipse at center, rgba(30, 100, 120, 0.2) 0%, rgba(10, 40, 60, 0.9) 100%);
    display: none; /* Hidden by default */
    pointer-events: none;
    z-index: 3; /* Below UI but above canvas visuals */
    transition: opacity 0.5s ease-in-out;
    opacity: 0;
}

/* Add combat UI styles */
#combat-info {
    position: absolute;
    top: 50px;
    left: 10px;
    color: white;
    background: rgba(0,0,0,0.7);
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
}

#shoot-btn {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255,0,0,0.8);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    pointer-events: auto;
    z-index: 10;
}

#buff-indicators {
    position: absolute;
    bottom: 20px;
    left: 10px;
    color: white;
    background: rgba(0,0,0,0.5);
    padding: 8px;
    border-radius: 5px;
    font-size: 14px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.buff-indicator {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.damage-buff {
    background-color: rgba(255, 102, 0, 0.3);
    border: 1px solid #ff6600;
    color: #ffcfb3;
    text-shadow: 0 0 5px #ff6600;
}

.speed-buff {
    background-color: rgba(0, 102, 255, 0.3);
    border: 1px solid #0066ff;
    color: #b3d1ff;
    text-shadow: 0 0 5px #0066ff;
}

#quality-selector {
    margin-top: 20px;
    margin-bottom: 10px;
}

#quality-selector button {
    padding: 10px 20px;
    font-size: 1em;
    margin: 0 10px;
    border: 2px solid white;
    background-color: transparent;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

#quality-selector button.active {
    background-color: white;
    color: black;
    font-weight: bold;
}

#quality-selector button:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.2);
}

#info-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 102;
}

#info-overlay h1 {
    font-size: 4em;
    margin: 0;
    text-shadow: 2px 2px 8px #000;
}

#info-overlay p {
    font-size: 1.2em;
    margin-top: 10px;
    color: #cccccc;
    display: none; /* Hidden by default */
}

#start-btn {
    margin-top: 25px;
    padding: 15px 40px;
    font-size: 1.5em;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    animation: pulse 2s infinite;
}

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