/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Retro Color Palette */
    --primary-bg: #0a0a0a;
    --secondary-bg: #1a1a1a;
    --accent-bg: #2a2a2a;
    --neon-green: #00ff41;
    --neon-blue: #00d4ff;
    --neon-purple: #b084ff;
    --neon-pink: #ff1493;
    --neon-yellow: #ffff00;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #888888;
    
    /* Fonts */
    --font-pixel: 'Press Start 2P', monospace;
    --font-mono: 'Courier New', monospace;
}

body {
    font-family: var(--font-pixel);
    background: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    /* Offset for fixed navbar so top content isn't hidden */
    padding-top: 72px; /* matches nav approx height */
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--secondary-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--neon-green);
    border-radius: 0;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.pixel-loader {
    text-align: center;
}

.loading-text {
    font-size: 1.5rem;
    color: var(--neon-green);
    margin-bottom: 2rem;
    animation: blink 1s infinite;
}

.loading-bar {
    width: 300px;
    height: 20px;
    border: 2px solid var(--neon-green);
    background: var(--secondary-bg);
    position: relative;
}

.loading-progress {
    height: 100%;
    background: var(--neon-green);
    width: 0%;
    animation: loadProgress 3s ease-in-out;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Navigation */
.game-nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo .pixel-text {
    font-size: 1.2rem;
    color: var(--neon-green);
    text-shadow: 0 0 10px var(--neon-green);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    flex: 1;
    justify-content: center;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 1rem;
    display: inline-block;
    border-radius: 4px;
    border: 1px solid transparent;
}

.nav-link:hover {
    color: var(--neon-green);
    text-shadow: 
        0 0 5px var(--neon-green),
        0 0 10px var(--neon-green),
        0 0 15px var(--neon-green);
    transform: translateY(-2px);
    border: 1px solid var(--neon-green);
    background: rgba(0, 255, 65, 0.1);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--neon-green);
    transition: all 0.3s ease;
    transform: translateX(-50%);
    box-shadow: 0 0 5px var(--neon-green);
}

.nav-link:hover::after {
    width: 80%;
}

/* Enhanced nav-link hover effects */
.nav-link:hover {
    color: var(--neon-green);
    text-shadow: 
        0 0 5px var(--neon-green),
        0 0 10px var(--neon-green),
        0 0 15px var(--neon-green);
    transform: translateY(-2px);
}

/* Active nav link styling */
.nav-link.active {
    color: var(--neon-green);
    text-shadow: 0 0 5px var(--neon-green);
}

.nav-link.active::after {
    width: 80%;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    z-index: 1002;
    padding: 5px;
    background: rgba(26, 26, 26, 0.9);
    border: 1px solid var(--neon-green);
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--neon-green);
    margin: 3px 0;
    transition: 0.3s;
    display: block;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Navbar Controls */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto; /* push controls to far right on desktop */
    justify-content: flex-end;
}

.achievement-btn,
.sound-btn,
.crt-btn,
.theme-btn {
    background: var(--accent-bg);
    border: 1px solid var(--neon-green);
    color: var(--neon-green);
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 0;
    font-family: var(--font-pixel);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 40px;
    justify-content: center;
}

.achievement-btn:hover,
.sound-btn:hover,
.crt-btn:hover,
.theme-btn:hover {
    background: var(--neon-green);
    color: var(--primary-bg);
    box-shadow: 0 0 10px var(--neon-green);
}

.nav-control-icon {
    font-size: 1rem;
}

.dropdown-arrow {
    font-size: 0.6rem;
    margin-left: 0.25rem;
    transition: transform 0.3s ease;
}

/* Theme Dropdown in Navbar */
.theme-dropdown {
    position: relative;
}

.theme-options {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(26, 26, 26, 0.98);
    border: 2px solid var(--neon-green);
    backdrop-filter: blur(10px);
    min-width: 140px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 1001;
    margin-top: 0.5rem;
}

.theme-dropdown.open .theme-options {
    max-height: 200px;
    padding: 0.5rem;
}

.theme-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.theme-option {
    display: block;
    width: 100%;
    background: var(--accent-bg);
    border: 1px solid var(--neon-green);
    color: var(--neon-green);
    padding: 0.5rem;
    font-size: 0.6rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 0;
    font-family: var(--font-pixel);
    margin: 0.2rem 0;
    text-align: left;
}

.theme-option:hover {
    background: var(--neon-green);
    color: var(--primary-bg);
}

/* Hero Section */
.hero-section {
    /* Subtract navbar offset already added as body padding to avoid extra scroll */
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: linear-gradient(45deg, var(--primary-bg), var(--secondary-bg));
    overflow: hidden;
}

.stars {
    position: absolute;
    width: 100%;
    height: 100%;
    background: transparent;
}

.stars::before,
.stars::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--neon-blue);
    border-radius: 50%;
    animation: twinkle 2s infinite;
}

.stars::before {
    top: 20%;
    left: 20%;
    animation-delay: 0s;
}

.stars::after {
    top: 60%;
    right: 30%;
    animation-delay: 1s;
}

.hero-content {
    text-align: center;
    z-index: 2;
    max-width: 800px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.glitch-text {
    font-size: 3rem;
    color: var(--neon-green);
    text-shadow: 
        0 0 10px var(--neon-green),
        2px 2px 0px var(--neon-pink),
        -2px -2px 0px var(--neon-blue);
    animation: glitch 2s infinite;
    margin-bottom: 1rem;
}

.hero-text h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.highlight {
    color: var(--neon-purple);
    text-shadow: 0 0 10px var(--neon-purple);
}

.hero-description {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-family: var(--font-mono);
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

/* Pixel Buttons */
.pixel-btn {
    padding: 1rem 2rem;
    border: 3px solid;
    background: transparent;
    text-decoration: none;
    font-family: var(--font-pixel);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    text-transform: uppercase;
}

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

.pixel-btn.primary:hover {
    background: var(--neon-green);
    color: var(--primary-bg);
    box-shadow: 0 0 20px var(--neon-green);
}

.pixel-btn.secondary {
    color: var(--neon-blue);
    border-color: var(--neon-blue);
}

.pixel-btn.secondary:hover {
    background: var(--neon-blue);
    color: var(--primary-bg);
    box-shadow: 0 0 20px var(--neon-blue);
}

/* Section Styles */
section {
    padding: 5rem 0;
    position: relative;
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--neon-green);
    text-shadow: 0 0 10px var(--neon-green);
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 100px;
    height: 3px;
    background: var(--neon-green);
    margin: 1rem auto;
}

/* About Section */
.about-section {
    background: var(--secondary-bg);
}

.about-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: center;
}

.terminal-window {
    background: var(--primary-bg);
    border: 2px solid var(--neon-green);
    border-radius: 0;
    overflow: hidden;
}

.terminal-header {
    background: var(--accent-bg);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.terminal-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.btn.red { background: #ff5555; }
.btn.yellow { background: #ffff55; }
.btn.green { background: #55ff55; }

.terminal-title {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.terminal-body {
    padding: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.terminal-line {
    margin-bottom: 0.5rem;
    color: var(--neon-green);
}

.terminal-cursor {
    animation: blink 1s infinite;
}

.about-stats {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stat-card {
    background: var(--accent-bg);
    border: 2px solid var(--neon-blue);
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--neon-purple);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 1.5rem;
    color: var(--neon-blue);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Skills Section */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.skill-category {
    background: var(--accent-bg);
    border: 2px solid var(--neon-purple);
    padding: 2rem;
}

.category-title {
    font-size: 1.2rem;
    color: var(--neon-purple);
    margin-bottom: 1.5rem;
    text-align: center;
}

.skills-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.skill-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.skill-name {
    font-size: 0.8rem;
    color: var(--text-primary);
}

.skill-bar {
    height: 10px;
    background: var(--secondary-bg);
    border: 1px solid var(--neon-purple);
    position: relative;
    overflow: hidden;
}

.skill-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-purple), var(--neon-pink));
    width: 0%;
    transition: width 2s ease-in-out;
}

/* Projects Section */
.projects-section {
    background: var(--secondary-bg);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--accent-bg);
    border: 2px solid var(--neon-yellow);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.project-card:hover {
    transform: translateY(-10px);
    border-color: var(--neon-green);
}

.project-image {
    height: 200px;
    background: var(--secondary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pixel-placeholder {
    font-size: 1.2rem;
    color: var(--neon-yellow);
    text-align: center;
}

.project-info {
    padding: 1.5rem;
}

.project-title {
    font-size: 1.1rem;
    color: var(--neon-yellow);
    margin-bottom: 1rem;
}

.project-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-family: var(--font-mono);
    line-height: 1.4;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tech-tag {
    font-size: 0.7rem;
    padding: 0.3rem 0.8rem;
    background: var(--primary-bg);
    border: 1px solid var(--neon-blue);
    color: var(--neon-blue);
}

.project-links {
    display: flex;
    gap: 1rem;
}

.project-link {
    font-size: 0.8rem;
    color: var(--neon-green);
    text-decoration: none;
    border: 1px solid var(--neon-green);
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.project-link:hover {
    background: var(--neon-green);
    color: var(--primary-bg);
}

.project-link.disabled {
    color: var(--text-muted);
    border-color: var(--text-muted);
    cursor: not-allowed;
}

/* Contact Section */
.contact-content {
    text-align: center;
}

.contact-text h3 {
    font-size: 1.5rem;
    color: var(--neon-pink);
    margin-bottom: 1rem;
}

.contact-text p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-family: var(--font-mono);
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.contact-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-primary);
    padding: 1.5rem;
    border: 2px solid var(--neon-pink);
    background: var(--accent-bg);
    transition: all 0.3s ease;
    min-width: 120px;
}

.contact-link:hover {
    background: var(--neon-pink);
    color: var(--primary-bg);
    transform: translateY(-5px);
}

.contact-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.contact-icon i {
    font-size: 2rem;
    transition: all 0.3s ease;
}

/* Social Media Icon Colors */
.contact-link:hover .fa-github {
    color: #ffffff;
    text-shadow: 0 0 10px #ffffff;
}

.contact-link:hover .fa-linkedin {
    color: #0077b5;
    text-shadow: 0 0 10px #0077b5;
}

.contact-link:hover .fa-x-twitter {
    color: #ffffff;
    text-shadow: 0 0 10px #ffffff;
}

.contact-link:hover .fa-instagram {
    color: #e4405f;
    text-shadow: 0 0 10px #e4405f;
}

/* Footer */
.footer {
    background: var(--primary-bg);
    border-top: 2px solid var(--neon-green);
    padding: 2rem 0;
    text-align: center;
}

.footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.footer-subtext {
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

/* Animations */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes loadProgress {
    0% { width: 0%; }
    100% { width: 100%; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

@keyframes twinkle {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* Mobile styles moved to end of file for proper override */

@media (max-width: 480px) {
    .nav-container {
        padding: 0.6rem 0.8rem;
    }
    
    .logo .pixel-text {
        font-size: 1rem;
    }
    
    .nav-controls {
        gap: 0.2rem;
        margin-right: 0.3rem;
        margin-left: auto; /* maintain right alignment on very small screens */
    }
    
    .achievement-btn,
    .sound-btn,
    .crt-btn,
    .theme-btn {
        padding: 0.3rem;
        min-width: 28px;
    }
    
    .nav-control-icon {
        font-size: 0.7rem;
    }
    
    .dropdown-arrow {
        font-size: 0.4rem;
    }
    
    .theme-options {
        min-width: 100px;
        right: -5px;
    }
    
    .theme-option {
        padding: 0.3rem;
        font-size: 0.5rem;
        margin: 0.1rem 0;
    }
    
    .hamburger {
        padding: 3px;
    }
    
    .hamburger span {
        width: 20px;
        height: 2px;
    }
    
    .glitch-text {
        font-size: 2rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    /* Enhanced mobile responsiveness */
    .container {
        padding: 0 1rem;
    }
    
    .hero h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .hero .tagline {
        font-size: 0.7rem;
        margin-bottom: 1.5rem;
    }
    
    /* Control buttons repositioning for mobile */
    .sound-toggle {
        top: 80px; /* Below navbar */
        right: 15px;
        padding: 8px;
        font-size: 1rem;
    }
    
    .crt-toggle {
        top: 140px; /* Below sound toggle */
        right: 15px;
        padding: 8px;
        font-size: 1rem;
    }
    
    .theme-selector {
        top: 200px; /* Below CRT toggle */
        right: 15px;
        padding: 8px;
        max-width: 120px;
    }
    
    .theme-btn {
        padding: 6px 10px;
        font-size: 0.5rem;
        margin: 2px 0;
    }
    
    /* Achievement panel mobile positioning */
    .achievement-panel {
        top: 80px; /* Below navbar */
        left: 15px;
        font-size: 1.2rem;
        padding: 8px;
        min-width: 40px;
    }
    
    .skills-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .contact-links {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .contact-links a {
        padding: 0.7rem 1rem;
        font-size: 0.7rem;
        min-height: 44px; /* Touch friendly */
    }
    
    /* Game canvas mobile */
    #gameCanvas {
        max-width: 100%;
        height: auto;
        touch-action: manipulation;
    }
    
    .game-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .game-controls button {
        padding: 0.5rem 1rem;
        font-size: 0.6rem;
        min-height: 44px;
    }
    
    section {
        padding: 3rem 0;
    }
    
    .section-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    /* Ultra mobile adjustments */
    .glitch-text {
        font-size: 1.2rem;
    }
    
    .hero-text h2 {
        font-size: 1rem;
    }
    
    .hero .tagline {
        font-size: 0.6rem;
    }
    
    .pixel-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.8rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .terminal-body {
        font-size: 0.8rem;
        padding: 1rem;
    }
    
    /* Smaller control buttons for ultra mobile - side by side layout */
    .sound-toggle {
        top: 80px; /* Below navbar */
        right: 80px; /* Positioned to the left of CRT toggle */
        padding: 6px;
        font-size: 0.9rem;
    }
    
    .crt-toggle {
        top: 80px; /* Same level as sound toggle */
        right: 15px;
        padding: 6px;
        font-size: 0.9rem;
    }
    
    .theme-selector {
        top: 130px; /* Below the other controls */
        right: 15px;
        padding: 6px;
        max-width: 100px;
    }
    
    .theme-btn {
        padding: 3px 6px;
        font-size: 0.4rem;
        margin: 1px 0;
    }
    
    /* Ultra compact achievement panel */
    .achievement-panel {
        top: 80px; /* Below navbar */
        left: 15px;
        font-size: 1rem;
        padding: 6px;
        min-width: 35px;
    }
    
    /* Touch-friendly interactions */
    .project-card,
    .skill-item {
        min-height: 44px;
        padding: 1rem;
    }
    
    /* Compact navigation */
    .contact-links a {
        padding: 0.5rem 0.8rem;
        font-size: 0.6rem;
    }
    
    /* Game adjustments for small screens */
    .game-info {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .game-stats {
        font-size: 0.5rem;
    }
}

/* Landscape mobile adjustments */
@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        padding: 2rem 0;
    }
    
    .hero h1 {
        font-size: 1.3rem;
    }
    
    /* Keep standard positioning in landscape mode */
    .achievement-panel {
        bottom: 10px;
        top: auto;
        left: 10px;
    }
}

/* Loading animations trigger */
.loaded .loading-screen {
    opacity: 0;
    pointer-events: none;
}

.skill-progress.animate {
    animation: fillProgress 2s ease-in-out forwards;
}

@keyframes fillProgress {
    to {
        width: var(--progress);
    }
}

/* Interactive Effects */
@keyframes trailFade {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0);
    }
}



/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    .sound-toggle:active,
    .crt-toggle:active {
        background: var(--neon-green);
        color: var(--primary-bg);
        transform: scale(0.95);
    }
    
    .theme-btn:active {
        background: var(--neon-green);
        color: var(--primary-bg);
    }
    
    .pixel-btn:active {
        transform: translateY(2px) scale(0.98);
    }
}

.sound-toggle:hover,
.crt-toggle:hover,
.theme-btn:hover {
    background: var(--neon-green);
    color: var(--primary-bg);
    box-shadow: 0 0 20px var(--neon-green);
}

/* CRT Monitor Effect */
.crt-effect {
    position: relative;
}

.crt-effect::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        transparent 49%,
        rgba(0, 255, 65, 0.03) 50%,
        transparent 51%
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 9999;
    animation: scanlines 0.1s linear infinite;
}

.crt-effect::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        transparent 60%,
        rgba(0, 0, 0, 0.2) 100%
    );
    pointer-events: none;
    z-index: 9998;
}

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* Enhanced Glitch Effects */
.glitch-text {
    position: relative;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.glitch-text::before {
    color: var(--neon-pink);
    animation: glitch-1 0.6s infinite;
}

.glitch-text::after {
    color: var(--neon-blue);
    animation: glitch-2 0.6s infinite;
}

@keyframes glitch-1 {
    0%, 90%, 100% { opacity: 0; }
    5% { 
        opacity: 0.8;
        transform: translate(-2px, -2px);
        clip-path: polygon(0 0, 100% 0, 100% 5%, 0 5%);
    }
    10% {
        opacity: 0.8;
        transform: translate(-5px, -5px);
        clip-path: polygon(0 85%, 100% 85%, 100% 100%, 0 100%);
    }
}

@keyframes glitch-2 {
    0%, 90%, 100% { opacity: 0; }
    15% {
        opacity: 0.9;
        transform: translate(2px, 2px);
        clip-path: polygon(0 60%, 100% 60%, 100% 70%, 0 70%);
    }
    20% {
        opacity: 0.9;
        transform: translate(5px, 5px);
        clip-path: polygon(0 10%, 100% 10%, 100% 15%, 0 15%);
    }
}

/* Floating Animations for Interactive Elements */
.floating {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Pulse Animation for Call-to-Action */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 var(--neon-green); }
    70% { box-shadow: 0 0 0 10px rgba(0, 255, 65, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 255, 65, 0); }
}

/* Theme Selector Styling */
.theme-selector {
    background: rgba(26, 26, 26, 0.9);
    padding: 10px;
    border: 2px solid var(--neon-green);
    backdrop-filter: blur(10px);
}

/* Enhanced Button Effects */
.pixel-btn,
.project-link,
.contact-link {
    position: relative;
    overflow: hidden;
}

.pixel-btn::before,
.project-link::before,
.contact-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s;
}

.pixel-btn:hover::before,
.project-link:hover::before,
.contact-link:hover::before {
    left: 100%;
}

/* Particle Canvas Styling */
#particle-canvas,
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* Enhanced Skill Bars */
.skill-progress {
    position: relative;
    overflow: hidden;
}

.skill-progress::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transform: translateX(-100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Mobile Responsive Updates */
@media (max-width: 768px) {
    .sound-toggle,
    .crt-toggle {
        top: auto;
        bottom: 20px;
        right: 20px;
    }
    
    .theme-selector {
        top: auto;
        bottom: 80px;
        right: 20px;
        display: flex;
        flex-direction: row;
        gap: 5px;
    }
    
    .theme-btn {
        font-size: 0.5rem;
        padding: 3px 6px;
    }
    
    .crt-effect::before {
        background-size: 100% 2px;
    }
}

/* Mini-Game Section */
.mini-game-section {
    background: var(--secondary-bg);
    padding: 3rem 0;
}

.game-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.game-title {
    font-size: 1.5rem;
    color: var(--neon-green);
}

.game-scores {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    text-align: center;
}

.game-best-score {
    font-size: 0.9rem;
    color: var(--neon-yellow);
    font-weight: bold;
}

.game-score {
    font-size: 1rem;
    color: var(--neon-blue);
}

#game-canvas {
    border: 3px solid var(--neon-green);
    background: var(--primary-bg);
    margin: 1rem 0;
    image-rendering: pixelated;
    position: relative;
    cursor: pointer;
}

.game-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.game-controls p {
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* In-canvas game state overlay */
.game-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--neon-green);
    padding: 2rem;
    text-align: center;
    color: var(--text-primary);
    font-family: var(--font-pixel);
    z-index: 10;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.3);
}

.game-overlay h3 {
    color: var(--neon-green);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.game-overlay .score-display {
    margin: 1rem 0;
    color: var(--neon-blue);
    font-size: 0.9rem;
}

.game-overlay .best-score-display {
    color: var(--neon-yellow);
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.game-overlay .new-best {
    color: var(--neon-yellow);
    animation: pulse 1s infinite;
    margin-bottom: 0.5rem;
}

.game-overlay-btn {
    background: var(--accent-bg);
    border: 2px solid var(--neon-green);
    color: var(--neon-green);
    padding: 0.8rem 1.5rem;
    font-family: var(--font-pixel);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.game-overlay-btn:hover {
    background: var(--neon-green);
    color: var(--primary-bg);
    box-shadow: 0 0 15px var(--neon-green);
    transform: scale(1.05);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Mobile Game Controls - Removed (swipe gestures are sufficient) */

/* Achievement System */
/* Achievement Panel - Fixed positioning */
.achievement-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: var(--accent-bg);
    border: 2px solid var(--neon-yellow);
    color: var(--neon-yellow);
    padding: 12px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-pixel);
    backdrop-filter: blur(10px);
    min-width: 50px;
    text-align: center;
}

.achievement-panel:hover {
    background: var(--neon-yellow);
    color: var(--primary-bg);
    box-shadow: 0 0 20px var(--neon-yellow);
    transform: scale(1.1);
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin: 8px 0;
    background: rgba(0, 255, 255, 0.1);
    border-left: 3px solid var(--neon-cyan);
    border-radius: 0;
    transition: all 0.3s ease;
}

.achievement-item.unlocked {
    background: rgba(0, 255, 0, 0.1);
    border-left-color: var(--neon-green);
}

.achievement-item.locked {
    background: rgba(128, 128, 128, 0.1);
    border-left-color: var(--text-muted);
    opacity: 0.6;
}

.achievement-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-bg);
    border: 2px solid var(--neon-yellow);
    color: var(--neon-yellow);
    padding: 1rem;
    z-index: 10000;
    font-family: var(--font-pixel);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideDown 0.5s ease-out;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 20px var(--neon-yellow);
    border-radius: 0;
}

.achievement-icon {
    font-size: 1.2rem;
    color: var(--neon-cyan);
}

.achievement-item.unlocked .achievement-icon {
    color: var(--neon-green);
}

.achievement-text {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.achievement-item.unlocked .achievement-text {
    color: var(--text-primary);
}

.achievement-icon {
    font-size: 2rem;
}

.achievement-title {
    font-weight: bold;
    margin-bottom: 0.2rem;
}

.achievement-name {
    color: var(--neon-yellow);
    margin-bottom: 0.1rem;
}

.achievement-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.achievement-panel:hover {
    background: var(--neon-yellow);
    color: var(--primary-bg);
    box-shadow: 0 0 20px var(--neon-yellow);
}

.achievement-modal .modal-content {
    background: var(--secondary-bg);
    border: 3px solid var(--neon-yellow);
    padding: 2rem;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    font-family: var(--font-pixel);
}

.achievement-modal h3 {
    color: var(--neon-yellow);
    text-align: center;
    margin-bottom: 1.5rem;
}

.achievements-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--accent-bg);
    border: 1px solid var(--text-muted);
}

.achievement-item.unlocked {
    border-color: var(--neon-yellow);
    background: rgba(255, 190, 11, 0.1);
}

.achievement-item.locked {
    opacity: 0.5;
}

.achievement-item .achievement-icon {
    font-size: 1.5rem;
}

.achievement-item .achievement-name {
    font-size: 0.8rem;
    color: var(--neon-yellow);
    margin-bottom: 0.2rem;
}

.achievement-item .achievement-desc {
    font-size: 0.6rem;
    color: var(--text-secondary);
}

/* Text Reveal Animation */
.text-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.text-reveal-active {
    opacity: 1;
    transform: translateY(0);
}

/* Additional Animations */
@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
    to {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        text-align: center;
    }
    
    #game-canvas {
        width: 100%;
        max-width: 300px;
        height: 300px; /* Keep it square */
        touch-action: none; /* Prevent scrolling on touch */
    }
    
    .game-controls p {
        font-size: 0.7rem;
        text-align: center;
        margin: 0.5rem 0;
    }
    
    .game-overlay {
        padding: 1.5rem;
        max-width: 280px;
        margin: 0 1rem;
    }
    
    .game-overlay h3 {
        font-size: 1rem;
    }
    
    .game-overlay-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.7rem;
    }
    
    .achievement-modal .modal-content {
        margin: 1rem;
        padding: 1rem;
    }
    
    .achievement-item {
        flex-direction: column;
        text-align: center;
    }
}

/* Extra small mobile adjustments */
@media (max-width: 420px) {
    #game-canvas {
        max-width: 280px;
        height: 280px;
    }
    
    .game-overlay {
        padding: 1rem;
        max-width: 250px;
    }
    
    .game-overlay h3 {
        font-size: 0.9rem;
        margin-bottom: 0.8rem;
    }
    
    .game-overlay-btn {
        padding: 0.5rem 1rem;
        font-size: 0.6rem;
    }
    
    .mobile-btn {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
    
    .game-title {
        font-size: 1.2rem;
    }
    
    .game-scores {
        gap: 0.2rem;
    }
    
    .game-best-score {
        font-size: 0.8rem;
    }
    
    .game-score {
        font-size: 0.9rem;
    }
}

/* === Responsive Layout (Refactored) === */
/* Medium desktops -> tighten grids */
@media (max-width: 1200px) {
    .about-content { gap: 2rem; }
    .skills-grid { gap: 2rem; }
    .projects-grid { gap: 2rem; }
}

/* Tablets / small laptops */
@media (max-width: 992px) {
    .about-content { grid-template-columns: 1.3fr 1fr; }
    .section-title { font-size: 2.2rem; }
    .glitch-text { font-size: 2.6rem; }
}

/* Core mobile breakpoint */
@media (max-width: 768px) {
    /* Nav */
    .hamburger { display: flex; order: 3; margin-left: 0; }
    .nav-container { padding: 0.75rem 1rem; gap: 1rem; }
    .nav-menu { display: none; position: absolute; top: 100%; left: 0; width: 100%; flex-direction: column; background: rgba(15,15,15,0.96); border: 2px solid var(--neon-green); border-top: none; padding: 0.75rem 0.75rem 1rem; z-index: 1001; }
    .nav-menu.active { display: flex; }
    .nav-menu { align-items: center; }
    .nav-menu li { margin: 0.35rem 0; width: 100%; display: flex; justify-content: center; }
    .nav-link { padding: 0.85rem 0.75rem; font-size: 0.75rem; border: 1px solid var(--neon-green); background: rgba(0,255,0,0.05); display: block; width: 180px; text-align: center; }
    /* Place controls before hamburger and remove auto push */
    .nav-controls { order: 2; margin-left: auto; gap: 0.35rem; flex-shrink: 0; }
    .nav-controls .theme-options { top: 110%; right: 0; }

    /* Hero */
    .hero-section { padding: 3.5rem 0 2.5rem; min-height: auto; }
    .hero-content { padding: 0 0.5rem; }
    .glitch-text { font-size: 2.2rem; }
    .hero-text h2 { font-size: 1.15rem; }
    .hero-description { font-size: 0.85rem; margin-bottom: 1.25rem; }
    .hero-buttons { flex-direction: column; gap: 0.75rem; align-items: center; }
    .pixel-btn { width: 190px; padding: 0.75rem 1.1rem; font-size: 0.75rem; }

    /* About */
    .about-content { grid-template-columns: 1fr; }
    .about-stats { justify-content: center; }
    .stat-card { min-width: 90px; }

    /* Skills */
    .skills-grid { grid-template-columns: 1fr; }

    /* Projects */
    .projects-grid { grid-template-columns: 1fr; }
    .project-card { max-width: 100%; }

    /* Contact */
    .contact-content { flex-direction: column; gap: 2rem; }
    .contact-links { display: grid; grid-template-columns: repeat(2,1fr); gap: 0.75rem; }

    /* Generic spacing */
    section { padding: 3.25rem 0; }
    .section-title { font-size: 1.9rem; margin-bottom: 2.2rem; }
    .container { padding: 0 1rem; }
}

/* Small phones */
@media (max-width: 600px) {
    .glitch-text { font-size: 1.9rem; }
    .hero-text h2 { font-size: 1rem; }
    .pixel-btn { width: 170px; font-size: 0.7rem; }
    .contact-links { grid-template-columns: 1fr; }
    .terminal-body { font-size: 0.7rem; padding: 0.6rem; }
}

/* Ultra small */
@media (max-width: 420px) {
    .nav-link { font-size: 0.7rem; }
    .nav-controls { gap: 0.25rem; }
    .glitch-text { font-size: 1.6rem; }
    .section-title { font-size: 1.45rem; }
    .pixel-btn { width: 160px; }
}

/* ==========================================
   3D INTERACTIVE CUBE STYLES
========================================== */

.cube-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    perspective: 1000px;
    user-select: none;
}

.interactive-cube {
    width: 120px;
    height: 120px;
    position: relative;
    transform-style: preserve-3d;
    transition: none; /* Remove transition to avoid conflicts with JS animation */
    cursor: grab;
    pointer-events: auto; /* Ensure it's clickable */
    z-index: 10; /* Make sure it's above other elements */
}

.interactive-cube:active {
    cursor: grabbing;
}

.cube-face {
    position: absolute;
    width: 120px;
    height: 120px;
    border: 3px solid var(--neon-green);
    background: rgba(0, 255, 65, 0.1);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 0 20px var(--neon-green),
        inset 0 0 20px rgba(0, 255, 65, 0.1);
    transition: all 0.3s ease;
    pointer-events: auto; /* Make faces clickable */
}

.cube-face:hover {
    background: rgba(0, 255, 65, 0.2);
    box-shadow: 
        0 0 30px var(--neon-green),
        inset 0 0 30px rgba(0, 255, 65, 0.2);
    border-color: var(--neon-blue);
}

.face-content {
    /* Clean faces without content */
    width: 100%;
    height: 100%;
}

/* Cube Face Positioning */
.cube-face.front {
    transform: rotateY(0deg) translateZ(60px);
}

.cube-face.back {
    transform: rotateY(180deg) translateZ(60px);
}

.cube-face.right {
    transform: rotateY(90deg) translateZ(60px);
    border-color: var(--neon-blue);
}

.cube-face.left {
    transform: rotateY(-90deg) translateZ(60px);
    border-color: var(--neon-purple);
}

.cube-face.top {
    transform: rotateX(90deg) translateZ(60px);
    border-color: var(--neon-yellow);
}

.cube-face.bottom {
    transform: rotateX(-90deg) translateZ(60px);
    border-color: var(--neon-pink);
}

/* Hide cube controls text */
.cube-controls {
    display: none;
}

/* Cube Animations */
@keyframes cubeFloat {
    0%, 100% {
        transform: translateY(0px) rotateX(0deg) rotateY(0deg);
    }
    25% {
        transform: translateY(-10px) rotateX(5deg) rotateY(90deg);
    }
    50% {
        transform: translateY(-5px) rotateX(0deg) rotateY(180deg);
    }
    75% {
        transform: translateY(-15px) rotateX(-5deg) rotateY(270deg);
    }
}

@keyframes cubeGlow {
    0%, 100% {
        box-shadow: 
            0 0 20px var(--neon-green),
            inset 0 0 20px rgba(0, 255, 65, 0.1);
    }
    50% {
        box-shadow: 
            0 0 40px var(--neon-green),
            inset 0 0 40px rgba(0, 255, 65, 0.2);
    }
}

/* Responsive Cube */
@media (max-width: 768px) {
    .cube-container {
        margin-bottom: 1.5rem;
    }
    
    .interactive-cube {
        width: 100px;
        height: 100px;
    }
    
    .cube-face {
        width: 100px;
        height: 100px;
    }
    
    .cube-face.front,
    .cube-face.back {
        transform: rotateY(0deg) translateZ(50px);
    }
    
    .cube-face.back {
        transform: rotateY(180deg) translateZ(50px);
    }
    
    .cube-face.right {
        transform: rotateY(90deg) translateZ(50px);
    }
    
    .cube-face.left {
        transform: rotateY(-90deg) translateZ(50px);
    }
    
    .cube-face.top {
        transform: rotateX(90deg) translateZ(50px);
    }
    
    .cube-face.bottom {
        transform: rotateX(-90deg) translateZ(50px);
    }
    
    .hero-content {
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .cube-container {
        margin-bottom: 1rem;
    }
    
    .interactive-cube {
        width: 80px;
        height: 80px;
    }
    
    .cube-face {
        width: 80px;
        height: 80px;
    }
    
    .cube-face.front,
    .cube-face.back,
    .cube-face.right,
    .cube-face.left {
        transform: translateZ(40px);
    }
    
    .cube-face.back {
        transform: rotateY(180deg) translateZ(40px);
    }
    
    .cube-face.right {
        transform: rotateY(90deg) translateZ(40px);
    }
    
    .cube-face.left {
        transform: rotateY(-90deg) translateZ(40px);
    }
    
    .cube-face.top {
        transform: rotateX(90deg) translateZ(40px);
    }
    
    .cube-face.bottom {
        transform: rotateX(-90deg) translateZ(40px);
    }
    
    .hero-content {
        gap: 1rem;
    }
}
