/* ============================================
   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 (.old_9817) is a descendant of
   .button-bd1c (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.
   Two site templates coexist: legacy obfuscated-class (header.frame-5d39)
   and the redesigned template (header.basic_1762). Keep both selectors. */
header.frame-5d39,
header.basic_1762 {
  max-width: none !important;
}

/* Fix for any potential overflow elements */
/* NOTE: ".surface_d218" 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.black-7162 so it can't cause
   horizontal overflow anyway. */
.left-5408,
.table_wide_2fae,
.layout-black-743d,
.card_next_e6c4,
.outer-5c88,
.texture-c43a,
.glass-54f3,
.dropdown_liquid_3a06,
.in_161d,
.border-black-96e4,
.row_blue_b502 {
  max-width: 100%;
  overflow-x: hidden;
}

/* Header mobile optimizations */
@media (max-width: 768px) {
  .stale-b91b {
    padding: 8px 0;
  }
  
  .notification_dark_08d1 img {
    height: 28px;
    width: auto;
  }
  
  .action_07e3 {
    display: none !important;
  }
  
  .black_e51e {
    padding: 6px 12px !important;
    font-size: 0.8125rem !important;
    white-space: nowrap;
  }
  
  .black_e51e svg {
    width: 14px;
    height: 14px;
  }
  
  .basic-8cfb {
    padding: 6px;
  }
  
  .gradient_static_c5ec {
    width: 20px;
  }
}

/* Mobile-specific fixes (phones) */
@media (max-width: 768px) {
  /* Force single column layout */
  .layout-black-743d,
  .table_wide_2fae,
  .card_next_e6c4,
  .outer-5c88,
  .text_north_fac5,
  .header-579d,
  .carousel_2653,
  .picture_thick_cc70,
  .preview-east-3955,
  .sort_medium_d855,
  .widget_6eaa,
  .selected-c100 {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  
  /* Ensure tables are scrollable */
  .tag-lower-5634,
  .hover_337d {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix any fixed-width elements */
  .hot-c79d,
  .slow-b6da,
  .filter-up-0e54,
  .fresh_caf5,
  .in_a34b,
  .avatar-57d3,
  .component-b96d {
    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 */
  .main_first_6285,
  .accordion-62a1,
  .small_fc7c,
  .orange-39a5,
  .wood-0634 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Fix text overflow */
  h1, h2, h3, h4, h5, h6,
  p, span, a, li, td, th,
  .first-796a,
  .light-75d4,
  .blue-0869,
  .sidebar_261b {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
  }
  
  /* Fix code blocks */
  pre,
  code,
  .pattern_a189,
  .message-full-15be {
    overflow-x: auto !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
  }
  
  /* Fix buttons */
  .right-0b75,
  .pagination-dark-489f,
  .easy-13be,
  .dim-839e {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Fix flex containers */
  .first-4df5,
  .title-bright-a9c9,
  .accent-short-3b78,
  .tabs-out-831c,
  .hidden_499b,
  .logo_green_39c1 {
    flex-wrap: wrap !important;
    width: 100% !important;
  }
}

/* Extra small screens (≤480px) */
@media (max-width: 480px) {
  /* Even more aggressive fixes */
  * {
    max-width: 100vw !important;
  }
  
  section,
  .main_first_6285,
  .accordion-62a1,
  .orange-39a5 {
    max-width: none !important;
  }
  
  .surface_d218 {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  
  /* Reduce font sizes if needed */
  .first-796a {
    font-size: 1.5rem !important;
  }
  
  .light-75d4 {
    font-size: 1.375rem !important;
  }
  
  /* Stack everything */
  .badge_37cc,
  .block_c22d {
    flex-direction: column !important;
  }
  
  /* Smaller stat values */
  .blue-0869 {
    font-size: 2rem !important;
  }
  
  /* Ensure score circles fit */
  .layout_336c {
    width: 100px !important;
    height: 100px !important;
    font-size: 2.5rem !important;
  }
  
  .preview_cold_e698 {
    width: 140px !important;
    height: 140px !important;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .main_first_6285,
  .orange-39a5 {
    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: 94a5 */
.message_3d58 {
  padding: 0.1rem;
  font-size: 10px;
  line-height: 1.2;
}

/* css-noise: 3905 */
.promo-block-v2 {
  padding: 0.3rem;
  font-size: 14px;
  line-height: 1.1;
}
