* {
    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: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

main {
    padding: 40px 30px;
}

.upload-section {
    margin-bottom: 30px;
}

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

.upload-area:hover {
    border-color: #764ba2;
    background: #f0f2ff;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #764ba2;
    background: #e8ebff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

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

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

.preview-section {
    margin-top: 30px;
    text-align: center;
}

.preview-image {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}

.preview-image img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-remove {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #ff4757;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

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

.btn-recognize {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-recognize:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);
}

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

.result-section {
    margin-top: 30px;
    padding: 30px;
    background: #f8f9ff;
    border-radius: 15px;
    border: 2px solid #e0e4ff;
}

.result-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.result-content {
    background: white;
    padding: 20px;
    border-radius: 10px;
    min-height: 100px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 1.1em;
    line-height: 1.8;
    color: #333;
    border: 1px solid #e0e0e0;
}

.result-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-copy, .btn-download, .btn-clear {
    padding: 10px 25px;
    border: none;
    border-radius: 25px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-copy {
    background: #4CAF50;
    color: white;
}

.btn-copy:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.btn-download {
    background: #2196F3;
    color: white;
}

.btn-download:hover {
    background: #0b7dda;
    transform: translateY(-2px);
}

.btn-clear {
    background: #ff9800;
    color: white;
}

.btn-clear:hover {
    background: #e68900;
    transform: translateY(-2px);
}

.loading {
    text-align: center;
    padding: 40px;
}

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

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

.loading p {
    color: #666;
    font-size: 1.1em;
}

.error {
    background: #ffebee;
    border: 2px solid #ffcdd2;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    text-align: center;
}

.error p {
    color: #c62828;
    font-size: 1.1em;
    font-weight: 600;
}

footer {
    background: #f5f5f5;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .upload-area {
        padding: 40px 15px;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .btn-copy, .btn-download, .btn-clear {
        width: 100%;
    }
}
