@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800&family=Inter:wght@400;500;600&display=swap');

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(ellipse at top, #1e1b4b 0%, #0f172a 50%, #030712 100%);
  background-attachment: fixed;
  color: #f8fafc;
  font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

img:not([src]), 
img[src=""], 
#background, 
#corner,
img[src*="undefined"] {
  display: none !important;
}

canvas {
  border: none;
  outline: none;
}

#menu {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Top Navbar */
.top-nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 54px;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 99999;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.brand-icon {
  font-size: 22px;
}

.brand-title {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #38bdf8, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  text-decoration: none;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #38bdf8;
  transform: translateY(-1px);
}

.btn-icon {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1);
}

/* Mobile Instruction Hint */
.mobile-hint {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 30px;
  font-size: 12px;
  color: #cbd5e1;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
}

/* Centered Carousel - Works on BOTH Mobile & Desktop */
.page-container {
  width: 100vw;
  height: 100vh;
}

.games-list {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  transform: translate(-50%, -50%) !important;
  width: min(92vw, 440px) !important;
  height: 72vh !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  overflow: visible !important;
  z-index: 50 !important;
}

.menu-div {
  width: 100% !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  margin: 4px 0 !important;
}

.menu-wrap {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  height: 100% !important;
  transition: all 0.25s ease !important;
}

.menu-wrap a {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  text-decoration: none !important;
  width: 100% !important;
}

/* Item Card Design */
.menu-img {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 90% !important;
  max-width: 360px !important;
  min-height: 48px !important;
  padding: 10px 20px !important;
  background: rgba(30, 41, 59, 0.75) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 14px !important;
  color: #f8fafc !important;
  font-family: 'Outfit', 'Inter', system-ui, sans-serif !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.25s ease !important;
  cursor: pointer;
  margin: 0 !important;
}

.grow, .grow-mobile {
  transform: scale(1.08) !important;
  opacity: 1 !important;
  z-index: 10 !important;
}

.grow .menu-img, .grow-mobile .menu-img {
  background: linear-gradient(135deg, #4f46e5, #9333ea) !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.8), 0 0 10px rgba(56, 189, 248, 0.5) !important;
  color: #ffffff !important;
}

.shrink, .shrink-mobile {
  transform: scale(0.85) !important;
  opacity: 0.55 !important;
}

/* In-game Player */
#game {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 100000;
}

.hidden {
  display: none !important;
}
/* Floating In-Game Exit Button */
#exitGameBtn {
  position: fixed !important;
  top: 14px !important;
  left: 14px !important;
  z-index: 2147483647 !important;
  background: rgba(15, 23, 42, 0.88) !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  border-radius: 20px !important;
  padding: 8px 18px !important;
  font-family: 'Outfit', 'Inter', system-ui, sans-serif !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

#exitGameBtn:hover, #exitGameBtn:active {
  background: rgba(56, 189, 248, 0.35) !important;
  border-color: #38bdf8 !important;
  transform: scale(1.05) !important;
}

/* On-Screen Mobile Controller */
#gamepad {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  pointer-events: none !important;
  z-index: 2147483640 !important;
}

#gamepad * {
  pointer-events: auto !important;
}

.screenGamepad-Joystick {
  border-radius: 50% !important;
  border: 2px solid rgba(56, 189, 248, 0.7) !important;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, rgba(15, 23, 42, 0.75) 100%) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), inset 0 0 12px rgba(56, 189, 248, 0.35) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
}

.screenGamepad-Button {
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.7)) !important;
  transition: transform 0.1s ease !important;
}

.screenGamepad-Button:active {
  transform: scale(0.92) !important;
}
/* PWA Install Button */
.install-btn {
  background: linear-gradient(135deg, #059669, #10b981) !important;
  color: #ffffff !important;
  border: 1px solid rgba(52, 211, 153, 0.6) !important;
  font-weight: 700 !important;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.45) !important;
  padding: 0 14px !important;
  display: inline-flex !important;
}

.install-btn:hover {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  border-color: #6ee7b7 !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.8) !important;
  transform: translateY(-1px) !important;
}
/* In-Game Controls Customization Mode */
#editControlsBtn {
  position: fixed !important;
  top: 14px !important;
  right: 14px !important;
  z-index: 2147483647 !important;
  background: rgba(15, 23, 42, 0.88) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.4) !important;
  border-radius: 20px !important;
  padding: 8px 16px !important;
  font-family: 'Outfit', 'Inter', system-ui, sans-serif !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: 0.3px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

#editControlsBtn:hover, #editControlsBtn:active {
  background: rgba(56, 189, 248, 0.25) !important;
  border-color: #38bdf8 !important;
  transform: scale(1.05) !important;
}

#padEditToolbar {
  position: fixed !important;
  top: 60px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: calc(100% - 24px) !important;
  max-width: 480px !important;
  background: rgba(15, 23, 42, 0.96) !important;
  border: 1px solid rgba(56, 189, 248, 0.5) !important;
  border-radius: 16px !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.85), 0 0 20px rgba(56, 189, 248, 0.25) !important;
  padding: 14px 16px !important;
  z-index: 2147483647 !important;
  display: none !important;
  flex-direction: column !important;
  gap: 12px !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  animation: slideDownPad 0.25s ease-out !important;
}

#padEditToolbar.pad-toolbar-active {
  display: flex !important;
}

.pad-drag-hint {
  font-family: 'Kantumruy Pro', 'Outfit', 'Inter', system-ui, sans-serif !important;
  font-size: 13px !important;
  line-height: 1.6 !important;
  font-weight: 600 !important;
  color: #f1f5f9 !important;
  text-align: center !important;
}

.pad-btn {
  font-family: 'Kantumruy Pro', 'Outfit', 'Inter', system-ui, sans-serif !important;
  line-height: 1.5 !important;
}

@keyframes slideDownPad {
  from { opacity: 0; transform: translate(-50%, -15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.pad-drag-hint {
  font-family: 'Outfit', 'Inter', system-ui, sans-serif !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #e2e8f0 !important;
  text-align: center !important;
}

.pad-toolbar-actions {
  display: flex !important;
  justify-content: center !important;
  gap: 8px !important;
}

.pad-btn {
  padding: 8px 14px !important;
  border-radius: 10px !important;
  font-family: 'Outfit', 'Inter', system-ui, sans-serif !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  border: none !important;
  transition: all 0.15s ease !important;
}

.pad-btn-save {
  background: linear-gradient(135deg, #0284c7, #38bdf8) !important;
  color: #0f172a !important;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.4) !important;
}

.pad-btn-reset {
  background: rgba(51, 65, 85, 0.8) !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
}

.pad-btn-close {
  background: rgba(239, 68, 68, 0.25) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
}

.pad-btn:active {
  transform: scale(0.95) !important;
}

.pad-editable {
  outline: 3px dashed #38bdf8 !important;
  outline-offset: 4px !important;
  cursor: grab !important;
  touch-action: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  pointer-events: auto !important;
  z-index: 2147483647 !important;
  animation: pulseOutline 1.5s infinite alternate !important;
}

.pad-editable * {
  pointer-events: none !important;
}

@keyframes pulseOutline {
  from { outline-color: #38bdf8; }
  to { outline-color: #a855f7; }
}

.pad-dragging {
  cursor: grabbing !important;
  opacity: 0.85 !important;
  transform: scale(1.08) !important;
  filter: brightness(1.4) drop-shadow(0 8px 24px rgba(56, 189, 248, 0.6)) !important;
}

.pad-toast {
  position: fixed !important;
  bottom: 80px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  background: rgba(15, 23, 42, 0.95) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.5) !important;
  border-radius: 9999px !important;
  padding: 10px 20px !important;
  font-family: 'Outfit', 'Inter', system-ui, sans-serif !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7) !important;
  z-index: 2147483647 !important;
  animation: fadeInOut 2.2s forwards ease-in-out !important;
  pointer-events: none !important;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, 15px); }
  15% { opacity: 1; transform: translate(-50%, 0); }
  80% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -15px); }
}
#toggleTouchBtn {
  position: fixed !important;
  top: 14px !important;
  right: 170px !important;
  z-index: 2147483647 !important;
  background: rgba(15, 23, 42, 0.88) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.4) !important;
  border-radius: 20px !important;
  padding: 8px 16px !important;
  font-family: 'Outfit', 'Inter', system-ui, sans-serif !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}
#toggleTouchBtn:hover, #toggleTouchBtn:active {
  background: rgba(56, 189, 248, 0.25) !important;
  border-color: #38bdf8 !important;
  transform: scale(1.05) !important;
}

/* Home Button */
.home-btn {
  background: rgba(56, 189, 248, 0.15) !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
  color: #38bdf8 !important;
  gap: 6px !important;
}
.home-btn:hover, .home-btn:active {
  background: rgba(56, 189, 248, 0.3) !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4) !important;
  transform: translateY(-1px) !important;
}
