/*
 * Ucuzabulan B174 - final mobile visual + dynamic marketplace logo completion
 * Loaded last. Keeps previous B172/B173 fixes, closes screenshot regressions where legacy
 * inline styles or old DB logos could still win on mobile/detail/store surfaces.
 */
html,body{max-width:100%;overflow-x:hidden!important;}
img{max-width:100%;}

/* Home compare: each comparison pair is full width on phones; the two compared products stay side-by-side inside the card. */
@media (max-width: 820px){
  html body #ubHomeComparedGrid,
  html body .ub-home2-main #ubHomeComparedGrid,
  html body .ub-home-block #ubHomeComparedGrid,
  html body .ub-compare-pair-grid#ubHomeComparedGrid{display:grid!important;grid-template-columns:1fr!important;gap:12px!important;width:100%!important;max-width:100%!important;}
  html body #ubHomeComparedGrid>.ub-compare-pair-card,
  html body #ubHomeComparedGrid>a.card{grid-column:1/-1!important;width:100%!important;max-width:100%!important;min-width:0!important;margin:0!important;overflow:hidden!important;}
  html body #ubHomeComparedGrid .ub-compare-pair-card__products{display:grid!important;grid-template-columns:minmax(0,1fr) 34px minmax(0,1fr)!important;gap:7px!important;align-items:stretch!important;}
  html body #ubHomeComparedGrid .ub-compare-side{min-width:0!important;overflow:hidden!important;align-items:center!important;text-align:center!important;}
  html body #ubHomeComparedGrid .ub-compare-side__img{width:100%!important;height:84px!important;object-fit:contain!important;background:#fff!important;}
  html body #ubHomeComparedGrid .ub-compare-side__title{font-size:12px!important;line-height:1.18!important;max-height:2.45em!important;display:-webkit-box!important;-webkit-line-clamp:2!important;-webkit-box-orient:vertical!important;overflow:hidden!important;word-break:break-word!important;overflow-wrap:anywhere!important;}
  html body #ubHomeComparedGrid .ub-prod-row,
  html body #ubHomeComparedGrid .ub-compare-pair-card__meta{display:grid!important;grid-template-columns:1fr!important;gap:7px!important;width:100%!important;}
  html body #ubHomeComparedGrid .badge{width:100%!important;max-width:100%!important;white-space:normal!important;text-align:center!important;justify-content:center!important;font-size:10.5px!important;line-height:1.15!important;padding:6px 7px!important;}
  html body #ubHomeComparedGrid .ub-compare-vs{position:relative!important;inset:auto!important;transform:none!important;align-self:center!important;justify-self:center!important;width:32px!important;height:32px!important;min-width:32px!important;border-width:3px!important;font-size:10px!important;z-index:2!important;}
}
@media (max-width: 370px){
  html body #ubHomeComparedGrid .ub-compare-pair-card__products{grid-template-columns:minmax(0,1fr) 28px minmax(0,1fr)!important;gap:5px!important;}
  html body #ubHomeComparedGrid .ub-compare-side{padding:6px!important;}
  html body #ubHomeComparedGrid .ub-compare-side__img{height:72px!important;}
  html body #ubHomeComparedGrid .ub-compare-vs{width:28px!important;height:28px!important;min-width:28px!important;font-size:9px!important;}
}

/* Home market rails: neutralize inline image heights and demo-card look on mobile. */
@media (max-width: 760px){
  html body .ub-home-block[aria-label="Market"] .ub-rail{display:grid!important;grid-auto-flow:row!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important;overflow:visible!important;scroll-snap-type:none!important;width:100%!important;}
  html body .ub-home-block[aria-label="Market"] .ub-rail-card{width:100%!important;min-width:0!important;max-width:100%!important;flex:1 1 auto!important;padding:10px!important;border-radius:18px!important;overflow:hidden!important;}
  html body .ub-home-block[aria-label="Market"] .ub-rail-card img,
  html body .ub-home-block[aria-label="Market"] .ub-rail-card .ub-img,
  html body .ub-home-block[aria-label="Market"] .ub-rail-card picture img{width:100%!important;height:132px!important;max-height:132px!important;object-fit:contain!important;background:#fff!important;border-radius:14px!important;mix-blend-mode:normal!important;}
  html body .ub-home-block[aria-label="Market"] .ub-prod-title{font-size:13px!important;line-height:1.22!important;min-height:0!important;max-height:2.6em!important;display:-webkit-box!important;-webkit-line-clamp:2!important;-webkit-box-orient:vertical!important;overflow:hidden!important;}
  html body .ub-home-block[aria-label="Market"] .ub-prod-row{display:grid!important;grid-template-columns:1fr!important;gap:7px!important;}
  html body .ub-home-block[aria-label="Market"] .badge{white-space:normal!important;justify-content:center!important;text-align:center!important;min-height:38px!important;line-height:1.14!important;font-size:11px!important;}
  html body .ub-home-block[aria-label="Market"] .ub-prod-cta{min-height:42px!important;font-size:12px!important;}
}
@media (max-width: 370px){html body .ub-home-block[aria-label="Market"] .ub-rail{grid-template-columns:1fr!important;}html body .ub-home-block[aria-label="Market"] .ub-rail-card img{height:150px!important;max-height:150px!important;}}

/* Market listing + market store grid: one readable card per row on narrow phones. */
@media (max-width: 640px){
  html body .grid-prod--market,
  html body .ub-market-grid,
  html body .ub-market-store-products{display:grid!important;grid-template-columns:1fr!important;gap:12px!important;width:100%!important;}
  html body .ub-mkt-card{width:100%!important;max-width:100%!important;min-width:0!important;border-radius:20px!important;overflow:hidden!important;}
  html body .ub-mkt-card__main{display:grid!important;grid-template-columns:1fr!important;gap:10px!important;}
  html body .ub-mkt-card__img{width:100%!important;height:176px!important;max-width:100%!important;margin:0!important;background:#fff!important;border-radius:16px!important;}
  html body .ub-mkt-card__img img{width:100%!important;height:100%!important;object-fit:contain!important;background:#fff!important;mix-blend-mode:normal!important;}
  html body .ub-mkt-card__footer{display:grid!important;grid-template-columns:1fr!important;gap:8px!important;}
  html body .ub-mkt-card__footer .btn,
  html body .ub-mkt-card__footer a{width:100%!important;min-height:44px!important;justify-content:center!important;text-align:center!important;}
}

/* PDP topdock/sticky: mobile normal flow, desktop sticky only inside safe column. */
@media (max-width: 860px){
  html body .ub-pdp .ub-pdp-topdock,
  html body .ub-pdp-topdock,
  html body .ub-pdp-topdock.card,
  html body section.ub-pdp-topdock{position:static!important;top:auto!important;left:auto!important;right:auto!important;bottom:auto!important;z-index:1!important;display:block!important;max-height:none!important;overflow:visible!important;transform:none!important;contain:none!important;clear:both!important;margin:12px 0 16px!important;}
  html body .ub-pdpsticky,
  html body .ub-pdp-sticky,
  html body .ub-pdp-stickybar{display:none!important;visibility:hidden!important;pointer-events:none!important;}
  html body .ub-pdp__gallery,
  html body .ub-pdp-gallery,
  html body .ub-pdp__media,
  html body .ub-pdp-hero{position:relative!important;z-index:2!important;overflow:visible!important;clear:both!important;}
  html body .ub-pdp__gallery img,
  html body .ub-pdp-gallery img,
  html body .ub-product-media img{display:block!important;width:auto!important;max-width:100%!important;max-height:58vh!important;height:auto!important;object-fit:contain!important;margin:0 auto!important;}
}

/* Dynamic marketplace logos should render as logo marks, never cropped avatars. */
.ub-store-ico,.ub-marketplace-logo,.ub-mkt-store img,.ub-offer-v2__seller img,.ub-list-storeline__logo{object-fit:contain!important;background:#fff!important;}
.ub-store-card .ub-store-ico{padding:6px!important;}

/* The floating AI assistant should not cover the product cards on mobile screenshots. */
@media (max-width: 640px){
  html body #ubAiAssistant.ub-ai{right:8px!important;bottom:max(8px,env(safe-area-inset-bottom,0px) + 58px)!important;z-index:80!important;}
  html body #ubAiAssistant .ub-ai__fab{min-width:48px!important;max-width:52px!important;width:52px!important;height:52px!important;min-height:52px!important;border-radius:18px!important;padding:6px!important;}
  html body #ubAiAssistant .ub-ai__fabText,
  html body #ubAiAssistant .ub-ai__fabBadge{display:none!important;}
  html body #ubAiAssistant .ub-ai__fabIcon{width:40px!important;height:40px!important;flex:0 0 40px!important;}
}
