/* friends.css, owner: track C. Holds: the Friends view, the Home summary, public tables, the rows they share, invite pills, the friend invite toast (DESIGN_SPEC.md 9.2, 9.3, 8.4).
   Load order 6 of 15: base, primitives, frame, home, room, friends, center, table, rails, chat, coach, meld, peek, results, dialogs.
   render/friends.js builds the view (.landing-friends > .friends-grid > .friends-main + .friends-aside) and the summary (.home-friends);
   render/public.js builds the Play with Anyone panel. The rows (.public-row) are one look everywhere: the two friends places, the public
   tables, the Invite Friends dialog, and the blocked list in Settings. The view is one column until it is 50rem wide (a container query on itself). */

/* ---- the rows ---- */
.public-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); min-height: 3.5rem; padding: var(--sp-2) 0; border-radius: 0; background: none; }
.public-row + .public-row { border-top: 1px solid var(--hair); }
.public-row .btn { flex: none; width: auto; }
.public-row-actions { display: flex; flex: none; align-items: center; gap: var(--sp-2); margin-left: auto; }
.public-row > .btn, .public-row > .friends-requested { margin-left: auto; }   /* a lone button that is not in the group (the blocked list in Settings) */
/* At large text the buttons drop under the words instead of squeezing them to a letter a line (checked at 200%). */
.public-row-text { display: grid; flex: 1 1 6em; min-width: 0; text-align: left; overflow-wrap: anywhere; }
.friend-avatar { flex: none; color: var(--text); font: var(--t-label); }
.friend-name { font: var(--t-label); font-weight: 600; }
/* The dot (or the seat pips) stays beside the first word and the words wrap on their own: the dot is never left alone on a line. */
.friend-where { display: flex; align-items: baseline; gap: var(--sp-2); font: var(--t-caption); color: var(--text-dim); }
.friend-where > :is(.dot, .seat-pips) { flex: none; }
.friends-requested { display: inline-flex; align-items: center; min-height: var(--hit-sm); color: var(--text-dim); font: var(--t-label); }
.list > .public-row { padding: var(--sp-2) var(--sp-4); }
@media (max-width: 599.98px) { .list > .public-row { padding-inline: var(--sp-3); } }
.public-tag {
  display: inline-flex; align-items: center; min-height: 1.25rem; margin-left: var(--sp-1); padding: 0 var(--sp-2); border: 1px solid var(--gold-line); border-radius: var(--r-full);
  color: var(--gold-strong); font: var(--t-eyebrow); letter-spacing: 0.04em;
}
.seat-pips { display: inline-flex; gap: var(--sp-1); }
.pip { width: 0.5rem; height: 0.5rem; border: 1px solid var(--text-dim); border-radius: 50%; }
.pip.is-filled { border-color: var(--gold); background: var(--gold); }

/* ---- the Friends view ---- */
.landing-friends { container: friends / inline-size; min-width: 0; }
.friends-grid { display: grid; align-items: start; gap: var(--sp-5); }
@container friends (min-width: 50rem) { .friends-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--sp-6); } }
.friends-main, .friends-aside { display: grid; gap: var(--sp-5); min-width: 0; }
.friends-block { display: grid; gap: var(--sp-3); }
.friends-block[hidden], .friends-recent[hidden] { display: none; }
.friends-title { font: var(--t-title-3); color: var(--text); }
.friends-note { max-width: 38ch; font: var(--t-caption); color: var(--text-dim); }
.friends-code-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-block: var(--sp-3); }
.friends-code-row .friend-code { font: var(--t-title-1); font-family: var(--font-mono); letter-spacing: 0.12em; }   /* 2rem in the Friends view (9.3); dialogs.css makes the other uses 1rem (fix round 3 m11) */
.friend-code { font: var(--t-title-1); font-family: var(--font-mono); letter-spacing: 0.12em; color: var(--gold-strong); user-select: all; }
.friends-add { display: grid; gap: var(--sp-3); }
.friends-add-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--sp-2); }
.friends-add .room-code-input, .friends-link .room-code-input, .link-devices .room-code-input { width: 100%; min-height: var(--field-h); margin: 0; padding: 0 var(--sp-4); text-align: left; }
.friends-link > summary, .friends-recent > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: var(--hit); padding: 0; font: var(--t-label); cursor: pointer; }
.friends-link > summary .i, .friends-recent > summary .i { color: var(--text-dim); }
.friends-link[open] > summary .i, .friends-recent[open] > summary .i { rotate: 180deg; }
.friends-link > :not(summary), .friends-recent > :not(summary) { margin-top: var(--sp-3); }
.friends-link .friends-add-row, .link-devices .friends-add-row { grid-template-columns: minmax(0, 1fr) auto; }
.link-devices { display: grid; justify-items: start; gap: var(--sp-3); min-width: 0; }
.link-devices .friends-add-row { justify-self: stretch; }
.link-devices__out:empty { display: none; }
.friends-recent-list { display: grid; }
.friends-skeleton { display: grid; gap: var(--sp-2); }
.friends-failed { display: grid; justify-items: start; gap: var(--sp-2); }
.invite-load-failed { font: var(--t-small); color: var(--text); }
.friends-empty { padding: var(--sp-5) var(--sp-4); border: 1px solid var(--hair); border-radius: var(--r-xl); background: var(--panel); }
.friends-offline { max-width: none; }

/* ---- the Home summary ---- */
.home-friends { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); text-align: left; }   /* (minmax 0: the track may not grow to the chip's words at Larger Text, fix round 2 M1) */
.home-friends__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3); }
.home-friends__title { font: var(--t-title-3); color: var(--text); }
.friends-codechip {
  display: inline-flex; flex-wrap: wrap; align-items: center; max-width: 100%; gap: 0 var(--sp-2); padding: 0 var(--sp-1) 0 var(--sp-3); border: 1px dashed var(--line); border-radius: var(--r-md); background: var(--panel-2);
}
.friends-codechip__label { font: var(--t-caption); color: var(--text-dim); }
.friends-codechip .friend-code { font: var(--t-small); font-family: var(--font-mono); font-weight: 700; letter-spacing: 0.12em; }
.home-friends__body { display: grid; gap: var(--sp-2); }
.home-friends__all { justify-self: start; padding-inline: 0; color: var(--gold-strong); }   /* in line with the heading and the rows above it */

/* ---- Play with Anyone ---- */
.landing-public { display: grid; gap: var(--sp-3); justify-items: start; text-align: left; }
.landing-public > h3 { font: var(--t-title-3); color: var(--text); }
.landing-public .panel-hint { max-width: none; }
.landing-public .public-host { padding-inline: 0; color: var(--gold-strong); }   /* a quiet link-button, in line with the words above it */
.public-list { display: grid; width: 100%; }
.public-list.is-stale { opacity: 0.6; }
.public-loading { display: flex; align-items: center; gap: var(--sp-2); min-height: 3.5rem; color: var(--text-dim); font: var(--t-small); }

/* ---- the one Invite button (build 28, rows 103 and 112): a pill with its state in words, and a caption under the name ---- */
.invite-pill { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: var(--hit); min-width: var(--hit); padding: 0 var(--sp-4); border-radius: var(--r-full); white-space: nowrap; }
.invite-pill[data-state="invited"], .invite-pill[data-state="limited"] { border-color: var(--gold-line); background: var(--gold-wash); color: var(--gold-strong); }
.invite-pill[data-state="sending"] { border-color: var(--gold-line); cursor: progress; }
.invite-pill[data-state="failed"] { border-color: var(--bad-edge); color: var(--bad); }
.invite-pill[data-state="here"] { border-color: transparent; background: none; color: var(--text-dim); cursor: default; }
.invite-check { font-weight: 800; }
.invite-spinner { width: 0.875rem; height: 0.875rem; border: 2px solid var(--track); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.8s linear infinite; }
.invite-caption { max-width: none; color: var(--gold-strong); }
.invite-caption[data-state="failed"] { color: var(--bad); }
.invite-dialog .public-row + .public-row { margin-top: 0; }

/* ---- a friend's invitation: one toast at the top (D16); on a phone above the tab bar, at a table under the bar ---- */
.friend-invite {
  position: fixed; top: calc(var(--moved-banner-h, 0px) + var(--sp-4)); left: 50%; translate: -50% 0; z-index: var(--z-toast); display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: var(--sp-2) var(--sp-3); width: max-content; max-width: min(92vw, 36rem); padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-5); border: 1px solid var(--gold-line); border-radius: var(--r-xl);
  background: var(--panel); box-shadow: var(--e-2); color: var(--text); font: var(--t-small);
}
.friend-invite__text { display: inline-flex; align-items: center; gap: var(--sp-2); }
.friend-invite__text .i { color: var(--gold); }
.friend-invite__join { border-color: var(--gold-line); background: var(--gold-wash); color: var(--gold-strong); }
body.at-table .friend-invite { top: calc(var(--moved-banner-h, 0px) + var(--bar-h) + var(--sp-3)); }
@media (max-width: 599.98px) {
  body.has-frame .friend-invite { top: auto; bottom: calc(var(--bar-h) + var(--safe-b) + var(--sp-3)); }
  /* The words on their own line, then the two buttons side by side (a wrapped third word was left alone on a line). */
  .friend-invite { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: min(92vw, 36rem); padding: var(--sp-3); }
  .friend-invite__text { grid-column: 1 / -1; justify-content: center; }
}
.friend-invite.is-pulsing { animation: invite-pulse 0.9s ease-out 1; }
@keyframes invite-pulse { from { box-shadow: 0 0 0 0 var(--gold-line); } to { box-shadow: 0 0 0 0.875rem var(--gold-wash); } }
@media (prefers-reduced-motion: reduce) { .friend-invite.is-pulsing, .invite-spinner { animation: none; } }
