:root {
  --bg: #050b14;
  --panel: rgba(11, 23, 39, 0.82);
  --panel-solid: #0b1727;
  --panel-light: #10213a;
  --line: rgba(142, 174, 211, 0.14);
  --text: #eef6ff;
  --muted: #8fa3ba;
  --cyan: #48dcff;
  --blue: #5888ff;
  --violet: #9c78ff;
  --green: #46e3ad;
  --yellow: #ffd36a;
  --red: #ff6f83;
  --radius: 20px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 15% -10%, rgba(72, 220, 255, 0.12), transparent 36%),
    radial-gradient(circle at 90% 10%, rgba(156, 120, 255, 0.11), transparent 34%),
    linear-gradient(180deg, #07111f 0%, var(--bg) 40%, #050912 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.page-glow {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.08;
  pointer-events: none;
}

.page-glow-a { left: -220px; top: 28%; background: var(--cyan); }
.page-glow-b { right: -240px; top: 55%; background: var(--violet); }

.shell {
  position: relative;
  z-index: 1;
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

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

.brand, .status-cluster, .node-health, .health-row, .chart-legend {
  display: flex;
  align-items: center;
}

.section-kicker {
  margin: 0 0 4px;
  color: var(--cyan);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.brand h1 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1;
  letter-spacing: -0.045em;
}

.status-cluster { gap: 12px; flex-wrap: wrap; justify-content: flex-end; }

.live-status, .history-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.035);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.history-badge { color: var(--yellow); border-color: rgba(255, 211, 106, 0.2); }
.history-badge.is-complete { color: var(--green); border-color: rgba(70, 227, 173, 0.2); }

.status-dot, .mini-led {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 12px currentColor;
}

.live-status.is-live { color: var(--green); border-color: rgba(70, 227, 173, 0.24); }
.live-status.is-live .status-dot, .mini-led.is-up { background: var(--green); }
.live-status.is-down { color: var(--red); border-color: rgba(255, 111, 131, 0.26); }
.live-status.is-down .status-dot, .mini-led.is-down { background: var(--red); }

.last-update { margin: 0; color: var(--muted); font-size: 0.75rem; }

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 32px;
  padding: 28px 8px;
}

.node-health {
  justify-self: end;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(11, 23, 39, 0.6);
  backdrop-filter: blur(14px);
}

.health-orbit {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(72, 220, 255, 0.26);
  border-radius: 50%;
  animation: orbit-pulse 3s ease-in-out infinite;
}

.health-orbit span {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d9fbff, var(--cyan) 30%, var(--blue) 75%);
  box-shadow: 0 0 28px rgba(72, 220, 255, 0.6);
}

@keyframes orbit-pulse { 50% { box-shadow: 0 0 28px rgba(72, 220, 255, 0.14); } }

.node-health p { margin: 0 0 8px; color: var(--muted); font-size: 0.72rem; }
.health-row { gap: 7px; margin-top: 5px; color: #c6d3e2; font-size: 0.82rem; }
.health-row strong { margin-left: auto; color: var(--text); font-size: 0.76rem; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  position: relative;
  min-height: 136px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(16, 33, 58, 0.72), rgba(7, 17, 31, 0.88));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035), 0 18px 50px rgba(0,0,0,0.16);
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -50px;
  bottom: -70px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: var(--blue);
  filter: blur(55px);
  opacity: 0.08;
}

.metric-primary {
  border-color: rgba(72, 220, 255, 0.25);
  background: linear-gradient(145deg, rgba(19, 56, 76, 0.78), rgba(7, 22, 40, 0.94));
}

.metric-card p { margin: 0 0 14px; color: var(--muted); font-size: 0.76rem; font-weight: 650; }
.metric-card strong { display: block; position: relative; z-index: 1; font-size: clamp(1.45rem, 2.2vw, 2.2rem); letter-spacing: -0.045em; }
.metric-card span { display: block; position: relative; z-index: 1; margin-top: 10px; color: #72889f; font-size: 0.72rem; }

.metric-span-2 { grid-column: span 2; }

.window-card { min-height: 174px; }
.coin-card { border-color: rgba(70, 227, 173, 0.2); }

.window-metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.window-stat {
  min-width: 0;
  padding: 10px 8px;
  border: 1px solid rgba(142, 174, 211, 0.1);
  border-radius: 12px;
  background: rgba(2, 8, 16, 0.28);
  text-align: center;
}

.window-stat span { margin: 0 0 6px; color: #6f849a; font-size: 0.64rem; font-weight: 800; text-transform: uppercase; }
.window-stat strong { font-size: clamp(0.82rem, 1.4vw, 1.25rem); letter-spacing: -0.025em; }
.metric-card .metric-footnote { margin-top: 12px; }

.panel {
  margin-top: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035), 0 25px 70px rgba(0,0,0,0.16);
  backdrop-filter: blur(15px);
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.panel h3 { margin: 0; font-size: 1.45rem; letter-spacing: -0.035em; }
.panel-note { margin: 0; color: var(--muted); font-size: 0.72rem; text-align: right; }

.window-switcher {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(2, 8, 16, 0.52);
}

.window-switcher button {
  min-width: 44px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.window-switcher button:hover { color: var(--text); }
.window-switcher button.is-active { color: #06101b; background: var(--cyan); box-shadow: 0 5px 18px rgba(72, 220, 255, 0.25); }

.chart-legend { gap: 18px; margin-bottom: 12px; color: var(--muted); font-size: 0.72rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend span:last-child { margin-left: auto; }
.chart-legend i { width: 18px; height: 3px; border-radius: 10px; }
.legend-pool { background: var(--green); box-shadow: 0 0 8px rgba(70, 227, 173, 0.4); }
.legend-network { background: var(--violet); box-shadow: 0 0 8px rgba(156, 120, 255, 0.4); }

.chart-wrap { position: relative; height: 330px; }
#hashrate-chart { width: 100%; height: 100%; display: block; }
.chart-empty { position: absolute; inset: 0; display: none; place-items: center; color: var(--muted); font-size: 0.86rem; }
.chart-empty.is-visible { display: grid; }

.table-scroll { overflow-x: auto; scrollbar-color: #27435e transparent; }
.block-scroll { max-height: 620px; overflow: auto; }
.block-scroll thead { position: sticky; top: 0; z-index: 2; background: var(--panel-solid); }
.block-scroll .data-table th { padding-top: 12px; }
.data-table { width: 100%; min-width: 980px; border-collapse: collapse; font-size: 0.78rem; }
.data-table th { padding: 0 14px 12px; color: #667c94; font-size: 0.65rem; font-weight: 800; letter-spacing: 0.075em; text-align: right; text-transform: uppercase; white-space: nowrap; }
.data-table th:first-child, .data-table th:nth-child(2), .data-table th:nth-child(3), .data-table th:nth-child(4) { text-align: left; }
.data-table td { padding: 15px 14px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
.data-table td:first-child, .data-table td:nth-child(2), .data-table td:nth-child(3), .data-table td:nth-child(4) { text-align: left; }
.data-table tbody tr { transition: background 150ms ease; }
.data-table tbody tr:hover { background: rgba(72, 220, 255, 0.025); }
.data-table code { color: #a9bdd3; font-family: "SFMono-Regular", Consolas, monospace; font-size: 0.72rem; }

.worker-name { color: var(--text); font-weight: 750; }
.worker-wallet { display: block; margin-top: 4px; color: #60768e; font-size: 0.65rem; }
.source-label { color: #7e94aa; }
.online-pill, .effort-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
}
.online-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.online-pill.is-online { color: var(--green); background: rgba(70, 227, 173, 0.08); }
.online-pill.is-offline { color: #71859b; background: rgba(113, 133, 155, 0.08); }
.effort-pill.is-good { color: var(--green); background: rgba(70, 227, 173, 0.08); }
.effort-pill.is-average { color: var(--yellow); background: rgba(255, 211, 106, 0.08); }
.effort-pill.is-hard { color: var(--red); background: rgba(255, 111, 131, 0.08); }
.effort-pill.is-unknown { color: var(--muted); background: rgba(143, 163, 186, 0.08); }
.hash-cell { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.empty-cell { height: 100px; color: var(--muted); text-align: center !important; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  padding: 22px 4px 0;
  color: #597088;
  font-size: 0.68rem;
  line-height: 1.5;
}

footer p { margin: 0; }
footer p:first-child { max-width: 850px; }
footer p:last-child { white-space: nowrap; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; gap: 18px; }
  .node-health { justify-self: start; }
}

@media (max-width: 720px) {
  .shell { width: min(100% - 24px, 1500px); padding-top: 16px; }
  .topbar { align-items: flex-start; }
  .history-badge, .last-update { display: none; }
  .hero { padding: 24px 2px; }
  .node-health { width: 100%; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { min-height: 122px; padding: 16px; border-radius: 16px; }
  .metric-card strong { font-size: 1.4rem; }
  .panel { padding: 18px 14px; border-radius: 17px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .panel-note { text-align: left; }
  .window-switcher { width: 100%; }
  .window-switcher button { flex: 1; min-width: 0; }
  .chart-wrap { height: 260px; }
  footer { flex-direction: column; gap: 8px; }
}

@media (max-width: 440px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric-span-2 { grid-column: span 1; }
  .metric-card { min-height: 112px; }
  .window-card { min-height: 164px; }
  .window-metrics { gap: 5px; }
  .window-stat { padding: 9px 3px; }
  .window-stat strong { font-size: 0.78rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
