:root {
    --bg-color: #000000;
    --primary-color: #00ff00;
    /* Hacker Green */
    --secondary-color: #00ffff;
    /* Cyber Cyan */
    --accent-color: #ff00ff;
    /* Neon Magenta */
    --text-color: #00ff00;
    --dim-color: #005500;
    --font-main: 'VT323', monospace;
    --glow: 0 0 10px var(--primary-color);
    --scanline-color: rgba(0, 255, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    font-size: 1.2rem;
    text-shadow: 0 0 5px var(--dim-color);
}

/* CRT Scanline Effect */
.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(to bottom,
            rgba(255, 255, 255, 0),
            rgba(255, 255, 255, 0) 50%,
            rgba(0, 0, 0, 0.2) 50%,
            rgba(0, 0, 0, 0.2));
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 9999;
    animation: scroll 10s linear infinite;
}

@keyframes scroll {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 100%;
    }
}

.terminal-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    border: 2px solid var(--dim-color);
    box-shadow: inset 0 0 20px var(--dim-color);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--dim-color);
    margin-bottom: 10px;
}

h1 {
    font-size: 2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: flicker 2s infinite;
}

@keyframes flicker {

    0%,
    19%,
    21%,
    23%,
    25%,
    54%,
    56%,
    100% {
        opacity: 1;
        text-shadow: 0 0 10px var(--primary-color);
    }

    20%,
    24%,
    55% {
        opacity: 0.5;
        text-shadow: none;
    }
}

.stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.stat-item {
    display: flex;
    gap: 10px;
}

.label {
    color: var(--secondary-color);
}

.value {
    font-weight: bold;
}

.lives-display {
    display: flex;
    gap: 5px;
}

.life-hex {
    width: 15px;
    height: 15px;
    background-color: var(--primary-color);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    transition: all 0.3s ease;
    box-shadow: 0 0 5px var(--primary-color);
}

.life-hex.lost {
    background-color: transparent;
    border: 1px solid var(--accent-color);
    /* Magenta border for lost life */
    box-shadow: none;
    opacity: 0.5;
}

.icon-btn {
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    font-family: var(--font-main);
    cursor: pointer;
    padding: 5px 10px;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--primary-color);
    color: var(--bg-color);
    box-shadow: var(--glow);
}

#requirements-container {
    position: absolute;
    top: 80px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    border: 1px solid var(--dim-color);
    max-width: 300px;
    pointer-events: none;
}

#requirements-list {
    list-style: none;
    margin-top: 5px;
}

#requirements-list li {
    margin-bottom: 5px;
}

#requirements-list li.met {
    color: var(--dim-color);
    text-decoration: line-through;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay-content {
    text-align: center;
    border: 2px solid var(--primary-color);
    padding: 40px;
    background: #000;
    box-shadow: var(--glow);
}

.hidden {
    display: none !important;
}

button {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    font-family: var(--font-main);
    font-size: 1.5rem;
    padding: 10px 20px;
    margin: 10px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
}

button:hover {
    background: var(--primary-color);
    color: var(--bg-color);
    box-shadow: var(--glow);
}

#game-canvas {
    flex-grow: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    /* Prevent flex overflow */
    cursor: crosshair;
}

#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-color);
    border: 1px solid var(--secondary-color);
    color: var(--secondary-color);
    padding: 10px 20px;
    animation: slideIn 0.3s ease-out;
    border: 2px solid var(--dim-color);
    box-shadow: inset 0 0 20px var(--dim-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .terminal-container {
        padding: 10px;
    }

    header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    h1 {
        font-size: 1.5rem;
        text-align: center;
    }

    .stats {
        justify-content: space-between;
        font-size: 1rem;
    }

    .stat-item {
        gap: 5px;
    }

    #requirements-container {
        top: auto;
        bottom: 60px;
        left: 10px;
        right: 10px;
        max-width: none;
        font-size: 0.9rem;
    }

    button {
        font-size: 1.2rem;
        padding: 8px 16px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.2rem;
    }

    .stats {
        flex-wrap: wrap;
        gap: 10px;
    }

    .stat-item {
        flex-basis: 45%;
    }
}