/* Native-dialog profile sheet and the shared avatar selector. */
dialog.profile-sheet-dialog {
  position: fixed;
  inset: auto 0 0;
  width: min(100%, 560px);
  max-width: 100vw;
  max-height: calc(100vh - 20px);
  max-height: calc(100dvh - 20px);
  margin: 0 auto;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #171717;
  color: #f6f6f6;
  border: 1px solid #ffffff16;
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -16px 70px #0008;
  scrollbar-width: thin;
  scrollbar-color: #555 transparent;
}

.profile-sheet-dialog::backdrop { background: #000a; backdrop-filter: blur(5px); }
.profile-sheet-dialog .modal { padding: 0; }
.profile-sheet { padding: 0 20px max(22px, env(safe-area-inset-bottom)); }
.profile-sheet-handle { display: block; width: 42px; height: 4px; margin: 12px auto 8px; border-radius: 4px; background: #6b6b6b; }
.profile-sheet-header { position: relative; display: grid; place-items: center; min-height: 48px; margin-bottom: 16px; }
.profile-sheet-header h2 { margin: 0; padding: 0; font-family: inherit; font-size: 19px; font-weight: 650; line-height: 1.3; letter-spacing: -.3px; }
.profile-sheet-close { position: absolute; right: 0; top: 4px; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #303030; color: #f5f5f5; }
.profile-sheet-close:hover { background: #414141; }
.profile-sheet-icon { display: block; width: 24px; height: 24px; flex: 0 0 auto; }
.profile-sheet-active { display: flex; flex-direction: column; align-items: center; padding: 30px 20px 25px; border-radius: 28px; background: #2c2c2c; }
.profile-sheet-edit { position: relative; display: block; width: 110px; height: 110px; padding: 0; border-radius: 22px; }
.profile-sheet-active .viewer-avatar.large { width: 110px; height: 110px; border-radius: 22px; padding: 15px; box-shadow: 0 8px 25px #0003; }
.profile-sheet-pencil { position: absolute; right: -8px; bottom: -5px; display: grid; place-items: center; width: 35px; height: 35px; border: 3px solid #2c2c2c; border-radius: 50%; background: #f4f4f4; color: #202020; }
.profile-sheet-pencil .profile-sheet-icon { width: 17px; height: 17px; }
.profile-sheet-active h3 { max-width: 100%; margin: 20px 0 0; overflow-wrap: anywhere; text-align: center; font-size: 24px; font-weight: 600; line-height: 1.25; letter-spacing: -.6px; }
.profile-sheet-kids { margin-top: 9px; color: #d9d9d9; font-size: 12px; }
.profile-sheet-switch { margin: 26px 0 20px; }
.profile-sheet-switch h3 { margin: 0 0 14px; font-size: 13px; font-weight: 500; color: #c4c4c4; }
.profile-sheet-viewers { display: flex; align-items: flex-start; gap: 16px; padding: 3px 2px 9px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: #555 transparent; }
.profile-sheet-viewer { display: flex; flex: 0 0 86px; flex-direction: column; align-items: center; gap: 10px; width: 86px; padding: 0; color: #f1f1f1; text-align: center; border-radius: 16px; }
.profile-sheet-viewer .viewer-avatar.large { width: 80px; height: 80px; padding: 11px; border-radius: 17px; }
.profile-sheet-viewer-name { max-width: 86px; overflow-wrap: anywhere; font-size: 12px; line-height: 1.35; }
.profile-sheet-viewer-kind { margin-top: -6px; color: #aaa; font-size: 10px; }
.profile-sheet-add-icon { display: grid; place-items: center; width: 80px; height: 80px; border: 1px solid #565656; border-radius: 17px; background: #272727; }
.profile-sheet-add-icon .profile-sheet-icon { width: 32px; height: 32px; }
.profile-sheet-actions { margin-top: 16px; }
.profile-sheet-row { display: flex; align-items: center; gap: 17px; width: 100%; min-height: 57px; padding: 16px 4px; border-bottom: 1px solid #ffffff0c; border-radius: 0; color: #f2f2f2; text-align: left; }
.profile-sheet-row:last-child { border-bottom: 0; }
.profile-sheet-row>span { flex: 1; font-size: 14px; line-height: 1.4; }
.profile-sheet-row>.profile-sheet-icon:first-child { color: #d1d1d1; }
.profile-sheet-row>.profile-sheet-icon:last-child { width: 16px; height: 16px; color: #999; }
.profile-sheet-row:hover { background: #ffffff06; }
.profile-sheet-row[data-action="logout"] { color: #ddd; }
.profile-sheet button:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

.viewer-avatar.viewer-avatar-photo,
.profile-sheet .viewer-avatar.viewer-avatar-photo,
.avatar-picker .viewer-avatar.viewer-avatar-photo { padding: 0; background-repeat: no-repeat; }
.avatar-picker { min-width: 0; }
.avatar-picker-group { border: 1px solid #ffffff1b; border-radius: 14px; margin: 10px 0; padding: 0 13px; overflow: hidden; }
.avatar-picker-group summary { padding: 16px 2px; cursor: pointer; color: #e5e1e3; font-size: 13px; font-weight: 500; line-height: 1.4; }
.avatar-picker-group summary span { float: right; margin-left: 10px; color: #9b969b; font-size: 11px; font-weight: 400; }
.avatar-picker-group summary:focus-visible { outline: 2px solid #eee; outline-offset: -3px; border-radius: 8px; }
.avatar-picker-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 9px; padding: 4px 0 17px; }
.avatar-picker-option { position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; padding: 4px; cursor: pointer; border: 2px solid transparent; border-radius: 16px; }
.avatar-picker-option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.avatar-picker-option .viewer-avatar.large { display: block; width: 100%; height: auto; max-width: 90px; aspect-ratio: 1; padding: 9px; border-radius: 11px; }
.avatar-picker-option>span:last-child { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #bfb8c0; font-size: 10px; line-height: 1.35; }
.avatar-picker-option:has(input:checked) { border-color: #f4f1ed; background: #ffffff0a; }
.avatar-picker-option:has(input:checked)>span:last-child { color: #fff; }
.avatar-picker-option:has(input:focus-visible) { outline: 2px solid #e5c09e; outline-offset: 3px; }

@media (max-width: 370px) {
  .profile-sheet { padding-inline: 16px; }
  .profile-sheet-active { padding-top: 26px; padding-bottom: 23px; }
  .profile-sheet-viewers { gap: 12px; }
  .avatar-picker-group { padding-inline: 9px; }
  .avatar-picker-grid { gap: 10px 5px; }
  .avatar-picker-option { padding: 3px; border-radius: 12px; }
}
