body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

#video-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

#background-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
}

#play-button-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 500px;
    z-index: 10;
}

#play-button-overlay h1 {
    font-size: 5vmin;
    text-align: center;
    font-family: 'Audiowide', sans-serif;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: transparent;
    -webkit-text-stroke: 1px #00FFFF;
    text-stroke: 1px #00FFFF;
    cursor: default;
}

#mobile-play-button {
    display: none; /* Hidden by default */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: #00FFFF;
    font-family: 'Audiowide', sans-serif;
    font-size: 6vmin;
    padding: 20px 40px;
    border: 2px solid #00FFFF;
    border-radius: 10px;
    cursor: pointer;
    z-index: 100; /* Very high z-index to be on top */
}

#oscilloscope {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    z-index: 5;
}

#links-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: flex-end;
    z-index: 20; /* Above everything else */
}

.link-item {
    color: transparent;
    -webkit-text-stroke: 1px #00FFFF;
    text-stroke: 1px #00FFFF;
    font-family: 'Audiowide', sans-serif;
    font-size: 3vmin;
    margin-bottom: 10px;
    cursor: pointer;
    transition: color 0.3s, text-shadow 0.3s;
}

.link-item:hover {
    color: #00FFFF;
    text-shadow: 0 0 5px #00FFFF, 0 0 10px #00FFFF;
}

#play-button-overlay h1.animate {
    animation: wireframe-fill-trail 3s ease-in-out forwards;
}

#play-button-overlay h1.animate-reverse {
    animation: wireframe-fill-trail-reverse 3s ease-in-out forwards;
}

@keyframes wireframe-fill-trail {
    0% {
        transform: translate(-50%, -50%) rotateY(0deg);
        -webkit-text-stroke-width: 1px;
        text-shadow: none;
        opacity: 1;
    }
    30% {
        transform: translate(-50%, -50%) rotateY(0deg);
        text-shadow: 0 0 5px #00FFFF, 0 0 10px #00FFFF;
    }
    50% {
        transform: translate(-50%, -50%) rotateY(180deg);
        text-shadow: 0 0 10px #00FFFF, 0 0 20px #00FFFF, 0 0 30px #00FFFF, 5px 5px 15px rgba(0, 255, 255, 0.3);
    }
    80% {
        transform: translate(-50%, -50%) rotateY(360deg);
        -webkit-text-stroke-width: 0.5px;
        text-shadow: 0 0 5px #00FFFF, 10px 10px 20px rgba(0, 255, 255, 0.1);
    }
    100% {
        top: calc(100% - 20px - (4 * 3vmin) - (4 * 10px) - 2vmin); /* Position above the links */
        left: calc(100% - 20px); /* Align with right edge of links container */
        transform: translate(-100%, -100%) rotateY(720deg); /* Adjust transform for alignment */
        font-size: 2vmin;
        -webkit-text-stroke-width: 0px;
        text-shadow: none;
        opacity: 0;
    }
}

@keyframes wireframe-fill-trail-reverse {
    0% {
        top: calc(100% - 20px - (4 * 3vmin) - (4 * 10px) - 2vmin); /* Position above the links */
        left: calc(100% - 20px); /* Align with right edge of links container */
        transform: translate(-100%, -100%) rotateY(720deg); /* Adjust transform for alignment */
        font-size: 2vmin;
        -webkit-text-stroke-width: 0px;
        text-shadow: none;
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -50%) rotateY(360deg);
        -webkit-text-stroke-width: 0.5px;
        text-shadow: 0 0 5px #00FFFF, 10px 10px 20px rgba(0, 255, 255, 0.1);
    }
    50% {
        transform: translate(-50%, -50%) rotateY(180deg);
        text-shadow: 0 0 10px #00FFFF, 0 0 20px #00FFFF, 0 0 30px #00FFFF, 5px 5px 15px rgba(0, 255, 255, 0.3);
    }
    70% {
        transform: translate(-50%, -50%) rotateY(0deg);
        text-shadow: 0 0 5px #00FFFF, 0 0 10px #00FFFF;
    }
    100% {
        transform: translate(-50%, -50%) rotateY(0deg);
        -webkit-text-stroke-width: 1px;
        text-shadow: none;
        opacity: 1;
    }
}

/* Media Queries for device-specific UI */
/* Hide mobile button on desktop */
@media (min-width: 768px) {
    #mobile-play-button {
        display: none;
    }
    #play-button-overlay h1 {
        display: block; /* Show desktop instruction */
    }
}

/* Hide desktop instruction on mobile */
@media (max-width: 767px) {
    #mobile-play-button {
        display: block; /* Show mobile button */
    }
    #play-button-overlay h1 {
        display: none; /* Hide desktop instruction */
    }

    /* Mobile specific styles for links container */
    #links-container {
        bottom: 120px; /* Above oscilloscope */
        right: 50%;
        transform: translateX(50%); /* Center horizontally */
        align-items: center; /* Center text items */
    }

    .link-item {
        font-size: 4vmin; /* Slightly larger for mobile */
        margin-bottom: 8px;
    }
}
