: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;
    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: none;
}

#levelDisplay {
    display: none;
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(1rem, 3vw, 1.6rem);
    color: #ffffff;
    text-align: center;
    letter-spacing: 0.15em;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

#gameCanvas {
    background-color: #050505;
    border: 4px solid #ffffff;
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.5), inset 0 0 24px rgba(0, 0, 0, 0.6);
    image-rendering: pixelated;
    display: block;
    max-width: 380px;
    width: 80%;
    height: auto;
    touch-action: none;
}

.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: 380px;
    aspect-ratio: 8 / 9;
    background-color: #050505;
    color: #ffffff;
    border: 4px solid var(--text-color);
    box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-sizing: border-box;
}

/* Mobile: fill screen width, remove side padding */
@media (max-width: 767px) {
    body {
        padding: 0;
        overflow-x: hidden;
        justify-content: center;
    }

    .game-container {
        padding: 4px;
    }

    #gameCanvas,
    #startScreen {
        width: calc(100% - 32px);
        max-width: calc(100% - 32px);
        margin: 0 auto;
    }

    .score-board {
        width: 95%;
        max-width: 100%;
    }

    .controls {
        width: 95%;
        max-width: 100%;
        font-size: 0.45rem;
    }

    .corner-text {
        font-size: 0.4rem;
        padding: 8px 10px;
    }

    .bottom-right {
        max-width: 75vw;
    }
}

.pixel-logo {
    width: 60%;
    height: auto;
    image-rendering: pixelated;
    margin-bottom: 20px;
    filter: none;
}

.start-static-text {
    text-align: center;
    font-size: clamp(0.6rem, 2vw, 1rem);
    line-height: 1.8;
    text-transform: lowercase;
    margin: 0 0 8px 0;
    opacity: 0.7;
}

.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;
    margin: 0;
}

@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: 'Press Start 2P', monospace;
    padding: 0;
    scroll-behavior: auto;
}

#creditsContent {
    width: 90%;
    max-width: 700px;
    text-align: center;
    line-height: 1.6;
    font-size: clamp(0.5rem, 2vw, 0.7rem);
    line-height: 2.2;
    padding-top: 50vh;
    padding-bottom: 25vh;
}

/* 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;
    position: relative;
}

.logo-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin: 0;
    cursor: default;
}

.logos-container img {
    max-width: 180px;
    max-height: 90px;
    width: auto;
    height: auto;
    object-fit: contain;
    /* 16-bit pixel effect */
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    filter: contrast(1.2) saturate(0.6) brightness(1.1) grayscale(0.3);
    outline: 2px solid rgba(255, 255, 255, 0.15);
    outline-offset: 4px;
    transition: filter 0.2s, outline 0.2s;
}

.logo-item figcaption {
    margin-top: 8px;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.45rem;
    color: #ffffff;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s, transform 0.2s;
    text-align: center;
    white-space: nowrap;
    letter-spacing: 0.05em;
    pointer-events: none;
}

.logo-item:hover figcaption {
    opacity: 1;
    transform: translateY(0);
}

.logo-item:hover img {
    filter: contrast(1.3) saturate(1.2) brightness(1.2) grayscale(0);
    outline: 2px solid rgba(255, 255, 255, 0.5);
}

/* Scanline overlay on logo grid */
.logos-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.25) 2px,
            rgba(0, 0, 0, 0.25) 4px);
    pointer-events: none;
    z-index: 1;
}

#creditsFooter {
    margin-top: 15vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 75vh;
}

#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;
}

.credits-intro p {
    margin-bottom: 0;
    line-height: 1.4;
}

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