/* Phone layout: the home page scrolls like a normal list instead of paging. */
@media (max-width: 680px) {
  body:has(#home:not([hidden])) { height: auto; min-height: calc(100dvh / var(--site-zoom, 1)); }
  #home:not([hidden]) { flex: none; padding-bottom: 28px; }
  #home #games { container-type: normal; }
  #home #games .games { --tile-height: 116px; grid-auto-rows: var(--tile-height); }
  #home #games .game-card .game::after { height: 92px; }
  #home #games .game h3 { align-self: end; font-size: 15px; }
  #home #games .game small {
    display: block;
    grid-column: 2;
    align-self: start;
    width: fit-content;
    max-width: 100%;
    margin: 0;
    padding: 3px 6px;
    border-radius: 6px;
    background: #ffffff7a;
    color: #30203f;
    font-size: 11px;
    line-height: 1.25;
  }
  #home .library-pager { display: none !important; }
  #home .section-head button, #home .game-view-picker button { min-height: 44px; }
  #home .game-pin { min-width: 44px; min-height: 44px; }
}

/* Phone game screens: less chrome above the game, actions always in reach. */
@media (max-width: 680px) {
  body > .game-controls-bar { display: none; }
  #siteSidebar .game-background-picker { display: grid; gap: 6px; margin-top: 14px; font-weight: 700; }
  #siteSidebar .game-background-picker select { min-height: 44px; font: inherit; }

  .room-toolbar { flex-direction: row; flex-wrap: nowrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
  .room-toolbar > div:first-child { display: grid; gap: 2px; min-width: 0; }
  .room-toolbar > div:last-child { display: flex; gap: 6px; flex: none; }
  .room-toolbar button { min-height: 40px; padding: 6px 10px; font-size: 13px; }
  .room-toolbar small { font-size: 11px; }

  #play .stage-card, #roomMain .stage-card { min-height: 0; padding: 18px 12px 0; }
  #play .stage-card > .actions:not(:empty), #roomMain .stage-card > .actions:not(:empty) {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 14px -12px 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background-color: inherit;
    background-image: none;
    box-shadow: 0 -8px 16px -12px #25204640;
    border-top: 1px solid #25204626;
    border-radius: 0 0 inherit inherit;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
  #play .stage-card > .actions button, #roomMain .stage-card > .actions button { min-height: 46px; }
  #play .stage-card > .actions:empty, #roomMain .stage-card > .actions:empty { padding-bottom: 12px; }

  #roomMain .stage-card > .actions [data-room-action="lobby"] {
    order: 9;
    min-height: 36px;
    padding: 4px 10px;
    font-size: 12px;
    background: transparent;
    box-shadow: none;
  }
  .property-space b { font-size: 9px; line-height: 1.15; }
  .property-space small { font-size: 9px; }
}

/* All screens: the home page shows every game at once and scrolls. */
body:has(#home:not([hidden])) { height: auto; min-height: calc(100dvh / var(--site-zoom, 1)); }
#home:not([hidden]) { flex: none; padding-bottom: 28px; }
#home #games { container-type: normal; }
#home #games .games { grid-auto-rows: var(--tile-height); }
#home .library-pager { display: none !important; }
