/* ============================================
   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 (.media-last-1fb1) is a descendant of
   .detail-683a (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.label-brown-cf51 {
  max-width: none !important;
}

/* Fix for any potential overflow elements */
/* NOTE: ".menu_7e42" 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.form_lower_6904 so it can't cause
   horizontal overflow anyway. */
.yellow_7930,
.panel-cold-8ac5,
.gas_5c78,
.description_2c0a,
.hard_224d,
.hover-e92f,
.narrow-e0c4,
.caption-dim-9ed7,
.badge_a602,
.right_43ad,
.message-1bd7 {
  max-width: 100%;
  overflow-x: hidden;
}

/* Header mobile optimizations */
@media (max-width: 768px) {
  .old-9140 {
    padding: 8px 0;
  }
  
  .aside-3ce0 img {
    height: 28px;
    width: auto;
  }
  
  .old-fdbd {
    display: none !important;
  }
  
  .secondary_c06f {
    padding: 6px 12px !important;
    font-size: 0.8125rem !important;
    white-space: nowrap;
  }
  
  .secondary_c06f svg {
    width: 14px;
    height: 14px;
  }
  
  .fast-2bb7 {
    padding: 6px;
  }
  
  .disabled_center_cf2f {
    width: 20px;
  }
}

/* Mobile-specific fixes (phones) */
@media (max-width: 768px) {
  /* Force single column layout */
  .gas_5c78,
  .panel-cold-8ac5,
  .description_2c0a,
  .hard_224d,
  .tooltip-17f8,
  .photo_tiny_8166,
  .motion_3659,
  .layout_silver_66ba,
  .widget-full-5453,
  .focused_5dea,
  .block_3ab7 {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  
  /* Ensure tables are scrollable */
  .border_7a6b,
  .highlight_fe1a {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix any fixed-width elements */
  .sidebar-complex-266e,
  .photo_2f77,
  .wrapper_action_584e,
  .text-smooth-b51c,
  .tabs-hovered-8273,
  .header-steel-9a2f,
  .block_green_1c47 {
    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 */
  .progress-advanced-1132,
  .red_1986,
  .content-focused-bd56,
  .stone_63eb,
  .static_b330 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Fix text overflow */
  h1, h2, h3, h4, h5, h6,
  p, span, a, li, td, th,
  .text_83f4,
  .south_dbd9,
  .thick-df2b,
  .container-70ae {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
  }
  
  /* Fix code blocks */
  pre,
  code,
  .gallery_hard_2109,
  .next-e210 {
    overflow-x: auto !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
  }
  
  /* Fix buttons */
  .module_motion_5273,
  .border_dirty_166a,
  .active_dirty_dda5,
  .west_7b67 {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Fix flex containers */
  .wide-c8c1,
  .focus_green_6659,
  .component_upper_c694,
  .pink-f9f1,
  .chip_narrow_8fb5,
  .outer-eb6b {
    flex-wrap: wrap !important;
    width: 100% !important;
  }
}

/* Extra small screens (≤480px) */
@media (max-width: 480px) {
  /* Even more aggressive fixes */
  * {
    max-width: 100vw !important;
  }
  
  section,
  .progress-advanced-1132,
  .red_1986,
  .stone_63eb {
    max-width: none !important;
  }
  
  .menu_7e42 {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  
  /* Reduce font sizes if needed */
  .text_83f4 {
    font-size: 1.5rem !important;
  }
  
  .south_dbd9 {
    font-size: 1.375rem !important;
  }
  
  /* Stack everything */
  .slow_37c6,
  .filter_b3b4 {
    flex-direction: column !important;
  }
  
  /* Smaller stat values */
  .thick-df2b {
    font-size: 2rem !important;
  }
  
  /* Ensure score circles fit */
  .wood-5ae3 {
    width: 100px !important;
    height: 100px !important;
    font-size: 2.5rem !important;
  }
  
  .under-0890 {
    width: 140px !important;
    height: 140px !important;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .progress-advanced-1132,
  .stone_63eb {
    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: 820e */
.phantom-card-k6 {
  padding: 0.1rem;
  font-size: 11px;
  line-height: 1.2;
}
