.gauge {
  --ui: "Inter", -apple-system, sans-serif;
  --ink: #1a1a1a;
  --muted: #666;
  --faint: #888;
  --line: #ddd;
  --hairline: #eee;
  --blue: #1a6fb5;
  --blue-pale: #b0d0e8;
  --warn: #b5471d;
  margin: 0 0 2.5rem;
}

/* --- Sections --- */

.gauge fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 1.75rem;
  min-width: 0;
}

/* Floating the legend turns it into an ordinary block so width and the
   bottom rule apply; the first row clears it. */
.gauge legend {
  float: left;
  width: 100%;
  padding: 0 0 0.35rem;
  margin-bottom: 0.15rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--ui);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #555;
}

.gauge legend + * {
  clear: left;
}

/* --- Rows: label left, inputs right, hairline between --- */

.gauge .row {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) auto;
  gap: 0.4rem 1rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--hairline);
}

.gauge .row:last-child {
  border-bottom: 0;
}

.gauge .name {
  color: var(--ink);
}

.gauge .unit {
  color: var(--muted);
  font-size: 0.9em;
}

.gauge .row input[type=radio] {
  margin: 0 0.5rem 0 0;
  vertical-align: -2px;
  accent-color: var(--ink);
}

.gauge .row label {
  cursor: pointer;
}

/* --- Unit pairs: each box carries its unit suffix --- */

.gauge .pair {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.gauge .ub {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.gauge .ub .u {
  font-family: var(--ui);
  font-size: 0.78rem;
  color: var(--faint);
  min-width: 2.2em;
}

/* --- Inputs --- */

.gauge input[type=number] {
  width: 6rem;
  font-family: var(--ui);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
}

.gauge input[type=number]:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-pale);
}

.gauge input[type=number]:disabled {
  color: #999;
  background: #f7f7f7;
}

.gauge input[type=number]::placeholder {
  color: #aaa;
}

/* step= sets the arrow increment; typed values off that grid are still fine,
   so hide the browser's invalid glow. */
.gauge input:invalid {
  box-shadow: none;
}

/* --- Derived notes, errors --- */

.gauge .derived,
.gauge .error {
  font-family: var(--ui);
  font-size: 0.82rem;
  color: var(--warn);
  margin: 0.5rem 0 0;
}

.gauge .derived:empty,
.gauge .error:empty {
  display: none;
}

/* --- Results --- */

.gauge .results {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem 1rem;
  padding-top: 0.4rem;
}

.gauge .stat {
  padding: 0.25rem 0;
}

.gauge .stat.big {
  grid-column: 1 / -1;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--hairline);
}

.gauge .k {
  font-family: var(--ui);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.gauge .v {
  font-family: var(--ui);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.gauge .stat.big .v {
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: #111;
}

.gauge .pitch {
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: 0.6rem;
  white-space: nowrap;
}

.gauge .sub {
  font-family: var(--ui);
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* --- Playback --- */

.gauge .play-bar {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.5rem 0 0;
}

.gauge button {
  font-family: var(--ui);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.45rem 1.2rem;
  min-width: 5.5rem;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--ink);
  color: #fcfcfc;
  cursor: pointer;
}

.gauge button:hover {
  background: #333;
  border-color: #333;
}

.gauge button[aria-pressed="true"] {
  background: var(--blue);
  border-color: var(--blue);
}

.gauge button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--blue-pale);
}

.gauge button:disabled {
  background: #f0f0f0;
  border-color: #ddd;
  color: #999;
  cursor: not-allowed;
}

.gauge .vol {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--ui);
  font-size: 0.82rem;
  color: var(--muted);
}

.gauge .vol input {
  width: 8rem;
  accent-color: var(--ink);
}

/* --- Responsive (matches the site's 540px breakpoint) --- */

@media (max-width: 540px) {
  .gauge .row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .gauge .pair {
    justify-content: flex-start;
  }
  .gauge .results {
    grid-template-columns: 1fr;
  }
  .gauge .stat.big .v {
    font-size: 2rem;
  }
  .gauge .pitch {
    display: block;
    margin-left: 0;
  }
}

/* --- Blade table --- */

article table th,
article table td {
  padding: 0.35em 0.2em;
}

article table th {
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

article table th:first-child,
article table td:first-child {
  padding-left: 0;
}

article table th:last-child,
article table td:last-child {
  padding-right: 0;
}

article table th,
article table td:not(:first-child) {
  white-space: nowrap;
}
