.avatar-gear-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(86px,1fr)); gap:8px; margin:12px 0 16px; }
.avatar-gear-pick { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; min-height:96px; padding:8px; border:2px solid transparent; border-radius:12px; background:var(--ui-surface-alt,#153337); color:var(--ui-text,#e5f4ef); font:11px 'Segoe UI',sans-serif; cursor:pointer; }
.avatar-gear-pick[aria-pressed="true"] { border-color:var(--ui-accent,#68d7be); background:var(--ui-surface,#204347); }
.avatar-gear-pick:focus-visible { outline:2px solid #68d7be; outline-offset:2px; }
.avatar-gear-pick:disabled { opacity:0.6; cursor:wait; }
.avatar-gear-thumb { display:block; width:56px; height:56px; background-size:800% 500%; background-repeat:no-repeat; font-size:36px; line-height:56px; }
#avatarV2Picker { flex-wrap:wrap; gap:8px; justify-content:center; max-height:340px; overflow:auto; }
#avatarV2Picker button[data-avatar] { flex:0 0 96px; min-height:106px; padding:8px!important; display:flex; flex-direction:column; align-items:center; gap:4px; border:2px solid transparent; border-radius:12px; background:var(--ui-surface-alt); color:var(--ui-text); cursor:pointer; }
#avatarV2Picker button[data-avatar][aria-pressed="true"] { border-color:var(--ui-accent,#68d7be)!important; }
.avatar-v2-character-thumb { display:block; width:64px; height:64px; background-size:800% 700%; background-repeat:no-repeat; }
.avatar-picker-tabs { display:flex; justify-content:center; gap:6px; width:fit-content; max-width:100%; margin:0 auto 16px; padding:4px; border:1px solid var(--ui-border-accent); border-radius:12px; background:var(--ui-surface-alt); }
.avatar-picker-tabs .ui-btn { min-width:116px; min-height:44px; gap:9px; padding:8px 16px; border-radius:8px; font-size:14px; font-weight:600; color:var(--ui-text); }
.avatar-picker-tabs .ui-btn:hover { background:rgba(var(--ui-accent-rgb),0.10); transform:none; box-shadow:none; }
.avatar-picker-tabs .ui-btn[aria-selected="true"] { border-color:var(--ui-accent); background:rgba(var(--ui-accent-rgb),0.18); color:var(--ui-text-bright); }
.avatar-picker-tabs .ui-btn:focus-visible { outline:2px solid var(--ui-accent); outline-offset:2px; }
#avatarCharactersPanel[hidden], #avatarGearPanel[hidden] { display:none; }
#avatarCharactersPanel, #avatarGearPanel { max-height:340px; overflow:auto; scrollbar-gutter:stable; }
#avatarCharactersPanel #avatarV2Picker { max-height:none; overflow:visible; margin-bottom:0!important; }
#avatarV2Preview { margin-bottom:16px; }
/* The kind row: one segmented track, equal cells — five choices that
   answer one question, not five loose buttons. */
#avatarKindRow { display:flex; gap:2px; padding:2px; border-radius:9px; background:rgba(0,0,0,0.22); }
#avatarKindRow button { flex:1 1 0; min-width:0; padding-left:4px; padding-right:4px; border-color:transparent; background:none; }
#avatarKindRow button[aria-pressed="true"] { border-color:var(--ui-accent); background:var(--ui-surface-alt); color:var(--ui-text); }
/* The 3D kind's panel (Avatar3DPanel.js): the row of sources under the kind row, and Kuukan's row of faces (names as tooltips). */
/* the Gear tab shows gear only: the figure's style (Block / Items) is the Avatar tab's choice */
#profileTabAvatar:has(#avatarGearTab[aria-selected="true"]) #avatar3dStyleRow { display:none !important; }
.av3d-styles { display:inline-flex; gap:2px; padding:2px; border-radius:9px; background:rgba(0,0,0,0.14); margin:0 auto 10px; }
.av3d-styles button { min-width:5.5em; border-color:transparent; background:none; }
.av3d-styles button[aria-pressed="true"] { border-color:var(--ui-accent); background:var(--ui-surface-alt); color:var(--ui-text); }
#avatar3dPanel [data-source-panel] + [data-source-panel] { margin-top:18px; padding-top:12px; border-top:1px solid rgba(255,255,255,0.08); }
#avatar3dPanel .av3d-head { margin:0 0 8px; font-size:.78em; font-weight:600; letter-spacing:.08em; text-transform:uppercase; opacity:.65; text-align:center; }
#avatar3dPanel .av3d-ready { display:flex; flex-wrap:wrap; justify-content:center; gap:6px; margin:0 0 8px; min-height:52px; }
#avatar3dPanel .av3d-skin { display:flex; align-items:center; justify-content:center; width:52px; height:52px; padding:0; border:1px solid transparent; border-radius:10px; background:none; cursor:pointer; }
#avatar3dPanel .av3d-skin img { width:44px; height:44px; image-rendering:pixelated; border-radius:6px; background:rgba(255,255,255,.06); }
#avatar3dPanel .av3d-look { text-align:left; max-width:26em; margin:14px auto 4px; }
#avatar3dPanel .av3d-range { width:100%; accent-color:var(--ui-accent); }
#avatar3dPanel .av3d-item img { image-rendering:auto; padding:2px; }
#avatar3dPanel .av3d-skin:hover { background:var(--ui-surface-alt); }
#avatar3dPanel .av3d-skin[aria-pressed="true"] { border-color:var(--ui-accent); background:var(--ui-surface-alt); }
/* The figure strip (Avatar3DStrip.js): pinned at the top of the avatar tab for the 3D kind — the face, the front with the view
   from above, the back — wearing everything chosen below, in the characters and in the Gear tab alike. */
.av3d-strip { position:sticky; top:0; z-index:3; display:flex; gap:10px; align-items:center; justify-content:center; padding:6px 0 8px; margin:0 0 8px; background:rgb(var(--ui-surface-rgb, 15, 31, 35)); border-bottom:1px solid var(--ui-border,rgba(255,255,255,.08)); }   /* opaque: the rows scroll under it, not through it */
.av3d-views { display:block; width:264px; height:120px; border-radius:10px; background:rgba(0,0,0,.18); flex-shrink:0; }
.av3d-strip-side { display:flex; flex-direction:column; gap:6px; align-items:stretch; min-width:0; }
.av3d-strip-side .ui-btn { white-space:nowrap; }
.av3d-strip-note { font-size:11px; opacity:.8; min-height:1.2em; }
@media (max-width: 420px) { .av3d-strip { flex-wrap:wrap; } }
/* "Make your own" (MixSkinEditor.js): the rows of parts; the figure is the strip above. */
#avatar3dPanel .mix-editor { text-align:left; margin:10px 0 6px; }
#avatar3dPanel .mix-actions { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin:0 0 10px; }
#avatar3dPanel .mix-row { margin:0 0 8px; }
#avatar3dPanel .mix-row > span { display:block; font-size:11px; color:var(--ui-text-muted); margin:0 0 4px; }
#avatar3dPanel .mix-row > span em { font-style:normal; opacity:.7; }
#avatar3dPanel .mix-hint { display:block; font-size:10px; color:var(--ui-text-muted); opacity:.75; margin:-2px 0 2px; }
#avatar3dPanel .mix-chips, #avatar3dPanel .mix-swatches { display:flex; flex-wrap:wrap; gap:5px; margin:0 0 5px; }
#avatar3dPanel .mix-chip { min-height:30px; padding:3px 9px; border:1px solid transparent; border-radius:999px; background:rgba(0,0,0,.18); color:var(--ui-text-muted); font:inherit; font-size:11px; cursor:pointer; }
#avatar3dPanel .mix-chip[aria-pressed="true"] { border-color:var(--ui-accent); color:var(--ui-text); background:var(--ui-surface-alt); }
#avatar3dPanel .mix-swatch { width:32px; height:32px; padding:0; border:2px solid transparent; border-radius:50%; cursor:pointer; box-shadow:inset 0 0 0 1px rgba(255,255,255,.14); }
#avatar3dPanel .mix-swatch[aria-pressed="true"] { border-color:var(--ui-accent); box-shadow:inset 0 0 0 2px var(--ui-surface,#0f1f23); }
#mixSkinOpen { margin:2px 0 8px; }
#avatarV2Preview .avatar-settings-preview { display:grid; grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); align-items:center; gap:12px; padding:8px; border:1px solid var(--ui-border); border-radius:12px; background:var(--ui-surface-alt); color:var(--ui-text); }
#avatarV2Preview canvas { display:block; width:100%; height:auto; min-width:0; max-width:200px; justify-self:center; }
#avatarV2Preview .avatar-preview-controls { display:flex; flex-direction:column; gap:20px; min-width:0; padding-right:8px; }
#avatarV2Preview label { display:flex; flex-direction:column; align-items:stretch; gap:8px; margin:0; font-size:12px; color:var(--ui-text-muted); }
#avatarV2Preview input[type="range"] { display:block; width:100%; min-width:0; margin:0; padding:0; accent-color:var(--ui-accent); cursor:pointer; }
#avatarV2Preview input:disabled { opacity:.4; cursor:default; }
#avatarV2Preview input:focus-visible { outline:2px solid var(--ui-accent); outline-offset:4px; }
#avatarV2Preview .avatar-preview-note { color:var(--ui-text-muted); font-size:11px; }
#avatarV2Preview .avatar-preview-note:empty { display:none; }
#avatarV2Picker button[data-avatar]:disabled { opacity:.6; cursor:wait; }

.avatar-neckwear-thumb { display:flex; align-items:center; justify-content:center; width:100%; height:48px; font-size:26px; }
.avatar-neckwear-thumb img { width:76px; max-width:100%; height:46px; object-fit:contain; }

/* The Ink editor (InkAvatarEditor.js): portrait and its real sizes on top,
   four group tabs, every part of a group as a labelled row. The panel grows
   with its rows; the settings dialog scrolls, not a box inside it. */
#avatarCharactersPanel.has-ink-editor { max-height:none; overflow:visible; scrollbar-gutter:auto; }
.ink-avatar-editor { display:grid; gap:12px; padding:4px 0; width:100%; box-sizing:border-box; }
.ink-editor-top { position:sticky; top:-1px; z-index:3; display:grid; gap:12px; padding:6px 0 10px; background:rgb(var(--ui-surface-rgb)); box-shadow:0 10px 12px -12px var(--ui-shadow); }
.ink-editor-header { display:grid; grid-template-columns:144px auto minmax(0,1fr); align-items:center; gap:14px; }
.ink-editor-preview { display:grid; place-items:center; width:144px; height:144px; background:transparent; }
.ink-editor-preview svg, .ink-editor-preview canvas { display:block; width:100%; height:100%; max-width:100%; max-height:100%; }
.ink-editor-sizes { display:grid; justify-items:center; gap:2px; font-size:10px; color:var(--ui-text-muted); }
.ink-editor-sizes small { font-size:10px; margin-bottom:4px; }
.ink-editor-size svg, .ink-editor-size canvas { display:block; }
.ink-editor-actions { display:grid; gap:8px; min-width:0; justify-items:start; }
.ink-editor-controls { display:flex; flex-wrap:wrap; gap:4px; }
.ink-editor-controls .ui-btn { padding:5px 9px; }
.ink-editor-status { font-size:11px; line-height:1.3; margin:0; color:var(--ui-text-muted); }
.ink-editor-tabs { display:flex; gap:2px; padding:2px; border-radius:10px; background:var(--ui-surface-alt); border:1px solid var(--ui-border-faint); overflow-x:auto; }
.ink-editor-tab { flex:1 0 auto; border:0; border-radius:8px; padding:8px 6px; background:none; color:var(--ui-text-muted); font:600 12.5px var(--ui-font); cursor:pointer; min-height:36px; }
.ink-editor-tab:hover { color:var(--ui-text); }
.ink-editor-tab[aria-selected="true"] { background:rgba(var(--ui-accent-rgb),0.18); color:var(--ui-text-bright); box-shadow:inset 0 0 0 1px var(--ui-border-accent); }
.ink-editor-groups { display:grid; gap:14px; }
.ink-editor-row { display:grid; gap:7px; }
.ink-editor-row-head { display:flex; align-items:center; gap:6px; min-height:24px; }
.ink-editor-row-label { font:600 12px var(--ui-font); color:var(--ui-text); }
.ink-editor-hair-group { display:grid; gap:7px; }
.ink-editor-hair-group-label { margin:3px 0 0; font:600 12px var(--ui-font); color:var(--ui-text-muted); }
.ink-editor-lock { display:inline-grid; place-items:center; width:26px; height:26px; border:0; border-radius:7px; background:none; color:var(--ui-text-muted); cursor:pointer; padding:0; }
.ink-editor-lock:hover { background:var(--ui-surface-hover); color:var(--ui-text); }
.ink-editor-lock[aria-pressed="true"] { color:var(--ui-accent); background:rgba(var(--ui-accent-rgb),0.14); }
.ink-editor-note { margin-left:auto; font-size:11px; color:var(--ui-text-muted); font-style:italic; }
.ink-editor-choices { display:grid; grid-template-columns:repeat(auto-fill,minmax(66px,1fr)); gap:6px; }
.ink-editor-choices--colours { display:flex; flex-wrap:wrap; gap:8px; }
.ink-editor-choices.is-moot { opacity:0.4; }
.ink-editor-choice { display:grid; justify-items:center; gap:3px; min-width:0; padding:4px 3px 5px; border:1px solid var(--ui-border-faint); border-radius:10px; background:var(--ui-surface-alt); color:var(--ui-text-muted); font:500 10.5px/1.2 var(--ui-font); cursor:pointer; }
.ink-editor-choice:hover { border-color:var(--ui-border); color:var(--ui-text); }
.ink-editor-choice[aria-pressed="true"] { border-color:var(--ui-accent); color:var(--ui-text-bright); box-shadow:0 0 0 1px var(--ui-accent); }
.ink-editor-thumb { display:block; width:56px; height:56px; border-radius:8px; overflow:hidden; background:#f6f4ee; }
.ink-editor-thumb svg, .ink-editor-thumb canvas { display:block; width:56px; height:56px; }
.ink-editor-choice-name { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ink-editor-choice--colour { width:34px; height:34px; padding:0; border-radius:50%; background:var(--swatch); border:2px solid var(--ui-border-faint); }
.ink-editor-choice--colour[aria-pressed="true"] { box-shadow:0 0 0 2px var(--ui-surface), 0 0 0 4px var(--ui-accent); border-color:transparent; }
/* the one color-of-your-own control (CustomColorControl.js): a Custom button with the color in a chip, and a hex field */
.custom-color { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding-top:3px; flex-basis:100%; }
.custom-color-button { display:inline-flex; align-items:center; gap:7px; margin:0; padding:4px 9px 4px 4px; border:1px solid var(--ui-border-faint); border-radius:9px; background:var(--ui-surface-alt); color:var(--ui-text); font:500 12px var(--ui-font); cursor:pointer; }
.custom-color-button.is-selected { border-color:var(--ui-accent); box-shadow:0 0 0 1px var(--ui-accent); }
.custom-color-chip { width:28px; height:26px; border:1px solid var(--ui-border); border-radius:5px; }
.custom-color-button:disabled { opacity:0.5; cursor:default; }
.custom-color-hex { width:92px; min-width:0; box-sizing:border-box; padding:8px; border:1px solid var(--ui-border); border-radius:7px; background:var(--ui-surface-alt); color:var(--ui-text); font:12px monospace; }
.custom-color-hex:invalid { border-color:var(--ui-danger,#e8452c); }
.custom-color-button:focus-visible, .custom-color-hex:focus-visible { outline:2px solid var(--ui-accent); outline-offset:2px; }
.ink-editor-choice:focus-visible, .ink-editor-tab:focus-visible, .ink-editor-lock:focus-visible { outline:2px solid var(--ui-accent); outline-offset:2px; }
/* Palette lab (InkPalette.js, admins): every palette on your own portrait,
   then a crowd under the chosen one. */
.ink-palette-choices { grid-template-columns:repeat(auto-fill,minmax(76px,1fr)); }
.ink-palette-choice .ink-editor-thumb, .ink-palette-choice .ink-editor-thumb svg { width:64px; height:64px; background:none; }
.ink-palette-crowd { display:flex; flex-wrap:wrap; gap:6px; }
.ink-palette-person, .ink-palette-person svg { display:block; width:52px; height:52px; }
@media (max-width:480px) { .ink-editor-header { grid-template-columns:128px auto; } .ink-editor-actions { grid-column:1 / -1; } .ink-editor-preview { width:128px; height:128px; } }

/* Wearing (AvatarWearing.js): the avatar and its gear in one line of chips */
.av-wearing { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin:8px 0 14px; font-size:12px; }
.av-wearing-label { color:var(--ui-text-muted); font-size:10.5px; text-transform:uppercase; letter-spacing:.06em; margin-right:2px; }
.av-chip { display:inline-flex; align-items:center; gap:2px; min-height:34px; padding:2px 3px 2px 12px; border:1px solid var(--ui-border-faint); border-radius:999px; background:var(--ui-surface-alt); color:var(--ui-text-muted); }
.av-chip b { color:var(--ui-text); font-weight:600; }
.av-chip-who { padding-right:12px; }
.av-chip button { border:0; background:none; color:inherit; font:inherit; cursor:pointer; border-radius:999px; }
.av-chip-open { padding:4px 4px 4px 0; }
.av-chip-open:hover b { color:var(--ui-accent); }
.av-chip-off { width:30px; height:30px; display:inline-flex; align-items:center; justify-content:center; font-size:13px; }
.av-chip-off:hover { background:rgba(255,255,255,.08); color:var(--ui-text); }
.av-chip button:focus-visible { outline:2px solid var(--ui-accent); outline-offset:1px; }
#avatar3dPanel .mix-tabs { margin:0 0 10px; }
/* Badge kind: Photo | Initials (AvatarPicker.js) */
.av-badge-choices { display:flex; justify-content:center; gap:12px; margin:6px 0 12px; }
.av-badge-choice { display:flex; flex-direction:column; align-items:center; gap:8px; min-width:112px; padding:12px 14px 10px; border:1px solid var(--ui-border-faint); border-radius:12px; background:var(--ui-surface-alt); color:var(--ui-text); font:600 12.5px var(--ui-font); cursor:pointer; }
.av-badge-choice:hover { border-color:var(--ui-border-accent); }
.av-badge-choice[aria-pressed="true"] { border-color:var(--ui-accent); box-shadow:0 0 0 1px var(--ui-accent); }
.av-badge-choice:focus-visible { outline:2px solid var(--ui-accent); outline-offset:2px; }
.av-badge-thumb { font-size:52px; line-height:1; }
