:root {
  --bg: #0d1117; --panel: #161b22; --line: #30363d; --fg: #e6edf3; --muted: #8b949e;
  /* BigRed accent: deep-red FILLS (--accent) carry white text (--accent-fg); a brighter red (--link) is used
     for text + borders on the dark background, where the deep red alone would be too low-contrast. */
  --accent: #e01e28; --accent-fg: #ffffff; --link: #ff5d5d;
  /* CTA colour for the primary purchase actions — red reads as "danger/stop", the wrong signal on a Buy button.
     Red stays the brand/identity colour (logo, links, active filters); the buy/list actions use a glowing-ember
     orange (on-theme with the Fire Horse, and a proven high-converting CTA) with near-black text for contrast. */
  --cta: #ff7518; --cta-fg: #2a1000;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
a { color: var(--link); text-decoration: none; }

.site-head { text-align: center; padding: 40px 16px 24px; }
.brand { margin: 0; font-size: 28px; letter-spacing: -0.3px; display: inline-flex; align-items: center; gap: 9px; }
.brand-horse { height: 32px; width: auto; }
.tagline { margin: 6px 0 0; color: var(--muted); }
.howto { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.fund { margin: 8px 0 0; font-size: 13px; }

main { max-width: 1080px; margin: 0 auto; padding: 0 16px 48px; }
/* Content-type category bar (Audio / Images / … — only shown when ≥2 categories exist) */
.cats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 0 0 14px; }
.cats:empty { display: none; }
.chip {
  background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 13px; font-size: 13px; cursor: pointer;
}
.chip:hover { border-color: var(--link); }
.chip.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
.chip .n { opacity: .6; font-weight: 400; margin-left: 4px; }
.chip.active .n { opacity: .85; }
/* Hashtag search + "popular hashtags" chips */
.tagbar { display: flex; flex-direction: column; align-items: center; gap: 9px; margin: 0 0 16px; }
.tagbar[hidden] { display: none; }
.tag-search {
  width: min(360px, 90%); background: var(--panel); color: var(--fg); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 15px; font-size: 13px;
}
.tag-search:focus { outline: none; border-color: var(--link); }
.poptags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.poptags:empty { display: none; }
.poptags .chip { font-size: 12px; padding: 3px 11px; color: var(--muted); }
.poptags .chip:hover { color: var(--fg); }
.poptags .chip.active { color: var(--accent-fg); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
/* Per-card tags */
.card .tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0 0; }
.card .tag { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; font-size: 11px; cursor: pointer; }
.card .tag:hover { color: var(--link); border-color: var(--link); }
/* Validated-genesis badge — a small pill showing the verified genesis + issue date, linking to WhatsOnChain. */
.card .genesis { color: var(--muted); font-size: 11.5px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; line-height: 1.7; white-space: nowrap; }
.card .genesis:hover { color: #3fb950; border-color: #3fb950; }
/* Badge row — validated-genesis + "sold" pills together. */
.card .badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 2px 0 0; }
.card .sold { color: #ff8c42; font-size: 11.5px; font-weight: 600; border: 1px solid rgba(255, 140, 66, .5); border-radius: 999px; padding: 1px 9px; line-height: 1.7; white-space: nowrap; }
/* Sort control (Most sold / Newest / Price) between the category filters and the grid. */
.sortbar { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.sortbar[hidden] { display: none; }
.sortbar select { background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: 13px; cursor: pointer; }
.sortbar select:hover { border-color: var(--link); }
.empty { color: var(--muted); text-align: center; grid-column: 1 / -1; padding: 40px 0; }
.empty code { background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.card .cover-box { position: relative; }
.card .cover { display: block; aspect-ratio: 1 / 1; background: #0b0e13; }
.card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Mockup composite canvas — fills the cover like an img; fades in when the browser finishes compositing. */
.card .cover canvas.cover-cv { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .25s ease; }
.card .cover canvas.cover-cv.ready { opacity: 1; }
/* Prop switcher (mix-and-match on the spotlight): tap a swatch to re-composite the hero cover with that prop. */
.prop-switcher { margin: 12px 0 4px; }
.prop-switcher-label { display: block; margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.prop-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.prop-swatch { width: 66px; height: 66px; padding: 0; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--panel); transition: border-color .15s ease; }
.prop-swatch:hover { border-color: var(--link); }
.prop-swatch.active { border-color: var(--accent); }
.prop-swatch-cv { width: 100%; height: 100%; object-fit: cover; display: block; }
/* The BACK is shown WHOLE (contain), not cropped: it's typically a text-heavy blurb at book proportions, so
   cropping to the square card would cut the text. A portrait/landscape back letterboxes on the dark face. */
.card .cover-back img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* Back-cover 3D flip (only cards with a back cover). The rotation animates so the flip gives instant feedback
   while the large back image downloads. */
.card .cover-box.has-back { perspective: 900px; }
.card .cover-box.has-back .cover-inner { position: relative; aspect-ratio: 1 / 1; transform-style: preserve-3d; transition: transform .55s ease; }
.card .cover-box.has-back .cover-inner > .cover, .card .cover-box.has-back .cover-back {
  position: absolute; inset: 0; aspect-ratio: auto; backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.card .cover-box.has-back .cover-back { transform: rotateY(180deg); background: #0b0e13; }
.card .cover-box.has-back.flipped .cover-inner { transform: rotateY(180deg); }
.card .cover-flip {
  position: absolute; top: 8px; right: 8px; z-index: 3; width: 30px; height: 30px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.55);
  color: #fff; font-size: 15px; line-height: 1; cursor: pointer; backdrop-filter: blur(4px);
}
.card .cover-flip:hover { background: rgba(0,0,0,.75); }
.card .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h2 { margin: 0; font-size: 16px; }
.card h2 a { color: inherit; text-decoration: none; cursor: pointer; }
.card h2 a:hover { color: var(--link); }
.card .cover { cursor: pointer; }
/* Clamp long descriptions to ~5 lines so every card is a uniform height (the full text lives on the listing
   page). The price row is pinned to the card bottom via margin-top:auto below, so short + long descriptions
   still line their prices up. */
.card .desc {
  /* Clamp to ~5 lines by MAX-HEIGHT, not -webkit-box/-webkit-line-clamp: as a flex-item child, that display
     collapses the note to zero height in current Chromium/Brave/Firefox — the bug that hid every seller note. */
  margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4;
  max-height: 7em; overflow: hidden;
}
.card .row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 6px; }
.card .price { font-weight: 600; font-size: 14px; }
.card .price .sub { display: block; color: var(--muted); font-weight: 400; font-size: 11px; margin-top: 1px; }
.card .buy {
  background: var(--cta); color: var(--cta-fg); font-weight: 700; font-size: 13px;
  padding: 7px 12px; border-radius: 8px; white-space: nowrap;
}
.card .copylink {
  margin-top: 8px; width: 100%; background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
  font-size: 12px; cursor: pointer; transition: border-color .15s, color .15s;
}
.card .copylink:hover { border-color: var(--link); color: var(--fg); }
.card .copylink.ok { color: #3fb950; border-color: #3fb950; }
.card .preview { margin: 0 0 8px; }
.card .preview-btn {
  width: 100%; background: var(--panel); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .15s, color .15s;
}
.card .preview-btn:hover { border-color: var(--accent); color: var(--accent); }
.card .preview-audio { width: 100%; height: 34px; }
.card .preview-dl { display: inline-block; margin-top: 5px; font-size: 12px; color: var(--muted); text-decoration: none; }
.card .preview-dl:hover { color: var(--link); }

/* Shared-link spotlight: a large, highlighted hero for the NFT someone shared, sitting above the browsable
   catalog. Reuses a normal .card but renders it large + horizontal with the full (unclamped) description. */
.focus {
  margin: 0 0 24px; padding: 14px; border: 1px solid var(--accent); border-radius: 16px;
  background: linear-gradient(180deg, rgba(224, 30, 40, .10), rgba(224, 30, 40, 0) 72%), var(--panel);
  box-shadow: 0 0 0 1px rgba(224, 30, 40, .22), 0 16px 44px rgba(0, 0, 0, .45);
}
.focus-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 4px 12px; }
.focus-badge { color: var(--link); font-weight: 700; font-size: 13px; letter-spacing: .3px; }
.focus-close {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 13px; font-size: 12px; cursor: pointer;
}
.focus-close:hover { border-color: var(--link); color: var(--fg); }
.focus .card { border: none; background: transparent; border-radius: 0; overflow: visible; }
.focus .card h2 { font-size: 22px; }
.focus .card .desc { max-height: none; font-size: 14px; }
.focus .card .buy { font-size: 15px; padding: 10px 18px; }
@media (min-width: 680px) {
  .focus .card { flex-direction: row; gap: 20px; align-items: stretch; }
  .focus .card .cover-box { width: 320px; flex: none; align-self: flex-start; }
  /* Round the two flip FACES, never .cover-inner — overflow:hidden on the preserve-3d element flattens the 3D
     context, breaking backface-visibility (the flipped front then shows mirrored). */
  .focus .card .cover, .focus .card .cover-back { border-radius: 12px; overflow: hidden; }
  .focus .card .body { padding: 4px 4px 4px 0; }
}

.sell {
  max-width: 720px; margin: 32px auto 8px; padding: 22px 18px; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
}
.sell h2 { margin: 0 0 6px; font-size: 18px; }
.sell p { margin: 0 auto; color: var(--muted); font-size: 14px; max-width: 52ch; }
.sell-cta {
  display: inline-block; margin: 14px 0 4px; background: var(--cta); color: var(--cta-fg);
  font-weight: 700; font-size: 14px; padding: 10px 18px; border-radius: 10px;
}
.sell-key { font-size: 12px !important; margin-top: 12px !important; }
.sell-key code { word-break: break-all; color: var(--fg); font-size: 11px; }
.sell-copy {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 8px; font-size: 11px; cursor: pointer; margin-left: 4px;
}
.sell-copy:hover { border-color: var(--link); color: var(--fg); }

.site-foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 48px; border-top: 1px solid var(--line); }
.scroll-sentinel { height: 1px; width: 100%; }
.woc-badge { height: 48px; width: auto; opacity: .85; margin-bottom: 8px; }
.woc-badge:hover { opacity: 1; }
.bb-badge { display: flex; align-items: center; justify-content: center; gap: 9px; margin-bottom: 10px; font-size: 13px; color: var(--muted); font-weight: 600; text-decoration: none; }
.bb-badge .bb-logo { height: 40px; width: auto; border-radius: 6px; }
.bb-badge .bb-word { color: #ffce1f; font-weight: 800; letter-spacing: -.2px; font-size: 16px; }
.bb-badge:hover .bb-word { text-decoration: underline; }
.site-foot p { margin: 4px 0; }
.site-foot .flavour { font-size: 12px; opacity: 0.8; }
