/* =====================================================================
   StableScreen — design system
   A calm, premium dark trading terminal for the Stable chain.
   Brand chrome is indigo→violet; price direction is strictly green/red,
   so brand color never collides with up/down semantics.
   ===================================================================== */
:root {
  color-scheme: light;

  /* Parity — ambient light glass. Surfaces are translucent white so the
     backdrop-filter refracts the aurora behind them. */
  --bg:        #eef1f5;
  --surface:   rgba(255,255,255,.55);
  --surface-2: rgba(255,255,255,.42);
  --surface-3: rgba(255,255,255,.72);
  --line:      rgba(40,50,75,.08);
  --line-2:    rgba(40,50,75,.14);

  /* ink */
  --text:   #2a2f3a;
  --text-2: #616776;
  --text-3: #9aa0ac;

  /* brand — muted steel blue, never electric */
  --brand:   #6a7d9c;
  --brand-2: #93a4c0;
  --brand-ink: #ffffff;
  --brand-glow: rgba(106,125,156,.3);

  /* semantic — price direction only, desaturated for the light ground */
  --up:   #109c72;
  --down: #d6555c;
  --up-soft:   rgba(16,156,114,.12);
  --down-soft: rgba(214,85,92,.12);

  /* geometry */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --shadow: 0 18px 44px -18px rgba(48,66,120,.24);
  --shadow-lg: 0 28px 64px -24px rgba(48,66,120,.3);
  --glass-edge: rgba(255,255,255,.7);

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scrollbar-gutter: stable; }
/* Background sits on a fixed html layer so backdrop-filter panels always have a
   painted canvas to sample — otherwise glass paints black on scroll. */
html {
  min-height: 100%;
  background: linear-gradient(160deg, #eef1f5 0%, #f0f0ee 50%, #f4f1ec 100%) fixed;
}
body {
  margin: 0;
  font: 14px/1.5 var(--sans);
  color: var(--text);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* soft ambient aurora — desaturated steel-blue, sand, sage; fixed behind all */
body::before {
  content: ""; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(760px 620px at 8% -12%, rgba(150,172,205,.28), transparent 66%),
    radial-gradient(700px 600px at 100% -6%, rgba(222,208,184,.28), transparent 66%),
    radial-gradient(620px 560px at 46% 108%, rgba(178,200,192,.2), transparent 68%);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: rgba(106,125,156,.28); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #c3c9d4; background-clip: content-box; }

.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.sub2 { font-size: .82em; opacity: .75; }
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); }
.up { color: var(--up); }
.down { color: var(--down); }

/* =====================================================================
   Header
   ===================================================================== */
header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 11px 22px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 13px; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  box-shadow: 0 6px 18px var(--brand-glow), inset 0 1px 0 rgba(255,255,255,.35);
}
.logo-mark svg { width: 20px; height: 20px; display: block; }
.wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.wordmark h1 {
  font-size: 17px; margin: 0; font-weight: 700; letter-spacing: -.02em;
}
.wordmark h1 .accent {
  background: linear-gradient(92deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.wordmark .sub {
  font-size: 11px; color: var(--text-3); letter-spacing: .01em;
  display: flex; align-items: center; gap: 6px;
}
.sub .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }

/* segmented view nav */
.viewnav {
  display: flex; gap: 2px; margin-left: 8px; padding: 3px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
}
.viewnav button {
  appearance: none; border: 0; cursor: pointer;
  background: transparent; color: var(--text-3);
  font: 600 13px/1 var(--sans); padding: 8px 15px; border-radius: 8px;
  transition: color .18s var(--ease), background .18s var(--ease);
}
.viewnav button:hover { color: var(--text-2); }
.viewnav button.active { color: var(--text); background: var(--surface-3); box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }

/* stat pills */
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 13px;
  font-size: 12px; color: var(--text-3); white-space: nowrap;
}
.chip .k { color: var(--text-3); }
.chip b { color: var(--text); font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; transition: color .3s; }
.chip.flash b { color: var(--brand); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); position: relative; }
.live-dot.on { background: var(--up); }
.live-dot.on::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  background: var(--up); opacity: .5; animation: ping 1.8s var(--ease-out) infinite;
}
@keyframes ping { 0% { transform: scale(.6); opacity: .55; } 100% { transform: scale(2.4); opacity: 0; } }

/* =====================================================================
   Live ticker — smooth infinite marquee
   ===================================================================== */
.ticker {
  position: relative; overflow: hidden; white-space: nowrap;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 60%, var(--bg)));
  height: 38px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
.ticker-track {
  display: inline-flex; align-items: center; gap: 26px; height: 100%;
  padding-left: 26px; will-change: transform;
  animation: marquee 60s linear infinite;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.tk { font-size: 12.5px; color: var(--text-2); display: inline-flex; align-items: center; gap: 7px; }
.tk .s { font-weight: 600; color: var(--text); }
.tk .side { font-family: var(--mono); font-weight: 700; font-size: 11px; }
.tk .side.buy { color: var(--up); }
.tk .side.sell { color: var(--down); }
.tk .amt { font-family: var(--mono); color: var(--text-3); }
.ticker.empty::after { content: "waiting for live trades…"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 12px; }

/* =====================================================================
   Panels / layout
   ===================================================================== */
main { display: grid; grid-template-columns: 1fr; gap: 16px; padding: 18px 22px 40px; }
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
.toolbar { display: flex; align-items: center; gap: 12px; padding: 13px 15px; flex-wrap: wrap; }

/* search */
.search-wrap { position: relative; flex: 0 1 360px; display: flex; align-items: center; }
.search-wrap svg { position: absolute; left: 12px; width: 15px; height: 15px; color: var(--text-3); pointer-events: none; }
#search {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 10px;
  padding: 9px 12px 9px 34px; font-size: 13px; font-family: var(--sans);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
#search::placeholder { color: var(--text-3); }
#search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }

/* filters */
.filters { display: flex; gap: 5px; flex-wrap: wrap; }
.filters button {
  appearance: none; cursor: pointer; font: 600 12.5px/1 var(--sans);
  color: var(--text-3); background: var(--bg); border: 1px solid var(--line-2);
  padding: 8px 13px; border-radius: 999px;
  transition: all .16s var(--ease);
}
.filters button:hover { color: var(--text-2); border-color: var(--text-3); }
.filters button.active { color: var(--brand-ink); background: linear-gradient(140deg, var(--brand), var(--brand-2)); border-color: transparent; }
.spacer { flex: 1; }

/* =====================================================================
   Tables
   ===================================================================== */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
thead th {
  position: sticky; top: 0; z-index: 2;
  font: 600 11px/1 var(--sans); text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); text-align: left; padding: 11px 14px; user-select: none;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
thead th.num { text-align: right; }
th.sortable { cursor: pointer; transition: color .15s; }
th.sortable:hover { color: var(--text-2); }
th.sorted { color: var(--brand); }
th.sorted::after { content: " ↓"; opacity: .8; }

tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); }
tbody tr { cursor: pointer; transition: background .14s var(--ease); }
tbody tr:hover { background: var(--surface-2); }
tbody tr.selected { background: linear-gradient(90deg, rgba(106,125,156,.12), transparent 60%); box-shadow: inset 2px 0 0 var(--brand); }
tbody tr:last-child td { border-bottom: 0; }

/* trade flash (side-tinted) */
@keyframes flashBuy  { from { background: var(--up-soft); }  to { background: transparent; } }
@keyframes flashSell { from { background: var(--down-soft); } to { background: transparent; } }
tr.flash-buy  { animation: flashBuy .9s var(--ease-out); }
tr.flash-sell { animation: flashSell .9s var(--ease-out); }

/* token cell */
.tok { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 42px; height: 42px; border-radius: 12px; flex: none; position: relative; overflow: hidden;
  display: grid; place-items: center; font: 700 13px/1 var(--sans);
  letter-spacing: -.02em; box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 2px 6px rgba(40,50,90,.14);
  transition: transform .18s var(--ease-out), box-shadow .18s;
}
/* the real on-chain logo overlays the tonal chip; removed on load error */
/* transparent background so the tonal chip shows through while a freshly-
   uploaded IPFS image propagates, instead of a blank white box */
.avatar .token-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: transparent; }
.avatar.has-img { cursor: zoom-in; }
.avatar.has-img:hover { transform: scale(1.08); box-shadow: 0 8px 20px -6px rgba(40,50,90,.4); z-index: 2; }

/* meme lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgba(20,26,40,.55); backdrop-filter: blur(10px) saturate(1.2);
  animation: lbIn .18s var(--ease-out); cursor: zoom-out; padding: 24px;
}
@keyframes lbIn { from { opacity: 0; } }
.lb-card {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  animation: lbPop .28s var(--ease-out);
}
@keyframes lbPop { from { transform: scale(.9); opacity: 0; } }
.lb-card img {
  max-width: min(76vw, 520px); max-height: 70vh; border-radius: 20px;
  box-shadow: 0 40px 100px -20px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.3);
  background: #fff;
}
.lb-cap { font-size: 17px; font-weight: 650; color: #fff; letter-spacing: -.01em; text-shadow: 0 2px 10px rgba(0,0,0,.4); }
.tok-meta { display: flex; flex-direction: column; min-width: 0; }
.tok-meta .sym { font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: 6px; }
.tok-meta .nm { color: var(--text-3); font-size: 11.5px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank { color: var(--text-3); font-family: var(--mono); font-size: 12px; width: 34px; }
tr:nth-child(1) .rank { color: #f5c451; }
tr:nth-child(2) .rank { color: #c9d1e0; }
tr:nth-child(3) .rank { color: #d69a6a; }

/* price cell */
td.price { font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.price sub { font-size: .72em; color: var(--text-3); }
.cell-flash { animation: cellFlash .7s var(--ease-out); }
@keyframes cellFlash { from { color: var(--brand); } to { color: inherit; } }

/* change pill */
.pill {
  display: inline-flex; align-items: center; gap: 3px; justify-content: flex-end;
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  padding: 3px 8px; border-radius: 7px;
}
.pill.up { background: var(--up-soft); color: var(--up); }
.pill.down { background: var(--down-soft); color: var(--down); }

/* badges */
.badge { font: 700 9px/1 var(--sans); letter-spacing: .04em; padding: 3px 5px; border-radius: 5px; vertical-align: middle; }
.badge.lp { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--line-2); }
.badge.new { background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: var(--brand-ink); animation: newpop .4s var(--ease-out); }
@keyframes newpop { from { transform: scale(0); } to { transform: scale(1); } }

/* skeleton loading */
.skl td { border-bottom: 1px solid var(--line); }
.skl .bar { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.empty-row td { padding: 40px; text-align: center; color: var(--text-3); }

/* =====================================================================
   Detail — slide-in drawer
   ===================================================================== */
.scrim {
  position: fixed; inset: 0; z-index: 50; background: rgba(6,7,10,.55);
  backdrop-filter: blur(3px); opacity: 0; transition: opacity .28s var(--ease);
}
.scrim.show { opacity: 1; }
.detail {
  position: fixed; top: 0; right: 0; z-index: 51; height: 100dvh; width: min(460px, 94vw);
  background: var(--surface); border-left: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 14px; padding: 18px;
  transform: translateX(100%); transition: transform .34s var(--ease-out);
  overflow-y: auto;
}
.detail.show { transform: translateX(0); }
.detail-close {
  appearance: none; cursor: pointer; position: absolute; top: 16px; right: 16px; z-index: 2;
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 9px;
  color: var(--text-2); font-size: 13px; transition: all .15s var(--ease);
}
.detail-close:hover { color: var(--text); background: var(--surface-3); }
.detail-head { display: flex; align-items: center; gap: 14px; padding-right: 40px; }
.detail-logo { flex: none; }
.detail-logo .avatar { width: 56px; height: 56px; border-radius: 16px; font-size: 17px; }
.detail-id { min-width: 0; }
.detail-sym { display: flex; align-items: center; gap: 4px; }
.detail-sym h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.detail-id .nm { color: var(--text-3); font-size: 12.5px; }
.detail-priceline { display: flex; align-items: baseline; gap: 10px; }
.big-num { font-size: 30px; font-weight: 700; font-family: var(--mono); letter-spacing: -.02em; }
.big-num sub { font-size: .7em; color: var(--text-3); }

.detail-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dstat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; }
.dstat .k { display: block; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); font-weight: 600; margin-bottom: 3px; }
.dstat .v { font-size: 14px; font-weight: 600; font-family: var(--mono); font-variant-numeric: tabular-nums; }

.tf-row { display: flex; gap: 6px; }
.tf-row button {
  appearance: none; cursor: pointer; font: 600 12px/1 var(--sans);
  background: var(--surface-2); color: var(--text-3); border: 1px solid var(--line-2);
  padding: 7px 14px; border-radius: 8px; transition: all .15s var(--ease);
}
.tf-row button:hover { color: var(--text-2); }
.tf-row button.active { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 55%, transparent); background: rgba(106,125,156,.10); }
#chart { height: 240px; border-radius: var(--r); overflow: hidden; background: rgba(255,255,255,.35); border: 1px solid var(--line); }
.detail-links { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.detail-links a { color: var(--brand); font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); padding: 5px 11px; border-radius: 8px; text-decoration: none; }
.detail-links a:hover { background: var(--surface-3); }
.detail h3 { margin: 6px 0 0; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.trades-wrap { overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r); max-height: 320px; }
.trades { width: 100%; border-collapse: collapse; }
.trades td { padding: 8px 12px; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.trades tr:last-child td { border-bottom: 0; }
.trades td:first-child { font-family: var(--mono); font-weight: 700; font-size: 11px; }

/* =====================================================================
   Portfolio
   ===================================================================== */
.portfolio { padding: 20px 22px 48px; display: flex; flex-direction: column; gap: 18px; max-width: 1180px; margin: 0 auto; width: 100%; }
.pf-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pf-input { position: relative; flex: 1 1 460px; display: flex; align-items: center; }
.pf-input svg { position: absolute; left: 13px; width: 16px; height: 16px; color: var(--text-3); }
#pfAddress {
  width: 100%; background: var(--surface); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 12px;
  padding: 13px 14px 13px 38px; font: 14px/1 var(--mono);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
#pfAddress::placeholder { color: var(--text-3); font-family: var(--sans); }
#pfAddress:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
#pfGo {
  appearance: none; cursor: pointer; font: 600 14px/1 var(--sans);
  color: var(--brand-ink); background: linear-gradient(140deg, var(--brand), var(--brand-2));
  border: 0; border-radius: 12px; padding: 13px 26px;
  transition: transform .12s var(--ease), filter .15s var(--ease);
}
#pfGo:hover { filter: brightness(1.07); }
#pfGo:active { transform: scale(.97); }
.pf-auto { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 12.5px; cursor: pointer; user-select: none; }
/* toggle switch */
.switch { position: relative; width: 34px; height: 20px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: var(--surface-3); border-radius: 999px; transition: background .18s var(--ease); }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.switch input:checked + .track { background: linear-gradient(140deg, var(--brand), var(--brand-2)); }
.switch input:checked + .track::after { transform: translateX(14px); }

/* hero card */
.pf-hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px;
  background:
    radial-gradient(600px 240px at 100% 0%, rgba(106,125,156,.12), transparent 60%),
    var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-xl); padding: 24px 26px;
}
.pf-hero .label { font-size: 12px; color: var(--text-3); letter-spacing: .02em; margin-bottom: 6px; }
.pf-value-big { font: 700 42px/1 var(--mono); letter-spacing: -.02em; }
.pf-addr { margin-top: 10px; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.pf-addr .copy { cursor: pointer; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-2); transition: all .15s; }
.pf-addr .copy:hover { color: var(--text); background: var(--surface-3); }

.pf-pnl { display: flex; flex-direction: column; justify-content: center; padding-left: 22px; border-left: 1px solid var(--line); }
.pf-pnl .big { font: 700 34px/1 var(--mono); letter-spacing: -.02em; display: flex; align-items: baseline; gap: 10px; }
.pf-pnl .pct { font-size: 18px; }
.pf-pnl.up .big { color: var(--up); }
.pf-pnl.down .big { color: var(--down); }
.pf-pnl .arrow { font-size: 22px; }
.pf-computing { font-size: 12px; color: var(--brand); display: inline-flex; align-items: center; gap: 7px; margin-top: 8px; }
.pf-computing .spin { width: 12px; height: 12px; border: 2px solid var(--brand-glow); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* sub-stats */
.pf-sub { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pf-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 15px 16px; }
.pf-stat .k { font-size: 11.5px; color: var(--text-3); margin-bottom: 6px; }
.pf-stat .v { font: 600 18px/1.1 var(--mono); font-variant-numeric: tabular-nums; }
.pf-stat .v small { color: var(--text-3); font-size: 12px; font-weight: 400; }

/* holdings profit bar */
.profit-cell { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 3px; font-family: var(--mono); }
.profit-cell .p { font-weight: 650; }
.profit-cell .pp { font-size: 11px; }
.portbar { position: relative; height: 5px; width: 74px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-left: auto; }
.portbar > i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }

.pf-note { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 7px; }
.pf-empty { padding: 60px 20px; text-align: center; color: var(--text-3); font-size: 14px; }
.pf-hint { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 70px 20px; text-align: center; color: var(--text-3); }
.pf-hint .big-emoji { font-size: 40px; opacity: .85; }
.pf-hint .samples { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pf-hint .samples button { cursor: pointer; font: 500 12px/1 var(--mono); color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line-2); padding: 8px 12px; border-radius: 8px; transition: all .15s; }
.pf-hint .samples button:hover { color: var(--text); border-color: var(--brand); }

/* =====================================================================
   Footer
   ===================================================================== */
footer { padding: 22px; text-align: center; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--line); line-height: 1.7; }

/* =====================================================================
   Motion / responsive
   ===================================================================== */
.view-enter { animation: viewIn .32s var(--ease-out); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 860px) {
  .pf-hero { grid-template-columns: 1fr; }
  .pf-pnl { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 18px; }
  .pf-sub { grid-template-columns: repeat(2, 1fr); }
  .chips .chip.hide-sm { display: none; }
  .wordmark .sub { display: none; }
}
@media (max-width: 560px) {
  header { padding: 10px 14px; }
  main, .portfolio { padding-left: 14px; padding-right: 14px; }
  .pf-value-big { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .ticker-track { animation: none; }
}

/* =====================================================================
   Market map — the signature view
   ===================================================================== */
.market { padding: 18px 22px 40px; display: flex; flex-direction: column; gap: 14px; }
.market-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 2px 4px 0; }
.market-head h2 { font-size: 19px; font-weight: 600; letter-spacing: -.02em; display: flex; align-items: center; gap: 9px; margin: 0; }
.market-head .market-hint { font-size: 12.5px; color: var(--text-3); }
.live-tag { font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--up); background: var(--up-soft); padding: 3px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; }
.live-tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--up); display: block; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.mmap-panel { padding: 14px; }
.mmap { position: relative; width: 100%; height: 460px; }
.mmap-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; }
.mcell {
  position: absolute; border-radius: 12px; padding: 9px 11px; overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; justify-content: space-between;
  border: 1px solid var(--glass-edge); box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
  transition: transform .18s var(--ease-out), box-shadow .18s;
}
.mcell:hover { transform: translateY(-3px) scale(1.012); box-shadow: 0 14px 30px -10px rgba(50,70,120,.4); z-index: 5; }
.mc-sym { font-weight: 700; letter-spacing: -.01em; line-height: 1.1; color: var(--text); }
.mc-chg { font-family: var(--mono); font-weight: 600; font-size: 12px; font-variant-numeric: tabular-nums; }
.mc-vol { font-size: .82em; color: var(--text-3); margin-left: 4px; }
@media (max-width: 760px) { .mmap { height: 520px; } }

/* token logos inside market-map cells */
.mc-sym { display: flex; align-items: center; gap: 6px; }
.mc-logo { width: 18px; height: 18px; border-radius: 5px; object-fit: cover; background: #fff; flex: none; box-shadow: 0 1px 3px rgba(40,50,90,.2); }

/* =====================================================================
   Advanced filters
   ===================================================================== */
.adv-toggle {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2);
  font: 600 12.5px/1 var(--sans); padding: 8px 13px; border-radius: 10px;
  transition: color .15s, border-color .15s, background .15s;
}
.adv-toggle:hover { color: var(--text); border-color: var(--line-2); }
.adv-toggle.active { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 45%, transparent); background: rgba(106,125,156,.08); }
.adv-count { background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; min-width: 16px; height: 16px; display: inline-grid; place-items: center; padding: 0 4px; }
.adv-panel {
  display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: flex-end;
  padding: 14px 16px; margin: 0 14px 4px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  animation: advIn .2s var(--ease-out);
}
@keyframes advIn { from { opacity: 0; transform: translateY(-4px); } }
.adv-panel label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.adv-panel input, .adv-panel select {
  font: 500 13px var(--mono); color: var(--text); background: var(--bg);
  border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; width: 130px;
}
.adv-panel input:focus, .adv-panel select:focus { outline: 1.5px solid var(--brand); border-color: transparent; }
.adv-reset {
  background: none; border: 1px solid var(--line-2); color: var(--text-3);
  font: 600 12px var(--sans); padding: 8px 14px; border-radius: 8px; cursor: pointer; height: 35px;
}
.adv-reset:hover { color: var(--text); border-color: var(--text-3); }

/* custom category icons — clean line style, not emoji */
.filters button { display: inline-flex; align-items: center; gap: 5px; }
.fi { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.filters button.active .fi { stroke: var(--brand); }

/* copy contract address */
.copy-addr {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  background: none; border: 0; cursor: pointer; color: var(--text-3);
  padding: 3px; margin-left: 3px; border-radius: 5px; position: relative;
  opacity: .5; transition: opacity .15s, color .15s, background .15s;
}
.tok:hover .copy-addr { opacity: 1; }
.copy-addr:hover { color: var(--text); background: var(--surface-2); }
.copy-addr.copied { color: var(--up); opacity: 1; }
.copy-addr.copied::after {
  content: "copied"; position: absolute; bottom: 135%; left: 50%; transform: translateX(-50%);
  font: 700 10px/1 var(--sans); color: #fff; background: var(--up);
  padding: 3px 6px; border-radius: 5px; white-space: nowrap; box-shadow: var(--shadow);
}
