/* Trait Store page — uses the site's design tokens (see style.css :root). */
/* Author display rules (grid/flex below) would otherwise beat the [hidden] attribute. */
.ts-hero [hidden], .ts-main [hidden] { display: none !important; }
.ts-hero { padding-bottom: 36px; }
.ts-main { padding: 32px 0 80px; }
.ts-main .container { display: grid; gap: 20px; }

.ts-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}
.ts-card h2 { font-family: 'Rye', serif; font-size: 26px; color: var(--cream); margin-bottom: 8px; font-weight: 400; }
.ts-card h3 { font-size: 18px; color: var(--orange-pale); margin: 4px 0 8px; }
.ts-center { text-align: center; }
.ts-muted { color: var(--muted); }
.small { font-size: 13px; }
.ts-msg { min-height: 1.4em; margin-top: 12px; color: var(--muted); }
.ts-msg.err { color: var(--danger); }
.ts-msg.ok { color: var(--green); }

.ts-banner {
  display: inline-block; padding: 8px 16px; border-radius: 999px; font-weight: 800; font-size: 13px;
  background: rgba(239,95,95,0.12); border: 1px solid rgba(239,95,95,0.4); color: #ffb0b0;
}
.ts-link { background: none; border: 0; color: var(--orange-light); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.ts-link:hover { text-decoration: underline; }
.ts-row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ts-who { color: var(--muted); font-size: 14px; }

.ts-wallets { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 18px 0 6px; }
.ts-wallets .btn { min-width: 170px; }

/* NFT picker */
.ts-nft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 16px; }
.ts-nft {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  cursor: pointer; text-align: left; color: inherit; font: inherit; padding: 0; transition: transform .12s, border-color .12s;
}
.ts-nft:hover:not([disabled]) { transform: translateY(-2px); border-color: var(--orange); }
.ts-nft[disabled] { opacity: .5; cursor: not-allowed; }
.ts-nft img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--panel-3); }
.ts-nft .cap { padding: 10px 12px; }
.ts-nft .cap b { display: block; color: var(--cream); }
.ts-nft .cap span { font-size: 12px; color: var(--muted); }

/* Editor */
.ts-editor { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 20px; align-items: start; }
.ts-editor-left {
  position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.ts-editor-left::-webkit-scrollbar { width: 8px; }
.ts-editor-left::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }
/* The cart floats near the top of the screen instead of sitting in the page flow, so a player always
   sees it without scrolling down — it has its own internal scroll so a big cart never overflows the screen. */
#ts-confirm {
  position: fixed; top: 90px; right: 24px; z-index: 120;
  width: 380px; max-width: calc(100vw - 48px); max-height: calc(100vh - 116px);
  overflow-y: auto; overflow-x: hidden;
  box-shadow: 0 18px 46px rgba(0,0,0,.55);
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
#ts-confirm::-webkit-scrollbar { width: 8px; }
#ts-confirm::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }
.ts-preview-wrap { position: relative; margin: 12px 0; border-radius: var(--radius); overflow: hidden; background: var(--panel-3); }
.ts-preview-wrap img { width: 100%; height: auto; display: block; aspect-ratio: 1; }
.ts-badge { position: absolute; top: 10px; left: 10px; background: var(--orange); color: #1a1207; font-weight: 900; font-size: 12px; padding: 4px 10px; border-radius: 999px; }
.ts-busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.55); font-weight: 800; }
.ts-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ts-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 6px 3px 9px; border-radius: 999px; background: var(--panel-3); border: 1px solid var(--line); color: var(--muted); }
.ts-chip b { color: var(--cream); font-weight: 700; }
.ts-chip.changed { border-color: var(--orange); }
.chip-bonus { color: var(--green); font-weight: 700; }
.chip-remove {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(255,255,255,.08); color: #ffb0b0; font-size: 9px; line-height: 1; cursor: pointer;
}
.chip-remove:hover { background: rgba(255,80,80,.3); color: #fff; }

.ts-totals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ts-total-pill { font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: rgba(99,212,99,0.12); border: 1px solid rgba(99,212,99,0.35); color: var(--green); }

.ts-slots { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 14px; }
.ts-slot {
  border: 1px solid var(--line-strong); background: var(--panel-3); color: var(--muted); font: inherit; font-weight: 700; font-size: 13px;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.ts-slot.active { background: var(--orange); border-color: var(--orange); color: #1a1207; }
.ts-slot .n { opacity: .7; margin-left: 4px; font-weight: 600; }
.ts-slot-inv { border-color: rgba(99,212,99,.5); color: var(--green); }
.ts-slot-inv.active { background: var(--green); border-color: var(--green); color: #0e2a10; }

.ts-trait-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; margin-bottom: 14px; align-items: stretch; }
.ts-trait {
  position: relative; display: flex; flex-direction: column; background: var(--panel-2); border: 2px solid var(--line); border-radius: var(--radius); padding: 0; overflow: hidden;
  cursor: pointer; text-align: left; color: inherit; font: inherit; transition: border-color .12s, transform .12s;
}
.ts-trait:hover:not([disabled]) { transform: translateY(-2px); }
.ts-trait.sel { border-color: var(--orange-light); box-shadow: 0 0 0 2px rgba(240,165,72,.25); }
.ts-trait[disabled] { opacity: .42; cursor: not-allowed; }
.ts-trait img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--panel-3); flex: none; }
/* Every card's caption reserves the same minimum height, so rows line up whether or not a card has a
   bonus/warning line — otherwise shorter cards (no bonus) sit at a different height than taller ones. */
.ts-trait .cap { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 7px 9px 9px; min-height: 84px; }
.ts-trait .cap b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; line-height: 1.25; color: var(--cream); }
.ts-trait .cap .price { font-size: 12px; font-weight: 800; color: var(--dkv); }
.ts-trait .cap .bonus { font-size: 11px; font-weight: 700; color: var(--green); display: block; }
.ts-trait .cap .why { font-size: 11px; color: #e8a3a3; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ts-trait .rar { position: absolute; top: 6px; right: 6px; width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(0,0,0,.5); }
.ts-trait .left { position: absolute; top: 4px; left: 6px; font-size: 10px; font-weight: 800; background: rgba(0,0,0,.6); border-radius: 6px; padding: 1px 6px; }
.ts-free { font-size: 11px; font-weight: 900; color: #0e2a10; background: var(--green); border-radius: 999px; padding: 2px 8px; vertical-align: middle; }

.ts-confirm { margin-top: 10px; padding: 16px; border-radius: var(--radius); background: var(--panel-3); border: 1px solid var(--orange); }
.ts-confirm-price { font-size: 22px; font-weight: 900; color: var(--dkv); margin: 6px 0 10px; }
.ts-fine { color: var(--muted); font-size: 13px; padding-left: 18px; margin-bottom: 14px; }
.ts-confirm .btn { margin-right: 8px; }
.ts-confirm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ts-cart-toggle {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--line-strong); color: var(--cream); font-size: 15px; line-height: 1;
  cursor: pointer; padding: 0;
}
.ts-cart-toggle:hover { border-color: var(--orange-light); color: var(--orange-light); }
/* Collapsed: only the header (title + item count + the toggle itself) stays visible — a small,
   unobtrusive bar a player can bring back at any time, instead of the cart blocking their view. */
#ts-confirm.collapsed { padding: 10px 14px; }
#ts-confirm.collapsed > *:not(.ts-confirm-head) { display: none; }
#ts-confirm.collapsed .ts-confirm-head { margin: 0; }

.ts-card #ts-result-img { max-width: 360px; width: 100%; height: auto; border-radius: var(--radius); margin: 12px auto; display: block; }

@media (max-width: 860px) {
  .ts-editor { grid-template-columns: 1fr; }
  .ts-editor-left { position: static; max-height: none; overflow: visible; }
  .ts-card { padding: 16px; }
  .ts-trait-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  #ts-confirm { top: 74px; right: 12px; left: 12px; width: auto; max-width: none; max-height: calc(100vh - 90px); }
}

/* Sort / filter bar */
.ts-sortbar { display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 0 0 14px; }
.ts-sortbar label { font-size: 12px; font-weight: 800; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ts-sortbar select {
  background: var(--panel-3); color: var(--cream); border: 1px solid var(--line-strong); border-radius: 8px;
  font: inherit; font-size: 13px; font-weight: 700; padding: 5px 8px;
}
.ts-trait .cap .cat { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); display: block; }

/* Cart — the panel itself (#ts-confirm, above) scrolls as a whole, so this list doesn't need its own */
.ts-cart-list { list-style: none; padding: 0; margin: 8px 0 4px; display: grid; gap: 6px; }
.ts-cart-row { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 6px 8px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); }
.ts-cart-row .what { flex: 1; min-width: 0; color: var(--muted); }
.ts-cart-row .what b { color: var(--cream); }
.ts-cart-row .cost { font-weight: 800; color: var(--dkv); white-space: nowrap; }
.ts-cart-row .cost.free { color: var(--green); }
.ts-cart-row button { background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; line-height: 1; padding: 2px 4px; }
.ts-cart-row button:hover { color: #ff8d8d; }
.ts-result-list { list-style: none; padding: 0; margin: 8px 0; color: var(--muted); }
.ts-result-list b { color: var(--cream); }

/* Multi-currency */
.ts-trait .cap .price .cur { opacity: .7; }
.ts-trait .cap .price .cur.on { opacity: 1; color: var(--orange-light); }
.ts-paywith { margin: 10px 0 4px; }
.ts-paywith-label { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ts-paychips { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.ts-paychip {
  display: flex; align-items: center; gap: 9px; text-align: left; cursor: pointer;
  background: var(--panel-2); color: var(--cream); font: inherit;
  border: 1.5px solid var(--line-strong); border-radius: 12px; padding: 9px 11px;
  transition: border-color .12s, background .12s, transform .12s;
}
.ts-paychip:hover { border-color: var(--orange-light); transform: translateY(-1px); }
.ts-paychip:focus-visible { outline: 2px solid var(--orange-light); outline-offset: 2px; }
.ts-paychip.on { border-color: var(--orange); background: rgba(222,122,31,.16); box-shadow: 0 0 0 1px rgba(222,122,31,.35) inset; }
.ts-paychip .txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.ts-paychip small { font-size: 10px; font-weight: 800; letter-spacing: .08em; color: var(--muted); }
.ts-paychip b { font-size: 15px; font-weight: 900; color: var(--cream); white-space: nowrap; }
.ts-paychip.on small { color: var(--orange-light); }
.ts-paychip .ico { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 14px; color: #0e2a10; }
.ts-paychip .ico-dkv { background: #2b241d url(../images/dkv-coin.webp) center / cover no-repeat; }
.ts-paychip .ico-sol { background: linear-gradient(135deg, #9945ff 0%, #14f195 100%); }
.ts-paychip .ico-usd { background: var(--green); }
