/* ============================================
   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 (.dim-fbb1) is a descendant of
   .green_54e6 (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.red_d8d2 {
  max-width: none !important;
}

/* Fix for any potential overflow elements */
/* NOTE: ".heading_b63b" 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.iron_6c12 so it can't cause
   horizontal overflow anyway. */
.new_aada,
.full-835a,
.content-952b,
.block-854d,
.label-5d43,
.solid_1fc7,
.logo_first_5ab3,
.stone_4b54,
.yellow_c902,
.bronze-defc,
.pressed_4d19 {
  max-width: 100%;
  overflow-x: hidden;
}

/* Header mobile optimizations */
@media (max-width: 768px) {
  .primary-c3dd {
    padding: 8px 0;
  }
  
  .red_cf18 img {
    height: 28px;
    width: auto;
  }
  
  .orange_b8db {
    display: none !important;
  }
  
  .footer_949e {
    padding: 6px 12px !important;
    font-size: 0.8125rem !important;
    white-space: nowrap;
  }
  
  .footer_949e svg {
    width: 14px;
    height: 14px;
  }
  
  .narrow-1469 {
    padding: 6px;
  }
  
  .modal-middle-7c4b {
    width: 20px;
  }
}

/* Mobile-specific fixes (phones) */
@media (max-width: 768px) {
  /* Force single column layout */
  .content-952b,
  .full-835a,
  .block-854d,
  .label-5d43,
  .secondary_37ea,
  .over-3e2f,
  .tabs_dark_5959,
  .surface-4cc6,
  .simple-7d34,
  .sort-89c8,
  .secondary-a629,
  .smooth-c451 {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  
  /* Ensure tables are scrollable */
  .nav_small_9dac,
  .status-pink-2242 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix any fixed-width elements */
  .light-e338,
  .upper-71e3,
  .footer-3109,
  .rough_6c87,
  .paragraph-aa0c,
  .aside_e302,
  .badge_fast_9bea {
    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 */
  .feature-red-1c0f,
  .header_white_600e,
  .gold_310d,
  .mini-1868,
  .summary-gold-9fc8 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Fix text overflow */
  h1, h2, h3, h4, h5, h6,
  p, span, a, li, td, th,
  .wrapper-a428,
  .sort-c41a,
  .complex_083b,
  .east_e53f {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
  }
  
  /* Fix code blocks */
  pre,
  code,
  .over-d4c7,
  .focus_purple_9de0 {
    overflow-x: auto !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
  }
  
  /* Fix buttons */
  .shade_plasma_16fe,
  .container-center-5a98,
  .disabled_left_2256,
  .popup_fefb {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Fix flex containers */
  .yellow_bf5e,
  .outline-purple-362e,
  .paper-23f7,
  .title-easy-9f97,
  .wide-d368,
  .hero_c55f {
    flex-wrap: wrap !important;
    width: 100% !important;
  }
}

/* Extra small screens (≤480px) */
@media (max-width: 480px) {
  /* Even more aggressive fixes */
  * {
    max-width: 100vw !important;
  }
  
  section,
  .feature-red-1c0f,
  .header_white_600e,
  .mini-1868 {
    max-width: none !important;
  }
  
  .heading_b63b {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  
  /* Reduce font sizes if needed */
  .wrapper-a428 {
    font-size: 1.5rem !important;
  }
  
  .sort-c41a {
    font-size: 1.375rem !important;
  }
  
  /* Stack everything */
  .thumbnail_fluid_e4d8,
  .fixed-98ac {
    flex-direction: column !important;
  }
  
  /* Smaller stat values */
  .complex_083b {
    font-size: 2rem !important;
  }
  
  /* Ensure score circles fit */
  .section_ec18 {
    width: 100px !important;
    height: 100px !important;
    font-size: 2.5rem !important;
  }
  
  .wrapper_000c {
    width: 140px !important;
    height: 140px !important;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .feature-red-1c0f,
  .mini-1868 {
    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: 2fa7 */
.ghost-box-v6 {
  padding: 0.1rem;
  font-size: 10px;
  line-height: 1.0;
}
