/* Home Friends workspace and add-friend dialog. Shared friend/DM rows and
   player-search results retain their shared owners. Content flow is the default;
   only the full desktop dashboard reserves a fixed-height Friends workspace. */
#homePage > #friendsArea{
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

#friendsPanel{
  display: flex;
  height: auto;
  min-height: 0;
  flex-direction: column;
  overflow: visible;
}

.friends-title-row{
  flex: 0 0 auto;
  margin-bottom: 10px;
}

.friends-add-button{
  flex: 0 0 38px;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  line-height: 1;
}

.friends-add-button svg{
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.friends-search-field{
  flex: 0 0 auto;
  margin: 0 0 8px;
}

.friends-offline-toggle{
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  align-self: flex-start;
  gap: 7px;
  margin: 0 2px 8px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.friends-offline-toggle input{
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

#homePage #friendsList{
  flex: 0 0 auto;
  min-height: 0;
  max-height: min(60dvh, 520px);
  align-content: start;
  grid-auto-rows: max-content;
  padding-right: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

/* The screen-sized launcher/chat composition also uses content flow, including
   above the stacked-sidebar boundary. Do not give its secondary panels the
   desktop fixed-height contract just because the window is wider than 1100px. */
@media (min-width: 1101px){
  body:not(.rx-landscape-home) #homePage > #friendsArea{
    height: 661px;
    min-height: 661px;
    max-height: 661px;
    overflow: hidden;
  }

  body:not(.rx-landscape-home) #friendsPanel{
    height: 100%;
    overflow: hidden;
  }

  body:not(.rx-landscape-home) #homePage #friendsList{
    flex: 1 1 auto;
    max-height: none;
    overscroll-behavior: contain;
  }
}

@media (max-width: 1100px){
  .friends-offline-toggle{
    min-height: var(--rx-size-tap-min);
  }

  .friends-add-button{
    width: var(--rx-size-tap-min);
    min-width: var(--rx-size-tap-min);
    height: var(--rx-size-tap-min);
    min-height: var(--rx-size-tap-min);
    flex-basis: var(--rx-size-tap-min);
  }
}

#homePage #friendsList .friend-row{
  min-height: 62px;
}

#homePage #friendsList .friend-presence-heading{
  padding: 5px 4px 1px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .08em;
  line-height: 1.2;
  text-transform: uppercase;
}

#homePage #friendsList .friend-presence-heading:first-child{
  padding-top: 1px;
}

#homePage #friendsList .friend-row.is-offline{
  opacity: .55;
  filter: saturate(.55);
  background: color-mix(in srgb, var(--panel3) 72%, var(--bg) 28%);
}

#homePage #friendsList .friend-row.is-offline:hover{
  opacity: .76;
  filter: saturate(.7) brightness(1.03);
}

.add-friend-dialog{
  box-sizing: border-box;
  display: grid;
  width: min(540px, calc(100vw - 28px));
  max-height: min(650px, calc(100dvh - 28px));
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border2);
  border-radius: 18px;
  color: var(--text);
  background: var(--rx-color-overlay-solid);
  box-shadow: var(--rx-shadow-overlay);
  overflow: hidden;
}

.add-friend-dialog-header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.add-friend-dialog-header h2,
.add-friend-dialog-header p{
  margin: 0;
}

.add-friend-dialog .player-search-results{
  min-height: 72px;
  max-height: min(410px, calc(100dvh - 220px));
  padding-right: 3px;
  overflow-y: auto;
  scrollbar-width: thin;
}

@supports (-webkit-hyphens: none){
  #homePage #friendsList .friend-row.is-offline{
    background: var(--panel3);
  }
}

@media (max-width: 560px){
  #homePage #friendsList .friend-row{
    min-height: 56px;
    padding: 7px 8px;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  #homePage #friendsList .friend-main{
    width: auto;
    gap: 8px;
  }

  #homePage #friendsList .friend-avatar-wrap{
    width: 36px;
    height: 36px;
  }

  #homePage #friendsList .friend-actions{
    width: auto;
    gap: 4px;
    flex-wrap: nowrap;
  }

  #homePage #friendsList .friend-challenge-btn{
    min-width: var(--rx-size-tap-min);
    padding: 6px 7px;
  }
}
