:root {
  --bg: #f6f4ee; --card: #fffdf8; --ink: #1d1f22; --dim: #6b6d70; --line: #dedad0;
  --link: #1f5fbf; --hi: #2c7a4b; --mid: #9a6a12; --lo: #b0412b; --boost: #f3ead2;
  --font: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15171a; --card: #1c1f23; --ink: #e6e3da; --dim: #9a9890; --line: #30343a;
          --link: #7fb0ff; --hi: #6cc58f; --mid: #e0b45a; --lo: #f08a72; --boost: #2a2717; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.15rem; font-weight: 600; margin: .6em 0 .3em; }
h2 { font-size: 1rem; font-weight: 600; margin: 1.6em 0 .3em; }
main { max-width: 72ch; margin: 0 auto; padding: 0 14px; }

.demo { background: var(--ink); color: var(--bg); text-align: center; font-size: 12px; padding: 3px; }
.top { max-width: 72ch; margin: 0 auto; padding: 12px 14px 6px; display: flex; align-items: baseline; gap: 10px; }
.brand { font-weight: 600; font-size: 1.1rem; color: var(--ink); }
.where { color: var(--dim); font-size: 13px; }
.topnav { display: none; margin-left: auto; gap: 16px; }
.topnav a.on, .tabs a.on { color: var(--ink); font-weight: 600; }

.tabbar { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); border-top: 1px solid var(--line);
          padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabbar a { flex: 1; text-align: center; padding: 8px 0 10px; color: var(--dim); font-size: 12px; min-height: 52px; }
.tabbar a b { display: block; font-size: 18px; line-height: 1.3; font-weight: 400; }
.tabbar a.on { color: var(--ink); }
.foot { max-width: 72ch; margin: 30px auto 10px; padding: 0 14px; color: var(--dim); font-size: 13px; }

@media (min-width: 720px) {
  body { font-size: 16px; padding-bottom: 0; }
  .topnav { display: flex; }
  .tabbar { display: none; }
}

.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin: 6px 0 0; }
.tabs a { padding: 10px 0 8px; color: var(--dim); }
.tabs a.on { border-bottom: 2px solid var(--ink); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0; scrollbar-width: none; }
.chips a { white-space: nowrap; padding: 5px 10px; border: 1px solid var(--line); border-radius: 99px; color: var(--dim); font-size: 13px; }
.chips a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.note { color: var(--dim); font-size: 13px; }
.empty { color: var(--dim); padding: 30px 0; }
.warn { border-left: 3px solid var(--mid); padding: 6px 10px; background: var(--card); font-size: 13px; }
.label { color: var(--dim); font-size: 12px; text-transform: lowercase; letter-spacing: .02em; margin: 18px 0 6px; }

/* listing rows: stacked on phones, columns on desktop */
.list { border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 7ch 1fr; gap: 0 10px; padding: 12px 2px; border-bottom: 1px solid var(--line); color: var(--ink); }
.row:hover { text-decoration: none; background: var(--card); }
.row.boosted { background: var(--boost); }
.row.sold { opacity: .55; }
.row .price { font-weight: 600; }
.row .body { display: flex; flex-direction: column; min-width: 0; }
.row .title { overflow: hidden; text-overflow: ellipsis; }
.row .meta, .row .trust { font-size: 13px; color: var(--dim); }
.iso { font-weight: 600; color: var(--mid); }
.spons { color: var(--mid); }
.aud { color: var(--hi); }
.t-hi { color: var(--hi); } .t-mid { color: var(--mid); } .t-lo { color: var(--lo); } .t-you { color: var(--dim); }
.pro { font-size: 12px; border: 1px solid var(--mid); color: var(--mid); padding: 0 5px; border-radius: 3px; vertical-align: middle; }

.listing .crumb { color: var(--dim); font-size: 13px; margin: 12px 0 0; }
.bigprice { font-size: 1.3rem; font-weight: 600; margin: 0 0 10px; }
.photos { display: flex; gap: 8px; overflow-x: auto; margin: 10px 0; scroll-snap-type: x mandatory; }
.photos a { flex: 0 0 auto; scroll-snap-align: start; }
.photos img { display: block; height: 260px; width: auto; max-width: 88vw; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.text { margin: 12px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 2px 14px 12px; margin: 16px 0; }
pre.tree, p.tree { font: inherit; font-size: 14px; white-space: pre-wrap; margin: 6px 0; overflow-wrap: anywhere; }
.who { font-weight: 600; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
.actions form { margin: 0; }
button { font: inherit; font-size: 14px; min-height: 44px; padding: 8px 16px; border-radius: 6px; cursor: pointer;
         background: var(--ink); color: var(--bg); border: 1px solid var(--ink); }
button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
button.ghost.on { border-color: var(--hi); color: var(--hi); }
button:disabled { opacity: .5; cursor: default; }

.replies .reply { border-bottom: 1px solid var(--line); padding: 8px 0; }
.reply p { margin: 2px 0; }
.reply.by-seller { border-left: 3px solid var(--hi); padding-left: 10px; }
.reply .meta { font-size: 13px; color: var(--dim); }
.replyform { display: flex; gap: 8px; margin: 10px 0; align-items: flex-end; }
textarea, input, select { font: inherit; font-size: 16px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; width: 100%; }
.replyform textarea { flex: 1; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--dim); }
.stack label:has(> input[type=radio]), .stack label:has(> input[type=checkbox]) { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
input[type=radio], input[type=checkbox] { width: 20px; height: 20px; flex: none; }
.stack small { color: var(--dim); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; gap: 18px; }
fieldset { border: 1px solid var(--line); border-radius: 6px; display: flex; flex-direction: column; gap: 8px; }
legend { font-size: 13px; color: var(--dim); padding: 0 4px; }
.boost { background: var(--boost); padding: 10px; border-radius: 6px; }

.searchbar { display: flex; gap: 8px; margin: 14px 0; }
.oauth { display: flex; flex-direction: column; gap: 8px; max-width: 340px; }
.persona { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.persona button { flex: none; min-width: 15ch; }
.persona .meta { font-size: 13px; color: var(--dim); }
.profile .meta { color: var(--dim); font-size: 13px; }
.prose p { max-width: 68ch; }
.price-table { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 12px; overflow-x: auto; white-space: pre !important; }
.price-table { font-size: 12px !important; }
@media (min-width: 720px) { .price-table { font-size: 14px !important; } }

/* links styled as buttons */
a.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 6px; font-size: 14px;
        background: var(--ink); color: var(--bg); border: 1px solid var(--ink); }
a.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
a.btn:hover { text-decoration: none; }
.actions .full { flex-basis: 100%; margin: 0; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--lo); color: #fff;
         font-size: 11px; line-height: 18px; text-align: center; font-weight: 600; vertical-align: middle; }
.tabbar b { position: relative; }
.tabbar b .badge { position: absolute; top: -2px; margin-left: -4px; }

/* messages */
.crumb { font-size: 13px; margin: 12px 0 4px; }
.row.mini { border-top: 1px solid var(--line); }
.who-line { font-size: 13px; color: var(--dim); margin: 8px 0; }
.chat { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.msg { max-width: 85%; padding: 8px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.msg p { margin: 0; overflow-wrap: anywhere; }
.msg .meta { font-size: 11px; color: var(--dim); }
.msg.mine { align-self: flex-end; background: var(--ink); color: var(--bg); border-color: var(--ink); }
.msg.mine .meta { color: var(--bg); opacity: .6; }
.msg.sys { align-self: center; max-width: 95%; background: transparent; border-style: dashed; font-size: 13px; color: var(--dim); text-align: center; }
.deal form { display: inline-block; margin: 4px 8px 4px 0; }
.deal form.replyform { display: flex; }
.row.thread.unread .title { font-weight: 600; }

.scam { border-left: 3px solid var(--lo); background: var(--card); padding: 8px 10px; font-size: 13px; margin: 6px 0; border-radius: 0 6px 6px 0; }
.chat .scam { max-width: 85%; }

.degsel a { display: inline-block; padding: 2px 9px; margin: 0 1px; border: 1px solid var(--line); border-radius: 99px; color: var(--dim); }
.degsel a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.audform { flex-basis: 100%; }
.audform label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--dim); }

/* feed thumbnails: small, on the right, only when there is a photo */
.row.has-thumb { grid-template-columns: 7ch 1fr 64px; }
.row .thumb { width: 64px; height: 64px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line); align-self: start; background: var(--card); }
.row.sold .thumb { filter: grayscale(1); }
@media (min-width: 720px) { .row.has-thumb { grid-template-columns: 8ch 1fr 76px; } .row .thumb { width: 76px; height: 76px; } }
.previews { display: flex; gap: 6px; flex-wrap: wrap; }
.previews img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

.degslider { margin: 4px 0 10px; font-size: 13px; color: var(--dim); }
.degslider input[type=range] { width: 100%; padding: 0; border: 0; background: transparent; accent-color: var(--ink); height: 28px; }
.degslider .ticks { display: flex; justify-content: space-between; font-size: 12px; margin-top: -4px; }
.degslider .note { margin: 6px 0 0; }
