/*
 * Shop and backpack panels (Collector's Catalogue design, chosen Oct 2026), shared by the game
 * (shared/shop-panels.js: Points Store, Town Works, backpack, Gear shop) and the proposals page
 * (shop-ui/). Markup and behaviour: shared/shop-kit.js.
 *
 * Part 1 is the panels' structure, states and phone layout (.m, .m-opt, .m-detail, .m-slot...),
 * which every shop-ui proposal reuses. Part 2 is the Catalogue look (.m--catalogue): the shop as an
 * open catalogue, the backpack as the inside of the bag you wear.
 */

/* ---------------------------------------------------------------- mock: frame and header */
.m {
  --ink: #263445; --short: #CC3530; --focus: #FCAA1A;
  --pad: clamp(12px, 2.2vw, 22px); --cell: 128px; --gap: 10px; --slot: 66px; --list-h: 470px;
  position: relative; isolation: isolate; overflow: hidden; padding: var(--pad); border-radius: 22px;
  color: var(--ink); font: 400 15px/1.45 var(--body-font);
}
.m *, .m *::before, .m *::after { box-sizing: border-box; }
.m__deco { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; border-radius: inherit; }
.m-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.m__head { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.m__titlebox { position: relative; min-width: 0; max-width: 100%; }
.m__title { margin: 0; font: 400 clamp(24px, 3.4vw, 36px)/1 var(--title-font); letter-spacing: 0.5px; text-wrap: balance; }
.m__sub { margin: 5px 0 0; font: 700 11px/1.2 var(--body-font); letter-spacing: 1.6px; text-transform: uppercase; opacity: 0.85; }
.m__sub:empty { display: none; }
.m-flourish { display: block; width: min(240px, 100%); height: auto; margin: 6px auto 0; }
.m__keeper { position: relative; flex: 1 1 260px; min-width: 0; margin: 0; padding: 8px 14px; border-radius: 14px; font-size: 14px; line-height: 1.35; }
.m__keeper:has(.m__say:empty) { visibility: hidden; }
.m__who { font-weight: 800; }
.m__keeper--bag { order: 5; flex-basis: 100%; }
.m__wallet { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.m-coin {
  position: relative; display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 3px 12px 3px 5px; border-radius: 999px;
  font: 800 16px/1 var(--body-font); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.m-coin small { font: 600 11px/1 var(--body-font); opacity: 0.75; }
.m-coin.is-full b { color: var(--short); }
.m-coin.is-bump { animation: m-bump 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.m-float { position: absolute; right: 8px; top: -8px; font: 800 14px/1 var(--body-font); pointer-events: none; animation: m-float 1s ease-out forwards; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8); }
.m-float.is-down { color: #CC3530; }
.m-float.is-up { color: #2E9E6A; }
@keyframes m-bump { 40% { transform: scale(1.12); } }
@keyframes m-float { from { opacity: 0; transform: translateY(4px); } 20% { opacity: 1; } to { opacity: 0; transform: translateY(-24px); } }

/* ---------------------------------------------------------------- tabs */
.m__tabs { position: relative; display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 12px; }
.m-tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 14px 6px 8px; border: 0;
  background: none; color: inherit; font: 700 15px/1 var(--body-font); cursor: pointer;
}
.m-tab__icon { display: inline-grid; place-items: center; }
.m-tab__count { font: 700 12px/1 var(--body-font); opacity: 0.75; }
.m-tab__count:empty { display: none; }
.m-tab:focus-visible, .m-opt:focus-visible, .m-slot:focus-visible, .m button:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ---------------------------------------------------------------- list */
.m__body { position: relative; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.m__listwrap { min-width: 0; }
.m__list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--cell)), 1fr)); gap: var(--gap); margin: 0; padding: 12px; list-style: none;
  max-height: var(--list-h); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.m-list--rows.m-shop .m__list { grid-template-columns: minmax(0, 1fr); }
.m-opt { position: relative; display: grid; justify-items: center; align-content: start; gap: 6px; min-width: 0; padding: 12px 8px 10px; text-align: center; cursor: pointer; user-select: none; -webkit-user-select: none; }
.m-opt__art { position: relative; display: grid; place-items: center; }
.m-opt__text { display: grid; gap: 2px; min-width: 0; max-width: 100%; }
.m-opt__name { font: 700 14px/1.2 var(--body-font); overflow-wrap: anywhere; }
.m-opt__desc { display: none; font-size: 12.5px; line-height: 1.35; opacity: 0.85; }
.m-opt__meta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 8px; font-size: 12px; }
.m-opt__have, .m-opt__status { font: 700 11px/1.2 var(--body-font); opacity: 0.85; }
.m-opt__tag {
  position: absolute; z-index: 2; top: 6px; left: 6px; padding: 3px 8px; border-radius: 6px; background: #CC3530; color: #fff;
  font: 800 10px/1 var(--body-font); letter-spacing: 1px; text-transform: uppercase;
}
.m-opt__rarity { font: 800 10px/1 var(--body-font); letter-spacing: 1px; text-transform: uppercase; color: var(--rar); }
.m-price { display: inline-flex; align-items: center; gap: 3px; font: 800 14px/1 var(--body-font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.m-price small { margin-left: 2px; font: 600 10px/1 var(--body-font); opacity: 0.75; }
.m-opt.is-short .m-opt__price { color: var(--short); }
.m-star { position: absolute; left: -2px; bottom: -2px; font-size: 18px; line-height: 1; -webkit-text-stroke: 1px rgba(38, 52, 69, 0.75); paint-order: stroke fill; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.3)); }
.m-star--1 { color: #C9CED8; }
.m-star--2 { color: #FCAA1A; }
.m-glyph { display: inline-grid; place-items: center; border-radius: 22%; background: var(--glyph); color: rgba(38, 52, 69, 0.75); font-family: var(--title-font); line-height: 1; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12), inset 0 0 0 2px rgba(255, 255, 255, 0.45); }
.m-none { grid-column: 1 / -1; padding: 18px; text-align: center; opacity: 0.85; }

/* Sell: what Mayor Mabel is building */
.m__listhead[hidden] { display: none; }
.m-project { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.82); color: #263445; }
.m-project__name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 0 0 6px; font-size: 14px; }
.m-project__name span { font: 700 10px/1 var(--body-font); letter-spacing: 1.4px; text-transform: uppercase; opacity: 0.75; }
.m-project__name b { font: 400 19px/1 var(--heading-font); letter-spacing: 0.3px; }
.m-project__name small { font-size: 12px; opacity: 0.8; }
.m-project__needs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 4px 12px; margin: 0; padding: 0; list-style: none; font-size: 12px; }
.m-project__needs li { display: grid; grid-template-columns: 4.2em minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.m-bar { position: relative; height: 8px; border-radius: 999px; overflow: hidden; background: rgba(38, 52, 69, 0.15); }
.m-bar i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, #FCAA1A, #E14826); }

/* ---------------------------------------------------------------- detail pane */
.m-detail { position: sticky; top: 70px; display: grid; gap: 12px; min-width: 0; padding: 16px; }
.m-detail__stage { position: relative; display: grid; place-items: center; min-height: 176px; }
.m-detail__art { position: relative; display: grid; place-items: center; }
.m-detail__tag {
  position: absolute; top: 6px; right: 6px; padding: 4px 10px; border-radius: 6px; background: #CC3530; color: #fff;
  font: 800 11px/1 var(--body-font); letter-spacing: 1px; text-transform: uppercase;
}
.m-detail__q {
  position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px 5px 26px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92); color: #263445; font: 800 12px/1 var(--body-font); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
.m-detail__q .m-star { left: 6px; bottom: auto; top: 50%; transform: translateY(-50%); font-size: 16px; }
.m-detail__info { display: grid; gap: 8px; min-width: 0; }
.m-detail__name { margin: 0; font: 400 clamp(22px, 2.4vw, 28px)/1.05 var(--heading-font); letter-spacing: 0.3px; overflow-wrap: anywhere; }
.m-detail__name small { font: 700 15px/1 var(--body-font); opacity: 0.75; }
.m-detail__chips { margin: 0; }
.m-chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--rar) 22%, transparent);
  box-shadow: inset 0 0 0 2px var(--rar); font: 800 11px/1.2 var(--body-font); letter-spacing: 1px; text-transform: uppercase;
}
.m-detail__desc { margin: 0; font-size: 15px; line-height: 1.5; }
.m-detail__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 112px), 1fr)); gap: 6px; margin: 0; }
.m-detail__stats div { min-width: 0; padding: 6px 10px; border-radius: 10px; }
.m-detail__stats dt { font: 700 10px/1.2 var(--body-font); letter-spacing: 1.3px; text-transform: uppercase; opacity: 0.75; }
.m-detail__stats dd { margin: 2px 0 0; font: 600 13.5px/1.3 var(--body-font); overflow-wrap: anywhere; }
.m-detail__deal { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px 12px; }
.m-step { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 999px; }
.m-step button { display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: none; color: inherit; font: 800 22px/1 var(--body-font); cursor: pointer; }
.m-step button:disabled { opacity: 0.35; cursor: default; }
.m-step .m-step__all { width: auto; padding: 0 10px; border-radius: 999px; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }
.m-step__n { min-width: 2.2ch; text-align: center; font: 800 18px/1 var(--body-font); font-variant-numeric: tabular-nums; }
.m-detail__total { display: grid; justify-items: end; gap: 3px; margin: 0; }
.m-detail__total > span { font: 700 11px/1.2 var(--body-font); letter-spacing: 1.2px; text-transform: uppercase; opacity: 0.8; }
.m-detail__total .m-price { gap: 5px; font-size: 24px; }
.m-buy {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; min-height: 54px; padding: 10px 20px; border: 0;
  color: #fff; font: 400 20px/1 var(--title-font); letter-spacing: 0.5px; text-transform: uppercase; cursor: pointer;
}
.m-buy__sum { padding: 4px 9px; border-radius: 999px; background: rgba(0, 0, 0, 0.18); font: 800 13px/1 var(--body-font); letter-spacing: 0; text-transform: none; }
.m-buy[aria-disabled='true'] { cursor: not-allowed; filter: grayscale(0.85); opacity: 0.6; }
.m-buy.is-nope { animation: m-nope 0.36s; }
@keyframes m-nope { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.m-detail__reason { grid-column: 1 / -1; margin: 0; font-size: 13px; line-height: 1.35; }
.m-detail__reason:empty { display: none; }
.m-detail__reason.is-warn { color: var(--short); font-weight: 700; }
.m-ghost { grid-column: 1 / -1; min-height: 44px; padding: 8px 14px; border: 0; border-radius: 999px; background: transparent; color: inherit; box-shadow: inset 0 0 0 2px currentColor; font: 700 14px/1.2 var(--body-font); cursor: pointer; }
.m-detail__empty { padding: 30px 10px; text-align: center; }
.m-detail__hole { width: 96px; height: 96px; border: 3px dashed currentColor; border-radius: 18px; opacity: 0.3; }

/* ---------------------------------------------------------------- backpack */
.m-cap { display: flex; flex: 1 1 260px; align-items: center; gap: 10px; min-width: 0; }
.m-cap__pack { display: inline-flex; align-items: center; gap: 6px; font: 700 14px/1 var(--body-font); white-space: nowrap; }
.m-cap__bar { position: relative; flex: 1 1 80px; min-width: 60px; height: 14px; border-radius: 999px; overflow: hidden; background: rgba(0, 0, 0, 0.2); }
.m-cap__bar i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, #7FD47F, #2E9E6A); transition: width 0.4s ease; }
.m-cap__bar.is-full i { background: linear-gradient(90deg, #FCAA1A, #E14826); }
.m-cap__num { font: 800 15px/1 var(--body-font); font-variant-numeric: tabular-nums; }
.m-inv .m__list { grid-template-columns: repeat(auto-fill, minmax(var(--slot), 1fr)); gap: 8px; max-height: none; }
.m-inv .m__list:not(.m-slots--bag) { --slot: 84px; }
.m-slot { position: relative; display: grid; place-items: center; aspect-ratio: 1; min-width: 0; padding: 0; cursor: pointer; user-select: none; -webkit-user-select: none; }
.m-slot__qty { position: absolute; right: 5px; bottom: 3px; font: 800 13px/1 var(--body-font); font-variant-numeric: tabular-nums; }
.m-slot .m-star { left: 3px; bottom: 2px; font-size: 15px; }
.m-slot__worn { position: absolute; right: 4px; top: 4px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #2E9E6A; color: #fff; font: 800 11px/1 var(--body-font); }
.m-slot.is-over { outline: 2px dashed var(--short); outline-offset: -4px; }
.m__hint { margin: 10px 2px 0; font-size: 12.5px; line-height: 1.4; opacity: 0.85; }

/* ---------------------------------------------------------------- tablet and phone */
@media (max-width: 760px) {
  .m__body { grid-template-columns: minmax(0, 1fr); }
  /* The selected item sits above the list, image left and name right; picking scrolls it into view. */
  .m-detail { order: -1; position: relative; top: auto; grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .m-detail__info { display: contents; }
  .m-detail__stage { grid-row: span 2; min-height: 0; padding: 8px; }
  .m-detail__name, .m-detail__chips { grid-column: 2; }
  .m-detail__desc, .m-detail__stats, .m-detail__deal, .m-detail__reason, .m-detail__empty { grid-column: 1 / -1; }
  .m-detail__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m-detail__desc { font-size: 14px; }
  .m__list { max-height: 56vh; }
}
@media (max-width: 640px) {
  .m { --cell: 104px; --slot: 56px; border-radius: 18px; }
  .m-inv .m__list:not(.m-slots--bag) { --slot: 70px; }
  .m__wallet { margin-left: 0; }
  .m-coin { min-height: 32px; font-size: 14px; }
  .m-tab { gap: 4px; padding: 6px 10px 6px 6px; font-size: 13.5px; }
  .m-detail__q { padding-left: 22px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .m *, .m *::before, .m *::after { animation: none !important; transition: none !important; }
}

/* ================================================================ part 2: the Collector's Catalogue */
/*
 * 3 · Collector's Catalogue: an illustrated mail-order catalogue open on a navy desk. The spread's
 * left page is a ledger of items (framed icon tile, name, line, owned, price) and the right page a
 * full plate of the selected item with stamps and an order coupon. Ribbon bookmarks are the
 * sections. The backpack is not a book: it opens like the bag you wear (see the backpack section).
 */
.m--catalogue {
  --paper: #FBF1DC; --paper-d: #F1DFB8; --rule: #C9A86A; --ink-red: #6B2A12; --stamp: #CC3530; --plate: #FFF8E8;
  --ink: #3B2A1A; --short: #B3261E; --focus: #263445;
  padding: 36px clamp(18px, 3.4vw, 40px) clamp(22px, 3vw, 34px); border-radius: 18px;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.1), transparent 60%), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 7px), #263445;
  box-shadow: 0 18px 34px rgba(20, 25, 40, 0.3);
}
/* the open book: two pages and the spine shadow, with page edges below */
.m--catalogue .m__deco::before {
  content: ''; position: absolute; inset: 14px 10px 12px; border-radius: 6px 6px 10px 10px;
  background:
    linear-gradient(90deg, rgba(120, 80, 30, 0.12), transparent 4%, transparent 46%, rgba(120, 80, 30, 0.22) 49.4%, rgba(90, 60, 20, 0.38) 50%, rgba(120, 80, 30, 0.22) 50.6%, transparent 54%, transparent 96%, rgba(120, 80, 30, 0.12)),
    radial-gradient(ellipse at 50% 40%, var(--paper), var(--paper-d));
  box-shadow: 0 4px 0 #E5D0A4, 0 7px 0 #D6BC8A, 0 9px 0 #E5D0A4, 0 16px 24px rgba(0, 0, 0, 0.4);
}

/* header across the spread */
.m--catalogue .m__head { justify-content: center; }
.m--catalogue .m__titlebox { flex: 1 1 100%; text-align: center; color: #C08A2E; }
.m--catalogue .m__title { color: var(--ink-red); font-size: clamp(26px, 4vw, 42px); text-shadow: 0 2px 0 rgba(192, 138, 46, 0.35); }
.m--catalogue .m__sub { color: #8A6A3A; letter-spacing: 3px; }
.m--catalogue .m__keeper { background: rgba(255, 255, 255, 0.5); border-left: 4px solid var(--stamp); border-radius: 4px; font-style: italic; }
.m--catalogue .m__who { color: var(--stamp); font-style: normal; }
.m--catalogue .m__wallet { margin-left: 0; }
.m--catalogue .m-coin { border-radius: 4px; background: var(--plate); box-shadow: inset 0 0 0 2px var(--rule), inset 0 0 0 4px var(--plate), inset 0 0 0 5px rgba(201, 168, 106, 0.6); }

/* ribbon bookmarks */
.m--catalogue .m__tabs { justify-content: center; align-items: flex-start; gap: 8px; margin: 10px 0 18px; padding-top: 0; border-top: 2px solid var(--rule); }
.m--catalogue .m-tab {
  --rib: #E14826; flex-direction: column; justify-content: flex-start; gap: 4px; min-width: 84px; min-height: 66px; padding: 8px 10px 20px;
  border-radius: 0; color: #fff; background: linear-gradient(90deg, rgba(0, 0, 0, 0.12), transparent 30%, transparent 70%, rgba(0, 0, 0, 0.12)), var(--rib);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 12px), 0 100%); font-size: 13px; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  transition: min-height 0.2s ease, padding 0.2s ease, filter 0.2s ease;
}
.m--catalogue .m-tab--bags { --rib: #263445; }
.m--catalogue .m-tab--tools { --rib: #585C3F; }
.m--catalogue .m-tab--sell { --rib: #C08A2E; }
.m--catalogue.m-inv .m-tab--decor { --rib: #2E9E6A; }
.m--catalogue.m-inv .m-tab--tools { --rib: #263445; }
.m--catalogue .m-tab:not([aria-selected='true']) { filter: saturate(0.7) brightness(1.08); }
.m--catalogue .m-tab:hover { min-height: 72px; }
.m--catalogue .m-tab[aria-selected='true'] { min-height: 82px; padding-bottom: 28px; }
.m--catalogue .m-tab:focus-visible { outline: none; box-shadow: inset 0 0 0 3px #FFF1C2, inset 0 0 0 5px #263445; }
.m--catalogue .m-tab__count { opacity: 0.9; }

/* the two pages */
.m--catalogue .m__body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); }
.m--catalogue .m__list { --gap: 0; padding: 0 6px 0 14px; }
.m--catalogue .m-opt {
  grid-template-columns: auto minmax(0, 1fr) auto; justify-items: start; align-items: center; gap: 4px 14px; padding: 10px 8px 10px 10px;
  text-align: left; border-bottom: 2px dotted rgba(110, 80, 40, 0.35); transition: background 0.2s ease;
}
.m--catalogue .m-opt__art { padding: 5px; border-radius: 3px; background: var(--plate); box-shadow: 0 0 0 2px var(--rule), 0 0 0 5px var(--plate), 0 0 0 6px var(--rule), 0 3px 6px 4px rgba(110, 80, 40, 0.15); margin: 6px; }
.m--catalogue .m-opt__name { font: 400 19px/1.1 var(--heading-font); letter-spacing: 0.3px; color: var(--ink-red); }
.m--catalogue .m-opt__desc { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-style: italic; }
.m--catalogue .m-opt__meta { flex-direction: column; align-items: flex-end; gap: 5px; }
.m--catalogue .m-opt__price { font-size: 16px; }
.m--catalogue .m-opt__tag { left: 2px; top: 2px; padding: 3px 6px; border: 2px solid var(--stamp); border-radius: 4px; background: var(--paper); color: var(--stamp); transform: rotate(-14deg); }
.m--catalogue .m-opt__rarity { grid-column: 2; margin-top: -4px; }
.m--catalogue .m-opt:hover { background: rgba(252, 170, 26, 0.12); }
.m--catalogue .m-opt.is-sel { background: linear-gradient(100deg, transparent 0 1%, rgba(252, 170, 26, 0.45) 2.5% 96%, transparent 99%); }
.m--catalogue .m-opt.is-sel::before { content: ''; position: absolute; left: -14px; top: -3px; width: 12px; height: calc(100% + 6px); background: var(--stamp); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%); }

/* right page: the plate */
.m--catalogue .m-detail { padding: 4px 6px; }
.m--catalogue .m-detail__stage {
  min-height: 210px; margin: 8px; border-radius: 2px;
  background: radial-gradient(circle at 50% 45%, rgba(252, 170, 26, 0.2), transparent 62%), var(--plate);
  box-shadow: 0 0 0 2px var(--rule), 0 0 0 7px var(--plate), 0 0 0 8px var(--rule), 0 6px 14px 8px rgba(110, 80, 40, 0.16);
}
.m--catalogue .m-detail__art { filter: drop-shadow(0 8px 6px rgba(110, 80, 40, 0.35)); }
.m--catalogue .m-detail__tag {
  top: -14px; right: -14px; display: grid; place-items: center; width: 66px; height: 66px; padding: 0; border-radius: 50%;
  border: 3px double var(--stamp); background: rgba(255, 248, 232, 0.85); color: var(--stamp); font: 400 14px/1 var(--title-font); transform: rotate(14deg);
}
.m--catalogue .m-detail__name { color: var(--ink-red); font: 400 clamp(24px, 2.8vw, 32px)/1.05 var(--title-font); text-align: center; }
.m--catalogue .m-detail__chips { text-align: center; }
.m--catalogue .m-detail__desc { font-style: italic; text-align: center; }
.m--catalogue .m-detail__stats { gap: 0; border-block: 2px solid var(--rule); }
.m--catalogue .m-detail__stats div { border-radius: 0; padding: 8px 10px; box-shadow: inset -1px 0 0 rgba(110, 80, 40, 0.3); }
.m--catalogue .m-step { box-shadow: inset 0 0 0 2px var(--rule); background: var(--plate); }
/* the order coupon: notched ends and a dashed cut line */
.m--catalogue .m-buy {
  border-radius: 6px; outline: 2px dashed rgba(255, 255, 255, 0.75); outline-offset: -8px;
  background: radial-gradient(circle at 0 50%, var(--paper) 9px, transparent 10px), radial-gradient(circle at 100% 50%, var(--paper) 9px, transparent 10px), linear-gradient(180deg, #F0592E, #D63F1E);
  box-shadow: 0 4px 0 #9A2A12; transition: transform 0.1s;
}
.m--catalogue .m-buy:active:not([aria-disabled='true']) { transform: translateY(3px); }
.m--catalogue .m-buy:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.m--catalogue .m-ghost { color: var(--ink-red); }
.m--catalogue .m-project { background: var(--plate); box-shadow: 0 0 0 2px var(--rule); border-radius: 3px; }

/* ---------------------------------------------------------------- backpack: inside the open bag
 * The bag you wear, seen from above with its zip open: the body (.m-bag), the zip around the rim,
 * the pull, and a padded, quilted lining. Slots are stitched pockets with the whole item in view
 * (nothing covers the icon), the stack size on a sewn tag and quality as an enamel pin. Tools sit
 * on an elastic loop sewn behind them. The details are on a luggage tag. The worn
 * pack ([data-pack], as the 3D packs in characters-ac/styles/core.js) picks the materials:
 * none = a linen drawstring pouch, satchel = brown leather, rucksack = green canvas with tan
 * straps, explorer = navy with an orange lining.
 */
.m--catalogue.m-inv {
  --bag: #8A5A35; --bag-d: #5E3A20; --lining: #D9AE7E; --lining-d: #C3925F; --pocket: #CF9F6C; --stitch: #F6DDA9;
  --teeth: #F2C14E; --tape: #4A2C16; --strap: #6B4226; --strap-l: #8A5A35; --bag-tex: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1.6px) 0 0 / 7px 7px, radial-gradient(rgba(0, 0, 0, 0.12) 1px, transparent 1.6px) 3px 4px / 9px 9px;
  --ink: #3B2A1A;
  padding: 46px clamp(34px, 4.4vw, 52px) clamp(38px, 4vw, 50px);
}
.m--catalogue.m-inv[data-pack='none'] {
  --bag: #CDB48C; --bag-d: #A88B60; --lining: #F1E6CF; --lining-d: #E0CFAE; --pocket: #E8D9BB; --stitch: #8A6A40;
  --strap: #8A6A40; --strap-l: #A88B60; --bag-tex: repeating-linear-gradient(0deg, rgba(90, 60, 20, 0.07) 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, rgba(90, 60, 20, 0.07) 0 1px, transparent 1px 3px);
}
.m--catalogue.m-inv[data-pack='rucksack'] {
  --bag: #6B8E4E; --bag-d: #4C6837; --lining: #E8E6CB; --lining-d: #D2D0AC; --pocket: #DCDAB8; --stitch: #8A5A35;
  --teeth: #2F3327; --tape: #4C6837; --strap: #8A5A35; --strap-l: #A8734A; --bag-tex: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.08) 0 1px, transparent 1px 4px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 4px);
}
.m--catalogue.m-inv[data-pack='explorer'] {
  --bag: #34506E; --bag-d: #263445; --lining: #EE7B4A; --lining-d: #D35A2A; --pocket: #E56C3A; --stitch: #FFE1C8;
  --teeth: #FCAA1A; --tape: #263445; --strap: #263445; --strap-l: #3E5C7E; --ink: #2A1A10;
  --bag-tex: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 6px), repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.1) 0 2px, transparent 2px 6px);
}
.m--catalogue.m-inv .m__deco::before { content: none; }
.m--catalogue .m-bag {
  position: absolute; inset: 8px; border-radius: 34px; background: var(--bag-tex), linear-gradient(180deg, var(--bag), var(--bag-d));
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.18), inset 0 -6px 0 rgba(0, 0, 0, 0.22), 0 14px 26px rgba(0, 0, 0, 0.4);
}
/* the lining: padded and quilted, deep at the top edge where you look into the bag */
.m--catalogue .m-bag::before {
  content: ''; position: absolute; inset: 24px; border-radius: 22px;
  background: repeating-linear-gradient(45deg, transparent 0 26px, rgba(0, 0, 0, 0.07) 26px 27px), repeating-linear-gradient(-45deg, transparent 0 26px, rgba(0, 0, 0, 0.07) 26px 27px), radial-gradient(ellipse at 50% 60%, var(--lining), var(--lining-d));
  box-shadow: inset 0 22px 26px -10px rgba(0, 0, 0, 0.38), inset 0 0 0 2px rgba(0, 0, 0, 0.12), inset 0 -6px 14px rgba(0, 0, 0, 0.12);
}
/* the zip: tape on both sides, chunky teeth between */
.m--catalogue .m-zip { position: absolute; inset: 13px; border: 6px dashed var(--teeth); border-radius: 28px; box-shadow: 0 0 0 4px var(--tape), inset 0 0 0 4px var(--tape); }
.m--catalogue .m-zip-pull { position: absolute; right: 64px; top: 4px; width: 20px; height: 26px; border-radius: 5px 5px 8px 8px; background: linear-gradient(90deg, #B8862C, #FFE08A 45%, #B8862C); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.45); transform: rotate(-14deg); }
.m--catalogue .m-zip-pull::after { content: ''; position: absolute; left: 3px; right: 3px; top: 22px; height: 30px; border-radius: 4px 4px 10px 10px; background: linear-gradient(90deg, #B8862C, #FFE08A 45%, #B8862C); box-shadow: inset 0 0 0 3px transparent, 0 3px 4px rgba(0, 0, 0, 0.4); -webkit-mask: radial-gradient(circle 3px at 50% 70%, transparent 98%, #000); mask: radial-gradient(circle 3px at 50% 70%, transparent 98%, #000); }
/* the pouch has a hem and a drawstring instead of a zip */
.m--catalogue.m-inv[data-pack='none'] .m-bag { border-radius: 44px; }
.m--catalogue.m-inv[data-pack='none'] .m-zip { inset: 14px; border: 3px dashed var(--stitch); border-radius: 36px; box-shadow: none; }
.m--catalogue.m-inv[data-pack='none'] .m-zip-pull { right: 50%; top: 2px; width: 30px; height: 14px; margin-right: -15px; border-radius: 999px; background: #8A6A40; transform: none; }
.m--catalogue.m-inv[data-pack='none'] .m-zip-pull::after { left: 4px; right: auto; top: 12px; width: 4px; height: 26px; border-radius: 2px; background: #6E5230; box-shadow: 18px 0 0 #6E5230; -webkit-mask: none; mask: none; }

/* header: a sewn-on name patch, Pip's note on a fabric label */
.m--catalogue.m-inv .m__titlebox { flex: 0 1 auto; padding: 8px 20px 9px; border-radius: 8px; background: #FFF8E8; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25); outline: 2px dashed rgba(107, 42, 18, 0.55); outline-offset: -6px; transform: rotate(-1.5deg); }
.m--catalogue.m-inv .m__title { font-size: clamp(22px, 3vw, 32px); }
.m--catalogue.m-inv .m__keeper { background: rgba(255, 248, 232, 0.88); border-left-color: var(--strap); }
.m--catalogue.m-inv .m-coin { background: #FFF8E8; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25); }
.m--catalogue.m-inv .m-cap { padding: 6px 12px; border-radius: 999px; background: rgba(255, 248, 232, 0.88); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); }
/* capacity: a webbing strap that fills up */
.m--catalogue.m-inv .m-cap__bar { height: 16px; border-radius: 4px; background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 4px), var(--strap); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); }
.m--catalogue.m-inv .m-cap__bar i { inset: 3px auto 3px 3px; border-radius: 2px; background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 4px), linear-gradient(180deg, #8FDB8F, #2E9E6A); }
.m--catalogue.m-inv .m-cap__bar.is-full i { background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 4px), linear-gradient(180deg, #FFB08A, #E14826); }

/* tabs: webbing straps with a brass rivet on the open one */
.m--catalogue.m-inv .m__tabs { border-top: 0; margin: 12px 0 14px; }
.m--catalogue.m-inv .m-tab {
  --rib: var(--strap); min-height: 58px; color: #FFF4DF;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 2px, transparent 2px 5px), linear-gradient(90deg, rgba(0, 0, 0, 0.18), transparent 25%, transparent 75%, rgba(0, 0, 0, 0.18)), var(--rib);
}
.m--catalogue.m-inv .m-tab[aria-selected='true'] { --rib: var(--strap-l); min-height: 74px; filter: none; }
.m--catalogue.m-inv .m-tab[aria-selected='true']::after { content: ''; position: absolute; left: 50%; bottom: 20px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #FFF1C2, #B8862C); }

/* the body: wider pockets than the catalogue's two pages */
.m--catalogue.m-inv .m__body { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: clamp(16px, 3vw, 32px); }
.m--catalogue.m-inv .m__list { --slot: 78px; gap: 12px 10px; padding: 12px 6px 6px; }
.m--catalogue.m-inv .m__list:not(.m-slots--bag) { --slot: 104px; }
.m--catalogue.m-inv .m__hint { color: var(--ink); }

/* a stitched pocket; the item sits whole in the middle with a small tilt */
.m--catalogue .m-slot {
  --tilt: -5deg; border-radius: 10px 10px 16px 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.03) 30%), var(--pocket);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14), 0 2px 0 rgba(255, 255, 255, 0.3), 0 3px 6px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}
.m--catalogue .m-slot:nth-child(3n + 2) { --tilt: 4deg; }
.m--catalogue .m-slot:nth-child(3n) { --tilt: -1deg; }
.m--catalogue .m-slot::before { content: ''; position: absolute; inset: 4px; border: 2px dashed var(--stitch); border-radius: 7px 7px 12px 12px; opacity: 0.75; pointer-events: none; }
.m--catalogue .m-slot > .fz-icon, .m--catalogue .m-slot > .m-glyph { position: relative; transform: rotate(var(--tilt)); filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.35)); transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
.m--catalogue .m-slot:hover > .fz-icon, .m--catalogue .m-slot:hover > .m-glyph { transform: rotate(0deg) scale(1.04); }
/* the stack size on a little sewn tag, quality as an enamel pin */
.m--catalogue .m-slot__qty {
  z-index: 2; right: -4px; bottom: 7px; padding: 2px 6px; border-radius: 2px; background: #FFF8E8; color: var(--ink-red); transform: rotate(-7deg);
  font: 400 14px/1 var(--heading-font); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); outline: 1px dashed rgba(160, 120, 60, 0.7); outline-offset: -3px;
}
.m--catalogue .m-slot .m-star {
  z-index: 2; left: -5px; top: -5px; bottom: auto; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 13px;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.45), transparent 50%), #263445; -webkit-text-stroke: 0; filter: none;
  box-shadow: 0 0 0 2px currentColor, 0 2px 3px rgba(0, 0, 0, 0.45);
}
.m--catalogue .m-slot.is-sel { transform: translateY(-3px); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14), 0 0 0 3px #FCAA1A, 0 8px 14px rgba(0, 0, 0, 0.28); }
.m--catalogue .m-slot.is-sel > .fz-icon, .m--catalogue .m-slot.is-sel > .m-glyph { transform: rotate(0deg) scale(1.08); }
.m--catalogue .m-slot.is-over { outline-color: var(--stamp); }
/* tools: an elastic loop sewn across the pocket, behind the tool (a background layer, never over the icon) */
.m--catalogue .m-slots--tools .m-slot {
  background:
    linear-gradient(180deg, transparent 52%, rgba(0, 0, 0, 0.25) 52% 53%, transparent 53% 65%, rgba(0, 0, 0, 0.2) 65% 66%, transparent 66%),
    linear-gradient(180deg, transparent 52%, var(--strap-l) 52% 66%, transparent 66%) 0 0 / 100% 100% no-repeat,
    linear-gradient(180deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.03) 30%), var(--pocket);
}
.m--catalogue .m-slot__worn { z-index: 2; }

/* the details: a luggage tag */
.m--catalogue.m-inv .m-detail {
  padding: 30px 16px 16px; background: #FFF8E8; border-radius: 6px;
  clip-path: polygon(22px 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%, 0 22px);
  box-shadow: inset 0 0 0 2px var(--rule);
}
.m--catalogue.m-inv .m-detail::before { content: ''; position: absolute; left: 50%; top: 9px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--strap); box-shadow: 0 0 0 4px #E5D0A4, inset 0 2px 3px rgba(0, 0, 0, 0.5); }
.m--catalogue.m-inv .m-detail__stage { min-height: 170px; margin: 4px 0 0; border-radius: 14px; background: repeating-linear-gradient(45deg, transparent 0 18px, rgba(0, 0, 0, 0.06) 18px 19px), var(--lining); box-shadow: inset 0 8px 14px rgba(0, 0, 0, 0.22); outline: 2px dashed var(--stitch); outline-offset: -7px; }
.m--catalogue.m-inv .m-detail__name, .m--catalogue.m-inv .m-detail__desc, .m--catalogue.m-inv .m-detail__chips { text-align: left; }
.m--catalogue.m-inv .m-detail__desc { font-style: normal; }
.m--catalogue.m-inv .m-detail__stats { border-block: 0; gap: 6px; }
.m--catalogue.m-inv .m-detail__stats div { border-radius: 8px; background: rgba(201, 168, 106, 0.18); box-shadow: none; }
.m--catalogue.m-inv .m-buy { background: linear-gradient(180deg, #F0592E, #D63F1E); outline: 2px dashed rgba(255, 255, 255, 0.6); outline-offset: -6px; }
.m--catalogue.m-inv .m-buy:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }


@media (max-width: 760px) {
  /* one page: no spine, the plate above the ledger */
  .m--catalogue .m__deco::before { background: radial-gradient(ellipse at 50% 30%, var(--paper), var(--paper-d)); }
  .m--catalogue .m__body { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .m--catalogue .m-detail { padding-bottom: 14px; border-bottom: 2px solid var(--rule); }
  .m--catalogue .m-detail__name, .m--catalogue .m-detail__desc, .m--catalogue .m-detail__chips { text-align: left; }
  .m--catalogue.m-inv .m__body { grid-template-columns: minmax(0, 1fr); }
  .m--catalogue.m-inv .m-detail { border-bottom: 0; }
  .m--catalogue.m-inv .m-detail__stage { min-height: 0; padding: 12px; }
}
@media (max-width: 640px) {
  .m--catalogue { padding: 30px 18px 20px; }
  .m--catalogue .m__deco::before { inset: 10px 6px 10px; }
  .m--catalogue .m__tabs { gap: 5px; }
  .m--catalogue .m-tab { min-width: 70px; padding-inline: 6px; font-size: 12px; }
  .m--catalogue .m__list { padding: 0 4px 0 10px; }
  .m--catalogue .m-opt { gap: 4px 10px; }
  .m--catalogue .m-opt__desc { display: none; }
  .m--catalogue .m-detail__tag { width: 52px; height: 52px; font-size: 12px; top: -10px; right: -10px; }
  .m--catalogue.m-inv { padding: 40px 30px 32px; }
  .m--catalogue .m-bag { inset: 6px; border-radius: 26px; }
  .m--catalogue .m-bag::before { inset: 18px; border-radius: 16px; }
  .m--catalogue .m-zip { inset: 9px; border-width: 5px; border-radius: 22px; }
  .m--catalogue .m-zip-pull { right: 40px; top: 1px; }
  .m--catalogue.m-inv .m__list { --slot: 58px; padding: 10px 6px 6px; }
  .m--catalogue.m-inv .m__list:not(.m-slots--bag) { --slot: 72px; }
}

/* ================================================================ part 3: in the game
 * The panels open in the game's modal (.fz-panel, brand.css): the catalogue is the whole panel.
 * The Gear shop is one catalogue page inside the Character panel (.m--embed, editors.js).
 */
.fz-panel.fz-panel--shop {
  width: min(1100px, 100%); max-height: min(92vh, 900px); padding: 0; border: 0; border-radius: 22px;
  background: none; box-shadow: 0 24px 60px rgba(10, 14, 24, 0.45); overflow: auto; overscroll-behavior: contain;
}
.fz-panel--shop .m__close { position: absolute; z-index: 4; top: 12px; right: 12px; width: 36px; height: 36px; background: #FFF8E8; color: #6B2A12; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
.fz-panel--shop .m-inv .m__close { top: 18px; right: 18px; }
.fz-panel--shop .m__close:focus-visible { outline: 3px solid #FCAA1A; outline-offset: 2px; }
.fz-panel--shop .m__say.fz-panel__sub { margin: 0; font: inherit; color: inherit; }
.fz-panel--shop .m__head { padding-right: 40px; }
.fz-panel--shop .m-detail { top: 8px; }
.fz-panel--shop .m__list { max-height: min(52vh, 470px); }
.fz-panel--shop .m-inv .m__list { max-height: none; }
.m-project__blurb { margin: 0 0 6px; font-size: 12.5px; line-height: 1.4; opacity: 0.85; }
@media (max-width: 720px) {
  .fz-panel.fz-panel--shop { width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 22px 22px 0 0; }
}

.m--catalogue.m--embed { padding: 12px 12px 8px; border-radius: 10px; overflow: visible; background: radial-gradient(ellipse at 50% 30%, var(--paper), var(--paper-d)); box-shadow: inset 0 0 0 2px var(--rule); }
.m--embed .m__sub { margin: 0 0 4px; text-align: center; letter-spacing: 3px; color: #8A6A40; }
.m--embed .fz-char__note { color: var(--ink); }
.m--embed .m-gear__sub { margin: 10px 0 0; padding-bottom: 3px; border-bottom: 2px solid var(--rule); color: var(--ink-red); font: 400 18px/1.1 var(--heading-font); }
.m--embed .m__list { padding: 0; max-height: none; overflow: visible; }
.m--embed .m__list > li { list-style: none; }
.m--embed .m-opt { width: 100%; border: 0; border-bottom: 2px dotted rgba(110, 80, 40, 0.35); background: none; font: inherit; color: inherit; cursor: pointer; }
.m--embed .m-opt__art { margin: 4px; padding: 3px; }
.m--embed .m-opt__art svg, .m--embed .m-opt__art .fz-icon { width: 40px !important; height: 40px !important; }
.m--embed .m-opt__text { justify-items: start; }
.m--embed .m-opt__name { font-size: 17px; }
.m--embed .m-opt__desc { white-space: normal; }
.m--embed .m-opt__rarity { margin: 0; }
.m--embed .m-opt__buy { padding: 5px 12px; border-radius: 4px; background: linear-gradient(180deg, #F0592E, #D63F1E); color: #fff; font: 400 13px/1 var(--title-font); text-transform: uppercase; outline: 1px dashed rgba(255, 255, 255, 0.7); outline-offset: -4px; }
.m--embed .m-opt:hover:not([disabled]) { background: rgba(252, 170, 26, 0.18); }
.m--embed .m-opt:focus-visible { outline: 3px solid var(--focus); outline-offset: -2px; }
.m--embed .m-opt[disabled] { opacity: 0.5; cursor: not-allowed; }
.m--embed .m-opt.is-owned { cursor: default; }
.m--embed .m-opt.is-owned .m-opt__status { color: #2E7D4F; }
