/* The Market (client/market-view.ts), Gilded Codex. The page is the leather; the index of categories sits on it
   like the tabs of a ledger, the board is one framed vellum leaf with ruled lines, and prices read like entries
   in a merchant's book. Tokens come from themes/codex.css. */

/* ---------- Layout ---------- */
.mkt { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 20px; align-items: start; }
.mk-side { position: sticky; top: 8px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.mk-main { min-width: 0; scroll-margin-top: 12px; }

/* ---------- Search ---------- */
.mk-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 2px; color: var(--muted-v);
  background: url(themes/codex/vellum.svg) 0 0 / 300px, var(--vellum-hi); box-shadow: inset 0 1px 3px rgba(60, 40, 20, .35), 0 0 0 1px var(--edge), 0 0 0 2px var(--gilt-lo); }
.mk-search svg { width: 17px; height: 17px; flex: none; }
.page .mk-search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: none !important; box-shadow: none; color: var(--ink-v); font: 600 15.5px var(--sans); }
.mk-search:focus-within { box-shadow: inset 0 1px 3px rgba(60, 40, 20, .35), 0 0 0 1px var(--edge), 0 0 0 2px var(--gilt-hi); }

/* ---------- The index of categories ---------- */
.mk-cats { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; border-block: 1px solid var(--rule-soft); }
.mk-cat { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; height: 38px; padding: 0 12px 0 8px;
  border: 0; border-radius: 2px; background: none; color: var(--cream); font: 700 16px/1 var(--pixel); letter-spacing: .03em; text-align: left; cursor: pointer; }
.mk-cat:hover { background: rgba(244, 233, 205, .07); color: #f0e2c4; }
.mk-cat .mc-ico { display: grid; place-items: center; width: 30px; height: 30px; }
.mk-cat .mc-ico img { width: 26px; height: 26px; image-rendering: pixelated; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .45)); }
.mk-cat .mc-svg { display: grid; place-items: center; width: 22px; height: 22px; color: var(--gilt-hi); }
.mk-cat .mc-svg svg { width: 22px; height: 22px; }
.mk-cat .mc-n { font: 600 13px var(--sans); color: var(--cream-2); font-variant-numeric: tabular-nums; }
.mk-cat.on { color: var(--rg-rubric); background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(90deg, var(--vellum-hi), var(--vellum));
  box-shadow: inset 0 0 0 1px var(--edge), inset 0 1px 0 1px rgba(255, 246, 222, .35), 0 2px 0 rgba(0, 0, 0, .3); }
.mk-cat.on::before { content: ''; position: absolute; left: -6px; top: 6px; bottom: 6px; width: 4px; border-radius: 1px; background: var(--wax); box-shadow: 0 0 0 1px var(--edge); }
.mk-cat.on .mc-n { color: var(--muted-v); }
.mk-cat.on .mc-svg { color: var(--rg-ink); }

/* ---------- Filters: one small vellum leaf ---------- */
.mk-filters { padding: 12px 14px 14px; color: var(--ink-v); border: 7px solid transparent; border-image: url(themes/codex/frame.svg) 20 / 22px stretch;
  background: url(themes/codex/vellum.svg) 0 0 / 300px, radial-gradient(ellipse at 50% 35%, var(--vellum-hi) 0, var(--vellum) 60%, var(--vellum-lo) 100%);
  box-shadow: inset 0 0 16px rgba(90, 60, 25, .18), 0 4px 12px rgba(0, 0, 0, .35);
  --ink: var(--ink-v); --muted: var(--muted-v); --faint: var(--faint-v); }
.mk-filters h5 { margin: 12px 0 6px; font: 700 14px/1 var(--pixel); letter-spacing: .05em; color: var(--rg-rubric); }
.mk-filters h5:first-child { margin-top: 0; }
.mk-seg { display: flex; flex-wrap: wrap; gap: 3px; }
.mk-seg button { flex: 1 1 auto; min-width: 0; height: 28px; padding: 0 8px; border: 0; border-radius: 2px; cursor: pointer; white-space: nowrap;
  color: var(--muted-v); font: 700 13.5px var(--sans); background: var(--inlay); box-shadow: inset 0 0 0 1px var(--rule-soft); }
.mk-seg button:hover { color: var(--ink-v); background: var(--inlay-hi); }
.mk-seg button.on { color: var(--ink-v); background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(180deg, #e4d6b6, var(--vellum-hi));
  box-shadow: inset 0 0 0 1px var(--gilt-lo), inset 0 0 0 2px rgba(201, 178, 130, .8), 0 1px 0 rgba(60, 40, 20, .25); }
.mk-seg.cur button { display: inline-flex; align-items: center; gap: 5px; }
.mk-seg.cur img { width: 15px; height: 15px; }
.mk-els { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
.mk-el { position: relative; height: 26px; padding: 0 2px 0 15px; letter-spacing: -.01em; border: 0; border-radius: 2px; cursor: pointer; color: var(--muted-v); font: 700 12.5px var(--sans);
  background: var(--inlay); box-shadow: inset 0 0 0 1px var(--rule-soft); }
.mk-el::before { content: ''; position: absolute; left: 6px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--el); box-shadow: 0 0 0 1px rgba(40, 25, 10, .45); filter: saturate(.8); }
.mk-el:hover { color: var(--ink-v); background: var(--inlay-hi); }
.mk-el.on { color: var(--ink-v); background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(180deg, #e4d6b6, var(--vellum-hi)); box-shadow: inset 0 0 0 2px var(--el), 0 1px 0 rgba(60, 40, 20, .25); }
.mk-el.on::before { width: 9px; height: 9px; margin-top: -4.5px; left: 5px; }
.mk-range { display: flex; align-items: center; gap: 6px; color: var(--muted-v); }
.page .mk-range input { flex: 1; min-width: 0; width: 0; height: 30px; padding: 0 8px; font: 600 14px var(--sans); }
.mk-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font: 600 14px var(--sans); color: var(--ink-v); cursor: pointer; }

.mk-fsum { display: none; }

/* ---------- Bar above the board ---------- */
.mk-bar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px 14px; margin: 0 0 10px; }
.mk-title { flex: 1 1 auto; margin: 0; font: italic 700 30px/1 var(--display); color: var(--gilt-hi); text-shadow: 0 1px 0 var(--edge); }
.mk-title span { margin-left: 10px; font: 600 15px var(--sans); font-style: normal; color: var(--cream-2); text-shadow: none; }
.mk-sortsel { display: flex; align-items: center; gap: 8px; color: var(--cream-2); font: 600 14px var(--sans); }
.page .mk-sortsel select { height: 32px; min-width: 180px; padding: 0 8px; font: 600 14px var(--sans); }
.mk-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 10px; }
.mk-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border: 0; border-radius: 13px; cursor: pointer;
  color: var(--ink-v); font: 700 13px var(--sans); background: var(--vellum-hi); box-shadow: inset 0 0 0 1px var(--gilt-lo); }
.mk-chip i { font-style: normal; color: var(--rg-rubric); font-size: 15px; line-height: 1; }
.mk-chip:hover { background: #e2d4b2; }
.mk-chip.clear { color: var(--cream); background: none; box-shadow: inset 0 0 0 1px var(--rule); }

/* ---------- The board: one framed leaf, ruled ---------- */
.mk-board { padding: 2px 0; color: var(--ink-v); border: 7px solid transparent; border-image: url(themes/codex/frame.svg) 20 / 22px stretch;
  background: url(themes/codex/vellum.svg) 0 0 / 300px, radial-gradient(ellipse at 50% 20%, var(--vellum-hi) 0, var(--vellum) 60%, var(--vellum-lo) 100%);
  box-shadow: inset 0 0 16px rgba(90, 60, 25, .18), 0 4px 12px rgba(0, 0, 0, .35);
  --ink: var(--ink-v); --muted: var(--muted-v); --faint: var(--faint-v); --accent: var(--rg-ink); --gold: #7a5a14; }
.mk-head, .mk-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 74px 70px minmax(116px, 168px) minmax(118px, 150px) 112px; align-items: center; gap: 0 14px; padding: 0 14px; }
.mk-head { height: 34px; border-bottom: 1px solid var(--rule); font: 700 13.5px/1 var(--pixel); letter-spacing: .05em; color: var(--rg-rubric); }
.mk-head > span { display: flex; align-items: center; }
.mk-head .r, .mk-row .r { text-align: right; justify-content: flex-end; }
.mk-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer; color: inherit; font: inherit; letter-spacing: inherit; }
.mk-sort:hover { color: var(--rg-ink); }
.mk-sort.on { color: var(--rg-ink); }
.mk-sort i { font-style: normal; font-size: 11px; }
.mk-row { position: relative; min-height: 68px; padding-top: 7px; padding-bottom: 7px; color: var(--ink-v); text-decoration: none; }
.mk-row + .mk-row { box-shadow: inset 0 1px 0 var(--rule-soft); }
.mk-row:hover { background: rgba(244, 233, 205, .32); }
a.mk-row { cursor: pointer; }
.mk-row.focus { background: rgba(240, 214, 140, .28); box-shadow: inset 0 0 0 2px var(--gilt); }
.mk-row.house .mk-art::after { content: ''; position: absolute; inset: 2px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--gilt); }

/* A specimen plate behind each piece of art */
.mk-art { position: relative; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(255, 248, 228, .65), rgba(244, 233, 205, .15) 62%, transparent 70%); }
.mk-art img { max-width: 52px; max-height: 52px; image-rendering: pixelated; }
.mk-art:not(.crt) img { width: 34px; height: 34px; filter: drop-shadow(0 1px 0 rgba(60, 40, 20, .35)); }
.mk-what { min-width: 0; }
.mk-nm { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; font: 700 16.5px/1.2 var(--sans); }
.mk-nm b { font-weight: 700; }
.mk-lvi { font: 600 13.5px var(--sans); color: var(--muted-v); }
/* What the Level / Qty column says, beside the name on phones, where that column is hidden. */
.mk-ph { display: none; }
.mk-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 7px; margin-top: 3px; max-height: 38px; overflow: hidden; font-size: 13px; line-height: 1.35; color: var(--muted-v); }
.mk-sub .el { font-size: 11px; }
.mk-stat { display: flex; align-items: center; }
.mk-stat .gr { transform: scale(1.08); }
.mk-qual { font: 700 15px var(--sans); }
.mk-cnt { font: 600 13.5px var(--sans); color: var(--muted-v); white-space: nowrap; }
.mk-mid, .mk-lv { font: 700 15px var(--sans); font-variant-numeric: tabular-nums; }
.mk-by { display: flex; flex-direction: column; gap: 2px; min-width: 0; font: 600 14px var(--sans); }
.mk-by .plink { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-when { font: 500 12.5px var(--sans); color: var(--faint-v); }
.mk-hold { font: 700 12.5px var(--sans); color: var(--rg-ink); white-space: nowrap; }
.mk-avg { font: 600 14.5px var(--sans); color: var(--muted-v); font-variant-numeric: tabular-nums; }
.mk-you { font: italic 700 14px var(--sans); color: var(--rg-ink); }
.mk-house { display: inline-flex; align-items: center; align-self: flex-start; height: 19px; padding: 0 7px; border-radius: 1px; font: 700 12px/1 var(--pixel); letter-spacing: .08em;
  color: #6a4c12; background: linear-gradient(180deg, rgba(240, 214, 140, .55), rgba(201, 169, 94, .35)); box-shadow: inset 0 0 0 1px var(--gilt-lo); }
.mk-price { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.mk-price .mk-from { font: italic 500 12px/1 var(--sans); color: var(--faint-v); }
.mk-dn { color: var(--good); } .mk-up { color: var(--rg-rubric); }
.mk-price .mk-up, .mk-price .mk-dn { font-style: normal; font-size: 10px; line-height: 1; }
.mk-tot { font: 500 12px var(--sans); color: var(--faint-v); white-space: nowrap; }
.mk-money { display: inline-flex; align-items: center; gap: 5px; font: 700 16.5px/1.1 var(--sans); color: var(--ink-v); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mk-money img { width: 16px; height: 16px; image-rendering: pixelated; }
.mk-money.big { font-size: 24px; }
.mk-money.big img { width: 22px; height: 22px; }
.mk-act { display: flex; justify-content: flex-end; gap: 6px; }
.mk-act .btn { min-width: 84px; }
.mk-go { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font: 700 22px/1 var(--display); color: var(--rg-rubric); box-shadow: inset 0 0 0 1px var(--rule-soft); }
a.mk-row:hover .mk-go { background: var(--wax); color: #f2e4cc; box-shadow: 0 0 0 1px var(--edge); }
.mk-empty { margin: 0; padding: 28px 18px; text-align: center; font: italic 600 16px var(--sans); color: var(--cream-2); }
.mk-board .mk-empty { color: var(--muted-v); }
.mk-note { margin: 0 0 8px; color: var(--cream); font-style: italic; }
.mk-pin { margin-bottom: 10px; }
.mk-pin .mk-row { border: 7px solid transparent; border-image: url(themes/codex/frame.svg) 20 / 22px stretch; background: url(themes/codex/vellum.svg) 0 0 / 300px, var(--vellum-hi); }

/* Mine and history boards have fewer columns */
.mk-board.mine .mk-row { grid-template-columns: 56px minmax(0, 1fr) 64px minmax(110px, 150px) minmax(118px, 150px) auto; }
.mk-board.hist .mk-row, .mk-board.hist .mk-head { grid-template-columns: 56px minmax(0, 1fr) 90px minmax(118px, 160px); }
.mk-flow { font: 700 16.5px var(--sans); font-variant-numeric: tabular-nums; }
.mk-flow.in { color: #285020; } .mk-flow.out { color: var(--rg-rubric); }

/* Links drawn as buttons */
.mkt a.btn, .mk-sells a.btn, .mk-slots a.btn, .mk-own a.btn { text-decoration: none; color: #eadbbd; }
.mk-slots a.btn.primary { color: #f2e4cc; }
.mk-sc .mk-ex { display: inline-flex; align-items: center; gap: 5px; }
.mk-sc .mk-ex img { width: 13px; height: 13px; }

/* ---------- Pages ---------- */
.mk-pager { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 4px; margin: 14px 0 4px; }
.mk-pg { min-width: 34px; height: 32px; padding: 0 10px; border: 0; border-radius: 2px; cursor: pointer; color: var(--cream); font: 700 14px var(--sans); background: rgba(244, 233, 205, .06); box-shadow: inset 0 0 0 1px var(--rule-soft); }
.mk-pg:hover:not(:disabled) { color: #f4e8cc; box-shadow: inset 0 0 0 1px var(--gilt); }
.mk-pg.on { color: var(--ink-v); background: url(themes/codex/vellum.svg) 0 0 / 300px, var(--vellum-hi); box-shadow: inset 0 0 0 1px var(--edge), inset 0 0 0 2px var(--gilt-lo); }
.mk-pg:disabled { opacity: .35; cursor: default; }
.mk-gap { color: var(--cream-2); padding: 0 2px; }

/* ---------- Recent sales: a tape of small slips ---------- */
.mk-tape { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px; }
.mk-tape li { display: flex; align-items: center; gap: 8px; min-width: 0; height: 40px; padding: 0 10px 0 4px; border-radius: 2px; color: var(--ink-v);
  background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(180deg, var(--vellum-hi), var(--vellum)); box-shadow: inset 0 0 0 1px rgba(214, 197, 161, .7), 0 2px 0 rgba(0, 0, 0, .25);
  --ink: var(--ink-v); --muted: var(--muted-v); }
.mk-tart { display: grid; place-items: center; width: 32px; height: 32px; flex: none; }
.mk-tart img { max-width: 32px; max-height: 32px; image-rendering: pixelated; }
.mk-tart:not(.crt) img { width: 22px; height: 22px; }
.mk-tn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 600 14px var(--sans); }
.mk-tn i { flex: none; font-style: normal; color: var(--muted-v); }
/* A long name gives way to "…", never the quantity beside it (a cut "×10" read as ten, 2026-10-26). */
.mk-tnm { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mk-tape .mk-money { font-size: 14.5px; }
.mk-tape .mk-money img { width: 14px; height: 14px; }

/* ---------- An item's page ---------- */
/* Back to the market's list: a small game button like Save or Refresh (Cole 11-20: the plain link looked unthemed). */
.mk-back { display: inline-flex; margin: 0 0 10px; text-decoration: none; }
.mk-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; margin-bottom: 14px; padding: 14px 18px; color: var(--ink-v);
  border: 7px solid transparent; border-image: url(themes/codex/frame.svg) 20 / 22px stretch;
  background: url(themes/codex/vellum.svg) 0 0 / 300px, radial-gradient(ellipse at 15% 50%, #e6d8b8 0, var(--vellum-hi) 35%, var(--vellum) 100%);
  box-shadow: inset 0 0 16px rgba(90, 60, 25, .18), 0 4px 12px rgba(0, 0, 0, .35); --ink: var(--ink-v); --muted: var(--muted-v); --faint: var(--faint-v); }
.mk-hart { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, rgba(255, 250, 232, .9), rgba(236, 222, 190, .5) 55%, rgba(180, 150, 100, .25));
  box-shadow: inset 0 0 0 2px var(--gilt), inset 0 0 0 3px var(--edge), 0 2px 6px rgba(60, 40, 20, .35); }
.mk-hart img { width: 60px; height: 60px; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(60, 40, 20, .3)); }
.mk-htxt h2 { margin: 0 0 4px; font: 700 30px/1.05 var(--display); color: var(--rg-rubric); }
.mk-htxt h2::first-letter { color: var(--rg-ink); }
.mk-htxt p { margin: 0; max-width: 60ch; font: italic 500 15px/1.4 var(--sans); color: var(--muted-v); }
.mk-hprice { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.mk-hprice i { font: italic 600 13px var(--sans); color: var(--muted-v); }
.mk-hprice > span { font: 600 13px var(--sans); color: var(--muted-v); }
.mk-itemgrid { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.mk-buy, .mk-hist { padding: 12px 16px 14px; }
.mk-buy h4, .mk-hist h4 { margin: 0 0 10px; }
.mk-qty { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font: 600 14px var(--sans); color: var(--muted-v); }
.mk-qty > span:first-child { width: 100%; }
.mk-step { display: inline-flex; align-items: stretch; height: 36px; border-radius: 2px; box-shadow: 0 0 0 1px var(--rule); }
.mk-step button { width: 34px; border: 0; cursor: pointer; font: 700 18px var(--sans); color: var(--ink-v); background: var(--inlay); }
.mk-step button:hover { background: var(--inlay-hi); }
.page .panel .mk-step input { width: 84px; height: 36px; border: 0; border-radius: 0; text-align: center; font: 700 17px var(--sans); box-shadow: inset 1px 0 0 var(--rule-soft), inset -1px 0 0 var(--rule-soft); -moz-appearance: textfield; }
.mk-step input::-webkit-inner-spin-button { -webkit-appearance: none; }
.mk-max { height: 30px; padding: 0 10px; border: 0; border-radius: 2px; cursor: pointer; color: var(--rg-ink); font: italic 700 14px var(--sans); background: none; box-shadow: inset 0 0 0 1px var(--rule-soft); }
.mk-max:hover { background: var(--inlay); }
.mk-sum { margin: 12px 0; padding: 8px 0 0; border-top: 1px solid var(--rule-soft); }
.mk-sum > div { display: flex; justify-content: space-between; align-items: center; min-height: 28px; }
.mk-sum dt { font: 600 14px var(--sans); color: var(--muted-v); }
.mk-sum dd { margin: 0; }
.mk-sum .tot dt { font: 700 16px var(--pixel); letter-spacing: .04em; color: var(--rg-rubric); }
.mk-buybtn { width: 100%; height: 42px; font-size: 16px !important; }
.mk-none { margin: 4px 0 12px; font: italic 600 15px var(--sans); color: var(--muted-v); }
.mk-own { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule-soft); font: 600 14px var(--sans); }
.mk-own > span { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mk-own .mk-money { font-size: 14.5px; }
.mk-histhead { display: flex; align-items: baseline; justify-content: space-between; }
.mk-histhead .link:not(.btn) { border: 0; background: none; cursor: pointer; padding: 0; }
.mk-chart { position: relative; height: 170px; margin: 2px 0 6px; padding: 10px 50px 18px 0; }
.mk-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.mk-chart .g line { stroke: var(--rule-soft); stroke-width: 1; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
.mk-chart .a { fill: rgba(44, 71, 102, .14); }
.mk-chart .l { fill: none; stroke: var(--rg-ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.mk-dot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--rg-rubric); box-shadow: 0 0 0 2px #f4e8cc, 0 0 0 3px rgba(60, 40, 20, .35); }
.mk-plot { position: relative; height: 100%; }
.mk-chart > span { position: absolute; font: 600 12px var(--sans); color: var(--faint-v); font-variant-numeric: tabular-nums; }
.mk-hi { right: 0; top: 23px; } .mk-lo { right: 0; bottom: 27px; }
.mk-x0 { left: 0; bottom: 0; } .mk-x1 { right: 50px; bottom: 0; }
.mk-chart.none { display: grid; place-items: center; height: 120px; padding: 0; font: italic 600 15px var(--sans); color: var(--muted-v); }
.mk-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding-top: 10px; border-top: 1px solid var(--rule-soft); }
.mk-stats div { display: flex; flex-direction: column; gap: 2px; }
.mk-stats i { font: italic 500 12.5px var(--sans); color: var(--muted-v); }
.mk-stats b { font: 700 16px var(--sans); font-variant-numeric: tabular-nums; }
.mk-book { padding: 2px 0; color: var(--ink-v); border: 7px solid transparent; border-image: url(themes/codex/frame.svg) 20 / 22px stretch;
  background: url(themes/codex/vellum.svg) 0 0 / 300px, var(--vellum); box-shadow: inset 0 0 16px rgba(90, 60, 25, .18), 0 4px 12px rgba(0, 0, 0, .35);
  --ink: var(--ink-v); --muted: var(--muted-v); --faint: var(--faint-v); --accent: var(--rg-ink); }
.mk-bh, .mk-br { display: grid; grid-template-columns: 150px 80px minmax(0, 1fr) 120px; align-items: center; gap: 0 18px; padding: 0 16px; }
.mk-bh { height: 32px; border-bottom: 1px solid var(--rule); font: 700 13.5px/1 var(--pixel); letter-spacing: .05em; color: var(--rg-rubric); }
.mk-bh .r, .mk-br .r { text-align: right; justify-content: flex-end; }
.mk-br { min-height: 46px; }
.mk-br + .mk-br { box-shadow: inset 0 1px 0 var(--rule-soft); }
.mk-br:first-of-type .mk-money { color: #2f6b3c; font-weight: 800; }
.mk-br .mk-by { flex-direction: row; align-items: baseline; gap: 10px; }
.mk-br.held { background: rgba(44, 71, 102, .05); }

/* ---------- Sell ---------- */
.mk-slots { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; color: var(--cream-2); font: 600 14.5px var(--sans); }
.mk-slots b { color: var(--gilt-hi); font-size: 17px; }
.mk-slots .btn { margin-left: auto; }
.mk-sells { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.mk-sc { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: 2px; color: var(--ink-v);
  background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(180deg, var(--vellum-hi), var(--vellum)); box-shadow: inset 0 0 0 1px rgba(214, 197, 161, .7), 0 2px 0 rgba(0, 0, 0, .25);
  --ink: var(--ink-v); --muted: var(--muted-v); --faint: var(--faint-v); --accent: var(--rg-ink); }
/* A set size: left to its own size, a creature's art drew at 32px or 52px by chance on sharp screens (client/assets.ts
   picks the file for the box it measures, and the box followed whichever file loaded first). */
.mk-sc .mk-art.crt img { width: 52px; height: 52px; object-fit: contain; }
.mk-sc .mk-nm { font-size: 15.5px; }
.mk-sc .mk-sub { max-height: 36px; }
.mk-scact { display: flex; gap: 6px; }
.mk-sc.two { grid-template-columns: 54px minmax(0, 1fr); row-gap: 4px; }
.mk-sc.two .mk-art { grid-row: span 2; }
.mk-sc.two .mk-scact { grid-column: 2; justify-content: flex-end; flex-wrap: wrap; }
.mk-tabn { display: inline-grid; place-items: center; min-width: 20px; height: 18px; margin-left: 4px; padding: 0 5px; border-radius: 9px; font: 700 12px var(--sans); color: #f2e4cc; background: var(--wax); }

/* The listing form's fee lines (client/ui.ts listDialog) */
.mk-fee { display: grid; gap: 2px; margin: 6px 0; font-size: 13px; color: var(--muted); }
.mk-fee > span { display: flex; justify-content: space-between; gap: 12px; }
.mk-fee b { color: var(--ink); font-variant-numeric: tabular-nums; }
.mk-fee .fee-net { padding-top: 3px; border-top: 1px solid var(--rule-soft); color: var(--ink); font-weight: 600; }
.mk-fee .fee-short { color: var(--bad); }
.mk-fee1 > span { display: block; }

/* ---------- Narrow screens ---------- */
@media (max-width: 1100px) {
  .mkt { grid-template-columns: 220px minmax(0, 1fr); gap: 14px; }
  .mk-head, .mk-row { grid-template-columns: 50px minmax(0, 1fr) 54px 56px minmax(100px, 130px) minmax(108px, 130px) 96px; gap: 0 10px; }
  .mk-itemgrid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .mkt { grid-template-columns: minmax(0, 1fr); }
  .mk-side { position: static; }
  .mk-fsum { display: flex; align-items: center; justify-content: space-between; height: 36px; padding: 0 12px; border: 0; border-radius: 2px; cursor: pointer;
    color: var(--cream); font: 700 15px var(--pixel); letter-spacing: .04em; background: rgba(244, 233, 205, .06); box-shadow: inset 0 0 0 1px var(--rule-soft); }
  .mk-fsum b { font: 600 13px var(--sans); color: var(--gilt-hi); }
  .mk-side:not(.fopen) .mk-filters { display: none; }
  .mk-cats { flex-direction: row; flex-wrap: wrap; gap: 5px; padding: 0; border: 0; }
  .mk-cat { grid-template-columns: 22px auto auto; gap: 6px; height: 34px; padding: 0 10px 0 6px; font-size: 14.5px; box-shadow: inset 0 0 0 1px var(--rule-soft); }
  .mk-cat .mc-ico, .mk-cat .mc-ico img, .mk-cat .mc-svg, .mk-cat .mc-svg svg { width: 22px; height: 22px; }
  .mk-cat.on::before { display: none; }
  .mk-title { font-size: 25px; }
  .mk-sortsel { width: 100%; }
  .page .mk-sortsel select { flex: 1; }
  .mk-head { display: none; }
  .mk-row, .mk-board.mine .mk-row, .mk-board.hist .mk-row { grid-template-columns: 46px minmax(0, 1fr) auto; grid-template-areas: "art what what" "art by price" "art stat act"; gap: 4px 10px; padding: 9px 10px; }
  .mk-art { width: 46px; height: 46px; }
  .mk-art img { max-width: 44px; max-height: 44px; }
  /* Named areas only for board rows: on a Sell card they would add stray grid tracks. */
  .mk-row .mk-art { grid-area: art; align-self: start; }
  .mk-row .mk-what { grid-area: what; } .mk-row .mk-by { grid-area: by; } .mk-row .mk-price { grid-area: price; } .mk-row .mk-act { grid-area: act; } .mk-row .mk-stat { grid-area: stat; }
  .mk-sc { grid-template-columns: 46px minmax(0, 1fr) auto; }
  .mk-sc.two { grid-template-columns: 46px minmax(0, 1fr); }
  .mk-mid { display: none; }
  .mk-ph { display: inline; }
  .mk-nph { display: none; }
  .mk-sub { max-height: 19px; }
  .mk-hero { grid-template-columns: auto minmax(0, 1fr); padding: 10px 12px; gap: 12px; }
  .mk-hart { width: 66px; height: 66px; } .mk-hart img { width: 44px; height: 44px; }
  .mk-htxt h2 { font-size: 24px; }
  .mk-hprice { grid-column: 1 / -1; flex-direction: row; align-items: baseline; justify-content: flex-start; gap: 10px; }
  .mk-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mk-bh { display: none; }
  .mk-br { grid-template-columns: auto auto minmax(0, 1fr); grid-template-areas: "p q act" "by by by"; gap: 4px 12px; padding: 8px 10px; }
  .mk-br > :nth-child(1) { grid-area: p; } .mk-br > :nth-child(2) { grid-area: q; } .mk-br > :nth-child(3) { grid-area: by; } .mk-br > :nth-child(4) { grid-area: act; }
  .mk-sells { grid-template-columns: minmax(0, 1fr); }
  .mk-tape { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- gems (shared/gems.ts): the gem price, the item page's currency switch, the wallet ---------- */
.mk-money.gem img { image-rendering: auto; }
.mk-tabg { display: inline-flex; align-items: center; gap: 3px; margin-left: 5px; font: 700 12.5px var(--sans); color: var(--gold); font-variant-numeric: tabular-nums; }
.mk-tabg img { width: 13px; height: 13px; }
.mk-icur { display: inline-flex; gap: 2px; margin-bottom: 6px; padding: 2px; border-radius: 3px; background: rgba(0, 0, 0, .18); box-shadow: inset 0 0 0 1px var(--rule-soft); }
.mk-icur a { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 2px; text-decoration: none; font: 700 13px var(--sans); color: var(--muted-v); }
.mk-icur a img { width: 14px; height: 14px; }
.mk-icur a:hover { color: var(--ink-v); background: var(--inlay-hi); }
.mk-icur a.on { color: var(--ink-v); background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(180deg, #e4d6b6, var(--vellum-hi));
  box-shadow: inset 0 0 0 1px var(--gilt-lo), 0 1px 0 rgba(60, 40, 20, .25); }
.mk-usd { display: block; margin-top: 2px; text-align: right; font: italic 600 13px var(--sans); color: var(--muted-v); }

.mk-wallet { display: flex; align-items: center; gap: 24px; margin: 4px 0 16px; padding: 16px 20px; border: 14px solid transparent; border-image: url(themes/codex/frame.svg) 28 / 14px stretch;
  background: url(themes/codex/vellum.svg) 0 0 / 420px, linear-gradient(180deg, var(--vellum), var(--vellum-hi)); background-clip: padding-box;
  box-shadow: inset 0 0 16px rgba(90, 60, 25, .18), 0 4px 12px rgba(0, 0, 0, .35); color: var(--ink-v); }
.mk-wbal { display: flex; align-items: center; gap: 14px; flex: none; }
.mk-wico { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #f4ead2, #d8c49c 70%, #bda476); box-shadow: inset 0 0 0 2px var(--gilt-lo), 0 2px 6px rgba(60, 40, 20, .3); }
.mk-wico img { width: 40px; height: 40px; }
.mk-wbal i { display: block; font: 700 14px/1 var(--pixel); letter-spacing: .05em; color: var(--rg-rubric); font-style: normal; }
.mk-wbal b { display: block; margin: 4px 0 2px; font: 700 34px/1 var(--serif, var(--sans)); font-variant-numeric: tabular-nums; }
.mk-wbal span { font: italic 600 15px var(--sans); color: var(--muted-v); }
.mk-wnote { max-width: 520px; padding-left: 24px; border-left: 1px solid var(--rule-soft); font: 600 14px/1.45 var(--sans); color: var(--muted-v); }
.mk-wstats { display: flex; gap: 0; flex: 1; justify-content: flex-end; }
.mk-wstat { min-width: 120px; padding: 0 20px; border-left: 1px solid var(--rule-soft); }
.mk-wstat i { display: block; font: 700 12px/1 var(--pixel); letter-spacing: .05em; color: var(--rg-rubric); font-style: normal; }
.mk-wstat b { display: block; margin: 6px 0 2px; font: 700 22px/1 var(--serif, var(--sans)); font-variant-numeric: tabular-nums; }
.mk-wstat span { font: italic 600 13px var(--sans); color: var(--muted-v); }
.mk-wline { margin: 0 0 12px; font: 600 14px/1.45 var(--sans); color: var(--muted); }
.mk-packs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mk-pack { display: grid; justify-items: center; gap: 4px; padding: 14px 8px 12px; cursor: pointer; border: 0; border-radius: 3px; color: var(--ink-v);
  background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(180deg, #efe3c6, var(--vellum-hi)); box-shadow: inset 0 0 0 1px var(--gilt-lo), 0 2px 6px rgba(0, 0, 0, .3); }
.mk-pack:hover { box-shadow: inset 0 0 0 2px var(--gilt), 0 3px 10px rgba(0, 0, 0, .35); transform: translateY(-1px); }
.mk-pack img { width: 30px; height: 30px; }
.mk-pack b { font: 700 20px/1 var(--serif, var(--sans)); font-variant-numeric: tabular-nums; }
.mk-pack span { font: 700 14px var(--sans); color: var(--rg-rubric); }
.mk-wpanel { padding: 12px 16px 14px; }
.mk-wpanel h4 { margin: 0 0 10px; }
.mk-wf { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; font: 600 14px var(--sans); color: var(--muted-v); }
.mk-wf > span:first-child { width: 100%; }
.page .panel .mk-wf .mk-step input { width: 160px; text-align: left; padding: 0 10px; }
.page .panel .mk-wf > input { width: 100%; height: 36px; font: 600 14px var(--mono, monospace); }
.mk-wq { margin: 12px 0 0; padding: 0; list-style: none; }
.mk-wq li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--rule-soft); }
.mk-wq li .mk-when { flex: 1; }
.mk-wq.past { margin-top: 0; }
.mk-wst { font: 700 13px var(--sans); color: var(--muted-v); }
.mk-wst.sent { color: var(--good); }
.mk-wst.refused { color: var(--bad); }
.dlg-cur { display: inline-flex; gap: 2px; margin: 2px 0 6px; padding: 2px; border-radius: 3px; background: rgba(0, 0, 0, .15); }
.dlg-cur label { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 14px; border-radius: 2px; cursor: pointer; font: 700 14px var(--sans); color: var(--muted); }
.dlg-cur label img { width: 16px; height: 16px; }
.dlg-cur input { position: absolute; opacity: 0; pointer-events: none; }
.dlg-cur label:has(input:checked) { color: #2a1c0c; background: linear-gradient(180deg, #ecdfc2, #d9c79f); box-shadow: inset 0 0 0 1px #8a6a32; }
.dlg-cur label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.mk-fee .fee-net i { margin-left: 6px; font-weight: 600; color: var(--muted); }
@media (max-width: 760px) {
  .mk-wallet { flex-direction: column; align-items: flex-start; gap: 12px; }
  .mk-wnote { padding: 12px 0 0; border-left: 0; border-top: 1px solid var(--rule-soft); }
  .mk-wstats { width: 100%; justify-content: flex-start; }
  .mk-wstat { min-width: 0; flex: 1; padding: 0 12px; }
  .mk-wstat:first-child { padding-left: 0; border-left: 0; }
  .mk-wgrid { grid-template-columns: 1fr; }
}
.mk-flow { display: inline-flex; align-items: center; gap: 5px; }
.mk-flow img { width: 16px; height: 16px; }
.mk-wgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
/* The currency switch sits on leather beside the sort, not on the filters leaf. */
.mk-bar .mk-seg.cur { gap: 2px; padding: 2px; border-radius: 3px; background: rgba(0, 0, 0, .22); box-shadow: inset 0 0 0 1px rgba(201, 178, 130, .25); }
.mk-bar .mk-seg.cur button { height: 30px; padding: 0 12px; color: #cdb894; background: none; box-shadow: none; }
.mk-bar .mk-seg.cur button:hover { color: #f0e2c4; background: rgba(255, 240, 210, .08); }
.mk-bar .mk-seg.cur button.on { color: var(--ink-v); background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(180deg, #e4d6b6, var(--vellum-hi)); box-shadow: inset 0 0 0 1px var(--gilt-lo); }
@media (max-width: 1100px) { .mk-wgrid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- History (client/market-view.ts historyPane) ---------- */
.mh-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 10px; }
.mh-bar .mk-seg { flex-wrap: nowrap; }
.mh-who button { min-width: 84px; }
.mh-search { flex: 1 1 200px; height: 34px; }
.mh-x { border: 0; background: none; cursor: pointer; padding: 0 2px; font: 700 18px/1 var(--sans); color: var(--muted-v); }
.mh-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 0; margin: 0 0 10px; padding: 10px 16px; border-radius: 3px; color: var(--ink-v);
  background: url(themes/codex/vellum.svg) 0 0 / 420px, linear-gradient(180deg, var(--vellum), var(--vellum-hi)); box-shadow: inset 0 0 0 1px var(--gilt-lo), 0 2px 8px rgba(0, 0, 0, .3); }
.mh-stat { padding: 0 20px; border-left: 1px solid var(--rule-soft); }
.mh-stat:first-child { padding-left: 0; border-left: 0; }
.mh-stat i, .mh-top i { display: block; font: 700 12px/1 var(--pixel); letter-spacing: .05em; color: var(--rg-rubric); font-style: normal; }
.mh-v { display: flex; align-items: center; gap: 12px; margin-top: 5px; font: 700 18px/1 var(--sans); font-variant-numeric: tabular-nums; }
.mh-v .mk-none { margin: 0; font-size: 15px; }
.mh-sub { display: block; margin-top: 3px; font: italic 600 12px var(--sans); color: var(--muted-v); }
.mh-top { flex: 1 1 260px; padding-left: 20px; border-left: 1px solid var(--rule-soft); }
.mh-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.mh-chips .mk-chip b { font: 600 12px var(--sans); color: var(--muted-v); }
.mh-chips .mk-chip.on { background: #e2d4b2; box-shadow: inset 0 0 0 2px var(--gilt-lo); }
.mk-board.hist .mk-nm a { color: inherit; text-decoration: none; }
.mk-board.hist .mk-nm a:hover b { text-decoration: underline; }
.mk-board.hist .mk-price { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.mh-more { margin: 6px 0 0; text-align: center; font: italic 600 13px var(--sans); color: var(--cream-2); }
@media (max-width: 760px) {
  .mh-bar { gap: 6px; }
  .mh-who { flex: 1 1 100%; } .mh-who button { flex: 1; }
  .mh-kinds { flex: 1 1 100%; } .mh-kinds button { padding: 0 4px; font-size: 12.5px; }
  .mh-cur { flex: 0 0 auto; }
  .mh-search { flex: 1 1 140px; height: 32px; }
  .mh-sum { padding: 8px 10px; }
  .mh-stat { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 2px 0; border-left: 0; }
  .mh-v { font-size: 15px; gap: 10px; margin-top: 0; } .mh-sub { display: none; }
  .mh-top { flex-basis: 100%; padding: 6px 0 0; border-left: 0; border-top: 1px solid var(--rule-soft); }
  .mh-top i { font-size: 10px; }
  .mh-chips .mk-chip { height: 24px; padding: 0 8px; font-size: 12px; }
}
/* History rows are denser than the board's, so more of them fit a page. */
@media (min-width: 761px) {
  .mk-board.mh-board .mk-row { min-height: 50px; padding-top: 4px; padding-bottom: 4px; }
  .mk-board.mh-board .mk-row, .mk-board.mh-board .mk-head { grid-template-columns: 46px minmax(0, 1fr) 90px minmax(118px, 160px); }
}
.mh-board .mk-art { width: 40px; height: 40px; }
.mh-board .mk-art img { max-width: 38px; max-height: 38px; }
.mh-board .mk-art:not(.crt) img { width: 26px; height: 26px; }
.mh-board .mk-sub { margin-top: 1px; }
.mh-bar .mk-seg button:not(.on) { color: var(--cream-2); }
.mh-ago { display: none; }

/* Sell > Creatures: search, grade and sort (client/market-view.ts sellMonsSec). */
.mk-sfbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 8px; }
.mk-sfq { flex: 1 1 220px; height: 34px; }
/* The search leads at every width (fit.css sends the Browse search's order to the end of its own grid under 1100px). */
.mk-sfbar .mk-sfq { order: 0 !important; }
.mk-sfg { flex-wrap: nowrap; }
.mk-sfg button { display: inline-grid; place-items: center; min-width: 38px; }
.mk-sfg button:not(.on) { opacity: .75; }
.mk-onm { color: var(--rg-rubric); font-weight: 700; }
.mk-lvt { margin-right: 6px; white-space: nowrap; }
/* Select: All, List N and Done take the sort's place; a card is one big tick box (sellPane card). */
.mk-sfsel { display: flex; align-items: center; gap: 8px; }
.mk-sfbar .btn { height: 34px; white-space: nowrap; }
.mk-sfbar .btn[aria-disabled="true"] { opacity: .5; }
.mk-sfsel [data-act="sf-list"] { min-width: 78px; justify-content: center; }
.mk-sc.sel { cursor: pointer; user-select: none; -webkit-user-select: none; }
.mk-sc.sel:hover { box-shadow: inset 0 0 0 1px var(--gilt-lo), 0 2px 0 rgba(0, 0, 0, .25); }
.mk-sc.sel.on { box-shadow: inset 0 0 0 2px var(--wax), 0 2px 0 rgba(0, 0, 0, .25); }
.mk-tick:focus-visible { outline: 2px solid var(--gilt-hi); outline-offset: 2px; }
.mk-tick { display: grid; place-items: center; width: 26px; height: 26px; margin-right: 4px; padding: 0; border: 0; border-radius: 2px; cursor: pointer; color: #f6ead2; background: rgba(60, 40, 20, .08); box-shadow: inset 0 0 0 2px var(--faint-v); }
.mk-sc.sel.on .mk-tick { background: var(--wax); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .25); }
.mk-tick svg { width: 16px; height: 16px; }
/* The listing form for several creatures: their art overlapped, how many, and the grades among them. */
.mx-mstack { display: flex; flex: none; padding-left: 14px; }
.mx-mstack .mk-art { margin-left: -14px; }
.mx-dthing .mx-os .mx-mg { display: inline-flex; align-items: center; gap: 3px; overflow: visible; font-weight: 700; color: var(--ink-v); }
@media (max-width: 760px) {
  /* Phones: the search with Select (or Done) beside it, then the grades with the sort (or All and List). */
  .mk-sfbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "q q pick" "g tools tools"; gap: 6px; }
  .mk-sfbar .mk-sfq { grid-area: q; height: 34px; }
  .mk-sfbar .mk-sfpick { grid-area: pick; height: 34px; }
  .mk-sfg { grid-area: g; } .mk-sfg button { min-width: 0; padding: 0 5px; }
  .mk-sfbar .mk-sfs, .mk-sfsel { grid-area: tools; justify-content: flex-end; gap: 6px; min-width: 0; }
  .mk-sfsel .btn { height: 30px; }
  .page .mk-sfs select { min-width: 0; width: 100%; max-width: 150px; height: 30px; }
  .mx-mstack { padding-left: 20px; } .mx-mstack .mk-art { margin-left: -20px; }
  .mk-sc .mk-art.crt img { width: 40px; height: 40px; }
}

/* A listing that takes coins or gems: a Buy per currency, stacked, and the gem price under the coin price. */
.mk-duo { display: flex; flex-direction: column; gap: 4px; }
.mk-act .mk-duo .btn { min-width: 84px; }
.mk-duo .btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.mk-bcur { width: 14px; height: 14px; }
.mk-or { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.mk-or img { width: 12px; height: 12px; }

/* A relic's or held item's quality next to its name (Everything shows a Qty column, so a bare number read as a count). */
.mk-qpill { display: inline-block; padding: 0 7px; border-radius: 9px; font: 700 12px/19px var(--sans); color: inherit; background: rgba(120, 90, 40, .14); border: 1px solid rgba(120, 90, 40, .3); vertical-align: 1px; white-space: nowrap; }

/* Bag › Relics: a relic listed on the Market shows with its tag, faded, until it sells or comes off. */
.bt-tile.listed .bg-art { opacity: .55; }
.bt-mk { display: block; margin-top: 2px; font: 700 10.5px/1.2 var(--sans); letter-spacing: .03em; text-transform: uppercase; color: #8a5a12; }

/* =====================================================================================================
   Market v2 (client/market-view.ts, 2026-11-08): one title row with the wallet, a grid of species cards,
   a card's offers page (gems first), and the gems-first listing form. Nothing scrolls: the fixed box takes
   the height left on screen (marketFit) and the grid and offer rows page to fit it.
   ===================================================================================================== */
#page[data-view="market"] .page-inner:has(.mx-fixed) { padding-bottom: 0 !important; }
.mx-spk { width: 1em; height: 1em; flex: none; }
.aura-tag.mx-at { display: inline-flex; align-items: center; gap: 3px; }
.mx { position: relative; display: flex; flex-direction: column; min-height: 0; color: var(--ink-l); }
.mx.mx-fixed { overflow: hidden; }
:is(.mx, .mx-head) .lg { display: inline; }
:is(.mx, .mx-head) .sh { display: none; }

/* ---------- the title row: Market, the five tabs, the wallet ---------- */
.mx-head { display: flex; align-items: flex-end; gap: 22px; height: 46px; margin: 0 0 0; border-bottom: 1px solid var(--rule-soft); }
.mx-head h1 { margin: 0 0 6px; font: italic 700 32px/1 var(--display); color: var(--ink-l); text-shadow: 0 1px 0 var(--edge); }
.mx-tabs.subtabs { border: 0; margin: 0; gap: 2px; align-self: stretch; align-items: flex-end; }
.mx-tabs.subtabs a { display: inline-flex; align-items: center; gap: 5px; height: 38px; padding: 0 12px; font: 700 15px/1 var(--pixel); letter-spacing: .05em; color: var(--muted-l); cursor: pointer; white-space: nowrap; }
.mx-tabs.subtabs a.on { color: var(--ink-l); box-shadow: inset 0 -2px 0 var(--gilt); }
.mx-tg { width: 14px; height: 14px; }
.mx-wallet { margin-left: auto; display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.mx-bal { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 10px; border-radius: 15px; font: 700 15px var(--sans); color: var(--ink-l); white-space: nowrap;
  background: rgba(20, 12, 6, .35); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .45), 0 0 0 1px var(--rule-soft); }
.mx-bal a { display: inline-flex; align-items: center; gap: 6px; color: inherit; text-decoration: none; }
.mx-bal.coin { padding-right: 12px; }
.mx-bal img { width: 18px; height: 18px; }
.mx-bal.gem { box-shadow: inset 0 1px 2px rgba(0, 0, 0, .45), 0 0 0 1px var(--gilt-lo); }
.mx-bal.gem:not(:has(.mx-plus)) { padding-right: 12px; }
.mx-plus { display: grid; place-items: center; width: 24px; height: 24px; margin-left: 2px; padding: 0; border: 0; border-radius: 50%; color: #2a1d10; cursor: pointer;
  background: radial-gradient(circle at 50% 32%, var(--gilt-hi), var(--gilt) 72%);
  box-shadow: 0 0 0 1px var(--edge), inset 0 0 0 2px rgba(255, 238, 196, .22), inset 0 -2px 3px rgba(70, 40, 12, .35); }
.mx-plus:hover { filter: brightness(1.08); }
.mx-plus:active { box-shadow: 0 0 0 1px var(--edge), inset 0 1px 3px rgba(70, 40, 12, .45); }
.mx-plus .mx-pl { display: block; width: 12px; height: 12px; fill: currentColor; stroke: currentColor; stroke-width: .5; stroke-linejoin: round; }
.mx-plus .mx-pl .lt { fill: rgba(255, 240, 205, .55); stroke: rgba(255, 240, 205, .55); }

/* ---------- browse: the rail and the grid ---------- */
.mx-browse { flex: 1; min-height: 0; display: grid; grid-template-columns: 214px minmax(0, 1fr); gap: 18px; padding-top: 12px; }
.mx-rail { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.mx-rail .mk-search { height: 36px; flex: none; }
.mx-rail .mk-cats { padding: 4px 0; }
.mx-rail .mk-cat { height: 33px; font-size: 15px; }
.mx-rail .mk-cat .mc-ico img { width: 24px; height: 24px; }
.mx-star { color: var(--gilt-hi) !important; font-style: normal; font-size: 19px; line-height: 1; }
.mx-tgl { display: flex; flex-direction: column; gap: 3px; }
.mx-tog { display: flex; align-items: center; justify-content: space-between; height: 30px; padding: 0 12px 0 10px; border: 0; border-radius: 2px; background: rgba(244, 233, 205, .05); box-shadow: inset 0 0 0 1px var(--rule-soft); color: var(--cream); font: 700 14.5px var(--pixel); letter-spacing: .03em; cursor: pointer; }
.mx-tog:hover { background: rgba(244, 233, 205, .09); }
.mx-tog.on { color: var(--ink-v); background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(180deg, #e4d6b6, var(--vellum-hi)); box-shadow: inset 0 0 0 1px var(--edge); }
.mx-tog .mc-n { font: 600 13px var(--sans); color: var(--cream-2); }
.mx-tog.on .mc-n { color: var(--muted-v); }
.mx-gseg { display: flex; align-items: center; gap: 8px; margin-top: 4px; font: 700 14px var(--pixel); color: var(--cream-2); }
.mx-gseg > span, .mx-fg > span { white-space: nowrap; }
.mx-gseg .mk-seg { flex: 1; flex-wrap: nowrap; }
.mx-gseg .mk-seg button { padding: 0 3px; height: 28px; display: inline-flex; align-items: center; justify-content: center; gap: 1px; color: var(--cream-2); background: rgba(244, 233, 205, .05); }
.mx-fbtn { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 12px; border: 0; border-radius: 2px; cursor: pointer; text-align: left;
  color: var(--cream); font: 700 15px var(--pixel); letter-spacing: .04em; background: rgba(244, 233, 205, .05); box-shadow: inset 0 0 0 1px var(--rule); }
.mx-fbtn b { font: 600 12.5px var(--sans); color: var(--gilt-hi); }
.mx-fbtn:hover, .mx-nfbtn:hover { box-shadow: inset 0 0 0 1px var(--gilt); }

.mx-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.mx-tool { display: flex; align-items: center; gap: 14px; flex: none; height: 40px; margin-bottom: 10px; }
.mx-tool .mk-title { flex: 1 1 auto; font-size: 28px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page .mx-tool .mk-sortsel select, .page .mx-spf .mk-sortsel select { min-width: 150px; height: 32px; }
.mx-cur { flex-wrap: nowrap; }
/* Ending soon: Standout | All (plain low-grade creatures only under All) */
.mx-plain { flex: none; flex-wrap: nowrap; }
.mx-plain button { height: 30px; padding: 0 10px; color: var(--cream-2); background: rgba(244, 233, 205, .05); }
.mx-plain button.on { color: var(--ink-v); }
.mx-soonnone .mk-link { margin-left: 6px; padding: 0; border: 0; background: none; color: var(--gilt-hi); font: inherit; text-decoration: underline; cursor: pointer; }
.mx-cur button { height: 30px; padding: 0 10px; color: var(--cream-2); background: rgba(244, 233, 205, .05); }
.mx-cur button.on { color: var(--ink-v); }
.mx-nsearch, .mx-nfbtn, .mx-kinds { display: none !important; }
.mx-nfbtn { height: 32px; padding: 0 12px; border: 0; border-radius: 2px; color: var(--cream); font: 700 14px var(--pixel); letter-spacing: .04em; background: rgba(244, 233, 205, .05); box-shadow: inset 0 0 0 1px var(--rule); cursor: pointer; white-space: nowrap; }
.mx-nfbtn.on { color: var(--gilt-hi); box-shadow: inset 0 0 0 1px var(--gilt-lo); }

/* the grid of cards: rows are --ch tall, stretched to --chx (marketFit) so a page fills the height */
.mx-grid { --cw: 172px; --ch: 192px; flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--cw), 1fr)); grid-auto-rows: var(--chx, var(--ch)); gap: 12px; align-content: start; overflow: hidden; padding: 2px; }
.mx-grid > .mk-empty { grid-column: 1 / -1; }
.mx-pager { display: flex; align-items: center; justify-content: center; gap: 10px; flex: none; height: 40px; color: var(--cream-2); font: 700 14px var(--sans); }
.mx-pager .mk-pg { height: 30px; min-width: 38px; font-size: 18px; line-height: 1; }
.mx-card { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 8px 10px 9px; border-radius: 3px; color: var(--ink-v); cursor: pointer; text-decoration: none; overflow: hidden;
  background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(180deg, var(--vellum-hi), var(--vellum));
  box-shadow: inset 0 0 0 1px rgba(126, 100, 64, .55), 0 0 0 1px var(--edge), 0 3px 8px rgba(0, 0, 0, .35); }
.mx-card:hover { transform: translateY(-1px); box-shadow: inset 0 0 0 1px var(--gilt), 0 0 0 1px var(--edge), 0 5px 12px rgba(0, 0, 0, .4); }
.mx-card:focus-visible { outline: 2px solid var(--gilt-hi); outline-offset: 2px; }
.mx-card.leg { box-shadow: inset 0 0 0 2px var(--gilt), inset 0 0 0 3px rgba(255, 240, 200, .35), 0 0 0 1px var(--edge), 0 0 14px rgba(201, 169, 94, .35); }
.mx-card.empty { opacity: .62; }
.mx-card { container: mx-card / inline-size; }
/* The top row: count, grade, Aura, rare traits, rarity, Awakened. The heart is pinned to the card's corner so no badge
   can push it off (Jonny 2026-11-17), and the row wraps into a hidden second line, so a badge that doesn't fit drops
   out whole, least important last in the row, instead of being cut in half. The 4 px padding above and below keeps the
   S+ glow from being clipped. */
.mx-ctop { display: flex; flex-wrap: wrap; align-items: center; align-content: flex-start; gap: 14px 4px; box-sizing: border-box; height: 28px; margin: -4px 0; padding: 4px 19px 4px 0; flex: none; overflow: hidden; }
.mx-ctop > .mx-cnt { order: 0; } .mx-ctop > .gr { order: 1; } .mx-ctop > .mx-aura { order: 2; } .mx-ctop > .mx-rtr { order: 3; } .mx-ctop > .mx-rar { order: 4; } .mx-ctop > .mx-awk { order: 5; }
.mx-ctop > .mx-fav { position: absolute; top: 8px; right: 6px; height: 20px; margin: 0; z-index: 1; }
/* Narrow cards say "148" without "for sale", so the rarity keeps its room. */
@container mx-card (max-width: 215px) { .mx-cnt .lg { display: none; } .mx-ctop > .mx-cnt { padding: 0 6px; } }
@container mx-card (max-width: 140px) { .mx-ctop > .mx-rar { padding: 0 4px; font-size: 9.5px; letter-spacing: -.01em; } .mx-ctop > .mx-cnt { padding: 0 5px; } }
.mx-cnt { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 10px; font: 600 12.5px var(--sans); color: var(--muted-v); background: var(--inlay); box-shadow: inset 0 0 0 1px var(--rule-soft); white-space: nowrap; }
.mx-cnt b { color: var(--ink-v); font-weight: 800; }
.mx-live { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--rg-rubric); box-shadow: 0 0 0 2px rgba(119, 41, 31, .25); }
.mx-aura { display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 6px; border-radius: 9px; font: 800 11.5px var(--sans); color: #4b2d00; background: linear-gradient(135deg, #ffe7a3, #f2b84b); box-shadow: 0 0 0 1px rgba(120, 80, 10, .55), 0 0 6px rgba(255, 200, 80, .5); }
.mx-fav { margin-left: auto; padding: 0 2px; border: 0; background: none; cursor: pointer; font-size: 17px; line-height: 1; color: rgba(70, 55, 42, .55); }
.mx-fav:hover { color: #b07a1c; }
.mx-fav.on { color: #b07a1c; text-shadow: 0 0 1px rgba(80, 50, 0, .6); }
.mx-art { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
.mx-art::before { content: ''; position: absolute; left: 50%; bottom: 6%; width: 60%; height: 16%; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(closest-side, rgba(60, 40, 20, .32), transparent); }
.mx-art.rg-midgard::after, .mx-art.rg-hellas::after, .mx-art.rg-yomi::after { content: ''; position: absolute; inset: 8% 18%; border-radius: 50%; z-index: 0; opacity: .5; }
.mx-art.rg-midgard::after { background: radial-gradient(closest-side, rgba(44, 71, 102, .22), transparent); }
.mx-art.rg-hellas::after { background: radial-gradient(closest-side, rgba(168, 136, 78, .28), transparent); }
.mx-art.rg-yomi::after { background: radial-gradient(closest-side, rgba(31, 76, 73, .22), transparent); }
.mx-art img { position: relative; z-index: 1; width: 72px; height: 72px; max-height: 100%; object-fit: contain; image-rendering: pixelated; }
.mx-art.icon img { width: 48px; height: 48px; filter: drop-shadow(0 1px 0 rgba(60, 40, 20, .35)); }
.mx-art.icon::before { display: none; }
.mx-card.awk .mx-art img { filter: drop-shadow(0 0 4px rgba(201, 169, 94, .9)); }
.mx-nm { display: flex; align-items: baseline; gap: 6px; min-width: 0; flex: none; font: 700 15.5px/1.15 var(--sans); }
.mx-nm b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-awk { flex: none; display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 3px; font: 700 11.5px var(--pixel); letter-spacing: .05em; color: #5e4210; background: rgba(201, 169, 94, .35); box-shadow: inset 0 0 0 1px rgba(126, 100, 64, .7); }
.mx-els { display: flex; gap: 4px; height: 18px; margin: 3px 0 5px; align-items: center; flex: none; overflow: hidden; }
.mx-els .el { height: 16px; font-size: 10.5px; padding: 0 6px; border-radius: 3px; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.mx-sub { font: italic 600 13px var(--sans); color: var(--muted-v); white-space: nowrap; }
/* The species' rarity on its Market card (Jonny 2026-11-15), in the rarity colours. */
.mx-rar { height: 17px; line-height: 17px; font: 700 10.5px/17px var(--sans); padding: 0 5px; border-radius: 9px; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .3); white-space: nowrap; flex: none; }
.mx-rar.r-common { background: #8a857a; } .mx-rar.r-uncommon { background: #4e9a3e; } .mx-rar.r-rare { background: #3a78c0; } .mx-rar.r-epic { background: #8a4cc0; } .mx-rar.r-legendary { background: #c08a1a; }
.mx-dots { display: none; gap: 3px; align-self: center; flex: none; }
.mx-eldot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px rgba(40, 25, 10, .45); }
.mx-prices { display: flex; flex-direction: column; gap: 2px; flex: none; padding-top: 5px; border-top: 1px solid var(--rule-soft); }
.mx-px { display: flex; align-items: center; gap: 5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mx-px img { width: 16px; height: 16px; flex: none; }
.mx-px i { font: italic 500 12px var(--sans); color: var(--muted-v); }
.mx-px b { font-weight: inherit; }
.mx-px.gem { font: 800 16px/1.1 var(--sans); color: #1d4d45; }
.mx-px.coin { font: 600 13.5px/1.1 var(--sans); color: var(--muted-v); }
.mx-px.coin img { width: 14px; height: 14px; }
.mx-px .sh { display: none; }
.mx-px.none { opacity: .45; font-weight: 600; }
.mx-px.locked { opacity: .5; }
.mx-lock { width: 11px; height: 12px; color: var(--muted-v); flex: none; }
.mk-qpill { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 3px; font: 800 11.5px var(--sans); color: var(--ink-v); background: var(--inlay-hi); box-shadow: inset 0 0 0 1px var(--gilt-lo); }

/* short screens: denser cards */
@media (max-height: 720px) {
  .mx-grid { --ch: 166px; gap: 10px; }
  .mx-els { display: none; }
  .mx-nm .mx-dots { display: inline-flex; }
  .mx-prices { margin-top: 4px; }
  .mx-art img { width: 56px; height: 56px; }
  .mx-rail { gap: 7px; }
  .mx-rail .mk-cat { height: 27px; }
  .mx-rail .mk-cats { padding: 3px 0; }
  .mx-tog { height: 27px; }
  .mx-fbtn { padding: 6px 12px; }
  .mx-head { height: 42px; }
  .mx-head h1 { font-size: 28px; }
  .mx-browse { padding-top: 8px; }
  .mx-tool { margin-bottom: 8px; height: 36px; }
  .mx-pager { height: 36px; }
}

/* narrow: the rail folds into a toolbar and kind chips */
@media (max-width: 1099px) {
  .mx-browse { grid-template-columns: minmax(0, 1fr); padding-top: 8px; }
  .mx-rail { display: none; }
  .mx-tool .mk-title, .mx-tool .mx-alerts > span { display: none; }
  .mx-nsearch { display: flex !important; flex: 1 1 auto; height: 34px; order: -1 !important; min-width: 0; }
  .mx-nfbtn { display: inline-block !important; }
  .mx-tool { height: 34px; gap: 8px; margin-bottom: 8px; }
  .mx-tool .mk-sortsel span { display: none; }
  .page .mx-tool .mk-sortsel select { min-width: 120px; }
  .mx-kinds { display: flex !important; gap: 4px; flex: none; height: 32px; margin-bottom: 8px; }
  .mx-kc { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px 0 6px; border: 0; border-radius: 2px; white-space: nowrap; cursor: pointer;
    color: var(--cream); font: 700 14px var(--pixel); letter-spacing: .03em; background: rgba(244, 233, 205, .05); box-shadow: inset 0 0 0 1px var(--rule-soft); }
  .mx-kc .mc-ico { display: grid; place-items: center; width: 22px; height: 22px; }
  .mx-kc .mc-ico img { width: 20px; height: 20px; image-rendering: pixelated; }
  .mx-kc .mc-svg svg { width: 18px; height: 18px; } .mx-kc .mc-svg { color: var(--gilt-hi); display: grid; }
  .mx-kc.on { color: var(--rg-rubric); background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(180deg, var(--vellum-hi), var(--vellum)); box-shadow: inset 0 0 0 1px var(--edge); }
  .mx-kc.on .mc-svg { color: var(--rg-ink); }
  .mx-kc.more { padding: 0 10px; }
  .mx-grid { --cw: 142px; --ch: 156px; gap: 10px; }
  .mx-els { display: none; }
  .mx-nm .mx-dots { display: inline-flex; }
  .mx-prices { margin-top: 4px; }
  .mx-art img { width: 56px; height: 56px; }
  .mx-head { gap: 12px; }
  .mx-head h1 { font-size: 26px; }
  .mx-tabs.subtabs a { padding: 0 9px; font-size: 14px; }
  .mx-cnt .lg { display: none; }
  .mx-px.coin .lg { display: none; } .mx-px.coin .sh { display: inline; }
}
@media (max-width: 1099px) and (max-height: 620px) {
  .mx-grid { --ch: 144px; }
  .mx-art img { width: 48px; height: 48px; }
  .mx-head { height: 40px; }
  .mx-tabs.subtabs a { height: 34px; }
}
/* More: the kinds that don't fit as chips */
.mx-kmore { position: relative; display: inline-flex; }
.mx-kmenu { position: absolute; z-index: 6; top: calc(100% + 4px); right: 0; display: flex; flex-direction: column; gap: 3px; min-width: 170px; padding: 6px; border-radius: 3px;
  background: var(--leather, #2b1d12); box-shadow: 0 0 0 1px var(--edge), 0 0 0 2px var(--gilt-lo), 0 8px 18px rgba(0, 0, 0, .5); }
.mx-kmenu .mx-kc { justify-content: flex-start; }

/* phones */
@media (max-width: 560px) {
  .mx-head { height: auto; flex-wrap: wrap; gap: 0; border: 0; }
  .mx-head h1, .mx-wallet { display: none; }
  .mx-tabs.subtabs { width: 100%; justify-content: space-between; border-bottom: 1px solid var(--rule-soft); }
  .mx-tabs.subtabs a { padding: 0 6px; height: 36px; font-size: 13.5px; letter-spacing: .03em; }
  :is(.mx, .mx-head) .lg { display: none; }
  :is(.mx, .mx-head) .sh { display: inline; }
  .mx-tabs .sh { display: inline-flex !important; align-items: center; gap: 3px; }
  .mx-tool .mx-sort, .mx-tool .mx-cur { display: none; }
  .mx-kc span:not(.mc-ico) { font-size: 13px; }
  .mx-kinds > .mx-kc:nth-child(n+5) { display: none; }
  .mx-kinds > .mx-kc:first-child span:not(.mc-ico) { display: none; }
  .mx-kinds > .mx-kc:first-child { padding: 0 6px; }
  .mx-kc { padding: 0 8px 0 5px; }
  .mx-grid { --cw: 150px; --ch: 168px; gap: 10px; }
  .mx-px.gem { font-size: 16px; }
}
@media (max-width: 560px) and (max-height: 700px) { .mx-grid { --ch: 156px; } }
/* 341-380 px phones: four kind chips and More ran 30 px past the screen's edge (More was cut); three show, the rest wait under More. */
@media (max-width: 380px) { .mx-kinds > .mx-kc:nth-child(n+4) { display: none; } }
/* the smallest phones: one compact row per card, so four or more show */
@media (max-width: 340px) {
  .mx-grid { --cw: 100%; --ch: 60px; grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .mx-card { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-areas: "art name prices" "art meta prices"; column-gap: 8px; align-items: center; padding: 6px 8px; }
  .mx-card .mx-art { grid-area: art; }
  .mx-card .mx-art img { width: 44px; height: 44px; }
  .mx-card .mx-art.icon img { width: 34px; height: 34px; }
  .mx-art::after, .mx-art::before { display: none; }
  .mx-card .mx-nm { grid-area: name; font-size: 14.5px; }
  .mx-card .mx-ctop { grid-area: meta; gap: 14px 4px; height: 26px; padding-right: 0; }
  .mx-card .mx-ctop .gr, .mx-card .mx-fav, .mx-card .mx-awk { display: none; }
  .mx-card .mx-cnt { height: 18px; font-size: 11.5px; }
  .mx-card .mx-els { display: none; }
  .mx-card .mx-prices { grid-area: prices; border: 0; padding: 0; margin: 0; align-items: flex-end; gap: 3px; }
  .mx-card .mx-px.gem { font-size: 14.5px; }
  .mx-card .mx-px.coin { font-size: 12.5px; }
  .mx-px i { display: none; }
  .mx-kinds > .mx-kc:nth-child(n+4) { display: none; }
  .mx-tabs.subtabs a { padding: 0 4px; font-size: 12.5px; }
}

/* ---------- a card's offers page ---------- */
.mx-sp { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-top: 8px; }
.mx-back { flex: none; align-self: flex-start; margin-bottom: 6px; text-decoration: none; }
.mx-o > .mx-back { margin-top: 8px; }
.mx-hero { position: relative; flex: none; display: flex; align-items: center; gap: 16px; padding: 8px 16px; color: var(--ink-v); border: 7px solid transparent; border-image: url(themes/codex/frame.svg) 20 / 22px stretch;
  background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(180deg, var(--vellum-hi), var(--vellum)); }
.mx-hart { position: relative; flex: none; display: grid; place-items: center; width: 84px; height: 72px; }
.mx-hart img { position: relative; z-index: 1; width: 96px; height: 96px; margin: -12px 0; object-fit: contain; image-rendering: pixelated; }
.mx-hart.icon img { width: 56px; height: 56px; margin: 0; filter: drop-shadow(0 1px 0 rgba(60, 40, 20, .35)); }
.mx-hname { min-width: 0; }
.mx-hname h2 { margin: 0 0 6px; font: 700 26px/1 var(--display); color: var(--ink-v); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-hmeta { display: flex; align-items: center; gap: 6px; font: 600 14px var(--sans); color: var(--muted-v); white-space: nowrap; }
.mx-hmeta .el { height: 17px; font-size: 11px; border-radius: 3px; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.mx-hmeta span:last-child { margin-left: 6px; }
.mx-hstats { margin-left: auto; display: flex; gap: 22px; }
.mx-hstats > div { display: flex; flex-direction: column; gap: 3px; }
.mx-hstats > div > i { font: italic 500 12.5px var(--sans); color: var(--muted-v); white-space: nowrap; }
.mx-hstats b { display: inline-flex; align-items: center; gap: 5px; font: 800 20px/1 var(--sans); color: var(--ink-v); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mx-hstats b img { width: 18px; height: 18px; }
.mx-hstats .gem b { color: #1d4d45; font-size: 22px; }
.mx-hstats b.lock .mx-lock { width: 15px; height: 17px; }
.mx-fav.big { margin-left: 4px; font-size: 26px; }
.mx-spf { flex: none; display: flex; align-items: center; gap: 14px; height: 40px; margin: 8px 0; }
.mx-chipf { border: 0; background: none; padding: 0; cursor: pointer; opacity: .6; }
.mx-chipf.on { opacity: 1; filter: drop-shadow(0 0 4px rgba(255, 200, 80, .6)); }
.mx-chipf .aura-tag { font-size: 13px; padding: 4px 10px; }
.mx-fg { display: flex; align-items: center; gap: 7px; font: 700 14px var(--pixel); letter-spacing: .03em; color: var(--cream-2); }
.mx-fg .mk-seg { flex-wrap: nowrap; }
.mx-fg .mk-seg button { height: 28px; padding: 0 9px; color: var(--cream-2); background: rgba(244, 233, 205, .05); }
.mx-fg .mk-seg button.on { color: var(--ink-v); background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(180deg, #e4d6b6, var(--vellum-hi)); }
.mx-spf .mx-sort { margin-left: auto; }
/* Creature offers keep a Filters button at every width: Quality, Level and Element live only in the panel. */
.mx-spf:not(.cr) .mx-nfbtn.sp { display: none !important; }
.mx-spf.cr .mx-nfbtn.sp { display: inline-block !important; flex: none; }
/* Mid-width windows: Talent and Bloodline step into the Filters panel so the row never runs off the page. */
@media (max-width: 1365px) { .mx-spf.cr .mx-fg.f-talentMin, .mx-spf.cr .mx-fg.f-blood { display: none; } }
.mx-spf .mx-cur button { height: 28px; padding: 0 8px; }
.mx-sptabs { display: none; }
.mx-spgrid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; }
.mx-spgrid > * { min-height: 0; }
.mx-spleft { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.mx-offers.mk-board { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
/* the last column is the deal: a bid line over a buy line (.mx-deal, below) */
.mx-ohead, .mx-orow { display: grid; grid-template-columns: 50px minmax(0, 1fr) 62px 74px 62px 76px 46px 286px; align-items: center; gap: 8px; padding: 0 12px 0 10px; }
.k-relic :is(.mx-ohead, .mx-orow), .k-held :is(.mx-ohead, .mx-orow), .k-shrine :is(.mx-ohead, .mx-orow), .k-item :is(.mx-ohead, .mx-orow) { grid-template-columns: 50px minmax(0, 1fr) 70px 286px; }
.mx-ohead { flex: none; height: 32px; font: 700 13px var(--pixel); letter-spacing: .06em; color: var(--rg-rubric); border-bottom: 1px solid var(--rule); }
.mx-ohead .c, .mx-oc.g, .mx-oc.s, .mx-oc.t, .mx-oc.b, .mx-oc.l { text-align: center; }
.mx-ohead .r { text-align: right; }
.mx-orows { --rh: 58px; flex: 1; min-height: 0; overflow: hidden; }
.mx-orows > .mk-empty { color: var(--muted-v); }
.mx-orow { height: var(--rhx, var(--rh)); border-bottom: 1px solid var(--rule-soft); }
.mx-orow.aura { background: linear-gradient(90deg, rgba(255, 214, 120, .28), transparent 65%); }
.mx-orow.focus { box-shadow: inset 3px 0 0 var(--wax); background: rgba(201, 169, 94, .14); }
.mx-orow .mk-art { width: 46px; height: 46px; }
.mx-orow .mk-art img { width: 40px; height: 40px; max-width: none; max-height: none; object-fit: contain; }
.mx-orow .mk-art:not(.crt) img { width: 30px; height: 30px; }
.mx-ow { min-width: 0; }
.mx-on { display: flex; align-items: center; gap: 6px; font: 700 15px var(--sans); white-space: nowrap; min-width: 0; }
.mx-on b { overflow: hidden; text-overflow: ellipsis; }
.mx-on .aura-tag { font-size: 11.5px; flex: none; }
.mx-orelic { width: 16px; height: 16px; image-rendering: pixelated; flex: none; }
.mx-os { font: 500 13px var(--sans); color: var(--muted-v); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-sel { font-style: italic; }
.mx-oc { font: 700 15px var(--sans); color: var(--ink-v); font-variant-numeric: tabular-nums; }
.mx-dash { font-style: normal; color: var(--faint-v); opacity: .6; }
.mx-oc.p { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 0; }
.mx-op { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.mx-op img { width: 16px; height: 16px; }
.mx-op.gem { font: 800 16.5px var(--sans); color: #1d4d45; }
.mx-op.coin { font: 700 15px var(--sans); color: var(--ink-v); }
.mx-or { display: inline-flex; align-items: center; gap: 3px; font: 500 12.5px var(--sans); color: var(--muted-v); white-space: nowrap; }
.mx-or img { width: 12px; height: 12px; }
.mx-oc.a { display: flex; flex-direction: column; gap: 3px; align-items: stretch; }
.mx-oc.a .btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 24px; min-height: 0; padding: 0 8px; white-space: nowrap; font-size: 12.5px; }
.mx-oc.a .btn img { width: 13px; height: 13px; }
.mx-oc.a .btn:only-child { height: 30px; }
.mx-oc.a .mk-duo { gap: 3px; }
/* Armed, a buy button grows left to its whole label (Confirm, the price, the dollars) over the price beside it. */
.mx-oc.a .btn.armed { align-self: flex-end; width: max-content; max-width: none; z-index: 1; }
/* the money call to action: gilt, with the gem */
.btn.mx-need, .mx-oc.a .btn.mx-need { color: #2a1d10; font-weight: 800; background: linear-gradient(180deg, #e9d39a, #c9a95e 60%, #a9884a); box-shadow: inset 0 1px 0 rgba(255, 245, 210, .7), 0 0 0 1px #5a4320, 0 1px 2px rgba(0, 0, 0, .3); text-shadow: none; }
.btn.mx-need:hover { filter: brightness(1.06); }
.mx-div { height: 26px; display: flex; align-items: center; gap: 10px; padding: 0 14px; font: 700 12.5px var(--pixel); letter-spacing: .08em; color: var(--muted-v); }
.mx-div::before, .mx-div::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
.mx-div span { display: inline-flex; align-items: center; gap: 5px; }
.mx-div img { width: 13px; height: 13px; }
.mx-ostat { display: none; }

/* ---------- one listing, both ways: the deal cell (client/market-view.ts dealCell) ----------
   Two lines, each a note, a price and a button: where the bidding stands over the Buy now price. One line when a
   listing has only one. A currency icon always sits on the line of its number (Cole 2026-11-20). */
.mx-deal { display: grid; grid-template-columns: minmax(0, 1fr) auto 76px; align-items: center; gap: 3px 8px; min-width: 0; }
.mx-dl { display: contents; }
/* A note gives way to its price and button: when the three don't fit (a 10,000,000 price beside "Need 9.9M"), the
   whole note drops to a second line that is cut off, so it never runs over the column beside it or shows half. */
.mx-dn { justify-self: stretch; display: flex; flex-wrap: wrap; justify-content: flex-end; align-content: flex-start; height: 20px; overflow: hidden; min-width: 0; font: 500 12.5px/1 var(--sans); color: var(--muted-v); white-space: nowrap; }
.mx-dn::before { content: ''; flex: none; width: 0; height: 20px; }
.mx-dni { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 20px; }
.mx-dni > .mx-alt:last-child { margin-right: 0; }
.mx-dn img { width: 12px; height: 12px; flex: none; }
.mx-dn .co { font: 700 13.5px/1 var(--sans); color: var(--ink-v); display: inline-flex; align-items: center; gap: 3px; }
.mx-alt { display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 5px; margin: 0 -2px 0 0; border: 0; border-radius: 2px; cursor: pointer; font: 700 13.5px/1 var(--sans); color: var(--ink-v); background: none; box-shadow: inset 0 0 0 1px var(--rule-soft); font-variant-numeric: tabular-nums; }
.mx-alt:hover { background: var(--inlay-hi); box-shadow: inset 0 0 0 1px var(--gilt-lo); }
.mx-alt.armed { color: #2a1d10; background: linear-gradient(180deg, #e9d39a, #c9a95e 60%, #a9884a); box-shadow: inset 0 0 0 1px #5a4320; }
.mx-deal .mx-op { justify-self: end; line-height: 1; }
.mx-deal .mx-op.gem { font-size: 16px; }
.mx-deal .mx-op.win { color: #285020; } .mx-deal .mx-op.lose { color: #a8481c; }
.mx-deal .btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 24px; min-height: 0; padding: 0 8px; white-space: nowrap; font-size: 12.5px; line-height: 1; }
.mx-deal .btn img { width: 13px; height: 13px; flex: none; }
.mx-deal.one .btn { height: 30px; }
.mx-deal .btn.armed { justify-self: end; width: max-content; max-width: none; z-index: 1; }
/* Short of gems, the button reads "Need 99.2k": its column grows to the label, so no amount is ever cut off.
   On wide screens a list with one widens the column on every row, so prices and buttons still line up down the list. */
.mx-deal:has(.mx-need) { grid-template-columns: minmax(0, 1fr) auto minmax(76px, max-content); }
@media (min-width: 1101px) { .mx-orows:has(.mx-need) .mx-deal { grid-template-columns: minmax(0, 1fr) auto minmax(104px, max-content); } }
.mx-deal .mx-top { justify-self: stretch; height: 24px; padding: 0 6px; font-size: 12px; }
.mx-deal.one .mx-top { height: 30px; }
.mx-deal .mx-bids { justify-self: center; }
.mx-op img, .mx-dn img, .mx-alt img, .mx-deal .btn img, .mk-bcur { display: block; }
/* The digits of the text face sit a little below the middle of their line box, so an icon centred on the box
   reads as riding high: one pixel down puts its middle on the middle of the digits. Capital-letter labels
   (the primary buttons) are already centred. Checked by measuring ink centres, never by eye alone. */
.mx-op img, .mx-dn img, .mx-alt img, .btn img.mk-bcur { position: relative; top: 1px; }
.btn.primary img.mk-bcur { top: 0; }
/* The same pixel for the Market's other prices: the wallet, a card's prices, the species header, History, the switches. */
.mx-bal img, .mx-px img, .mx-hstats b img, .mk-money img, .mk-flow img, .mx-low img, .mk-seg img[src*="icon-gem"] { position: relative; top: 1px; }
@media (min-width: 1100px) { .mx-hstats b img:not([src*="icon-gem"]) { top: 2px; } }
.mx-recent b img { position: relative; top: 1px; }
/* An item's page: the big price in the header sits lower in its line, the small "yours" price higher. */
.mk-hprice .mk-money.big img { top: 2px; }
.mk-own .mk-money img { top: 0; }
dd .mk-money.big.gem img { top: 2px; }
@media (min-width: 761px) { .mk-icur img:not([src*="icon-gem"]) { position: relative; top: 1px; } }
/* A button with a currency icon lays icon and label on one line wherever it sits (a creature's card, a pop-up). */
.btn:has(> img.mk-bcur) { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
/* A creature's card: Bid and Buy side by side, the time left beside the seller. */
.pk-acts .mk-duo { flex-direction: row; gap: 6px; }
.pk-band .mx-ends { margin-left: 6px; }
/* The card's band is set in the display face, whose figures hang below the line: the icon comes down to their middle. */
.pk-price img { position: relative; top: 3px; }
.mk-icur img[src*="icon-gem"] { position: relative; top: 1px; }
.mx-on .mx-oend { display: none; }
.mx-ostat .mx-oend { display: contents; }
/* The smallest phones: the price beside a button already carries the icon, and the pop-up's main button takes its own row. */
@media (max-width: 340px) {
  .mx-dl .btn img.mk-bcur { display: none; }
  .mx-card .mx-px img { top: 0; }
  .mx-dl .btn { min-width: 0; padding: 0 8px; }
  /* The stats line has no room for the time left: it rides the name line, in place of the trait's effect. */
  .mx-ostat { gap: 3px; font-size: 11.5px; } .mx-ostat .str-x { font-size: 11.5px; }
  .mx-ostat .mx-oend, .mx-on .mx-tfx { display: none; }
  .mx-on .mx-oend { display: inline-flex; flex: none; } .mx-on .mx-oend .mx-ends { font-size: 11.5px; }
  .mx-orow .mx-on b:has(+ .mx-tfx) { flex: 0 1 auto; min-width: 0; }
  .mx-bidd .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .mx-bidd .actions:has(> :nth-child(3)) .btn.primary { grid-column: 1 / -1; grid-row: 2; }
}
.mx-st { display: inline-flex; align-items: center; height: 17px; padding: 0 6px; border-radius: 2px; font: 800 10.5px/1 var(--pixel); letter-spacing: .08em; text-transform: uppercase; }
.mx-st.win { color: #1f4a2a; background: rgba(40, 80, 32, .16); box-shadow: inset 0 0 0 1px rgba(40, 80, 32, .55); }
.mx-st.lose { color: #fff3e0; background: linear-gradient(180deg, #c8622a, #a8481c); box-shadow: inset 0 0 0 1px #6e2c10; }
.mx-st.unsold { color: var(--ink-v); background: rgba(90, 70, 40, .16); box-shadow: inset 0 0 0 1px var(--rule); }
/* time left: an hourglass and the countdown; amber in the last hour, an ember chip in the last ten minutes */
.mx-ends { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; font: 600 12.5px/1 var(--sans); color: var(--muted-v); font-variant-numeric: tabular-nums; }
.mx-ends svg { width: 11px; height: 12px; flex: none; }
.mx-ends.soon { color: #8a5a00; font-weight: 700; }
.mx-ends.going { color: #fff3e0; font-weight: 800; padding: 0 6px; height: 17px; border-radius: 2px; background: linear-gradient(180deg, #c8622a, #a8481c); box-shadow: inset 0 0 0 1px #6e2c10; }
.mx-oc.e { text-align: center; }
.mx-oc.e .mx-ends { font-size: 14.5px; font-weight: 700; color: var(--ink-v); }
.mx-oc.e .mx-ends.soon { color: #8a5a00; }
.mx-oc.e .mx-ends.going { color: #fff3e0; height: 22px; padding: 0 8px; }
.mx-orow.mine-top { box-shadow: inset 3px 0 0 #3d6b36; }
.mx-orow.mine-out { box-shadow: inset 3px 0 0 #b0521f; }
@media (max-width: 1100px) {
  .mx-deal { grid-template-columns: minmax(0, 1fr) auto 64px; gap: 2px 6px; }
  .mx-deal:has(.mx-need) { grid-template-columns: minmax(0, 1fr) auto minmax(64px, max-content); }
  .mx-deal .btn.mx-need { padding: 0 6px; }
  .mx-deal .btn, .mx-deal .mx-top { height: 21px; font-size: 12px; }
  .mx-deal.one .btn, .mx-deal.one .mx-top { height: 28px; }
  .mx-deal .mx-op.gem { font-size: 15px; }
  .mx-dn { font-size: 12px; } .mx-dn .co, .mx-alt { font-size: 12.5px; }
}
@media (max-width: 760px) {
  .mx-deal { grid-area: deal; grid-template-columns: auto 58px; gap: 4px 6px; align-self: center; }
  .mx-deal:has(.mx-need) { grid-template-columns: auto minmax(58px, max-content); }
  .mx-deal .mx-dn { display: none; }
  .mx-deal .btn, .mx-deal.one .btn, .mx-deal .mx-top, .mx-deal.one .mx-top { height: 24px; padding: 0 6px; }
  .mx-deal .mx-op, .mx-deal .mx-op.gem { font-size: 14.5px; }
  .mx-oc.e { display: none; }
  .mx-ostat .mx-ends { font-size: 12.5px; }
}

/* ---------- the bid pop-up (bidDialog) ---------- */
.mx-bidd .mx-bstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 10px 0 2px; padding: 8px 0; border-top: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule-soft); }
.mx-bstats div { padding: 0 10px; border-left: 1px solid var(--rule-soft); } .mx-bstats div:first-child { border-left: 0; padding-left: 0; }
.mx-bstats i { display: block; font: 700 11.5px/1 var(--pixel); letter-spacing: .06em; color: var(--rg-rubric); font-style: normal; text-transform: uppercase; }
.mx-bstats b { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; font: 800 17px/1 var(--sans); color: var(--ink-v); font-variant-numeric: tabular-nums; }
.mx-bstats b img { display: block; width: 15px; height: 15px; }
.mx-bstats b img { position: relative; top: 1px; }
.mx-bidd .mx-dsec { margin-top: 10px; }
.mx-bidd .mx-drow label { width: auto; white-space: nowrap; }
.mx-bidd .mx-dchips { margin-left: 0; } .mx-bidd .mx-keep { margin-left: 0; }
.mx-bidd .mx-ornow { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 8px 12px; border-radius: 3px; background: var(--inlay); box-shadow: inset 0 0 0 1px var(--rule-soft); font: 600 13.5px/1 var(--sans); color: var(--muted-v); }
.mx-ornow b { display: inline-flex; align-items: center; gap: 8px; }
.mx-ornow b i { font: 500 12.5px/1 var(--sans); font-style: normal; color: var(--muted-v); }
.mx-ornow .mx-op { line-height: 1; } .mx-ornow .mx-op img { display: block; }
.mx-dchips .mk-chip.on { background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(180deg, #e4d6b6, var(--vellum-hi)); box-shadow: inset 0 0 0 1px var(--gilt-lo), 0 0 0 1px var(--gilt-lo); }
.mx-spside { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: hidden; }
.mx-spside .panel { margin: 0; padding: 12px 14px; color: var(--ink-v); }
.mx-sell { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.mx-ph { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.mx-ph h4 { margin: 0; }
.mx-ph .mk-seg button { height: 24px; padding: 0 7px; font-size: 12.5px; }
.mx-ph .mk-seg img { width: 13px; height: 13px; }
.mx-chart { display: block; width: 100%; height: 96px; }
.mx-chart.none { display: grid; place-items: center; font: italic 600 13px var(--sans); color: var(--muted-v); background: var(--inlay); border-radius: 3px; }
.mx-chart .g line { stroke: var(--rule-soft); stroke-width: 1; }
.mx-chart .a { fill: rgba(29, 77, 69, .16); }
.mx-chart .l { fill: none; stroke: #1d4d45; stroke-width: 2; vector-effect: non-scaling-stroke; }
.mx-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 8px 0; }
.mx-stats div { display: flex; flex-direction: column; gap: 2px; }
.mx-stats i { font: italic 500 11.5px var(--sans); color: var(--muted-v); white-space: nowrap; }
.mx-stats b { font: 800 15px var(--sans); color: #1d4d45; }
.mx-recent { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; border-top: 1px solid var(--rule-soft); }
.mx-recent div { display: flex; align-items: center; gap: 6px; font: 600 13px var(--sans); color: var(--muted-v); }
.mx-recent b { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; color: #1d4d45; }
.mx-recent b img { width: 13px; height: 13px; }
.mx-recent span:last-child { width: 26px; text-align: right; }
.mx-recent .aura-tag { font-size: 10.5px; padding: 1px 5px; }
.page .mx-every { margin-top: 6px; padding: 0; border: 0; background: none; box-shadow: none; cursor: pointer; font: 600 13px var(--sans); color: var(--accent-v, #77291f); text-decoration: underline; text-underline-offset: 2px; }
.mx-own { font: 600 13px var(--sans); color: var(--muted-v); }
.mx-mines { flex: 1; min-height: 0; overflow: hidden; }
.mx-mine { display: flex; align-items: center; gap: 8px; padding: 4px 0; font: 600 13.5px var(--sans); }
.mx-mine .mk-art { width: 38px; height: 38px; flex: none; }
.mx-mine .mk-art img { width: 34px; height: 34px; max-width: none; object-fit: contain; }
.mx-mine .mk-art:not(.crt) img { width: 26px; height: 26px; }
.mx-mine > span:nth-child(2) { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; }
.mx-sell .mk-none { margin: 0; font: italic 600 13px var(--sans); color: var(--muted-v); }
.mx-mpg { display: flex; align-items: center; gap: 8px; height: 30px; font: 600 13px var(--sans); color: var(--muted-v); }
.mx-mpg .btn { height: 24px; min-height: 0; padding: 0 9px; }

@media (max-height: 720px) {
  .mx-hero { padding: 4px 14px; }
  .mx-hart { height: 56px; }
  .mx-hart img { width: 72px; height: 72px; margin: -8px 0; }
  .mx-hart.icon img { width: 44px; height: 44px; margin: 0; }
  .mx-hname h2 { font-size: 23px; margin-bottom: 4px; }
  .mx-spf { height: 34px; margin: 6px 0; }
  .mx-orows { --rh: 54px; }
  .mx-recent { display: none; }
  .mx-chart { height: 50px; }
  .mx-spside { gap: 8px; }
  .mx-spside .panel { padding: 9px 12px; }
  .mx-spside .mx-ph { margin-bottom: 4px; }
  .mx-stats { margin: 4px 0; }
}
@media (max-width: 1099px) {
  .mx-spgrid { grid-template-columns: minmax(0, 1fr); }
  .mx-spside { display: none; }
  /* For sale, Price history and Sell yours take turns */
  .mx-sptabs { display: flex; flex: none; gap: 2px; height: 32px; margin-bottom: 6px; border-bottom: 1px solid var(--rule-soft); }
  .mx-sptabs button { display: inline-flex; align-items: center; padding: 0 10px; border: 0; background: none; font: 700 14px var(--pixel); letter-spacing: .04em; color: var(--muted-l); cursor: pointer; white-space: nowrap; }
  .mx-sptabs button.on { color: var(--ink-l); box-shadow: inset 0 -2px 0 var(--gilt); }
  .sp-hist .mx-spleft, .sp-sell .mx-spleft { display: none; }
  .sp-hist .mx-spside, .sp-sell .mx-spside { display: flex; }
  .sp-hist .mx-sell, .sp-sell .mx-hist { display: none; }
  .sp-hist .mx-spf, .sp-sell .mx-spf { visibility: hidden; }
  .sp-hist .mx-chart { height: 140px; }
  .sp-hist .mx-recent { display: flex; }
  .mx-hstats .lastsold { display: none; }
  .mx-hstats { gap: 16px; }
  .mx-fg { display: none; }
  .mx-spf .mx-nfbtn.sp { display: inline-block !important; }
  .mx-ohead, .mx-orow { grid-template-columns: 46px minmax(0, 1fr) 40px 52px 44px 44px 36px 232px; gap: 6px; }
  .k-relic :is(.mx-ohead, .mx-orow), .k-held :is(.mx-ohead, .mx-orow), .k-shrine :is(.mx-ohead, .mx-orow), .k-item :is(.mx-ohead, .mx-orow) { grid-template-columns: 46px minmax(0, 1fr) 60px 232px; }
  .k-creature .mx-ohead span:nth-child(6) { font-size: 0; } .k-creature .mx-ohead span:nth-child(6)::after { content: 'Blood'; font-size: 13px; }
  .k-creature .mx-ohead span:nth-child(4) { font-size: 0; } .k-creature .mx-ohead span:nth-child(4)::after { content: attr(data-short); font-size: 13px; }
  .mx-sp > .mx-back { display: none; }
  .mx-spf .mx-cur { display: none; }
  .mx-awk { font-size: 0; padding: 0 5px; } .mx-awk::after { content: 'Awk'; font-size: 11px; }
}
@media (max-width: 1099px) and (max-height: 620px) {
  .mx-hero { padding: 0 12px; gap: 10px; }
  .mx-hname { display: flex; align-items: baseline; gap: 10px; }
  .mx-hname h2 { margin: 0; }
  .mx-hmeta span:last-child { display: none; }
  .mx-hstats > div { flex-direction: row; align-items: baseline; gap: 6px; }
  .mx-hart { width: 60px; height: 48px; }
  .mx-hart img { width: 56px; height: 56px; margin: -4px 0; }
  .mx-hart.icon img { width: 36px; height: 36px; margin: 0; }
  .mx-hname h2 { font-size: 21px; }
  .mx-hstats b { font-size: 17px; } .mx-hstats .gem b { font-size: 18px; }
  .mx-spf { height: 30px; margin: 4px 0; }
  .mx-spf .mx-nfbtn { height: 26px; }
  .page .mx-tool .mk-sortsel select, .page .mx-spf .mk-sortsel select { height: 28px; }
  .mx-orows { --rh: 48px; }
  .mx-oc.a .mk-duo .btn { height: 21px; }
  .mx-ohead { height: 24px; }
  .mx-sptabs { height: 28px; margin-bottom: 4px; }
  .sp-hist .mx-chart { height: 90px; }
}
@media (max-width: 560px) {
  .mx-hero { flex-wrap: wrap; gap: 4px 10px; padding: 4px 10px; }
  .mx-hart { width: 56px; height: 52px; }
  .mx-hart img { width: 56px; height: 56px; margin: 0; }
  .mx-hart.icon img { width: 38px; height: 38px; }
  .mx-hname { display: block; flex: 1; min-width: 0; padding-right: 30px; }
  .mx-hstats > div { flex-direction: column; align-items: flex-start; gap: 2px; }
  .mx-hname h2 { font-size: 21px; margin-bottom: 3px; }
  .mx-hmeta span:last-child { display: none; }
  .mx-hstats { width: 100%; margin: 0; justify-content: space-between; gap: 8px; padding-top: 4px; border-top: 1px solid var(--rule-soft); }
  .mx-hstats b { font-size: 16px; } .mx-hstats .gem b { font-size: 17px; }
  .mx-fav.big { position: absolute; right: 10px; top: 8px; }
  .mx-spf .mx-fg, .mx-spf .mx-sort { display: none; }
  .mx-spf { height: 32px; margin: 6px 0; }
  .mx-spf .mx-nfbtn.sp { margin-left: auto; }
  .mx-sptabs button { padding: 0 7px; font-size: 13px; }
  .mx-ohead { display: none; }
  .mx-offers.mk-board { border-width: 5px; }
  .mx-orows { --rh: 64px; }
  .mx-orow, .k-relic .mx-orow, .k-held .mx-orow, .k-shrine .mx-orow, .k-item .mx-orow { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "art what deal" "art stats deal"; grid-template-rows: auto auto; gap: 2px 8px; padding: 5px 8px; align-content: center; }
  .mx-orow .mk-art { grid-area: art; width: 38px; height: 38px; } .mx-orow .mk-art img { width: 34px; height: 34px; }
  .mx-ow { grid-area: what; } .mx-ow .mx-os { display: none; }
  .mx-orow .mx-oc.g, .mx-orow .mx-oc.s, .mx-orow .mx-oc.t, .mx-orow .mx-oc.b, .mx-orow .mx-oc.l { display: none; }
  .mx-oc.p { grid-area: price; flex-direction: row; align-items: center; gap: 6px; }
  .mx-or { display: none; }
  .mx-oc.a { grid-area: act; flex-direction: row; justify-content: flex-end; }
  .mx-oc.a .btn, .mx-oc.a .btn:only-child { height: 24px; }
  /* coins or gems: the two buttons side by side */
  .mx-oc.a .mk-duo { display: flex; flex-direction: row; gap: 4px; }
  .mx-ostat { grid-area: stats; display: flex !important; align-items: center; gap: 6px; font: 600 12.5px var(--sans); color: var(--muted-v); white-space: nowrap; overflow: hidden; }
  /* the time left never gets cut at the row's edge: Talent and level give way first, then the name line's trait */
  .mx-ostat > * { flex: none; }
  .mx-ostat .mx-stt { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .mx-ostat .mx-oend { display: inline-flex; align-items: center; gap: 4px; flex: none; white-space: pre; }
  .mx-orow .mx-on { overflow: hidden; }
  .mx-orow .mx-on > b, .mx-orow .mx-on > b:has(+ .mx-tfx) { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .mx-orow .mx-on > .mx-tfx { flex: 0 9999 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .mx-div { height: 22px; }
}

/* the smallest phones: shorter offer rows and a smaller header */
@media (max-width: 340px) {
  .mx-orows { --rh: 52px; }
  .mx-orow, .k-relic .mx-orow, .k-held .mx-orow, .k-shrine .mx-orow, .k-item .mx-orow { padding: 3px 6px; column-gap: 6px; }
  .mx-hstats > div:first-child { display: none; }
  .mx-hart { width: 46px; height: 44px; } .mx-hart img { width: 46px; height: 46px; }
}

/* ---------- Browse: ending soon (soonPane) ---------- */
/* One board of every kind: art, offer, grade (or quality), strength, Talent, Lv, ends, the deal. */
.mx-soon :is(.mx-ohead, .mx-orow) { grid-template-columns: 50px minmax(0, 1fr) 62px 74px 62px 46px 100px 286px; }
.mx-soonv .mx-offers.mk-board { flex: 1; }
/* The name keeps its width while the trait gives way first; once the trait is gone the name itself shortens, so an
   Aura tag and a Bloodline crest never push it under the grade. */
.mx-soon .mx-on > b { flex: 0 1 auto; min-width: 0; }
.mx-soon .mx-on .sp-nm { font-weight: 800; }
.mx-soon .mx-on .tr { font: 500 13px var(--sans); color: var(--muted-v); overflow: hidden; text-overflow: ellipsis; flex: 0 9999 auto; min-width: 0; }
.mx-soon .mx-os { display: flex; align-items: center; gap: 6px; }
@media (max-width: 560px) { .mx-soon .mx-ow .mx-os { display: none; } }
.mx-soon .mx-oc.s { text-align: center; }
.mx-soonnone { flex: 1; margin: 0; }
.mx-soonnone a { color: var(--gilt); }
.mc-svg.hg svg, .mk-cat .mc-svg.hg svg { width: 18px; height: 20px; }
/* The rail has no scroll: with the Ending soon entry its rows are a little shorter, so Filters still shows at 1366x768 and 1366x657. */
.mx-rail .mk-cats { padding: 2px 0; }
.mx-rail .mk-cat { height: 30px; }
@media (max-height: 720px) and (min-width: 1100px) {
  .mx-browse .mx-rail { gap: 5px; }
  .mx-browse .mx-rail .mk-cat { height: 24px; }
  .mx-browse .mx-rail .mx-tog { height: 24px; }
}
@media (max-width: 1099px) {
  .mx-soon :is(.mx-ohead, .mx-orow) { grid-template-columns: 46px minmax(0, 1fr) 40px 44px 44px 36px 74px 232px; gap: 6px; }
  .mx-soon .mx-ohead span:nth-child(4) { font-size: 0; } .mx-soon .mx-ohead span:nth-child(4)::after { content: attr(data-short); font-size: 13px; }
  .mx-kc .mc-svg.hg svg { width: 16px; height: 18px; }
}
/* 1100-1279 wide the rail is back beside the board: the number columns close up so the name keeps room (at 1100 it
   had 60 px, and an Aura's name ran under its grade). */
@media (min-width: 1100px) and (max-width: 1279px) {
  .mx-soon :is(.mx-ohead, .mx-orow) { grid-template-columns: 50px minmax(0, 1fr) 46px 50px 50px 40px 92px 250px; }
  .mx-soon .mx-ohead span:nth-child(4) { font-size: 0; } .mx-soon .mx-ohead span:nth-child(4)::after { content: attr(data-short); font-size: 13px; }
}
@media (min-width: 561px) and (max-width: 760px) { .mx-soon .mx-oc.e { display: block; } }
/* the Ending soon chip takes a chip's room: below 840 px the last kind waits under More */
@media (min-width: 561px) and (max-width: 839px) { .mx-kinds > .mx-kc:nth-child(7) { display: none; } }
/* phones: Ending soon's rows (its Filters button is Browse's own, shown wherever the rail is folded away) */
@media (max-width: 560px) {
  .mx-soon .mx-orow { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .mx-soon .mx-ostat .gr { flex: none; }
  /* beside a long price or a "Need 93.8k" button the talent and level give way, never the time left */
  .mx-soon .mx-ostat .mx-stt { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .mx-soon .mx-ostat .mx-ends { flex: none; }
  .mx-soon .mx-deal .mk-draw .cd { display: none; }
}
/* a coin on a mixed-case Buy label (bids in gems, Buy now in coins) sits one pixel lower to meet the letters' middle */
.mx-soon .mx-deal .btn:not(.primary) img.mk-bcur[alt="coins"] { top: 2px; }
/* the smallest phones: the stats line keeps the grade and the time left */
@media (max-width: 340px) { .mx-soon .mx-stt { display: none; } }

/* ---------- the listing form (a dialog) ---------- */
.dialog.mx-lfd { width: min(470px, calc(100vw - 16px)); }
.mx-lf { display: flex; flex-direction: column; }
.mx-dthing { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; margin-bottom: 2px; border-bottom: 1px solid var(--rule-soft); font: 700 16px var(--sans); }
.mx-dtw { min-width: 0; }
.mx-dname { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.mx-dname b { overflow: hidden; text-overflow: ellipsis; }
.mx-dthing .mx-os { display: flex; align-items: center; gap: 5px; margin-top: 3px; }
.mx-dthing .mx-os > span { overflow: hidden; text-overflow: ellipsis; }
.mx-dthing .mk-art { width: 50px; height: 50px; flex: none; } .mx-dthing .mk-art img { width: 46px; height: 46px; max-width: none; max-height: none; object-fit: contain; }
.mx-dthing .mk-art:not(.crt) img { width: 32px; height: 32px; }
.mx-dsec { padding: 10px 12px; margin-top: 8px; border-radius: 3px; background: var(--inlay); box-shadow: inset 0 0 0 1px var(--rule-soft); }
.mx-dsec.gem { background: linear-gradient(180deg, rgba(29, 77, 69, .10), rgba(29, 77, 69, .04)); box-shadow: inset 0 0 0 1px rgba(29, 77, 69, .45); }
.mx-dsec.off { opacity: .62; background: var(--inlay); box-shadow: inset 0 0 0 1px var(--rule-soft); }
.mx-drow { display: flex; align-items: center; gap: 10px; }
.mx-dqty { margin-top: 10px; }
.mx-drow label { display: inline-flex; align-items: center; gap: 6px; width: 80px; flex: none; font: 700 15px var(--pixel); letter-spacing: .04em; }
.mx-drow label img { width: 18px; height: 18px; }
.mx-dinput { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.mx-dinput input { flex: 1; min-width: 0; height: 36px; padding: 0 10px; font: 800 18px var(--sans) !important; color: var(--ink-v); }
.mx-dqty .mx-dinput input { flex: 0 1 110px; }
.mx-dsec.gem .mx-dinput input { color: #1d4d45; }
.mx-dinput input::placeholder { font-weight: 600; font-size: 15px; color: var(--muted-v); opacity: .75; }
.mx-dinput input::-webkit-inner-spin-button, .mx-dinput input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.mx-dinput input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.mx-dchips .mk-chip { white-space: nowrap; }
.mx-dinput i { font: italic 600 14px var(--sans); color: var(--muted-v); white-space: nowrap; }
.mx-dchips { display: flex; flex-wrap: wrap; gap: 5px; min-height: 24px; margin: 8px 0 6px 90px; }
.mx-dchips .mk-chip { height: 24px; font-size: 12.5px; gap: 4px; }
.mx-dchips .mk-chip img { width: 13px; height: 13px; }
.mx-dwait { font: italic 600 12.5px/24px var(--sans); color: var(--muted-v); }
.mx-keep { display: flex; align-items: center; gap: 4px; margin-left: 90px; font: 600 13px var(--sans); color: var(--muted-v); }
.mx-dsec.off .mx-keep { margin-top: 6px; }
.mx-keep b { display: inline-flex; align-items: center; gap: 3px; color: var(--ink-v); }
.mx-keep b img { width: 13px; height: 13px; }
.mx-dfoot { min-height: 0; margin: 8px 0 0; font: 700 13px var(--sans); color: var(--rg-rubric); }
.mx-dfoot:empty { display: none; }
.mx-dnote { margin: 8px 0 0; font: 600 12.5px var(--sans); color: var(--muted-v); }
@media (max-width: 560px) {
  .mx-dchips, .mx-keep { margin-left: 0; }
  .mx-drow label { width: 70px; }
  .mx-dinput { flex-wrap: wrap; row-gap: 2px; }
  .mx-dinput i { flex-basis: 100%; text-align: right; font-size: 13px; }
  .mx-dinput i:empty { display: none; }
  .mx-dqty .mx-dinput i { flex-basis: auto; }
}
@media (max-width: 340px) { .mx-dchips .mk-chip { padding: 0 7px; font-size: 12px; } .mx-dthing .mx-os .el { display: none; } }
@media (max-height: 620px) {
  .mx-dthing { padding-bottom: 6px; }
  .mx-dthing .mk-art { width: 40px; height: 40px; } .mx-dthing .mk-art img { width: 36px; height: 36px; }
  .mx-dsec { padding: 7px 10px; margin-top: 6px; }
  .mx-dchips { margin: 5px 0 4px 90px; }
  .mx-dinput input { height: 32px; }
}

/* ---------- the listing form, both ways (listForm) ---------- */
/* Buy now on the left, Bids and Ends in on the right from 720px; one column below, the summary left out. */
.dialog.mx-lfd.mx-lf2 { width: min(760px, calc(100vw - 16px)); }
.mx-lcols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; }
.mx-lcol { min-width: 0; }
.mx-lh { display: flex; align-items: baseline; gap: 8px; margin: 10px 0 0; font: 700 14px var(--pixel); letter-spacing: .06em; color: var(--rg-rubric); text-transform: uppercase; }
.mx-lh i { font: italic 500 12.5px var(--sans); letter-spacing: 0; text-transform: none; color: var(--muted-v); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-lcols .mx-dsec { margin-top: 6px; }
.mx-lf2 .mx-drow label { width: 72px; }
.mx-lf2 .mx-dchips { margin: 7px 0 5px 0; }
.mx-lf2 .mx-keep { margin-left: 0; flex-wrap: wrap; row-gap: 0; }
.mx-lf2 .mx-shares.tight .amt { display: none; }
.mx-lf2 .mx-shares.tight .mk-chip { flex: 1; justify-content: center; }
.mx-lf2 .mx-keep b img, .mx-lf2 .mx-dchips .mk-chip img, .mx-lsum b img { position: relative; top: 1px; }
.mx-dsec.bid { background: linear-gradient(180deg, rgba(119, 41, 31, .07), rgba(119, 41, 31, .02)); box-shadow: inset 0 0 0 1px rgba(119, 41, 31, .38); }
.mx-dsec.bid.off { background: var(--inlay); box-shadow: inset 0 0 0 1px var(--rule-soft); }
.mx-dsec.bid .mx-drow > label { width: auto; }
.mx-bcur { display: inline-flex; flex: none; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--rule); overflow: hidden; }
.mx-lf2 .mx-drow .mx-bcur label { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 36px; opacity: .45; cursor: pointer; }
.mx-lf2 .mx-drow .mx-bcur label.on { opacity: 1; background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(180deg, #e4d6b6, var(--vellum-hi)); box-shadow: inset 0 0 0 1px var(--gilt-lo); }
.mx-lf2 .mx-drow .mx-bcur label.off, .mx-lf2 .mx-dsec.off .mx-drow .mx-bcur label { opacity: .3; cursor: not-allowed; filter: grayscale(1); }
.mx-lf2 .mx-bcur img { width: 16px; height: 16px; }
.mx-bcur input, .mx-lens input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.mx-bcur label:has(input:focus-visible), .mx-lens label:has(input:focus-visible) { outline: 2px solid var(--gilt-lo); outline-offset: 1px; }
.mx-lf2 .mx-shares { gap: 4px; }
.mx-lf2 .mx-shares .mk-chip { padding: 0 7px; }
.mx-lf2 .mx-shares .amt { display: inline-flex; align-items: center; gap: 3px; }
.mx-lf2 .mx-shares .amt img { width: 13px; height: 13px; }
.mx-lf2 .mx-drow > label img { position: relative; top: 1px; }
.mx-shares .mk-chip.on { box-shadow: inset 0 0 0 1px var(--gilt-lo), 0 0 0 1px var(--gilt-lo); }
.mx-lens { display: flex; gap: 4px; margin-top: 6px; }
.mx-lens label { flex: 1; display: inline-flex; align-items: center; justify-content: center; min-width: 0; height: 32px; border-radius: 2px; cursor: pointer; font: 700 13.5px var(--sans); color: var(--muted-v); background: var(--inlay); box-shadow: inset 0 0 0 1px var(--rule-soft); white-space: nowrap; }
.mx-lens label:hover { color: var(--ink-v); background: var(--inlay-hi); }
.mx-lens label.on { color: var(--ink-v); background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(180deg, #e4d6b6, var(--vellum-hi)); box-shadow: inset 0 0 0 1px var(--gilt-lo), 0 0 0 1px var(--gilt-lo); }
.mx-lsum { margin-top: 10px; padding: 8px 12px; border-radius: 3px; background: var(--inlay); box-shadow: inset 0 0 0 1px var(--rule-soft); font: 600 13px/1.5 var(--sans); color: var(--muted-v); }
.mx-lsum b { display: inline-flex; align-items: center; gap: 3px; color: var(--ink-v); } .mx-lsum b img { width: 13px; height: 13px; }
.mx-lf2 .actions { flex-wrap: nowrap; }
.mx-lf2 .actions .btn { white-space: nowrap; }
.mx-lf2 .mx-dchips .ln { display: none; }
.mx-lf2 .actions .btn:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 719px) {
  .mx-lcols { grid-template-columns: minmax(0, 1fr); }
  .mx-lh { margin-top: 8px; }
  .mx-lsum { display: none; }
  .mx-lf2 .mx-dinput { flex-wrap: nowrap; }
  .mx-lf2 .mx-dinput i { flex-basis: auto; }
  .mx-lf2 .mx-dchips .c3, .mx-lf2 .mx-dchips .amt { display: none; }
  .mx-lf2 .mx-dchips { margin: 6px 0 4px; }
  .mx-lf2 .mx-dsec { padding: 8px 10px; }
  .mx-shares .mk-chip { flex: 1; justify-content: center; }
}
@media (max-height: 620px) {
  .mx-lh { margin-top: 7px; font-size: 13px; }
  .mx-lens label { height: 28px; }
  .mx-lsum { margin-top: 7px; padding: 6px 10px; }
  .mx-lf2 .mx-drow .mx-bcur label { height: 32px; }
}

/* Short phones: tighter boxes, Ends in beside its choices, a refusal in place of the note, so the form fits without scrolling. */
@media (max-width: 719px) and (max-height: 760px) {
  .dialog.mx-lf2 > h3 { padding-top: 8px; padding-bottom: 0; font-size: 17px; }
  .dialog.mx-lf2 > .body { padding-top: 4px; padding-bottom: 6px; }
  .dialog.mx-lf2 > .actions { padding-top: 8px; padding-bottom: 10px; }
  .mx-lf2 .mx-dthing { padding-bottom: 5px; }
  .mx-lf2 .mx-dthing .mk-art { width: 34px; height: 34px; } .mx-lf2 .mx-dthing .mk-art img { width: 34px; height: 34px; }
  .mx-lf2 .mx-lh { margin-top: 4px; font-size: 13px; }
  .mx-lf2 .mx-lcols .mx-dsec { margin-top: 3px; padding: 4px 9px 5px; }
  .mx-lf2 .mx-dinput input { height: 32px; min-height: 32px; }
  .mx-lf2 .mx-drow .mx-bcur label { height: 32px; }
  .mx-lf2 .mx-dchips { min-height: 22px; margin: 4px 0 3px; }
  .mx-lf2 .mx-dchips .mk-chip { height: 22px; }
  .mx-lf2 .mx-keep { font-size: 12.5px; }
  .mx-lf2 .mx-lcol.bids { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; align-items: center; }
  .mx-lf2 .mx-lcol.bids > * { grid-column: 1 / -1; }
  .mx-lf2 .mx-lcol.bids > .mx-lh.ends { grid-column: 1; margin-top: 6px; }
  .mx-lf2 .mx-lcol.bids > .mx-lens { grid-column: 2; margin-top: 6px; gap: 3px; }
  .mx-lf2 .mx-lens label { height: 28px; font-size: 12.5px; }
  .mx-lf2 .mx-dfoot, .mx-lf2 .mx-dnote { margin-top: 6px; }
  .mx-lf2 .mx-dfoot:not(:empty) + .mx-dnote { display: none; }
  .mx-lf2 .mx-dqty { margin-top: 4px; }
  .mx-lf2 .mx-dsec.bid.off .mx-drow { display: none; }
  .mx-lf2 .mx-dsec.bid.off .mx-keep { margin: 0; }
}
@media (max-width: 719px) and (max-height: 600px) {
  .dialog.mx-lf2 > h3 { padding-top: 6px; }
  .dialog.mx-lf2 > .actions { padding-top: 6px; padding-bottom: 8px; }
  .mx-lf2 .mx-dinput input { height: 30px; min-height: 30px; }
  .mx-lf2 .mx-drow .mx-bcur label { height: 30px; }
  .mx-lf2 .mx-keep { line-height: 16px; }
  .mx-lf2 .mx-dchips { margin: 3px 0 2px; }
}
@media (max-width: 380px) {
  .dialog.mx-lf2 > .body { padding-left: 14px; padding-right: 14px; }
  .mx-lf2 .mx-dchips { gap: 4px; }
  .mx-lf2 .mx-dchips .mk-chip { padding: 0 6px; font-size: 11.5px; }
  .mx-lf2 .mx-keep .tl, .mx-lf2 .mx-dchips .lw { display: none; }
  .mx-lf2 .mx-dchips .ln { display: inline; }
}

/* ---------- Filters (dialog) ---------- */
.mxf { display: flex; flex-direction: column; gap: 6px; }
.mxf-tr, .mxf-tabs { display: none; }
.mxf-s1, .mxf-s2 { display: flex; flex-direction: column; gap: 6px; }
.mxf-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 8px; }
.mxf-l { font: 700 13px var(--pixel); letter-spacing: .04em; color: var(--muted-v); white-space: nowrap; }
.mxf-v { min-width: 0; }
.mxf-seg { flex-wrap: wrap; }
.mxf-seg label { display: inline-flex; align-items: center; justify-content: center; height: 28px; padding: 0 9px; border-radius: 2px; cursor: pointer; white-space: nowrap; font: 600 13px var(--sans); color: var(--ink-v); background: var(--inlay); box-shadow: inset 0 0 0 1px var(--rule-soft); }
.mxf-seg label.on { background: url(themes/codex/vellum.svg) 0 0 / 300px, linear-gradient(180deg, #e4d6b6, var(--vellum-hi)); box-shadow: inset 0 0 0 1px var(--edge), inset 0 0 0 2px var(--gilt-lo); }
.mxf input[type="radio"], .mxf input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.mxf-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.mxf-chip, .mxf label.mxf-chip { height: 26px; min-height: 0; font-size: 12.5px; }
.mxf-chip.on { color: var(--ink-v); box-shadow: inset 0 0 0 1px var(--edge), inset 0 0 0 2px var(--gilt); background: #eadcb9; }
.mxf .mk-range { display: flex; align-items: center; gap: 6px; }
.mxf .mk-range input { width: 90px; height: 30px; min-height: 0; }
.mxf-pcur { width: 16px; height: 16px; }
.mxf select { height: 30px; min-width: 180px; }
@media (min-width: 761px) { .mxf.two { display: grid; grid-template-columns: minmax(0, 1fr); } }
@media (max-height: 700px), (max-width: 560px) {
  /* short screens: the creature filters and sort-and-price take turns */
  .mxf.two .mxf-tabs { display: flex; gap: 2px; margin-bottom: 4px; border-bottom: 1px solid var(--rule-soft); }
  .mxf.two .mxf-tabs label { padding: 6px 10px; font: 700 14px var(--pixel); color: var(--muted-v); cursor: pointer; }
  .mxf.two #mxf-t1:checked ~ .mxf-tabs label[for="mxf-t1"], .mxf.two #mxf-t2:checked ~ .mxf-tabs label[for="mxf-t2"] { color: var(--ink-v); box-shadow: inset 0 -2px 0 var(--gilt); }
  .mxf.two #mxf-t1:checked ~ .mxf-s2, .mxf.two #mxf-t2:checked ~ .mxf-s1 { display: none; }
  .mxf-row { grid-template-columns: 76px minmax(0, 1fr); gap: 6px; }
  .mxf-seg label { height: 24px; padding: 0 7px; font-size: 12.5px; }
  .mxf-chip, .mxf label.mxf-chip { height: 23px; }
  /* creature Quality made the creature tab one row longer (2026-11-19): tighter rows keep it from scrolling */
  .mxf-s1 { gap: 3px; }
  .mxf .mk-range input { height: 27px; }
  .mxf select { height: 27px; padding-top: 0; padding-bottom: 0; line-height: 25px; }
}
@media (max-width: 340px) {
  /* the smallest phones: each filter's name runs first in its line of choices, so the creature tab fits */
  .mxf-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 5px; }
  .mxf-v, .mxf-v > .mxf-seg, .mxf-v > .mxf-chips { display: contents; }
  .mxf-l { margin-right: 2px; font-size: 11.5px; letter-spacing: .02em; }
  .mxf-s1 { gap: 2px; } .mxf-s2 { gap: 6px; }
  .mxf-row { gap: 3px 4px; }
  .mxf-seg label, .mxf label.mxf-chip { height: 21px; padding: 0 6px; font-size: 11.5px; }
  .mxf .mk-range input { height: 24px; width: 80px; }
  .mxf select { height: 24px; }
}
@media (min-width: 561px) { .mxf-ph { display: none; } .mxf.two .mxf-s2:not(:has(.mxf-row:not(.mxf-ph) + *, .mxf-row:not(.mxf-ph))) { display: none; } }

/* ---------- gem packs (dialog) ---------- */
.mxp-need { margin: 0 0 8px; font: 600 15px var(--sans); }
.mxp-need b { display: inline-flex; align-items: center; gap: 4px; }
.mxp-packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.mxp-packs .mk-pack { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px; border: 0; border-radius: 3px; cursor: pointer; color: var(--ink-v); background: var(--inlay); box-shadow: inset 0 0 0 1px var(--rule-soft); }
.mxp-packs .mk-pack img { width: 26px; height: 26px; }
.mxp-packs .mk-pack b { font: 800 17px var(--sans); color: #1d4d45; }
.mxp-packs .mk-pack span { font: 600 13px var(--sans); color: var(--muted-v); }
.mxp-packs .mk-pack:hover { box-shadow: inset 0 0 0 1px var(--gilt); }
.mxp-packs .mk-pack.mxp-pick { background: linear-gradient(180deg, rgba(233, 211, 154, .5), rgba(201, 169, 94, .3)); box-shadow: inset 0 0 0 2px var(--gilt), 0 0 8px rgba(201, 169, 94, .5); }
.mxp-bal { margin: 10px 0 0; }

/* ---------- Sell and Your listings: market context ---------- */
.mx-ctx { display: inline-flex; align-items: center; gap: 4px; font: 600 12.5px var(--sans); color: var(--muted-v); white-space: nowrap; }
.mx-ctx img { width: 13px; height: 13px; }
.mx-ctxl { font-style: italic; }
.mx-gm { width: 14px; height: 14px; vertical-align: -2px; }
.mx-gm.off { opacity: .35; filter: grayscale(1); }
.mx-low { display: inline-flex; align-items: center; gap: 3px; margin-right: 6px; font: 600 12.5px var(--sans); color: var(--muted-v); white-space: nowrap; }
.mx-low img { width: 13px; height: 13px; }
.mx-low i { font: italic 500 12px var(--sans); margin-right: 2px; }
.mx-low.hi { color: var(--rg-rubric); }
.mx-low.hi i { color: var(--rg-rubric); }
.mx-low.only { font-style: italic; }
/* Sell, Listings, History and Wallet sit a little below the title row */
#page[data-view="market"] #pane:not(:has(.mx-fixed)) { padding-top: 10px; }
@media (max-width: 760px) {
  /* Your listings on a phone: the buttons take the row's full width under the art; the lowest other price leads them */
  .mk-board.mine .mk-row { grid-template-areas: "art what price" "art by by" "act act act"; }
  .mk-board.mine .mk-row .mk-act { flex-wrap: wrap; row-gap: 4px; justify-content: stretch; }
  .mk-board.mine .mk-row .mk-act .btn { flex: 1 1 0; min-width: 0; padding: 0 4px; }
  .mk-board.mine .mk-row .mx-low { flex: 1 1 100%; justify-content: flex-end; margin: 0; }
}

/* An item's page on narrow or short screens: the quantity controls keep one line, and the description goes on a short screen. */
@media (max-width: 1100px), (max-height: 620px) {
  .mk-qty { gap: 6px; }
  .page .panel .mk-step input { width: 58px; }
  .mk-step button { width: 30px; min-width: 0; }
  .mk-max { padding: 0 7px; }
}
@media (max-height: 620px) {
  .mk-htxt p { display: none; }
  #page[data-view="market"] #pane:has(.mk-itemgrid) { padding-top: 2px; }
  .mk-hero { margin-bottom: 6px; }
}
/* Narrow screens: Browse (the first tab) is the way back, as on a card's offers page. */
@media (max-width: 1099px) { #page[data-view="market"] .mk-back { display: none; } }

/* Trait filter and effects (Cole 2026-11-13: buyers hunt catch chance and other traits). */
.mx-rfoot { display: flex; gap: 6px; }
.mx-rfoot .mx-tsel { flex: 1; min-width: 0; margin: 0; }
.mx-rfoot .mx-tsel > span { display: none; }
.mx-rfoot .mx-tsel select { width: 100%; height: 100%; min-height: 30px; }
.mx-rfoot .mx-fbtn { flex: none; }
.mx-tsel { display: flex; align-items: center; gap: 8px; margin-top: 4px; font: 700 14px var(--pixel); color: var(--cream-2); }
.mx-tsel > span { white-space: nowrap; }
.mx-tsel select { flex: 1; min-width: 0; height: 30px; }
.mx-tsel.on select { box-shadow: inset 0 0 0 1px var(--gilt); }
.mx-tsel.o select { flex: none; width: auto; max-width: 200px; height: 28px; }
@media (max-width: 1599px) { .mx-spf .mx-tsel.o > span, .mx-spf .mx-sort > span { display: none; } .mx-spf { gap: 12px; } }
.mxf-trait { min-width: 220px; height: 32px; }
.mx-tfx { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font: 600 12px var(--sans); color: var(--muted-v); white-space: nowrap; }
.mx-on b:has(+ .mx-tfx) { flex: none; }
.mx-tfx.rare { color: #8a5a00; }
.mx-rtr { display: inline-flex; align-items: center; height: 18px; padding: 0 5px; border-radius: 9px; font: 800 11.5px var(--sans); color: #fff3cf; background: linear-gradient(135deg, #8a5a00, #5c3a00); box-shadow: 0 0 0 1px rgba(120, 80, 10, .55); }
@media (max-height: 720px) and (min-width: 1100px) { .mx-rail .mk-cat { height: 25px; } }

/* Listings that take bids (shared/market.ts): the Top bid mark and the bid counts. */
.mk-auc { font-weight: 800; color: var(--rg-rubric); }
.mx-top { display: inline-flex; align-items: center; justify-content: center; height: 28px; padding: 0 12px; border-radius: 3px; white-space: nowrap;
  font: 700 12.5px var(--sans); letter-spacing: .04em; text-transform: uppercase; color: #1d4d45; background: rgba(29, 77, 69, .10); box-shadow: inset 0 0 0 1px rgba(29, 77, 69, .5); }
.mx-bids { font: 700 13px var(--sans); color: var(--muted-v); white-space: nowrap; }
.mk-bidhead { margin: 6px 0 2px; }
/* Aura and Rare trait share a row (Jonny 2026-11-17), so the rail keeps its height on short screens. */
.mx-tpair { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.mx-tpair .mx-tog { padding: 0 8px; min-width: 0; white-space: nowrap; gap: 6px; }
/* Market > Listings: Selling | Watching, the star on an offer, and Watching's row states (2026-11-19, Jonny's idea). */
.mk-mview { flex: 0 0 auto; flex-wrap: nowrap; }
.mk-mview button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; font: 700 13.5px var(--sans); }
.mk-mview button:not(.on) { color: #e2d2ae; background: rgba(255, 240, 210, .1); box-shadow: inset 0 0 0 1px rgba(201, 178, 130, .35); }
.mk-mview button:not(.on) .mk-segn:not(.ob) { color: #e2d2ae; background: rgba(255, 240, 210, .14); }
.mk-segn { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 5px; border-radius: 9px; font: 700 12px var(--sans); color: var(--ink-v); background: rgba(60, 40, 20, .12); }
.mk-segn.ob, .mk-tabn.ob { color: #fff4dc; background: #b4561c; }
.mk-open { white-space: nowrap; }
.mx-watch { display: inline-grid; place-items: center; width: 24px; height: 22px; margin: -3px 0 -3px 4px; padding: 0; border: 0; border-radius: 3px; cursor: pointer; color: var(--muted-v); background: none; vertical-align: middle; }
.mx-watch:hover { color: var(--gilt-lo); background: var(--inlay-hi); }
.mx-watch.on { color: #c08a1e; }
.mx-watch:disabled { cursor: default; opacity: .9; }
.mk-wst { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 3px; font: 800 12px var(--sans); letter-spacing: .04em; text-transform: uppercase; }
.mk-wst.win { color: #1d4d45; background: rgba(29, 77, 69, .12); box-shadow: inset 0 0 0 1px rgba(29, 77, 69, .5); }
.mk-wst.lose { color: #fff4dc; background: #b4561c; }
.mk-wst.gone { color: var(--muted-v); background: rgba(60, 40, 20, .08); box-shadow: inset 0 0 0 1px var(--rule-soft); }
.mk-board.watch .mk-by { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.mk-row.watch.won, .mk-row.watch.sold, .mk-row.watch.ended { opacity: .78; }
.mk-wx { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 3px; cursor: pointer; font: 700 18px/1 var(--sans); color: var(--muted-v); background: none; }
.mk-wx:hover { color: var(--ink-v); background: var(--inlay-hi); }

/* Strength column (client/strength.ts): the board is parchment, so the gilt is a deep gold and the top rolls glow. */
.mx-oc.s .str-x, .mx-ostat .str-x { font: 800 15px var(--sans); color: var(--ink-v); }
.mx-ostat .str-x { font-size: 12.5px; }
.mx-orow .str-x.str-hi { color: #8a5a00; }
.mx-orow .str-x.str-top { color: #a2560a; text-shadow: 0 0 6px rgba(255, 190, 70, .8); }
.mx-orow .str-x.str-lo { color: var(--muted-v); font-weight: 600; }

/* ---------- Listings: unsold rows, Relist, bid and Buy now prices (minePane, watchPane) ---------- */
.mk-row.mine.unsold { background: rgba(90, 70, 40, .07); }
.mk-row.mine.unsold .mk-art img { filter: saturate(.55); opacity: .85; }
.mk-unsold { display: inline-flex; align-items: center; gap: 8px; margin-left: 4px; padding-left: 12px; border-left: 1px solid rgba(240, 225, 190, .25); font: 600 14px var(--sans); color: #e6d6b4; white-space: nowrap; }
.mk-unsold b { color: #ffd9a8; }
.mk-unsold .btn { margin-left: 0; white-space: nowrap; }
.mk-row.mine .mk-by .mx-st { height: 16px; font-size: 10px; }
.mk-row.mine .mk-price .mx-op { line-height: 1.2; }
.mk-row.mine .mk-tot { line-height: 1.15; }
/* Icons on the number's line (align.cjs): the big gem price sits half a pixel lower than the shared rule puts it, Lowest other half a pixel higher. */
.mk-row.mine .mk-price > .mx-op.gem img { top: .6px; }
.mk-row.mine .mx-low img { position: relative; top: .5px; }
.mk-price .mk-bn { display: inline-flex; align-items: center; gap: 4px; font: 500 12.5px/1.25 var(--sans); color: var(--muted-v); white-space: nowrap; }
.mk-price .mk-bn .mx-op { gap: 3px; font: 700 13px/1.25 var(--sans); }
.mk-price .mk-bn .mx-op.coin { color: var(--ink-v); }
.mk-price .mk-bn .mx-op img { width: 12px; height: 12px; }
.mk-act .mk-relist, .mk-unsold .mk-relistall { display: inline-flex; align-items: center; justify-content: center; gap: 4px; white-space: nowrap; }
.mk-relist img.mk-bcur { display: block; width: 13px; height: 13px; flex: none; }
.mk-relist .mk-rs, .mk-relistall .mk-rs { display: none; }
/* Watching: a running listing's deal (dealCell) takes the price and button columns; the remove button ends the row. */
.mk-board.mine.watch .mk-row { grid-template-columns: 56px minmax(0, 1fr) minmax(120px, 180px) 300px 30px; }
@media (min-width: 761px) and (max-width: 1100px) {
  .mk-board.mine.watch .mk-row { grid-template-columns: 46px minmax(0, 1fr) auto 280px 26px; grid-template-areas: "art what by deal act"; }
  .mk-board.watch .mk-row > .mx-deal, .mk-board.watch .mk-row > .mk-price { grid-area: deal; }
  .mk-board.watch .mx-alt img { top: .5px; }
}
.mk-board.watch .mk-row > .mx-deal { justify-self: end; }
.mk-board.watch .mx-deal .mx-op.gem img { top: .5px; }
.mk-wph { display: none; }
/* Wide screens: the buttons column keeps one width whatever a row offers, so states and prices line up down the board. */
@media (min-width: 1101px) {
  .mk-board.mine:not(.watch) .mk-row { grid-template-columns: 56px minmax(0, 1fr) 56px 150px 160px 478px; }
  .mk-board.mine:not(.watch) .mk-row .mk-act { justify-content: flex-end; }
}
@media (max-width: 1100px) {
  .mk-slots:has(.mk-unsold) .mk-minesort > span { display: none; }
  .mk-slots:has(.mk-unsold) .mk-minesort { flex: 0 1 150px; min-width: 0; }
  .mk-slots:has(.mk-unsold) .btn.primary .st-long { display: none; }
  .mk-slots:has(.mk-unsold) .btn.primary .st-short { display: inline; }
}
@media (max-width: 760px) {
  .mk-slots:has(.mk-unsold) .mk-open, .mk-slots:has(.mk-unsold) .mk-minesort { display: none; }
  .mk-unsold { border-left: 0; padding-left: 0; margin-left: auto; }
  .mk-relist .mk-rl, .mk-relistall .mk-rl { display: none; } .mk-relist .mk-rs, .mk-relistall .mk-rs { display: inline; }
  .mk-unsold:has(.armed) .mk-un { display: none; }
  .mk-board.mine .mk-row .mk-act .btn { white-space: nowrap; }
  .mk-board.mine .mk-row .mk-act .btn.mk-relist.armed { flex: 0 0 auto; padding: 0 6px; }
  .mk-board.mine.watch .mk-row { grid-template-columns: 46px minmax(0, 1fr) auto 22px; grid-template-areas: "art what what what" "art by deal act"; }
  .mk-board.watch .mk-row .mk-wx { width: 22px; }
  .mk-board.watch .mk-row .mk-price { grid-area: deal; }
  .mk-board.watch .mk-row .mk-act { align-self: center; }
  .mk-wph { display: inline-block; }
  .mk-board.watch .mx-deal .mx-op.gem img { top: .8px; }
}
/* The narrowest phones: with unsold ones the Sell tab just above stands in for the Sell button, so the row fits. */
@media (max-width: 400px) {
  .mk-slots:has(.mk-unsold) > a.btn.primary { display: none; }
  .mk-slots:has(.mk-unsold) { gap: 6px; }
  .mk-slots:has(.mk-unsold) .mk-mview button { padding-left: 7px; padding-right: 7px; gap: 4px; }
  .mk-unsold { gap: 6px; } .mk-unsold .btn { padding-left: 8px; padding-right: 8px; }
}
/* The smallest phones: Your listings' Sell ran past the screen's edge; the "0 of 50 open" count steps aside for it
   (the Sell page shows the room left). */
@media (max-width: 340px) {
  .mk-slots { gap: 6px; }
  .mk-slots .mk-open { display: none; }
  .mk-mview button { gap: 4px; font-size: 12.5px; }
}
