/* Test version control */

/* Halo-themed Game Overlay */
.game-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7); /* Dark, semi-transparent background */
    border: 2px solid #00ff99; /* Thin green border */
    padding: 20px 40px;
    font-size: 28px;
    color: white; /* White text */
    text-align: center;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 200;
    /* Prevent text selection */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: manipulation;
}


.game-overlay:hover {
    box-shadow: 0 0 20px 5px rgba(0, 255, 153, 0.7); /* Halo-themed glow effect */
    transform: translate(-50%, -50%) scale(1.05); /* Slight scale on hover */
}

/* Game over screen */
.game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 300;
    display: none;
    /* Prevent text selection */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.game-over h1 {
    color: #ff0000;
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-over p {
    color: white;
    font-size: 24px;
    margin-bottom: 30px;
}

.restart-button {
    background-color: #00cc00;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    /* Prevent text selection */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: manipulation;
}

.restart-button:hover {
    background-color: #00ff00;
}

/* Joystick container styling */
.joystick-container {
    display: none;
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    touch-action: none;
    backdrop-filter: blur(8px); /* Retained from original for frosted glass effect */
    /* Prevent text selection */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Joystick handle styling */
.joystick-handle {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    top: 30px; /* Centers handle: (120 - 60) / 2 */
    left: 30px; /* Centers handle: (120 - 60) / 2 */
    pointer-events: none;
    transition: transform 0.05s ease-out;
}

/* Mobile control layout - hide by default */
#movementJoystickZone, #lookJoystickZone, #actionButtons {
    display: none;
    /* Prevent text selection */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: manipulation;
}

/* Media query for mobile devices (max-width: 768px) */
@media (max-width: 768px) {
    /* --- Joystick Zones --- */
    #movementJoystickZone,
    #lookJoystickZone {
        display: block; /* Ensure visibility */
        position: absolute; /* Needed for z-index and positioning */
        z-index: 210;      /* Place above canvas (assuming canvas z-index is lower) */
        width: 120px;      /* Define touchable area width */
        height: 120px;     /* Define touchable area height */
        bottom: 20px;      /* Common bottom positioning */
        /* Optional: Add a faint background for debugging */
        /* background-color: rgba(255, 255, 255, 0.1); */
    }

    /* Specific horizontal positioning */
    #movementJoystickZone {
        left: 20px;
    }

    #lookJoystickZone {
        right: 20px;
        left: auto; /* Override potential inherited left */
    }

    /* --- Action Buttons --- */
    #actionButtons {
        display: flex;
        flex-direction: column; /* Stack vertically */
        flex-wrap: nowrap;
        position: absolute;    /* Position relative to screen */
        z-index: 210;          /* Same layer as joysticks or higher if needed */
        right: 20px;           /* Position on the right */
        bottom: 180px;         /* Position higher above the look joystick */
        gap: 20px;             /* Increase space between buttons */
    }

    /* Individual icon button styling */
    .icon-button {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.5); /* Darker background for better visibility */
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer; /* Still useful for dev tools */
        transition: background 0.2s ease;
        font-size: 24px;
        color: #fff;
        border: none; /* Remove default button border */
        padding: 0; /* Remove default button padding */
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px); /* For Safari */
        touch-action: manipulation; /* Prevent zooming on double tap */
        /* Strong text selection prevention */
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        -webkit-touch-callout: none;
        pointer-events: auto;
    }

    /* Hover state (for desktop testing) */
    .icon-button:hover {
        background: rgba(0, 0, 0, 0.7);
    }

    /* Active state (for touch feedback) */
    .icon-button:active {
        background: rgba(0, 0, 0, 0.8);
        transform: scale(1.1); /* Add a slight scale effect for feedback */
    }

    /* Emoji icons via pseudo-elements */
    .icon-button.reload::before { content: '🔄'; }
    .icon-button.jump::before { content: '⬆️'; }
    .icon-button.grenade::before { content: '💣'; }
    .icon-button.switch::before { content: '🔀'; }
    
    /* Font size adjustments */
    .game-overlay {
        font-size: 22px;
        padding: 16px 32px;
    }
    
    .game-over h1 {
        font-size: 36px;
    }
    
    .game-over p {
        font-size: 18px;
    }
    
    .restart-button {
        font-size: 16px;
        padding: 8px 16px;
    }
}

/* Separate Media Query for HUD Repositioning */
@media (max-width: 768px) {
    /* Radar container */
    .radar-container {
        position: absolute; /* Ensure positioning context */
        left: auto;
        right: 10px;
        bottom: auto;
        top: 10px;
        width: 90px; /* Smaller on mobile */
        height: 90px; /* Smaller on mobile */
        z-index: 150; /* Ensure radar is above other elements if needed */
    }

    /* Health bar */
    .health-container {
        position: absolute;
        bottom: 22px;       /* Same bottom offset as joystick zones */
        left: 50%;
        transform: translateX(-50%);
        /* Responsive width: minimum 100px, ideal 20vw, maximum 150px */
        width: clamp(100px, 20vw, 150px);
        /* Responsive height: minimum 15px, ideal 3vw, maximum 20px */
        height: clamp(15px, 3vw, 20px);
        z-index: 150;
      }
      

    /* Support for the HUD container in hud.css */
    .hud-container-left {
      top: 10px;
      left: 10px;
      gap: 10px; /* Smaller gap for mobile */
    }

    /* For non-container elements, still show pick-up message */
        .weapon-pickup-message {
            font-size: 16px;
            display: inline-block !important;
            width: auto !important;
            max-width: 300px !important;
            text-align: center;
            top: 460px !important;
            bottom: auto !important;  /* This prevents the element from stretching */
            left: 50% !important;
            transform: translateX(-50%) !important;
            box-sizing: border-box;
        }
      

    /* Hide desktop controls hint */
    .controls-hint {
      display: none !important; /* Use !important cautiously, but ok for hiding desktop hints */
    }
}

/* X Icon Styling */
.x-icon {
    position: fixed;
    bottom: -1px;
    left: -1px;
    padding: 7px;
    background: linear-gradient(135deg, rgba(0, 100, 50, 0.2), rgba(0, 50, 25, 0.2)); /* Matches grenade counter border */
    border-bottom: none; /* Remove bottom border to align with screen edge */
    border-left: none; /* Remove left border to align with screen edge */
    border-top-right-radius: 8px;
    backdrop-filter: blur(1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
  }
  
  /* X Logo Styling - Option 1: White */
  /* .x-icon svg {
    fill: #e0e0e0; /* Matches HUD text color */
    /* width: 24px;
    height: 24px; */
  /* } */ 
  
  /* X Logo Styling - Option 2: Black (comment out Option 1 if using this) */
  .x-icon svg {
    fill: #000000;
    width: 24px;
    height: 24px;
  } 
  
  /* Hover Effect */
  .x-icon:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, rgba(0, 100, 50, 0.3), rgba(0, 50, 25, 0.3)); /* Slightly brighter on hover */
  }