body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a252f; /* Fundo mais escuro, quase preto-azulado */
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    align-items: center;
    overflow-x: hidden; /* Previne rolagem horizontal indesejada */
}

header, footer {
    text-align: center;
    padding: 20px;
    width: 100%;
    background-color: #2c3e50; /* Azul escuro mais vibrante */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

h1 {
    color: #f1c40f;
    margin: 0;
}

main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    box-sizing: border-box;
}

.generator-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    width: 100%;
    justify-content: center;
    margin-bottom: 30px;
}

.controls-panel {
    background-color: #2c3e50; /* Azul escuro do header/footer para consistência */
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    flex: 1;
    min-width: 300px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.controls-panel h2 {
    color: #f1c40f;
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-weight: bold;
    color: #ecf0f1;
}

.control-group input[type="text"] {
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #555;
    background-color: #4a647e; /* Fundo mais escuro para inputs */
    color: #ecf0f1;
    font-size: 1em;
}

/* Novo estilo para o input de cor de fundo da cena */
.control-group input[type="color"]#scene-background-color {
    width: 100%;
    height: 40px;
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
    /* Optional: Add a subtle border to differentiate from text color picker */
    border: 1px solid #555;
    border-radius: 5px;
}

/* Estilo para input de cor genérico */
.control-group input[type="color"] {
    width: 100%;
    height: 40px;
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
}


.checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #f1c40f;
}

/* Estilo para input range (slider) */
.control-group input[type="range"] {
    width: 100%;
    -webkit-appearance: none; /* Remove estilo padrão do Chrome */
    appearance: none;
    height: 8px;
    background: #555;
    outline: none;
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity .2s;
    cursor: pointer;
}

.control-group input[type="range"]:hover {
    opacity: 1;
}

/* Thumb (o "puxador" do slider) */
.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f1c40f;
    cursor: grab;
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f1c40f;
    cursor: grab;
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
}

/* Valor do slider */
.control-group #text-depth-value,
.control-group #emissive-intensity-value { /* Adicionado ID para o valor de intensidade */
    display: block;
    text-align: right;
    font-size: 0.9em;
    color: #bdc3c7;
    margin-top: -5px;
}


.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.action-button {
    padding: 12px 25px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 1em;
}

.action-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.action-button.primary {
    background-color: #3498db;
    color: white;
}

.action-button.primary:hover:not(:disabled) {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.action-button.success {
    background-color: #2ecc71;
    color: white;
}

.action-button.success:hover:not(:disabled) {
    background-color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#three-preview-container {
    flex: 2;
    min-width: 300px;
    height: 500px;
    background-color: #1a1a1a; /* Mantido escuro para a pré-visualização, a cor da cena será ajustada no JS */
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 10;
    gap: 15px;
}

.loading-overlay p {
    margin: 0;
    font-size: 1.2em;
}

.loading {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #f1c40f;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

.notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 25px;
    border-radius: 5px;
    font-weight: bold;
    z-index: 100;
    animation: fadeIn 0.3s;
}

.notification.error {
    background-color: #e74c3c;
    color: white;
}

.notification.success {
    background-color: #2ecc71;
    color: white;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* Novo estilo para o select de fonte */
.control-group select {
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #555;
    background-color: #4a647e; /* Fundo mais escuro para inputs */
    color: #ecf0f1;
    font-size: 1em;
    -webkit-appearance: none; /* Remove seta padrão do Chrome */
    -moz-appearance: none;    /* Remove seta padrão do Firefox */
    appearance: none;         /* Remove seta padrão geral */
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292%22%20height%3D%22292%22%3E%3Cpath%20fill%3D%22%23ecf0f1%22%20d%3D%22M287%2C197.319L146.001%2C56.32L5%2C197.319L36.319%2C228.638L146.001%2C118.956L255.681%2C228.638L287%2C197.319z%22%2F%3E%3C%2Fsvg%3E'); /* Seta customizada para o select */
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    cursor: pointer;
}

/* Responsividade */
@media (max-width: 768px) {
    .generator-container {
        flex-direction: column;
        align-items: center;
    }

    .controls-panel, #three-preview-container {
        width: 90%;
        max-width: none;
        min-width: unset;
    }
    
    #three-preview-container {
        height: 400px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    header, footer {
        padding: 15px;
    }
    
    h1 {
        font-size: 1.5em;
    }
    
    #three-preview-container {
        height: 300px;
    }
}