:root {
  color-scheme: dark;
  --ink: #050807;
  --panel: rgba(7, 13, 12, 0.88);
  --line: rgba(215, 233, 228, 0.18);
  --text: #edf6f2;
  --muted: #8fa39c;
  --live: #b9ff3d;
  --teal: #45ddd2;
  --warn: #ffc14d;
  --down: #ff7167;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--text);
}

.earth-field {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: #050807 url("assets/earth-night.jpg") center 35% / cover no-repeat;
  opacity: 0.29;
}

.earth-field::after {
  position: absolute;
  inset: 0;
  content: "";
  background: rgba(1, 5, 4, 0.63);
}

header {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 12px clamp(18px, 4vw, 64px);
  background: rgba(3, 7, 6, 0.9);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand img { width: 38px; height: 38px; object-fit: contain; }
.brand span, .release { display: grid; gap: 3px; }
.brand b { font-size: 18px; }
.brand small, .release span { color: var(--muted); font-size: 10px; }
.release { text-align: right; }
.release b { color: var(--teal); }

main {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 64px 0 28px;
}

.network-state {
  display: flex;
  min-height: 220px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.eyebrow { color: var(--teal); font-size: 11px; }
h1 { margin: 12px 0; font: 700 46px/1.05 Arial, sans-serif; letter-spacing: 0; }
h1 b { color: var(--warn); }
.network-state p { max-width: 700px; margin: 0; color: var(--muted); line-height: 1.6; }

.pulse {
  position: relative;
  width: 150px;
  height: 150px;
  flex: 0 0 150px;
}

.pulse i {
  position: absolute;
  inset: 50%;
  width: 14px;
  height: 14px;
  border: 1px solid var(--warn);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: pulse 2.4s infinite;
}

.pulse i:nth-child(2) { animation-delay: 0.8s; }
.pulse i:nth-child(3) { animation-delay: 1.6s; }

@keyframes pulse {
  0% { width: 14px; height: 14px; opacity: 1; }
  100% { width: 140px; height: 140px; opacity: 0; }
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-left: 1px solid var(--line);
}

.telemetry-grid article {
  min-height: 142px;
  display: grid;
  align-content: center;
  gap: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 22px;
  background: var(--panel);
}

.telemetry-grid span, .region-head span { color: var(--muted); font-size: 10px; }
.telemetry-grid b { overflow-wrap: anywhere; font-size: 23px; }
.telemetry-grid small { overflow-wrap: anywhere; color: var(--muted); font-size: 9px; line-height: 1.5; }

.regions { margin-top: 36px; border: 1px solid var(--line); background: var(--panel); }
.region-head { display: flex; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.region-head time { color: var(--teal); font-size: 10px; }
.regions ol { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.regions li { display: grid; grid-template-columns: 9px 1fr; gap: 5px 10px; padding: 18px; border-right: 1px solid var(--line); }
.regions li:last-child { border-right: 0; }
.regions i { width: 8px; height: 8px; margin-top: 3px; border-radius: 50%; background: var(--live); }
.regions span { font-size: 12px; }
.regions b { grid-column: 2; color: var(--muted); font-size: 9px; }

footer { display: flex; gap: 24px; padding: 24px 0; }
footer a { color: var(--muted); font-size: 10px; text-decoration: none; }
footer a:hover { color: var(--teal); }

body.operational h1 b, body.operational #rpc-state { color: var(--live); }
body.degraded h1 b, body.degraded #rpc-state { color: var(--warn); }
body.outage h1 b, body.outage #rpc-state { color: var(--down); }
body.operational .pulse i { border-color: var(--live); }
body.outage .pulse i { border-color: var(--down); }

@media (max-width: 760px) {
  header { min-height: 64px; }
  .brand small { display: none; }
  main { width: min(100% - 24px, 1180px); padding-top: 30px; }
  .network-state { min-height: 210px; }
  h1 { font-size: 34px; }
  .pulse { display: none; }
  .telemetry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .telemetry-grid article { min-height: 130px; padding: 16px; }
  .telemetry-grid b { font-size: 18px; }
  .regions ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .regions li:nth-child(2) { border-right: 0; }
  .regions li:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  footer { flex-wrap: wrap; gap: 16px; }
}
