/* ─── 2D Scene (Canvas) Controls ─── */

#game-container {
    position: relative;
    width: 100%;
    height: 60vh;
    background: #120f0d;
    border-radius: 4px;
    overflow: hidden;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
}

#ui-controls-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 999;
}

/* Directional pad */
.dpad {
    position: absolute;
    bottom: 16px;
    left: 16px;
    width: 120px;
    height: 120px;
}

.dpad .btn {
    position: absolute;
    width: 40px;
    height: 40px;
    background: var(--surface2, #2c2219);
    border: 2px solid var(--accent-primary, #d4a373);
    color: var(--text, #f5ebe0);
    font-weight: bold;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    touch-action: manipulation;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    pointer-events: auto;
}

#btn-up { top: 0; left: 40px; }
#btn-down { bottom: 0; left: 40px; }
#btn-left { top: 40px; left: 0; }
#btn-right { top: 40px; right: 0; }

#btn-up:active {  background: var(--surface2, #2c2219); border-color: var(--gold);}
#btn-down:active {  background: var(--surface2, #2c2219); border: 2px solid var(--gold);}
#btn-left:active {  background: var(--surface2, #2c2219); border: 2px solid var(--gold);}
#btn-right:active {  background: var(--surface2, #2c2219); border: 2px solid var(--gold); }


#ui-controls-overlay .btn:hover {
    background: rgba(0, 242, 255, 0.2);
}





/* UI buttons — bottom-right, stacked vertically */
.btn-ui {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 999;
    pointer-events: none;
}

.btn-ui div {
    width: 40px;
    height: 40px;
    background: var(--surface2, #2c2219);
    border: 2px solid var(--border, #44372c);
    color: var(--text-muted, #554438);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    pointer-events: auto;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
}

.btn-ui div:active {
    background: var(--surface3, #3a2e24);
    border-color: var(--gold);
}

.btn-ui div:hover {
    background: rgba(0, 242, 255, 0.2);
}

/* Action popup for 2D scene — positioned by JS near btn-actions */
.actions-popup {
    position: absolute;
    background: rgba(0, 10, 20, 0.94);
    border: 1px solid var(--accent-primary);
    border-radius: 10px;
    padding: 8px;
    z-index: 1000;
    display: none;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    pointer-events: auto;
}

.actions-popup.open {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.action-item {
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    border-radius: 8px;
    font-size: 1.4rem;
    transition: background 0.2s;
    width: 48px;
    height: 48px;
}

.action-item:hover {
    background: rgba(0, 242, 255, 0.2);
}

.floating-action-icon {
    position: fixed;
    font-size: 24px;
    z-index: 2000;
    pointer-events: none;
    will-change: transform, opacity;
}