.dyno {
  --dyno-bg: #0f0f13;
  --dyno-line: rgba(255, 255, 255, 0.1);
  --dyno-grid: rgba(255, 255, 255, 0.065);
  --dyno-text: #f5f5f5;
  --dyno-muted: rgba(245, 245, 245, 0.56);
  --dyno-power: #f56e0f;
  --dyno-torque: #e4ddcf;
  --dyno-power-stock: rgba(245, 110, 15, 0.52);
  --dyno-torque-stock: rgba(228, 221, 207, 0.4);
  --dyno-axis-w: 40px;
  margin: 0 0 24px;
  padding: 0;
  background: var(--dyno-bg);
  border: 1px solid var(--dyno-line);
  border-radius: 0;
  color: var(--dyno-text);
  font-family: "Inter", system-ui, sans-serif;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  text-align: left;
}

.dyno *,
.dyno *::before,
.dyno *::after {
  box-sizing: border-box;
}

.dyno__head {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: stretch;
  border-bottom: 1px solid var(--dyno-line);
}

.dyno__stat {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 16px 32px 16px 24px;
  border-right: 1px solid var(--dyno-line);
}

.dyno__stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dyno-muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dyno__stat-label::before {
  content: "";
  width: 16px;
  height: 2px;
  background: var(--dyno-series);
}

.dyno__stat--power {
  --dyno-series: var(--dyno-power);
}

.dyno__stat--torque {
  --dyno-series: var(--dyno-torque);
}

.dyno__stat-value {
  color: var(--dyno-text);
  font-size: 32px;
  font-weight: 600;
  line-height: 40px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.dyno__stat-value small {
  color: var(--dyno-muted);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
}

.dyno__stat-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 12px;
  font-size: 13px;
  line-height: 16px;
  white-space: nowrap;
}

.dyno__stat-delta {
  color: var(--dyno-series);
  font-weight: 600;
}

.dyno__stat-from {
  color: var(--dyno-muted);
}

.dyno__legend {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 24px;
  margin: 0;
  padding: 16px 24px;
  list-style: none;
  color: var(--dyno-muted);
  font-size: 12px;
  line-height: 16px;
}

.dyno__legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dyno__legend li::before,
.dyno__legend li::marker {
  content: none;
}

.dyno__key {
  width: 28px;
  height: 8px;
  overflow: visible;
}

.dyno__key line {
  stroke: rgba(245, 245, 245, 0.86);
  stroke-width: 2;
}

.dyno__key--stock line {
  stroke: rgba(245, 245, 245, 0.5);
  stroke-width: 1.25;
  stroke-dasharray: 5 4;
}

.dyno__chart {
  display: grid;
  grid-template-columns: var(--dyno-axis-w) minmax(0, 1fr) var(--dyno-axis-w);
  grid-template-rows: 16px auto 24px;
  grid-template-areas:
    "ul . ur"
    "left plot right"
    ". x .";
  gap: 8px 8px;
  padding: 16px 16px 0;
}

.dyno__unit {
  color: var(--dyno-muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.04em;
}

.dyno__unit--left {
  grid-area: ul;
  color: var(--dyno-power);
  text-align: right;
}

.dyno__unit--right {
  grid-area: ur;
  color: var(--dyno-torque);
}

.dyno__axis {
  position: relative;
  color: var(--dyno-muted);
  font-size: 11px;
  line-height: 16px;
}

.dyno__axis span {
  position: absolute;
  white-space: nowrap;
}

.dyno__axis--left {
  grid-area: left;
}

.dyno__axis--left span {
  right: 0;
  transform: translateY(-50%);
}

.dyno__axis--right {
  grid-area: right;
}

.dyno__axis--right span {
  left: 0;
  transform: translateY(-50%);
}

.dyno__axis--x {
  grid-area: x;
}

.dyno__axis--x span {
  top: 0;
  transform: translateX(-50%);
}

.dyno__axis--x .dyno__tick--start {
  transform: none;
}

.dyno__axis--x .dyno__tick--end {
  transform: translateX(-100%);
}

.dyno__plot {
  grid-area: plot;
  position: relative;
  height: clamp(216px, 30vw, 368px);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.dyno__layer {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.dyno__grid line {
  stroke: var(--dyno-grid);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  shape-rendering: crispEdges;
}

.dyno__grid .dyno__grid-edge {
  display: none;
}

.dyno__line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.dyno__line--power {
  stroke: var(--dyno-power);
}

.dyno__line--torque {
  stroke: var(--dyno-torque);
}

.dyno__line--stock {
  stroke-width: 1.25;
  stroke-dasharray: 5 4;
  stroke-linecap: butt;
}

.dyno__line--stock.dyno__line--power {
  stroke: var(--dyno-power-stock);
}

.dyno__line--stock.dyno__line--torque {
  stroke: var(--dyno-torque-stock);
}

.dyno__gain {
  fill: rgba(245, 110, 15, 0.07);
  stroke: none;
}

.dyno__peak {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

.dyno__peak::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  background: var(--dyno-series);
  border: 2px solid var(--dyno-bg);
}

.dyno__peak--power {
  --dyno-series: var(--dyno-power);
}

.dyno__peak--torque {
  --dyno-series: var(--dyno-torque);
}

.dyno__peak b {
  position: absolute;
  left: 0;
  bottom: 8px;
  transform: translateX(-50%);
  padding: 0 4px;
  background: var(--dyno-bg);
  color: var(--dyno-series);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  white-space: nowrap;
}

.dyno__peak--start b {
  transform: translateX(-8px);
}

.dyno__peak--end b {
  transform: translateX(calc(-100% + 8px));
}

.dyno__note {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 8px calc(var(--dyno-axis-w) + 24px) 16px;
  color: rgba(245, 245, 245, 0.46);
  font-size: 11px;
  line-height: 16px;
}

.dyno__note-unit {
  letter-spacing: 0.04em;
}

.dyno-section {
  margin-top: clamp(32px, 5vw, 56px);
}

.dyno-section .dyno {
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .dyno {
    --dyno-axis-w: 28px;
  }

  .dyno__head {
    grid-template-columns: 1fr 1fr;
  }

  .dyno__stat {
    padding: 16px;
  }

  .dyno__stat--torque {
    border-right: 0;
  }

  .dyno__stat-value {
    font-size: 26px;
    line-height: 32px;
  }

  .dyno__stat-meta {
    flex-direction: column;
    gap: 0;
    font-size: 12px;
  }

  .dyno__legend {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding: 8px 16px;
    border-top: 1px solid var(--dyno-line);
  }

  .dyno__chart {
    gap: 8px 6px;
    padding: 16px 8px 0;
  }

  .dyno__axis,
  .dyno__unit {
    font-size: 10px;
  }

  .dyno__axis--x .dyno__tick--minor {
    display: none;
  }

  .dyno__plot {
    height: clamp(208px, 62vw, 300px);
  }

  .dyno__note {
    padding: 8px 16px 16px;
  }
}

@keyframes dyno-draw {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes dyno-draw-late {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes dyno-peak {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes dyno-peak-late {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html.motion .dyno__layer--tuned {
    animation: dyno-draw-late 0.8s cubic-bezier(0.45, 0, 0.2, 1) 3s both;
  }

  html.motion .dyno__peak {
    animation: dyno-peak-late 0.24s linear 3.6s both;
  }

  html.motion .dyno.is-drawn .dyno__layer--tuned {
    animation: dyno-draw 0.8s cubic-bezier(0.45, 0, 0.2, 1) both;
  }

  html.motion .dyno.is-drawn .dyno__peak {
    animation: dyno-peak 0.24s linear 0.6s both;
  }
}
