/* ROOT & BODY SETUP */
body {
    margin: 0;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    overflow: hidden; /* Disables scrollbars */
    color: #e2e8f0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, 'Helvetica Neue', Arial;
}

/* --- MOBILE MODE LOCK --- */
body.mobile-mode {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

/* --- GAME CONTAINER & SCREEN --- */
#game-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

#screen {
    width: 1280px;  /* Fixed Base Width */
    height: 720px;  /* Fixed Base Height */
    background: #0f172a;
    position: relative;
    overflow: hidden;
    /* Important for scaling from the middle */
    transform-origin: center center;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    flex-shrink: 0;
}

/* Canvas strictly fills internal screen */
#c { 
    width: 100%; 
    height: 100%; 
    display: block; 
    touch-action: none;
}

/* --- TIGHTENED UI --- */
#ui { 
    position: absolute; 
    top: 60px; /* Moved down to clear the top-left button */
    left: 16px; 
    background: rgba(15, 23, 42, 0.75); 
    padding: 12px 16px; 
    border-radius: 12px; 
    backdrop-filter: blur(8px); 
    box-shadow: 0 4px 16px rgba(0,0,0,0.3); 
    max-width: 420px;
    pointer-events: auto; /* ALLOW CLICKS FOR MENU NOW */
}

#ui h1 { 
    font-size: 20px; 
    margin: 0 0 4px; 
    color: #f8fafc; 
}

#ui p { 
    margin: 4px 0; 
    font-size: 14px; 
    line-height: 1.3; 
}

.kbd { 
    padding: 2px 6px; 
    border-radius: 4px; 
    background: #1f2937; 
    color: #e5e7eb; 
    border: 1px solid #374151; 
    font-size: 13px; 
    font-weight: bold;
}

/* --- OPTIONS MENU --- */
#options-menu {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.2);
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 14px;
}
#options-menu select, #options-menu button {
    background: #1e293b;
    color: white;
    border: 1px solid #475569;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    outline: none;
}
#options-menu button:hover { background: #334155; }
#options-menu select:hover { background: #334155; }

/* --- TOGGLE BUTTON --- */
#mobile-btn {
    position: fixed;
    top: 10px; left: 10px; /* Moved to top-left corner */
    z-index: 2000;
    background: rgba(15, 23, 42, 0.8);
    color: white;
    border: 2px solid white;
    border-radius: 8px;
    font-size: 14px;
    padding: 8px 12px;
    cursor: pointer;
    backdrop-filter: blur(4px);
}
body.mobile-mode #mobile-btn { display: none; }

/* --- MOBILE CONTROLS OVERLAY --- */
#mobile-controls {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; /* Let clicks pass through to game */
    z-index: 3000;
    display: none; 
    justify-content: space-between;
    align-items: flex-end;
    padding: 20px;
    box-sizing: border-box;
}
body.mobile-mode #mobile-controls { display: flex; }

/* --- CONTROL BUTTONS --- */
.mobile-control-btn {
    pointer-events: auto; /* Re-enable clicks for buttons */
    width: 80px; height: 80px;
    background: rgba(255,255,255,0.15);
    border: 3px solid rgba(255,255,255,0.4);
    border-radius: 50%;
    color: white;
    font-size: 32px;
    display: flex; justify-content: center; align-items: center;
    user-select: none;
    backdrop-filter: blur(4px);
    margin-bottom: 20px;
    transition: transform 0.1s, background 0.1s;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}
.mobile-control-btn:active {
    background: rgba(255,255,255,0.4);
    transform: scale(0.95);
}

#mobile-dpad {
    display: flex;
    gap: 15px; 
    margin-left: 20px;
    margin-bottom: 20px;
}
#mobile-action {
    margin-right: 40px;
    margin-bottom: 40px;
}
