* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    /* Prevent text selection in game */
}

body,
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
}

canvas {
    display: block;
}

/* UI Overlay */
/* UI Overlay */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Click through to canvas */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-family: 'Courier New', Courier, monospace;
    /* Tech Font */
}

/* Common HUD Panel Style */
.hud-panel {
    background: rgba(0, 15, 25, 0.85);
    /* Slightly less transparent */
    border: 1px solid rgba(0, 255, 255, 0.4);
    color: #ccffff;
    pointer-events: auto;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.15);
    border-radius: 2px;
    /* Sharper corners */
}

/* Tech Corners / Angled Edges Helper Class */
.tech-border {
    position: relative;
    clip-path: polygon(10px 0, 100% 0,
            100% calc(100% - 10px), calc(100% - 10px) 100%,
            0 100%, 0 10px);
    border: none;
    /* Handled by pseudo-elements or specific borders if clip-path allows */
    /* Note: clip-path clips borders too. We might need a wrapper or just use the background+clip */
}

/* PLAYER HUD (Top Left) */
#hud-player {
    background: linear-gradient(135deg, rgba(0, 30, 60, 0.8), rgba(0, 10, 20, 0.8));
    border-left: 2px solid #00ffff;
    clip-path: polygon(0 0, 100% 0, 100% 80%, 90% 100%, 0 100%);
    /* Scaled Up */
    width: 450px;
    font-size: 18px;
}

/* ENEMY HUD (Top Right) */
#hud-enemy {
    background: linear-gradient(225deg, rgba(60, 0, 60, 0.8), rgba(20, 0, 20, 0.8));
    border-right: 2px solid #ff00ff;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 10% 100%, 0 80%);
    /* Scaled Up */
    width: 450px;
    font-size: 18px;
}

/* MINIMAP (Left) */
#minimap-panel {
    width: 350px;
    /* Larger */
    height: 350px;
    /* Larger */
    background: rgba(0, 10, 20, 0.4);
    /* Much more transparent */
    border: 1px solid #005577;
    position: relative;
    border-radius: 5px;
    box-shadow: 0 0 10px #00aaff;
    backdrop-filter: blur(4px);
    /* Reduced blur for visibility through it */
}

/* INFO PANEL (Bottom Center) */
#info-panel {
    align-self: flex-end;
    /* Bottom */
    width: 700px;
    /* Larger */
    height: 180px;
    /* Larger */
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(to top, rgba(0, 20, 40, 0.9), rgba(0, 10, 20, 0.6));
    border-top: 2px solid #00aaff;
    clip-path: polygon(10% 0, 90% 0, 100% 20%, 100% 100%, 0 100%, 0 20%);
}

#info-details h3 {
    margin: 0 0 10px 0;
    color: #ffffff;
    text-transform: uppercase;
    text-shadow: 0 0 5px #00aaff;
    letter-spacing: 2px;
    font-size: 24px;
    /* Larger Title */
}

#info-details p {
    font-size: 18px;
    /* Larger Text */
    color: #aaaaff;
    line-height: 1.4;
    text-align: center;
}

/* ACTION/BUILD PANEL (Right of Minimap) */
#action-panel {
    padding: 10px;
}

.action-btn {
    background: rgba(0, 40, 60, 0.6);
    border: 1px solid #005577;
    color: #00ffff;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    /* Larger Buttons */
    padding: 12px 16px;
    /* Larger Click Area */
    text-transform: uppercase;
    transition: all 0.2s;
    text-shadow: 0 0 2px #00ffff;
}

.action-btn:hover {
    background: rgba(0, 100, 150, 0.6);
    border-color: #00ffff;
    box-shadow: 0 0 8px #00ffff;
    color: white;
}

.action-btn:active {
    background: #00ffff;
    color: black;
}

/* QUEUE ITEMS */
.queue-item {
    background: rgba(0, 20, 30, 0.8);
    border: 1px solid #005577;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.queue-item.active {
    border-color: #00ff00;
    color: #00ff00;
    box-shadow: 0 0 5px #00ff00;
}

/* HEALTH BARS IN HUD */
.bar-container {
    background: #111;
    border: 1px solid #333;
    position: relative;
    overflow: hidden;
}

/* WATCHDOG */
#debug-watchdog {
    font-family: 'Consolas', monospace;
    font-size: 11px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px dashed #444;
}

/* QUEUE PANEL OVERRIDES (DOM) */
#build-queue-panel {
    border: none;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    /* Positioned inside HQ Command Context now? Or we keep it absolute but styled better? */
    /* Let's keep absolute for now but style the items */
    bottom: 300px !important;
    /* Move up slightly */
    right: 20px !important;
}

.queue-item {
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: bold;
    min-width: 25px;
    text-align: center;
}

/* --- COMMAND PANEL DOM --- */
#command-panel-dom {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 280px;
    /* Slightly wider */
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 50;
}

.cmd-header {
    font-size: 16px;
    font-weight: bold;
    color: #00ffaa;
    border-bottom: 1px solid #005577;
    padding-bottom: 5px;
    margin-bottom: 5px;
    text-shadow: 0 0 5px #00ffaa;
}

.cmd-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 3 cols for better text fit */
    gap: 8px;
}

.build-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

/* Base Button Style */
.cmd-btn,
.build-btn {
    background: rgba(0, 20, 40, 0.9);
    border: 1px solid #00aaaa;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 5px rgba(0, 255, 170, 0.1);
    position: relative;
    width: 100%;
    height: 60px;
    /* Fixed height */
    padding: 4px;
}

.cmd-btn:hover,
.build-btn:hover {
    background: rgba(0, 60, 100, 1.0);
    border-color: #00ffff;
    box-shadow: 0 0 10px #00ffff;
    transform: translateY(-2px);
    z-index: 2;
}

.cmd-btn.active,
.build-btn.active {
    background: rgba(0, 100, 50, 0.5);
    border-color: #00ff00;
    box-shadow: 0 0 8px #00ff00;
}

.cmd-btn.disabled,
.build-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
    border-color: #880000;
    background: rgba(40, 0, 0, 0.5) !important;
}

/* Icon & Label Typography */
.btn-icon {
    font-size: 20px;
    margin-bottom: 2px;
}

.btn-label {
    font-size: 10px;
    color: #ccffff;
    text-transform: uppercase;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    text-align: center;
    line-height: 1;
}

.build-cost {
    font-size: 9px;
    color: #00ffaa;
    margin-top: 2px;
}

/* Tooltip - Fixed Position Strategy */
.cmd-tooltip {
    position: fixed;
    /* Fixed relative to viewport prevents clipping */
    width: 250px;
    background: rgba(0, 10, 20, 0.98);
    border: 1px solid #00ffaa;
    padding: 10px;
    border-radius: 4px;
    pointer-events: none;
    box-shadow: 0 0 20px rgba(0, 0, 0, 1);
    backdrop-filter: blur(5px);
    z-index: 9999;
    /* Max Z */
    /* Position set by JS */
}

.tt-title {
    color: #00ffaa;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 4px;
    border-bottom: 1px solid #004455;
}

.tt-desc {
    color: #ffffff;
    font-size: 12px;
    margin-bottom: 6px;
}

.tt-tip {
    color: #ffdd00;
    font-size: 11px;
    font-style: italic;
}