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

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

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2em;
    margin-bottom: 10px;
}

header p {
    opacity: 0.9;
    font-size: 0.95em;
}

.device-selector {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.device-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background 0.3s;
}

.device-selector label:hover {
    background: #e9ecef;
}

.device-selector input[type="radio"] {
    cursor: pointer;
}

.input-section {
    padding: 30px;
}

.input-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: #f8f9fa;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

#image-url {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

#image-url:focus {
    outline: none;
    border-color: #667eea;
}

.upload-area {
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 15px;
}

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

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

.upload-area svg {
    color: #667eea;
    margin-bottom: 10px;
}

.upload-area p {
    color: #666;
}

.primary-btn, .secondary-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-btn {
    background: #f8f9fa;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.preview-section {
    padding: 0 30px 30px;
}

.preview-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.preview-section img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.prompt-section {
    padding: 0 30px 30px;
}

.prompt-section label {
    display: block;
    margin-bottom: 8px;
    color: #666;
    font-size: 0.9em;
}

#custom-prompt {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

#custom-prompt:focus {
    outline: none;
    border-color: #667eea;
}

.loading-section {
    padding: 30px;
    text-align: center;
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

#loading-text {
    color: #666;
    margin-bottom: 15px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
}

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

.output-section {
    padding: 30px;
    background: #f8f9fa;
}

.output-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.output-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 15px;
    min-height: 100px;
}

.error-section {
    padding: 20px 30px;
    background: #fee;
    border-left: 4px solid #f44336;
    margin: 0 30px 30px;
    border-radius: 4px;
}

#error-message {
    color: #d32f2f;
}

@media (max-width: 600px) {
    header h1 {
        font-size: 1.5em;
    }
    
    .container {
        border-radius: 0;
        box-shadow: none;
    }
    
    body {
        padding: 0;
    }
    
    .device-selector {
        flex-direction: column;
    }
    
    .device-selector label {
        width: 100%;
        justify-content: center;
    }
}