/* Game District: equip feedback (hub-busy.js). A busy button keeps its size: a cover with a spinner and "Equipping..."
 * sits over its own label; thumbnail buttons get a small corner badge. Avatar pictures get a soft "changing" shimmer.
 * Lite mode and reduced motion: no spinning and no shimmer, a static busy state instead. */

[data-hub-busy-pos] { position: relative; }   /* set by hub-busy.js only on buttons that were position: static */
[data-hub-busy="busy"] { cursor: default; }
[data-hub-busy="busy"]:disabled { opacity: 1; filter: none; }
.hub-busy-tag { pointer-events: none; }

/* inline: covers the label, inherits the button's own colours */
[data-hub-busy-mode="inline"] > .hub-busy-tag {
    position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; justify-content: safe center; gap: 6px;
    padding: 0 8px; border-radius: inherit; background: inherit; color: inherit; font: inherit; font-weight: 800; white-space: nowrap; overflow: hidden;
}
[data-hub-busy-mode="inline"] > .hub-busy-tag::after { content: attr(data-t); flex: 0 0 auto; }   /* never shrinks: hub-busy.js widens a short button instead */

/* badge: a small round chip in the corner of a thumbnail / tile button */
[data-hub-busy-mode="badge"] > .hub-busy-tag {
    position: absolute; top: 4px; right: 4px; z-index: 3; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
    background: var(--surface, #241a4a); color: var(--gold, #ffc94a); border: 2px solid var(--gold, #ffc94a); box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
[data-hub-busy-mode="badge"] > .hub-busy-tag > * { grid-area: 1 / 1; }

.hub-busy-spin {
    display: inline-block; width: 1em; height: 1em; flex: 0 0 auto; box-sizing: border-box; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent; animation: hubBusySpin .7s linear infinite;
}
[data-hub-busy-mode="badge"] .hub-busy-spin { width: 12px; height: 12px; }
.hub-busy-check { display: none; font-size: 1.05em; line-height: 1; }
[data-hub-busy="done"] .hub-busy-spin { display: none; }
[data-hub-busy="done"] .hub-busy-check { display: inline-block; }
[data-hub-busy="done"][data-hub-busy-mode="inline"] > .hub-busy-tag { animation: hubBusyDone .45s ease-out; }
[data-hub-busy="done"][data-hub-busy-mode="badge"] > .hub-busy-tag { color: var(--green, #5fe3a1); border-color: var(--green, #5fe3a1); }
@keyframes hubBusySpin { to { transform: rotate(360deg); } }
@keyframes hubBusyDone { 0% { transform: scale(.92); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }

/* the polite live region that reads the busy text out (visually hidden) */
.hub-busy-live { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------------------------------------------------------------- the "changing" shimmer on avatar pictures */
#dashboardRailAvatar[data-hub-look], .plz-ward-mirror[data-hub-look] { position: relative; }
[data-hub-look]::after {
    content: attr(data-hub-look-text); position: absolute; inset: 0; z-index: 6; pointer-events: none; border-radius: inherit;
    display: flex; align-items: flex-end; justify-content: center; padding-bottom: 10px; box-sizing: border-box;
    font: 800 12px/1.2 var(--font-body, sans-serif); letter-spacing: .02em; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .8), 0 0 8px rgba(40, 20, 90, .8);
    background:
        radial-gradient(2.5px 2.5px at 22% 28%, #fff, transparent 70%), radial-gradient(2px 2px at 76% 22%, #ffe9a8, transparent 70%),
        radial-gradient(2px 2px at 64% 64%, #fff, transparent 70%), radial-gradient(1.5px 1.5px at 30% 72%, #bfe8ff, transparent 70%),
        linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .34) 48%, rgba(255, 233, 168, .22) 54%, transparent 70%) 0 0 / 260% 100% no-repeat,
        rgba(60, 30, 120, .16);
    animation: hubLookShimmer 1.1s ease-in-out infinite;
}
/* the item window's "On you" stage has its own buttons along the bottom: the words go to the top */
.hub-pv-scene[data-hub-look]::after { align-items: flex-start; padding: 12px 0 0; }
/* phones: the studio stage is small and its bottom holds the style badge, so the words sit in the middle */
html.hub-phone .dz-stage[data-hub-look]::after { align-items: center; padding-bottom: 0; font-size: 13px; }
[data-hub-look="s"]::after { content: ''; padding: 0; box-shadow: inset 0 0 0 2px rgba(255, 233, 168, .9); }
@keyframes hubLookShimmer { 0% { background-position: 0 0, 0 0, 0 0, 0 0, 130% 0, 0 0; } 100% { background-position: 0 0, 0 0, 0 0, 0 0, -130% 0, 0 0; } }
:root[data-theme="day"] [data-hub-look]::after { background-color: rgba(255, 255, 255, .18); }
:root[data-theme="contrast"] [data-hub-look]::after { background: rgba(0, 0, 0, .45); text-shadow: none; }

/* lite and reduced motion: a static busy state (no spin, no shimmer) */
:root[data-lite="1"] .hub-busy-spin, body[data-motion="reduced"] .hub-busy-spin { animation: none; border-style: dotted; border-right-color: currentColor; }
:root[data-lite="1"] [data-hub-look]::after, body[data-motion="reduced"] [data-hub-look]::after { animation: none; background-position: 0 0, 0 0, 0 0, 0 0, 50% 0, 0 0; }
:root[data-lite="1"] [data-hub-busy="done"] > .hub-busy-tag, body[data-motion="reduced"] [data-hub-busy="done"] > .hub-busy-tag { animation: none; }
@media (prefers-reduced-motion: reduce) {
    body:not([data-motion="full"]) .hub-busy-spin { animation: none; border-style: dotted; border-right-color: currentColor; }
    body:not([data-motion="full"]) [data-hub-look]::after { animation: none; background-position: 0 0, 0 0, 0 0, 0 0, 50% 0, 0 0; }
    body:not([data-motion="full"]) [data-hub-busy="done"] > .hub-busy-tag { animation: none; }
}

/* ---------------------------------------------------------------- Sunnyside (plaza): your avatar sparkles while the new
 * look is on its way (engine changing()), and a quick puff of smoke shows everyone a look change (engine puff()) */
.plz-root .plz-pl.is-changing::after {
    content: ''; position: absolute; left: 6px; right: 6px; top: 4px; bottom: 14px; pointer-events: none; z-index: 3; border-radius: 40%;
    background:
        radial-gradient(5px 5px at 18% 20%, #fff, transparent 75%), radial-gradient(4px 4px at 80% 28%, #ffe28a, transparent 75%),
        radial-gradient(5px 5px at 66% 72%, #fff, transparent 75%), radial-gradient(4px 4px at 26% 62%, #a8e2ff, transparent 75%),
        radial-gradient(3.5px 3.5px at 50% 8%, #ffe28a, transparent 75%), radial-gradient(3.5px 3.5px at 88% 58%, #fff, transparent 75%),
        radial-gradient(closest-side, transparent 45%, rgba(255, 224, 140, .32) 80%, transparent);
    filter: drop-shadow(0 0 4px rgba(255, 230, 150, .9));
    animation: plzChanging 1s ease-in-out infinite;
}
@keyframes plzChanging { 0%, 100% { opacity: .7; transform: scale(.94) rotate(-4deg); } 50% { opacity: 1; transform: scale(1.06) rotate(4deg); } }
.plz-root .plz-puff { position: absolute; left: 50%; top: 52%; width: 0; height: 0; pointer-events: none; z-index: 4; }
.plz-root .plz-puff i {
    position: absolute; left: -16px; top: -16px; width: 32px; height: 32px; border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #fff, #e9e3ff 55%, rgba(220, 210, 255, 0) 72%); opacity: 0;
    animation: plzPuff .8s ease-out forwards;
}
.plz-root .plz-puff i:nth-child(1) { --px: -34px; --py: -28px; }
.plz-root .plz-puff i:nth-child(2) { --px: 30px; --py: -34px; animation-delay: 40ms; }
.plz-root .plz-puff i:nth-child(3) { --px: -38px; --py: 14px; animation-delay: 80ms; }
.plz-root .plz-puff i:nth-child(4) { --px: 36px; --py: 18px; animation-delay: 60ms; }
.plz-root .plz-puff i:nth-child(5) { --px: 0px; --py: -46px; animation-delay: 20ms; }
@keyframes plzPuff { 0% { opacity: .95; transform: translate(0, 0) scale(.5); } 100% { opacity: 0; transform: translate(var(--px), var(--py)) scale(1.5); } }
/* lite / reduced motion: a still sparkle and a still puff that simply goes away */
:root[data-lite="1"] .plz-root .plz-pl.is-changing::after, body[data-motion="reduced"] .plz-root .plz-pl.is-changing::after { animation: none; opacity: .9; }
:root[data-lite="1"] .plz-root .plz-puff i, body[data-motion="reduced"] .plz-root .plz-puff i { animation: none; opacity: .8; transform: translate(calc(var(--px) * .5), calc(var(--py) * .5)); }
@media (prefers-reduced-motion: reduce) {
    body:not([data-motion="full"]) .plz-root .plz-pl.is-changing::after { animation: none; opacity: .9; }
    body:not([data-motion="full"]) .plz-root .plz-puff i { animation: none; opacity: .8; transform: translate(calc(var(--px) * .5), calc(var(--py) * .5)); }
}
