:root {
    --primary-color: #6a5acd; /* SlateBlue */
    --primary-hover-color: #5a4ab9;
    --background-color: #f0f2f5;
    --card-background-color: #ffffff;
    --text-color: #333;
    --border-color: #d9d9d9;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 1rem;
}

#app-container {
    width: 100%;
    max-width: 600px;
    background-color: var(--card-background-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1.5rem;
    text-align: center;
}

header h1 {
    margin-bottom: 0.5rem;
    font-weight: 700;
}

header p {
    font-weight: 300;
    opacity: 0.9;
}

main {
    padding: 1.5rem;
}

#generator-ui {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

#prompt-input {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    resize: vertical;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#prompt-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(106, 90, 205, 0.2);
}

#generate-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 500;
    color: white;
    background-color: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

#generate-btn:hover {
    background-color: var(--primary-hover-color);
    transform: translateY(-2px);
}

#generate-btn:active {
    transform: translateY(0);
}

#generate-btn:disabled {
    background-color: #9e93d2;
    cursor: not-allowed;
    transform: none;
}

#progress-container {
    width: 100%;
    background-color: var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    height: 10px;
    margin-top: -0.5rem; /* Tucks it closer to the text area */
    margin-bottom: 0.5rem;
}

#progress-container.hidden {
    display: none;
}

#progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.2s ease-out;
}

#image-display-area {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #e9e9e9;
    border-radius: var(--border-radius);
    overflow: hidden;
}

#image-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
    transition: opacity 0.5s;
}

#image-wrapper.loading {
    opacity: 0.3;
}

#image-wrapper.placeholder #generated-image {
    opacity: 0.3;
}

#image-wrapper.placeholder #placeholder-text {
    display: block;
}

#placeholder-text {
    display: none;
    position: absolute;
    color: #888;
    padding: 1rem;
}

#generated-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.5s ease-in-out;
}

#loading-spinner {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

#loading-spinner.hidden {
    display: none;
}

.hidden {
    display: none;
}

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

#brainrot-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 15;
}

.brainrot-text {
    position: absolute;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff;
    white-space: nowrap;
    animation: fly-across 1.5s linear;
    will-change: transform;
}

@keyframes fly-across {
    from { transform: translateX(-100%); }
    to { transform: translateX(300px); } /* Adjust based on container width */
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
    body {
        padding: 0;
    }
    #app-container {
        border-radius: 0;
        min-height: 100vh;
        box-shadow: none;
    }
    main {
        padding: 1rem;
    }
    header {
        padding: 1rem;
    }
    header h1 {
        font-size: 1.5rem;
    }
}