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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 50%, #8b1a2b 100%);
    min-height: 100vh;
}

.header {
    background: #dc3545;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.credits-display {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.credits-display svg {
    width: 18px;
    height: 18px;
    fill: #ffd700;
}

.header-icons {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-left: auto;
}

.logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 1px;
    white-space: nowrap;
    pointer-events: none;
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

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

.icon-btn svg {
    width: 20px;
    height: 20px;
    stroke: white;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

@media (max-width: 480px) {
    .logo {
        font-size: 22px;
        max-width: 50%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .header {
        padding: 12px 15px;
    }
    
    .credits-display {
        font-size: 12px;
        padding: 4px 8px;
        gap: 4px;
    }
    
    .credits-display svg {
        width: 14px;
        height: 14px;
    }
    
    .icon-btn {
        width: 24px;
        height: 24px;
        padding: 2px;
    }
    
    .icon-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .header-icons {
        gap: 6px;
    }
}

.hero-section {
    max-width: 900px;
    margin: 60px auto 40px;
    padding: 0 20px;
    text-align: center;
}

.hero-title {
    font-size: 48px;
    font-weight: 800;
    color: white;
    margin-bottom: 20px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 22px;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 40px;
    font-weight: 400;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.1);
}

.cta-text {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 30px;
    font-weight: 500;
}

.upload-zone {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 60px 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    margin: 0 auto;
    max-width: 700px;
    backdrop-filter: blur(10px);
}

.upload-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.7;
}

.upload-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
}

.upload-description {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    color: #333;
    margin-bottom: 30px;
    text-align: center;
    font-size: 28px;
}

.section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #555;
    margin-bottom: 12px;
}

.input-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #666;
    font-weight: 500;
}

input[type="text"],
input[type="file"],
textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.camera-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
    min-width: 150px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.preview-container {
    margin-top: 15px;
    text-align: center;
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 18px;
    }
    
    .upload-zone {
        padding: 40px 30px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 28px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    .cta-text {
        font-size: 16px;
    }
    
    .upload-zone {
        padding: 30px 20px;
    }
    
    .upload-title {
        font-size: 20px;
    }
}

#imagePreview {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

video {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hidden {
    display: none;
}

#result {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #333;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #667eea;
    font-weight: 600;
}

.error {
    background: #fee;
    border: 2px solid #fcc;
    color: #c33;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.info-text {
    font-size: 13px;
    color: #888;
    margin-top: 5px;
}

canvas {
    display: none;
}
