/* Multi-family: the Friends tab's "Your Families" section, the family switcher and the
   create / join forms. Added for docs/multi-family.md; kept out of royal.css on purpose. */

/* Section headers inside the one Friends list. */
#friends-view .list-head {
  margin: 14px 0 8px; font-family: var(--serif, 'Lora', Georgia, serif); font-weight: 600; font-size: 17px;
  letter-spacing: 0; text-transform: none; color: var(--ink, #f4e7c9); display: flex; align-items: center; gap: 6px;
}
#friends-view .list-head[hidden] { display: none; }
#friends-view .list-head:first-child, #friends-view .fam-filter + #friends-block .list-head { margin-top: 12px; }
#friends-view .list-count { font-family: var(--sans, 'Nunito', system-ui, sans-serif); font-size: 13px; font-weight: 700; color: var(--ink-2, #bba98a); }
#friends-view .list-head .badge { position: static; margin-left: auto; }
#friends-view .fam-filter { margin-bottom: 4px; }
#friends-block[hidden], #families-block[hidden] { display: none; }
#families-block { margin-top: 6px; }
#friends-block + #families-block { border-top: 1px solid var(--hair-soft, rgba(255, 238, 190, .14)); margin-top: 16px; padding-top: 2px; }

.family-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.family-actions .btn { min-height: 46px; padding-inline: 10px; }
#families-cap { margin-top: 8px; }

/* Which family this screen (and any war) speaks for. */
.fam-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px; scrollbar-width: none; }
.fam-chips::-webkit-scrollbar { display: none; }
.fam-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 12px 4px 6px; border-radius: 999px;
  border: 1px solid var(--hair-soft, rgba(255, 238, 190, .22)); background: rgba(0, 0, 0, .18); color: var(--ink, #f4e7c9);
  font: 700 13.5px var(--sans, 'Nunito', system-ui, sans-serif); max-width: 70vw; position: relative;
}
.fam-chip > span:last-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fam-chip .fam-chip-crest { width: 28px; height: 28px; flex: 0 0 28px; }
.fam-chip.is-on { border-color: var(--gold-satin, #e4b860); background: rgba(228, 184, 96, .14); color: #ffe6a0; }
.fam-chip .badge { position: absolute; top: -2px; right: -2px; }

#screen-family .lobby-share-row + .lobby-share-row { margin-top: 8px; }
#family-manage .lobby-share-row { margin-top: 10px; }
#wc-as { margin: 0 0 6px; }
#wc-as .crest-img { display: inline-block; width: 22px; height: 22px; vertical-align: -6px; }
#fm-switch { margin: 0 0 8px; }

/* ===== Family members as round faces, and the family icon with its online count ===== */
/* Friends tab: under each family's row, its members side by side, sliding sideways when they do not fit. */
.family-rows li { display: block; }
.fam-members {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 10px 10px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
}
.fam-members::-webkit-scrollbar { display: none; }
.fam-members > .fam-mem { scroll-snap-align: start; width: 58px; }
.fam-members .friend-avatar { width: 44px; height: 44px; }
.fam-members .friend-chip-name { font-size: 11px; line-height: 1.2; -webkit-line-clamp: 1; line-clamp: 1; }
/* Home: a family is a round crest in place of a face, a gold ring, and the count of others online on its corner. */
.family-chip .fam-icon { border-color: var(--gold-satin, #e4b860); background: radial-gradient(circle at 50% 30%, rgba(228, 184, 96, .28), transparent 70%), linear-gradient(180deg, var(--surface), var(--surface-2)); overflow: visible; }
.family-chip .fam-icon.has-online { box-shadow: 0 0 0 2px rgba(143, 221, 124, .35); }
.family-chip .fam-icon-crest { display: block; width: 70%; height: 70%; }
.family-chip .fam-icon-crest .crest-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.fam-online-count {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
  display: grid; place-items: center; border-radius: 999px;
  background: #1f8a4c; color: #fff; font: 800 11px/1 var(--sans, system-ui, sans-serif);
  border: 2px solid var(--stage-0, #220b0e);
}

/* Top of a family's own screen: crest, name, who is online, then every member as a round face with a status word. */
.family-strip { padding: 12px 6px 6px; }
.family-strip-head { display: flex; align-items: center; gap: 10px; padding: 0 8px 8px; }
.family-strip-head .fam-crest { flex: 0 0 38px; width: 38px; height: 38px; }
.family-strip-copy { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; }
.family-strip-copy b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.family-strip-copy em { font-style: normal; font-size: 12.5px; color: var(--ink-2, #bba98a); }
.fam-online-count.is-inline { position: static; flex: 0 0 auto; }
.family-strip .fam-members { padding: 2px 4px 6px; }
.family-strip .fam-members > .fam-mem { width: 64px; }
.fam-mem-status { font-size: 10px; line-height: 1.1; letter-spacing: .02em; color: var(--ink-3, #8a7a64); }
.fam-mem-status.is-free { color: #8fdd7c; }
.fam-mem-status.is-playing { color: #ffb87a; }

/* A family invite link: who the family is and who is in it, before Join. Hides the create/join forms while it is up. */
#family-none.is-landing > :not(#family-landing) { display: none; }
.family-landing { text-align: center; padding: 14px 8px 12px; }
.family-landing-crest { display: inline-block; width: 72px; height: 72px; }
.family-landing-crest .crest-img { width: 100%; height: 100%; object-fit: contain; }
.family-landing h3 { margin: 6px 0 2px; font-size: 19px; }
.family-landing-who { margin: 12px 0 2px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2, #bba98a); }
.family-landing .fam-members { justify-content: flex-start; }
.family-landing .btn { margin-top: 8px; }



/* ===== Friends tab: one round icon per family, like the friends' faces ===== */
/* Same row as #friends-list in royal.css: swipes sideways, 56px circles with the name under. */
#screen-friends #families-list { display: flex; flex-wrap: nowrap; gap: 12px; overflow-x: auto; overflow-y: hidden; margin: 6px -4px 4px; padding: 4px 4px 10px; list-style: none; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
#screen-friends #families-list::-webkit-scrollbar { display: none; }
#screen-friends #families-list li { flex: 0 0 auto; width: 74px; display: block; margin: 0; padding: 0; border: 0; background: none; box-shadow: none; scroll-snap-align: start; }
#screen-friends #families-list .friend-chip { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; padding: 2px 0; box-shadow: none; border-radius: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
#screen-friends #families-list .friend-avatar { width: 56px; height: 56px; overflow: visible; }
#screen-friends #families-list .friend-chip:active .friend-avatar { transform: scale(.95); }
#screen-friends #families-list .friend-chip-name { max-width: 100%; font-size: 12px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#screen-friends #families-list .friend-chip.is-current .friend-avatar { box-shadow: 0 0 0 2px rgba(228, 184, 96, .55); }
#screen-friends #families-list .badge { position: absolute; top: -4px; right: -4px; }
/* A family keeps its gold ring; the green dot and ring appear only while someone in it is online. */
#screen-friends #families-list .friend-avatar.is-free { border-color: var(--jade-lo, #3f8f55); }
#screen-friends #families-list .friend-avatar.is-free .friend-avatar-dot { background: #36d170; box-shadow: 0 0 6px rgba(54, 209, 112, .75); width: 14px; height: 14px; }

/* The small card a tap on a family opens. */
.family-pop-card { position: relative; max-width: 340px; text-align: left; }
.family-pop-x { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; display: grid; place-items: center; font-size: 26px; line-height: 1; color: var(--ink-2, #bba98a); background: none; border: 0; cursor: pointer; }
.family-pop-head { display: flex; align-items: center; gap: 12px; padding: 4px 36px 12px 0; }
.family-pop-head .fam-crest { flex: 0 0 46px; width: 46px; height: 46px; }
.family-pop-head b { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.family-pop-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: min(46vh, 320px); overflow-y: auto; display: grid; gap: 2px; }
.family-pop-member { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 4px 4px; border-radius: 12px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.family-pop-member:active { background: rgba(228, 184, 96, .10); }
.family-pop-member:focus-visible, .family-pop-x:focus-visible { outline: 2px solid var(--gold-satin, #e4b860); outline-offset: 1px; }
.family-pop-member .friend-avatar { width: 40px; height: 40px; flex: 0 0 40px; }
.family-pop-who { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; }
.family-pop-who b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.family-pop-member .fam-mem-status { flex: 0 0 auto; font-size: 12px; font-weight: 700; }
