/* Percentage padding resolves against the containing block, not the element
   itself, so the frame is capped one level up: that keeps its own width equal to
   the percentage base and the preview border exactly proportional to the PNG. */
.preview-cap {
  width: 100%;
  max-width: 320px;
}

/* Square and unrounded on purpose: the preview must match the exported PNG,
   which has hard corners and no outline. */
.preview-frame {
  --avatar-bg: var(--surface-variant);
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  padding: 0;
  background: var(--avatar-bg);
  box-shadow: 0 8px 24px rgb(0 0 0 / 30%);
  /* Padding is deliberately not transitioned: the preview has to show the
     exported border width exactly, including mid-drag on the width slider. */
  transition: background-color var(--transition), opacity var(--transition);
}

.preview-frame.has-border {
  /* Share of the export edge taken by the border — border / (1000 + 2 × border) —
     kept in sync by ui/handlers.js so the frame matches the PNG composition. */
  padding: var(--avatar-border-padding, 0);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  transition: opacity var(--transition);
}

canvas.loading {
  opacity: 0.45;
}

.name-label {
  width: 100%;
  min-height: 24px;
  overflow-wrap: anywhere;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.name-label.active {
  color: var(--primary);
}
