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

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

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

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

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

.subtitle {
    opacity: 0.9;
    font-size: 16px;
}

.search-box {
    margin-bottom: 30px;
}

#searchInput {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    background: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.app-item {
    background: white;
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.app-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.app-item img {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    margin-bottom: 10px;
    object-fit: cover;
    object-position: center center;
    background: white;
}

.app-item .app-name {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

/* Modal Styles */
.custom-modal, .result-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background: white;
    max-width: 500px;
    margin: 50px auto;
    border-radius: 20px;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    font-size: 28px;
    cursor: pointer;
    opacity: 0.8;
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 30px;
}

.preview-section {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

.preview-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-20%, -20%); }
}

.icon-wrapper {
    display: inline-block;
    position: relative;
    width: 100px;
    height: 100px;
    padding: 0;
    background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
    border-radius: 22px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    margin-bottom: 12px;
    overflow: hidden;
}

#previewIcon {
    width: 100px;
    height: 100px;
    display: block;
    object-fit: cover;
    object-position: center center;
    background: white;
}

#previewName {
    font-size: 14px;
    font-weight: 500;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.3px;
    margin-top: 8px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #666;
    font-size: 14px;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
}

.form-group input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #f8f9fa;
}

.help-text {
    margin-top: 10px;
    font-size: 12px;
    color: #999;
}

/* 图片选择按钮组 */
.image-source-buttons {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}

.source-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 10px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    color: #495057;
    font-weight: 500;
}

.source-btn:hover {
    background: #fff;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.source-btn:active {
    transform: translateY(0);
}

.source-btn .source-icon {
    font-size: 24px;
    margin-bottom: 5px;
    display: block;
}


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

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background: #f1f3f5;
    color: #666;
}

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

.btn-copy {
    background: #28a745;
    color: white;
}

.btn-copy:hover {
    background: #218838;
}

/* Result Modal Styles */
.success-preview {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
}

.success-icon-wrapper {
    display: inline-block;
    width: 80px;
    height: 80px;
    padding: 0;
    background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    margin-bottom: 12px;
    overflow: hidden;
}

#successIcon {
    width: 80px;
    height: 80px;
    display: block;
    object-fit: cover;
    object-position: center center;
    background: white;
}

#successName {
    font-size: 14px;
    font-weight: 500;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    margin-top: 8px;
}

.success-message {
    text-align: center;
    margin: 20px 0;
    color: #4CAF50;
    font-size: 1.1rem;
    font-weight: 500;
}

.url-section {
    margin-bottom: 25px;
}

.url-section label {
    display: block;
    margin-bottom: 8px;
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.url-input-group {
    display: flex;
    gap: 10px;
}

.url-input-group input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 14px;
    background: #f8f9fa;
}

.action-buttons {
    margin: 25px 0;
    text-align: center;
}

.btn-large {
    width: 100%;
    padding: 16px 24px;
    font-size: 18px;
    font-weight: 500;
    border-radius: 12px;
}

.btn-ios {
    background: linear-gradient(135deg, #007AFF 0%, #0051D5 100%);
}

.btn-android {
    background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
}

.instructions {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.instructions h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
    font-weight: 500;
}

#platformInstructions ol {
    padding-left: 20px;
    color: #666;
}

#platformInstructions li {
    margin-bottom: 10px;
    line-height: 1.6;
}

/* Toast Notification */
.success-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    min-width: 300px;
}

.success-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.toast-icon {
    font-size: 48px;
}

.toast-message h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 18px;
}

.toast-message p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 15px;
    }
    
    .app-item {
        padding: 15px 10px;
    }
    
    .app-item img {
        width: 50px;
        height: 50px;
    }
    
    .app-item .app-name {
        font-size: 12px;
    }
    
    .modal-content {
        margin: 20px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}