:root {
  color-scheme: dark;
  --bg: #050806;
  --panel: #09110c;
  --panel-hi: #0d1811;
  --line: #1b2a20;
  --line-hi: #304536;
  --text: #f3f7ef;
  --muted: #91a095;
  --faint: #5e6d63;
  --lime: #d7ff63;
  --lime-dim: rgba(215, 255, 99, .1);
  --orange: #ffb86b;
  --red: #ff7777;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --gutter: clamp(18px, 4vw, 56px);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 62% -120px, rgba(215, 255, 99, .08), transparent 70%),
    linear-gradient(rgba(255,255,255,.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.012) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 52px 52px, 52px 52px, auto;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }

.topbar, main, footer { width: min(1480px, 100%); margin-inline: auto; padding-inline: var(--gutter); }
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 22px;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 800; letter-spacing: .12em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; color: #071007; background: var(--lime); border-radius: 9px; letter-spacing: -.08em; }
.network { margin-left: auto; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font: 10px var(--mono); letter-spacing: .05em; }
.network i { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 12px var(--lime); }
.sync-state { min-width: 150px; color: var(--faint); font: 10px var(--mono); text-align: right; }
.sync-state.live { color: var(--muted); }
.sync-state.live::before { content: "●"; color: var(--lime); margin-right: 6px; }
.sync-state.stale::before { content: "●"; color: var(--orange); margin-right: 6px; }

.hero { padding: clamp(54px, 9vw, 116px) 0 36px; }
.eyebrow { margin: 0 0 14px; color: var(--lime); font: 700 10px var(--mono); letter-spacing: .2em; }
.hero h1 { max-width: 940px; margin: 0; font-size: clamp(48px, 8vw, 100px); line-height: .95; letter-spacing: -.065em; }
.hero h1 em { color: var(--lime); font-style: normal; }
.hero-copy { max-width: 660px; margin: 26px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; overflow: hidden; margin: 24px 0 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--line); }
.metrics article { min-height: 126px; padding: 20px; background: rgba(9,17,12,.96); }
.metrics article > span { display: block; color: var(--muted); font-size: 12px; }
.metrics strong { display: block; margin-top: 12px; font: 700 clamp(27px, 4vw, 40px) var(--mono); letter-spacing: -.05em; }
.metrics small { display: block; margin-top: 5px; color: var(--faint); font: 9px var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.metrics .metric-accent { background: var(--lime); color: #0a1108; }
.metrics .metric-accent span, .metrics .metric-accent small { color: rgba(10,17,8,.65); }

.filters { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto auto auto; align-items: end; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(9,17,12,.72); backdrop-filter: blur(16px); position: sticky; top: 8px; z-index: 20; }
.filters label, .sort-box { display: flex; flex-direction: column; gap: 7px; }
.filters label > span, .sort-box > span { color: var(--faint); font: 9px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
input, select, .segments, .refresh { min-height: 39px; border: 1px solid var(--line); border-radius: 9px; background: #070c09; }
input, select { width: 100%; padding: 8px 11px; color: var(--text); outline: none; }
input:focus, select:focus { border-color: var(--lime); box-shadow: 0 0 0 3px var(--lime-dim); }
input::placeholder { color: var(--faint); }
select { min-width: 142px; cursor: pointer; }
.segments { display: flex; padding: 3px; }
.segments button { min-width: 58px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; }
.segments button.on { background: var(--lime); color: #0a1108; font-weight: 700; }
.refresh { padding: 0 16px; color: var(--lime); cursor: pointer; }
.refresh:hover { border-color: var(--lime); background: var(--lime-dim); }
.refresh:disabled { opacity: .45; cursor: wait; }

.board-section, .detail { padding: 54px 0 76px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-head h2, .detail h2 { margin: 0; font-size: clamp(28px, 4vw, 44px); letter-spacing: -.04em; }
.section-head > p { max-width: 300px; margin: 0 0 5px; color: var(--faint); font-size: 11px; text-align: right; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.board.loading::before, .board.loading::after { content: ""; height: 268px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(100deg, var(--panel) 35%, var(--panel-hi) 50%, var(--panel) 65%); background-size: 250% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.stock-card { position: relative; overflow: hidden; min-height: 268px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(155deg, var(--panel-hi), var(--panel) 56%); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.stock-card::after { content: attr(data-stock); position: absolute; top: -20px; right: -9px; color: rgba(243,247,239,.035); font-size: 92px; font-weight: 900; letter-spacing: -.08em; pointer-events: none; }
.stock-card:hover { transform: translateY(-3px); border-color: var(--line-hi); box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.card-open { position: absolute; inset: 0; z-index: 1; width: 100%; border: 0; background: transparent; cursor: pointer; }
.stock-card > *:not(.card-open) { position: relative; z-index: 2; pointer-events: none; }
.stock-card a, .stock-card .copy { pointer-events: auto; }
.stock-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stock-card header > div { min-width: 0; }
.stock-symbol { display: block; font-size: 17px; }
.stock-name { display: block; overflow: hidden; margin-top: 3px; color: var(--faint); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.pair-count, .live-badge { flex: 0 0 auto; color: var(--lime); border: 1px solid rgba(215,255,99,.3); border-radius: 999px; padding: 4px 7px; background: var(--lime-dim); font: 8px var(--mono); letter-spacing: .08em; }
.leader { margin-top: 22px; }
.leader-line { display: flex; align-items: center; gap: 8px; }
.token-symbol { overflow: hidden; font-size: 21px; text-overflow: ellipsis; white-space: nowrap; }
.leader-volume { margin: 8px 0; font: 700 26px var(--mono); letter-spacing: -.05em; }
.volume-bar { height: 3px; overflow: hidden; border-radius: 3px; background: rgba(255,255,255,.05); }
.volume-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--lime), #8dff76); }
.leader-meta { display: flex; gap: 11px; margin-top: 9px; color: var(--muted); font: 9px var(--mono); }
.runners { margin: 16px 0 0; padding: 11px 0 0; border-top: 1px solid var(--line); list-style: none; }
.runners li { display: flex; align-items: center; gap: 7px; min-height: 24px; color: var(--muted); font: 10px var(--mono); }
.runners b { overflow: hidden; max-width: 45%; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.runners i { flex: 1; border-bottom: 1px dotted var(--line-hi); transform: translateY(-2px); }
.runners span { white-space: nowrap; }
.show-more { display: block; margin: 24px auto 0; padding: 10px 22px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; background: var(--panel); cursor: pointer; }
.show-more:hover { color: var(--lime); border-color: var(--line-hi); }

.back { margin-bottom: 28px; padding: 0; color: var(--muted); border: 0; background: none; cursor: pointer; font: 11px var(--mono); }
.back:hover { color: var(--lime); }
.detail-title { display: flex; align-items: end; gap: 20px; margin-bottom: 28px; }
.detail-title > p { margin: 0 0 6px; color: var(--muted); }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line-hi); }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th { padding: 12px 10px; color: var(--faint); font: 9px var(--mono); text-align: left; text-transform: uppercase; letter-spacing: .08em; }
td { padding: 14px 10px; border-top: 1px solid var(--line); font: 11px var(--mono); }
td:nth-child(3) { color: var(--lime); font-weight: 700; }
.token-cell strong { display: block; max-width: 240px; overflow: hidden; color: var(--text); font: 700 13px var(--sans); text-overflow: ellipsis; }
.token-cell button { margin-top: 4px; padding: 0; color: var(--faint); border: 0; background: none; cursor: pointer; font: 9px var(--mono); }
.token-cell button:hover { color: var(--lime); }
.trade-links { display: flex; gap: 7px; }
.trade-links a { color: var(--muted); text-decoration: none; border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; font-size: 9px; }
.trade-links a:hover { color: var(--lime); border-color: var(--line-hi); }

.empty, .error { margin: 30px 0 80px; padding: 40px; border: 1px dashed var(--line-hi); border-radius: 16px; text-align: center; }
.empty strong, .error strong { display: block; }
.empty span, .error span { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.error { border-color: rgba(255,119,119,.35); }
.error button { margin-top: 16px; padding: 8px 16px; color: var(--text); border: 1px solid var(--line-hi); border-radius: 8px; background: var(--panel); cursor: pointer; }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-block: 22px 32px; border-top: 1px solid var(--line); color: var(--faint); font: 9px var(--mono); }

@media (max-width: 1180px) {
  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters { grid-template-columns: minmax(220px, 1fr) auto auto; }
  .sort-box, .refresh { grid-row: 2; }
}
@media (max-width: 820px) {
  .topbar { height: auto; flex-wrap: wrap; padding-block: 16px; gap: 10px; }
  .network { margin-left: auto; }
  .sync-state { width: 100%; text-align: left; }
  .hero { padding-top: 62px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { position: static; grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .section-head > p { text-align: left; }
}
@media (max-width: 560px) {
  :root { --gutter: 15px; }
  .brand { font-size: 12px; }
  .network { padding: 5px 8px; font-size: 8px; }
  .hero h1 { font-size: clamp(43px, 15vw, 68px); }
  .metrics article { min-height: 106px; padding: 16px; }
  .filters { display: flex; flex-direction: column; align-items: stretch; }
  .sort-box, .refresh { width: 100%; }
  .segments button { flex: 1; }
  .board { grid-template-columns: 1fr; }
  .stock-card { min-height: 250px; }
  .detail-title { align-items: flex-start; flex-direction: column; gap: 6px; }
  footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .board.loading::before, .board.loading::after { animation: none; }
  .stock-card { transition: none; }
}
