:root {
  --bg: #0d0f14;
  --panel: #161a22;
  --panel-2: #1c212b;
  --line: #262c38;
  --text: #e6e9ef;
  --muted: #8b94a7;
  --accent: #6d5cf0;
  --accent-soft: #6d5cf026;
  --good: #3fbf7f;
  --bad: #e5484d;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans", "Microsoft YaHei", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

/* --- top bar --- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 4px #3fbf7f22;
  flex: none;
  transition: background 0.3s, box-shadow 0.3s;
}

.dot-bad {
  background: var(--bad);
  box-shadow: 0 0 0 4px #e5484d22;
}

/* --- language switch --- */

.lang-switch { display: flex; gap: 4px; }

.lang-switch button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.lang-switch button:hover { color: var(--text); border-color: #39404f; }

.lang-switch button.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* --- banner --- */

.banner {
  margin: 16px 24px 0;
  padding: 12px 16px;
  background: #2a1416;
  border: 1px solid #5c2a2d;
  border-left: 3px solid var(--bad);
  border-radius: 8px;
  color: #ffb4b6;
  font-size: 14px;
  word-break: break-word;
}

/* --- layout --- */

main { padding: 8px 24px 32px; }

.cards { margin-top: 28px; }

.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
}

.card-wide { margin-top: 12px; }

.label {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.value {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  word-break: break-all;
}

.value-sm { font-size: 15px; font-weight: 500; word-break: break-all; }

.sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* --- validator bars --- */

.bars { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }

.bar-row {
  display: grid;
  grid-template-columns: 96px 1fr 54px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar-addr {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 8px;
  background: var(--panel-2);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b7bff);
  border-radius: 4px;
}

.bar-pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* --- chips --- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chips-empty { color: var(--muted); font-size: 14px; }

.chip {
  background: var(--accent-soft);
  border: 1px solid #6d5cf040;
  color: #b9b0ff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* --- footer --- */

.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 24px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

/* --- address activity --- */

.section-note {
  margin: -4px 0 12px;
  font-size: 13px;
  color: var(--muted);
  max-width: 78ch;
}

.chart-wrap-sm { height: 210px; }

.stat-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }

.stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.stat-row:last-child { border-bottom: none; padding-bottom: 0; }
.stat-key { color: var(--muted); }
.stat-val { font-variant-numeric: tabular-nums; font-weight: 600; }

/* --- range switch --- */

.range-switch {
  display: flex;
  gap: 4px;
  margin: 12px 0;
}

.range-switch button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 5px 13px;
  font-size: 12px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.range-switch button:hover { color: var(--text); border-color: #39404f; }

.range-switch button.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* --- charts --- */

.chart-card { display: flex; flex-direction: column; }

.chart-wrap {
  position: relative;
  height: 200px;
  margin-top: 10px;
}

/* --- rotation --- */

.anomaly-list { display: flex; flex-direction: column; gap: 6px; }

.anomaly-row {
  display: grid;
  grid-template-columns: 118px 68px 1fr 76px;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.anomaly-kind { color: #ffb4b6; }

.anomaly-addr {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.anomaly-when { text-align: right; color: var(--muted); }

/* --- responsive --- */

@media (max-width: 640px) {
  .topbar, main, .banner, .foot { padding-left: 16px; padding-right: 16px; }
  .value { font-size: 24px; }
  .bar-row { grid-template-columns: 78px 1fr 48px; }
  .brand h1 { font-size: 16px; }
  .anomaly-row { grid-template-columns: 96px 56px 1fr; }
  .anomaly-when { display: none; }
}