:root {
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #e7e6df;
  background: #171817;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: #171817;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
}

button,
input {
  font: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  margin: -1px;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.guide-dialog {
  scroll-behavior: smooth;
}

.guide-dialog p,
.guide-dialog ul,
.guide-dialog dl,
.guide-dialog figure {
  margin-block: 0;
}

.guide-dialog__contents {
  display: flex;
  padding: 0.6rem;
  border-block: 1px solid #898a84;
  margin-top: 1rem;
  gap: 0.35rem;
  overflow-x: auto;
}

.guide-dialog__contents a {
  min-height: 2.25rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid #777872;
  border-radius: 0.12rem;
  background: #e3dfd2;
  color: #292a27;
  font: 800 0.56rem/1 ui-monospace, monospace;
  letter-spacing: 0.03em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.guide-dialog__contents a:focus-visible,
.guide-sources a:focus-visible {
  outline: 3px solid #fffdf5;
  outline-offset: 2px;
}

.guide-dialog__body {
  display: grid;
  margin-top: 1rem;
  gap: 0.8rem;
}

.guide-section {
  display: grid;
  padding: clamp(0.8rem, 2vw, 1.2rem);
  border: 1px solid #8a8b85;
  background: #c5c6c0;
  scroll-margin-top: 1rem;
  gap: 0.7rem;
}

.guide-section h2,
.guide-section h3 {
  margin: 0;
  color: #242522;
  font: 900 clamp(1.05rem, 2vw, 1.35rem)/1.1 "Arial Narrow", sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.guide-section > p,
.guide-listening-list,
.guide-rhythm-terms,
.guide-note {
  max-width: 68rem;
  color: #3e3f3b;
  font-size: 0.82rem;
  line-height: 1.6;
}

.guide-section .guide-section__index {
  color: #9b3825;
  font: 800 0.6rem/1 ui-monospace, monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.guide-note {
  padding: 0.65rem 0.75rem;
  border-left: 0.22rem solid #d65a36;
  background: #b5b6b0;
}

.guide-example {
  display: grid;
  min-width: 0;
  gap: 0.45rem;
}

.guide-example__controls {
  min-width: 0;
  user-select: none;
}

.guide-example__controls > * {
  margin-inline: auto;
}

.guide-example__panel-controls {
  display: flex;
  position: static;
  width: fit-content;
  min-width: min(100%, 12rem);
  box-shadow: none;
}

.guide-example__panel-controls .control-cluster {
  justify-self: start;
}

.guide-example__display {
  width: min(100%, 64rem);
  min-width: 31rem;
}

.guide-example__keys {
  width: min(100%, 64rem);
  margin-top: 0.5rem;
}

.guide-example .pattern-controls,
.guide-example .mixer-section {
  position: static;
  width: 100%;
  box-shadow: none;
}

.guide-example .pattern-controls {
  width: min(100%, 36rem);
  grid-template-columns: 1fr;
}

.guide-example .mixer-section {
  width: min(100%, 64rem);
  min-width: 0;
}

.guide-rhythm-terms {
  display: grid;
  gap: 0.45rem;
}

.guide-rhythm-terms > div {
  display: grid;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid #969791;
  grid-template-columns: minmax(6rem, 9rem) minmax(0, 1fr);
  gap: 0.6rem;
}

.guide-rhythm-terms dt {
  color: #292a27;
  font-weight: 800;
}

.guide-rhythm-terms dd {
  margin: 0;
}

.guide-listening-list {
  display: grid;
  padding-left: 1.2rem;
  gap: 0.5rem;
}

.guide-sources a {
  color: #74291f;
  font-weight: 700;
  text-underline-offset: 0.16em;
}

@media (max-width: 42rem) {
  .guide-dialog__contents {
    padding-inline: 0;
  }

  .guide-example {
    overflow-x: auto;
  }

  .guide-example__display {
    min-width: 36rem;
  }

  .guide-example__keys {
    min-width: 31rem;
  }

  .guide-example .mixer-section {
    min-width: 31rem;
  }

  .guide-example .pattern-controls {
    min-width: 0;
  }

  .guide-example .preset-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow-x: visible;
  }

  .guide-example .preset-controls select {
    max-width: none;
    grid-column: 1 / -1;
  }

  .guide-example .preset-controls button {
    width: 100%;
    padding-inline: 0.1rem;
    font-size: 0.48rem;
  }

  .guide-example .preset-controls__settings {
    grid-column: span 1;
  }

  .guide-example .pattern-controls__slots {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow-x: visible;
  }

  .guide-example .pattern-copy-button,
  .guide-example .pattern-slot {
    padding-inline: 0.1rem;
    font-size: 0.52rem;
  }

  .guide-rhythm-terms > div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .guide-dialog {
    scroll-behavior: auto;
  }
}

.lcd-display {
  --lcd-background: #aeb6a0;
  --lcd-segment: #1e251f;
  --lcd-ghost: rgb(30 37 31 / 16%);
  --lcd-border: #464b44;
  --lcd-highlight: rgb(255 255 255 / 15%);

  width: 100%;
  padding: clamp(0.75rem, 2vw, 1.25rem);
  overflow-x: auto;
  border: 0.45rem solid #535650;
  border-radius: 0.35rem;
  background: var(--lcd-background);
  box-shadow:
    inset 0 0.2rem 0.45rem rgb(0 0 0 / 28%),
    inset 0 1px 0 var(--lcd-highlight);
  color: var(--lcd-segment);
  font-family: "Arial Narrow", "Roboto Condensed", ui-monospace, monospace;
}

.lcd-matrix {
  min-width: 31rem;
}

.lcd-header {
  position: sticky;
  left: 0;
  display: grid;
  min-width: 0;
  grid-template-columns: auto auto auto minmax(0, 1fr) auto;
  gap: clamp(0.35rem, 1vw, 1rem);
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgb(30 37 31 / 42%);
  font-size: clamp(0.55rem, 1.2vw, 0.78rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.lcd-header span:nth-child(4) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.lcd-status {
  position: sticky;
  left: 0;
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 8rem;
  align-items: center;
  gap: 1rem;
  min-height: 1.75rem;
  padding-block: 0.45rem 0.25rem;
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.lcd-status > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lcd-system-status {
  min-width: 8rem;
  color: var(--lcd-segment);
  text-align: right;
  white-space: nowrap;
}

.lcd-matrix {
  display: grid;
  gap: 0.12rem;
  transition: opacity 120ms linear;
}

.lcd-matrix--dimmed {
  opacity: 0.42;
}

.lcd-row {
  display: grid;
  grid-template-columns: 0.8rem 7.5rem minmax(0, 1fr);
  align-items: center;
  min-height: 1.15rem;
}

.lcd-row__pointer,
.lcd-row__label {
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.lcd-row__label {
  font-variant-caps: small-caps;
}

.lcd-row__pointer {
  font-size: 0.5rem;
}

.lcd-row__cells {
  display: grid;
  grid-template-columns: repeat(16, minmax(1.25rem, 1fr));
}

.lcd-cell {
  display: grid;
  min-height: 1.15rem;
  color: var(--lcd-segment);
  font: 800 0.75rem/1 ui-monospace, monospace;
  place-items: center;
}

.lcd-cell--empty {
  color: var(--lcd-ghost);
}

.lcd-cell--quarter {
  border-left: 1px solid rgb(30 37 31 / 30%);
}

.lcd-cell--current {
  background: rgb(255 255 255 / 22%);
  box-shadow: inset 1px 0 rgb(30 37 31 / 18%);
}

.lcd-row--selected .lcd-row__label,
.lcd-row--selected .lcd-cell:not(.lcd-cell--empty) {
  font-weight: 900;
}

@media (prefers-reduced-motion: reduce) {
  .lcd-matrix {
    transition: none;
  }
}

.app-shell {
  display: grid;
  min-height: 100vh;
  padding: clamp(0.5rem, 2vw, 2rem);
  gap: 1rem;
  align-content: center;
  justify-items: center;
}

.app-footer {
  width: min(100%, 76rem);
  color: #a7a8a2;
  font: 500 0.68rem/1.45 ui-monospace, monospace;
  letter-spacing: 0.02em;
  text-align: center;
}

.app-footer p {
  margin: 0;
}

.app-footer a {
  color: inherit;
  text-decoration: none;
}

.app-footer a:hover,
.app-footer a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.machine-panel {
  display: grid;
  width: min(100%, 76rem);
  overflow: hidden;
  border: 2px solid #343531;
  border-radius: 0.3rem;
  background: #adaea8;
  box-shadow:
    0 1.5rem 4rem rgb(0 0 0 / 38%),
    inset 0 1px 0 rgb(255 255 255 / 45%);
  color: #191a19;
}

.machine-panel--restoring {
  min-height: 12rem;
  place-items: center;
}

.restore-status {
  margin: 0;
  color: #555650;
  font: 700 0.75rem/1.2 ui-monospace, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-header {
  display: flex;
  height: 5rem;
  min-height: 5rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem clamp(0.8rem, 2vw, 1.5rem);
  overflow: hidden;
  border-bottom: 0.35rem solid #dc5a33;
  background: #d1d1cb;
  gap: 1rem;
  flex-wrap: nowrap;
}

.panel-header__identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.9rem;
  overflow: hidden;
}

.panel-header__identity > div {
  min-width: 0;
}

.panel-header h1,
.panel-header p {
  margin: 0;
}

.panel-header h1 {
  font: 800 clamp(0.85rem, 1.6vw, 1.2rem)/1 "Arial Narrow", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel-header h1.panel-header__model {
  overflow: hidden;
  color: #cc4529;
  font: 900 clamp(1.5rem, 3.4vw, 2.75rem)/0.9 ui-monospace, monospace;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.panel-header p {
  margin-top: 0.3rem;
  overflow: hidden;
  color: #555650;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.panel-header__spec {
  display: flex;
  color: #4b4c48;
  font: 700 0.56rem/1 ui-monospace, monospace;
  gap: 0.8rem;
  letter-spacing: 0.06em;
}

.panel-header__actions {
  display: flex;
  min-width: 0;
  flex: none;
  align-items: center;
  gap: 1rem;
  flex-wrap: nowrap;
}

.panel-header__buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: nowrap;
}

.panel-header__button {
  display: grid;
  flex: none;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid #555650;
  border-radius: 0.14rem;
  background: #e3dfd2;
  box-shadow: 0 0.15rem 0 rgb(0 0 0 / 22%);
  color: #242522;
  cursor: pointer;
  font: 800 0.59rem/1 ui-monospace, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  place-items: center;
}

.panel-header__button:active {
  box-shadow: inset 0 0.18rem 0.2rem rgb(0 0 0 / 20%);
  transform: translateY(1px);
}

.panel-header__button:focus-visible {
  outline: 3px solid #fffdf5;
  outline-offset: 2px;
}

.panel-header__spec span + span {
  padding-left: 0.8rem;
  border-left: 1px solid #8a8b85;
}

.machine-panel__content {
  display: grid;
  width: 100%;
  padding: clamp(0.7rem, 1.5vw, 1.25rem);
  gap: 0.75rem;
}

.display-zone,
.main-key-zone {
  border: 1px solid #4c4d49;
  background: #70716c;
}

.display-zone {
  display: grid;
  min-width: 0;
  padding: 0.55rem;
  grid-template-rows: auto 1fr;
}

.panel-zone-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 1.25rem;
  color: #fffdf5;
  font: 700 0.53rem/1 ui-monospace, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.main-key-zone {
  padding: 0.55rem 0.65rem 0.75rem;
}

.main-key-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.3rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.main-key-grid__item {
  display: grid;
  flex: 1 1 0;
  grid-template-rows: 0.75rem auto;
  gap: 0.4rem;
  padding-top: 0.425rem;
  min-width: 0;
}

.main-key-grid__item:nth-child(4n + 1):not(:first-child) {
  margin-left: 0.65rem;
}

.step-led {
  width: 0.55rem;
  height: 0.55rem;
  aspect-ratio: 1;
  border: 1px solid #5d1714;
  border-radius: 50%;
  background: #3e1715;
  box-shadow: inset 0 1px 1px rgb(0 0 0 / 55%);
  justify-self: center;
}

.step-led--choice {
  background: #6f211c;
}

.step-led--weak {
  background: #85231d;
}

.step-led--strong {
  background: #c62c22;
  box-shadow: 0 0 0.22rem rgb(198 44 34 / 45%);
}

.step-led--current {
  outline: 2px solid #f0b7a4;
  outline-offset: 2px;
}

.main-key {
  display: grid;
  min-width: 0;
  min-height: 4.75rem;
  padding: 0.5rem 0.2rem;
  border: 1px solid #77756c;
  border-radius: 0.16rem;
  background: #e3dfd2;
  box-shadow:
    inset 0 -0.35rem 0 rgb(0 0 0 / 9%),
    0 0.15rem 0.15rem rgb(0 0 0 / 25%);
  color: #242522;
  cursor: pointer;
  place-content: space-between center;
}

.main-key-grid--paintable .main-key {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.main-key:active,
.main-key[aria-pressed='true'] {
  background: #c8c1b1;
  box-shadow: inset 0 0.25rem 0.25rem rgb(0 0 0 / 18%);
  transform: translateY(1px);
}

.main-key:focus-visible,
.panel-button:focus-visible,
.transport-button:focus-visible,
.tempo-control button:focus-visible,
.tempo-control input:focus-visible {
  outline: 3px solid #fffdf5;
  outline-offset: 2px;
}

.main-key__instrument,
.main-key__number {
  font: 800 0.62rem/1 ui-monospace, monospace;
}

.main-key__number {
  color: #585850;
}

.panel-button {
  min-width: 6rem;
  min-height: 3rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid #555650;
  border-radius: 0.14rem;
  background: #d7d5cc;
  box-shadow: 0 0.16rem 0 rgb(0 0 0 / 22%);
  color: #191a19;
  cursor: pointer;
  font: 700 0.66rem/1.15 ui-monospace, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.panel-button span {
  display: block;
}

.panel-button[aria-pressed='true'] {
  border-color: #7f1f19;
  background: #b5342b;
  color: #fff6ea;
}

.panel-controls {
  --control-button-gap: 0.55rem;

  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: var(--control-button-gap);
  padding: 0.45rem 0.6rem 0.6rem;
  border-top: 0.22rem solid #d65a36;
  background: #70716c;
}

.control-cluster {
  display: grid;
  min-width: 0;
  align-content: start;
}

.transport-controls {
  justify-self: start;
}

.edit-controls {
  justify-self: center;
}

.tempo-control {
  width: 12rem;
  max-width: 100%;
  justify-self: end;
}

.control-cluster h2 {
  margin: 0 0 0.45rem;
  color: #fffdf5;
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.control-cluster__buttons {
  display: flex;
  min-width: 0;
  gap: var(--control-button-gap);
}

.transport-button,
.tempo-control button,
.tempo-control input {
  min-height: 3rem;
  border: 1px solid #555650;
  border-radius: 0.14rem;
  background: #d7d5cc;
  color: #191a19;
  font: 800 0.7rem/1 ui-monospace, monospace;
  text-transform: uppercase;
}

.transport-button {
  width: 3rem;
  min-width: 3rem;
  height: 3rem;
  min-height: 3rem;
  padding: 0;
  box-shadow: 0 0.16rem 0 rgb(0 0 0 / 22%);
  cursor: pointer;
  flex: 0 0 3rem;
}

.panel-controls .panel-button {
  width: max-content;
  min-width: max-content;
  padding-inline: 0.6rem;
  flex: none;
  white-space: nowrap;
}

.transport-button--play-pause {
  border-bottom-color: #8e2e1e;
  color: #8e2e1e;
}

.transport-button__icon {
  display: block;
  width: 1.15rem;
  min-width: 1.15rem;
  height: 1.15rem;
  min-height: 1.15rem;
  margin: auto;
  fill: currentcolor;
  flex-shrink: 0;
}

.transport-button:active:not(:disabled),
.panel-button:active {
  box-shadow: inset 0 0.18rem 0.2rem rgb(0 0 0 / 20%);
  transform: translateY(1px);
}

.transport-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.tempo-control__adjuster {
  display: grid;
  min-width: 0;
  grid-template-columns: 2.25rem minmax(3.5rem, 1fr) 2.25rem;
  align-items: center;
  gap: 0.3rem;
  color: #fffdf5;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tempo-control button {
  min-width: 2.25rem;
  padding: 0;
  box-shadow: 0 0.16rem 0 rgb(0 0 0 / 22%);
  cursor: pointer;
  font-size: 1rem;
}

.tempo-control input {
  width: 100%;
  min-width: 0;
  padding: 0.5rem;
  appearance: textfield;
  background: #242724;
  color: #e8a270;
  text-align: center;
}

.tempo-control__value {
  display: flex;
  min-width: 0;
  min-height: 3rem;
  border: 1px solid #555650;
  border-radius: 0.14rem;
  background: #242724;
  align-items: center;
  gap: 0.3rem;
  justify-content: center;
}

.tempo-control__value input {
  min-width: 1.5rem;
  min-height: 1.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: right;
}

.tempo-control__value:focus-within {
  outline: 3px solid #fffdf5;
  outline-offset: 2px;
}

.tempo-control__value input:focus-visible {
  outline: 0;
}

.tempo-control__value-unit {
  color: #e8a270;
  font: 800 0.58rem/1 ui-monospace, monospace;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.tempo-control input::-webkit-inner-spin-button,
.tempo-control input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

@media (max-width: 64rem) {
  .panel-controls {
    --control-button-gap: 0.35rem;
  }

  .panel-header__spec {
    gap: 0.45rem;
  }

  .panel-header__spec span + span {
    padding-left: 0.45rem;
  }

}

@media (max-width: 52rem) {
  .panel-header__spec {
    display: none;
  }

  .main-key-grid {
    flex-wrap: wrap;
  }

  .main-key-grid__item {
    flex: 0 0 calc(12.5% - 0.34375rem);
  }

  .main-key-grid__item:nth-child(9):not(:first-child) {
    margin-left: 0;
  }
}

@media (max-width: 32rem) {
  .panel-header {
    gap: 0.5rem;
  }

  .panel-header h1.panel-header__model {
    font-size: 1.45rem;
  }

  .panel-header__button {
    padding-inline: 0.55rem;
    font-size: 0.56rem;
  }

  .machine-panel__content {
    padding: 0.5rem;
  }

  .main-key-grid {
    flex-wrap: wrap;
  }

  .main-key-grid__item {
    flex-basis: calc(25% - 0.225rem);
  }

  .main-key-grid__item:nth-child(4n + 1):not(:first-child) {
    margin-left: 0;
  }

  .panel-controls {
    --control-button-gap: 0.25rem;

    padding: 0.4rem;
  }

  .control-cluster h2 {
    font-size: 0.48rem;
    letter-spacing: 0.08em;
  }

  .panel-controls .panel-button,
  .tempo-control button,
  .tempo-control input {
    min-height: 2.5rem;
  }

  .panel-controls .panel-button {
    width: max-content;
    min-width: max-content;
    padding-inline: 0.35rem;
    font-size: 0.45rem;
    letter-spacing: 0;
  }

  .transport-button {
    width: 2.5rem;
    min-width: 2.5rem;
    height: 2.5rem;
    min-height: 2.5rem;
    flex-basis: 2.5rem;
  }

  .tempo-control {
    width: 5.75rem;
  }

  .tempo-control__adjuster {
    grid-template-columns: 1.5rem minmax(0, 1fr) 1.5rem;
    gap: 0.2rem;
  }

  .tempo-control button {
    min-width: 1.5rem;
  }

  .tempo-control input {
    padding-inline: 0.15rem;
    font-size: 0.58rem;
  }

  .tempo-control__value input {
    text-align: center;
  }

  .tempo-control__value {
    min-height: 2.5rem;
  }

  .tempo-control__value-unit {
    display: none;
  }

}

@media (prefers-reduced-motion: reduce) {
  .panel-header__button:active {
    transform: none;
  }
}

.machine-panel__content {
  grid-template-columns: minmax(0, 1fr) minmax(30rem, auto);
  grid-template-areas:
    "display pattern"
    "display mixer"
    "main main"
    "controls controls";
}

.machine-panel__upper,
.machine-panel__right {
  display: contents;
}

.display-zone {
  grid-area: display;
}

.pattern-controls {
  grid-area: pattern;
}

.mixer-section {
  grid-area: mixer;
}

.main-key-zone {
  grid-area: main;
}

.panel-controls {
  grid-area: controls;
}

.mixer-section {
  display: grid;
  min-width: 30rem;
  padding: 0.6rem 0.65rem 0.45rem;
  overflow-x: auto;
  border: 1px solid #4c4d49;
  background: #70716c;
  color: #fffdf5;
  grid-template-rows: auto 1fr;
}

.mixer-section h2 {
  margin: 0 0 0.4rem;
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.mixer-section__controls {
  display: grid;
  min-width: 28rem;
  grid-template-columns: repeat(11, minmax(2rem, 1fr));
  align-items: end;
  gap: 0.2rem;
}

.level-control {
  display: grid;
  min-width: 0;
  justify-items: center;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1rem 8.5rem;
}

.level-control__name,
.level-control__value {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  grid-column: 1;
  grid-row: 1;
  font: 700 0.5rem/1.05 ui-monospace, monospace;
  letter-spacing: -0.02em;
  text-align: center;
  text-overflow: clip;
}

.level-control__rail {
  display: grid;
  width: 2.2rem;
  grid-template-columns: 0.7rem 1.5rem;
  height: 8.25rem;
  align-items: center;
}

.level-control__ticks {
  display: flex;
  height: 7.5rem;
  color: #fffdf5;
  flex-direction: column;
  font: 600 0.43rem/1 ui-monospace, monospace;
  justify-content: space-between;
}

.level-control__slider-track {
  position: relative;
  display: grid;
  width: 1.5rem;
  height: 7.5rem;
  place-items: center;
}

.level-slider {
  position: absolute;
  width: 7.5rem;
  height: 1.5rem;
  margin: 0;
  cursor: ns-resize;
  transform: rotate(-90deg);
  accent-color: #d8d5ca;
}

.level-slider:focus-visible {
  outline: 2px solid #fff2df;
  outline-offset: 2px;
}

.level-control__value {
  opacity: 0;
}

.level-control:focus-within .level-control__name {
  opacity: 0;
}

.level-control:focus-within .level-control__value {
  opacity: 1;
}

@media (max-width: 74rem) {
  .machine-panel {
    overflow: visible;
  }

  .machine-panel__content {
    grid-template-columns: 1fr;
    grid-template-areas:
      "pattern"
      "mixer"
      "display"
      "main"
      "controls";
  }

  .mixer-section {
    width: 100%;
    min-width: 0;
  }

  .pattern-controls,
  .panel-controls {
    position: sticky;
    z-index: 10;
    box-shadow: 0 0.35rem 0.65rem rgb(0 0 0 / 28%);
  }

  .pattern-controls {
    top: 0;
  }

  .panel-controls {
    bottom: 0;
  }
}

.pattern-controls {
  display: grid;
  min-width: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid #4c4d49;
  border-top: 0.2rem solid #d65a36;
  background: #70716c;
  gap: 0.55rem;
}

.pattern-controls__group {
  display: grid;
  min-width: 0;
  gap: 0.35rem;
}

.pattern-controls__group h2 {
  margin: 0;
  color: #fffdf5;
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.pattern-controls__slots,
.preset-controls {
  display: grid;
  width: 100%;
  min-width: 0;
  align-items: center;
  grid-template-columns: repeat(9, minmax(2.8rem, 1fr));
  gap: 0.3rem;
  overflow-x: auto;
}

.pattern-copy-button,
.pattern-slot,
.preset-controls button,
.preset-controls select {
  min-height: 2.75rem;
  border: 1px solid #4d4e49;
  border-radius: 0.12rem;
  background: #d7d5cc;
  color: #22231f;
  font: 800 0.62rem/1 ui-monospace, monospace;
}

.pattern-copy-button,
.pattern-slot {
  width: 100%;
  min-width: 0;
  padding-inline: 0.35rem;
  cursor: pointer;
}

.pattern-copy-button[aria-pressed='true'],
.pattern-slot[aria-pressed='true'] {
  border-color: #8f241b;
  background: #b63c2d;
  color: #fff8ed;
}

.pattern-copy-button:active,
.pattern-slot:active,
.preset-controls button:active:not(:disabled) {
  box-shadow: inset 0 0.18rem 0.2rem rgb(0 0 0 / 20%);
  transform: translateY(1px);
}

.pattern-slot--queued:not([aria-pressed='true']) {
  box-shadow: inset 0 0 0 2px #d68652;
}

.preset-controls select {
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 2.75rem;
  padding-inline: 0.45rem;
  appearance: none;
  background-image: none;
  grid-column: span 5;
}

.preset-controls button {
  width: 100%;
  min-width: 0;
  padding-inline: 0.25rem;
  cursor: pointer;
  font-size: 0.55rem;
}

.preset-controls__settings {
  grid-column: span 2;
}

.preset-controls button:disabled,
.preset-controls select:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.preset-controls__error {
  margin: 0;
  color: #fff2df;
  font: 700 0.58rem/1.3 ui-monospace, monospace;
}

.pattern-copy-button:focus-visible,
.pattern-slot:focus-visible,
.preset-controls button:focus-visible,
.preset-controls select:focus-visible {
  outline: 3px solid #fffdf5;
  outline-offset: 2px;
}

@media (min-width: 60rem) and (max-width: 74rem) {
  .pattern-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

@media (max-width: 32rem) {
  .preset-controls {
    display: flex;
    overflow-x: visible;
    flex-wrap: wrap;
  }

  .preset-controls select {
    max-width: 100%;
    flex: 0 0 100%;
  }

  .preset-controls button {
    width: auto;
    min-width: 0;
    flex: 1 1 0;
  }
}

html {
  scroll-behavior: smooth;
}

.static-guide {
  width: min(calc(100% - 1rem), 76rem);
  padding: clamp(0.8rem, 3vw, 2rem);
  border: 2px solid #343531;
  border-top: 0.4rem solid #dc5a33;
  margin: clamp(0.5rem, 3vw, 2rem) auto;
  background: #d1d1cb;
  box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 55%);
  color: #191a19;
}

.static-guide__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.static-guide h1 {
  margin: 0;
  font: 900 clamp(1.7rem, 5vw, 2.6rem)/1 "Arial Narrow", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.static-guide__app-link {
  min-height: 2.5rem;
  padding: 0.75rem;
  border: 1px solid #555650;
  background: #e3dfd2;
  color: #242522;
  font: 800 0.62rem/1 ui-monospace, monospace;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.static-guide__image {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #777872;
  margin-top: 1rem;
  background: #171817;
}

.static-guide__footer {
  padding-top: 1rem;
  color: #555650;
  font: 700 0.68rem/1.5 ui-monospace, monospace;
  text-align: center;
}

@media (max-width: 38rem) {
  .static-guide__header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
