/* Mobile header audit: use space and wrapping, never smaller type or scrolling.
   Load after the view-specific styles so dialogs and inline tables agree. */
@media (max-width: 760px) {
  html[data-theme][data-table-navigation] body[data-palette] :is(#main, dialog)
  :is(#strength-table, #global-table, table) thead th {
    min-width: 0;
    height: auto;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    line-height: 1.4;
    padding-block: 12px;
  }

  html[data-theme][data-table-navigation] body[data-palette] :is(#main, dialog)
  :is(#strength-table, #global-table, table) thead th button {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    height: auto;
    padding: 4px 2px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    line-height: 1.4;
  }

  /* Flex labels and date captions must be allowed to use the same cell width.
     Keep their existing display/visibility rules and their original font sizes. */
  html[data-theme][data-table-navigation] body[data-palette] :is(#main, dialog)
  :is(#strength-table, #global-table, table) thead th :is(span, small) {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  /* Reserve more of each standard row for the three rating headers. Grouped
     rows retain their own full-width name row and labelled metric cells. */
  html[data-theme][data-table-navigation] body[data-palette] #main
  :is(#strength-table, #global-table, .snapshot-table)[data-layout=table]
  :is(th, td):nth-child(2) {
    width: 34%;
  }

  /* Sorting arrows should not squeeze a radar heading's longest word. */
  html[data-theme] body[data-palette] :is(#main, dialog)
  .radar-table thead button > span[aria-hidden=true] {
    display: block;
    margin-top: 3px;
  }

  /* A single long club name can also be a chart's column heading. These
     supporting tables must wrap within their panel instead of widening it. */
  html[data-theme] body[data-palette] :is(#main, dialog)
  :is(.history-table, .club-metric-table, .chart-values table, .radar-table,
      .collection-data-table, .collection-values table) {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    table-layout: fixed;
  }
}

@media (max-width: 360px) {
  html[data-theme][data-table-navigation] body[data-palette] #main
  :is(#strength-table, #global-table, .snapshot-table)[data-layout=table]
  :is(th, td):nth-child(2) {
    width: 30%;
  }
}
