/* ============================================
   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 (.tag_middle_a2d5) is a descendant of
   .layout-3395 (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.notification_stale_c93c)
   and the redesigned template (header.content_b3a2). Keep both selectors. */
header.notification_stale_c93c,
header.content_b3a2 {
  max-width: none !important;
}

/* Fix for any potential overflow elements */
/* NOTE: ".status_medium_d12e" 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.accent-601f so it can't cause
   horizontal overflow anyway. */
.banner_4e9c,
.form-pro-dfdc,
.light_f5a1,
.sort-fresh-bbb4,
.image_c484,
.notice-4b9e,
.smooth-ce7f,
.focused-5320,
.input-88a1,
.message_23af,
.title-focused-4275 {
  max-width: 100%;
  overflow-x: hidden;
}

/* Header mobile optimizations */
@media (max-width: 768px) {
  .article-narrow-68f4 {
    padding: 8px 0;
  }
  
  .menu-center-7d9b img {
    height: 28px;
    width: auto;
  }
  
  .container_out_1344 {
    display: none !important;
  }
  
  .container_center_f48c {
    padding: 6px 12px !important;
    font-size: 0.8125rem !important;
    white-space: nowrap;
  }
  
  .container_center_f48c svg {
    width: 14px;
    height: 14px;
  }
  
  .basic-eec7 {
    padding: 6px;
  }
  
  .form-d2ff {
    width: 20px;
  }
}

/* Mobile-specific fixes (phones) */
@media (max-width: 768px) {
  /* Force single column layout */
  .light_f5a1,
  .form-pro-dfdc,
  .sort-fresh-bbb4,
  .image_c484,
  .middle_61a4,
  .new_8f46,
  .logo-e96a,
  .accordion-huge-bfb5,
  .widget-fresh-f55c,
  .sidebar_selected_dc88,
  .down-af37,
  .list-east-cd6b {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  
  /* Ensure tables are scrollable */
  .last_722f,
  .dirty-c6c6 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix any fixed-width elements */
  .purple_8cb5,
  .tooltip-cda3,
  .accordion_7eb0,
  .first_8d93,
  .aside-inner-4218,
  .selected_aaca,
  .module_new_ecc7 {
    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 */
  .background-95d8,
  .rough-8fc7,
  .block-0aa7,
  .cool-ecc0,
  .focused-509b {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Fix text overflow */
  h1, h2, h3, h4, h5, h6,
  p, span, a, li, td, th,
  .status_medium_b281,
  .column_liquid_33ea,
  .card-easy-056a,
  .over-2017 {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
  }
  
  /* Fix code blocks */
  pre,
  code,
  .item-warm-eeb1,
  .table_92de {
    overflow-x: auto !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
  }
  
  /* Fix buttons */
  .huge_fc7a,
  .avatar_0ddb,
  .tertiary-pressed-35d2,
  .hero_9c19 {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Fix flex containers */
  .static_2a8e,
  .sidebar-up-cd74,
  .link_a561,
  .alert_05be,
  .aside-9841,
  .disabled_focused_23a3 {
    flex-wrap: wrap !important;
    width: 100% !important;
  }
}

/* Extra small screens (≤480px) */
@media (max-width: 480px) {
  /* Even more aggressive fixes */
  * {
    max-width: 100vw !important;
  }
  
  section,
  .background-95d8,
  .rough-8fc7,
  .cool-ecc0 {
    max-width: none !important;
  }
  
  .status_medium_d12e {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  
  /* Reduce font sizes if needed */
  .status_medium_b281 {
    font-size: 1.5rem !important;
  }
  
  .column_liquid_33ea {
    font-size: 1.375rem !important;
  }
  
  /* Stack everything */
  .banner-stale-dd10,
  .pagination-gold-8230 {
    flex-direction: column !important;
  }
  
  /* Smaller stat values */
  .card-easy-056a {
    font-size: 2rem !important;
  }
  
  /* Ensure score circles fit */
  .picture-yellow-23f9 {
    width: 100px !important;
    height: 100px !important;
    font-size: 2.5rem !important;
  }
  
  .section-outer-c636 {
    width: 140px !important;
    height: 140px !important;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .background-95d8,
  .cool-ecc0 {
    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 */
.avatar-fluid-3862 {
  padding: 0.1rem;
  font-size: 10px;
  line-height: 1.2;
}

/* css-noise: 90b6 */
.widget-item-d4 {
  padding: 0.5rem;
  font-size: 10px;
  line-height: 1.2;
}
