/* UNKNOWN WORLD - Game Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    touch-action: none;
}

#game-container {
    width: 100%;
    height: 100%;
    position: relative;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* UI Overlay */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

/* Loading Screen */
#loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    z-index: 200;
    color: #ffffff;
}

.loader {
    width: 60px;
    height: 60px;
    border: 4px solid #2a2a4a;
    border-top: 4px solid #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading-screen h1 {
    font-size: 2.5rem;
    letter-spacing: 8px;
    margin-bottom: 8px;
    color: #00d4ff;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

#loading-progress {
    font-size: 1rem;
    color: #aaaaaa;
    letter-spacing: 2px;
}

/* HUD */
#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    color: #ffffff;
    pointer-events: auto;
}

#fps-counter {
    font-size: 0.9rem;
    color: #00ff88;
    margin-bottom: 16px;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

#controls-hint {
    font-size: 0.85rem;
    color: #cccccc;
    line-height: 1.6;
    max-width: 300px;
}

#controls-hint div {
    margin-bottom: 4px;
}

/* Mobile Controls */
#mobile-controls {
    position: absolute;
    bottom: 30px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 30px;
    pointer-events: auto;
}

.d-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.direction-row {
    display: flex;
    gap: 10px;
}

.direction-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.direction-btn:active {
    background: rgba(0, 212, 255, 0.3);
    border-color: #00d4ff;
}

.action-btns {
    display: flex;
    gap: 20px;
}

.action-btn {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:active {
    background: rgba(0, 212, 255, 0.3);
    border-color: #00d4ff;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #hud {
        top: 10px;
        left: 10px;
    }
    
    #controls-hint {
        display: none;
    }
    
    #mobile-controls {
        display: flex;
        bottom: max(16px, env(safe-area-inset-bottom));
        padding: 0 12px;
        align-items: flex-end;
        gap: 8px;
    }
}

@media (min-width: 769px) {
    #mobile-controls {
        display: none;
    }
}

@media (max-width: 600px) {
    #main-menu-overlay {
        overflow-y: auto;
        padding: 18px 0;
    }

    #main-menu-overlay h1 {
        font-size: clamp(2rem, 8vw, 3.2rem) !important;
        letter-spacing: clamp(3px, 2.5vw, 10px) !important;
    }

    .d-pad {
        gap: 4px;
    }

    .direction-row {
        gap: 4px;
    }

    .direction-btn {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    .action-btns {
        gap: 6px;
    }

    .action-btn,
    .vehicle-btn {
        width: 52px;
        height: 52px;
        font-size: 0.72rem;
    }

    #mobile-vehicle-controls {
        position: absolute;
        right: 12px;
        bottom: 116px;
    }

    #minimap-container {
        width: 132px !important;
        height: 132px !important;
        right: 12px !important;
        bottom: 12px !important;
    }

    #minimap-container canvas {
        width: 100%;
        height: 100%;
    }

    #quick-toolbar {
        max-width: calc(100vw - 20px);
        top: 56px !important;
        gap: 4px !important;
    }

    #quick-toolbar button {
        padding: 3px 6px !important;
        font-size: 0.65rem !important;
    }

    #region-badge {
        top: 8px !important;
        max-width: calc(100vw - 24px);
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.75rem !important;
        padding: 5px 10px !important;
    }

    #fps-counter,
    #perf-overlay {
        display: none;
    }
}

/* Vehicle UI Styles */
#speedometer {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 12px 16px;
    border-radius: 8px;
    border: 2px solid #00d4ff;
    color: #ffffff;
    pointer-events: none;
    min-width: 80px;
    text-align: center;
}

#exit-hint {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #ffaa00;
    pointer-events: none;
}

.vehicle-btn {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vehicle-btn:active {
    background: rgba(0, 212, 255, 0.3);
    border-color: #00d4ff;
}

.vehicle-d-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.vehicle-direction-row {
    display: flex;
    gap: 10px;
}