body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 10px;
    background-color: #1a1a2e;
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.6;
}

.container {
    width: 95%;
    max-width: 1000px;
    background-color: #24243e;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    border: 1px solid #4a4a6a;
}

canvas {
    display: block;
    margin: 10px auto 20px auto;
    border: 1px solid #505070;
    max-width: 100%;
    height: auto;
    background-color: #000000;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 20px;
}

.controls fieldset {
    border: 1px solid #4a4a6a;
    background-color: #1e1e36;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 10px;
    flex: 1;
    min-width: 280px;
    display: flex;
    flex-direction: column;
}

.controls legend {
    font-weight: bold;
    color: #9fa8da;
    padding: 0 5px;
}

.controls div {
    margin-bottom: 10px;
}

.controls label {
    display: inline-block;
    min-width: 140px; 
    margin-right: 5px;
    vertical-align: middle;
    color: #c0c0e0;
}

.controls input[type="number"], .controls select {
    width: 100px;
    padding: 8px;
    border: 1px solid #505070;
    background-color: #2a2a4a;
    color: #e0e0e0;
    border-radius: 4px;
    vertical-align: middle;
}
.controls select {
    width: calc(100% - 150px);
    min-width: 100px;
}


.controls input[type="color"] {
    width: 100px;
    height: 36px;
    padding: 2px;
    border: 1px solid #505070;
    background-color: #2a2a4a;
    border-radius: 4px;
    vertical-align: middle;
    cursor: pointer;
}

.controls input[type="checkbox"] {
    width: auto;
    height: auto;
    vertical-align: middle;
    margin-left: 5px;
}


.controls button {
    display: inline-block;
    width: auto;
    padding: 10px 15px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    margin-top: 5px;
    margin-right: 5px;
    margin-bottom: 5px; 
    transition: background-color 0.2s ease;
}

.controls fieldset button:last-child {
    margin-right: 0;
}

.controls fieldset > button.full-width {
    display: block;
    width: 100%;
    margin-right: 0;
}

.button-group {
    display: flex;
    flex-wrap: wrap; 
    gap: 5px; 
}

.button-group button {
   flex-grow: 1; 
   margin-right: 0; 
}


#info {
    margin-top: 15px;
    padding: 12px;
    background-color: #2a2a4a;
    border: 1px solid #505070;
    border-radius: 4px;
    height: auto; 
    text-align: center;
    color: #d0d0f0;
    font-style: italic;
    word-wrap: break-word;
    transition: padding 0.3s ease, height 0.3s ease;
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
    }
    .controls fieldset {
        width: auto;
        min-width: unset; 
    }
    .controls label {
        display: block;
        min-width: unset;
        margin-bottom: 3px;
    }
    .controls input[type="number"], .controls input[type="color"], .controls select {
        width: calc(100% - 20px);
        margin-bottom: 8px;
    }
    .controls button { 
        width: 100%; 
        margin-right: 0;
        margin-left: 0;
        box-sizing: border-box;
    }
     .button-group button { 
        flex-basis: calc(50% - 5px); 
     }
}
@media (max-width: 480px) {
    .button-group button {
        flex-basis: 100%; 
    }
}