:root {
  color-scheme: dark;
  --bg: #101216;
  --panel: #191d24;
  --panel-2: #222832;
  --text: #eef3f6;
  --muted: #93a3ad;
  --line: #313946;
  --accent: #f2a900;
  --good: #5ad17a;
  --bad: #ff6f61;
  --accent-soft: rgba(242, 169, 0, 0.14);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(242, 169, 0, 0.18), transparent 30rem),
    linear-gradient(180deg, #151820 0%, var(--bg) 44rem);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
canvas {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.topbar,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  margin-bottom: 22px;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 3.9vw, 3.8rem);
  white-space: nowrap;
}

h2 {
  font-size: 1.45rem;
}

.panel-subtitle {
  margin: 8px 0 0;
  font-size: 0.94rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(25, 29, 36, 0.86);
  color: var(--muted);
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(242, 169, 0, 0.14);
}

.status-pill.is-live .status-dot {
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(90, 209, 122, 0.14);
}

.status-pill.is-error .status-dot {
  background: var(--bad);
  box-shadow: 0 0 0 4px rgba(255, 111, 97, 0.14);
}

.summary-grid,
.fees-strip {
  display: grid;
  gap: 12px;
}

.summary-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.fees-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric,
.fees-strip > div,
.chart-panel {
  border: 1px solid var(--line);
  background: rgba(25, 29, 36, 0.88);
  backdrop-filter: blur(16px);
}

.metric {
  min-height: 118px;
  padding: 16px;
  border-radius: 8px;
}

.metric-label,
.metric small,
.fees-strip span,
#updatedAt,
.panel-subtitle {
  color: var(--muted);
}

.metric-label,
.fees-strip span {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.35rem, 2.25vw, 2rem);
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#memoryUsage {
  font-size: clamp(1.08rem, 1.6vw, 1.42rem);
  line-height: 1.08;
  white-space: normal;
}

#secondaryMetric {
  font-size: clamp(1.08rem, 1.6vw, 1.42rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.metric small {
  display: block;
  margin-top: 7px;
  font-size: 0.84rem;
}

.metric-progress {
  margin-top: 9px;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.metric-progress__fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3cb371, #77e2a3);
  transition: width 260ms ease, background-color 220ms ease;
}

.metric-progress__fill.is-medium {
  background: linear-gradient(90deg, #f2a900, #ffd56f);
}

.metric-progress__fill.is-high {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.chart-panel {
  margin: 12px 0;
  padding: 18px;
  border-radius: 8px;
}

.refresh-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.legend-toggle {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
}

.legend-toggle:hover,
.legend-toggle:focus-visible {
  border-color: rgba(242, 169, 0, 0.62);
  color: var(--text);
}

#refreshButton {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
}

#refreshButton:hover {
  border-color: rgba(242, 169, 0, 0.62);
}

#refreshButton svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

#historyRefreshButton {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
}

#historyRefreshButton:hover {
  border-color: rgba(242, 169, 0, 0.62);
}

#historyRefreshButton svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.chart-wrap {
  position: relative;
  margin-top: 18px;
  min-height: 420px;
}

.projected-chart-wrap {
  display: flex;
  align-items: flex-start;
  border: 1px solid #2b333f;
  border-radius: 8px;
  background: #12161c;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: var(--line) #12161c;
}

#mempoolYAxis {
  position: sticky;
  left: 0;
  z-index: 2;
  flex: 0 0 66px;
  width: 66px;
  border: 0;
  border-radius: 0;
}

#mempoolChart {
  flex: 0 0 auto;
  border: 0;
  border-radius: 0;
}

canvas {
  display: block;
  width: 100%;
  height: 420px;
  border: 1px solid #2b333f;
  border-radius: 8px;
  background: #12161c;
}

.chart-tooltip {
  position: absolute;
  z-index: 3;
  display: none;
  min-width: 190px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 16, 21, 0.95);
  color: var(--text);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  pointer-events: none;
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 4px;
}

.chart-tooltip span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.chart-tooltip span.is-active {
  color: var(--text);
  font-weight: 700;
}

#historyTooltip {
  position: fixed !important;
  z-index: 2147483647;
}

#throughputTooltip {
  position: fixed !important;
  z-index: 2147483647;
  max-width: min(320px, calc(100vw - 16px));
}

#chartTooltip {
  position: fixed !important;
  z-index: 2147483647;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 14px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.84rem;
}

.legend-item:hover,
.legend-item:focus-visible,
.legend-item.is-active {
  color: var(--text);
}

.legend-item.is-muted {
  opacity: 0.36;
}

.legend-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
}

.block-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
}

.block-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.block-table caption {
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: left;
}

.block-table th,
.block-table td {
  border-top: 1px solid rgba(238, 243, 246, 0.1);
  padding: 10px 8px;
  text-align: right;
}

.block-table th:first-child,
.block-table td:first-child {
  text-align: left;
}

.block-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.block-table td {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.block-table td::before {
  display: none;
}

.fees-strip > div {
  min-height: 86px;
  padding: 16px;
  border-radius: 8px;
}

.fees-strip strong {
  display: block;
  margin-top: 8px;
  font-size: 1.7rem;
}

.throughput-panel {
  margin-top: 12px;
}

#historyUpdatedAt {
  color: var(--muted);
  font-size: 0.84rem;
}

#updatedAt {
  font-size: 0.84rem;
}

.history-windows {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.history-windows button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  padding: 6px 11px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.history-windows button.is-active,
.history-windows button:hover,
.history-windows button:focus-visible {
  border-color: rgba(242, 169, 0, 0.62);
  color: var(--text);
}

.throughput-wrap {
  margin-top: 12px;
}

.history-wrap {
  position: relative;
}

.history-controls {
  margin-top: 10px;
  align-items: center;
  gap: 10px;
}

.throughput-head {
  margin-top: 18px;
}

.history-actions {
  margin-left: auto;
}

.history-modes {
  display: inline-flex;
  gap: 2px;
  margin-left: auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #12161c;
}

.history-modes button {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
}

.history-modes button.is-active {
  background: var(--panel-2);
  color: var(--text);
}

.history-modes button:hover,
.history-modes button:focus-visible {
  color: var(--text);
}

#throughputChart {
  height: 220px;
  min-height: 220px;
}

#historyChart {
  height: 300px;
  min-height: 300px;
}

@media (max-width: 1080px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.chart-panel {
  min-width: 0;
}

.panel-head--single-row {
  align-items: center;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 18px;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    white-space: normal;
  }

  .panel-head--single-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .topbar__right {
    width: 100%;
    justify-content: flex-start;
  }

  .summary-grid,
  .fees-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-panel {
    padding: 12px;
  }

  .refresh-group {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }

  .legend-toggle {
    flex: 1 1 220px;
    min-width: 0;
  }

  #updatedAt {
    flex-basis: 100%;
  }

  .chart-wrap,
  canvas {
    height: 340px;
    min-height: 340px;
  }

  #throughputChart {
    height: 200px;
    min-height: 200px;
  }

  #historyChart {
    height: 240px;
    min-height: 240px;
  }

  .block-table-wrap {
    overflow-x: visible;
  }

  .block-table {
    min-width: 0;
  }

  .block-table thead {
    display: none;
  }

  .block-table,
  .block-table tbody,
  .block-table tr,
  .block-table td {
    display: block;
  }

  .block-table tr {
    border-top: 1px solid rgba(238, 243, 246, 0.12);
    padding: 10px 0;
  }

  .block-table td {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    border-top: 0;
    padding: 5px 0;
    text-align: right;
  }

  .block-table td::before {
    display: inline;
    color: var(--muted);
    content: attr(data-label);
    font-size: 0.78rem;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
  }

}

@media (max-width: 480px) {
  .summary-grid,
  .fees-strip {
    grid-template-columns: 1fr;
  }

  #memoryUsage {
    font-size: clamp(1.2rem, 7vw, 1.7rem);
  }

  .status-pill {
    width: 100%;
    justify-content: center;
  }

  .legend-toggle {
    width: 100%;
    flex-basis: 100%;
  }

  #updatedAt {
    width: 100%;
  }

}

/* Keep fees and network activity ahead of technical detail. */
h1 { font-size: clamp(1.7rem, 3vw, 2.35rem); }
h2 { font-size: 1.2rem; line-height: 1.3; }
button, select { font: inherit; }
button:focus-visible, select:focus-visible, canvas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.section-label { margin: 0 0 10px; font-size: .9rem; font-weight: 700; }
.section-label span { color: var(--muted); font-weight: 400; margin-left: 8px; }
.fees-strip { margin-bottom: 18px; }
.fees-strip > div { background: var(--panel); border-top: 2px solid var(--accent); }
.fees-strip strong { font-size: clamp(1.15rem, 2vw, 1.6rem); font-variant-numeric: tabular-nums; }
.metric--secondary { background: rgba(25, 29, 36, .5); }
.metric--secondary strong { color: #bdc8cf; }
.metrics-toggle { display: none; }
.history-windows { margin-top: 0; gap: 6px; }
.history-windows button, .history-windows select { min-height: 40px; }
.history-windows select {
  min-width: 0; max-width: 145px; padding: 6px 9px; border: 1px solid var(--line);
  border-radius: 8px; color: var(--muted); background: var(--panel-2); font-size: .82rem;
}
.history-windows button.is-active, .history-windows select.is-active {
  background: var(--accent); color: #171300; border-color: var(--accent);
}
.history-controls { flex-wrap: wrap; }
.history-actions { gap: 8px; }
.fee-scale { margin-top: 18px; max-width: 360px; color: var(--muted); font-size: .75rem; }
.fee-scale__colors { display: flex; height: 8px; border-radius: 3px; overflow: hidden; margin-top: 6px; background: var(--line); }
.fee-scale__colors span { flex: 1; }
.fee-scale__labels { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; }
.chart-help { color: var(--muted); font-size: .75rem; margin: 10px 0 0; }
.chart-tooltip { max-width: min(320px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); overflow-y: auto; pointer-events: auto; font-size: .85rem; }
.block-tabs { display: flex; gap: 6px; margin-top: 20px; border-bottom: 1px solid var(--line); }
.block-tabs button {
  min-height: 44px; padding: 8px 14px; background: transparent; color: var(--muted);
  border: 0; border-bottom: 2px solid transparent; cursor: pointer; font-size: .9rem;
}
.block-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.block-expand { display: none; }
@media (max-width: 760px) {
  .summary-grid, .fees-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 96px; padding: 12px; }
  .metric strong { font-size: 1.45rem; }
  .metric--secondary { display: none; }
  .summary-grid.show-technical .metric--secondary { display: block; }
  .metrics-toggle {
    display: block; min-height: 44px; padding: 8px 0; border: 0;
    background: transparent; color: var(--muted); cursor: pointer; font-size: .82rem;
  }
  .fees-strip { gap: 8px; margin-bottom: 12px; }
  .fees-strip > div { min-height: 78px; padding: 12px; }
  .fees-strip strong { font-size: 1.2rem; }
  .history-modes { margin-left: 0; }
  .history-modes button { min-height: 40px; }
  .history-windows { width: 100%; }
  .history-windows button { padding: 6px 10px; }
  .history-windows select { flex: 1; max-width: none; }
  .history-actions .legend-toggle { flex: 0 1 auto; width: auto; }
  .history-actions #historyUpdatedAt { flex-basis: 100%; }
  .block-table tr:not(.is-expanded) td:nth-child(n+3) { display: none; }
  .block-expand {
    display: inline-flex; align-items: center; gap: 12px; min-height: 44px;
    border: 0; padding: 0 2px; background: transparent; color: var(--text); cursor: pointer;
  }
  .block-expand::after { content: "+"; color: var(--accent); }
  .block-expand[aria-expanded="true"]::after { content: "−"; }
  .block-desktop-label { display: none; }
  .block-table td:first-child { align-items: center; }
  .block-table caption { display: block; }
  .fee-scale { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .metric-progress__fill { transition: none; }
}
