/* ===== KMD Chain Analytics — dark fintech theme ===== */
:root {
  --bg: #070b14;
  --bg-soft: #0b1120;
  --card: rgba(17, 25, 44, 0.72);
  --card-border: rgba(120, 150, 200, 0.14);
  --text: #e6edf7;
  --text-dim: #8b97ad;
  --accent: #2dd4bf;
  --accent-2: #34d399;
  --accent-3: #60a5fa;
  --warn: #fbbf24;
  --danger: #f87171;
  --mono: "SF Mono", "JetBrains Mono", "Fira Code", Consolas, monospace;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(45, 212, 191, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(96, 165, 250, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--text-dim); font-weight: 400; font-size: 0.85em; }
.grad {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ===== top bar ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(7, 11, 20, 0.75);
  border-bottom: 1px solid var(--card-border);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 132px; height: auto; fill: var(--text); flex-shrink: 0; }
.brand > div { border-left: 1px solid var(--card-border); padding-left: 12px; }
.brand-title { font-weight: 700; letter-spacing: 0.2px; }
.brand-sub { font-size: 12px; color: var(--text-dim); font-family: var(--mono); }
.topnav { display: flex; gap: 4px; flex-wrap: wrap; }
.topnav a {
  color: var(--text-dim); font-size: 14px; padding: 7px 12px; border-radius: 10px;
  transition: color 0.15s, background 0.15s;
}
.topnav a:hover { color: var(--text); background: rgba(120, 150, 200, 0.10); text-decoration: none; }

/* ===== hero ===== */
.hero { padding: 56px 0 8px; }
.hero h1 { font-size: clamp(28px, 4.2vw, 44px); font-weight: 800; letter-spacing: -0.5px; }
.hero-sub { color: var(--text-dim); max-width: 640px; margin: 10px 0 28px; font-size: 16px; }

.view-toggle {
  display: inline-flex; gap: 4px; margin-bottom: 22px;
  background: rgba(17, 25, 44, 0.8);
  border: 1px solid var(--card-border);
  border-radius: 12px; padding: 4px;
}
.seg {
  background: transparent; border: none; color: var(--text-dim);
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 9px 18px; border-radius: 9px; cursor: pointer;
  transition: all 0.15s;
}
.seg:hover { color: var(--text); }
.seg.active {
  color: #06241f;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.seg-note { font-size: 11px; font-weight: 500; opacity: 0.75; margin-left: 4px; }

.kpi-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
}
/* animated-border effect (as on faucet.decker.im) */
.kpi {
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative; overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.kpi::before {
  content: ""; position: absolute;
  width: 200%; height: 200%;
  top: -50%; left: -50%;
  background: linear-gradient(90deg, var(--bg-soft) 20%, var(--accent) 45%, var(--bg-soft) 70%);
  animation: rotate-border 3s linear infinite;
}
.kpi::after {
  content: ""; position: absolute; inset: 2px;
  background: #0e1525;
  border-radius: calc(var(--radius) - 2px);
  z-index: 1;
}
.kpi > * { position: relative; z-index: 2; }
.kpi:nth-child(2n)::before { animation-delay: -1s; }
.kpi:nth-child(3n)::before { animation-delay: -2s; }
@keyframes rotate-border {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .kpi::before { animation: none; }
}
.kpi .kpi-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-dim); }
.kpi .kpi-value { font-size: 26px; font-weight: 750; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .kpi-foot { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.kpi .kpi-foot .up { color: var(--accent-2); }

/* ===== sections / cards ===== */
.section { padding: 44px 0 4px; }
.section-head { margin-bottom: 20px; max-width: 760px; }
.section-head h2 { font-size: 24px; font-weight: 750; letter-spacing: -0.3px; }
.section-head p { color: var(--text-dim); margin-top: 6px; font-size: 14.5px; }
.tag {
  display: inline-block; vertical-align: 3px; margin-left: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--accent); background: rgba(45, 212, 191, 0.10);
  border: 1px solid rgba(45, 212, 191, 0.25);
  padding: 3px 9px; border-radius: 999px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 880px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(6px);
}
.card h3 { font-size: 15px; font-weight: 650; margin-bottom: 14px; color: #c7d2e3; }
.chart-box { position: relative; height: 320px; }
.donut-box { height: 260px; }

/* ===== concentration ===== */
.conc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.conc-item {
  background: rgba(120, 150, 200, 0.06);
  border: 1px solid var(--card-border);
  border-radius: 12px; padding: 12px; text-align: center;
}
.conc-item .v { font-size: 21px; font-weight: 750; color: var(--accent); font-variant-numeric: tabular-nums; }
.conc-item .l { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.stat-rows { display: flex; flex-direction: column; gap: 0; }
.stat-row {
  display: flex; justify-content: space-between; padding: 9px 2px;
  border-top: 1px solid rgba(120, 150, 200, 0.08); font-size: 13.5px;
}
.stat-row .k { color: var(--text-dim); }
.stat-row .v { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ===== insights ===== */
.insights { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin: 4px 0 8px; }
.insight {
  display: flex; gap: 12px; align-items: flex-start;
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.07), rgba(45, 212, 191, 0.02));
  border: 1px solid rgba(45, 212, 191, 0.18);
  border-radius: 14px; padding: 14px 16px; font-size: 13.5px; color: #c9d6e8;
}
.insight .ico { font-size: 18px; line-height: 1.2; }
.insight strong { color: var(--text); }

/* ===== tables ===== */
.table-card { padding: 0; overflow: hidden; }
.table-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--card-border);
}
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  background: transparent; border: 1px solid var(--card-border); color: var(--text-dim);
  font: inherit; font-size: 13.5px; padding: 8px 14px; border-radius: 10px; cursor: pointer;
  transition: all 0.15s;
}
.tab:hover { color: var(--text); border-color: rgba(45, 212, 191, 0.4); }
.tab.active {
  color: #06241f; font-weight: 650;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-color: transparent;
}
#tableSearch {
  background: rgba(120, 150, 200, 0.07); border: 1px solid var(--card-border);
  color: var(--text); font: inherit; font-size: 13.5px;
  padding: 8px 14px; border-radius: 10px; width: 250px; outline: none;
}
#tableSearch:focus { border-color: rgba(45, 212, 191, 0.5); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: right; padding: 10px 12px; white-space: nowrap;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-dim); background: rgba(120, 150, 200, 0.05);
  position: sticky; top: 0;
}
thead th:nth-child(1), thead th:nth-child(2), thead th:nth-child(4), thead th:nth-child(5) { text-align: left; }
tbody td { padding: 9px 12px; border-top: 1px solid rgba(120, 150, 200, 0.07); white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
tbody td:nth-child(1), tbody td:nth-child(2), tbody td:nth-child(4), tbody td:nth-child(5) { text-align: left; }
tbody tr:hover { background: rgba(45, 212, 191, 0.045); }
.addr { font-family: var(--mono); font-size: 12.5px; }
.rank { color: var(--text-dim); font-size: 12px; }
.medal { font-size: 14px; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  border: 1px solid transparent;
}
.badge.bucket { color: var(--accent-3); background: rgba(96, 165, 250, 0.10); border-color: rgba(96, 165, 250, 0.25); }
.badge.notary { color: var(--warn); background: rgba(251, 191, 36, 0.10); border-color: rgba(251, 191, 36, 0.3); }
.badge.technical { color: var(--danger); background: rgba(248, 113, 113, 0.10); border-color: rgba(248, 113, 113, 0.3); }
.badge.exchange { color: #c084fc; background: rgba(192, 132, 252, 0.10); border-color: rgba(192, 132, 252, 0.3); }
.badge.unknown { color: var(--text-dim); background: rgba(120, 150, 200, 0.08); border-color: var(--card-border); }

.bar-cell { position: relative; }
.bar-bg {
  position: absolute; right: 12px; bottom: 4px;
  height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(45, 212, 191, 0.15), rgba(45, 212, 191, 0.55));
}

.table-footer { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-top: 1px solid var(--card-border); }
.btn {
  background: rgba(45, 212, 191, 0.12); color: var(--accent);
  border: 1px solid rgba(45, 212, 191, 0.3); border-radius: 10px;
  font: inherit; font-size: 13.5px; font-weight: 600; padding: 8px 18px; cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: rgba(45, 212, 191, 0.2); }
.btn:disabled { opacity: 0.35; cursor: default; }

/* ===== dataset ===== */
.dataset-head {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
  padding-bottom: 16px; margin-bottom: 16px;
  border-bottom: 1px solid var(--card-border);
}
.dataset-name { font-family: var(--mono); font-weight: 700; font-size: 16px; }
.btn-download {
  display: inline-block; text-decoration: none;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #06241f; border: none; font-size: 14px; padding: 10px 20px;
}
.btn-download:hover { text-decoration: none; filter: brightness(1.1); background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.dataset-body h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--accent); margin: 18px 0 10px; }
.dataset-body ul { margin-left: 18px; color: var(--text-dim); font-size: 13.5px; display: flex; flex-direction: column; gap: 6px; }
.dataset-body strong { color: var(--text); }
.dataset-body code {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  background: rgba(45, 212, 191, 0.08); border: 1px solid rgba(45, 212, 191, 0.15);
  padding: 1px 6px; border-radius: 6px;
}
.dict-table td, .dict-table th { text-align: left !important; white-space: normal; }
.dict-table td:first-child { white-space: nowrap; }

/* ===== methodology / footer ===== */
.methodology h3 { margin-bottom: 10px; }
.methodology ul { margin-left: 18px; color: var(--text-dim); font-size: 13.5px; display: flex; flex-direction: column; gap: 6px; }
.methodology strong { color: var(--text); }

.footer { border-top: 1px solid var(--card-border); margin-top: 56px; }
.footer-inner {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px;
  padding: 24px; font-size: 13px; color: var(--text-dim);
}
.footer-col { display: flex; flex-direction: column; gap: 6px; }
.footer-title { font-weight: 700; color: var(--text); }
.footer-author { align-items: flex-end; }
.footer-links { display: flex; gap: 8px; flex-wrap: wrap; }
.flink {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(120, 150, 200, 0.06);
  color: var(--text-dim); font-size: 12.5px; font-weight: 600;
  transition: all 0.15s;
}
.flink svg { width: 14px; height: 14px; }
.flink:hover { color: var(--text); border-color: rgba(45, 212, 191, 0.4); text-decoration: none; transform: translateY(-1px); }
.flink-sponsor { color: #ec6cb9; border-color: rgba(236, 108, 185, 0.3); background: rgba(236, 108, 185, 0.08); }
.flink-sponsor:hover { color: #f48fc9; border-color: rgba(236, 108, 185, 0.55); }
@media (max-width: 720px) {
  .footer-author { align-items: flex-start; }
}

@media (max-width: 720px) {
  .topnav { display: none; }
  .hero { padding-top: 36px; }
  .chart-box { height: 260px; }
  #tableSearch { width: 100%; }
}
