/* ============================================
   CRITICAL MOBILE FIXES
   Additional layer to ensure perfect mobile display
   ============================================ */

/* Prevent horizontal scroll at all costs */
html {
  width: 100%;
  scroll-behavior: smooth;
  /* NO position:relative - it breaks sticky! */
  /* NO overflow-x here either - mixed with body's overflow-x: hidden
     it makes <html> its own scroll container and breaks sticky too! */
}

body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  /* NO position:relative - it breaks sticky! */
}

/* Ensure all major containers respect viewport */
/* NOTE: "nav" is intentionally excluded here. Giving a <nav> element
   overflow-x: hidden makes its overflow-y auto-compute to "auto" (per the
   CSS overflow spec), turning it into a clipping/scroll container. Since
   the header's dropdown submenu (.title_e16d) is a descendant of
   .warm-3d39 (a <nav>), it was getting clipped and forced into a tiny
   internal scrollbar instead of opening naturally below the nav link. */
main,
section,
article,
footer {
  max-width: 100%;
  overflow-x: hidden;
}

/* Header must NOT have max-width restriction for sticky to work */
header.item_2f22 {
  max-width: none !important;
}

/* Fix for any potential overflow elements */
/* NOTE: ".photo-glass-3a80" is intentionally excluded here for the same reason as
   "nav" above — the header's <div class="container"> wraps the nav and
   must not clip the dropdown submenu with an auto-computed overflow-y.
   It's already width-capped via max-width in style.primary_af43 so it can't cause
   horizontal overflow anyway. */
.gallery_in_3781,
.input-static-7080,
.container_tiny_4b34,
.main-first-df1c,
.label_glass_9d6c,
.summary_3ea1,
.notification_stale_147e,
.hot_2675,
.iron_b157,
.advanced_4af7,
.pattern_e99a {
  max-width: 100%;
  overflow-x: hidden;
}

/* Header mobile optimizations */
@media (max-width: 768px) {
  .surface-1eb9 {
    padding: 8px 0;
  }
  
  .light_8480 img {
    height: 28px;
    width: auto;
  }
  
  .menu_up_4c64 {
    display: none !important;
  }
  
  .motion_5a53 {
    padding: 6px 12px !important;
    font-size: 0.8125rem !important;
    white-space: nowrap;
  }
  
  .motion_5a53 svg {
    width: 14px;
    height: 14px;
  }
  
  .menu-9006 {
    padding: 6px;
  }
  
  .hidden-lite-f8c3 {
    width: 20px;
  }
}

/* Mobile-specific fixes (phones) */
@media (max-width: 768px) {
  /* Force single column layout */
  .container_tiny_4b34,
  .input-static-7080,
  .main-first-df1c,
  .label_glass_9d6c,
  .pattern_clean_f0e8,
  .pattern-current-e926,
  .badge-glass-8946,
  .east-4e63,
  .secondary-24a9,
  .primary_wood_87cf,
  .hero_b6e6,
  .popup_8d12 {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  
  /* Ensure tables are scrollable */
  .row-83d6,
  .info_basic_19d7 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix any fixed-width elements */
  .avatar-bronze-fda3,
  .plasma-7950,
  .element-4d3a,
  .feature_5e70,
  .sort_49ef,
  .info-motion-7f5e,
  .mini-dfef {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
  
  /* Ensure images are responsive */
  img,
  svg,
  picture {
    max-width: 100% !important;
    height: auto !important;
  }
  
  /* Better padding for mobile */
  .inner-e164,
  .complex-4d33,
  .upper-1734,
  .icon_wood_7375,
  .dim_dfa1 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Fix text overflow */
  h1, h2, h3, h4, h5, h6,
  p, span, a, li, td, th,
  .layout-iron-7795,
  .upper-e631,
  .tooltip-bronze-82a0,
  .short_0334 {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
  }
  
  /* Fix code blocks */
  pre,
  code,
  .paragraph_first_355c,
  .prev-2454 {
    overflow-x: auto !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
  }
  
  /* Fix buttons */
  .article-first-1869,
  .basic_9a5f,
  .badge_7cd8,
  .basic_2788 {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Fix flex containers */
  .up-834e,
  .surface-e14c,
  .slow-0c7a,
  .gradient-dark-7653,
  .header-mini-2a6d,
  .easy-97ef {
    flex-wrap: wrap !important;
    width: 100% !important;
  }
}

/* Extra small screens (≤480px) */
@media (max-width: 480px) {
  /* Even more aggressive fixes */
  * {
    max-width: 100vw !important;
  }
  
  section,
  .inner-e164,
  .complex-4d33,
  .icon_wood_7375 {
    max-width: none !important;
  }
  
  .photo-glass-3a80 {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  
  /* Reduce font sizes if needed */
  .layout-iron-7795 {
    font-size: 1.5rem !important;
  }
  
  .upper-e631 {
    font-size: 1.375rem !important;
  }
  
  /* Stack everything */
  .new-b983,
  .logo_84d1 {
    flex-direction: column !important;
  }
  
  /* Smaller stat values */
  .tooltip-bronze-82a0 {
    font-size: 2rem !important;
  }
  
  /* Ensure score circles fit */
  .rough-1722 {
    width: 100px !important;
    height: 100px !important;
    font-size: 2.5rem !important;
  }
  
  .texture-e837 {
    width: 140px !important;
    height: 140px !important;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .inner-e164,
  .icon_wood_7375 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }
}

/* iPhone X and notch devices */
@supports (padding: max(0px)) {
  body {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
}

/* css-noise: 4065 */
.shadow-element-u4 {
  padding: 0.5rem;
  font-size: 11px;
  line-height: 1.3;
}
