.market-screen {
  --market-ink: #1b1520;
  --market-felt: #223137;
  --market-brass: #b78d59;
  --market-art-shade: linear-gradient(90deg, #17121def 0%, #1e1725c9 24%, #21182a26 52%, transparent 69%);
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  background: var(--market-ink);
}
.market-art {
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: clamp(520px, 52vw, 740px);
  background: #332639 url("assets/kraemerstand-pixel.avif") var(--market-art-position, 60% 44%) / cover no-repeat;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .market-art { container-type: size; }
  .market-art::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
      radial-gradient(ellipse 4% 8% at 92.4% 61%, #ffbf426e, transparent),
      radial-gradient(ellipse 1.4% 2.5% at 23.7% 29%, #ffab5750, transparent),
      radial-gradient(ellipse 1.4% 2.5% at 29.8% 46.8%, #ffab5750, transparent),
      radial-gradient(ellipse 1.4% 2.5% at 25.1% 51.2%, #ffab5750, transparent);
    /* Match the artwork's 1672 × 941 cover crop at every viewport size. */
    background-size: max(100%, calc(100cqh * 1672 / 941)) max(100%, calc(100cqw * 941 / 1672));
    background-position: inherit;
    background-repeat: no-repeat;
    mix-blend-mode: screen;
    animation: market-lantern-flicker 2.08s linear infinite;
  }
}
@keyframes market-lantern-flicker {
  0%, 36%, 100% { opacity: .2; }
  17%, 67% { opacity: .6; }
  24%, 77% { opacity: .32; }
  84% { opacity: .46; }
}
.market-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, var(--market-ink) 0%, #1b1520ee 10%, #1b152057 36%, transparent 63%),
    var(--market-art-shade);
}
.market-layout {
  width: min(1160px, 100%);
  margin-inline: auto;
  padding: var(--hud-height) clamp(16px, 4vw, 54px) 40px;
}
.market-heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
  min-height: clamp(290px, 28vw, 390px);
  padding-block: 20px;
}
.market-heading h2 {
  color: #ffebc8; font-size: clamp(38px, 7vw, 86px); letter-spacing: -.065em; line-height: .93;
  text-shadow: 0 3px #261829, 0 5px 24px #130e19;
}
.market-heading p { margin-top: 10px; color: #f0e0cf; text-shadow: 0 1px 8px #100b15; }
.market-wallet {
  display: flex; align-items: center; gap: 11px; flex: none; padding: 9px 13px;
  background: #1c2428; border: 1px solid #8b8061; border-radius: 9px;
  box-shadow: 0 3px #17111a, inset 0 0 0 2px #151b21;
}
.market-wallet > div { display: grid; gap: 2px; line-height: 1.1; }
.market-wallet div > span { color: #ccdfd6; font-size: 12px; }
.market-wallet output { font: 800 25px/1 var(--display); color: #ebf8da; }
.market-mark {
  display: grid; place-items: center; width: 31px; aspect-ratio: 1; flex: none;
  border: 3px double #b5e0be; border-radius: 50%; background: #345d55; color: #e8f6d1; font-size: 16px;
}
.market-chest-note {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  margin-bottom: 18px; padding: 10px 15px; border: 1px solid #77795d; border-radius: 12px;
  background: #233337; color: #d3e1d8; box-shadow: 0 4px #140e18, 0 9px 24px #140d1c70;
}
.market-chest-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.market-stock h3 { margin: 0; font: 800 21px/1.12 var(--display); letter-spacing: -.025em; }
.market-stock { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: stretch; gap: 18px; }
.market-stock > section {
  min-width: 0; border: 1px solid #805e4a; border-radius: 12px;
  background: #2c2028; box-shadow: 0 5px #130d17, 0 13px 24px #130d1866;
}
.market-stock section > header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap;
  padding: 12px 15px; border-bottom: 1px solid #82664e; border-radius: 11px 11px 0 0;
  background: linear-gradient(180deg, #49332e, #36252a); color: #ffe9bd;
}
.market-stock section > header :is(time, p) { color: #e6d8c6; font-size: 12px; }
.market-stock .market-counter { display: grid; grid-template-rows: auto 1fr; background: var(--market-felt); border-color: var(--market-brass); }
.market-stock .market-counter > header {
  background: repeating-linear-gradient(103deg, #e4c6961a 0 28px, #18252622 28px 56px), #374d42;
}
.market-offer { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 7px 14px; padding: 12px 15px; }
.market-offer + .market-offer { border-top: 1px solid #534a40; }
.market-offer h4 { margin: 2px 0 3px; color: #fff2dd; font: 800 20px/1.05 var(--display); overflow-wrap: anywhere; }
.market-item-type { color: var(--rarity); font-size: 12px; font-weight: 750; }
.market-item-set, .market-item-perks { color: #e2d9d4; font-size: 12px; }
.market-item-art { grid-row: span 2; display: grid; place-items: center; background: radial-gradient(ellipse, var(--rarity-wash), transparent 72%); }
.market-buy { justify-self: start; min-height: 35px; }
.market-stock .market-buy[aria-disabled="true"] { color: #d7cccf; background: #282733; border-color: #66616d; box-shadow: none; transform: none; }
.market-counter > div { display: grid; }
.market-counter .market-offer {
  grid-template-columns: minmax(94px, 37%) minmax(0, 1fr); gap: 10px 15px;
  align-content: center; padding: 18px clamp(13px, 2.5vw, 25px);
}
.market-counter .market-item-art { min-height: 124px; }
.market-counter .loot-sprite { width: clamp(91px, 13vw, 153px); height: clamp(91px, 13vw, 153px); }
.market-counter h4 { font-size: clamp(23px, 3vw, 42px); letter-spacing: -.045em; }
.market-counter .market-item-perks { margin-top: 5px; font-size: 13px; }
.market-feedback { display: flex; align-items: center; gap: 9px 12px; flex-wrap: wrap; }
.market-feedback:has(p:not(:empty), button:not([hidden])) { margin-top: 16px; }
.market-feedback p:empty { display: none; }
.market-note { color: #c6d0ca; font-size: 12px; margin-top: 13px; }
@media (max-width: 730px) {
  .market-screen {
    --market-art-position: 86% 45%;
    --market-art-shade: linear-gradient(180deg, transparent 32%, #1c152277 59%, #1b1520ed 81%);
  }
  .market-art { height: clamp(455px, 85vw, 520px); }
  .market-heading { min-height: 320px; justify-content: end; }
  .market-stock { grid-template-columns: 1fr; gap: 13px; }
}
@media (max-width: 490px) {
  body[data-scene="markt"] { min-width: 0; }
  .market-screen { --market-art-position: 92% 45%; }
  .market-heading { gap: 12px; }
  .market-heading p { margin-top: 6px; }
  .market-wallet { padding: 6px 9px; gap: 7px; }
  .market-wallet output { font-size: 19px; }
  .market-mark { width: 26px; }
}
@media (max-width: 360px) {
  .market-counter .market-offer { grid-template-columns: 65px minmax(0, 1fr); gap: 8px 10px; }
  .market-counter .market-item-art { min-height: 84px; }
  .market-counter .loot-sprite { width: 67px; height: 67px; }
}


.exchange, .exchange-dialog {
  --exchange-bg: #121519;
  --exchange-panel: #191d22;
  --exchange-raised: #22272d;
  --exchange-line: #343a41;
  --exchange-text: #f0ede6;
  --exchange-muted: #b1b8bf;
  --exchange-accent: #e5c688;
  color: var(--exchange-text);
}

.exchange {
  --exchange-bottom: 0px;
  height: calc(100svh - var(--exchange-bottom));
  min-height: 0;
  padding: var(--hud-height) 0 0;
  background: var(--exchange-bg);
}
html:has(#markt:not([hidden]) #zentralmarkt:not([hidden])) { scrollbar-gutter: auto; }
body:has(#markt:not([hidden]) #zentralmarkt:not([hidden])) { overflow: hidden; }
.exchange-ledger {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--exchange-bg);
}
.exchange-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  flex: none;
  align-items: center;
  gap: 0 12px;
  padding-inline: clamp(20px, 2.5vw, 40px);
  border-bottom: 1px solid var(--exchange-line);
  background: #101215;
}
.exchange-toolbar h2 { margin: 0; font: 800 clamp(20px, 2vw, 28px)/1.1 var(--display); letter-spacing: -.035em; }
.exchange-toolbar nav { display: flex; align-self: stretch; gap: 12px; }
.exchange-toolbar nav button,
.exchange-categories button {
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--exchange-muted);
  font: 700 14px var(--body);
}
.exchange-toolbar nav button { min-width: 110px; min-height: 64px; }
.exchange-toolbar nav button[aria-pressed="true"] {
  box-shadow: inset 0 -3px var(--exchange-accent);
  color: var(--exchange-accent);
  background: linear-gradient(0deg, #e5c6880d, transparent 65%);
}
.exchange-wallet {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 5px;
  padding-block: 7px;
  color: var(--exchange-muted);
  font-size: 13px;
  justify-content: flex-end;
}
.exchange-wallet output {
  color: var(--exchange-accent);
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.exchange-wallet small { color: var(--exchange-muted); }
.exchange-wallet small:empty { display: none; }
.exchange-wallet small:not(:empty)::before { content: "· "; }

#exchange-content { flex: 1; min-height: 0; overflow: hidden; }
#exchange-book {
  display: grid;
  grid-template-columns: clamp(190px, 17vw, 260px) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}
.exchange-categories {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 14px;
  overflow-y: auto;
  border-right: 1px solid var(--exchange-line);
  background: #14171b;
}
.exchange-categories button { min-height: 48px; border-radius: 0; border-left: 2px solid transparent; text-align: left; }
.exchange-categories button[aria-pressed="true"] {
  border-left-color: var(--exchange-accent);
  background: linear-gradient(90deg, #e5c68816, transparent);
  color: var(--exchange-accent);
}
.exchange-categories button:hover, .exchange-toolbar nav button:hover { color: var(--exchange-text); }
.exchange-catalog { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.exchange-results { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-color: #555b63 #14171b; }
.exchange-results:focus-visible { outline: 2px solid var(--exchange-accent); outline-offset: -2px; }
.exchange-search {
  display: flex;
  gap: 8px;
  flex: none;
  padding: 18px 24px;
  border-bottom: 1px solid var(--exchange-line);
}
.exchange-search input { flex: 1; }
.exchange :is(input, select),
.exchange-dialog :is(input, select) {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid #4c535c;
  border-radius: 4px;
  background: var(--exchange-bg);
  color: var(--exchange-text);
  font: 500 14px var(--body);
  color-scheme: dark;
}
.exchange input::placeholder { color: var(--exchange-muted); }
.exchange :is(button, input, select, summary):focus-visible,
.exchange-dialog :is(button, input, select, summary):focus-visible {
  outline: 2px solid var(--exchange-accent);
  outline-offset: -2px;
}
.exchange .party-button,
.exchange-dialog .party-button {
  min-height: 34px;
  padding-inline: 10px;
  border: 1px solid #4c535c;
  border-radius: 4px;
  box-shadow: none;
  background: var(--exchange-raised);
  color: var(--exchange-text);
}
.exchange .party-button:hover:not(:disabled),
.exchange-dialog .party-button:hover:not(:disabled) { background: #333941; }
.exchange .party-button.primary,
.exchange-dialog .party-button.primary {
  border-color: var(--exchange-accent);
  background: var(--exchange-accent);
  color: #231c12;
}
.exchange .party-button.primary:hover:not(:disabled),
.exchange-dialog .party-button.primary:hover:not(:disabled) { background: #f3d8a6; }

.exchange-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.exchange-table th, .exchange-table td { padding: 10px 24px; border-bottom: 1px solid #ffffff12; }
.exchange-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-block: 12px;
  background: var(--exchange-raised);
  color: var(--exchange-muted);
  text-align: left;
  font-weight: 600;
}
.exchange-table td:first-child { width: 100%; }
.exchange-table :is(th, td):nth-child(2),
.exchange-table :is(th, td):nth-child(3) {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.exchange-table tr:hover td { background: #1e2328; }
.exchange-stock { color: var(--exchange-muted); }
.exchange-price { font-weight: 700; }
.exchange-action { text-align: right; }
.exchange-action .party-button { white-space: nowrap; }
.exchange-ware { display: flex; align-items: center; gap: 9px; }
.exchange-ware > div { min-width: 0; overflow-wrap: anywhere; }
.exchange-ware :is(.pixel, .loot-sprite) {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}
.exchange-ware .pixel { padding: 4px; }
.exchange-ware strong { font-weight: 700; }
.exchange-ware small { display: block; color: var(--exchange-muted); font-size: 12px; }
.exchange-more { text-align: right; }
.exchange-more:has(button:not([hidden])), .exchange-empty { padding: 10px 14px; }
.exchange-empty { color: var(--exchange-muted); }

.exchange-body { height: 100%; overflow: auto; padding: 28px clamp(20px, 3vw, 48px); }
.exchange-form { display: grid; gap: 10px; }
.exchange-sell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 32%);
  height: 100%;
  min-height: 0;
}
.exchange-inventory { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.exchange-inventory-heading, .exchange-listing-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 96px; padding: 24px 28px;
}
.exchange-inventory-heading h3, .exchange-listing-heading h3 { margin: 0; font: 800 24px/1.15 var(--display); letter-spacing: -.035em; }
.exchange-inventory-heading p, .exchange-listing-heading p { margin-top: 6px; color: var(--exchange-muted); font-size: 13px; }
.exchange-inventory-heading output { flex: none; color: var(--exchange-muted); font-size: 13px; }
.exchange-inventory-tools { display: grid; gap: 14px; padding: 0 28px; }
.exchange-inventory-tools input { min-height: 42px; }
.exchange-inventory-filters { display: flex; gap: 6px; overflow-x: auto; }
.exchange-inventory-filters button {
  flex: none; min-height: 40px; padding: 8px 13px; border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--exchange-muted); font-size: 13px; font-weight: 700;
}
.exchange-inventory-filters button[aria-pressed="true"] { border-bottom-color: var(--exchange-accent); color: var(--exchange-accent); }
.exchange-inventory-columns { display: flex; justify-content: space-between; padding: 11px 28px; background: var(--exchange-raised); color: var(--exchange-muted); font-size: 12px; }
.exchange-sell-stock { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #555b63 #14171b; }
.exchange-stock-choice {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; min-height: 88px; padding: 12px 28px 12px 26px;
  border: 0; border-left: 2px solid transparent; border-bottom: 1px solid #ffffff12; border-radius: 0;
  background: transparent; color: var(--exchange-text); text-align: left;
}
.exchange-stock-choice[aria-pressed="true"] { border-left-color: var(--exchange-accent); background: linear-gradient(90deg, #e5c68816, #e5c68804); }
.exchange-stock-choice:hover:not(:disabled) { background-color: #ffffff05; }
.exchange-stock-choice[data-empty="true"] { color: var(--exchange-muted); }
.exchange-stock-choice[data-empty="true"] .exchange-ware > :is(.pixel, .loot-sprite) { opacity: .45; }
.exchange-stock-choice .exchange-ware { min-width: 0; gap: 16px; }
.exchange-stock-choice .exchange-ware strong { font-size: 16px; }
.exchange-stock-choice .exchange-ware small { margin-top: 4px; font-size: 13px; }
.exchange-stock-choice .exchange-ware :is(.pixel, .loot-sprite) { width: 54px; height: 54px; flex-basis: 54px; }
.exchange-stock-amount { display: grid; gap: 2px; flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.exchange-stock-amount strong { font-size: 18px; }
.exchange-stock-amount small { color: var(--exchange-muted); font-size: 12px; }
.exchange-stock-choice[aria-pressed="true"] .exchange-stock-amount strong { color: var(--exchange-accent); }
.exchange-inventory-note { flex: none; padding: 16px 28px; border-top: 1px solid var(--exchange-line); color: var(--exchange-muted); font-size: 12px; }
.exchange-sell-empty { flex: 1; padding: 40px 28px; color: var(--exchange-muted); text-align: center; }
.exchange-listing { min-width: 0; min-height: 0; overflow-y: auto; border-left: 1px solid var(--exchange-line); background: var(--exchange-panel); scrollbar-color: #555b63 #14171b; }
.exchange-listing-heading { border-bottom: 1px solid var(--exchange-line); }
#exchange-sell-change { display: none; }
.exchange-sell-form { gap: 16px; padding: 24px 28px 28px; }
.exchange-sell-selection .exchange-ware { gap: 16px; }
.exchange-sell-selection .exchange-ware :is(.pixel, .loot-sprite) { width: 72px; height: 72px; flex-basis: 72px; }
.exchange-sell-selection .exchange-ware strong { font: 800 22px/1.15 var(--display); letter-spacing: -.025em; }
.exchange-sell-selection .exchange-ware small { margin-top: 6px; font-size: 13px; }
.exchange-sell-form .exchange-details { margin-top: -6px; line-height: 1.6; }
.exchange-sell-controls { display: grid; min-width: 0; gap: 18px; margin: 0; padding: 20px 0; border: 0; border-top: 1px solid var(--exchange-line); border-bottom: 1px solid var(--exchange-line); }
.exchange-sell-controls .exchange-fields:has(> [hidden]):not(:has(> :not([hidden]))) { display: none; }
.exchange-quantity-field { display: grid; gap: 7px; }
.exchange-quantity-input { display: flex; align-items: stretch; }
.exchange-quantity-input input { flex: 1; border-radius: 4px 0 0 4px; }
.exchange-quantity-input button { flex: none; padding: 8px 14px; border: 1px solid #4c535c; border-left: 0; border-radius: 0 4px 4px 0; background: var(--exchange-raised); color: var(--exchange-text); font-size: 12px; font-weight: 700; }
.exchange-sell-controls :is(input, select) { min-height: 44px; font-size: 16px; }
.exchange-price-input { position: relative; display: block; }
.exchange-price-input input { padding-right: 65px; }
.exchange-price-input > span { position: absolute; inset: 0 14px 0 auto; display: flex; align-items: center; color: var(--exchange-muted); font-size: 13px; font-weight: 500; pointer-events: none; }
.exchange-price-reference h4 { margin: 0 0 12px; font-size: 13px; font-weight: 700; }
.exchange-price-reference dl, .exchange-sale-summary dl { display: grid; gap: 11px; margin: 0; font-size: 13px; }
.exchange-price-reference dl > div, .exchange-sale-summary dl > div { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.exchange-price-reference dt, .exchange-sale-summary dt { color: var(--exchange-muted); }
.exchange-price-reference dd, .exchange-sale-summary dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.exchange-price-reference button { padding: 0; border: 0; background: transparent; color: var(--exchange-accent); text-decoration: underline dotted; text-underline-offset: 4px; font: 600 13px var(--body); }
.exchange-price-reference button:disabled { color: var(--exchange-muted); text-decoration: none; opacity: 1; cursor: default; }
.exchange-price-reference p, .exchange-sale-summary p, .exchange-listing-note { margin-top: 12px; color: var(--exchange-muted); font-size: 12px; line-height: 1.6; }
.exchange-sale-summary { margin-top: 4px; padding-top: 20px; border-top: 1px solid var(--exchange-line); }
.exchange-sale-summary .exchange-net-proceeds { align-items: center; margin-top: 3px; padding-top: 16px; border-top: 1px solid var(--exchange-line); }
.exchange-net-proceeds dt { color: var(--exchange-text); font-weight: 700; }
.exchange-net-proceeds output { color: var(--exchange-accent); font: 800 28px/1.1 var(--display); overflow-wrap: anywhere; }
.exchange-sell-hint { color: var(--exchange-muted); font-size: 12px; line-height: 1.5; }
.exchange-sell-hint:empty { display: none; }
.exchange-sell-form #exchange-sell-submit { width: 100%; min-height: 46px; font-size: 14px; }
.exchange-sell-form #exchange-sell-submit:disabled { background: #33383e; color: #aeb4bb; border-color: #4c535c; opacity: 1; }
.exchange-sell-form .exchange-listing-note { margin-top: -5px; }
@media (max-width: 900px) {
  .exchange-sell { display: block; overflow-y: auto; }
  .exchange-inventory { min-height: 360px; }
  .exchange-sell-stock { flex: none; max-height: 350px; }
  .exchange-listing { overflow: visible; border-left: 0; border-top: 1px solid var(--exchange-line); }
  #exchange-sell-change { display: block; flex: none; }
  .exchange-sell-selection .exchange-ware { align-items: center; }
}
@media (max-width: 630px) {
  .exchange-inventory-heading, .exchange-listing-heading { min-height: 0; padding: 20px 16px; }
  .exchange-inventory-heading h3, .exchange-listing-heading h3 { font-size: 22px; }
  .exchange-inventory-heading { align-items: flex-start; }
  .exchange-inventory-heading output { padding-top: 4px; font-size: 12px; }
  .exchange-inventory-tools { padding-inline: 16px; }
  .exchange-inventory-columns { padding-inline: 16px; }
  .exchange-stock-choice { min-height: 78px; padding: 10px 16px 10px 14px; gap: 10px; }
  .exchange-stock-choice .exchange-ware { gap: 10px; }
  .exchange-stock-choice .exchange-ware strong { font-size: 14px; }
  .exchange-stock-choice .exchange-ware small { font-size: 12px; }
  .exchange-stock-choice .exchange-ware :is(.pixel, .loot-sprite) { width: 40px; height: 40px; flex-basis: 40px; }
  .exchange-stock-amount strong { font-size: 16px; }
  .exchange-inventory-note { padding: 12px 16px; }
  .exchange-sell-form { padding: 20px 16px; }
  .exchange-sell-form .exchange-fields label { flex-basis: 110px; }
}
.exchange-fields { display: flex; flex-wrap: wrap; gap: 10px; }
.exchange-fields label { flex: 1 1 130px; }
.exchange-form label {
  display: grid;
  align-content: end;
  gap: 4px;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
}
.exchange-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.exchange-preview { font-size: 14px; font-weight: 700; }
.exchange-body h3 { margin: 0 0 8px; font-size: 15px; }
.exchange-details, .exchange-muted, .exchange-order p, .exchange-progress p {
  color: var(--exchange-muted);
  font-size: 13px;
}
.exchange-orders h3:not(:first-child) { margin-top: 18px; }
.exchange-list { margin: 0; padding: 0; list-style: none; }
.exchange-order {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding-block: 8px;
  border-bottom: 1px solid var(--exchange-line);
  font-size: 14px;
}
.exchange-progress { flex: none; max-height: 30%; overflow: auto; padding: 14px 24px; border-top: 1px solid var(--exchange-line); background: #101215; font-size: 13px; }
.exchange-progress summary, .exchange-bid summary { color: var(--exchange-muted); cursor: pointer; width: fit-content; }
.exchange-progress p { margin-top: 6px; }
.exchange-status, #exchange-dialog-status { padding: 8px 14px; color: var(--exchange-accent); font-size: 14px; }
.exchange-status:empty, #exchange-dialog-status:empty { display: none; }

.exchange-dialog {
  width: min(430px, calc(100% - 24px));
  max-height: calc(100svh - 24px);
  padding: 0;
  overflow: auto;
  border: 1px solid #555e67;
  border-radius: 6px;
  background: var(--exchange-panel);
  font-size: 14px;
}
.exchange-dialog::backdrop { background: #101214bd; }
.exchange-dialog header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--exchange-line);
}
.exchange-dialog header h2 { margin: 0; font: 800 19px/1.2 var(--display); }
#exchange-dialog-body { display: grid; gap: 12px; padding: 14px; }
#exchange-dialog-body > .party-button { justify-self: start; }
.exchange-bid { padding-top: 8px; border-top: 1px solid var(--exchange-line); }
.exchange-bid .exchange-form { margin-top: 10px; }

@media (max-width: 1000px) {
  .exchange-toolbar { grid-template-columns: 1fr auto; padding-inline: 20px; }
  .exchange-toolbar nav { grid-row: 2; grid-column: 1 / -1; justify-content: center; }
  .exchange-toolbar nav button { min-height: 46px; }
  .exchange-toolbar h2 { padding-block: 14px; }
}
@media (max-width: 820px) {
  .exchange { --exchange-bottom: calc(62px + env(safe-area-inset-bottom)); }
}
@media (max-width: 630px) {
  .exchange-toolbar { padding-inline: 12px; }
  .exchange-toolbar nav { gap: 0; justify-content: stretch; }
  .exchange-toolbar nav button { min-width: 0; flex: 1; }
  .exchange-wallet output { font-size: 18px; }
  #exchange-book { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .exchange-categories {
    flex-direction: row;
    gap: 0;
    overflow-x: auto;
    padding: 4px 6px;
    border-right: 0;
    border-bottom: 1px solid var(--exchange-line);
  }
  .exchange-categories button { flex: none; min-height: 40px; padding-inline: 10px; border-left: 0; border-bottom: 2px solid transparent; font-size: 13px; white-space: nowrap; }
  .exchange-categories button[aria-pressed="true"] { border-bottom-color: var(--exchange-accent); background: #e5c6880d; }
  .exchange-table .exchange-stock { display: none; }
  .exchange-table th, .exchange-table td { padding: 8px 7px; }
  .exchange-table th { white-space: normal !important; }
  .exchange-search { padding: 10px 8px; }
  .exchange :is(input, select) { font-size: 16px; }
  .exchange-action .party-button { padding-inline: 6px; font-size: 12px; }
  .exchange-progress { padding: 12px; }
  .exchange-ware { gap: 5px; }
  .exchange-ware :is(.pixel, .loot-sprite) { width: 26px; height: 26px; flex-basis: 26px; }
}

@media (max-width: 370px) {
  .exchange-toolbar { padding-inline: 6px; }
  .exchange-toolbar nav button { padding-inline: 7px; }
  .exchange-body { padding-inline: 10px; }
  .exchange-table th, .exchange-table td { padding-inline: 5px; }
}
