:root {
  --bg: #0b0d10;
  --surface: #111418;
  --surface-2: #161a20;
  --hover: #1b2028;
  --border: #232931;
  --border-strong: #2e3540;
  --text: #e6e8eb;
  --muted: #8a93a0;
  --faint: #5d6570;
  --accent: #5b8def;
  --good: #3fb67a;
  --warn: #e0a236;
  --bad: #e5534b;
  --radius: 8px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
code { font-family: var(--mono); font-size: 0.85em; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 30; height: 52px; display: flex; align-items: center; gap: 24px; padding: 0 20px; background: var(--bg); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 700; font-size: 15px; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 2px; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: 6px; font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--surface-2); }
.search { position: relative; flex: 1; max-width: 520px; margin-left: auto; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 11px; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; color: var(--muted); }
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); }
.search input::placeholder { color: var(--faint); }
.search select { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; color: var(--muted); font-size: 12px; padding: 2px 4px; outline: none; }
.search kbd { font-family: var(--mono); font-size: 11px; color: var(--faint); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; }
.suggestions { position: absolute; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); max-height: 340px; overflow: auto; }
.suggestions li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--text); }
.suggestions li:hover, .suggestions li.active { background: var(--hover); }
.suggestions .sym { font-weight: 600; min-width: 56px; }
.suggestions .name { color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.status.live .dot { background: var(--good); }
.status .sep { color: var(--faint); }

/* Buttons & badges */
.btn { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #4a7ee3; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 6px; cursor: pointer; }
.icon-btn:hover { color: var(--text); }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); text-transform: capitalize; }
.badge-good { color: var(--good); border-color: rgba(63, 182, 122, 0.35); background: rgba(63, 182, 122, 0.08); }
.badge-warn { color: var(--warn); border-color: rgba(224, 162, 54, 0.35); background: rgba(224, 162, 54, 0.08); }
.badge-bad { color: var(--bad); border-color: rgba(229, 83, 75, 0.35); background: rgba(229, 83, 75, 0.08); }

/* Cards & tables */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card.pad { padding: 20px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 13px; font-weight: 600; }
.table { width: 100%; border-collapse: collapse; }
.table th { position: sticky; top: 0; background: var(--surface); text-align: left; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; color: var(--faint); padding: 8px 16px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--hover); }
.table .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.table-dense td { padding: 7px 16px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.empty { color: var(--muted); padding: 20px 16px; margin: 0; }
.tok { display: flex; align-items: center; gap: 10px; }
.tok b { font-weight: 600; }
.tok .muted { font-size: 12px; }
.addr-cell { display: flex; flex-direction: column; }
.addr-cell .mono { font-size: 12px; }
.addr-cell .label { font-size: 12px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.type i, .legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.score-pill { display: inline-block; min-width: 34px; text-align: center; padding: 2px 6px; border-radius: 4px; font-family: var(--mono); font-weight: 500; font-size: 12px; }

/* Home */
.view { max-width: 1320px; margin: 0 auto; padding: 24px 20px 48px; }
.home-hero { padding: 40px 0 32px; max-width: 720px; }
.home-hero h1 { font-size: 32px; letter-spacing: -0.02em; margin-bottom: 10px; }
.home-hero p { color: var(--muted); font-size: 15px; line-height: 1.6; margin: 0 0 20px; }
.home-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }

/* Token view */
.view.token { max-width: none; padding: 0; }
.token-bar { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.token-title { display: flex; align-items: center; gap: 10px; }
.token-title h1 { font-size: 20px; }
.token-meta { display: flex; align-items: center; gap: 12px; margin-top: 4px; font-size: 12px; }
.addr { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: 12px; }
.addr:hover { color: var(--text); }
.token-actions { display: flex; gap: 8px; }
.scan-progress { position: absolute; left: 0; right: 0; bottom: -1px; display: flex; align-items: center; gap: 12px; }
.scan-bar { flex: 1; height: 2px; background: transparent; }
.scan-bar div { height: 100%; width: 0; background: var(--accent); transition: width 0.3s; }
.scan-progress span { position: absolute; right: 20px; top: 6px; color: var(--muted); background: var(--bg); padding: 0 0 0 8px; }
.token-body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; padding: 16px 20px 24px; }
.main-card { display: flex; flex-direction: column; min-height: calc(100vh - 52px - 83px - 40px); overflow: hidden; }
.tabs { display: flex; align-items: center; gap: 4px; padding: 0 8px 0 12px; border-bottom: 1px solid var(--border); height: 44px; }
.tabs [role="tab"] { background: none; border: 0; border-bottom: 2px solid transparent; height: 44px; padding: 0 10px; color: var(--muted); font-weight: 500; cursor: pointer; }
.tabs [role="tab"]:hover { color: var(--text); }
.tabs [role="tab"].active { color: var(--text); border-bottom-color: var(--accent); }
.count { font-family: var(--mono); font-size: 11px; color: var(--faint); margin-left: 3px; }
.tab-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button { background: var(--surface); border: 0; border-right: 1px solid var(--border); padding: 3px 9px; font-size: 12px; font-family: var(--mono); color: var(--muted); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--hover); color: var(--text); }
.tab-panel { position: relative; flex: 1; min-height: 0; }
.tab-panel.scroll { overflow: auto; max-height: calc(100vh - 52px - 83px - 40px - 44px); }
#galaxy { position: absolute; inset: 0; }
.legend { position: absolute; left: 12px; bottom: 12px; margin: 0; padding: 8px 10px; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; max-width: 560px; background: rgba(17, 20, 24, 0.92); border: 1px solid var(--border); border-radius: 6px; font-size: 12px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.wallet { position: absolute; top: 12px; left: 12px; width: 300px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 14px 16px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); font-size: 13px; }
.wallet .close { position: absolute; right: 8px; top: 6px; background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; }
.wallet h3 { font-size: 14px; margin: 6px 0 2px; padding-right: 20px; }
.wallet .mono.addrline { font-size: 11px; color: var(--muted); word-break: break-all; }
.wallet .kv { margin: 12px 0; }
.wallet .btn { height: 28px; font-size: 12px; }

/* Side */
.side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.score-card { padding-bottom: 6px; }
.score-row { display: flex; align-items: baseline; gap: 6px; padding: 14px 16px 8px; }
.score { font-size: 40px; font-weight: 500; line-height: 1; letter-spacing: -0.02em; }
.score-track { margin: 0 16px 14px; height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.score-track div { height: 100%; width: 0; background: var(--muted); transition: width 0.8s ease; }
.factors { list-style: none; margin: 0; padding: 0 16px 8px; border-top: 1px solid var(--border); }
.factors li { display: grid; grid-template-columns: 1fr 44px; align-items: center; gap: 4px 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.factors li:last-child { border-bottom: 0; }
.factors .val { text-align: right; font-family: var(--mono); font-size: 12px; }
.factors .bar { grid-column: 1 / -1; height: 3px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.factors .bar div { height: 100%; border-radius: 2px; }
.kv { display: grid; grid-template-columns: 1fr auto; margin: 0; padding: 4px 16px 8px; }
.kv dt, .kv dd { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-family: var(--mono); font-size: 12px; }
.kv dt:nth-last-of-type(1), .kv dd:last-of-type { border-bottom: 0; }
.findings { list-style: none; margin: 0; padding: 4px 0; }
.findings li { display: grid; grid-template-columns: 8px 1fr auto; gap: 4px 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.findings li:last-child { border-bottom: 0; }
.findings li.clickable { cursor: pointer; }
.findings li.clickable:hover { background: var(--hover); }
.findings .sev { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--muted); }
.findings .bad .sev { background: var(--bad); } .findings .warn .sev { background: var(--warn); } .findings .good .sev { background: var(--good); }
.findings b { font-weight: 600; }
.findings p { grid-column: 2 / -1; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.findings .impact { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.disclaimer { color: var(--faint); font-size: 11px; margin: 0; }

/* Pages */
.view.page { max-width: 980px; }
.page-head { padding: 24px 0 20px; }
.page-head h1 { font-size: 24px; margin-bottom: 4px; }
.page-head p { margin: 0; }
.prose h2 { font-size: 15px; margin: 22px 0 8px; }
.prose h2:first-child { margin-top: 0; }
.prose p { color: #c3c8cf; line-height: 1.65; margin: 0 0 12px; }
.prose .table { margin: 8px 0 16px; border: 1px solid var(--border); border-radius: 6px; }

.scene-tooltip { background: var(--surface) !important; border: 1px solid var(--border-strong); border-radius: 6px; padding: 6px 9px !important; font: 12px/1.45 var(--font) !important; color: var(--text) !important; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 6px; padding: 8px 14px; font-size: 13px; z-index: 50; }

.table .right { text-align: right; }
/* Dashboard */
.page-head.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.tile-label { color: var(--muted); font-size: 12px; }
.tile-value { font-size: 26px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.span-2 { grid-column: span 2; }
.pad-sm { padding: 14px 16px; }
.pad-sm p { margin: 0 0 12px; line-height: 1.55; }
.row-gap { display: flex; gap: 8px; }
.scorebar { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.scorebar .mono { width: 24px; text-align: right; font-size: 12px; }
.scorebar > div { flex: 1; height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.scorebar > div > div { height: 100%; border-radius: 2px; }
.grades { list-style: none; margin: 0; padding: 8px 16px 12px; }
.grades li { display: grid; grid-template-columns: 90px 1fr 32px; align-items: center; gap: 10px; padding: 8px 0; font-size: 13px; }
.grade-name { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.grade-name i { width: 8px; height: 8px; border-radius: 2px; }
.grade-bar { height: 8px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.grade-bar div { height: 100%; border-radius: 2px; min-width: 2px; }
.grades b { text-align: right; font-weight: 500; font-size: 12px; }

/* Supply composition (2px surface gaps between segments) */
.stack { display: flex; gap: 2px; height: 12px; border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.stack span { min-width: 2px; }
.stack span.rest, .stack-legend i.rest { background: var(--surface-2); }
.stack-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.stack-legend li { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.stack-legend i { width: 10px; height: 10px; border-radius: 2px; }
.stack-legend b { color: var(--text); font-weight: 500; }

/* Markets */
.view.page.wide { max-width: 1320px; }
.market-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.chain-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.chain-tabs button { background: var(--surface); border: 1px solid var(--border); color: var(--muted); padding: 5px 11px; border-radius: 6px; cursor: pointer; text-transform: capitalize; font-weight: 500; }
.chain-tabs button:hover { color: var(--text); }
.chain-tabs button.active { background: var(--hover); color: var(--text); border-color: var(--border-strong); }
.market-filters { display: flex; gap: 8px; }
.market-filters .seg button { font-family: var(--font); padding: 5px 11px; }
.market-table th.sortable { cursor: pointer; }
.market-table th.sortable:hover { color: var(--text); }
.market-table th.sortable.active { color: var(--text); }
.market-table th.sortable.active::after { content: " ↓"; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
.market-table .open { text-decoration: none; display: inline-block; min-width: 120px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); }

/* Memecoin tools */
.traders-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.traders-grid > div:first-child { border-right: 1px solid var(--border); }
.sub-head { font-size: 12px; font-weight: 600; color: var(--muted); padding: 12px 16px 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.flows { list-style: none; margin: 0; padding: 6px 16px 10px; }
.flows li { display: grid; grid-template-columns: 110px 1fr 76px; align-items: center; gap: 10px; padding: 7px 0; font-size: 12px; color: var(--muted); }
.flows .mono { text-align: right; }
.flow-track { position: relative; height: 8px; background: var(--surface-2); border-radius: 2px; }
.flow-track i { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--border-strong); }
.flow-track b { position: absolute; top: 0; bottom: 0; border-radius: 2px; min-width: 1px; }
@media (max-width: 760px) { .traders-grid { grid-template-columns: 1fr; } .traders-grid > div:first-child { border-right: 0; } }

/* Game */
#gameGalaxy { position: absolute; inset: 0; }
.tab-title { font-weight: 600; font-size: 13px; }
.game-score { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.game-score b { font-size: 16px; font-weight: 500; }
.picks { list-style: none; margin: 0; padding: 4px 16px; }
.picks li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.picks li:last-child { border-bottom: 0; }
.picks li.muted { display: block; }
.rules { margin: 0; padding: 10px 16px 12px 32px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.rules b { color: var(--text); font-weight: 500; }
.game-promo .btn { margin-right: 10px; }


@media (min-width: 1081px) {
  .view.token:not([hidden]) { display: flex; flex-direction: column; height: calc(100vh - 52px); }
  .token-body { flex: 1; min-height: 0; }
  .main-card { min-height: 0; height: 100%; }
  .tab-panel.scroll { max-height: none; overflow: auto; }
  .side { height: 100%; overflow-y: auto; padding-right: 2px; }
}

@media (max-width: 1080px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .token-body { grid-template-columns: 1fr; }
  .main-card { min-height: 60vh; }
  .tab-panel.scroll { max-height: 70vh; }
}
@media (max-width: 760px) {
  .topbar { height: auto; flex-wrap: wrap; gap: 10px 16px; padding: 10px 14px; }
  .search { order: 3; flex-basis: 100%; max-width: none; margin: 0; }
  .search kbd, .status { display: none; }
  .view { padding: 16px 14px 32px; }
  .home-hero { padding: 16px 0 24px; }
  .home-hero h1 { font-size: 24px; }
  .home-grid { grid-template-columns: 1fr; }
  .token-bar, .token-body { padding-left: 14px; padding-right: 14px; }
  .legend { display: none; }
  .table th, .table td { padding-left: 10px; padding-right: 10px; }
  .hide-sm { display: none; }
  .tab-tools .seg { display: none; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; grid-row: auto; }
  .nav { overflow-x: auto; min-width: 0; max-width: 100%; }
  .card { overflow-x: auto; }
  .dash-grid > *, .tiles > * { min-width: 0; }
  .scorebar { min-width: 80px; }
  .table td, .table th { white-space: nowrap; }
  .prose .table td, .prose .table th { white-space: normal; }
}
