/* ===== STAR WARS GAME — FLOATING BUTTON ===== */
#swg-open-btn {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 999990;
    display: flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, #1a0a00 0%, #3d1f00 50%, #1a0a00 100%);
    color: #ffe81f;
    border: 2px solid #ffe81f;
    border-radius: 30px;
    padding: 8px 16px 8px 12px;
    font-family: 'Arial Black', Arial, sans-serif;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 0 16px rgba(255, 232, 31, 0.5), 0 2px 8px rgba(0,0,0,0.6);
    transition: all 0.25s ease;
    text-transform: uppercase;
    user-select: none;
}

#swg-open-btn:hover {
    background: linear-gradient(135deg, #2a1200 0%, #5c3000 50%, #2a1200 100%);
    box-shadow: 0 0 28px rgba(255, 232, 31, 0.9), 0 2px 12px rgba(0,0,0,0.7);
    transform: scale(1.05);
    color: #fff7a0;
}

#swg-open-btn:active {
    transform: scale(0.97);
}

#swg-open-btn .swg-icon {
    font-size: 16px;
    color: #ffe81f;
    filter: drop-shadow(0 0 4px #ffe81f);
}

/* ===== MODAL ===== */
#swg-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#swg-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#swg-modal-content {
    position: relative;
    z-index: 1;
    background: #0a0a0f;
    border: 2px solid #ffe81f;
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(255, 232, 31, 0.4), 0 8px 40px rgba(0,0,0,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    overflow: hidden;
    max-width: 98vw;
    max-height: 98vh;
}

#swg-modal-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(90deg, #0a0a0f 0%, #1a1200 50%, #0a0a0f 100%);
    border-bottom: 2px solid #ffe81f;
    padding: 10px 16px;
    box-sizing: border-box;
}

#swg-title {
    font-family: 'Arial Black', Arial, sans-serif;
    font-size: 18px;
    font-weight: 900;
    color: #ffe81f;
    letter-spacing: 3px;
    text-shadow: 0 0 12px rgba(255, 232, 31, 0.8);
    text-transform: uppercase;
}

#swg-close-btn {
    background: transparent;
    border: 2px solid #ffe81f;
    color: #ffe81f;
    font-size: 22px;
    line-height: 1;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

#swg-close-btn:hover {
    background: #ffe81f;
    color: #000;
    box-shadow: 0 0 12px rgba(255, 232, 31, 0.8);
}

/* ===== GAME WRAP ===== */
#swg-game-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    gap: 10px;
}

#swg-canvas {
    display: block;
    border: 1px solid rgba(255, 232, 31, 0.3);
    border-radius: 4px;
    background: #000010;
    max-width: 100%;
}

/* ===== MOBILE CONTROLS ===== */
#swg-mobile-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

#swg-controls-row-1,
#swg-controls-row-2,
#swg-controls-row-3 {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.swg-ctrl-btn {
    width: 50px;
    height: 50px;
    background: rgba(255, 232, 31, 0.1);
    border: 2px solid rgba(255, 232, 31, 0.6);
    border-radius: 8px;
    color: #ffe81f;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}

.swg-ctrl-btn:active,
.swg-ctrl-btn.swg-pressed {
    background: rgba(255, 232, 31, 0.4);
    border-color: #ffe81f;
}

.swg-fire-btn {
    background: rgba(255, 60, 0, 0.2);
    border-color: rgba(255, 100, 0, 0.8);
    color: #ff6400;
    font-size: 20px;
    width: 56px;
    height: 56px;
}

.swg-fire-btn:active,
.swg-fire-btn.swg-pressed {
    background: rgba(255, 100, 0, 0.5);
}

/* Show/hide mobile controls based on input method */
@media (hover: hover) and (pointer: fine) {
    /* Desktop: hide if user never touches */
    #swg-mobile-controls {
        display: none;
    }
}

@media (hover: none) and (pointer: coarse) {
    /* Touch device: always show */
    #swg-mobile-controls {
        display: flex;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    #swg-open-btn {
        top: 10px;
        left: 10px;
        padding: 7px 13px 7px 10px;
        font-size: 11px;
    }

    #swg-title {
        font-size: 14px;
        letter-spacing: 2px;
    }

    #swg-modal-content {
        width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}
