:root {
  color-scheme: dark;
  --bg: #02060b;
  --surface: #0b1724;
  --surface-strong: #10243a;
  --border: rgba(69, 157, 231, .24);
  --text: #f2f7ff;
  --muted: #91a1b7;
  --blue: #58bcff;
  --cyan: #61ebdc;
  --purple: #8d6cff;
  --green: #44e2a2;
  --gold: #e7c75d;
  --danger: #ff7185;
  --shadow: 0 18px 55px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 92% 15%, var(--theme-glow, rgba(46, 155, 255, .14)), transparent 31rem),
    radial-gradient(circle at 15% 88%, var(--theme-glow-soft, rgba(31, 107, 189, .08)), transparent 34rem),
    linear-gradient(135deg, #000 0%, var(--bg) 52%, #000 100%);
}
button, input { font: inherit; }
button { color: inherit; }

.topbar {
  min-height: 64px;
  padding: 24px max(22px, calc((100vw - 1500px) / 2)) 0;
  display: flex;
  align-items: center;
  gap: 26px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 91%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}
.merge-tagline {
  position: absolute;
  top: 5px;
  right: max(22px, calc((100vw - 1500px) / 2));
  color: var(--muted);
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 12px;
  font-style: italic;
  font-weight: 600;
  letter-spacing: .08em;
  text-shadow: 0 0 14px var(--theme-glow);
  white-space: nowrap;
}
.merge-tagline span {
  color: var(--blue);
  font-weight: 700;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 245px; color: var(--text); text-decoration: none; font-size: 18px; white-space: nowrap; }
.brand-logo { width: 42px; height: 42px; display: block; object-fit: contain; border-radius: 50%; filter: drop-shadow(0 0 8px var(--blue)); }
.chain-tabs { display: flex; gap: 5px; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: rgba(255, 255, 255, .025); }
.chain-tab, .nav-link, .text-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}
.chain-tab { padding: 6px 12px; display: flex; align-items: center; gap: 6px; color: var(--muted); border-radius: 7px; font-size: 12px; font-weight: 700; }
.chain-tab img { width: 18px; height: 18px; object-fit: contain; border-radius: 50%; }
.chain-tab.active { color: #07111f; background: linear-gradient(135deg, var(--cyan), var(--blue)); box-shadow: 0 0 16px rgba(88, 188, 255, .25); }
.primary-nav { align-self: stretch; display: flex; align-items: stretch; margin-left: auto; }
.nav-link { padding: 0 15px; color: var(--muted); position: relative; }
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-link.active::after { content: ""; position: absolute; height: 2px; left: 14px; right: 14px; bottom: 0; background: var(--blue); box-shadow: 0 0 11px var(--blue); }
.search { width: min(360px, 27vw); display: flex; border: 1px solid var(--border); border-radius: 9px; background: rgba(255, 255, 255, .035); }
.search:focus-within { border-color: rgba(88, 188, 255, .65); box-shadow: 0 0 0 3px rgba(88, 188, 255, .08); }
.search input { width: 100%; min-width: 0; padding: 9px 12px; border: 0; outline: 0; color: var(--text); background: transparent; }
.search input::placeholder { color: #74859c; }
.search button { width: 42px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 24px; }

main { max-width: 1500px; margin: auto; padding: 22px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.page-heading h1 { margin: 0; font-size: 20px; }
.eyebrow { margin: 0 0 2px; color: var(--cyan); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.chain-links { display: flex; gap: 8px; margin-top: 8px; }
.chain-links a {
  padding: 4px 9px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 10%, transparent);
  text-decoration: none;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .02em;
  transition: border-color .15s, color .15s, transform .15s;
}
.chain-links a:hover { color: var(--blue); border-color: var(--blue); transform: translateY(-1px); }
.updated { color: var(--muted); font-size: 12px; }
.live-dot { width: 7px; height: 7px; margin-right: 7px; display: inline-block; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.live-dot.offline { background: var(--danger); box-shadow: none; }

.overview-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 15px; margin-bottom: 18px; }
.metric-card, .panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--surface-strong) 92%, transparent), color-mix(in srgb, var(--surface) 88%, transparent));
  box-shadow: var(--shadow);
}
.metric-card { min-height: 106px; padding: 14px 15px; }
.metric-card::after { content: ""; position: absolute; width: 100px; height: 100px; right: -35px; bottom: -60px; border-radius: 50%; background: var(--theme-glow); filter: blur(18px); }
.metric-card.glow { background: linear-gradient(145deg, var(--surface-strong), var(--surface)); }
.metric-label { display: block; margin-bottom: 4px; color: #d8e2f0; font-size: 12px; }
.metric-value { display: block; font-size: 22px; line-height: 1.2; letter-spacing: -.02em; }
.status-content { display: flex; align-items: center; gap: 12px; }
.status-content strong { color: var(--green); font-size: 12px; text-transform: uppercase; }
.status-content small { display: block; margin-top: 3px; color: var(--text); }
.status-orbit { width: 51px; height: 51px; display: grid; place-items: center; border: 2px solid var(--green); border-radius: 50%; box-shadow: 0 0 13px rgba(68, 226, 162, .75), inset 0 0 12px rgba(68, 226, 162, .24); }
.status-orbit span { width: 22px; height: 22px; border-radius: 50%; background: var(--green); box-shadow: 0 0 18px var(--green); }
.sparkline { position: absolute; right: 8px; bottom: 8px; width: 42%; height: 48px; overflow: visible; }
.sparkline path { fill: none; stroke: var(--blue); stroke-width: 2; }
.sparkline.teal path { stroke: var(--cyan); }
.sparkline.blue path { stroke: #7db6ff; }
.mini-bars { height: 45px; position: absolute; right: 17px; bottom: 13px; display: flex; align-items: end; gap: 5px; }
.mini-bars i { width: 6px; height: 20%; background: linear-gradient(var(--cyan), var(--purple)); box-shadow: 0 0 7px rgba(88, 188, 255, .35); }
.mini-bars i:nth-child(2) { height: 50%; }.mini-bars i:nth-child(3) { height: 88%; }.mini-bars i:nth-child(4) { height: 38%; }.mini-bars i:nth-child(5) { height: 65%; }.mini-bars i:nth-child(6) { height: 78%; }

.dashboard-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(500px, 1.8fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.panel-title { min-height: 48px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.panel-title h2, .distribution-heading h2 { margin: 0; font-size: 14px; font-weight: 650; }
.pill, .select-look { padding: 4px 9px; border: 1px solid var(--border); border-radius: 7px; color: var(--muted); background: rgba(255, 255, 255, .035); font-size: 10px; }
.block-stream { max-height: 520px; padding: 0 12px 12px; overflow: auto; scrollbar-color: #60728d transparent; }
.block-row { margin-bottom: 8px; padding: 11px 10px; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 9px; align-items: center; border: 1px solid var(--border); border-radius: 9px; background: rgba(255, 255, 255, .025); cursor: pointer; }
.block-row:hover { border-color: rgba(88, 188, 255, .45); transform: translateY(-1px); }
.block-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: var(--blue); background: rgba(88, 188, 255, .12); font-weight: 800; }
.block-main strong, .block-main small { display: block; }
.block-main small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.block-size { color: var(--muted); font-size: 10px; text-align: right; }
.block-size i { display: block; width: 46px; height: 3px; margin-top: 7px; border-radius: 2px; background: linear-gradient(90deg, var(--blue), var(--purple)); }
.chart-shell { height: 300px; padding: 8px 14px 0; }
.distribution-heading { padding: 5px 14px 10px; display: flex; justify-content: space-between; align-items: center; }
.distribution-heading span { color: var(--muted); font-size: 10px; }
.donut-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 5px 18px 18px; text-align: center; }
.donut-grid p { margin: 8px 0 0; color: #dce7f5; font-size: 11px; }
.donut { width: 92px; height: 92px; margin: auto; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--blue) 0 64%, var(--purple) 64% 91%, #26364c 91%); position: relative; }
.donut::after { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: var(--surface-strong); }
.donut span { z-index: 1; font-size: 11px; font-weight: 700; }
.donut.alternate { background: conic-gradient(var(--blue) 0 52%, var(--cyan) 52% 72%, var(--purple) 72% 92%, var(--gold) 92%); }
.donut.gold { background: conic-gradient(var(--blue) 0 72%, var(--cyan) 72% 89%, var(--gold) 89%); }
.right-column { display: grid; gap: 16px; }
.transaction-head, .transaction-row { display: grid; grid-template-columns: minmax(0, 1fr) 56px 80px; gap: 6px; align-items: center; }
.transaction-head { padding: 0 12px 5px; color: var(--muted); font-size: 10px; }
.transaction-row { padding: 8px 12px; cursor: pointer; }
.transaction-row:hover { background: rgba(255, 255, 255, .035); }
.transaction-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.transaction-row span:last-child { text-align: right; color: #f2f7ff; }
.network-facts { padding: 2px 14px 14px; }
.fact-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 0; }
.fact-row b { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; color: var(--cyan); background: rgba(97, 235, 220, .1); font-size: 10px; }
.fact-row div { min-width: 0; }
.fact-row strong, .fact-row small { display: block; }
.fact-row strong { overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.fact-row small { color: var(--muted); font-size: 9px; }
.fact-row em { color: var(--green); font-size: 11px; font-style: normal; }
.text-button { padding: 0; color: var(--blue); font-size: 10px; }
.loading-box { color: var(--muted); }

.detail-view { min-height: 510px; }
.detail-content { padding: 0 14px 18px; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 10px; color: var(--muted); text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: 12px; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.hash { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: Consolas, monospace; color: #b9caff; }
.muted { color: var(--muted); font-size: 11px; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 10px 0; }
.info-box { min-height: 95px; padding: 15px; border: 1px solid var(--border); border-radius: 9px; background: rgba(255, 255, 255, .025); }
.info-box strong, .info-box small { display: block; }
.info-box strong { margin-top: 6px; font-size: 18px; }
.info-box small { color: var(--muted); }
.wallet-note { max-width: 760px; padding: 16px; border-left: 3px solid var(--blue); background: rgba(88, 188, 255, .06); color: #c7d5e6; }
.index-state { margin: 14px 0; padding: 14px; display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: 9px; background: rgba(255, 255, 255, .025); }
.index-state strong, .index-state span { display: block; }
.index-state span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.index-indicator { width: 10px; height: 10px; flex: 0 0 auto; margin-top: 5px; border-radius: 50%; background: var(--danger); }
.index-indicator.connected { background: var(--green); box-shadow: 0 0 8px var(--green); }
.empty-state { max-width: 760px; margin: 45px auto; padding: 26px; text-align: center; border: 1px solid var(--border); border-radius: 12px; background: rgba(255, 255, 255, .025); }
.empty-state h3 { margin: 0 0 8px; }
.empty-state p { margin: 0; color: var(--muted); }
.error-banner { margin-top: 15px; padding: 12px 14px; border: 1px solid rgba(255, 113, 133, .35); border-radius: 8px; color: #ffc0c8; background: rgba(255, 113, 133, .08); }
footer { padding: 28px 0 5px; color: #64758c; text-align: center; font-size: 10px; letter-spacing: .04em; }
footer a { color: var(--blue); text-decoration: none; }
footer a:hover { text-decoration: underline; }
.footer-separator { padding: 0 7px; color: var(--border); }

dialog { width: min(760px, calc(100vw - 32px)); max-height: 80vh; padding: 0; color: var(--text); border: 1px solid var(--border); border-radius: 12px; background: #111f33; box-shadow: 0 30px 90px #000; }
dialog::backdrop { background: rgba(2, 7, 14, .75); backdrop-filter: blur(5px); }
.dialog-head { padding: 15px 18px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.dialog-head h2 { margin: 0; font-size: 16px; }
.dialog-head button { width: 32px; height: 32px; border: 0; border-radius: 50%; color: var(--muted); background: rgba(255, 255, 255, .05); cursor: pointer; font-size: 22px; }
#resultBody { padding: 18px; overflow: auto; }
.result-grid { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 15px; }
.result-grid dt { color: var(--muted); }
.result-grid dd { margin: 0; overflow-wrap: anywhere; font-family: Consolas, monospace; }

@media (max-width: 1180px) {
  .topbar { flex-wrap: wrap; gap: 10px 20px; padding: 30px 18px 0; }
  .merge-tagline { top: 8px; right: 18px; }
  .brand { min-width: 210px; }
  .primary-nav { order: 3; width: 100%; height: 43px; justify-content: center; }
  .search { margin-left: auto; width: 330px; }
  .dashboard-grid { grid-template-columns: minmax(250px, .8fr) minmax(480px, 1.5fr); }
  .right-column { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .topbar { position: static; }
  .merge-tagline { top: 8px; right: 18px; font-size: 11px; }
  .brand { width: 100%; }
  .chain-tabs { margin-left: 0; }
  .search { width: 100%; order: 4; margin: 0 0 10px; }
  .primary-nav { justify-content: start; overflow-x: auto; }
  .nav-link { flex: 0 0 auto; padding: 0 12px; }
  .overview-cards { grid-template-columns: repeat(2, 1fr); }
  .overview-cards .metric-card:first-child { grid-column: span 2; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .right-column { grid-column: auto; grid-template-columns: 1fr; }
  .blocks-panel { order: 2; }
  .activity-panel { order: 1; }
  .right-column { order: 3; }
  .info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  main { padding: 14px 10px; }
  .overview-cards { grid-template-columns: 1fr; }
  .overview-cards .metric-card:first-child { grid-column: auto; }
  .chain-tab { padding: 6px 10px; }
  .chart-shell { height: 240px; }
  .donut { width: 72px; height: 72px; }
  .donut::after { inset: 10px; }
  footer span, footer a { display: block; }
  .footer-separator { display: none; }
}
