@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap");

:root {
  color-scheme: dark;
  --bg: #07111f;
  --card: rgba(15, 29, 48, 0.82);
  --line: rgba(159, 187, 218, 0.12);
  --text: #f2f7fc;
  --muted: #8d9db1;
  --mint: #63e6be;
  --blue: #55b9ff;
  --purple: #9b87f5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 0%, rgba(52, 122, 169, 0.18), transparent 35rem),
    radial-gradient(circle at 90% 35%, rgba(112, 80, 180, 0.12), transparent 32rem),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.shell {
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 42px;
}

.topbar, .brand, .connection-state, .details, .metric { display: flex; align-items: center; }
.topbar { justify-content: space-between; gap: 20px; }
.brand { gap: 10px; color: var(--text); text-decoration: none; font: 800 25px "Manrope", sans-serif; letter-spacing: -1px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(99, 230, 190, 0.45);
  border-radius: 10px;
  background: rgba(99, 230, 190, 0.08);
}

.brand-mark span { width: 10px; height: 10px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 18px var(--mint); }
.connection-state { gap: 8px; color: var(--muted); font-size: 13px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 10px rgba(99, 230, 190, 0.7); }
.connection-state.testing .status-dot { animation: pulse 1.2s infinite; }

.hero { padding: 64px 0 34px; text-align: center; }
.eyebrow { margin: 0 0 13px; color: var(--mint); font-size: 11px; font-weight: 700; letter-spacing: 2.3px; }
.hero h1 { margin: 0; font: 700 clamp(34px, 6vw, 55px)/1.12 "Manrope", sans-serif; letter-spacing: -2.4px; }
.subtitle { margin: 17px auto 0; color: var(--muted); font-size: 16px; line-height: 1.6; }

.test-card {
  position: relative;
  overflow: hidden;
  padding: 20px 40px 32px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(18px);
}

.test-card::before {
  content: "";
  position: absolute;
  width: 300px;
  height: 180px;
  top: -130px;
  left: calc(50% - 150px);
  background: rgba(85, 185, 255, 0.16);
  filter: blur(55px);
  pointer-events: none;
}

.gauge-wrap { position: relative; width: min(100%, 440px); margin: 0 auto; }
.gauge { display: block; width: 100%; overflow: visible; }
.gauge path { fill: none; stroke-width: 11; stroke-linecap: round; }
.gauge-track { stroke: rgba(154, 181, 211, 0.1); }
.gauge-progress { stroke: url(#gaugeGradient); stroke-dasharray: 390; stroke-dashoffset: 390; transition: stroke-dashoffset 180ms linear; filter: drop-shadow(0 0 7px rgba(85, 185, 255, 0.42)); }

.speed-readout { position: absolute; inset: 49% 0 auto; text-align: center; }
.speed-readout > span { color: var(--muted); font-size: 13px; }
.speed-readout > div { display: flex; align-items: baseline; justify-content: center; gap: 9px; margin-top: 2px; }
.speed-readout strong { min-width: 80px; font: 700 clamp(50px, 9vw, 68px)/1.1 "Manrope", sans-serif; letter-spacing: -4px; }
.speed-readout > div > span { color: #b0bdca; font-size: 14px; }
.speed-readout p { margin: 8px 20px 0; color: #718399; font-size: 11px; }

.start-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 190px;
  height: 52px;
  margin: -2px auto 0;
  border: 0;
  border-radius: 15px;
  color: #071721;
  background: linear-gradient(115deg, var(--mint), #78d9f7);
  box-shadow: 0 10px 32px rgba(99, 230, 190, 0.18);
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms, box-shadow 160ms, opacity 160ms;
}

.start-button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(99, 230, 190, 0.27); }
.start-button:active:not(:disabled) { transform: translateY(0); }
.start-button:focus-visible, .secondary-button:focus-visible { outline: 3px solid rgba(85, 185, 255, 0.5); outline-offset: 3px; }
.start-button:disabled { cursor: wait; opacity: 0.68; }
.start-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.progress-track { height: 2px; margin: 25px 0; overflow: hidden; background: rgba(154, 181, 211, 0.08); }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--mint), var(--blue)); transition: width 250ms ease; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric { position: relative; gap: 11px; min-width: 0; padding: 17px 14px; border: 1px solid transparent; border-radius: 16px; background: rgba(255, 255, 255, 0.025); transition: border-color 200ms, background 200ms; }
.metric.active { border-color: rgba(85, 185, 255, 0.25); background: rgba(85, 185, 255, 0.055); }
.metric-icon { display: grid; flex: 0 0 auto; place-items: center; width: 34px; height: 34px; border-radius: 10px; }
.metric-icon svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.download-icon { color: var(--mint); background: rgba(99, 230, 190, 0.09); }
.upload-icon { color: var(--blue); background: rgba(85, 185, 255, 0.09); }
.latency-icon { color: #f4c76b; background: rgba(244, 199, 107, 0.09); }
.jitter-icon { color: var(--purple); background: rgba(155, 135, 245, 0.09); }
.metric p { margin: 0 0 2px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.metric strong { font: 700 21px "Manrope", sans-serif; letter-spacing: -0.7px; }
.metric > span { align-self: flex-end; margin: 0 0 3px auto; color: #718399; font-size: 9px; }

.summary { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 18px; padding: 25px 28px; border: 1px solid rgba(99, 230, 190, 0.18); border-radius: 20px; background: rgba(99, 230, 190, 0.045); }
.summary h2 { margin: 0 0 7px; font: 700 21px "Manrope", sans-serif; letter-spacing: -0.6px; }
.summary p:last-child { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.secondary-button { flex: 0 0 auto; padding: 11px 17px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: rgba(255, 255, 255, 0.04); font-size: 13px; cursor: pointer; }
.secondary-button:hover { background: rgba(255, 255, 255, 0.08); }

.details { justify-content: space-around; gap: 20px; margin-top: 24px; padding: 0 16px; }
.details div { min-width: 0; text-align: center; }
.details span, .details strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.details span { margin-bottom: 5px; color: #63758a; font-size: 10px; letter-spacing: 0.8px; text-transform: uppercase; }
.details strong { max-width: 240px; color: #a8b7c7; font-size: 12px; font-weight: 500; }
.privacy-note { margin: 25px 0 0; color: #536579; font-size: 11px; text-align: center; }
.error-message { margin: 16px 0 0; padding: 12px 16px; border: 1px solid rgba(255, 123, 123, 0.2); border-radius: 10px; color: #ffaaaa; background: rgba(255, 100, 100, 0.06); font-size: 13px; text-align: center; }

@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.8); } }

@media (max-width: 720px) {
  .shell { width: min(100% - 24px, 920px); padding-top: 20px; }
  .hero { padding: 44px 0 26px; }
  .hero h1 { letter-spacing: -1.5px; }
  .test-card { padding: 14px 16px 20px; border-radius: 22px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric { padding: 14px; }
  .summary { align-items: flex-start; flex-direction: column; padding: 22px; }
  .details { justify-content: space-between; padding: 0; }
  .details strong { max-width: 150px; }
}

@media (max-width: 420px) {
  .connection-state { font-size: 0; }
  .hero { padding-top: 36px; }
  .subtitle { font-size: 14px; }
  .speed-readout p { font-size: 10px; }
  .metric { gap: 8px; padding: 12px 10px; }
  .metric-icon { display: none; }
  .metric strong { font-size: 20px; }
  .details { gap: 8px; }
  .details strong { max-width: 105px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}