.pitch-trace {
  --trace-target: var(--pitch-target, #536343);
  --trace-voice: var(--accent, #a43a27);
  --trace-grid: #cfc1ae;
  --trace-band: #e1e4ce;
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 12px;
  color: var(--ink, #211b17);
  text-align: left;
}

.pitch-trace--compact {
  gap: 7px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line-strong, #cfc1ae);
}

.pitch-trace__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 5px 16px;
}

.pitch-trace__key {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 5px;
  min-height: 1.6em;
  font-size: clamp(.75rem, 1.05vw, .875rem);
}

.pitch-trace:not(.pitch-trace--compact) .pitch-trace__key:first-child {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 6px;
  font-weight: 700;
}

.pitch-trace__key [data-trace-target] {
  grid-column: 1 / -1;
  color: var(--trace-voice);
  font-size: clamp(2.8rem, 4.7vw, 4.125rem);
  font-weight: 800;
  letter-spacing: -.055em;
  line-height: 1;
}

.pitch-trace__key strong {
  font-variant-numeric: tabular-nums;
}

.pitch-trace__key [data-trace-voice] { min-width: 2.5ch; color: var(--trace-voice); }
.pitch-trace__distance { white-space: nowrap; font-variant-numeric: tabular-nums; }

.pitch-trace__reference {
  width: 16px;
  border-top: 2px dashed var(--trace-target);
}

.pitch-trace__voice {
  width: 9px;
  height: 9px;
  margin-inline: 3px 4px;
  border-radius: 50%;
  background: var(--trace-voice);
}

.pitch-trace__graph {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 3px 8px;
}

.pitch-trace__plot {
  position: relative;
  min-width: 0;
  height: clamp(86px, 12vh, 112px);
}

.pitch-trace--compact .pitch-trace__plot { height: 66px; }

.pitch-trace .pitch-trace__chart {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.pitch-trace__chart path {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.pitch-trace__grid { stroke: var(--trace-grid); stroke-width: 1px; }
.pitch-trace__band { fill: var(--trace-band); }
.pitch-trace__target { stroke: var(--trace-target); stroke-width: 1.5px; stroke-dasharray: 5 4; }
.pitch-trace__path { stroke: var(--trace-voice); stroke-width: 2.5px; stroke-linejoin: round; stroke-linecap: round; }

.pitch-trace__dot {
  position: absolute;
  right: 1%;
  width: 11px;
  height: 11px;
  border: 2px solid var(--paper, #f6eddd);
  border-radius: 50%;
  background: var(--trace-voice);
  transform: translate(50%, -50%);
}

.pitch-trace__axis, .pitch-trace__time {
  color: var(--muted, #64564a);
  font-size: clamp(.63rem, 1.2vw, .72rem);
  line-height: 1.2;
}

.pitch-trace__axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  white-space: nowrap;
}

.pitch-trace__axis > :nth-child(2) { color: var(--trace-target); font-weight: 750; }

.pitch-trace__time {
  grid-column: 2;
  display: flex;
  justify-content: space-between;
  padding-inline: 1%;
}
