:root {
  --bg: #101010;
  --panel: #2a2a2a;
  --panel-dark: #202020;
  --slot: #252525;
  --slot-border: #090909;
  --text: #ffffff;
  --muted: #bdbdbd;
  --green: #08c51d;
  --yellow: #e2b900;
  --red: #df0808;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at 50% -20%, rgba(91, 53, 140, .18), transparent 36rem),
    linear-gradient(#11131a, #08090d 70%);
}
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, [role="button"]:focus-visible {
  outline: 3px solid #70cfff;
  outline-offset: 2px;
}

.page-shell {
  width: min(620px, calc(100% - 24px));
  margin: 0 auto;
  padding: 28px 0 44px;
}
.mini-brand {
  margin: 0 0 8px 4px;
  color: rgba(255,255,255,.45);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .12em;
}
.preview-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 3px 6px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  color: #d9c7ff;
  background: rgba(126, 87, 194, .16);
  font-size: .58rem;
  letter-spacing: .08em;
}
.preview-note {
  margin: 0 4px 10px;
  color: #aaa;
  font-size: .72rem;
  line-height: 1.4;
}

.trade-window {
  background: var(--panel);
  border: 4px solid #151515;
  box-shadow: 0 18px 55px rgba(0,0,0,.55);
  padding: 18px;
}
.offer-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin: 0 0 7px;
}
.offer-heading h1,
.offer-heading h2 {
  margin: 0;
  color: white;
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  line-height: 1;
  font-weight: 950;
  letter-spacing: -.02em;
}
.their-heading { margin-top: 17px; }
.tiny-total { display: none; }

.offer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.trade-slot {
  position: relative;
  aspect-ratio: 1 / 1;
  min-width: 0;
  overflow: hidden;
  border: 3px solid var(--slot-border);
  background: var(--slot);
  padding: 0;
  color: white;
}
.trade-slot.empty {
  display: grid;
  place-items: center;
}
.trade-slot.empty::before {
  content: "+";
  color: rgba(255,255,255,.22);
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 400;
}
.trade-slot:hover { background: #303030; }
.slot-art {
  position: absolute;
  inset: 10px 4px 24px;
  display: grid;
  place-items: center;
}
.slot-art img {
  width: 84%;
  height: 84%;
  display: block;
  object-fit: contain;
}
.slot-fallback { font-size: 2.4rem; }
.slot-class {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 2;
  max-width: 72%;
  padding: 2px 4px;
  background: var(--rarity-color);
  color: var(--rarity-text, white);
  border: 1px solid rgba(0,0,0,.45);
  font-size: clamp(.42rem, 1.4vw, .58rem);
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 23px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 4px;
  background: var(--rarity-color);
  color: var(--rarity-text, white);
  font-size: clamp(.54rem, 1.8vw, .72rem);
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-remove {
  position: absolute;
  top: 3px;
  left: 4px;
  z-index: 3;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 2px;
  background: rgba(0,0,0,.62);
  color: white;
  font-weight: 900;
  line-height: 1;
}

.verdict-bar {
  margin: 18px auto 8px;
  min-height: 58px;
  width: min(360px, 88%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 9px 16px;
  border: 4px solid rgba(0,0,0,.42);
  color: white;
  text-align: center;
  text-shadow: 0 2px 2px rgba(0,0,0,.45);
}
.verdict-bar strong {
  font-size: clamp(1.05rem, 4vw, 1.42rem);
  line-height: 1;
  font-weight: 950;
}
.verdict-bar span {
  font-size: .72rem;
  font-weight: 700;
  opacity: .92;
}
.verdict-empty { background: #655b5b; }
.verdict-good { background: var(--green); }
.verdict-fair { background: var(--yellow); }
.verdict-bad { background: var(--red); }

.reset-button {
  display: block;
  width: min(300px, 76%);
  margin: 8px auto 0;
  border: 4px solid rgba(0,0,0,.38);
  background: #6f6262;
  color: white;
  padding: 9px 16px;
  font-size: 1rem;
  font-weight: 950;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.reset-button:hover { filter: brightness(1.08); }

.details-panel {
  margin: 12px auto 0;
  width: min(360px, 88%);
  color: #d4d4d4;
  font-size: .75rem;
}
.details-panel summary {
  text-align: center;
  color: #aaa;
  cursor: pointer;
  user-select: none;
}
.details-panel[open] {
  padding: 9px 11px;
  background: #1d1d1d;
  border: 1px solid #444;
}
.details-panel[open] summary { margin-bottom: 7px; }
.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 3px 0;
}
.details-panel p {
  margin: 7px 0 0;
  color: #969696;
  line-height: 1.35;
}

.picker-dialog {
  width: min(760px, calc(100% - 16px));
  max-height: calc(100vh - 16px);
  padding: 0;
  border: 4px solid #151515;
  background: #282828;
  color: white;
  box-shadow: 0 25px 80px rgba(0,0,0,.75);
}
.picker-dialog::backdrop { background: rgba(0,0,0,.72); }
.inventory-window {
  max-height: calc(100vh - 24px);
  overflow: auto;
  padding: 13px;
  background: #292929;
}
.inventory-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.inventory-top > div { display: flex; align-items: center; gap: 10px; }
.inventory-tab {
  display: inline-block;
  padding: 7px 11px;
  border: 2px solid #0d0d0d;
  background: #464646;
  font-size: .76rem;
  font-weight: 950;
}
.inventory-top strong { font-size: .9rem; color: #d6d6d6; }
.close-button {
  width: 36px;
  height: 36px;
  border: 2px solid #111;
  background: #4a4a4a;
  color: white;
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
}
.search-box { display: block; margin-top: 10px; }
.search-box input {
  width: 100%;
  border: 2px solid #151515;
  background: #1f1f1f;
  color: white;
  padding: 9px 10px;
  outline: none;
}
.search-box input::placeholder { color: #8d8d8d; }

.filter-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 8px 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 1px;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: 0 0 auto;
  border: 2px solid #111;
  background: #3e3e3e;
  color: #eee;
  padding: 6px 10px;
  font-size: .72rem;
  font-weight: 950;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}
.filter-chip.active {
  outline: 2px solid white;
  outline-offset: -3px;
  filter: brightness(1.14);
}
.filter-divider {
  flex: 0 0 1px;
  width: 1px;
  height: 20px;
  margin: 0 2px;
  background: #666;
}
.class-chip { color: white; text-shadow: 0 1px 2px rgba(0,0,0,.55); }
.unique-chip { background: #f58a1f; }
.ancient-chip { background: #8a45d6; }
.chroma-chip { background: linear-gradient(90deg,#ff2a9d,#8f44ff,#2b8dff,#28c76f,#ffd43b,#ff7b24); }
.godly-chip { background: #ed2b9a; }
.vintage-chip { background: #d9b522; color: #171717; text-shadow: none; }
.legendary-chip { background: #d83a3a; }
.rare-chip { background: #38a85a; }
.uncommon-chip { background: #3d82d9; }
.common-chip { background: #858585; }

.picker-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 3px 1px 8px;
  color: #aaa;
  font-size: .66rem;
}
.weapon-catalog {
  display: block;
}
.rarity-section {
  margin: 0 0 13px;
  content-visibility: auto;
  contain-intrinsic-size: 600px;
}
.rarity-heading {
  position: sticky;
  top: -13px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 5px;
  padding: 7px 9px;
  border: 2px solid #111;
  background: var(--rarity-color);
  color: var(--rarity-text, white);
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0,0,0,.45);
}
.rarity-heading strong {
  font-size: .85rem;
  font-weight: 950;
  letter-spacing: .04em;
}
.rarity-heading span {
  min-width: 24px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(0,0,0,.32);
  color: white;
  font-size: .62rem;
  font-weight: 900;
  text-align: center;
}
.tier-group { margin: 0 0 8px; }
.tier-label {
  display: inline-block;
  margin: 0 0 4px 2px;
  padding: 3px 7px;
  border: 1px solid #111;
  background: #414141;
  color: #ddd;
  font-size: .62rem;
  font-weight: 950;
  text-transform: uppercase;
}
.weapon-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

@media (max-width: 600px) {
  .weapon-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
  }
}
.weapon-card {
  position: relative;
  aspect-ratio: .92 / 1;
  min-width: 0;
  overflow: hidden;
  border: 3px solid #0b0b0b;
  background: #252525;
  color: white;
  padding: 0;
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: 120px;
}

@media (max-width: 600px) {
  .weapon-card {
    aspect-ratio: 1 / 1;
  }
}
.weapon-card:hover { background: #343434; }
.weapon-image-wrap {
  position: absolute;
  inset: 11px 3px 22px;
  display: grid;
  place-items: center;
}
.weapon-image {
  display: block;
  width: 82%;
  height: 82%;
  object-fit: contain;
}
.item-fallback { font-size: 2rem; }
.weapon-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 3px;
  background: var(--rarity-color);
  color: var(--rarity-text, white);
  font-size: clamp(.5rem, 1.5vw, .66rem);
  font-weight: 950;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0,0,0,.45);
}
.weapon-value,
.weapon-tier {
  position: absolute;
  top: 3px;
  z-index: 2;
  padding: 2px 4px;
  background: rgba(0,0,0,.68);
  color: white;
  font-size: .58rem;
  font-weight: 950;
  line-height: 1;
}
.weapon-value { right: 3px; }
.weapon-tier { left: 3px; }
.value-pending .weapon-value { background: #8b6d00; }
.no-results {
  padding: 42px 10px;
  text-align: center;
  color: #aaa;
  font-weight: 800;
}

@media (max-width: 600px) {
  .page-shell { width: min(100% - 10px, 620px); padding-top: 8px; }
  .mini-brand { display: none; }
  .trade-window { padding: 10px; border-width: 3px; }
  .offer-grid { gap: 2px; }
  .trade-slot { border-width: 2px; }
  .slot-art { inset: 10px 3px 20px; }
  .slot-label { min-height: 20px; font-size: .5rem; }
  .slot-class { font-size: .42rem; }
  .verdict-bar { width: 92%; margin-top: 12px; }
  .reset-button { width: 78%; }
  .details-panel { width: 92%; }
  .picker-dialog { width: calc(100% - 8px); border-width: 3px; }
  .inventory-window { padding: 8px; }
  .inventory-top strong { display: none; }
  .rarity-heading { top: -8px; }
  .weapon-grid { grid-template-columns: repeat(4, 1fr); gap: 3px; }
  .weapon-card { border-width: 2px; }
  .weapon-image-wrap { inset: 10px 2px 19px; }
  .weapon-name { min-height: 19px; font-size: .48rem; }
  .weapon-value, .weapon-tier { font-size: .5rem; }
  .picker-meta span:last-child { display: none; }
}

@media (max-width: 380px) {
  .offer-heading h1, .offer-heading h2 { font-size: 1.12rem; }
  .trade-window { padding: 8px; }
  .slot-label { font-size: .44rem; }
  .weapon-grid { grid-template-columns: repeat(3, 1fr); }
}