:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-bg: #1e293b;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent-glow: #818cf8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

.background-glow {
    position: fixed;
    top: -20%;
    left: -20%;
    width: 140%;
    height: 140%;
    background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

.container {
    width: 90%;
    max-width: 600px;
    text-align: center;
    padding: 2rem;
}

/* Upload Section */
.upload-box {
    background: var(--glass-bg);
    border: 2px dashed var(--glass-border);
    border-radius: 20px;
    padding: 4rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: block;
}

.upload-box:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.3);
}

.upload-box .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-box h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.upload-box p {
    color: #64748b;
}

/* Processing Section */
.video-wrapper {
    position: relative;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
    margin-bottom: 1.5rem;
}

video {
    width: 100%;
    display: block;
    opacity: 0.6;
    /* Dimmed while processing */
}

canvas {
    display: none;
    /* Used for processing only */
}

.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 45%, var(--primary-color) 50%, transparent 55%);
    background-size: 100% 200%;
    animation: scan 2s linear infinite;
    opacity: 0.3;
    pointer-events: none;
}

@keyframes scan {
    0% {
        background-position: 0% -100%;
    }

    100% {
        background-position: 0% 200%;
    }
}

.status-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: #94a3b8;
}

.loader {
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-bottom-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Result Section */
.result-section {
    width: 100%;
    max-width: 1000px;
    /* Wider for gallery */
    margin: 0 auto;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.result-header h2 {
    margin: 0;
    font-size: 2rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.gallery-item {
    background: var(--glass-bg);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
    position: relative;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-color);
}

.gallery-item img {
    width: 100%;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
}

.btn.small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn {
    padding: 0.8rem 2rem;
    border-radius: 12px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn.primary {
    background: var(--primary-color);
    color: white;
}

.btn.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn.secondary {
    background: transparent;
    color: #94a3b8;
    border: 1px solid #334155;
}

.btn.secondary:hover {
    color: white;
    border-color: white;
}

.hidden {
    display: none !important;
}