/* ════════════════════════════════════════════════════════════════════════════
 * bagwork — shared "degen terminal" theme + early-pump.fun layout system.
 * One source of truth: palette, fonts, top utility bar, activity ticker,
 * hero / king-of-the-hill / search / pill row, dense card grid, panels,
 * plus the legacy post/form/table classes that JS-generated markup still emits.
 * Branding/aesthetics only — page logic & functional hooks are untouched.
 * ════════════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;

  /* ── degen terminal tokens ── */
  --bg:             #1b1d28;   /* near-black page background                    */
  --surface:        #181b23;   /* dark card/panel background                    */
  --surface-2:      #1f2430;   /* raised surface: table th, labels, zebra       */
  --border:         rgba(255,255,255,0.08);
  --text:           #d9dce3;
  --text-muted:     #8b93a1;
  --green:          #5fe08c;   /* links, tickers, amounts, active states        */
  --green-soft:     #7dbb92;   /* muted greentext quotes                        */
  --green-fill:     #9ff0bd;   /* pale mint fill for buttons/search             */
  --green-fill-ink: #0c2a1a;   /* dark green ink on mint fills                  */
  --orange:         #f5a623;   /* featured / "king of the hill" highlight       */
  --danger:         #f2a0a0;   /* soft red: warnings/errors/hover               */
  --chip-sell-bg:   #f2b8b8;  --chip-sell-ink: #5e1b1b;
  --chip-buy-bg:    #b9d2f5;  --chip-buy-ink:  #1c3a6b;

  /* ── legacy aliases (per-page <style> blocks reference these names) ── */
  --ffe:        var(--bg);
  --post:       var(--surface);
  --post-op:    var(--surface);
  --maroon:     var(--green);       /* titles/section headers/accents           */
  --name:       var(--green);       /* poster name green                        */
  --subject:    var(--text);        /* subject line: bright bold                */
  --greentext:  var(--green-soft);  /* >greentext quotes                        */
  --link:       var(--green);
  --link-hover: var(--danger);
  --muted:      var(--text-muted);
  --boardlist:  var(--surface);
  --btn-face:   var(--green-fill);
  --highlight:  #1c2a21;            /* dark green-tinted post highlight         */
  --highlight-border: rgba(95,224,140,0.4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ffe);
  color: var(--text);
  font-family: Verdana, Geneva, system-ui, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.35;
  word-wrap: break-word;
}

body { position: relative; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--green-fill); }

hr {
  border: none;
  border-top: 1px solid var(--border);
  height: 0;
  margin: 8px 0;
  clear: both;
}

.mono { font-family: 'Courier New', monospace; }
.center { text-align: center; }
.clear { clear: both; }
.nowrap { white-space: nowrap; }

/* ── top utility bar ─────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.topbar .links { display: flex; flex-wrap: wrap; gap: 2px 4px; align-items: center; }
.topbar a { color: var(--green); padding: 0 1px; }
.topbar a:hover { color: var(--green-fill); }
.topbar .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
@media (max-width: 640px) { .topbar .right { margin-left: 0; } }

/* ── activity ticker (chips of recent bagwork events) ─────────────────── */
.ticker {
  overflow: hidden;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  padding: 4px 0;
}
.ticker-track {
  display: inline-flex;
  gap: 6px;
  padding-left: 8px;
  animation: tickerScroll 45s linear infinite;
  will-change: transform;
}
.ticker.paused .ticker-track { animation: none; }
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes tickerScroll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: bold;
  padding: 1px 9px;
  border-radius: 9999px;
  white-space: nowrap;
}
.chip.buy  { background: var(--chip-buy-bg);  color: var(--chip-buy-ink); }
.chip.sell { background: var(--chip-sell-bg); color: var(--chip-sell-ink); }
.chip.job  { background: var(--green-fill);   color: var(--green-fill-ink); }
.chip .mono { font-family: 'Courier New', monospace; }

/* ── hero: logo + tagline + centered bracket CTA ─────────────────────────── */
.hero { text-align: center; margin: 16px auto 6px; }
.brand { display: inline-block; text-align: center; line-height: 0; }
.brandLogo { width: 300px; max-width: 80%; height: auto; }
.hero .brandLogo { width: 320px; max-width: 84%; }
@media (max-width: 560px) { .brandLogo { width: 220px; } }

.boardSubtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
  margin: 4px 0 6px;
}

.cta-bracket {
  display: inline-block;
  font-size: 16px;
  font-weight: bold;
  color: var(--green);
  margin: 8px 0 4px;
}
.cta-bracket:hover { color: var(--green-fill); }
.hero-art { display: block; margin: 8px auto 0; }

/* ── king of the hill ────────────────────────────────────────────────────── */
.koth { text-align: center; margin: 14px auto 6px; }
.koth-label {
  color: var(--orange);
  font-weight: bold;
  font-style: italic;
  font-size: 13px;
  margin-bottom: 6px;
}
.koth-card {
  display: inline-flex;
  align-items: center;
  text-align: left;
  gap: 12px;
  background: var(--highlight);
  border: 1px solid rgba(245,166,35,0.5);
  padding: 8px 14px;
  max-width: 480px;
}
.koth-card img { width: 72px; height: 72px; object-fit: contain; flex: none; }
.koth-card .koth-code { color: var(--green); font-weight: bold; font-family: 'Courier New', monospace; }
.koth-card .koth-share { color: var(--orange); font-weight: bold; font-style: italic; }
.koth-card .koth-meta { color: var(--text-muted); font-size: 11px; }

/* ── centered search ─────────────────────────────────────────────────────── */
.searchwrap { display: flex; justify-content: center; margin: 12px auto 4px; padding: 0 10px; }
.searchwrap form { display: flex; gap: 6px; width: 100%; max-width: 520px; }
.searchwrap input { flex: 1; }

/* ── sort / filter pill row ──────────────────────────────────────────────── */
.pillrow {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px auto 14px;
  padding: 0 10px;
}
.pillrow label { display: inline-flex; align-items: center; gap: 5px; }
.pillrow .toggle[aria-pressed="false"] { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }

/* ── card grid + coin-card ───────────────────────────────────────────────── */
.board { max-width: 1100px; margin: 0 auto; padding: 0 8px 40px; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  align-items: start;
}
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } }

.card {
  display: flex;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px;
  min-width: 0;
  position: relative;
}
.card-thumb { width: 86px; height: 86px; object-fit: contain; object-position: top; flex: none; }
.card-body { flex: 1; min-width: 0; }
.card-title { color: var(--green); font-weight: bold; font-size: 13px; margin: 0 0 2px; }
.card-title a { color: var(--green); }
.card-meta { color: var(--text-muted); font-size: 11px; margin: 1px 0; }
.card p { margin: 4px 0; }
.card.wide { grid-column: 1 / -1; }
.card.highlight { background: var(--highlight); border-color: var(--highlight-border); }
.card.featured { border-color: rgba(245,166,35,0.5); }
/* legacy post containers dropped straight into a grid become cards */
.grid > .postReply, .grid > .reply, .grid > .opPost { margin: 0; }
.grid > .jb-empty { grid-column: 1 / -1; }

/* a section label row above grid areas */
.feed-label {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 8px 0 0;
}

/* terminal panel (forms / steps) */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 12px;
  margin: 8px 0;
}

/* ── legacy post containers (JS-generated markup still emits these) ──────── */
.thread { margin: 0 0 6px; }

.opPost {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 10px;
  margin: 8px 0;
}

.postReply,
.reply {
  display: block;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 10px 8px;
  margin: 8px 0;
}
.postReply::after, .reply::after, .opPost::after { content: ''; display: block; clear: both; }
.postReply.wide, .reply.wide { margin-left: 0; }
.postReply.highlight { background: var(--highlight); border-color: var(--highlight-border); }

.postInfo {
  font-size: 12px;
  margin-bottom: 2px;
  color: var(--text);
}
.postInfo .subject { color: var(--subject); font-weight: bold; }
.postInfo .name { color: var(--name); font-weight: bold; }
.postInfo .trip { color: var(--name); }
.postInfo .dateTime { color: var(--text-muted); }
.postInfo .postNum { color: var(--text-muted); }
.postInfo .postNum a { color: var(--text-muted); }
.postInfo .capcode { color: var(--green); font-weight: bold; }

.fileText { font-size: 12px; color: var(--text); margin: 2px 0; }

/* meme art helpers — transparent PNGs used as card thumbs / floats */
.postImg {
  float: left;
  margin: 2px 12px 4px 0;
  border: none;
  background: transparent;
  max-width: 160px;
  height: auto;
}
.postImg.sm { max-width: 86px; }
.postImg.lg { max-width: 200px; }
.postImg.xl { max-width: 240px; }
.postImg.right, .float-r { float: right; margin: 2px 0 4px 12px; }
@media (max-width: 560px) { .postImg { max-width: 30vw; } }

.postMessage {
  margin: 6px 0 2px;
  font-size: 13px;
  line-height: 1.45;
}
.postMessage p { margin: 0 0 8px; }
.postMessage p:last-child { margin-bottom: 0; }
.quote, .greentext { color: var(--greentext); }
.orangetext { color: var(--orange); font-weight: bold; font-style: italic; }
.pinktext { color: var(--chip-sell-bg); }
.quotelink, a.quotelink { color: var(--link); }
.deadlink { color: var(--link); text-decoration: line-through; }

.summary { color: var(--muted); font-size: 12px; margin: 2px 0 6px; }

/* ── forms ───────────────────────────────────────────────────────────────── */
.postForm {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 12px;
  margin: 10px 0;
  max-width: 560px;
}
.postForm .row { display: flex; align-items: stretch; margin-bottom: 3px; }
.postForm .rowLabel {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: bold;
  padding: 3px 6px;
  min-width: 70px;
  display: flex;
  align-items: center;
}
input[type=text], input[type=number], input[type=password], input[type=date], textarea, select {
  font-family: inherit;
  font-size: 13px;
  border: 1px solid rgba(0,0,0,0.15);
  background: var(--green-fill);
  color: var(--green-fill-ink);
  padding: 3px 8px;
  border-radius: 5px;
}
input::placeholder, textarea::placeholder { color: rgba(12,42,26,0.55); }
.postForm input[type=text], .postForm input[type=number], .postForm textarea {
  flex: 1;
  border-left: none;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 1px solid var(--green); }

/* the mint pill button */
.oldbtn, button.oldbtn, input[type=submit].oldbtn, a.oldbtn {
  display: inline-block;
  font-family: inherit;
  font-size: 13px;
  color: var(--green-fill-ink);
  background: var(--green-fill);
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 6px;
  padding: 3px 12px;
  cursor: pointer;
  box-shadow: none;
  text-decoration: none;
}
.oldbtn:hover { filter: brightness(1.06); color: var(--green-fill-ink); }
.oldbtn:active { filter: brightness(0.95); box-shadow: inset 0 1px 2px rgba(0,0,0,.25); }
.oldbtn:disabled, .oldbtn[aria-disabled=true] { opacity: .5; cursor: default; }
.oldbtn.big { font-size: 15px; font-weight: bold; padding: 6px 18px; }

/* ── tables (leaderboard / dashboard stats) ──────────────────────────────── */
table.ttable {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  background: var(--bg);
}
table.ttable th {
  background: var(--surface-2);
  color: var(--text-muted);
  text-align: left;
  padding: 3px 8px;
  font-weight: bold;
  font-size: 12px;
  border: 1px solid var(--border);
}
table.ttable td {
  border: 1px solid var(--border);
  padding: 3px 8px;
}
table.ttable tr:nth-child(even) td { background: var(--surface); }
table.ttable tr.you td { background: var(--highlight); }
table.ttable .mono { color: var(--green); }

/* a dark info/stat box */
.tbox {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 12px;
  margin: 8px 0;
}
.tbox h3 { margin: 0 0 6px; color: var(--green); font-size: 14px; }
.statBig { font-size: 28px; font-weight: bold; color: var(--green); line-height: 1; }
.statLabel { font-size: 11px; color: var(--text-muted); }

/* small inline tag/pill ("Soon", "live") */
.tag {
  font-size: 10px;
  font-weight: bold;
  color: var(--green-fill-ink);
  background: var(--green-fill);
  padding: 0 4px;
  border-radius: 3px;
  vertical-align: middle;
}
.tag.green { background: var(--green-fill); }
.live { color: var(--green); font-weight: bold; }
.live::before { content: '\25CF '; color: var(--green); }

/* code/quote blocks for the "math" */
.codebox {
  background: #0b0d12;
  border: 1px solid var(--border);
  padding: 8px 10px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--green);
  white-space: pre-wrap;
  margin: 6px 0;
}

/* footer credit line */
.boardFooter {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 24px;
  padding: 8px 0 14px;
}
.boardFooter a { color: var(--green); }

::selection { background: rgba(95,224,140,0.28); }
