.cosmetic-art { display: inline-grid; place-items: center; position: relative; width: 100%; height: 100%; font-size: 2rem; }
.cosmetic-art img { grid-area: 1/1; width: 100%; height: 100%; object-fit: contain; }
.cosmetic-art > span { grid-area: 1/1; }
.cosmetic-art > span[hidden] { display: none; }
.cosmetic-loadout { position: relative; display: inline-block; width: 64px; height: 64px; flex-shrink: 0; }
.cosmetic-loadout .cosmetic-avatar { position: absolute; inset: 14%; width: 72%; height: 72%; }
.cosmetic-loadout .cosmetic-frame { position: absolute; inset: 0; }
.cosmetic-loadout .cosmetic-frame img, .shop-dialog[data-category="frame"] .cosmetic-art img { filter: brightness(.5) sepia(1) saturate(3); }
.cosmetic-loadout .cosmetic-badge { position: absolute; right: -4%; bottom: -4%; width: 36%; height: 36%; filter: drop-shadow(0 2px 2px #0003); }
.student-shop { --shop-ink: #183e3b; --shop-muted: #506b66; --shop-paper: #fffef9; --shop-line: #d4dfd6; --shop-accent: #145e51; color: var(--shop-ink); background: #f4f5ed; padding: clamp(16px,3vw,32px); border-radius: 20px; }
.shop-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.shop-heading h2 { font-size: clamp(1.7rem,4vw,2.5rem); margin: 4px 0 8px; color: var(--shop-ink); letter-spacing: -.04em; }
.shop-heading p { max-width: 560px; line-height: 1.6; color: var(--shop-muted); }
.shop-eyebrow { text-transform: uppercase; font-size: .72rem; font-weight: 800; letter-spacing: .15em; }
.shop-wallet { display: flex; align-items: center; gap: 8px; white-space: nowrap; padding: 10px 16px; background: #f6df90; border: 1px solid #be9b48; border-radius: 999px; font-weight: 800; }
.shop-wallet .cosmetic-art { width: 30px; height: 30px; }
.shop-layout { display: grid; grid-template-columns: 245px minmax(0,1fr); gap: 24px; align-items: start; }
.shop-dressing { background: var(--shop-paper); border: 1px solid var(--shop-line); border-radius: 18px; padding: 22px 18px; text-align: center; position: sticky; top: 24px; }
.shop-dressing .cosmetic-loadout { width: 165px; height: 165px; margin: 12px auto 20px; }
.shop-dressing h3 { font-size: 1rem; margin-bottom: 8px; }
.shop-dressing p { color: var(--shop-muted); font-size: .85rem; line-height: 1.6; }
.shop-slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 16px 0; }
.shop-slot { background: #e9efe7; padding: 5px 9px; font-size: .72rem; border-radius: 6px; }
.shop-streak { border-top: 1px solid var(--shop-line); margin-top: 20px; padding-top: 18px; }
.shop-streak strong { display: block; margin-bottom: 8px; }
.shop-streak progress { width: 100%; accent-color: var(--shop-accent); }
.shop-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.student-shop button { font: inherit; cursor: pointer; }
.shop-filter { border: 1px solid var(--shop-line); border-radius: 999px; background: var(--shop-paper); color: var(--shop-ink); padding: 9px 14px; font-size: .82rem !important; }
.shop-filter[aria-pressed="true"] { background: var(--shop-accent); color: white; border-color: var(--shop-accent); }
.student-shop button:focus-visible, .student-shop a:focus-visible { outline: 3px solid #ab570c; outline-offset: 4px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(155px,1fr)); gap: 14px; }
.shop-card { background: var(--shop-paper); border: 1px solid var(--shop-line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; min-width: 0; }
.shop-card.rarity-uncommon { border-color: #6e9b77; }
.shop-card.rarity-rare { border-color: #799ac5; box-shadow: 0 2px 0 #799ac533; }
.shop-card.rarity-legendary { border-color: #b29142; box-shadow: 0 2px 0 #b2914244; background: linear-gradient(155deg,#fff6d6,var(--shop-paper) 70%); }
.shop-inspect { background: #f1f3eb; border: 0; border-radius: 10px; width: 100%; height: 128px; margin-bottom: 10px; transition: background .2s; }
.shop-inspect:hover { background: #e2ebde; }
.shop-inspect .cosmetic-art { width: 105px; height: 105px; transition: transform .2s; }
.shop-inspect:hover .cosmetic-art { transform: translateY(-4px) rotate(-4deg); }
.shop-card[data-category="frame"] .shop-inspect { background: #3f5d58; }
.shop-card h3 { font-size: .9rem; margin: 3px 0 5px; }
.shop-rarity { text-transform: uppercase; letter-spacing: .1em; font-size: .63rem; font-weight: 800; color: var(--shop-muted); }
.shop-card p { color: var(--shop-muted); font-size: .75rem; line-height: 1.5; margin: 4px 0 12px; flex: 1; }
.shop-action { background: var(--shop-accent); border: 1px solid var(--shop-accent); border-radius: 8px; color: white; padding: 9px 12px; font-weight: 700 !important; font-size: .8rem !important; }
.shop-action:disabled { background: #e3e8e1; color: #4b6054; border-color: #c6d2c7; cursor: default; }
.shop-secondary { background: transparent; color: var(--shop-accent); margin-top: 8px; }
.shop-status { min-height: 26px; padding: 8px 0; font-size: .85rem; color: var(--shop-accent); }
.shop-footer { margin-top: 24px; font-size: .75rem; color: var(--shop-muted); line-height: 1.7; }
.shop-footer a { color: var(--shop-accent); }
.shop-dialog { border: 1px solid #bacabd; border-radius: 20px; padding: 28px; max-width: 390px; width: calc(100% - 32px); margin: auto; color: #183e3b; background: #fffef9; }
.shop-dialog::backdrop { background: #102c2bb3; }
.shop-dialog .cosmetic-art { height: 180px; margin: 12px 0; }
.shop-dialog p { margin: 12px 0; line-height: 1.6; }
.shop-dialog button { margin: 8px 8px 0 0; }
@media (max-width: 680px) {
 .shop-heading { flex-direction: column; }
 .shop-layout { grid-template-columns: 1fr; }
 .shop-dressing { position: static; }
 .shop-dressing .cosmetic-loadout { width: 130px; height: 130px; }
 .shop-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
 .shop-card { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) { .shop-inspect, .shop-inspect .cosmetic-art { transition: none; } .shop-inspect:hover .cosmetic-art { transform: none; } }

.lb-creature.cosmetic-loadout, .p-creature.cosmetic-loadout, .rank-creature.cosmetic-loadout { width: 36px; height: 36px; }
.team-cosmetic-roster { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }

.achievement-art { width: 52px; height: 52px; flex-shrink: 0; }
.shop-filter::before { content: ''; display: inline-block; width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; background: currentColor; mask: url('/assets/cosmetics/icons/icon_shopping_bag.svg') center/contain no-repeat; }
.shop-filter[data-filter=owned]::before { mask-image: url('/assets/cosmetics/icons/icon_check.svg'); }
/* Keep the portal's Shop entry reachable on narrow screens. */
@media (max-width: 680px) {
 #appScreen > .tabs { flex-wrap: wrap; }
 #appScreen > .tabs .tab-btn { flex: 1 1 95px; padding: 12px 8px; }
 #shopTab > .section-card { padding: 0; }
 .shop-heading h2 { color: var(--shop-ink); }
}
.cosmetic-loadout .cosmetic-frame.rarity-uncommon img { filter: brightness(.6) sepia(.9) saturate(2) hue-rotate(85deg); }
.cosmetic-loadout .cosmetic-frame.rarity-rare img { filter: brightness(.65) sepia(1) saturate(3) hue-rotate(150deg); }
@media (max-width: 680px) {
 #appScreen .header .user-info { flex-wrap: wrap; justify-content: center; max-width: 100%; }
 #appScreen .header .user-info > div { min-width: 0; overflow-wrap: anywhere; }
}

.shop-dialog { --shop-accent: #145e51; --shop-muted: #506b66; max-height: 90svh; overflow-y: auto; }
.shop-dialog :focus-visible { outline: 3px solid #ab570c; outline-offset: 4px; }
.shop-story .shop-personality { font-weight: 650; }
.shop-story .shop-fact { padding: 12px; border-radius: 12px; background: #edf3e7; font-size: .9rem; }
.shop-earning:empty { display: none; }
.shop-earning { margin-bottom: 12px; }
.shop-card .shop-gap { font-weight: 750; color: #81480c; margin-bottom: 6px; }
.shop-earn-link { color: #145e51; font-weight: 750; text-underline-offset: 3px; }
.shop-earn-note { display: block; margin-top: 6px; font-size: .7rem; line-height: 1.5; color: #506b66; }
.shop-delivery { --delivery-color: #287b78; --delivery-light: #b9e7d9; width: min(500px,calc(100% - 24px)); max-width: 500px; text-align: center; padding: 26px; background: radial-gradient(ellipse at 50% 32%,#fff 15%,#edf5ed 65%,#dcebdd); border: 2px solid #c0d6c6; box-shadow: 0 25px 90px #06221d66; }
.shop-delivery.delivery-space { --delivery-color: #62459b; --delivery-light: #ddd0fc; }
.shop-delivery.delivery-lab { --delivery-color: #a24f33; --delivery-light: #ffddae; }
.shop-delivery.delivery-earth { --delivery-color: #805c25; --delivery-light: #f5dc99; }
.shop-delivery h2 { font-size: clamp(1.3rem,5vw,1.9rem); margin: 14px 0 8px; letter-spacing: -.04em; color: #183e3b; }
.shop-delivery .shop-delivery-note { font-size: .8rem; margin: 0; color: #506b66; }
.shop-delivery-stage { position: relative; height: 285px; display: grid; place-items: center; isolation: isolate; overflow: hidden; }
.shop-parcel { border: 0; padding: 0; background: transparent; cursor: pointer; color: #183e3b; width: 260px; max-width: 100%; height: 250px; position: relative; z-index: 2; touch-action: pan-y; }
.shop-parcel-art { display: block; position: absolute; inset: 30px 20px 48px; filter: drop-shadow(0 22px 12px #143e3929); animation: parcel-arrive .65s cubic-bezier(.2,.8,.2,1) both; }
.shop-parcel-body { position: absolute; inset: 35px 0 0; border-radius: 4px 4px 15px 15px; background: linear-gradient(90deg,transparent 41%,#fff7da 41% 59%,transparent 59%),linear-gradient(120deg,#e5c596,#c39761); box-shadow: inset -8px 0 0 #875d2e26,inset 0 -8px 0 #875d2e26; }
.shop-parcel-lid { position: absolute; inset: 12px -8px auto; height: 47px; border-radius: 8px; background: linear-gradient(90deg,transparent 42%,#fff7da 42% 58%,transparent 58%),linear-gradient(120deg,#f3dbb0,#dfb87f); box-shadow: 0 7px 0 #694a2638; transform-origin: 90% 90%; }
.shop-parcel-seal { display: grid; place-items: center; position: absolute; width: 58px; height: 58px; border: 3px solid #ffedb9; border-radius: 50%; top: 40px; left: calc(50% - 29px); background: var(--delivery-color); color: #fff5c8; font-size: 28px; box-shadow: 0 4px 0 #46341740; }
.shop-parcel-label { position: absolute; bottom: 17px; left: 14px; width: 90px; padding: 8px 5px; border: 1px dashed #52736a; background: #fffced; color: #335e51; font-size: 10px; font-weight: 900; letter-spacing: .12em; transform: rotate(-7deg); }
.shop-parcel-hint { position: absolute; bottom: 10px; left: 0; right: 0; font-size: .8rem; font-weight: 700; }
.shop-delivery-rays { position: absolute; inset: 12px; border-radius: 50%; opacity: .35; background: repeating-conic-gradient(from 10deg,transparent 0 15deg,var(--delivery-light) 15deg 30deg); mask-image: radial-gradient(black,transparent 68%); transition: opacity .4s; }
.shop-delivery-reward { position: relative; z-index: 3; width: 220px; border-radius: 22px; padding: 8px 20px 16px; background: linear-gradient(145deg,#ffffffed,#fff9e5f0); border: 2px solid var(--delivery-light); box-shadow: 0 14px 24px #17332c26; }
.shop-delivery-reward .cosmetic-art { height: 145px; margin: 4px 0; filter: drop-shadow(0 9px 6px #294f4533); }
.shop-delivery-reward h3 { font-size: 1.2rem; margin: 7px 0 0; color: #183e3b; }
.shop-delivery.rarity-legendary .shop-delivery-reward { border-color: #c69c37; box-shadow: 0 0 35px #efcf7980,0 14px 24px #17332c26; }
.shop-delivery .shop-story { text-align: left; }
.shop-delivery [hidden] { display: none !important; }
.shop-delivery-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.shop-delivery-actions button { margin: 0; }
.shop-delivery-sparks { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.shop-delivery-sparks span { position: absolute; left: 50%; top: 50%; color: var(--delivery-color); font-size: 21px; }
.shop-delivery-sparks span:nth-child(2) { --spark-angle: 45deg; color: #bc861c; }
.shop-delivery-sparks span:nth-child(3) { --spark-angle: 90deg; }
.shop-delivery-sparks span:nth-child(4) { --spark-angle: 135deg; color: #bc861c; }
.shop-delivery-sparks span:nth-child(5) { --spark-angle: 180deg; }
.shop-delivery-sparks span:nth-child(6) { --spark-angle: 225deg; color: #bc861c; }
.shop-delivery-sparks span:nth-child(7) { --spark-angle: 270deg; }
.shop-delivery-sparks span:nth-child(8) { --spark-angle: 315deg; color: #bc861c; }
.shop-delivery.is-open .shop-parcel { position: absolute; pointer-events: none; }
.shop-delivery.is-open .shop-parcel-lid { animation: parcel-lift .75s ease-in forwards; }
.shop-delivery.is-open .shop-parcel-seal { animation: seal-pop .4s ease-in forwards; }
.shop-delivery.is-open .shop-parcel-body, .shop-delivery.is-open .shop-parcel-label, .shop-delivery.is-open .shop-parcel-hint { animation: parcel-away .55s ease-in forwards; }
.shop-delivery.is-open .shop-delivery-rays { opacity: 1; }
.shop-delivery.is-open .shop-delivery-reward { animation: discovery-rise .85s cubic-bezier(.16,1,.3,1) both; }
.shop-delivery.is-open .shop-delivery-sparks { opacity: 1; }
.shop-delivery.is-open .shop-delivery-sparks span { animation: discovery-spark .9s ease-out both; }
@keyframes parcel-arrive { from { opacity: 0; transform: translateY(-30px) rotate(-8deg) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes parcel-lift { to { transform: translate(40px,-150px) rotate(35deg); opacity: 0; } }
@keyframes seal-pop { to { transform: scale(1.7) rotate(45deg); opacity: 0; } }
@keyframes parcel-away { to { transform: translateY(65px) scale(.8); opacity: 0; } }
@keyframes discovery-rise { from { opacity: 0; transform: translateY(65px) rotate(-8deg) scale(.55); } to { opacity: 1; transform: none; } }
@keyframes discovery-spark { from { transform: rotate(var(--spark-angle,0deg)) translateX(30px) scale(.5); opacity: 1; } to { transform: rotate(var(--spark-angle,0deg)) translateX(145px) scale(.8); opacity: 0; } }
.shop-delivery.is-instant *, .shop-delivery.is-instant *::before { animation: none !important; transition: none !important; }
.shop-delivery.is-instant.is-open .shop-parcel { visibility: hidden; }
@media (prefers-reduced-motion: reduce) {
 .shop-delivery *, .shop-delivery *::before { animation: none !important; transition: none !important; }
 .shop-delivery.is-open .shop-parcel, .shop-delivery-sparks { visibility: hidden; }
}
@media (max-width: 480px) { .shop-delivery { padding: 20px 16px; } .shop-delivery-stage { height: 265px; } }

.student-shop .shop-search-label { color:var(--shop-ink); display:block; font-weight:700; margin-bottom:6px; }
.shop-search { box-sizing:border-box; width:100%; min-height:44px; padding:10px 14px; border:2px solid #315e51; border-radius:12px; background:#fffdf7; color:#163d32; font:inherit; margin-bottom:14px; }
.shop-search:focus-visible { outline:3px solid #a87914; outline-offset:3px; }
.shop-results { color:#315e51; font-size:.9rem; }
/* Package silhouettes vary by what the student selected; the contents remain guaranteed. */
.delivery-garden { background:radial-gradient(circle at 50% 25%,#fffde1,#eaf5e5 70%); }
.parcel-capsule .shop-parcel-body { border-radius:48% 48% 25% 25%; background:linear-gradient(110deg,#b4e4e8,#e8faf8 48%,#97cad0); border-color:#408188; }
.parcel-capsule .shop-parcel-lid { border-radius:60% 60% 15% 15%; background:#94cbd1; border-color:#408188; }
.parcel-capsule .shop-parcel-label { background:#edf9f7; }
.parcel-crate .shop-parcel-body { border-radius:5px; background:repeating-linear-gradient(0deg,#d7b783 0 26px,#b98f56 27px 30px); border:5px solid #a27b44; }
.parcel-crate .shop-parcel-lid { border-radius:4px; background:#b99159; border:3px solid #886432; }
.parcel-envelope .shop-parcel-body { border-radius:8px; background:#f3ecd8; border:2px solid #b8a780; }
.parcel-envelope .shop-parcel-lid { height:55%; clip-path:polygon(0 0,100% 0,50% 100%); border-radius:0; background:#dbcdab; }
.parcel-envelope .shop-parcel-seal { background:#325f55; color:#fff3cd; }
.parcel-envelope.is-open .shop-parcel-lid { animation:envelope-open .55s ease-in forwards; }
.parcel-capsule.is-open .shop-parcel-lid { animation:capsule-open .65s ease-in forwards; }
@keyframes envelope-open { to { transform:translateY(-80px) rotateX(150deg);opacity:0; } }
@keyframes capsule-open { to { transform:translateY(-160px) rotate(-12deg);opacity:0; } }
@media(prefers-reduced-motion:reduce){.parcel-envelope.is-open .shop-parcel-lid,.parcel-capsule.is-open .shop-parcel-lid{animation:none;opacity:0}}
.shop-delivery.is-instant .shop-parcel-lid { animation:none;opacity:0; }

/* Hub collection preview (students.html Quest Hub + school/ dashboard) */
.student-collection-preview { --shop-ink: #183e3b; --shop-muted: #506b66; --shop-paper: #fffef9; --shop-line: #d4dfd6; --shop-accent: #145e51; color: var(--shop-ink); background: #f4f5ed; border-radius: 20px; padding: clamp(16px,3vw,24px); margin: 18px 0; }
.collection-preview-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.collection-preview-heading h3 { font-size: 1.35rem; margin: 2px 0 0; color: var(--shop-ink); letter-spacing: -.03em; }
.collection-preview-body { display: grid; grid-template-columns: 200px minmax(0,1fr); gap: 20px; align-items: start; margin-bottom: 16px; }
.collection-preview-look { background: var(--shop-paper); border: 1px solid var(--shop-line); border-radius: 14px; padding: 16px; text-align: center; }
.collection-preview-look h4 { font-size: .85rem; margin: 0 0 8px; color: var(--shop-ink); }
.collection-preview-look .cosmetic-loadout { width: 110px; height: 110px; margin: 8px auto 12px; }
.collection-preview-grid-section h4 { font-size: .95rem; margin: 0 0 10px; color: var(--shop-ink); }
.collection-preview-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(100px,1fr)); gap: 10px; }
.collection-preview-card { background: var(--shop-paper); border: 1px solid var(--shop-line); border-radius: 12px; padding: 10px; text-align: center; font-size: .72rem; font-weight: 650; color: var(--shop-ink); }
.collection-preview-card .cosmetic-art { width: 56px; height: 56px; margin: 0 auto 6px; }
.collection-preview-card.rarity-uncommon { border-color: #6e9b77; }
.collection-preview-card.rarity-rare { border-color: #799ac5; }
.collection-preview-card.rarity-legendary { border-color: #b29142; background: linear-gradient(155deg,#fff6d6,var(--shop-paper) 70%); }
.collection-preview-card p, .collection-preview-grid > p { grid-column: 1 / -1; color: var(--shop-muted); font-size: .82rem; text-align: center; }
@media (max-width: 680px) {
 .collection-preview-body { grid-template-columns: 1fr; }
 .collection-preview-look .cosmetic-loadout { width: 90px; height: 90px; }
}
