body {
    font-family: 'Roboto', sans-serif;
    background-color: #f0f2f5;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

#app-container {
    background-color: #ffffff;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 700px;
    text-align: center;
    margin-top: 20px;
}

h1 {
    font-family: 'Merriweather', serif;
    color: #2c3e50;
    margin-bottom: 10px;
}

.subtitle {
    color: #7f8c8d;
    margin-bottom: 30px;
}

.hidden {
    display: none !important;
}

#image-upload-section {
    margin-bottom: 30px;
}

.upload-label {
    display: block;
    width: 100%;
    min-height: 200px;
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.3s, background-color 0.3s;
    position: relative;
    overflow: hidden;
    background-color: #f8f9fa;
}

.upload-label:hover {
    border-color: #3498db;
}

#upload-text {
    color: #7f8c8d;
    font-weight: bold;
}

#image-preview {
    max-width: 100%;
    max-height: 400px;
    border-radius: 6px;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#controls-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
    text-align: left;
}

@media (min-width: 600px) {
    #controls-section {
        grid-template-columns: 1fr 1fr;
    }
    .control-group.full-width, #generate-button {
        grid-column: span 2;
    }
}


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

.control-group.full-width {
    grid-column: span 1; /* Default for mobile */
}


label {
    margin-bottom: 8px;
    font-weight: bold;
    color: #34495e;
}

select, input[type="text"], textarea {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
}

textarea {
    resize: vertical;
    min-height: 60px;
}

.radio-group {
    display: flex;
    gap: 15px;
    align-items: center;
    background-color: #ecf0f1;
    padding: 10px;
    border-radius: 5px;
}

.radio-group label {
    font-weight: normal;
    margin-bottom: 0;
    cursor: pointer;
}

.radio-group input[type="radio"]:disabled + label {
    cursor: not-allowed;
    color: #bdc3c7;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #ecf0f1;
    padding: 10px;
    border-radius: 5px;
}

.checkbox-group label {
    font-weight: normal;
    margin-bottom: 0;
    cursor: pointer;
}

input[type="radio"], input[type="checkbox"] {
    cursor: pointer;
    transform: scale(1.1);
}

#generate-button {
    background-color: #3498db;
    color: white;
    padding: 15px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    width: 100%;
}

#generate-button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

#generate-button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    transform: translateY(0);
}

#story-output {
    text-align: left;
    margin-top: 20px;
    padding: 25px;
    background-color: #fdfdfd;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    line-height: 1.7;
    font-family: 'Merriweather', serif;
    white-space: pre-wrap;
    min-height: 100px;
}

#loader {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#error-message {
    color: #e74c3c;
    margin-top: 15px;
    font-weight: bold;
    background-color: #fadbd8;
    border: 1px solid #f1948a;
    padding: 10px;
    border-radius: 5px;
}