/* shared/chimp-avatar.css — the avatar editor (shared/chimp-avatar-editor.js): one component, mounted by the sign-up step
   and by My Avatar. Design sheet v3 tokens and materials (site/account-assets/v3.css), each with its v3 value as a
   fallback so the sheet also stands where those tokens are not defined.
   The layout follows the editor's own width (a container query), not the window's, so it fits whatever it is mounted in:
   narrow = the picture, then the part tabs, then the options; from 620 px the picture has its own column and stays in
   view; from 900 px the part tabs stand as a rail between the picture and the options. The tabs wrap; they never scroll.
   Owner's rules kept: the picture is pinned only where it has its own column (pinned on a phone it covered the options),
   it is the one pinned thing in the sheet, and the extras stand in whole columns (one, two, three), never auto-fill.
   The rarity chip on an extra, and the tier's frame and backdrop on its picture (cv-rarity-tile: border, tinted
   backdrop, small glow, Unique's shine), are the design system's own (shared/cv-rarity.css, generated; not restyled
   here). The card around them stays neutral (owner, 2026-11-16: no tier colour on the whole box). */
.cv-editor,.cv-cosmetics{
  --cve-ground:var(--ground,#0a0d12); --cve-1:var(--tone-1,#10161d); --cve-2:var(--tone-2,#172029); --cve-3:var(--tone-3,#1f2a36);
  --cve-ink:var(--ink,#e8ecf1); --cve-dim:var(--dim,#93a0ad);
  --cve-mint:var(--mint,#78d8aa); --cve-mint-bright:var(--mint-bright,#c8fce3); --cve-mint-deep:var(--mint-deep,#2f8a62);
  --cve-coin:var(--coin,#ffc94d); --cve-coin-deep:var(--coin-deep,#b9840f);
  --cve-text:var(--f-text,"Rubik","Segoe UI",system-ui,sans-serif); --cve-show:var(--f-show,"Russo One","Arial Black",Impact,sans-serif);
  --cve-raised:var(--surface-raised,linear-gradient(165deg,#25323f 0%,#1b2631 48%,#151e27 100%));
  --cve-low:var(--surface-low,linear-gradient(170deg,#18222d,#10171f));
  --cve-recessed:var(--depth-recessed,inset 0 2px 5px #00000080,inset 0 -1px 0 #ffffff12);
  --cve-edge-light:var(--edge-light,inset 0 1px 0 #ffffff1f); --cve-edge-dark:var(--edge-dark,inset 0 -2px 0 #00000059); --cve-contact:var(--shadow-contact,0 2px 3px #00000066);
  --cve-lift:var(--depth-raised,inset 0 1px 0 #ffffff1f,inset 0 -2px 0 #00000059,0 2px 3px #00000066,0 10px 22px -8px #00000099);
  --cve-track:linear-gradient(var(--cve-ground),color-mix(in srgb,var(--cve-1) 50%,var(--cve-2))); /* the sheet's recessed track (its Tabs component), from its tones */
  --cve-well:linear-gradient(color-mix(in srgb,var(--cve-ground) 70%,var(--cve-1)),color-mix(in srgb,var(--cve-1) 80%,var(--cve-2))); /* the sheet's well (its Field component), from its tones */
  --cve-chosen:var(--cve-edge-light),inset 0 -1px 0 color-mix(in srgb,var(--cve-ground) 60%,transparent),var(--cve-contact); /* the sheet's chosen tab */
  --cve-top:var(--nav-h,68px);
}
.cv-editor{container:cv-editor/inline-size;min-width:0}
.cv-editor button{font-family:var(--cve-text)}
.cv-editor :focus-visible{outline:3px solid var(--cve-coin);outline-offset:3px}
.cv-editor__layout{display:grid;gap:16px;min-width:0}
.cv-editor__controls{display:grid;gap:28px;min-width:0;align-content:start}

/* the stage: a well lit from above, the picture standing in it as a framed card */
.cv-editor__preview{position:relative;display:grid;grid-template-columns:auto minmax(0,1fr);gap:16px;align-items:center;padding:16px;border-radius:22px;overflow:hidden;
  background:radial-gradient(120% 85% at 50% -10%,color-mix(in srgb,var(--cve-mint) 30%,transparent),transparent 70%),var(--cve-track);box-shadow:var(--cve-recessed)}
.cv-editor__spot{position:relative;display:grid;justify-items:center;min-width:0}
/* the light pools behind the picture, so the well and the card read as one lit stage */
.cv-editor__spot::before{content:"";position:absolute;inset:-22% -30%;border-radius:50%;background:radial-gradient(closest-side,color-mix(in srgb,var(--cve-mint) 26%,transparent),transparent);pointer-events:none}
.cv-editor__spot::after{content:"";position:absolute;left:14%;right:14%;bottom:-9px;height:16px;border-radius:50%;background:var(--cve-ground);filter:blur(7px);opacity:.9}
.cv-editor__stage{position:relative;z-index:1;width:128px;height:128px;flex:none;border-radius:28px;overflow:hidden;
  box-shadow:0 0 0 3px var(--cve-3),0 0 0 4px color-mix(in srgb,var(--cve-mint-bright) 30%,transparent),0 14px 24px -12px var(--cve-ground)}
.cv-editor__stage svg{display:block;width:100%;height:100%;animation:cv-pop .24s cubic-bezier(.2,.8,.3,1.25)}
@keyframes cv-pop{from{transform:scale(.94)}to{transform:scale(1)}}
/* narrow: the picture with its small sizes beside it, Randomize under both across the stage's full width (beside the
   picture it broke onto two lines on a phone). The side is unboxed here so its three pieces sit in the stage's grid. */
.cv-editor__preview{row-gap:12px}
.cv-editor__side{display:contents}
.cv-editor__spot{grid-row:1 / span 2}
.cv-editor__sizes-note{grid-column:2;align-self:end}
.cv-editor__sizes{grid-column:2;align-self:start}
.cv-editor__side .cv-btn-random{grid-column:1 / -1;grid-row:3;width:100%}
.cv-editor__sizes-note{margin:2px 0 0;font:500 12px/1.2 var(--cve-text);letter-spacing:.14em;text-transform:uppercase;color:var(--cve-dim)}
.cv-editor__sizes{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.cv-size{display:flex;align-items:center;gap:8px;font-size:13px;line-height:1.2;color:var(--cve-dim)}
.cv-size svg{display:block}
.cv-size .ring{display:block;border-radius:50%;overflow:hidden;flex:none;box-shadow:0 0 0 2px var(--cve-3)}
/* Randomize: the sheet's Tag material (coin lettering on dark amber) with a die; a quiet second to the page's mint cap */
.cv-btn-random{display:inline-flex;align-items:center;justify-content:center;gap:9px;min-height:44px;padding:0 16px;border:0;border-radius:12px;font:500 16px/1.15 var(--cve-text);cursor:pointer;
  color:var(--cve-coin);background:linear-gradient(170deg,color-mix(in srgb,var(--cve-coin) 26%,var(--cve-2)),color-mix(in srgb,var(--cve-coin) 12%,var(--cve-1)));
  box-shadow:inset 0 1px 0 color-mix(in srgb,var(--cve-coin) 30%,transparent),var(--cve-edge-dark),var(--cve-contact);transition:filter .14s,transform .14s}
.cv-btn-random:hover{filter:brightness(1.14);transform:translateY(-1px)}
.cv-btn-random:active{transform:translateY(1px);filter:brightness(.96);box-shadow:var(--cve-recessed)}
.cv-btn-random svg{width:20px;height:20px;flex:none}

/* the part tabs on a recessed track: they wrap, so every part shows at every width, and each tab grows, so every row
   fills the track edge to edge (no row ends in an empty cell); five at most to a row, so the ten parts stand 5 + 5 where
   there is room and 4 + 4 + 2 on a phone; words never break */
.cv-parts{display:grid;gap:18px;min-width:0;align-content:start}
.cv-tabs{display:flex;flex-wrap:wrap;gap:4px;padding:5px;border-radius:14px;background:var(--cve-track);box-shadow:var(--cve-recessed)}
.cv-tab{flex:1 1 calc(20% - 4px);min-width:64px;min-height:44px;padding:4px 10px;border:0;border-radius:10px;background:none;color:var(--cve-dim);font:500 14px/1.15 var(--cve-text);cursor:pointer;white-space:nowrap;transition:color .14s,background-color .14s}
.cv-tab:not([aria-selected="true"]):hover{color:var(--cve-ink);background:color-mix(in srgb,var(--cve-ink) 6%,transparent)}
.cv-tab:not([aria-selected="true"]):active{background:color-mix(in srgb,var(--cve-ground) 50%,transparent)}
.cv-tab[aria-selected="true"]{color:var(--cve-mint-bright);background:var(--cve-raised);box-shadow:var(--cve-chosen)}
/* the options measure their own width (cv-opts), so a group of pictures can choose balanced rows below */
.cv-panel{display:grid;gap:24px;min-width:0;align-content:start;container:cv-opts/inline-size}
.cv-group{min-width:0}
.cv-group__head{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 10px;margin:0 0 10px}
.cv-group__label{font:500 13px/1.2 var(--cve-text);letter-spacing:.14em;text-transform:uppercase;color:var(--cve-dim);margin:0}
.cv-group__now{font:500 15px/1.2 var(--cve-text);color:var(--cve-ink)}
.cv-opts--thumb{display:grid;gap:10px;grid-template-columns:repeat(auto-fill,minmax(96px,1fr))}
/* an option: a low tile; the chosen one is raised, ringed in mint and ticked */
.cv-opt{position:relative;display:grid;justify-items:center;align-content:start;gap:8px;padding:12px 6px 11px;min-height:44px;border:0;border-radius:16px;background:var(--cve-low);box-shadow:var(--cve-edge-light),var(--cve-edge-dark);color:var(--cve-ink);cursor:pointer;transition:transform .14s,filter .14s}
.cv-opt:hover{transform:translateY(-2px);filter:brightness(1.14)}
.cv-opt:active{transform:translateY(0) scale(.98);filter:brightness(.98)}
/* The chosen tile's green ring and raised lip are both drawn inside its edge. A ring drawn outside (0 0 0 2px) met the
   inner lip on the same rounded edge, and the two smoothed edges let the dark drop shadow show through as a hairline at
   the bottom corners. The tile reaches 2px out instead (margin, with the padding to match), so its size, its content
   and the lip stay where they were; the light top edge moves down under the ring. */
.cv-opt[aria-checked="true"]{margin:-2px;padding:14px 8px 13px;border-radius:18px;background:var(--cve-raised);box-shadow:inset 0 0 0 2px var(--cve-mint),inset 0 -4px 0 2px var(--cve-mint),inset 0 1px 0 2px color-mix(in srgb,var(--cve-ink) 12%,transparent),0 10px 18px -12px var(--cve-ground)}
.cv-opt__art{width:72px;height:72px;display:block;border-radius:50%;overflow:hidden;box-shadow:0 0 0 2px var(--cve-3)}
.cv-opt__art svg{display:block;width:100%;height:100%}
.cv-opt__name{font-size:14px;line-height:1.15;text-align:center;overflow-wrap:anywhere}
.cv-opt[aria-checked="true"] .cv-opt__name{color:var(--cve-mint-bright)}
.cv-opt__tick{display:none;position:absolute;top:-6px;right:-6px;width:24px;height:24px;border-radius:50%;place-items:center;background:var(--cve-mint);color:var(--cve-ground);box-shadow:0 0 0 3px var(--cve-2)}
.cv-opt__tick svg{width:14px;height:14px}
.cv-opt[aria-checked="true"] .cv-opt__tick{display:grid}
/* colours: SVG discs (the page allows no inline style) in a paint tray; the chosen one gets a ring and a tick */
.cv-opts--swatch{display:flex;flex-wrap:wrap;gap:6px;padding:8px;border-radius:18px;background:var(--cve-track);box-shadow:var(--cve-recessed)}
.cv-swatch{position:relative;display:grid;place-items:center;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:none;cursor:pointer;transition:transform .14s}
.cv-swatch:hover{transform:scale(1.08)}
.cv-swatch:active{transform:scale(.96)}
.cv-swatch svg{display:block;width:34px;height:34px;border-radius:50%}
.cv-swatch[aria-checked="true"] svg{box-shadow:0 0 0 3px var(--cve-ground),0 0 0 6px var(--cve-mint-bright)}
.cv-swatch[aria-checked="true"]::after{content:"";position:absolute;width:14px;height:8px;border-left:3px solid var(--cve-ground);border-bottom:3px solid var(--cve-ground);transform:translateY(-2px) rotate(-45deg)}
.cv-swatch[data-dark="true"][aria-checked="true"]::after{border-color:var(--cve-ink)}

/* the extras (My Avatar only): a tally, then three shelves. Yours stand raised with a coin rim; the rest lie in wells.
   Each card: its name and rarity chip, how it was obtained (earned, or a gift from ChimpVibe), then where it stands */
.cv-cosmetics{display:grid;gap:18px;min-width:0;align-content:start}
.cv-cosmetics[hidden]{display:none}
.cv-cosmetics :focus-visible{outline:3px solid var(--cve-coin);outline-offset:3px}
.cv-cosmetics__head{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:12px 24px}
.cv-cosmetics__title{display:grid;gap:6px;min-width:0}
.cv-cosmetics h2{font:400 clamp(20px,2.2vw,28px)/1.15 var(--cve-show);margin:0;color:var(--cve-ink)}
.cv-cosmetics__lede{margin:0;color:var(--cve-dim);max-width:60ch}
.cv-cosmetics__tally{display:grid;grid-template-columns:auto auto;align-items:baseline;justify-content:start;gap:6px 8px;margin:0;color:var(--cve-dim);font-size:15px;min-width:150px}
.cv-cosmetics__count{font:400 24px/1 var(--cve-show);color:var(--cve-coin);letter-spacing:.01em}
.cv-cosmetics__tally .cv-cos__bar,.cv-cosmetics__gifts{grid-column:1 / -1}
.cv-cosmetics__gifts{display:inline-flex;align-items:center;gap:6px;color:var(--cve-coin);font-weight:500}
.cv-cosmetics__gifts svg{width:15px;height:15px;flex:none}
.cos-note{margin:0;padding:10px 14px;border-radius:12px;background:linear-gradient(170deg,color-mix(in srgb,var(--cve-coin) 22%,var(--cve-2)),color-mix(in srgb,var(--cve-coin) 10%,var(--cve-1)));box-shadow:inset 0 1px 0 color-mix(in srgb,var(--cve-coin) 26%,transparent),var(--cve-edge-dark);color:var(--cve-ink);font-size:15px}
.cos-note[hidden]{display:none}
.cos-shelves{display:grid;gap:22px;min-width:0}
.cos-shelf{display:grid;gap:10px;min-width:0}
.cos-shelf__label{display:flex;align-items:center;gap:8px;margin:0;font:500 13px/1.2 var(--cve-text);letter-spacing:.14em;text-transform:uppercase;color:var(--cve-dim)}
.cos-shelf__count{min-width:22px;padding:3px 7px;border-radius:999px;background:var(--cve-track);box-shadow:var(--cve-recessed);color:var(--cve-ink);font-size:12px;letter-spacing:0;text-align:center}
.cos-shelf--mine .cos-shelf__label{color:var(--cve-coin)}
.cos-grid{display:grid;gap:10px;grid-template-columns:minmax(0,1fr)}
.cv-cos{position:relative;display:grid;grid-template-columns:auto minmax(0,1fr);gap:14px;align-items:center;min-height:100px;padding:12px 14px 12px 12px;border:0;border-radius:18px;background:var(--cve-raised);box-shadow:var(--cve-lift);color:var(--cve-ink);font-family:var(--cve-text);text-align:left;cursor:pointer;transition:transform .14s,filter .14s}
.cv-cos:not([aria-disabled="true"]):hover{transform:translateY(-2px);filter:brightness(1.08)}
/* worn (the selected card): a ring in the site's bright mint round the neutral card (never a tier colour), plus its check;
   keyboard focus: the same mint drawn as an outline, pushed further out when the card is also worn */
.cv-cos[aria-pressed="true"]{box-shadow:var(--cve-lift),0 0 0 2px var(--cve-mint-bright)}
.cv-cosmetics .cv-cos:focus-visible{outline:3px solid var(--cve-mint-bright);outline-offset:3px}
.cv-cosmetics .cv-cos[aria-pressed="true"]:focus-visible{outline-offset:5px}
/* the picture in its tier's frame (cv-rarity-tile): border and tinted backdrop behind the avatar wearing the extra */
.cv-cos__art{position:relative;width:80px;height:80px;flex:none;display:block;padding:2px;border-radius:14px}
.cv-cos__art svg{display:block;width:100%;height:100%;border-radius:11px}
.cv-cos__badge{position:absolute;right:-4px;bottom:-4px;width:26px;height:26px;border-radius:50%;display:grid;place-items:center;background:var(--cve-3);color:var(--cve-coin);box-shadow:0 0 0 3px var(--cve-ground)}
.cv-cos__badge svg{width:13px;height:13px}
.cv-cos__body{min-width:0;display:grid;gap:3px}
.cv-cos__top{display:flex;flex-wrap:wrap;align-items:center;gap:5px 8px;min-width:0}
.cv-cos__name{font-weight:600;font-size:16px;line-height:1.2;overflow-wrap:anywhere}
.cv-cos .cv-rarity{font-size:13px;min-height:22px;padding-block:1px}
.cv-cos .cv-cos__how--gift{display:inline-flex;align-items:center;gap:5px;color:var(--cve-coin)}
.cv-cos .cv-cos__how--gift svg{width:13px;height:13px;flex:none}
.cv-cos__badge--gift{background:var(--cve-coin);color:var(--cve-ground)}
.cv-cos__how{color:var(--cve-dim);font-size:13px;line-height:1.3}
.cv-cos__state{font:600 13px/1.2 var(--cve-text);display:inline-flex;align-items:center;gap:5px;margin-top:2px}
.cv-cos__state svg{width:13px;height:13px;flex:none}
.cv-cos__state--on,.cv-cos__state--off{color:var(--cve-mint-bright)}
.cv-cos__state--later{color:var(--cve-dim)}
.cv-cos__state--locked{color:var(--cve-coin)}
/* not yours yet: sunk into a well, the picture dimmed behind its lock or clock; the tier's border stays, its backdrop
   and glow weaker (cv-rarity-tile--locked) */
.cv-cos[aria-disabled="true"]{background:var(--cve-well);box-shadow:var(--cve-recessed);cursor:not-allowed}
.cv-cos[aria-disabled="true"] .cv-cos__art svg{opacity:.4;filter:grayscale(.7)}
.cv-cos[aria-disabled="true"] .cv-cos__name{color:var(--cve-dim)}
.cv-cos[aria-disabled="true"] .cv-rarity{opacity:.75}
.cv-cos[data-state="later"] .cv-cos__badge{color:var(--cve-dim)}
/* progress: a plain <progress>, drawn as a thin coin bar */
.cv-cos__bar{display:block;width:100%;height:6px;margin-top:4px;border:0;border-radius:999px;background:var(--cve-ground);overflow:hidden;appearance:none;-webkit-appearance:none}
.cv-cos__bar::-webkit-progress-bar{background:var(--cve-ground);border-radius:999px}
.cv-cos__bar::-webkit-progress-value{background:var(--cve-coin);border-radius:999px}
.cv-cos__bar::-moz-progress-bar{background:var(--cve-coin);border-radius:999px}

/* one half at a time, where the page marks the mount (My Avatar's sections) */
[data-cv-view="parts"] .cv-cosmetics,[data-cv-view="extras"] .cv-parts{display:none}
/* the half that is chosen comes in with a short rise; the picture beside it stays put */
[data-cv-view] .cv-parts,[data-cv-view] .cv-cosmetics{animation:cv-in .2s ease-out}
@keyframes cv-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}

/* balanced rows: where a group of pictures would wrap and leave a lonely tile on its last row, it takes fewer, wider
   columns instead (four as 2 + 2 on a phone; five as 3 + 2; six as 3 + 3; seven and eight in fours). The widths are the
   options' own: where every tile fits on one row (at the widest tile size, 112 px plus the 10 px gap), nothing changes */
@container cv-opts (max-width:477px){.cv-opts--thumb:has(>:nth-child(4):last-child){grid-template-columns:repeat(2,minmax(0,1fr))}}
@container cv-opts (max-width:599px){.cv-opts--thumb:has(>:nth-child(5):last-child){grid-template-columns:repeat(3,minmax(0,1fr))}}
@container cv-opts (max-width:721px){.cv-opts--thumb:has(>:nth-child(6):last-child){grid-template-columns:repeat(3,minmax(0,1fr))}}
@container cv-opts (min-width:430px) and (max-width:843px){.cv-opts--thumb:has(>:nth-child(7):last-child){grid-template-columns:repeat(4,minmax(0,1fr))}}
@container cv-opts (min-width:430px) and (max-width:965px){.cv-opts--thumb:has(>:nth-child(8):last-child){grid-template-columns:repeat(4,minmax(0,1fr))}}

/* from 620 px of its own width: the picture in its own column, staying in view under the site's top bar */
@container cv-editor (min-width:620px){
  .cv-editor__layout{grid-template-columns:minmax(230px,36%) minmax(0,1fr);gap:24px;align-items:start}
  .cv-editor__preview{grid-template-columns:minmax(0,1fr);justify-items:center;gap:22px;padding:30px 20px 22px;position:sticky;top:calc(var(--cve-top) + 16px);z-index:1}
  .cv-editor__spot{width:100%}
  .cv-editor__stage{width:100%;max-width:280px;height:auto;aspect-ratio:1;border-radius:36px}
  .cv-editor__spot::after{bottom:-12px;height:22px}
  .cv-editor__side{display:grid;width:100%;justify-items:center;gap:12px}
  .cv-editor__spot,.cv-editor__sizes-note,.cv-editor__sizes,.cv-editor__side .cv-btn-random{grid-row:auto;grid-column:auto}
  .cv-editor__side .cv-btn-random{width:100%;max-width:280px}
  .cv-editor__sizes{justify-content:center}
}
/* from 900 px: the part tabs stand as a rail beside the options */
@container cv-editor (min-width:900px){
  .cv-editor__layout{grid-template-columns:minmax(280px,340px) minmax(0,1fr);gap:28px}
  .cv-parts{grid-template-columns:172px minmax(0,1fr);gap:28px;align-items:start}
  .cv-tabs{display:grid;grid-template-columns:minmax(0,1fr)}
  .cv-tab{min-height:44px;padding:4px 14px;font-size:16px;text-align:left}
  .cv-tab[aria-selected="true"]{box-shadow:var(--cve-chosen),inset 3px 0 0 var(--cve-mint)}
  .cv-opts--thumb{grid-template-columns:repeat(auto-fill,minmax(104px,1fr))}
  .cos-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@container cv-editor (min-width:1200px){
  .cv-editor__layout{grid-template-columns:380px minmax(0,1fr);gap:32px}
  .cv-editor__stage{max-width:320px}
  .cv-editor__side .cv-btn-random{max-width:320px}
  .cv-opts--thumb{grid-template-columns:repeat(auto-fill,minmax(112px,1fr))}
  .cv-opt__art{width:80px;height:80px}
}
@container cv-editor (min-width:1500px){
  .cos-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}

/* what a screen reader hears after a choice; never seen */
.cv-live{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
@media (prefers-reduced-motion:reduce){.cv-editor *,.cv-cosmetics *{transition:none!important;animation:none!important}}
