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

body {
    font-family: 'Courier New', Courier, monospace;
    background-color: #111;
    color: #eee;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#app {
    position: relative;
    width: 800px;
    height: 600px;
    max-width: 100%;
    max-height: 100%;
    background-color: #000;
    border: 2px solid #444;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.2);
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10;
}

.screen.active {
    display: flex;
}

/* Intro Screen */
#intro-screen {
    background: radial-gradient(circle, #222, #000);
}

.background-maze {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.2;
    background-image: 
        linear-gradient(#0f0 2px, transparent 2px),
        linear-gradient(90deg, #0f0 2px, transparent 2px);
    background-size: 40px 40px;
    z-index: 1;
}

h1 {
    font-size: 4rem;
    color: #0f0;
    text-shadow: 0 0 10px #0f0;
    margin-bottom: 2rem;
    z-index: 2;
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    z-index: 2;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border: 1px solid #0f0;
    border-radius: 8px;
}

select, button {
    font-family: inherit;
    font-size: 1.2rem;
    padding: 0.5rem 1rem;
    background-color: #222;
    color: #0f0;
    border: 1px solid #0f0;
    cursor: pointer;
    transition: all 0.2s;
}

select:focus, button:focus {
    outline: none;
}

button:hover {
    background-color: #0f0;
    color: #000;
}

.instructions {
    margin-top: 2rem;
    text-align: center;
    color: #aaa;
    z-index: 2;
}

/* Game Screen */
#game-screen {
    background-color: #000;
    z-index: 5;
}

#game-ui {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #0f0;
    font-size: 1.2rem;
    font-weight: bold;
    z-index: 10;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Result Screen */
#result-screen h1 {
    font-size: 3rem;
}

#result-message {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: #fff;
}

#result-screen button {
    margin: 0.5rem;
}
/* Virtual Controls */
#virtual-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 150px;
    display: none; /* Hidden by default, shown via JS if touch device */
    justify-content: space-between;
    align-items: flex-end;
    padding: 20px;
    z-index: 20;
    pointer-events: none; /* Let clicks pass through where there are no controls */
}

#joystick-zone, #fire-zone {
    width: 120px;
    height: 120px;
    pointer-events: auto; /* Re-enable for the control areas */
    display: flex;
    justify-content: center;
    align-items: center;
}

#joystick-base {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    position: relative;
    touch-action: none; /* Prevent scrolling when using joystick */
}

#joystick-stick {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(0, 255, 0, 0.6);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    pointer-events: none;
}

#fire-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: rgba(255, 0, 0, 0.4);
    border: 2px solid rgba(255, 0, 0, 0.6);
    color: #fff;
    font-weight: bold;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.4);
    pointer-events: auto;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

#fire-btn:active, #fire-btn.active {
    background-color: rgba(255, 0, 0, 0.8);
}
