/* NearNow Web v161 — mobile-only app layer.
   Loaded with media="(max-width: 860px)" so desktop rendering stays untouched. */
@media (max-width: 860px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: hidden; }
  body { overflow-x: hidden; overscroll-behavior-x: none; }
  button, input, select, textarea { touch-action: manipulation; }
  button, .pill, .intent, .cta, .primary, .secondary { -webkit-tap-highlight-color: rgba(255,255,255,.08); }

  .main { width: 100%; max-width: 100vw; }
  .topbar { min-height: 64px; height: auto; padding: max(8px, env(safe-area-inset-top)) 10px 8px; gap: 8px; background: rgba(8,10,14,.96); backdrop-filter: blur(18px); }
  .topbar-left { flex: 1 1 auto; min-width: 0; gap: 7px; overflow: hidden; }
  .topbar-screen-heading { min-width: 0; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
  .top-actions { flex: 0 0 auto; gap: 6px; }
  .top-actions .pill { min-height: 40px; padding: 8px 9px; }
  .mode { min-width: 0; }
  .mode button { min-height: 40px; padding: 8px 9px; }

  .content { width: 100%; padding: 10px 10px 24px; padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .card { border-radius: 17px; }
  .radar-card { padding: 10px; }
  .radar-head { margin-bottom: 10px; }
  .radar-head .status { margin-top: 3px; line-height: 1.35; }
  .intent-row { display: flex !important; flex-wrap: nowrap !important; justify-content: flex-start !important; gap: 7px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; scroll-snap-type: x proximity; padding: 2px 1px 5px; }
  .intent-row::-webkit-scrollbar { display: none; }
  .intent-row > * { flex: 0 0 auto; scroll-snap-align: start; }
  .intent { min-height: 44px; padding: 9px 11px; }

  .radar { aspect-ratio: 1/1; border-radius: 15px; }
  .radar-controls button { width: 42px; height: 42px; }
  .zoomlabel { left: 10px; bottom: 10px; }
  .radar-controls { right: 10px; bottom: 10px; }
  .nearby { margin-top: 12px; }
  .profiles { gap: 8px; }
  .profile-card { border-radius: 14px; }
  .sidecol { gap: 10px; margin-top: 10px; }
  .sidebox { padding: 14px; }
  .stats { gap: 6px; }
  .stat { padding: 10px 8px; }
  .stat b { font-size: 18px; }
  .location-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .location-actions > * { width: 100%; min-height: 44px; }

  .sidebar { padding-inline: 6px; }
  .sidebar .nav { grid-auto-columns: minmax(58px,1fr); gap: 3px; }
  .sidebar .nav button { min-width: 58px; min-height: 56px; padding: 6px 4px 5px; }
  .sidebar .nav .icon { font-size: 19px; }

  .discover-page, .tonight-page, .community-page, .profile-page, .settings-page { width: 100%; max-width: 100%; }
  .discover-hero, .tonight-hero { padding: 16px; gap: 12px; }
  .discover-hero h2, .tonight-hero h2 { font-size: 25px; }
  .discover-filter-grid { gap: 9px; }
  .discover-filter-grid input, .discover-filter-grid select, .discover-interest-toggle { font-size: 16px; }
  .discover-filter-actions { gap: 8px; }
  .discover-filter-actions button { min-height: 46px; flex: 1; }
  .discover-grid { gap: 9px; }

  .tonight-layout { grid-template-columns: 1fr !important; gap: 10px; }
  .tonight-panel { padding: 16px; }
  .tonight-actions button, #tonightRefreshBtn, #tonightStopBtn { min-height: 44px; }

  #screen-community .community-toolbar { border-radius: 17px; }
  #screen-community .community-toolbar-actions button,
  #screen-community .community-topic-trigger,
  #screen-community .community-filter-row select,
  #screen-community .community-filter-row input { min-height: 44px; }
  #screen-community .community-post { min-height: 0; border-radius: 17px; }
  #screen-community .community-post-footer { align-items: flex-start; flex-direction: column; }
  #screen-community .community-post-actions { width: 100%; margin-left: 0; }
  #screen-community .community-post-actions button { min-height: 42px; flex: 1; }
  .community-topic-sheet-panel { max-height: 86dvh; }

  .chat-thread { min-height: calc(100dvh - 160px); }
  .chat-thread-head { padding: 12px; }
  .chat-head-actions { width: 100%; overflow-x: auto; flex-wrap: nowrap !important; scrollbar-width: none; padding-bottom: 2px; }
  .chat-head-actions::-webkit-scrollbar { display: none; }
  .chat-head-actions button { flex: 0 0 auto; min-height: 40px; }
  .chat-messages { padding: 13px 10px; }
  .bubble { max-width: 88%; }
  .message-image { max-width: 100%; height: auto; }
  .chat-compose { position: sticky; bottom: 0; z-index: 4; padding: 9px 8px max(9px, env(safe-area-inset-bottom)); background: rgba(10,13,19,.96); backdrop-filter: blur(14px); }
  .chat-compose textarea { min-height: 46px; font-size: 16px; }
  .chat-compose button { min-height: 46px; padding-inline: 14px; }
  .chat-activity-panel.mobile-open { top: calc(72px + env(safe-area-inset-top)); bottom: calc(78px + env(safe-area-inset-bottom)); }

  .profile-editor, .profile-summary { padding: 15px; }
  .profile-field input, .profile-field textarea, .profile-field select { min-height: 44px; font-size: 16px; }
  .profile-field textarea { min-height: 104px; }
  .choice-chip { min-height: 40px; padding: 9px 11px; }
  .profile-save { min-height: 46px; width: 100%; }
  .profile-story-actions { top: calc(70px + env(safe-area-inset-top)); }

  .dialog-card button, .dialog-card input, .dialog-card select { min-height: 44px; }
  .dialog-card input, .dialog-card select, .dialog-card textarea { font-size: 16px; }
}

@media (max-width: 520px) {
  .topbar-screen-heading { display: none; }
  .mode button { font-size: 11px; padding-inline: 8px; }
  .content { padding-inline: 8px; }
  .profiles { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .stats { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .stat span { font-size: 10px; }
  .discover-filter-grid { grid-template-columns: 1fr !important; }
  .discover-filter-grid .discover-wide { grid-column: auto !important; }
  .discover-filter-actions { flex-direction: column; align-items: stretch; }
  .community-topic-sheet-grid { grid-template-columns: 1fr 1fr; }
  .chat-compose { gap: 6px; }
  .chat-compose button { padding-inline: 11px; }
}
