/* dotBots Market v2 - dark + light theme in the dotBots palette (ink #1d1d1f, paper #f5f5f7, signal orange #ff4d00, navy #161f39) */
:root {
  --bg: #0e0f13;
  --bg-2: #14161c;
  --card: #181a21;
  --card-2: #1f2129;
  --line: #2a2d37;
  --line-2: #363a46;
  --text: #f5f5f7;
  --text-2: #b4b6bf;
  --text-3: #8b8e99;
  --accent: #ff4d00;
  --accent-2: #ff6a2b;
  --accent-wash: rgba(255, 77, 0, .14);
  --navy: #161f39;
  --green: #22c27a;
  --red: #f1555b;
  --amber: #ffb020;
  --radius: 14px;
  --radius-s: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --top-h: 64px;
  --link-warm: #ffb08a;
  --red-text: #ffa3a6;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body.lock { overflow: hidden; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
img { display: block; }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------- testnet banner + top bar */
.tn-banner { background: repeating-linear-gradient(-45deg, #2a1d05, #2a1d05 12px, #33240a 12px, #33240a 24px); color: var(--amber); text-align: center; font-size: 13px; font-weight: 600; padding: 7px 12px; letter-spacing: .02em; border-bottom: 1px solid #4a3410; }
.tn-banner b { color: #ffd27a; }
.topbar { position: sticky; top: 0; z-index: 50; height: var(--top-h); display: flex; align-items: center; gap: 16px; padding: 0 24px; background: rgba(14, 15, 19, .86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 18px; letter-spacing: -.01em; white-space: nowrap; }
.brand .dot { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; font-family: var(--mono); font-size: 15px; }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; display: block; }
.brand small { font-weight: 500; color: var(--text-3); font-size: 13px; margin-left: 2px; }
.search { flex: 1; max-width: 560px; position: relative; }
.search input { width: 100%; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); padding: 0 14px 0 40px; outline: none; transition: border-color .15s, background .15s; }
.search input:focus { border-color: var(--line-2); background: var(--card); }
.search svg { position: absolute; left: 13px; top: 12px; opacity: .6; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; color: var(--text-2); white-space: nowrap; }
.pill .led { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.pill.ok .led { background: var(--green); box-shadow: 0 0 0 3px rgba(34, 194, 122, .18); }
.pill.bad { color: var(--amber); border-color: #4a3410; }
.pill.bad .led { background: var(--amber); }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; background: var(--card-2); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, transform .08s, border-color .15s, opacity .15s; text-decoration: none; }
.btn:hover { background: #2a2c36; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; border-color: var(--line-2); }
.btn.ghost:hover { background: var(--card); }
.btn.danger { background: transparent; border-color: #5a2a2d; color: #ff8a8e; }
.btn.danger:hover { background: rgba(241, 85, 91, .1); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.xs { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.icon { width: 42px; padding: 0; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .3); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- hero */
.hero { position: relative; }
.banner { height: 240px; position: relative; overflow: hidden; background: radial-gradient(1200px 300px at 20% 0%, #24305a 0%, var(--navy) 45%, #0e1222 100%); }
.banner-mosaic { position: absolute; inset: -20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; transform: rotate(-6deg) scale(1.15); opacity: .55; }
.banner-mosaic img, .banner-mosaic div { width: 100%; aspect-ratio: 6 / 7; border-radius: 14px; background: rgba(255, 255, 255, .05); }
.banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(14, 15, 19, .15) 0%, rgba(14, 15, 19, .55) 55%, rgba(14, 15, 19, 1) 100%); }
.hero-body { max-width: 1600px; margin: 0 auto; padding: 0 24px; position: relative; margin-top: -64px; z-index: 2; display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; }
.avatar { width: 120px; height: 120px; border-radius: 22px; border: 4px solid var(--bg); background: var(--card); overflow: hidden; flex: none; box-shadow: var(--shadow); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.hero-title { flex: 1; min-width: 260px; padding-bottom: 6px; }
.hero-title h1 { margin: 0; font-size: 32px; letter-spacing: -.02em; line-height: 1.1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--card-2); color: var(--text-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.orange { background: var(--accent-wash); color: #ffb08a; border-color: rgba(255, 77, 0, .35); }
.chip.green { background: rgba(34, 194, 122, .12); color: #7fe0b2; border-color: rgba(34, 194, 122, .3); }
.chip.amber { background: rgba(255, 176, 32, .12); color: #ffd27a; border-color: rgba(255, 176, 32, .3); }
.chip.red { background: rgba(241, 85, 91, .12); color: #ffa3a6; border-color: rgba(241, 85, 91, .3); }
.hero-sub { margin: 8px 0 0; color: var(--text-2); max-width: 760px; font-size: 14px; }
.hero-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* stats bar (sticky under top bar) */
.statsbar { position: sticky; top: var(--top-h); z-index: 40; background: rgba(14, 15, 19, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); margin-top: 18px; }
.statsbar-in { max-width: 1600px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 28px; overflow-x: auto; scrollbar-width: none; }
.statsbar-in::-webkit-scrollbar { display: none; }
.mini-id { display: none; align-items: center; gap: 10px; font-weight: 700; white-space: nowrap; }
.mini-id img { width: 32px; height: 32px; border-radius: 8px; }
.statsbar.stuck .mini-id { display: flex; }
.stat { white-space: nowrap; }
.stat .v { font-weight: 650; font-size: 17px; font-family: var(--mono); font-feature-settings: "tnum"; }
.stat .v small { font-size: 12px; color: var(--text-3); font-weight: 500; margin-left: 3px; font-family: var(--sans); }
.stat .k { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.stat-sep { width: 1px; height: 30px; background: var(--line); flex: none; }

/* ---------------------------------------------------------------- tabs */
.tabs { max-width: 1600px; margin: 0 auto; padding: 0 24px; display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: none; border: 0; padding: 14px 14px 12px; font-weight: 600; color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; transition: color .15s; }
.tab:hover { color: var(--text-2); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab .count { margin-left: 6px; font-size: 12px; color: var(--text-3); font-family: var(--mono); }

.page { max-width: 1600px; margin: 0 auto; padding: 18px 24px 80px; }
.notice { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); margin-bottom: 14px; font-size: 14px; }
.notice.warn { border-color: #4a3410; background: #1d170b; color: #ffd27a; }
.notice.err { border-color: #5a2a2d; background: #1f1213; color: #ffb3b5; }
.notice.ok { border-color: rgba(34, 194, 122, .35); background: rgba(34, 194, 122, .08); color: #a5ebc8; }
.notice .grow { flex: 1; }

/* ---------------------------------------------------------------- items layout */
.items { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
.items.nofilters { grid-template-columns: 1fr; }
.items.nofilters .sidebar { display: none; }
.sidebar { position: sticky; top: calc(var(--top-h) + 70px); max-height: calc(100vh - var(--top-h) - 90px); overflow-y: auto; padding-right: 6px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.fgroup { border-bottom: 1px solid var(--line); }
.fgroup > button { width: 100%; display: flex; align-items: center; justify-content: space-between; background: none; border: 0; padding: 14px 4px; font-weight: 600; cursor: pointer; }
.fgroup > button .chev { transition: transform .2s; opacity: .7; }
.fgroup.open > button .chev { transform: rotate(180deg); }
.fgroup .fbody { display: none; padding: 0 4px 14px; }
.fgroup.open .fbody { display: block; }
.opt { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.opt:hover { background: var(--card); }
.opt input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.opt .n { margin-left: auto; color: var(--text-3); font-family: var(--mono); font-size: 12px; }
.seg { display: grid; grid-auto-flow: column; gap: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.seg button { border: 0; background: none; padding: 7px 10px; border-radius: 8px; cursor: pointer; color: var(--text-2); font-weight: 600; font-size: 13px; white-space: nowrap; }
.seg button.on { background: var(--card-2); color: var(--text); }
.range { display: flex; gap: 8px; align-items: center; }
.input { height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); padding: 0 12px; outline: none; width: 100%; min-width: 0; transition: border-color .15s; }
.input:focus { border-color: var(--accent); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 18px) 17px, calc(100% - 13px) 17px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; cursor: pointer; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.result-count { color: var(--text-2); font-size: 14px; white-space: nowrap; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.active-filters .chip { cursor: pointer; }
.active-filters .chip:hover { border-color: var(--line-2); color: var(--text); }

/* ---------------------------------------------------------------- cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 16px; }
.grid.big { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, border-color .18s; outline: none; }
.card:hover, .card:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.card .media { position: relative; aspect-ratio: 6 / 7; background: var(--bg-2); overflow: hidden; }
.card .media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; image-rendering: pixelated; }
.card:hover .media img { transform: scale(1.05); }
.card .tier { position: absolute; left: 10px; top: 10px; }
.card .check { position: absolute; right: 10px; top: 10px; width: 26px; height: 26px; border-radius: 8px; background: rgba(14, 15, 19, .65); border: 1px solid rgba(255, 255, 255, .25); display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.card:hover .check, .card.sel .check { opacity: 1; }
.card.sel .check { background: var(--accent); border-color: var(--accent); }
.card .body { padding: 12px 14px 14px; }
.card .name { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; display: flex; justify-content: space-between; gap: 6px; }
.card .price { margin-top: 10px; display: flex; align-items: baseline; gap: 6px; min-height: 22px; }
.card .price .v { font-family: var(--mono); font-weight: 650; font-size: 16px; }
.card .price .u { font-size: 12px; color: var(--text-3); }
.card .price .none { font-size: 13px; color: var(--text-3); }
.card .offer { font-size: 12px; color: var(--text-2); margin-top: 3px; min-height: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .hover-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; transform: translateY(100%); transition: transform .18s ease; }
.card:hover .hover-bar, .card:focus-within .hover-bar { transform: translateY(0); }
.card .hover-bar button { flex: 1; height: 42px; border: 0; font-weight: 700; cursor: pointer; background: var(--accent); color: #fff; }
.card .hover-bar button.alt { flex: 0 0 54px; background: #c93d00; }
.card .hover-bar button:hover { filter: brightness(1.08); }
.card .owned-tag { position: absolute; right: 10px; bottom: 10px; }
@media (hover: none) { .card .hover-bar { display: none; } .card .check { opacity: 1; } }

.skel { background: linear-gradient(90deg, var(--card) 0%, var(--card-2) 50%, var(--card) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.card.skeleton { cursor: default; }
.card.skeleton:hover { transform: none; box-shadow: none; }
.card.skeleton .media { background: none; }
.card.skeleton .media .skel { position: absolute; inset: 0; border-radius: 0; }
.skel.line { height: 12px; margin-top: 8px; }

.empty { text-align: center; padding: 60px 20px; color: var(--text-2); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty h3 { margin: 0 0 6px; color: var(--text); }

/* ---------------------------------------------------------------- tables / lists */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: rgba(255, 255, 255, .02); }
.table .item { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }
.table .item img, .table .item .ph { width: 40px; height: 40px; border-radius: 8px; flex: none; background: var(--bg-2); }
.table .item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; font-weight: 600; }
.table .num { font-family: var(--mono); white-space: nowrap; }
.table a.tx { color: var(--text-2); text-decoration: none; display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.table a.tx:hover { color: var(--text); }
.ev { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; }
.ev i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ev.sale i { background: var(--green); } .ev.list i { background: var(--accent); } .ev.offer i { background: #6aa8ff; } .ev.cancel i { background: var(--text-3); } .ev.coll i { background: #b38bff; } .ev.price i { background: var(--amber); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel h3 { margin: 0 0 12px; font-size: 16px; }
.panel + .panel { margin-top: 16px; }
.scroll-x { overflow-x: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chips button { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--text-2); cursor: pointer; font-weight: 600; font-size: 13px; }
.chips button.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: 260px; display: block; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-top: 8px; flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-tip { position: absolute; pointer-events: none; background: var(--card-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; font-size: 12px; white-space: nowrap; opacity: 0; transition: opacity .1s; }

/* ---------------------------------------------------------------- modal */
.scrim { position: fixed; inset: 0; background: rgba(5, 6, 9, .7); backdrop-filter: blur(4px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.scrim.on { opacity: 1; pointer-events: auto; }
.modal { width: min(1080px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); transform: translateY(14px) scale(.985); transition: transform .22s cubic-bezier(.2, .8, .2, 1); position: relative; }
.scrim.on .modal { transform: none; }
.modal.small { width: min(480px, 100%); }
.modal .x { position: absolute; right: 14px; top: 14px; z-index: 3; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(20, 22, 28, .8); cursor: pointer; display: grid; place-items: center; }
.modal .x:hover { background: var(--card-2); }
.mhead { padding: 22px 24px 4px; }
.mhead h2 { margin: 0; font-size: 20px; }
.mbody { padding: 16px 24px 24px; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; padding: 24px; }
.detail .big { border-radius: 16px; overflow: hidden; background: var(--card); border: 1px solid var(--line); aspect-ratio: 6 / 7; max-height: 70vh; margin: 0 auto; }
.detail .big img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.detail h2 { margin: 2px 0 6px; font-size: 28px; letter-spacing: -.02em; word-break: break-word; padding-right: 40px; }
.owner-line { color: var(--text-2); font-size: 14px; display: flex; gap: 14px; flex-wrap: wrap; }
.owner-line a { color: var(--text); text-decoration: none; font-weight: 600; }
.pricebox { margin-top: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.pricebox .lbl { font-size: 13px; color: var(--text-3); }
.pricebox .big-price { font-family: var(--mono); font-size: 30px; font-weight: 700; margin-top: 4px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pricebox .big-price small { font-size: 15px; color: var(--text-2); font-family: var(--sans); font-weight: 500; }
.pricebox .actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.pricebox .actions .btn { flex: 1; min-width: 140px; }
.feeline { font-size: 12px; color: var(--text-3); margin-top: 10px; }
.feeline b { color: var(--text-2); font-weight: 600; }
.traits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.trait { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; min-width: 0; }
.trait .t { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.trait .v { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trait .p { font-size: 12px; color: var(--text-2); }
.section-h { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin: 20px 0 10px; font-weight: 600; }
.rows .row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.rows .row:last-child { border-bottom: 0; }
.rows .row .grow { flex: 1; min-width: 0; }
.rows .row .price { font-family: var(--mono); font-weight: 650; white-space: nowrap; }
.form { display: grid; gap: 12px; }
.form label { font-size: 13px; color: var(--text-2); font-weight: 600; display: grid; gap: 6px; }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 60px; }
.input-suffix span { position: absolute; right: 12px; top: 10px; color: var(--text-3); font-weight: 600; font-size: 14px; }
.breakdown { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.breakdown div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.breakdown div span:last-child { font-family: var(--mono); text-align: right; }
.breakdown .tot { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; font-weight: 700; }

/* ---------------------------------------------------------------- cart drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--bg-2); border-left: 1px solid var(--line-2); z-index: 110; transform: translateX(100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; box-shadow: -20px 0 60px rgba(0, 0, 0, .5); }
.drawer.on { transform: none; }
.drawer-scrim { position: fixed; inset: 0; z-index: 105; background: rgba(5, 6, 9, .55); opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-scrim.on { opacity: 1; pointer-events: auto; }
.drawer-h { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-h h3 { margin: 0; font-size: 18px; }
.drawer-b { flex: 1; overflow-y: auto; padding: 8px 20px; }
.drawer-f { padding: 16px 20px 20px; border-top: 1px solid var(--line); }
.cart-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-item img { width: 52px; height: 52px; border-radius: 10px; background: var(--card); }
.cart-item .grow { flex: 1; min-width: 0; }
.cart-item .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item.gone { opacity: .55; }
.cart-btn { position: relative; }
.cart-btn .badge { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; }
.filter-btn { display: none; }
.sweep-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); }
.sweep-bar input[type=range] { accent-color: var(--accent); width: 130px; }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 10px; width: min(380px, calc(100% - 40px)); }
.toast { background: var(--card-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: flex-start; animation: tin .22s cubic-bezier(.2, .8, .2, 1); font-size: 14px; }
.toast.out { animation: tout .2s ease forwards; }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes tout { to { opacity: 0; transform: translateY(10px); } }
.toast .ic { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; margin-top: 1px; }
.toast.ok .ic { background: rgba(34, 194, 122, .2); color: var(--green); }
.toast.err .ic { background: rgba(241, 85, 91, .2); color: var(--red); }
.toast.wait .ic { background: rgba(255, 255, 255, .08); }
.toast .tt { font-weight: 650; }
.toast .td { color: var(--text-2); font-size: 13px; margin-top: 2px; word-break: break-word; }
.toast .td a { color: #ffb08a; }
.toast .grow { flex: 1; min-width: 0; }
.toast .close { background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 0 2px; font-size: 18px; line-height: 1; }

footer { border-top: 1px solid var(--line); color: var(--text-3); font-size: 13px; padding: 24px; text-align: center; }
footer a { color: var(--text-2); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .detail { grid-template-columns: 1fr; }
  .detail .big { max-width: 520px; margin: 0 auto; width: 100%; }
}
@media (max-width: 900px) {
  :root { --top-h: 58px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .brand small { display: none; }
  .search { display: none; }
  .search.mobile-on { display: block; position: absolute; left: 10px; right: 10px; top: 8px; max-width: none; z-index: 2; }
  .search-toggle { display: inline-flex !important; }
  .items { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(340px, 88%); max-height: none; z-index: 120; background: var(--bg-2); padding: 16px; border-right: 1px solid var(--line-2); transform: translateX(-102%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); box-shadow: 20px 0 60px rgba(0, 0, 0, .5); }
  .sidebar.on { transform: none; }
  .items.nofilters .sidebar { display: block; }
  .filter-btn { display: inline-flex; }
  .filters-toggle { display: none !important; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid.big { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .banner { height: 150px; }
  .hero-body { margin-top: -44px; padding: 0 14px; gap: 14px; }
  .avatar { width: 84px; height: 84px; border-radius: 18px; }
  .hero-title { min-width: 100%; padding-bottom: 0; }
  .hero-title h1 { font-size: 24px; }
  .hero-sub { font-size: 13px; }
  .statsbar-in { padding: 10px 14px; gap: 20px; }
  .stat .v { font-size: 15px; }
  .tabs { padding: 0 8px; }
  .page { padding: 14px 14px 80px; }
  .card .body { padding: 10px 10px 12px; }
  .card .price .v { font-size: 14px; }
  .card .price .u { display: none; }
  .scrim { padding: 0; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: 20px 20px 0 0; width: 100%; transform: translateY(40px); }
  .modal.small { width: 100%; }
  .detail { padding: 16px; gap: 16px; }
  .detail .dleft { display: contents; }
  .detail .big { order: 1; max-width: 260px; }
  .detail .dinfo { order: 2; }
  .detail .dtraits { order: 3; }
  .detail .dtraits .section-h { margin-top: 4px; }
  .detail h2 { font-size: 22px; }
  .traits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar .sort { flex: 1 1 100%; order: 5; width: 100% !important; }
  .sweep-bar input[type=range] { width: 90px; }
  .toasts { right: 10px; left: 10px; bottom: 10px; width: auto; }
  .table .item span { max-width: 120px; }
  .hide-m { display: none !important; }
  .pill.net { display: none; }
}
@media (min-width: 901px) { .search-toggle { display: none !important; } .show-m { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.rows.hist-scroll { max-height: 320px; overflow-y: auto; padding-right: 6px; overscroll-behavior: contain; }

/* ---------------------------------------------------------------- theme toggle */
.theme-btn .i-moon { display: none; }
[data-theme="light"] .theme-btn .i-sun { display: none; }
[data-theme="light"] .theme-btn .i-moon { display: block; }

/* ---------------------------------------------------------------- light theme */
[data-theme="light"] {
  --bg: #f5f5f7;
  --bg-2: #ffffff;
  --card: #ffffff;
  --card-2: #efeff2;
  --line: #e2e2e7;
  --line-2: #d0d0d7;
  --text: #1d1d1f;
  --text-2: #4b4d56;
  --text-3: #6c6f7a;
  --accent-wash: rgba(255, 77, 0, .10);
  --green: #12925a;
  --red: #d63c43;
  --amber: #a86a00;
  --shadow: 0 10px 30px rgba(20, 22, 30, .10);
  --link-warm: #c93d00;
  --red-text: #c0303a;
  color-scheme: light;
}
[data-theme="light"] .tn-banner { background: repeating-linear-gradient(-45deg, #fff4dc, #fff4dc 12px, #ffecc4 12px, #ffecc4 24px); color: #8a5600; border-bottom-color: #f0d49a; }
[data-theme="light"] .tn-banner b { color: #6b4200; }
[data-theme="light"] .topbar { background: rgba(245, 245, 247, .88); }
[data-theme="light"] .statsbar { background: rgba(245, 245, 247, .94); }
[data-theme="light"] .btn:hover { background: #e4e4e9; }
[data-theme="light"] .btn.primary:hover { background: var(--accent-2); }
[data-theme="light"] .btn.danger { border-color: #f0c2c4; color: #c0303a; }
[data-theme="light"] .pill.bad { border-color: #f0d49a; }
[data-theme="light"] .banner { background: radial-gradient(1200px 300px at 20% 0%, #dfe4f2 0%, #eceef5 45%, #f5f5f7 100%); }
[data-theme="light"] .banner-mosaic img, [data-theme="light"] .banner-mosaic div { background: rgba(0, 0, 0, .05); }
[data-theme="light"] .banner::after { background: linear-gradient(180deg, rgba(245, 245, 247, .1) 0%, rgba(245, 245, 247, .55) 55%, rgba(245, 245, 247, 1) 100%); }
[data-theme="light"] .chip.orange { color: #c93d00; }
[data-theme="light"] .chip.green { color: #0e7a4b; }
[data-theme="light"] .chip.amber { color: #8a5600; }
[data-theme="light"] .chip.red { color: #c0303a; }
[data-theme="light"] .notice.warn { border-color: #f0d49a; background: #fff6e2; color: #7a4d00; }
[data-theme="light"] .notice.err { border-color: #f0c2c4; background: #fdeeee; color: #a5262e; }
[data-theme="light"] .notice.ok { color: #0e7a4b; }
[data-theme="light"] .table tr:hover td { background: rgba(0, 0, 0, .025); }
[data-theme="light"] .scrim { background: rgba(20, 22, 30, .35); }
[data-theme="light"] .drawer-scrim { background: rgba(20, 22, 30, .3); }
[data-theme="light"] .modal { box-shadow: 0 30px 80px rgba(20, 22, 30, .18); }
[data-theme="light"] .modal .x { background: rgba(255, 255, 255, .9); }
[data-theme="light"] .toast .td a { color: #c93d00; }
[data-theme="light"] .toast.wait .ic { background: rgba(0, 0, 0, .06); }
[data-theme="light"] .spinner { border-color: rgba(0, 0, 0, .15); border-top-color: var(--accent); }
[data-theme="light"] .btn.primary .spinner { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
[data-theme="light"] .drawer { box-shadow: none; }
[data-theme="light"] .drawer.on { box-shadow: -20px 0 60px rgba(20, 22, 30, .15); }
@media (max-width: 900px) {
  [data-theme="light"] .sidebar { box-shadow: none; }
  [data-theme="light"] .sidebar.on { box-shadow: 20px 0 60px rgba(20, 22, 30, .15); }
}
/* small phones: keep the theme button without pushing Connect off screen */
@media (max-width: 480px) {
  .top-actions { gap: 6px; }
  .top-actions .btn.icon { width: 38px; height: 38px; }
  #connect { height: 38px; padding: 0 12px; font-size: 14px; }
  .brand { font-size: 0; gap: 0; }
  .brand small { display: none; }
}

/* language toggle */
.lang-btn { font-size: 14px; font-weight: 650; letter-spacing: .02em; }
[data-lang="zh"] body { word-break: normal; line-break: strict; }
