#comparison-charts {
  --chart-v1: #146b45;
  --chart-v2: #a43d17;
  margin: 16px 0 0;
  min-width: 0;
}

html[data-theme="night"] #comparison-charts {
  --chart-v1: #83e9ab;
  --chart-v2: #ff9d73;
}

#comparison-charts h2 {
  margin: 0;
  font-size: 1.15rem;
}

#comparison-charts > p {
  margin: 4px 0 8px;
}

.comparison-chart {
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  min-width: 0;
}

.comparison-chart-head,
.comparison-chart-values {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
}

.comparison-chart-head h3 {
  margin: 0;
  font-size: 1rem;
}

.comparison-chart-head select {
  max-width: 100%;
  font-size: .8rem;
  padding: 4px 8px;
}

.comparison-chart-values {
  justify-content: flex-start;
  margin: 3px 0 1px;
}

.comparison-chart-value {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}

.comparison-chart-value::before {
  content: "";
  width: .8rem;
  border-top: 2px solid var(--chart-v1);
}

.comparison-chart-value[data-variant="V2"]::before {
  border-top: 2px dashed var(--chart-v2);
}

.comparison-chart-plot,
.comparison-chart-phase-row {
  position: relative;
}

.comparison-chart-plot canvas {
  display: block;
  width: 100%;
  height: 121px;
  cursor: crosshair;
  touch-action: pan-y;
}

.comparison-chart-cursor {
  position: absolute;
  top: 9px;
  bottom: 27px;
  width: 2px;
  background: var(--ink);
  pointer-events: none;
  border-radius: 2px;
}

.comparison-chart-phase-row {
  padding: 0 0 4px;
  font-size: .75rem;
}

.comparison-chart-phase-row strong {
  position: absolute;
  inset-inline-start: 0;
}

.comparison-chart-phase-track {
  display: flex;
  height: 16px;
  border-radius: 4px;
  background: var(--screen);
}

.comparison-chart-phase-track button {
  box-sizing: border-box;
  flex: 0 0 auto;
  height: 16px;
  min-width: 0;
  padding: 0;
  border-radius: 0;
  border: 1px solid var(--line);
  background: var(--active);
}

.comparison-chart-phase-track button:nth-child(even) { background: var(--screen); }
.comparison-chart-phase-track button.current { background: var(--chart-v1); }
.comparison-chart-phase-row:nth-child(2) button.current { background: var(--chart-v2); }
.comparison-chart-phase-row output { display: block; margin-inline-start: 52px; }
#phase-details { margin-block: 10px 0; }
#phase-details summary { cursor: pointer; font-weight: 700; }

@media (max-width: 730px) {
  #comparison-charts, #phase-details {
    scroll-margin-top: calc(var(--comparison-stage-height, 0px) + 8px);
  }

  .comparison-chart-head select { min-height: 36px; }
}
