* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

main {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

.upload-section {
    margin-bottom: 30px;
}

.file-input-wrapper {
    position: relative;
    margin-bottom: 25px;
}

#fileInput {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 3px dashed #667eea;
    border-radius: 10px;
    background: #f8f9ff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-label:hover {
    border-color: #764ba2;
    background: #f0f2ff;
}

.file-icon {
    font-size: 2em;
    margin-right: 15px;
}

.file-text {
    font-size: 1.1em;
    color: #667eea;
    font-weight: 500;
}

.ratio-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 10px;
}

.ratio-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

#ratioInput {
    width: 100%;
    margin-bottom: 10px;
}

#ratioDisplay {
    font-size: 1.2em;
    font-weight: bold;
    color: #667eea;
    margin-left: 10px;
}

.ratio-section small {
    display: block;
    color: #666;
    margin-top: 5px;
}

.submit-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.submit-btn:hover {
    transform: translateY(-2px);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    margin-right: 10px;
    font-size: 1.2em;
}

.progress-section {
    margin-bottom: 30px;
    padding: 25px;
    background: #f8f9ff;
    border-radius: 10px;
}

.progress-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.progress-message {
    font-size: 1.1em;
    color: #333;
    margin-bottom: 10px;
}

.progress-time {
    font-size: 0.9em;
    color: #666;
}

.result-section {
    padding: 25px;
    background: #f0fff4;
    border-radius: 10px;
    border: 2px solid #4caf50;
}

.result-section h3 {
    color: #2e7d32;
    margin-bottom: 20px;
}

.result-info {
    margin-bottom: 20px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 10px;
    background: white;
    border-radius: 5px;
}

.stat-label {
    font-weight: 600;
    color: #333;
}

.stat-value {
    color: #2e7d32;
    font-weight: bold;
}

.download-btn {
    width: 100%;
    padding: 15px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-btn:hover {
    background: #45a049;
}

.error-section {
    padding: 25px;
    background: #ffebee;
    border-radius: 10px;
    border: 2px solid #f44336;
}

.error-section h3 {
    color: #c62828;
    margin-bottom: 15px;
}

.error-message {
    color: #d32f2f;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.retry-btn {
    padding: 10px 20px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

.retry-btn:hover {
    background: #d32f2f;
}

footer {
    text-align: center;
    color: white;
    opacity: 0.8;
}

.dev-tools {
    margin-bottom: 15px;
}

.dev-btn {
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s ease;
}

.dev-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* 模态框样式 */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    padding: 20px;
    background: #667eea;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

#logContent {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    main {
        padding: 20px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

.progress-controls {
    margin-top: 15px;
    text-align: center;
}

.stop-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.stop-btn:hover {
    background: linear-gradient(135deg, #ff5252, #d32f2f);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.stop-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}