/* Pasar NFT — "PASAR TERMINAL" skin.
   Refined modern-terminal aesthetic with a warm Indonesian accent.
   Same layout & class names as before — only the visual system changed:
   Sora (display) + Inter (UI) + JetBrains Mono (figures), a considered color
   palette, hairline borders + soft elevation, tasteful accent usage. Dark-first. */
:root {
  --paper:  #ffffff;
  --bg:     #f3f1ea;        /* warm paper page */
  --surf:   #ffffff;        /* cards */
  --bg2:    #ece9e0;        /* recessed well / art bg */
  --bg3:    #eeebe2;        /* hover */
  --txt:    #191c22;
  --mut:    #6b7280;
  --dim:    #a2a8b2;
  --ink:    rgba(24,28,34,.10);   /* hairline */
  --line:   rgba(24,28,34,.10);
  --line-hi:rgba(24,28,34,.20);
  --merah:  #f0503f;        /* coral (secondary / sell) */
  --indigo: #5852f2;        /* violet (primary / prices) */
  --overlap:#8b46d6;
  --acc:    #5852f2;
  --acc2:   #f0503f;
  --gold:   #d99a1c;        /* Indonesian warmth, used sparingly */
  --gold-hi:#5852f2;
  --grn:    #10b784;        /* buy */
  --red:    #ef4444;        /* sell */
  --cyan:   #5852f2;
  --on-accent: #ffffff;     /* text on filled accent/pos/neg buttons */
  --radius: 14px;
  --rsm: 9px;
  --disp: 'Sora', system-ui, sans-serif;
  --sans: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --out:    0 1px 2px rgba(20,22,28,.04), 0 6px 22px rgba(20,22,28,.06);
  --out-sm: 0 1px 2px rgba(20,22,28,.05), 0 2px 8px rgba(20,22,28,.05);
  --out-lg: 0 8px 20px rgba(20,22,28,.10), 0 24px 60px rgba(20,22,28,.12);
  --in:     inset 0 1px 0 rgba(255,255,255,.5);
  --in-sm:  inset 0 1px 0 rgba(255,255,255,.5);
  --glow:   0 0 0 3px rgba(88,82,242,.18);
  --batik:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cg fill='none' stroke='rgba(88,82,242,0.07)' stroke-width='1.1'%3E%3Cpath d='M0 24 L24 0'/%3E%3Cpath d='M0 20 L20 0'/%3E%3C/g%3E%3Cg fill='rgba(88,82,242,0.05)'%3E%3Ccircle cx='2.5' cy='8.5' r='1'/%3E%3Ccircle cx='5.5' cy='5.5' r='1'/%3E%3Ccircle cx='8.5' cy='2.5' r='1'/%3E%3C/g%3E%3C/svg%3E");   /* parang lereng */
}

/* ---------- DARK — "Midnight terminal" ---------- */
html[data-theme="dark"] {
  --paper:  #0e111a;
  --bg:     #0a0c12;
  --surf:   #141824;
  --bg2:    #0e111b;
  --bg3:    #1b2030;
  --txt:    #e9edf5;
  --mut:    #97a0b2;
  --dim:    #5b6474;
  --ink:    rgba(255,255,255,.09);
  --line:   rgba(255,255,255,.09);
  --line-hi:rgba(255,255,255,.17);
  --merah:  #ff6b5e;
  --indigo: #8b93ff;
  --overlap:#b98bff;
  --acc:    #8b93ff;
  --acc2:   #ff6b5e;
  --gold:   #f2b544;
  --gold-hi:#8b93ff;
  --grn:    #34d399;
  --red:    #f87171;
  --cyan:   #8b93ff;
  --on-accent: #0a0c12;
  --out:    0 2px 4px rgba(0,0,0,.3), 0 10px 34px rgba(0,0,0,.4);
  --out-sm: 0 1px 3px rgba(0,0,0,.35), 0 3px 12px rgba(0,0,0,.3);
  --out-lg: 0 12px 32px rgba(0,0,0,.5), 0 30px 80px rgba(0,0,0,.55);
  --in:     inset 0 1px 0 rgba(255,255,255,.04);
  --in-sm:  inset 0 1px 0 rgba(255,255,255,.04);
  --glow:   0 0 0 3px rgba(139,147,255,.22);
  --batik:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cg fill='none' stroke='rgba(139,147,255,0.08)' stroke-width='1.1'%3E%3Cpath d='M0 24 L24 0'/%3E%3Cpath d='M0 20 L20 0'/%3E%3C/g%3E%3Cg fill='rgba(139,147,255,0.06)'%3E%3Ccircle cx='2.5' cy='8.5' r='1'/%3E%3Ccircle cx='5.5' cy='5.5' r='1'/%3E%3Ccircle cx='8.5' cy='2.5' r='1'/%3E%3C/g%3E%3C/svg%3E");   /* parang lereng */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--txt); font-family: var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { min-height: 100vh; position: relative; background-image: var(--batik); background-attachment: fixed; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: 340px; z-index: 0; pointer-events: none;
  background: radial-gradient(120% 100% at 50% -20%, color-mix(in srgb, var(--acc) 12%, transparent), transparent 70%); }
main, header { position: relative; z-index: 1; }
a { color: var(--acc2); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button { font-family: inherit; cursor: pointer; border: none; }
.mono { font-family: var(--mono); font-feature-settings: "tnum" 1; letter-spacing: -.01em; }
.mut { color: var(--mut); } .dim { color: var(--dim); }
.grn { color: var(--grn); } .red { color: var(--red); } .acc { color: var(--acc); }

/* ---------- nav ---------- */
header { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 18px; height: 64px; padding: 0 22px;
  background: color-mix(in srgb, var(--paper) 82%, transparent); backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 11px; font-family: var(--disp); font-weight: 800; font-size: 19px; letter-spacing: -.03em; color: var(--txt); }
.logo .mark { width: 27px; height: 27px; filter: drop-shadow(0 2px 6px rgba(88,82,242,.35)); }
.nav { display: flex; gap: 2px; }
.nav a { padding: 8px 13px; border-radius: var(--rsm); color: var(--mut); font-weight: 600; font-size: 13.5px; letter-spacing: -.01em; transition: color .15s, background .15s; }
.nav a:hover { background: var(--bg3); color: var(--txt); text-decoration: none; }
.nav a.active { background: color-mix(in srgb, var(--acc) 14%, transparent); color: var(--acc); }
.grow { flex: 1; }
.searchbox { display: flex; align-items: center; gap: 9px; background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; padding: 8px 13px; width: 270px; transition: border-color .15s, box-shadow .15s; }
.searchbox:focus-within { border-color: var(--acc); box-shadow: var(--glow); }
.searchbox input { background: none; border: none; outline: none; color: var(--txt); width: 100%; font-size: 13.5px; font-family: var(--sans); }
.searchbox input::placeholder { color: var(--dim); }
.btn { background: var(--acc); color: var(--on-accent); font-weight: 650; font-size: 13.5px; padding: 10px 16px; border-radius: 11px; letter-spacing: -.01em; box-shadow: var(--out-sm); transition: transform .12s cubic-bezier(.2,.8,.2,1), box-shadow .12s, filter .12s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--out); filter: brightness(1.05); }
.btn:active { transform: translateY(0); box-shadow: var(--out-sm); filter: brightness(.97); }
.btn:disabled { opacity: .45; box-shadow: none; transform: none; filter: none; cursor: default; }
.btn.ghost { background: var(--bg2); color: var(--txt); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--bg3); border-color: var(--line-hi); filter: none; }
.btn.sm { padding: 7px 11px; font-size: 12px; border-radius: 9px; }
.btn.connected { background: color-mix(in srgb, var(--grn) 14%, transparent); color: var(--grn); border: 1px solid color-mix(in srgb, var(--grn) 45%, transparent); box-shadow: none; }
.btn.connected:hover { filter: none; background: color-mix(in srgb, var(--grn) 20%, transparent); }
.menu-btn { display: none; background: var(--bg2); color: var(--txt); font-size: 18px; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 11px; }
.logo-short { display: none; }
.pill { font-size: 11.5px; padding: 5px 11px; border-radius: 20px; background: var(--bg2); color: var(--mut); font-weight: 600; border: 1px solid var(--line); font-family: var(--mono); }

/* wallet dropdown */
.wallet { position: relative; }
.wallet-menu { position: absolute; top: calc(100% + 10px); right: 0; min-width: 236px; background: var(--surf); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--out-lg); padding: 8px; display: none; flex-direction: column; gap: 1px; z-index: 60; }
.wallet-menu.show { display: flex; }
.wallet-menu .wm-addr { font-size: 12px; color: var(--mut); padding: 9px 11px 11px; word-break: break-all; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-family: var(--mono); }
.wallet-menu a, .wallet-menu button { text-align: left; background: none; box-shadow: none; border: none; color: var(--txt); font-size: 13.5px; font-weight: 550; padding: 10px 11px; border-radius: 9px; }
.wallet-menu a:hover, .wallet-menu button:hover { background: var(--bg3); text-decoration: none; }
.wallet-menu button.danger { color: var(--red); }
.wallet-menu button.danger:hover { background: color-mix(in srgb, var(--red) 12%, transparent); }

/* ---------- layout ---------- */
main { max-width: 1400px; margin: 0 auto; padding: 26px 22px 96px; }
h1.page { font-family: var(--disp); font-size: 30px; font-weight: 800; letter-spacing: -.035em; }
.sub { color: var(--mut); font-size: 14px; margin-bottom: 22px; }
.row { display: flex; align-items: center; gap: 12px; }
.spread { display: flex; align-items: center; justify-content: space-between; }

/* ---------- banner ---------- */
.banner { border: 1px solid var(--line); border-radius: 20px; padding: 30px 32px; margin-bottom: 26px; box-shadow: var(--out);
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--acc) 16%, transparent), transparent 55%),
    radial-gradient(120% 140% at 0% 100%, color-mix(in srgb, var(--merah) 12%, transparent), transparent 55%),
    var(--surf); position: relative; overflow: hidden; }
.banner h2 { font-family: var(--disp); font-size: 38px; font-weight: 800; letter-spacing: -.04em; margin-bottom: 11px; line-height: 1.02; }
.banner p { color: var(--mut); max-width: 660px; line-height: 1.6; font-size: 14.5px; }
.stats { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.stat { padding: 13px 20px; border: 1px solid var(--line); border-radius: 13px; background: color-mix(in srgb, var(--surf) 60%, transparent); backdrop-filter: blur(4px); }
.stat .v { font-family: var(--disp); font-size: 24px; font-weight: 750; letter-spacing: -.03em; color: var(--txt); }
.stat .v.acc { color: var(--acc); }
.stat .l { font-size: 10.5px; color: var(--mut); text-transform: uppercase; letter-spacing: .09em; font-weight: 600; margin-top: 2px; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0 7px; }
.table thead th { text-align: right; font-size: 11px; color: var(--mut); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding: 4px 16px; white-space: nowrap; }
.table thead th:first-child, .table tbody td:first-child { text-align: left; }
.table tbody tr { cursor: pointer; }
.table tbody td { text-align: right; padding: 14px 16px; font-size: 14px; font-family: var(--mono); background: var(--surf); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); transition: background .12s; }
.table tbody td:first-child { border-left: 1px solid var(--line); border-radius: 12px 0 0 12px; font-family: var(--sans); }
.table tbody td:last-child { border-right: 1px solid var(--line); border-radius: 0 12px 12px 0; }
.table tbody tr:hover td { background: var(--bg3); }
.coll-cell { display: flex; align-items: center; gap: 12px; }
.coll-cell img, .coll-thumb { width: 42px; height: 42px; border-radius: 11px; background: var(--bg2); object-fit: cover; border: 1px solid var(--line); }
.coll-cell .nm { font-family: var(--disp); font-weight: 650; letter-spacing: -.02em; } .coll-cell .sy { font-size: 12px; color: var(--mut); font-family: var(--mono); }

/* ---------- collection detail ---------- */
.cohead { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 18px; }
.cohead .ava { width: 90px; height: 90px; border-radius: 18px; background: var(--bg2); border: 1px solid var(--line); box-shadow: var(--out-sm); }
.cohead h1 { font-family: var(--disp); font-size: 27px; font-weight: 800; letter-spacing: -.035em; }
.metrics { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.metrics .m { padding: 10px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surf); box-shadow: var(--out-sm); }
.metrics .m .v { font-family: var(--mono); font-weight: 600; font-size: 15px; } .metrics .m .l { font-size: 10px; color: var(--mut); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; margin-top: 1px; }

.toolbar { display: flex; align-items: center; gap: 12px; margin: 18px 0; background: var(--surf); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; box-shadow: var(--out-sm); flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; }
.tabs button { background: transparent; color: var(--mut); padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 12.5px; letter-spacing: -.01em; transition: background .12s, color .12s; }
.tabs button:hover { background: var(--bg3); color: var(--txt); }
.tabs button.active { background: color-mix(in srgb, var(--acc) 14%, transparent); color: var(--acc); }
.slider { display: flex; align-items: center; gap: 10px; }
.slider input[type=range] { width: 180px; accent-color: var(--acc); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 15px; }
.card { background: var(--surf); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--out-sm); transition: transform .14s cubic-bezier(.2,.8,.2,1), box-shadow .14s, border-color .14s; position: relative; }
.card:hover { transform: translateY(-3px); box-shadow: var(--out); border-color: var(--line-hi); }
.card.sel { border-color: var(--acc); box-shadow: var(--glow); }
.card .art { width: 100%; aspect-ratio: 1; background: var(--bg2); display: block; border-bottom: 1px solid var(--line); }
.card .meta { padding: 12px 13px; }
.card .id { font-family: var(--disp); font-weight: 650; font-size: 13.5px; letter-spacing: -.02em; }
.card .rar { font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 650; letter-spacing: .02em; background: var(--bg2); }
.r-Mythic { color: var(--merah); } .r-Legendary { color: var(--overlap); } .r-Rare { color: var(--grn); } .r-Common { color: var(--mut); }
.card .price { font-family: var(--mono); font-weight: 600; font-size: 14px; margin-top: 8px; color: var(--acc); }
.card .price small { color: var(--mut); font-weight: 400; }
.card .act { display: flex; gap: 7px; margin-top: 10px; }
.card .act .btn { flex: 1; text-align: center; }
.unlisted { color: var(--dim); font-size: 12px; font-family: var(--mono); }

.cart { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 40; background: color-mix(in srgb, var(--surf) 88%, transparent); backdrop-filter: blur(16px); border: 1px solid var(--line-hi); border-radius: 16px; padding: 14px 22px; box-shadow: var(--out-lg); display: none; align-items: center; gap: 18px; width: min(920px, 92vw); }
.cart.show { display: flex; }
.cart .total { font-family: var(--disp); font-size: 21px; font-weight: 800; letter-spacing: -.03em; color: var(--acc); }
.evt-buy { color: var(--grn); } .evt-list { color: var(--acc); } .evt-offer { color: var(--overlap); } .evt-cbid { color: var(--merah); }

/* ---------- panels ---------- */
.panel { background: var(--surf); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 16px; box-shadow: var(--out-sm); }
.panel h3 { font-family: var(--disp); font-size: 16px; font-weight: 750; letter-spacing: -.025em; margin-bottom: 15px; display: flex; align-items: center; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 13px; }
.field label { font-size: 11px; color: var(--mut); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.field input, .field select { background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; color: var(--txt); padding: 11px 13px; font-size: 14px; font-family: var(--mono); outline: none; transition: border-color .15s, box-shadow .15s; }
.field input:focus, .field select:focus { border-color: var(--acc); box-shadow: var(--glow); }
.kv { display: flex; justify-content: space-between; padding: 9px 0; font-size: 13px; color: var(--mut); border-bottom: 1px solid var(--line); }
.kv .v { font-family: var(--mono); font-weight: 600; color: var(--txt); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 820px) { .cols { grid-template-columns: 1fr; } .searchbox { display: none; } }

.lead { display: flex; align-items: center; gap: 12px; padding: 12px 15px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surf); }
.lead .rk { font-family: var(--disp); font-weight: 800; width: 30px; color: var(--dim); }
.lead .ad { font-family: var(--mono); flex: 1; }
.lead .pt { font-family: var(--disp); font-weight: 800; color: var(--acc); letter-spacing: -.02em; }
.lead.me { background: color-mix(in srgb, var(--acc) 10%, var(--surf)); border-color: color-mix(in srgb, var(--acc) 40%, transparent); }

#toast { position: fixed; top: 78px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--surf); border: 1px solid var(--line); border-left: 3px solid var(--acc); padding: 12px 16px; font-size: 13.5px; max-width: 340px; box-shadow: var(--out-lg); border-radius: 12px; animation: slidein .2s cubic-bezier(.2,.8,.2,1); font-weight: 500; }
.toast.ok { border-left-color: var(--grn); } .toast.err { border-left-color: var(--red); }
@keyframes slidein { from { transform: translateX(16px); opacity: 0; } }

.empty { text-align: center; color: var(--mut); padding: 60px 20px; font-size: 14px; }
.loadwrap { display: grid; place-items: center; padding: 72px; color: var(--mut); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--acc); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal-bg { position: fixed; inset: 0; background: rgba(10,12,18,.55); backdrop-filter: blur(4px); z-index: 90; display: none; align-items: center; justify-content: center; }
.modal-bg.show { display: flex; }
.modal { background: var(--surf); border: 1px solid var(--line-hi); border-radius: 18px; padding: 24px; width: 428px; max-width: 92vw; box-shadow: var(--out-lg); }
.modal h3 { font-family: var(--disp); font-size: 20px; font-weight: 800; letter-spacing: -.03em; margin-bottom: 15px; }
.modal .art { width: 100%; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 13px; aspect-ratio: 1; object-fit: cover; background: var(--bg2); }
.close { float: right; color: var(--mut); cursor: pointer; font-size: 22px; line-height: 1; }
.close:hover { color: var(--txt); }

/* ---------- order book ---------- */
.ob-wrap { display: grid; grid-template-columns: 1fr 344px; gap: 16px; }
@media (max-width: 880px) { .ob-wrap { grid-template-columns: 1fr; } }
.ob-main { min-width: 0; }
.ob-spotlight { display: flex; gap: 16px; align-items: center; background: var(--surf); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 13px; box-shadow: var(--out-sm); }
.ob-art { width: 78px; height: 78px; border: 1px solid var(--line); border-radius: 13px; }
.ob-name { font-family: var(--disp); font-size: 21px; font-weight: 800; letter-spacing: -.035em; }
.ob-stats { display: flex; gap: 10px; margin-top: 11px; flex-wrap: wrap; }
.ob-stats > div { padding: 8px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg2); }
.ob-stats .v { font-family: var(--mono); font-weight: 600; font-size: 15px; } .ob-stats .l { font-size: 10px; color: var(--mut); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.ob-ladder { background: var(--surf); border: 1px solid var(--line); border-radius: 16px; padding: 8px; box-shadow: var(--out-sm); }
.ob-head, .ob-thead { display: grid; grid-template-columns: 1fr 60px 84px 18px; gap: 6px; padding: 9px 13px; font-size: 10px; color: var(--mut); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.ob-thead { grid-template-columns: 60px 1fr 50px 44px; }
.ob-row { position: relative; display: grid; grid-template-columns: 1fr 60px 84px 18px; gap: 6px; padding: 6px 13px; font-size: 13px; font-family: var(--mono); align-items: center; border-radius: 8px; transition: background .1s; }
.ob-row:hover { background: var(--bg3); }
.ob-bar { position: absolute; top: 3px; bottom: 3px; right: 7px; z-index: 0; opacity: .14; border-radius: 5px; }
.ob-bar.ask { background: var(--red); } .ob-bar.bid { background: var(--grn); }
.ob-row > span { position: relative; z-index: 1; text-align: right; }
.ob-row .ob-px { text-align: left; font-weight: 600; }
.ob-row.ask .ob-px { color: var(--red); } .ob-row.bid .ob-px { color: var(--grn); }
.ob-sz, .ob-tot { color: var(--mut); }
.ob-live { color: var(--merah); text-align: center !important; font-size: 9px; }
.ob-you { font-size: 9px; font-weight: 700; color: var(--acc); background: color-mix(in srgb, var(--acc) 15%, transparent); border: 1px solid color-mix(in srgb, var(--acc) 45%, transparent); padding: 1px 5px; border-radius: 8px; }
.ob-row.mine { background: color-mix(in srgb, var(--acc) 8%, transparent); }
.ob-spread { display: flex; justify-content: space-between; padding: 9px 13px; margin: 6px; font-size: 11.5px; color: var(--mut); background: var(--bg2); border-radius: 9px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.ob-side { display: flex; flex-direction: column; gap: 16px; }
.ob-trades h3 { font-family: var(--disp); font-size: 15px; font-weight: 750; letter-spacing: -.025em; margin-bottom: 11px; }
.ob-trade { display: grid; grid-template-columns: 60px 1fr 50px 44px; gap: 6px; padding: 6px 0; font-size: 12px; font-family: var(--mono); border-bottom: 1px solid var(--line); }
.ob-trade > span:not(:first-child) { text-align: right; }

/* order entry */
.ob-entry { padding: 16px; }
.oe-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 13px; }
.oe-tabs button { padding: 12px; font-family: var(--disp); font-weight: 750; font-size: 14.5px; letter-spacing: -.02em; border: 1px solid var(--line); border-radius: 11px; background: var(--bg2); color: var(--mut); transition: all .12s; }
.oe-tabs .oe-buy.active { background: color-mix(in srgb, var(--grn) 16%, transparent); color: var(--grn); border-color: color-mix(in srgb, var(--grn) 45%, transparent); }
.oe-tabs .oe-sell.active { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.oe-modes { display: flex; gap: 7px; margin-bottom: 13px; }
.oe-modes button { flex: 1; padding: 8px; font-size: 11.5px; font-weight: 600; letter-spacing: -.01em; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); color: var(--mut); transition: all .12s; }
.oe-modes button.active { background: color-mix(in srgb, var(--acc) 14%, transparent); color: var(--acc); border-color: color-mix(in srgb, var(--acc) 40%, transparent); }
.oe-modes.oe-sub { margin: -3px 0 13px; }
.frow2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.oe-items { font-size: 11.5px; color: var(--mut); margin: -5px 0 11px; word-break: break-word; font-family: var(--mono); }
.oe-submit { color: var(--on-accent); background: var(--grn); font-family: var(--disp); font-size: 16px; font-weight: 750; letter-spacing: -.02em; border-radius: 12px; }
.oe-submit.sell { background: var(--red); }

/* ---------- browse (TCGplayer-style) ---------- */
.browse { display: grid; grid-template-columns: 244px 1fr; gap: 18px; }
@media (max-width: 820px) { .browse { grid-template-columns: 1fr; } }
.bside { display: flex; flex-direction: column; gap: 14px; align-self: start; position: sticky; top: 80px; }
.facet { background: var(--surf); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--out-sm); }
.facet h4 { font-family: var(--disp); font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 12px; font-weight: 700; color: var(--mut); }
.fopt { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13.5px; cursor: pointer; font-weight: 500; }
.fopt input { accent-color: var(--acc); width: 16px; height: 16px; }
.fopt .fc { margin-left: auto; color: var(--dim); font-family: var(--mono); font-size: 12px; }
.fopt .rar { padding: 2px 8px; border-radius: 20px; font-weight: 650; font-size: 11px; background: var(--bg2); }
.frow { display: flex; align-items: center; gap: 8px; }
.frow input { width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; color: var(--txt); padding: 9px 11px; font-family: var(--mono); font-size: 13px; outline: none; }
.frow input:focus { border-color: var(--acc); box-shadow: var(--glow); }
.bmain { min-width: 0; }
.ftbar { display: flex; align-items: center; gap: 12px; background: var(--surf); border: 1px solid var(--line); border-radius: 13px; padding: 11px 16px; margin-bottom: 15px; box-shadow: var(--out-sm); }
.bcount { font-family: var(--disp); font-weight: 700; font-size: 14px; letter-spacing: -.02em; }
.bsort { font-size: 12.5px; color: var(--mut); display: flex; align-items: center; gap: 8px; font-weight: 500; }
.bsort select { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; color: var(--txt); padding: 8px 11px; font-size: 13px; font-weight: 550; outline: none; cursor: pointer; }
.vtoggle { display: flex; gap: 6px; }
.vtoggle button { width: 36px; height: 36px; border-radius: 10px; background: var(--bg2); color: var(--mut); font-size: 15px; border: 1px solid var(--line); transition: all .12s; }
.vtoggle button:hover { color: var(--txt); }
.vtoggle button.active { background: color-mix(in srgb, var(--acc) 14%, transparent); color: var(--acc); border-color: color-mix(in srgb, var(--acc) 40%, transparent); }
.lwrap { display: flex; flex-direction: column; gap: 10px; }
.lrow { display: grid; grid-template-columns: 58px 1fr 112px 134px auto; align-items: center; gap: 16px; background: var(--surf); border: 1px solid var(--line); border-radius: 13px; padding: 11px 16px; box-shadow: var(--out-sm); transition: transform .12s, box-shadow .12s, border-color .12s; }
.lrow:hover { transform: translateY(-1px); box-shadow: var(--out); border-color: var(--line-hi); }
.lrow.sel { border-color: var(--acc); box-shadow: var(--glow); }
.lthumb { width: 58px; height: 58px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg2); }
.lmain { min-width: 0; }
.lname { font-family: var(--disp); font-weight: 650; font-size: 14px; letter-spacing: -.02em; }
.ltraits { font-size: 12px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); }
.lprice { font-family: var(--mono); font-weight: 600; color: var(--acc); text-align: right; }
.lprice small { color: var(--mut); font-weight: 400; }
.lact { display: flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 620px) { .lrow { grid-template-columns: 48px 1fr auto; } .lrow .rar, .lrow .lprice { display: none; } }

/* ---------- mobile ---------- */
.mobile-drawer, .drawer-scrim { display: none; }
@media (max-width: 760px) {
  html, body { overflow-x: hidden; }
  /* --- header: [menu] [logo] .......... [wallet], everything else in the drawer --- */
  header { gap: 10px; padding: 0 12px; height: 58px; }
  .menu-btn { display: grid; place-items: center; }
  .logo { font-size: 17px; gap: 9px; } .logo-full { display: none; } .logo-short { display: inline; }
  .nav, header > .searchbox, .faucet-d, #poolchip, header > .theme-toggle { display: none; }
  header > .grow { display: none; }
  .wallet { margin-left: auto; }
  #connectBtn { padding: 9px 13px; }
  .mobile-drawer { position: absolute; top: 58px; left: 8px; right: 8px; background: var(--surf); border: 1px solid var(--line-hi); border-radius: 16px; box-shadow: var(--out-lg); padding: 14px; flex-direction: column; gap: 9px; z-index: 70; }
  header.menu-open .mobile-drawer { display: flex; }
  .mobile-drawer .searchbox.mob { width: auto; }
  .mobile-drawer .md-link { padding: 13px; border: 1px solid var(--line); border-radius: 11px; font-weight: 600; font-size: 14px; color: var(--txt); }
  .mobile-drawer .md-link.active { background: color-mix(in srgb, var(--acc) 14%, transparent); color: var(--acc); border-color: color-mix(in srgb, var(--acc) 40%, transparent); }
  .mobile-drawer .btn { min-height: 46px; }
  .md-bal { font-size: 13px; font-family: var(--mono); padding: 2px 2px 0; }
  /* scrim MUST sit below the header's z-index:50 stacking context, otherwise it renders
     on top of the drawer (which is trapped inside header) and eats the menu taps */
  header.menu-open ~ .drawer-scrim { display: block; position: fixed; inset: 58px 0 0; background: rgba(10,12,18,.45); backdrop-filter: blur(2px); z-index: 45; }

  main { padding: 16px 13px 100px; }
  h1.page { font-size: 23px; }

  /* 16px inputs → iOS never zoom-jumps on focus; comfy tap height */
  .field input, .field select, .frow input, .searchbox input, .ob-rarsel, .bsort select { font-size: 16px; }
  .field input, .field select { padding: 12px 13px; }

  /* banner + stats */
  .banner { padding: 22px 18px; border-radius: 18px; } .banner h2 { font-size: 27px; }
  .banner p { font-size: 14px; }
  .stats { gap: 9px; }
  .stat { flex: 1 1 calc(50% - 5px); padding: 11px 14px; } .stat .v { font-size: 21px; }

  /* collection header */
  .cohead { gap: 13px; } .cohead .ava { width: 64px; height: 64px; border-radius: 14px; } .cohead h1 { font-size: 21px; }
  .metrics { gap: 8px; } .metrics .m { padding: 9px 13px; flex: 1 0 auto; }

  /* toolbar → stacked; tabs become a swipeable strip; sweep spans full width */
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; padding: 11px 12px; border-radius: 14px; }
  .toolbar > .grow { display: none; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; gap: 6px; margin: -2px; padding: 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: 0 0 auto; min-height: 40px; }
  .slider { width: 100%; justify-content: space-between; }
  .slider input[type=range] { flex: 1; width: auto; min-width: 0; height: 28px; }

  /* items grid */
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }

  /* markets table: drop the two least-critical columns, tighten */
  .table thead th:nth-child(4), .table tbody td:nth-child(4), .table thead th:nth-child(6), .table tbody td:nth-child(6) { display: none; }
  .table tbody td { padding: 12px 13px; font-size: 13px; }
  .coll-cell img, .coll-thumb { width: 36px; height: 36px; }

  /* order book: stacked, ladder height-capped so BUY/SELL is within reach */
  .ob-wrap { grid-template-columns: 1fr; gap: 13px; }
  .ob-spotlight { gap: 12px; padding: 13px; } .ob-art { width: 58px; height: 58px; } .ob-name { font-size: 18px; }
  .ob-stats { gap: 8px; } .ob-stats > div { padding: 7px 11px; flex: 1 0 auto; }
  .ob-ladder { max-height: 46vh; overflow-y: auto; }
  .ob-head, .ob-thead, .ob-row { padding-left: 11px; padding-right: 11px; }
  .oe-tabs button { min-height: 48px; }
  .oe-modes button { min-height: 42px; }

  /* browse rail sits above the list, not stuck */
  .bside { position: static; top: auto; }
  .ftbar { flex-wrap: wrap; gap: 10px; }
  .vtoggle button { min-height: 40px; }

  .panel { padding: 16px; }
  .modal { padding: 20px; border-radius: 16px; }
  .wallet-menu { min-width: 210px; max-width: calc(100vw - 24px); }

  .cart { flex-wrap: wrap; gap: 10px; left: 8px; right: 8px; transform: none; width: auto; padding: 13px 16px; }
  #toast { left: 12px; right: 12px; top: 70px; } .toast { max-width: none; }
}

/* very small phones */
@media (max-width: 420px) {
  .banner { padding: 18px 15px; } .banner h2 { font-size: 24px; }
  .cart .total { font-size: 18px; }
  .cohead h1 { font-size: 19px; } .cohead .ava { width: 56px; height: 56px; }
  .ob-name { font-size: 17px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ---------- theme toggle button ---------- */
.theme-toggle { padding: 9px 12px; font-size: 15px; line-height: 1; }
