/* Built avatars (avatar.js) + the avatar builder. Original SVG card-suit avatars; sized by their container. */
.av-svg { width: 1.15em; height: 1.15em; vertical-align: -.22em; display: inline-block; flex: none; }
.avatar > .av-svg, .big-avatar > .av-svg, .swp-av > .av-svg, .sws-av > .av-svg, .kb-av > .av-svg, #meAvatar > .av-svg, #lobbyAvatar > .av-svg { width: 100%; height: 100%; vertical-align: 0; }
.avatar:has(> .av-svg), .big-avatar:has(> .av-svg), .swp-av:has(> .av-svg), .sws-av:has(> .av-svg) { padding: 0; overflow: hidden; background: none; }
.pa > .av-svg { width: 1.35em; height: 1.35em; }
#meAvatar:has(> .av-svg) { width: 26px; height: 26px; }

/* SHOW_AVATARS=0 hides the emoji icons; a player-built avatar is shown anyway (they chose it). */
.no-avatars .seat .avatar:has(> .av-svg), .no-avatars .big-avatar:has(> .av-svg), .no-avatars .sw-card .avatar:has(> .av-svg),
.no-avatars .partner-card .avatar:has(> .av-svg), .no-avatars .swp-av:has(> .av-svg) { display: grid !important; }
.no-avatars .pa:has(> .av-svg), .no-avatars #meAvatar:has(> .av-svg) { display: inline-flex !important; }
.no-avatars .swp-partner:has(.swp-av > .av-svg) .swp-jack { display: none; }

/* Edit profile row */
.av-build-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; }
.av-cur { display: inline-grid; place-items: center; min-width: 52px; height: 52px; }
.av-cur > .av-svg { width: 52px; height: 52px; }
.avb-open { margin-top: 6px; }

/* Builder overlay */
.avb-back { position: fixed; inset: 0; z-index: 400; background: rgba(5,10,20,.66); display: grid; place-items: center; padding: 16px; }
.avb-back[hidden] { display: none; }
.avb-card { width: min(880px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--surface, #141518); color: var(--surface-ink, #eef2f7);
  border: 1px solid var(--line, rgba(255,255,255,.15)); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5); overflow: hidden; }
.avb-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line, rgba(255,255,255,.12)); }
.avb-head h2 { margin: 0; font-size: 1.15rem; }
.avb-x { background: none; border: 0; color: inherit; font-size: 1.2rem; cursor: pointer; padding: 4px 8px; }
.avb-body { display: grid; grid-template-columns: 240px 1fr; gap: 16px; padding: 14px 16px; min-height: 0; overflow: hidden; flex: 1; }
.avb-left { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.avb-preview { width: 200px; height: 200px; }
.avb-preview > .av-svg { width: 100%; height: 100%; }
.avb-tools { display: flex; gap: 8px; }
.avb-lock { margin: 0; text-align: center; color: #fbbf24; min-height: 1em; }
.avb-right { display: flex; flex-direction: column; min-height: 0; gap: 8px; }
.avb-tabs, .avb-packs { display: flex; gap: 6px; flex-wrap: wrap; }
.avb-tab, .avb-pack { border: 1px solid var(--line, rgba(255,255,255,.2)); background: transparent; color: inherit; border-radius: 999px; padding: 5px 12px; cursor: pointer; font: inherit; font-size: .9rem; }
.avb-pack { font-size: .78rem; padding: 3px 10px; opacity: .85; }
.avb-tab.on, .avb-pack.on { background: var(--btn, #2563eb); color: var(--on-btn, #fff); border-color: transparent; opacity: 1; }
.avb-grid { overflow-y: auto; min-height: 0; flex: 1; padding-right: 4px; max-height: 52vh; }
.avb-part + .avb-part { margin-top: 10px; }
.avb-plabel { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; opacity: .7; margin-bottom: 6px; }
.avb-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.avb-opts.swatches { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.avb-opt { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 12px; cursor: pointer; font: inherit;
  border: 2px solid transparent; background: rgba(255,255,255,.06); color: inherit; }
.avb-opt > .av-svg { width: 56px; height: 56px; }
.avb-opt:hover { background: rgba(255,255,255,.12); }
.avb-opt.on { border-color: var(--btn, #3b82f6); background: rgba(59,130,246,.18); }
.avb-opt.locked > .av-svg, .avb-opt.locked > .avb-sw { opacity: .55; filter: grayscale(.5); }
.avb-name { font-size: .72rem; line-height: 1.1; text-align: center; }
.avb-lk { position: absolute; top: 2px; right: 4px; font-style: normal; font-size: .8rem; }
.avb-sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); }
.avb-opts.swatches .avb-opt { padding: 4px; }
.avb-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line, rgba(255,255,255,.12)); }
.avb-foot .err { margin-right: auto; color: #f87171; }
.avb-foot button:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 640px) {
  .avb-back { padding: 0; place-items: stretch; }
  .avb-card { max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .avb-body { grid-template-columns: 1fr; gap: 8px; padding: 10px 12px; overflow: hidden; display: flex; flex-direction: column; }
  .avb-left { flex-direction: row; justify-content: center; gap: 12px; flex-wrap: wrap; }
  .avb-preview { width: 120px; height: 120px; }
  .avb-tools { flex-direction: column; }
  .avb-lock { flex-basis: 100%; }
  .avb-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .avb-tab { white-space: nowrap; }
  .avb-grid { max-height: none; }
  .avb-opts { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
  .avb-opt > .av-svg { width: 46px; height: 46px; }
}

/* post-hand popup: your side's avatars next to "Board Results" */
.swp-recap .rb-h { display: flex; align-items: center; gap: 8px; }
.rb-avs { display: inline-flex; gap: 2px; margin-left: 8px; vertical-align: middle; }
.rb-avs .pa { font-size: 22px; line-height: 1; }
.rb-avs .pa > .av-svg { width: 30px; height: 30px; }
