* {
    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;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.screen {
    display: none;
    width: 100%;
    min-height: 100vh;
    padding: 20px;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Welcome Screen */
.welcome-container {
    text-align: center;
    background: white;
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
}

.logo {
    width: 200px;
    height: auto;
    margin-bottom: 30px;
}

.welcome-container h1 {
    color: #333;
    margin-bottom: 40px;
    font-size: 2em;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-capture {
    padding: 15px 40px;
    font-size: 18px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    margin-right: 15px;
}

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

.btn-capture {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-size: 20px;
    padding: 20px 60px;
    margin-top: 20px;
}

.btn-capture:hover {
    transform: scale(1.05);
}

/* Camera Screen */
.camera-container {
    text-align: center;
    max-width: 800px;
    width: 100%;
}

.video-wrapper {
    position: relative;
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

#video {
    width: 100%;
    height: auto;
    display: block;
    transform: scaleX(-1);
}

#canvas {
    display: none;
}

.countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 120px;
    color: white;
    font-weight: bold;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    display: none;
    animation: pulse 0.5s ease-in-out;
}

.countdown.active {
    display: block;
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* Preview Screen */
.preview-container {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 700px;
}

.preview-container h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2em;
}

#previewImage {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.preview-actions {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Effect Screen */
.effect-container {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
}

.effect-container h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2em;
}

.original-preview {
    margin-bottom: 30px;
}

#originalImage {
    max-width: 300px;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.effect-options {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.effect-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 40px 30px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.effect-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.effect-icon {
    font-size: 60px;
    margin-bottom: 15px;
}

.effect-card h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.5em;
}

.effect-card p {
    color: #666;
    font-size: 0.9em;
}

/* Processing Screen */
.processing-container {
    text-align: center;
    background: white;
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
}

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

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

.processing-container h2 {
    color: #333;
    margin-bottom: 15px;
}

.processing-container p {
    color: #666;
}

/* Final Screen */
.final-container {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 700px;
}

.final-container h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2em;
}

#finalImage {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.qr-section {
    margin: 30px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
}

.qr-instruction {
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 20px;
}

.qr-container {
    display: inline-block;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.qr-container img {
    display: block;
}

.final-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Error Screen */
.error-container {
    text-align: center;
    background: white;
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
}

.error-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.error-container h2 {
    color: #e74c3c;
    margin-bottom: 15px;
}

.error-container p {
    color: #666;
    margin-bottom: 30px;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .screen:not(#finalScreen) {
        display: none !important;
    }

    .qr-section,
    .final-actions,
    .final-container h2 {
        display: none !important;
    }

    .final-container {
        box-shadow: none;
        padding: 0;
    }

    #finalImage {
        max-width: 100%;
        box-shadow: none;
        margin: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .welcome-container,
    .preview-container,
    .effect-container,
    .final-container,
    .processing-container,
    .error-container {
        padding: 30px 20px;
    }

    .logo {
        width: 150px;
    }

    .welcome-container h1,
    .preview-container h2,
    .effect-container h2,
    .final-container h2 {
        font-size: 1.5em;
    }

    .btn-primary,
    .btn-secondary,
    .btn-capture {
        padding: 12px 30px;
        font-size: 16px;
    }

    .effect-options {
        flex-direction: column;
    }

    .countdown {
        font-size: 80px;
    }

    .final-actions {
        gap: 10px;
    }
}
