@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

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

body {
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    background-color: #000;
}

#container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* Base video feed from webcam */
.input_video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Mirror the video feed horizontally for intuitive interaction */
    transform: scaleX(-1);
}

/* ThreeJS overlay */
.output_canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let ThreeJS handle own raycasting internally if needed, but here we use MediaPipe coords */
}

/* UI Overlay styling - Premium Glassmorphism */
#ui_overlay {
    position: absolute;
    top: 24px;
    left: 24px;
    background: rgba(10, 15, 30, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 24px;
    color: white;
    z-index: 10;
    width: 340px;
    box-shadow: 
        0 20px 40px -10px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
}

h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #e0f2fe, #38bdf8, #818cf8);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 5s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 20px;
    line-height: 1.5;
    font-weight: 400;
}

#status {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 8px;
    background: rgba(234, 179, 8, 0.15);
    color: #fde047;
    border: 1px solid rgba(234, 179, 8, 0.3);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 24px;
    letter-spacing: 0.02em;
}

#status::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    margin-right: 8px;
    box-shadow: 0 0 8px currentColor;
}

.status-ready {
    background: rgba(34, 197, 94, 0.15) !important;
    color: #86efac !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
}

button {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(4px);
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

button:hover::before {
    left: 100%;
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Creator Header Button */
.creator-link {
    position: absolute;
    top: 36px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(115deg, #f9ce34 0%, #f77737 22%, #e1306c 48%, #833ab4 74%, #5851db 100%);
    background-size: 180% 180%;
    color: #fff;
    padding: 12px 28px;
    min-width: 220px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    z-index: 100;
    transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease, background-position 0.6s ease;
    box-shadow: 
        0 12px 26px rgba(131, 58, 180, 0.42),
        0 2px 0 rgba(255, 255, 255, 0.26) inset,
        0 -2px 0 rgba(0, 0, 0, 0.12) inset;
    letter-spacing: 0.11em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: creatorGradientShift 8s linear infinite;
}

.creator-link:hover {
    transform: translateX(-50%) translateY(-3px) scale(1.03);
    box-shadow: 
        0 18px 34px rgba(131, 58, 180, 0.54),
        0 2px 0 rgba(255, 255, 255, 0.34) inset,
        0 -2px 0 rgba(0, 0, 0, 0.15) inset;
    filter: brightness(1.05) saturate(1.15);
    background-position: 100% 50%;
}

.creator-link:active {
    transform: translateX(-50%) translateY(-1px) scale(1.01);
}

.creator-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.95);
    outline-offset: 3px;
}

.creator-link::before,
.creator-link::after {
    content: none !important;
}

@keyframes creatorGradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@media (max-width: 768px) {
    .creator-link {
        top: 22px;
        font-size: 0.8rem;
        min-width: 185px;
        padding: 10px 18px;
        letter-spacing: 0.08em;
    }
}
