* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.step-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.step-section:hover {
    transform: translateY(-2px);
}

.step-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.upload-area {
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f7fafc;
}

.upload-area:hover {
    border-color: #667eea;
    background: #edf2f7;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #e6fffa;
}

.upload-placeholder svg {
    color: #a0aec0;
    margin-bottom: 15px;
}

.upload-placeholder p {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 5px;
}

.upload-placeholder span {
    color: #718096;
    font-size: 0.9rem;
}

.position-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
}

.selection-tip {
    font-size: 0.9rem;
    color: #4a5568;
    font-style: italic;
    flex-basis: 100%;
    text-align: center;
    margin-top: 5px;
}

.position-count {
    font-weight: 600;
    color: #4a5568;
}

.canvas-container {
    position: relative;
    display: inline-block;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    max-width: 100%;
}

#backgroundCanvas {
    display: block;
    max-width: 100%;
    height: auto;
    cursor: crosshair;
}

.position-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.position-marker {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #667eea;
    border: 3px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

.uploaded-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.uploaded-image {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.uploaded-image:hover {
    transform: scale(1.05);
}

.uploaded-image img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.uploaded-image .image-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px;
    font-size: 0.8rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.generate-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 8px;
}

.combination-info {
    background: #e6fffa;
    border: 2px solid #38b2ac;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.combination-info p {
    margin: 5px 0;
    color: #2d3748;
}

.combination-info strong {
    color: #38b2ac;
}

#combinationStatus {
    font-weight: 600;
    color: #4a5568;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 20px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
}

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

.generated-image {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.generated-image img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    margin-bottom: 10px;
}

.download-btn {
    width: 100%;
    padding: 8px 16px;
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.download-btn:hover {
    background: #38a169;
}

.batch-download-container {
    margin-bottom: 20px;
    text-align: center;
}

.btn-success {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    font-size: 1.1rem;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4);
    background: linear-gradient(135deg, #38a169, #2f855a);
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .step-section {
        padding: 20px;
    }
    
    .generate-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .size-controls {
        justify-content: center;
    }
}