/* Basic Styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #FFFACD; /* Lemon Chiffon - bright yellow */
    color: #333;
}

/* Gatekeeper */
.gatekeeper-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.gatekeeper-overlay.active {
    display: flex;
}
.gatekeeper-card {
    background: #fff;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 360px;
    text-align: center;
}
.gatekeeper-card input[type="tel"] {
    font-size: 1.25rem;
    letter-spacing: 0.4em;
    text-align: center;
}

header {
    background-color: #FF69B4; /* Hot Pink */
    padding: 1rem;
    text-align: center;
    color: white;
}

main {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

section {
    margin-bottom: 2rem;
    background-color: #FFFFFF; /* Minimal white card */
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

h1, h2 {
    color: #8A2BE2; /* Blue Violet - robust color */
    margin-top: 0;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1rem;
}

.controls input[type="text"],
.controls input[type="number"],
.controls input[type="tel"],
.controls input[type="range"] {
    flex-grow: 1;
    min-width: 200px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #e6e6e6;
    background: #fff;
}

.controls button,
.controls select,
.controls input[type="checkbox"] + label {
    /* Styles for buttons, select, and labels associated with checkboxes */
    padding: 12px 14px;
    border-radius: 999px; /* pill */
    border: 1px solid #e6e6e6;
    background-color: #00CED1; /* Dark Turquoise - robust color */
    color: white;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.controls button:hover,
.controls select:hover,
.controls input[type="checkbox"] + label:hover {
    background-color: #00BFFF; /* Deep Sky Blue */
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.controls select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    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.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M287%2C197.398L146.2%2C56.6C145.4%2C55.8%2C144.6%2C55.4%2C143.8%2C55.4s-1.6%2C0.4-2.4%2C1.2L5.4%2C197.398c-1.6%2C1.6-2.4%2C3.6-2.4%2C5.4s0.8%2C3.8%2C2.4%2C5.4l21.6%2C21.6c1.6%2C1.6%2C3.6%2C2.4%2C5.4%2C2.4c1.8%2C0%2C3.8-0.8%2C5.4-2.4l112-112l112%2C112c1.6%2C1.6%2C3.6%2C2.4%2C5.4%2C2.4c1.8%2C0%2C3.8-0.8%2C5.4-2.4l21.6-21.6c1.6-1.6%2C2.4-3.6%2C2.4-5.4S288.6%2C198.998%2C287%2C197.398z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 0.7em top 50%;
    background-size: 0.65em auto;
    padding-right: 2.5em; /* Space for the arrow */
    color: #333;
    background-color: white; /* Keep white for select background */
    border: 1px solid #e6e6e6;
}

.controls input[type="checkbox"] {
    margin-right: 5px; /* Space between checkbox and label */
}

.controls input[type="checkbox"] + label {
    background-color: #8A2BE2; /* Blue Violet for checkbox label */
    padding: 10px 15px;
    color: white;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    display: inline-block;
}

.controls input[type="checkbox"]:checked + label {
    background-color: #00BFFF; /* Deep Sky Blue when checked */
}

#image-preview img {
    max-width: 100%;
    height: auto;
    display: block;
    margin-top: 1rem;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.image-grid img {
    width: 100%;
    height: 150px; /* Fixed height for consistent grid */
    object-fit: cover; /* Cover the area, cropping if necessary */
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.image-grid img:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.image-grid img.selected {
    outline: 3px solid #8A2BE2;
    outline-offset: 2px;
}

/* Context Menu */
.context-menu {
    position: absolute;
    z-index: 1000;
    background: #fff;
    color: #333;
    border-radius: 10px;
    border: 1px solid #eee;
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
    min-width: 220px;
    overflow: hidden;
    display: none;
}

.context-menu ul {
    list-style: none;
    margin: 0;
    padding: 6px 0;
}

.context-menu li {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.context-menu li:hover {
    background: #F0F8FF;
}

.context-menu .section-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #777;
    padding: 8px 14px 4px 14px;
}

footer {
    background-color: #FF69B4; /* Hot Pink */
    padding: 1rem;
    text-align: center;
    color: white;
    margin-top: 2rem;
}

.error-banner {
    background: #FFEAEA;
    color: #A40000;
    border: 1px solid #FFC4C4;
    padding: 12px 14px;
    border-radius: 10px;
    margin: 10px 0 0 0;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
    }

    .controls input[type="text"],
    .controls button,
    .controls input[type="file"],
    .controls select {
        width: 100%;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .image-grid img {
        height: 120px;
    }

    /* Mobile friendliness for inputs */
    #prompt-input, #edit-prompt-input, #replace-prompt-input, #text-to-add-input,
    #style-input, #width-input, #height-input, #seed-input, #negative-input,
    #style-preset-input, #guidance-input {
        font-size: 16px; /* Prevent iOS zoom */
    }
}
