.avatar-editor { display: grid; grid-template-columns: minmax(240px,.8fr) minmax(0,1.2fr); gap: 45px; align-items: start; }
.avatar-preview { --pencil: #258653; background: #00e070; display: flex; flex-direction: column; align-items: center; padding: 30px 16px; position: sticky; top: 25px; }
.avatar-preview::after, .avatar-effects label::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; background: var(--pencil);
  -webkit-mask: var(--outline) center / 100% 100% no-repeat;
  mask: var(--outline) center / 100% 100% no-repeat;
}
.avatar-preview canvas { width: min(100%,288px); aspect-ratio: 6/7; height: auto; image-rendering: pixelated; }
.avatar-preview strong { font: 700 27px/1.2 var(--display-font); margin-top: 20px; text-align: center; }
.avatar-editor fieldset { border: 0; padding: 0; margin: 0 0 25px; min-width: 0; }
.avatar-editor legend { font-size: 16px; font-weight: 900; margin-bottom: 12px; }
.avatar-effects { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.avatar-effects label { --pencil: #736d68; margin: 0; display: flex; align-items: center; flex-direction: column; position: relative; cursor: pointer; background: white; padding: 8px 4px 15px; gap: 4px; text-align: center; min-width: 0; }
.avatar-effects label:has(input:checked) { --pencil: #c9531d; background: #ffcf00; }
.avatar-effects input { position: absolute; top: 12px; left: 12px; width: 16px; height: 16px; margin: 0; accent-color: #a74313; z-index: 1; }
.avatar-effects canvas { width: 100%; max-width: 115px; aspect-ratio: 6/7; height: auto; image-rendering: pixelated; }
.avatar-effects span { font-size: 13px; font-weight: 900; line-height: 1.3; overflow-wrap: anywhere; }
.avatar-swatches { display: flex; gap: 15px; flex-wrap: wrap; padding: 4px; }
.avatar-swatches label { margin: 0; cursor: pointer; }
.avatar-swatches input { appearance: none; -webkit-appearance: none; width: 38px; height: 38px; border: 2px solid var(--ink); border-radius: 0; padding: 0; margin: 0; background: var(--swatch); display: block; }
.avatar-swatches input:checked { outline: 3px solid var(--ink); outline-offset: 3px; box-shadow: inset 0 0 0 3px #fff; }
.avatar-swatches input:focus-visible { outline: 3px solid #4e176f; outline-offset: 5px; }
.avatar-editor select { width: 100%; max-width: 300px; }
.avatar-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.avatar-editor form .primary { width: auto; }
.avatar-editor input:disabled, .avatar-editor select:disabled { opacity: .5; cursor: wait; }
#avatar-status { font-size: 14px; line-height: 1.5; min-height: 24px; margin: 18px 0 5px; }
@media (max-width:650px) {
  .avatar-editor { grid-template-columns: 1fr; gap: 25px; }
  .avatar-preview { position: relative; top: 0; padding: 15px; }
  .avatar-preview canvas { width: 180px; }
  .avatar-preview strong { font-size: 23px; margin-top: 10px; }
}
