* {
    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;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 800px;
    width: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    font-size: 1.5rem;
}

.camera-container {
    position: relative;
    background: #000;
    min-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#video {
    width: 100%;
    height: auto;
    transform: scaleX(-1);
    display: block;
}

.status {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 10;
    transition: all 0.3s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.detection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 5;
}

.face-box {
    position: absolute;
    border: 3px solid #4caf50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
    border-radius: 10px;
    animation: pulse 1s ease-out;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        opacity: 1;
    }
    100% {
        transform: scale(1.05);
        opacity: 0;
    }
}

.preview {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: 10px;
    padding: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    max-width: 100px;
    z-index: 20;
    animation: fadeIn 0.5s ease-out;
    cursor: pointer;
    transition: transform 0.2s;
}

.preview:hover {
    transform: scale(1.05);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

#capturedImage {
    width: 100%;
    height: auto;
    border-radius: 5px;
    transform: scaleX(-1);
}

.preview-info {
    font-size: 10px;
    text-align: center;
    margin-top: 5px;
    color: #4caf50;
    font-weight: bold;
}

.info {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

.info p {
    margin: 10px 0;
    color: #6c757d;
    font-size: 14px;
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.flash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 9999;
    animation: flash 0.3s ease-out;
    pointer-events: none;
}

@keyframes flash {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@media (max-width: 600px) {
    .container {
        margin: 10px;
    }
    
    h1 {
        font-size: 1.2rem;
        padding: 15px;
    }
    
    .preview {
        max-width: 70px;
        bottom: 10px;
        right: 10px;
    }
    
    .info p {
        font-size: 12px;
    }
}