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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 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 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    padding: 30px;
}

h1 {
    text-align: center;
    color: #333;
    font-size: 2rem;
    margin-bottom: 30px;
    font-weight: 700;
}

h2 {
    color: #333;
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
}

/* 上传区域 */
.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    border: 3px dashed #ccc;
    border-radius: 15px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

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

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

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.upload-area p {
    font-size: 1.1rem;
    color: #666;
    margin: 0;
}

.image-preview {
    position: relative;
    margin-top: 20px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.image-preview img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    display: block;
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.remove-btn:hover {
    background: #ff4757;
    color: white;
    transform: scale(1.1);
}

/* 设置区域 */
.settings-section {
    background: #f8f9ff;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.setting-group:last-child {
    margin-bottom: 0;
}

label {
    font-weight: 600;
    color: #333;
    min-width: 80px;
}

select, input[type="number"], input[type="range"] {
    padding: 10px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    min-width: 80px;
}

input[type="range"] {
    padding: 5px;
    min-width: 120px;
    background: #f8f9ff;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

#qualityValue {
    font-weight: 600;
    color: #667eea;
    min-width: 40px;
    display: inline-block;
}

select:focus, input[type="number"]:focus, input[type="range"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.split-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

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

.split-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 结果区域 */
.results-section {
    margin-top: 30px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.result-item {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.result-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.result-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.result-image {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: default;
    transition: transform 0.2s ease;
}

.result-image:hover {
    transform: scale(1.02);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 60%, rgba(0, 0, 0, 0.8));
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
    pointer-events: none;
}

.result-item:hover .image-overlay {
    opacity: 1;
}

.image-number {
    align-self: flex-start;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    border-radius: 15px;
    padding: 5px 10px;
    font-size: 0.9rem;
    font-weight: 600;
}

.tap-hint {
    align-self: flex-end;
    background: rgba(76, 175, 80, 0.9);
    color: white;
    border-radius: 15px;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.result-item .download-btn {
    align-self: flex-end;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 8px 15px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    pointer-events: auto;
}

.result-item .download-btn:hover {
    background: #5a67d8;
    transform: scale(1.05);
}

.download-actions {
    text-align: center;
}

.download-all-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 107, 107, 0.3);
}

/* 加载动画 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading p {
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px;
        border-radius: 15px;
    }
    
    h1 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .upload-area {
        padding: 30px 15px;
    }
    
    .upload-icon {
        font-size: 2.5rem;
    }
    
    .settings-section {
        padding: 20px;
    }
    
    .setting-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    label {
        min-width: auto;
    }
    
    select, input[type="number"] {
        width: 100%;
    }
    
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .result-item img {
        height: 120px;
    }
}

@media (max-width: 480px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .container {
        padding: 15px;
    }
    
    .upload-area {
        padding: 25px 10px;
    }
    
    .settings-section {
        padding: 15px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .upload-area:hover {
        transform: none;
    }
    
    .split-btn:hover:not(:disabled) {
        transform: none;
    }
    
    .result-item:hover {
        transform: none;
    }
    
    .download-all-btn:hover {
        transform: none;
    }
}

/* 手机用户提示 */
.mobile-tip {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    color: white;
    text-align: center;
    box-shadow: 0 10px 25px rgba(76, 175, 80, 0.3);
}

.tip-content h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.tip-content p {
    margin: 5px 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.tip-content p:last-child {
    font-weight: 600;
    margin-top: 10px;
}

/* 图片浏览器 */
.image-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.image-counter {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

.close-viewer {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-viewer:hover {
    background: rgba(255, 255, 255, 0.3);
}

.viewer-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.prev-btn {
    left: 20px;
}

.next-btn {
    right: 20px;
}

.image-container {
    max-width: 90%;
    max-height: 80%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.viewer-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: default;
}

.image-tip {
    margin-top: 15px;
    color: white;
    font-size: 1rem;
    text-align: center;
    background: rgba(76, 175, 80, 0.8);
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
}

/* 移动设备优化 */
@media (max-width: 768px) {
    .viewer-header {
        padding: 10px 15px;
    }
    
    .nav-btn {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }
    
    .prev-btn {
        left: 15px;
    }
    
    .next-btn {
        right: 15px;
    }
    
    .image-container {
        max-width: 95%;
        max-height: 75%;
    }
    
    .image-tip {
        font-size: 0.9rem;
        padding: 8px 16px;
    }
} 