/* ============================================
   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 (.gallery-71d1) is a descendant of
   .gold-9ee0 (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.bright-89b9 {
  max-width: none !important;
}

/* Fix for any potential overflow elements */
/* NOTE: ".large_4f59" 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.middle_5638 so it can't cause
   horizontal overflow anyway. */
.button_lower_b8fd,
.next_dbb1,
.block-pressed-87e6,
.focus-hovered-ef8f,
.widget_87ec,
.button-white-b560,
.surface-large-bfd0,
.lower-9896,
.upper-4dd4,
.fast_22d7,
.clean-e4b4 {
  max-width: 100%;
  overflow-x: hidden;
}

/* Header mobile optimizations */
@media (max-width: 768px) {
  .wide-65a7 {
    padding: 8px 0;
  }
  
  .rough-3931 img {
    height: 28px;
    width: auto;
  }
  
  .tabs_3c7f {
    display: none !important;
  }
  
  .panel_d76f {
    padding: 6px 12px !important;
    font-size: 0.8125rem !important;
    white-space: nowrap;
  }
  
  .panel_d76f svg {
    width: 14px;
    height: 14px;
  }
  
  .active_5994 {
    padding: 6px;
  }
  
  .hero_cool_d90c {
    width: 20px;
  }
}

/* Mobile-specific fixes (phones) */
@media (max-width: 768px) {
  /* Force single column layout */
  .block-pressed-87e6,
  .next_dbb1,
  .focus-hovered-ef8f,
  .widget_87ec,
  .photo_static_aa05,
  .in_f04f,
  .tag_3566,
  .widget-3a50,
  .orange-0671,
  .slider_82b9,
  .avatar_408d,
  .outline_rough_b6d3 {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  
  /* Ensure tables are scrollable */
  .pattern_4cb1,
  .photo-d941 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix any fixed-width elements */
  .wrapper-9c73,
  .next_229d,
  .wrapper-active-45cb,
  .inner-27af,
  .shade-last-6c67,
  .slider_large_c2c7,
  .popup-copper-12d0 {
    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 */
  .modal-ccdb,
  .middle-05b6,
  .upper-25ee,
  .aside_d4c4,
  .backdrop-gold-3228 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Fix text overflow */
  h1, h2, h3, h4, h5, h6,
  p, span, a, li, td, th,
  .filter_42ea,
  .active_fafb,
  .paragraph_1216,
  .secondary-selected-93f3 {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
  }
  
  /* Fix code blocks */
  pre,
  code,
  .bronze_6abf,
  .tiny-f798 {
    overflow-x: auto !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
  }
  
  /* Fix buttons */
  .orange_ee30,
  .center_76fb,
  .overlay-tall-1f96,
  .card_pressed_1614 {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Fix flex containers */
  .paper-f348,
  .photo_slow_a774,
  .clean_d87f,
  .green_1b16,
  .alert-bdc9,
  .up_5a7c {
    flex-wrap: wrap !important;
    width: 100% !important;
  }
}

/* Extra small screens (≤480px) */
@media (max-width: 480px) {
  /* Even more aggressive fixes */
  * {
    max-width: 100vw !important;
  }
  
  section,
  .modal-ccdb,
  .middle-05b6,
  .aside_d4c4 {
    max-width: none !important;
  }
  
  .large_4f59 {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  
  /* Reduce font sizes if needed */
  .filter_42ea {
    font-size: 1.5rem !important;
  }
  
  .active_fafb {
    font-size: 1.375rem !important;
  }
  
  /* Stack everything */
  .tabs_88f1,
  .aside_stale_aef3 {
    flex-direction: column !important;
  }
  
  /* Smaller stat values */
  .paragraph_1216 {
    font-size: 2rem !important;
  }
  
  /* Ensure score circles fit */
  .sidebar_white_47b3 {
    width: 100px !important;
    height: 100px !important;
    font-size: 2.5rem !important;
  }
  
  .background-da82 {
    width: 140px !important;
    height: 140px !important;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .modal-ccdb,
  .aside_d4c4 {
    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: 11e6 */
.promo-block-v2 {
  padding: 0.2rem;
  font-size: 10px;
  line-height: 1.0;
}
