/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 优化移动端滚动 */
html {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: #ffffff;
    min-height: 100vh;
    color: var(--text-primary);
    font-size: 18px;
    line-height: 1.7;
    /* 优化文本渲染 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* 防止横向滚动 */
    overflow-x: hidden;
    width: 100%;
    /* 确保文字换行 */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    overflow-x: hidden;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

header h1 a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

header h1 a:hover {
    opacity: 0.8;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* 主内容区域 */
main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* 上传区域 */
.upload-section {
    background: var(--surface);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: 0.75rem;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    /* 触摸优化 */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f8fafc;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: #eff6ff;
    transform: scale(1.02);
}

.upload-content svg {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-hint {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

/* 演示区域 */
.demos-section {
    margin-bottom: 2rem;
}

/* 介绍说明区 */
.info-section {
    margin-bottom: 2rem;
}

.info-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 0;
}

.info-block {
    background: var(--surface);
    border-radius: 1rem;
    padding: 3rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    width: 100%;
}

.info-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.75rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.info-text {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.info-text strong {
    color: var(--primary-color);
    font-weight: 600;
}

.info-list {
    list-style: none;
    counter-reset: step-counter;
    padding-left: 0;
}

.info-list li {
    counter-increment: step-counter;
    position: relative;
    padding-left: 3rem;
    margin-bottom: 1.5rem;
    font-size: 1.125rem;
    line-height: 1.7;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.info-list li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.info-list li strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.feature-card {
    background: #f8fafc;
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.feature-text {
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--text-secondary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.feature-text strong {
    color: var(--primary-color);
}

/* Use Cases */
.use-cases {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.use-case {
    background: #f8fafc;
    border-radius: 0.75rem;
    padding: 1.5rem;
    border-left: 4px solid var(--primary-color);
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.use-case h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.use-case p {
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--text-secondary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.use-case p strong {
    color: var(--primary-color);
}

/* FAQ */
.faq-list {
    margin-top: 2rem;
}

.faq-item {
    background: #f8fafc;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color);
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.faq-question {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.faq-answer {
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.faq-answer strong {
    color: var(--primary-color);
}

.demos-container {
    text-align: center;
    padding: 3rem 0;
}

.demos-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.demos-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.demos-grid {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.demo-card {
    background: var(--surface);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    overflow: hidden;
    max-width: 100%;
}

.demo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.demo-card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.demo-card-description {
    color: var(--text-secondary);
    font-size: 1.0625rem;
    margin-bottom: 1.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.demo-images {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.demo-image-wrapper {
    flex: 1;
    position: relative;
    background: #f8fafc;
    border-radius: 0.5rem;
    overflow: hidden;
    max-width: 100%;
}

.demo-image {
    width: 100%;
    height: auto;
    min-height: 250px;
    max-height: 400px;
    max-width: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    display: block;
    background: #f1f5f9;
    transition: opacity 0.3s ease;
}

.demo-image:not([src]), 
.demo-image[src=""] {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.demo-image.loading {
    opacity: 0.6;
}

.demo-image.pixelated {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.demo-label {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.demo-arrow {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: bold;
    flex-shrink: 0;
}

/* 工作区域 */
.workspace-section {
    background: var(--surface);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.workspace-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

/* 预览区域（左侧） */
.preview-section {
    flex: 1;
    min-width: 0;
}

/* 控制面板（右侧） */
.controls-section {
    flex: 0 0 380px;
    width: 380px;
}

.controls-panel h2,
.preview-container h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 1.0625rem;
    font-weight: 500;
    color: var(--text-primary);
}

.control-value {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 600;
    min-width: 3rem;
    text-align: center;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
}

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;
    /* 触摸优化 */
    touch-action: none;
}

input[type="range"]::-webkit-slider-thumb:hover,
input[type="range"]::-webkit-slider-thumb:active {
    background: var(--primary-hover);
    transform: scale(1.1);
}

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);
    /* 触摸优化 */
    touch-action: none;
}

input[type="range"]::-moz-range-thumb:hover,
input[type="range"]::-moz-range-thumb:active {
    background: var(--primary-hover);
    transform: scale(1.1);
}

/* 按钮组 */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1.0625rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    /* 触摸优化 */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    min-height: 44px; /* iOS 推荐的最小触摸目标 */
    white-space: normal;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}


.image-info {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 0.5rem;
}

.canvas-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.75rem;
    min-height: 300px;
}

#canvas {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    display: block;
    margin: 0 auto;
}

.download-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.download-group .btn {
    width: 100%;
}

/* 页脚 */
footer {
    text-align: center;
    margin-top: 3rem;
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

/* 响应式设计 */

/* 平板尺寸（1024px 及以下） */
@media (max-width: 1024px) {
    .workspace-container {
        flex-direction: column;
    }

    .controls-section {
        flex: 1;
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
    }
    
    .preview-section {
        width: 100%;
    }
}

/* 小平板和大手机（768px 及以下） */
@media (max-width: 768px) {
    body {
        font-size: 17px;
    }

    .container {
        padding: 1rem;
        max-width: 100%;
    }

    header h1 {
        font-size: 2.25rem;
    }

    .subtitle {
        font-size: 1.125rem;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .workspace-section,
    .upload-section {
        padding: 1.5rem;
    }

    .workspace-container {
        gap: 1.5rem;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group .btn {
        width: 100%;
    }
    
    .controls-section {
        max-width: 100%;
    }
    
    /* 优化控制面板间距 */
    .control-group {
        margin-bottom: 1.25rem;
    }
    
    .controls-panel h2,
    .preview-container h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    /* 演示区响应式 */
    .demos-grid {
        gap: 1.5rem;
    }

    .demos-title {
        font-size: 2rem;
    }

    .demos-subtitle {
        font-size: 1.125rem;
        margin-bottom: 2rem;
    }

    .demo-card {
        padding: 2rem;
        max-width: 100%;
    }

    .demo-images {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .demo-image-wrapper {
        width: 100%;
        max-width: 100%;
    }

    .demo-arrow {
        transform: rotate(90deg);
        font-size: 1.25rem;
    }
    
    .demo-image {
        min-height: 200px;
    }

    /* Info Section 平板响应式 */
    .info-block {
        padding: 2rem;
        max-width: 100%;
    }

    .info-title {
        font-size: 1.75rem;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        width: 100%;
    }

    .feature-card {
        max-width: 100%;
    }

    .use-cases {
        grid-template-columns: 1fr;
    }
}

/* 手机尺寸（480px 及以下） */
@media (max-width: 480px) {
    body {
        font-size: 16px;
    }

    .container {
        padding: 0.75rem;
        max-width: 100%;
    }

    img {
        max-width: 100%;
        height: auto;
    }

    header {
        margin-bottom: 2rem;
        max-width: 100%;
    }

    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1.0625rem;
    }

    .workspace-section,
    .upload-section {
        padding: 1rem;
        border-radius: 0.75rem;
        max-width: 100%;
    }

    .demos-section,
    .info-section {
        max-width: 100%;
    }

    .workspace-container {
        gap: 1rem;
    }

    /* 优化上传区域 */
    .upload-area {
        padding: 1.5rem 1rem;
    }

    .upload-content svg {
        width: 48px;
        height: 48px;
    }

    .upload-text {
        font-size: 1.25rem;
    }

    .upload-hint {
        font-size: 1rem;
    }

    /* 优化按钮尺寸 */
    .btn {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    .button-group {
        gap: 0.5rem;
    }

    /* 优化控制面板 */
    .controls-panel h2,
    .preview-container h2 {
        font-size: 1.375rem;
        margin-bottom: 0.75rem;
    }

    .control-group {
        margin-bottom: 1rem;
    }

    .control-group label {
        font-size: 1rem;
    }

    .control-value {
        padding: 0.2rem 0.6rem;
        font-size: 0.9375rem;
        min-width: 2.5rem;
    }

    /* 优化滑块 */
    input[type="range"] {
        height: 6px;
    }

    input[type="range"]::-webkit-slider-thumb {
        width: 18px;
        height: 18px;
    }

    input[type="range"]::-moz-range-thumb {
        width: 18px;
        height: 18px;
    }

    /* 优化图片信息 */
    .image-info {
        font-size: 0.9375rem;
        padding: 0.5rem;
    }

    /* 优化canvas容器 */
    .canvas-wrapper {
        padding: 0.75rem;
        min-height: 200px;
    }

    #canvas {
        border-radius: 0.375rem;
    }

    /* 优化下载按钮 */
    .download-group {
        gap: 0.5rem;
    }

    .download-group .btn svg {
        width: 16px;
        height: 16px;
    }

    /* 优化页脚 */
    footer {
        margin-top: 2rem;
        padding: 1rem;
        font-size: 0.9375rem;
    }

    /* 演示区手机优化 */
    .demos-container {
        padding: 2rem 0;
    }

    .demos-title {
        font-size: 1.75rem;
    }

    .demos-subtitle {
        font-size: 1.0625rem;
        margin-bottom: 1.5rem;
    }

    .demos-grid {
        gap: 1.5rem;
    }

    .demo-card {
        padding: 1.5rem;
        max-width: 100%;
    }

    .demo-card-title {
        font-size: 1.375rem;
    }

    .demo-card-description {
        font-size: 1rem;
    }
    
    .demo-images {
        width: 100%;
        max-width: 100%;
    }

    .demo-image-wrapper {
        width: 100%;
        max-width: 100%;
    }

    .demo-image {
        min-height: 150px;
        width: 100%;
        max-width: 100%;
    }

    /* Info Section 手机响应式 */
    .info-container {
        padding: 1rem 0;
        max-width: 100%;
    }

    .info-block {
        padding: 1.5rem;
        max-width: 100%;
    }

    .info-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
        max-width: 100%;
    }

    .info-text {
        font-size: 1.0625rem;
    }

    .info-list li {
        padding-left: 2.5rem;
        font-size: 1.0625rem;
    }

    .info-list li::before {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.9375rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        width: 100%;
    }

    .feature-card {
        max-width: 100%;
    }

    .feature-icon {
        font-size: 2rem;
    }

    .feature-title {
        font-size: 1.125rem;
    }

    .feature-text {
        font-size: 1rem;
    }

    .use-case {
        padding: 1.25rem;
        max-width: 100%;
    }

    .use-case h3 {
        font-size: 1.125rem;
    }

    .use-case p {
        font-size: 1rem;
    }

    .faq-item {
        padding: 1.25rem;
        max-width: 100%;
    }

    .faq-question {
        font-size: 1.125rem;
    }

    .faq-answer {
        font-size: 1rem;
    }
}

/* 超小手机（360px 及以下） */
@media (max-width: 360px) {
    body {
        font-size: 15px;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.9375rem;
    }

    .controls-panel h2,
    .preview-container h2 {
        font-size: 1.25rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.workspace-section {
    animation: fadeIn 0.5s ease;
}

