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

:root {
    color-scheme: dark;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #121212;
    color: #e0e0e0;
}

.container {
    display: flex;
    position: relative;
    flex-direction: row;
    gap: 1rem;
    padding: 20px;
    background-color: #0e0e0e;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    width: 100vw;
    min-height: 100vh;
}

.canvas-container {
    position: relative;
    order: 1;
}

canvas {
    border: 2px solid #333;
    border-radius: 8px;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.canvas-controls {
    position: absolute;
    top: 0;
    left: 0;
    padding: 10px;
}

.render-toggle {
    position: absolute;
    top: 0;
    right: 0;
    padding: 10px;
}

.options {
    order: 0;
    display: flex;
    flex-direction: column;
    background-color: #1e1e1e;
    height: 100%;
    gap: 10px;
    padding: 30px;
    width: fit-content;
    flex-shrink: 0;
    overflow-y: auto;
    max-height: calc(100vh - 40px);
}

.options label, .options input {
    font-size: 1em;
}

.options h2 {
    padding-bottom: 10px;
    border-bottom: 1px solid #999;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-group:has(input[disabled]) > input, .input-group:has(input[disabled]) > label {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-group label {
    width: 110px;
}

.input-group input {
    width: 120px;
}

.input-group input[type=color] {
    width: 80px;
}

input[type="number"], input[type="color"] {
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #2b2b2b;
    color: #e0e0e0;
    font-size: 1em;
}

input[type="number"] {
    padding: 8px;
}

select {
    padding: 8px 20px 8px 8px;
    border: 1px solid #444;
    border-radius: 4px;
    width: 120px;
    background-color: #2b2b2b;
    color: #e0e0e0;
    font-size: 1em;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #e0e0e0 50%),
    linear-gradient(135deg, #e0e0e0 50%, transparent 50%);
    background-position: calc(100% - 10px) center, calc(100% - 5px) center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

select > option {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

.canvas-controls.button-group {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

button {
    padding: 10px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

button#chaos-play {
    background-color: #4CAF50; /* Green */
    color: white;
}

button#chaos-stop {
    background-color: #f44336; /* Red */
    color: white;
}

button#chaos-erase {
    background-color: #2196F3; /* Blue */
    color: white;
}

/*button#chaos-step {*/
/*    background-color: #2196F3; !* Blue *!*/
/*    color: white;*/
/*}*/

button:hover {
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background-color: #555 !important;
    opacity: 0.5;
    cursor: not-allowed;
    color: #999;
}

#show-options {
    display: none;
    background-color: #333;
    color: white;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background-color: rgba(0, 0, 0, 0.6);
    transition: opacity 0.2s;
}

.overlay.disabled {
    opacity: 0;
    pointer-events: none;
}

.switch > input {
    width: 40px;
    height: 24px;
    margin: 5px 0;
    cursor: pointer;
    position: relative;
    appearance: none;
}

.switch > input::before {
    content: "";
    position: absolute;
    inset: 0;
    background: #555;
    border-radius: 40px;
}

.switch > input:checked::before {
    content: "";
    background: #0e399c;
    border-radius: 40px;
}

.switch > input:active::before {
    background: #474747;
}

.switch > input:checked:active::before {
    background: #0d348f;
}

.switch > input::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #eee;
    border-radius: 40px;
    transition: transform 0.2s ease;
}

.switch > input:checked::after {
    transform: translateX(16px);
}

.switch > input:active::after {
    background: #ddd;
}

@media (max-width: 720px) {
    .container {
        padding: 10px;
    }

    .options {
        display: none;
        position: fixed;
        z-index: 100;
        top: 0;
        left: 0;
        padding: 40px 30px 30px;
        max-height: 100vh;
    }

    .options.open {
        display: flex;
    }

    #show-options {
        display: flex;
        position: absolute;
        z-index: 101;
        top: 5px;
        left: 5px;
    }

    .canvas-controls {
        top: 0;
        left: 27px;
    }

    button {
        width: 32px;
        height: 32px;
        padding: 6px;
    }

    button svg {
        width: 20px;
        height: 20px;
    }
}