* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 淡青色、淡粉色、白色、黑色配色方案 */
    --primary-color: #7dd3fc; /* 淡青色 */
    --primary-hover: #38bdf8;
    --secondary-color: #fbcfe8; /* 淡粉色 */
    --secondary-hover: #f9a8d4;
    --bg-color: #ffffff; /* 白色 */
    --card-bg: #ffffff;
    --text-primary: #000000; /* 黑色 */
    --text-secondary: #4b5563;
    --border-color: #e0e7ff; /* 淡青色边框 */
    --header-bg: #ffffff;
    --header-text: #000000;
    --accent-cyan: #a5f3fc; /* 更淡的青色 */
    --accent-pink: #fce7f3; /* 更淡的粉色 */
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-pink) 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 30px 40px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.header-content {
    text-align: center;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
    min-height: 50px;
}

.logo-img {
    max-height: 50px;
    max-width: 200px;
    height: auto;
    width: auto;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    /* 如果Logo是深色背景上的白色轮廓，取消下面的注释来反转颜色 */
    /* filter: invert(1) brightness(0.9) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1)); */
}

.logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 1px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.privacy-notice {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 12px;
    padding: 6px 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    display: inline-block;
}

main {
    padding: 30px 40px;
    background: var(--bg-color);
}

/* 上传区域 */
.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--card-bg);
}

.upload-area:hover {
    border-color: var(--primary-hover);
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-pink) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.upload-area.dragover {
    border-color: var(--primary-hover);
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-pink) 100%);
    transform: scale(1.01);
    box-shadow: var(--shadow);
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: var(--primary-color);
}

.upload-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* 选项区域 */
.options-section {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.options-section h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.3rem;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.option-item {
    background: var(--card-bg);
    padding: 18px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.option-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-pink) 100%);
}

.option-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 8px;
}

.option-item input[type="radio"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.option-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: 28px;
}

/* 参数控制区域 */
.params-section {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

.params-section h4 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.param-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.param-item label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.param-value {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.9rem;
}

.param-item input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.param-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.param-item input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: var(--primary-hover);
}

.param-item input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.param-item input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.1);
    background: var(--primary-hover);
}

.param-options {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.param-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.param-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--bg-color);
}

.param-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.param-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.btn-small {
    padding: 8px 20px;
    font-size: 0.9rem;
}

/* 处理控制区域 */
.process-controls {
    margin-top: 25px;
}

/* 进度条 */
.progress-container {
    margin-top: 20px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.progress-text span:first-child {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1rem;
}

/* 按钮样式 */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-primary);
    width: 100%;
    padding: 12px 24px;
    border: none;
    font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--secondary-hover) 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

/* 预览区域 */
.preview-section {
    margin-top: 30px;
}

.comparison-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.image-panel {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.image-panel h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
    text-align: center;
    font-size: 1.2rem;
}

.image-wrapper {
    position: relative;
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-wrapper img,
.image-wrapper canvas {
    max-width: 100%;
    max-height: 600px;
    object-fit: contain;
    border-radius: 10px;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.image-info {
    margin-top: 15px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    border: 1px solid var(--border-color);
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* 消息提示 */
.message {
    padding: 15px 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
    font-weight: 500;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #10b981;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

.message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 2px solid #3b82f6;
}

/* 页脚 */
footer {
    background: var(--card-bg);
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .comparison-container {
        grid-template-columns: 1fr;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-secondary {
        width: 100%;
    }
}

