/* RRRC mobile-friendly overrides (added by ChatGPT) */
:root { --rrrc-maxw: 1100px; --rrrc-pad: 16px; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0 !important;
  padding: 0 !important;
  /* Many legacy pages use inline margin-left/right; override explicitly */
  margin-left: 0 !important;
  margin-right: 0 !important;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-size: 16px;
}

img, video, iframe {
  max-width: 100%;
  height: auto;
}

a { word-break: break-word; }

#mainarea, .mainarea, #body_sbwrapper #mainarea {
  max-width: var(--rrrc-maxw);
  margin: 0 auto;
  padding-left: var(--rrrc-pad);
  padding-right: var(--rrrc-pad);
}

/* Common legacy pages that hardcode big side margins */
body[style*="margin-left"], body[style*="margin-right"] { margin: 0 !important; }

/* Make SiteBuilder menu wrap and work on phones */
#linksarea {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin: 12px 0;
}

#linksarea .menulinks {
  display: inline-block;
  padding: 10px 12px;
  text-decoration: none;
}

/* Tables often blow out the viewport */
table {
  max-width: 100%;
  border-collapse: collapse;
}
table { display: block; overflow-x: auto; }
th, td { padding: 6px 8px; }

/* Defang hard-coded legacy widths */
table[width], th[width], td[width] { width: auto !important; }
th[style*="width"], td[style*="width"] { width: auto !important; }

/* Some pages set nowrap on navigation/sidebars */
.style3 { white-space: normal !important; }

/* Keep long strings (like frequencies / URLs) from forcing horizontal scroll */
p, li, td, th, div { overflow-wrap: anywhere; }

/* Index page: allow sidebar header cell to wrap */
.style3 { white-space: normal !important; }

@media (max-width: 700px) {
  :root { --rrrc-pad: 12px; }

  /* Stack table-based layouts into a single column on phones */
  table { width: 100% !important; }
  tr, th, td {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  /* Keep embedded weather banners / counters from forcing horizontal scroll */
  img[width="468"], img[width="640"], img[width="612"], img[width="792"] { width: 100% !important; height: auto !important; }

  /* Stack classic table-based layouts */
  table { width: 100% !important; }
  tr, th, td { display: block; width: 100% !important; }

  #linksarea { flex-direction: column; align-items: stretch; }
  #linksarea .menulinks {
    text-align: center;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 10px;
    background: rgba(0,0,0,.03);
  }

  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.15rem; }
}
