:root {
  --night: #07080b;
  --card: #0f1116;
  --edge: rgba(226, 232, 255, 0.08);
  --ink: #eef1f6;
  --ink-soft: #8b93a1;
  --ink-faint: #4a505c;
  --tick: rgba(226, 232, 255, 0.14);
  --glow: #7cb0ff;
  --glow-soft: #3f6fd8;
  --glow-up: #b38cff;
  --font: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  --dial: min(300px, 78vw, 48vh);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--night);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  width: 100%;
  height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(90% 70% at 50% 42%, #10131b, var(--night) 72%);
  padding: 12px;
  user-select: none;
  -webkit-user-select: none;
}

.card {
  position: relative;
  width: min(440px, 100%);
  padding: clamp(12px, 2.6vh, 18px) clamp(14px, 4vw, 20px) clamp(10px, 2.2vh, 16px);
  border-radius: 22px;
  background: linear-gradient(180deg, #12151c, var(--card));
  border: 1px solid var(--edge);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

/* the soft light that sits behind the dial while it measures */
.card::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 34%;
  width: 70%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(124, 176, 255, 0.16), transparent);
  opacity: var(--halo, 0);
  pointer-events: none;
}

.head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 560;
  white-space: nowrap;
}

.brand__mark {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.brand__sep { color: var(--ink-faint); }
.brand__page { color: var(--ink-soft); font-weight: 450; }

.state {
  position: relative;
  height: 22px;
  min-width: 78px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 520;
  color: var(--ink-soft);
  display: grid;
  place-items: center;
}

.state__in { display: block; white-space: nowrap; }

.dial {
  position: relative;
  width: var(--dial);
  margin: clamp(2px, 1vh, 8px) auto 0;
  aspect-ratio: 300 / 236;
}

.gauge { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.tick { stroke: var(--tick); stroke-width: 1.2; stroke-linecap: butt; }
.tick--major { stroke-width: 1.6; }
.tick.is-lit { stroke: var(--glow); }

.label {
  fill: var(--ink-faint);
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 520;
  text-anchor: middle;
  dominant-baseline: middle;
}
.label.is-lit { fill: var(--ink-soft); }

.track {
  fill: none;
  stroke: rgba(226, 232, 255, 0.07);
  stroke-width: 12;
  stroke-linecap: butt;
}

.fill, .fill-glow {
  fill: none;
  stroke: url(#fill-grad);
  stroke-width: 12;
  stroke-linecap: butt;
  stroke-dasharray: 0 100;
}
.fill-glow { stroke-width: 16; opacity: 0.55; }

.needle__beam { stroke: url(#needle-grad); stroke-width: 3; stroke-linecap: butt; }
.needle__glow { stroke: var(--glow); stroke-width: 7; opacity: 0.5; }
.needle { opacity: 0; }

.readout {
  position: absolute;
  left: 50%;
  top: 63.6%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  opacity: 0;
}

.readout__num {
  display: flex;
  justify-content: center;
  font-size: calc(var(--dial) * 0.17);
  font-weight: 620;
  font-stretch: 92%;
  letter-spacing: -0.02em;
  line-height: 1;
  height: 1em;
  overflow: hidden;
}

/* every digit is a column 0-9 that rolls like an odometer */
.dig { position: relative; display: block; width: 0.6em; height: 1em; overflow: hidden; }
.dig--hide { width: 0; }
.dig__col { position: absolute; left: 0; right: 0; top: 0; display: flex; flex-direction: column; }
.dig__col span { display: block; height: 1em; line-height: 1em; text-align: center; }

.readout__unit {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
}

.go {
  position: absolute;
  left: 50%;
  top: 63.6%;
  width: calc(var(--dial) * 0.34);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  border: 1px solid rgba(226, 232, 255, 0.16);
  background: radial-gradient(circle at 50% 30%, #1d222d, #12151c 70%);
  color: var(--ink);
  font: inherit;
  font-size: calc(var(--dial) * 0.075);
  font-weight: 620;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 10px 28px -10px rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
  -webkit-tap-highlight-color: transparent;
}

/* the ring of light that turns around Go while it waits */
.go__ring {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  padding: 1.5px;
  background: conic-gradient(from var(--spin, 0deg), transparent 0 62%, var(--glow) 82%, #ffffff 88%, transparent 92%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.85;
}

.go__label { position: relative; display: block; }

.go:focus-visible { outline: 2px solid var(--glow); outline-offset: 4px; }

@media (hover: hover) {
  .go:hover { border-color: rgba(124, 176, 255, 0.5); box-shadow: 0 0 0 6px rgba(124, 176, 255, 0.07), 0 10px 28px -10px rgba(0, 0, 0, 0.9); }
}

.results {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: clamp(4px, 1.2vh, 10px);
}

.res {
  padding: 8px 10px 7px;
  border-radius: 12px;
  border: 1px solid var(--edge);
  background: rgba(255, 255, 255, 0.02);
  min-width: 0;
  transition: border-color 0.35s, background-color 0.35s;
}
.res.is-on { border-color: rgba(124, 176, 255, 0.35); background: rgba(124, 176, 255, 0.05); }
.res[data-res="up"].is-on { border-color: rgba(179, 140, 255, 0.35); background: rgba(179, 140, 255, 0.05); }

.res__name {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.res__name svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.res[data-res="down"] .res__name svg { stroke: var(--glow); }
.res[data-res="up"] .res__name svg { stroke: var(--glow-up); }

.res__val {
  margin-top: 3px;
  display: flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
  height: 22px;
  overflow: hidden;
}
.res__num { display: inline-block; font-size: 19px; font-weight: 620; font-stretch: 94%; line-height: 22px; }
.res__unit { font-size: 10.5px; color: var(--ink-soft); }

.wave {
  position: relative;
  margin-top: clamp(6px, 1.4vh, 10px);
  height: clamp(30px, 8vh, 48px);
  cursor: crosshair;
}
.wave svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.wave__base { stroke: rgba(226, 232, 255, 0.1); stroke-width: 1; vector-effect: non-scaling-stroke; }
.wave__split { stroke: rgba(226, 232, 255, 0.07); stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.wave__line { fill: none; stroke-width: 1.6; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.wave__line--down { stroke: var(--glow); }
.wave__line--up { stroke: var(--glow-up); }
.wave__probe { stroke: rgba(238, 241, 246, 0.6); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0; }

.wave__tip {
  position: absolute;
  top: 1px;
  left: 0;
  padding: 3px 7px;
  border-radius: 7px;
  background: rgba(27, 31, 41, 0.92);
  border: 1px solid var(--edge);
  font-size: 10.5px;
  line-height: 1.2;
  font-weight: 560;
  white-space: nowrap;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
}

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  fill: #ffffff;
  stroke: #07080b;
  stroke-width: 1.1;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0;
  z-index: 3;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

@media (max-width: 380px) {
  .res { padding: 7px 7px 6px; }
  .res__num { font-size: 16px; }
  .res__name { font-size: 10px; }
  .brand__page { display: none; }
  .brand__sep { display: none; }
}
