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

body {
    background-color: #000;
    overflow: hidden;
    font-family: 'Times New Roman', Times, Georgia, serif;
    --video-scale: 1.0;
    --video-offset-x: 0vw;
    --gradient-opacity: 0.3;

    /* Extend into iOS safe areas */
    padding: 0;
    margin: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    position: fixed;
}

#canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: block;
}

#fallback-video {
    position: fixed;
    top: 50%;
    left: calc(50% + var(--video-offset-x));
    transform: translate(-50%, -50%) scale(var(--video-scale));
    width: 100vw;
    height: auto;
    max-height: 100vh;
    max-height: 100dvh;
    display: none;
    object-fit: contain;
}

#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.loader {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #7CABFD;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.progress-text {
    color: #7CABFD;
    font-size: 18px;
    font-weight: 300;
    letter-spacing: 1px;
}

#progress {
    font-weight: 500;
    min-width: 3ch;
    display: inline-block;
}

/* Prevent text selection and touch callouts */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

#ios-permission {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
    color: #b2b7c0;
    font-size: 18px;
    letter-spacing: 2px;
}



/* Show/hide button text based on device */
.button-text-desktop {
    display: inline;
}

.button-text-mobile {
    display: none;
}

@media (max-width: 768px) {
    .button-text-desktop {
        display: none;
    }

    .button-text-mobile {
        display: inline;
    }
}

#gradient-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    pointer-events: none;
    z-index: 100;
    background: linear-gradient(to bottom,
            rgba(0, 0, 0, var(--gradient-opacity)) 0%,
            transparent 20%,
            transparent 80%,
            rgba(0, 0, 0, var(--gradient-opacity)) 100%);
}

/* iOS Safe Area Support */
@supports (padding: max(0px)) {
    body {
        /* Ensure content extends into safe areas */
        padding-top: 0;
        padding-bottom: 0;
        padding-left: 0;
        padding-right: 0;
    }

    #canvas,
    #loading,
    #ios-permission {
        /* Extend into safe areas on iOS */
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
    }

    #fallback-video {
        /* Video needs to maintain its centering transform, so only set dimensions */
        width: 100vw;
        max-height: 100vh;
        max-height: 100dvh;
    }

    #gradient-overlay {
        height: 100vh;
        height: 100dvh;
    }
}

.footer {
    position: fixed;
    bottom: 20px;
    right: 2rem;
    display: flex;
    gap: 20px;
    z-index: 200;
    pointer-events: auto;
}

.footer a {
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 300;
    letter-spacing: -0.2px;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.footer a:hover {
    opacity: 0.9;
}

.footer-center {
    position: fixed;
    width: 100%;
    pointer-events: auto;
    bottom: 70px;
    align-content: center;
    align-items: center;
    display: flex;
    flex-direction: column;
}

#countdown-timer {
    color: #fff;
    font-family: 'Times New Roman', Times, Georgia, serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 2rem;
    text-align: center;
}


/* Footer left for signup button */
.footer-left {
    position: fixed;
    bottom: 20px;
    left: 2rem;
    z-index: 200;
    pointer-events: auto;
}

.footer-left button {
    background: transparent;
    border: none;
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 300;
    letter-spacing: -0.2px;
    opacity: 1;
    cursor: pointer;
    transition: opacity 0.3s ease;
    font-family: 'Times New Roman', Times, Georgia, serif;
    padding: 0;
}

.footer-left button:hover {
    opacity: 0.7;
}

/* Footer social icons */
.footer-social {
    position: fixed;
    left: 2rem;
    bottom: 20px;
    display: flex;
    gap: 15px;
    z-index: 200;
    pointer-events: auto;
}

.footer-social a {
    color: #fff;
    opacity: 0.9;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-social a:hover {
    opacity: 1;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    padding: 1rem;
}

.modal-content {
    position: relative;
    background-color: #000000;
    border: 1px solid #6a9ae6;
    border-radius: 0px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 28px;
    color: #e6e6e6;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #666;
}

.modal-content h2 {
    font-family: 'Times New Roman', Times, Georgia, serif;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    margin: 0 0 1rem 0;
    line-height: 1.4;
}

.modal-content p {
    font-family: 'Times New Roman', Times, Georgia, serif;
    font-size: 14px;
    color: #d5d5d5;
    text-align: center;
    margin: 0 0 1.5rem 0;
    line-height: 1.6;
}


#signup-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#signup-form input[type="email"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #6a9ae6;
    border-radius: 0px;
    font-family: 'Times New Roman', Times, Georgia, serif;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background-color: #000;
    color: #fff;
}

#signup-form input[type="email"]:focus {
    outline: none;
    border-color: #7CABFD;
}

#signup-form input[type="email"]::placeholder {
    color: #999;
}

button {
    padding: 0.1rem 2rem;
    background-image: linear-gradient(to top, rgb(24, 38, 238), rgb(3, 6, 48), rgb(24, 38, 238));
    border: 4px solid #2464cc;
    color: #fff;
    border-radius: 0px;
    font-family: 'Times New Roman', Times, Georgia, serif;
    font-size: 18px;
    letter-spacing: 0.4px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.6s ease;
    box-shadow: 0 0 20px rgba(36, 100, 204, 0.6), 0 0 50px rgb(32, 104, 221);
}

#signup-form button[type="submit"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background-image: linear-gradient(to top, rgb(24, 38, 238), rgb(3, 6, 48), rgb(24, 38, 238));

    border: 3px solid #2464cc;

    color: #fff;
    border-radius: 0px;
    font-family: 'Times New Roman', Times, Georgia, serif;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#signup-form button[type="submit"]:hover {
    background-color: #6a9ae6;
}

#signup-form button[type="submit"]:disabled {
    background-color: #000;
    cursor: not-allowed;
}

.error-message {
    color: #e74c3c;
    font-family: 'Times New Roman', Times, Georgia, serif;
    font-size: 12px;
    text-align: center;
    margin-top: 0.5rem;
}

#modal-success h2 {
    color: #7CABFD;
    margin-bottom: 0.5rem;
}

/* Optimize for mobile */
@media (max-width: 768px) {
    body {
        -webkit-tap-highlight-color: transparent;
    }

    .footer-center {
        bottom: 100px;
    }

    #countdown-timer {
       padding: 0 1rem;
       margin: 1rem 0;
       z-index: 100;
    }

    .footer {
        bottom: 15px;
        gap: 15px;
        row-gap: 5px;
        flex-wrap: wrap;
        align-items: center;
        align-content: center;
        flex-direction: row;
        right: 0;
        left: 0;
        justify-content: center;
    }

    .footer a {
        font-size: 11px;
    }

    .footer-left {
        bottom: 15px;
        left: 1rem;
    }

    .footer-left button {
        font-size: 11px;
    }

    .footer-social {
        bottom: 60px;
        left: 0;
        right: 0;
        justify-content: center;
        flex-wrap: wrap;
        gap: 12px;
        padding: 0 1rem;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .modal-content h2 {
        font-size: 16px;
    }

    .modal-content p {
        font-size: 13px;
    }
}