:root {
  color-scheme: dark;
  --bg: #080812;
  --bg-lift: #121127;
  --panel: #111225;
  --panel-strong: #181938;
  --text: #f7f8ff;
  --muted: #b8bed8;
  --line: rgba(247, 248, 255, 0.14);
  --blue: #7292cb;
  --violet: #715ea9;
  --blue-soft: #9eb8ee;
  --violet-soft: #9b86dc;
  --red: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 22% 16%, rgba(114, 146, 203, 0.28), transparent 32rem),
    radial-gradient(circle at 82% 10%, rgba(113, 94, 169, 0.22), transparent 30rem),
    linear-gradient(135deg, #080812 0%, #111225 54%, #080812 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

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

.hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 34px;
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  letter-spacing: 0;
}

.brand-logo {
  display: block;
  width: auto;
  height: 93px;
  object-fit: contain;
  filter: drop-shadow(0 0 24px rgba(114, 146, 203, 0.34));
}

.brand-logo-full {
  max-width: min(540px, 76vw);
}

.hero-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  align-items: center;
  gap: 48px;
  padding-top: 20px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--blue-soft);
  font-weight: 800;
}

.primary-meter {
  display: grid;
  justify-items: center;
  gap: 22px;
  order: 0;
}

.ring {
  width: min(320px, 78vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--panel) 0 54%, transparent 55%),
    conic-gradient(var(--blue) 0deg, var(--violet) var(--progress, 0deg), rgba(247, 248, 255, 0.12) 0);
  box-shadow: inset 0 0 0 1px var(--line), 0 24px 80px rgba(0, 0, 0, 0.34);
}

.ring > div {
  width: 70%;
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  text-align: center;
  border-radius: 50%;
  background: rgba(8, 8, 18, 0.88);
  border: 1px solid var(--line);
}

.ring span,
.ring small,
.metric span,
.metric small,
.details span {
  color: var(--muted);
}

.ring strong {
  display: block;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
}

.ring-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  align-items: center;
  margin: 12px 0 4px;
}

.ring-results div {
  min-width: 0;
}

.start {
  width: 190px;
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  color: #080812;
  background: linear-gradient(135deg, var(--blue), var(--violet-soft));
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 34px rgba(114, 146, 203, 0.28);
}

.start:disabled {
  cursor: wait;
  opacity: 0.72;
}

.results {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 0 10px;
}

.metric,
.details {
  background: rgba(17, 18, 37, 0.78);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.metric {
  min-height: 84px;
  padding: 16px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
}

.metric strong {
  grid-column: 2;
  grid-row: 1;
  font-size: 1.05rem;
  line-height: 1;
  text-align: right;
}

.metric small {
  grid-column: 2;
  grid-row: 3;
  align-self: start;
  font-size: 0.72rem;
  text-align: right;
}

.metric-rail {
  grid-column: 1 / -1;
  height: 16px;
  border-radius: 999px;
  background: rgba(247, 248, 255, 0.08);
  overflow: hidden;
}

.metric-rail i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--violet-soft));
}

.latency-rail i {
  background: linear-gradient(90deg, var(--blue-soft), var(--violet));
}

.accent-download {
  border-top: 3px solid var(--blue);
}

.accent-upload {
  border-top: 3px solid var(--violet);
}

.details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border-radius: 8px;
  overflow: hidden;
}

.details div {
  min-width: 0;
  padding: 18px;
  background: rgba(8, 8, 18, 0.38);
}

.details strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.latency-profile {
  padding-top: 22px;
}

.section-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.section-bar .eyebrow {
  margin: 0;
}

.section-bar h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.info-toggle {
  max-width: 430px;
  color: var(--muted);
}

.info-toggle summary {
  width: fit-content;
  margin-left: auto;
  color: var(--blue-soft);
  cursor: pointer;
  font-weight: 800;
  list-style-position: inside;
}

.info-toggle p {
  margin: 8px 0 0;
  line-height: 1.45;
}

.latency-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.latency-card {
  min-height: 130px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 18, 37, 0.78);
  backdrop-filter: blur(18px);
  cursor: help;
}

.latency-card > span,
.latency-card small,
.latency-card dt {
  color: var(--muted);
}

.latency-card strong {
  display: block;
  margin: 12px 0 2px;
  font-size: clamp(1.6rem, 2.7vw, 2.2rem);
  line-height: 1;
}

.latency-track {
  position: relative;
  height: 34px;
  margin-top: 14px;
  border-radius: 999px;
  background: rgba(247, 248, 255, 0.08);
  overflow: hidden;
}

.latency-track i,
.latency-track b,
.latency-track em {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.latency-track i {
  left: 0;
  width: 0%;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--violet-soft));
}

.latency-track b {
  left: 0%;
  width: 3px;
  height: 24px;
  border-radius: 999px;
  background: var(--text);
  box-shadow: 0 0 18px rgba(247, 248, 255, 0.35);
}

.latency-track em {
  left: 0%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue-soft);
  box-shadow: 0 0 12px rgba(114, 146, 203, 0.42);
}

.duplex {
  padding-top: 22px;
}

.duplex-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 18, 37, 0.78);
  backdrop-filter: blur(18px);
}

.duplex-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 84px;
  gap: 14px;
  align-items: center;
}

.duplex-row span {
  color: var(--muted);
}

.duplex-row strong {
  text-align: right;
}

.duplex-track {
  height: 22px;
  border-radius: 999px;
  background: rgba(247, 248, 255, 0.08);
  overflow: hidden;
}

.duplex-track i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--violet-soft));
}

.retention-track i {
  background: linear-gradient(90deg, var(--violet), var(--blue-soft));
}

.chart-panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 18, 37, 0.78);
  backdrop-filter: blur(18px);
}

.hero-chart {
  padding: 18px 18px 16px;
  order: 1;
}

.chart-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.chart-title span,
.chart-legend span {
  color: var(--muted);
}

.chart-title strong {
  white-space: nowrap;
}

#speedTrace {
  display: block;
  width: 100%;
  height: 300px;
  cursor: crosshair;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 10px 0 14px;
  font-size: 0.9rem;
}

.chart-legend strong {
  margin-left: auto;
}

.chart-legend i {
  display: inline-block;
  width: 18px;
  height: 3px;
  margin-right: 7px;
  vertical-align: middle;
  border-radius: 999px;
}

.legend-download {
  background: var(--blue);
}

.legend-upload {
  background: var(--violet-soft);
}

.inline-bands {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.sample-bands {
  display: grid;
  gap: 8px;
}

.band-group + .band-group {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.band-group h2 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 0.95rem;
}

.sample-band {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 62px;
  gap: 10px;
  align-items: center;
  cursor: help;
}

.sample-band span {
  color: var(--muted);
  font-weight: 800;
}

.band-track {
  position: relative;
  height: 24px;
  border-radius: 999px;
  background: rgba(247, 248, 255, 0.08);
  overflow: hidden;
}

.band-range,
.band-median,
.band-dot {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.band-range {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(114, 146, 203, 0.9), rgba(113, 94, 169, 0.9));
}

.band-median {
  width: 3px;
  height: 18px;
  border-radius: 999px;
  background: var(--text);
  box-shadow: 0 0 18px rgba(247, 248, 255, 0.35);
}

.band-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue-soft);
  box-shadow: 0 0 12px rgba(114, 146, 203, 0.42);
}

.band-value {
  text-align: right;
  font-weight: 900;
  font-size: 0.88rem;
}

.tooltip {
  position: fixed;
  z-index: 20;
  max-width: min(280px, calc(100vw - 24px));
  padding: 10px 12px;
  border: 1px solid rgba(247, 248, 255, 0.18);
  border-radius: 8px;
  color: var(--text);
  background: rgba(8, 8, 18, 0.94);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
  pointer-events: none;
  backdrop-filter: blur(14px);
}

.tooltip strong,
.tooltip span {
  display: block;
}

.tooltip strong {
  margin-bottom: 4px;
}

.tooltip span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

@media (max-width: 860px) {
  .hero-grid,
  .results,
  .details,
  .inline-bands {
    grid-template-columns: 1fr;
  }

  .latency-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-grid {
    padding-top: 54px;
  }

  .brand {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .primary-meter {
    justify-items: center;
    width: 100%;
  }

  .results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #speedTrace {
    height: 260px;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 24px, 1120px);
    padding-top: 18px;
  }

  .brand-logo {
    height: 69px;
  }

  .hero {
    min-height: auto;
  }

  .ring {
    width: min(300px, 78vw);
  }

  .chart-title,
  .chart-legend,
  .section-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-legend strong {
    margin-left: 0;
  }

  .results {
    grid-template-columns: 1fr;
  }

  .latency-grid,
  .duplex-row {
    grid-template-columns: 1fr;
  }

  .duplex-row strong {
    text-align: left;
  }
}
