.modal.profile-appearance-modal { width: min(100%, 700px); }
.profile-appearance-modal .profile-appearance-editor {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
}
.profile-editor-portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  gap: 18px;
  padding: 8px 6px;
}
.profile-editor-portrait .profile-appearance-preview { width: min(100%, 168px); }
.profile-editor-portrait .profile-appearance-preview > img { display: block; }
.profile-editor-portrait .profile-appearance-preview > span:not(:empty) {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 4px;
  border-radius: 50%;
  background: var(--surface);
}
.profile-editor-portrait .profile-appearance-preview > span :is(img, .rank-badge) {
  display: block;
  width: 100%;
  height: 100%;
}
.profile-appearance-modal .profile-appearance-editor :is(.profile-appearance-upload, .profile-appearance-options) {
  display: flex;
  flex-direction: column;
  background: none;
}
.profile-appearance-modal .profile-appearance-editor .profile-appearance-upload { gap: 12px; padding: 0; }
.profile-appearance-modal .profile-appearance-editor .profile-appearance-options { gap: 20px; padding: 8px 0; }
.profile-avatar-rail-frame { position: relative; min-width: 0; }
.profile-avatar-rail-frame::before,
.profile-avatar-rail-frame::after {
  content: '';
  position: absolute;
  inset-block: 0;
  z-index: 1;
  width: 36px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.profile-avatar-rail-frame::before { left: 0; background: linear-gradient(to right, var(--surface), transparent); }
.profile-avatar-rail-frame::after { right: 0; background: linear-gradient(to left, var(--surface), transparent); }
.profile-avatar-rail-frame.can-scroll-left::before,
.profile-avatar-rail-frame.can-scroll-right::after { opacity: 1; }
.profile-avatar-rail-frame .profile-avatar-rail { padding: 3px 2px; cursor: grab; touch-action: pan-x pan-y; user-select: none; }
.profile-avatar-rail-frame .profile-avatar-rail label { flex-basis: 88px; cursor: grab; }
.profile-avatar-rail-frame .profile-avatar-rail label > span {
  display: block;
  padding: 3px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #242428;
}
.profile-avatar-rail-frame .profile-avatar-rail img { width: 100%; height: auto; aspect-ratio: 1; border: none; }
.profile-avatar-rail-frame .profile-avatar-rail input:checked + span { border-color: #0055ff; background: #0055ff14; }
.profile-editor-color legend { display: flex; align-items: center; gap: 12px; }
.profile-editor-color legend span { color: var(--text-secondary); font-size: 12px; }
.profile-editor-color .profile-avatar-colors { gap: 8px; padding: 3px; }
.profile-editor-color .profile-avatar-colors label > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 3px solid var(--surface);
}
.profile-editor-color .profile-avatar-colors input:checked + span { box-shadow: 0 0 0 1px #fff; }
.profile-editor-color .profile-avatar-colors input:checked + span::after { content: '✓'; color: #fff; text-shadow: 0 1px 2px #0008; }
.profile-editor-color:disabled .profile-avatar-colors { opacity: .35; }
.profile-appearance-modal .profile-appearance-badges input:checked + span { background: #0055ff14; }

@media (max-width: 620px) {
  .profile-appearance-modal .profile-appearance-editor { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .profile-editor-portrait { padding: 4px; }
  .profile-editor-portrait .profile-appearance-preview { width: min(100%, 140px); }
  .profile-editor-portrait .profile-appearance-preview > span:not(:empty) { width: 40px; height: 40px; }
  .profile-appearance-modal .profile-appearance-editor .profile-appearance-upload {
    flex-flow: row wrap;
    justify-content: center;
    gap: 12px;
  }
  .profile-appearance-modal .modal-body { padding: 18px; }
}
