/* ============================================================
   SkinSignal / css / forum.css
   The Trade Board, in the product's own material: the dashboard plates
   (css/surface-tokens.css), Saira / Inter / JetBrains Mono, real item
   pictures on dark item wells with a rarity edge, gold for rank and
   the one CTA, a cold blue whisper for "yours". Rides css/style.css for
   the shell and css/buttons.css for the .cta pills.
   ============================================================ */

:root {
  --tb-gold: #e4ae39;
  --tb-blue: #3d7fff;
  --tb-green: #3ecf8e;
  --tb-plate: var(--surface-panel);
  --tb-well: #0a0c11;
  --tb-plate-edge:
    inset 0 1px 0 var(--edge-top),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 12px 32px -16px rgba(0, 0, 0, 0.9);
  --tb-gap: clamp(18px, 2vw, 26px);
  --tb-radius: 18px;
  --tb-radius-sm: 12px;
  --tb-pad: clamp(18px, 2vw, 26px);
  --tb-ease: cubic-bezier(0.16, 0.84, 0.32, 1);
}

.tb-main { position: relative; }
.tb-main::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 6px);
}
.tb-wrap {
  position: relative; z-index: 1; max-width: 1120px; margin: 0 auto;
  padding: clamp(28px, 3.6vw, 48px) clamp(16px, 3vw, 32px) clamp(40px, 6vw, 72px);
}
.tb-wrap > * + * { margin-top: var(--tb-gap); }
#compose:empty { display: none; }
.tb-main + .footer { margin-top: 0; }

.tb-eyebrow {
  margin: 0; font-family: var(--font-body); font-size: 11px; font-weight: 600;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--tb-gold);
}
.tb-plate {
  border: 1px solid var(--edge); border-radius: var(--tb-radius);
  background: var(--tb-plate); box-shadow: var(--tb-plate-edge);
}

/* ---------- HEADER ---------- */

.tb-head__title {
  margin: 12px 0 10px; font-family: var(--font-display); font-stretch: var(--display-hero);
  font-weight: 700; font-size: clamp(40px, 6vw, 72px); line-height: 1; letter-spacing: -0.02em; color: var(--text);
}
.tb-head__lede {
  margin: 0; max-width: 60ch; font-family: var(--font-body); font-weight: 300;
  font-size: clamp(15px, 1.6vw, 18px); line-height: 1.5; color: var(--muted);
}
.tb-head__meta {
  display: inline-flex; align-items: center; gap: 8px; margin: 14px 0 0; padding: 5px 11px 5px 10px;
  border-radius: 999px; background: var(--surface-raised); box-shadow: inset 0 0 0 1px var(--edge);
  font-family: var(--font-mono); font-size: 11.5px; color: var(--muted);
}
.tb-head__meta::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--tb-green);
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.15);
}

/* ---------- THE NOTICE (wording pinned by tools/test-forum.js) ---------- */

.notice {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px;
  padding: 14px 18px; border-radius: var(--tb-radius-sm);
  background: rgba(228, 174, 57, 0.06); border: 1px solid rgba(228, 174, 57, 0.22);
}
.notice::before {
  content: "!"; grid-row: span 2; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(228, 174, 57, 0.16); color: var(--tb-gold);
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
}
.notice__title { margin: 0; font-family: var(--font-display); font-stretch: var(--display-header); font-weight: 600; font-size: 15px; color: var(--text); }
.notice__body { margin: 4px 0 0; font-family: var(--font-body); font-size: 13.5px; line-height: 1.55; color: var(--muted); }

/* ---------- INPUTS ---------- */

.tb-input {
  width: 100%; box-sizing: border-box; padding: 11px 13px; border-radius: 10px;
  background: var(--tb-well); border: 1px solid var(--edge); color: var(--text);
  font-family: var(--font-body); font-size: 14px; outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.tb-input::placeholder { color: rgba(245, 242, 236, 0.32); }
.tb-input:focus { border-color: rgba(61, 127, 255, 0.55); box-shadow: 0 0 0 3px rgba(61, 127, 255, 0.14); }
.tb-input--area { resize: vertical; min-height: 64px; line-height: 1.5; }

/* ---------- COMPOSE ---------- */

.compose { padding: var(--tb-pad); }
.compose__head { margin-bottom: 18px; }
.compose__title {
  margin: 8px 0 0; font-family: var(--font-display); font-stretch: var(--display-header); font-weight: 600;
  font-size: clamp(22px, 2.6vw, 30px); letter-spacing: -0.015em; color: var(--text);
}
.compose__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--tb-gap); }
.compose__side {
  display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 16px;
  border-radius: 14px; background: var(--surface-raised); box-shadow: inset 0 0 0 1px var(--edge);
}
.compose__sidehead { display: flex; align-items: baseline; justify-content: space-between; }
.compose__label {
  margin: 0; font-family: var(--font-body); font-size: 10.5px; font-weight: 600; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--muted);
}
.compose__count { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.compose__pick {
  align-self: flex-start; padding: 10px 14px; border-radius: 10px; cursor: pointer;
  background: rgba(61, 127, 255, 0.1); border: 1px dashed rgba(61, 127, 255, 0.45); color: #a8c4ff;
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  transition: background-color 160ms ease;
}
.compose__pick:hover, .compose__pick.is-open { background: rgba(61, 127, 255, 0.18); }
.compose__noterow { display: flex; flex-direction: column; gap: 8px; margin-top: var(--tb-gap); }
.compose__foot { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 18px; flex-wrap: wrap; }
.compose__error { margin: 0 auto 0 0; font-family: var(--font-body); font-size: 13px; color: #ff9b9b; }

/* chips */
.tb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tb-chips:empty { display: none; }
.tb-chip {
  --rarity: rgba(255, 255, 255, 0.2);
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 6px 4px 4px;
  border-radius: 10px; background: var(--tb-well); box-shadow: inset 0 0 0 1px var(--edge), inset 3px 0 0 var(--rarity);
}
.tb-chip__img { width: 34px; height: 26px; object-fit: contain; flex: none; }
.tb-chip__name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--font-body); font-size: 12.5px; color: var(--text); }
.tb-chip__x {
  flex: none; width: 22px; height: 22px; border-radius: 6px; border: 0; cursor: pointer;
  background: transparent; color: var(--faint); font-size: 16px; line-height: 1;
}
.tb-chip__x:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }

/* the inventory picker */
.tb-picker { display: flex; flex-direction: column; gap: 10px; }
.tb-picker[hidden] { display: none; }
.tb-picker__top { display: flex; flex-direction: column; gap: 6px; }
.tb-picker__status { margin: 0; font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.tb-picker__grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px;
  max-height: 340px; overflow-y: auto; padding: 2px; scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.tb-pick {
  position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px;
  border-radius: 10px; border: 0; cursor: pointer; text-align: left;
  background: var(--tb-well); box-shadow: inset 0 0 0 1px var(--edge);
  transition: box-shadow 140ms ease, transform 200ms var(--tb-ease);
}
.tb-pick:hover { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16); transform: translateY(-1px); }
.tb-pick.is-picked { box-shadow: inset 0 0 0 2px var(--tb-blue); background: rgba(61, 127, 255, 0.08); }
.tb-pick.is-picked::after {
  content: "\2713"; position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; background: var(--tb-blue); color: #fff; font-size: 11px; font-weight: 700;
}
.tb-pick.is-hold { opacity: 0.7; }
.tb-pick__img { width: 100%; height: 64px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5)); }
.tb-pick__text { display: flex; flex-direction: column; min-width: 0; }
.tb-pick__weapon { font-family: var(--font-body); font-size: 10.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-pick__skin { font-family: var(--font-body); font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-pick__meta { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }

/* the autocomplete */
.tb-search { position: relative; }
.tb-drop {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; max-height: 320px; overflow-y: auto;
  padding: 6px; border-radius: 12px; background: #11141b; border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.85);
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.tb-drop[hidden] { display: none; }
.tb-drop__msg { margin: 6px 8px; font-family: var(--font-body); font-size: 12.5px; color: var(--muted); }
.tb-opt {
  --rarity: rgba(255, 255, 255, 0.2);
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 7px 10px 7px 8px; border: 0; cursor: pointer;
  border-radius: 8px; background: transparent; text-align: left; box-shadow: inset 3px 0 0 var(--rarity);
}
.tb-opt:hover, .tb-opt.is-active { background: rgba(255, 255, 255, 0.05); }
.tb-opt__img { width: 52px; height: 38px; object-fit: contain; flex: none; }
.tb-opt__text { display: flex; flex-direction: column; min-width: 0; }
.tb-opt__weapon { font-family: var(--font-body); font-size: 11px; color: var(--faint); }
.tb-opt__skin { font-family: var(--font-body); font-size: 13.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the open-to-offers toggle */
.tb-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; align-self: flex-start; }
.tb-toggle__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tb-toggle__track {
  position: relative; width: 36px; height: 20px; border-radius: 999px; background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px var(--edge); transition: background-color 180ms ease;
}
.tb-toggle__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: #c9cdd6; transition: transform 200ms var(--tb-ease), background-color 180ms ease;
}
.tb-toggle__input:checked + .tb-toggle__track { background: rgba(62, 207, 142, 0.3); }
.tb-toggle__input:checked + .tb-toggle__track::after { transform: translateX(16px); background: var(--tb-green); }
.tb-toggle__input:focus-visible + .tb-toggle__track { box-shadow: 0 0 0 3px rgba(61, 127, 255, 0.35); }
.tb-toggle__label { font-family: var(--font-body); font-size: 13px; color: var(--text); }

/* ---------- LOCKED / EMPTY ---------- */

.tb-locked { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: var(--tb-pad); flex-wrap: wrap; }
.tb-locked__title {
  margin: 8px 0 4px; font-family: var(--font-display); font-stretch: var(--display-header); font-weight: 600;
  font-size: clamp(20px, 2.4vw, 26px); color: var(--text);
}
.tb-locked__body { margin: 0; max-width: 56ch; font-family: var(--font-body); font-weight: 300; font-size: 14.5px; line-height: 1.5; color: var(--muted); }
.tb-empty { padding: clamp(28px, 4vw, 48px); text-align: center; }
.tb-empty__title {
  margin: 0 0 8px; font-family: var(--font-display); font-stretch: var(--display-hero); font-weight: 700;
  font-size: clamp(24px, 3.2vw, 34px); letter-spacing: -0.02em; color: var(--text);
}
.tb-empty__body { margin: 0 auto; max-width: 50ch; font-family: var(--font-body); font-weight: 300; font-size: 15px; line-height: 1.5; color: var(--muted); }
.tb-empty .cta { margin-top: 18px; }

/* ---------- THE LISTINGS ---------- */

.tb-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.tb-hidden { display: grid; gap: 12px; }

.post {
  position: relative; padding: 18px var(--tb-pad) 16px;
  border: 1px solid var(--edge); border-radius: var(--tb-radius);
  background: var(--tb-plate); box-shadow: var(--tb-plate-edge);
  transition: border-color 200ms ease, transform 240ms var(--tb-ease);
}
.post:hover { border-color: rgba(255, 255, 255, 0.1); }
.post--hidden { border-style: dashed; border-color: rgba(255, 155, 155, 0.3); opacity: 0.85; }

.post__head { display: flex; align-items: center; gap: 12px; }
.post__avatar {
  width: 40px; height: 40px; border-radius: 10px; object-fit: cover; flex: none;
  background: var(--surface-raised); box-shadow: inset 0 0 0 1px var(--edge);
}
.post__who { min-width: 0; flex: 1; }
.post__name {
  font-family: var(--font-display); font-stretch: var(--display-header); font-weight: 600; font-size: 16px;
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.post__sub { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.post__rank { display: inline-flex; align-items: center; gap: 6px; }
.post__emblem { width: 20px; height: 20px; object-fit: contain; }
.post__emblem.is-empty { display: none; }
.post__ranklabel {
  font-family: var(--font-body); font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: rgba(228, 174, 57, 0.85);
}
.post__when { flex: none; font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); }
.post__hiddenline { margin: 12px 0 0; font-family: var(--font-body); font-size: 12.5px; color: #ff9b9b; }

.post__trade {
  display: grid; grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr); align-items: stretch;
  gap: 12px; margin-top: 16px;
}
.post__side {
  min-width: 0; padding: 12px; border-radius: 14px;
  background: var(--tb-well); box-shadow: inset 0 0 0 1px var(--edge);
}
.post__side--have { box-shadow: inset 0 0 0 1px var(--edge), inset 0 2px 0 rgba(61, 127, 255, 0.5); }
.post__side--want { box-shadow: inset 0 0 0 1px var(--edge), inset 0 2px 0 rgba(228, 174, 57, 0.55); }
.post__label {
  margin: 0 0 10px; font-family: var(--font-body); font-size: 10px; font-weight: 600; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--faint);
}
.post__side--have .post__label { color: #8fb2ff; }
.post__side--want .post__label { color: rgba(228, 174, 57, 0.9); }
.post__swap {
  align-self: center; justify-self: center; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-raised); box-shadow: inset 0 0 0 1px var(--edge);
}
.post__swap::before {
  content: "\21C4"; font-family: var(--font-body); font-size: 17px; line-height: 1; color: var(--muted);
}
.post__text { margin: 0; font-family: var(--font-body); font-size: 14px; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }
.post__extras { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.post__extras:first-of-type { margin-top: 0; }
.tb-items + .post__extras { margin-top: 10px; }
.tb-pill {
  padding: 4px 10px; border-radius: 999px; background: rgba(62, 207, 142, 0.12);
  box-shadow: inset 0 0 0 1px rgba(62, 207, 142, 0.35); color: #7ee6b6;
  font-family: var(--font-body); font-size: 11.5px; font-weight: 600;
}
.post__wanttext {
  font-family: var(--font-body); font-size: 13px; color: var(--text); overflow-wrap: anywhere;
}
.post__wanttext::before { content: "+ "; color: var(--faint); }
.post__note {
  margin: 14px 0 0; padding-left: 12px; border-left: 2px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-body); font-weight: 300; font-size: 14px; line-height: 1.55; color: var(--muted);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.post__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--edge);
}
.post__stamp { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.post__asof { color: #c9a24f; }
.post__actions { display: flex; align-items: center; gap: 8px; }
.post__contact {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: rgba(61, 127, 255, 0.14); box-shadow: inset 0 0 0 1px rgba(61, 127, 255, 0.45);
  color: #cfe0ff; font-family: var(--font-body); font-size: 13px; font-weight: 600; text-decoration: none;
  transition: background-color 160ms ease;
}
.post__contact::after { content: "\2197"; font-size: 12px; opacity: 0.8; }
.post__contact:hover { background: rgba(61, 127, 255, 0.24); }
.post__contact:focus-visible { outline: 2px solid rgba(168, 196, 255, 0.8); outline-offset: 2px; }
.post__btn {
  padding: 8px 12px; border-radius: 999px; border: 0; cursor: pointer; background: transparent;
  box-shadow: inset 0 0 0 1px var(--edge); color: var(--text); font-family: var(--font-body); font-size: 12.5px;
}
.post__btn:hover { background: rgba(255, 255, 255, 0.05); }
.post__btn--quiet { color: var(--faint); }
.post__btn:disabled { cursor: default; opacity: 0.7; }

/* item tiles on a listing */
.tb-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.tb-item {
  --rarity: rgba(255, 255, 255, 0.18);
  position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 8px 8px 7px;
  border-radius: 10px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 -2px 0 var(--rarity);
}
.tb-item__img {
  width: 100%; height: 58px; object-fit: contain;
  filter: drop-shadow(0 5px 9px rgba(0, 0, 0, 0.55));
  transition: transform 260ms var(--tb-ease);
}
.tb-item:hover .tb-item__img { transform: scale(1.06); }
.tb-item__img.is-empty, .tb-pick__img.is-empty, .tb-opt__img.is-empty, .tb-chip__img.is-empty {
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.03) 0 4px, transparent 4px 8px); border-radius: 6px;
}
.tb-item__text { display: flex; flex-direction: column; min-width: 0; }
.tb-item__weapon { font-family: var(--font-body); font-size: 10.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-item__skin { font-family: var(--font-body); font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-item__meta { font-family: var(--font-mono); font-size: 10px; color: var(--muted); white-space: nowrap; }
.tb-item__hold {
  align-self: flex-start; margin-top: 3px; padding: 1px 6px; border-radius: 4px; background: rgba(255, 155, 155, 0.1);
  font-family: var(--font-body); font-size: 9.5px; color: #ffb0b0;
}

/* ---------- LOADING ---------- */

.tb-skel { display: grid; gap: 14px; }
.tb-skel span {
  display: block; height: 170px; border-radius: var(--tb-radius); background: var(--tb-plate); box-shadow: var(--tb-plate-edge);
  animation: tbSkel 1.6s ease-in-out infinite;
}
@keyframes tbSkel { 0%, 100% { opacity: 0.55; } 50% { opacity: 0.9; } }

/* ---------- SMALL SCREENS ---------- */

@media (max-width: 820px) {
  .compose__grid { grid-template-columns: minmax(0, 1fr); }
  .post__trade { grid-template-columns: minmax(0, 1fr); }
  .post__swap { transform: rotate(90deg); }
}
@media (max-width: 520px) {
  .tb-items { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .tb-picker__grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .post__when { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tb-skel span { animation: none; }
  .tb-pick, .tb-item__img, .post, .tb-toggle__track::after { transition: none; }
  .tb-pick:hover, .tb-item:hover .tb-item__img { transform: none; }
}
