/* Controls - Bottom Section */
#controls {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.7);
    min-height: 140px;
}

/* D-Pad Container */
#dpad-container {
    flex: 0 0 auto;
}

#dpad {
    display: grid;
    grid-template-columns: repeat(3, 50px);
    grid-template-rows: repeat(3, 50px);
    gap: 4px;
}

.dpad-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 8px;
    background: #3a3a5e;
    color: #fff;
    font-size: 1.5em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.dpad-btn:active,
.dpad-btn.active {
    background: #ffd700;
}

/* D-Pad arrows */
.dpad-btn[data-direction="up"]::before { content: "▲"; }
.dpad-btn[data-direction="down"]::before { content: "▼"; }
.dpad-btn[data-direction="left"]::before { content: "◀"; }
.dpad-btn[data-direction="right"]::before { content: "▶"; }

/* Center button (inactive) */
.dpad-center {
    background: #2a2a4e;
    cursor: default;
}

.dpad-center:active {
    background: #2a2a4e;
}

/* Empty corners */
.dpad-btn:nth-child(1) { grid-column: 2; grid-row: 1; } /* Up */
.dpad-btn:nth-child(2) { grid-column: 1; grid-row: 2; } /* Left */
.dpad-btn:nth-child(3) { grid-column: 2; grid-row: 2; } /* Center */
.dpad-btn:nth-child(4) { grid-column: 3; grid-row: 2; } /* Right */
.dpad-btn:nth-child(5) { grid-column: 2; grid-row: 3; } /* Down */

/* Push Button Container */
#push-container {
    flex: 0 0 auto;
}

#push-btn {
    width: 100px;
    height: 100px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: #fff;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.4);
    transition: transform 0.1s, box-shadow 0.1s;
    -webkit-tap-highlight-color: transparent;
}

#push-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.4);
    background: linear-gradient(135deg, #ff6666, #ff0000);
}

/* Touch feedback */
@media (hover: none) and (pointer: coarse) {
    .dpad-btn:active,
    .dpad-btn.active {
        background: #ffd700;
    }
}

/* Responsive adjustments for smaller screens */
@media (max-height: 600px) {
    #controls {
        min-height: 120px;
        padding: 10px 15px;
    }

    #dpad {
        grid-template-columns: repeat(3, 40px);
        grid-template-rows: repeat(3, 40px);
    }

    .dpad-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }

    #push-btn {
        width: 80px;
        height: 80px;
        font-size: 1em;
    }
}
