/* --- Previous styles for body, background, top-menu, etc. remain the same --- */
/* Basic Reset & Defaults */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f4f8; /* Lighter, slightly bluish background */
    color: #333;
    line-height: 1.6;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

body {
    display: flex;
    flex-direction: column;
    position: relative; /* Needed for absolute positioning of background */
    min-height: 100%;
}

/* Background Prompts */
#background-prompts {
    position: fixed; /* Covers the whole viewport */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Behind everything */
    overflow: hidden; /* Hide prompts that go off-screen */
    pointer-events: none; /* Don't interfere with clicks */
}

.background-prompt {
    position: absolute;
    color: #d0d8e0; /* Light grey color */
    font-size: 1.5em; /* Example size, JS will vary */
    opacity: 0; /* Start hidden, JS will fade in/out */
    transition: opacity 1s ease-in-out; /* Smooth fade */
    white-space: nowrap; /* Prevent wrapping */
    user-select: none; /* Prevent accidental selection */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1); /* Subtle shadow for depth */
}


/* Top Menu Bar */
.top-menu {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 30px; /* Slightly more padding */
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    z-index: 10; /* Keep above background prompts */
    position: relative; /* Ensure it stays above potential fixed elements */
}

.ref-links a,
.social-icons a {
    color: #555;
    text-decoration: none;
    margin: 0 12px;
    transition: color 0.3s ease;
    font-size: 0.95em;
}

.social-icons a {
    font-size: 1.4em; /* Larger icons */
    margin: 0 8px;
}

/* YEPE-inspired hover color */
.ref-links a:hover,
.social-icons a:hover {
    color: #FFC107; /* YEPE Yellow */
}

/* Main Content Area */
.content-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    /* Remove justify-content: center to align items towards top */
    align-items: center; /* Center horizontally */
    padding: 30px 20px; /* Adjusted padding */
    text-align: center;
    z-index: 5;
    position: relative;
}

/* Image Previews Section Styling */
.image-previews-container {
    width: 90%;
    max-width: 750px;
    margin-bottom: 25px; /* Space before prompt display */
    text-align: left; /* Align title left */
}

.reference-title {
    font-size: 0.95em; /* Slightly larger title */
    font-weight: bold;
    color: #444;
    margin-bottom: 15px;
    text-align: center; /* Center title */
}

.previews-wrapper {
    display: flex;
    justify-content: center; /* Center items horizontally */
    align-items: flex-start; /* Align items to the top */
    gap: 30px; /* Space between preview items */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.preview-item {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center image and button vertically */
    text-align: center;
    width: 120px; /* Fixed width for preview item */
}

.reference-image-preview {
    width: 100%; /* Make image take full width of preview-item */
    height: 100px; /* Fixed height for previews */
    object-fit: contain; /* Scale image nicely within bounds */
    border: 2px solid #FFD54F; /* YEPE border */
    border-radius: 8px;
    margin-bottom: 10px; /* Space between image and button */
    background-color: #fff; /* White background behind transparent images */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.copy-button-small {
    padding: 5px 12px;
    font-size: 0.8em;
    color: #fff;
    background-color: #6c757d; /* Neutral grey */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    line-height: 1.2; /* Adjust line height */
}

.copy-button-small:hover {
    background-color: #5a6268;
}

/* Copy Feedback Message (Tiny Reference Links) */
.copy-feedback-tiny {
    display: block; /* Ensure it takes its own line */
    min-height: 15px; /* Reserve space */
    margin-top: 5px; /* Space above feedback */
    font-size: 0.75em;
    color: #E64A19; /* YEPE Orange/Red */
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    text-align: center; /* Center feedback text */
}


/* Prompt Display Div - Adjusted Margins */
#prompt-display {
    width: 90%;
    max-width: 750px;
    min-height: 100px;
    height: auto;
    padding: 20px;
    /* margin-bottom: 5px; -> Now handled by #copy-feedback margin */
    border: 2px solid #FFD54F;
    border-radius: 12px;
    font-size: 1.05em;
    line-height: 1.6;
    background-color: #fff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    overflow-wrap: break-word;
    color: #444;
    text-align: left;
}
#prompt-display:focus,
#prompt-display:hover {
    outline: none;
    border-color: #FFA000;
    box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.3);
}
#prompt-display:empty::before {
    content: "Click 'Generate Prompt' below...";
    color: #999;
    font-style: italic;
}

/* Copy Feedback Message (Main Prompt) */
.copy-feedback {
    width: 90%; /* Match width of prompt display */
    max-width: 750px;
    min-height: 20px;
    margin-top: 5px; /* Space below prompt display */
    margin-bottom: 25px; /* Space before Generate button */
    font-size: 0.9em; /* Slightly smaller */
    color: #E64A19;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    text-align: right; /* Align feedback to the right */
}

/* Generate Button - Adjusted Margins */
#generate-button {
    /* margin-top is now effectively set by .copy-feedback margin-bottom */
    padding: 15px 35px;
    font-size: 1.2em;
    font-weight: bold;
    color: #424242;
    background-color: #FFEB3B;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease, box-shadow 0.3s ease;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.15);
    letter-spacing: 0.5px;
}
#generate-button:hover {
    background-color: #FDD835;
    box-shadow: 0 7px 15px rgba(0, 0, 0, 0.2);
}
#generate-button:active {
    transform: scale(0.97);
    background-color: #FBC02D;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

/* Character Popup */
#character-popup {
    position: fixed;
    bottom: -350px; /* Start hidden below screen - Ensure this is large enough for tallest image */
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    max-height: 300px; /* Limit height */
    z-index: 20; /* Above everything */
    transition: bottom 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Bounce effect */
    pointer-events: none; /* Prevent interaction */
}

#character-popup img {
    display: block;
    width: 100%;
    height: auto; /* Maintain aspect ratio */
    max-height: 100%; /* Respect container max-height */
    object-fit: contain; /* Scale down large images */
    filter: drop-shadow(0px -4px 8px rgba(0,0,0,0.2)); /* Add a slight shadow */
}


/* Mobile Friendliness */
@media (max-width: 768px) {
    /* --- top-menu adjustments remain the same --- */
    .top-menu {
        flex-direction: column;
        align-items: center;
        padding: 15px 10px;
    }
    .ref-links, .social-icons {
        margin-bottom: 10px;
        text-align: center;
    }
    .social-icons {
        margin-bottom: 0;
    }

    /* Adjust preview item width and gap for mobile */
    .previews-wrapper {
        gap: 20px;
    }
    .preview-item {
        width: 100px; /* Smaller items on mobile */
    }
    .reference-image-preview {
        height: 80px; /* Smaller height */
    }

    #prompt-display {
        width: 95%;
        font-size: 1em;
        padding: 15px;
        min-height: 80px;
    }
    .copy-feedback {
        width: 95%;
        font-size: 0.85em;
        margin-bottom: 20px;
    }
    #generate-button {
        padding: 12px 30px;
        font-size: 1.1em;
    }

    #character-popup {
        width: 120px;
        max-height: 200px;
        bottom: -250px;
    }
}

@media (max-width: 480px) {
     /* --- top-menu social/ref link adjustments remain same --- */
    .ref-links a {
        margin: 0 8px;
        font-size: 0.9em;
    }
    .social-icons a {
        font-size: 1.3em;
        margin: 0 6px;
    }

    /* Further reduce preview item size and gap */
     .previews-wrapper {
        gap: 15px;
    }
    .preview-item {
        width: 90px;
    }
    .reference-image-preview {
        height: 70px;
    }
    .copy-button-small {
        font-size: 0.75em;
        padding: 4px 8px;
    }
     .copy-feedback-tiny {
        font-size: 0.7em;
        min-height: 12px;
    }

    #character-popup {
        width: 100px;
        max-height: 180px;
        bottom: -220px;
    }
}

/* --- Character Popup styles remain the same --- */