.btn--with-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn--with-icon .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid + .form-grid {
  margin-top: 4px;
}

.form-grid--knobs {
  align-items: start;
}

.field-group {
  min-width: 0;
}

.text-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font: inherit;
  font-size: 0.9375rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-input:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-primary) 22%, transparent);
}

.text-input--compact {
  max-width: 140px;
  text-align: center;
}

.radio-group {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.radio-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  cursor: pointer;
}

.radio-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.radio-chip input:checked + span {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-color: color-mix(in srgb, var(--md-sys-color-primary) 40%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-primary) 12%, transparent);
}

.knob-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.knob-shell {
  position: relative;
  width: 220px;
  height: 172px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.knob-marker {
  position: absolute;
  top: 118px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--md-sys-color-on-surface-variant);
  user-select: none;
  -webkit-user-select: none;
  line-height: 1;
}

.knob-marker--min {
  left: 0;
}

.knob-marker--max {
  right: 0;
}

.knob-help {
  margin: 0;
  text-align: center;
}

.metal-knob {
  --knob-angle: 0deg;
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  cursor: grab;
  touch-action: none;
  border-radius: 999px;
  user-select: none;
  -webkit-user-select: none;
}

.metal-knob:active {
  cursor: grabbing;
}

.metal-knob:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--md-sys-color-primary) 22%, transparent);
}

.metal-knob__ring {
  position: relative;
  width: 144px;
  height: 144px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.08) 18%, transparent 22%),
    linear-gradient(145deg, #eef4fa 0%, #d0dae5 44%, #b8c4d0 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    inset 0 -10px 16px rgba(71, 85, 105, 0.18),
    0 6px 18px rgba(15, 23, 42, 0.15);
}

.metal-knob__scale {
  position: absolute;
  inset: 8px;
  border-radius: 999px;
  background:
    repeating-conic-gradient(
      from 135deg,
      rgba(80, 88, 98, 0) 0deg 8deg,
      rgba(80, 88, 98, 0.34) 8deg 9deg
    );
  mask: radial-gradient(circle, transparent 57%, #000 58%);
  -webkit-mask: radial-gradient(circle, transparent 57%, #000 58%);
  opacity: 0.85;
}

.metal-knob__face {
  position: relative;
  width: 108px;
  height: 108px;
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.62) 10%, #f7fbff 24%, #dce5ee 68%, #c0ccd8 100%);
  border: 1px solid rgba(148, 163, 184, 0.75);
  box-shadow:
    inset 0 2px 8px rgba(255, 255, 255, 0.95),
    inset 0 -12px 18px rgba(71, 85, 105, 0.12),
    0 2px 6px rgba(15, 23, 42, 0.12);
}

.metal-knob__pointer {
  position: absolute;
  top: 11px;
  left: 50%;
  width: 5px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, #1e293b 0%, #334155 100%);
  transform: translateX(-50%) rotate(var(--knob-angle));
  transform-origin: 50% 43px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.metal-knob__value {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
  line-height: 1.1;
}

.metal-knob__unit {
  margin-top: 3px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--md-sys-color-on-surface-variant);
}

.inline-status {
  margin-top: 20px;
}

.inline-status--top {
  margin-top: 8px;
}

.beat-indicator-wrap {
  padding: 18px;
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.beat-indicator {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.beat-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--md-sys-color-outline) 48%, white);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-sys-color-outline) 35%, transparent);
  transform: scale(1);
  transition: transform 0.08s ease, background-color 0.08s ease, box-shadow 0.08s ease;
}

.beat-dot.is-active {
  transform: scale(1.15);
  background: var(--md-sys-color-primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--md-sys-color-primary) 18%, transparent);
}

.beat-dot.is-accent {
  background: color-mix(in srgb, var(--md-sys-color-primary) 68%, white);
}

.beat-dot.is-accent.is-active {
  background: var(--md-sys-color-on-primary-container);
}

.pulse-panel {
  display: flex;
  justify-content: center;
  padding: 16px 0 4px;
}

.pulse-panel--top {
  padding-top: 20px;
}

.pulse-toggle-btn {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  border-radius: 999px;
}

.pulse-toggle-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--md-sys-color-primary) 22%, transparent);
}

.visual-pulse {
  width: 96px;
  height: 96px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, color-mix(in srgb, var(--md-sys-color-primary) 22%, white) 0%, color-mix(in srgb, var(--md-sys-color-primary) 12%, white) 42%, transparent 72%);
  border: 2px solid color-mix(in srgb, var(--md-sys-color-primary) 24%, transparent);
  transform: scale(0.95);
  opacity: 0.9;
  transition: transform 0.08s ease, opacity 0.08s ease, box-shadow 0.08s ease, border-color 0.15s ease;
}

.visual-pulse.is-pulsing {
  transform: scale(1.08);
  opacity: 1;
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--md-sys-color-primary) 12%, transparent);
}

.visual-pulse.is-playing {
  border-color: color-mix(in srgb, var(--md-sys-color-primary) 48%, transparent);
}

.pulse-icon {
  font-size: 34px;
  color: var(--md-sys-color-on-primary-container);
}

@media (max-width: 600px) {
  .form-grid,
  .form-grid--knobs {
    grid-template-columns: 1fr;
  }

  .tool-actions {
    flex-direction: column;
  }

  .tool-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .radio-group {
    gap: 8px;
  }

  .radio-chip span {
    min-height: 42px;
    padding: 9px 12px;
    font-size: 0.875rem;
  }

  .knob-shell {
    width: 180px;
    height: 148px;
  }

  .knob-marker {
    top: 108px;
    font-size: 0.625rem;
  }

  .knob-marker--min {
    left: 0;
  }

  .knob-marker--max {
    right: 0;
  }

  .metal-knob__ring {
    width: 128px;
    height: 128px;
  }

  .metal-knob__face {
    width: 98px;
    height: 98px;
  }

  .metal-knob__pointer {
    height: 26px;
    transform-origin: 50% 39px;
  }}
