:root {
    --sidebar-bg: #1e1e24;
    --text-color: #ffffff;
    --accent-color: #4cc9f0;
    --btn-color: #4361ee;
    --btn-hover: #3a0ca3;
    --input-bg: #2b2d42;
    --sidebar-width: 280px; 
}

body {
    margin: 0; padding: 0; width: 100%; height: 100vh;
    overflow: hidden;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #000;
}

#main-container {
    display: flex; width: 100%; height: 100%; position: relative;
}

#sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(135deg, var(--sidebar-bg), #141418);
    color: var(--text-color);
    padding: 20px;
    box-shadow: 4px 0 15px rgba(0,0,0,0.6);
    z-index: 200;
    display: flex; flex-direction: column; gap: 20px;
    border-right: 1px solid #333;
    overflow-y: auto; box-sizing: border-box; flex-shrink: 0;
    transition: transform 0.3s ease-in-out;
}

.sidebar-header {
    text-align: center; border-bottom: 2px solid var(--accent-color);
    padding-bottom: 10px; margin-bottom: 5px; flex-shrink: 0;
}

#appTitle {
    margin: 0; font-size: 1.1em; font-weight: 700;
    color: var(--accent-color); text-transform: uppercase; line-height: 1.3;
}

.brand { 
    margin: 5px 0 0 0; font-size: 0.9em; font-weight: 800; 
    color: #ffd166;
    letter-spacing: 1px; 
}

#canvas-container {
    flex-grow: 1; position: relative; background-color: #000;
    overflow: hidden; touch-action: none;
}
canvas { 
    display: block; 
    outline: none; 
    touch-action: none;
    width: 100%; 
    height: 100%;
}

.floating-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    background-color: #ef233c;
    color: white;
    border: 2px solid rgba(255,255,255,0.2);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    text-transform: none; 
    cursor: pointer;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.floating-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.7);
    filter: brightness(1.1);
}

.floating-btn:active {
    transform: translateY(1px);
}

#mobile-menu-btn {
    display: none; position: fixed; top: 15px; left: 15px; z-index: 300;
    background-color: rgba(30, 30, 36, 0.8); color: #fff;
    border: 1px solid #555; border-radius: 8px;
    width: 44px; height: 44px; font-size: 24px; cursor: pointer;
    backdrop-filter: blur(4px); padding: 0; line-height: 1;
    transition: background 0.2s;
}
#mobile-menu-btn:hover { background-color: rgba(67, 97, 238, 0.9); }

#close-sidebar-btn {
    display: none; position: absolute; top: 10px; right: 10px;
    background: none; border: none; color: #aaa; font-size: 24px; cursor: pointer; padding: 5px;
}

.control-panel { display: flex; flex-direction: column; gap: 18px; }
.control-group { display: flex; flex-direction: column; gap: 8px; }
label { font-size: 0.95em; font-weight: 500; color: #ccc; }

select, input[type="number"] {
    padding: 12px; background-color: var(--input-bg);
    border: 1px solid #444; border-radius: 6px;
    color: white; font-size: 1em; outline: none; width: 100%; box-sizing: border-box;
}

input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; }
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; height: 20px; width: 20px;
    border-radius: 50%; background: var(--accent-color);
    cursor: pointer; margin-top: -8px;
}
input[type=range]::-webkit-slider-runnable-track {
    width: 100%; height: 4px; cursor: pointer; background: #555; border-radius: 2px;
}

button.toggle-btn {
    padding: 14px; background-color: var(--btn-color); color: white;
    border: none; border-radius: 6px; cursor: pointer; font-weight: 600;
    transition: background 0.2s; font-size: 0.9em;
    text-transform: none; 
}
button.toggle-btn.active { background-color: #2a9d8f; }

.ghost-btn {
    background: transparent;
    border: none;
    color: #bbb;
    font-size: 0.9em;
    cursor: pointer;
    text-decoration: underline;
    padding: 5px;
    align-self: flex-start;
    transition: color 0.2s;
}
.ghost-btn:hover {
    color: var(--accent-color);
}

#sidebar-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); z-index: 190; backdrop-filter: blur(3px);
    opacity: 0; transition: opacity 0.3s;
}

.modal-overlay-custom {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-overlay-custom.active {
    display: flex;
}

.modal-content {
    background: #1e1e24;
    color: #fff;
    padding: 25px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    position: relative;
    border: 1px solid #444;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}

.close-modal-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #aaa;
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal-btn:hover {
    color: #ff5555;
}

.modal-body ul {
    padding-left: 20px;
    line-height: 1.6;
}

.modal-body li {
    margin-bottom: 10px;
}

.modal-body code {
    background: #333;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: #ffd166;
}

@media (max-width: 768px) {
    #mobile-menu-btn { display: block; }
    
    #sidebar {
        position: fixed; top: 0; left: 0; bottom: 0;
        width: 300px; max-width: 85%;
        transform: translateX(-100%); border-right: 1px solid #444;
    }
    
    #sidebar.active { transform: translateX(0); box-shadow: 5px 0 20px rgba(0,0,0,0.8); }
    
    #close-sidebar-btn { display: block; }
    
    #sidebar-overlay.active { display: block; opacity: 1; }
    
    #canvas-container { width: 100%; height: 100%; }
    
    .floating-btn {
        top: 15px;
        right: 15px;
        padding: 6px 12px;
        font-size: 13px;
    }
}