:root {
    --bg-color: #000000;
    --text-color: #ffffff;
    --accent-color: #aaaaaa;
    --block-a: #ffffff;
    --block-h: #ffffff;
    --canvas-bg: #050505;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Press Start 2P', monospace;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    user-select: none;
}

/* CRT Scanline Effect */
.crt::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.45) 50%), linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.05));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

.game-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100vw;
    padding: 10px;
    box-sizing: border-box;
}

.corner-text {
    position: absolute;
    font-size: clamp(0.5rem, 1.2vw, 0.8rem);
    color: var(--text-color);
    z-index: 20;
    text-transform: uppercase;
    pointer-events: none;
    padding: 20px;
}

.top-left {
    top: 0;
    left: 0;
}

.top-right {
    top: 0;
    right: 0;
    text-align: right;
    text-transform: none;
    max-width: 50vw;
    word-wrap: break-word;
}

.bottom-left {
    bottom: 0;
    left: 0;
}

.bottom-right {
    bottom: 0;
    right: 0;
    text-align: right;
    max-width: 60vw;
    word-wrap: break-word;
    line-height: calc(1em + 1pt);
}

.score-board {
    display: flex;
    justify-content: space-between;
    width: 80%;
    max-width: 640px;
    margin-bottom: 10px;
    font-size: clamp(0.7rem, 2.5vw, 1.2rem);
    text-shadow: 2px 2px 0px #555;
}

#gameCanvas {
    background-color: #ffffff;
    border: 4px solid var(--text-color);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.4);
    image-rendering: pixelated;
    display: block;
    width: 80%;
    max-width: 640px;
    height: auto;
    aspect-ratio: 4 / 3;
    touch-action: none;
    /* Prevent scroll on canvas drag */
}

.controls {
    margin-top: 20px;
    width: 80%;
    max-width: 640px;
    font-size: clamp(0.5rem, 1.5vw, 0.8rem);
    color: var(--accent-color);
    text-align: center;
}

/* Start Screen */
#startScreen {
    width: 80%;
    max-width: 640px;
    aspect-ratio: 4 / 3;
    background-color: #ffffff;
    color: #000000;
    border: 4px solid var(--text-color);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-sizing: border-box;
}

.pixel-logo {
    width: 40%;
    height: auto;
    image-rendering: pixelated;
    margin-bottom: 40px;
    filter: invert(1);
}

.flash-text {
    text-align: center;
    font-size: clamp(0.6rem, 2vw, 1rem);
    line-height: 1.5;
    animation: flash 1s step-end infinite;
    text-transform: lowercase;
}

@keyframes flash {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Credits Overlay */
#creditsOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    color: #fff;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    font-family: Arial, Helvetica, sans-serif;
    padding: 0;
    scroll-behavior: auto;
}

#creditsContent {
    width: 90%;
    max-width: 700px;
    text-align: center;
    line-height: 1.6;
    font-size: clamp(0.9rem, 3.5vw, 1.1rem);
    padding-top: 50vh;
    padding-bottom: 25vh;
    /* Less padding so it stops sooner */
}

/* Rest of the credits */

.logos-container {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-top: 40px;
}

.logos-container img {
    max-width: 150px;
    max-height: 80px;
    width: auto;
    height: auto;
    object-fit: contain;
}

#creditsFooter {
    margin-top: 15vh;
    /* Spacer after the logos */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 75vh;
    /* Give it enough height to be centered when scrolled to bottom */
}

#creditsFooterLogo {
    width: 40%;
    max-width: 250px;
    margin-bottom: 20px;
    filter: none;
}

.skip-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 0.6rem;
    color: #444;
    cursor: pointer;
    z-index: 15;
    font-family: 'Press Start 2P', monospace;
}

#creditsContent p {
    margin-bottom: 15px;
}

#creditsContent strong {
    font-size: clamp(1rem, 4vw, 1.2rem);
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 5px;
    font-family: 'Press Start 2P', monospace;
}