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

body {
    overflow: hidden;
    background: #1a1a2e;
    color: #eee;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Toolbar */
#toolbar {
    height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
    flex-shrink: 0;
}

#title {
    font-weight: 700;
    font-size: 16px;
    color: #e94560;
    margin-right: 8px;
}

#toolbar button {
    padding: 4px 12px;
    border: 1px solid #0f3460;
    border-radius: 4px;
    background: #1a1a2e;
    color: #eee;
    cursor: pointer;
    font-size: 12px;
}

#template-select {
    padding: 3px 6px;
    border: 1px solid #0f3460;
    border-radius: 4px;
    background: #1a1a2e;
    color: #eee;
    font-size: 12px;
    cursor: pointer;
}

#toolbar button:hover {
    background: #0f3460;
}

#toolbar button.active {
    background: #e94560;
    border-color: #e94560;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
}

.toolbar-group label {
    font-size: 12px;
    color: #aaa;
}

#speed-slider, #brush-slider {
    width: 80px;
    accent-color: #e94560;
}

/* Main layout */
#main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#simCanvas {
    flex: 1;
    display: block;
    cursor: crosshair;
    background: #1a1a2e;
}

/* Side panel */
#ui-panel {
    width: 200px;
    background: #16213e;
    border-left: 1px solid #0f3460;
    overflow-y: auto;
    padding: 8px;
    flex-shrink: 0;
}

/* Element picker */
.category-header {
    padding: 6px 8px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    margin: 4px 0 2px;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-header::before {
    content: '▼';
    font-size: 8px;
    transition: transform 0.2s;
}

.category-header.collapsed::before {
    transform: rotate(-90deg);
}

.category-header:hover {
    background: rgba(255, 255, 255, 0.1);
}

.category-section {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    padding: 4px 0;
}

.category-section.collapsed {
    display: none;
}

.element-btn {
    width: calc(50% - 2px);
    padding: 5px 2px;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    transition: border-color 0.15s;
}

.element-btn:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.element-btn.selected {
    border-color: #fff;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}

/* Brush controls */
#brush-controls {
    margin-top: 12px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

#brush-controls label {
    font-size: 12px;
    font-weight: 600;
    width: 100%;
}

#brush-slider {
    flex: 1;
}

/* Scrollbar styling */
#ui-panel::-webkit-scrollbar {
    width: 6px;
}

#ui-panel::-webkit-scrollbar-track {
    background: transparent;
}

#ui-panel::-webkit-scrollbar-thumb {
    background: #0f3460;
    border-radius: 3px;
}
