#market {
  width:90vw;height:90svh;max-width:none;max-height:none;margin:auto;padding:0;
  overflow:hidden;border-color:#b49a68;background:linear-gradient(130deg,#24332e,#15221f 72%);
}
#market[open] {display:grid;grid-template-rows:auto auto minmax(0,1fr) auto}
#market::backdrop {background:#071210ad}
.market-titlebar,.market-toolbar,.market-footer {display:flex;align-items:center;gap:12px}
.market-titlebar {
  padding:9px 14px 9px 20px;min-height:48px;
  border-bottom:1px solid var(--edge);background:linear-gradient(90deg,#384335,#192825);
}
#market-title {font:clamp(1.12rem,2.3vw,1.65rem)/1.15 var(--display);margin-right:auto}
#market-title small {margin-left:7px;color:#e6c485;font:600 .66rem/1.1 "Segoe UI",sans-serif;text-transform:uppercase;letter-spacing:.12em}
.market-wallet {display:flex;align-items:center;gap:5px;font-size:.8rem;color:var(--gold);white-space:nowrap}
.market-wallet strong {font-variant-numeric:tabular-nums}
#close-market {width:38px;height:34px;line-height:1;border:1px solid var(--edge);background:#172423;font-size:1.35rem}
#market[data-quit-listings] #close-market {width:auto;padding-inline:10px;font-size:.82rem;white-space:nowrap}
.market-toolbar {display:grid;gap:8px;padding:8px 17px}
.market-modes {display:flex;gap:5px}
.market-modes button {
  min-width:74px;min-height:33px;padding:3px 12px;border:1px solid var(--edge);background:#14211e;font-weight:650;
  white-space:nowrap;
}
.market-modes button[aria-pressed=true] {
  color:#ffe0a2;border-color:#bc9d65;background:#424232;box-shadow:inset 0 -2px #dab16e;
}
#listing-count {
  display:inline-block;min-width:1.4em;margin-left:3px;padding:0 4px;
  color:#f1d49b;background:#15241d;border:1px solid #b59c6b92;border-radius:3px;font-size:.73em;
}
#market-filters {
  display:grid;grid-template-columns:minmax(124px,2fr) repeat(4,minmax(66px,1fr)) minmax(108px,1.17fr) auto;
  gap:5px;padding:6px;border:1px solid var(--edge);background:#14221f;
}
#market-filters input,#market-filters select {
  width:100%;min-width:0;min-height:30px;margin:0;padding:4px 6px;
  border:1px solid var(--edge);border-radius:2px;background:#202d28;color:var(--ink);font-size:.76rem;
}
#market-filters input::placeholder {color:var(--muted)}
#clear-market-filters {font-size:.74rem}
#clear-market-filters:disabled {opacity:.55;cursor:default}
.market-grid {
  display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.05fr);
  gap:12px;padding:0 17px 8px;min-height:0;
}
.market-grid-listings {grid-template-columns:minmax(0,1fr)}
.market-items,.market-detail {padding:14px;overflow:auto;min-width:0;overscroll-behavior:contain}
.market-items h2 {font:1.18rem/1.17 var(--display);color:#f1d8aa;margin-bottom:8px}
.market-items h2:not(:first-child) {margin-top:14px}
.market-items .notice {font-size:.83rem}
.market-items .lot {min-width:0}
.lot-copy {min-width:0;overflow-wrap:anywhere}
.market-items .price {white-space:nowrap}
.market-item-detail {display:flex;align-items:center;gap:10px;margin-bottom:10px}
.market-item-detail h2 {font:clamp(1.05rem,2.5vw,1.65rem)/1.12 var(--display);margin:3px 0;overflow-wrap:anywhere}
.market-item-detail img {width:54px;height:54px;flex:none}
.market-item-detail > div {flex:1;min-width:0}
.market-item-detail small {font-size:.72rem}
.market-item-traits {display:block;color:#e2c996}
.item-details-button {flex:none;white-space:nowrap;color:#efd3a1}
.item-preview-note {margin:10px 0;color:var(--muted);font-size:.83rem}
dialog:has(> :is(#dialog-body,#gear-body) > .item-inspector) {width:640px;max-width:94vw}
.item-inspector-heading {
  display:flex;align-items:center;gap:12px;padding:3px 31px 10px 0;
  border-bottom:1px solid var(--edge);
}
.item-inspector-heading .slot {width:58px;height:58px;flex:none}
.item-inspector-heading h2 {padding:0;margin:2px 0 0;font:clamp(1.2rem,3.4vw,1.9rem)/1.1 var(--display)}
.item-inspector-heading em {color:var(--gold);font-style:normal}
.item-properties {display:grid;grid-template-columns:1fr 1fr;gap:0 12px;margin:7px 0}
.item-properties div {font-size:.8rem}
.item-inspector-section {margin-top:10px}
.item-inspector-section h3 {font:1.12rem/1.1 var(--display);color:#efd3a1;margin:0 0 5px}
.item-inspector-section h3 small {margin-left:5px;font:.67em "Segoe UI",sans-serif}
.item-inspector-section p,.item-inspector-section > small {color:var(--muted);font-size:.83rem;margin-bottom:8px}
.item-stat-table {border-collapse:collapse;width:100%;font-size:.79rem;font-variant-numeric:tabular-nums}
.item-stat-table th,.item-stat-table td {padding:4px 6px;border-bottom:1px solid var(--edge);text-align:right}
.item-stat-table th:first-child {text-align:left}
.item-stat-table thead th {color:#e2c996;background:#162522;font-size:.7rem}
.item-stat-table td:last-child {color:#ffe2a9;font-weight:700}
.socket-list {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:0;margin:0;list-style:none}
.socket-tile {display:flex;align-items:center;gap:7px;min-width:0;padding:5px 7px;border:1px solid var(--edge);background:#162522}
.socket-tile img,.empty-socket {width:33px;height:33px;flex:none}
.empty-socket {display:grid;place-items:center;color:var(--muted);border:1px dashed #947e55}
.socket-tile small,.socket-tile strong {display:block}
.socket-tile strong {font-size:.79rem;line-height:1.18}
.socket-tile small {font-size:.68rem}
.item-bonus,.socket-tile .item-bonus {color:#9cd3b6}
.rune-bonus {display:block;font:1.45rem var(--display)}
.rune-bonus + small {display:block}
.item-fixture-note {margin-top:9px;color:var(--muted);font-size:.69rem}
.trade-fields {display:grid;grid-template-columns:1fr 1fr;gap:8px 12px;padding-block:8px;border-block:1px solid var(--edge)}
.market-field {display:grid;align-content:start;gap:5px;color:var(--muted);font-size:.72rem;min-width:0}
.market-field strong,.market-field input {
  display:flex;align-items:center;min-height:32px;color:var(--ink);
  font:650 .93rem/1.2 "Segoe UI",sans-serif;font-variant-numeric:tabular-nums;
}
.market-field input {width:100%;padding:4px 7px;background:#12201e;border:1px solid #ad9162}
.trade-summary {margin:8px 0}
.trade-summary div:first-child {color:var(--gold);font-weight:700}
.trade-summary div:first-child dt {color:inherit}
.trade-message {font-size:.78rem;color:#ffd0b3;margin:7px 0}
.trade-form .primary {width:100%;min-height:38px}
.trade-form .primary:disabled {opacity:.58;cursor:default}
.own-offer .secondary {margin-left:4px}
#market[data-quit-listings] .own-offer .secondary:disabled {opacity:.5;cursor:default}
.own-offer > small {white-space:nowrap}
.market-footer {
  border-top:1px solid var(--edge);padding:5px 17px;min-height:28px;
  justify-content:space-between;font-size:.68rem;color:var(--muted);
}
.market-footer select {font-size:.68rem}
@media (max-height:550px), (max-width:680px) {
  .market-titlebar {min-height:39px;padding:4px 8px 4px 11px;gap:7px}
  #close-market {width:31px;height:29px}
  .market-toolbar {padding:5px 8px;gap:4px}
  .market-modes button {min-width:49px;min-height:27px;padding:3px 8px;font-size:.79rem}
  #market-filters {gap:3px;padding:4px}
  #market-filters input,#market-filters select,#clear-market-filters {min-height:26px;padding:3px 5px;font-size:.71rem}
  .market-grid {gap:6px;padding:0 8px 5px}
  .market-items,.market-detail {padding:8px}
  .market-items h2 {font-size:1rem;margin-bottom:5px}
  .market-items h2:not(:first-child) {margin-top:7px}
  .market-item-detail {margin-bottom:5px}
  .market-item-detail img {width:39px;height:39px}
  .item-details-button {padding:4px 5px;font-size:.69rem}
  .item-inspector-heading .slot {width:43px;height:43px}
  .trade-fields {padding-block:4px;gap:5px}
  .market-field {gap:3px}
  .market-field strong,.market-field input {min-height:27px}
  .trade-summary {margin:5px 0}
  .trade-form .primary {min-height:32px;font-size:.83rem}
  .market-footer {min-height:23px;padding:3px 8px}
}
@media (max-width:680px) {
  #market-filters {grid-template-columns:repeat(4,minmax(0,1fr))}
  .market-search {grid-column:span 2}
  #market-filters label:has([name="sort"]) {grid-column:4;grid-row:1}
}
@media (max-width:480px) {
  #market-title small {display:none}
  .market-wallet {font-size:.7rem}
  .market-items .lot {gap:4px;padding-inline:4px}
  .market-items .lot-copy strong,.market-items .price {font-size:.78rem}
  .market-items .lot-copy small,.market-items .price small {font-size:.64rem}
  .market-items .slot {width:25px;height:25px}
}

.market-scope select {max-width:120px;min-height:32px;font:inherit;font-size:.8rem;color:var(--ink);background:#152522;border:1px solid var(--edge)}
