/* Glass public theme. Cold blue instruments and high-contrast telemetry in both appearances. */
:root {
  --background: #e5edf6;
  --foreground: #172942;
  --card-solid: #f3f8ff;
  --card-foreground: #172942;
  --primary: #175899;
  --primary-foreground: #f3f8ff;
  --muted: #e1eaf6;
  --muted-foreground: #465e7b;
  --border: #b5c9df;
  --ring: #175899;
  --glass-control: #e1eaf6;
  --node-card-bg: #f3f8ff;
  --node-card-hover: #e6eff9;
  --node-card-border: #b5c9df;
  --node-data-bg: #e6eff9;
  --node-offline-bg: #f3f8ffe6;
  --glass-download: #435eb7;
  --glass-alert: #8c5000;
  --ping-good: #23866d;
  --ping-calm: #68a98b;
  --ping-watch: #bea45b;
  --ping-high: #b98248;
  --ping-critical: #bd655b;
}
.dark {
  --background: #0b1220;
  --foreground: #e0eaf8;
  --card-solid: #111e31;
  --card-foreground: #e0eaf8;
  --primary: #8bd6ff;
  --primary-foreground: #0b1220;
  --muted: #1a2c44;
  --muted-foreground: #a0b6d2;
  --border: #2d4764;
  --ring: #8bd6ff;
  --glass-control: #1a2c44;
  --node-card-bg: #111e31;
  --node-card-hover: #1a2c44;
  --node-card-border: #2d4764;
  --node-data-bg: #1a2c44;
  --node-offline-bg: #0b1220e6;
  --glass-download: #91a8ff;
  --glass-alert: #ffb77f;
  --ping-good: #4dab8c;
  --ping-calm: #7ab99b;
  --ping-watch: #cabb72;
  --ping-high: #d49b64;
  --ping-critical: #da8174;
}

/* Solid, quiet surfaces instead of the upstream translucent glass and shadows. */
.glass-panel {
  border: 1px solid var(--node-card-border);
  background: var(--node-card-bg);
  box-shadow: none;
}
html[data-blur=on] .glass-panel,
html[data-blur=off] .glass-panel {
  background: var(--node-card-bg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
#theme-background { opacity: 0 !important; }

header.w-full { border-bottom: 1px solid var(--border); }
header.w-full > div { height: 3.5rem; }
main { min-width: 0; }
.node-card {
  min-height: 0;
  border-radius: 4px;
  box-shadow: none;
  transition: border-color .16s, background-color .16s;
}
.node-card:hover,
.dark .node-card:hover {
  border-color: var(--muted-foreground);
  background: var(--node-card-hover);
  box-shadow: none;
}
.node-card-offline,
.node-card-offline:hover,
.dark .node-card-offline:hover {
  border-color: var(--destructive);
  box-shadow: none;
}
.node-card > header { border-bottom: 1px solid var(--border); }
.node-card > header, .node-card > div { min-width: 0; }
.node-card > header { padding: .625rem .875rem; }
.node-card > div { padding-inline: .875rem; padding-bottom: .875rem; }
.node-data-panel {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--node-data-bg);
}
/* The generated grid already has a 1px gap and 1px-rounded sample spans. */
.node-card .group\/ping-panel .ping-timeline { max-height: 10px; }
/* Preserve timeline height and hit targets; narrow only the visible latency samples. */
.node-card .group\/ping-panel .ping-timeline.ping-latency .group\/ping-bar > span:first-child {
  width: min(68%, 4px);
  margin-inline: auto;
}
.node-card .group\/ping-panel .bg-signal-1 { background-color: var(--ping-good); }
.node-card .group\/ping-panel .bg-signal-2 { background-color: var(--ping-calm); }
.node-card .group\/ping-panel .bg-signal-3 { background-color: var(--ping-watch); }
.node-card .group\/ping-panel .bg-signal-4 { background-color: var(--ping-high); }
.node-card .group\/ping-panel .bg-signal-5 { background-color: var(--ping-critical); }
.chip-pill, .node-tag, .node-card .chip-pill, .node-card .node-tag {
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--glass-control);
}
.node-card .chip-online { color: var(--success); }
.node-card .chip-offline { color: var(--destructive); }
.icon-btn, .btn-primary, .segmented-control, .segment-btn { border-radius: 3px; }
.icon-btn:hover { color: var(--foreground); background: var(--glass-control); }
.icon-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.segmented-control { background: var(--glass-control); }
.segment-btn:hover { color: var(--foreground); background: var(--node-card-hover); }
.segment-btn-active { color: var(--primary-foreground); background: var(--primary); box-shadow: none; }
.segment-btn-active:hover { color: var(--primary-foreground); background: var(--primary); }
.segment-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.glass-node-home {
  --telemetry-font: ui-monospace, SFMono-Regular, Consolas, monospace;
  display: grid;
  gap: clamp(1.1rem, 2.5vw, 2rem);
}
.glass-section-title {
  margin: 0;
  font-size: clamp(1.3rem, 2.2vw, 1.85rem);
  font-weight: 670;
  letter-spacing: -.025em;
  line-height: 1.2;
}
/* A tiny stencil inspired by a mechanic's personal marking. */
.glass-site-mark {
  position: relative;
  display: inline-block;
  width: 27px;
  height: 25px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card-solid);
  color: var(--primary);
}
.glass-site-mark::before, .glass-site-mark::after { position: absolute; content: ""; background: currentColor; }
.glass-site-mark::before {
  inset: 5px 9px 4px 4px;
  clip-path: polygon(43% 0, 57% 0, 63% 21%, 84% 17%, 100% 51%, 82% 58%, 73% 41%, 62% 67%,
    78% 96%, 56% 96%, 50% 75%, 41% 96%, 17% 96%, 37% 67%, 24% 42%, 15% 60%, 0 51%, 16% 17%, 37% 21%);
}
.glass-site-mark::after { inset: 4px 4px 4px auto; width: 5px; clip-path: polygon(50% 0, 100% 20%, 66% 33%, 66% 100%, 34% 100%, 34% 33%, 0 20%); }
.glass-infrastructure { display: grid; gap: .8rem; }
.glass-overview-heading, .node-view-toolbar, .glass-throughput-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .65rem 1rem;
}
.glass-raid { display: flex; align-items: center; gap: .45rem; font-size: .75rem; color: var(--muted-foreground); }
/* The linked ring changes only after the public WebSocket sends a valid frame. */
.glass-raid-icon {
  position: relative;
  width: 20px;
  height: 20px;
  border: 1px solid currentColor;
  border-radius: 50%;
}
.glass-raid-icon::before, .glass-raid-icon::after { position: absolute; content: ""; }
.glass-raid-icon::before { inset: 3px; border: 1px solid currentColor; border-inline-color: transparent; border-radius: 50%; transform: rotate(32deg); }
.glass-raid-icon::after { inset: 50% auto auto 50%; width: 3px; height: 3px; border-radius: 50%; background: currentColor; transform: translate(-50%, -50%); }
.glass-raid[data-live="true"] { color: var(--primary); }
.glass-overview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  margin: 0;
}
.glass-overview-stats, .glass-instrument, .node-table-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--card-solid);
}
.glass-overview-stats > div { min-width: 0; padding: .68rem 1rem; }
.glass-overview-stats > div + div { border-inline-start: 1px solid var(--border); }
.glass-overview-stats dt { color: var(--muted-foreground); font-size: .77rem; }
.glass-overview-stats dd {
  margin: .25rem 0 0;
  color: var(--primary);
  font: 650 clamp(1rem, 1.8vw, 1.4rem)/1.2 var(--telemetry-font);
  overflow-wrap: anywhere;
}
.glass-overview-assets { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: 0; color: var(--muted-foreground); font: .73rem/1.4 var(--telemetry-font); }
.glass-network-panels { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: .75rem; }
.glass-instrument { position: relative; padding: .85rem 1rem; }
.glass-instrument::after, .node-view-grid .node-card::after {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  background: linear-gradient(45deg, transparent 46%, var(--border) 48% 54%, var(--background) 56%);
  content: "";
  pointer-events: none;
}
.glass-instrument h2 { margin: 0; font-size: .95rem; font-weight: 650; }
/* Instrument traces share one amplitude scale. Thin grid and center line
   remain steady while samples move through the 60-second window. */
.glass-wave-scale, .glass-throughput-time {
  color: var(--muted-foreground);
  font: .68rem/1.35 var(--telemetry-font);
}
.glass-trace-upload { --trace: var(--primary); }
.glass-trace-download { --trace: var(--glass-download); }
.glass-throughput-plot {
  --wave-label: clamp(5.15rem, 13vw, 7.25rem);
  position: relative;
  margin-top: .66rem;
  border-radius: 2px;
}
.glass-wave-channel {
  display: grid;
  grid-template-columns: var(--wave-label) minmax(0, 1fr);
  align-items: stretch;
  min-height: 3.35rem;
  border: 1px solid var(--border);
  color: var(--trace);
  background: var(--background);
}
.glass-wave-channel + .glass-wave-channel { border-top: 0; }
.glass-wave-label {
  display: grid;
  align-content: center;
  gap: .18rem;
  padding: .22rem .48rem;
  border-inline-end: 1px solid var(--border);
  background: var(--card-solid);
  font-size: .72rem;
}
.glass-wave-label span { color: var(--muted-foreground); }
.glass-wave-label strong { font: 650 clamp(.67rem, 1.2vw, .83rem)/1.15 var(--telemetry-font); overflow-wrap: anywhere; }
.glass-wave-channel svg {
  display: block;
  width: 100%;
  height: 3.35rem;
  min-width: 0;
  overflow: hidden;
  background:
    linear-gradient(transparent calc(50% - .5px), var(--border) 50%, transparent calc(50% + .5px)),
    repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), color-mix(in srgb, var(--border) 45%, transparent) calc(10% - 1px) 10%);
}
.glass-wave-channel path {
  stroke: var(--trace);
  stroke-width: 1.4px;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: color-mix(in srgb, var(--trace) 14%, transparent);
}
.glass-throughput-time { display: flex; justify-content: space-between; margin: .3rem 0 0 var(--wave-label); }
.glass-throughput-empty {
  position: absolute;
  inset: 1.8rem .5rem auto calc(var(--wave-label) + .5rem);
  margin: 0;
  color: var(--muted-foreground);
  font-size: .72rem;
  text-align: center;
  pointer-events: none;
}
.overview-network-ranking {
  margin: .55rem 0 0;
  padding: 0 .2rem 0 0;
  list-style: none;
  max-height: 8.6rem;
  overflow: auto;
  scrollbar-color: var(--border) transparent;
  scrollbar-width: thin;
}
.overview-network-ranking:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.overview-network-rank-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(1.25rem, .8fr) auto;
  align-items: center;
  gap: .55rem;
  min-height: 1.72rem;
  font: .72rem/1.3 var(--telemetry-font);
}
.overview-network-host, .node-table-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overview-network-host-speed { white-space: nowrap; }
.overview-network-empty, .glass-no-matches { color: var(--muted-foreground); font-size: .82rem; }
.node-view-controls { display: flex; align-items: stretch; justify-content: flex-end; gap: .6rem; }
.node-view-search, .node-view-switch { border: 1px solid var(--border); border-radius: 4px; color: var(--foreground); background: var(--card-solid); }
.node-view-search { width: clamp(8rem, 21vw, 17rem); padding: .42rem .65rem; font-size: .82rem; }
.node-view-switch { display: flex; flex: none; }
.node-view-switch button { padding: .4rem .62rem; font-size: .8rem; }
.node-view-switch button[aria-pressed="true"] { color: var(--primary-foreground); background: var(--primary); }
.node-view-search:focus-visible, .node-view-switch button:focus-visible, .node-table-link:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.node-view-grid, .node-table-panel, .glass-no-matches { margin-top: .75rem; }
.node-view-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); align-items: start; gap: .75rem; }
.node-view-grid .node-card { overflow: visible; }
.node-view-grid .node-card::after { border-top-right-radius: 4px; }
.node-table { width: 100%; border-collapse: collapse; table-layout: fixed; font: .79rem/1.4 var(--telemetry-font); }
.node-table th, .node-table td { padding: .55rem .62rem; text-align: start; vertical-align: middle; }
.node-table thead th { color: var(--muted-foreground); font-family: system-ui, sans-serif; font-weight: 620; background: var(--muted); }
.node-table thead th:first-child { width: 25%; }
.node-table thead th:nth-child(6) { width: 15%; }
.node-table tbody th, .node-table td { border-top: 1px solid var(--border); }
.node-table tbody tr:hover, .node-table tbody tr:focus-within { background: var(--node-card-hover); }
.node-table-link { display: flex; align-items: center; gap: .45rem; color: var(--foreground); font-weight: 650; }
.node-status-dot { flex: none; width: .62rem; height: .62rem; border: 1px solid var(--destructive); border-radius: 50%; }
.node-status-dot[data-online="true"] { border-color: var(--primary); background: radial-gradient(circle, var(--primary) 31%, transparent 35%); }
.glass-spearhead { display: inline-flex; flex: none; width: 11px; color: var(--muted-foreground); }
.glass-spearhead::before, .glass-spearhead::after { width: 5px; height: 5px; transform: rotate(45deg); border-top: 1px solid; border-right: 1px solid; content: ""; }
.node-meter { display: block; height: 4px; overflow: hidden; border-radius: 2px; background: var(--muted); }
.node-meter > span { display: block; height: 100%; background: var(--primary); }
.node-cell-metric .node-meter { display: inline-block; width: 35%; margin-inline-start: .4rem; vertical-align: middle; }
.node-probe-value { display: flex; gap: .35rem; align-items: center; white-space: nowrap; }
.node-probe-value + .node-probe-value { margin-top: .2rem; }
.node-probe-name { color: var(--muted-foreground); overflow: hidden; min-width: 0; text-overflow: ellipsis; }
.node-latency-high { color: var(--glass-alert); }
@media (max-width: 830px) {
  .node-table .node-cell-metric { display: none; }
  .node-table thead th:first-child { width: 34%; }
  .node-table thead th:nth-child(6) { width: 29%; }
}
@media (max-width: 640px) {
  header.w-full > div { height: 3.25rem; }
  .glass-overview-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .glass-overview-stats > div { padding: .58rem .68rem; }
  .glass-network-panels { grid-template-columns: minmax(0, 1fr); }
  .node-card > header { padding: .625rem .75rem; }
  .node-card > div { padding-inline: .75rem; padding-bottom: .75rem; }
  .node-table .node-cell-secondary { display: none; }
  .node-table th, .node-table td { padding: .5rem .4rem; }
  .node-table thead th:first-child { width: 42%; }
  .node-table thead th:nth-child(6) { width: 35%; }
  .node-view-controls { width: 100%; }
  .node-view-search { flex: 1; min-width: 0; }
  .node-probe-value { gap: .25rem; }
}
