body {
            margin: 0;
            overflow: hidden;
            font-family: 'Inter', sans-serif;
            background-color: #000000; /* Black background for space */
            color: #e0e0e0;
            -webkit-user-select: none;
            user-select: none;
        }

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

        #message-box {
            position: absolute;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.7);
            padding: 15px 25px;
            border-radius: 10px;
            color: #fff;
            font-size: 1.2em;
            text-align: center;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
            z-index: 100;
        }

        #overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 200;
            color: white;
            font-size: 2em;
            cursor: pointer;
        }

        #crosshair {
            position: absolute;
            top: 50%;
            left: 50%;
            width: 20px;
            height: 20px;
            margin-left: -10px;
            margin-top: -10px;
            border: 2px solid white;
            border-radius: 50%;
            background-color: rgba(255, 255, 255, 0.2);
            z-index: 100;
        }

        #mobile-controls {
            position: absolute;
            bottom: 20px;
            left: 0;
            width: 100%;
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
            padding: 0 20px;
            box-sizing: border-box;
            z-index: 150;
            pointer-events: none;
        }

        #joystick-area,
        #action-buttons-area {
            pointer-events: auto;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        #joystick-base {
            width: 100px;
            height: 100px;
            background-color: rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            position: relative;
            touch-action: none;
        }

        #joystick-thumb {
            width: 60px;
            height: 60px;
            background-color: rgba(255, 255, 255, 0.5);
            border-radius: 50%;
            position: absolute;
            touch-action: none;
        }

        .action-button {
            background-color: #007bff;
            color: white;
            padding: 15px 30px;
            border: none;
            border-radius: 10px;
            font-size: 1.2em;
            cursor: pointer;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
            transition: background-color 0.2s ease-in-out;
        }

        .action-button:active {
            background-color: #0056b3;
        }

        #inventory-bar {
            position: absolute;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            align-items: center;
            background-color: rgba(31, 41, 55, 0.8);
            padding: 8px;
            border-radius: 12px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            border: 1px solid rgba(75, 85, 99, 0.5);
            z-index: 10;
        }

        #inventory-slots {
            display: flex;
            gap: 8px;
            padding: 0 10px;
        }

        .inventory-slot {
            width: 50px;
            height: 50px;
            background-color: #374151;
            border: 2px solid #4B5563;
            border-radius: 8px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            font-weight: 600;
            color: white;
            cursor: pointer;
            transition: all 0.2s ease;
            position: relative;
            overflow: hidden;
            text-transform: capitalize;
        }

        .inventory-slot.selected {
            border-color: #facc15;
            transform: scale(1.1);
            box-shadow: 0 0 15px rgba(250, 204, 21, 0.5);
        }

        .slot-color-preview {
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0;
            left: 0;
        }

        .slot-info {
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            background-color: rgba(0, 0, 0, 0.6);
            text-align: center;
            padding: 4px 0;
            z-index: 1;
        }

        .slot-name {
            font-size: 0.65em;
        }

        .slot-count {
            font-size: 0.9em;
            font-weight: bold;
        }

        .material-switch {
            background-color: #4B5563;
            border: none;
            color: white;
            font-size: 24px;
            font-weight: bold;
            border-radius: 8px;
            width: 40px;
            height: 60px;
            cursor: pointer;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .material-switch:hover {
            background-color: #6B7280;
        }

        #game-info {
            display: none;
        }

        #health-bar-container {
            position: absolute;
            bottom: 20px;
            left: 20px;
            transform: none;
            width: 300px;
            height: 25px;
            background-color: rgba(31, 41, 55, 0.8);
            border-radius: 12px;
            border: 1px solid rgba(75, 85, 99, 0.5);
            overflow: hidden;
            z-index: 100;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            display: none;
            /* Initially hidden */
        }

        #health-bar-fill {
            width: 100%;
            height: 100%;
            background: linear-gradient(to right, #e11d48, #f43f5e);
            border-radius: 8px;
            transition: width 0.2s ease-out;
        }

        #health-bar-text {
            position: absolute;
            width: 100%;
            text-align: center;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: white;
            font-weight: 600;
            font-size: 0.9em;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
        }

        #damage-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(255, 0, 0, 0.5);
            z-index: 9999;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.5s ease-out;
        }
#map-view-info {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 10px;
    color: #fff;
    font-size: 1.1em;
    z-index: 100;
    display: none; /* Initially hidden */
}