:root {
    --base-mobile-size: 1rem;
    --nav-height: 80px;
    --nav-border: 1px;
    --z-nav: 1000;
    --z-mobile-menu: 999;
    --z-burger: 1002;
    --reference-width: 375px;
    --reference-height: 667px;
}

/* Mobile Navigation Styles */
@media screen and (max-width: 768px) {
    nav {
        position: fixed;
    nav {
        top: 0;
        left: 0;
        width: 100%;
        height: 80px;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(10px);
        z-index: 1000;
        transform: none;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        display: flex;
        justify-content: flex-start;
        padding: 0 20px; /* Increased padding */
        position: relative;
        will-change: transform;
        -webkit-transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        -webkit-perspective: 1000;
    }

    .logo-wrapper {
        grid-column: 1;
        padding-left: 5px;
        z-index: var(--z-nav);
    }

    .logo-container {
        margin-right: auto; /* Push everything else to the right */
        flex: 0 1 auto; /* Prevent flex growing */
    }

    .logo {
        position: absolute;
        left: 15px; /* Move slightly more to the right */
        top: 50%;
        transform: translateY(-50%);
        margin: 0;
        padding: 0;
        z-index: var(--z-nav);
        flex: 0 1 auto; /* Don't allow flex grow */
        display: flex;
        align-items: center;
        max-width: calc(100% - 60px); /* Give space for burger menu */
    }

    .logo a {
        text-decoration: none;
        font-weight: 900;
        font-size: 1.8rem; /* Increase font size */
        animation: rotateColors 8s linear infinite;
        text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.3);
        white-space: nowrap;
        padding: 0;
        margin: 0;
    }

    @keyframes rotateColors {
        0% { color: #00ffff; }    /* Cyan */
        12.5% { color: #ff0000; } /* Bright Red */
        25% { color: #00ff00; }   /* Bright Green */
        37.5% { color: #ff00ff; } /* Magenta */
        50% { color: #ffff00; }   /* Yellow */
        62.5% { color: #ff8c00; } /* Orange */
        75% { color: #9932ff; }   /* Purple */
        87.5% { color: #00bfff; } /* Deep Sky Blue */
        100% { color: #00ffff; }  /* Back to Cyan */
    }

    .nav-links {
        position: fixed;
        top: 75px;
        left: 0;
        width: 100%;
        height: calc(100vh - 75px);
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(10px);
        display: flex;
        flex-direction: column;
        align-items: stretch;
        padding: 2rem 0;
        margin: 0;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        z-index: 999;
        overflow-y: auto;
        will-change: transform;
        -webkit-transform: translateX(100%);
    }

    .nav-links.active {
        transform: translateX(0);
        -webkit-transform: translateX(0);
    }

    .nav-links > * {
        margin: 0;
        padding: 0.8rem 0;
        width: 100%;
    }

    .nav-links a {
        font-size: 1.8rem;
        padding: 0.8rem 2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.8rem;
        width: 100%;
        text-decoration: none;
    }

    .nav-links li {
        margin: 0;
        padding: 0;
    }

    .nav-links li.dropdown {
        margin: 0;
        padding: 0;
    }

    .nav-links .dropdown {
        padding: 0;
        margin: 0;
        width: 100%;
    }

    .nav-links .dropdown .nav-link {
        width: 100%;
        padding: 0.8rem 2rem;
        margin: 0;
    }

    .nav-links .dropdown .nav-link {
        margin: 0;
        padding: 0.8rem 2rem;
        width: 100%;
    }

    .nav-links a i {
        font-size: 1.6rem;
    }

    /* Remove any potential list styling */
    .nav-links ul, 
    .nav-links li {
        list-style: none;
        padding: 0;
        margin-top: -1vh;
    }

    .nav-links .back-button {
        margin-top: auto;
        padding-bottom: 2rem;
    }

    .nav-links .back-button a {
        color: #00ffff;
    }

    .mobile-burger {
        display: block;
        position: fixed; /* Change back to fixed */
        top: 26px;
        right: 25px; /* Move burger slightly left */
        margin-left: auto; /* Push to right */
        width: 32px;
        height: 30px;
        cursor: pointer;
        z-index: 1000;
    }

    .mobile-burger span {
        display: block;
        position: absolute;
        height: 3px;
        width: 100%;
        background: #00ffff;
        border-radius: 9px;
        opacity: 1;
        left: 0;
        transform: rotate(0deg);
        transition: .25s ease-in-out;
    }

    .mobile-burger span:nth-child(1) {
        top: 0px;
    }

    .mobile-burger span:nth-child(2) {
        top: 10px;
    }

    .mobile-burger span:nth-child(3) {
        top: 20px;
    }

    .mobile-burger.active span:nth-child(1) {
        top: 10px;
        transform: rotate(135deg);
    }

    .mobile-burger.active span:nth-child(2) {
        opacity: 0;
        left: -60px;
    }

    .mobile-burger.active span:nth-child(3) {
        top: 10px;
        transform: rotate(-135deg);
    }

    /* Mobile dropdown styles */
    .dropdown {
        margin: 0;
    }

    .dropdown-content {
        position: static;
        width: 100%;
        background: none;
        border: none;
        padding: 0;
        margin-top: 0;
    }

    .dropdown-content a {
        font-size: 1.8rem;
        padding: 0.8rem 2rem;
        justify-content: center;
    }

    .dropdown-content a i {
        font-size: 1.6rem;
    }
}

/* Add responsive adjustments for very small screens */
@media screen and (max-width: 360px) {
    .logo a {
        font-size: calc(var(--base-mobile-size) * 1.4);
    }
}

/* Additional breakpoint for very narrow screens */
@media screen and (max-width: 320px) {
    nav {
        padding: 0 calc((var(--reference-width) / 375) * 10px);
    }
    
    .logo a {
        font-size: calc(var(--base-mobile-size) * 1.3);
    }
}
}