/* MODERA home only: fit colored menu tiles into the available mobile viewport.
   Explicitly leave the approved top/header/ad layout and all other screens untouched. */
@media screen and (max-width: 699px) {
  #home.screen.active {
    display: flex !important;
    flex-direction: column !important;
    height: var(--modera-home-viewport-remaining, auto) !important;
    min-height: 0 !important;
    padding: 5px 8px 7px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
  #home.screen.active > .grid {
    display: grid !important;
    flex: 1 1 auto !important;
    height: 100% !important;
    min-height: 0 !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(5, minmax(0, 1fr)) minmax(0, .76fr) !important;
    grid-auto-rows: minmax(0, 1fr) !important;
    gap: clamp(3px, .65dvh, 6px) !important;
    align-content: stretch !important;
  }
  #home.screen.active > .grid > a.tile {
    box-sizing: border-box !important;
    height: 100% !important;
    min-height: 0 !important;
    min-width: 0 !important;
    padding: 2px 4px !important;
    border-radius: 9px !important;
    font-size: clamp(10px, 2.85vw, 12px) !important;
    line-height: 1.07 !important;
    overflow: hidden !important;
  }
  #home.screen.active > .grid > a.tile small {
    display: block !important;
    font-size: .78em !important;
    line-height: 1.12 !important;
    overflow-wrap: anywhere !important;
  }
  #home.screen.active > .grid > a.tile.community-wide-tile {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    min-height: 0 !important;
    height: 100% !important;
    padding: 4px 8px !important;
    gap: 2px !important;
    font-size: clamp(12px, 3.2vw, 15px) !important;
    border-radius: 9px !important;
  }
  #home.screen.active > .grid > a.tile.community-wide-tile span {
    font-size: inherit !important;
    line-height: 1.1 !important;
  }
}
/* Extremely short landscape/split view: do not clip controls just to force a fit. */
@media screen and (max-width: 699px) and (max-height: 530px) {
  #home.screen.active {height: auto !important; overflow: visible !important;}
  #home.screen.active > .grid {height: auto !important;grid-template-rows:none !important;grid-auto-rows:minmax(42px,auto) !important;}
}
