:root {
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    --bg-main: hsl(229, 56%, 46%);
    --text-main: #333;
    --text-light: #666;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --box-shadow-inset: 0 2px 10px rgba(0, 0, 0, 0.1) inset;
    --bg-glass: rgba(255, 255, 255, 0.67);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font);
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    min-width: 320px;
    color: var(--text-main);
    line-height: 1.6;
    padding: 20px;
    background: linear-gradient(135deg, hsl(229, 76%, 66%) 0%, hsl(270, 37%, 46%) 100%) fixed;
}

.container {
    min-width: 320px;
    max-width: 1000px;
    margin: 0 auto;
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    background: linear-gradient(180deg, rgba(255, 255, 255, .6) 0%, rgba(255, 255, 255, 0.2) 100%);
}

@media (max-width: 400px) {
    body {
        padding: 0;
        background: var(--bg-main);
    }
    .container {
        border-radius: 0;
    }
}

h1 {
    text-align: center;
    color: #2c3e50;
}

h2 {
    margin-bottom: 10px;
    color: var(--text-light);
    font-size: 12px;
    font-weight: normal;
    text-align: center;
}

h2 a {
    color: inherit;
}

.drop-zone, .settings, .image-item {
    box-shadow: var(--box-shadow-inset);
    border-radius: 8px;
}

.drop-zone {
    border: 2px dashed #ccc;
    padding: 40px;
    text-align: center;
    margin-bottom: 20px;
    background-color: var(--bg-glass);
    transition: border-color 0.3s ease;
}

.drop-zone.active {
    border-color: #3498db;
    background-color: rgba(52, 152, 219, 0.05);
}

.drop-zone-prompt p {
    margin-bottom: 15px;
    color: var(--text-light);
}

button {
    padding: 12px 26px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    transition: 250ms ease-in-out;
    transition-property: box-shadow, transform, filter;
    box-shadow: rgba(255, 255, 255, 0.2) 0 1px 0 0 inset,
    rgba(0, 0, 0, 0.07) 0 1px 1px,
    rgba(0, 0, 0, 0.07) 0 2px 2px,
    rgba(0, 0, 0, 0.07) 0 4px 4px;
    color: #000;
    text-shadow: -1px 0 1px #B4E84E, 0 1px 1px #B4E84E, 1px 0 1px #B4E84E, 0 -1px 1px #B4E84E;
    background-image: linear-gradient(180deg, #B4E84E 0%, #8BB33D 100%);
    border: 1px solid #8BB33D;
}

button.download {
    background-image: linear-gradient(180deg, hsl(210, 90%, 73%) 0%, hsl(210, 84%, 64%) 100%);
    text-shadow: -1px 0 1px hsl(210, 90%, 73%), 0 1px 1px hsl(210, 90%, 73%), 1px 0 1px hsl(210, 90%, 73%), 0 -1px 1px hsl(229, 90%, 73%);
    border-color: hsl(210, 84%, 64%);
}

button.download-all {
    background-image: linear-gradient(180deg, hsl(270, 70%, 73%) 0%, hsl(270, 64%, 64%) 100%);
    text-shadow: -1px 0 1px hsl(270, 70%, 73%), 0 1px 1px hsl(270, 70%, 73%), 1px 0 1px hsl(270, 70%, 73%), 0 -1px 1px hsl(270, 70%, 73%);
    border-color: hsl(270, 64%, 64%);
}

button:hover {
    filter: brightness(1.1);
}

button:active {
    transform: scale(0.95);
}

button:disabled {
    background-image: linear-gradient(180deg, #9c9c9c 0%, #787878 100%);
    border-color: #787878;
    color: #666;
    text-shadow: -1px 0 1px #9c9c9c, 0 1px 1px #9c9c9c, 1px 0 1px #9c9c9c, 0 -1px 1px #9c9c9c;
    cursor: not-allowed;
    pointer-events: none;
}

.settings {
    background-color: var(--bg-glass);
    padding: 20px;
    margin-bottom: 20px;
}

.setting {
    margin-bottom: 15px;
}

.setting:last-child {
    margin-bottom: 0;
}

label {
    display: inline-block;
    margin-right: 10px;
    min-width: 100px;
}

input[type="range"],
input[type="number"] {
    background-color: var(--bg-glass);
    border-radius: 4px;
    padding: 5px;
    border: none;
}

input[type="range"] {
    max-width: 200px;
    vertical-align: middle;
}

input[type="number"] {
    width: 80px;
}

.resize-options {
    margin-top: 10px;
    padding-left: 20px;
}

.resize-options > div {
    margin-bottom: 10px;
}

.images-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.image-item {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-glass);
    position: relative;
}

.image-item img {
    width: 100%;
    height: auto;
    padding: 1em;
    flex-shrink: 0;
    display: block;
}

.image-info {
    flex: 1 1 auto;
    padding: 10px;
    overflow-y: auto;
}

.image-actions {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    padding: 10px;
}

.image-item button {
    width: 100%;
}

.actions {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
}

.images-container .loading {
    position: absolute;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

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

.footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-light);
    font-size: 14px;
}

.footer svg {
    height: 2em;
    filter: invert(1);
    transition: filter 250ms ease-in-out;
}

.footer svg:hover {
    filter: none;
}

/* Dark mode overrides */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-main: hsl(270, 37%, 46%);
        --text-main: #eee;
        --text-light: #aaa;
        --bg-glass: rgba(46, 46, 46, 0.67);
        --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        --box-shadow-inset: 0 2px 10px rgba(0, 0, 0, 0.3) inset;
    }

    h1 {
        color: #dcdcdc;
    }

    .container {
        background: linear-gradient(180deg, rgba(46, 46, 46, .8) 0%, rgba(46, 46, 46, .6) 100%);
    }

    .drop-zone {
        border-color: #555;
    }

    .drop-zone.active {
        border-color: #5dade2;
        background-color: rgba(93, 173, 226, 0.1);
    }

    input[type="range"],
    input[type="number"] {
        border-color: #555;
        color: #eee;
    }

    .image-info,
    .image-actions {
        color: #ddd;
    }

    .loading {
        background-color: rgba(30, 30, 30, 0.8);
    }

    .spinner {
        border-color: rgba(255, 255, 255, 0.1);
        border-top-color: #5dade2;
    }

    .footer svg {
        filter: none;
    }

    .footer svg:hover {
        filter: invert(1);
    }
}
