/* Worlds Within Market. Tokens follow worldswithin.gg (dark, purple and gold). */
:root {
  --bg: #0d0d0e;
  --panel: #15161d;
  --panel-2: #1b1c25;
  --brand: #7d4f7d;
  --mint: #ffd447;
  --peach: #eebbc3;
  --ink: #f2f3f2;
  --sub: #b4b7b4;
  --muted: rgba(242, 243, 242, 0.62);
  --line: rgba(242, 243, 242, 0.12);
  --display: "Raleway", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.55 var(--mono);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); padding: 6px 10px; border-radius: 6px; }
.skip:focus { left: 8px; z-index: 10; }

/* header / footer */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px var(--gutter);
  background: rgba(18, 18, 20, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 400 18px var(--display); }
.brand b { color: var(--mint); font-weight: 600; }
.pill {
  font-size: 12px; color: var(--peach);
  border: 1px solid rgba(255, 179, 138, 0.4); border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
main { flex: 1; width: 100%; max-width: 1320px; margin: 0 auto; padding: 24px var(--gutter) 48px; }
main:focus { outline: none; }
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding: 18px var(--gutter); border-top: 1px solid var(--line); color: var(--muted); font-size: 12px;
}
.loading, .empty, .error { color: var(--muted); padding: 24px 0; }
.error { color: var(--peach); }

/* home */
.hero { padding: 12px 0 28px; max-width: 720px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); }
.hero h1 em { font-style: normal; color: var(--mint); }
.hero p { color: var(--sub); margin: 10px 0 0; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
  display: flex; flex-direction: column; text-decoration: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: rgba(61, 191, 79, 0.5); transform: translateY(-2px); }
.card .art { aspect-ratio: 16 / 10; background: var(--panel-2) center / cover no-repeat; }
.card .body { padding: 14px 16px 16px; display: grid; gap: 10px; }
.card h2 { font-size: 19px; }
.card p { margin: 0; color: var(--sub); font-size: 13px; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kv div { min-width: 0; }
.kv dt, .stat dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.kv dd, .stat dd { margin: 2px 0 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dl { margin: 0; }

/* collection */
.crumbs { color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.chead { display: grid; grid-template-columns: 96px 1fr; gap: 18px; align-items: center; margin-bottom: 20px; }
.chead .avatar { width: 96px; height: 96px; border-radius: 14px; background: var(--panel-2) center / cover; border: 1px solid var(--line); }
.chead h1 { font-size: clamp(24px, 4vw, 34px); }
.chead p { margin: 6px 0 0; color: var(--sub); }
.badge { display: inline-block; font-size: 11px; color: var(--mint); border: 1px solid rgba(255, 212, 71, .45); border-radius: 6px; padding: 1px 6px; margin-left: 8px; vertical-align: middle; font-family: var(--mono); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 22px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a {
  padding: 10px 14px; text-decoration: none; color: var(--sub); border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--mint); }
.browse { display: grid; grid-template-columns: 250px 1fr; gap: 22px; align-items: start; }
.filters { position: sticky; top: 72px; max-height: calc(100vh - 90px); overflow: auto; padding-right: 4px; }
.filters > summary { display: none; }
.filters details.trait { border-bottom: 1px solid var(--line); }
.filters details.trait summary { cursor: pointer; padding: 9px 0; display: flex; justify-content: space-between; text-transform: capitalize; }
.filters details.trait summary span { color: var(--muted); font-size: 12px; }
.filters label { display: flex; gap: 8px; align-items: center; padding: 3px 0; color: var(--sub); font-size: 13px; cursor: pointer; }
.filters label small { margin-left: auto; color: var(--muted); }
.filters input[type=checkbox] { accent-color: var(--brand); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search], .toolbar select {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0;
}
.toolbar input[type=search] { flex: 1 1 200px; }
.toolbar label.toggle { display: flex; gap: 6px; align-items: center; color: var(--sub); white-space: nowrap; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.chip:hover { border-color: var(--peach); }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.item { text-decoration: none; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.item:hover { border-color: rgba(61, 191, 79, 0.5); }
.item .art { aspect-ratio: 1; background: var(--panel-2) center / cover no-repeat; }
.item .art img { width: 100%; height: 100%; object-fit: cover; }
.item .meta { padding: 9px 10px 11px; display: grid; gap: 2px; }
.item .name { font-family: var(--display); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .price { color: var(--mint); font-weight: 500; }
.item .price.none { color: var(--muted); font-weight: 400; }
.item .sub { color: var(--muted); font-size: 12px; }
.more { display: block; margin: 20px auto 0; }
.btn {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 16px; cursor: pointer;
}
.btn:hover { border-color: var(--mint); }
.btn.primary { background: var(--brand); border-color: var(--brand); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* tables (activity, offers) */
.rows { width: 100%; border-collapse: collapse; }
.rows th { text-align: left; color: var(--muted); font-weight: 400; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 0 10px 8px; }
.rows td { padding: 9px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.rows td.num { text-align: right; white-space: nowrap; }
.rows .thumb { width: 36px; height: 36px; border-radius: 6px; background: var(--panel-2) center / cover; flex: none; }
.rows .what { display: flex; gap: 10px; align-items: center; min-width: 0; }
.rows .what a { text-decoration: none; }
.who { color: var(--sub); }
.ours { color: var(--peach); }
.note { color: var(--muted); font-size: 12px; margin-top: 10px; }

/* item page */
.itempage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.itempage .bigart { border-radius: 14px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--line); aspect-ratio: 1; }
.itempage .bigart img { width: 100%; height: 100%; object-fit: contain; }
.artcol { display: grid; gap: 10px; align-content: start; min-width: 0; }
.artcol .note { margin: 0; }
.bigart iframe { display: block; width: 100%; height: 100%; border: 0; background: #000; }
.bigart.live { border-color: rgba(61, 191, 79, .5); }
.worldbar { display: flex; flex-wrap: wrap; gap: 8px; }
.worldbar a.btn { text-decoration: none; }
.itempage h1 { font-size: clamp(26px, 4vw, 38px); margin: 6px 0 14px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.box h2 { font-size: 15px; margin-bottom: 10px; color: var(--sub); }
.price-big { font: 600 30px var(--display); color: var(--mint); }
.traits { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.trait { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.trait dt { color: var(--muted); font-size: 11px; text-transform: capitalize; }
.trait dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.trait small { color: var(--muted); display: block; font-size: 11px; }
.chain { list-style: none; margin: 0; padding: 0; }
.chain li { position: relative; padding: 0 0 14px 22px; }
.chain li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); }
.chain li::after { content: ""; position: absolute; left: 8.5px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.chain li:last-child::after { display: none; }
.chain .how { font-weight: 500; }
.chain .when { color: var(--muted); font-size: 12px; }
.mono-short { font-family: var(--mono); }
.itempage.lower { margin-top: 8px; }

/* buying */
.buy { margin-top: 12px; display: grid; gap: 10px; }
.buy .note, .buy .error, .buy .ok, .buy .loading { margin: 0; padding: 0; }
.buy-go { justify-self: start; font-size: 15px; padding: 11px 22px; }
.wallets { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.wallet { display: inline-flex; align-items: center; gap: 8px; }
.btn.wallet img { width: 18px; height: 18px; border-radius: 4px; }
.linkish { background: none; border: 0; padding: 0; color: var(--sub); text-decoration: underline; cursor: pointer; font-size: inherit; }
.linkish:hover { color: var(--ink); }
.confirm { display: grid; gap: 10px; border: 1px solid rgba(255, 212, 71, .45); border-radius: var(--radius); padding: 12px 14px; background: var(--panel-2); }
.confirm .sum div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.confirm .sum dt { color: var(--muted); }
.confirm .sum dd { margin: 0; white-space: nowrap; }
.confirm .sum .total { font: 600 20px var(--display); color: var(--mint); }
.confirm .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ok { color: var(--mint); }

/* drift mode: one listed world after another, full screen */
.drift-go { display: inline-block; margin-top: 14px; text-decoration: none; }
body.drifting main { max-width: none; padding: 0; }
body.drifting .foot { display: none; }
.drift { position: relative; height: calc(100dvh - 53px); min-height: 420px; overflow: hidden; background: #000; }
.drift .stage { position: absolute; inset: 0; }
.drift .stage > p { padding: 24px var(--gutter); }
.drift .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(14px) brightness(.55); transform: scale(1.06); }
.drift iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity .6s; }
.drift iframe.on { opacity: 1; }
/* The world takes drags and keys everywhere except on the controls themselves. */
.dinfo, .dbar, .drawer { position: absolute; z-index: 2; pointer-events: none; }
.dinfo > *, .dbar > *, .drawer { pointer-events: auto; }
.dinfo {
  top: 14px; left: var(--gutter); display: grid; gap: 2px; max-width: min(420px, calc(100% - 2 * var(--gutter)));
  background: rgba(18, 18, 20, .72); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px;
}
.dexit { color: var(--muted); font-size: 12px; text-decoration: none; justify-self: start; }
.dexit:hover { color: var(--ink); }
.dname { font: 600 20px var(--display); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dname:hover { color: var(--mint); }
.dprice { color: var(--mint); font-weight: 500; }
.dhint { color: var(--muted); font-size: 11px; }
.dbar { bottom: 18px; left: var(--gutter); right: var(--gutter); display: flex; flex-wrap: wrap; gap: 8px; }
.dbar .btn { font-size: 15px; padding: 11px 20px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
.dbar .btn:not(.primary) { background: rgba(32, 32, 36, .88); }
.dbar a.btn { text-decoration: none; }
.drawer {
  left: var(--gutter); bottom: 76px; width: min(400px, calc(100% - 2 * var(--gutter))); max-height: calc(100% - 110px); overflow: auto;
  display: grid; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
.drawer[hidden] { display: none; }
.drawer .buy { margin-top: 0; }
.drawer .linkish { justify-self: end; font-size: 12px; }
.art, .avatar, .thumb { overflow: hidden; }
.art img, .avatar img, .thumb img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 860px) {
  .browse { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px; }
  .filters > summary { display: block; cursor: pointer; padding: 10px 0; }
  .itempage { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 560px) {
  .chead { grid-template-columns: 64px 1fr; gap: 12px; }
  .chead .avatar { width: 64px; height: 64px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kv { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rows .hide-sm { display: none; }
  .pill { display: none; }
  /* leave the world's own VR button (bottom right) clear */
  .dbar { right: 84px; }
  .dbar .btn { padding: 10px 14px; font-size: 14px; }
  .dbar .dvr { display: none; }
  .dname { font-size: 17px; }
  .drawer { left: var(--gutter); right: var(--gutter); width: auto; bottom: 120px; }
}
