/* Patiyiz - 01 Nov 2026. Mobile profile icon tabs, accessible post
   actions, single tools entry point and readable Reels counters.
   Loaded AFTER the previous mobile patches, without changing behavior. */

/* A single features/tools menu lives on the user's profile. */
#pati-right-menu-handle,
#app-root>.mobile-header>#pati-header-menu{
  display:none!important;
}

@media(max-width:740px){
  /* Two right actions: balance and notifications. Logo/chooser is independent. */
  html[data-pati-view="home"] #app-root:not(.hidden)>.mobile-header{
    display:grid!important;
    grid-template-columns:44px minmax(0,1fr) auto!important;
    grid-template-rows:minmax(48px,auto)!important;
    align-items:center!important;
    gap:5px!important;box-sizing:border-box!important;
    width:100%!important;min-height:58px!important;
    padding:5px max(9px,env(safe-area-inset-right,0px))
            5px max(9px,env(safe-area-inset-left,0px))!important;
  }
  html[data-pati-view="home"] #app-root:not(.hidden)>.mobile-header>#pati-feed-menu-trigger.brand{
    grid-column:2!important;grid-row:1!important;
    position:relative!important;left:auto!important;top:auto!important;
    right:auto!important;bottom:auto!important;
    transform:none!important;min-width:0!important;width:100%!important;
    max-width:100%!important;min-height:44px!important;
    justify-content:flex-start!important;overflow:hidden!important;
    z-index:7!important;
  }
  html[data-pati-view="home"] #app-root:not(.hidden)>.mobile-header>.pati-header-actions{
    grid-column:3!important;grid-row:1!important;
    position:relative!important;display:flex!important;
    flex-direction:row!important;align-items:center!important;
    justify-content:flex-end!important;
    flex:0 0 auto!important;gap:5px!important;
    width:auto!important;max-width:none!important;
    padding:0!important;margin:0!important;
    z-index:8!important;
  }
  html[data-pati-view="home"] #app-root:not(.hidden)>.mobile-header>.pati-header-actions>#pati-header-coins{
    box-sizing:border-box!important;position:relative!important;
    flex:0 0 auto!important;
    width:auto!important;max-width:89px!important;min-width:46px!important;
    min-height:44px!important;height:44px!important;
    border:1px solid #e4e6eb!important;background:#f5f6f8!important;
    border-radius:13px!important;
    display:flex!important;flex-direction:column!important;
    justify-content:center!important;align-items:center!important;
    gap:0!important;padding:3px 6px!important;
    box-shadow:none!important;
    color:#1a1c20!important;
  }
  html[data-pati-view="home"] #app-root>.mobile-header>.pati-header-actions>#pati-header-coins .pati-balance-title{
    display:block!important;position:static!important;
    width:auto!important;max-width:100%!important;min-width:0!important;
    padding:0!important;margin:0!important;
    color:#6a6f77!important;-webkit-text-fill-color:#6a6f77!important;
    font-size:9px!important;font-weight:700!important;line-height:1.2!important;
    white-space:nowrap!important;text-align:center!important;
  }
  html[data-pati-view="home"] #app-root>.mobile-header>.pati-header-actions>#pati-header-coins strong{
    display:block!important;color:#1a1c20!important;
    -webkit-text-fill-color:#1a1c20!important;
    max-width:100%!important;min-width:0!important;
    font-size:13px!important;line-height:1.3!important;
    font-weight:800!important;white-space:nowrap!important;
  }
  html[data-pati-view="home"] #app-root:not(.hidden)>.mobile-header>#pati-header-share,
  html[data-pati-view="home"] #app-root:not(.hidden)>.mobile-header>#pati-header-notifications{
    display:grid!important;place-items:center!important;
    min-width:44px!important;width:44px!important;height:44px!important;
    min-height:44px!important;max-height:44px!important;
    padding:7px!important;box-sizing:border-box!important;
  }
  html[data-pati-view="home"] #app-root:not(.hidden)>.mobile-header>#pati-header-share{
    grid-column:1!important;grid-row:1!important;justify-self:start!important;
    position:relative!important;transform:none!important;inset:auto!important;
  }
  html[data-pati-view="home"] #app-root:not(.hidden)>.mobile-header>#pati-feed-menu{
    z-index:1900!important;
  }

  /* Restore the original five-icon profile organization, now consistent
     squares, stronger icon strokes and an unambiguous active indicator. */
  #main-content .pati-ig-profile .pati-ig-tabs[role="tablist"]{
    box-sizing:border-box!important;
    display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;
    flex-direction:unset!important;align-items:stretch!important;
    justify-content:stretch!important;
    gap:2px!important;width:100%!important;max-width:100%!important;
    min-width:0!important;min-height:65px!important;
    margin:9px 0 0!important;padding:0 5px!important;
    overflow:visible!important;
    scroll-snap-type:none!important;
    background:#fff!important;
    border-top:1px solid #edf0f3!important;
    border-bottom:1px solid #e4e7ea!important;
  }
  #main-content .pati-ig-profile .pati-ig-tabs[role="tablist"]>button[role="tab"]{
    box-sizing:border-box!important;
    display:flex!important;flex-direction:column!important;
    align-items:center!important;justify-content:center!important;
    flex:1 1 auto!important;
    width:100%!important;min-width:0!important;max-width:100%!important;
    height:64px!important;min-height:64px!important;max-height:64px!important;
    margin:0!important;padding:8px 2px 6px!important;
    color:#777b83!important;-webkit-text-fill-color:#777b83!important;
    background:#fff!important;
    border:0!important;border-bottom:3px solid transparent!important;
    border-radius:9px 9px 0 0!important;
    box-shadow:none!important;scroll-snap-align:none!important;
    -webkit-tap-highlight-color:transparent!important;
  }
  #main-content .pati-ig-profile .pati-ig-tabs[role="tablist"]>button[role="tab"].active,
  #main-content .pati-ig-profile .pati-ig-tabs[role="tablist"]>button[role="tab"][aria-selected="true"]{
    color:#181a1f!important;-webkit-text-fill-color:#181a1f!important;
    background:#f1f3f6!important;
    border-color:#181a1f!important;
  }
  #main-content .pati-ig-profile .pati-ig-tabs[role="tablist"]>button[role="tab"] .pati-profile-tab-icon{
    display:block!important;position:static!important;
    width:29px!important;height:29px!important;
    min-width:29px!important;max-width:29px!important;
    flex:0 0 29px!important;opacity:1!important;
    stroke:currentColor!important;stroke-width:2.4px!important;
    stroke-linecap:round!important;stroke-linejoin:round!important;
    filter:none!important;
  }
  #main-content .pati-ig-profile .pati-ig-tabs[role="tablist"]>button[role="tab"] .pati-profile-grid-icon{
    fill:currentColor!important;stroke:none!important;
  }
  #main-content .pati-ig-profile .pati-ig-tabs[role="tablist"]>button[role="tab"] .pati-profile-tab-label,
  #main-content .pati-ig-profile .pati-ig-tabs[role="tablist"]>button[role="tab"]::before,
  #main-content .pati-ig-profile .pati-ig-tabs[role="tablist"]>button[role="tab"]::after{
    display:none!important;content:none!important;
  }
  #main-content .pati-ig-profile .pati-ig-tabs[role="tablist"]>button[role="tab"]:focus-visible{
    outline:2px solid #17191e!important;outline-offset:-4px!important;
  }

  /* Slightly larger statistics card; not a giant extra section. */
  #main-content .pati-ig-profile .pati-profile-insights-preview{
    box-sizing:border-box!important;
    display:grid!important;grid-template-columns:minmax(0,1fr) auto auto!important;
    align-items:center!important;gap:11px!important;
    width:calc(100% - 24px)!important;max-width:none!important;
    min-height:99px!important;height:auto!important;
    margin:10px 12px 8px!important;padding:16px 17px!important;
    background:#fff!important;color:#202227!important;
    border:1px solid #e2e5e9!important;border-radius:17px!important;
    box-shadow:0 2px 7px rgba(23,26,31,.04)!important;
    text-align:left!important;
  }
  #main-content .pati-ig-profile .pati-profile-insights-preview>span:first-child{
    display:flex!important;flex-direction:column!important;
    align-items:flex-start!important;justify-content:center!important;
    gap:4px!important;min-width:0!important;
  }
  #main-content .pati-ig-profile .pati-profile-insights-preview strong{
    color:#202227!important;font-size:19px!important;
    font-weight:800!important;line-height:1.2!important;
  }
  #main-content .pati-ig-profile .pati-profile-insights-preview small{
    color:#6d737b!important;font-size:12px!important;line-height:1.3!important;
  }
  #main-content .pati-ig-profile .pati-profile-insights-preview .pati-profile-insights-value{
    color:#1e2126!important;font-weight:800!important;
    font-size:25px!important;line-height:1.1!important;
    font-variant-numeric:tabular-nums!important;
  }
  #main-content .pati-ig-profile .pati-profile-insights-preview .pati-profile-insights-arrow{
    color:#1e2126!important;font-size:26px!important;
    font-weight:750!important;line-height:1!important;
  }

  /* Larger, bolder post controls for both the home feed and post detail.
     Save occupies the far right, others are naturally left aligned. */
  #main-content .pati-feed-card .pati-actionbar.pati-social-actions{
    box-sizing:border-box!important;
    display:flex!important;flex-flow:row nowrap!important;
    align-items:center!important;justify-content:flex-start!important;
    gap:clamp(2px,1.2vw,7px)!important;
    width:100%!important;min-height:59px!important;
    padding:5px 11px!important;margin:0!important;
    overflow:visible!important;
  }
  #main-content .pati-feed-card .pati-actionbar.pati-social-actions>button{
    box-sizing:border-box!important;position:relative!important;
    display:inline-flex!important;flex:0 0 auto!important;
    justify-content:center!important;align-items:center!important;
    min-width:45px!important;width:auto!important;
    min-height:48px!important;height:48px!important;
    margin:0!important;padding:7px 5px!important;
    gap:4px!important;border-radius:11px!important;
  }
  #main-content .pati-feed-card .pati-actionbar.pati-social-actions>button[data-action="save"]{
    margin-left:auto!important;margin-right:0!important;
    justify-content:center!important;
  }
  #main-content .pati-feed-card .pati-actionbar.pati-social-actions>button :is(svg,svg.icon){
    display:block!important;flex:0 0 auto!important;
    width:clamp(24px,6.7vw,29px)!important;height:clamp(24px,6.7vw,29px)!important;
    stroke-width:2.45!important;
    stroke-linejoin:round!important;stroke-linecap:round!important;
  }
  #main-content .pati-feed-card .pati-actionbar.pati-social-actions>button :is(span,.pati-engagement-metric){
    font-size:12px!important;font-weight:720!important;line-height:1.1!important;
  }
  #main-content .pati-feed-card .pati-post-details{
    padding:2px 13px 12px!important;margin:0!important;
  }
}
@media(max-width:365px){
  #main-content .pati-feed-card .pati-actionbar.pati-social-actions{
    gap:0!important;padding-inline:6px!important;
  }
  #main-content .pati-feed-card .pati-actionbar.pati-social-actions>button{
    min-width:40px!important;padding-inline:2px!important;
  }
  #main-content .pati-feed-card .pati-actionbar.pati-social-actions>button :is(svg,svg.icon){
    width:24px!important;height:24px!important;
  }
  html[data-pati-view="home"] #app-root:not(.hidden)>.mobile-header>.pati-header-actions{
    gap:2px!important;
  }
  html[data-pati-view="home"] #app-root:not(.hidden)>.mobile-header>.pati-header-actions>#pati-header-coins{
    max-width:72px!important;min-width:43px!important;
  }
}

/* Reels action counters: white even on active green repost indicator.
   Do not alter the existing active/liked UI color semantics. */
html[data-pati-view="reels"] #main-content .pati-reel-item
  .pati-reel-rail>button[data-action="pati-repost"] :is(.pati-engagement-metric,.pati-reel-count),
html[data-pati-view="reels"] #main-content .pati-reel-item
  .pati-reel-rail>button[data-action="pati-repost"] :is(span,.pati-reel-action-label){
  color:#fff!important;-webkit-text-fill-color:#fff!important;
  opacity:1!important;text-shadow:0 1px 3px #000b!important;
}
@media(max-width:740px){
  html[data-pati-view="reels"] #main-content .pati-reel-rail>button.pati-reel-action{
    min-width:47px!important;width:47px!important;max-width:47px!important;
    min-height:48px!important;height:48px!important;max-height:48px!important;
    gap:2px!important;
  }
  html[data-pati-view="reels"] #main-content .pati-reel-rail>button.pati-reel-action svg{
    width:24px!important;height:24px!important;stroke-width:2.5!important;
  }
  html[data-pati-view="reels"] #main-content .pati-reel-rail>button .pati-reel-count,
  html[data-pati-view="reels"] #main-content .pati-reel-rail>button .pati-engagement-metric{
    color:#fff!important;-webkit-text-fill-color:#fff!important;
    font-weight:800!important;font-size:11px!important;line-height:1.05!important;
  }
}

/* Bottom tabs also use stronger, slightly larger strokes, with safe phone
   hit targets. Keep the familiar labels and the existing five destinations. */
@media(max-width:740px){
  #app-root:not(.hidden)>.mobile-bottom{
    box-sizing:border-box!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;
    align-items:stretch!important;
    min-height:70px!important;
    padding:6px 4px max(8px,env(safe-area-inset-bottom,0px))!important;
  }
  #app-root:not(.hidden)>.mobile-bottom>.mobile-nav-btn{
    box-sizing:border-box!important;min-width:0!important;max-width:none!important;
    min-height:56px!important;padding:5px 2px!important;
    gap:4px!important;border-radius:12px!important;
  }
  #app-root:not(.hidden)>.mobile-bottom>.mobile-nav-btn .pati-mobile-nav-glyph{
    display:grid!important;place-items:center!important;
    flex:0 0 30px!important;width:32px!important;height:30px!important;
  }
  #app-root:not(.hidden)>.mobile-bottom>.mobile-nav-btn .pati-mobile-nav-glyph>.icon{
    width:27px!important;height:27px!important;
    stroke-width:2.35!important;stroke-linecap:round!important;
    stroke-linejoin:round!important;
  }
  #app-root:not(.hidden)>.mobile-bottom>.mobile-nav-btn>small{
    font-size:10.5px!important;line-height:1.1!important;font-weight:730!important;
  }
}

/* 2026-11-01: profile detail adjustments and the two Reels icon swap.
   Applies after the existing mobile layout rules, with no duplicate screens. */
@media(max-width:740px){
  /* Make each icon explain its category even on a small phone.
     Retain the original 5-column grid and its 5 working tab actions. */
  #main-content .pati-ig-profile .pati-ig-tabs[role="tablist"]{
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    min-height:75px!important;
    padding:0 4px!important;
    align-items:stretch!important;
  }
  #main-content .pati-ig-profile .pati-ig-tabs[role="tablist"]>button[role="tab"]{
    box-sizing:border-box!important;
    display:flex!important;
    flex-flow:column nowrap!important;
    align-items:center!important;justify-content:center!important;
    gap:5px!important;
    height:74px!important;min-height:74px!important;max-height:74px!important;
    min-width:0!important;width:100%!important;
    padding:6px 2px 5px!important;
    overflow:hidden!important;
    -webkit-tap-highlight-color:transparent!important;
  }
  #main-content .pati-ig-profile .pati-ig-tabs[role="tablist"]>button[role="tab"] :is(.pati-profile-tab-icon,svg.icon){
    box-sizing:border-box!important;
    display:block!important;flex:0 0 27px!important;
    width:27px!important;min-width:27px!important;max-width:27px!important;
    height:27px!important;min-height:27px!important;max-height:27px!important;
    fill:none;
    stroke:currentColor!important;stroke-width:2.35px!important;
    stroke-linejoin:round!important;stroke-linecap:round!important;
    opacity:1!important;
  }
  #main-content .pati-ig-profile .pati-ig-tabs[role="tablist"]>button[role="tab"] .pati-profile-grid-icon{
    stroke:none!important;fill:currentColor!important;
  }
  #main-content .pati-ig-profile .pati-ig-tabs[role="tablist"] .pati-profile-tab-caption{
    display:block!important;position:static!important;
    padding:0!important;margin:0!important;
    flex:0 0 auto!important;
    max-width:100%!important;min-width:0!important;
    color:inherit!important;-webkit-text-fill-color:currentColor!important;
    font-size:clamp(9px,2.65vw,11px)!important;line-height:1.15!important;
    font-weight:750!important;letter-spacing:-.01em!important;
    white-space:normal!important;text-align:center!important;
    overflow-wrap:normal!important;overflow:hidden!important;
    display:-webkit-box!important;-webkit-box-orient:vertical!important;
    -webkit-line-clamp:2!important;line-clamp:2!important;
  }

  /* Main stats: larger labels; numbers and ordering stay unchanged. */
  #main-content .pati-ig-profile .pati-ig-stats :is(span,button){
    min-width:0!important;text-align:center!important;
    align-items:center!important;
  }
  #main-content .pati-ig-profile .pati-ig-stats :is(span,button)>small{
    display:block!important;
    font-size:clamp(12px,3.55vw,14px)!important;
    font-weight:720!important;line-height:1.19!important;
    letter-spacing:-.012em!important;
    white-space:normal!important;
    overflow-wrap:normal!important;
    color:#4d535c!important;
    opacity:1!important;
  }

  /* Return the statistics card to a compact, but still legible size. */
  #main-content .pati-ig-profile .pati-profile-insights-preview{
    box-sizing:border-box!important;
    width:calc(100% - 24px)!important;
    height:auto!important;min-height:83px!important;max-height:none!important;
    margin:7px 12px 6px!important;padding:11px 14px!important;
    gap:8px!important;border-radius:15px!important;
  }
  #main-content .pati-ig-profile .pati-profile-insights-preview>span:first-child{
    gap:2px!important;
  }
  #main-content .pati-ig-profile .pati-profile-insights-preview strong{
    font-size:17px!important;line-height:1.2!important;
  }
  #main-content .pati-ig-profile .pati-profile-insights-preview small{
    font-size:11px!important;line-height:1.22!important;
  }
  #main-content .pati-ig-profile .pati-profile-insights-preview .pati-profile-insights-value{
    font-size:22px!important;
  }
  #main-content .pati-ig-profile .pati-profile-insights-preview .pati-profile-insights-arrow{
    font-size:23px!important;
  }

  /* The own profile has one black full-width Edit button, with no balance
     card. Visitors retain their existing Follow / Message action layout. */
  #main-content .pati-ig-profile .pati-ig-actions.pati-own-profile-actions{
    box-sizing:border-box!important;
    display:grid!important;grid-template-columns:minmax(0,1fr)!important;
    align-items:stretch!important;
    width:100%!important;min-width:0!important;max-width:100%!important;
    gap:0!important;
    margin:0!important;padding:9px 12px 12px!important;
  }
  #main-content .pati-ig-profile .pati-ig-actions.pati-own-profile-actions>button[data-action="edit-profile"]{
    box-sizing:border-box!important;grid-column:1/-1!important;
    display:flex!important;align-items:center!important;justify-content:center!important;
    width:100%!important;min-width:0!important;max-width:100%!important;
    height:62px!important;min-height:62px!important;max-height:62px!important;
    margin:0!important;padding:10px 15px!important;
    background:#202126!important;color:#fff!important;
    -webkit-text-fill-color:#fff!important;
    border:1px solid #202126!important;
    border-radius:15px!important;box-shadow:none!important;
    font-size:16px!important;font-weight:820!important;line-height:1.2!important;
  }
  #main-content .pati-ig-profile .pati-own-profile-actions .pati-profile-coin-balance,
  #main-content .pati-ig-profile .pati-own-profile-actions #pati-profile-balance{
    display:none!important;
  }

  /* Swap completed in app.js: bottom Reels is the vertical-play device. */
  #app-root:not(.hidden)>.mobile-bottom .pati-mobile-reels-icon{
    width:27px!important;height:27px!important;min-width:27px!important;
    stroke:currentColor!important;stroke-width:2.5px!important;
    fill:none!important;opacity:1!important;
  }
}
@media(max-width:350px){
  #main-content .pati-ig-profile .pati-ig-stats :is(span,button)>small{
    font-size:12px!important;
  }
  #main-content .pati-ig-profile .pati-ig-tabs .pati-profile-tab-caption{
    font-size:9px!important;letter-spacing:-.025em!important;
  }
}
