* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #000;
    width: 100%;
    height: 100%;
}

#gameCanvas {
    display: block;
    cursor: crosshair;
    position: absolute;
    top: 0;
    left: 0;
}

#gameCanvas.dragging {
    cursor: grabbing;
}

/* UI Buttons - Will be dynamically scaled to counter zoom */
.ui-btn {
    position: fixed;
    width: 50px;
    height: 50px;
    background-color: rgba(40, 40, 40, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, border-color 0.2s;
    z-index: 1000;
    will-change: transform;
}

.ui-btn:hover {
    background-color: rgba(60, 60, 60, 0.9);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Button positions managed by UIManager */
#formationEditorWindow {
    /* Position managed by UIManager */
}

#formationCanvas {
    image-rendering: crisp-edges;
}

.ui-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-family: Arial, sans-serif;
}

/* Group Tabs Container */
.group-tabs-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background-color: rgba(20, 20, 20, 0.95);
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 5px;
    z-index: 999;
    overflow-x: auto;
    transform-origin: top left;
    will-change: transform;
}

.group-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: rgba(50, 50, 50, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
}

.group-tab:hover {
    background-color: rgba(70, 70, 70, 0.9);
}

.group-tab-name {
    user-select: none;
    pointer-events: none;
}

.group-tab-delete {
    color: rgb(255, 0, 0);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}

.group-tab.enemy .group-tab-name {
    color: rgb(255, 80, 80);
}

.group-tab-delete:hover {
    color: rgb(255, 100, 100);
}

/* Dialogue Windows - Positions managed by UIManager */
.dialogue-window {
    position: fixed;
    width: 300px;
    background-color: rgba(30, 30, 30, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    font-family: Arial, sans-serif;
    will-change: transform;
    backface-visibility: hidden;
}

.dialogue-window.hidden {
    display: none;
}

/* Window positions managed by UIManager */

.dialogue-header {
    background-color: rgba(50, 50, 50, 0.9);
    padding: 12px 15px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
}

.dialogue-header span {
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.close-btn-red {
    background: none;
    border: none;
    color: rgb(255, 0, 0);
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s;
}

.close-btn-red:hover {
    color: rgb(255, 100, 100);
    transform: scale(1.1);
}

.dialogue-content {
    padding: 20px;
}

.menu-option {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    background-color: rgba(70, 70, 70, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.menu-option:hover {
    background-color: rgba(90, 90, 90, 0.8);
    border-color: rgba(255, 255, 255, 0.4);
}

.menu-option:last-child {
    margin-bottom: 0;
}

/* Equipment Selector Styles */
.equipment-selector {
    margin-bottom: 15px;
}

.equipment-selector label {
    display: block;
    color: white;
    font-size: 13px;
    margin-bottom: 5px;
    font-weight: bold;
}

.equipment-dropdown {
    width: 100%;
    padding: 8px;
    background-color: rgba(50, 50, 50, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: white;
    font-size: 13px;
    cursor: pointer;
}

.equipment-dropdown:hover {
    background-color: rgba(60, 60, 60, 0.9);
    border-color: rgba(255, 255, 255, 0.5);
}

.equipment-dropdown option {
    background-color: rgb(40, 40, 40);
    color: white;
}

.spawn-btn {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    background-color: rgba(50, 150, 50, 0.8);
    border: 1px solid rgba(100, 255, 100, 0.3);
    border-radius: 6px;
    color: white;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.spawn-btn:hover {
    background-color: rgba(70, 170, 70, 0.9);
    border-color: rgba(100, 255, 100, 0.5);
}

/* Unit Info Window - Position managed by UIManager */
.unit-info-window {
    position: fixed;
    width: 280px;
    background-color: rgba(30, 30, 30, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    font-family: Arial, sans-serif;
    will-change: transform;
    backface-visibility: hidden;
}

.unit-info-window.hidden {
    display: none;
}

.unit-info-header {
    background-color: rgba(50, 50, 50, 0.9);
    padding: 10px 15px;
    border-radius: 8px 8px 0 0;
    user-select: none;
}

.unit-info-header span {
    color: white;
    font-weight: bold;
    font-size: 15px;
}

.unit-info-content {
    padding: 15px;
}

.info-section {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
}

.info-section:last-child {
    margin-bottom: 0;
}

.info-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

.info-value {
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Object Info Window - Position managed by UIManager */
.object-info-window {
    position: fixed;
    width: 220px;
    background-color: rgba(30, 30, 30, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    font-family: Arial, sans-serif;
    will-change: transform;
    backface-visibility: hidden;
}

.object-info-window.hidden {
    display: none;
}

.object-info-header {
    background-color: rgba(50, 50, 50, 0.9);
    padding: 10px 15px;
    border-radius: 8px 8px 0 0;
    user-select: none;
}

.object-info-header span {
    color: white;
    font-weight: bold;
    font-size: 15px;
}

.object-info-content {
    padding: 15px;
}

/* Input fields */
input[type="text"] {
    user-select: text !important;
    -webkit-user-select: text !important;
}

/* Formation Browser - Position managed by UIManager */
.formation-browser {
    position: fixed;
    width: 140px;
    max-height: 80vh;
    background-color: rgba(30, 30, 30, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    font-family: Arial, sans-serif;
    will-change: transform;
    backface-visibility: hidden;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.formation-browser.hidden {
    display: none;
}

.formation-browser-header {
    background-color: rgba(50, 50, 50, 0.9);
    padding: 10px;
    border-radius: 8px 8px 0 0;
    user-select: none;
    text-align: center;
    flex-shrink: 0;
}

.formation-browser-header span {
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.formation-browser-content {
    padding: 10px;
    overflow-y: auto;
    flex: 1;
}

.formation-item {
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 5px;
}

.formation-item:hover {
    background-color: rgba(70, 70, 70, 0.5);
}

.formation-item.selected {
    border-color: rgb(0, 255, 0);
    background-color: rgba(0, 255, 0, 0.1);
}

.formation-preview {
    width: 100%;
    height: 80px;
    background-color: rgba(20, 20, 20, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    margin-bottom: 5px;
    overflow: hidden;
}

.formation-name {
    color: white;
    font-size: 11px;
    text-align: center;
    word-wrap: break-word;
}

/* Stance HUD - Position managed by UIManager */
.stance-hud {
    position: fixed;
    background-color: rgba(30, 30, 30, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 10px 15px;
    z-index: 1001;
    font-family: Arial, sans-serif;
    will-change: transform;
    backface-visibility: hidden;
}

.stance-hud.hidden {
    display: none;
}

.stance-hud-header {
    color: white;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
}

.stance-buttons {
    display: flex;
    gap: 10px;
}

.stance-btn {
    padding: 10px 20px;
    background-color: rgba(70, 70, 70, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.stance-btn:hover {
    background-color: rgba(90, 90, 90, 0.9);
    border-color: rgba(255, 255, 255, 0.5);
}

.stance-btn.active {
    background-color: rgba(100, 200, 100, 0.8);
    border-color: rgb(100, 255, 100);
}

.holdfire-container {
    margin-top: 8px;
    display: flex;
    justify-content: center;
}

.stance-btn.holdfire-btn.active {
    background-color: rgba(220, 180, 50, 0.8);
    border-color: rgb(255, 220, 80);
}

/* Cannon mode - hide stance header and buttons, only show hold fire */
.stance-hud.cannon-mode .stance-hud-header,
.stance-hud.cannon-mode .stance-buttons {
    display: none;
}

.stance-hud.cannon-mode .holdfire-container {
    margin-top: 0;
}

.stance-label {
    user-select: none;
    pointer-events: none;
}

/* God Menu Button - Position managed by UIManager */

/* God Menu Dropdown - Position managed by UIManager */
.god-menu-dropdown {
    position: fixed;
    width: 200px;
    background-color: rgba(30, 30, 30, 0.95);
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    font-family: Arial, sans-serif;
    will-change: transform;
    backface-visibility: hidden;
}

.god-menu-dropdown.hidden {
    display: none;
}

.god-menu-header {
    background-color: rgba(50, 50, 50, 0.9);
    padding: 10px 12px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}

.god-menu-header span {
    color: gold;
    font-weight: bold;
    font-size: 14px;
}

.god-menu-content {
    padding: 10px;
}

.god-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 5px;
    background-color: rgba(70, 70, 70, 0.6);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.god-menu-item:hover {
    background-color: rgba(90, 90, 90, 0.8);
    border-color: rgba(255, 215, 0, 0.5);
}

.god-menu-item.selected {
    background-color: rgba(255, 215, 0, 0.2);
    border-color: gold;
}

.god-menu-item svg {
    flex-shrink: 0;
}

.god-menu-item span {
    color: white;
    font-size: 13px;
    font-weight: bold;
}

.god-menu-item:last-child {
    margin-bottom: 0;
}

/* Wind Controls in God Menu */
.god-menu-wind-controls {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 215, 0, 0.3);
}

.wind-control-group {
    margin-bottom: 12px;
}

.wind-control-group:last-child {
    margin-bottom: 0;
}

.wind-control-group label {
    display: block;
    color: rgba(255, 215, 0, 0.9);
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 5px;
}

.wind-control-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(100, 100, 100, 0.6);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.wind-control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: rgba(255, 215, 0, 0.9);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 215, 0, 1);
}

.wind-control-group input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: rgba(255, 215, 0, 0.9);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 215, 0, 1);
}

.wind-control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: rgba(255, 215, 0, 1);
    transform: scale(1.1);
}

.wind-control-group input[type="range"]::-moz-range-thumb:hover {
    background: rgba(255, 215, 0, 1);
    transform: scale(1.1);
}

.wind-value {
    display: inline-block;
    margin-top: 3px;
    color: white;
    font-size: 10px;
    font-family: monospace;
}

/* AI Controls in God Menu */
.god-menu-ai-controls {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 100, 100, 0.3);
}

.ai-control-group {
    margin-bottom: 8px;
}

.ai-control-group:last-child {
    margin-bottom: 0;
}

.ai-control-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 150, 150, 0.9);
    font-size: 11px;
    cursor: pointer;
}

.ai-control-group input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #ff6b6b;
    cursor: pointer;
}