* {
    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: #f5f7fa;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

header .subtitle {
    font-size: 16px;
    opacity: 0.85;
}

main {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 20px;
}

/* Upload Area */
.upload-area {
    border: 2px dashed #d0d5dd;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: #fff;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #667eea;
    background: #f0f1ff;
}

.upload-icon {
    color: #9ca3af;
    margin-bottom: 16px;
}

.upload-area.drag-over .upload-icon {
    color: #667eea;
}

.upload-text {
    font-size: 18px;
    color: #555;
    margin-bottom: 8px;
}

.upload-text .link {
    color: #667eea;
    text-decoration: underline;
}

.upload-hint {
    font-size: 13px;
    color: #9ca3af;
}

/* Preview Section */
.preview-section {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.filename {
    font-size: 14px;
    color: #666;
    word-break: break-all;
}

.btn-remove {
    background: none;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-remove:hover {
    border-color: #999;
    color: #333;
}

.preview-image {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    border-radius: 8px;
    background: #f9fafb;
    margin-bottom: 20px;
}

.btn-upload {
    display: block;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-upload:hover {
    opacity: 0.9;
}

.btn-upload:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.status-text {
    text-align: center;
    margin-top: 12px;
    font-size: 14px;
    color: #666;
}

.status-text.error {
    color: #e74c3c;
}

.status-text.success {
    color: #27ae60;
}

/* Result Section */
.result-section {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.result-section h2 {
    font-size: 22px;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #667eea;
}

.result-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 640px) {
    .result-layout {
        grid-template-columns: 1fr;
    }
}

.result-image-panel h3,
.result-text-panel h3 {
    font-size: 14px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.result-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    background: #f9fafb;
}

.ocr-result,
.analysis-result {
    background: #f9fafb;
    border-radius: 8px;
    padding: 20px;
    min-height: 120px;
    margin-bottom: 20px;
    font-size: 15px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}

.placeholder {
    color: #bbb;
    font-style: italic;
    text-align: center;
}

.action-bar {
    margin-top: 24px;
    text-align: center;
}

.btn-reset {
    background: #f0f0f0;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    padding: 12px 32px;
    font-size: 15px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset:hover {
    background: #e5e5e5;
    color: #333;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    margin-bottom: 12px;
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Footer */
footer {
    text-align: center;
    padding: 24px 20px;
    font-size: 13px;
    color: #999;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #d0d5dd;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
