/* CorridorOS Enhanced Mobile Styles */
/* Comprehensive mobile optimization for tablets and phones */

/* Enhanced Mobile Detection and Responsive Base Styles */

/* Glass-morphism transparency effects for mobOS icons */
.mobile-app-icon {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-app-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.mobile-app-icon:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.2);
}

/* Dark theme glass-morphism */
[data-theme="dark"] .mobile-app-icon {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .mobile-app-icon:hover {
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Photonic light theme glass-morphism */
[data-theme="photonic-light"] .mobile-app-icon {
    background: rgba(0, 200, 255, 0.1);
    border: 1px solid rgba(0, 200, 255, 0.2);
    box-shadow: 
        0 8px 32px rgba(0, 200, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

[data-theme="photonic-light"] .mobile-app-icon:hover {
    background: rgba(0, 200, 255, 0.15);
    box-shadow: 
        0 12px 40px rgba(0, 200, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Mobile-specific theme solidification */
body.mobile-mode {
    --mobile-primary: #00c8ff;
    --mobile-secondary: #00ffd5;
    --mobile-accent: #ff6b6b;
    --mobile-success: #51cf66;
    --mobile-warning: #ffd43b;
    --mobile-error: #ff6b6b;
    --mobile-surface: rgba(255, 255, 255, 0.1);
    --mobile-surface-elevated: rgba(255, 255, 255, 0.15);
    --mobile-text-primary: #ffffff;
    --mobile-text-secondary: rgba(255, 255, 255, 0.7);
    --mobile-text-muted: rgba(255, 255, 255, 0.5);
    --mobile-border: rgba(255, 255, 255, 0.2);
    --mobile-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --mobile-shadow-elevated: 0 16px 48px rgba(0, 0, 0, 0.4);
}

/* Dark mobile theme */
body.mobile-mode[data-theme="dark"] {
    --mobile-primary: #00c8ff;
    --mobile-secondary: #00ffd5;
    --mobile-accent: #ff6b6b;
    --mobile-surface: rgba(0, 0, 0, 0.3);
    --mobile-surface-elevated: rgba(0, 0, 0, 0.4);
    --mobile-text-primary: #ffffff;
    --mobile-text-secondary: rgba(255, 255, 255, 0.8);
    --mobile-text-muted: rgba(255, 255, 255, 0.6);
    --mobile-border: rgba(255, 255, 255, 0.1);
    --mobile-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    --mobile-shadow-elevated: 0 16px 48px rgba(0, 0, 0, 0.6);
}

/* Light mobile theme */
body.mobile-mode[data-theme="light"] {
    --mobile-primary: #2563eb;
    --mobile-secondary: #0891b2;
    --mobile-accent: #dc2626;
    --mobile-surface: rgba(255, 255, 255, 0.8);
    --mobile-surface-elevated: rgba(255, 255, 255, 0.9);
    --mobile-text-primary: #1a202c;
    --mobile-text-secondary: rgba(26, 32, 44, 0.8);
    --mobile-text-muted: rgba(26, 32, 44, 0.6);
    --mobile-border: rgba(0, 0, 0, 0.1);
    --mobile-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --mobile-shadow-elevated: 0 16px 48px rgba(0, 0, 0, 0.15);
}

/* Photonic mobile theme */
body.mobile-mode[data-theme="photonic-light"] {
    --mobile-primary: #00c8ff;
    --mobile-secondary: #00ffd5;
    --mobile-accent: #ff6b6b;
    --mobile-surface: rgba(0, 200, 255, 0.1);
    --mobile-surface-elevated: rgba(0, 200, 255, 0.15);
    --mobile-text-primary: #ffffff;
    --mobile-text-secondary: rgba(255, 255, 255, 0.9);
    --mobile-text-muted: rgba(255, 255, 255, 0.7);
    --mobile-border: rgba(0, 200, 255, 0.2);
    --mobile-shadow: 0 8px 32px rgba(0, 200, 255, 0.2);
    --mobile-shadow-elevated: 0 16px 48px rgba(0, 200, 255, 0.3);
}

/* Mobile Navigation Router Styles */
.mobile-nav-item {
    background: var(--mobile-surface);
    border: 1px solid var(--mobile-border);
    border-radius: 12px;
    padding: 12px 16px;
    margin: 4px 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--mobile-text-primary);
    font-weight: 500;
    text-align: center;
    user-select: none;
}

.mobile-nav-item:hover {
    background: var(--mobile-surface-elevated);
    transform: translateY(-2px);
    box-shadow: var(--mobile-shadow-elevated);
}

.mobile-nav-item.active {
    background: var(--mobile-primary);
    color: white;
    box-shadow: var(--mobile-shadow-elevated);
}

.mobile-nav-item.active:hover {
    background: var(--mobile-primary);
    opacity: 0.9;
}

.mobile-screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    background: var(--mobile-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.mobile-screen.active {
    display: block;
}

/* Navigation Back Button */
.mobile-nav-back {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: var(--mobile-surface);
    border: 1px solid var(--mobile-border);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--mobile-text-primary);
    font-size: 20px;
}

.mobile-nav-back:hover {
    background: var(--mobile-surface-elevated);
    transform: scale(1.1);
}

.mobile-nav-back:active {
    transform: scale(0.95);
}

/* Ultra-wide screens (1920px+) */
@media (min-width: 1920px) {
  :root {
    --mobile-panel-height: 56px;
    --mobile-dock-height: 80px;
    --mobile-touch-target: 48px;
    --mobile-gesture-threshold: 60px;
    --grid-columns: 6;
    --grid-rows: 3;
    --app-size: large;
    --dock-size: large;
    --spacing: comfortable;
  }
}

/* Large desktop screens (1440px-1919px) */
@media (min-width: 1440px) and (max-width: 1919px) {
  :root {
    --mobile-panel-height: 52px;
    --mobile-dock-height: 72px;
    --mobile-touch-target: 46px;
    --mobile-gesture-threshold: 55px;
    --grid-columns: 5;
    --grid-rows: 3;
    --app-size: large;
    --dock-size: large;
    --spacing: comfortable;
  }
}

/* Desktop screens (1200px-1439px) */
@media (min-width: 1200px) and (max-width: 1439px) {
  :root {
    --mobile-panel-height: 50px;
    --mobile-dock-height: 68px;
    --mobile-touch-target: 44px;
    --mobile-gesture-threshold: 50px;
    --grid-columns: 4;
    --grid-rows: 3;
    --app-size: medium;
    --dock-size: medium;
    --spacing: normal;
  }
}

/* Large tablet screens (1024px-1199px) */
@media (min-width: 1024px) and (max-width: 1199px) {
  :root {
    --mobile-panel-height: 48px;
    --mobile-dock-height: 64px;
    --mobile-touch-target: 44px;
    --mobile-gesture-threshold: 50px;
    --grid-columns: 4;
    --grid-rows: 4;
    --app-size: medium;
    --dock-size: medium;
    --spacing: normal;
  }
}

/* Tablet screens (768px-1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  :root {
    --mobile-panel-height: 46px;
    --mobile-dock-height: 60px;
    --mobile-touch-target: 44px;
    --mobile-gesture-threshold: 50px;
    --grid-columns: 3;
    --grid-rows: 4;
    --app-size: medium;
    --dock-size: medium;
    --spacing: normal;
  }
}

/* Large phone screens (480px-767px) */
@media (min-width: 480px) and (max-width: 767px) {
  :root {
    --mobile-panel-height: 44px;
    --mobile-dock-height: 56px;
    --mobile-touch-target: 44px;
    --mobile-gesture-threshold: 50px;
    --grid-columns: 2;
    --grid-rows: 5;
    --app-size: small;
    --dock-size: small;
    --spacing: compact;
  }
}

/* Phone screens (375px-479px) */
@media (min-width: 375px) and (max-width: 479px) {
  :root {
    --mobile-panel-height: 42px;
    --mobile-dock-height: 52px;
    --mobile-touch-target: 44px;
    --mobile-gesture-threshold: 50px;
    --grid-columns: 2;
    --grid-rows: 6;
    --app-size: small;
    --dock-size: small;
    --spacing: compact;
  }
}

/* Small phone screens (320px-374px) */
@media (max-width: 374px) {
  :root {
    --mobile-panel-height: 40px;
    --mobile-dock-height: 48px;
    --mobile-touch-target: 44px;
    --mobile-gesture-threshold: 50px;
    --grid-columns: 1;
    --grid-rows: 8;
    --app-size: small;
    --dock-size: small;
    --spacing: compact;
  }
}

/* Touch device detection */
@media (hover: none) and (pointer: coarse) {
  :root {
    --mobile-safe-area-top: env(safe-area-inset-top, 0px);
    --mobile-safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --mobile-safe-area-left: env(safe-area-inset-left, 0px);
    --mobile-safe-area-right: env(safe-area-inset-right, 0px);
    --keyboard-height: 0px;
    --visual-viewport-height: 100vh;
  }
}

/* Enhanced Responsive App Grid System */
.app-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns, 4), 1fr);
  grid-template-rows: repeat(var(--grid-rows, 3), 1fr);
  gap: var(--grid-gap, 16px);
  padding: var(--grid-padding, 20px);
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  align-content: start;
  position: relative;
}

.app-grid .app-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  min-height: 100px;
}

.app-grid .app-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.app-grid .app-item:hover::before {
  opacity: 1;
}

.app-grid .app-item:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.app-grid .app-item:active {
  transform: translateY(0) scale(0.98);
}

/* App size variations */
.app-grid.large-apps .app-icon {
  width: 80px;
  height: 80px;
  font-size: 2.5rem;
}

.app-grid.medium-apps .app-icon {
  width: 64px;
  height: 64px;
  font-size: 2rem;
}

.app-grid.small-apps .app-icon {
  width: 48px;
  height: 48px;
  font-size: 1.5rem;
}

/* Spacing variations */
.app-grid.comfortable-spacing {
  gap: 24px;
  padding: 32px;
}

.app-grid.normal-spacing {
  gap: 16px;
  padding: 20px;
}

.app-grid.compact-spacing {
  gap: 12px;
  padding: 16px;
}

/* Responsive Dock System */
.dock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--dock-gap, 12px);
  padding: var(--dock-padding, 12px);
  height: var(--mobile-dock-height);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.dock.large-dock {
  height: 80px;
  gap: 16px;
  padding: 16px;
}

.dock.medium-dock {
  height: 64px;
  gap: 12px;
  padding: 12px;
}

.dock.small-dock {
  height: 48px;
  gap: 8px;
  padding: 8px;
}

.dock.comfortable-spacing {
  gap: 20px;
  padding: 20px;
}

.dock.normal-spacing {
  gap: 12px;
  padding: 12px;
}

.dock.compact-spacing {
  gap: 8px;
  padding: 8px;
}

/* Device-specific behaviors */
.iphone-mode .app-grid {
  --grid-gap: 14px;
  --grid-padding: 18px;
}

.android-phone-mode .app-grid {
  --grid-gap: 16px;
  --grid-padding: 20px;
}

.ipad-mode .app-grid {
  --grid-gap: 20px;
  --grid-padding: 24px;
}

.android-tablet-mode .app-grid {
  --grid-gap: 18px;
  --grid-padding: 22px;
}

/* Orientation-specific adjustments */
.landscape-mode .app-grid {
  grid-template-columns: repeat(calc(var(--grid-columns) + 1), 1fr);
  grid-template-rows: repeat(calc(var(--grid-rows) - 1), 1fr);
}

.portrait-mode .app-grid {
  grid-template-columns: repeat(var(--grid-columns), 1fr);
  grid-template-rows: repeat(var(--grid-rows), 1fr);
}

/* Screen size specific adjustments */
.ultra-wide-mode .app-grid {
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 32px;
  padding: 40px;
}

.large-desktop-mode .app-grid {
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 28px;
  padding: 36px;
}

.desktop-mode .app-grid {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 24px;
  padding: 32px;
}

.large-tablet-mode .app-grid {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 20px;
  padding: 28px;
}

.tablet-mode .app-grid {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 18px;
  padding: 24px;
}

.large-phone-mode .app-grid {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 16px;
  padding: 20px;
}

.phone-mode .app-grid {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 14px;
  padding: 18px;
}

.small-phone-mode .app-grid {
  grid-template-columns: repeat(1, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 12px;
  padding: 16px;
}

/* Mobile body and html setup */
body.mobile-mode, html.mobile-mode {
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile */
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

  /* Enhanced mobile viewport handling */
  body.mobile-mode {
    padding-top: var(--mobile-safe-area-top);
    padding-bottom: var(--mobile-safe-area-bottom);
    padding-left: var(--mobile-safe-area-left);
    padding-right: var(--mobile-safe-area-right);
  }

  /* Mobile Top Panel */
  body.mobile-mode .top-panel {
    height: var(--mobile-panel-height);
    padding: 0 12px;
    position: fixed;
    top: var(--mobile-safe-area-top);
    left: 0;
    right: 0;
    z-index: var(--z-sticky);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }

  body.mobile-mode .top-panel .panel-left {
    gap: 8px;
  }

  body.mobile-mode .top-panel .activities-button {
    font-size: 13px;
    padding: 8px 12px;
    min-height: var(--mobile-touch-target);
    min-width: var(--mobile-touch-target);
  }

  body.mobile-mode .top-panel .panel-right {
    gap: 4px;
  }

  body.mobile-mode .top-panel .panel-button {
    padding: 8px;
    min-height: var(--mobile-touch-target);
    min-width: var(--mobile-touch-target);
    font-size: 16px;
  }

  /* Enhanced Mobile Dock with Modern OS Feel */
  body.mobile-mode .dock {
    position: fixed;
    bottom: var(--mobile-safe-area-bottom);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: auto;
    max-width: calc(100vw - 40px);
    height: var(--mobile-dock-height);
    padding: 12px 20px;
    background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.7));
    backdrop-filter: saturate(180%) blur(25px);
    -webkit-backdrop-filter: saturate(180%) blur(25px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 24px;
    z-index: var(--z-sticky);
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 8px;
    gap: 8px;
  }

  body.mobile-mode .dock .dock-apps {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 4px 0;
    flex: 1;
  }

  body.mobile-mode .dock .dock-apps::-webkit-scrollbar {
    display: none;
  }

  body.mobile-mode .dock .dock-app {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
  }
  
  body.mobile-mode .dock .dock-app::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  body.mobile-mode .dock .dock-app:hover::before {
    opacity: 1;
  }

  body.mobile-mode .dock .dock-app:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.2);
  }

  body.mobile-mode .dock .dock-app.active {
    background: rgba(0, 200, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.4);
  }

  body.mobile-mode .dock .dock-app.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--primary-cyan);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--primary-cyan);
  }

  /* Notifications: ensure they appear above overlays and look tidy */
  body.mobile-mode .notifications {
    top: 14px;
    right: 12px;
    z-index: var(--z-toast); /* above drawers/switchers/gestures */
    padding: 2px;
  }
  body.mobile-mode .notification {
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(12,16,28,0.92);
    box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  }

  /* Swipe indicator */
  body.mobile-mode .swipe-indicator {
    text-align: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    padding: 2px 0;
    animation: pulse 2s infinite;
  }

  @keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
  }

  /* Mobile Windows - Full screen with gestures */
  body.mobile-mode .windows-container {
    position: fixed;
    top: calc(var(--mobile-panel-height) + var(--mobile-safe-area-top));
    left: 0;
    right: 0;
    bottom: calc(var(--mobile-dock-height) + var(--mobile-safe-area-bottom));
    pointer-events: auto;
    overflow: hidden;
  }

  body.mobile-mode .window {
    position: absolute;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
  }

  body.mobile-mode .window.hidden {
    transform: translateX(100%);
  }

  body.mobile-mode .window.slide-in {
    animation: slideInFromRight 0.3s ease;
  }

  @keyframes slideInFromRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
  }

  /* Mobile Window Titlebar */
  body.mobile-mode .window .window-titlebar {
    height: 44px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    cursor: default;
  }

  body.mobile-mode .window .window-title-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
  }

  body.mobile-mode .window .window-icon {
    font-size: 18px;
    flex-shrink: 0;
  }

  body.mobile-mode .window .window-title {
    font-size: 16px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.mobile-mode .window .window-controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
  }

  /* Hide desktop-style minimize/maximize on phones */
  body.mobile-mode .window .window-control.minimize,
  body.mobile-mode .window .window-control.maximize {
    display: none !important;
  }

  body.mobile-mode .window .window-control {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
  }

  body.mobile-mode .window .window-control:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
  }

  body.mobile-mode .window .window-control.close {
    background: rgba(255, 95, 86, 0.8);
  }

  body.mobile-mode .window .window-control.minimize {
    background: rgba(255, 189, 46, 0.8);
  }

  body.mobile-mode .window .window-control.maximize {
    background: rgba(39, 202, 63, 0.8);
  }

  /* Mobile Window Content */
  body.mobile-mode .window .window-content {
    flex: 1;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-secondary);
    padding: 16px;
  }

  /* Softkeys bar (Back · Home · Switcher) */
  .mobile-softkeys {
    position: fixed;
    bottom: calc(var(--mobile-safe-area-bottom) + var(--mobile-dock-height));
    left: 0;
    right: 0;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    /* Ensure softkeys sit above app windows and overlays */
    z-index: 6000;
    pointer-events: none; /* let taps pass except on buttons */
  }
  .mobile-softkeys .softkey {
    width: 44px; height: 44px; border-radius: 12px;
    display: inline-flex; align-items:center; justify-content:center;
    background: rgba(0,0,0,.35); color:#fff; border:1px solid rgba(255,255,255,.2);
    pointer-events: auto; /* clickable */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 18px; cursor: pointer;
  }
  .mobile-softkeys .softkey:active { transform: scale(.96); }

  /* Mobile Activities Overview */
  body.mobile-mode #activities-overview {
    position: fixed;
    top: calc(var(--mobile-panel-height) + var(--mobile-safe-area-top));
    left: 0;
    right: 0;
    bottom: calc(var(--mobile-dock-height) + var(--mobile-safe-area-bottom));
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    padding: 20px;
  }

  body.mobile-mode #activities-overview .overview-search {
    margin-bottom: 20px;
  }

  body.mobile-mode #activities-overview .overview-search input {
    width: 100%;
    padding: 16px 20px;
    font-size: 18px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
  }

  body.mobile-mode #activities-overview .overview-workspaces {
    display: none; /* Hide workspaces on mobile */
  }

  body.mobile-mode #activities-overview .overview-apps {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.mobile-mode #activities-overview .app-grid {
    display: grid;
    /* Two vertical columns, scrolls vertically */
    grid-template-columns: repeat(2, 1fr) !important;
    grid-auto-rows: minmax(92px, auto) !important;
    grid-auto-flow: row !important;
    gap: 16px;
    padding: 0;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  /* Tablets: use 3 columns for Activities overview */
  body.mobile-mode.tablet-mode #activities-overview .app-grid,
  body.mobile-mode.large-tablet-mode #activities-overview .app-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  /* Phones: keep 2 columns explicitly */
  body.mobile-mode.phone-mode #activities-overview .app-grid,
  body.mobile-mode.large-phone-mode #activities-overview .app-grid,
  body.mobile-mode.small-phone-mode #activities-overview .app-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  body.mobile-mode #activities-overview .app-item {
    padding: 20px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 100px;
    transition: all 0.2s ease;
  }

  body.mobile-mode #activities-overview .app-item:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
  }

  body.mobile-mode #activities-overview .app-item .app-icon {
    font-size: 32px;
  }

  body.mobile-mode #activities-overview .app-item .app-name {
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    color: white;
  }

  /* Enhanced Mobile App Drawer with Modern OS Feel */
  .mobile-app-drawer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 20px;
    padding-top: calc(var(--mobile-safe-area-top) + 20px);
    padding-bottom: calc(var(--mobile-safe-area-bottom) + 20px);
    padding-left: calc(var(--mobile-safe-area-left) + 20px);
    padding-right: calc(var(--mobile-safe-area-right) + 20px);
  }

  .mobile-app-drawer.open {
    transform: translateY(0);
  }

  .mobile-app-drawer .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    margin: 0 0 16px 0;
    border-radius: 20px 20px 0 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
  }

  .mobile-app-drawer .drawer-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
  }

  .mobile-app-drawer .drawer-close {
    width: 44px;
    height: 44px;
    border-radius: 22px;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.2);
    color: var(--text);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .mobile-app-drawer .drawer-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
  }

  .mobile-app-drawer .drawer-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px;
    border: 1px solid rgba(255,255,255,0.18);
    border-top: none;
    border-radius: 0 0 20px 20px;
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 4px 30px rgba(0, 0, 0, 0.2);
  }

  .mobile-app-drawer .category-section {
    margin-bottom: 32px;
  }

  .mobile-app-drawer .category-section h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-cyan);
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 200, 255, 0.3);
  }

  .mobile-app-drawer .category-apps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }

  .mobile-app-drawer .drawer-app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 96px;
    position: relative;
    overflow: hidden;
  }
  
  .mobile-app-drawer .drawer-app-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .mobile-app-drawer .drawer-app-item:hover::before {
    opacity: 1;
  }

  .mobile-app-drawer .drawer-app-item:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
  }

  .mobile-app-drawer .drawer-app-item .app-icon {
    font-size: 32px;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
  }
  
  .mobile-app-drawer .drawer-app-item:hover .app-icon {
    transform: scale(1.1);
  }

  .mobile-app-drawer .drawer-app-item .app-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    position: relative;
    z-index: 1;
    line-height: 1.2;
  }

  /* Subtle home indicator for OS feel */
  .mobile-app-drawer::after,
  .mobile-app-switcher::after,
  .mobile-app-grid::after {
    content: '';
    position: fixed;
    left: 50%;
    bottom: calc(var(--mobile-safe-area-bottom) + 6px);
    transform: translateX(-50%);
    width: 88px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.35);
  }

  /* Mobile App Switcher */
  .mobile-app-switcher {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: var(--z-drawer);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }

  .mobile-app-switcher.open {
    transform: translateY(0);
  }

  .mobile-app-switcher .switcher-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: var(--mobile-safe-area-top);
  }

  .mobile-app-switcher .switcher-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
  }

  .mobile-app-switcher .switcher-close {
    width: 44px;
    height: 44px;
    border-radius: 22px;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.2);
    color: var(--text);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .mobile-app-switcher .switcher-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
  }

  .mobile-app-switcher .switcher-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
  }

  .mobile-app-switcher .switcher-app-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .mobile-app-switcher .switcher-app-item.active {
    background: rgba(0, 200, 255, 0.3);
    border-color: rgba(0, 200, 255, 0.5);
  }

  .mobile-app-switcher .switcher-app-item:active {
    transform: scale(0.98);
  }

  .mobile-app-switcher .switcher-app-item .app-icon {
    font-size: 24px;
    flex-shrink: 0;
  }

  .mobile-app-switcher .switcher-app-item .app-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    flex: 1;
  }

  .mobile-app-switcher .switcher-app-item .close-app {
    width: 32px;
    height: 32px;
    border-radius: 16px;
    background: rgba(255, 95, 86, 0.8);
    border: none;
    color: white;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .mobile-app-switcher .switcher-app-item .close-app:hover {
    background: rgba(255, 95, 86, 1);
    transform: scale(1.1);
  }

  .mobile-app-switcher .switcher-actions {
    display: flex;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .mobile-app-switcher .switcher-action {
    flex: 1;
    padding: 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .mobile-app-switcher .switcher-action:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
  }

  /* Gesture Overlay */
  .gesture-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: var(--z-popover);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .gesture-indicator {
    background: rgba(0, 200, 255, 0.9);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 200, 255, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
  }

  /* Mobile Notifications */
  body.mobile-mode .notifications {
    top: calc(var(--mobile-panel-height) + var(--mobile-safe-area-top) + 20px);
    right: 16px;
    left: 16px;
    max-width: none;
    z-index: var(--z-toast); /* Lower z-index to prevent blocking */
    pointer-events: none; /* Allow clicks to pass through */
  }

  body.mobile-mode .notification {
    max-width: none;
    margin-bottom: 12px;
    border-radius: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: auto; /* Re-enable pointer events for the notification itself */
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
  }
  
  /* Notification close button */
  body.mobile-mode .notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
  }
  
  body.mobile-mode .notification-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 1);
  }
  
  /* Swipe animation classes */
  body.mobile-mode .notification.dismissing {
    transform: translateX(100%);
    opacity: 0;
  }
  
  body.mobile-mode .notification.show {
    animation: slideInRight 0.3s ease;
  }
  
  @keyframes slideInRight {
    from {
      transform: translateX(100%);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }

  body.mobile-mode .notifications-panel {
    width: 100%;
    right: 0;
    left: 0;
    top: calc(var(--mobile-panel-height) + var(--mobile-safe-area-top));
    height: calc(100vh - var(--mobile-panel-height) - var(--mobile-safe-area-top) - var(--mobile-dock-height) - var(--mobile-safe-area-bottom));
    border-radius: 0;
  }

  /* Mobile Desktop Icons - Hidden on mobile */
  body.mobile-mode .desktop-icons {
    display: none !important;
  }
  
  /* Mobile App Grid - Show on homescreen */
  body.mobile-mode .activities-overview {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: calc(var(--mobile-panel-height) + var(--mobile-safe-area-top));
    left: 0;
    right: 0;
    bottom: calc(var(--mobile-dock-height) + var(--mobile-safe-area-bottom));
    background: var(--bg-primary);
    z-index: 10;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  body.mobile-mode .overview-apps {
    padding: 20px;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  body.mobile-mode .app-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-columns), 1fr);
    grid-template-rows: repeat(var(--grid-rows), 1fr);
    gap: var(--mobile-grid-gap, 16px);
    padding: 0;
    margin: 0;
    height: 100%;
    align-content: start;
  }
  
  body.mobile-mode .app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 12px;
    background: var(--bg-panel);
    backdrop-filter: var(--blur-medium);
    -webkit-backdrop-filter: var(--blur-medium);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-small);
    transition: all 0.2s ease;
    cursor: pointer;
    min-height: 80px;
    position: relative;
    overflow: hidden;
  }
  
  body.mobile-mode .app-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
    background: var(--bg-glass-hover);
  }
  
  body.mobile-mode .app-item:active {
    transform: translateY(0);
    box-shadow: var(--shadow-small);
  }
  
  body.mobile-mode .app-item .app-icon {
    font-size: 32px;
    margin-bottom: 8px;
    display: block;
    line-height: 1;
  }
  
  body.mobile-mode .app-item .app-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
  }
  
  /* Hide search and workspaces on mobile */
  body.mobile-mode .overview-search,
  body.mobile-mode .overview-workspaces {
    display: none !important;
  }

  /* Mobile Context Menu */
  body.mobile-mode .context-menu {
    position: fixed;
    bottom: calc(var(--mobile-dock-height) + var(--mobile-safe-area-bottom) + 20px);
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    width: auto;
    min-width: 200px;
    max-width: 300px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  }

  body.mobile-mode .context-menu .menu-item {
    padding: 16px 20px;
    font-size: 16px;
    border-radius: 12px;
    margin: 4px 8px;
  }

  /* Mobile User Menu */
  body.mobile-mode .user-menu {
    position: fixed;
    bottom: calc(var(--mobile-dock-height) + var(--mobile-safe-area-bottom) + 20px);
    right: 20px;
    left: auto;
    top: auto;
    width: 200px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  }

  body.mobile-mode .user-menu .menu-item {
    padding: 16px 20px;
    font-size: 16px;
    border-radius: 12px;
    margin: 4px 8px;
  }

  /* Mobile Theme Menu */
  body.mobile-mode .theme-menu {
    position: fixed;
    bottom: calc(var(--mobile-dock-height) + var(--mobile-safe-area-bottom) + 20px);
    right: 20px;
    left: auto;
    top: auto;
    width: 200px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  }

  /* Mobile Lock Screen */
  body.mobile-mode .lock-screen {
    padding: var(--mobile-safe-area-top) var(--mobile-safe-area-right) var(--mobile-safe-area-bottom) var(--mobile-safe-area-left);
  }

  body.mobile-mode .lock-content {
    padding: 20px;
  }

  body.mobile-mode .lock-clock {
    font-size: 64px;
    margin-bottom: 16px;
  }

  body.mobile-mode .lock-date {
    font-size: 20px;
    margin-bottom: 40px;
  }

  body.mobile-mode .lock-user {
    gap: 20px;
  }

  body.mobile-mode .user-avatar {
    width: 100px;
    height: 100px;
    font-size: 40px;
  }

  body.mobile-mode .password-input {
    width: 100%;
    max-width: 300px;
    padding: 16px 20px;
    font-size: 18px;
  }

  body.mobile-mode .unlock-button {
    padding: 16px 32px;
    font-size: 18px;
  }

  /* Mobile Keyboard Handling */
  body.mobile-mode.keyboard-open .dock {
    display: none;
  }

  body.mobile-mode.keyboard-open .windows-container {
    bottom: 0;
    height: calc(100vh - var(--mobile-panel-height) - var(--mobile-safe-area-top));
  }

  /* Landscape Mode Optimizations */
  @media (orientation: landscape) and (max-height: 500px) {
    body.mobile-mode .dock {
      height: 48px;
      padding: 4px 12px;
    }

    body.mobile-mode .dock .dock-app {
      width: 40px;
      height: 40px;
      min-width: 40px;
      min-height: 40px;
    }

    body.mobile-mode .top-panel {
      height: 40px;
    }

    body.mobile-mode .windows-container {
      top: calc(40px + var(--mobile-safe-area-top));
      bottom: calc(48px + var(--mobile-safe-area-bottom));
    }

    body.mobile-mode .window .window-titlebar {
      height: 36px;
    }
  }

  /* Tablet Specific Optimizations */
  @media (min-width: 768px) and (max-width: 1024px) {
    body.tablet-mode .dock {
      bottom: 20px;
      left: 50%;
      right: auto;
      transform: translateX(-50%);
      width: auto;
      max-width: 80%;
      border-radius: 24px;
    }

    body.tablet-mode .dock .dock-apps {
      justify-content: center;
    }

    body.tablet-mode #activities-overview .app-grid {
      grid-template-columns: repeat(4, 1fr);
    }

    body.tablet-mode .mobile-app-drawer .category-apps {
      grid-template-columns: repeat(4, 1fr);
    }
  }

  /* Phone Specific Optimizations */
  @media (max-width: 767px) {
    body.phone-mode .dock .dock-apps {
      padding: 0 8px;
    }

    body.phone-mode .dock .dock-app {
      width: 44px;
      height: 44px;
      min-width: 44px;
      min-height: 44px;
    }

    body.phone-mode #activities-overview .app-grid {
      grid-template-columns: repeat(2, 1fr);
    }

    body.phone-mode .mobile-app-drawer .category-apps {
      grid-template-columns: repeat(2, 1fr);
    }

    body.phone-mode .mobile-app-drawer .drawer-app-item {
      min-height: 70px;
      padding: 12px 8px;
    }

    body.phone-mode .mobile-app-drawer .drawer-app-item .app-icon {
      font-size: 24px;
    }

    body.phone-mode .mobile-app-drawer .drawer-app-item .app-name {
      font-size: 11px;
    }
  }

  /* Accessibility Improvements */
  @media (prefers-reduced-motion: reduce) {
    body.mobile-mode * {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }

  /* High Contrast Mode */
  @media (prefers-contrast: high) {
    body.mobile-mode {
      --mobile-touch-target: 48px;
    }

    body.mobile-mode .dock .dock-app,
    body.mobile-mode .app-item,
    body.mobile-mode .panel-button {
      border: 2px solid rgba(255, 255, 255, 0.5);
    }

    body.mobile-mode .window .window-control {
      border: 2px solid rgba(255, 255, 255, 0.5);
    }
  }

  /* Dark Mode Optimizations */
  @media (prefers-color-scheme: dark) {
    body.mobile-mode .gesture-indicator {
      background: rgba(0, 200, 255, 0.95);
      color: #000;
    }
  }

  /* Light Mode Optimizations */
  @media (prefers-color-scheme: light) {
    body.mobile-mode .dock {
      background: linear-gradient(180deg, rgba(255,255,255,0.8), rgba(255,255,255,0.6));
      border-top: 1px solid rgba(0, 0, 0, 0.1);
    }

    body.mobile-mode .window .window-titlebar {
      background: rgba(255, 255, 255, 0.9);
      border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }

    body.mobile-mode .window .window-title {
      color: #000;
    }

    body.mobile-mode .window .window-control {
      color: #000;
      background: rgba(0, 0, 0, 0.1);
      border: 1px solid rgba(0, 0, 0, 0.2);
    }
  }
}

/* Additional Mobile Utilities */
.mobile-only {
  display: none;
}

@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .mobile-only {
    display: block;
  }

  .desktop-only {
    display: none !important;
  }
}

/* Mobile Video Optimizations */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  video {
    -webkit-playsinline: true;
    playsinline: true;
    object-fit: contain;
  }

  video::-webkit-media-controls {
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
  }

  video::-webkit-media-controls-panel {
    background: rgba(0,0,0,0.6);
  }

  video::-webkit-media-controls-play-button,
  video::-webkit-media-controls-pause-button {
    background: rgba(0, 200, 255, 0.8);
    border-radius: 50%;
  }
}

/* Mobile Scrollbar Styling */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  ::-webkit-scrollbar {
    width: 4px;
    height: 4px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
  }
}
