:root {
    --bg-color: #111;
    --text-color: #fff;
    --accent-color: #0f0;
    --retro-font: 'Press Start 2P', cursive;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    touch-action: none;
    /* Prevent default touch actions like scrolling */
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--retro-font);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 600px;
    /* Keep it playable on desktop */
    aspect-ratio: 9/16;
    background: #000;
    border: 2px solid #333;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.2);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.preview-canvas {
    width: auto;
    height: auto;
}

#ui-layer {
    position: absolute;
    top: 10px;
    left: 0;
    width: 100%;
    padding: 0 10px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    font-size: 12px;
    color: var(--accent-color);
    text-shadow: 2px 2px #000;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 10;
}

.hidden {
    display: none;
}

h1 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #ff0055;
    text-shadow: 4px 4px #000;
    line-height: 1.5;
}

p {
    font-size: 14px;
    animation: blink 1s infinite;
    line-height: 2em;
}

button {
    background: var(--accent-color);
    border: none;
    padding: 15px 30px;
    font-family: var(--retro-font);
    font-size: 16px;
    line-height: 2em;
    cursor: pointer;
    margin-top: 20px;
    color: #000;
}

button:active {
    transform: scale(0.95);
}

button:hover {
    background: white;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* CRT Scanline Effect */
#game-container::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

#life-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

#life-bar-bg {
    width: 100px;
    height: 15px;
    background: #333;
    border: 2px solid #fff;
    position: relative;
}

#life-bar-fill {
    width: 100%;
    height: 100%;
    background: #0f0;
    transition: width 0.2s, background-color 0.2s;
}

/* New Screens */
.instruction-list {
    text-align: left;
    margin-bottom: 20px;
    padding: 0 20px;
}

.instruction-list p {
    margin-bottom: 15px;
    animation: none;
    /* No Blink */
    color: #ccc;
    font-size: 10px;
    line-height: 1.6;
}

.highlight {
    color: #0f0;
    font-weight: bold;
}

.blink {
    animation: blink 0.5s infinite;
}

#level-transition-screen h1 {
    color: #0f0;
}

#level-transition-screen h2 {
    color: #fff;
    font-size: 16px;
    margin-top: 20px;
}

/* Violent Shake Animation */
@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}

.shake {
    animation: shake 0.5s;
    animation-iteration-count: infinite;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    text-align: left;
}

.instruction-item canvas {
    border: 2px solid #333;
    background: #000;
    flex-shrink: 0;
}

.instruction-item p {
    margin: 0;
    font-size: 10px;
    line-height: 1.4;
}

.copyright {
    position: absolute;
    bottom: 10px;
    font-size: 10px;
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    animation: none;
}

.screen.victory {
    background: rgba(0, 0, 0, 0.3);
}

.victory-text {
    color: #FFD700;
    text-shadow: 0 0 10px #ff8c00;
    font-size: 40px;
    animation: shake 2s infinite;
}