:root {
    --bg-color: #0d1117;
    --text-color: #c9d1d9;
    --accent-color: #00ff41;
    /* Hacker Green */
    --accent-dim: #008f11;
    --secondary-bg: #161b22;
    --border-color: #30363d;
    --card-bg: #21262d;
    --font-mono: 'Courier New', Courier, monospace;
    --font-sans: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-sans);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

h1,
h2,
h3 {
    color: var(--accent-color);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 1px;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: #fff;
    text-shadow: 0 0 5px var(--accent-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 80px;
    /* Space for navbar */
    width: 95%;
    /* Flexible width */
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(13, 17, 23, 0.95);
    border-bottom: 2px solid var(--accent-color);
    height: 60px;
    /* Fixed height for consistency */
    display: flex;
    /* Flex container */
    align-items: center;
    /* Center vertically */
    z-index: 1000;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.2);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: center;
    /* Center links on desktop */
    align-items: center;
    padding: 0 20px;
}

.navbar .nav-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar a {
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 1.1rem;
}

.hamburger {
    display: none;
    /* Hidden by default */
    cursor: pointer;
    position: absolute;
    right: 20px;
    /* Fix to right */
}

.hamburger .line {
    width: 25px;
    height: 3px;
    background-color: var(--accent-color);
    margin: 5px;
    transition: all 0.3s ease;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 60px 20px;
    border-bottom: 1px solid var(--border-color);
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 0 0 10px var(--accent-dim);
}

.hero p {
    font-size: 1.5rem;
    color: #8b949e;
    max-width: 800px;
    margin: 0 auto;
}

/* Cards */
.grid {
    display: grid;
    /* Responsive columns: auto-fit with min size. 
       If screen < 300px, 1 column. 
       If > 600px, 2 columns, etc. */
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 20px;
    transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.card h3 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

/* Buttons */
.btn {
    display: inline-block;
    background-color: var(--accent-dim);
    color: #fff;
    padding: 10px 20px;
    border: 1px solid var(--accent-color);
    border-radius: 4px;
    font-family: var(--font-mono);
    cursor: pointer;
    margin-top: 10px;
}

.btn:hover {
    background-color: var(--accent-color);
    color: #000;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px;
    margin-top: 60px;
    border-top: 1px solid var(--border-color);
    color: #8b949e;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

/* Code Blocks */
pre {
    background-color: #000;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #333;
    overflow-x: auto;
    font-family: var(--font-mono);
    color: #e6edf3;
    max-width: 100%;
    /* Prevent overflow */
}

code {
    font-family: var(--font-mono);
    background-color: rgba(110, 118, 129, 0.4);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
    word-break: break-all;
    /* Break long words/paths */
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: var(--card-bg);
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--secondary-bg);
    color: var(--accent-color);
    font-family: var(--font-mono);
}

tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Glitch Effect (Simple) */
.glitch {
    position: relative;
    display: inline-block;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 1.2em;
    background-color: var(--accent-color);
    animation: blink 1s infinite;
    vertical-align: bottom;
}

/* Reward Section */
.reward-section {
    text-align: center;
    margin-top: 60px;
    padding: 40px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    transition: all 0.5s ease;
}

.reward-locked {
    opacity: 0.8;
    filter: grayscale(80%);
    /* pointer-events: none; REMOVED to allow clicking */
}

.reward-unlocked {
    opacity: 1;
    filter: grayscale(0%);
    border-color: gold;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.reward-btn {
    background: #333;
    color: #777;
    border-color: #555;
    /* cursor: not-allowed; Default cursor indicates clickable now */
    cursor: pointer;
}

.reward-unlocked .reward-btn {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #000;
    border: none;
    font-weight: bold;
    cursor: pointer;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 215, 0, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0);
    }
}

/* Responsive Flex Utility */
.responsive-flex {
    display: flex;
    gap: 20px;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    .responsive-flex {
        flex-direction: column;
    }

    .nav-container {
        justify-content: flex-end;
        /* Push hamburger to right */
    }

    .hamburger {
        display: block;
        z-index: 1002;
        /* Above mobile menu */
    }

    .navbar .nav-links {
        position: fixed;
        background: var(--secondary-bg);
        height: 100vh;
        width: 100%;
        top: 0;
        left: 0;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        transform: translateY(-100%);
        /* Slide down */
        transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
        pointer-events: none;
        opacity: 0;
        z-index: 1001;
    }

    .navbar .nav-links.open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
    }

    .navbar .nav-links li {
        margin: 20px 0;
    }

    /* Content adjustments */
    .container {
        padding-top: 70px;
        /* Reduced padding top */
        width: 100%;
        padding-left: 15px;
        padding-right: 15px;
        box-sizing: border-box;
        /* Crucial for padding inclusion */
    }

    .hero {
        padding: 30px 10px;
    }

    .hero h1 {
        font-size: 1.8rem;
        word-wrap: break-word;
        /* Prevent text overflow */
    }

    .hero p {
        font-size: 1rem;
    }

    /* Grid Adjustments */
    .grid {
        grid-template-columns: 1fr;
        /* Single column on mobile */
        gap: 15px;
    }

    /* Table Adjustments */
    table {
        display: block;
        width: 100% !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        font-size: 0.85rem;
        box-sizing: border-box;
        /* Fix padding issues */
    }

    th,
    td {
        padding: 10px;
    }

    /* Input & Button stacking in tables */
    .flag-input-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
        min-width: 150px;
    }

    .flag-input-group button {
        width: 100%;
    }

    /* GHIDRA SIMULATOR MOBILE FIXES */
    .ghidra-container {
        display: flex !important;
        flex-direction: column;
        height: auto !important;
        border: none;
        min-height: auto;
    }

    .toolbar {
        flex-wrap: wrap;
        height: auto;
        padding: 10px;
        gap: 5px;
    }

    .toolbar,
    .status-bar,
    .symbol-tree,
    .listing-view,
    .decompiler-view {
        width: 100% !important;
        /* Force full width */
        max-width: 100%;
        box-sizing: border-box;
        /* Include padding/borders */
    }

    .symbol-tree {
        height: 200px;
        border-right: none;
        border-bottom: 2px solid #444;
    }

    .listing-view,
    .decompiler-view {
        height: 300px;
        border-right: none;
        border-bottom: 2px solid #444;
        font-size: 12px;
        /* Smaller font on mobile */
    }

    /* Reset Button Position */
    button[onclick="window.resetProgress()"] {
        left: 10px;
        bottom: 10px;
        font-size: 0.75rem;
        padding: 8px 10px;
        width: auto;
    }
}