    /* ============ Mobile Launcher Mode ============ */
    body.mobile-mode { 
      overflow: hidden; 
    }
    body.mobile-mode .desktop { display: none !important; }
    body.mobile-mode .desktop-icon { display: none !important; }
    body.mobile-mode .taskbar,
    body.mobile-mode .start-menu { display: none !important; }
    
    /* Ensure mobile background can be applied */
    html.mobile-mode, body.mobile-mode {
      background-attachment: fixed !important;
    }

    .mobile-only { display: none; }
    body.mobile-mode .mobile-only { display: block; }

    /* Hide mobile navigation during page load to prevent flash */
    body.page-loading .mobile-only {
      opacity: 0;
      pointer-events: none;
    }

    #mobileLauncher {
      position: absolute;
      inset: 0;
      padding: 16px 14px calc(82px + env(safe-area-inset-bottom));
      display: grid;
      grid-template-columns: repeat(var(--mobile-grid-cols, 4), minmax(0, 1fr));
      gap: var(--mobile-grid-gap, 14px) 10px;
      align-content: start;
      z-index: 2;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      background: transparent;
    }

    .mobile-app {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      gap: 6px;
      padding: 10px 8px;
      border-radius: 16px;
      user-select: none;
      -webkit-tap-highlight-color: transparent;
    }
    .mobile-app:active { background: rgba(255,255,255,0.08); }
    .mobile-app-icon {
      width: 80px;
      height: 80px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 40px;
      line-height: 1;
      position: relative;
      border-radius: 12px;
      background-color: var(--mobile-icon-bg, transparent);
      background-image: var(--mobile-icon-gradient, linear-gradient(135deg, var(--icon-color-1, #667eea), var(--icon-color-2, #764ba2)));
      box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.16);
      overflow: hidden;
      color: rgba(255, 255, 255, 0.95);
    }

    /* iOS-style shine effect overlay */
    .mobile-app-icon::before {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(
        to bottom,
        rgba(255,255,255,0.2) 0%,
        rgba(255,255,255,0.1) 40%,
        rgba(255,255,255,0) 60%,
        rgba(0,0,0,0.1) 100%
      );
      border-radius: inherit;
      pointer-events: none;
    }

    /* Ensure icon content is above the shine */
    .mobile-app-icon > * {
      position: relative;
      z-index: 1;
    }
    .mobile-app-icon img {
      width: 60px !important;
      height: 60px !important;
      object-fit: contain;
      filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
    }
    #mobileLauncher .mobile-app img{
      padding-left:8px;
      padding-right:8px;
      padding-top:8px;
      padding-bottom:8px;
    }

    .mobile-app-icon svg {
      width: 60px !important;
      height: 60px !important;
      filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
      opacity: 0.9;
    }

    /* Fallback handling for broken custom icon images */
    .mobile-app-icon.icon-error {
      /* Ensure gradient background is visible when image fails */
      background-image: var(--mobile-icon-gradient, linear-gradient(135deg, var(--icon-color-1, #667eea), var(--icon-color-2, #764ba2)));
    }
    .mobile-app-icon.icon-error::after {
      content: '\1FADF'; /* 🪟 window emoji */
      font-size: 40px;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      z-index: 2;
    }
    .mobile-app-label {
      color: white;
      font-size: 13px;
      text-align: center;
      line-height: 1.15;
      text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      line-clamp: 2;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      max-width: 100%;
    }

    /* Android-style nav bar */
    #mobileNavBar {
      position: absolute;
      left: 0; right: 0; bottom: 0;
      height: calc(var(--mobile-nav-height, 58px) + env(safe-area-inset-bottom));
      padding-bottom: env(safe-area-inset-bottom);
      background: rgba(10, 10, 20, 0.92);
      backdrop-filter: blur(10px);
      display: flex;
      align-items: center;
      justify-content: space-around;
      z-index: 100001;
      border-top: 1px solid rgba(255,255,255,0.1);
    }
    .mobile-nav-btn {
      width: 64px;
      height: calc(var(--mobile-nav-height, 58px) - 16px);
      border: none;
      background: transparent;
      color: white;
      opacity: 0.95;
      border-radius: 12px;
      font-size: 20px;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
      position: relative;
    }
    .mobile-nav-btn:active { background: rgba(255,255,255,0.08); }
    .mobile-nav-btn::before {
      content: '';
      width: var(--mobile-nav-icon-size, 22px);
      height: var(--mobile-nav-icon-size, 22px);
      display: block;
      margin: 0 auto;
      background-repeat: no-repeat;
      background-position: center;
      background-size: contain;
      opacity: 0.95;
      filter: drop-shadow(0 1px 2px rgba(0,0,0,0.35));
    }
    .mobile-nav-btn.back::before {
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M14.5 5.5L8 12l6.5 6.5l1.5-1.5L11 12l5-5z'/%3E%3C/svg%3E");
    }
    .mobile-nav-btn.home::before {
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='6.5' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E");
    }
    .mobile-nav-btn.menu::before {
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Crect x='7' y='7' width='10' height='10' rx='2' ry='2' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E");
    }

    /* Recents overlay */
    #mobileRecents {
      position: absolute;
      inset: 0;
      padding: 16px 14px calc(82px + env(safe-area-inset-bottom));
      background: transparent;
      background: rgba(0,0,0,0.35);
      backdrop-filter: blur(6px);
      z-index: 100000;
      display: none;
    }
    #mobileRecents.open { display: block; }
    .mobile-recents-header { display:flex; align-items:center; justify-content:space-between; color:white; font-weight:700; font-size:16px; }
    .mobile-recents-grid {
      margin-top: 12px;
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
    }
    .mobile-recent-card {
      background: rgba(20,20,35,0.9);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 14px;
      padding: 12px;
      color: white;
      -webkit-tap-highlight-color: transparent;
    }
    .mobile-recent-card:active { background: rgba(255,255,255,0.08); }
    .mobile-recent-title { display:flex; align-items:center; gap:8px; margin-bottom: 8px; }
    .mobile-recent-title .ico {
      width: 48px;
      height: 48px;
      display:flex;
      align-items:center;
      justify-content:center;
      border-radius: 8px;
      background-image: linear-gradient(135deg, var(--icon-color-1, #667eea), var(--icon-color-2, #764ba2));
      box-shadow: 0px 0px 3px 1px rgba(0,0,0,0.16);
      position: relative;
      overflow: hidden;
    }
    .mobile-recent-title .ico::before {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(
        to bottom,
        rgba(255,255,255,0.2) 0%,
        rgba(255,255,255,0.1) 40%,
        rgba(255,255,255,0) 60%,
        rgba(0,0,0,0.1) 100%
      );
      border-radius: inherit;
      pointer-events: none;
    }
    .mobile-recent-title .ico img, .mobile-recent-title .ico svg {
      width: 32px !important;
      height: 32px !important;
      filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
      position: relative;
      z-index: 1;
    }
    .mobile-recent-title .name { font-weight: 700; overflow:hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* Mobile app windows: no titlebar, content fills screen */
    body.mobile-mode .winbox.mobile-app-window .wb-header { display: none !important; }
    body.mobile-mode .winbox.mobile-app-window .wb-body {
      top: 0 !important;
      height: 100% !important;
    }

    /* Ensure mobile window has relative positioning for title overlay */
    body.mobile-mode .winbox.mobile-app-window {
      position: relative;
    }

    /* Mobile app open/close animations */
    body.mobile-mode .winbox.mobile-app-window.mobile-opening {
      animation: mobileScaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
      transform-origin: center center;
    }
    body.mobile-mode .winbox.mobile-app-window.mobile-closing {
      animation: mobileScaleOut 0.2s ease-in forwards;
      transform-origin: center center;
    }

    /* Mobile app title overlay */
    .mobile-app-title {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      min-height: var(--mobile-app-header-height, 56px);
      padding: var(--mobile-app-header-padding-y, 12px) var(--mobile-app-header-padding-x, 20px);
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      font-size: var(--mobile-app-header-font-size, 18px);
      font-weight: var(--mobile-app-header-font-weight, 600);
      color: var(--mobile-app-header-text-color, #ffffff);
      background: var(--mobile-app-header-bg, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
      z-index: 999999;
      pointer-events: none;
      text-shadow: 0 1px 2px rgba(0,0,0,0.3);
      box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }

    /* Disable resize handles for no-resize class */
    .winbox.no-resize .wb-n,
    .winbox.no-resize .wb-e,
    .winbox.no-resize .wb-s,
    .winbox.no-resize .wb-w,
    .winbox.no-resize .wb-nw,
    .winbox.no-resize .wb-ne,
    .winbox.no-resize .wb-sw,
    .winbox.no-resize .wb-se {
      display: none !important;
    }

    /* Disable move for no-move class */
    .winbox.no-move .wb-drag {
      pointer-events: none !important;
    }

    /* Fullscreen mobile Start menu */
    #mobileStartMenu {
      position: absolute;
      inset: 0;
      padding: 12px 12px calc(82px + env(safe-area-inset-bottom));
      background: transparent;
      background: rgba(10,10,20,0.92);
      backdrop-filter: blur(14px);
      z-index: 100000;
      display: none;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }
    #mobileStartMenu.open { display: block; }
    .mobile-start-header {
      display:flex;
      align-items:center;
      gap: 10px;
      color: white;
      font-weight: 800;
      font-size: 16px;
      padding: 10px 12px;
      border-radius: 14px;
      background: rgba(255,255,255,0.06);
      border: 1px solid rgba(255,255,255,0.08);
    }
    .mobile-start-section {
      margin-top: 12px;
      padding: 10px 12px;
      border-radius: 14px;
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(255,255,255,0.06);
    }
    .mobile-start-section-title {
      color: rgba(255,255,255,0.75);
      font-size: 12px;
      font-weight: 700;
      margin-bottom: 8px;
      text-transform: uppercase;
      letter-spacing: 0.6px;
    }
    .mobile-start-item {
      display:flex;
      align-items:center;
      gap: 10px;
      padding: 10px 10px;
      border-radius: 12px;
      color: white;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }
    .mobile-start-item:active { background: rgba(255,255,255,0.08); }
    .mobile-start-item .ico {
      width: 40px;
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      border-radius: 8px;
      background-image: linear-gradient(135deg, var(--icon-color-1, #667eea), var(--icon-color-2, #764ba2));
      box-shadow: 0px 0px 3px 1px rgba(0,0,0,0.16);
      overflow: hidden;
      font-size: 20px;
    }

    /* iOS-style shine effect for start menu icons */
    .mobile-start-item .ico::before {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(
        to bottom,
        rgba(255,255,255,0.2) 0%,
        rgba(255,255,255,0.1) 40%,
        rgba(255,255,255,0) 60%,
        rgba(0,0,0,0.1) 100%
      );
      border-radius: inherit;
      pointer-events: none;
    }

    .mobile-start-item .ico > * {
      position: relative;
      z-index: 1;
    }

    .mobile-start-item .ico img {
      width: 28px !important;
      height: 28px !important;
      object-fit: contain;
      filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
    }

    .mobile-start-item .ico svg {
      width: 28px !important;
      height: 28px !important;
      filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
      opacity: 0.9;
    }
    .mobile-start-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 8px 6px; border-radius: 1px; }

    /* ============ Android-Style Phone Frame (Admin Preview) ============ */
    #phoneFrameWrapper {
      position: fixed;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(0, 0, 0, 0.85);
      z-index: 999999;
    }
    #phoneFrameWrapper.phone-frame-hidden {
      display: none !important;
    }

    .phone-device.android {
      width: 360px;
      height: 780px;
      background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
      border-radius: 36px;
      padding: 10px;
      box-shadow:
        0 0 0 2px #3a3a3a,
        0 0 0 4px #1a1a1a,
        0 30px 60px -15px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
      position: relative;
    }

    /* Punch-hole camera */
    .phone-camera-punch {
      position: absolute;
      top: 22px;
      left: 50%;
      transform: translateX(-50%);
      width: 14px;
      height: 14px;
      background: radial-gradient(circle at 30% 30%, #333 0%, #111 60%, #000 100%);
      border-radius: 50%;
      z-index: 100;
      box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.9),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    }

    /* Camera lens reflection effect */
    .phone-camera-punch::before {
      content: '';
      position: absolute;
      top: 2px;
      left: 2px;
      width: 4px;
      height: 4px;
      background: rgba(100, 150, 255, 0.3);
      border-radius: 50%;
    }

    .phone-screen {
      width: 100%;
      height: 100%;
      background: #000;
      border-radius: 28px;
      overflow: hidden;
      position: relative;
    }

    /* When phone frame is active, position mobile elements inside the screen */
    #phoneFrameWrapper:not(.phone-frame-hidden) #mobileLauncher {
      position: absolute;
      inset: 0;
      padding-top: 40px; /* Space for camera punch area */
    }

    #phoneFrameWrapper:not(.phone-frame-hidden) #mobileNavBar {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
    }

    #phoneFrameWrapper:not(.phone-frame-hidden) #mobileRecents,
    #phoneFrameWrapper:not(.phone-frame-hidden) #mobileStartMenu {
      position: absolute;
      inset: 0;
    }

    /* Phone frame label */
    .phone-frame-label {
      position: absolute;
      bottom: -40px;
      left: 50%;
      transform: translateX(-50%);
      color: rgba(255, 255, 255, 0.6);
      font-size: 12px;
      font-weight: 500;
      white-space: nowrap;
    }

    /* Mobile app windows inside phone frame need to be positioned relative to the phone screen */
    #phoneFrameWrapper:not(.phone-frame-hidden) .winbox.mobile-app-window {
      position: absolute !important;
      top: 0 !important;
      left: 0 !important;
      width: 100% !important;
      height: calc(100% - 58px) !important; /* Account for nav bar */
    }

    /* Mobile app title overlay inside phone frame */
    #phoneFrameWrapper:not(.phone-frame-hidden) .mobile-app-title {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
    }
  
