/* Avatar maker (avatar-maker.js) — its screen in Studio. Uses the host's
   tokens (--bg, --fg, --panel, --line, --muted, --ease). The preview in
   Instagram's circle, then style and colour as big thumb-sized targets;
   side by side from 900px, the preview staying in view as the controls
   scroll. */

.av { margin-top: 24px; }
.av__stage { display: grid; place-items: center; padding: 28px; border-radius: 20px; background: var(--panel); }
.av__pic { display: block; width: min(100%, 300px); aspect-ratio: 1; border-radius: 50%; box-shadow: 0 18px 40px -20px rgba(0,0,0,.6), 0 0 0 1px var(--line); }
.av__note { margin: 10px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.av__lbl { margin: 24px 0 8px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.av__styles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.av__styles button { display: grid; justify-items: center; gap: 6px; padding: 12px 6px 10px; border: 0; border-radius: 16px; background: var(--panel); color: var(--fg); font: inherit; font-size: 15px; line-height: 1.2; cursor: pointer; transition: box-shadow .2s, transform .2s var(--ease); }
.av__styles button:active { transform: scale(.96); }
.av__styles button[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--fg); }
.av__styles canvas { width: 100%; max-width: 96px; aspect-ratio: 1; border-radius: 50%; }

.av__pick { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.av__well { position: relative; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px; border-radius: 16px; background: var(--panel); cursor: pointer; }
/* the native picker, invisible over the whole well, so a tap anywhere opens it */
.av__input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.av__chip { flex: none; width: 34px; height: 34px; border-radius: 50%; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 18%, transparent); }
.av__wellt { display: grid; gap: 1px; font-size: 15px; }
.av__wellt small { color: var(--muted); font-size: 12.5px; }
.av__hex { display: flex; align-items: center; gap: 2px; width: 128px; padding: 0 14px; border-radius: 16px; background: var(--panel); color: var(--muted); font-size: 17px; }
.av__hex:focus-within { box-shadow: inset 0 0 0 2px var(--fg); }
.av__hex input { width: 100%; min-width: 0; border: 0; background: none; color: var(--fg); font: inherit; font-size: 17px; letter-spacing: .04em; text-transform: uppercase; font-variant-numeric: tabular-nums; outline: none; }

.av__sws { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 10px; }
.av__sws button { aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 14%, transparent); cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s; }
.av__sws button:active { transform: scale(.9); }
.av__sws button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fg); }

.av__btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 54px; margin-top: 8px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--panel); color: var(--fg); font: inherit; font-size: 16px; cursor: pointer; transition: transform .2s var(--ease), background-color .2s; }
.av__btn:active { transform: scale(.98); }
.av__btn--solid { background: var(--fg); color: var(--bg); }
.av__dice { margin-top: 24px; min-height: 48px; font-size: 15px; box-shadow: inset 0 0 0 1px var(--line); background: transparent; }
.av__ctl .av__note { text-align: left; }

@media (min-width: 900px) {
  .av { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 32px; align-items: start; }
  .av__view { position: sticky; top: 92px; }
  .av__stage { padding: 48px; }
  .av__pic { width: min(100%, 420px); }
  .av__lbl:first-child { margin-top: 0; }
}
