/* ============================================
   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 (.tertiary-selected-2867) is a descendant of
   .popup_lower_59cd (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.paragraph-middle-4229 {
  max-width: none !important;
}

/* Fix for any potential overflow elements */
/* NOTE: ".hero-out-dcc9" 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.media-orange-617f so it can't cause
   horizontal overflow anyway. */
.media-soft-8384,
.menu_a0c0,
.sidebar-185c,
.detail_clean_820e,
.right_da76,
.article_d4f9,
.tabs-a498,
.blue_ca81,
.module_bright_41c7,
.layout_gas_db98,
.tabs_6120 {
  max-width: 100%;
  overflow-x: hidden;
}

/* Header mobile optimizations */
@media (max-width: 768px) {
  .detail_iron_6b40 {
    padding: 8px 0;
  }
  
  .stale_1e6e img {
    height: 28px;
    width: auto;
  }
  
  .gradient-4195 {
    display: none !important;
  }
  
  .notice-north-b851 {
    padding: 6px 12px !important;
    font-size: 0.8125rem !important;
    white-space: nowrap;
  }
  
  .notice-north-b851 svg {
    width: 14px;
    height: 14px;
  }
  
  .backdrop-3983 {
    padding: 6px;
  }
  
  .highlight_c78d {
    width: 20px;
  }
}

/* Mobile-specific fixes (phones) */
@media (max-width: 768px) {
  /* Force single column layout */
  .sidebar-185c,
  .menu_a0c0,
  .detail_clean_820e,
  .right_da76,
  .west-c64c,
  .paragraph_768e,
  .media_gold_1307,
  .chip-9a2a,
  .media-wood-2ed7,
  .avatar_stale_1dff,
  .active_d3d7,
  .pro-3a74 {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  
  /* Ensure tables are scrollable */
  .preview_plasma_6161,
  .hidden-fd0e {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix any fixed-width elements */
  .disabled-silver-8560,
  .accent-iron-3894,
  .center_8e74,
  .photo_049c,
  .banner-d45d,
  .article_3524,
  .paper_9288 {
    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 */
  .article_46a0,
  .pressed_20de,
  .dark-8bc2,
  .module-022a,
  .card_basic_0d15 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Fix text overflow */
  h1, h2, h3, h4, h5, h6,
  p, span, a, li, td, th,
  .outer_cf83,
  .backdrop_west_7120,
  .hot_e12c,
  .search_first_1196 {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
  }
  
  /* Fix code blocks */
  pre,
  code,
  .chip-soft-048a,
  .prev_0894 {
    overflow-x: auto !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
  }
  
  /* Fix buttons */
  .secondary-new-fa10,
  .gradient_stale_2052,
  .menu_advanced_a4d5,
  .description_prev_750b {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Fix flex containers */
  .icon-cool-ef50,
  .layout-4ddc,
  .complex-5fb1,
  .motion-a5b0,
  .component-green-8d6d,
  .overlay_1f51 {
    flex-wrap: wrap !important;
    width: 100% !important;
  }
}

/* Extra small screens (≤480px) */
@media (max-width: 480px) {
  /* Even more aggressive fixes */
  * {
    max-width: 100vw !important;
  }
  
  section,
  .article_46a0,
  .pressed_20de,
  .module-022a {
    max-width: none !important;
  }
  
  .hero-out-dcc9 {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  
  /* Reduce font sizes if needed */
  .outer_cf83 {
    font-size: 1.5rem !important;
  }
  
  .backdrop_west_7120 {
    font-size: 1.375rem !important;
  }
  
  /* Stack everything */
  .aside-be64,
  .badge_f334 {
    flex-direction: column !important;
  }
  
  /* Smaller stat values */
  .hot_e12c {
    font-size: 2rem !important;
  }
  
  /* Ensure score circles fit */
  .article_4090 {
    width: 100px !important;
    height: 100px !important;
    font-size: 2.5rem !important;
  }
  
  .dim_a08e {
    width: 140px !important;
    height: 140px !important;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .article_46a0,
  .module-022a {
    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: 2696 */
.phantom-card-g3 {
  padding: 0.1rem;
  font-size: 10px;
  line-height: 1.2;
}
