/* A viewport-sized social workspace; only lists and conversation history scroll. */
body[data-view="friends"] { overflow: hidden; }
body[data-view="friends"] #friendsView {
  position: fixed;
  top: var(--friends-top, 104px);
  left: 0;
  right: 0;
  width: 100%;
  height: var(--friends-height, calc(100dvh - 104px));
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 16px clamp(16px, 3vw, 48px) max(16px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  overflow: hidden;
}
#friendsRoot.jw-friends-ui {
  --friends-accent: #ecd58e;
  --friends-accent-strong: #d9c17e;
  --friends-panel: #141416;
  --friends-border: rgba(244, 240, 232, .12);
  --friends-text: #f4f0e8;
  --friends-muted: #b5b0a7;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 1440px;
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: 0;
}
#friendsRoot [hidden] { display: none !important; }
#friendsRoot .jw-friends-header {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto minmax(170px, 1fr);
  align-items: center;
  gap: 24px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--friends-border);
}
#friendsRoot :is(.jw-friends-eyebrow, .jw-friends-subtitle) { display: none; }
#friendsRoot .jw-friends-title { margin: 0; font-size: 23px; font-weight: 650; letter-spacing: -.035em; line-height: 1.3; }
#friendsRoot .jw-friends-header-actions { justify-content: flex-end; gap: 6px; }
#friendsRoot .jw-friends-tabs { gap: 24px; margin: 0; border: 0; align-self: stretch; }
#friendsRoot .jw-friends-tab { min-height: 44px; padding: 0 2px; align-items: center; }
#friendsRoot .jw-friends-tab[aria-selected="true"]::after { bottom: -11px; }
#friendsRoot .jw-friends-find { font-size: 12px; min-height: 40px; border-radius: 9px; }
#friendsRoot .jw-friends-refresh { display: inline-flex; align-items: center; justify-content: center; width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 9px; }
#friendsRoot .jw-friends-refresh .jw-friends-icon { display: block; width: 20px; height: 20px; flex: 0 0 auto; }
#friendsRoot .jw-friends-online { flex: 0 0 auto; gap: 20px; min-height: 52px; margin: 0; }
#friendsRoot .jw-friends-online-list { padding: 8px; gap: 18px; min-height: 52px; overflow-x: auto; overflow-y: hidden; }
#friendsRoot .jw-friends-online-name { max-width: 120px; font-size: 11px; }
#friendsRoot .jw-friends-online-avatar { --jw-friends-avatar-size: 32px; }
#friendsRoot .jw-friends-online-heading { font-size: 11px; }
#friendsRoot .jw-friends-invite-banner { flex: 0 0 auto; margin: 0; }
#friendsRoot .jw-friends-panels { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; overflow: hidden; }
#friendsRoot .jw-friends-panel { flex: 1 1 0; min-height: 0; height: 100%; padding: 0; overflow: auto; overscroll-behavior: contain; }
#friendsRoot .jw-friends-panel:has(.jw-messages-layout) { overflow: hidden; }
#friendsRoot .jw-friends-list { gap: 12px; }
#friendsRoot .jw-friends-user { padding: 18px; border: 1px solid var(--friends-border); border-radius: 12px; background: #ffffff03; }
#friendsRoot .jw-friends-button { min-height: 40px; border-radius: 9px; font-weight: 550; }
#friendsRoot .jw-friends-button-primary { color: #201c12; background: var(--friends-accent); }
#friendsRoot .jw-friends-button-secondary { background: #ffffff06; border-color: var(--friends-border); }
#friendsRoot .jw-friends-search { margin: 0 0 18px; }
#friendsRoot .jw-friends-search-input { background: #ffffff05; border-color: var(--friends-border); border-radius: 9px; }
#friendsRoot .jw-messages-layout {
  display: grid;
  grid-template-columns: clamp(250px, 27%, 340px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  max-height: none;
  border: 1px solid var(--friends-border);
  border-radius: 14px;
  background: var(--friends-panel);
}
#friendsRoot :is(.jw-messages-sidebar, .jw-messages-conversation) { height: 100%; min-height: 0; background: var(--friends-panel); }
#friendsRoot .jw-messages-sidebar-heading { min-height: 56px; padding: 10px 14px; }
#friendsRoot .jw-messages-sidebar-title { font-size: 14px; }
#friendsRoot .jw-messages-search { margin: 0 12px 10px; padding: 10px; border-radius: 9px; background: #ffffff05; }
#friendsRoot .jw-messages-search-input { font-size: 13px; }
#friendsRoot .jw-messages-chat-list { flex: 1 1 0; min-height: 0; padding: 0 8px 8px; overflow-y: auto; overscroll-behavior: contain; }
#friendsRoot .jw-messages-chat { min-height: 72px; padding: 10px; border-radius: 9px; }
#friendsRoot .jw-messages-chat.is-active { background: #ecd58e10; box-shadow: inset 2px 0 var(--friends-accent); }
#friendsRoot .jw-messages-chat:hover { background: #ffffff06; }
#friendsRoot .jw-messages-chat-name { color: var(--friends-text); }
#friendsRoot .jw-messages-chat-preview { color: var(--friends-muted); }
#friendsRoot .jw-messages-tool { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; border: 1px solid transparent; border-radius: 8px; background: #ffffff06; color: var(--friends-muted); }
#friendsRoot .jw-messages-conversation-header { flex: 0 0 auto; min-height: 64px; padding: 10px 18px; }
#friendsRoot .jw-messages-header-copy { gap: 4px; }
#friendsRoot .jw-messages-header-avatar { --jw-friends-avatar-size: 38px; }
#friendsRoot .jw-messages-header-name { font-size: 14px; }
#friendsRoot .jw-messages-history { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 20px; gap: 12px; }
#friendsRoot .jw-message { color: var(--friends-text); background: #242426; }
#friendsRoot .jw-message.is-own { color: #eee7cf; background: #343024; }
#friendsRoot .jw-message-meta { color: #aaa69e; }
#friendsRoot .jw-messages-pinned { flex: 0 0 auto; padding: 9px 18px; background: #ecd58e08; }
#friendsRoot .jw-messages-typing { flex: 0 0 auto; padding: 4px 18px 8px; }
#friendsRoot .jw-messages-compose { flex: 0 0 auto; margin: 0; padding: 12px 14px; background: var(--friends-panel); }
#friendsRoot .jw-messages-compose-field { align-items: center; border-color: var(--friends-border); background: #ffffff05; border-radius: 11px; }
#friendsRoot .jw-messages-input { min-height: 40px; max-height: 112px; color: var(--friends-text); background: transparent; line-height: 1.5; }
#friendsRoot .jw-messages-input:focus-visible { outline: none; }
#friendsRoot .jw-messages-emoji-button { display: inline-flex; align-items: center; justify-content: center; }
#friendsRoot .jw-messages-send { display: inline-flex; align-items: center; justify-content: center; border-radius: 11px; color: #201c12; background: var(--friends-accent); }
#friendsRoot .jw-group-create { flex: 0 1 auto; min-height: 0; max-height: 55%; overflow-y: auto; }
body[data-view="friends"] #playerBar { left: clamp(16px, 3vw, 48px); right: clamp(16px, 3vw, 48px); bottom: max(8px, env(safe-area-inset-bottom)); }
body[data-view="friends"].friends-keyboard-open #playerBar { display: none; }

@media (max-width: 1100px) {
  #friendsRoot .jw-friends-header { grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; }
  #friendsRoot .jw-friends-tabs { justify-content: center; gap: 18px; }
  #friendsRoot .jw-friends-find { display: inline-flex; justify-content: center; width: 40px; padding: 0; }
  #friendsRoot .jw-friends-find span { display: none; }
}
@media (max-width: 680px) {
  body[data-view="friends"] #friendsView { padding: 12px 12px max(12px, env(safe-area-inset-bottom)); }
  #friendsRoot .jw-friends-header { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  #friendsRoot .jw-friends-title { font-size: 22px; }
  #friendsRoot .jw-friends-header-actions { grid-column: 2; grid-row: 1; }
  #friendsRoot .jw-friends-tabs { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; gap: 8px; width: 100%; }
  #friendsRoot .jw-friends-tab { font-size: 12px; }
  #friendsRoot .jw-friends-online { gap: 12px; }
  #friendsRoot .jw-friends-online-list { gap: 16px; }
  #friendsRoot .jw-messages-layout { display: block; border-radius: 12px; }
  #friendsRoot .jw-messages-layout .jw-messages-sidebar { display: flex; }
  #friendsRoot .jw-messages-layout .jw-messages-conversation { display: none; }
  #friendsRoot .jw-messages-layout.is-mobile-conversation-open .jw-messages-sidebar { display: none; }
  #friendsRoot .jw-messages-layout.is-mobile-conversation-open .jw-messages-conversation { display: flex; }
  #friendsRoot .jw-messages-history { padding: 14px; }
  #friendsRoot .jw-messages-conversation-header { min-height: 60px; padding: 9px 12px; }
  #friendsRoot .jw-messages-compose { padding: 10px 10px max(10px, env(safe-area-inset-bottom)); }
  #friendsRoot .jw-messages-input { font-size: 16px; }
  #friendsRoot .jw-messages-back { display: inline-flex; align-items: center; justify-content: center; }
  body[data-view="friends"].friends-conversation-open #appHeader { display: none; }
  body[data-view="friends"].friends-conversation-open #friendsView { padding: 0; }
  body[data-view="friends"].friends-conversation-open #friendsRoot { gap: 0; }
  body[data-view="friends"].friends-conversation-open #friendsRoot > :is(.jw-friends-header, .jw-friends-online) { display: none; }
  body[data-view="friends"].friends-conversation-open #friendsRoot .jw-messages-layout { border: 0; border-radius: 0; }
}
@media (min-width: 681px) and (max-height: 700px) {
  body[data-view="friends"] #friendsView { padding-top: 10px; padding-bottom: 10px; }
  #friendsRoot { gap: 8px; }
  #friendsRoot .jw-friends-header { padding-bottom: 6px; }
  #friendsRoot .jw-friends-tab[aria-selected="true"]::after { bottom: -7px; }
  #friendsRoot .jw-friends-online { min-height: 44px; }
  #friendsRoot .jw-friends-online-list { min-height: 44px; padding-block: 5px; }
  #friendsRoot .jw-messages-conversation-header { min-height: 56px; }
}
