:root {
  --paper: #f3f4f6;
  --ink: #25252c;
  --muted: #85858f;
  --line: #e3e4e9;
  --green: #484174;
  --accent: #ee794a;
  --ok: #4e9a6f;
  --ok-bg: #e1eee5;
  --warn: #c78965;
  --warn-bg: #ffe7d9;
  --bad: #c95858;
  --bad-bg: #fce6e6;
  --card: #ffffff;
  --card-soft: #f8f8fa;
  --room: #e8e1f3;
  --room-ink: #393044;
  --shadow: 0 5px 24px #26233508;
  --sans: system-ui, -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --serif: Georgia, 'Songti SC', serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

:root[data-theme="dark"] {
  --paper: #17181d;
  --ink: #eaeaf0;
  --muted: #9c9da9;
  --line: #32333e;
  --green: #c1adee;
  --accent: #f69b6c;
  --ok: #92b29c;
  --ok-bg: #2b3d32;
  --warn: #e1a077;
  --warn-bg: #47352b;
  --bad: #e38b8b;
  --bad-bg: #42272a;
  --card: #22232b;
  --card-soft: #292a34;
  --room: #393146;
  --room-ink: #f4eafb;
  --shadow: 0 8px 30px #00000028;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, a, input { transition: background .2s, color .2s, border-color .2s, transform .2s; }
button { font-family: inherit; cursor: pointer; }

.site-header {
  max-width: 1392px;
  min-height: 86px;
  margin: 0 auto;
  padding: 0 36px;
  display: flex;
  align-items: center;
  gap: 30px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  font-size: 20px;
  font-weight: 850;
  letter-spacing: -.8px;
  gap: 5px;
  white-space: nowrap;
}
.brand-symbol {
  width: 31px;
  height: 31px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  line-height: 24px;
  letter-spacing: -4px;
  display: inline-block;
  position: relative;
  padding-left: 6px;
  margin-right: 7px;
  transform: rotate(-5deg);
}
.brand-symbol > span {
  font: 15px var(--sans);
  position: absolute;
  right: 1px;
  top: 0;
  line-height: 15px;
}
.brand-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  margin-top: 12px;
}
.site-header nav {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-right: auto;
}
.site-header nav a {
  padding: 6px 17px;
  border-radius: 9px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.site-header nav a:hover { background: var(--card); color: var(--ink); }
.site-header nav a.active { background: var(--ink); color: var(--paper); }

.theme-toggle {
  width: 34px;
  height: 34px;
  background: transparent;
  border: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  color: var(--ink);
}
.theme-toggle:hover { background: var(--card); }

.world-shell {
  max-width: 1320px;
  width: calc(100% - 72px);
  margin: 0 auto;
  padding-bottom: 36px;
}
.world-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 1.6px;
  padding: 6px 2px 16px;
}
.world-topline > span:first-child { display: flex; align-items: center; gap: 8px; }
.world-topline i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  background: var(--muted);
}
.world-topline i.is-live { background: #66a780; box-shadow: 0 0 0 4px #66a78028; }
.world-topline i.is-warn { background: var(--accent); }

.status-hero {
  position: relative;
  border-radius: 22px;
  background: var(--room);
  color: var(--room-ink);
  padding: 32px 36px;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  overflow: hidden;
}
.status-hero::before {
  content: '';
  position: absolute;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  border: 1px solid #ffffff45;
  right: 40px;
  top: -70px;
  pointer-events: none;
}
.status-hero::after {
  content: '';
  position: absolute;
  width: 440px;
  height: 440px;
  border-radius: 50%;
  border: 1px solid #ffffff35;
  right: -30px;
  top: -120px;
  pointer-events: none;
}
.hero-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  display: inline-flex;
  gap: 10px;
  align-items: center;
}
.hero-kicker > span { font-size: 18px; color: #8e78ac; }
.hero-copy h1 {
  font-size: clamp(32px, 3.6vw, 50px);
  font-weight: 850;
  letter-spacing: -2.2px;
  line-height: 1.05;
  margin: 12px 0 8px;
}
.hero-copy h1 em { font-style: normal; position: relative; }
.hero-copy h1 em > span { position: absolute; font-size: 12px; top: 4px; right: -15px; letter-spacing: 0; }
.hero-tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  opacity: .75;
  margin: 0;
}

.hero-stats {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.stat-box {
  background: #ffffff75;
  border: 1px solid #ffffff85;
  border-radius: 14px;
  padding: 14px 18px;
}
:root[data-theme="dark"] .stat-box {
  background: #ffffff10;
  border-color: #ffffff1f;
}
.stat-box strong {
  display: block;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.6px;
  font-variant-numeric: tabular-nums;
}
.stat-box span {
  display: block;
  font-size: 11px;
  opacity: .72;
  margin-top: 2px;
}

.controls-bar {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-pills button {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 9px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 550;
}
.filter-pills button:hover { color: var(--ink); border-color: #b7a4c6; }
.filter-pills button.selected {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.search-box input {
  width: 240px;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 9px;
  padding: 8px 13px;
  font-size: 12px;
  outline: none;
}
.search-box input:focus { border-color: var(--green); }

.node-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.node-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.node-card:hover {
  transform: translateY(-3px);
  border-color: #b7a4c6;
}
.node-card.is-offline { opacity: .72; }

.node-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.node-title-wrap { min-width: 0; }
.node-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.3px;
}
.node-title span.node-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.node-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ok-bg);
  color: var(--ok);
}
.status-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-pill.is-offline { background: var(--bad-bg); color: var(--bad); }

.node-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.node-tag {
  font-size: 10px;
  color: var(--muted);
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
}

.metrics-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.metric-row { display: flex; flex-direction: column; gap: 5px; }
.metric-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.metric-label span:first-child { color: var(--muted); }
.metric-label strong { font-weight: 650; }
.bar-track {
  height: 6px;
  border-radius: 999px;
  background: var(--card-soft);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--green);
  transition: width .35s ease;
}
.bar-fill.is-warn { background: var(--warn); }
.bar-fill.is-bad { background: var(--bad); }

.node-foot {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.net-item small {
  display: block;
  font-size: 10px;
  color: var(--muted);
}
.net-item strong { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.node-uptime {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.empty-state {
  grid-column: 1 / -1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.site-footer {
  margin-top: 44px;
  border-top: 1px solid var(--line);
  padding: 26px 4px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.site-footer p {
  font-size: 11px;
  color: var(--muted);
  margin: 4px 0 0;
}
.footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.footer-links a:hover { color: var(--ink); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: #10101875;
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  width: 100%;
  max-width: 880px;
  max-height: 88vh;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 60px #00000038;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.eyebrow {
  display: block;
  font-size: 9px;
  letter-spacing: 1.6px;
  color: var(--muted);
  font-weight: 700;
}
.modal-header h2 {
  margin: 2px 0 0;
  font-size: 20px;
  font-weight: 750;
}
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hours-switch {
  display: inline-flex;
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
}
.hours-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
}
.hours-switch button.selected { background: var(--ink); color: var(--paper); }
.close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--ink);
  font-size: 14px;
}
.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.spec-item {
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.spec-item small { display: block; font-size: 10px; color: var(--muted); }
.spec-item strong {
  display: block;
  font-size: 12px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-panel {
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}
.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.chart-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.chart-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-item i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chart-svg { width: 100%; height: 170px; display: block; }

.ping-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 12px;
  font-variant-numeric: tabular-nums;
}
.ping-table th, .ping-table td {
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
}
.ping-table th { color: var(--muted); font-weight: 600; font-size: 11px; border-top: 0; }

@media (max-width: 1100px) {
  .node-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-hero { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .site-header { padding: 0 18px; gap: 14px; flex-wrap: wrap; min-height: auto; padding-top: 14px; }
  .site-header nav { order: 3; width: 100%; padding-bottom: 10px; overflow-x: auto; }
  .world-shell { width: calc(100% - 32px); }
  .node-grid { grid-template-columns: 1fr; }
  .spec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-hero { padding: 24px 20px; }
}
