:root {
  --bg: #0b0b0c;
  --bg-2: #121214;
  --bg-3: #1a1a1d;
  --line: #26262b;
  --fg: #ededed;
  --fg-2: #9a9aa3;
  --fg-3: #5f5f68;
  --accent: #d9ff5c;
  --accent-ink: #0b0b0c;
  --warn: #ffb257;
  --bad: #ff6a6a;
  --good: #7df5a2;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 4px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; }
[hidden] { display: none !important; }

/* ── header ─────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
}
.wordmark { font-family: var(--mono); font-size: 14px; letter-spacing: .04em; text-decoration: none; }
.wordmark .slash { color: var(--fg-3); margin: 0 2px; }
.tabs { display: flex; gap: 4px; margin-left: 8px; }
.tab {
  background: none; border: 1px solid transparent; border-radius: var(--radius);
  padding: 6px 12px; color: var(--fg-2); font-family: var(--mono); font-size: 12.5px; letter-spacing: .02em;
}
.tab:hover { color: var(--fg); }
.tab.is-active { color: var(--fg); border-color: var(--line); background: var(--bg-2); }
.wallet { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.badge { font-family: var(--mono); font-size: 11px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--fg-2); }
.badge.bad { color: var(--bad); border-color: var(--bad); }

/* ── buttons ────────────────────────────── */
.btn {
  border: 1px solid var(--line); background: var(--bg-2); border-radius: var(--radius);
  padding: 8px 14px; font-family: var(--mono); font-size: 12.5px; letter-spacing: .02em; white-space: nowrap;
}
.btn:hover { border-color: var(--fg-3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.05); border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--bad); }
.btn-sm { padding: 5px 10px; font-size: 11.5px; }

/* ── layout ─────────────────────────────── */
main { max-width: 1280px; margin: 0 auto; padding: 36px 24px 80px; }
.view { display: none; }
.view.is-active { display: block; }
.view-head { margin-bottom: 28px; max-width: 720px; }
h1 { font-size: 26px; font-weight: 500; letter-spacing: -.01em; margin: 0 0 10px; }
.lede { color: var(--fg-2); margin: 0 0 18px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.select, .input {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--fg); border-radius: var(--radius);
  padding: 7px 10px; font-family: var(--mono); font-size: 12.5px;
}
.select:focus, .input:focus { outline: none; border-color: var(--fg-3); }
.count { font-family: var(--mono); font-size: 12px; color: var(--fg-3); margin-left: auto; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.empty { grid-column: 1 / -1; color: var(--fg-3); font-family: var(--mono); font-size: 13px; padding: 40px 0; text-align: center; }

/* ── cards ──────────────────────────────── */
.card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  display: flex; flex-direction: column; transition: border-color .15s;
}
.card:hover { border-color: var(--fg-3); }
.card-media { aspect-ratio: 1; background: var(--bg-3); position: relative; cursor: pointer; }
.card-media img, .card-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-media .noimg { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: 11px; color: var(--fg-3); }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-collection { font-family: var(--mono); font-size: 10.5px; color: var(--fg-3); letter-spacing: .05em; text-transform: uppercase; }
.card-title { font-size: 14.5px; font-weight: 500; line-height: 1.3; }
.card-meta { font-family: var(--mono); font-size: 12px; color: var(--fg-2); display: flex; justify-content: space-between; gap: 8px; }
.card-range { color: var(--fg); }
.card-range.unset { color: var(--fg-3); }
.card-actions { margin-top: auto; padding-top: 8px; display: flex; gap: 8px; }
.pill { display: inline-block; font-family: var(--mono); font-size: 10.5px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--fg-2); }
.pill.open { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.pill.stale { color: var(--warn); border-color: var(--warn); }

/* ── drawer ─────────────────────────────── */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 100%);
  background: var(--bg); border-left: 1px solid var(--line); overflow-y: auto; padding: 28px 28px 48px;
}
.drawer-close { position: absolute; top: 14px; right: 16px; background: none; border: 0; font-size: 22px; color: var(--fg-2); }
.drawer-close:hover { color: var(--fg); }
.piece-media { aspect-ratio: 1; background: var(--bg-3); border-radius: 6px; overflow: hidden; margin-bottom: 18px; }
.piece-media img, .piece-media video { width: 100%; height: 100%; object-fit: contain; display: block; }
.piece-title { font-size: 20px; font-weight: 500; margin: 0 0 4px; }
.piece-sub { font-family: var(--mono); font-size: 12px; color: var(--fg-2); margin-bottom: 20px; display: flex; gap: 12px; flex-wrap: wrap; }
.piece-sub a { color: var(--fg-2); }
.section { border-top: 1px solid var(--line); padding: 18px 0; }
.section h3 { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); margin: 0 0 12px; font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-family: var(--mono); font-size: 11.5px; color: var(--fg-2); }
.field .input { width: 100%; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.hint { font-family: var(--mono); font-size: 11.5px; color: var(--fg-3); margin: 6px 0 0; }
.hint.warn { color: var(--warn); }

.offer { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-family: var(--mono); font-size: 12.5px; }
.offer:last-child { border-bottom: 0; }
.offer .amt { font-weight: 600; min-width: 90px; }
.offer .who { color: var(--fg-2); flex: 1; }
.offer .exp { color: var(--fg-3); font-size: 11px; }
.offer.dead { opacity: .4; text-decoration: line-through; }
.offer.mine .who::after { content: " (you)"; color: var(--accent); }

.range-display { font-family: var(--mono); font-size: 18px; margin-bottom: 4px; }

/* ── activity ───────────────────────────── */
.activity { list-style: none; margin: 0; padding: 0; max-width: 820px; }
.activity li { display: grid; grid-template-columns: 90px 1fr auto; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12.5px; align-items: baseline; }
.activity .kind { color: var(--fg-3); text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; }
.activity .kind.sale { color: var(--good); }
.activity .kind.offer { color: var(--accent); }
.activity .what a { color: var(--fg); text-decoration: none; }
.activity .what a:hover { text-decoration: underline; }
.activity .when { color: var(--fg-3); font-size: 11px; }

/* ── toast / footer ─────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 6px; padding: 10px 16px;
  font-family: var(--mono); font-size: 12.5px; max-width: 90vw;
}
.toast.err { border-color: var(--bad); color: var(--bad); }
.toast.ok { border-color: var(--good); }
.foot { border-top: 1px solid var(--line); padding: 18px 24px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-family: var(--mono); font-size: 11px; color: var(--fg-3); }
.foot a { color: var(--fg-2); }
.mono { font-family: var(--mono); }

@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .tabs { order: 3; width: 100%; margin-left: 0; overflow-x: auto; }
  main { padding: 24px 16px 60px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .drawer-panel { padding: 22px 18px 40px; }
}

/* v2: edition quantity input inside bid rows */
.input-qty { width: 64px; padding: 4px 6px; margin-right: 6px; }
.offer .amt small { color: var(--fg-3); font-weight: 400; }
.tab-link { text-decoration: none; display: inline-flex; align-items: center; }

/* dither background: canvas (dither.js) sits at z-index -1 under the page; html carries the base colour */
html { background: var(--bg); }
body { background: transparent; }
main, .foot { position: relative; }
/* soft scrim: a fixed vignette that dims the dither behind the content column (no hard boxes) */
main::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 62% 75% at 50% 42%, color-mix(in srgb, var(--bg) 62%, transparent) 0%, color-mix(in srgb, var(--bg) 30%, transparent) 55%, transparent 85%);
}
