/* Viewer avatar (viewer-avatar.js): picture, rank pip bottom-right, gold ring for Legend. Stage UX13: colours are shared tokens. */
.viewer-avatar{position:relative;display:inline-block;flex:none;width:32px;height:32px;vertical-align:middle;margin-right:8px}
.viewer-avatar.lg{width:64px;height:64px}
.viewer-avatar.xl{width:112px;height:112px}
.viewer-avatar>img{width:100%;height:100%;border-radius:50%;object-fit:cover;display:block;background:var(--raised)}
.viewer-avatar.ring-gold>img{box-shadow:0 0 0 2px var(--surface),0 0 0 4px var(--gold)}
.viewer-avatar .rank-pip{position:absolute;right:-4px;bottom:-4px;min-width:16px;height:16px;padding:0 3px;border-radius:8px;background:var(--gold-metal,var(--gold));color:var(--on-gold);border:1px solid var(--surface);font:700 10px/14px system-ui,sans-serif;text-align:center;box-sizing:border-box}
.viewer-avatar.lg .rank-pip{min-width:24px;height:24px;border-radius:12px;font-size:13px;line-height:22px}
.viewer-avatar.xl .rank-pip{min-width:32px;height:32px;border-radius:16px;font-size:16px;line-height:30px}
.viewer-avatar .rank-pip img{width:100%;height:100%;object-fit:contain;display:block}
/* PROFILE PAGE stage: picture borders a viewer wears (cosmetics.mjs). Gold family and neutrals from the shared tokens only. */
.viewer-avatar.frame-bronze>img{box-shadow:0 0 0 2px var(--surface),0 0 0 4px var(--warning-text)}
.viewer-avatar.frame-silver>img{box-shadow:0 0 0 2px var(--surface),0 0 0 4px var(--text-soft)}
.viewer-avatar.frame-gold>img{box-shadow:0 0 0 2px var(--surface),0 0 0 4px var(--gold-strong)}
.viewer-avatar.frame-legend>img{box-shadow:0 0 0 2px var(--surface),0 0 0 4px var(--gold)}
.viewer-avatar.frame-crown>img{box-shadow:0 0 0 2px var(--surface),0 0 0 4px var(--gold-strong),0 0 0 6px var(--gold-soft),0 0 12px 4px var(--gold-glow)}
.viewer-avatar.frame-marble>img{box-shadow:0 0 0 2px var(--text),0 0 0 3px var(--edge-strong),0 0 0 5px var(--gold)}
.viewer-avatar.frame-double>img{box-shadow:0 0 0 2px var(--surface),0 0 0 4px var(--gold),0 0 0 5px var(--surface),0 0 0 7px var(--gold-soft)}
/* The name a viewer wears (BudintName): colour, badges after it, title underneath. */
.viewer-name{display:inline-flex;flex-direction:column;min-width:0;vertical-align:middle;line-height:1.25}
.viewer-name-line{display:inline-flex;align-items:center;flex-wrap:wrap;gap:4px;min-width:0}
.viewer-name-line>strong{overflow-wrap:anywhere}
.viewer-badge{display:inline-grid;place-items:center;min-width:18px;height:18px;padding:0 3px;box-sizing:border-box;border-radius:var(--r-pill);background:var(--gold-tint);border:1px solid var(--gold-line);color:var(--gold-text);font-size:11px;line-height:1}
.viewer-title{display:block;color:var(--gold-text);font-size:var(--fs-xs);font-weight:600;letter-spacing:.02em}
.name-colour-pale-gold{color:var(--gold-soft)}
.name-colour-antique{color:color-mix(in srgb,var(--gold) 70%,var(--text-muted))}
.name-colour-bright-gold{color:var(--gold-strong)}
.name-colour-silver{color:var(--text-soft)}
.name-colour-bronze{color:var(--warning-text)}
[data-theme="light"] .name-colour-bright-gold{color:var(--gold-text)}
/* LEVELS (9 Nov 2026): the level pill shows the exact level (1–1,000). Three- and four-digit levels get a little more room; the frame steps
   up at 10 (bronze edge), 25 (silver edge), 50 (double gold edge) and 100 (a slow gold shimmer, still under reduced motion). Colours come
   from the shared tokens; the viewer's own colour arrives with bundles (phase 2). */
/* 3- and 4-digit levels: tighter number, and on small pictures the pill hangs further past the corner so it never covers the face. */
.viewer-avatar .rank-pip.wide{padding:0 2px;letter-spacing:-.05em}
/* A level never breaks across lines (chat rows allow breaking long words anywhere; the pill must not inherit that). */
.viewer-avatar .rank-pip{white-space:nowrap;overflow-wrap:normal;word-break:normal}
.viewer-avatar:not(.lg):not(.xl) .rank-pip.wide{font-size:9px;right:auto;left:50%;transform:translateX(-50%);bottom:-7px}
.viewer-avatar .rank-pip[data-tier="10"]{border-color:var(--warning-text)}
.viewer-avatar .rank-pip[data-tier="25"]{border-color:var(--text-soft);box-shadow:0 0 0 1px var(--surface)}
.viewer-avatar .rank-pip[data-tier="50"]{border-color:var(--gold-strong,var(--gold));box-shadow:0 0 0 1px var(--surface),0 0 0 2px var(--gold)}
.viewer-avatar .rank-pip[data-tier="100"]{border-color:var(--gold-strong,var(--gold));box-shadow:0 0 0 1px var(--surface),0 0 0 2px var(--gold),0 0 6px var(--gold-glow,var(--gold));background:linear-gradient(110deg,var(--gold) 0%,var(--gold-soft,var(--gold-strong)) 45%,var(--gold) 60%,var(--gold-strong,var(--gold)) 100%);background-size:220% 100%;animation:level-pill-shine 4s linear infinite}
@keyframes level-pill-shine{from{background-position:120% 0}to{background-position:-100% 0}}
@media (prefers-reduced-motion:reduce){.viewer-avatar .rank-pip[data-tier="100"]{animation:none;background-position:50% 0}}
