.market-shell { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 72px; }
.market-hero, .market-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.market-hero { margin-bottom: 24px; }
.market-hero h1 { margin: 0; color: var(--ink); font: 500 clamp(32px, 5vw, 42px)/1.05 "Cormorant Garamond", serif; }
.market-hero > div > p:last-child, .market-muted { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.market-safety, .market-note { flex: 0 0 auto; margin: 0; padding: 7px 11px; border: 1px solid var(--line); color: var(--gold-hover); font-size: 10px; }
.market-message { min-height: 0; margin: 0; color: var(--muted); font-size: 12px; }
.market-message:not(:empty) { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line); background: var(--panel-solid); }
.market-message.is-error { border-color: rgba(226, 155, 142, .6); color: #e29b8e; }
.market-tabs { display: flex; align-items: stretch; gap: 8px; border-bottom: 1px solid var(--line); }
.market-tab, .market-switch { position: relative; min-width: 0; min-height: 44px; padding: 9px 10px; border: 0; border-bottom: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font: 600 10px/1.3 "Cinzel", serif; }
.market-tab.is-active, .market-switch.is-active { border-bottom-color: var(--gold-hover); color: var(--gold-hover); }
.market-badge { display: inline-grid; min-width: 18px; height: 18px; place-items: center; margin-left: 4px; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold-hover); font: 600 10px/1 Inter, sans-serif; }
.market-section { min-width: 0; padding-top: 20px; }
.market-section[hidden], .market-list[hidden], .market-panel[hidden], [hidden] { display: none !important; }
.market-layout { display: grid; grid-template-columns: minmax(190px, 220px) minmax(0, 1fr); align-items: start; gap: 16px; }
.market-filters, .market-panel, .market-card { min-width: 0; border: 1px solid var(--line); background: var(--panel-solid); box-shadow: inset 0 1px rgba(241, 231, 216, .025); }
.market-filters { position: sticky; top: 12px; padding: 16px; }
.market-filters h2, .market-panel h2, .market-heading h2, .market-dialog h2 { margin: 0; color: var(--ink); font: 500 23px/1.1 "Cormorant Garamond", serif; }
.market-content { display: grid; min-width: 0; gap: 14px; }
.market-heading { margin-bottom: 12px; }
.market-field { display: grid; min-width: 0; gap: 6px; margin: 0 0 13px; color: var(--muted); font-size: 11px; }
.market-field input, .market-field select { width: 100%; min-width: 0; min-height: 37px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 1px; background: #080e16; color: var(--ink); font: 12px Inter, sans-serif; }
.market-field input:focus-visible, .market-field select:focus-visible, .market-button:focus-visible, .market-tab:focus-visible, .market-switch:focus-visible { outline: 2px solid var(--gold-hover); outline-offset: 2px; }
.market-categories { display: flex; flex-wrap: wrap; gap: 6px; margin: -7px 0 14px; }
.market-chip { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; }
.market-chip:hover, .market-chip.is-active { border-color: var(--gold); color: var(--gold-hover); }
.market-chip:focus-visible { outline: 2px solid var(--gold-hover); outline-offset: 2px; }
.market-button { min-height: 36px; padding: 0 13px; border: 1px solid rgba(185, 167, 127, .54); border-radius: 1px; background: rgba(8, 14, 22, .92); color: var(--ink); cursor: pointer; font-size: 11px; }
.market-button:hover:not(:disabled) { border-color: var(--gold-hover); background: rgba(185, 167, 127, .1); }
.market-button:disabled { cursor: not-allowed; opacity: .5; }
.market-button--primary { border-color: var(--gold); color: var(--gold-hover); font-weight: 600; }
.market-button--quiet { justify-self: center; color: var(--muted); }
.market-list { display: grid; min-width: 0; gap: 10px; }
.market-card { display: grid; min-width: 0; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 16px; }
.market-card > .market-card__main:first-child { grid-column: 1 / 3; }
.market-card__art { display: grid; width: 52px; height: 58px; place-items: center; border: 1px solid var(--line); background: rgba(185, 167, 127, .1); color: var(--gold-hover); font: 25px/1 "Cormorant Garamond", serif; }
.market-card__art--piece { background: rgba(134, 169, 213, .1); color: var(--blue); }
.market-card__art--retainer { background: rgba(185, 167, 127, .14); }
.market-card__image { width: 100%; height: 100%; object-fit: cover; }
.market-card__main { min-width: 0; }
.market-card__title { margin: 0; color: var(--ink); font: 500 21px/1.12 "Cormorant Garamond", serif; overflow-wrap: anywhere; }
.market-type, .market-status { display: inline-block; margin-left: 7px; padding: 3px 6px; border: 1px solid var(--line); color: var(--gold); font: 600 8px/1.3 "Cinzel", serif; vertical-align: middle; }
.market-card__desc, .market-card__meta { margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; }
.market-card__slot { margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.market-card__price { min-width: 118px; text-align: right; }
.market-card__price strong { display: block; color: var(--gold-hover); font-size: 14px; font-variant-numeric: tabular-nums; }
.market-card__price small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.market-card__price .market-button { margin-top: 9px; }
.market-panel { padding: 16px; }
.market-inventory { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); gap: 8px; margin-top: 12px; }
.market-inventory__item { position: relative; display: flex; min-width: 0; aspect-ratio: 1; flex-direction: column; justify-content: flex-end; overflow: hidden; padding: 10px; border: 1px solid rgba(185, 167, 127, .42); border-radius: 0; background: #080e16; background-image: var(--market-inventory-image); background-position: center; background-size: cover; color: var(--ink); text-align: left; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.market-inventory__item::before { position: absolute; inset: 0; z-index: 0; background: linear-gradient(0deg, rgba(8, 14, 22, .98) 0%, rgba(8, 14, 22, .78) 42%, rgba(8, 14, 22, .15) 100%); content: ""; }
.market-inventory__item:hover, .market-inventory__item.is-selected { border-color: var(--gold-hover); box-shadow: 0 0 16px rgba(185, 167, 127, .14); }
.market-inventory__item:focus-visible { outline: 2px solid var(--gold-hover); outline-offset: 2px; }
.market-inventory__item > span { position: relative; z-index: 1; }
.market-inventory__item:disabled { opacity: .45; }
.market-inventory__item strong, .market-inventory__item small { display: block; overflow: hidden; overflow-wrap: anywhere; text-overflow: ellipsis; }
.market-inventory__item small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.market-gift-selection { display: grid; gap: 6px; margin-top: 12px; }
.market-gift-selection__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 12px; }
.market-gift-selection__row .market-field { width: min(120px, 38%); margin: 0; }
.market-gift-selection__row .market-field input { min-height: 32px; }
.market-gift-confirm { display: grid; gap: 7px; margin-top: 12px; }
.market-gift-confirm__line { margin: 0; padding: 8px 10px; border-left: 2px solid var(--gold); background: rgba(185, 167, 127, .07); color: var(--ink); font-size: 11px; line-height: 1.5; }
.market-form-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.market-preview, .market-note { margin: 0; padding: 11px 12px; border: 1px solid var(--line); background: rgba(8, 14, 22, .7); color: var(--muted); font-size: 11px; line-height: 1.55; }
.market-preview { white-space: pre-line; }
.market-preview strong { color: var(--gold-hover); }
.market-panel > .market-button { display: block; margin: 13px 0 0 auto; }
.market-switches { display: flex; gap: 4px; margin: 12px 0; border-bottom: 1px solid var(--line); }
.market-switch { min-height: 37px; }
.market-offer-form { margin-top: 16px; }
.market-warning { color: #e29b8e; font-size: 11px; }
.market-dialog { width: min(440px, calc(100vw - 32px)); max-width: none; padding: 22px; border: 1px solid var(--line); background: #080e16; color: var(--ink); }
.market-dialog::backdrop { background: rgba(0, 0, 0, .72); }
.market-close { float: right; border: 0; background: transparent; color: var(--muted); font-size: 24px; cursor: pointer; }
.market-dialog .eyebrow { margin-top: 22px; }
.market-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.market-empty { padding: 22px 14px; border: 1px dashed var(--line); color: var(--muted); font-size: 11px; text-align: center; }
.market-footnote { margin: 24px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--dim); font-size: 10px; line-height: 1.55; }
@media (max-width: 640px) {
  .market-shell { width: calc(100% - 32px); padding-top: 20px; }
  .market-hero { align-items: flex-start; flex-direction: column; gap: 10px; }
  .market-tabs { gap: 2px; overflow-x: auto; }
  .market-tab { padding-right: 3px; padding-left: 3px; font-size: 9px; }
  .market-layout { grid-template-columns: minmax(0, 1fr); }
  .market-inventory { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-filters { position: static; }
  .market-card { grid-template-columns: 42px minmax(0, 1fr); gap: 10px; padding: 12px; }
  .market-card > .market-card__main:first-child ~ .market-status { grid-column: 1 / -1; justify-self: start; }
  .market-card__art { width: 42px; height: 48px; font-size: 21px; }
  .market-card__price { grid-column: 1 / -1; }
  .market-card__price { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; text-align: left; }
  .market-card__price strong, .market-card__price small { grid-column: 1; }
  .market-card__price .market-button { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
  .market-form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-heading { align-items: flex-start; }
}
