.techno-machine {
  min-width: 0;
  padding: 1.5rem;
  background: #10100f;
}

.is-fx-dragging,
.is-fx-dragging * { cursor: ns-resize !important; user-select: none !important; }

.machine-display {
  position: relative;
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr) 4.5rem;
  height: 9rem;
  overflow: hidden;
  border: 1px solid #55554f;
  background: #080908;
}

.machine-id {
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: .8rem;
  border-right: 1px solid #55554f;
  color: var(--acid);
  font: 700 .68rem "Courier New", monospace;
}

.machine-id span { font-size: 1.25rem; }
.machine-id small { max-width: 9ch; color: #8b8b82; font: inherit; line-height: 1.35; }

.signal-scope { width: 100%; height: 100%; }

.step-display {
  z-index: 1;
  display: grid;
  place-items: center;
  border-left: 1px solid #55554f;
  color: var(--red);
  font: 900 2.5rem Arial, sans-serif;
  letter-spacing: -.08em;
}

.machine-controls {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr .9fr .9fr;
  margin-top: 1rem;
  border: 1px solid #55554f;
}

.machine-controls > * { min-width: 0; border: 0; border-right: 1px solid #55554f; }
.machine-controls > *:last-child { border-right: 0; }

.transport,
.machine-action {
  display: flex;
  min-height: 5.25rem;
  align-items: center;
  justify-content: space-between;
  padding: .8rem;
  color: var(--paper);
  background: transparent;
  cursor: pointer;
  font: 800 .78rem Arial, sans-serif;
  text-transform: uppercase;
}

.transport b { color: var(--acid); font-size: 1.1rem; }
.transport[aria-pressed="true"] { color: var(--ink); background: var(--acid); }
.transport[aria-pressed="true"] b { color: var(--red); }
.machine-action:hover,
.machine-action:focus-visible { color: var(--ink); background: var(--red); outline: 0; }
.machine-action span { font-size: 1.35rem; }

.machine-knob {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-content: space-between;
  gap: .25rem;
  min-height: 5.25rem;
  padding: .65rem .8rem;
  color: #8b8b82;
  font: 700 .62rem "Courier New", monospace;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.machine-knob output { color: var(--paper); font-size: 1rem; }
.machine-knob input { grid-column: 1 / -1; width: 100%; accent-color: var(--red); cursor: ew-resize; }

.sequence-grid {
  display: grid;
  grid-template-columns: 7rem repeat(16, minmax(1.5rem, 1fr));
  margin-top: 1rem;
  border-top: 1px solid #55554f;
  border-left: 1px solid #55554f;
}

.track-label,
.step-cell {
  min-width: 0;
  min-height: 3.65rem;
  border: 0;
  border-right: 1px solid #55554f;
  border-bottom: 1px solid #55554f;
}

.track-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem;
  color: var(--paper);
  background: #10100f;
  cursor: pointer;
  font: 800 .68rem Arial, sans-serif;
  text-align: left;
  text-transform: uppercase;
}

.track-label small { color: #77776f; font: .55rem "Courier New", monospace; }
.track-label[aria-pressed="true"] { color: #66665f; text-decoration: line-through; }

.step-cell {
  position: relative;
  padding: 0;
  background: #181917;
  cursor: crosshair;
}

.step-cell.is-beat { box-shadow: inset 3px 0 0 #3a3a36; }
.step-cell::before {
  position: absolute;
  inset: 23%;
  border: 1px solid #44443f;
  content: "";
  transform: rotate(45deg) scale(.45);
  transition: transform 80ms ease, background 80ms ease;
}

.step-cell:hover,
.step-cell:focus-visible { background: #353530; outline: 0; }
.step-cell[aria-pressed="true"]::before { border-color: var(--acid); background: var(--acid); transform: rotate(45deg) scale(1); }
.step-cell[data-track="clap"][aria-pressed="true"]::before { border-color: var(--paper); background: var(--paper); }
.step-cell[data-track="hat"][aria-pressed="true"]::before { border-color: var(--red); background: var(--red); }
.step-cell[data-track="acid"][aria-pressed="true"]::before { border-color: #45a7ff; background: #45a7ff; }
.step-cell.is-current { background: #34342f; box-shadow: inset 0 -4px 0 var(--red); }
.step-cell.is-current[aria-pressed="true"] { background: #4a1b15; }

.fx-panel {
  margin-top: 1rem;
  border: 1px solid #55554f;
}

.fx-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem;
  border-bottom: 1px solid #55554f;
  background: var(--red);
}

.fx-heading span,
.fx-heading p {
  margin: 0;
  color: var(--ink);
  font: 700 .57rem "Courier New", monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.fx-heading h3 {
  margin: .15rem 0 0;
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
  text-transform: uppercase;
}

.fx-grid { display: grid; grid-template-columns: repeat(8, 1fr); }

.fx-button {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 4.2rem;
  flex-direction: column;
  justify-content: space-between;
  padding: .55rem;
  border: 0;
  border-right: 1px solid #55554f;
  border-bottom: 1px solid #55554f;
  color: #a09f96;
  background: #181917;
  cursor: pointer;
  text-align: left;
  text-transform: uppercase;
}

.fx-button::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--acid);
  content: "";
  opacity: .55;
  transform: scaleX(var(--fx-strength, .5));
  transform-origin: left;
}

.fx-button:nth-child(8n) { border-right: 0; }
.fx-button:nth-last-child(-n + 8) { border-bottom: 0; }
.fx-button small { color: #64645e; font: .55rem "Courier New", monospace; }
.fx-button span { font-size: .65rem; font-weight: 800; line-height: 1.05; }
.fx-button:hover,
.fx-button:focus-visible { color: var(--ink); background: var(--paper); outline: 0; }
.fx-button.is-engaged {
  z-index: 1;
  color: var(--ink);
  background: var(--acid);
  box-shadow: inset 0 0 0 3px var(--red), 0 0 1.5rem rgb(217 255 67 / 35%);
  transform: scale(.94);
}
.fx-button.is-engaged small { color: var(--red); }

.fx-control {
  --level: .5;
  position: fixed;
  z-index: 50;
  bottom: var(--control-bottom, 1rem);
  left: var(--control-left, 1rem);
  width: 12rem;
  padding: .65rem;
  border: 2px solid var(--paper);
  color: var(--ink);
  background: var(--acid);
  box-shadow: .55rem .55rem 0 var(--red), 0 0 4rem rgb(217 255 67 / 25%);
  pointer-events: none;
  transform-origin: bottom;
  animation: control-erupt 110ms cubic-bezier(.2, 1.5, .5, 1) both;
}

.fx-control[hidden] { display: none; }

.fx-control::before,
.fx-control::after {
  position: absolute;
  z-index: -1;
  right: -1rem;
  left: -1rem;
  height: 2px;
  background: var(--red);
  content: "";
}
.fx-control::before { top: 23%; }
.fx-control::after { top: 71%; }

.fx-control-head { display: flex; justify-content: space-between; gap: .5rem; font: 700 .6rem "Courier New", monospace; text-transform: uppercase; }
.fx-control-head span { color: var(--red); }
.fx-control-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fx-control-meter {
  position: relative;
  height: 15rem;
  margin: .55rem 0;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: repeating-linear-gradient(0deg, transparent 0 8px, rgb(16 16 15 / 18%) 8px 10px), #bebeb7;
}

.fx-control-meter i {
  position: absolute;
  inset: auto 0 0;
  height: calc(var(--level) * 100%);
  background: repeating-linear-gradient(135deg, var(--red) 0 9px, #ff604d 9px 18px);
  transition: height 25ms linear;
}

.fx-control-meter b {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: calc(var(--level) * 100% - 2px);
  left: 0;
  height: 4px;
  background: var(--ink);
  box-shadow: 0 0 0 2px var(--acid);
}

.fx-control output {
  display: block;
  min-height: 2.2rem;
  overflow: hidden;
  font: 900 1.5rem/1 Arial, sans-serif;
  letter-spacing: -.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.fx-control > small { display: block; margin-top: .4rem; font: 700 .52rem "Courier New", monospace; text-transform: uppercase; }
.fx-control.is-danger { color: var(--paper); background: var(--red); box-shadow: .55rem .55rem 0 var(--acid), 0 0 5rem rgb(240 45 23 / 45%); }
.fx-control.is-danger .fx-control-head span { color: var(--acid); }

@keyframes control-erupt {
  from { opacity: 0; transform: scaleY(.08) skewX(-5deg); }
  to { opacity: 1; transform: scaleY(1) skewX(0); }
}

.machine-footer {
  display: flex;
  gap: 1.2rem;
  margin-top: .75rem;
  color: #77776f;
  font: 700 .57rem "Courier New", monospace;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.machine-footer strong { margin-left: auto; color: var(--acid); }

@media (max-width: 76rem) {
  .techno-machine { padding: 1rem; }
  .sequence-grid { grid-template-columns: 5rem repeat(16, minmax(1.2rem, 1fr)); }
  .track-label { padding: .4rem; }
  .track-label small { display: none; }
}

@media (max-width: 64rem) {
  .machine-display { grid-template-columns: 9rem minmax(0, 1fr) 4rem; }
  .machine-controls { grid-template-columns: 1fr 1fr 1fr; }
  .machine-controls > * { border-bottom: 1px solid #55554f; }
  .machine-controls > *:nth-child(3) { border-right: 0; }
  .machine-controls > *:nth-last-child(-n + 2) { border-bottom: 0; }
  .machine-controls > *:last-child { border-right: 1px solid #55554f; }
  .fx-grid { grid-template-columns: repeat(4, 1fr); }
  .fx-button:nth-child(8n) { border-right: 1px solid #55554f; }
  .fx-button:nth-last-child(-n + 8) { border-bottom: 1px solid #55554f; }
  .fx-button:nth-child(4n) { border-right: 0; }
  .fx-button:nth-last-child(-n + 4) { border-bottom: 0; }
}

@media (pointer: coarse) {
  .synth { display: none; }
}
