body {
    margin: 0;
    overflow: hidden;
    background-color: #020203;
    font-family: 'Eurostile', 'Segoe UI', sans-serif;
    user-select: none;
}

/* --- UI Panel --- */
#ui-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(13, 20, 30, 0.95);
    border: 1px solid rgba(68, 102, 136, 0.5);
    border-top: 2px solid rgba(0, 180, 255, 0.8);
    padding: 0;
    width: 300px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

@media (max-width: 768px) {
    #ui-panel {
        position: fixed;
        width: 280px;
        left: 0;
        top: 0;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        border: none;
        border-right: 1px solid rgba(68, 102, 136, 0.5);
        border-radius: 0;
        background: rgba(13, 20, 30, 0.98);
        z-index: 1000;
        transition: transform 0.3s ease;
        padding-top: 80px;
        overflow-y: auto;
    }

    #ui-panel.collapsed {
        transform: translateX(-100%);
    }

    input[type="text"],
    input[type="number"],
    button {
        min-height: 40px;
        font-size: 14px;
    }

    .ov-item {
        padding: 10px;
        font-size: 14px;
    }

    /* Ensure search box is large enough */
    .search-box {
        min-height: 40px;
    }
}

.panel-header {
    background: rgba(0, 180, 255, 0.1);
    color: #00aaff;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 10px;
    border-bottom: 1px solid rgba(68, 102, 136, 0.3);
    flex-shrink: 0;
}

.panel-body {
    padding: 10px;
    flex-shrink: 0;
}

/* Overview List */
#overview-list {
    flex: 1;
    overflow-y: auto;
    border-top: 1px solid rgba(68, 102, 136, 0.3);
    padding: 5px;
    background: rgba(0, 0, 0, 0.3);
}

#overview-list::-webkit-scrollbar {
    width: 6px;
}

#overview-list::-webkit-scrollbar-track {
    background: #0b1116;
}

#overview-list::-webkit-scrollbar-thumb {
    background: #335577;
    border-radius: 3px;
}

.ov-group {
    margin-bottom: 10px;
}

.ov-header {
    font-size: 10px;
    color: #6688aa;
    border-bottom: 1px solid #223344;
    margin-bottom: 4px;
    padding-bottom: 2px;
    font-weight: bold;
}

.ov-item {
    font-size: 11px;
    padding: 3px 6px;
    margin-bottom: 2px;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 2px solid transparent;
}

.ov-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.ov-gate {
    color: #ccffdd;
    border-left-color: #00ff66;
}

.ov-station {
    color: #ccffff;
    border-left-color: #00ffff;
    margin-top: 6px;
    background: rgba(0, 40, 60, 0.3);
}

.ov-station.has-agents {
    border-left-color: #ff3333;
    background: rgba(40, 10, 10, 0.3);
    color: #ffcccc;
}

.agent-list {
    padding-left: 10px;
    margin-bottom: 4px;
}

.ov-agent {
    font-size: 10px;
    color: #aaddff;
    padding: 1px 0;
    font-family: monospace;
}

.agent-lvl {
    color: #ffaa00;
    font-weight: bold;
    margin-right: 4px;
}

.agent-div {
    color: #6688aa;
    font-style: italic;
    margin-right: 4px;
}

/* Controls */
.control-row {
    display: flex;
    gap: 5px;
    margin-bottom: 8px;
    align-items: center;
}

.search-box {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #335577;
    color: #fff;
    padding: 6px;
    flex: 1 1 auto;
    outline: none;
    font-family: monospace;
    font-size: 12px;
    min-width: 120px;
    width: auto;
    box-sizing: border-box;
}

.search-box:focus {
    border-color: #00aaff;
    box-shadow: 0 0 5px rgba(0, 170, 255, 0.3);
}

input[type="number"] {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #335577;
    color: #aaa;
    padding: 4px;
    width: 60px;
    outline: none;
    font-family: monospace;
    font-size: 11px;
}

button {
    background: linear-gradient(180deg, rgba(0, 80, 120, 0.8), rgba(0, 60, 90, 0.8));
    border: 1px solid #006699;
    color: #cdf;
    padding: 0 10px;
    cursor: pointer;
    font-size: 10px;
    font-weight: bold;
    transition: all 0.2s;
    height: 26px;
}

button:hover {
    background: rgba(0, 120, 180, 0.8);
    color: #fff;
}

.slider-container {
    margin-bottom: 8px;
}

.slider-label {
    font-size: 9px;
    color: #88aacc;
    margin-bottom: 2px;
    display: flex;
    justify-content: space-between;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 3px;
    background: #112233;
    border: 1px solid #335577;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 10px;
    width: 10px;
    background: #00aaff;
    margin-top: -4px;
    border-radius: 2px;
    cursor: pointer;
}

.toggle-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: #88aacc;
    cursor: pointer;
}

.toggle-item input {
    accent-color: #00aaff;
    cursor: pointer;
    margin: 0;
}

#log {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-family: monospace;
    font-size: 9px;
    color: #5588aa;
    min-height: 12px;
    white-space: pre-wrap;
}

/* Labels */
#labels-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 10;
}

.tactical-label {
    position: absolute;
    font-size: 9px;
    color: rgba(255, 255, 255, 0.8);
    padding: 2px 6px;
    background: rgba(10, 15, 20, 0.85);
    white-space: nowrap;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(100, 150, 200, 0.3);
    border-left-width: 3px;
    cursor: pointer;
    pointer-events: auto;
    transition: opacity 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    will-change: transform;
}

.tactical-label:hover {
    z-index: 9999 !important;
    color: #fff;
    background: rgba(0, 40, 70, 0.95);
    border-color: #00ccff;
    box-shadow: 0 0 10px rgba(0, 170, 255, 0.3);
}

.type-Star {
    border-color: #ffcc00;
    color: #ffdb4d;
    font-weight: bold;
    font-size: 11px;
    z-index: 50;
}

.type-Planet {
    border-color: #00aaff;
    color: #99ddff;
    z-index: 60;
}

.type-Stargate {
    border-color: #00ff66;
    color: #ccffdd;
    font-weight: bold;
    background: rgba(0, 30, 10, 0.85);
    z-index: 40;
}

.type-Station {
    border-color: #00ffff;
    color: #ccffff;
    font-size: 10px;
    font-weight: bold;
    opacity: 1.0;
    border-left-width: 4px;
    z-index: 55;
    background: rgba(0, 20, 30, 0.9);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
}

.type-Station-Agent {
    border-color: #ff3333;
    color: #ffcccc;
    border-left-width: 4px;
    background: rgba(30, 5, 5, 0.9);
    box-shadow: 0 0 8px rgba(255, 50, 50, 0.4);
}

.type-Moon {
    border-color: #666666;
    color: #bbbbbb;
    font-size: 9px;
    opacity: 0.9;
    border-left-width: 1px;
    z-index: 30;
}

.type-AsteroidBelt {
    border-color: #aa4444;
    color: #ffaaaa;
    font-size: 9px;
    opacity: 0.9;
    border-left-width: 1px;
    z-index: 30;
}

.corp-ticker {
    color: #ffd700;
    font-weight: bold;
    margin-left: 4px;
    font-size: 9px;
}

.label-hidden {
    opacity: 0;
    pointer-events: none;
}

#svg-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

line {
    stroke-width: 1;
    transition: opacity 0.2s;
}

/* Tooltip */
#tooltip {
    position: absolute;
    display: none;
    background: rgba(5, 10, 15, 0.98);
    border: 1px solid #00ffff;
    padding: 10px;
    pointer-events: none;
    z-index: 2000;
    color: #eee;
    font-size: 10px;
    max-width: 280px;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.tooltip-header {
    color: #fff;
    font-weight: bold;
    margin-bottom: 6px;
    border-bottom: 1px solid #005555;
    padding-bottom: 4px;
    letter-spacing: 1px;
}

.tooltip-sub {
    margin-top: 8px;
    color: #00ffff;
    font-weight: bold;
    border-bottom: 1px solid #004444;
    margin-bottom: 4px;
    font-size: 9px;
}

.service-tag {
    display: inline-block;
    background: #004444;
    color: #00ffff;
    padding: 2px 5px;
    margin: 2px;
    border-radius: 2px;
    font-size: 9px;
}
@media (max-width: 768px) {
    .tactical-label {
        font-size: 11px;
        padding: 5px 8px;
        border-width: 1px;
    }
    .type-System .tactical-label {
         /* maybe specific tweaks */
    }
    #tooltip {
        font-size: 12px;
        padding: 8px 12px;
        min-width: 150px;
    }
}
