:root {
  color-scheme: dark;
  --bg: #090b0f;
  --bg-elevated: #0d1016;
  --surface: rgba(17, 21, 29, 0.94);
  --surface-solid: #11151d;
  --surface-hover: #151a23;
  --text: #f7f8fa;
  --muted: #929aaa;
  --line: #252b36;
  --line-strong: #343c49;
  --red: #ef3f49;
  --red-bright: #ff5962;
  --red-dark: #b91f29;
  --red-soft: rgba(239, 63, 73, 0.11);
  --green: #2fd17b;
  --green-soft: rgba(47, 209, 123, 0.10);
  --amber: #f2b84b;
  --amber-soft: rgba(242, 184, 75, 0.10);
  --slate: #778196;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.30);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 10% -10%, rgba(239, 63, 73, 0.10), transparent 34rem),
    radial-gradient(circle at 100% 100%, rgba(185, 31, 41, 0.08), transparent 36rem),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

.background-glow {
  position: fixed;
  z-index: -1;
  width: 430px;
  height: 430px;
  border-radius: 999px;
  filter: blur(60px);
  opacity: 0.10;
  pointer-events: none;
}

.background-glow--one {
  top: -300px;
  left: -190px;
  background: var(--red);
}

.background-glow--two {
  right: -280px;
  bottom: -320px;
  background: var(--red-dark);
}

.page-shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 28px;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 30px;
}

.brand-logo {
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 26px rgba(239, 63, 73, 0.16));
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--red-bright);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 6px;
  font-size: clamp(1.75rem, 4vw, 2.45rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
}

.live-card,
.quality-card,
.metric-card,
.route-card,
.info-note {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.live-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 78px;
  padding: 18px 20px;
  border-radius: 18px;
}

.pulse-dot {
  position: relative;
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px rgba(47, 209, 123, 0.35);
}

.pulse-dot::after {
  position: absolute;
  inset: -6px;
  border: 1px solid currentColor;
  border-radius: inherit;
  color: var(--green);
  content: "";
  animation: pulse 1.8s infinite;
}

.pulse-dot.is-stopped,
.pulse-dot.is-stopped::after {
  background: var(--slate);
  color: var(--slate);
  box-shadow: none;
  animation: none;
}

.pulse-dot.is-error,
.pulse-dot.is-error::after {
  background: var(--red);
  color: var(--red);
  box-shadow: 0 0 18px rgba(239, 63, 73, 0.25);
  animation: none;
}

@keyframes pulse {
  0% { opacity: 0.8; transform: scale(0.55); }
  70%, 100% { opacity: 0; transform: scale(1.55); }
}

.live-copy {
  display: grid;
  flex: 1;
  min-width: 0;
}

.live-copy strong,
.live-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-copy span {
  color: var(--muted);
  font-size: 0.88rem;
}

.secondary-button {
  border: 1px solid rgba(239, 63, 73, 0.38);
  border-radius: 12px;
  background: var(--red-soft);
  color: #ffb8bd;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 750;
  padding: 10px 14px;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.secondary-button:hover {
  border-color: var(--red);
  background: rgba(239, 63, 73, 0.16);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  transform: translateY(-1px);
}

.quality-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding: 22px;
  border-radius: 18px;
  transition: background 180ms ease, border-color 180ms ease;
}

.quality-card h2 { margin-bottom: 3px; font-size: 1.15rem; }
.quality-card p { margin-bottom: 0; color: var(--muted); font-size: 0.9rem; }

.quality-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #171c25;
  color: var(--slate);
  font-weight: 900;
}

.quality-card--excellent,
.quality-card--good { border-color: rgba(47, 209, 123, 0.28); background: linear-gradient(135deg, var(--green-soft), var(--surface)); }
.quality-card--excellent .quality-icon,
.quality-card--good .quality-icon { border-color: transparent; background: var(--green); color: #07130c; }

.quality-card--warning,
.quality-card--inconclusive { border-color: rgba(242, 184, 75, 0.30); background: linear-gradient(135deg, var(--amber-soft), var(--surface)); }
.quality-card--warning .quality-icon,
.quality-card--inconclusive .quality-icon { border-color: transparent; background: var(--amber); color: #171006; }

.quality-card--bad { border-color: rgba(239, 63, 73, 0.34); background: linear-gradient(135deg, var(--red-soft), var(--surface)); }
.quality-card--bad .quality-icon { border-color: transparent; background: var(--red); color: #fff; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.metric-card {
  min-width: 0;
  padding: 20px;
  border-radius: 17px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.metric-card:hover {
  border-color: var(--line-strong);
  background: var(--surface-solid);
  transform: translateY(-1px);
}

.metric-label,
.metric-card small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.metric-value {
  display: block;
  margin: 7px 0 2px;
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.route-card {
  margin-top: 16px;
  overflow: hidden;
  border-radius: 20px;
}

.route-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.route-heading h2 { margin-bottom: 0; font-size: 1.15rem; }


.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 0.84rem;
}

th, td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  color: #80899a;
  background: rgba(10, 12, 17, 0.50);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.02em;
}

th:nth-child(1), td:nth-child(1),
th:nth-child(2), td:nth-child(2),
th:nth-child(3), td:nth-child(3) { text-align: left; }

tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 140ms ease; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }

.hop-number { color: #737d90; }
.hop-host { color: #dce1e8; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 650; }
.hop-host--muted { color: #656e7e; font-weight: 500; }
.destination-tag {
  display: inline-flex;
  margin-left: 8px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-family: inherit;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 3px 7px;
  vertical-align: middle;
}

.loss-cell { min-width: 130px; }
.loss-wrap { display: flex; align-items: center; gap: 9px; }
.loss-value { min-width: 37px; font-weight: 800; }
.loss-bar { width: 64px; height: 5px; overflow: hidden; border-radius: 99px; background: #272d38; }
.loss-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.loss-wrap.is-warning .loss-value { color: var(--amber); }
.loss-wrap.is-warning .loss-bar > span { background: var(--amber); }
.loss-wrap.is-bad .loss-value { color: var(--red-bright); }
.loss-wrap.is-bad .loss-bar > span { background: var(--red); }
.filtered-label { color: var(--amber); font-size: 0.68rem; font-weight: 750; }

.empty-row td {
  padding: 40px 20px;
  color: var(--muted);
  text-align: center !important;
}

.info-note {
  margin-top: 16px;
  padding: 17px 20px;
  border-radius: 16px;
  color: var(--muted);
  font-size: 0.84rem;
}

.info-note strong { color: var(--text); }

footer {
  display: flex;
  justify-content: center;
  gap: 7px;
  padding-top: 25px;
  color: #697284;
  font-size: 0.78rem;
}

@media (max-width: 820px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .route-heading { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
  .page-shell { width: min(100% - 22px, 1100px); padding-top: 24px; }
  .brand-header { align-items: flex-start; }
  .brand-logo { width: 60px; height: 60px; }
  .live-card { align-items: flex-start; flex-wrap: wrap; }
  .secondary-button { width: 100%; }
  .metrics-grid { gap: 10px; }
  .metric-card { padding: 16px; }
  .quality-card { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.route-status {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}
