:root {
    --bg-color: #050505;
    --text-color: #00ff00; /* Matrix green */
    --highlight-color: #ffffff; /* White highlight for typed text */
    --target-color: #ff3333; /* Red for targeted/locked words */
    --font-family: 'Courier New', Courier, monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    /* Prevent default touch behaviors on mobile to avoid scrolling and zooming */
    touch-action: none; 
    user-select: none;
    -webkit-user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    background-color: #000000;
    font-family: var(--font-family);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 600px; /* Constrain width on desktop */
    background-color: var(--bg-color);
    border: 1px solid #003300;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.1) inset;
    overflow: hidden;
    cursor: default;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    pointer-events: none;
    z-index: 10;
}

#stats {
    display: flex;
    justify-content: space-between;
    color: var(--text-color);
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 0 0 5px var(--text-color);
}

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

/* Overlay for Start and Game Over screens */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 5, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text-color);
    z-index: 20;
    text-align: center;
    padding: 20px;
}

.overlay.hidden {
    display: none;
}

.overlay h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

#start-screen h1 {
    color: var(--text-color);
    text-shadow: 0 0 10px var(--text-color);
}

#game-over h1 {
    color: var(--target-color);
    text-shadow: 0 0 15px var(--target-color);
}

.overlay p {
    font-size: 1.1rem;
    margin-bottom: 10px;
    line-height: 1.5;
}

.blink {
    animation: blinker 1.2s cubic-bezier(1, 0, 0, 1) infinite;
}

@keyframes blinker {
    50% { opacity: 0; }
}

/* Hidden mobile input for popping up native keyboard */
#mobile-input {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1px;
    height: 1px;
    opacity: 0;
    border: none;
    padding: 0;
    font-size: 16px; /* Prevents auto-zoom on iOS */
    pointer-events: none;
    z-index: -1;
    background: transparent;
    color: transparent;
}
