/* #markettest v1.3 — isolated prototype. Existing #game-market is untouched. */

body.markettest-mode #hero,
body.markettest-mode #subgroupTabs,
body.markettest-mode .content-stage > .toolbar {
  display: none !important;
}

#markettestView {
  --mt-ink: #2c2118;
  --mt-muted: #75624d;
  --mt-blood: #812b25;
  --mt-blood-soft: rgba(129, 43, 37, 0.08);
  --mt-gold: #997344;
  --mt-line: rgba(88, 66, 42, 0.2);
  --mt-line-strong: rgba(88, 66, 42, 0.36);
  --mt-enchant: #7b5622;
  --mt-enchant-bg: rgba(205, 139, 37, 0.08);
  min-width: 0;
  color: var(--mt-ink);
}

#markettestView.active { display: block; }

.markettest-page {
  box-sizing: border-box;
  width: 100%;
  max-width: 1680px;
  min-width: 0;
  margin: 0 auto 54px;
}

.markettest-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 44px;
  margin-bottom: 10px;
  padding: 8px 12px;
  border: 1px solid var(--mt-line-strong);
  background: linear-gradient(180deg, rgba(248, 239, 217, 0.78), rgba(231, 211, 172, 0.62));
}

.markettest-heading-title {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 10px;
}

.markettest-heading-title strong {
  color: var(--mt-blood);
  font-family: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-size: 1.03rem;
  font-weight: 800;
  white-space: nowrap;
}

.markettest-heading-title span,
.markettest-freshness {
  color: var(--mt-muted);
  font-size: 0.7rem;
}

.markettest-freshness {
  min-width: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Top row: only market/auction, search and refresh. */
.markettest-controls {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) auto;
  gap: 6px;
  align-items: end;
  min-width: 0;
  margin-bottom: 6px;
}

.markettest-tabs {
  display: flex;
  min-height: 32px;
  gap: 7px;
  border: 0;
  background: transparent;
}

.markettest-tabs button,
.markettest-categories button,
.markettest-refresh,
.markettest-reset {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--mt-muted);
  font: 700 0.77rem "EB Garamond", Georgia, serif;
  cursor: pointer;
}

.markettest-tabs button {
  min-width: 74px;
  padding: 5px 9px;
  border: 1px solid var(--mt-line-strong);
  background: rgba(255, 251, 236, 0.48);
}

.markettest-tabs button.active {
  background: var(--mt-blood);
  color: #fff6e6;
}

.markettest-search,
.markettest-select {
  display: grid;
  min-width: 0;
  gap: 2px;
  color: var(--mt-muted);
  font-size: 0.59rem;
  font-weight: 700;
  text-transform: uppercase;
}

.markettest-search input,
.markettest-select select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 32px;
  border: 1px solid var(--mt-line-strong);
  border-radius: 0;
  padding: 4px 7px;
  background: rgba(255, 252, 239, 0.72);
  color: var(--mt-ink);
  font: 650 0.78rem "EB Garamond", Georgia, serif;
}

.markettest-refresh,
.markettest-reset {
  min-height: 32px;
  border: 1px solid rgba(129, 43, 37, 0.3);
  padding: 5px 9px;
  background: rgba(129, 43, 37, 0.05);
  color: var(--mt-blood);
  white-space: nowrap;
}

.markettest-reset {
  align-self: end;
  border-color: var(--mt-line-strong);
  background: rgba(255, 251, 236, 0.46);
  color: var(--mt-muted);
}

.markettest-options-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px 10px;
  margin: 0 0 7px;
}

.markettest-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
}

.markettest-categories button {
  border: 1px solid var(--mt-line);
  padding: 4px 8px;
  background: rgba(255, 251, 236, 0.4);
}

.markettest-categories button.active {
  border-color: rgba(129, 43, 37, 0.4);
  background: var(--mt-blood-soft);
  color: var(--mt-blood);
}

/* Category buttons and filters intentionally share one desktop row. */
.markettest-filterbar {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 5px;
  align-items: end;
  margin: 0;
}

.markettest-filterbar .markettest-tier-select { width: 66px; }
.markettest-filterbar .markettest-set-select { width: 110px; }
.markettest-filterbar .markettest-sort-select { width: 145px; }
.markettest-filterbar .markettest-count-select { width: 78px; }

.markettest-status {
  min-height: 19px;
  margin: 0 0 4px;
  color: var(--mt-muted);
  font-size: 0.72rem;
}

.markettest-list-shell {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--mt-line-strong);
  background: rgba(240, 223, 188, 0.62);
}

.markettest-table-head,
.markettest-row-main {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 68px 116px 108px 54px;
  min-width: 0;
  align-items: stretch;
}

.markettest-list-shell.is-auction .markettest-table-head,
.markettest-list-shell.is-auction .markettest-row-main {
  grid-template-columns: minmax(340px, 1fr) 64px 108px 64px 100px 50px;
}

.markettest-table-head {
  min-height: 42px;
  border-bottom: 2px solid rgba(129, 43, 37, 0.18);
  background: rgba(248, 239, 217, 0.76);
  color: var(--mt-blood);
  font-family: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.markettest-table-head > span {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  text-align: center;
}

.markettest-table-head > span:first-child {
  justify-content: flex-start;
  text-align: left;
}

.markettest-bids-head { display: none !important; }
.markettest-list-shell.is-auction .markettest-bids-head { display: flex !important; }

.markettest-row {
  min-width: 0;
  border-bottom: 1px solid var(--mt-line);
  background: rgba(255, 250, 234, 0.43);
}

.markettest-row:last-child { border-bottom: 0; }

.markettest-row.has-multiple-offers .markettest-row-main { cursor: pointer; }

.markettest-row.has-multiple-offers .markettest-row-main:hover {
  background: rgba(129, 43, 37, 0.035);
}

.markettest-row.has-multiple-offers:focus-visible {
  outline: 2px solid rgba(129, 43, 37, 0.45);
  outline-offset: -2px;
}

.markettest-row-main { min-height: 96px; }
.markettest-row-main > * { min-width: 0; }

.markettest-item {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
  padding: 9px 10px;
}

.markettest-item-visual {
  display: grid;
  width: 74px;
  justify-items: center;
  gap: 4px;
}

.markettest-art {
  position: relative;
  display: grid;
  width: 70px;
  height: 70px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--mt-line-strong);
  border-radius: 10px;
  background: var(--quality-bg, rgba(153, 115, 68, 0.16));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.markettest-art[data-markettest-hover] { cursor: help; }

.markettest-art img {
  width: 65px;
  height: 65px;
  border-radius: 8px;
  object-fit: contain;
}

/* Exactly three normal-sized rune icons fit on one line. */
.markettest-item-visual .game-market-rune-icons {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 2px;
  width: 70px;
  max-width: 70px;
}

.markettest-item-visual .game-market-rune-icon {
  display: grid;
  box-sizing: border-box;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(88, 66, 42, 0.32);
  border-radius: 3px;
  background: var(--quality-bg, rgba(255, 251, 236, 0.7));
}

.markettest-item-visual .game-market-rune-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.markettest-copy { min-width: 0; }

.markettest-item-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 7px;
  margin-bottom: 2px;
}

.markettest-item-title {
  color: var(--mt-ink);
  font-family: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-size: 0.96rem;
  font-weight: 800;
  line-height: 1.05;
}

.markettest-item-meta {
  color: var(--mt-muted);
  font-size: 0.69rem;
  font-weight: 650;
}

.markettest-offer-badge {
  display: inline-block;
  border: 1px solid rgba(129, 43, 37, 0.25);
  padding: 1px 5px;
  background: rgba(129, 43, 37, 0.05);
  color: var(--mt-blood);
  font-size: 0.58rem;
  font-weight: 750;
}

.markettest-summary {
  display: grid;
  gap: 3px;
  margin-top: 4px;
}

.markettest-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 255px));
  justify-content: start;
  gap: 3px 22px;
}

.markettest-stat {
  display: inline-flex;
  min-width: 0;
  max-width: 255px;
  align-items: baseline;
  justify-content: flex-start;
  gap: 5px;
  border-bottom: 1px dotted rgba(88, 66, 42, 0.15);
  padding: 1px 0 2px;
  font-size: 0.82rem;
  line-height: 1.2;
}

.markettest-stat span {
  min-width: 0;
  color: var(--mt-muted);
  overflow-wrap: anywhere;
}

.markettest-stat strong {
  flex: 0 0 auto;
  color: var(--mt-blood);
  font-weight: 800;
  white-space: nowrap;
}

.markettest-enchants {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 310px));
  justify-content: start;
  gap: 3px 22px;
  margin-top: 2px;
  padding: 3px 5px;
  border-left: 2px solid rgba(205, 139, 37, 0.72);
  background: var(--mt-enchant-bg);
}

.markettest-enchant {
  display: flex;
  min-width: 0;
  gap: 4px;
  align-items: baseline;
  font-size: 0.71rem;
  line-height: 1.2;
}

.markettest-enchant::before {
  content: "✦";
  flex: 0 0 auto;
  color: var(--mt-enchant);
}

.markettest-enchant span {
  min-width: 0;
  color: #695734;
  overflow-wrap: anywhere;
}

.markettest-enchant strong {
  flex: 0 0 auto;
  color: var(--mt-enchant);
  white-space: nowrap;
}

.markettest-effect {
  padding: 3px 5px;
  border-left: 2px solid rgba(129, 43, 37, 0.35);
  background: rgba(255, 252, 239, 0.46);
  color: var(--mt-ink);
  font-size: 0.71rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.markettest-effect b {
  margin-right: 4px;
  color: var(--mt-blood);
}

.markettest-empty-summary {
  color: var(--mt-muted);
  font-size: 0.62rem;
  font-style: italic;
}

.markettest-metric {
  display: flex;
  min-width: 0;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  padding: 7px 5px;
  border-left: 1px solid rgba(88, 66, 42, 0.1);
  color: var(--mt-ink);
  font-size: 0.77rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.12;
  text-align: center;
}

.markettest-price {
  flex-direction: column;
  color: var(--mt-blood);
  font-family: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-size: 0.91rem;
  font-weight: 800;
  white-space: nowrap;
}

.markettest-price small {
  display: block;
  margin-top: 2px;
  color: var(--mt-muted);
  font: 600 0.54rem/1.12 "EB Garamond", Georgia, serif;
}

.markettest-quantity,
.markettest-durability,
.markettest-rune-count,
.markettest-bids {
  white-space: nowrap;
}

.markettest-bids { display: none; }
.markettest-list-shell.is-auction .markettest-bids { display: flex; }

.markettest-toggle,
.markettest-toggle-spacer {
  align-self: center;
  justify-self: center;
}

.markettest-toggle {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(129, 43, 37, 0.32);
  background: rgba(255, 252, 239, 0.6);
  color: var(--mt-blood);
  font-size: 0.92rem;
  cursor: pointer;
}

.markettest-toggle span {
  position: absolute;
  transform: translate(10px, -10px);
  min-width: 14px;
  border-radius: 999px;
  padding: 1px 3px;
  background: var(--mt-blood);
  color: white;
  font-size: 0.48rem;
}

.markettest-toggle-spacer {
  width: 28px;
  height: 28px;
}

.markettest-detail {
  padding: 0 10px 9px 93px;
}

.markettest-detail[hidden] { display: none; }

.markettest-detail-inner {
  border-top: 1px solid var(--mt-line);
  padding-top: 7px;
}

.markettest-detail-section h4 {
  margin: 0 0 4px;
  color: var(--mt-blood);
  font-family: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-size: 0.8rem;
}

.markettest-offers-host .game-market-offers { margin: 0; }
.markettest-offers-host .game-market-offers > h4 { display: none; }
.markettest-offers-host .game-market-offer-list { display: grid; gap: 6px; }
.markettest-offers-host .game-market-offer { align-items: center; }
.markettest-offers-host .game-market-offer-summary .game-market-compact-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.markettest-offers-host .game-market-offer-summary .game-market-compact-chips > span {
  display: inline-flex;
  width: auto;
  min-width: 0;
  align-items: baseline;
  justify-content: flex-start;
  gap: 5px;
}
.markettest-offers-host .game-market-offer-summary .game-market-compact-chips small,
.markettest-offers-host .game-market-offer-summary .game-market-compact-chips b {
  display: inline;
  width: auto;
}

/* Same visual language as the fitting-room item tooltip. */
.markettest-hover-card {
  position: fixed;
  z-index: 2200;
  display: none;
  box-sizing: border-box;
  width: min(370px, calc(100vw - 20px));
  max-height: min(72vh, 560px);
  overflow: auto;
  padding: 10px;
  border: 1px solid rgba(84, 59, 35, 0.32);
  background: rgba(255, 250, 231, 0.985);
  color: #2b2118;
  box-shadow: 0 14px 36px rgba(55, 38, 24, 0.25);
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.markettest-hover-card.is-visible {
  display: block;
}

.markettest-hover-head {
  display: grid;
  gap: 2px;
  padding: 1px 2px 8px;
  border-bottom: 1px solid rgba(92, 67, 39, 0.18);
}

.markettest-hover-head > strong {
  color: #2b2118;
  font-size: 1.02rem;
  line-height: 1.2;
}

.markettest-hover-head > small {
  color: #75624d;
  font-size: 0.72rem;
}

.markettest-hover-head > span {
  margin-top: 2px;
  color: #75624d;
  font-size: 0.73rem;
}

.markettest-hover-head > span b {
  color: #812b25;
  font-weight: 800;
}

.markettest-hover-section {
  margin-top: 7px;
  padding: 7px 8px;
  border: 1px solid rgba(97, 69, 37, 0.16);
  background: rgba(255, 246, 217, 0.52);
}

.markettest-hover-section h5 {
  margin: 0 0 5px;
  color: #812b25;
  font-size: 0.75rem;
  line-height: 1.1;
  text-transform: uppercase;
}

.markettest-hover-section ul {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.markettest-hover-section li {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: baseline;
  color: #2b2118;
  font-size: 0.76rem;
  line-height: 1.28;
}

.markettest-hover-section li > span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  color: #75624d;
}

.markettest-hover-section li > span em {
  color: #75624d;
  font-style: normal;
}

.markettest-hover-section li > strong {
  max-width: none;
  color: #2b2118;
  font-size: inherit;
  font-weight: 800;
  text-align: left;
  white-space: normal;
}

.markettest-hover-section.enchants {
  border-left: 3px solid rgba(205, 139, 37, 0.74);
  background: rgba(255, 247, 220, 0.72);
}

.markettest-hover-section.enchants h5 {
  color: #8a5b19;
}

.markettest-hover-section.runes {
  border-left: 3px solid rgba(47, 151, 104, 0.7);
  background: rgba(229, 249, 239, 0.68);
}

.markettest-hover-section.runes h5 {
  color: #3f6c38;
}

.markettest-hover-section.description {
  border-left: 3px solid rgba(129, 43, 37, 0.62);
  background: rgba(249, 232, 224, 0.58);
}

.markettest-hover-section.runes .game-market-rune-icons {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
}

.markettest-hover-section.runes .game-market-rune-icon {
  display: grid;
  box-sizing: border-box;
  width: 22px;
  height: 22px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(88, 66, 42, 0.25);
  border-radius: 3px;
  background: var(--quality-bg, rgba(255, 251, 236, 0.7));
}

.markettest-hover-section.runes .game-market-rune-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.markettest-hover-section.runes ul {
  gap: 6px;
}

.markettest-hover-section.runes li.markettest-hover-rune-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  padding: 4px 0;
}

.markettest-hover-rune-visual {
  display: grid;
  width: 24px;
  min-width: 24px;
  place-items: start center;
}

.markettest-hover-rune-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.markettest-hover-rune-copy em {
  color: #3f5f35;
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1.2;
}

.markettest-hover-rune-copy strong {
  color: #2b2118;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.24;
  overflow-wrap: anywhere;
}

.markettest-pagination {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 9px;
}

.markettest-pagination button {
  min-width: 31px;
  min-height: 28px;
  border: 1px solid var(--mt-line-strong);
  background: rgba(255, 251, 236, 0.56);
  color: var(--mt-blood);
  font: 750 0.7rem "EB Garamond", Georgia, serif;
  cursor: pointer;
}

.markettest-pagination button:disabled {
  opacity: 0.42;
  cursor: default;
}


@media (max-width: 1320px) {
  .markettest-options-row { align-items: flex-start; }
  .markettest-filterbar { flex-basis: 100%; }
}
@media (max-width: 1180px) {
  .markettest-table-head,
  .markettest-row-main {
    grid-template-columns: minmax(320px, 1fr) 60px 100px 92px 48px 34px;
  }

  .markettest-list-shell.is-auction .markettest-table-head,
  .markettest-list-shell.is-auction .markettest-row-main {
    grid-template-columns: minmax(300px, 1fr) 58px 94px 58px 86px 44px 34px;
  }

  .markettest-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .markettest-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .markettest-freshness {
    width: 100%;
    text-align: left;
  }

  .markettest-controls {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .markettest-filterbar {
    align-items: end;
  }

  .markettest-table-head { display: none; }

  .markettest-row-main,
  .markettest-list-shell.is-auction .markettest-row-main {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 7px 7px 5px;
  }

  .markettest-item {
    grid-column: 1 / -1;
    padding: 2px 2px 7px;
  }

  .markettest-metric {
    position: relative;
    padding: 16px 3px 3px;
    border-top: 1px solid var(--mt-line);
    border-left: 0;
    font-size: 0.72rem;
  }

  .markettest-metric::before {
    position: absolute;
    top: 2px;
    left: 0;
    right: 0;
    color: var(--mt-muted);
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .markettest-quantity::before { content: "Кол-во"; }
  .markettest-price::before { content: "Цена"; }
  .markettest-bids::before { content: "Ставки"; }
  .markettest-durability::before { content: "Прочность"; }
  .markettest-rune-count::before { content: "Руны"; }

  .markettest-list-shell:not(.is-auction) .markettest-row-main {
    grid-template-columns: repeat(4, minmax(0, 1fr)) 34px;
  }

  .markettest-list-shell:not(.is-auction) .markettest-bids { display: none; }

  .markettest-detail {
    padding: 0 8px 8px;
  }
}

@media (max-width: 560px) {
  .markettest-heading-title {
    display: grid;
    gap: 1px;
  }

  .markettest-controls {
    grid-template-columns: 1fr auto;
  }

  .markettest-tabs,
  .markettest-search {
    grid-column: 1 / -1;
  }

  .markettest-filterbar .markettest-tier-select,
  .markettest-filterbar .markettest-select:nth-child(2),
  .markettest-filterbar .markettest-select:nth-child(3) {
    width: calc(50% - 3px);
  }

  .markettest-reset {
    flex: 1 1 100%;
  }

  .markettest-item {
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 7px;
  }

  .markettest-item-visual {
    width: 62px;
  }

  .markettest-art {
    width: 58px;
    height: 58px;
    border-radius: 9px;
  }

  .markettest-art img {
    width: 53px;
    height: 53px;
    border-radius: 7px;
  }

  .markettest-item-visual .game-market-rune-icons {
    width: 60px;
    max-width: 60px;
    gap: 1px;
  }

  .markettest-item-visual .game-market-rune-icon {
    flex-basis: 19px;
    width: 19px;
    height: 19px;
  }

  .markettest-item-visual .game-market-rune-icon img {
    width: 17px;
    height: 17px;
  }

  .markettest-stat-grid,
  .markettest-enchants {
    grid-template-columns: 1fr;
  }

  .markettest-row-main,
  .markettest-list-shell.is-auction .markettest-row-main,
  .markettest-list-shell:not(.is-auction) .markettest-row-main {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .markettest-list-shell.is-auction .markettest-bids { display: none; }

  .markettest-toggle,
  .markettest-toggle-spacer {
    grid-column: 4;
  }
}

@media (hover: none) {
  .markettest-hover-card {
    display: none !important;
  }
}


/* #markettest v1.6 */

.markettest-filter-toggle,
.markettest-view-toggle {
  min-height: 30px;
  border: 1px solid var(--mt-line);
  border-radius: 0;
  padding: 4px 8px;
  background: rgba(255,251,236,.48);
  color: var(--mt-muted);
  font: 700 .7rem "EB Garamond",Georgia,serif;
  cursor: pointer;
  white-space: nowrap;
}
.markettest-filter-toggle[aria-pressed="true"],
.markettest-view-toggle[aria-pressed="true"] {
  border-color: rgba(129,43,37,.48);
  background: rgba(129,43,37,.1);
  color: var(--mt-blood);
}
.markettest-filter-toggle:disabled { opacity:.42; cursor:default; }

.markettest-row {
  box-shadow: inset 3px 0 0 var(--quality-accent,transparent);
}

.markettest-table-head {
  position: static;
  z-index: auto;
  box-shadow: none;
}


.markettest-stat.tone-attack { border-bottom-color:rgba(125,49,39,.26); }
.markettest-stat.tone-attack strong { color:#7d3127; }
.markettest-stat.tone-defense { border-bottom-color:rgba(73,99,71,.3); }
.markettest-stat.tone-defense strong { color:#496347; }
.markettest-stat.tone-utility { border-bottom-color:rgba(138,106,55,.28); }
.markettest-stat.tone-utility strong { color:#806236; }

.markettest-price-trend {
  display:inline-block;
  margin-top:2px;
  padding:1px 4px;
  border-radius:999px;
  font:800 .55rem/1.25 "EB Garamond",Georgia,serif;
  cursor:help;
}
.markettest-price-trend.is-cheaper { background:rgba(54,113,58,.1); color:#356c3a; }
.markettest-price-trend.is-higher { background:rgba(143,52,39,.09); color:#8f3427; }

.markettest-hover-market {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:4px;
  padding:6px;
  border:1px solid rgba(97,69,37,.16);
  border-left:3px solid var(--quality-accent,var(--mt-gold));
  background:rgba(255,250,232,.66);
}
.markettest-hover-market div { display:grid; gap:1px; min-width:0; }
.markettest-hover-market span { color:var(--mt-muted); font-size:.61rem; text-transform:uppercase; }
.markettest-hover-market strong {
  color:var(--mt-ink);
  font-size:.76rem;
  font-variant-numeric:tabular-nums;
  overflow-wrap:anywhere;
}


@media (max-width:720px) {
  .markettest-hover-market { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .markettest-table-head { position:static; box-shadow:none; }
}


/* ------------------------------------------------------------------
   #markettest v1.7 — cleaner multi-offer rows + card view
   ------------------------------------------------------------------ */

.markettest-item-title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.markettest-offer-badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(129, 43, 37, 0.26);
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(129, 43, 37, 0.055);
  color: var(--mt-blood);
  font: 800 0.58rem/1.1 "EB Garamond", Georgia, serif;
  cursor: pointer;
  white-space: nowrap;
}

.markettest-offer-badge:hover,
.markettest-offer-badge[aria-expanded="true"] {
  border-color: rgba(129, 43, 37, 0.5);
  background: rgba(129, 43, 37, 0.1);
}

.markettest-offer-badge .markettest-toggle-arrow {
  font-size: 0.7rem;
  line-height: 1;
}

.markettest-stat {
  font-size: 0.82rem;
}

.markettest-enchant {
  font-size: 0.8rem;
}

/* Card view keeps the same data but removes the spreadsheet feeling. */
.markettest-page.is-card-view .markettest-table-head {
  display: none;
}

.markettest-page.is-card-view .markettest-list-shell {
  border: 0;
  background: transparent;
}

.markettest-page.is-card-view .markettest-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 10px;
  padding: 2px 0;
}

.markettest-page.is-card-view .markettest-row {
  display: flex;
  min-width: 0;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--mt-line-strong);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(255, 251, 238, 0.78), rgba(247, 232, 196, 0.42));
  box-shadow:
    inset 4px 0 0 var(--quality-accent, transparent),
    0 2px 7px rgba(72, 50, 27, 0.08);
}

.markettest-page.is-card-view .markettest-row-main,
.markettest-page.is-card-view .markettest-list-shell.is-auction .markettest-row-main {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: 0;
}

.markettest-page.is-card-view .markettest-item {
  grid-column: 1 / -1;
  grid-template-columns: 74px minmax(0, 1fr);
  min-height: 105px;
  padding: 10px 11px 8px;
  border-bottom: 1px solid rgba(112, 85, 50, 0.14);
}

.markettest-page.is-card-view .markettest-copy {
  min-width: 0;
}

.markettest-page.is-card-view .markettest-item-title {
  font-size: 1rem;
}

.markettest-page.is-card-view .markettest-item-meta {
  margin-top: 2px;
  font-size: 0.67rem;
}

.markettest-page.is-card-view .markettest-summary {
  margin-top: 6px;
}

.markettest-page.is-card-view .markettest-stat-grid,
.markettest-page.is-card-view .markettest-enchants {
  grid-template-columns: 1fr;
  gap: 2px;
}

.markettest-page.is-card-view .markettest-stat,
.markettest-page.is-card-view .markettest-enchant {
  max-width: none;
  width: 100%;
  font-size: 0.76rem;
}

.markettest-page.is-card-view .markettest-metric {
  position: relative;
  display: grid;
  min-height: 54px;
  place-items: end start;
  gap: 1px;
  border-left: 0;
  border-top: 1px solid rgba(112, 85, 50, 0.12);
  padding: 19px 8px 6px;
  font-size: 0.78rem;
  text-align: left;
}

.markettest-page.is-card-view .markettest-metric::before {
  position: absolute;
  top: 5px;
  left: 8px;
  color: var(--mt-muted);
  font: 700 0.52rem/1 "EB Garamond", Georgia, serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.markettest-page.is-card-view .markettest-quantity::before { content: "Количество"; }
.markettest-page.is-card-view .markettest-price::before { content: "Цена"; }
.markettest-page.is-card-view .markettest-durability::before { content: "Прочность"; }
.markettest-page.is-card-view .markettest-rune-count::before { content: "Руны"; }
.markettest-page.is-card-view .markettest-bids::before { content: "Ставки"; }

.markettest-page.is-card-view .markettest-list-shell:not(.is-auction) .markettest-bids {
  display: none;
}

.markettest-page.is-card-view .markettest-list-shell.is-auction .markettest-row-main {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.markettest-page.is-card-view .markettest-detail {
  padding: 0 10px 10px;
}

.markettest-page.is-card-view .markettest-detail-inner {
  padding-top: 9px;
}

.markettest-page.is-card-view .markettest-price-trend {
  margin-left: 0;
}

@media (min-width: 1680px) {
  .markettest-page.is-card-view .markettest-list {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  }
}

@media (max-width: 720px) {
  .markettest-page.is-card-view .markettest-list {
    grid-template-columns: 1fr;
  }

  .markettest-page.is-card-view .markettest-row-main,
  .markettest-page.is-card-view .markettest-list-shell.is-auction .markettest-row-main {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
