/* Terminal Theme Styles */
:root {
    --neon-green: #00ff41;
    --terminal-black: #121212;
}

body {
    background-color: var(--terminal-black);
    color: var(--neon-green);
    font-family: 'Courier New', monospace;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Enhanced main content area */
main {
    background: linear-gradient(to bottom, 
        rgba(10, 10, 10, 0.3) 0%, 
        rgba(10, 10, 10, 0.6) 50%, 
        rgba(10, 10, 10, 0.3) 100%);
    position: relative;
}

/* Hero section styling */
main > div > div:first-child {
    background: rgba(10, 10, 10, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    margin: 1rem 0;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        inset 0 0 20px rgba(0, 255, 65, 0.05),
        0 0 30px rgba(0, 255, 65, 0.1);
    border: 1px solid rgba(0, 255, 65, 0.2);
}

/* Binary Rain Background Canvas */
#binary-rain-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.8;
    filter: none;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    transform: perspective(1200px) rotateX(12deg) scale(1.15);
    transform-origin: center center;
    will-change: transform;
}

/* Ensure content is above background */
body {
    position: relative;
    z-index: 0;
}

nav,
main,
footer,
.container {
    position: relative;
    z-index: 10;
}

/* Content background overlays for better readability */
.terminal-border,
article {
    background: rgba(10, 10, 10, 0.9) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
}

.terminal-glow {
    text-shadow: 0 0 10px var(--neon-green), 0 0 20px var(--neon-green), 0 0 30px var(--neon-green);
}

.terminal-border {
    border: 2px solid var(--neon-green);
    box-shadow: 
        0 0 10px var(--neon-green), 
        inset 0 0 10px rgba(0, 255, 65, 0.1),
        0 4px 20px rgba(0, 0, 0, 0.5);
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 4px;
}

.terminal-button {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--neon-green);
    color: var(--neon-green);
    background-color: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 
        0 0 10px rgba(0, 255, 65, 0.5),
        0 4px 15px rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    font-weight: bold;
}

.terminal-button:hover:not(:disabled) {
    background-color: var(--neon-green);
    color: var(--terminal-black);
    box-shadow: 
        0 0 20px var(--neon-green), 
        0 0 30px var(--neon-green),
        0 6px 20px rgba(0, 255, 65, 0.4);
    transform: translateY(-2px);
}

.terminal-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.terminal-input {
    background-color: var(--terminal-black);
    border: 2px solid var(--neon-green);
    color: var(--neon-green);
    padding: 0.5rem 1rem;
    font-family: 'Courier New', monospace;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}

.terminal-input:focus {
    outline: none;
    box-shadow: 0 0 15px var(--neon-green);
}

/* Attractive Custom Cursor for Text Inputs */
.terminal-input,
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    caret-color: var(--neon-green);
    /* Enhanced cursor visibility with glow */
    text-shadow: 0 0 3px rgba(0, 255, 65, 0.5);
    /* Smooth cursor appearance */
    transition: caret-color 0.2s ease;
}

/* Cursor pulse animation for better visibility */
@keyframes cursor-pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 8px var(--neon-green), 0 0 16px var(--neon-green);
    }
    50% {
        opacity: 0.7;
        box-shadow: 0 0 12px var(--neon-green), 0 0 24px var(--neon-green);
    }
}

/* Enhanced cursor for mobile devices */
@media (max-width: 768px) {
    .terminal-input,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea {
        caret-color: var(--neon-green);
        /* Ensure cursor is visible on mobile */
        -webkit-tap-highlight-color: rgba(0, 255, 65, 0.3);
    }
    
    /* Larger, more visible cursor on mobile when focused */
    .terminal-input:focus,
    input[type="text"]:focus,
    input[type="email"]:focus,
    input[type="password"]:focus,
    textarea:focus {
        caret-color: var(--neon-green);
    }
    
    /* Mobile Navigation Styles */
    #nav-links {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        z-index: 1000;
        margin: 0;
        padding: 5rem 1.25rem 2.5rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 1.25rem;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        height: 100vh;
        overflow-y: auto;
    }
    
    #nav-links:not(.hidden) {
        transform: translateX(0);
    }
    
    #nav-links .nav-link {
        width: 100%;
        max-width: 19rem;
        text-align: center;
        padding: 1rem 1.5rem;
        font-size: 1.125rem;
        border: 0.125rem solid var(--neon-green);
        border-radius: 0.5rem;
        background: rgba(0, 255, 65, 0.1);
        transition: all 0.3s ease;
        margin: 0.5rem 0;
        min-height: 3rem;
    }
    
    #nav-links .nav-link:hover,
    #nav-links .nav-link:focus {
        background: rgba(0, 255, 65, 0.2);
        transform: translateY(-2px);
        box-shadow: 0 4px 20px rgba(0, 255, 65, 0.3);
    }
    
    #nav-links .nav-link-active {
        background: rgba(0, 255, 65, 0.3) !important;
        box-shadow: 
            0 0 20px rgba(0, 255, 65, 0.5),
            inset 0 0 15px rgba(0, 255, 65, 0.2) !important;
    }
    
    /* Mobile menu button enhancements */
    #menu-toggle {
        position: relative;
        z-index: 1001;
        min-width: 3rem;
        min-height: 3rem;
        padding: 0.75rem 1rem;
        font-size: 1rem;
        border-radius: 0.5rem;
        transition: all 0.3s ease;
    }
    
    #menu-toggle:active {
        transform: scale(0.95);
    }
    
    /* Menu overlay backdrop */
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden;
    }
    
    /* Enhanced mobile logo sizing */
    .logo-glow-container {
        transform: scale(0.8);
    }
    
    /* Better touch targets for mobile */
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Desktop cursor enhancement */
@media (min-width: 769px) {
    .terminal-input:focus,
    input[type="text"]:focus,
    input[type="email"]:focus,
    input[type="password"]:focus,
    textarea:focus {
        caret-color: var(--neon-green);
        /* Enhanced glow on desktop */
    }
}

/* Make cursor glow more visible when focused */
.terminal-input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
    caret-color: var(--neon-green);
    /* Ensure cursor is always visible when focused */
    text-shadow: 0 0 5px rgba(0, 255, 65, 0.8);
}

/* Tablet-specific cursor styling */
@media (min-width: 769px) and (max-width: 1024px) {
    .terminal-input:focus,
    input[type="text"]:focus,
    input[type="email"]:focus,
    input[type="password"]:focus,
    textarea:focus {
        caret-color: var(--neon-green);
    }
}

/* Cursor Trail */
.cursor-trail {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neon-green);
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 0 10px var(--neon-green), 0 0 20px var(--neon-green);
    animation: fadeOut 0.5s ease-out forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: scale(1.5);
    }
}

/* Advanced Click Effects */

/* Central Glow Burst */
.click-center-glow {
    position: fixed;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--neon-green);
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    box-shadow: 
        0 0 10px var(--neon-green),
        0 0 20px var(--neon-green),
        0 0 30px var(--neon-green),
        0 0 40px var(--neon-green);
    animation: centerGlowBurst 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes centerGlowBurst {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.8);
    }
    50% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

/* Expanding Rings */
.click-ring {
    position: fixed;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--neon-green);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    box-shadow: 
        0 0 10px var(--neon-green),
        inset 0 0 10px rgba(0, 255, 65, 0.3);
    animation: ringExpand 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes ringExpand {
    0% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(0.3);
        border-width: 3px;
    }
    50% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
        border-width: 2px;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2.5);
        border-width: 1px;
    }
}

/* Particle Burst */
.click-particle {
    position: fixed;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--neon-green);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px var(--neon-green), 0 0 12px var(--neon-green);
    animation: particleBurst 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes particleBurst {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) 
            translate(var(--end-x), var(--end-y)) 
            scale(0.3);
    }
}

/* Outer Ripple Wave */
.click-ripple {
    position: fixed;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--neon-green);
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    opacity: 0.7;
    animation: rippleWave 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes rippleWave {
    0% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(0.5);
        border-width: 2px;
    }
    50% {
        opacity: 0.4;
        transform: translate(-50%, -50%) scale(1.5);
        border-width: 1px;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(4);
        border-width: 0.5px;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .click-center-glow {
        width: 16px;
        height: 16px;
    }

    .click-ring {
        width: 40px;
        height: 40px;
        border-width: 2.5px;
    }

    .click-particle {
        width: 5px;
        height: 5px;
    }

    .click-ripple {
        width: 50px;
        height: 50px;
    }
}

/* Tablet Optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .click-center-glow {
        width: 14px;
        height: 14px;
    }

    .click-ring {
        width: 35px;
        height: 35px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .click-center-glow,
    .click-particle {
        box-shadow: 
            0 0 12px var(--neon-green),
            0 0 24px var(--neon-green),
            0 0 36px var(--neon-green);
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .click-center-glow,
    .click-ring,
    .click-particle,
    .click-ripple {
        animation-duration: 0.2s;
    }
}

/* Pulse Glow Animation - Reduced intensity */
@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        text-shadow: 0 0 5px var(--neon-green);
    }
    50% {
        opacity: 0.9;
        text-shadow: 0 0 10px var(--neon-green), 0 0 15px var(--neon-green);
    }
}

.animate-pulse-glow {
    animation: pulse-glow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Tailwind Overrides */
.bg-terminal-black {
    background-color: var(--terminal-black);
}

.text-neon-green {
    color: var(--neon-green);
}

.border-neon-green {
    border-color: var(--neon-green);
}

.shadow-glow {
    box-shadow: 0 0 10px var(--neon-green), 0 0 20px var(--neon-green), 0 0 30px var(--neon-green);
}

/* Responsive and Touch-Friendly Improvements */
.touch-manipulation {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Better mobile input sizing */
@media (max-width: 640px) {
    .terminal-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem 1rem;
    }
    
    .terminal-button {
        padding: 0.875rem 1.5rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Better spacing on mobile */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* Hero section improvements for mobile */
    .hero-content h1 {
        font-size: 2.5rem; /* Reduced from 4xl */
        line-height: 1.1;
    }
    
    .hero-content p {
        font-size: 1rem; /* Better readability */
        padding: 0 0.5rem;
    }
    
    /* Improve touch targets on mobile */
    .terminal-button, .btn, button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Typing test improvements for mobile */
    #typing-text {
        font-size: 1rem; /* Smaller text for mobile */
        line-height: 1.6;
        padding: 1rem;
    }
    
    #typing-input {
        font-size: 1rem;
        padding: 0.75rem;
    }
    
    /* Results and stats improvements */
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    /* Progress bar improvements */
    .progress-bar {
        height: 0.5rem;
    }
    
    /* Timer improvements */
    .timer-display {
        font-size: 1.5rem;
    }
    
    /* Difficulty buttons */
    .difficulty-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .difficulty-buttons button {
        width: 100%;
        margin: 0;
    }
}

/* Better text selection on mobile */
@media (max-width: 768px) {
    input, textarea {
        -webkit-appearance: none;
        appearance: none;
        border-radius: 0;
    }
    
    /* Tablet improvements */
    .hero-content h1 {
        font-size: 3.5rem;
        line-height: 1.2;
    }
    
    .hero-content p {
        font-size: 1.125rem;
    }
    
    /* Improve navigation for tablets */
    nav .container {
        padding: 0 1rem;
    }
    
    /* Better spacing for sections */
    section {
        padding: 3rem 0;
    }
    
    /* Improve card layouts */
    .grid > div {
        padding: 1.5rem;
    }
}

/* Rating stars - touch-friendly */
.rating-star {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
}

/* Comprehensive responsive improvements for all screen sizes */
/* Ultra-small devices (320px and below) */
@media (max-width: 320px) {
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .hero-content p {
        font-size: 0.875rem;
    }
    
    .terminal-button {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Small tablets (481px - 640px) */
@media (min-width: 481px) and (max-width: 640px) {
    .hero-content h1 {
        font-size: 2.75rem;
    }
    
    .grid-cols-1,
    .grid-cols-2,
    .grid-cols-3 {
        grid-template-columns: 1fr;
    }
}

/* Large tablets (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .hero-content h1 {
        font-size: 4rem;
    }
    
    .container {
        max-width: 90%;
    }
    
    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Small laptops (1025px - 1280px) */
@media (min-width: 1025px) and (max-width: 1280px) {
    .container {
        max-width: 95%;
    }
    
    .hero-content h1 {
        font-size: 4.5rem;
    }
}

/* Large screens (1920px and above) */
@media (min-width: 1920px) {
    .container {
        max-width: 1400px;
    }
    
    .hero-content h1 {
        font-size: 5.5rem;
    }
    
    .text-xl {
        font-size: 1.375rem;
    }
}

/* Responsive typography */
html {
    font-size: 16px;
}

@media (max-width: 640px) {
    html {
        font-size: 14px;
    }
}

@media (min-width: 1920px) {
    html {
        font-size: 18px;
    }
}

/* Improve text readability on all devices */
.text-content {
    line-height: 1.6;
    letter-spacing: 0.01em;
}

/* Responsive spacing utilities */
.responsive-padding {
    padding: clamp(1rem, 4vw, 3rem);
}

.responsive-margin {
    margin: clamp(1rem, 4vw, 3rem);
}

/* Improve form elements on mobile */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important;
        padding: 0.75rem;
        min-height: 44px;
    }
    
    .form-group {
        margin-bottom: 1.5rem;
    }
}

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
}

/* Improve table responsiveness */
@media (max-width: 768px) {
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 0.5rem;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Responsive cards */
.card {
    padding: clamp(1rem, 3vw, 2rem);
    margin-bottom: clamp(1rem, 3vw, 2rem);
}

/* Improve button responsiveness */
.btn-responsive {
    padding: clamp(0.5rem, 2vw, 1rem) clamp(1rem, 4vw, 2rem);
    font-size: clamp(0.875rem, 2vw, 1rem);
    min-height: 44px;
    min-width: 120px;
}

/* Accessibility improvements for mobile */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .header-particles {
        display: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --neon-green: #00ff00;
        --neon-green-darker: #00cc00;
        --bg-dark: #000000;
        --bg-darker: #000000;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-dark: #0a0a0a;
        --bg-darker: #050505;
    }
}

/* Print styles */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        text-shadow: none !important;
        filter: none !important;
    }
    
    nav, .header-particles, .binary-rain {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
}

/* Focus visible improvements */
:focus-visible {
    outline: 2px solid var(--neon-green);
    outline-offset: 2px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Better text rendering */
body {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom two-tone cursors */
body {
    cursor: url('assets/cursors/cursor-default.svg') 2 2, auto;
}

a, button, .terminal-button, [role="button"], input[type="button"], input[type="submit"], summary {
    cursor: url('assets/cursors/cursor-pointer.svg') 6 2, pointer;
}

input[type="text"], input[type="email"], input[type="password"], textarea {
    cursor: url('assets/cursors/cursor-text.svg') 8 16, text;
}

@media (prefers-contrast: high) {
    body {
        cursor: url('assets/cursors/cursor-default.svg') 2 2, auto;
    }
}

/* Fluid typography utilities */
.fluid-heading {
    font-size: clamp(2rem, 7vw, 4.5rem);
    line-height: 1.15;
}

.fluid-subheading {
    font-size: clamp(1rem, 3.5vw, 1.5rem);
}

/* Specified breakpoint ranges */
@media (min-width: 320px) and (max-width: 767px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    nav .container > div {
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) and (max-width: 1439px) {
    .terminal-border {
        padding: 1.5rem !important;
    }
}

@media (min-width: 1440px) {
    .container {
        max-width: 1320px;
    }
}

/* Orientation adjustments */
@media (max-width: 767px) and (orientation: landscape) {
    #nav-links {
        padding-top: 4rem;
    }
}

/* Improve performance on mobile */
@media (max-width: 768px) {
    .header-particles {
        opacity: 0.3; /* Reduce particle opacity on mobile */
    }
    
    .binary-rain {
        opacity: 0.1; /* Reduce binary rain opacity on mobile */
    }
    
    /* Reduce animations on mobile */
    .animate-pulse-glow {
        animation-duration: 3s; /* Slower pulse on mobile */
    }
}

/* Prevent text size adjustment on iOS */
@media screen and (max-width: 767px) {
    html {
        -webkit-text-size-adjust: 100%;
    }
}

/* Enhanced Navigation Styling */
nav {
    background: linear-gradient(135deg, rgba(10, 10, 10, 0.95) 0%, rgba(15, 15, 15, 0.95) 100%) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-bottom: 2px solid var(--neon-green);
    box-shadow: 
        0 4px 30px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(0, 255, 65, 0.15),
        inset 0 0 10px rgba(0, 255, 65, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

/* Logo container enhancement */
nav .flex.items-center:first-child {
    position: relative;
    overflow: hidden;
}

nav .flex.items-center:first-child::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(0, 255, 65, 0.1), transparent);
    transform: rotate(45deg);
    animation: logo-shine 3s infinite;
    pointer-events: none;
}

@keyframes logo-shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
    100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
}

/* Enhanced logo styling */
nav img.terminal-glow {
    filter: drop-shadow(0 0 15px var(--neon-green)) drop-shadow(0 0 30px var(--neon-green));
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

nav img.terminal-glow:hover {
    filter: drop-shadow(0 0 25px var(--neon-green)) drop-shadow(0 0 50px var(--neon-green));
    transform: scale(1.05) rotate(2deg);
}

/* Navigation links container */
#nav-links {
    position: relative;
    gap: 0.5rem;
}

/* Enhanced navigation links */
#nav-links a {
    position: relative;
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0, 255, 65, 0.05);
    border: 1px solid rgba(0, 255, 65, 0.2);
    min-height: 3rem;
}

.nav-item { position: relative; }
.submenu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.9rem;
    border-radius: 6px;
    background: rgba(0, 255, 65, 0.05);
    border: 1px solid rgba(0, 255, 65, 0.2);
    min-height: 3rem;
    transition: all 0.3s ease;
}
.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 12rem;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--neon-green);
    border-radius: 0.5rem;
    padding: 0.5rem;
    display: none;
    z-index: 1002;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    animation: slideDown 0.2s ease;
}
.has-submenu:hover .submenu,
.has-submenu:focus-within .submenu { display: block; }
.submenu a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
.submenu a:hover,
.submenu a:focus {
    background: rgba(0, 255, 65, 0.08);
    border-color: var(--neon-green);
}

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

#nav-links a:hover::before {
    left: 100%;
}

#nav-links a:hover {
    background: rgba(0, 255, 65, 0.08);
    border-color: var(--neon-green);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

#nav-links a:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

#nav-links a.border-b-2.border-neon-green {
    background: rgba(0, 255, 65, 0.12);
    border: 1px solid var(--neon-green);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

/* Enhanced menu toggle button */
#menu-toggle {
    position: relative;
    background: linear-gradient(135deg, rgba(0, 255, 65, 0.1), rgba(0, 255, 65, 0.05));
    border: 2px solid var(--neon-green);
    padding: 0.75rem 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

#menu-toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, var(--neon-green) 0%, transparent 70%);
    transition: all 0.4s ease;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

#menu-toggle:hover::before {
    width: 200px;
    height: 200px;
    opacity: 0.1;
}

#menu-toggle:hover {
    transform: scale(1.05);
    box-shadow: 
        0 0 20px rgba(0, 255, 65, 0.4),
        0 8px 25px rgba(0, 255, 65, 0.2);
}

#menu-toggle[aria-expanded="true"] {
    background: rgba(0, 255, 65, 0.2);
    box-shadow: 
        inset 0 0 15px rgba(0, 255, 65, 0.3),
        0 0 20px rgba(0, 255, 65, 0.3);
}

/* Mobile navigation menu */
@media (max-width: 768px) {
    #nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(10px);
        flex-direction: column;
        padding: 2rem;
        transition: right 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
    }
    
    /* Better mobile navigation spacing */
    #nav-links a {
        padding: 0.75rem 1rem;
        margin: 0.25rem 0;
        font-size: 1.125rem;
    }
    
    /* Improve mobile menu button */
    #menu-toggle {
        padding: 0.75rem;
        min-height: 3rem;
        min-width: 3rem;
        font-size: 1.125rem;
    }
    
    /* Better mobile header */
    nav.scrolled {
        padding: 0.75rem 0;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    .submenu {
        position: static;
        display: none;
        max-height: 0;
        overflow: hidden;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
        transition: max-height 0.3s ease;
    }
    .has-submenu.open .submenu {
        display: block;
        max-height: 600px;
        padding: 0.5rem 0;
    }
    .submenu-toggle { width: 100%; justify-content: space-between; }
}

/* Ultra-small mobile devices */
@media (max-width: 480px) {
    #nav-links {
        width: 90%;
        max-width: 280px;
        padding: 1.5rem;
    }
    
    .logo {
        font-size: 1.25rem;
    }
    
    #menu-toggle {
        font-size: 1rem;
        padding: 0.5rem;
    }
    
    .header-particles {
        display: none; /* Hide particles on very small screens for performance */
    }
}

/* Desktop navigation alignment */
@media (min-width: 768px) {
    nav .container > div {
        align-items: center;
        gap: 2rem;
    }
    
    #nav-links {
        align-items: center;
        height: 100%;
        gap: 0.75rem;
    }
    
    #nav-links a {
        padding: 0.875rem 1.5rem;
        display: flex;
        align-items: center;
        height: fit-content;
        font-size: 0.85rem;
    }
}

/* Ultra-modern navigation for large screens */
@media (min-width: 1024px) {
    nav .container > div {
        gap: 3rem;
    }
    
    #nav-links {
        gap: 1rem;
    }
    
    #nav-links a {
        padding: 1rem 1.75rem;
        font-size: 0.9rem;
    }
}

/* Navigation scroll effect */
nav.scrolled {
    background: linear-gradient(135deg, rgba(5, 5, 5, 0.98), rgba(10, 10, 10, 0.98)) !important;
    box-shadow: 
        0 8px 40px rgba(0, 0, 0, 0.9),
        0 0 30px rgba(0, 255, 65, 0.25),
        inset 0 0 15px rgba(0, 255, 65, 0.08);
    border-bottom: 2px solid var(--neon-green);
}

/* Floating animation for logo on hover */
@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-3px) rotate(1deg); }
    50% { transform: translateY(-5px) rotate(0deg); }
    75% { transform: translateY(-3px) rotate(-1deg); }
}

nav .flex.items-center:first-child:hover img {
    animation: float 2s ease-in-out infinite;
}

/* Advanced header particle effects */
.header-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.header-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--neon-green);
    border-radius: 50%;
    opacity: 0.6;
    animation: particle-float 8s infinite linear;
}

@keyframes particle-float {
    0% {
        transform: translateY(100vh) translateX(0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
        transform: scale(1);
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100vh) translateX(100px) scale(0);
        opacity: 0;
    }
}

/* Cyberpunk grid overlay for header */
nav::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(0, 255, 65, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 65, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
}

/* Enhanced active page indicator */
#nav-links a.border-b-2.border-neon-green::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-green), transparent);
    animation: active-pulse 2s infinite;
}

@keyframes active-pulse {
    0%, 100% { width: 0; opacity: 0; }
    50% { width: 100%; opacity: 1; }
}

/* Holographic effect for navigation */
#nav-links a::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        var(--neon-green), 
        transparent, 
        var(--neon-green), 
        transparent, 
        var(--neon-green));
    border-radius: 8px;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
    animation: holographic 3s linear infinite;
}

#nav-links a:hover::after {
    opacity: 0.3;
}

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

/* Responsive particle density */
@media (max-width: 768px) {
    .header-particle {
        animation-duration: 12s;
    }
}

@media (min-width: 1024px) {
    .header-particle {
        animation-duration: 6s;
    }
}

/* Header loading animation */
@keyframes header-load {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

nav {
    animation: header-load 0.6s ease-out;
}

/* Enhanced focus styles for accessibility */
nav a:focus,
nav button:focus {
    outline: 2px solid var(--neon-green);
    outline-offset: 3px;
    border-radius: 6px;
}

/* Logo glow effect on hover */
nav .flex.items-center:first-child:hover img {
    filter: drop-shadow(0 0 10px var(--neon-green)) drop-shadow(0 0 20px var(--neon-green));
}

/* Advanced menu button animations */
.menu-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 255, 65, 0.3);
}

.menu-toggle:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 255, 65, 0.2);
}

/* Ensure tables are scrollable on mobile */
@media (max-width: 640px) {
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }
}

/* Better container padding on very small screens */
@media (max-width: 375px) {
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Login Popup Modal */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-in {
    animation: fade-in 0.3s ease-out;
}

#login-popup-modal {
    backdrop-filter: blur(4px);
}

#login-popup-modal button[aria-label="Close popup"] {
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Logo styling */
nav img.terminal-glow {
    filter: drop-shadow(0 0 10px var(--neon-green)) drop-shadow(0 0 20px var(--neon-green));
    transition: filter 0.3s ease;
}

nav img.terminal-glow:hover {
    filter: drop-shadow(0 0 15px var(--neon-green)) drop-shadow(0 0 30px var(--neon-green));
}

/* Logo glow effect - circular */
.logo-glow-container {
    position: relative;
    display: inline-block;
    border-radius: 50%;
    padding: 0.5rem;
}

.logo-glow-outer {
    position: absolute;
    inset: -0.5rem;
    background: radial-gradient(circle, var(--neon-green) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0.3;
    filter: blur(8px);
    animation: logo-pulse 2s ease-in-out infinite;
}

.logo-glow-inner {
    position: absolute;
    inset: 0.25rem;
    background: radial-gradient(circle, var(--neon-green) 0%, transparent 50%);
    border-radius: 50%;
    opacity: 0.4;
    filter: blur(4px);
}

.logo-glow-static {
    position: absolute;
    inset: -0.25rem;
    background: radial-gradient(circle, var(--neon-green) 0%, transparent 60%);
    border-radius: 50%;
    opacity: 0.2;
    filter: blur(6px);
}

@keyframes logo-pulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.05);
    }
}

/* Hover effects for logo */
.group:hover .logo-glow-outer {
    opacity: 0.5;
    animation-duration: 1s;
}

.group:hover .logo-glow-inner {
    opacity: 0.6;
}

.group:hover .logo-glow-static {
    opacity: 0.3;
}

/* Settings Menu Dropdown */
#settings-dropdown {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 255, 65, 0.2);
}

#settings-toggle span:last-child {
    font-size: 0.6em;
    transition: transform 0.2s;
}

#settings-dropdown button {
    display: flex;
    align-items: center;
    width: 100%;
}

/* Mobile settings menu */
@media (max-width: 767px) {
    #settings-menu {
        width: 100%;
    }
    
    #settings-toggle {
        width: 100%;
        justify-content: space-between;
    }
    
    #settings-dropdown {
        position: static;
        width: 100%;
        margin-top: 0.5rem;
    }
}

/* Enhanced footer styling */
footer {
    background: rgba(10, 10, 10, 0.95) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.8), 0 0 10px rgba(0, 255, 65, 0.2);
}

/* Improved text readability */
h1, h2, h3, h4, h5, h6 {
    text-shadow: 
        0 0 10px rgba(0, 255, 65, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Better list item styling */
ul li {
    padding-left: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Enhanced link hover effects */
a:hover {
    text-shadow: 0 0 8px var(--neon-green);
    transition: text-shadow 0.2s ease;
}

/* Improved spacing for content sections */
main > div > div {
    margin-bottom: 2rem;
}

/* Better mobile responsiveness for hero section */
@media (max-width: 768px) {
    main > div > div:first-child {
        padding: 1.5rem 1rem;
        margin: 0.5rem;
    }

    .terminal-border {
        padding: 1rem !important;
        margin: 0.5rem !important;
    }
}

/* Extra large screen optimizations */
@media (min-width: 1280px) {
    .container {
        max-width: 1280px;
    }

    /* Larger hero text on XL screens */
    h1 {
        font-size: 5rem;
        line-height: 1.1;
    }

    /* Better spacing on XL screens */
    main > div > div {
        margin-bottom: 3rem;
    }

    /* Larger terminal borders on XL */
    .terminal-border {
        padding: 2rem !important;
    }

    /* Footer improvements for XL */
    footer .container {
        max-width: 1280px;
    }
}

/* 2XL and larger screens */
@media (min-width: 1536px) {
    .container {
        max-width: 1536px;
    }

    /* Even larger hero text */
    h1 {
        font-size: 6rem;
    }

    /* Enhanced spacing */
    main > div > div {
        margin-bottom: 4rem;
    }

    /* Larger buttons on very large screens */
    .terminal-button {
        padding: 1rem 2rem;
        font-size: 1.25rem;
    }
}

/* Binary rain canvas optimizations for large screens */
@media (min-width: 1280px) {
    #binary-rain-canvas {
        transform: perspective(1500px) rotateX(15deg) scale(1.2);
    }
}

/* Binary rain canvas responsive adjustments */
@media (max-width: 640px) {
    #binary-rain-canvas {
        transform: perspective(800px) rotateX(10deg) scale(1.1);
        opacity: 0.6;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    #binary-rain-canvas {
        transform: perspective(1000px) rotateX(12deg) scale(1.15);
        opacity: 0.7;
    }
}

@media (min-width: 1025px) and (max-width: 1279px) {
    #binary-rain-canvas {
        transform: perspective(1200px) rotateX(12deg) scale(1.15);
        opacity: 0.8;
    }
}

/* Enhanced navigation for large screens */
@media (min-width: 1280px) {
    nav .container > div {
        align-items: center;
    }

    #nav-links {
        gap: 1.5rem;
    }

    #nav-links a {
        padding: 0.75rem 1rem;
        font-size: 1.1rem;
    }
}

/* Better grid layouts on large screens */
@media (min-width: 1280px) {
    footer .grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 3rem;
    }
}

/* Improved readability on very large screens */
@media (min-width: 1920px) {
    body {
        font-size: 18px;
    }

    h1 {
        font-size: 7rem;
    }

    .terminal-border {
        padding: 2.5rem !important;
    }
}
