/* Pixel Font Import */
body {
    font-family: 'Press Start 2P', cursive; /* Main retro font */
    margin: 0;
    overflow: hidden; /* Hide scrollbars, keep content fixed */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #000; /* Black background for CRT effect */
    color: #0F0; /* Default green pixel text */
    text-shadow: 0 0 8px rgba(0,255,0,0.5); /* Subtle pixel glow */
    font-size: 14px; /* Default pixel font size */
    line-height: 1.4;
    -webkit-font-smoothing: none; /* No anti-aliasing for pixel perfect look */
    -moz-osx-font-smoothing: grayscale;
    image-rendering: pixelated; /* Ensures any scaled images look pixelated */
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.container {
    max-width: 800px; /* Constrain content width */
    margin: 0 auto;
    padding: 10px; /* Small padding for pixel vibe */
}

/* CRT Screen Effect */
.crt-screen {
    position: relative;
    width: 90vw; /* Occupy most of the viewport width */
    max-width: 1000px; /* Max size for larger screens */
    aspect-ratio: 16 / 9; /* Classic TV aspect ratio */
    background-color: #010101; /* Dark inner screen */
    border: 5px solid #222; /* Outer casing border */
    border-radius: 15px; /* Slightly rounded corners */
    box-shadow: inset 0 0 20px rgba(0,255,0,0.3), /* Inner glow */
                0 0 30px rgba(0,255,0,0.4); /* Outer glow */
    overflow: hidden;
    display: flex;
    flex-direction: column; /* Stack header, main, footer */
}

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0,0,0,0) 0px,
        rgba(0,0,0,0.3) 1px,
        rgba(0,0,0,0) 2px
    );
    pointer-events: none; /* Allow clicks through scanlines */
    z-index: 10;
}

/* Game Header */
.game-header {
    background-color: #000;
    border-bottom: 3px solid #0F0;
    padding: 10px 0;
    text-align: center;
    position: relative;
    z-index: 5;
}

.game-title {
    color: #0F0;
    font-size: 1.5rem;
    margin: 0;
    padding: 5px;
    text-shadow: 0 0 10px #0F0, 0 0 20px #0F0; /* Stronger glow for title */
    animation: flicker 1s infinite alternate; /* Subtle flicker effect */
}

/* Game Area (Main Content) */
.game-area {
    flex-grow: 1; /* Take up remaining space */
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center content vertically */
    align-items: center;
    position: relative;
    z-index: 5;
}

.game-dialog-box {
    background-color: #2a2a2a; /* Dark background for dialog box */
    border: 3px solid #0F0; /* Green pixel border */
    padding: 20px;
    margin-bottom: 20px;
    max-width: 700px;
    width: 100%;
    box-shadow: 0 0 15px rgba(0,255,0,0.3); /* Dialog box glow */
    position: relative;
    text-align: left; /* Text inside is left-aligned */
}

.dialog-text {
    font-size: 0.9rem; /* Slightly smaller text for readability */
    color: #0F0;
    white-space: pre-wrap; /* Preserve line breaks from HTML */
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 14px;
    background-color: #0F0;
    animation: blink-cursor 0.7s infinite step-end;
    vertical-align: middle;
    margin-left: 5px;
}

/* Retro Button */
.retro-button {
    background-color: #999; /* Grey base */
    color: #000;
    font-family: 'Press Start 2P', cursive;
    font-size: 1.1rem;
    padding: 10px 20px;
    border: none;
    border-radius: 0;
    cursor: pointer;
    text-shadow: 1px 1px 0px rgba(255,255,255,0.3); /* Inner bevel effect */
    box-shadow:
        inset -2px -2px 0px #555, /* Darker bottom/right for depth */
        inset 2px 2px 0px #bbb,   /* Lighter top/left for depth */
        0 4px 0px #333;           /* Outer shadow for "pop" */
    transition: all 0.05s linear;
    text-transform: uppercase;
}

.retro-button:active {
    box-shadow:
        inset -2px -2px 0px #bbb,
        inset 2px 2px 0px #555,
        0 0px 0px #333; /* Pressed effect */
    transform: translateY(4px); /* Simulate button press */
}

/* Game Footer */
.game-footer {
    background-color: #000;
    border-top: 3px solid #0F0;
    padding: 10px 0;
    text-align: center;
    position: relative;
    z-index: 5;
}

.game-footer p {
    font-size: 0.8rem;
    color: #0F0;
    margin: 0;
    text-shadow: 0 0 5px rgba(0,255,0,0.5);
}

/* Blinking Text Animation */
@keyframes blinking-text {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

.blinking-text {
    animation: blinking-text 1s infinite;
}

/* Flicker Animation for Title */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
    52% { opacity: 1; }
    54% { opacity: 0.7; }
    56% { opacity: 1; }
}

/* Cursor Animation */
@keyframes blink-cursor {
    0%, 49% { background-color: #0F0; }
    50%, 100% { background-color: transparent; }
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    body {
        font-size: 12px;
    }
    .game-title {
        font-size: 1rem;
    }
    .hero-section h2 {
        font-size: 2rem;
    }
    .hero-section .tagline {
        font-size: 0.9rem;
    }
    .game-dialog-box {
        padding: 15px;
    }
    .retro-button {
        font-size: 0.9rem;
        padding: 8px 15px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 10px;
    }
    .crt-screen {
        width: 95vw;
        border-radius: 10px;
        border-width: 3px;
    }
    .game-title {
        font-size: 0.9rem;
    }
    .game-dialog-box {
        padding: 10px;
    }
    .game-footer p {
        font-size: 0.7rem;
    }
    .retro-button {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}