#item-market-view {
  min-width: 0;
}

.item-market-card {
  border: 1px solid rgba(77, 124, 91, 0.16);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 36px rgba(39, 83, 55, 0.08);
}

.item-market-results {
  padding: 18px 20px 16px;
}

.item-market-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 14px;
}

.item-market-heading > div:first-child {
  flex: 1 1 170px;
  min-width: 0;
}

.item-market-heading h2,
.item-market-heading p {
  margin: 0;
}

.item-market-heading h2 {
  color: var(--brand-deep, #24563a);
  font: 700 21px/1.25 "Noto Serif SC", "STKaiti", serif;
}

.item-market-heading p {
  margin-top: 3px;
  color: #67756b;
  font-size: 13px;
}

.item-market-button,
.item-market-pagination button {
  min-height: 38px;
  border: 1px solid rgba(70, 122, 84, 0.24);
  border-radius: 10px;
  background: #f4faf5;
  color: #315f40;
  font: inherit;
  cursor: pointer;
}

.item-market-button {
  padding: 0 14px;
}

.item-market-filters {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(180px, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(82, 132, 96, 0.14);
  border-radius: 14px;
  background: #f7fbf7;
}

.item-market-filters label,
.item-market-server-picker,
.item-market-category-filter {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #4f6255;
  font-size: 13px;
  font-weight: 700;
}

.item-market-category-filter {
  grid-column: 1 / -1;
}

.item-market-category-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.item-market-category-buttons button {
  flex: 0 0 auto;
  min-height: 40px;
  max-width: 100%;
  border: 1px solid rgba(70, 122, 84, 0.24);
  border-radius: 9px;
  background: #fff;
  color: #3f5f49;
  padding: 7px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

#item-market-category {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

#item-market-category button {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 7px 4px;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

@media (max-width: 1100px) {
  #item-market-category {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.item-market-category-buttons button[aria-pressed="true"] {
  border-color: #568e68;
  background: #deeee2;
  color: #245b37;
}

.item-market-filters input,
.item-market-filters select {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid rgba(70, 122, 84, 0.24);
  border-radius: 10px;
  background: #fff;
  color: #263b2d;
  padding: 0 11px;
  font: inherit;
}

.item-market-filters input:focus,
.item-market-filters select:focus,
.item-market-category-buttons button:focus-visible,
.item-market-button:focus-visible,
.item-market-pagination button:focus-visible,
.item-market-server-options button:focus-visible {
  outline: 3px solid rgba(68, 139, 86, 0.2);
  outline-offset: 1px;
  border-color: #458a59;
}

.item-market-filters .text-button {
  height: 38px;
  padding: 0 12px;
}

.item-market-combobox {
  position: relative;
}

.item-market-server-options {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 10;
  max-height: 286px;
  overflow: auto;
  border: 1px solid rgba(70, 122, 84, 0.25);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(30, 72, 42, 0.16);
}

.item-market-server-options button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 6px 10px;
  border: 0;
  border-bottom: 1px solid #edf3ee;
  background: #fff;
  color: #294634;
  text-align: left;
  cursor: pointer;
}

.item-market-server-options button:last-child {
  border-bottom: 0;
}

.item-market-server-options button:hover,
.item-market-server-options button.is-active,
.item-market-server-options button[aria-selected="true"] {
  background: #edf7ef;
}

.item-market-server-options strong {
  overflow-wrap: anywhere;
}

.item-market-server-options span {
  color: #6a796e;
  font-size: 12px;
}

.item-market-server-empty {
  margin: 0;
  padding: 13px;
  color: #758078;
  text-align: center;
}

.item-market-notice,
.item-market-state {
  margin-top: 12px;
  border-radius: 12px;
  color: #526359;
  background: #f7faf7;
}

.item-market-notice {
  padding: 9px 12px;
}

.item-market-notice.is-error {
  color: #8a3e37;
  background: #fff2f0;
}

.item-market-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 96px;
  padding: 18px;
  text-align: center;
}

.item-market-state p {
  margin: 0;
}

.item-market-table-wrap {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid #e7eee8;
  border-radius: 12px;
}

.item-market-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  color: #2f4035;
  font-size: 14px;
}

.item-market-table th,
.item-market-table td {
  height: 40px;
  padding: 7px 12px;
  border-bottom: 1px solid #edf1ee;
  vertical-align: middle;
  text-align: left;
  overflow-wrap: anywhere;
}

.item-market-table thead th {
  height: 36px;
  background: #f4f8f5;
  color: #5c6d61;
  font-size: 12px;
  font-weight: 700;
}

.item-market-table tbody tr:last-child > * {
  border-bottom: 0;
}

.item-market-table tbody tr:hover {
  background: #fbfdfb;
}

.item-market-table th:nth-child(1) { width: 20%; }
.item-market-table th:nth-child(2) { width: 13%; }
.item-market-table th:nth-child(3) { width: 11%; }
.item-market-table th:nth-child(4) { width: 11%; }
.item-market-table th:nth-child(5) { width: 12%; }
.item-market-table th:nth-child(6) { width: 11%; }
.item-market-table th:nth-child(7) { width: 22%; }

.item-market-row th {
  color: #245238;
  font-weight: 700;
}

.item-market-history-button {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-top: 5px;
  border: 1px solid #b9d2bf;
  border-radius: 7px;
  background: #f6fbf7;
  color: #356848;
  padding: 2px 9px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.item-market-full-stat-cell {
  color: #965025;
  font-weight: 600;
}

.item-market-full-action-cell {
  white-space: nowrap;
}
.item-market-full-action-cell .item-market-history-button + .item-market-history-button {
  margin-left: 5px;
}

.item-market-history-button:focus-visible,
.item-market-history-dialog button:focus-visible,
.item-market-history-point:focus-visible {
  outline: 3px solid rgba(68, 139, 86, 0.24);
  outline-offset: 2px;
}

.item-market-history-dialog {
  width: min(820px, calc(100vw - 28px));
  max-width: none;
  max-height: calc(100dvh - 28px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 18px;
  color: #2f4035;
  background: #fff;
  box-shadow: 0 22px 70px rgba(25, 57, 34, 0.28);
}

.item-market-history-dialog::backdrop {
  background: rgba(24, 45, 31, 0.46);
  backdrop-filter: blur(2px);
}

.item-market-history-panel {
  padding: 20px;
}

.item-market-history-panel > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.item-market-history-panel h2,
.item-market-history-panel p {
  margin: 0;
}

.item-market-history-panel h2 {
  color: #24563a;
  font: 700 21px/1.3 "Noto Serif SC", "STKaiti", serif;
  overflow-wrap: anywhere;
}

.item-market-history-eyebrow {
  margin-bottom: 3px !important;
  color: #718077;
  font-size: 12px;
}

.item-market-history-close,
.item-market-history-ranges button,
.item-market-history-state button {
  min-height: 34px;
  border: 1px solid #c7d8cb;
  border-radius: 9px;
  background: #f7fbf8;
  color: #315f40;
  padding: 4px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.item-market-history-ranges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
}

.item-market-history-ranges button[aria-pressed="true"] {
  border-color: #568e68;
  background: #deeee2;
  color: #245b37;
}

.item-market-history-legend {
  display: flex;
  gap: 16px;
  margin: 13px 0 5px;
  color: #55675b;
  font-size: 13px;
  font-weight: 700;
}

.item-market-history-legend span::before {
  display: inline-block;
  width: 18px;
  height: 3px;
  margin-right: 6px;
  border-radius: 2px;
  vertical-align: middle;
  content: "";
}

.item-market-history-legend .is-buy::before { background: #dc2626; }
.item-market-history-legend .is-sell::before { background: #2563eb; }

.item-market-history-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 230px;
  border: 1px solid #e4ece6;
  border-radius: 12px;
  background: #fafcfb;
  color: #627168;
  text-align: center;
}

.item-market-history-chart {
  width: 100%;
  min-height: 250px;
  border: 1px solid #e4ece6;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.item-market-history-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.item-market-history-grid {
  stroke: #e7eee9;
  stroke-width: 1;
}

.item-market-history-grid.is-month { stroke: #f0f3f1; }

.item-market-history-axis-label {
  fill: #708078;
  font-size: 11px;
}

.item-market-history-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.item-market-history-line.is-buy { stroke: #dc2626; }
.item-market-history-line.is-sell { stroke: #2563eb; }
.item-market-history-dot.is-buy { fill: #dc2626; }
.item-market-history-dot.is-sell { fill: #2563eb; }

.item-market-history-point {
  fill: transparent;
  stroke: none;
  cursor: pointer;
}

.item-market-history-dot {
  stroke: #fff;
  stroke-width: 2;
  pointer-events: none;
}

.item-market-history-tooltip {
  position: fixed;
  z-index: 2;
  width: max-content;
  max-width: min(320px, calc(100vw - 24px));
  margin: 0 !important;
  box-sizing: border-box;
  border-radius: 9px;
  border: 1px solid #c9dfcf;
  background: #fff;
  color: #294d35;
  box-shadow: 0 8px 24px rgba(25, 57, 34, 0.18);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  pointer-events: none;
  visibility: hidden;
}

.item-market-history-tooltip.is-visible {
  visibility: visible;
}

.item-market-history-window {
  margin-top: 8px !important;
  color: #718077;
  font-size: 12px;
}

.item-market-prices {
  display: grid;
  gap: 6px;
  color: #9a5425;
}

.item-market-prices.is-paired {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 10px;
}

.item-market-prices.is-paired .item-market-stat-group-unknown {
  grid-column: 1 / -1;
}

.item-market-stat-group {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 5px;
  min-width: 0;
}

.item-market-stat-direction {
  padding: 1px 4px;
  border-radius: 5px;
  background: #edf6ef;
  color: #3f7650;
  font-size: 10px;
  line-height: 1.4;
}

.item-market-stat-lines {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.item-market-stat-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  color: #6f786f;
  font-weight: 500;
}

.item-market-stat-line > small {
  color: #78847b;
  font-size: 10px;
  line-height: 1.4;
  white-space: nowrap;
}

.item-market-stat-values {
  display: flex;
  flex-wrap: wrap;
  gap: 1px 5px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.item-market-stat-values > span {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.item-market-stat-values.is-missing {
  color: #98a098;
}

.item-market-stat-average {
  color: #965025;
  font-weight: 700;
}

.item-market-simple-price-button {
  display: block;
  max-width: 100%;
  margin: -2px -3px;
  padding: 2px 3px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.item-market-simple-name-button {
  display: inline;
  max-width: 100%;
  margin: -2px -3px;
  padding: 2px 3px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: pointer;
}

.item-market-simple-name-button:hover {
  background: #edf6ef;
}

.item-market-simple-name-button:focus-visible {
  outline: 2px solid #2f7245;
  outline-offset: 2px;
}

.item-market-simple-price-button:hover {
  background: #edf6ef;
}

.item-market-simple-price-button:focus-visible {
  outline: 2px solid #2f7245;
  outline-offset: 2px;
}

.item-market-stat-reference {
  color: #69766d;
  font-size: 11px;
}

.item-market-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  margin-top: 12px;
  color: #607066;
  font-size: 13px;
}

.item-market-pagination button {
  min-width: 72px;
  padding: 0 10px;
}

.item-market-pagination button:disabled,
.item-market-button:disabled {
  opacity: 0.48;
  cursor: default;
}

.item-market-import-note {
  margin: 10px 0 0;
  color: #778178;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 760px) {
  .item-market-results {
    padding: 15px 12px 13px;
  }

  .item-market-heading {
    align-items: flex-start;
  }

  .item-market-filters {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .item-market-server-picker {
    grid-column: 1 / -1;
  }

  .item-market-filters .text-button {
    align-self: end;
    min-height: 38px;
  }

  .item-market-table {
    min-width: 760px;
    font-size: 13px;
  }

  .item-market-table th,
  .item-market-table td {
    height: auto;
    min-height: 40px;
    padding: 7px 8px;
  }

  .item-market-table th:nth-child(1) { width: 24%; }
  .item-market-table th:nth-child(2) { width: 13%; }
  .item-market-table th:nth-child(3) { width: 11%; }
  .item-market-table th:nth-child(4) { width: 11%; }
  .item-market-table th:nth-child(5) { width: 12%; }
  .item-market-table th:nth-child(6) { width: 10%; }
  .item-market-table th:nth-child(7) { width: 19%; }

  .item-market-prices.is-paired {
    grid-template-columns: minmax(0, 1fr);
  }

  .item-market-prices.is-paired .item-market-stat-group-unknown {
    grid-column: auto;
  }
}

@media (max-width: 390px) {
  .item-market-filters {
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  .item-market-table {
    font-size: 12px;
  }

  .item-market-table th,
  .item-market-table td {
    padding: 7px 5px;
  }

  .item-market-full-stat-cell {
    padding-inline: 2px !important;
    font-size: 11px;
  }

  .item-market-full-stat-cell .item-market-stat-values > span {
    white-space: nowrap;
  }

  .item-market-table th:nth-child(1) { width: 24%; }
  .item-market-table th:nth-child(2) { width: 13%; }
  .item-market-table th:nth-child(3) { width: 11%; }
  .item-market-table th:nth-child(4) { width: 11%; }
  .item-market-table th:nth-child(5) { width: 12%; }
  .item-market-table th:nth-child(6) { width: 10%; }
  .item-market-table th:nth-child(7) { width: 19%; }

  .item-market-prices {
    gap: 3px;
  }
}


html.item-market-mode,
html.item-market-mode body {
  min-width: 0 !important;
}

.item-market-table tbody th,
.item-market-table tbody td {
  font-size: inherit;
}

@media (max-width: 390px) {
  .item-market-stat-group,
  .item-market-prices .item-market-stat-line {
    grid-template-columns: minmax(0, 1fr);
    gap: 1px;
  }

  .item-market-simple-card .item-market-stat-values {
    max-width: 100%;
  }
}
.item-market-display-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  margin-left: auto;
}
.item-market-compare-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
  text-align: right;
}
.item-market-compare-actions span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #405d49;
  font-size: 13px;
}
.item-market-compare-actions .item-market-button {
  flex: 0 0 auto;
}

.item-market-view-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid rgba(70, 122, 84, 0.2);
  border-radius: 10px;
  background: #f4f8f5;
}

.item-market-view-switch button {
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #627067;
  font: inherit;
  cursor: pointer;
}

.item-market-view-switch button.is-active {
  background: #fff;
  color: #28603b;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(39, 83, 55, 0.12);
}

.item-market-simple-grid {
  --simple-columns: 3;
  position: relative;
  margin-top: 12px;
}

/* The shell width, rather than the viewport, determines the masonry column count. */
#item-market-view .item-market-results { container: market-results / inline-size; }
#item-market-view .item-market-simple-grid { --simple-columns:1; }
@container market-results (min-width:560px) {
  #item-market-view .item-market-simple-grid { --simple-columns:2; }
}
@container market-results (min-width:840px) {
  #item-market-view .item-market-simple-grid { --simple-columns:3; }
}

.item-market-simple-grid[hidden] {
  display: none;
}

.item-market-simple-card {
  display: block;
  position: absolute;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid #e2ebe4;
  border-radius: 12px;
  background: #fff;
}

.item-market-simple-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px 10px;
  background: #f3f8f4;
}

.item-market-simple-heading {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.item-market-simple-card h3 {
  margin: 0;
  color: #285a3b;
  font-size: 15px;
}

.item-market-simple-card time {
  color: #718077;
  font-size: 11px;
  white-space: nowrap;
}

.item-market-skill-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.item-market-skill-filters button {
  min-height: 25px;
  border: 1px solid #cadbce;
  border-radius: 7px;
  background: #fff;
  color: #52675a;
  padding: 2px 7px;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.item-market-skill-filters button[aria-pressed="true"] {
  border-color: #568e68;
  background: #deeee2;
  color: #245b37;
}

.item-market-simple-card table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  color: #334239;
  font-size: 12px;
}

.item-market-simple-card th,
.item-market-simple-card td {
  min-width: 0;
  height: 34px;
  padding: 5px 8px;
  border-bottom: 1px solid #edf1ee;
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
  font-size: inherit;
}

.item-market-simple-card thead th {
  height: 30px;
  color: #68756d;
  background: #fafcfb;
  font-size: 11px;
}

.item-market-simple-card th:first-child { width: 46%; }
.item-market-simple-card th:nth-child(2),
.item-market-simple-card th:nth-child(3) { width: 27%; }
.item-market-simple-card tbody th { color: #28543a; }
.item-market-simple-card tbody tr:last-child > * { border-bottom: 0; }

.item-market-price-warning {
  display: block;
  max-width: 100%;
  margin-top: 2px;
  color: #a34d28;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.item-market-simple-subgroup th {
  height: 26px;
  padding-block: 4px;
  background: #f8faf8;
  color: #6a786f;
  font-size: 11px;
  font-weight: 700;
}

.item-market-simple-average {
  color: #965025;
  font-weight: 700;
}

.item-market-simple-missing,
.item-market-simple-empty td {
  color: #8a938d;
}

.item-market-simple-empty td {
  height: 48px;
  text-align: center;
}

.item-market-simple-card[data-category="shoujue"] .item-market-simple-empty td {
  height: 34px;
}

@media (max-width: 1100px) {
  .item-market-simple-grid {
    --simple-columns: 2;
  }
}

@media (max-width: 760px) {
  .item-market-simple-grid {
    --simple-columns: 1;
  }

}

@media (max-width: 390px) {
  .item-market-display-controls {
    width: 100%;
  }

  .item-market-view-switch {
    min-width: 0;
  }

  .item-market-view-switch button {
    padding: 0 11px;
  }
  .item-market-compare-actions { gap: 4px; }
  .item-market-compare-actions .item-market-button { padding: 0 7px; font-size: 12px; }

  .item-market-simple-card > header {
    align-items: flex-start;
  }

  .item-market-simple-card time {
    white-space: normal;
    text-align: right;
  }

  .item-market-simple-card th,
  .item-market-simple-card td {
    padding: 5px 6px;
  }

  .item-market-history-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 14px;
  }

  .item-market-history-panel {
    padding: 14px 12px;
  }

  .item-market-history-close {
    flex: 0 0 auto;
  }

  .item-market-history-ranges button {
    flex: 1 1 calc(25% - 7px);
    min-width: 62px;
    padding-inline: 6px;
  }

  .item-market-history-chart {
    min-height: 220px;
  }

}
