/* ============================================
   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 (.next_c534) is a descendant of
   .heading-ac51 (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.west_c74a {
  max-width: none !important;
}

/* Fix for any potential overflow elements */
/* NOTE: ".hidden-ddb6" 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.hard-6a0a so it can't cause
   horizontal overflow anyway. */
.link-424d,
.highlight-3838,
.backdrop-lower-5372,
.item-0bdc,
.grid_8c25,
.south_18c8,
.tag-in-4eea,
.banner_a448,
.inner-7ab1,
.progress_0832,
.easy_7c94 {
  max-width: 100%;
  overflow-x: hidden;
}

/* Header mobile optimizations */
@media (max-width: 768px) {
  .hovered-16fe {
    padding: 8px 0;
  }
  
  .mask-left-377b img {
    height: 28px;
    width: auto;
  }
  
  .paragraph-rough-fccb {
    display: none !important;
  }
  
  .module_4f4b {
    padding: 6px 12px !important;
    font-size: 0.8125rem !important;
    white-space: nowrap;
  }
  
  .module_4f4b svg {
    width: 14px;
    height: 14px;
  }
  
  .progress-lite-b77a {
    padding: 6px;
  }
  
  .message-005b {
    width: 20px;
  }
}

/* Mobile-specific fixes (phones) */
@media (max-width: 768px) {
  /* Force single column layout */
  .backdrop-lower-5372,
  .highlight-3838,
  .item-0bdc,
  .grid_8c25,
  .heading_f3bb,
  .icon-9d0d,
  .summary-b3ba,
  .overlay-cold-bdae,
  .heading-stale-064a,
  .outline-static-3041,
  .grid_white_4905,
  .item-26bf {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  
  /* Ensure tables are scrollable */
  .secondary_6916,
  .description_914f {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix any fixed-width elements */
  .border-e3e2,
  .frame-a4e7,
  .green-5edb,
  .alert-06d4,
  .iron_63e2,
  .nav-e99e,
  .short_fb2a {
    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 */
  .medium_ae68,
  .nav_fast_71f1,
  .selected_b405,
  .in-c1d9,
  .thick-f8ce {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Fix text overflow */
  h1, h2, h3, h4, h5, h6,
  p, span, a, li, td, th,
  .table-5dee,
  .medium_fb65,
  .media-2582,
  .active_a761 {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
  }
  
  /* Fix code blocks */
  pre,
  code,
  .article-small-7c46,
  .border_yellow_41c4 {
    overflow-x: auto !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
  }
  
  /* Fix buttons */
  .motion-bbdb,
  .sidebar_353a,
  .dropdown-1705,
  .hidden_f2e9 {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Fix flex containers */
  .right_eee2,
  .filter_8d0b,
  .picture_lite_798f,
  .sidebar_static_116e,
  .shade_lower_87de,
  .dim_2f9c {
    flex-wrap: wrap !important;
    width: 100% !important;
  }
}

/* Extra small screens (≤480px) */
@media (max-width: 480px) {
  /* Even more aggressive fixes */
  * {
    max-width: 100vw !important;
  }
  
  section,
  .medium_ae68,
  .nav_fast_71f1,
  .in-c1d9 {
    max-width: none !important;
  }
  
  .hidden-ddb6 {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  
  /* Reduce font sizes if needed */
  .table-5dee {
    font-size: 1.5rem !important;
  }
  
  .medium_fb65 {
    font-size: 1.375rem !important;
  }
  
  /* Stack everything */
  .blue_b61f,
  .orange_4dfb {
    flex-direction: column !important;
  }
  
  /* Smaller stat values */
  .media-2582 {
    font-size: 2rem !important;
  }
  
  /* Ensure score circles fit */
  .notice_hot_bcb6 {
    width: 100px !important;
    height: 100px !important;
    font-size: 2.5rem !important;
  }
  
  .tag-pressed-d34f {
    width: 140px !important;
    height: 140px !important;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .medium_ae68,
  .in-c1d9 {
    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: f414 */
.ghost-box-e6 {
  padding: 0.1rem;
  font-size: 12px;
  line-height: 1.1;
}
