/* Ayster proprietary software. Copyright © 2026 Ayster. All rights reserved. */
/* Ayster v76 — iPhone/WebView fit + safe-area + no horizontal escape */
:root{
  --ayster-safe-top: env(safe-area-inset-top, 0px);
  --ayster-safe-right: env(safe-area-inset-right, 0px);
  --ayster-safe-bottom: env(safe-area-inset-bottom, 0px);
  --ayster-safe-left: env(safe-area-inset-left, 0px);
}
html,body{
  width:100%!important;
  max-width:100%!important;
  min-height:100%!important;
  overflow-x:hidden!important;
  overscroll-behavior-x:none;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}
body{
  margin:0!important;
  padding-left:var(--ayster-safe-left)!important;
  padding-right:var(--ayster-safe-right)!important;
}
*,*::before,*::after{box-sizing:border-box!important}
img,video,svg{max-width:100%!important}
iframe{max-width:100%!important}
pre,code{max-width:100%;overflow-wrap:anywhere}
input,textarea,select,button{max-width:100%;font-size:16px}

/* Never let common page shells extend outside the physical phone width. */
main,.page,.app,.container,.wrapper,.content,.content-wrap,.dashboard,.dashboard-page,
.settings-page,.profile-page,.social-page,.chat-page,.wallet-page,.creator-page,.map-page,
.office-page,.learning-page,.marketplace-page,.real-estate-page,.video-call-page{
  max-width:100%!important;
  min-width:0!important;
}
.grid,.row,.columns,.cards,.luxury-grid{min-width:0!important}
.grid>*,.row>*,.columns>*,.cards>*,.luxury-grid>*{min-width:0!important}

/* Bottom navigation stays inside the safe area and never clips. */
#aysterV69BottomNav{
  left:max(8px,var(--ayster-safe-left))!important;
  right:max(8px,var(--ayster-safe-right))!important;
  width:auto!important;
  max-width:none!important;
  bottom:calc(8px + var(--ayster-safe-bottom))!important;
}
#aysterV69BottomNav a{min-width:0!important;overflow:hidden!important}
#aysterV69BottomNav a span:last-child{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* Internet status. Hidden while online; clear warning only when offline. */
#aysterNetworkStatus{
  position:fixed;z-index:2147483646;
  top:calc(8px + var(--ayster-safe-top));left:50%;transform:translateX(-50%);
  max-width:calc(100vw - 24px);padding:7px 12px;border-radius:999px;
  font:800 11px/1.2 -apple-system,BlinkMacSystemFont,"SF Pro Text",Arial,sans-serif;
  background:rgba(154,31,31,.96);color:#fff;border:1px solid rgba(255,255,255,.18);
  box-shadow:0 8px 24px rgba(0,0,0,.35);pointer-events:none;
}
#aysterNetworkStatus[hidden]{display:none!important}

@media (max-width:760px){
  html{scroll-padding-bottom:calc(86px + var(--ayster-safe-bottom))}
  body{font-size:16px!important}
  main{width:100%!important;margin:0!important}
  .hero,.section,.footer{width:100%!important;max-width:100%!important;padding-left:14px!important;padding-right:14px!important}
  .hero{grid-template-columns:minmax(0,1fr)!important;gap:24px!important;min-height:auto!important;padding-top:26px!important;padding-bottom:30px!important}
  .earth-container{height:min(68vw,380px)!important;min-height:250px!important}
  .ayster-shell{width:100%!important;max-width:100%!important;padding-left:12px!important;padding-right:12px!important}
  .ayster-shell-nav{width:100%!important;max-width:100%!important;overflow-x:auto!important;overscroll-behavior-x:contain!important;-webkit-overflow-scrolling:touch}
  .card,.panel,.widget,.auth-box,.dashboard-card,.feature-card,.profile-card,.settings-card,.post-card,.message-card,.luxury-card,.office-card{
    width:100%!important;max-width:100%!important;min-width:0!important;
  }
  .auth-box{margin:28px auto calc(92px + var(--ayster-safe-bottom))!important;width:calc(100% - 24px)!important;padding:22px 16px!important}
  table{font-size:13px}
  .table-wrap,[class*="table-wrap"],[class*="table-container"]{max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch}
}

@media (max-width:390px){
  #aysterV69BottomNav{height:60px!important;padding:4px!important}
  #aysterV69BottomNav a{height:50px!important;font-size:9px!important}
  #aysterV69BottomNav .ico{font-size:18px!important}
  .luxury-hero h1,.hero h1{font-size:clamp(34px,11vw,52px)!important}
}

/* =========================================================
   AYSTER v85 — WHOLE-APP IPHONE FIT / SAFE-AREA MASTER FIX
   Prevents accidental horizontal escape while preserving
   intentional horizontal carousels (stories, reels, chips).
   ========================================================= */
:root{
  --ayster-bottom-nav-space: calc(84px + var(--ayster-safe-bottom));
}
html{
  width:100%!important;
  max-width:100%!important;
  overflow-x:clip!important;
  background-clip:padding-box;
}
body{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  overflow-x:clip!important;
  padding-bottom:var(--ayster-bottom-nav-space)!important;
}
body>*{max-width:100%!important}

/* Replaced elements and text must shrink instead of widening the viewport. */
img,picture,video,canvas,svg,iframe,embed,object{max-width:100%!important}
img,picture,video,canvas,svg{height:auto}
input,textarea,select,button{min-width:0}
pre,code,.post-text,.message,.bubble,.file-note,.review-note{overflow-wrap:anywhere;word-break:break-word}

/* Flexible layout children are a common source of iPhone overflow. */
header,nav,main,section,article,aside,footer,form,
.social-layout,.social-utility,.main-col,.left-col,.right-col,
.music-shell,.music-top,.layout,.main,.sidebar,.top-search,.top-actions,
.stories,.story-row,.reel-strip,.composer,.compose-top,.compose-actions,
.chat-float,.chat-float-body,.chat-call-row,.chat-actions,
.grid,.user-video-grid,.section-head,.hero-banner,.hero-actions,
.modal-card,.watch-card,.office-modal,.ai-drawer{
  min-width:0!important;
  max-width:100%!important;
}

/* Popups/dialogs stay inside the visible phone and above bottom navigation. */
.modal,.upload-modal,.watch-modal,.modal-backdrop,.people-modal,.ay-incoming-call{
  padding-left:max(10px,var(--ayster-safe-left))!important;
  padding-right:max(10px,var(--ayster-safe-right))!important;
}
.modal-card,.watch-card,.office-modal,.people-sheet{
  width:min(100%,760px)!important;
  max-width:100%!important;
  max-height:calc(100dvh - var(--ayster-safe-top) - var(--ayster-safe-bottom) - 24px)!important;
}

/* Fixed/floating UI must respect all four iPhone safe areas. */
.chat-float{
  right:max(10px,var(--ayster-safe-right))!important;
  left:max(10px,var(--ayster-safe-left))!important;
  bottom:calc(82px + var(--ayster-safe-bottom))!important;
  width:auto!important;
  max-width:none!important;
  max-height:calc(100dvh - 110px - var(--ayster-safe-top) - var(--ayster-safe-bottom))!important;
  overflow:auto!important;
}
.toast{
  left:max(12px,var(--ayster-safe-left))!important;
  right:max(12px,var(--ayster-safe-right))!important;
  bottom:calc(88px + var(--ayster-safe-bottom))!important;
  width:auto!important;
  max-width:none!important;
}

/* Social: carousel items may scroll horizontally, but their container may not escape. */
.social-utility{
  width:100%!important;
  margin-left:auto!important;
  margin-right:auto!important;
  padding-left:max(12px,var(--ayster-safe-left))!important;
  padding-right:max(12px,var(--ayster-safe-right))!important;
}
.social-search,.social-tabs{width:100%!important;max-width:100%!important}
.story-row,.reel-strip,.chips,.ayster-shell-nav{
  width:100%!important;
  max-width:100%!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  overscroll-behavior-inline:contain;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
}
.story-row::-webkit-scrollbar,.reel-strip::-webkit-scrollbar,.chips::-webkit-scrollbar,.ayster-shell-nav::-webkit-scrollbar{display:none}
.story,.reel-card{flex:0 0 auto}
.compose-top textarea,.comment-form input,.chat-actions input{width:0;min-width:0;flex:1 1 auto}

/* Music top bar: dynamic-island safe and shrinkable. */
.music-top{
  top:0!important;
  width:100%!important;
  height:auto!important;
  min-height:calc(60px + var(--ayster-safe-top))!important;
  padding-top:var(--ayster-safe-top)!important;
  padding-left:max(8px,var(--ayster-safe-left))!important;
  padding-right:max(8px,var(--ayster-safe-right))!important;
  gap:8px!important;
}
.music-top>.menu-btn,.music-top>.voice,.music-top>.top-actions{flex:0 0 auto}
.music-top>.brand{flex:0 0 auto;min-width:0!important}
.music-top>.top-search{flex:1 1 80px!important;min-width:0!important;margin:0!important}
.top-search input{width:0!important;min-width:0!important;flex:1 1 auto!important;padding-left:11px!important;padding-right:9px!important}
.top-search button{flex:0 0 44px!important;width:44px!important}
.music-top .top-actions{min-width:0!important}

/* Global premium shell safe-area support. */
.ayster-shell{
  top:0!important;
  width:100%!important;
  padding-top:calc(10px + var(--ayster-safe-top))!important;
  padding-left:max(12px,var(--ayster-safe-left))!important;
  padding-right:max(12px,var(--ayster-safe-right))!important;
}

/* Tables/sheets keep their own horizontal scroll instead of widening the app. */
.sheet-stage,.sheet-grid-wrap,.table-wrap,[class*="table-wrap"],[class*="table-container"]{
  max-width:100%!important;
  overflow-x:auto!important;
  -webkit-overflow-scrolling:touch;
}

@media (max-width:760px){
  .social-layout{width:100%!important;padding-left:12px!important;padding-right:12px!important}
  .social-utility{padding-top:calc(8px + var(--ayster-safe-top))!important;margin-top:0!important}
  .stories,.composer,.post-card,.ayster-reviews{width:100%!important;max-width:100%!important}
  .story{min-width:96px!important;width:96px!important;height:160px!important}
  .reel-strip{display:flex!important;grid-template-columns:none!important}
  .reel-card{width:min(42vw,170px)!important;min-width:min(42vw,170px)!important}
  .compose-actions>*{max-width:100%!important}
  .primary-btn{margin-left:0!important}

  .music-top .brand{display:none!important}
  .music-top .voice{display:none!important}
  .music-top .top-actions .pill-upload,.music-top .top-actions .avatar{display:none!important}
  .music-top .top-actions{gap:4px!important}
  .music-top .icon-btn{width:38px!important;height:38px!important}
  .music-top .menu-btn{width:38px!important;height:38px!important}
  .music-top .top-search{max-width:none!important}
  .main{width:100%!important;max-width:100%!important;padding-left:12px!important;padding-right:12px!important}
  .hero-banner{width:100%!important;max-width:100%!important;padding:20px 16px!important}
  .hero-banner h2{font-size:clamp(26px,9vw,40px)!important}
  .hero-actions>*{flex:1 1 145px;min-width:0!important}
  .section-head{align-items:flex-start!important;flex-wrap:wrap!important}
  .section-head>*{min-width:0!important;max-width:100%!important}
}

@media (max-width:390px){
  .social-tabs{gap:3px!important}
  .social-tabs a{height:42px!important;font-size:19px!important}
  .story{min-width:88px!important;width:88px!important;height:150px!important}
  .reel-card{width:150px!important;min-width:150px!important}
  .music-top{gap:5px!important}
  .top-search button{flex-basis:40px!important;width:40px!important}
}
