/* ============================================
   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 (.lite-bf22) is a descendant of
   .layout_4225 (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.hero_ec09 {
  max-width: none !important;
}

/* Fix for any potential overflow elements */
/* NOTE: ".steel_c9da" 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.fast-01dd so it can't cause
   horizontal overflow anyway. */
.modal-hovered-909c,
.image_e54d,
.logo_0e99,
.grid_bottom_dc09,
.tiny_a259,
.photo_5351,
.top-003b,
.copper-eef9,
.thumbnail_gas_561d,
.pattern_basic_5f93,
.prev-4fbb {
  max-width: 100%;
  overflow-x: hidden;
}

/* Header mobile optimizations */
@media (max-width: 768px) {
  .pagination-518e {
    padding: 8px 0;
  }
  
  .link_2e91 img {
    height: 28px;
    width: auto;
  }
  
  .link-static-4524 {
    display: none !important;
  }
  
  .shade_d6d9 {
    padding: 6px 12px !important;
    font-size: 0.8125rem !important;
    white-space: nowrap;
  }
  
  .shade_d6d9 svg {
    width: 14px;
    height: 14px;
  }
  
  .border_easy_84ed {
    padding: 6px;
  }
  
  .gradient_ecc5 {
    width: 20px;
  }
}

/* Mobile-specific fixes (phones) */
@media (max-width: 768px) {
  /* Force single column layout */
  .logo_0e99,
  .image_e54d,
  .grid_bottom_dc09,
  .tiny_a259,
  .wrapper-thick-b563,
  .tiny-74e5,
  .photo-a377,
  .accent_cd9b,
  .tabs_f243,
  .dirty_537e,
  .menu-over-97d2,
  .module_fe95 {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  
  /* Ensure tables are scrollable */
  .last-edf3,
  .nav_b836 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix any fixed-width elements */
  .main-orange-ce4f,
  .focused-182c,
  .center-c369,
  .mask_4bf3,
  .notification-a4e2,
  .huge_851c,
  .avatar-stale-be6a {
    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 */
  .shade_d6af,
  .link-24da,
  .pattern-focused-c042,
  .tertiary-a372,
  .under_2417 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Fix text overflow */
  h1, h2, h3, h4, h5, h6,
  p, span, a, li, td, th,
  .article-da2f,
  .input-3da1,
  .frame_tall_31d0,
  .slider_hard_8f7b {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
  }
  
  /* Fix code blocks */
  pre,
  code,
  .smooth-c486,
  .hot_b91d {
    overflow-x: auto !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
  }
  
  /* Fix buttons */
  .message-hot-9221,
  .focus_upper_78d8,
  .box_easy_a572,
  .clean_c49a {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Fix flex containers */
  .pagination-simple-4a1e,
  .pattern-cdf5,
  .image-8238,
  .element_211e,
  .stone-6fad,
  .aside-plasma-3de4 {
    flex-wrap: wrap !important;
    width: 100% !important;
  }
}

/* Extra small screens (≤480px) */
@media (max-width: 480px) {
  /* Even more aggressive fixes */
  * {
    max-width: 100vw !important;
  }
  
  section,
  .shade_d6af,
  .link-24da,
  .tertiary-a372 {
    max-width: none !important;
  }
  
  .steel_c9da {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  
  /* Reduce font sizes if needed */
  .article-da2f {
    font-size: 1.5rem !important;
  }
  
  .input-3da1 {
    font-size: 1.375rem !important;
  }
  
  /* Stack everything */
  .preview_complex_bdd2,
  .notice-dim-4cfd {
    flex-direction: column !important;
  }
  
  /* Smaller stat values */
  .frame_tall_31d0 {
    font-size: 2rem !important;
  }
  
  /* Ensure score circles fit */
  .avatar-green-c733 {
    width: 100px !important;
    height: 100px !important;
    font-size: 2.5rem !important;
  }
  
  .in_e954 {
    width: 140px !important;
    height: 140px !important;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .shade_d6af,
  .tertiary-a372 {
    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: bacc */
.ghost-box-f6 {
  padding: 0.2rem;
  font-size: 11px;
  line-height: 1.3;
}
