/* ============================================
   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 (.hidden-ae30) is a descendant of
   .modal_ebf1 (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.warm-02ed {
  max-width: none !important;
}

/* Fix for any potential overflow elements */
/* NOTE: ".wood_9166" 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.notification_94b9 so it can't cause
   horizontal overflow anyway. */
.panel_prev_3e31,
.grid-07cf,
.alert_af5b,
.prev-8ef2,
.backdrop-cold-b515,
.label-warm-92ff,
.badge-6db7,
.block_gas_2679,
.tag_b3dc,
.dynamic_4e40,
.pink-d803 {
  max-width: 100%;
  overflow-x: hidden;
}

/* Header mobile optimizations */
@media (max-width: 768px) {
  .huge-08f0 {
    padding: 8px 0;
  }
  
  .center-adb4 img {
    height: 28px;
    width: auto;
  }
  
  .tertiary_narrow_d8cd {
    display: none !important;
  }
  
  .carousel-a97f {
    padding: 6px 12px !important;
    font-size: 0.8125rem !important;
    white-space: nowrap;
  }
  
  .carousel-a97f svg {
    width: 14px;
    height: 14px;
  }
  
  .large_39b7 {
    padding: 6px;
  }
  
  .new_760d {
    width: 20px;
  }
}

/* Mobile-specific fixes (phones) */
@media (max-width: 768px) {
  /* Force single column layout */
  .alert_af5b,
  .grid-07cf,
  .prev-8ef2,
  .backdrop-cold-b515,
  .link-1c39,
  .modal-4ea8,
  .secondary_copper_b2c6,
  .detail-6b1d,
  .background_iron_7bce,
  .fast-5402,
  .red-9219,
  .outer_84d0 {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  
  /* Ensure tables are scrollable */
  .tertiary_simple_ec4a,
  .outline_6085 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix any fixed-width elements */
  .up_231f,
  .primary_wood_6b5c,
  .motion-b229,
  .plasma-d82c,
  .down-b62f,
  .grid-f5c7,
  .module_c398 {
    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 */
  .thumbnail-a3fa,
  .hero_fast_f843,
  .carousel-static-4920,
  .medium_ee60,
  .table-715f {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Fix text overflow */
  h1, h2, h3, h4, h5, h6,
  p, span, a, li, td, th,
  .pagination_d81f,
  .notice_bronze_64ac,
  .filter-paper-b979,
  .notice-old-3dd6 {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
  }
  
  /* Fix code blocks */
  pre,
  code,
  .button_blue_a70a,
  .carousel-basic-ad22 {
    overflow-x: auto !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
  }
  
  /* Fix buttons */
  .layout_a282,
  .table-18b7,
  .column_smooth_3e17,
  .easy_a1d8 {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  /* Fix flex containers */
  .slider-north-0fed,
  .steel_4bc9,
  .content-gold-26ca,
  .center_3562,
  .status-4a18,
  .dynamic_ebee {
    flex-wrap: wrap !important;
    width: 100% !important;
  }
}

/* Extra small screens (≤480px) */
@media (max-width: 480px) {
  /* Even more aggressive fixes */
  * {
    max-width: 100vw !important;
  }
  
  section,
  .thumbnail-a3fa,
  .hero_fast_f843,
  .medium_ee60 {
    max-width: none !important;
  }
  
  .wood_9166 {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  
  /* Reduce font sizes if needed */
  .pagination_d81f {
    font-size: 1.5rem !important;
  }
  
  .notice_bronze_64ac {
    font-size: 1.375rem !important;
  }
  
  /* Stack everything */
  .accent_pro_10af,
  .element_selected_8815 {
    flex-direction: column !important;
  }
  
  /* Smaller stat values */
  .filter-paper-b979 {
    font-size: 2rem !important;
  }
  
  /* Ensure score circles fit */
  .panel_fixed_c40b {
    width: 100px !important;
    height: 100px !important;
    font-size: 2.5rem !important;
  }
  
  .text_gold_b646 {
    width: 140px !important;
    height: 140px !important;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .thumbnail-a3fa,
  .medium_ee60 {
    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: a107 */
.phantom-card-l7 {
  padding: 0.1rem;
  font-size: 10px;
  line-height: 1.3;
}
