:root {
  color-scheme: dark;
  --bg: #101618;
  --surface: #192124;
  --surface-raised: #1d2729;
  --line: #334044;
  --text: #eef4f3;
  --muted: #a6b6b8;
  --green: #a1e5b3;
  --gold: #f3c486;
  --red: #ffb0a5;
  --blue: #a3cafa;
  --active-bg: #1b2c26;
  --active-line: #527a61;
  --button-text: #173520;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-synthesis: none;
}
* { box-sizing: border-box }
body { margin: 0; min-height: 100vh }
[hidden] { display: none !important }
button, input { font: inherit }
button { cursor: pointer }
button:disabled { cursor: default }
button:focus-visible, input:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px }
.topbar { border-bottom: 1px solid var(--line) }
.topbar-inner, main { width: min(1120px, calc(100% - 64px)); margin-inline: auto }
.topbar-inner { height: 72px; display: flex; justify-content: space-between; align-items: center }
.brand { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 690; letter-spacing: -.6px }
.brand-mark { display: inline-flex; gap: 3px; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--green); transform: rotate(0) }
.brand-mark i { width: 3px; height: 8px; border-radius: 4px; background: var(--button-text) }
.brand-mark i:nth-child(2) { height: 17px }
.brand-mark i:last-child { height: 12px }
.brand-separator { height: 18px; border-left: 1px solid var(--line); margin: 0 2px }
.brand-context, .quiet { font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--muted) }
.quiet, .text-button { background: transparent; border: 0; padding: 8px 0 }
.quiet:hover, .text-button:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px }
main { padding: clamp(32px, 5vw, 65px) 0 64px }
h1, h2, h3, p, dl, dd { margin: 0 }
h1 { font-size: clamp(38px, 5.2vw, 60px); line-height: 1.03; font-weight: 580; letter-spacing: -.062em }
h2 { font-size: 20px; font-weight: 570; line-height: 1.2; letter-spacing: -.045em }
h3 { font-size: 21px; font-weight: 570; letter-spacing: -.045em; overflow-wrap: anywhere }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 12px/1.4 var(--mono); color: var(--muted); margin: 0 0 13px }
.node-dot { width: 7px; height: 7px; background: var(--green); border-radius: 50%; display: inline-block }
.page-heading, .panel-heading, .route-heading, .metric-row, .updates { display: flex; justify-content: space-between; align-items: center; gap: 12px }
.page-heading { align-items: flex-end; margin-bottom: 27px }
.updates { font-size: 12px; color: var(--muted); flex-wrap: wrap; gap: 14px }
.updates .quiet { color: var(--text); border: 1px solid var(--line); padding: 8px 12px; border-radius: 7px }
.routes { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px }
.route, .panel, .auth-panel { border: 1px solid var(--line); border-radius: 13px; background: var(--surface) }
.route { min-width: 0; padding: clamp(17px,2.1vw,25px); display: flex; flex-direction: column }
.route.selected { background: var(--active-bg); border-color: var(--active-line) }
.route-heading { align-items: baseline; flex-wrap: wrap; gap: 5px 12px }
.badge { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px }
.badge::before { content: ''; width: 6px; height: 6px; background: var(--muted); border-radius: 50% }
.badge.ok::before { background: var(--green) }
.badge.bad { color: var(--red) }
.badge.bad::before { background: var(--red) }
.route-ip, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums }
.route-ip { color: var(--muted); margin: 8px 0 25px; font-size: 12px }
.metric { font: 500 clamp(31px,3.8vw,48px)/1 var(--mono); letter-spacing: -.08em; white-space: nowrap }
.metric small { font: 14px/1.2 var(--mono); letter-spacing: -.04em; color: var(--muted); padding-left: 6px }
.metric-row { gap: 6px; align-items: baseline; margin-bottom: 13px }
.metric-label { color: var(--muted); font-size: 12px }
.probe-result { display: grid; gap: 6px; color: var(--muted); font-size: 12px; margin-bottom: 20px }
.route button, .primary { border: 1px solid var(--line); border-radius: 7px; min-height: 41px; font-size: 14px; font-weight: 590; padding: 8px 12px }
.route button { margin-top: auto; width: 100%; color: var(--text); background: transparent }
.route button:not(:disabled):hover { background: var(--surface-raised); border-color: var(--muted) }
.route button:disabled { color: var(--muted) }
.route.selected button { color: var(--green); border-color: var(--active-line) }
.route-help { font-size: 13px; line-height: 1.5; color: var(--muted); margin-top: 12px }
.detail-grid { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(280px,1fr); gap: 14px; margin-top: 25px }
.panel { padding: clamp(18px,2.3vw,26px); min-width: 0 }
.period { font: 12px var(--mono); color: var(--muted) }
.sub, .muted, .form-help { color: var(--muted); font-size: 13px; line-height: 1.5 }
.sub { margin-top: 5px }
.plot { position: relative; margin-top: 16px; height: 162px }
.plot canvas { display: block; width: 100%; height: 100% }
#chart-empty { color: var(--muted); text-align: center; position: absolute; inset: 44% 0 auto; font-size: 13px }
.legend { display: flex; flex-wrap: wrap; gap: 7px 17px; margin-top: 10px }
.legend-item { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 6px }
.legend-swatch { display: inline-block; width: 14px; height: 3px; border-radius: 3px; background: var(--green) }
.legend-item[data-route="old"] .legend-swatch { background: var(--blue) }
.legend-item[data-route="hostkey"] .legend-swatch { background: var(--gold) }
.stats { margin-top: 15px }
.stats div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line) }
.stats dt { font-size: 13px; color: var(--muted) }
.stats dd { font: 500 16px var(--mono); white-space: nowrap }
.stats-note { font-size: 11px; color: var(--muted); line-height: 1.4; margin-top: 3px }
.auth-panel { width: min(460px,100%); margin: 5vh auto 0; padding: clamp(22px,4vw,36px) }
.auth-panel h1 { font-size: clamp(34px,4vw,44px); margin-bottom: 12px }
.auth-panel form { margin-top: 22px }
.auth-panel label { font-size: 14px; font-weight: 600 }
.auth-panel input { display: block; width: 100%; margin: 13px 0; padding: 11px 12px; color: var(--text); border: 1px solid var(--line); border-radius: 7px; background: var(--bg) }
.form-help { margin-top: 7px }
.command { display: block; font: 12px/1.6 var(--mono); overflow-wrap: anywhere; margin: 7px 0; user-select: all }
.primary { display: flex; justify-content: space-between; align-items: center; width: 100%; color: var(--button-text); background: var(--green); border-color: var(--green) }
.primary:disabled { opacity: .65 }
.text-button { margin-top: 12px; font-size: 13px; color: var(--muted) }
.error { border: 1px solid #81534c; border-radius: 7px; padding: 10px 12px; color: var(--red); font-size: 13px; line-height: 1.4; margin: 12px 0 }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%) }
#loading { color: var(--muted) }
@media (max-width: 820px) {
  .detail-grid { grid-template-columns: 1fr }
  .routes { gap: 9px }
  .metric-row { align-items: flex-start; flex-direction: column }
  .stats { display: grid; grid-template-columns: repeat(2,1fr); gap: 0 24px }
}
@media (max-width: 635px) {
  .topbar-inner, main { width: calc(100% - 32px) }
  .topbar-inner { height: 58px }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 14px }
  .routes { grid-template-columns: 1fr }
  .route { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 0 12px; }
  .route-heading { grid-column: 1/2; grid-row: 1; align-items: baseline; justify-content: flex-start }
  .route-ip { grid-row: 2; grid-column: 1/2; margin: 5px 0 12px }
  .metric-row { grid-column: 2; grid-row: 1 / span 2; align-items: flex-end; gap: 4px; margin: 0 }
  .metric-label { font-size: 11px }
  .probe-result { grid-column: 1; grid-row: 3; margin: 0; align-self: end; gap: 4px; font-size: 11px }
  .route button { grid-column: 2; grid-row: 3; padding-inline: 9px; font-size: 12px; min-height: 36px }
  .detail-grid { margin-top: 16px }
  .stats { display: block }
}
@media (prefers-color-scheme: light) {
  :root { color-scheme: light; --bg: #f4f6f3; --surface: #fff; --surface-raised: #eef3ef; --line: #cfdad3; --text: #18251f; --muted: #55665d; --green: #397348; --active-bg: #eaf3e9; --active-line: #80a58a; --blue: #345f94; --gold: #9c610e; --red: #963c32; --button-text: #fff }
}
