:root {
    --primary-color: #00f3ff;
    --secondary-color: #ff0055;
    --bg-color: #050505;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-color: #ffffff;
    --font-main: 'Roboto', sans-serif;
    --font-display: 'Orbitron', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    /* Overflow handled by JS */
    overflow-x: hidden;
    height: 100vh;
    width: 100vw;
}

#game-container {
    position: fixed;
    /* Fixed to prevent scrolling the game container itself */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a1a2e 0%, #000000 100%);
}

canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    z-index: 1;
    /* Ensure it's behind screens (z-index 10) */
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 10;
    transition: opacity 0.5s ease;
    overflow-y: auto;
    /* Allow scrolling content within screens */
    padding: 20px;
    /* Add padding for smaller screens */
}

.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
    /* Ensure it's removed from flow */
}

.active {
    opacity: 1;
    pointer-events: auto;
    display: flex !important;
}

/* Typography */
h1 {
    font-family: var(--font-display);
    font-size: 4rem;
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 5px;
    text-shadow: 0 0 10px var(--primary-color), 0 0 20px var(--primary-color);
    text-align: center;
}

h2 {
    font-family: var(--font-display);
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    text-transform: uppercase;
}

.glitch {
    position: relative;
}

.danger {
    color: var(--secondary-color);
    text-shadow: 0 0 10px var(--secondary-color), 0 0 20px var(--secondary-color);
}

.story-container {
    max-width: 600px;
    text-align: center;
    line-height: 1.6;
    background: var(--glass-bg);
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    position: relative;
}

.story-container p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.highlight {
    color: var(--primary-color);
    font-weight: bold;
}

.myth {
    font-style: italic;
    color: #aaa;
    margin-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
    padding-top: 1rem;
}

/* Close Button */
.close-btn {
    position: fixed;
    top: 20px;
    right: 30px;
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 3rem;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    line-height: 1;
    padding: 0;
    text-shadow: 0 0 10px var(--primary-color), 0 0 20px var(--primary-color);
}

.close-btn:hover {
    color: #fff;
    text-shadow: 0 0 15px var(--primary-color);
    transform: scale(1.1);
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.cyber-btn {
    background: transparent;
    color: var(--primary-color);
    font-family: var(--font-display);
    font-size: 1.5rem;
    padding: 1rem 3rem;
    border: 2px solid var(--primary-color);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 5;
    font-family: var(--font-display);
    font-size: 1.5rem;
    text-shadow: 0 0 10px var(--primary-color);
    box-shadow: 0 0 15px var(--primary-color), inset 0 0 10px var(--primary-color);
}

.cyber-btn:hover {
    background: var(--primary-color);
    color: #000;
    box-shadow: 0 0 30px var(--primary-color), inset 0 0 15px var(--primary-color);
    text-shadow: none;
}

.icon-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    position: fixed;
    right: 30px;
    top: 30px;
    z-index: 2000;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    font-family: var(--font-display);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px var(--primary-color), inset 0 0 10px var(--primary-color);
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 15px var(--primary-color), inset 0 0 10px var(--primary-color);
    }

    50% {
        box-shadow: 0 0 25px var(--primary-color), inset 0 0 15px var(--primary-color);
    }

    100% {
        box-shadow: 0 0 15px var(--primary-color), inset 0 0 10px var(--primary-color);
    }
}

.icon-btn:hover {
    background: var(--primary-color);
    color: #000;
    box-shadow: 0 0 40px var(--primary-color);
    transform: scale(1.1);
}

#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 20;
    pointer-events: none;
}

.score-board,
.lives-board {
    background: transparent;
    padding: 0;
    border: none;
    text-shadow: 0 0 10px var(--primary-color), 0 0 20px var(--primary-color);
}

.lives-board {
    margin-right: 80px;
    text-align: right;
    transition: margin-right 0.3s ease;
}

.lives-board.align-right {
    margin-right: 0;
}

#score {
    color: #fff;
    font-weight: bold;
}

#lives {
    color: var(--primary-color);
    font-weight: bold;
    text-shadow: 0 0 10px var(--primary-color);
}

/* Persistent Link */
.persistent-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    color: var(--primary-color);
    font-family: var(--font-display);
    font-size: 1rem;
    text-decoration: none;
    z-index: 2000;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 5px 10px;
    border: 1px solid transparent;
    transition: all 0.3s;
    opacity: 0.7;
}

.persistent-link:hover {
    opacity: 1;
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
    background: rgba(0, 243, 255, 0.1);
}

/* Specific Screen Z-Indices */
#story-overlay {
    z-index: 100;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    .story-container {
        width: 90%;
        padding: 1rem;
    }

    .cyber-btn {
        font-size: 1.2rem;
        padding: 0.8rem 2rem;
    }

    .icon-btn {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        right: 15px;
        top: 15px;
    }

    #hud {
        font-size: 1.2rem;
    }
}