/* ViraWise mobile usability layer.
   Loaded last so older light/dark and community themes remain intact. */
@media (max-width: 760px) {
  #search-view,
  #results-view,
  #search-view > *,
  #results-view > *,
  #results-view > div.max-w-7xl > *,
  #results-view .glass-card {
    min-width: 0;
  }

  /* Results actions are a horizontal, swipeable tool rail, not three rows
     of tiny two-column buttons. */
  #results-view .v2-result-toolbar {
    display: block;
    margin: 15px auto 0;
    padding: 0 0 3px;
    max-width: 100%;
    min-width: 0;
  }
  #results-view .v2-result-toolbar > div:first-child {
    padding: 0 15px;
    margin-bottom: 10px;
  }
  #results-view .v2-result-toolbar h2 { font-size: clamp(19px, 5.3vw, 25px); }
  #results-view .v2-tool-list {
    display: flex !important;
    grid-template-columns: none !important;
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 15px 10px;
    scroll-padding-inline: 15px;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #results-view .v2-tool-list::-webkit-scrollbar { display: none; }
  #results-view .v2-tool-btn {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 10px 14px;
    white-space: nowrap;
    scroll-snap-align: start;
    font-size: 12px;
    transform: none;
  }

  /* More generous maps and readable long place names on phones. */
  #results-view #map { height: clamp(240px, 70vw, 330px) !important; }
  #results-view #walking-map { height: clamp(250px, 75vw, 360px) !important; }
  #results-view #timeline-box,
  #results-view #res-dest,
  #results-view .v7-map-message,
  #results-view .glass-card :is(p,h2,h3,h4) {
    overflow-wrap: anywhere;
  }
  #results-view .glass-card {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Native touch-sized targets; use 16px for iOS input focus (no auto zoom). */
  :is(#search-view,#results-view,#profile-modal,#auth-card,#v9-social-overlay)
    :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea),
  :is(.v10-dialog,.v20-dialog) :is(input,select,textarea) {
    font-size: 16px !important;
    max-width: 100%;
  }
  :is(#search-view,#results-view,#profile-modal,#auth-card,#v9-social-overlay)
    :is(button,select,a.v2-tool-btn),
  .v20-mobile-quick button,
  .v20-search-tabs button {
    min-height: 44px;
  }
  :is(#search-view,#results-view,#v9-social-overlay,#profile-modal)
    :is(button,a,input,select,textarea):focus-visible {
    outline: 3px solid #12b89e;
    outline-offset: 2px;
  }

  /* Dialogs stay usable when the software keyboard is open. */
  #auth-card > .glass-card,
  #saved-trips-content,
  #my-comments-modal > .glass-card,
  #feedback-content,
  #profile-modal .v4-profile-panel {
    max-height: calc(100dvh - 24px) !important;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  #auth-card, #saved-trips-modal, #my-comments-modal, #feedback-modal {
    padding-block: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-bottom));
  }

  /* The community's bottom bar must clear the phone's home indicator. */
  #v9-social-overlay .v10-social-shell {
    grid-template-rows: 64px auto minmax(0,1fr) calc(65px + env(safe-area-inset-bottom));
    min-height: 0;
  }
  #v9-social-overlay .v10-social-shell > .v9-social-tabs {
    padding-bottom: env(safe-area-inset-bottom) !important;
    overscroll-behavior-x: contain;
  }
  #v9-social-overlay .v10-social-shell > .v9-social-tabs button {
    min-height: 44px;
    min-width: 0;
  }
  #v9-social-overlay .v10-social-shell > .v9-social-page {
    min-height: 0;
    overscroll-behavior-y: contain;
  }

  /* Reduce expensive glass blur effects while scrolling on mobile GPUs. */
  :where(#search-view,#results-view) .glass-card {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

@media (max-width: 600px) {
  #search-view {
    padding-top: 139px !important;
    padding-inline: max(13px, env(safe-area-inset-left)) max(13px, env(safe-area-inset-right)) !important;
    gap: 0;
  }
  #search-view > nav {
    padding: max(10px, env(safe-area-inset-top)) 12px 0 !important;
  }
  #search-view > nav > .max-w-7xl {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 7px;
    min-width: 0;
    padding-bottom: 8px;
  }
  #search-view .v6-main-links { display: none !important; }
  #search-view #brand-logo {
    flex: 0 0 auto;
    font-size: clamp(17px, 5.1vw, 22px) !important;
    white-space: nowrap;
  }
  #search-view .v10-main-controls {
    flex: 0 1 auto;
    min-width: 0;
    gap: 5px !important;
    margin-left: auto;
  }
  #search-view .v9-theme-button {
    min-width: 42px;
    width: 42px;
    min-height: 44px !important;
    height: 44px;
  }
  #search-view .v10-main-controls > .glass-card {
    max-width: 65px;
    min-width: 50px;
    height: 44px;
  }
  #search-view #global-nav-actions { min-width: 0; }
  #search-view #global-nav-actions button {
    min-height: 44px;
    max-width: 96px;
    padding: 7px 9px !important;
    font-size: 11px !important;
    margin: 0;
  }
  #search-view #global-nav-actions button > span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  #search-view .v20-mobile-quick {
    display: flex;
    gap: 8px;
    min-height: 52px;
    padding: 6px 12px 9px;
  }
  #search-view .v20-mobile-quick button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    font-size: 12px;
  }
  #search-view .v2-hero-content { margin-top: 6px !important; }
  #search-view .v2-hero-content > h1 { margin-bottom: 12px !important; }
  #search-view .v2-lead { margin-bottom: 14px !important; }
  #search-view #route-form,
  #search-view .v20-budget-form { max-width: 100%; }
  #search-view #route-form > .flex.gap-3 { width: 100%; }

  /* Route settings start compact but stay one tap away. */
  #search-view .v9-preferences {
    margin-block: 13px 18px !important;
    padding: 14px !important;
    gap: 10px !important;
  }
  #search-view .vira-mobile-prefs-toggle {
    display: block;
    grid-column: 1 / -1;
    width: 100%;
    min-height: 44px;
    margin-top: 2px;
    border: 1px solid var(--page-line, #c5dedb);
    background: var(--page-soft, #e9f7f5);
    color: var(--page-ink, #163a47);
    border-radius: 11px;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    cursor: pointer;
  }
  #search-view .v9-preferences.vira-mobile-prefs-collapsed > label {
    display: none !important;
  }
  #search-view .v9-preferences > div { min-width: 0; }
  #search-view .v9-preferences > div small { margin-bottom: 0; }

  /* Header: brand/actions, then one horizontally scrollable currency row. */
  #results-view > nav > .max-w-7xl {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) minmax(76px,85px);
    gap: 7px 10px !important;
    align-items: center;
    padding: 8px 12px 10px !important;
  }
  #results-view > nav > .max-w-7xl > :first-child {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    gap: 10px;
  }
  #results-nav-actions-mobile {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 7px;
  }
  #results-nav-actions-mobile button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 44px;
    max-width: 136px;
    padding: 8px 10px !important;
    margin: 0 !important;
    border-radius: 999px;
    white-space: nowrap;
  }
  #results-nav-actions-mobile button > span {
    font-size: 11px !important;
    max-width: 80px !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #results-view > nav > .max-w-7xl > #currency-bar {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    margin: 0;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
  }
  #results-view #currency-bar .cur-tab {
    flex: 0 0 auto;
    min-height: 40px;
    scroll-snap-align: start;
    padding-inline: 13px !important;
    font-size: 11px !important;
  }
  #results-view > nav > .max-w-7xl > :last-child {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    min-width: 0;
  }
  #results-view > nav > .max-w-7xl > :last-child > .glass-card {
    min-height: 44px;
    height: 44px;
    min-width: 0;
    width: 100%;
    flex: 1 1 auto;
  }
  #results-view #results-nav-actions { display: none !important; }
  #results-view > div.max-w-7xl { gap: 14px !important; }
}

@media (max-width: 375px) {
  #search-view #brand-logo::before { display: none !important; }
  #search-view #global-nav-actions button:has(> div) > span { display: none !important; }
  #search-view .v20-mobile-quick button { padding-inline: 4px; }
  #results-view #results-nav-actions-mobile button > span { max-width: 64px !important; }
  #results-view .v2-tool-list { padding-inline: 12px; }
}

@media (min-width: 601px) {
  .vira-mobile-prefs-toggle { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  #results-view .v2-tool-list,
  #results-view #currency-bar { scroll-behavior: auto; }
}

/* Mobile full-screen social mode. The visual viewport shrinks when a
   software keyboard opens; the main page must never peek through it. */
#v10-community-profile .v10-profile-cover>span:last-child{font-size:inherit}
#v10-community-profile .v10-profile-cover{letter-spacing:.06em}
#v10-community-profile .v28-profile-loading{
  min-height:56px;display:flex;align-items:center;justify-content:center;
  background:var(--community-paper);color:var(--community-muted);font-size:13px;
  border:1px solid var(--community-line);border-radius:12px;padding:15px;
}
#v10-community-profile .v28-profile-shortcuts{
  display:flex;flex-wrap:wrap;gap:9px;margin:16px 0 20px;padding:0 2px;
}
#v10-community-profile .v28-profile-shortcut{
  min-height:42px;display:inline-flex;align-items:center;justify-content:center;
  padding:10px 15px;background:var(--community-paper);color:var(--community-ink);
  border:1px solid var(--community-line);border-radius:999px;font-size:12px;font-weight:780;
}
#v10-community-profile .v28-profile-shortcut:hover,
#v10-community-profile .v28-profile-shortcut:focus-visible{
  border-color:var(--community-accent);color:var(--community-accent);background:var(--community-soft);
}
#v10-community-profile .v28-following-head{margin:10px 0}
#v10-community-profile .v28-following-entries{display:grid;gap:6px}
#v10-community-profile .v28-following-entries[hidden]{display:none}
#v10-community-profile .v28-passport-host{min-height:56px;content-visibility:auto;contain-intrinsic-size:auto 120px}
#v10-community-profile .v28-route-list{display:grid;gap:9px}
#v10-community-profile #v28-profile-posts,
#v10-community-profile #v28-profile-routes,
#v10-community-profile #vira-passport,
#v10-community-profile #v28-following{scroll-margin-top:22px}
#v10-community-profile .v10-grid-tile{content-visibility:auto;contain-intrinsic-size:auto 180px}
#v10-community-profile .v10-profile-stats{gap:6px 9px;flex-wrap:wrap}
#v10-community-profile .v11-followers-label{margin-left:3px}
@media(max-width:760px){
  /* Fully opaque surfaces eliminate flickering home-page content during typing. */
  #v9-social-overlay:not(.hidden){
    position:fixed!important;left:0!important;right:0!important;bottom:auto!important;
    top:var(--vira-visual-top,0px)!important;
    height:var(--vira-visual-height,100dvh)!important;
    min-height:0;max-height:none;width:100%;
    background:#f8fbfc!important;backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;isolation:isolate;overflow:hidden;
    padding:0!important;
  }
  html[data-theme="dark"] #v9-social-overlay:not(.hidden){background:#0b2331!important}
  #v9-social-overlay .v10-social-shell{
    display:grid;width:100%!important;
    height:100%!important;max-height:100%!important;min-height:0!important;
    border:0!important;border-radius:0!important;box-shadow:none!important;
    overflow:hidden!important;
    grid-template-rows:minmax(53px,auto) auto minmax(0,1fr) calc(59px + env(safe-area-inset-bottom))!important;
  }
  #v9-social-overlay .v10-social-shell>.v9-social-page{
    overflow-x:hidden!important;overflow-y:auto!important;
    min-height:0!important;overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
  }
  #v9-social-overlay .v9-social-tabs{background:var(--community-paper)}
  #v9-social-overlay .v10-feed-list .v10-post,
  #v9-social-overlay .v10-grid-tile{content-visibility:auto;contain-intrinsic-size:auto 400px}
  #v10-community-profile .v10-profile-cover{
    height:68px!important;padding:14px 17px!important;border-radius:12px;
    justify-content:flex-start;font-size:11px;min-height:0;
  }
  #v10-community-profile .v10-profile-header{
    padding:0 5px 18px;display:grid;
    grid-template-columns:76px minmax(0,1fr);gap:10px 13px;
    align-items:start;
  }
  #v10-community-profile .v10-profile-header>.v10-avatar{
    width:76px;height:76px;margin-top:-21px;border-width:4px;
  }
  #v10-community-profile .v10-profile-details{
    min-width:0;padding-top:9px;
  }
  #v10-community-profile .v10-profile-details h3{
    font-size:clamp(21px,5.7vw,26px);margin:3px 0 5px;
  }
  #v10-community-profile .v10-profile-bio{font-size:13px;line-height:1.55}
  #v10-community-profile .v10-profile-stats{
    grid-column:1/-1;display:flex;gap:5px 8px;margin-top:9px;
    flex-wrap:wrap;font-size:11px;line-height:1.65;
  }
  #v10-community-profile .v10-profile-stats strong{font-size:14px;margin-left:2px}
  #v10-community-profile .v10-profile-buttons{
    grid-column:1/-1;display:grid;grid-template-columns:1fr 1fr;
    gap:8px;padding:0;margin-top:0;
  }
  #v10-community-profile .v10-profile-buttons button{
    min-height:46px!important;border-radius:11px;
    font-size:12px!important;padding:10px 12px;text-align:center;
  }
  #v10-community-profile .v10-profile-buttons>.v10-text-button{grid-column:1/-1}
  #v10-community-profile .v28-profile-shortcuts{
    flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;
    padding:2px 0 10px;margin:10px 0 13px;
    scrollbar-width:none;
  }
  #v10-community-profile .v28-profile-shortcut{flex:0 0 auto;min-height:44px}
  #v10-community-profile .v10-profile-grid-label{margin:17px 0 10px}
  #v10-community-profile .v10-profile-grid{gap:5px}
  #v10-community-profile .v11-follow-btn{grid-column:1/-1;margin:0;width:100%;min-height:46px}
  /* Native dialogs sit in their own top layer, with a solid backdrop. */
  dialog.v10-dialog[open],dialog.v24-compose-dialog[open],dialog.v20-dialog[open]{
    box-sizing:border-box;position:fixed;
    top:var(--vira-visual-top,0px)!important;
    margin:8px auto!important;
    max-height:calc(var(--vira-visual-height,100dvh) - 16px)!important;
    max-width:calc(100vw - 16px);overflow-y:auto;overscroll-behavior:contain;
    border-radius:15px;
  }
  dialog.v10-dialog::backdrop,dialog.v24-compose-dialog::backdrop,
  dialog.v20-dialog::backdrop{
    background:rgba(5,15,25,.97)!important;
    backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
  }
  .v10-dialog .v10-form{padding:15px;gap:14px}
  .v10-dialog .v10-field{font-size:13px;gap:7px}
  .v10-dialog .v10-field :is(input,textarea){
    font-size:16px!important;min-height:46px;line-height:1.4;
    scroll-margin-bottom:100px;padding:12px;
  }
  .v10-dialog .v10-field textarea{min-height:94px;resize:vertical}
  .v10-dialog .v10-form>button[type="submit"]{
    position:sticky;bottom:0;z-index:3;min-height:48px;
    width:100%;box-shadow:0 -7px 18px var(--community-paper);
  }
  #v9-tab-messages .v24-layout{
    height:100%!important;min-height:0!important;max-height:100%!important;
  }
  .v27-compose input,.v10-comment-form input{font-size:16px!important}
  /* Cheaper scrolling on low-end phone GPUs. */
  #v9-social-overlay,.v10-dialog::backdrop,.v10-dialog{
    backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
  }
}

/* Messenger mobile isolation: only the message list scrolls.
   Applied after legacy social and messenger CSS, without affecting Explore. */
@media (max-width:760px) {
  #v9-social-overlay #v9-tab-messages.v9-social-page{
    display:flex;flex-direction:column;min-width:0;min-height:0;
    padding:0!important;overflow:hidden!important;height:100%;
    background:var(--community-paper);
  }
  #v9-social-overlay #v9-tab-messages.hidden{display:none!important}
  #v9-social-overlay #v9-tab-messages #v24-msg-status{
    flex:0 0 auto;margin:0;padding:0 12px;font-size:12px;
  }
  #v9-social-overlay #v9-tab-messages #v24-msg-status:empty{display:none}
  #v9-social-overlay #v24-messenger{
    display:flex;flex:1 1 0;min-height:0;min-width:0;width:100%;
    overflow:hidden;background:var(--community-paper);
  }
  #v9-social-overlay #v9-tab-messages .v24-layout{
    flex:1;min-height:0!important;height:100%!important;
    max-height:100%!important;min-width:0;width:100%;
    overflow:hidden;box-shadow:none;border:0!important;border-radius:0!important;
    grid-template-columns:minmax(0,1fr);
  }
  #v9-social-overlay #v9-tab-messages .v24-list-pane{
    height:100%;min-height:0;max-height:100%;min-width:0;
    overflow:hidden;display:flex;flex-direction:column;
  }
  #v9-social-overlay #v9-tab-messages .v24-chat-list{
    flex:1 1 0;min-height:0;overflow-y:auto;
    overscroll-behavior:contain;-webkit-overflow-scrolling:touch;
  }
  #v9-social-overlay #v9-tab-messages .v24-layout:not(.v30-chat-open) .v24-chat-pane{
    display:none!important;
  }
  #v9-social-overlay #v9-tab-messages .v24-layout.v30-chat-open .v24-list-pane{
    display:none!important;
  }
  #v9-social-overlay #v9-tab-messages .v24-layout.v30-chat-open .v24-chat-pane{
    display:flex!important;flex-direction:column;
    width:100%;height:100%;min-height:0;min-width:0;
    overflow:hidden;background:var(--community-bg);
  }
  /* A chat is its own full-screen view. Hide the social navigation and
     global status rather than letting them push the composer below the fold. */
  #v9-social-overlay.v30-chat-focused .v10-social-shell{
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-rows:minmax(0,1fr)!important;
    grid-template-areas:"page"!important;
  }
  #v9-social-overlay.v30-chat-focused .v10-social-shell > .v9-social-header,
  #v9-social-overlay.v30-chat-focused .v10-social-shell > .v9-social-tabs,
  #v9-social-overlay.v30-chat-focused .v10-social-shell > .v9-social-status{
    display:none!important;
  }
  #v9-social-overlay.v30-chat-focused .v10-social-shell > #v9-tab-messages{
    display:flex!important;grid-area:page;
    height:100%;min-height:0;overflow:hidden!important;padding:0!important;
  }
  #v9-social-overlay.v30-chat-focused .v27-chat-header{
    flex:0 0 auto;min-height:57px;max-height:76px;
    padding:8px 11px;gap:8px;
    border-bottom:1px solid var(--community-line);
    background:var(--community-paper);
  }
  #v9-social-overlay.v30-chat-focused .v27-chat-header .v24-back{
    width:44px;min-width:44px;height:44px;border:0;font-size:23px;
  }
  #v9-social-overlay.v30-chat-focused .v27-chat-header .v27-info-button{
    width:40px;min-width:40px;height:40px;font-size:21px;
  }
  #v9-social-overlay.v30-chat-focused .v27-active-title h3{
    font-size:14px;line-height:1.3;
  }
  #v9-social-overlay.v30-chat-focused .v27-chat-header .v27-peer-avatar,
  #v9-social-overlay.v30-chat-focused .v27-chat-header .v27-group-avatar{
    width:38px;height:38px;flex:0 0 38px;
  }
  #v9-social-overlay.v30-chat-focused .v27-message-search-wrap{
    flex:0 0 auto;padding:8px 12px;background:var(--community-paper);
  }
  #v9-social-overlay.v30-chat-focused .v27-message-search-wrap:not(.v30-search-open){
    display:none!important;
  }
  #v9-social-overlay.v30-chat-focused .v24-messages{
    flex:1 1 0;min-height:0!important;height:0;
    overflow-y:auto!important;overflow-x:hidden!important;
    overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch;
    touch-action:pan-y;overflow-anchor:none;
    display:flex;flex-direction:column;gap:4px;
    padding:12px 11px 8px!important;
  }
  #v9-social-overlay.v30-chat-focused .v27-msg-wrap{flex-shrink:0;max-width:100%}
  #v9-social-overlay.v30-chat-focused .v27-day-divider{flex-shrink:0;margin:10px 0}
  #v9-social-overlay.v30-chat-focused .v27-msg-tools{
    opacity:0!important;max-height:0!important;
    overflow:hidden;pointer-events:none;
  }
  #v9-social-overlay.v30-chat-focused .v27-msg-wrap.v30-tools-open .v27-msg-tools,
  #v9-social-overlay.v30-chat-focused .v27-msg-wrap:focus-within .v27-msg-tools{
    opacity:1!important;max-height:45px!important;pointer-events:auto;
  }
  #v9-social-overlay.v30-chat-focused .v27-bubble{
    max-width:min(87%,450px);min-width:0;overflow-wrap:anywhere;
    -webkit-user-select:text;user-select:text;touch-action:pan-y;
  }
  #v9-social-overlay.v30-chat-focused .v27-reply-bar:not([hidden]){
    flex:0 0 auto;min-height:43px;max-height:90px;overflow:hidden;
  }
  #v9-social-overlay.v30-chat-focused .v27-compose{
    flex:0 0 auto;min-height:0;
    display:block!important;position:relative!important;bottom:auto!important;
    padding:8px 10px max(8px,env(safe-area-inset-bottom))!important;
    margin:0;background:var(--community-paper);
    border-top:1px solid var(--community-line);
    box-shadow:0 -4px 16px #0000000a;
  }
  #v9-social-overlay.v30-chat-focused .v27-composer-field{
    display:flex;align-items:center;gap:8px;
  }
  #v9-social-overlay.v30-chat-focused .v27-composer-field input{
    min-width:0;flex:1;min-height:46px;
    font-size:16px!important;border-radius:999px;
    padding:11px 14px;
  }
  #v9-social-overlay.v30-chat-focused .v27-composer-emoji,
  #v9-social-overlay.v30-chat-focused .v27-composer-field .v24-primary{
    width:44px;min-width:44px;height:44px;min-height:44px;
  }
  #v9-social-overlay.v30-chat-focused .v27-emoji-menu{
    max-height:min(112px,23dvh);overflow-y:auto;
    padding:7px 0 0;gap:4px;
  }
  #v9-social-overlay.v30-chat-focused .v27-emoji-button{min-width:39px;min-height:39px}
}
/* Keep the desktop layout usable without outer-page scrolling. */
@media (min-width:761px){
  #v9-social-overlay #v9-tab-messages{overflow:hidden;padding:16px 22px!important}
  #v9-social-overlay #v24-messenger{height:100%;min-height:0;overflow:hidden}
  #v9-social-overlay #v9-tab-messages .v24-layout{
    height:100%;min-height:0;max-height:100%;width:100%;
  }
  #v9-social-overlay #v9-tab-messages .v24-chat-pane{overflow:hidden}
}


/* Mobile account + social profile behave like pages in the same tab.
   A single internal scroller handles text input; the site stays stationary. */
.v31-profile-back{display:none}
.v31-profile-back-label{display:none}
@media(max-width:760px){
  html.vira-mobile-account-active,
  html.vira-mobile-account-active body{
    overflow:hidden!important;
    overscroll-behavior:none;
  }
  #profile-modal:not(.hidden){
    display:block!important;
    position:fixed!important;
    inset:auto!important;
    top:var(--vira-visual-top,0px)!important;
    left:0!important;right:0!important;bottom:auto!important;
    width:100vw!important;
    height:var(--vira-visual-height,100dvh)!important;
    max-height:none!important;
    margin:0!important;padding:0!important;
    z-index:2000!important;
    background:#f8fbfd!important;
    backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
    overflow:hidden!important;
    isolation:isolate;
  }
  #profile-modal:not(.hidden) .v4-profile-panel{
    box-sizing:border-box;
    width:100%!important;
    height:100%!important;
    min-height:0!important;
    max-height:none!important;
    display:grid!important;
    grid-template-rows:auto minmax(0,1fr) auto!important;
    border:0!important;border-radius:0!important;
    box-shadow:none!important;
    overflow:hidden!important;
    background:#f8fbfd!important;
  }
  #profile-modal .v4-profile-heading{
    flex:0 0 auto;
    min-height:63px;
    align-items:center;
    padding:10px 14px!important;
    background:#fff;
    border-bottom:1px solid #dfe9ef;
    gap:12px;
  }
  #profile-modal .v4-profile-heading h2{
    font-size:20px!important;margin:3px 0!important;
  }
  #profile-modal .v4-profile-kicker{font-size:10px}
  #profile-modal .v4-profile-heading p{display:none!important}
  #profile-modal .v4-profile-close{
    order:-1;
    display:inline-flex!important;align-items:center;justify-content:center;
    min-width:76px;width:auto!important;height:44px!important;
    min-height:44px;padding:0 10px!important;gap:7px;
    border-radius:11px!important;
    font-size:13px;font-weight:800;
  }
  #profile-modal .v4-profile-close .v31-profile-back-label{
    display:inline!important;
  }
  #profile-modal .v4-profile-scroll{
    min-height:0!important;
    height:100%;
    max-height:100%!important;
    padding:14px 14px max(22px,env(safe-area-inset-bottom))!important;
    overflow-y:auto!important;overflow-x:hidden!important;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
    scroll-padding-block:15px 34%;
  }
  #profile-modal .v4-profile-grid{
    display:grid!important;grid-template-columns:minmax(0,1fr)!important;
    gap:12px!important;
  }
  #profile-modal .v4-profile-summary{padding:14px!important;margin-bottom:12px!important}
  #profile-modal .v4-profile-footer{
    position:relative;flex:0 0 auto;
    padding:8px 13px max(10px,env(safe-area-inset-bottom))!important;
    background:#fff;border-top:1px solid #dfe9ef;
    min-height:57px;
  }
  #profile-modal .v4-profile-footer .v4-profile-logout{
    min-height:42px;
  }
  #profile-modal :is(input:not([type=checkbox]):not([type=radio]),textarea,select){
    font-size:16px!important;
    max-width:100%;min-width:0;box-sizing:border-box;
    scroll-margin-block:18px 28vh;
  }
  #profile-modal input:not([type=checkbox]):not([type=radio]){
    min-height:44px;
  }
  #profile-modal textarea{line-height:1.5;min-height:90px}
  /* The social profile tab is also a standalone in-app page, not a
     stack of layers above Explore or the messenger. */
  #v9-social-overlay.v31-profile-focused .v10-social-shell{
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-rows:auto minmax(0,1fr)!important;
    grid-template-areas:"head" "page"!important;
    min-height:0!important;
    overflow:hidden!important;
  }
  #v9-social-overlay.v31-profile-focused .v10-social-shell>.v9-social-tabs,
  #v9-social-overlay.v31-profile-focused .v10-social-shell>.v9-social-status{
    display:none!important;
  }
  #v9-social-overlay.v31-profile-focused .v10-social-shell>.v9-social-header{
    display:flex!important;grid-area:head;
    min-height:58px;
    padding:8px 13px!important;
    background:var(--community-paper);
  }
  #v9-social-overlay.v31-profile-focused #v9-tab-profile{
    display:block!important;
    grid-area:page;
    min-height:0!important;
    height:100%;
    padding:12px 13px 32px!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
    background:var(--community-bg);
  }
  #v9-social-overlay.v31-profile-focused .v31-profile-back{
    display:grid!important;
    place-items:center;
    flex:0 0 auto;
    width:44px;min-width:44px;height:44px;
    border-radius:11px;
    border:1px solid var(--community-line);
    color:var(--community-ink);
    background:var(--community-paper);
    font-size:22px;
  }
  #v9-social-overlay.v31-profile-focused .v9-social-header-actions{
    display:flex;gap:7px;align-items:center;
  }
  #v9-social-overlay.v31-profile-focused #v10-community-profile{
    width:100%;max-width:100%;min-width:0;
  }
  #v9-social-overlay.v31-profile-focused .v10-page-heading{
    margin-bottom:14px;
  }
}
/* Respect built-in reduced-motion and avoid keyboard-driven transitions. */
@media(max-width:760px) and (prefers-reduced-motion:reduce){
  #profile-modal .v4-profile-panel,
  #v9-social-overlay.v31-profile-focused .v10-social-shell{transition:none!important}
}
