* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: #6e6e73;
    font-size: 1.1em;
}

.upload-zone {
    border: 2px dashed #c7c7cc;
    border-radius: 16px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
    margin-bottom: 24px;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.upload-icon {
    color: #667eea;
}

.upload-text {
    font-size: 1.15em;
    color: #1d1d1f;
}

.browse-link {
    color: #667eea;
    font-weight: 600;
    text-decoration: underline;
}

.upload-hint {
    font-size: 0.85em;
    color: #8e8e93;
}

.progress-area {
    text-align: center;
    padding: 24px 20px;
    color: #6e6e73;
    margin-bottom: 24px;
}

.progress-label {
    font-size: 0.95em;
    margin-bottom: 12px;
    color: #1d1d1f;
}

.progress-bar {
    width: 100%;
    max-width: 480px;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    margin: 0 auto;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 5px;
    transition: width 0.3s ease;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #6e6e73;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 0.95em;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.results-header h2 {
    font-size: 1.5em;
    font-weight: 600;
}

.count {
    color: #6e6e73;
    font-weight: 400;
    font-size: 0.85em;
}

.download-all-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.download-all-container select {
    padding: 8px 12px;
    border: 1px solid #d1d1d6;
    border-radius: 8px;
    font-size: 0.9em;
    background: #fff;
    cursor: pointer;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: #fff;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8em;
    background: #667eea;
    color: #fff;
    border-radius: 6px;
}

.btn-sm:hover {
    background: #5a6fd6;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.image-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.image-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.image-preview {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    background: #f0f0f0;
}

.image-info {
    padding: 12px 16px;
}

.image-meta {
    display: block;
    font-size: 0.8em;
    color: #6e6e73;
    margin-bottom: 10px;
}

.download-buttons {
    display: flex;
    gap: 6px;
}

@media (max-width: 640px) {
    .container {
        padding: 20px 16px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .upload-zone {
        padding: 40px 16px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .gallery {
        grid-template-columns: 1fr;
    }
}
