* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    flex: 1;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    background: #f8f9ff;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f0f2ff;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #764ba2;
    background: #e8ebff;
    transform: scale(1.02);
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.upload-area h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.upload-area p {
    color: #666;
    margin-bottom: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
    pointer-events: all;
    font-weight: 600;
}

.btn.primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn.secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn.secondary:hover {
    background: #667eea;
    color: white;
}

.btn.capture {
    background: #28a745;
    color: white;
    width: 100%;
    margin-top: 15px;
}

.btn.capture:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

video {
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
    display: block;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.image-preview {
    margin-bottom: 30px;
    text-align: center;
}

.image-preview h3 {
    margin-bottom: 15px;
    color: #333;
}

#previewImg {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.loading {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 10px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result-section {
    background: #f8f9ff;
    padding: 25px;
    border-radius: 15px;
    border-left: 5px solid #667eea;
}

.result-section h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.result-content {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    line-height: 1.6;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.result-content h1,
.result-content h2,
.result-content h3,
.result-content h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #333;
}

.result-content h1 { font-size: 1.5rem; }
.result-content h2 { font-size: 1.3rem; }
.result-content h3 { font-size: 1.1rem; }
.result-content h4 { font-size: 1rem; }

.result-content strong {
    color: #667eea;
    font-weight: 600;
}

.result-content ul,
.result-content ol {
    margin: 10px 0;
    padding-left: 20px;
}

.result-content li {
    margin: 5px 0;
}

.result-content hr {
    border: none;
    border-top: 2px solid #f0f0f0;
    margin: 20px 0;
}

.result-content code {
    background: #f8f9ff;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #667eea;
}

.question-section h4 {
    color: #333;
    margin-bottom: 15px;
}

.question-input {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#questionInput {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

#questionInput:focus {
    outline: none;
    border-color: #667eea;
}

.answer-content {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    line-height: 1.6;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-left: 5px solid #28a745;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.answer-content h1,
.answer-content h2,
.answer-content h3,
.answer-content h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #333;
}

.answer-content h1 { font-size: 1.5rem; }
.answer-content h2 { font-size: 1.3rem; }
.answer-content h3 { font-size: 1.1rem; }
.answer-content h4 { font-size: 1rem; }

.answer-content strong {
    color: #28a745;
    font-weight: 600;
}

.answer-content ul,
.answer-content ol {
    margin: 10px 0;
    padding-left: 20px;
}

.answer-content li {
    margin: 5px 0;
}

.answer-content hr {
    border: none;
    border-top: 2px solid #f0f0f0;
    margin: 20px 0;
}

.answer-content code {
    background: #f8fff8;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #28a745;
}

footer {
    text-align: center;
    margin-top: 30px;
    color: white;
    opacity: 0.8;
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    main {
        padding: 20px;
    }
    
    .upload-area {
        padding: 30px 20px;
    }
    
    .btn {
        width: 100%;
        margin: 5px 0;
    }
}
