/* ==================== 全局样式 ==================== */
* {
    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;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 头部 ==================== */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.95;
    font-weight: 500;
}

/* ==================== 主卡片 ==================== */
.main-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

/* ==================== 区块样式 ==================== */
.section {
    margin-bottom: 40px;
}

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

.section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-size: 1.2em;
    font-weight: 700;
    flex-shrink: 0;
}

.section-header h2 {
    font-size: 1.5em;
    color: #333;
    margin: 0;
}

/* ==================== 上传区域 ==================== */
.upload-area {
    border: 3px dashed #d0d0d0;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.upload-area:active {
    border-color: #764ba2;
    background: #e0e8ff;
    transform: scale(0.98);
}

.upload-area.dragover {
    border-color: #667eea;
    background: #e8f0ff;
    transform: scale(1.02);
}

.upload-content {
    pointer-events: none;
    user-select: none;
}

.upload-icon {
    width: 80px;
    height: 80px;
    color: #667eea;
    margin-bottom: 20px;
}

.upload-text {
    font-size: 1.3em;
    color: #333;
    font-weight: 600;
    margin-bottom: 10px;
}

.upload-hint {
    color: #666;
    font-size: 0.95em;
}

/* ==================== 图片预览 ==================== */
.image-preview-container {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.image-count {
    font-weight: 600;
    color: #667eea;
    font-size: 1.05em;
}

.btn-link {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.btn-link:hover {
    background: #f8d7da;
}

.image-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
    background: white;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    transition: all 0.3s ease;
}

.preview-item .remove-btn:hover {
    background: #dc3545;
    transform: scale(1.1);
}

/* ==================== 方向选择 ==================== */
.direction-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    max-width: 450px;
    margin: 0 auto;
}

.direction-option {
    cursor: pointer;
}

.direction-option input[type="radio"] {
    display: none;
}

.option-card {
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
    background: white;
}

.direction-option input[type="radio"]:checked + .option-card {
    border-color: #667eea;
    background: linear-gradient(135deg, #f0f4ff 0%, #f8f4ff 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.2);
}

.option-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.option-icon {
    width: 45px;
    height: 45px;
    color: #667eea;
    margin-bottom: 12px;
}

.option-label {
    font-size: 1.05em;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.option-desc {
    color: #666;
    font-size: 0.85em;
}

/* ==================== 按钮样式 ==================== */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 35px;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

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

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

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
}

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

/* ==================== 结果区域 ==================== */
.result-section {
    animation: slideIn 0.5s ease;
}

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

.canvas-container {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    text-align: center;
    overflow: auto;
}

#resultCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    background: white;
}

.result-info {
    margin-top: 15px;
    padding: 15px;
    background: #e7f3ff;
    border-left: 4px solid #667eea;
    border-radius: 8px;
    color: #004085;
    font-size: 0.95em;
}

/* ==================== 信息卡片 ==================== */
.info-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 20px;
}

.info-card h3 {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.4em;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.info-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.info-icon {
    font-size: 2.5em;
    flex-shrink: 0;
}

.info-content strong {
    display: block;
    color: #667eea;
    margin-bottom: 8px;
    font-size: 1.05em;
}

.info-content p {
    color: #555;
    line-height: 1.6;
    font-size: 0.95em;
}

/* ==================== 技术说明 ==================== */
.tech-info {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 20px;
}

.tech-info h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.tech-info ul {
    list-style: none;
    padding: 0;
}

.tech-info li {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    color: #555;
    line-height: 1.6;
}

.tech-info li:last-child {
    border-bottom: none;
}

.tech-info strong {
    color: #667eea;
    font-weight: 600;
}

/* ==================== 页脚 ==================== */
footer {
    text-align: center;
    color: white;
    padding: 20px;
    opacity: 0.95;
    font-size: 0.95em;
}

/* ==================== 加载状态 ==================== */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .main-card {
        padding: 25px;
    }
    
    .upload-area {
        padding: 40px 15px;
    }
    
    .upload-icon {
        width: 60px;
        height: 60px;
    }
    
    .direction-options {
        grid-template-columns: 1fr;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==================== 动画效果 ==================== */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.5s ease;
}

