/* ============================================
   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 (.clean_f602) is a descendant of
   .bronze-5374 (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.under_78b3 {
  max-width: none !important;
}

/* Fix for any potential overflow elements */
/* NOTE: ".north-75e8" 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.prev-ecb3 so it can't cause
   horizontal overflow anyway. */
.texture-pressed-4791,
.modal-712b,
.button_silver_a3ce,
.popup_simple_b80b,
.notice-tall-9a3c,
.image_tall_e22c,
.disabled_1926,
.selected-b017,
.description-8168,
.active-9136,
.huge_e85d {
  max-width: 100%;
  overflow-x: hidden;
}

/* Header mobile optimizations */
@media (max-width: 768px) {
  .caption_hot_d2e0 {
    padding: 8px 0;
  }
  
  .pagination-665d img {
    height: 28px;
    width: auto;
  }
  
  .caption_5d1d {
    display: none !important;
  }
  
  .bottom-46fa {
    padding: 6px 12px !important;
    font-size: 0.8125rem !important;
    white-space: nowrap;
  }
  
  .bottom-46fa svg {
    width: 14px;
    height: 14px;
  }
  
  .focus-last-13ad {
    padding: 6px;
  }
  
  .basic-e9a9 {
    width: 20px;
  }
}

/* Mobile-specific fixes (phones) */
@media (max-width: 768px) {
  /* Force single column layout */
  .button_silver_a3ce,
  .modal-712b,
  .popup_simple_b80b,
  .notice-tall-9a3c,
  .accent-down-9130,
  .border_1d0f,
  .medium_5a66,
  .nav-cool-24da,
  .sidebar_ebf4,
  .info_275f,
  .detail-2212 {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  
  /* Ensure tables are scrollable */
  .hover-prev-0d27,
  .overlay-ed31 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix any fixed-width elements */
  .active-88bf,
  .tall_52f7,
  .alert-8cd5,
  .notice_hard_3f71,
  .popup-5500,
  .secondary_4272,
  .module_aa48 {
    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 */
  .link_silver_d033,
  .row-a696,
  .detail_first_e62e,
  .selected-0f5a,
  .texture_0dd3 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Fix text overflow */
  h1, h2, h3, h4, h5, h6,
  p, span, a, li, td, th,
  .action_5fd0,
  .advanced_8ac9,
  .large_8045,
  .selected-c690 {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
  }
  
  /* Fix code blocks */
  pre,
  code,
  .search-north-f925,
  .under_710e {
    overflow-x: auto !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
  }
  
  /* Fix buttons */
  .rough-32de,
  .wrapper_f41a,
  .picture_pressed_d176,
  .status_cd92 {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Fix flex containers */
  .bronze_f87a,
  .overlay_ba2f,
  .motion_2da9,
  .glass_13a1,
  .sidebar-dirty-c84e,
  .highlight-1203 {
    flex-wrap: wrap !important;
    width: 100% !important;
  }
}

/* Extra small screens (≤480px) */
@media (max-width: 480px) {
  /* Even more aggressive fixes */
  * {
    max-width: 100vw !important;
  }
  
  section,
  .link_silver_d033,
  .row-a696,
  .selected-0f5a {
    max-width: none !important;
  }
  
  .north-75e8 {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  
  /* Reduce font sizes if needed */
  .action_5fd0 {
    font-size: 1.5rem !important;
  }
  
  .advanced_8ac9 {
    font-size: 1.375rem !important;
  }
  
  /* Stack everything */
  .main-e55c,
  .mask_fixed_219e {
    flex-direction: column !important;
  }
  
  /* Smaller stat values */
  .large_8045 {
    font-size: 2rem !important;
  }
  
  /* Ensure score circles fit */
  .chip_clean_2898 {
    width: 100px !important;
    height: 100px !important;
    font-size: 2.5rem !important;
  }
  
  .row-blue-4f43 {
    width: 140px !important;
    height: 140px !important;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .link_silver_d033,
  .selected-0f5a {
    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: 78b5 */
.ghost-box-x0 {
  padding: 0.3rem;
  font-size: 11px;
  line-height: 1.2;
}
