* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0a0a14;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Press Start 2P', monospace;
    overflow: hidden;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 640px;
    max-height: 960px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    overflow: hidden;
}

#canvas {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#loading-screen,
#title-screen,
#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg, #0f0f23 0%, #1a1a3e 50%, #0f0f23 100%);
    z-index: 10;
}

#loading-screen h1,
#title-screen h1,
#game-over-screen h1 {
    font-size: clamp(1.2rem, 5vw, 2rem);
    color: #ffd700;
    text-shadow: 
        0 0 10px #ffd700,
        0 0 20px #ff8c00,
        0 0 30px #ff4500,
        4px 4px 0 #8b0000;
    margin-bottom: 2rem;
    text-align: center;
    padding: 0 1rem;
    animation: titleGlow 2s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 10px #ffd700, 0 0 20px #ff8c00, 0 0 30px #ff4500, 4px 4px 0 #8b0000; }
    50% { text-shadow: 0 0 20px #ffd700, 0 0 40px #ff8c00, 0 0 60px #ff4500, 4px 4px 0 #8b0000; }
}

.loading-content {
    text-align: center;
    width: 80%;
    max-width: 300px;
}

.loading-bar-container {
    width: 100%;
    height: 20px;
    background: #333;
    border: 2px solid #666;
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.3s ease;
}

#loading-text {
    color: #aaa;
    font-size: 0.6rem;
}

.subtitle {
    color: #87CEEB;
    font-size: 0.7rem;
    margin-bottom: 3rem;
}

.blink {
    color: #fff;
    font-size: clamp(0.5rem, 2.5vw, 0.8rem);
    animation: blink 1s ease-in-out infinite;
    margin-bottom: 2rem;
    text-align: center;
    padding: 0 1rem;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.controls-info {
    color: #888;
    font-size: 0.5rem;
    line-height: 2;
    text-align: center;
    margin-bottom: 2rem;
}

.final-score {
    color: #ffd700;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.high-score {
    color: #87CEEB;
    font-size: 0.8rem;
    margin-bottom: 2rem;
}

.footer {
    position: absolute;
    bottom: 1.5rem;
    color: #666;
    font-size: 0.5rem;
    text-align: center;
}

.footer a {
    color: #888;
    text-decoration: none;
}

.footer a:hover {
    color: #ffd700;
}

/* Scanline effect */
#game-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1) 0px,
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 100;
}

/* CRT vignette */
#game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        transparent 60%,
        rgba(0, 0, 0, 0.4) 100%
    );
    pointer-events: none;
    z-index: 99;
}

@media (max-width: 480px) {
    #title-screen h1,
    #game-over-screen h1 {
        font-size: 1.2rem;
    }
    
    .blink {
        font-size: 0.5rem;
    }
    
    .controls-info {
        font-size: 0.4rem;
    }
}