* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #000;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    font-size: 14px;
}

#canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Основной UI */
#ui {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1000;
    background: rgba(5, 15, 30, 0.92);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(0, 180, 255, 0.4);
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(0, 30, 60, 0.5);
    max-width: 380px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#header {
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 180, 255, 0.3);
    position: relative;
}

.title {
    font-size: 20px;
    font-weight: 700;
    color: #0ff;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.subtitle {
    font-size: 11px;
    color: #8af;
    opacity: 0.9;
    margin-bottom: 10px;
}

.ui-controls {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 6px;
}

.ui-controls button {
    background: rgba(0, 100, 200, 0.4);
    border: 1px solid rgba(100, 200, 255, 0.3);
    color: #fff;
    width: 32px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.ui-controls button:hover {
    background: rgba(0, 150, 255, 0.6);
    transform: translateY(-1px);
}

.control-group {
    margin-bottom: 16px;
    padding: 10px;
    background: rgba(0, 30, 60, 0.3);
    border-radius: 8px;
    border-left: 3px solid rgba(0, 180, 255, 0.5);
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: #cceeff;
    font-weight: 500;
}

.hint {
    font-size: 11px;
    color: #88aadd;
    margin-top: 4px;
    opacity: 0.8;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: linear-gradient(to right, rgba(0, 100, 200, 0.3), rgba(0, 200, 255, 0.5));
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #0ff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.mode-btn {
    background: rgba(0, 80, 160, 0.25);
    border: 1px solid rgba(0, 150, 255, 0.4);
    color: #aaddff;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    text-align: left;
    transition: all 0.2s;
    position: relative;
}

.mode-btn:hover {
    background: rgba(0, 120, 220, 0.4);
    transform: translateX(2px);
}

.mode-btn.active {
    background: rgba(0, 150, 255, 0.5);
    border-color: #0ff;
    color: #fff;
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.3);
}

.mode-btn.active::after {
    content: '✓';
    position: absolute;
    right: 10px;
    color: #0ff;
}

#stats {
    position: fixed;
    bottom: 15px;
    right: 15px;
    background: rgba(5, 15, 30, 0.92);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(0, 180, 255, 0.4);
    font-size: 12px;
    z-index: 1000;
    backdrop-filter: blur(15px);
    min-width: 180px;
}

#stats div {
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
}

#stats span {
    color: #0ff;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* Панель настроек */
#settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    background: rgba(10, 20, 40, 0.98);
    padding: 0;
    border-radius: 16px;
    border: 1px solid rgba(0, 200, 255, 0.5);
    backdrop-filter: blur(20px);
    width: 85vw;
    max-width: 900px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
}

.settings-header {
    padding: 20px;
    background: rgba(0, 30, 60, 0.8);
    border-bottom: 1px solid rgba(0, 180, 255, 0.4);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-header h3 {
    color: #0ff;
    font-size: 18px;
}

#btn-close-settings {
    background: rgba(255, 50, 50, 0.3);
    border: 1px solid rgba(255, 100, 100, 0.5);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#btn-close-settings:hover {
    background: rgba(255, 80, 80, 0.5);
}

.settings-tabs {
    display: flex;
    background: rgba(0, 20, 40, 0.8);
    border-bottom: 1px solid rgba(0, 180, 255, 0.3);
    padding: 0 20px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: #88aaff;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #aaddff;
    background: rgba(0, 100, 200, 0.2);
}

.tab-btn.active {
    color: #0ff;
    border-bottom-color: #0ff;
    background: rgba(0, 150, 255, 0.1);
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.setting-item {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 30, 60, 0.3);
    border-radius: 8px;
    border-left: 3px solid rgba(0, 150, 255, 0.5);
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    color: #cceeff;
    font-weight: 500;
    font-size: 13px;
}

.setting-item .description {
    font-size: 11px;
    color: #88aadd;
    margin-top: 5px;
    opacity: 0.8;
}

.settings-footer {
    padding: 15px 20px;
    background: rgba(0, 20, 40, 0.8);
    border-top: 1px solid rgba(0, 180, 255, 0.3);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.settings-footer button {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
}

#btn-reset-settings {
    background: rgba(255, 100, 0, 0.3);
    border: 1px solid rgba(255, 150, 0, 0.5);
}

#btn-reset-settings:hover {
    background: rgba(255, 120, 0, 0.5);
}

#btn-save-preset {
    background: rgba(0, 150, 0, 0.3);
    border: 1px solid rgba(0, 200, 0, 0.5);
}

#btn-save-preset:hover {
    background: rgba(0, 180, 0, 0.5);
}

#btn-load-preset {
    background: rgba(0, 100, 200, 0.3);
    border: 1px solid rgba(0, 150, 255, 0.5);
}

#btn-load-preset:hover {
    background: rgba(0, 150, 255, 0.5);
}

/* Минимальный UI */
#minimal-ui {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    gap: 10px;
    align-items: center;
}

#btn-show-ui {
    background: rgba(0, 100, 200, 0.4);
    border: 1px solid rgba(100, 200, 255, 0.3);
    color: #fff;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

#btn-show-ui:hover {
    background: rgba(0, 150, 255, 0.6);
}

.minimal-stats {
    background: rgba(0, 30, 60, 0.7);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(0, 180, 255, 0.3);
    display: flex;
    gap: 15px;
    font-size: 11px;
    color: #aaddff;
}

/* Заглушка для LOD переключения */
.lod-badge {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(0, 150, 255, 0.3);
    border-radius: 4px;
    font-size: 10px;
    margin-left: 5px;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-content.active {
    animation: fadeIn 0.3s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    #ui {
        max-width: 95vw;
        left: 50%;
        transform: translateX(-50%);
    }
    
    #settings-panel {
        width: 95vw;
        height: 90vh;
    }
    
    .settings-tabs {
        overflow-x: auto;
    }
}