@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 10px;
    background: linear-gradient(to bottom, #ffffff 40%, #fffffffa 100%);
    font-family: 'Press Start 2P', cursive;
    overflow: hidden;
    position: relative;
}

#bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    background-size: cover;
    background-position: bottom;
    background-repeat: no-repeat;
    transition: background-image 0.8s;
    pointer-events: none;
    filter: blur(6px);
}

#gameCanvas, #title, #instructions {
    position: relative;
    z-index: 1;
}

#title { 
    color: #fff;
    font-size: clamp(1.2rem, 4vw, 2.5rem);
    margin: 10px 0 5px 0;
    text-shadow: 2px 2px 0 #222, 4px 4px 0 #ff0;
    text-align: center;
}

#instructions {
    color: #fff;
    font-size: clamp(0.4rem, 2vw, 1rem);
    margin-bottom: 10px;
    text-shadow: 1px 1px 0 #222;
    text-align: center;
    padding: 0 10px;
}

#gameCanvas {
    border: 4px solid #ffffff5a;
    background: #70c1ff;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    image-rendering: pixelated;
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
}

/* Mobile specific styles */
@media (max-width: 768px) {
    body {
        padding: 5px;
        justify-content: flex-start;
        padding-top: 20px;
    }

    #title {
        margin: 5px 0;
    }

    #instructions {
        margin-bottom: 15px;
        line-height: 1.4;
    }

    #gameCanvas {
        max-height: 65vh;
        border-width: 2px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 2px;
        padding-top: 10px;
    }

    #title {
        margin: 2px 0;
    }

    #instructions {
        margin-bottom: 10px;
    }

    #gameCanvas {
        max-height: 60vh;
        max-width: 98%;
    }
}

/* Landscape mobile */
@media (max-height: 600px) and (orientation: landscape) {
    body {
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        padding: 5px;
    }

    .game-info {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-right: 20px;
    }

    #gameCanvas {
        max-height: 85vh;
        max-width: 60vw;
    }
}

/* Very small screens */
@media (max-width: 320px) {
    #title {
        font-size: 1rem;
    }

    #instructions {
        font-size: 0.35rem;
    }

    #gameCanvas {
        max-height: 55vh;
    }
}