/* ============================================
   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 (.top_4036) is a descendant of
   .large-f00b (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.summary_silver_d8b2 {
  max-width: none !important;
}

/* Fix for any potential overflow elements */
/* NOTE: ".panel-brown-cad4" 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.aside-0a6d so it can't cause
   horizontal overflow anyway. */
.image_ca61,
.input-a44c,
.chip_motion_edd7,
.table-46c9,
.thumbnail-hot-40fb,
.over_b777,
.row-narrow-c10f,
.row-pressed-bc68,
.blue_6da1,
.active-hard-2424,
.stone_3acd {
  max-width: 100%;
  overflow-x: hidden;
}

/* Header mobile optimizations */
@media (max-width: 768px) {
  .block_lower_b478 {
    padding: 8px 0;
  }
  
  .highlight_solid_e835 img {
    height: 28px;
    width: auto;
  }
  
  .caption-paper-0e42 {
    display: none !important;
  }
  
  .alert_fresh_f08a {
    padding: 6px 12px !important;
    font-size: 0.8125rem !important;
    white-space: nowrap;
  }
  
  .alert_fresh_f08a svg {
    width: 14px;
    height: 14px;
  }
  
  .dirty-bf5e {
    padding: 6px;
  }
  
  .link_ff95 {
    width: 20px;
  }
}

/* Mobile-specific fixes (phones) */
@media (max-width: 768px) {
  /* Force single column layout */
  .chip_motion_edd7,
  .input-a44c,
  .table-46c9,
  .thumbnail-hot-40fb,
  .table_4d05,
  .message_b026,
  .box-tall-9ebd,
  .content_short_58ee,
  .secondary-1d27,
  .description-medium-4f17,
  .easy_e517 {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  
  /* Ensure tables are scrollable */
  .right-6b8a,
  .alert_97fe {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix any fixed-width elements */
  .medium_0bbb,
  .shadow-282a,
  .west_7098,
  .accordion-3373,
  .header_steel_16ab,
  .section-focused-ddf3,
  .black-c986 {
    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 */
  .glass_bcab,
  .first-cb41,
  .slider_active_ff86,
  .block_b0f7,
  .accent_5184 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Fix text overflow */
  h1, h2, h3, h4, h5, h6,
  p, span, a, li, td, th,
  .paper_a925,
  .input-full-f4d9,
  .thumbnail_current_9bcd,
  .hover_9c3e {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
  }
  
  /* Fix code blocks */
  pre,
  code,
  .nav-in-771a,
  .sidebar_fixed_811e {
    overflow-x: auto !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
  }
  
  /* Fix buttons */
  .icon_dark_1ea9,
  .dim-770a,
  .in-b7c4,
  .mini-87fc {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Fix flex containers */
  .gradient-2364,
  .sidebar_9827,
  .description_static_5560,
  .preview_advanced_6ace,
  .smooth-fe75,
  .component-5a60 {
    flex-wrap: wrap !important;
    width: 100% !important;
  }
}

/* Extra small screens (≤480px) */
@media (max-width: 480px) {
  /* Even more aggressive fixes */
  * {
    max-width: 100vw !important;
  }
  
  section,
  .glass_bcab,
  .first-cb41,
  .block_b0f7 {
    max-width: none !important;
  }
  
  .panel-brown-cad4 {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  
  /* Reduce font sizes if needed */
  .paper_a925 {
    font-size: 1.5rem !important;
  }
  
  .input-full-f4d9 {
    font-size: 1.375rem !important;
  }
  
  /* Stack everything */
  .short-aaf1,
  .backdrop_focused_378f {
    flex-direction: column !important;
  }
  
  /* Smaller stat values */
  .thumbnail_current_9bcd {
    font-size: 2rem !important;
  }
  
  /* Ensure score circles fit */
  .border-277d {
    width: 100px !important;
    height: 100px !important;
    font-size: 2.5rem !important;
  }
  
  .background-fresh-c380 {
    width: 140px !important;
    height: 140px !important;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .glass_bcab,
  .block_b0f7 {
    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: f7ab */
.phantom-card-y7 {
  padding: 0.3rem;
  font-size: 10px;
  line-height: 1.1;
}
