html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: #212529;
    font-family: "Press Start 2P", cursive;
    color: #fff;
    overflow: hidden;
}

body::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: rgba(18, 16, 16, 0.1);
    opacity: 0;
    z-index: 2;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

body::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%,
            rgba(0, 0, 0, 0.25) 50%),
        linear-gradient(90deg,
            rgba(255, 0, 0, 0.06),
            rgba(0, 255, 0, 0.02),
            rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

@keyframes flicker {
    0% {
        opacity: 0.27861;
    }

    5% {
        opacity: 0.34769;
    }

    10% {
        opacity: 0.23604;
    }

    15% {
        opacity: 0.90626;
    }

    20% {
        opacity: 0.18128;
    }

    25% {
        opacity: 0.83891;
    }

    30% {
        opacity: 0.65583;
    }

    35% {
        opacity: 0.67807;
    }

    40% {
        opacity: 0.26559;
    }

    45% {
        opacity: 0.84693;
    }

    50% {
        opacity: 0.96019;
    }

    55% {
        opacity: 0.08594;
    }

    60% {
        opacity: 0.20313;
    }

    65% {
        opacity: 0.71988;
    }

    70% {
        opacity: 0.53455;
    }

    75% {
        opacity: 0.37288;
    }

    80% {
        opacity: 0.71428;
    }

    85% {
        opacity: 0.70428;
    }

    90% {
        opacity: 0.7003;
    }

    95% {
        opacity: 0.36108;
    }

    100% {
        opacity: 0.24387;
    }
}

/* --- Start Screen --- */
#start-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    text-align: center;
}

.start-title {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-shadow: 3px 3px #ff0000, -3px -3px #0000ff;
}

.press-start {
    animation: blink 1s step-start 0s infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* Main-Content: Game World */
#game-world {
    display: grid;
    grid-template-areas:
        "header"
        "main"
        "footer";
    grid-template-rows: auto 1fr auto;
    height: 100vh;
    padding: 1rem;
    box-sizing: border-box;
}

.game-header {
    grid-area: header;
}

.game-main {
    grid-area: main;
    display: flex;
    gap: 2rem;
    overflow: hidden;
}

.game-footer {
    grid-area: footer;
}

/*Navigation: Hero Stats */
#hero-stats-nav {
    width: 35%;
    padding: 1rem;
}

#hero-stats-nav .map-location {
    margin-bottom: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

#hero-stats-nav .map-location:hover,
#hero-stats-nav .map-location.is-active {
    background-color: #525252 !important;
    /* Override nes.css */
    transform: translateY(-2px);
}

/* Display Content  */
#content-display {
    width: 65%;
    height: calc(100% - 2rem);
    /*Full height minus padding*/
}

#text-content {
    height: 90%;
    font-size: 36px;
    font-family: "VT323", monospace;
    font-weight: 400;
    font-style: normal;
    overflow-y: auto;
    word-wrap: break-word;
}

/* Custom content styling */
.skill-item {
    margin-bottom: 1.5rem;
}


.project-card {
    margin-bottom: 2rem;
}

.social-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.social-links-grid .nes-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Footer */
footer {
    text-align: center;
}

/* Utility */
.hidden {
    display: none !important;
}

#content-title {
    color: #000;
    /* Black text color */
    background-color: #fff;
    padding: 0.5rem 1rem;
    display: inline-block;
    margin-bottom: 1rem;
    border: 2px solid #000;
}

.nes-container.with-title>.title {
    color: #000;
    /* Ensure text is visible on white background */
}

/* Mobile View:  */
@media (max-width: 768px) {

    /* Fix body overflow for mobile */
    body {
        overflow-y: auto;
    }

    /* Game world mobile adjustment */
    #game-world {
        height: auto;
        min-height: 100vh;
        margin-top: 1rem;
        padding: 0.5rem;
    }

    /* Header Mobile */
    .game-header .nes-container {
        padding: 0.5rem;
    }

    .game-header .title {
        font-size: 0.8rem;
    }

    .game-header>div>div {
        flex-direction: column !important;
        gap: 0.5rem;
        align-items: stretch !important;
    }

    .game-header .nes-badge {
        align-self: center;
    }

    /* hamburger menu for mobile */
    .mobile-menu-toggle {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        width: 40px;
        height: 40px;
        background: #212529;
        border: 3px solid #fff;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 4px;
        z-index: 10;
        transition: all 0.2s ease;
    }

    /* hamburger menu hidden on Desktop */
    @media (min-width: 769px) {
        .mobile-menu-toggle {
            display: none;
        }
    }

    .mobile-menu-toggle:hover {
        background: #525252;
        transform: scale(1.1);
    }

    .mobile-menu-toggle span {
        width: 20px;
        height: 3px;
        background: #fff;
        display: block;
        transition: all 0.3s ease;
    }

    /* animate hamburger menu */
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    /* Vertical Stack of main content */
    .game-main {
        flex-direction: column;
        gap: 1rem;
        overflow: visible;
        height: auto;
    }

    /* Navigation Mobile - Show hamburger, hide menu items by default */
    #hero-stats-nav {
        width: 100%;
        padding: 0.5rem;
        margin-bottom: 2rem;
        order: 1;
        display: block;
        position: relative;
    }

    /* Hide navigation links by default, show only hamburger */
    #hero-stats-nav .map-location {
        display: none;
        margin-bottom: 0.5rem;
        font-size: 0.7rem;
        padding: 0.5rem;
        border: 2px solid #fff;
        background: #212529;
        transition: all 0.2s ease;
        animation: slideDown 0.3s ease-in-out;
    }

    /* Show navigation links when menu is open */
    #hero-stats-nav.mobile-menu-open .map-location {
        display: block;
    }

    #hero-stats-nav .map-location:hover {
        background: #525252;
        transform: translateX(5px);
    }

    /* Content Display Mobile */
    #content-display {
        width: 100%;
        height: auto;
        min-height: 250px;
        order: 2;
        padding: 0.5rem;
    }

    #text-content {
        height: auto;
        min-height: 150px;
        font-size: 22px;
        padding: 0.5rem;
        overflow-y: auto;
        max-height: 300px;
    }

    /* Slide down animation for menu */
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-20px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}