/* Keep the 1600 × 400 card and its avatar proportional in Safari as well. */
.profile-rank-preview {
  aspect-ratio: 4 / 1;
  min-height: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.profile-rank-preview .profile-preview-avatar {
  width: 16.25%;
  height: 16.25cqw;
  min-height: 0;
  box-sizing: border-box;
  aspect-ratio: 1;
}
.profile-preview-avatar img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Nearby players use one readable scale instead of shrinking to fit a sidebar panel. */
#nearby-ranks {
  container-type: inline-size;
  padding: 20px;
  align-self: start;
}
#nearby-ranks h2 { margin: 0 0 16px; font-size: 1.25rem; line-height: 1.25; }
#nearby-ranks p { margin: -4px 0 16px; font-size: .875rem; line-height: 1.45; }
#nearby-ranks .nearby-player-scroll { overflow: visible; padding: 0; margin: 0; }
#nearby-ranks .nearby-player-list {
  width: 100%;
  min-width: 0;
  grid-template-columns: 28px max-content minmax(72px, 1fr) minmax(max-content, .35fr) minmax(max-content, .65fr) minmax(max-content, .65fr);
  gap: 0 12px;
}
#nearby-ranks .nearby-player-heading,
#nearby-ranks .nearby-player {
  padding: 12px 6px;
  column-gap: 12px;
}
#nearby-ranks .nearby-player-heading { padding-block: 0 10px; font-size: .75rem; line-height: 1.4; }
#nearby-ranks .nearby-player {
  min-width: 0;
  min-height: 52px;
  border-top: 1px solid var(--border);
  font-family: "CLB Sans", sans-serif;
  font-size: .8125rem;
  line-height: 1.4;
  color: var(--text);
}
#nearby-ranks .nearby-avatar { width: 28px; height: 28px; }
#nearby-ranks .nearby-player-position { color: var(--muted); }
#nearby-ranks .nearby-player-identity { align-items: center; gap: 4px; }
#nearby-ranks .nearby-player-name { color: var(--text); font-weight: 600; }
#nearby-ranks .nearby-player-you { color: var(--muted); font-size: .6875rem; }
#nearby-ranks .nearby-player-stats { display: contents; }
/* Compact/full number wrappers must inherit the positive/negative gap color. */
#nearby-ranks .nearby-xp-gap > span { color: inherit; }
#nearby-ranks .nearby-player-level,
#nearby-ranks .nearby-player-xp { color: var(--text); }
#nearby-ranks .nearby-player.is-current { outline: 1px solid #939bff66; outline-offset: -1px; }
#nearby-ranks .nearby-player:hover { background: var(--surface-strong); }
#nearby-ranks .nearby-player:focus-visible { outline: 2px solid #a6adff; outline-offset: -2px; }

/* Keep narrow panels in a single row per member, with one shared header. */
#nearby-ranks .nearby-number-compact { display: none; }
@container (max-width: 540px) {
  #nearby-ranks .nearby-player-list {
    grid-template-columns: 24px max-content minmax(24px, 1fr) minmax(max-content, .35fr) minmax(max-content, .65fr) minmax(max-content, .65fr);
    column-gap: 8px;
  }
  #nearby-ranks .nearby-player-heading,
  #nearby-ranks .nearby-player { column-gap: 8px; padding-inline: 4px; }
  #nearby-ranks .nearby-player { min-height: 44px; padding-block: 8px; font-size: .75rem; }
  #nearby-ranks .nearby-player-heading { font-size: .6875rem; }
  #nearby-ranks .nearby-avatar { width: 24px; height: 24px; }
  #nearby-ranks .nearby-player-you { display: none; }
}
/* Compact notation leaves space for the name; full values remain in tooltips and labels. */
@container (max-width: 340px) {
  #nearby-ranks .nearby-player-list {
    grid-template-columns: 20px max-content minmax(24px, 1fr) minmax(max-content, .35fr) minmax(max-content, .65fr) minmax(max-content, .65fr);
    column-gap: 8px;
  }
  #nearby-ranks .nearby-player-heading,
  #nearby-ranks .nearby-player { column-gap: 8px; padding-inline: 2px; }
  #nearby-ranks .nearby-avatar { width: 20px; height: 20px; }
  #nearby-ranks .nearby-number-full { display: none; }
  #nearby-ranks .nearby-number-compact { display: inline; }
}

/* Dates and the enlarge instruction belong to the same footer row. */
.profile-preview-column { container-type: inline-size; }
.profile-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
  min-width: 0;
  padding-top: 4px;
}
.profile-card-footer #member-info { min-width: 0; font-size: .75rem; line-height: 1.5; }
.profile-card-footer .profile-preview-hint {
  margin-left: auto;
  flex-shrink: 0;
  font-size: .75rem;
  white-space: nowrap;
  text-align: right;
}
.profile-preview-feedback:has(#rank-save-status:empty) { display: none; }
@container (max-width: 620px) {
  .profile-card-footer #member-info .member-info-full {
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .profile-card-footer #member-info .member-info-compact { display: flex; flex-wrap: nowrap; gap: 0 8px; }
  .profile-card-footer #member-info .member-info-compact > span { white-space: nowrap; }
  .profile-card-footer #member-info,
  .profile-card-footer .profile-preview-hint { font-size: .6875rem; }
}
@media (max-width: 600px) {
  #nearby-ranks { padding: 16px; }
}
@media (min-width: 1024px) {
  .profile-dashboard:has(#nearby-ranks) { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 1280px) {
  .profile-dashboard:has(#nearby-ranks) { grid-template-columns: minmax(360px, .95fr) minmax(0, 1.35fr); align-items: start; }
}

.profile-card-panel { align-self: start; grid-template-rows: auto auto; }
.profile-card-panel .profile-rank-layout { align-content: start; }
@container (max-width: 330px) {
  .profile-card-footer { gap: 6px; }
  .profile-card-footer #member-info, .profile-card-footer .profile-preview-hint { font-size: .625rem; }
  .profile-card-footer #member-info .member-info-compact { gap: 4px; }
}
@container (max-width: 230px) {
  .profile-card-footer #member-info .member-info-compact { flex-wrap: wrap; }
}

/* Match the generated rank image's pill-shaped progress track and fill. */
.profile-rank-preview .profile-preview-track,
.profile-rank-preview .profile-preview-track > span { border-radius: 999px; }
