body {
    margin: 0;
    padding: 0;
    background-color: #000;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #eee;
    touch-action: none; /* Prevents scrolling on mobile */
}

/* --- MOBILE MODE LOCK (Prevents dragging screen) --- */
body.mobile-mode {
    overflow: hidden;      
    touch-action: none;    
    position: fixed;       
    width: 100%;
    height: 100%;
}

/* Container */
#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* THE FIXED 1920x1080 SCREEN */
#screen {
    width: 1920px;
    height: 1080px;
    background: #000;
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center center; 
    overflow: hidden;
    /* Transform (scale + translate) applied via JS */
}

/* Background Canvas */
#bg-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* Physics Container */
#container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Let clicks pass through empty areas */
}

canvas#simulation {
    display: block;
    width: 100%;
    height: 100%;
    background: transparent; 
    pointer-events: auto; /* Re-enable clicks on the canvas itself */
}

/* --- MOVED OUTSIDE: UI Buttons --- */
#btn-mobile {
    position: fixed;          /* locks to window, not game */
    top: 20px;
    left: 20px;

    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid #777;
    padding: 16px 22px;       /* Bigger before fullscreen */
    font-size: 28px;          /* Larger text */
    border-radius: 6px;

    cursor: pointer;
    z-index: 9999;            /* Above everything */
    transition: background 0.2s;
}

#btn-mobile:hover { 
    background-color: rgba(255, 255, 255, 0.35); 
}

/* In-game button (scales with screen) */
#btn-options-trigger {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: 1px solid #555;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 24px;
    z-index: 20;
    transition: background 0.2s;
    border-radius: 4px;
    pointer-events: auto;
}

#btn-options-trigger:hover { 
    background-color: rgba(50, 50, 50, 0.9); 
}

/* --- Options Menu Overlay --- */
#options-menu {
    position: absolute;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 30;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

#options-menu.hidden { 
    display: none; 
}

.menu-content {
    background-color: #333;
    padding: 40px;
    border-radius: 8px;
    border: 1px solid #555;
    width: 500px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.8);
    font-size: 20px;
}

.menu-content h2 {
    margin-top: 0;
    color: #fff;
    border-bottom: 1px solid #555;
    padding-bottom: 15px;
    font-size: 32px;
}

.option-group { 
    margin: 20px 0; 
    text-align: left; 
}

.radio-group { 
    display: flex; 
    flex-direction: column; 
    gap: 12px; 
    margin-top: 10px; 
}

.radio-group label {
    cursor: pointer;
    display: flex; 
    align-items: center; 
    gap: 10px;
    background: rgba(255,255,255,0.05);
    padding: 12px; 
    border-radius: 4px;
}

select, input[type="text"] {
    width: 100%; 
    box-sizing: border-box; 
    margin-top: 10px; 
    padding: 15px;
    background-color: rgba(255,255,255,0.1); 
    border: 1px solid #555;
    color: white; 
    border-radius: 4px; 
    font-size: 20px; 
    outline: none;
}

select { cursor: pointer; }
select option { background-color: #333; color: white; }
input[type="text"]:focus { 
    border-color: #28a745; 
    background-color: rgba(255,255,255,0.15); 
}

.menu-actions { 
    display: flex; 
    justify-content: space-between; 
    margin-top: 25px; 
}

button { 
    padding: 12px 24px; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
    font-weight: bold; 
    font-size: 18px;
}

#btn-apply { background-color: #28a745; color: white; } 
#btn-apply:hover { background-color: #218838; }
#btn-close { background-color: #6c757d; color: white; } 
#btn-close:hover { background-color: #5a6268; }

/* --- FOOLPROOF FULLSCREEN HIDE --- */
:fullscreen #btn-mobile {
    display: none !important;
}

:-webkit-full-screen #btn-mobile {
    display: none !important;
}
