/* Mobile Controls CSS */

/* Portrait warning - ONLY show during gameplay, not in lobby */
body.in-game::before {
    content: "📱 Vui lòng xoay ngang thiết bị để chơi game";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    color: white;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 10000;
    font-size: 24px;
    text-align: center;
    padding: 20px;
    font-family: Arial, sans-serif;
}

/* Show warning only when in-game AND portrait */
@media screen and (orientation: portrait) and (max-width: 1024px) {
    body.in-game::before {
        display: flex;
    }
}

/* Mobile controls container */
#mobileControls {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Joystick */
.joystick-base {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.joystick-stick {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Camera button */
.camera-button {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.camera-button:active {
    transform: scale(0.95);
}

/* Attack button */
.attack-button {
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.4);
    transition: all 0.2s ease;
}

.attack-button:active {
    transform: scale(0.95);
}

/* Ability buttons */
.ability-button {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.ability-button:active {
    transform: scale(0.95);
}

/* Hide controls on desktop */
@media screen and (min-width: 1025px) {
    #mobileControls {
        display: none !important;
    }
}

/* Hide desktop controls instruction on mobile */
@media screen and (max-width: 1024px) {
    .controls {
        display: none !important;
    }
}

/* Prevent text selection on mobile */
body.mobile-game {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    overflow: hidden;
}

/* Optimize for mobile performance */
#mobileControls * {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Fullscreen on mobile */
@media screen and (max-width: 1024px) {
    html, body {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
        position: fixed;
    }
    
    canvas {
        width: 100% !important;
        height: 100% !important;
        display: block;
    }
}

/* Safe area for notch devices */
@supports (padding: max(0px)) {
    #mobileControls {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}
