:root {
  color-scheme: dark;
  --bg: #060d16; --line: #28414f; --muted: #a2bac8; --text: #e9f7fb;
  --mint: #6ae5c7; --blue: #8bcfff; --amber: #ffd18a; --red: #ff9aaa;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; isolation: isolate; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
button, a { touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; }
[hidden] { display: none !important; }

/* One bounded canvas projects stars towards the viewer; cards remain opaque. */
.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: radial-gradient(ellipse at 85% 5%, #15313c, transparent 55%), radial-gradient(ellipse at 5% 35%, #15172c, transparent 55%), var(--bg); }
#star-flight { display: block; width: 100%; height: 100%; }
@keyframes orbit { to { transform: rotate(360deg); } }

.shell { max-width: 1600px; margin: auto; padding: 0 40px; }
header { min-height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 11px; align-items: center; font-size: 29px; font-weight: 750; letter-spacing: -1.5px; line-height: 1.05; }
.brand svg { width: 29px; height: 38px; fill: none; stroke: var(--mint); stroke-width: 1.5; }
.brand-light { font-weight: 300; color: #afcad7; }
.brand small { display: block; font: 12px ui-monospace, monospace; letter-spacing: 1.8px; color: var(--muted); margin-top: 10px; }
.header-tools { display: flex; align-items: center; gap: 18px; }
.utc { color: var(--muted); font: 12px ui-monospace, monospace; }
#motion-toggle { background: #0c1b25; border: 1px solid #39535e; color: #c1d7e1; min-height: 40px; padding: 10px 14px; border-radius: 3px; font: 12px ui-monospace, monospace; cursor: pointer; }
#motion-toggle:hover { border-color: var(--mint); }
nav { display: flex; gap: 6px; }
nav a { display: grid; place-items: center; width: 44px; height: 40px; border: 1px solid var(--line); border-radius: 3px; font: 14px ui-monospace, monospace; }
nav a:hover { border-color: var(--mint); }
nav a[aria-current=page] { background: #15372f; color: var(--mint); border-color: #4a8b7a; }
.telemetry-strip { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; padding: 22px 0; gap: 12px; color: var(--muted); font: 12px ui-monospace, monospace; letter-spacing: .4px; }
.telemetry-strip b { padding: 0 9px; color: #698996; font-weight: 400; }
.tiny-dot, .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.tiny-dot { color: var(--mint); margin-right: 7px; }
#updated { letter-spacing: 0; }
.notice { border: 1px solid #796235; background: #332e20; color: var(--amber); padding: 14px 16px; margin: 10px 0; border-radius: 4px; }

.command-deck { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.04fr); gap: 32px; align-items: center; padding: 12px 0 30px; border-bottom: 1px solid #345765; }
.hero-copy { min-width: 0; }
.title-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
h1 { font-size: 64px; letter-spacing: -3px; line-height: 1.1; margin: 0; font-weight: 650; }
.accent { color: var(--mint); }
.eyebrow { font: 12px ui-monospace, monospace; letter-spacing: 1px; color: var(--mint); margin: 0 0 8px; }
.subtitle { font: 13px/1.8 ui-monospace, monospace; color: var(--muted); margin: 16px 0 0; max-width: 50ch; }
.health { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid #34505e; background: #101f28; border-radius: 3px; color: var(--muted); font: 13px ui-monospace, monospace; }
.health.good { border-color: #386454; background: #122b25; color: var(--mint); }
.health.warn { border-color: #8a6d3c; background: #362e1d; color: var(--amber); }
.health.bad { border-color: #74484b; background: #3b2428; color: var(--red); }
.datapoint-core { margin-top: 28px; padding: 22px; background: linear-gradient(120deg, #112631, #101b2b); border: 1px solid #375661; border-top-color: #568d8a; border-radius: 3px; }
.data-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 12px; font: 13px ui-monospace, monospace; letter-spacing: .5px; color: #c6dce4; }
.count-mode { color: var(--mint); font-size: 12px; letter-spacing: .2px; }
.hero-number { font-size: 100px; line-height: 1.15; letter-spacing: -5px; font-weight: 550; font-variant-numeric: tabular-nums; color: #dff9f1; margin: 10px 0 14px; overflow-wrap: anywhere; }
.hero-number.long { font-size: 54px; letter-spacing: -2px; }
.count-caption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.count-caption span:last-child { font-family: ui-monospace, monospace; }
.count-stale .hero-number { color: #9bb0bb; }
.count-stale .count-mode { color: var(--amber); }
.hero-bottom { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 24px; }
.mini-bracket { border-left: 1px solid #4d7e80; padding-left: 12px; font: 12px/1.5 ui-monospace, monospace; color: var(--muted); }
.mini-bracket strong { display: block; font-size: 19px; color: #d4ebf4; margin-top: 6px; font-weight: 500; }

/* Motion stays within the diagram; labels and panels never animate. */
.orbital-panel { min-width: 0; padding: 18px 20px 16px; border: 1px solid #2b4756; border-radius: 3px; background: linear-gradient(150deg, #0e202b, #0a1521); }
.orbital-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.orbital-heading .eyebrow { margin: 0; font-size: 12px; letter-spacing: .6px; color: #accfd8; }
.tag { display: inline-block; font: 12px ui-monospace, monospace; color: var(--muted); border: 1px solid #365060; border-radius: 3px; padding: 4px 7px; white-space: nowrap; }
#constellation { display: block; width: 100%; height: auto; max-height: 400px; margin: 10px 0; overflow: visible; }
.orbit-rings { fill: none; stroke: #436b7c; stroke-width: .8; }
.orbit-dashes { stroke-dasharray: 2 8; }
.orbit-faint { stroke-dasharray: 30 7; opacity: .4; }
.orbit-ellipse { stroke: url(#orbit-stroke); stroke-width: 1; }
.orbit-ellipse.faint { stroke: #867aaf; opacity: .45; }
.globe-edge { fill: none; stroke: #7ad6c9; stroke-width: 1; }
.meridians { fill: none; stroke: #68a6b1; stroke-width: .65; opacity: .3; }
.core-ring { fill: none; stroke: #72dec5; stroke-width: 1.5; stroke-dasharray: 150 45 24 70 90 317; transform-origin: 310px 222px; animation: orbit 28s linear infinite; }
.svg-kicker, .svg-core { text-anchor: middle; font-family: ui-monospace, monospace; }
.svg-kicker { font-size: 14px; letter-spacing: 2px; fill: #a1c1cb; }
.svg-core { font-size: 52px; letter-spacing: -3px; fill: #e0f7ef; }
.mesh-line { stroke: #41616e; stroke-width: 1; stroke-dasharray: 3 7; }
.mesh-line.recent { stroke: #4b9c8c; }
.mesh-line.delayed { stroke: var(--amber); }
.mesh-line.unavailable { stroke: #56616c; }
.peer-orbit-node .halo { fill: #0c202d; stroke: #4a6577; stroke-width: 1; }
.peer-orbit-node.recent .halo { stroke: #70d1b5; }
.peer-orbit-node.delayed .halo { stroke: var(--amber); }
.peer-orbit-node.unavailable .halo { stroke: #9f6970; }
.peer-orbit-node .halo-outer { fill: none; stroke: #496f80; stroke-width: .6; }
.peer-orbit-node text { text-anchor: middle; font-family: ui-monospace, monospace; }
.node-number { font-size: 19px; fill: #e0eff4; }
.node-label { font-size: 15px; fill: #c2d6e0; }
.node-state { font-size: 14px; fill: var(--muted); }
.peer-orbit-node.recent .node-state { fill: #86d9c3; }
.peer-orbit-node.delayed .node-state { fill: var(--amber); }
.peer-orbit-node.unavailable .node-state { fill: var(--red); }
.mesh-legend { display: none; }
.orbital-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font: 12px/1.6 ui-monospace, monospace; }
.orbital-footer>span:last-child { color: #91bbc8; }
.viz-note { font-size: 12px; line-height: 1.65; color: var(--muted); margin: 10px 0 0; }

.storage-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 24px; border: 1px solid var(--line); background: #0e1d29; }
.storage-strip article { display: flex; gap: 12px; padding: 24px 20px; position: relative; min-width: 0; }
.storage-strip article+article { border-left: 1px solid var(--line); }
.stat-number { font: 12px ui-monospace, monospace; color: #8badba; padding-top: 3px; }
.storage-strip h2 { font-size: 15px; font-weight: 500; color: #d3e3ec; margin: 0; padding-right: 20px; letter-spacing: 0; }
.storage-strip strong { display: block; font: 36px ui-monospace, monospace; color: #e8faff; margin: 10px 0; letter-spacing: -1px; overflow-wrap: anywhere; }
.storage-strip p { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.65; }
.storage-strip svg { position: absolute; top: 24px; right: 12px; width: 24px; height: 24px; fill: none; stroke: #7eb8bc; stroke-width: 1; }
.storage-strip article>div:not(.stat-number) { min-width: 0; }
.count-explainer { font-size: 13px; line-height: 1.8; color: var(--muted); max-width: 1150px; margin: 16px 0 34px; }
.section-label { display: flex; justify-content: space-between; align-items: center; gap: 18px; font: 13px ui-monospace, monospace; color: #b4ced8; letter-spacing: .5px; margin: 28px 0 18px; }
.section-label:after { content: ""; height: 1px; flex: 1; background: #2c4b58; }
.section-label span:first-child { order: -1; }
.section-label span:last-child { order: 1; color: var(--muted); font-size: 12px; letter-spacing: .3px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 30px; }
.card { background: linear-gradient(135deg, #10222f, #0d1926); border: 1px solid var(--line); border-radius: 4px; padding: 24px; min-width: 0; }
.card-top, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 23px; font-weight: 550; letter-spacing: -.3px; margin: 0; }
.card-top h2 { font-size: 16px; font-weight: 500; letter-spacing: 0; color: #d0e0e9; }
.value { font: 38px/1.25 ui-monospace, monospace; letter-spacing: -2px; margin: 16px 0 0; font-variant-numeric: tabular-nums; color: #e0f7ff; }
.value .unit { font-size: 16px; color: var(--muted); letter-spacing: 0; }
.chart { height: 56px; margin: 18px 0; display: flex; align-items: center; }
.chart svg { height: 100%; width: 100%; overflow: visible; }
.chart .empty { color: var(--muted); font-size: 13px; }
.chart path { fill: none; stroke: var(--mint); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.chart .baseline, .blue-chart .baseline { stroke: #284652; stroke-width: 1; }
.blue-chart path { stroke: var(--blue); }
.detail, .footnote { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.8; }
.network { display: flex; flex-wrap: wrap; align-content: center; gap: 6px 12px; font-size: 23px; letter-spacing: -.5px; min-height: 48px; }
.network .unit { font-size: 13px; }
.network .out { color: var(--blue); }
.network .direction { white-space: nowrap; }
progress { appearance: none; width: 100%; height: 7px; border: none; border-radius: 0; margin: 42px 0; display: block; background: #213a46; }
progress::-webkit-progress-bar { background: #213a46; }
progress::-webkit-progress-value { background: #61bca9; }
progress::-moz-progress-bar { background: #61bca9; }
.columns { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 22px; margin-bottom: 22px; }
.section-heading { margin-bottom: 24px; }
.section-heading .eyebrow { font-size: 12px; letter-spacing: .8px; margin-bottom: 8px; }
.table-scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; min-width: 600px; text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; }
th { color: #a0becc; font: 12px ui-monospace, monospace; text-transform: uppercase; letter-spacing: .2px; padding: 0 14px 14px 0; border-bottom: 1px solid var(--line); }
td { font-size: 14px; padding: 17px 14px 17px 0; border-bottom: 1px solid #243c48; }
td:first-child { font-weight: 500; color: #d0e6ec; }
td:last-child, th:last-child { padding-right: 0; text-align: right; }
td:not(:first-child) { color: var(--muted); font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.service-state { display: inline-flex; gap: 6px; align-items: center; color: var(--mint); font: 13px ui-monospace, monospace; }
.service-state.warn { color: var(--amber); }
.service-state.bad { color: var(--red); }
.service-state .dot { width: 5px; height: 5px; }
.services .footnote { margin-top: 16px; }
.peer { border-bottom: 1px solid #294652; padding-bottom: 14px; margin-bottom: 18px; }
.peer-title { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; font: 15px ui-monospace, monospace; }
.row { display: flex; justify-content: space-between; align-items: start; gap: 16px; font-size: 14px; line-height: 1.65; margin: 10px 0; }
.row span { color: var(--muted); }
.row strong { font-weight: 450; text-align: right; font-variant-numeric: tabular-nums; color: #c8e1eb; }
.sync>.footnote { border-top: 1px solid var(--line); padding-top: 15px; margin-top: 18px; }
.muted { color: var(--muted); }
.system-card { display: grid; grid-template-columns: 200px 1fr; gap: 24px; margin-bottom: 28px; }
.system { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px 22px; font-size: 13px; margin: 0; }
.system dt { color: var(--muted); }
.system dd { margin: 0; text-align: right; overflow-wrap: anywhere; color: #c6e1eb; font-family: ui-monospace, monospace; }
.system .version { font-size: 12px; }
footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px; border-top: 1px solid var(--line); padding: 24px 0 34px; color: #a0bac9; font: 12px/1.8 ui-monospace, monospace; }
footer .tiny-dot { width: 4px; height: 4px; }
noscript { display: block; padding: 20px; color: var(--amber); }

/* Only freshness changes may dim data, never a repeating visual effect. */
body.stale main .chart, body.stale main .value, body.stale #constellation, body.stale .mesh-legend { opacity: .5; }
body.stale #constellation * { animation-play-state: paused !important; }
body.stale .contact-light { display: none; }
body.stale #orb-state { color: var(--amber); border-color: #8a6d3c; }
.counts-stale #packets, .counts-stale #history-points, .counts-stale #sensors { color: #9bb0bb; }
.motion-paused #constellation *, .tab-hidden #constellation * { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) { body:not(.motion-enabled) #constellation * { animation: none; } }

@media (max-width: 1250px) {
  .columns, .system-card { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .command-deck { gap: 24px; }
  .storage-strip article { padding: 22px 16px; gap: 8px; }
  .storage-strip h2 { padding-right: 0; }
  .storage-strip svg { display: none; }
  .mini-bracket strong { font-size: 17px; }
  .card { padding: 22px; }
}
@media (max-width: 1100px) { .utc { display: none; } }
@media (max-width: 1000px) {
  .shell { padding: 0 28px; }
  .command-deck { grid-template-columns: 1fr; gap: 30px; }
  .orbital-panel { max-width: 680px; width: 100%; margin: auto; }
  .hero-bottom { gap: 20px; }
  .mini-bracket strong { font-size: 21px; }
  .storage-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .storage-strip article:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .storage-strip article:nth-child(4) { border-top: 1px solid var(--line); }
  .system { grid-template-columns: auto minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .shell { padding: 0 20px; }
  header { display: grid; grid-template-columns: 1fr; padding: 22px 0 18px; gap: 20px; }
  .header-tools { width: 100%; justify-content: space-between; gap: 12px; }
  #motion-toggle { min-height: 42px; padding: 10px 12px; }
  nav { gap: 5px; } nav a { width: 40px; height: 42px; }
  .telemetry-strip { letter-spacing: 0; line-height: 1.8; padding: 20px 0; }
  .telemetry-strip b { padding: 0 5px; }
  .command-deck { padding-top: 10px; gap: 26px; }
  h1 { font-size: 54px; }
  .title-row { gap: 14px; }
  .datapoint-core { padding: 20px 18px; margin-top: 24px; }
  .hero-number { font-size: 88px; }
  .hero-number.long { font-size: 36px; }
  .count-caption { display: grid; }
  .hero-bottom { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
  .mini-bracket strong { font-size: 20px; }
  .hero-bottom .mini-bracket:last-child { grid-column: 1 / -1; }
  .orbital-panel { padding: 18px 16px; }
  .orbital-heading .eyebrow { letter-spacing: 0; }
  .node-label, .node-state { display: none; }
  .node-number { font-size: 27px; }
  .svg-kicker { font-size: 24px; letter-spacing: .5px; }
  .mesh-legend { display: grid; gap: 8px; margin: 0 0 16px; }
  .legend-peer { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .legend-peer strong { font: 14px ui-monospace, monospace; color: #d1e4ee; }
  .legend-peer span { font-size: 13px; color: var(--muted); }
  .legend-peer.recent span { color: var(--mint); }
  .legend-peer.delayed span { color: var(--amber); }
  .legend-peer.unavailable span { color: var(--red); }
  .storage-strip article { padding: 20px 14px; }
  .stat-number { display: none; }
  .storage-strip strong { font-size: 34px; }
  .section-label { flex-wrap: wrap; gap: 8px; }
  .section-label:after { display: none; }
  .section-label span:last-child { line-height: 1.6; }
  .metrics { gap: 16px; }
  .card { padding: 20px; }
  .value { font-size: 36px; }
  .value.network { font-size: 24px; }
  h2 { font-size: 22px; }
  .system { gap: 16px 12px; }
}
@media (max-width: 480px) { .metrics { grid-template-columns: 1fr; } }
@media (max-width: 360px) { .svg-kicker, .node-number { font-size: 32px; letter-spacing: 0; } }
/* Keep orbit lines from crossing the peer labels visually. */
.node-label, .node-state { paint-order: stroke; stroke: #0d1c28; stroke-width: 3px; stroke-linejoin: round; }

.counter-ring { fill: none; stroke: #a393d8; stroke-width: 1.4; stroke-dasharray: 95 80 35 594; transform-origin: 310px 222px; animation: orbit 43s linear infinite reverse; }
.satellite-orbit { transform-origin: 310px 222px; animation: orbit 16s linear infinite; }
.satellite-orbit.secondary { animation-duration: 23s; animation-direction: reverse; }
.satellite-aura { fill: #74e4ce; opacity: .14; }
.satellite { fill: #c3fff0; }
.secondary .satellite { fill: #d4c6ff; }
.secondary .satellite-aura { fill: #b5a0f3; }
.contact-light { fill: none; stroke: #a9f8df; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 1.6 98.4; animation: contact-flow 4.5s linear infinite; }
@keyframes contact-flow { to { stroke-dashoffset: -100; } }
.mesh-line.unavailable { stroke: #b87280; }
.peer-orbit-node.unavailable .halo { stroke: var(--red); }
nav a[data-peer-state=unavailable] { color: var(--red); border-color: #98606b; }
nav a[data-peer-state=delayed] { color: var(--amber); border-color: #8f774c; }
body.stale nav a[data-peer-state] { color: var(--muted); border-color: var(--line); }
