:root {
    --bg-color: #f9f9f9;
    --text-color: #1a1a1a;
    --sub-text-color: #4a4a4a;
    --accent-color: #000000;
    --glass-bg: rgba(249, 249, 249, 0.85);
    --glass-border: rgba(0, 0, 0, 0.08);
    --node-color: #1a1a1a;
    --line-color: rgba(0, 0, 0, 0.08);
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: var(--bg-color);
    font-family: 'Outfit', sans-serif;
    color: var(--text-color);
    cursor: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Grain Texture */
body::before {
    content: "";
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDAiIGhlaWdodD0iMjAwIj48ZmlsdGVyIGlkPSJub2lzZSI+PGZlVHVyYnVsZW5jZSB0eXBlPSJmcmFjdGFsTm9pc2UiIGJhc2VGcmVxdWVuY3k9IjAuNjUiIG51bU9jdGF2ZXM9IjMiIHN0aXRjaFRpbGVzPSJzdGl0Y2giLz48L2ZpbHRlcj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWx0ZXI9InVybCgjbm9pc2UpIiBvcGFjaXR5PSIwLjAzIi8+PC9zdmc+');
    opacity: 0.6;
    pointer-events: none;
    z-index: 9999;
    animation: grain 8s steps(10) infinite;
}

@keyframes grain {

    0%,
    100% {
        transform: translate(0, 0);
    }

    10% {
        transform: translate(-5%, -10%);
    }

    20% {
        transform: translate(-15%, 5%);
    }

    30% {
        transform: translate(7%, -25%);
    }

    40% {
        transform: translate(-5%, 25%);
    }

    50% {
        transform: translate(-15%, 10%);
    }

    60% {
        transform: translate(15%, 0%);
    }

    70% {
        transform: translate(0%, 15%);
    }

    80% {
        transform: translate(3%, 35%);
    }

    90% {
        transform: translate(-10%, 10%);
    }


}

/* Custom Cursor */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: exclusion;
    transition: transform 0.1s ease;
    will-change: transform;
}

canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}

/* Hide video but keep it playing for MediaPipe */
.input_video {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    z-index: -10;
}

#ui-layer {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    text-align: center;
    z-index: 1;
    pointer-events: none;
    /* mix-blend-mode: exclusion; Removed as it makes black text invisible on white bg */
    width: 100%;
    box-sizing: border-box;
}

h1 {
    font-weight: 700;
    font-size: 5rem;
    line-height: 1;
    letter-spacing: 0.05em;
    margin: 0;
    text-transform: uppercase;
    color: var(--text-color);
    opacity: 0;
    animation: textPulse 3s infinite ease-in-out, revealUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0s, 0.1s;
}

@keyframes textPulse {

    0%,
    100% {
        transform: scale(1);
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    }

    50% {
        transform: scale(1.02);
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    }
}

p {
    font-weight: 300;
    font-size: 1rem;
    letter-spacing: 0.5em;
    text-transform: uppercase;
    margin-top: 25px;
    opacity: 0.7;
    margin-bottom: 2rem;
    opacity: 0;
    animation: revealUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.3s;
}

@keyframes revealUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enter Button */
.btn-enter {
    display: inline-block;
    padding: 14px 32px;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-decoration: none;
    color: #fff;
    background: #111;
    border-radius: 999px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    pointer-events: auto;
    cursor: none;
}

.btn-enter.disabled {
    pointer-events: none;
    opacity: 0.4;
    filter: grayscale(1);
}

.btn-enter:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

#instructions {
    position: fixed;
    bottom: 30px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    opacity: 0.9;
    pointer-events: auto;
    z-index: 100;
    white-space: pre-wrap;
}

.btn-text {
    background: none;
    border: 1px solid rgba(0, 0, 0, 0.3);
    color: #111;
    padding: 8px 16px;
    margin-top: 10px;
    font-family: inherit;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 20px;
}

.btn-text:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: #000;
}

/* Custom Cursor managed by JS */
.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    background: rgba(100, 100, 100, 0.3);
    border: 1.5px solid rgba(80, 80, 80, 0.6);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9999;
    will-change: transform, width, height, border;
    transition: width 0.2s, height 0.2s, background 0.2s, box-shadow 0.2s, opacity 0.2s;
}

/* Double Ring style for Camera Mode */
.custom-cursor.camera-active {
    width: 30px;
    height: 30px;
    border: 2px solid #000;
    background: rgba(0, 0, 0, 0.1);
    /* Slight tint to see center */
    /* Create outer ring using box-shadow */
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.8), 0 0 0 6px #000;
}

@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.7;
    }
}

/* Modal Styles */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.modal.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-content {
    background: #111;
    padding: 3rem;
    border: 1px solid var(--glass-border);
    max-width: 500px;
    width: 90%;
    position: relative;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.95) translateY(20px);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

/* Subtle gradient border effect */
.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.modal.open .modal-content {
    transform: scale(1) translateY(0);
}

/* Image Wrapper */
.modal-image-wrapper {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem auto;
    border-radius: 50%;
    overflow: hidden;
    filter: grayscale(100%) contrast(1.2);
    /* Black and white style */
    transition: filter 0.3s ease;
}

.modal-image-wrapper:hover {
    filter: grayscale(0%) contrast(1);
}

.modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal h2 {
    font-size: 1.8rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
    color: white;
}

.modal .subtitle {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #888;
    margin-bottom: 2rem;
}

.modal p {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #ccc;
    text-transform: none;
    letter-spacing: 0.02em;
    margin-bottom: 2.5rem;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    border: 1px solid #111;
    color: #111;
    text-decoration: none;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    transition: all 0.3s ease;
    background: transparent;
}

.btn:hover {
    background: #111;
    color: white;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #666;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
}

.close-btn:hover {
    color: white;
}

.hidden {
    display: none !important;
}

/* Glow Effect - repurposed as a subtle ambient light if needed, or remove if cleaner without */
#glow-effect {
    display: none;
    /* Removed for cleaner look, replacing with cursor element */
}

/* Mobile Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2.2rem;
        letter-spacing: 0.03em;
    }

    p {
        font-size: 0.7rem;
        letter-spacing: 0.25em;
    }

    #ui-layer {
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        transform: translateY(-50%);
        width: 100%;
        text-align: center;
        padding: 0;
        margin: 0;
        box-sizing: border-box;
    }

    .btn-enter {
        padding: 12px 28px;
        font-size: 0.85rem;
    }

    #instructions {
        font-size: 0.55rem;
        letter-spacing: 0.1em;
        padding: 0 20px;
        bottom: 25px;
        line-height: 1.8;
    }

    .modal-content {
        padding: 2rem;
        width: 85%;
    }

    body {
        cursor: auto;
        /* Restore default cursor on touch */
    }

    body::after {
        display: none;
    }
}