.avatar-editor {
  --avatar-accent: #478ad6;
  --avatar-light: #eef5ff;
  box-sizing: border-box;
  width: min(440px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  max-height: calc(100dvh - 28px);
  margin: auto;
  padding: 23px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #fff;
  border-radius: 25px;
  color: #344157;
  background: #fffdfd;
  box-shadow: 0 25px 90px #38425c38;
  font-family: inherit;
  text-align: left;
  scrollbar-width: thin;
}
.avatar-editor[data-owner="chen"] { --avatar-accent: #d76799; --avatar-light: #fff0f6; }
.avatar-editor[open] { animation: avatar-enter 180ms ease-out; }
.avatar-editor::backdrop { background: #28354b66; backdrop-filter: blur(7px); }
.avatar-editor *, .avatar-editor *::before, .avatar-editor *::after { box-sizing: border-box; }
.avatar-editor__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 20px; }
.avatar-editor__eyebrow { font-size: 12px; color: var(--avatar-accent); letter-spacing: 0.12em; }
.avatar-editor h2 { margin: 6px 0 0; padding: 0; font-size: 19px; line-height: 1.35; font-weight: 700; color: #344157; overflow-wrap: anywhere; }
.avatar-editor button { min-height: 44px; margin: 0; border-radius: 12px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; transition: background 160ms, transform 160ms; }
.avatar-editor button:active { transform: scale(0.98); }
.avatar-editor button:disabled { opacity: 0.45; cursor: default; transform: none; }
.avatar-editor button:focus-visible, .avatar-editor input:focus-visible, .avatar-editor canvas:focus-visible { outline: 3px solid var(--avatar-accent); outline-offset: 4px; }
.avatar-editor .avatar-editor__close { flex-shrink: 0; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--avatar-light); color: #536176; font-size: 25px; line-height: 1; }
.avatar-editor__preview { display: grid; place-items: center; min-height: 80px; margin: 0 auto; }
.avatar-editor canvas { display: block; width: min(100%, 280px); aspect-ratio: 1; height: auto; border-radius: 50%; outline: 4px solid var(--avatar-accent); outline-offset: 4px; background: var(--avatar-light); box-shadow: 0 8px 25px #37496612; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.avatar-editor canvas[hidden] { display: none; }
.avatar-editor canvas.is-dragging { cursor: grabbing; }
.avatar-editor__status { min-height: 38px; margin: 20px 0 12px; font-size: 12px; line-height: 1.7; color: #6c7788; }
.avatar-editor__status.is-error { color: #b5374b; background: #fff0f1; padding: 10px 12px; border-radius: 10px; }
.avatar-editor__controls { min-width: 0; margin: 0; padding: 0; border: 0; }
.avatar-editor__slider { display: block; min-width: 0; }
.avatar-editor__slider > span { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 1px; font-size: 12px; font-weight: 600; color: #566175; }
.avatar-editor__slider output { color: var(--avatar-accent); font-variant-numeric: tabular-nums; }
.avatar-editor input[type="range"] { display: block; width: 100%; min-width: 0; min-height: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; accent-color: var(--avatar-accent); cursor: pointer; }
.avatar-editor input[type="range"]:disabled { opacity: 0.35; cursor: default; }
.avatar-editor__position { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 3px; }
.avatar-editor .avatar-editor__reset { display: block; padding: 0 10px; margin: 0 auto; border: 0; background: transparent; color: var(--avatar-accent); font-size: 12px; }
.avatar-editor .avatar-editor__reset:hover { background: var(--avatar-light); }
.avatar-editor__footer { display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px; margin-top: 12px; }
.avatar-editor .avatar-editor__cancel { border: 1px solid #dfe4eb; background: #fff; color: #596578; }
.avatar-editor .avatar-editor__save { border: 1px solid var(--avatar-accent); background: var(--avatar-accent); color: #fff; }
.avatar-editor__sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.avatar-upload:focus-visible { outline: 3px solid #8a97aa; outline-offset: 5px; border-radius: 50%; }
@keyframes avatar-enter { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 480px) {
  .avatar-editor { padding: 18px; border-radius: 22px; }
  .avatar-editor__header { margin-bottom: 18px; }
  .avatar-editor canvas { width: min(100%, 260px); }
  .avatar-editor__position { gap: 16px; }
  .avatar-editor__footer button { min-height: 48px; }
}
@media (max-height: 720px) {
  .avatar-editor canvas { width: min(100%, 205px); }
  .avatar-editor__header { margin-bottom: 15px; }
  .avatar-editor__status { margin-top: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .avatar-editor[open] { animation: none; }
  .avatar-editor button { transition: none; }
}
