/*
 * Layout fixes for the web build. Loaded after the game's own stylesheets (a <link> at the end of <head>), so
 * these win without touching the shared css/ that the Android app also ships.
 *
 * Home is drawn as one screen with no scrolling (css/royal.css, "HOME: one screen"). That holds on a tall Android
 * phone, but an iPhone browser tab only has about 660px of height once Safari's toolbars are showing, and the
 * "coming to iPhone" strip and the family row take more. The 2x2 tiles then shrank below their own content and
 * overlapped, and the bottom row slid under the tab bar. Here the tiles keep a minimum height and Home scrolls
 * when it does not fit; where it does fit (tall phones, the Home Screen icon), nothing changes.
 */
html #screen-menu .menu-wrap {
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  scrollbar-width: none;
}
html #screen-menu .menu-wrap::-webkit-scrollbar { display: none; }
html #screen-menu .mode-row.is-grid {
  flex: 1 0 auto;
  min-height: calc(2 * 104px + 52px + 2 * var(--h-gap, 8px));
  grid-template-rows: minmax(104px, 1fr) minmax(104px, 1fr) 52px;
}
html #screen-menu .mode-row.is-grid .mode-tile.is-big { min-height: 104px; }

/*
 * Friends: the friends and families list is a panel that scrolls inside the screen, with the Share Code and Enter
 * Code panels fixed under it. On a short browser tab the list got about 300px, so "Your Families" and the Create /
 * Join buttons sat out of sight inside a small scroller. Below 820px of height the whole column scrolls as one page
 * instead, and the list takes the height it needs.
 */
@media (max-height: 820px) {
  html #screen-friends .scroller { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  html #screen-friends .scroller > .panel:has(> #friends-view) { flex: 0 0 auto; min-height: auto; overflow: visible; }
}
