.hamburger-btn,
.sidebar-overlay,
.mobile-nav-bar,
.mobile-control-panel,
.mobile-bottom-actions,
.mobile-bottom-sheet {
  display: none;
}

/* Mobile Specific Styles */
@media (max-width: 768px) {
  /* Global Resets for Mobile */
  body {
    overflow-x: hidden;
    overscroll-behavior-y: none; /* Prevent pull-to-refresh on accidental scrolls */
  }

  .app-container {
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height */
  }

  /* 
   * Sidebar Drawer Styles 
   */
  .left-sidebar {
    display: flex !important; /* Force display on mobile */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 250px !important; /* Drawer width */
    height: 100% !important;
    z-index: 3000 !important; /* Above everything */
    transform: translateX(-100%); /* Initially hidden */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    border-right: 1px solid #333;
    padding-top: 0; /* Maintain layout */
  }

  /* Force text visibility on mobile sidebar */
  .left-sidebar .nav-item .nav-text {
    display: inline-block !important;
  }

  .left-sidebar .logo-section,
  .left-sidebar .theme-section {
    display: block !important;
  }

  .left-sidebar.show-drawer {
    transform: translateX(0);
  }

  /* Overlay for Sidebar */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    /* backdrop-filter: blur(2px); */
  }

  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  /* Hamburger Button */
  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-right: 8px;
    margin-left: -8px; /* Visual alignment */
    cursor: pointer;
    color: #fff;
    border-radius: 4px;
    transition: background 0.2s;
  }

  .hamburger-btn:active {
    background: rgba(255, 255, 255, 0.1);
  }

  /* Hide Desktop Sidebar normally, but we overrode it above with .left-sidebar styles */

  /* Mobile Bottom Navigation Bar - HIDDEN per request */
  .mobile-nav-bar {
    display: none !important;
  }

  .mobile-nav-item {
    display: none;
  }

  /* Header Adjustments */
  .top-header {
    height: 60px;
    padding: 0 16px;
    /* Sticky Header */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: #000; /* Ensure opaque background */
  }

  /* Increase Dropdown Height & Style */
  .mobile-select-trigger {
    height: 48px; /* Taller touch target */
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 14px;
    color: #fff;
    width: 100%;
    cursor: pointer;
  }

  .header-title {
    font-size: 16px;
    font-weight: bold;
  }

  .header-right {
    gap: 10px;
  }

  .points-display {
    font-size: 12px;
  }

  /* Main Content Adjustments */
  /* Main Content Adjustments */
  .main-content {
    padding-bottom: 0; /* No bottom nav space needed */
    padding-top: 60px; /* Compensate for fixed header */
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Content Area Vertical Stack */
  .content-area {
    flex-direction: column !important;
    display: flex !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* Hide Original Bottom Toolbar on Mobile */
  .bottom-toolbar {
    display: none !important;
  }

  /* Canvas Toolbar (Top Center) */
  .left-toolbar {
    display: flex !important;
    position: absolute !important;
    top: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    flex-direction: row !important;
    width: auto !important;
    height: auto !important;
    padding: 6px 16px !important;
    background: rgba(30, 30, 30, 0.9) !important;
    border-radius: 100px !important;
    border: 1px solid #444 !important;
    z-index: 150 !important;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }

  /* Adjust tool buttons for mobile touch target */
  .left-toolbar .tool-btn {
    width: 28px;
    height: 28px;
    margin-bottom: 0; /* Override vertical layout margins if any */
  }

  /* Adjust Canvas Area for Mobile */
  .canvas-area {
    align-items: flex-start !important;
    padding-top: 10px !important;
    width: 100% !important;
    flex: none !important;
    height: auto !important;
    min-height: 250px;
    position: relative !important;
  }

  /* Modal/Panel Adjustments (Bottom Sheet style) */
  .mobile-bottom-sheet {
    position: fixed;
    bottom: 0px;
    left: 0;
    width: 100%;
    background: #1e1e1e;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    z-index: 3001;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
  }

  .mobile-bottom-sheet.show {
    transform: translateY(0);
  }

  .sheet-handle {
    width: 40px;
    height: 4px;
    background: #444;
    border-radius: 2px;
    margin: 12px auto;
  }

  .sheet-content {
    overflow-y: auto;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  /* Bottom Sheet Content Styling */
  .sheet-list-item {
    padding: 16px;
    border-bottom: 1px solid #333;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
  }
  .sheet-list-item:last-child {
    border-bottom: none;
  }
  .sheet-list-item.active {
    background: #333;
    color: #3b82f6;
  }

  /* Task Board Grid */
  .task-board-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 12px;
    padding-bottom: 20px;
  }

  .task-board-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #252525;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
  }

  .task-board-item-icon {
    font-size: 20px;
  }

  .sheet-header {
    padding: 0 0 16px;
    border-bottom: 1px solid #333;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
  }
  /* Mobile Control Panel Styles */
  .mobile-control-panel {
    display: block !important;
    padding: 16px;
    padding-bottom: 80px; /* 刚好匹配底部操作栏高度 */
    background: transparent;
  }

  .control-group {
    margin-bottom: 20px;
  }

  .control-label {
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 8px;
  }

  /* Custom Select Style */
  .select-wrapper {
    position: relative;
    border: 1px solid #333;
    border-radius: 4px;
    background: #1e1e1e;
  }

  .select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 10px;
    pointer-events: none;
  }

  .mobile-select {
    width: 100%;
    height: 40px;
    background: transparent;
    border: none;
    color: #fff;
    padding: 0 30px 0 12px;
    font-size: 14px;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
  }

  .mobile-textarea {
    width: 100%;
    height: 80px;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 12px;
    color: #fff;
    font-size: 14px;
    resize: none;
    outline: none;
    font-family: inherit;
  }

  /* Ratio Selector */
  .ratio-selector {
    display: flex;
    gap: 12px;
  }

  .ratio-btn {
    flex: 1;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #333;
    border-radius: 4px;
    background: #1e1e1e;
    color: #888;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
  }

  .ratio-btn.active {
    background: #333;
    color: #fff;
    border-color: #666;
  }

  /* Batch Selector */
  .batch-selector {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #1e1e1e;
    border: 1px solid #333;
    padding: 10px 16px;
    border-radius: 4px;
  }

  #mobileBatchInput {
    flex: 1;
    accent-color: #3b82f6;
  }

  #mobileBatchValue {
    color: #fff;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
  }

  /* Fixed Bottom Actions */
  .mobile-bottom-actions {
    display: flex !important;
    position: fixed !important;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px; /* Increased height */
    background: #121212;
    border-top: 1px solid #333;
    padding: 10px 16px; /* Padding inside */
    z-index: 2000;
    align-items: center;
    gap: 12px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
  }

  .action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 44px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
  }

  .action-btn.secondary {
    flex: 1;
    background: #252525;
    border: 1px solid #333;
    color: #fff;
    gap: 2px;
  }

  .action-btn.primary {
    flex: 2; /* Double Width */
    background: #3b82f6; /* Blue Fill */
    color: #fff; /* White Text */
    font-weight: bold;
    font-size: 16px;
    height: 50px; /* Slightly taller */
    border: none;
  }

  .btn-icon {
    font-size: 16px;
  }
} /* End Mobile Media Query */

/* Default state for overlay (hidden) */
.sidebar-overlay {
  display: none;
}

/* Ensure mobile nav is hidden on desktop too (default) */
.mobile-nav-bar {
  display: none;
}

/* User Drawer (Right Side) */
.user-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  height: 100%;
  background: #1e1e1e;
  z-index: 3000;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  padding-top: 20px;
}

.user-drawer.show {
  transform: translateX(0);
}

.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.drawer-item {
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  font-size: 15px;
  border-bottom: 1px solid #2a2a2a;
  cursor: pointer;
  text-decoration: none;
}

.drawer-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Adjustments for moved elements */
.user-drawer .points-display {
  font-size: 16px;
  font-weight: bold;
}

.user-drawer .recharge-btn {
  width: 100%;
  margin: 0;
  text-align: center;
  padding: 10px;
  margin-top: 10px;
}

.drawer-section {
  padding: 15px 20px;
  border-bottom: 1px solid #333;
}

/* Desktop/Mobile Visibility Control */
@media (max-width: 768px) {
  .desktop-nav-items {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .user-drawer {
    display: none !important;
  }
  .drawer-overlay {
    display: none !important;
  }
}
