/* MOBILE FORCE FIX - Simplified, clean overrides */

/* Mobile: Compact topbar, hide search */
@media (max-width: 768px) {
  .topbar .topbar-center,
  .topbar-center,
  .search-wrap { 
    display: none !important; 
  }
  
  .mobile-nav-toggle-label { 
    display: none !important; 
  }
  
  .topbar { 
    padding: 6px 10px !important; 
    min-height: 44px !important; 
    gap: 6px !important;
  }
  
  .topbar button.mobile-nav-toggle.ghost-btn { 
    padding: 8px !important; 
    min-height: 36px !important;
  }
  
  /* Mobile menu as overlay */
  .header-links.mobile-nav-open {
    position: fixed !important;
    top: 50px !important;
    left: 10px !important;
    right: 10px !important;
    background: rgba(10, 10, 15, 0.98) !important;
    border-radius: 12px !important;
    padding: 16px !important;
    z-index: 1000 !important;
  }
}

/* Mobile/Tablet: Show touch controls, reasonable height */
@media (max-width: 1024px) {
  #emu-st-touch,
  .emu-st-touch {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: 140px !important;
    max-height: 25vh !important;
  }
  
  #emu-st-touch[hidden],
  .emu-st-touch[hidden] {
    display: none !important;
  }
  
  /* Ensure system buttons visible */
  .emu-st-touch-snes-system,
  .emu-st-touch-genesis-system,
  .emu-st-touch-gb-system,
  .emu-st-touch-nes-system {
    display: flex !important;
    visibility: visible !important;
    margin-top: 8px !important;
    gap: 20px !important;
  }
  
  /* Make buttons smaller so they don't overwhelm */
  .emu-st-touch-btn {
    width: 48px !important;
    height: 48px !important;
    font-size: 12px !important;
  }
  
  /* Select/Start buttons */
  .emu-st-touch-snes-system .emu-st-sys,
  .emu-st-touch-genesis-system .emu-st-sys,
  .emu-st-touch-gb-system .emu-st-sys,
  .emu-st-touch-nes-system .emu-st-sys {
    width: 60px !important;
    height: 24px !important;
    font-size: 10px !important;
  }
}

/* Portrait: Slightly taller controls */
@media (orientation: portrait) and (max-width: 1024px) {
  .emu-st-touch {
    height: 160px !important;
    max-height: 30vh !important;
  }
  
  .emu-st-touch-btn {
    width: 56px !important;
    height: 56px !important;
  }
}

/* Fullscreen on mobile */
@media (hover: none) and (pointer: coarse) {
  :fullscreen .emu-st-touch,
  :-webkit-full-screen .emu-st-touch {
    height: 120px !important;
    max-height: 20vh !important;
    z-index: 10000 !important;
    display: block !important;
  }
}

/* NES React Overlay Styles */
.emu-st-touch-nes {
  background: #0b1422 !important;
  padding: 8px !important;
}

.emu-st-touch-nes-react {
  width: 100% !important;
  height: 100% !important;
  max-height: 160px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#nes-react-container,
#nes-react-mount {
  width: 100% !important;
  height: 100% !important;
}

/* NES controller SVG button interactions */
.nes-dpad-btn:active,
.nes-sys-btn:active,
.nes-action-btn:active {
  filter: brightness(1.2) !important;
}

/* Mobile NES adjustments */
@media (max-width: 768px) {
  .emu-st-touch-nes {
    max-height: 140px !important;
  }
  
  .emu-st-touch-nes svg {
    max-height: 120px !important;
  }
}
