:root {
  --eco-ink: #172033;
  --eco-muted: #667085;
  --eco-line: #dfe4ea;
  --eco-paper: #f7f8f5;
  --eco-card: #ffffff;
  --eco-green: #087a55;
  --eco-green-soft: #e8f5ef;
  --eco-amber: #a45b08;
  --eco-amber-soft: #fff4dc;
  --eco-slate: #526071;
  --eco-slate-soft: #eef1f4;
  --eco-blue: #2457c5;
  --eco-blue-soft: #edf3ff;
}

* { box-sizing: border-box; }
body.ecosystem-body {
  margin: 0;
  color: var(--eco-ink);
  background:
    linear-gradient(90deg, rgba(23,32,51,.025) 1px, transparent 1px),
    linear-gradient(rgba(23,32,51,.025) 1px, transparent 1px),
    var(--eco-paper);
  background-size: 28px 28px;
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.ecosystem-shell { width: min(1460px, calc(100% - 48px)); margin: 0 auto; padding-bottom: 56px; }
.ecosystem-topbar { min-height: 72px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-bottom: 1px solid var(--eco-line); }
.ecosystem-topbar .brand { justify-self: start; }
.ecosystem-connection { justify-self: end; display: flex; align-items: center; gap: 8px; color: var(--eco-muted); font: 600 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; text-transform: uppercase; }
.ecosystem-connection i { width: 7px; height: 7px; border-radius: 50%; background: #98a2b3; box-shadow: 0 0 0 4px rgba(152,162,179,.12); }
.ecosystem-connection.live i { background: var(--eco-green); box-shadow: 0 0 0 4px rgba(8,122,85,.12); }
.ecosystem-connection.error i { background: #c33a2c; }

.ecosystem-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 48px; align-items: end; padding: 72px 0 38px; }
.ecosystem-title-block h1 { margin: 8px 0 12px; font-family: Iowan Old Style, Baskerville, "Songti SC", serif; font-size: clamp(52px, 7vw, 96px); font-weight: 600; line-height: .95; letter-spacing: -.055em; }
.ecosystem-title-block p { max-width: 760px; margin: 0; color: var(--eco-muted); font-size: 15px; line-height: 1.8; }
.ecosystem-asof { min-width: 230px; padding: 18px 20px; border: 1px solid var(--eco-line); background: rgba(255,255,255,.72); }
.ecosystem-asof span, .ecosystem-asof small { display: block; color: var(--eco-muted); font-size: 11px; }
.ecosystem-asof strong { display: block; margin: 7px 0 4px; font: 700 20px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; }

.ecosystem-spine { display: grid; grid-template-columns: 1fr 80px 1fr 80px 1fr; align-items: center; padding: 24px; border: 1px solid #cfd8e5; background: #172033; color: #fff; box-shadow: 0 20px 60px rgba(23,32,51,.12); }
.ecosystem-spine > i { height: 1px; background: linear-gradient(90deg, #8796ad, #dce5f3); position: relative; }
.ecosystem-spine > i::after { content: ""; position: absolute; right: -1px; top: -3px; width: 7px; height: 7px; border-top: 1px solid #dce5f3; border-right: 1px solid #dce5f3; transform: rotate(45deg); }
.spine-node { min-width: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
.spine-node span { grid-row: 1 / 3; display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.28); border-radius: 50%; color: #b8c5d8; font: 600 10px/1 ui-monospace, monospace; }
.spine-node b { font-size: 15px; letter-spacing: .01em; }
.spine-node small { margin-top: 3px; color: #aebbd0; font-size: 11px; }
.spine-node.arc span { border-color: #7ca5ff; background: #2457c5; color: #fff; }

.ecosystem-overview { display: grid; grid-template-columns: repeat(4, 1fr); margin: 18px 0 20px; border: 1px solid var(--eco-line); background: var(--eco-card); }
.ecosystem-overview > div { min-height: 94px; padding: 17px 20px; border-right: 1px solid var(--eco-line); }
.ecosystem-overview > div:last-child { border-right: 0; }
.ecosystem-overview span, .ecosystem-overview small { display: block; color: var(--eco-muted); font-size: 10px; }
.ecosystem-overview span { font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ecosystem-overview strong { display: block; margin: 5px 0 2px; font-family: Iowan Old Style, Baskerville, serif; font-size: 30px; line-height: 1; }
.ecosystem-overview .issued strong { color: var(--eco-green); }
.ecosystem-overview .unissued strong { color: var(--eco-slate); }
.ecosystem-overview .candidate strong { color: var(--eco-amber); }

.ecosystem-tools { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: center; padding: 12px 0; background: rgba(247,248,245,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--eco-line); }
.status-filters { display: flex; gap: 7px; flex-wrap: wrap; }
.status-filters button { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 12px; border: 1px solid var(--eco-line); border-radius: 4px; background: #fff; color: var(--eco-muted); font: 650 11px/1 "Avenir Next", sans-serif; cursor: pointer; }
.status-filters button:hover, .status-filters button.active { border-color: var(--eco-ink); color: var(--eco-ink); box-shadow: inset 0 -2px 0 var(--eco-ink); }
.status-filters button i { width: 7px; height: 7px; border-radius: 50%; background: var(--eco-slate); }
.status-filters button[data-status="issued"] i { background: var(--eco-green); }
.status-filters button[data-status="candidate"] i { background: var(--eco-amber); }
.status-filters button[data-status="na"] i { background: var(--eco-blue); }
.ecosystem-search { height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--eco-line); background: #fff; }
.ecosystem-search span { color: var(--eco-muted); font-size: 17px; }
.ecosystem-search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--eco-ink); font: 500 12px/1 "Avenir Next", "PingFang SC", sans-serif; }

.ecosystem-map { position: relative; padding: 18px 0 0 32px; }
.ecosystem-map::before { content: ""; position: absolute; left: 13px; top: 18px; bottom: 36px; width: 1px; background: #bdc7d4; }
.map-category { position: relative; display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; padding: 26px 0 32px; border-bottom: 1px solid var(--eco-line); }
.map-category::before { content: ""; position: absolute; left: -24px; top: 36px; width: 18px; height: 1px; background: #bdc7d4; }
.category-heading { position: sticky; top: 68px; align-self: start; }
.category-index { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 20px; margin-bottom: 12px; background: var(--eco-ink); color: #fff; font: 700 9px/1 ui-monospace, monospace; letter-spacing: .08em; }
.category-heading h2 { margin: 0 0 7px; font-family: Iowan Old Style, Baskerville, "Songti SC", serif; font-size: 25px; line-height: 1.15; }
.category-heading p { margin: 0; color: var(--eco-muted); font-size: 11px; line-height: 1.65; }
.category-count { display: block; margin-top: 12px; color: var(--eco-muted); font: 600 10px/1 ui-monospace, monospace; }
.category-nodes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.ecosystem-node { min-width: 0; min-height: 174px; display: flex; flex-direction: column; padding: 15px; border: 1px solid var(--eco-line); background: rgba(255,255,255,.9); transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.ecosystem-node:hover { transform: translateY(-2px); border-color: #aeb9c7; box-shadow: 0 12px 30px rgba(23,32,51,.08); }
.node-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.node-title { min-width: 0; }
.node-title h3 { margin: 0; font-size: 14px; line-height: 1.25; }
.node-title a { color: inherit; text-decoration: none; }
.node-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.node-title span { display: block; margin-top: 4px; overflow: hidden; color: var(--eco-muted); font: 500 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }
.token-badge { flex: 0 0 auto; padding: 5px 7px; border-radius: 3px; font: 750 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .03em; }
.token-badge.issued { background: var(--eco-green-soft); color: var(--eco-green); }
.token-badge.unissued { background: var(--eco-slate-soft); color: var(--eco-slate); }
.token-badge.candidate { background: var(--eco-amber-soft); color: var(--eco-amber); }
.token-badge.na { background: var(--eco-blue-soft); color: var(--eco-blue); }
.node-role { margin: 13px 0 8px; color: var(--eco-ink); font-size: 11px; font-weight: 650; }
.node-note { margin: 0; color: var(--eco-muted); font-size: 10px; line-height: 1.55; }
.node-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 13px; }
.token-identity { min-width: 0; }
.token-identity b { display: block; color: var(--eco-ink); font: 700 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; }
.token-identity code { display: block; max-width: 148px; margin-top: 4px; overflow: hidden; color: var(--eco-muted); font: 500 9px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }
.token-scope { flex: 0 0 auto; color: var(--eco-muted); font: 600 8px/1.2 ui-monospace, monospace; text-align: right; text-transform: uppercase; }
.node-market { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--eco-line); }
.node-market span { min-width: 0; color: var(--eco-muted); font-size: 8px; }
.node-market b { display: block; margin-top: 3px; overflow: hidden; color: var(--eco-ink); font: 650 10px/1 ui-monospace, monospace; text-overflow: ellipsis; }
.ecosystem-loading { padding: 80px 0; color: var(--eco-muted); font: 600 12px/1 ui-monospace, monospace; text-align: center; }
.ecosystem-empty { margin: 28px 0; padding: 44px; border: 1px dashed #b8c1cd; background: rgba(255,255,255,.6); text-align: center; }
.ecosystem-empty b, .ecosystem-empty span { display: block; }
.ecosystem-empty span { margin-top: 7px; color: var(--eco-muted); font-size: 12px; }
.ecosystem-footer { display: flex; justify-content: space-between; gap: 32px; padding: 26px 0; color: var(--eco-muted); font-size: 11px; line-height: 1.7; }
.ecosystem-footer p { max-width: 780px; margin: 0; }
.ecosystem-footer a { flex: 0 0 auto; color: var(--eco-blue); font-weight: 650; text-decoration: none; }

@media (max-width: 1120px) {
  .category-nodes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ecosystem-topbar { grid-template-columns: 1fr auto; }
  .ecosystem-topbar .desk-nav { order: 3; grid-column: 1 / -1; justify-self: start; padding-bottom: 12px; }
}

@media (max-width: 760px) {
  .ecosystem-shell { width: min(100% - 28px, 680px); padding-bottom: 28px; }
  .ecosystem-topbar { min-height: 62px; }
  .ecosystem-connection { display: none; }
  .ecosystem-topbar .desk-nav { width: 100%; overflow-x: auto; }
  .ecosystem-hero { grid-template-columns: 1fr; gap: 22px; padding: 44px 0 26px; }
  .ecosystem-title-block h1 { font-size: 56px; }
  .ecosystem-asof { min-width: 0; }
  .ecosystem-spine { grid-template-columns: 1fr; gap: 0; padding: 18px; }
  .ecosystem-spine > i { width: 1px; height: 22px; margin-left: 18px; background: linear-gradient(#8796ad, #dce5f3); }
  .ecosystem-spine > i::after { right: -3px; top: auto; bottom: -1px; transform: rotate(135deg); }
  .ecosystem-overview { grid-template-columns: repeat(2, 1fr); }
  .ecosystem-overview > div:nth-child(2) { border-right: 0; }
  .ecosystem-overview > div:nth-child(-n+2) { border-bottom: 1px solid var(--eco-line); }
  .ecosystem-tools { grid-template-columns: 1fr; gap: 10px; }
  .status-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 3px; }
  .status-filters button { flex: 0 0 auto; }
  .ecosystem-map { padding-left: 19px; }
  .ecosystem-map::before { left: 5px; }
  .map-category { grid-template-columns: 1fr; gap: 16px; }
  .map-category::before { left: -14px; width: 12px; }
  .category-heading { position: static; }
  .category-nodes { grid-template-columns: 1fr; }
  .ecosystem-node { min-height: 158px; }
  .ecosystem-footer { flex-direction: column; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .ecosystem-node { transition: none; }
}
