/* The ornament owns its full canvas; a circular avatar fits the clear opening. */
.avatar-frame.frame-collection {
  --collection-size: 54px;
  --frame-render-size: calc(var(--collection-size) * var(--frame-display-scale, 1));
  width: var(--frame-render-size);
  height: var(--frame-render-size);
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0;
  background: none !important;
  box-shadow: none !important;
  animation: none;
  position: relative;
  isolation: isolate;
}
.avatar-frame.frame-collection > .avatar {
  width: 53.90625% !important;
  height: 53.90625% !important;
  border: 0 !important;
  border-radius: 50% !important;
  flex: 0 0 auto;
  font-size: calc(var(--collection-size) * 0.19) !important;
}
.avatar-frame.frame-collection > .collection-frame-art {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
  -webkit-mask-image: radial-gradient(
    circle at center,
    transparent calc(var(--collection-size) * 0.26),
    #000 calc(var(--collection-size) * 0.26 + 0.1px)
  );
  mask-image: radial-gradient(
    circle at center,
    transparent calc(var(--collection-size) * 0.26),
    #000 calc(var(--collection-size) * 0.26 + 0.1px)
  );
}
.collection-frame-art > :is(img, video, canvas) {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  clip-path: circle(50%);
}
.avatar-frame.frame-collection.large-frame {
  --collection-size: 136px;
}
.studio-art .avatar-frame.frame-collection.large-frame {
  --collection-size: 112px;
}
.studio-art:has(.frame-collection) {
  min-height: 142px;
}
.studio-item .studio-art:has(.frame-collection) {
  min-height: 132px;
}
.profile-button > .avatar-frame.frame-collection {
  --collection-size: 56px;
}
.mini-leader > .avatar-frame.frame-collection {
  --collection-size: 32px;
}
.table-name .avatar-frame.frame-collection {
  --collection-size: 48px;
}
.member-identity .avatar-frame.frame-collection {
  --collection-size: 60px;
}
.online-player .avatar-frame.frame-collection.large-frame {
  --collection-size: 72px;
}
.duel-player > .avatar-frame.frame-collection.large-frame {
  --collection-size: 68px;
}
.chat-message > .avatar-frame.frame-collection {
  --collection-size: 56px;
}
.chat-channel > .avatar-frame.frame-collection {
  --collection-size: 40px;
}
.guild-member-preview > .avatar-frame.frame-collection {
  --collection-size: 36px;
}
.roster-member > .avatar-frame.frame-collection {
  --collection-size: 52px;
}
.profile-avatar-row:has(.frame-collection) {
  min-height: 136px;
  gap: 8px;
}
.profile-avatar-row:has(.frame-collection) > .profile-badge {
  font-size: 7px;
}
@media (min-width: 1200px) {
  .shop-grid:has(.frame-collection) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  #mobile-profile > .avatar-frame.frame-collection {
    --collection-size: 44px;
  }
  .studio-art .avatar-frame.frame-collection.large-frame {
    --collection-size: 104px;
  }
  .studio-preview-column .profile-card-content:has(.frame-collection) {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 4px 9px;
  }
  .studio-preview-column .profile-avatar-row:has(.frame-collection) {
    min-height: 100px;
  }
  .studio-preview-column .avatar-frame.frame-collection.large-frame {
    --collection-size: 100px;
  }
  .duel-player > .avatar-frame.frame-collection.large-frame {
    --collection-size: 60px;
  }
  .online-player .avatar-frame.frame-collection.large-frame {
    --collection-size: 68px;
  }
}
/* Four distinct cosmetic shops. Basic profile settings stay in Profile Studio. */
#view-shop .shop-tabs {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  overflow: visible;
  gap: 5px;
  padding: 5px;
}
#view-shop .shop-tabs button {
  min-width: 0;
  white-space: normal;
  min-height: 45px;
  padding: 9px 6px;
  font-size: 11px;
  line-height: 1.3;
}
.shop-category-description {
  color: var(--muted, #a5af95);
  font-size: 12px;
  line-height: 1.5;
  min-height: 18px;
  margin: 13px 2px 18px;
}
.studio-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.studio-extra-settings {
  margin: 12px 0;
  border: 1px solid #394131;
  border-radius: 10px;
  padding: 12px;
  color: #aebaa0;
  font-size: 12px;
}
.studio-extra-settings summary {
  cursor: pointer;
  color: #dce8ce;
}
.studio-settings-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}
.studio-settings-buttons button {
  padding: 10px;
  border: 1px solid #414c36;
  border-radius: 7px;
  background: #20251d;
  color: #c1cbb5;
  font: inherit;
  cursor: pointer;
}
.studio-settings-buttons button.selected {
  background: #d4f89b;
  color: #182014;
  border-color: #d4f89b;
}
/* Original frame motion only. New foreground actions must not be center-masked or circle-clipped. */
.avatar-frame.frame-collection > .collection-frame-art.native-foreground {
  -webkit-mask-image: none;
  mask-image: none;
}
.collection-frame-art.native-foreground > :is(img, video, canvas) {
  clip-path: none;
}
@media (max-width: 700px) {
  #view-shop .shop-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #view-shop .shop-tabs button {
    font-size: 12px;
    min-height: 44px;
  }
  .shop-category-description {
    margin-bottom: 14px;
  }
}

#shop-grid .studio-art:has(.frame-collection) {
  min-height: 172px;
}
#shop-grid .studio-art .frame-collection.large-frame {
  --collection-size: 136px;
}
.studio-art:has(.frame-chrome) {
  background: radial-gradient(ellipse at center, #a1d9ef20, transparent 68%), #1c211a;
}
.studio-art:has(.frame-sakura) {
  background: radial-gradient(ellipse at center, #f99abd24, transparent 68%), #211c1d;
}
.studio-art:has(.frame-abyss) {
  background: radial-gradient(ellipse at center, #2864ef2c, transparent 68%), #191e27;
}
@media (max-width: 700px) {
  #shop-grid .studio-art:has(.frame-collection) {
    min-height: 150px;
  }
  #shop-grid .studio-art .frame-collection.large-frame {
    --collection-size: 120px;
  }
}

.studio-art:has(.frame-venom) {
  background: radial-gradient(ellipse at center, #56ff5d20, transparent 68%), #192019;
}
.studio-art:has(.frame-afterhours) {
  background: radial-gradient(ellipse at center, #de45ff24, transparent 68%), #211a26;
}
.studio-art:has(.frame-ronin) {
  background: radial-gradient(ellipse at center, #ff534024, transparent 68%), #241b1b;
}

/* Wing trilogy exports have their own avatar aperture and center. Keep their full canvas. */
.avatar-frame.frame-collection.frame-wing {
  --collection-size: 68px;
}
.avatar-frame.frame-collection.frame-wing > .avatar {
  position: absolute;
  left: var(--frame-x);
  top: var(--frame-y);
  transform: translate(-50%, -50%);
  width: var(--frame-avatar) !important;
  height: var(--frame-avatar) !important;
  font-size: calc(var(--frame-render-size) * var(--frame-letter)) !important;
}
.avatar-frame.frame-collection.frame-wing.large-frame {
  --collection-size: 196px;
}
.profile-avatar-row:has(.frame-wing) {
  min-height: 196px;
}
.studio-art .avatar-frame.frame-collection.frame-wing.large-frame {
  --collection-size: 160px;
}
.studio-art:has(.frame-wing) {
  min-height: 182px;
}
.studio-item .studio-art:has(.frame-wing) {
  min-height: 180px;
}
#shop-grid .studio-art:has(.frame-wing) {
  min-height: 236px;
}
#shop-grid .studio-art .frame-collection.frame-wing.large-frame {
  --collection-size: 208px;
}
.profile-button > .avatar-frame.frame-collection.frame-wing {
  --collection-size: 62px;
}
.mini-leader > .avatar-frame.frame-collection.frame-wing {
  --collection-size: 40px;
}
.table-name .avatar-frame.frame-collection.frame-wing {
  --collection-size: 60px;
}
.member-identity .avatar-frame.frame-collection.frame-wing {
  --collection-size: 70px;
}
.online-player .avatar-frame.frame-collection.frame-wing.large-frame {
  --collection-size: 88px;
}
.duel-player > .avatar-frame.frame-collection.frame-wing.large-frame {
  --collection-size: 80px;
}
.chat-message > .avatar-frame.frame-collection.frame-wing {
  --collection-size: 64px;
}
.chat-channel > .avatar-frame.frame-collection.frame-wing {
  --collection-size: 48px;
}
.guild-member-preview > .avatar-frame.frame-collection.frame-wing {
  --collection-size: 44px;
}
.roster-member > .avatar-frame.frame-collection.frame-wing {
  --collection-size: 62px;
}
.studio-art:has(.frame-seraph) {
  background: radial-gradient(ellipse at center, #ffd98529, transparent 70%), #241f17;
}
.studio-art:has(.frame-eclipse) {
  background: radial-gradient(ellipse at center, #c3d0e025, transparent 70%), #191d23;
}
.studio-art:has(.frame-sovereign) {
  background: radial-gradient(ellipse at center, #f4a99c29, transparent 70%), #261c1e;
}
@media (max-width: 700px) {
  #mobile-profile > .avatar-frame.frame-collection.frame-wing {
    --collection-size: 50px;
  }
  .studio-art .avatar-frame.frame-collection.frame-wing.large-frame {
    --collection-size: 150px;
  }
  #shop-grid .studio-art:has(.frame-wing) {
    min-height: 220px;
  }
  #shop-grid .studio-art .frame-collection.frame-wing.large-frame {
    --collection-size: 156px;
  }
  .studio-preview-column .avatar-frame.frame-collection.frame-wing.large-frame {
    --collection-size: 100px;
  }
  .studio-preview-column .profile-avatar-row:has(.frame-wing) {
    min-height: 100px;
  }
  .duel-player > .avatar-frame.frame-collection.frame-wing.large-frame {
    --collection-size: 72px;
  }
  .online-player .avatar-frame.frame-collection.frame-wing.large-frame {
    --collection-size: 80px;
  }
}

/* Original Space and Seasonal Series artwork; only matching preview backgrounds. */
.studio-art:has(.frame-orbital) {
  background: radial-gradient(ellipse at center, #389dff26, transparent 70%), #17212b;
}
.studio-art:has(.frame-inferno) {
  background: radial-gradient(ellipse at center, #ff731d29, transparent 70%), #271c17;
}
.studio-art:has(.frame-singularity) {
  background: radial-gradient(ellipse at center, #ab5dff2b, transparent 70%), #20192a;
}
.studio-art:has(.frame-harvest) {
  background: radial-gradient(ellipse at center, #efa73d29, transparent 70%), #292017;
}
.studio-art:has(.frame-verdant) {
  background: radial-gradient(ellipse at center, #b7e27229, transparent 70%), #1c271c;
}
.studio-art:has(.frame-frostbite) {
  background: radial-gradient(ellipse at center, #91dfff29, transparent 70%), #19252c;
}

/* Native Elemental / Seven Sins artwork; matching backgrounds only. */
.studio-art:has(.frame-pyre) {
  background: radial-gradient(ellipse at center, #ff642a26, transparent 70%), #271914;
}
.studio-art:has(.frame-tidal) {
  background: radial-gradient(ellipse at center, #34cde226, transparent 70%), #15242a;
}
.studio-art:has(.frame-voltage) {
  background: radial-gradient(ellipse at center, #ffd34d26, transparent 70%), #272416;
}
.studio-art:has(.frame-pride) {
  background: radial-gradient(ellipse at center, #9dbaff26, transparent 70%), #202436;
}
.studio-art:has(.frame-greed) {
  background: radial-gradient(ellipse at center, #ffce5826, transparent 70%), #292419;
}
.studio-art:has(.frame-wrath) {
  background: radial-gradient(ellipse at center, #ff3b4326, transparent 70%), #2c181d;
}
.studio-art:has(.frame-envy) {
  background: radial-gradient(ellipse at center, #43ed8e26, transparent 70%), #17291f;
}
.studio-art:has(.frame-lust) {
  background: radial-gradient(ellipse at center, #e95aa926, transparent 70%), #2a1725;
}
.studio-art:has(.frame-gluttony) {
  background: radial-gradient(ellipse at center, #d49bff26, transparent 70%), #281c30;
}
.studio-art:has(.frame-sloth) {
  background: radial-gradient(ellipse at center, #a998fa26, transparent 70%), #202039;
}

/* Native Wings II / Magic artwork; matching backgrounds only. */
.studio-art:has(.frame-vespers) {
  background: radial-gradient(ellipse at center, #c7afff26, transparent 70%), #232031;
}
.studio-art:has(.frame-daybreak) {
  background: radial-gradient(ellipse at center, #ffbb7626, transparent 70%), #2c201a;
}
.studio-art:has(.frame-nightjar) {
  background: radial-gradient(ellipse at center, #5bdcea26, transparent 70%), #19242b;
}
.studio-art:has(.frame-palimpsest) {
  background: radial-gradient(ellipse at center, #49d9cd26, transparent 70%), #1a2928;
}
.studio-art:has(.frame-parallax) {
  background: radial-gradient(ellipse at center, #b99aff26, transparent 70%), #221f30;
}
.studio-art:has(.frame-alembic) {
  background: radial-gradient(ellipse at center, #79e9a926, transparent 70%), #20291e;
}
.studio-art:has(.frame-fateweaver) {
  background: radial-gradient(ellipse at center, #efad9e26, transparent 70%), #2c1d23;
}
.studio-art:has(.frame-chronomancer) {
  background: radial-gradient(ellipse at center, #e2bd6826, transparent 70%), #29251b;
}
.studio-art:has(.frame-umbra) {
  background: radial-gradient(ellipse at center, #c691ec26, transparent 70%), #251d2c;
}

/* Larger leaderboard identities; preserve each frame's original avatar aperture. */
@media (min-width: 701px) {
  :is(#leaderboard-body, #pvp-board-body) .table-name {
    gap: 16px;
    min-height: 84px;
  }
  :is(#leaderboard-body, #pvp-board-body) .table-name > .avatar-frame.frame-collection {
    --collection-size: 84px;
  }
  :is(#leaderboard-body, #pvp-board-body)
    .table-name
    > .avatar-frame:not(.frame-collection)
    > .avatar {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }
  :is(#leaderboard-body, #pvp-board-body) > tr > td {
    padding-top: 12px;
    padding-bottom: 12px;
    vertical-align: middle;
  }
}
@media (max-width: 700px) {
  #leaderboard-body .table-name {
    gap: 8px;
    min-height: 76px;
  }
  #leaderboard-body .table-name > .avatar-frame.frame-collection {
    --collection-size: 76px;
  }
  #leaderboard-body .table-name > .avatar-frame:not(.frame-collection) > .avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  #leaderboard-body > tr > td {
    padding-top: 9px;
    padding-bottom: 9px;
    vertical-align: middle;
  }
  #leaderboard-body .table-name > .styled-name {
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-size: 12px;
    padding: 4px 5px;
  }
  #leaderboard-body .table-name .nickname {
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: left;
    line-height: 1.25;
  }
  #leaderboard-body .table-name .display-badges {
    flex-wrap: wrap;
  }
}

/* Wildcard Duo native art; matching preview backgrounds only. */
.studio-art:has(.frame-last-call) {
  background: radial-gradient(ellipse at center, #9df0d22b, transparent 70%), #211d22;
}
.studio-art:has(.frame-briarheart) {
  background: radial-gradient(ellipse at center, #e4e86d2b, transparent 70%), #25271b;
}

/* Scale the ornament and its avatar together so the opening stays aligned. */
.social-avatar:has(> .collection-frame-art.native-foreground) {
  scale: 0.9;
  overflow: visible;
}

.collection-frame-art {
  display: block;
  position: relative;
}
.collection-frame-art > .frame-loop {
  position: absolute;
  inset: 0;
}
.collection-frame-art > .frame-packed-source {
  position: absolute;
  inset: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.collection-frame-art.frame-art-playing > .frame-poster {
  visibility: hidden;
}

/* Padded motion extends beyond the logical resting canvas. */
.collection-frame-art.frame-art-padded {
  overflow: visible;
}
.collection-frame-art.frame-art-padded > :is(img, video, canvas) {
  transform: scale(var(--frame-art-scale));
}
.shop-item:has(.frame-vesper-wyrm),
.studio-item:has(.frame-vesper-wyrm),
.studio-art:has(.frame-vesper-wyrm) {
  overflow: visible;
}
@media (max-width: 700px) {
  .profile-frame-focus:has(.frame-vesper-wyrm) {
    max-width: 74vw;
  }
}
