/* ── Legend ────────────────────────────────────────────── */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0.35rem 1.2rem;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  font-size: 0.68rem;
  color: var(--text-dim);
  flex-shrink: 0;
}
.lg {
  display: flex;
  align-items: center;
  gap: 3px;
}
.sw {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ── Controls Bar ─────────────────────────────────────── */

.controls {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.7rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

#startBtn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.3rem;
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  background: var(--blue-dark);
  color: #fff;
  min-width: 148px;
  justify-content: center;
  transition:
    background 0.15s,
    transform 0.1s;
}
#startBtn:hover {
  background: var(--blue);
}
#startBtn:active {
  transform: scale(0.97);
}
#startBtn.rec {
  background: var(--red);
  animation: pulse 1.8s ease-in-out infinite;
}
#startBtn.rec:hover {
  background: #dc2626;
}
#startBtn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  animation: none;
}
@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
}

/* ── Audio level indicator ────────────────────────────── */

#audioLevel {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: none;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.1s,
    border-color 0.1s;
  flex-shrink: 0;
}
#audioLevel.on {
  display: flex;
}
#audioLevel .bar-wrap {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}
#audioLevel .bar {
  width: 3px;
  background: var(--green);
  border-radius: 1px;
  transition: height 0.08s;
}

/* ── Stats & misc ─────────────────────────────────────── */

.lw {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.stats {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.74rem;
  color: var(--text-dim);
}
.st b {
  color: var(--text);
  font-weight: 600;
}
#errorEl {
  font-size: 0.74rem;
  color: var(--yellow);
  display: none;
}
#errorEl.on {
  display: inline;
}
