html, body {
  margin: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#screen {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#compass {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#needle,
#tip {
  fill: none;
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 150ms linear;
}

#arrowGroup {
  transform-origin: 120px 148px;
  transform-box: view-box;
  opacity: 0.85;
  transition: transform 120ms linear;
}

/* No good heading/GPS lock yet: needle stays visible, drawn red. */
#arrowGroup.bad #needle,
#arrowGroup.bad #tip {
  stroke: #FF3B30;
}

/* Good heading/GPS lock: needle drawn white. */
#arrowGroup.good #needle,
#arrowGroup.good #tip {
  stroke: #ffffff;
}

#readout {
  position: relative;
  z-index: 1;
  text-align: center;
  pointer-events: none;
}

#speed {
  font-size: 96px;
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

#unit {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  transition: color 150ms linear;
}

/* No GPS lock: label red. */
#unit.bad {
  color: #FF3B30;
}

/* Good GPS lock: label white. */
#unit.good {
  color: #ffffff;
}

#gpsStatus {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  z-index: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #FF3B30;
  opacity: 0;
  transition: opacity 150ms linear;
  pointer-events: none;
  padding: 0 10px;
}

#gpsStatus.show {
  opacity: 1;
}

/* Double-tap diagnostics. Hidden until asked for, then covers the screen so
   the values are legible enough to read aloud off a 240px-wide display. */
#diag {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(0, 0, 0, 0.92);
  color: #34C759;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 6px;
  display: none;
  pointer-events: none;
}

#diag.show {
  display: block;
}
