:root {
  --bg: #07111f;
  --surface: #0c1a2d;
  --surface-2: #10233a;
  --border: rgba(157, 184, 216, .15);
  --text: #f4f8fc;
  --muted: #92a8bf;
  --cyan: #29d5e8;
  --blue: #397cff;
  --green: #36d399;
  --purple: #ad7aff;
}

* { box-sizing: border-box; }

html { color-scheme: dark; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 16%, rgba(27, 117, 176, .18), transparent 34rem),
    linear-gradient(180deg, #07111f 0%, #081421 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, a { font: inherit; }

.topbar {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 19px;
  font-weight: 750;
  text-decoration: none;
  letter-spacing: -.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #04111b;
  font-size: 13px;
  font-weight: 900;
}

.server-pill {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  background: rgba(9, 24, 40, .65);
}

.server-pill i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

main { width: min(1040px, calc(100% - 40px)); margin: 0 auto; }

.hero { text-align: center; padding: 48px 0 27px; }
.eyebrow { margin: 0 0 12px; color: var(--cyan); font-size: 11px; font-weight: 800; letter-spacing: .17em; }
.hero h1 { margin: 0; font-size: clamp(34px, 5.5vw, 62px); line-height: 1.06; letter-spacing: -.05em; }
.hero h1 span { color: var(--cyan); }
.subtitle { max-width: 620px; margin: 18px auto 0; color: var(--muted); font-size: clamp(15px, 2vw, 18px); line-height: 1.6; }

.test-panel {
  position: relative;
  overflow: hidden;
  padding: 38px 24px 32px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(14, 35, 58, .9), rgba(8, 23, 39, .94));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .25);
  text-align: center;
}

.test-panel::before {
  content: "";
  position: absolute;
  inset: -150px 20% auto;
  height: 240px;
  background: var(--cyan);
  filter: blur(120px);
  opacity: .08;
  pointer-events: none;
}

.gauge { position: relative; width: min(340px, 90%); height: 190px; margin: 0 auto -12px; }
.gauge svg { width: 100%; overflow: visible; }
.gauge path { fill: none; stroke-width: 7; stroke-linecap: round; }
.gauge-track { stroke: rgba(136, 169, 200, .15); }
.gauge-progress { stroke: url(#none); stroke: var(--cyan); stroke-dasharray: 100; stroke-dashoffset: 100; filter: drop-shadow(0 0 7px rgba(41, 213, 232, .65)); transition: stroke-dashoffset .35s ease; }
.gauge-value { position: absolute; inset: 73px 0 auto; display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.gauge-value strong { font-size: clamp(43px, 8vw, 67px); line-height: 1; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.gauge-value span { color: var(--muted); font-size: 13px; }

.status-area h2 { margin: 0 0 8px; font-size: 20px; }
.status-area p { margin: 0 auto; color: var(--muted); font-size: 13px; }
.progress-wrap { max-width: 440px; margin: 22px auto 0; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.progress-bar { height: 5px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.08); }
.progress-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--cyan)); transition: width .2s linear; }

.start-button {
  min-width: 210px;
  margin-top: 26px;
  padding: 15px 24px;
  border: 0;
  border-radius: 12px;
  color: #03101a;
  background: linear-gradient(135deg, #48e1ec, #27c4e6);
  box-shadow: 0 12px 30px rgba(41, 213, 232, .19);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  cursor: pointer;
  transition: transform .2s ease, filter .2s ease;
}
.start-button:hover { transform: translateY(-2px); filter: brightness(1.08); }
.start-button:disabled { cursor: wait; opacity: .55; transform: none; }
.button-icon { margin-right: 8px; font-size: 10px; }
.cancel-button { display: block; margin: 12px auto 0; padding: 5px 12px; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0 54px; }
.metrics article { display: flex; align-items: center; gap: 13px; min-height: 92px; padding: 17px; border: 1px solid var(--border); border-radius: 16px; background: rgba(12, 28, 47, .75); }
.metric-icon { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 11px; font-size: 20px; font-weight: 700; }
.metric-icon.download { color: var(--cyan); background: rgba(41, 213, 232, .11); }
.metric-icon.upload { color: var(--green); background: rgba(54, 211, 153, .11); }
.metric-icon.latency { color: #73a5ff; background: rgba(57, 124, 255, .12); }
.metric-icon.jitter { color: var(--purple); background: rgba(173, 122, 255, .12); }
.metrics article div:last-child { min-width: 0; }
.metrics span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.metrics strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.metrics small { margin-left: 4px; color: var(--muted); font-size: 10px; }

.details { margin-bottom: 64px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.secondary-button { padding: 9px 13px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: var(--surface); cursor: pointer; font-size: 11px; }
.secondary-button:disabled { opacity: .35; cursor: not-allowed; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); border-radius: 17px; overflow: hidden; background: rgba(10, 25, 42, .7); }
.detail-grid > div { min-height: 82px; padding: 20px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.detail-grid > div:nth-child(4n) { border-right: 0; }
.detail-grid > div:nth-last-child(-n+4) { border-bottom: 0; }
.detail-grid span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; }
.detail-grid strong { display: block; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.quality-card { display: flex; align-items: center; gap: 18px; margin-top: 16px; padding: 20px; border: 1px solid rgba(54, 211, 153, .22); border-radius: 16px; background: rgba(54, 211, 153, .06); }
.quality-score { display: grid; place-items: center; flex: 0 0 58px; height: 58px; border: 2px solid var(--green); border-radius: 50%; color: var(--green); font-size: 18px; font-weight: 900; }
.quality-card span { color: var(--green); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.quality-card h3 { margin: 4px 0; font-size: 18px; }
.quality-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

footer { width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 36px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
footer a { color: var(--muted); }
noscript { display: block; margin: 20px 0; padding: 15px; border: 1px solid #c77; }
[hidden] { display: none !important; }

.legal-page { max-width: 720px; min-height: calc(100vh - 190px); padding: 70px 0; }
.legal-page h1 { margin: 0 0 30px; font-size: clamp(34px, 5vw, 50px); letter-spacing: -.045em; }
.legal-page h2 { margin: 32px 0 8px; font-size: 18px; }
.legal-page p { color: var(--muted); line-height: 1.75; }
.back-link { display: inline-block; margin-top: 28px; color: var(--cyan); text-decoration: none; }

@media (max-width: 780px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid > div:nth-child(odd) { border-right: 1px solid var(--border); }
  .detail-grid > div:nth-child(even) { border-right: 0; }
  .detail-grid > div:nth-last-child(-n+4) { border-bottom: 1px solid var(--border); }
  .detail-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
}

@media (max-width: 480px) {
  .topbar, main, footer { width: min(100% - 24px, 1040px); }
  .server-pill { padding: 7px 9px; font-size: 10px; }
  .hero { padding-top: 35px; }
  .test-panel { padding-inline: 14px; border-radius: 19px; }
  .gauge { height: 170px; }
  .gauge-value { top: 65px; }
  .metrics { gap: 8px; margin-bottom: 44px; }
  .metrics article { min-height: 80px; padding: 12px 10px; gap: 9px; }
  .metric-icon { flex-basis: 31px; height: 31px; }
  .metrics strong { font-size: 20px; }
  .detail-grid > div { min-height: 76px; padding: 15px 13px; }
  .section-heading { align-items: center; }
}

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