* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  padding: 16px;
  background: #000;
  color: #0ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  min-height: 100vh;
  overflow-x: hidden;
  animation: fadein 0.6s ease-out;
}

@keyframes fadein {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

header { text-align: center; margin-bottom: 20px; }
header h1 { margin: 0 0 4px; font-size: 20px; }
.sub { margin: 0; color: #077; font-size: 12px; }

.readout {
  text-align: center;
  margin: 16px 0 24px;
}

.dist-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 20px;
  border-radius: 12px;
  transition: color 0.3s, text-shadow 0.3s;
}

#dist {
  font-size: 76px;
  font-weight: bold;
  line-height: 1;
  letter-spacing: -2px;
  transition: color 0.25s, text-shadow 0.25s;
}

#unit {
  font-size: 22px;
  color: #077;
}

.dist-wrap.close { color: #ff0; }
.dist-wrap.mid   { color: #0f0; }
.dist-wrap.far   { color: #0ff; }
.dist-wrap.none  { color: #333; }

.dist-wrap.close #dist { text-shadow: 0 0 24px rgba(255,255,0,0.6); }
.dist-wrap.mid   #dist { text-shadow: 0 0 24px rgba(0,255,0,0.5); }
.dist-wrap.far   #dist { text-shadow: 0 0 24px rgba(0,255,255,0.5); }

.dist-wrap.bump { animation: bump 0.35s ease-out; }
@keyframes bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.echo-count {
  margin-top: 6px;
  font-size: 12px;
  color: #066;
  letter-spacing: 1px;
}

.controls { margin-bottom: 20px; }

button {
  padding: 16px;
  font-size: 16px;
  font-weight: bold;
  font-family: inherit;
  background: #0ff;
  color: #000;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  width: 100%;
  transition: transform 0.1s, box-shadow 0.2s;
}

button:active { transform: scale(0.97); }
button:disabled { background: #151515; color: #444; }

button.ping {
  font-size: 22px;
  padding: 22px;
  letter-spacing: 4px;
}

button.ping.ripple {
  animation: ripple 0.7s ease-out;
}
@keyframes ripple {
  0%   { box-shadow: 0 0 0 0 rgba(0,255,255,0.7); }
  100% { box-shadow: 0 0 0 40px rgba(0,255,255,0); }
}

button.ping.pulsing {
  animation: breathe 1.4s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,255,255,0.4); }
  50%      { box-shadow: 0 0 0 14px rgba(0,255,255,0); }
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

button.ghost {
  background: transparent;
  color: #0ff;
  border: 1px solid #055;
}

button.ghost.active {
  background: #0ff;
  color: #000;
}

.panel {
  background: #051010;
  border: 1px solid #033;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 14px;
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 2px;
  color: #088;
}

.panel .hint {
  color: #044;
  font-weight: normal;
  letter-spacing: 0;
  text-transform: none;
  font-size: 10px;
  margin-left: 6px;
}

canvas {
  width: 100%;
  height: 140px;
  display: block;
  border-radius: 6px;
  background: #000;
}

.heading-label {
  text-align: center;
  font-size: 11px;
  color: #077;
  margin-top: 6px;
  letter-spacing: 1px;
}

input[type=range] {
  width: 100%;
  -webkit-appearance: none;
  background: transparent;
  height: 32px;
}

input[type=range]::-webkit-slider-runnable-track {
  height: 4px;
  background: #033;
  border-radius: 2px;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  background: #0ff;
  border-radius: 50%;
  margin-top: -9px;
  box-shadow: 0 0 12px rgba(0,255,255,0.6);
  transition: transform 0.15s;
}
input[type=range]::-webkit-slider-thumb:active { transform: scale(1.2); }

.temp-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #0aa;
  margin-top: 4px;
}

.history h2 {
  font-size: 10px;
  letter-spacing: 2px;
  color: #044;
  margin: 0 0 6px;
}

#hist {
  background: #051010;
  border: 1px solid #033;
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  color: #0aa;
  min-height: 30px;
  word-break: break-all;
}

footer {
  text-align: center;
  font-size: 11px;
  color: #044;
  padding: 12px 0 24px;
}