/* ── MOBILE-ONLY ELEMENTS — hidden on desktop ── */
#mobile-menu-btn    { display: none; }
#mobile-link-btn    { display: none; }
#mobile-actions-btn { display: none; }
#mobile-actions-menu { display: none; } /* uses .hidden class; this ensures it on desktop too */

/* ── SIDEBAR BACKDROP — hidden by default ── */
#sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 150;
}
#sidebar-backdrop.visible { display: block; }

/* ── MOBILE ACTIONS DROPDOWN ── */
#mobile-actions-menu {
  position: absolute;
  top: calc(var(--topbar-h) - 4px);
  right: 8px;
  background: var(--surface2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  min-width: 160px;
  overflow: hidden;
  animation: menuIn 0.12s ease forwards;
}
#mobile-actions-menu:not(.hidden) { display: block; }

.mobile-action-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  background: none; border: none;
  font-family: var(--font); font-size: 13px;
  color: var(--text); cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}
.mobile-action-item + .mobile-action-item {
  border-top: 1px solid var(--border);
}
.mobile-action-item:hover,
.mobile-action-item:active { background: var(--surface3); }

/* ── MOBILE BREAKPOINT ── */
@media (max-width: 640px) {

  /* Show mobile-only topbar buttons */
  #mobile-menu-btn    { display: flex; }
  #mobile-link-btn    { display: flex; }
  #mobile-actions-btn { display: flex; }

  /* Hide desktop action buttons (replaced by dropdown) */
  #new-note-btn,
  #new-zone-btn,
  #fit-btn { display: none !important; }

  /* Sidebar becomes a fixed slide-in overlay */
  #sidebar {
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w) !important;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 200;
  }
  #sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Desktop collapse chevron not needed on mobile */
  #sidebar-collapse-btn { display: none; }

  /* Desktop expand tab not needed on mobile */
  #sidebar-expand-btn { display: none !important; }

  /* Hide button text labels and kbd hints in topbar */
  .btn-label { display: none; }
  #topbar-actions kbd,
  #topbar-right kbd { display: none; }

  /* Compact topbar button padding */
  .tb-btn { padding: 7px 10px; }

  /* Hide minimap on small screens */
  #minimap { display: none !important; }

  /* Prevent iOS auto-zoom when focusing note textarea */
  .note-body { font-size: 16px !important; }

  /* Ensure touch targets are comfortably large */
  .tb-btn,
  .tb-icon-btn,
  #new-tree-btn,
  #signout-btn {
    min-height: 40px;
    min-width: 40px;
  }

  /* Tree items slightly taller for finger tapping */
  .tree-item { padding: 9px 8px; }
}
