/* ── Mobile Bottom Sheet — DrawRadius ── */

/* Default: sheet hidden on desktop */
#mobile-sheet { display: none; }

/* Safe area for all screens */
#search-bar { top: max(12px, env(safe-area-inset-top, 0px)); }
#fab-stack { top: max(12px, env(safe-area-inset-top, 0px)); }

@media (max-width: 768px) {
  /* Hide desktop UI */
  #fab-stack, #pop-radius, #pop-tools, #pop-style, #pop-settings, #popover-backdrop, #stats-hud, #coords-label, #brand-badge { display: none !important; }
  #mobile-sheet { display: block !important; }
  /* Search bar full width */
  #search-bar { top: max(56px, calc(env(safe-area-inset-top, 0px) + 12px)); left: 10px; right: 10px; width: auto; transform: none; border-radius: 14px; backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(255,255,255,0.97); }
  .satellite-theme #search-bar { background: rgba(18,26,18,0.97); }

  /* ── Bottom sheet structure ── */
  #mobile-sheet { position: absolute; bottom: 0; left: 0; right: 0; background: #ffffff; border-radius: 20px 20px 0 0; z-index: 1000; transition: height 0.35s cubic-bezier(0.4,0,0.2,1); height: calc(80px + env(safe-area-inset-bottom, 0px)); overflow: hidden; padding-bottom: env(safe-area-inset-bottom, 20px); box-shadow: 0 -2px 20px rgba(0,0,0,0.12); box-sizing: border-box; max-width: 100vw; overflow-x: hidden; }
  #mobile-sheet.sheet-half { height: 220px; }
  #mobile-sheet.sheet-full { height: 85dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  #mobile-sheet-handle { width: 36px; height: 4px; background: rgba(0,0,0,0.15); border-radius: 2px; margin: 10px auto 0; }
  #mobile-sheet-content { padding: 8px 14px 16px; }
  .satellite-theme #mobile-sheet { background: rgba(18,26,18,0.97); }

  /* ── Peek row (collapsed) ── */
  .m-peek-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 14px 0; }
  .m-peek-num { font-size: 20px; font-weight: 700; color: #007AFF; letter-spacing: -0.5px; }
  .m-peek-unit { font-size: 12px; color: rgba(0,0,0,0.4); margin-left: 3px; }
  .m-peek-pill { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; cursor: pointer; }
  .m-peek-pill.active { background: #007AFF; color: #fff; }
  .m-peek-pill.inactive { background: rgba(0,0,0,0.06); color: rgba(0,0,0,0.45); }

  /* ── Mode toggle ── */
  .m-mode-toggle { display: flex; background: rgba(0,0,0,0.06); border-radius: 10px; padding: 2px; margin-bottom: 10px; }
  .m-mode-btn { flex: 1; text-align: center; font-size: 13px; font-weight: 500; padding: 7px; border-radius: 8px; color: rgba(0,0,0,0.4); cursor: pointer; }
  .m-mode-btn.active { background: #fff; color: #007AFF; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.12); }

  /* ── Big number + unit toggle ── */
  .m-bignum { font-size: 32px; font-weight: 700; color: #007AFF; letter-spacing: -1.5px; line-height: 1; cursor: pointer; }
  .m-unit-toggle { display: flex; gap: 4px; margin-left: auto; align-items: center; }
  .m-unit-btn { font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 7px; cursor: pointer; }
  .m-unit-btn.active { background: #007AFF; color: #fff; }
  .m-unit-btn.inactive { background: rgba(0,0,0,0.05); color: rgba(0,0,0,0.4); }

  /* ── Slider ── */
  .m-slider { width: 100%; height: 4px; -webkit-appearance: none; appearance: none; background: rgba(0,0,0,0.10); border-radius: 2px; outline: none; cursor: pointer; margin: 10px 0 12px; }
  .m-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,0.28); border: 0.5px solid rgba(0,0,0,0.12); }

  /* ── Presets ── */
  .m-presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-bottom: 12px; }
  .m-preset { text-align: center; font-size: 12px; font-weight: 600; padding: 7px 0; border-radius: 9px; cursor: pointer; }
  .m-preset.active { background: #007AFF; color: #fff; }
  .m-preset.inactive { background: rgba(0,122,255,0.08); color: #007AFF; border: 0.5px solid rgba(0,122,255,0.2); }

  /* ── Stat cards ── */
  .m-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
  .m-stat { background: rgba(0,122,255,0.06); border-radius: 10px; padding: 8px 6px; text-align: center; }
  .m-stat-val { font-size: 13px; font-weight: 700; color: #007AFF; }
  .m-stat-key { font-size: 10px; color: rgba(0,0,0,0.38); margin-top: 2px; }

  /* ── Action buttons ── */
  .m-actions { display: flex; gap: 8px; }
  .m-action-primary { flex: 1; height: 44px; background: #007AFF; border-radius: 13px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; font-weight: 600; border: none; cursor: pointer; }
  .m-action-secondary { height: 44px; padding: 0 16px; background: rgba(0,0,0,0.05); border-radius: 13px; display: flex; align-items: center; justify-content: center; color: rgba(0,0,0,0.65); font-size: 14px; font-weight: 500; border: 0.5px solid rgba(0,0,0,0.1); cursor: pointer; }

  /* ── Full state menu rows ── */
  .m-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(0,0,0,0.3); margin: 14px 0 6px; }
  .m-menu-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 0.5px solid rgba(0,0,0,0.06); cursor: pointer; }
  .m-menu-row:last-child { border-bottom: none; }
  .m-menu-icon { width: 32px; height: 32px; border-radius: 9px; background: rgba(0,122,255,0.1); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 15px; }
  .m-menu-label { font-size: 14px; font-weight: 500; color: rgba(0,0,0,0.8); }
  .m-menu-arrow { margin-left: auto; font-size: 16px; color: rgba(0,0,0,0.25); }
  .m-destructive { color: #FF3B30 !important; }
  .m-icon-destructive { background: rgba(255,59,48,0.1) !important; }
}
