:root {
    /* Frutiger Aero Palette & Effects */
    --primary-color: #00b2e3; /* Bright Cyan/Blue */
    --secondary-color: #6ccd00; /* Bright Green */
    --highlight-color: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.15);
    --text-color: #333;
    --placeholder-color: #888;
    --border-color: #a0ddeB; /* Light Blue-Gray */
    --background-start: #e0f7fa; /* Very Light Cyan */
    --background-end: #f1fff1; /* Very Light Greenish White */
    --card-background: rgba(255, 255, 255, 0.85); /* Semi-transparent white */
    --gloss-highlight: rgba(255, 255, 255, 0.6);
    --gloss-shadow: rgba(0, 0, 0, 0.1);
    --spinner-color: var(--primary-color);
    --error-color: #e53935; /* Red for errors */

    /* Custom Cursors - Frutiger Aero Style */
    --cursor-default: url('data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2732%27%20height%3D%2732%27%20viewBox%3D%270%200%2032%2032%27%20fill%3D%27none%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%3Cdefs%3E%3CradialGradient%20id%3D%27aero-blue-grad%27%20cx%3D%2750%25%27%20cy%3D%2730%25%27%20r%3D%2770%25%27%20fx%3D%2750%25%27%20fy%3D%2730%25%27%3E%3Cstop%20offset%3D%270%25%27%20stop-color%3D%27%23b3e5fc%27%2F%3E%3Cstop%20offset%3D%27100%25%27%20stop-color%3D%27%2300b2e3%27%2F%3E%3C%2FradialGradient%3E%3Cfilter%20id%3D%27aero-shadow%27%20x%3D%27-20%25%27%20y%3D%27-20%25%27%20width%3D%27140%25%27%20height%3D%27140%25%27%3E%3CfeDropShadow%20dx%3D%271.5%27%20dy%3D%272%27%20stdDeviation%3D%271.5%27%20flood-color%3D%27%23000%27%20flood-opacity%3D%270.2%27%2F%3E%3C%2Ffilter%3E%3ClinearGradient%20id%3D%27aero-gloss%27%20x1%3D%270%25%27%20y1%3D%270%25%27%20x2%3D%270%25%27%20y2%3D%27100%25%27%3E%3Cstop%20offset%3D%270%25%27%20stop-color%3D%27rgba(255%2C255%2C255%2C0.7)%27%2F%3E%3Cstop%20offset%3D%2750%25%27%20stop-color%3D%27rgba(255%2C255%2C255%2C0.3)%27%2F%3E%3Cstop%20offset%3D%27100%25%27%20stop-color%3D%27rgba(255%2C255%2C255%2C0.0)%27%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Cpath%20d%3D%27M6%203%20L6%2027%20L14%2020%20L18%2025%20L27%2016%20L22%2012%20Z%27%20fill%3D%27url(%23aero-blue-grad)%27%20stroke%3D%27%23007aa3%27%20stroke-width%3D%271%27%20filter%3D%27url(%23aero-shadow)%27%2F%3E%3Cpath%20d%3D%27M8%205%20Q%2014%204%2C%2020%208%20L%2023.5%2013.5%20L%2017%2019%20L%2014%2017%20L%208%2020%20Z%27%20fill%3D%27url(%23aero-gloss)%27%20style%3D%27pointer-events%3Anone%3B%27%2F%3E%3C%2Fsvg%3E') 6 3, auto;
    --cursor-pointer: url('data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2732%27%20height%3D%2732%27%20viewBox%3D%270%200%2032%2032%27%20fill%3D%27none%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%3Cdefs%3E%3CradialGradient%20id%3D%27aero-green-grad%27%20cx%3D%2750%25%27%20cy%3D%2730%25%27%20r%3D%2770%25%27%20fx%3D%2750%25%27%20fy%3D%2730%25%27%3E%3Cstop%20offset%3D%270%25%27%20stop-color%3D%27%23d1ffad%27%2F%3E%3Cstop%20offset%3D%27100%25%27%20stop-color%3D%27%236ccd00%27%2F%3E%3C%2FradialGradient%3E%3Cfilter%20id%3D%27aero-shadow-green%27%20x%3D%27-20%25%27%20y%3D%27-20%25%27%20width%3D%27140%25%27%20height%3D%27140%25%27%3E%3CfeDropShadow%20dx%3D%271.5%27%20dy%3D%272%27%20stdDeviation%3D%271.5%27%20flood-color%3D%27%23000%27%20flood-opacity%3D%270.2%27%2F%3E%3C%2Ffilter%3E%3ClinearGradient%20id%3D%27aero-gloss-green%27%20x1%3D%270%25%27%20y1%3D%270%25%27%20x2%3D%270%25%27%20y2%3D%27100%25%27%3E%3Cstop%20offset%3D%270%25%27%20stop-color%3D%27rgba(255%2C255%2C255%2C0.7)%27%2F%3E%3Cstop%20offset%3D%2750%25%27%20stop-color%3D%27rgba(255%2C255%2C255%2C0.3)%27%2F%3E%3Cstop%20offset%3D%27100%25%27%20stop-color%3D%27rgba(255%2C255%2C255%2C0.0)%27%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Cpath%20d%3D%27M6%203%20L6%2027%20L14%2020%20L18%2025%20L27%2016%20L22%2012%20Z%27%20fill%3D%27url(%23aero-green-grad)%27%20stroke%3D%27%234a9900%27%20stroke-width%3D%271%27%20filter%3D%27url(%23aero-shadow-green)%27%2F%3E%3Cpath%20d%3D%27M8%205%20Q%2014%204%2C%2020%208%20L%2023.5%2013.5%20L%2017%2019%20L%2014%2017%20L%208%2020%20Z%27%20fill%3D%27url(%23aero-gloss-green)%27%20style%3D%27pointer-events%3Anone%3B%27%2F%3E%3C%2Fsvg%3E') 6 3, pointer;
    --cursor-text: url('data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2732%27%20height%3D%2732%27%20viewBox%3D%270%200%2032%2032%27%20fill%3D%27none%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%3Cdefs%3E%3ClinearGradient%20id%3D%27aero-text-grad%27%20x1%3D%2750%25%27%20y1%3D%270%25%27%20x2%3D%2750%25%27%20y2%3D%27100%25%27%3E%3Cstop%20offset%3D%270%25%27%20stop-color%3D%27%23b3e5fc%27%2F%3E%3Cstop%20offset%3D%27100%25%27%20stop-color%3D%27%23009acd%27%2F%3E%3C%2FlinearGradient%3E%3Cfilter%20id%3D%27aero-text-shadow%27%20x%3D%27-50%25%27%20y%3D%27-50%25%27%20width%3D%27200%25%27%20height%3D%27200%25%27%3E%3CfeDropShadow%20dx%3D%271%27%20dy%3D%271.5%27%20stdDeviation%3D%271%27%20flood-color%3D%27rgba(0%2C0%2C0%2C0.25)%27%2F%3E%3C%2Ffilter%3E%3C%2Fdefs%3E%3Cpath%20d%3D%27M15.5%204%20L15.5%2028%20M12%204%20L19%204%20M12%2028%20L19%2028%27%20stroke%3D%27url(%23aero-text-grad)%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20filter%3D%27url(%23aero-text-shadow)%27%20%2F%3E%3Cpath%20d%3D%27M15.5%204%20L15.5%2028%20M12%204%20L19%204%20M12%2028%20L19%2028%27%20stroke%3D%27rgba(255%2C255%2C255%2C0.7)%27%20stroke-width%3D%270.5%27%20stroke-linecap%3D%27round%27%20%2F%3E%3C%2Fsvg%3E') 16 16, text;
    --cursor-loading: url('data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%2232%22%20height%3D%2232%22%20viewBox%3D%220%200%2032%2032%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22spinner-grad%22%20x1%3D%220%25%22%20y1%3D%220%25%22%20x2%3D%22100%25%22%20y2%3D%22100%25%22%3E%3Cstop%20offset%3D%220%25%22%20stop-color%3D%22%2300b2e3%22%2F%3E%3Cstop%20offset%3D%2250%25%22%20stop-color%3D%22%236ccd00%22%2F%3E%3Cstop%20offset%3D%22100%25%22%20stop-color%3D%22%2300b2e3%22%2F%3E%3C%2FlinearGradient%3E%3Cfilter%20id%3D%27spinner-shadow%27%20x%3D%27-20%25%27%20y%3D%27-20%25%27%20width%3D%27140%25%27%20height%3D%27140%25%27%3E%3CfeDropShadow%20dx%3D%271%27%20dy%3D%271.5%27%20stdDeviation%3D%271%27%20flood-color%3D%27rgba(0%2C0%2C0%2C0.2)%27%2F%3E%3C%2Ffilter%3E%3C%2Fdefs%3E%3Cg%20filter%3D%27url(%23spinner-shadow)%27%3E%3Cpath%20fill%3D%22none%22%20stroke%3D%22url(%23spinner-grad)%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-dasharray%3D%2240%2080%22%20d%3D%22M16%204%20A12%2012%200%201%201%2016%2028%20A12%2012%200%200%201%2016%204%22%3E%3CanimateTransform%20attributeName%3D%22transform%22%20attributeType%3D%22XML%22%20type%3D%22rotate%22%20from%3D%220%2016%2016%22%20to%3D%22360%2016%2016%22%20dur%3D%220.8s%22%20repeatCount%3D%22indefinite%22%2F%3E%3C%2Fpath%3E%3C%2Fg%3E%3C%2Fsvg%3E') 16 16, progress;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Common Frutiger Aero font */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(135deg, var(--background-start) 0%, var(--background-end) 100%);
    /* Optional: Add subtle background pattern */
    /* background-image: url('data:image/svg+xml,...'); */
    padding: 20px;
    box-sizing: border-box;
    cursor: var(--cursor-default); /* Apply default custom cursor */
}

body.loading {
    cursor: var(--cursor-loading);
}

body.loading * {
    cursor: var(--cursor-loading) !important; /* Use !important to override specific element cursors */
}

.container {
    background-color: var(--card-background);
    backdrop-filter: blur(10px); /* Glassmorphism effect */
    -webkit-backdrop-filter: blur(10px); /* Safari */
    padding: 30px; /* Slightly more padding */
    border-radius: 15px; /* More rounded */
    border: 1px solid rgba(255, 255, 255, 0.4); /* Subtle white border */
    box-shadow: 0 8px 25px var(--shadow-color), inset 0 1px 1px var(--gloss-highlight);
    width: 100%;
    max-width: 600px;
    text-align: center;
    margin-top: 30px; /* More spacing */
    transition: all 0.3s ease;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 25px;
    font-size: 2em; /* Larger heading */
    font-weight: 600;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.7); /* Subtle text highlight */
}

.input-group {
    display: flex;
    gap: 12px;
    align-items: center; /* Vertically align items */
}

.style-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: -10px 0 25px 0; /* Positioned between input and image container */
}

.style-toggle-text {
    font-size: 0.9em;
    color: var(--text-color);
    font-weight: 500;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
    user-select: none;
}

.style-toggle-checkbox {
    display: none;
}

.style-toggle-label {
    display: flex;
    align-items: center;
    width: 50px;
    height: 28px;
    background-color: #ccc;
    border-radius: 14px;
    position: relative;
    cursor: var(--cursor-pointer);
    transition: background-color 0.3s ease;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.style-toggle-inner {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 14px;
    transition: background-color 0.3s ease;
}

.style-toggle-switch {
    position: absolute;
    left: 3px;
    width: 22px;
    height: 22px;
    background-color: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.style-toggle-checkbox:checked + .style-toggle-label .style-toggle-inner {
    background-color: var(--secondary-color);
}

.style-toggle-checkbox:checked + .style-toggle-label .style-toggle-switch {
    transform: translateX(22px);
}

.count-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0 12px;
    box-shadow: inset 0 2px 4px var(--gloss-shadow);
    transition: all 0.3s ease;
    position: relative;
    padding-right: 35px; /* Space for arrow */
}

.count-selector:focus-within {
    outline: none;
    border-color: var(--primary-color);
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: inset 0 2px 4px var(--gloss-shadow), 0 0 0 3px rgba(0, 178, 227, 0.3);
}

.count-selector::after {
    content: '';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-color);
    pointer-events: none;
    transition: all 0.2s ease;
}

.count-selector:hover::after {
    border-top-color: var(--primary-color);
}

.count-selector label {
    font-size: 0.9em;
    color: var(--text-color);
    font-weight: 500;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}

#image-count {
    background: transparent;
    border: none;
    font-size: 1em;
    color: var(--text-color);
    padding: 14px 0;
    cursor: var(--cursor-pointer);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    font-family: inherit;
    font-weight: 600;
}

input[type="text"] {
    flex-grow: 1;
    padding: 14px 18px; /* Slightly larger */
    border: 1px solid var(--border-color);
    border-radius: 10px; /* More rounded */
    font-size: 1em;
    color: var(--text-color);
    background-color: rgba(255, 255, 255, 0.7); /* Slightly transparent white */
    box-shadow: inset 0 2px 4px var(--gloss-shadow); /* Inner shadow */
    transition: all 0.3s ease;
    cursor: var(--cursor-text); /* Apply custom text cursor */
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: inset 0 2px 4px var(--gloss-shadow), 0 0 0 3px rgba(0, 178, 227, 0.3); /* Focus ring */
    /* Cursor is already set in the base style */
}

input[type="text"]::placeholder {
    color: var(--placeholder-color);
}

button {
    padding: 14px 25px; /* Match input height */
    background: linear-gradient(to bottom, #8eed52, #63c428); /* Green Gradient */
    color: white;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-top-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px; /* Match input */
    cursor: var(--cursor-pointer); /* Apply pointer custom cursor */
    font-size: 1em;
    font-weight: 600; /* Bolder */
    text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.25); /* Text shadow for depth */
    box-shadow: 0 3px 5px var(--shadow-color), inset 0 1px 0 var(--gloss-highlight); /* 3D effect */
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative; /* For gloss overlay */
    overflow: hidden;
}

/* Gloss Effect */
button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 60%; /* Cover top part */
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.0) 100%);
    border-radius: 10px 10px 50% 50% / 10px 10px 5px 5px; /* Shaped gloss */
    transition: opacity 0.2s ease;
    pointer-events: none;
}

button:hover:not(:disabled) {
    background: linear-gradient(to bottom, #9cf361, #6fd131); /* Lighter green on hover */
    box-shadow: 0 5px 8px rgba(0, 0, 0, 0.2), inset 0 1px 0 var(--gloss-highlight);
    transform: translateY(-1px);
}

button:hover:not(:disabled)::before {
    opacity: 0.8;
}

button:active:not(:disabled) {
    background: linear-gradient(to bottom, #63c428, #8eed52); /* Invert gradient */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 1px 2px rgba(0, 0, 0, 0.1);
    transform: translateY(1px);
}

button:active:not(:disabled)::before {
    opacity: 0.3;
}

button:disabled {
    opacity: 0.6;
    cursor: var(--cursor-default); /* Use default cursor when disabled */
    background: linear-gradient(to bottom, #cccccc, #aaaaaa); /* Grey gradient when disabled */
    box-shadow: 0 2px 3px var(--shadow-color), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

button:disabled::before {
    opacity: 0.2;
}

#image-container {
    margin-top: 30px;
    border: 1px solid var(--border-color);
    padding: 10px; /* Padding around image */
    background-color: rgba(255, 255, 255, 0.6); /* Slightly transparent white */
    border-radius: 12px; /* Rounded */
    min-height: 250px; /* Increased height */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    align-content: flex-start;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 5px var(--gloss-shadow); /* Inner shadow */
}

/* When placeholder is showing, use flex to center it */
#image-container.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

#image-container img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    object-fit: cover;
    background-color: #eee;
    box-shadow: 0 2px 4px var(--shadow-color);
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

#generated-image {
    display: none; /* Hide old single image element */
}

.spinner {
    border: 5px solid rgba(0, 0, 0, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border-left-color: var(--spinner-color);
    animation: spin 1s linear infinite; /* Use linear for smoother spin */
    position: absolute;
    display: none;
}

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

.placeholder-text {
    display: none;
    color: var(--placeholder-color);
    font-style: normal; /* Remove italic */
    font-size: 1.1em;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

#image-container.is-empty .placeholder-text {
    display: block;
}

.error-message {
    color: var(--error-color);
    background-color: rgba(229, 57, 53, 0.1); /* Light red background */
    border: 1px solid var(--error-color);
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 0.9em;
    display: none;
    text-shadow: none;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .container {
        padding: 20px;
        margin-top: 15px;
    }
    h1 {
        font-size: 1.6em;
    }
    .input-group {
        flex-direction: column;
        gap: 15px; /* More gap on mobile */
    }
    .style-toggle-container {
        margin-top: 15px;
        margin-bottom: 20px;
    }
    input[type="text"], .count-selector {
        width: 100%;
        box-sizing: border-box;
    }
    button {
        width: 100%;
        padding: 12px 20px;
    }
    #image-container {
        min-height: 200px;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    .placeholder-text {
        font-size: 1em;
    }
}