/* --- Global & Layout --- */
:root {
    --bg-main: #1a1a1a;
    --bg-toolbar: #242424;
    --border-color: #333333;
    --text-primary: #e0e0e0;
    --text-secondary: #aaa;
    --accent-primary: #00BFFF;
    --accent-green: #2ecc71;
    --accent-red: #e74c3c;
    --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.canvas-container {
    flex-grow: 1; /* Makes canvas area fill available space */
    position: relative;
    background-color: var(--bg-main);
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

/* ---         Bottom Toolbar         --- */
.bottom-toolbar {
    flex-shrink: 0;
    min-height: 80px;
    width: 100%;
    background-color: var(--bg-toolbar);
    border-top: 1px solid var(--border-color);
    padding: 10px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-sizing: border-box;
    flex-wrap: nowrap; 
}

/* On smaller screens, allow wrapping and center the content */
@media (max-width: 1050px) {
    .bottom-toolbar {
        flex-wrap: wrap; 
        justify-content: center;
    }
}


.toolbar-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* ---           Controls Styling            --- */
label {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
}

button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    white-space: nowrap;
}

button:active {
    transform: scale(0.95);
}

#play-pause-btn {
    background-color: var(--accent-green);
    color: white;
    width: 100px; 
    text-align: center;
}

#play-pause-btn.running {
    background-color: var(--accent-red);
}

.secondary-btn {
    background-color: #4a4a4a;
    color: var(--text-primary);
    border: 1px solid #555;
}

.secondary-btn:hover {
    background-color: #5a5a5a;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100px;
    height: 4px;
    background: #555;
    outline: none;
    border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
}

#speed-value {
    font-size: 12px;
    color: var(--text-secondary);
    width: 50px; 
}

.generation-counter {
    font-size: 14px;
}
.generation-counter span {
    font-weight: bold;
    color: var(--accent-primary);
}

select {
    padding: 8px;
    background-color: #333;
    color: var(--text-primary);
    border: 1px solid #555;
    border-radius: 6px;
    font-size: 14px;
}

.brush-mode-group {
    display: flex;
}

.brush-btn {
    padding: 6px 12px;
    background-color: #4a4a4a;
    border: 1px solid #555;
    border-radius: 0;
}
.brush-btn:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}
.brush-btn:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    border-left: none;
}


.brush-btn.active {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.color-palette {
    display: flex;
    gap: 5px;
}

.color-palette button {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #555;
    padding: 0;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.color-palette button.active {
    transform: scale(1.15);
    border-color: white;
}