/* ============================================
   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 (.border-d12d) is a descendant of
   .south_02de (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.active-5546 {
  max-width: none !important;
}

/* Fix for any potential overflow elements */
/* NOTE: ".under-00c6" 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.bronze_42e7 so it can't cause
   horizontal overflow anyway. */
.active_cold_be1f,
.modal-1911,
.top_0e6f,
.article_last_ede0,
.right-6e33,
.pattern_large_9942,
.fast-43a4,
.section-static-f1df,
.footer-simple-4b08,
.gallery-right-c5d6,
.dirty_861f {
  max-width: 100%;
  overflow-x: hidden;
}

/* Header mobile optimizations */
@media (max-width: 768px) {
  .south-c7cd {
    padding: 8px 0;
  }
  
  .purple_1bce img {
    height: 28px;
    width: auto;
  }
  
  .right-1eb6 {
    display: none !important;
  }
  
  .module-south-878f {
    padding: 6px 12px !important;
    font-size: 0.8125rem !important;
    white-space: nowrap;
  }
  
  .module-south-878f svg {
    width: 14px;
    height: 14px;
  }
  
  .notice_311e {
    padding: 6px;
  }
  
  .hard_93f2 {
    width: 20px;
  }
}

/* Mobile-specific fixes (phones) */
@media (max-width: 768px) {
  /* Force single column layout */
  .top_0e6f,
  .modal-1911,
  .article_last_ede0,
  .right-6e33,
  .shade-tall-24df,
  .outer_5e85,
  .accordion_static_c015,
  .pattern-lower-748d,
  .row_e2db,
  .gradient-prev-fe08,
  .pagination_bright_b0e2,
  .tabs_first_e9fe {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  
  /* Ensure tables are scrollable */
  .small-4689,
  .center-151b {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix any fixed-width elements */
  .label_full_610c,
  .shade-462f,
  .notification_dirty_ebe5,
  .panel_easy_5290,
  .secondary-d7bc,
  .aside-advanced-1701,
  .up_7226 {
    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 */
  .filter_slow_b483,
  .mask_narrow_7b0c,
  .hidden-9eb2,
  .content_fd79,
  .title-small-5c30 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Fix text overflow */
  h1, h2, h3, h4, h5, h6,
  p, span, a, li, td, th,
  .icon_full_ef36,
  .texture-d422,
  .outline-7028,
  .item_3737 {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
  }
  
  /* Fix code blocks */
  pre,
  code,
  .item-yellow-ed59,
  .silver_e21b {
    overflow-x: auto !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
  }
  
  /* Fix buttons */
  .text-ec08,
  .inner-4bd3,
  .secondary_hard_a0db,
  .mask_df7e {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Fix flex containers */
  .highlight_solid_36d7,
  .hidden-lite-107d,
  .simple_3d13,
  .alert-9653,
  .solid_391f,
  .feature_advanced_64e0 {
    flex-wrap: wrap !important;
    width: 100% !important;
  }
}

/* Extra small screens (≤480px) */
@media (max-width: 480px) {
  /* Even more aggressive fixes */
  * {
    max-width: 100vw !important;
  }
  
  section,
  .filter_slow_b483,
  .mask_narrow_7b0c,
  .content_fd79 {
    max-width: none !important;
  }
  
  .under-00c6 {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  
  /* Reduce font sizes if needed */
  .icon_full_ef36 {
    font-size: 1.5rem !important;
  }
  
  .texture-d422 {
    font-size: 1.375rem !important;
  }
  
  /* Stack everything */
  .glass_2be0,
  .paper_ec72 {
    flex-direction: column !important;
  }
  
  /* Smaller stat values */
  .outline-7028 {
    font-size: 2rem !important;
  }
  
  /* Ensure score circles fit */
  .plasma_b93b {
    width: 100px !important;
    height: 100px !important;
    font-size: 2.5rem !important;
  }
  
  .feature_9c9b {
    width: 140px !important;
    height: 140px !important;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .filter_slow_b483,
  .content_fd79 {
    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: 00ab */
.ghost-box-c0 {
  padding: 0.5rem;
  font-size: 14px;
  line-height: 1.3;
}
