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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    color: #ffffff;
    overflow: hidden;
}

#canvas-container {
    position: fixed;
    top: 0;
    left: 320px; /* Account for sidebar width */
    width: calc(100vw - 320px);
    height: 100vh;
    z-index: 1;
}

.ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    pointer-events: none;
}

.header {
    text-align: center;
    /* @tweakable the vertical padding of the header to reduce height */
    padding: 12px;
    background: rgba(15, 15, 30, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: all;
    width: 100%; /* Ensure header spans full width */
}

.header h1 {
    color: #64ffda;
    /* @tweakable the header title font size for compactness */
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    margin: 0;
    text-shadow: 0 0 20px rgba(100, 255, 218, 0.5);
}

.sidebar {
    /* @tweakable the width of the left sidebar */
    width: 220px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    /* @tweakable the background opacity of the sidebar */
    background: rgba(15, 15, 30, 0.95);
    backdrop-filter: blur(15px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 15;
    overflow-y: auto;
    /* @tweakable the padding inside the sidebar */
    padding: 60px 12px 60px 12px; /* Top padding to account for header */
    /* @tweakable the bottom padding to make room for credit section */
    padding-bottom: 60px;
}

.credit-section {
    /* @tweakable the position of the credit section at bottom of sidebar */
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    /* @tweakable the padding around the credit section */
    padding: 15px 12px;
    /* @tweakable the background color of the credit section */
    background: rgba(15, 15, 30, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.credit-section p {
    /* @tweakable the font size of the credit text */
    font-size: 12px;
    color: #a0a0a0;
    text-align: center;
    margin: 0;
    /* @tweakable the line height of the credit text */
    line-height: 1.4;
}

.credit-section a {
    /* @tweakable the color of the creator name link */
    color: #64ffda;
    text-decoration: none;
    /* @tweakable the font weight of the creator name link */
    font-weight: 500;
    transition: all 0.3s ease;
    /* @tweakable the text shadow glow effect for the creator link */
    text-shadow: 0 0 8px rgba(100, 255, 218, 0.3);
}

.credit-section a:hover {
    /* @tweakable the color of the creator link on hover */
    color: #ffffff;
    /* @tweakable the text shadow intensity on hover for creator link */
    text-shadow: 0 0 12px rgba(100, 255, 218, 0.6);
}

.controls-container {
    display: flex;
    flex-direction: column;
    /* @tweakable the gap between dropdown sections */
    gap: 12px;
    pointer-events: all;
}

.dropdown-container {
    position: relative;
}

.dropdown-btn {
    background: none;
    border: none;
    /* @tweakable the color of dropdown heading text */
    color: #64ffda;
    /* @tweakable the padding around dropdown headings */
    padding: 6px 0;
    /* @tweakable the font size of dropdown headings */
    font-size: 15px;
    border-radius: 0;
    cursor: pointer;
    /* @tweakable the transition duration for dropdown heading hover effects */
    transition: all 0.2s ease;
    box-shadow: none;
    /* @tweakable the font weight of dropdown headings */
    font-weight: 600;
    text-align: left;
    width: 100%;
    /* @tweakable the text shadow glow effect for dropdown headings */
    text-shadow: 0 0 10px rgba(100, 255, 218, 0.3);
}

.dropdown-btn:hover {
    transform: none;
    box-shadow: none;
    /* @tweakable the opacity of dropdown headings on hover */
    opacity: 0.8;
    /* @tweakable the text shadow intensity on hover */
    text-shadow: 0 0 15px rgba(100, 255, 218, 0.5);
}

.dropdown-content {
    display: none;
    position: static; /* Changed from absolute to static for sidebar layout */
    transform: none; /* Remove transform since we're not centering */
    background: none;
    backdrop-filter: none;
    border: none;
    border-radius: 0;
    /* @tweakable the padding inside expanded dropdown content */
    padding: 10px 0 12px 0;
    width: 100%; /* Use full width of sidebar */
    max-height: none; /* Remove height restriction */
    overflow-y: visible;
    box-shadow: none;
    z-index: 1000;
    /* @tweakable the top margin of expanded dropdown content */
    margin-top: 3px;
    /* @tweakable the left padding to indent dropdown content */
    padding-left: 8px;
    /* @tweakable the border on the left side of expanded content */
    border-left: 2px solid rgba(100, 255, 218, 0.2);
}

.info-section h3, .control-section h3 {
    color: #64ffda;
    /* @tweakable the bottom margin of section headings */
    margin-bottom: 10px;
    /* @tweakable the font size of section headings */
    font-size: 1.1em;
}

.info-section h4 {
    color: #bb86fc;
    /* @tweakable the margin around subsection headings */
    margin: 10px 0 6px 0;
    /* @tweakable the font size of subsection headings */
    font-size: 1em;
}

.info-section p, .info-section li {
    color: #e0e0e0;
    line-height: 1.5;
    /* @tweakable the bottom margin of paragraphs and list items */
    margin-bottom: 8px;
    /* @tweakable the font size of body text */
    font-size: 13px;
}

.info-section ul {
    margin-left: 15px;
    /* @tweakable the bottom margin of lists */
    margin-bottom: 10px;
}

.mode-instructions p {
    /* @tweakable the margin between simulation mode descriptions */
    margin-bottom: 8px;
    /* @tweakable the padding of simulation mode instruction text */
    padding: 6px 0;
    /* @tweakable the font size of mode instruction descriptions */
    font-size: 12px;
    color: #e0e0e0;
    border-left: 3px solid rgba(100, 255, 218, 0.3);
    /* @tweakable the left padding for mode instruction indentation */
    padding-left: 10px;
}

.mode-instructions p strong {
    color: #64ffda;
    /* @tweakable the font weight of mode instruction headings */
    font-weight: 600;
}

.best-practices {
    /* @tweakable the background color of best practices section */
    background: rgba(100, 255, 218, 0.05);
    border-radius: 8px;
    /* @tweakable the padding inside best practices section */
    padding: 12px;
    /* @tweakable the margin around best practices section */
    margin: 10px 0;
    border: 1px solid rgba(100, 255, 218, 0.2);
}

.best-practices p {
    /* @tweakable the margin between best practice items */
    margin-bottom: 6px;
    /* @tweakable the font size of best practice text */
    font-size: 12px;
    color: #e0e0e0;
}

.best-practices p strong {
    color: #bb86fc;
    /* @tweakable the font weight of best practice category headings */
    font-weight: 600;
}

.mode-buttons {
    display: grid;
    /* @tweakable the number of columns in the mode button grid */
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    /* @tweakable the gap between mode buttons */
    gap: 6px;
    /* @tweakable the bottom margin of the mode buttons container */
    margin-bottom: 15px;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    /* @tweakable the padding inside mode buttons */
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    /* @tweakable the font size of mode buttons */
    font-size: 12px;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.mode-btn.active {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-color: #667eea;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
}

.parameter-controls {
    /* @tweakable the vertical margin around parameter controls */
    margin: 15px 0;
}

.control-group {
    /* @tweakable the bottom margin of control groups */
    margin-bottom: 12px;
}

.control-group label {
    display: block;
    color: #bb86fc;
    /* @tweakable the bottom margin of control labels */
    margin-bottom: 6px;
    /* @tweakable the font size of control labels */
    font-size: 13px;
    font-weight: 500;
}

.control-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #64ffda;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(100, 255, 218, 0.5);
}

.legend {
    /* @tweakable the top margin and padding of the legend section */
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.legend h4 {
    color: #bb86fc;
    /* @tweakable the bottom margin of legend headings */
    margin-bottom: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    /* @tweakable the bottom margin of legend items */
    margin-bottom: 6px;
    /* @tweakable the font size of legend items */
    font-size: 13px;
    color: #e0e0e0;
}

.color-box {
    /* @tweakable the size of color indicator boxes */
    width: 14px;
    height: 14px;
    border-radius: 50%;
    /* @tweakable the right margin of color boxes */
    margin-right: 8px;
    display: inline-block;
}

.color-box.motor { background-color: #FF6B6B; }
.color-box.sensory { background-color: #4ECDC4; }
.color-box.reflex { background-color: #FFE66D; }
.color-box.stress { background-color: #FF8E53; }
.color-box.sleep { background-color: #9B59B6; }
.color-box.learning { background-color: #F39C12; }
.color-box.pain { background-color: #E74C3C; }
.color-box.memory { background-color: #3498DB; }
.color-box.autonomic { background-color: #9C27B0; }
.color-box.cranial { background-color: #FF9800; }
.color-box.thalamic { background-color: #E91E63; }
.color-box.limbic { background-color: #673AB7; }

.nav-buttons, .follow-buttons, .zoom-controls {
    display: grid;
    /* @tweakable the number of columns in navigation button grids */
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    /* @tweakable the gap between navigation buttons */
    gap: 6px;
    /* @tweakable the bottom margin of navigation button containers */
    margin-bottom: 15px;
}

.nav-btn {
    background: rgba(100, 255, 218, 0.1);
    border: 1px solid rgba(100, 255, 218, 0.3);
    color: #64ffda;
    /* @tweakable the padding inside navigation buttons */
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    /* @tweakable the font size of navigation buttons */
    font-size: 11px;
    /* @tweakable the font weight of navigation buttons */
    font-weight: 500;
}

.nav-btn:hover {
    background: rgba(100, 255, 218, 0.2);
    border-color: #64ffda;
    /* @tweakable the scale transform on navigation button hover */
    transform: scale(1.02);
    box-shadow: 0 0 10px rgba(100, 255, 218, 0.3);
}

.nav-btn.stop {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.3);
    color: #ff6b6b;
}

.nav-btn.stop:hover {
    background: rgba(255, 107, 107, 0.2);
    border-color: #ff6b6b;
}

.keyboard-help {
    /* @tweakable the top margin and padding of keyboard help section */
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.keyboard-help h4 {
    color: #bb86fc;
    /* @tweakable the bottom margin of keyboard help heading */
    margin-bottom: 10px;
    /* @tweakable the font size of keyboard help heading */
    font-size: 14px;
}

.shortcut-list {
    display: grid;
    /* @tweakable the number of columns in keyboard shortcut grid */
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    /* @tweakable the gap between keyboard shortcuts */
    gap: 4px;
}

.shortcut {
    /* @tweakable the font size of keyboard shortcuts */
    font-size: 11px;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    /* @tweakable the gap between key and description in shortcuts */
    gap: 6px;
}

.shortcut kbd {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    /* @tweakable the padding inside keyboard key indicators */
    padding: 2px 6px;
    /* @tweakable the font size of keyboard key indicators */
    font-size: 10px;
    font-family: monospace;
    color: #64ffda;
    /* @tweakable the minimum width of keyboard key indicators */
    min-width: 20px;
    text-align: center;
}

@media (max-width: 768px) {
    .sidebar {
        /* @tweakable the sidebar width on mobile devices */
        width: 200px;
    }
    
    #canvas-container {
        left: 200px;
        width: calc(100vw - 200px);
    }
    
    .controls-container {
        /* @tweakable the gap between sections on mobile */
        gap: 10px;
    }
    
    .dropdown-content {
        min-width: 200px;
        /* @tweakable the padding in dropdown content on mobile */
        padding: 10px;
    }
    
    .mode-buttons {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 8px;
    }
    
    .header h1 {
        /* @tweakable the header font size on mobile */
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .sidebar {
        /* @tweakable whether to hide sidebar on very small screens */
        width: 180px;
    }
    
    #canvas-container {
        left: 180px;
        width: calc(100vw - 180px);
    }
    
    .dropdown-content {
        min-width: 180px;
        max-width: 95vw;
    }
    
    .mode-buttons {
        grid-template-columns: 1fr;
    }
    
    .controls-container {
        padding: 10px;
    }
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(100, 255, 218, 0.5);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 255, 218, 0.7);
}

/* Custom scrollbar for dropdown content */
.dropdown-content::-webkit-scrollbar {
    width: 8px;
}

.dropdown-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.dropdown-content::-webkit-scrollbar-thumb {
    background: rgba(100, 255, 218, 0.5);
    border-radius: 4px;
}

.dropdown-content::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 255, 218, 0.7);
}