/* The shop shares the workshop frame and the economy navigation. */
.avatar-store-mobile-back { display: none; }
.student-economy-shell-page #studentEconomyMessage:empty { display: none; }
.student-economy-shell-page [hidden] { display: none !important; }
.avatar-store.economy-avatar-shop-shell { padding: 24px clamp(16px, 2vw, 30px) 30px; }
.avatar-store-tabs, .avatar-store-filters, .avatar-store-preview-head, .avatar-store-buy {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.avatar-store-tabs { border-bottom: 1px solid #ba884b; margin: 0 0 16px; align-items: end; }
.avatar-store-tabs button, .avatar-store-filters button, .avatar-store-controls button,
.avatar-store select {
    min-height: 42px; padding: 6px 10px; font: inherit; font-weight: 750;
    color: #4f331d; background: #fff3d5; border: 1px solid #ccaa70; border-radius: 8px;
}
.avatar-store-tabs button { border-radius: 10px 10px 0 0; border-bottom: 0; }
.avatar-store-tabs button[data-tab="editor"] { margin-inline-start: auto; }
.avatar-store button[aria-pressed="true"]:not(.avatar-store-card) {
    background: #dfedfc; color: #194e7e; border-color: #8bb1d9;
}
.avatar-store-tabs button[aria-pressed="true"]:not(.avatar-store-card) {
    color: white; background: linear-gradient(#539bd5, #2d74b4);
}
.avatar-store-merch {
    display: grid; grid-template-columns: minmax(210px, .91fr) minmax(0, 1.64fr);
    gap: 16px; align-items: start;
}
.avatar-store-preview {
    position: sticky; top: 8px; min-width: 0; color: #4b2d16;
    background: #fff7df; border: 1px solid #d4a45c; border-radius: 14px; padding: 10px;
}
.avatar-store-preview-head, .avatar-store-buy { justify-content: space-between; }
.avatar-store h4 { color: #4b2d16; font-size: 1.1rem; margin: 0 0 8px; }
.avatar-store-preview-head h4 { margin: 0; }
.avatar-store-preview-head select { max-width: 100%; margin: 0 0 5px; font-size: .8rem; }
.avatar-store-scene, .avatar-store-card-picture, .economy-avatar-shop-look {
    position: relative; display: grid; place-items: center; overflow: hidden;
}
.avatar-store-scene {
    height: clamp(156px, 17vw, 244px); isolation: isolate; border: 1px solid #ae8145;
    border-radius: 12px; margin-top: 6px;
    background: #ebc987 url("/avatar-lab/background/avatar-stage-frame.png") center / cover no-repeat;
}
.avatar-store-caption, .avatar-store-badge {
    position: absolute; z-index: 12; top: 5px; left: 5px; border-radius: 6px;
    background: #fff4d9; color: #523117; padding: 3px 6px; font-size: .7rem; font-weight: 800;
}
.avatar-store-badge { background: #e5effb; color: #1b4e7c; }
.avatar-store-scene canvas, .avatar-store-card-picture canvas { position: absolute; inset: 0; margin: auto; height: 100%; width: auto; max-width: 100%; object-fit: contain; }
.economy-avatar-shop-look { width: 100%; height: 100%; container-type: size; isolation: isolate; }
.economy-avatar-shop-look .economy-avatar-lab-bg-img { width: 100%; height: 100%; object-fit: cover; }
.economy-avatar-shop-look .economy-avatar-lab-layer { cursor: inherit; outline: 0; }
.economy-avatar-shop-look .economy-avatar-lab-layer--character { width: 58cqh; height: 58cqh; }
.economy-avatar-shop-look .economy-avatar-lab-layer--headgear,
.economy-avatar-shop-look .economy-avatar-lab-layer--faceAccessory,
.economy-avatar-shop-look .economy-avatar-lab-layer--outfit { width: 32cqh; height: 32cqh; }
.economy-avatar-shop-look .economy-avatar-lab-layer--heldItem,
.economy-avatar-shop-look .economy-avatar-lab-layer--pet { width: 28cqh; height: 28cqh; }
.economy-avatar-shop-look .economy-avatar-lab-layer--aura { width: 65cqh; height: 65cqh; }
.avatar-store-controls { display: grid; grid-template-columns: repeat(4, 1fr) 1.2fr; gap: 3px; margin-top: 6px; }
.avatar-store-controls button { padding: 4px 1px; min-width: 0; font-size: .74rem; }
.avatar-store-usage { margin: 6px 0; font-size: .78rem; }
.avatar-store-usage:empty { display: none; }
.avatar-store-buy { border-top: 1px solid #e5cca0; padding-top: 8px; margin-top: 8px; }
.avatar-store-buy small { display: block; font-size: .75rem; }
.avatar-store .economy-button { min-height: 42px; }
.avatar-store-buy .economy-button { width: 100%; }
.avatar-store-grid.economy-avatar-shop-grid {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 8px 0;
}
.avatar-store .avatar-store-card {
    width: 100%; max-width: none; min-width: 0; text-align: center; padding: 9px;
    gap: 3px; display: grid; grid-template-rows: auto 1fr auto auto; color: #452c18; font: inherit;
}
.avatar-store .avatar-store-card[aria-pressed="true"] { outline: 2px solid #2d75be; }
.avatar-store-card-picture { height: clamp(74px, 7vw, 100px); isolation: isolate; border-radius: 9px; background: #fff2d4; }
.avatar-store-card strong { font-size: .85rem; line-height: 1.2; overflow-wrap: anywhere; }
.avatar-store-card small, .avatar-store-card-action { font-size: .75rem; }
.avatar-store-card-action { color: #174f90; font-weight: 800; }
.avatar-store-history { margin-top: 14px; font-size: .82rem; }
.economy-avatar-purchase-card .economy-avatar-shop-look { height: 150px; }
.economy-avatar-purchase-modal { overflow: auto; overscroll-behavior: contain; }
.economy-avatar-purchase-card { max-height: calc(100dvh - 24px); overflow: auto; }
@media (max-width: 1179px) {
    .avatar-store-grid.economy-avatar-shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 950px) {
    .avatar-store-preview { position: static; }
    .avatar-store-merch { grid-template-columns: minmax(0, 1fr); }
    .avatar-store-grid.economy-avatar-shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px), (max-width: 1000px) and (max-height: 520px) {
    body.student-economy-shell-page { min-width: 0; width: 100%; height: auto; background: #f9f5ea; overflow: auto; }
    body.student-economy-shell-page .student-economy-shell { display: block; width: 100%; max-width: 100%; min-height: 100dvh; height: auto; padding: 0; overflow: visible; }
    body.student-economy-shell-page .student-economy-sidebar-shell { display: none; }
    body.student-economy-shell-page .student-economy-main-shell {
        width: 100%; max-width: 100%; min-width: 0; height: auto; max-height: none;
        overflow: visible; padding: 10px 12px max(20px, env(safe-area-inset-bottom)); box-sizing: border-box;
    }
    .avatar-store-mobile-back { display: inline-flex; align-items: center; min-height: 40px; color: #21674f; font-weight: 800; }
    .student-economy-shell-page .economy-avatar-workshop-header { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; background: none; border: 0; box-shadow: none; gap: 8px; padding: 0; }
    .student-economy-shell-page .economy-avatar-workshop-title h3 { color: #19344a; font-size: 1.65rem; }
    .student-economy-shell-page .economy-avatar-workshop-title p { font-size: .85rem; }
    .student-economy-shell-page .economy-avatar-header-badges { justify-content: flex-start; flex-wrap: wrap; gap: 5px; }
    .student-economy-shell-page .economy-avatar-header-badges > span { min-height: 32px; padding: 4px 8px; font-size: .76rem; }
    .student-economy-shell-page .economy-avatar-header-badges .economy-avatar-tutorial-button { min-height: 38px; }
    .avatar-store.economy-avatar-shop-shell { background: none; border: 0; box-shadow: none; filter: none; overflow: visible; padding: 0 2px; }
    .avatar-store.economy-avatar-shop-shell::before, .avatar-store.economy-avatar-shop-shell::after { display: none; }
    .avatar-store-scene { height: clamp(120px, 36vw, 190px); }
    .avatar-store-tabs { gap: 3px; }
    .avatar-store-tabs button { font-size: .78rem; padding: 5px 6px; }
    .avatar-store-tabs button[data-tab="editor"] { margin-inline-start: 0; }
    .avatar-store-filters { gap: 4px; }
    .avatar-store-filters button, .avatar-store select { font-size: .79rem; padding-inline: 6px; }
    .avatar-store-grid.economy-avatar-shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .avatar-store-buy .economy-button { min-height: 44px; }
}

.avatar-store-mobile-nav { display: none; }
.avatar-store .avatar-store-card { min-height: 0; }
.avatar-store .avatar-store-card-picture { min-width: 0; }
@media (max-width: 760px), (max-width: 1000px) and (max-height: 520px) {
    body.student-economy-shell-page .student-economy-main-shell { padding-bottom: calc(154px + env(safe-area-inset-bottom)); }
    .avatar-store-mobile-nav {
        display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); z-index: 15;
        position: fixed; inset: auto 0 0; padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
        background: #fffaf0; border: 1px solid #e4d5ba; border-radius: 14px 14px 0 0;
    }
    .avatar-store-mobile-nav a {
        display: grid; justify-items: center; place-content: center; min-height: 46px;
        font-size: .73rem; font-weight: 800; color: #294351; text-decoration: none;
    }
    .avatar-store-mobile-nav img { width: 26px; height: 26px; object-fit: contain; }
    .avatar-store-buy {
        position: fixed; z-index: 14; inset: auto 0 calc(56px + env(safe-area-inset-bottom));
        background: #fff8e5; padding: 6px 12px; margin: 0; flex-wrap: nowrap;
    }
    .avatar-store-buy .economy-button { width: auto; flex: none; }
    .economy-avatar-purchase-modal { z-index: 30; }
}

@media (min-width: 761px) and (max-width: 1250px) and (min-height: 521px) {
    .student-economy-shell-page .economy-avatar-workshop-header {
        display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0;
        padding: 18px 26px 20px clamp(52px, 7vw, 92px); gap: 8px;
    }
    .student-economy-shell-page .economy-avatar-workshop-title h3 { font-size: clamp(24px, 3.2vw, 34px); }
    .student-economy-shell-page .economy-avatar-header-badges { justify-content: flex-start; gap: 5px; }
    .student-economy-shell-page .economy-avatar-header-badges > span { min-height: 34px; padding: 5px 8px; font-size: .8rem; }
}
@media (min-width: 951px) and (max-height: 740px) {
    .avatar-store-scene { height: 146px; }
    .avatar-store.economy-avatar-shop-shell { padding-top: 14px; }
}
@media (max-width: 760px), (max-width: 1000px) and (max-height: 520px) {
    .student-economy-shell-page .economy-job-post-form { grid-template-columns: minmax(0, 1fr); }
    .student-economy-shell-page .economy-job-post-form :is(input, textarea) {
        min-width: 0; width: 100%; max-width: 100%; box-sizing: border-box;
    }
}
@media (max-width: 760px), (max-width: 1000px) and (max-height: 520px) {
    .student-economy-shell-page .economy-avatar-workshop-title .economy-kicker { display: none; }
    .student-economy-shell-page .economy-avatar-header-badges .economy-avatar-tutorial-button {
        min-height: 36px; padding: 4px 7px; box-shadow: none; font-size: .76rem;
    }
    .student-economy-shell-page .economy-avatar-header-badges .economy-avatar-tutorial-button span {
        min-width: 0; min-height: 0; margin: 0; padding: 0; background: none;
        border: 0; box-shadow: none; font: inherit; white-space: nowrap;
    }
    .student-economy-shell-page .economy-avatar-workshop-header { margin-bottom: 10px; }
    .avatar-store-tabs { margin-bottom: 10px; }
    .avatar-store-preview-head select { min-height: 36px; margin: 0; }
    .avatar-store-merch { gap: 10px; }
}
@media (max-width: 1000px) and (max-height: 520px) {
    .avatar-store-merch { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
    .avatar-store-scene { height: 116px; }
}

/* Catalogue first in the DOM. Two panels are used only when the main column has room. */
body.student-economy-shell-page[data-balanced-avatar-shop] .student-economy-stage { padding: 0; }
body.student-economy-shell-page[data-balanced-avatar-shop] .economy-avatar-workshop-header {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
    min-height: 0; gap: 5px 10px; margin-bottom: 8px; padding: 9px 14px;
    border: 1px solid #dcc19a; border-radius: 10px; background: #fff7e4;
}
body[data-balanced-avatar-shop] .economy-avatar-workshop-title :is(.economy-kicker, p) { display: none; }
body.student-economy-shell-page[data-balanced-avatar-shop] .economy-avatar-workshop-title h3 { margin: 0; font-size: clamp(20px, 2.7vw, 28px); }
body.student-economy-shell-page[data-balanced-avatar-shop] .economy-avatar-header-badges { gap: 5px; }
body.student-economy-shell-page[data-balanced-avatar-shop] .economy-avatar-header-badges > span { min-height: 34px; padding: 4px 8px; font-size: 12px; }
body[data-balanced-avatar-shop] .avatar-store.economy-avatar-shop-shell {
    container: student-avatar-store / inline-size;
    padding: 12px clamp(10px, 1.4vw, 22px); background: #fff7e4;
    border: 1px solid #dcc19a; border-radius: 10px; overflow: visible;
}
body[data-balanced-avatar-shop] .avatar-store.economy-avatar-shop-shell::before,
body[data-balanced-avatar-shop] .avatar-store.economy-avatar-shop-shell::after { display: none; }
body[data-balanced-avatar-shop] .avatar-store-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-bottom: 8px; }
body[data-balanced-avatar-shop] .avatar-store-tabs button[data-tab="editor"] { margin-inline-start: 0; }
body[data-balanced-avatar-shop] .avatar-store :is(button, select) { min-height: 44px; }
body[data-balanced-avatar-shop] .avatar-store-merch { grid-template-columns: minmax(0, 1fr); gap: 10px; }
body[data-balanced-avatar-shop] .avatar-store .avatar-store-catalog { min-width: 0; }
body[data-balanced-avatar-shop] .avatar-store .avatar-store-preview {
    display: none; position: static; min-width: 0; padding: 7px; border-radius: 9px;
}
body[data-balanced-avatar-shop] .avatar-store-merch[data-store-preview-open] .avatar-store-preview { display: block; }
body[data-balanced-avatar-shop] .avatar-store-merch[data-store-preview-open] .avatar-store-catalog { display: none; }
body[data-balanced-avatar-shop] .avatar-store-list-back { margin-bottom: 6px; }
body[data-balanced-avatar-shop] .avatar-store .avatar-store-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-block: 5px; }
body[data-balanced-avatar-shop] .avatar-store .avatar-store-card {
    padding: 5px; gap: 3px; border: 1px solid #dcc19a;
    border-radius: 9px; background: #fff9eb; box-shadow: none; filter: none;
}
body[data-balanced-avatar-shop] .avatar-store .avatar-store-card[aria-pressed="true"] { outline: 2px solid #2d75be; outline-offset: -1px; }
body[data-balanced-avatar-shop] .avatar-store .avatar-store-card-picture { height: clamp(69px, 9vw, 112px); background: #fff1d1; }
body[data-balanced-avatar-shop] .avatar-store .avatar-store-card > small {
    display: inline-flex; align-items: center; gap: 3px; width: fit-content; margin-inline: auto;
    padding-inline: 6px; border-radius: 999px; color: #594218; font-weight: 800; background: #f9edce;
}
body[data-balanced-avatar-shop] .avatar-store-card > small img,
body[data-balanced-avatar-shop] .economy-avatar-header-badges > span img { width: 15px; height: 15px; object-fit: contain; }
body[data-balanced-avatar-shop] .avatar-store .avatar-store-scene { height: clamp(145px, 20vw, 250px); }
body[data-balanced-avatar-shop] .avatar-store .avatar-store-buy {
    position: static; display: grid; grid-template-columns: minmax(0, 1fr); padding: 5px 0 0; gap: 4px; margin-top: 3px; background: none;
}
body[data-balanced-avatar-shop] .avatar-store-buy .economy-button { width: 100%; }
body[data-balanced-avatar-shop] .avatar-store-buy small:empty { display: none; }
body[data-balanced-avatar-shop] .avatar-store-money { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 0; }
body[data-balanced-avatar-shop] .avatar-store-money > div { min-width: 0; padding: 4px; border-radius: 6px; background: #f5e9cd; text-align: center; }
body[data-balanced-avatar-shop] .avatar-store-money > div:last-child { background: #e3effa; }
body[data-balanced-avatar-shop] .avatar-store-money dt { font-size: 11px; }
body[data-balanced-avatar-shop] .avatar-store-money dd { margin: 0; color: #194e7e; font-size: 14px; font-weight: 800; overflow-wrap: anywhere; }

@container student-avatar-store (min-width: 680px) {
    body[data-balanced-avatar-shop] .avatar-store-merch:has(.avatar-store-preview) {
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    }
    body[data-balanced-avatar-shop] .avatar-store .avatar-store-preview { display: block; }
    body[data-balanced-avatar-shop] .avatar-store-merch[data-store-preview-open] .avatar-store-catalog { display: block; }
    body[data-balanced-avatar-shop] .avatar-store .avatar-store-list-back { display: none; }
}

@media (max-height: 700px) {
    body.student-economy-shell-page[data-balanced-avatar-shop] .economy-avatar-workshop-header { padding-block: 5px; margin-bottom: 5px; }
    body[data-balanced-avatar-shop] .avatar-store .avatar-store-scene { height: 144px; }
    body[data-balanced-avatar-shop] .avatar-store .avatar-store-card { gap: 2px; }
    body[data-balanced-avatar-shop] .avatar-store .avatar-store-card-picture { height: 52px; }
    body[data-balanced-avatar-shop] .avatar-store :is(.avatar-store-card-action, .avatar-store-usage) { margin-block: 2px; }
}


body[data-balanced-avatar-shop] #studentAvatarLabStatus:empty { display: none; }
body[data-balanced-avatar-shop] .avatar-store-catalog {
    padding: 9px; border: 1px solid #dcc19a; border-radius: 9px; background: #fff7e4;
}
body[data-balanced-avatar-shop] .economy-avatar-lab-layer[data-avatar-head-fit] {
    /* Forehead and brim anchors are relative to the original asset boxes. */
    top: calc(50% + var(--avatar-y) * 1% - var(--dragon-layer-size, 184px) * .34 * var(--avatar-anchor-scale, 1)
        - var(--cap-layer-width, 126px) * .19 * var(--avatar-scale));
}
body[data-balanced-avatar-shop] .economy-avatar-shop-look { --dragon-layer-size: 58cqh; --cap-layer-width: 32cqh; }
body[data-balanced-avatar-shop] .economy-avatar-stage-frame .economy-avatar-lab-stage { --dragon-layer-size: 190px; }
@media (min-width: 1181px) and (max-width: 1540px) {
    body[data-balanced-avatar-shop] .economy-avatar-stage-frame .economy-avatar-lab-stage { --dragon-layer-size: 172px; }
}
@media (min-width: 1360px) {
    body.student-economy-shell-page[data-balanced-avatar-shop] .student-economy-shell {
        width: min(1540px, calc(100% - 36px));
    }
}
@media (min-width: 1360px) and (min-height: 800px) {
    body.student-economy-shell-page[data-balanced-avatar-shop] .economy-avatar-workshop-header {
        min-height: 112px; padding-inline: clamp(84px, 7vw, 114px) 36px;
        border: 0; border-radius: 18px;
        background: url("/avatar-lab/workshop/avatar-header-wood.png?v=20260504-avatarworkshop1") center / 100% 100% no-repeat;
    }
    body.student-economy-shell-page[data-balanced-avatar-shop] .economy-avatar-workshop-title h3 { font-size: 40px; }
    body.student-economy-shell-page[data-balanced-avatar-shop] .economy-avatar-header-badges > span {
        min-height: 48px; padding: 8px 13px; border-radius: 999px; font-size: 16px;
    }
    body[data-balanced-avatar-shop] .avatar-store.economy-avatar-shop-shell {
        padding: 16px 24px 24px; border: 6px ridge #b88442; border-radius: 22px;
    }
    body[data-balanced-avatar-shop] .avatar-store-tabs { grid-template-columns: repeat(3, minmax(0, 235px)); }
    body[data-balanced-avatar-shop] .avatar-store-tabs button { font-size: 18px; }
    body[data-balanced-avatar-shop] .avatar-store :is(.avatar-store-catalog, .avatar-store-preview) { padding: 14px; border-radius: 15px; }
    body[data-balanced-avatar-shop] .avatar-store h4 { font-size: 27px; }
    body[data-balanced-avatar-shop] .avatar-store .avatar-store-filters button { border-radius: 999px; }
    body[data-balanced-avatar-shop] .avatar-store .avatar-store-card-picture { height: 98px; }
    body[data-balanced-avatar-shop] .avatar-store-card strong { font-size: 18px; }
    body[data-balanced-avatar-shop] .avatar-store-card > small { font-size: 14px; }
    body[data-balanced-avatar-shop] .avatar-store .avatar-store-scene { height: 262px; border-radius: 17px; }
    body[data-balanced-avatar-shop] .avatar-store-controls button { font-size: 14px; }
    body[data-balanced-avatar-shop] .avatar-store-money > div { padding-block: 8px; }
    body[data-balanced-avatar-shop] .avatar-store-money dt { font-size: 13px; }
    body[data-balanced-avatar-shop] .avatar-store-money dd { font-size: 23px; }
    body[data-balanced-avatar-shop] .avatar-store-buy .primary { min-height: 58px; font-size: 24px; }
}

.avatar-workshop-maintenance { max-width: 760px; margin: 24px auto; padding: clamp(24px, 5vw, 56px); text-align: center; }
.avatar-workshop-maintenance > span { display: block; font-size: 40px; }
.avatar-workshop-maintenance h2 { margin: 12px 0; font-size: clamp(23px, 3vw, 32px); }
.avatar-workshop-maintenance p { line-height: 1.8; overflow-wrap: anywhere; }
.avatar-workshop-maintenance .economy-button { display: inline-flex; margin-top: 16px; min-height: 44px; align-items: center; text-decoration: none; }
