/* NearNow Web v167 — MOBILE_VISUAL_USABILITY_POLISH.
   Second mobile-only polish layer. Desktop >=861px remains untouched. */
@media (max-width: 860px) {
  :root {
    --nn-mobile-card-radius:18px;
    --nn-mobile-control:48px;
    --nn-mobile-gap:12px;
    --nn-mobile-topbar:112px;
  }

  /* Global top actions remain visible on every mobile app screen. */
  .topbar { flex-wrap:wrap!important; align-content:center!important; row-gap:6px!important; }
  .topbar-left { flex:1 1 100%!important; width:100%!important; }
  .top-actions { display:flex!important; flex:1 1 100%!important; width:100%!important; justify-content:flex-end!important; gap:6px!important; }
  .top-actions #premiumShopBtn { display:none!important; }
  .top-actions #recommendFriendsBtn,
  .top-actions #logoutBtn { display:inline-flex!important; align-items:center!important; justify-content:center!important; min-height:36px!important; padding:7px 10px!important; font-size:11px!important; }
  .top-actions #recommendFriendsBtn { max-width:min(68vw,250px); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

  /* Radar: people first, controls second. */
  #screen-radar .radar-grid { gap:12px!important; }
  #screen-radar .radar-card { display:grid!important; gap:10px!important; }
  #screen-radar .radar-head {
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:8px!important;
    margin:0!important;
  }
  #screen-radar .radar-head .status {
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:#98a5b8!important;
    font-size:11px!important;
  }
  #screen-radar .intent-row {
    grid-column:1/-1;
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:7px!important;
    margin:0 -2px!important;
    padding:1px 2px 3px!important;
    overflow-x:auto!important;
    overscroll-behavior-x:contain;
    scrollbar-width:none;
    scroll-snap-type:x proximity;
  }
  #screen-radar .intent-row::-webkit-scrollbar { display:none; }
  #screen-radar .intent {
    flex:0 0 auto;
    min-height:38px!important;
    padding:8px 11px!important;
    border-radius:999px!important;
    scroll-snap-align:start;
    font-size:11px!important;
    background:rgba(15,21,31,.84)!important;
  }
  #screen-radar .intent.on {
    background:rgba(47,111,237,.15)!important;
    box-shadow:inset 0 0 0 1px rgba(74,137,255,.12)!important;
  }
  .sensual-mode #screen-radar .intent.on {
    background:rgba(169,31,69,.18)!important;
    box-shadow:inset 0 0 0 1px rgba(225,63,119,.13)!important;
  }
  #screen-radar .radar {
    aspect-ratio:1/1!important;
    max-height:min(73dvh,620px)!important;
    border-radius:22px!important;
    background:radial-gradient(circle at center,rgba(47,111,237,.13),transparent 26%),linear-gradient(180deg,#09111b,#070a10)!important;
  }
  .sensual-mode #screen-radar .radar {
    background:radial-gradient(circle at center,rgba(169,31,69,.18),transparent 27%),linear-gradient(180deg,#13090e,#08070a)!important;
  }
  #screen-radar .radar-controls { right:10px!important; bottom:10px!important; gap:6px!important; }
  #screen-radar .radar-controls button {
    width:44px!important;
    height:44px!important;
    border-radius:14px!important;
    background:rgba(8,12,18,.82)!important;
    backdrop-filter:blur(10px);
  }
  #screen-radar .zoomlabel {
    left:10px!important;
    bottom:11px!important;
    padding:7px 9px!important;
    border-radius:999px!important;
    background:rgba(6,10,15,.72)!important;
    backdrop-filter:blur(8px);
  }
  #screen-radar .radar-person { width:78px!important; min-height:78px!important; }
  #screen-radar .radar-avatar-wrap {
    width:56px!important;
    height:56px!important;
    flex-basis:56px!important;
    border-width:2px!important;
    box-shadow:0 7px 22px rgba(0,0,0,.48),0 0 0 3px rgba(255,255,255,.018)!important;
  }
  #screen-radar .radar-distance {
    max-width:78px!important;
    margin-top:4px!important;
    padding:3px 6px!important;
    border-radius:999px!important;
    font-size:9px!important;
    background:rgba(4,8,13,.76)!important;
  }
  #screen-radar .nearby { margin-top:4px!important; }
  #screen-radar .section-title {
    min-height:38px;
    margin:0 2px 7px!important;
    align-items:center!important;
  }
  #screen-radar .section-title h3 { font-size:16px!important; letter-spacing:-.01em; }
  #screen-radar .nearby-head-actions { gap:8px!important; }
  #screen-radar .nearby-head-actions button {
    min-height:36px;
    padding:5px 7px!important;
    border-radius:10px!important;
  }
  #screen-radar .profiles {
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:10px!important;
  }
  #screen-radar .profiles .profile-card {
    width:auto!important;
    flex-basis:auto!important;
    aspect-ratio:3/4.45!important;
    border-radius:19px!important;
    border-color:rgba(112,133,168,.20)!important;
    box-shadow:0 12px 28px rgba(0,0,0,.18)!important;
  }
  #screen-radar .profile-card .fade {
    height:61%!important;
    background:linear-gradient(transparent,rgba(5,7,10,.24) 24%,rgba(5,7,10,.92) 76%,rgba(5,7,10,.99))!important;
  }
  #screen-radar .profile-card .meta { left:11px!important; right:9px!important; bottom:10px!important; }
  #screen-radar .profile-card .name { font-size:15px!important; line-height:1.2!important; }
  #screen-radar .profile-card .dist { margin-top:3px; font-size:10px!important; color:#d0d7e2!important; }
  #screen-radar .profile-card .intentline {
    display:block!important;
    width:max-content;
    max-width:100%;
    margin-top:6px!important;
    padding:4px 7px!important;
    border:1px solid rgba(99,137,202,.20);
    border-radius:999px;
    background:rgba(9,14,22,.58);
    color:#dbe8fb!important;
    font-size:9px!important;
  }
  .sensual-mode #screen-radar .profile-card .intentline {
    border-color:rgba(200,71,117,.25);
    color:#ffe0eb!important;
  }

  /* Profiles: stronger image hierarchy, calmer information cards, swipeable action rail. */
  #screen-profile.viewing-other-profile .viewed-profile-overview,
  #profileOverviewCard.profile-story-own { margin-inline:-2px!important; }
  .profile-story-shell { gap:11px!important; padding-bottom:8px!important; }
  .profile-story-hero,
  #profileOverviewCard.profile-story-own .own-profile-hero-frame {
    border-radius:22px!important;
    box-shadow:0 20px 50px rgba(0,0,0,.28)!important;
  }
  .profile-story-hero-thumbs,.own-profile-hero-strip {
    margin-inline:-2px!important;
    padding:0 2px 4px!important;
    gap:7px!important;
    scroll-snap-type:x proximity;
  }
  .profile-story-hero-thumb,.own-profile-hero-thumb,.profile-story-hero-more,.own-profile-hero-more {
    flex-basis:62px!important;
    height:54px!important;
    border-radius:11px!important;
    scroll-snap-align:start;
  }
  .profile-story-identity { gap:6px!important; padding:4px 3px 1px!important; }
  .profile-story-name-line h2,.profile-story-own-head h3 {
    font-size:27px!important;
    line-height:1.06!important;
    letter-spacing:-.025em!important;
  }
  .profile-story-meta { font-size:12px!important; line-height:1.4!important; }
  .profile-story-quick-tags,.own-profile-quick-tags {
    flex-wrap:nowrap!important;
    overflow-x:auto!important;
    margin-inline:-3px!important;
    padding:2px 3px 4px!important;
    scrollbar-width:none;
    overscroll-behavior-x:contain;
  }
  .profile-story-quick-tags::-webkit-scrollbar,.own-profile-quick-tags::-webkit-scrollbar { display:none; }
  .profile-story-chip { flex:0 0 auto; min-height:31px; display:inline-flex!important; align-items:center; }
  .profile-story-actions {
    position:sticky!important;
    top:calc(var(--nn-mobile-topbar) + 7px)!important;
    z-index:20!important;
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:7px!important;
    margin:0 -2px!important;
    padding:7px!important;
    overflow-x:auto!important;
    border:1px solid rgba(113,135,170,.18)!important;
    border-radius:16px!important;
    background:rgba(8,12,18,.91)!important;
    box-shadow:0 12px 32px rgba(0,0,0,.25)!important;
    backdrop-filter:blur(18px) saturate(1.12)!important;
    -webkit-backdrop-filter:blur(18px) saturate(1.12)!important;
    scrollbar-width:none;
    overscroll-behavior-x:contain;
    scroll-snap-type:x proximity;
  }
  .profile-story-actions::-webkit-scrollbar { display:none; }
  .profile-story-actions button {
    flex:0 0 auto!important;
    min-width:auto!important;
    min-height:44px!important;
    padding-inline:14px!important;
    scroll-snap-align:start;
    white-space:nowrap;
  }
  .profile-story-actions .primary-action { min-width:150px!important; }
  .profile-story-info-grid,.own-profile-story-grid { gap:9px!important; }
  .profile-story-card,.own-profile-story-grid .own-profile-section {
    padding:14px 14px!important;
    border-radius:17px!important;
    border-color:rgba(112,132,165,.17)!important;
    background:linear-gradient(180deg,rgba(15,21,31,.76),rgba(9,13,20,.88))!important;
    box-shadow:none!important;
  }
  .profile-story-card h4,.own-profile-story-grid .own-profile-section h4 {
    margin-bottom:7px!important;
    font-size:13px!important;
  }
  .profile-story-card .viewed-profile-copy,.profile-story-card .own-profile-copy {
    font-size:14px!important;
    line-height:1.62!important;
  }
  .viewed-profile-facts { gap:7px!important; }
  .viewed-profile-fact { min-height:58px; padding:10px 11px!important; border-radius:13px!important; }
  .profile-story-gallery { gap:7px!important; }
  .profile-story-gallery button { border-radius:13px!important; }
  .profile-story-safety-actions { gap:7px!important; padding:3px 0 14px!important; }
  .profile-story-safety-actions button { min-height:44px!important; }
  #profileOverviewCard.profile-story-own .profile-story-own-head {
    gap:10px!important;
    margin-bottom:10px!important;
  }
  #profileOverviewCard.profile-story-own .profile-story-own-actions {
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:7px!important;
    overflow-x:auto!important;
    padding-bottom:3px;
    scrollbar-width:none;
    scroll-snap-type:x proximity;
  }
  #profileOverviewCard.profile-story-own .profile-story-own-actions::-webkit-scrollbar { display:none; }
  #profileOverviewCard.profile-story-own .profile-story-own-actions .pill {
    flex:0 0 auto!important;
    width:auto!important;
    min-height:44px!important;
    padding:0 13px!important;
    font-size:11px!important;
    white-space:nowrap;
    scroll-snap-align:start;
  }

  /* Community: mobile feed first, controls compact and predictable. */
  #screen-community .community-page { gap:9px!important; }
  #screen-community .community-toolbar {
    padding:9px 10px!important;
    border-radius:17px!important;
    background:rgba(13,18,27,.78)!important;
    box-shadow:none!important;
  }
  .sensual-mode #screen-community .community-toolbar { background:rgba(22,12,18,.80)!important; }
  #screen-community .community-toolbar-actions {
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 44px!important;
    align-items:center!important;
    gap:8px!important;
  }
  #screen-community .community-compose-primary {
    grid-column:1!important;
    min-height:44px!important;
    width:100%!important;
    border-radius:13px!important;
    justify-content:center;
  }
  #screen-community .community-toolbar-control-stack {
    display:contents!important;
  }
  #screen-community #communityRefreshBtn {
    grid-column:2!important;
    grid-row:1!important;
    width:44px!important;
    min-width:44px!important;
    height:44px!important;
    padding:0!important;
    border-radius:13px!important;
    font-size:17px!important;
  }
  #screen-community .community-filter-row.community-filter-row-inline {
    grid-column:1/-1!important;
    grid-row:2!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    gap:7px!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
  }
  #screen-community .community-filter-row.community-filter-row-inline > * {
    min-width:0!important;
    min-height:42px!important;
    margin:0!important;
  }
  #screen-community .community-filter-row.community-filter-row-inline select {
    width:100%!important;
    min-height:42px!important;
    border-radius:12px!important;
  }
  #screen-community .community-filter-row.community-filter-row-inline label {
    justify-content:flex-start!important;
    min-height:42px!important;
    padding:8px 10px!important;
    border:1px solid rgba(106,127,161,.16)!important;
    border-radius:12px!important;
    background:rgba(9,13,20,.68)!important;
    line-height:1.25!important;
  }
  #screen-community #communityRadiusWrap { grid-column:1/-1!important; }
  #screen-community #communityRadiusWrap input { min-height:38px!important; }
  #screen-community .community-topic-mobile {
    position:sticky!important;
    top:calc(var(--nn-mobile-topbar) + 6px)!important;
    z-index:18!important;
    display:block!important;
  }
  #screen-community .community-topic-trigger {
    min-height:58px!important;
    padding:9px 11px!important;
    border-radius:15px!important;
    border-color:rgba(106,129,166,.20)!important;
    background:rgba(11,16,24,.94)!important;
    box-shadow:0 10px 25px rgba(0,0,0,.18)!important;
    backdrop-filter:blur(15px);
  }
  .sensual-mode #screen-community .community-topic-trigger { background:rgba(22,11,17,.95)!important; }
  #screen-community .community-feed { gap:10px!important; padding-right:0!important; }
  #screen-community .community-post {
    min-height:0!important;
    padding:15px 14px 13px!important;
    border-radius:18px!important;
    border-color:rgba(105,126,159,.16)!important;
    background:linear-gradient(160deg,rgba(15,21,31,.91),rgba(8,12,18,.95))!important;
    box-shadow:0 10px 28px rgba(0,0,0,.13)!important;
  }
  #screen-community .community-author .chat-avatar {
    width:40px!important;
    height:40px!important;
    border-radius:13px!important;
  }
  #screen-community .community-post h3 {
    margin:12px 0 6px!important;
    font-size:18px!important;
    line-height:1.3!important;
  }
  #screen-community .community-post-body {
    -webkit-line-clamp:5!important;
    font-size:13px!important;
    line-height:1.55!important;
    color:#d3dbe7!important;
  }
  #screen-community .community-post-images {
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:6px!important;
    margin-top:10px!important;
  }
  #screen-community .community-post-images .community-media-item:only-child { grid-column:1/-1; }
  #screen-community .community-post-images .community-media-item:only-child img { height:min(58vw,320px)!important; }
  #screen-community .community-post-images .community-media-item:first-child:nth-last-child(3) { grid-column:1/-1; }
  #screen-community .community-post-images img { height:150px!important; border-radius:12px!important; }
  #screen-community .community-post-footer {
    align-items:center!important;
    gap:8px!important;
    padding-top:11px!important;
  }
  #screen-community .community-post-actions button { min-height:38px!important; }
  .community-topic-sheet-panel { padding-top:10px!important; }
  .community-topic-sheet-grid { grid-template-columns:1fr!important; gap:8px!important; }
  .community-topic-sheet-grid .community-category-photo { min-height:86px!important; }

  /* Discover and profile forms: consistent native-size controls, no accidental mobile zoom. */
  #screen-discover .discover-hero {
    padding:16px!important;
    gap:10px!important;
    border-radius:18px!important;
  }
  #screen-discover .discover-hero h2 { font-size:26px!important; }
  #screen-discover .discover-hero .sub {
    display:-webkit-box;
    -webkit-line-clamp:3;
    -webkit-box-orient:vertical;
    overflow:hidden;
    line-height:1.45;
  }
  #screen-discover .discover-hero .primary { width:100%!important; min-height:44px!important; }
  #screen-discover .discover-filters { padding:13px!important; border-radius:18px!important; }
  #screen-discover .discover-filter-grid { gap:9px!important; }
  #screen-discover .discover-filter-grid label,
  #screen-discover .discover-interest-field { gap:5px!important; font-size:11px!important; }
  #screen-discover .discover-filter-grid input,
  #screen-discover .discover-filter-grid select,
  #screen-discover .discover-interest-toggle,
  #screen-discover .discover-preset-row select,
  .profile-field input,.profile-field select,.profile-field textarea,
  .dialog-body input,.dialog-body select,.dialog-body textarea {
    min-height:var(--nn-mobile-control)!important;
    border-radius:13px!important;
    font-size:16px!important;
    line-height:1.2!important;
    background:#0b1017!important;
  }
  .profile-field textarea,.dialog-body textarea { line-height:1.45!important; padding-top:12px!important; }
  #screen-discover .discover-interest-toggle { padding-inline:12px!important; }
  #screen-discover .discover-interest-panel {
    position:fixed!important;
    z-index:1700!important;
    left:0!important;
    right:0!important;
    top:auto!important;
    bottom:0!important;
    max-height:72dvh!important;
    padding:14px 14px max(18px,env(safe-area-inset-bottom))!important;
    border-left:0!important;
    border-right:0!important;
    border-bottom:0!important;
    border-radius:24px 24px 0 0!important;
    background:#0c1118!important;
    box-shadow:0 -24px 65px rgba(0,0,0,.58)!important;
  }
  #screen-discover .discover-interest-option {
    min-height:40px!important;
    padding:9px 11px!important;
    font-size:12px!important;
  }
  #screen-discover .discover-filter-actions,
  #screen-discover .discover-preset-row {
    gap:8px!important;
  }
  #screen-discover .discover-filter-actions button,
  #screen-discover .discover-preset-row button {
    min-height:46px!important;
    border-radius:13px!important;
  }
  #screen-discover .discover-card {
    border-radius:18px!important;
    border-color:rgba(106,128,163,.17)!important;
    box-shadow:0 10px 28px rgba(0,0,0,.14)!important;
  }
  #screen-discover .discover-card-body { left:11px!important; right:11px!important; bottom:11px!important; }
  #screen-discover .discover-card-name { font-size:17px!important; }
  #screen-discover .discover-card-copy { -webkit-line-clamp:1!important; margin-top:5px!important; }
  #screen-discover .discover-card-tags { flex-wrap:nowrap!important; overflow:hidden!important; }

  .profile-editor { padding:15px!important; border-radius:18px!important; }
  .profile-form { gap:16px!important; margin-top:16px!important; }
  .profile-form-section { padding-top:15px!important; }
  .profile-fields,.profile-age-grid { gap:10px!important; }
  .profile-field label { margin-bottom:5px!important; font-size:11px!important; }
  .choice-chip {
    min-height:40px!important;
    display:inline-flex!important;
    align-items:center!important;
    padding:8px 12px!important;
    font-size:12px!important;
  }
  .profile-switch {
    min-height:44px!important;
    padding:8px 2px!important;
    line-height:1.35!important;
  }
  .profile-switch input { width:20px!important; height:20px!important; flex:0 0 20px; }
  .profile-actions { align-items:stretch!important; gap:8px!important; }
  .profile-save { width:100%!important; min-height:48px!important; border-radius:13px!important; }

  /* Loading/feedback: stable geometry with restrained motion. */
  .nn-skeleton { border-color:rgba(255,255,255,.035)!important; background:#101721!important; }
  .nn-skeleton::after {
    background:linear-gradient(90deg,transparent,rgba(133,167,219,.07),transparent)!important;
    animation-duration:1.55s!important;
  }
  .sensual-mode .nn-skeleton::after {
    background:linear-gradient(90deg,transparent,rgba(225,90,137,.065),transparent)!important;
  }
  .nn-empty-state {
    min-height:124px;
    padding:24px 18px!important;
    border-radius:18px!important;
    border-color:rgba(111,134,170,.18)!important;
    background:linear-gradient(180deg,rgba(14,20,30,.60),rgba(8,12,18,.52))!important;
  }
  .screen.active { animation:nnMobileScreenIn 1s ease-out both; }
  .profile-card,.discover-card,.community-post,.chat-contact,.profile-story-card {
    transition:transform .15s ease,border-color .15s ease,background-color .15s ease!important;
  }
  .profile-card:active,.discover-card:active,.community-post:active,.chat-contact:active { transform:scale(.985)!important; }
  button:active { transition-duration:.06s!important; }

  @keyframes nnMobileScreenIn {
    from { opacity:.72; transform:translateY(4px); }
    to { opacity:1; transform:translateY(0); }
  }
}

@media (max-width: 520px) {
  #screen-radar .radar { border-radius:20px!important; }
  #screen-radar .profiles { gap:8px!important; }
  #screen-radar .profiles .profile-card { border-radius:17px!important; }
  .profile-story-name-line h2,.profile-story-own-head h3 { font-size:25px!important; }
  #screen-community .community-filter-row.community-filter-row-inline { grid-template-columns:1fr!important; }
  #screen-community #communityRadiusWrap { grid-column:auto!important; }
  #screen-community .community-post-images img { height:132px!important; }
  #screen-discover .discover-filter-grid { grid-template-columns:repeat(2,minmax(0,1fr))!important; }
  #screen-discover .discover-filter-grid .discover-wide { grid-column:1/-1!important; }
  #screen-discover .discover-filter-grid label:nth-child(1) { grid-column:1/-1!important; }
  #screen-discover .discover-interest-field { grid-column:1/-1!important; }
}

@media (prefers-reduced-motion: reduce) and (max-width: 860px) {
  .screen.active { animation:none!important; }
  .profile-card,.discover-card,.community-post,.chat-contact,.profile-story-card,button { transition:none!important; }
}
