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

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

body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(45deg, #1a0f0a, #2d1b14);
    font-family: 'Press Start 2P', monospace;
    overflow: hidden;
}

#gameContainer {
    position: relative;
    width: 800px;
    height: 600px;
    background: #0d0805;
    border: 6px solid #8B4513;
    border-radius: 8px;
    overflow: hidden;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    box-shadow: 
        0 0 30px rgba(139, 69, 19, 0.5),
        inset 0 0 20px rgba(0, 0, 0, 0.8);
}

/* Mobile styles */
@media (max-width: 800px) {
    body {
        padding: 0;
        margin: 0;
        height: 100vh;
        overflow: hidden;
    }
    
    #gameContainer {
        width: 100vw;
        height: 100vh;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }
    
    #gameCanvas {
        width: 100vw;
        height: 100vh;
        object-fit: cover;
        object-position: left center; /* SHIFT THE VIEW TO THE LEFT */
    }

    #ui {
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 200;
    }
    
    #score {
        font-size: 18px;
        padding: 6px 12px;
    }
    
    #instructions {
        bottom: 10px;
        font-size: 10px;
        padding: 6px 12px;
    }
    
    #titleScreen {
        padding: 20px;
    }
    
    #titleScreen h1 {
        font-size: 24px;
        margin-bottom: 15px;
    }
    
    #titleScreen p {
        font-size: 11px;
        margin-bottom: 15px;
    }
    
    #gameOver {
        padding: 20px;
        width: 90%;
        max-width: 300px;
    }
    
    #gameOver h2 {
        font-size: 18px;
        margin-bottom: 10px;
    }
    
    #gameOver p {
        font-size: 10px;
        margin-bottom: 8px;
    }
}

#gameCanvas {
    display: block;
    background: transparent;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    position: relative;
    z-index: 1;
    cursor: pointer;
}

@media (max-width: 768px) {
    #gameCanvas {
        width: 100vw !important;
        height: 100vh !important;
        object-fit: cover;
        image-rendering: pixelated;
        image-rendering: -moz-crisp-edges;
        image-rendering: crisp-edges;
    }
}

#ui {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 100;
    pointer-events: none; /* Allow clicks to pass through */
}

#score {
    font-size: 24px;
    color: #FFD700;
    text-shadow: 
        2px 2px 0px #8B4513,
        4px 4px 8px rgba(0, 0, 0, 0.8);
    margin-bottom: 10px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #8B4513;
    border-radius: 4px;
}

#gameOver {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #2d1b14, #1a0f0a);
    color: #FFD700;
    padding: 40px;
    border: 6px solid #8B4513;
    border-radius: 12px;
    text-align: center;
    display: none;
    z-index: 200;
    box-shadow: 
        0 0 40px rgba(0, 0, 0, 0.9),
        inset 0 0 20px rgba(139, 69, 19, 0.3);
}

#gameOver h2 {
    margin: 0 0 20px 0;
    font-size: 20px;
    text-shadow: 2px 2px 0px #8B4513;
    color: #FF6B35;
}

#gameOver p {
    margin: 15px 0;
    font-size: 14px;
    text-shadow: 1px 1px 0px #8B4513;
}

#restartBtn {
    background: linear-gradient(135deg, #FF6B35, #E55A2B);
    color: #fff;
    border: 4px solid #8B4513;
    border-radius: 8px;
    padding: 16px 28px;
    font-size: 14px;
    font-family: 'Press Start 2P', monospace;
    cursor: pointer;
    margin-top: 20px;
    text-shadow: 1px 1px 0px #8B4513;
    box-shadow: 
        0 4px 0 #8B4513,
        0 6px 12px rgba(0, 0, 0, 0.6);
    transition: all 0.1s ease;
}

#restartBtn:hover {
    background: linear-gradient(135deg, #E55A2B, #D44920);
    transform: translateY(2px);
    box-shadow: 
        0 2px 0 #8B4513,
        0 4px 8px rgba(0, 0, 0, 0.6);
}

#instructions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #FFD700;
    font-size: 12px;
    text-align: center;
    text-shadow: 2px 2px 0px #8B4513;
    z-index: 100;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border: 2px solid #8B4513;
    border-radius: 4px;
    pointer-events: none; /* Allow clicks to pass through */
}

#titleScreen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #2d1b14, #1a0f0a);
    color: #FFD700;
    padding: 60px;
    border: 8px solid #8B4513;
    border-radius: 16px;
    text-align: center;
    z-index: 300;
    box-shadow: 
        0 0 50px rgba(0, 0, 0, 0.9),
        inset 0 0 30px rgba(139, 69, 19, 0.3);
}

#titleScreen h1 {
    font-size: 32px;
    margin-bottom: 30px;
    text-shadow: 3px 3px 0px #8B4513;
    color: #FF6B35;
}

#titleScreen p {
    font-size: 14px;
    margin-bottom: 40px;
    text-shadow: 1px 1px 0px #8B4513;
}

#startBtn {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #8B4513;
    border: 4px solid #8B4513;
    border-radius: 8px;
    padding: 20px 32px;
    font-size: 16px;
    font-family: 'Press Start 2P', monospace;
    cursor: pointer;
    text-shadow: none;
    box-shadow: 
        0 4px 0 #8B4513,
        0 8px 16px rgba(0, 0, 0, 0.6);
    transition: all 0.1s ease;
}

#startBtn:hover {
    background: linear-gradient(135deg, #FFA500, #FF8C00);
    transform: translateY(2px);
    box-shadow: 
        0 2px 0 #8B4513,
        0 6px 12px rgba(0, 0, 0, 0.6);
} 