:root {
  --ground: #121316;
  --surface: #0d0e11;
  --raised: #181a1f;
  --border: #22252c;
  --rule: #191b20;
  --text: #f3f4f6;
  --muted: #8a8f98;
  --dim: #6e7681;
  --accent: #4a8ad6;
  --positive: #3ecf8e;
  --warning: #f5a623;
  --negative: #e5566f;
  --pill-pos-bg: rgba(62, 207, 142, 0.12);
  --pill-pos-ink: #3ecf8e;

  /* Backward-compatible aliases for legacy selectors */
  --bg: #121316;
  --bg2: #0d0e11;
  --surface2: #181a1f;
  --line: #22252c;
  --line2: #2d323e;
  --matrix: #3ecf8e;
  --matrix-dim: #4a8ad6;
  --matrix-dark: rgba(62, 207, 142, 0.12);
  --amber: #f5a623;
  --cyan: #4a8ad6;
  --sans: 'Public Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }

body {
  background: var(--ground);
  color: var(--text);
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  min-height: 100svh;
  line-height: 1.6;
  overflow-x: hidden;
}

::selection { background: rgba(74, 138, 214, 0.3); color: #fff; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: #2d3139; border-radius: 3px; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--positive); text-decoration: none; }

#rain, .veil { display: none !important; }

/* =========================================================================
   TOP LIVE TELEMETRY STATUS BAR (Global across all pages)
   ========================================================================= */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 14, 17, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 8px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11.5px;
}
.top-bar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  flex-wrap: wrap;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--positive);
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(62, 207, 142, 0.7);
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(62, 207, 142, 0.65); }
  70% { box-shadow: 0 0 0 7px rgba(62, 207, 142, 0); }
  100% { box-shadow: 0 0 0 0 rgba(62, 207, 142, 0); }
}
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sim-btn {
  appearance: none;
  background: var(--raised);
  border: 1px solid #323640;
  color: var(--text);
  padding: 5px 11px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sim-btn:hover, .sim-btn.active {
  border-color: var(--accent);
  color: #fff;
  text-decoration: none;
}
.sim-btn.contact-btn {
  background: rgba(62, 207, 142, 0.14);
  border-color: var(--positive);
  color: var(--positive);
  font-weight: 600;
}
.sim-btn.contact-btn:hover {
  background: var(--positive);
  color: #090a0c;
}

/* =========================================================================
   54PX ICON RAIL + SRE CONTROL PLANE SHELL
   ========================================================================= */
.sre-shell {
  display: grid;
  grid-template-columns: 54px 1fr;
  min-height: calc(100svh - 42px);
}
@media (max-width: 768px) {
  .sre-shell { grid-template-columns: 1fr; }
  .sre-rail { display: none; }
}
.sre-rail {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 18px;
  position: sticky;
  top: 42px;
  height: calc(100svh - 42px);
}
.sre-mark {
  width: 32px;
  height: 32px;
  border: 1px solid var(--accent);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  text-decoration: none;
}
.sre-rail-item {
  width: 36px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-decoration: none;
  position: relative;
  transition: color 0.15s ease;
}
.sre-rail-item:hover, .sre-rail-item.active {
  color: var(--text);
  text-decoration: none;
}
.sre-rail-item.active::before {
  content: '';
  position: absolute;
  left: -9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--accent);
}

.sre-main {
  padding: 26px 34px 64px;
  max-width: 1320px;
  width: 100%;
}
@media (max-width: 768px) { .sre-main { padding: 18px 14px 48px; } }

/* =========================================================================
   COMPACT LIVE SERVER MONITORING STRIP (Subpages)
   ========================================================================= */
.sub-telemetry-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: 280px 1fr 260px;
  gap: 18px;
  align-items: center;
}
@media (max-width: 980px) {
  .sub-telemetry-strip { grid-template-columns: 1fr; gap: 12px; }
}
.sub-tel-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}
.sub-tel-meta strong {
  color: var(--text);
  display: block;
  font-size: 12px;
  margin-bottom: 2px;
}
.sub-canvas-wrap {
  height: 46px;
  background: #08090c;
  border: 1px solid #1b1d24;
  border-radius: 4px;
  overflow: hidden;
}
#subSreChart {
  width: 100%;
  height: 100%;
  display: block;
}
.sub-tel-gauges {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
}
.sub-gauge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.sub-gauge-bar {
  flex: 1;
  height: 5px;
  background: #181a20;
  border-radius: 2px;
  overflow: hidden;
}
.sub-gauge-fill {
  height: 100%;
  background: var(--positive);
  transition: width 0.5s ease;
}

/* =========================================================================
   SHARED COMPONENTS (Pills, Panels, Tables, Footer)
   ========================================================================= */
.sre-pill {
  background: var(--pill-pos-bg);
  color: var(--pill-pos-ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(62, 207, 142, 0.25);
  display: inline-block;
}
.sre-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 20px;
}
.sre-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--rule);
}
.sre-panel-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.sre-footer {
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}
.sre-footer a { color: var(--muted); text-decoration: none; }
.sre-footer a:hover { color: var(--text); }
