@import '../machine/base.css';
@import '../machine/controls.css';
@import '../machine/file-button.css';
@import '../machine/rig.css';
@import '../machine/drop.css';
@import '../machine/matzkaim.css';
@import '../machine/thumb-deck.css';

/* one slab: the arrangement, the few choices beside it, the deck under the thumb */
.page:has(.cm-machine) {
  max-width: min(1500px, 96vw);
  padding-block-end: 96px;
}

.cm-machine {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 12px;
}

.cm-top,
.cm-stage,
.cm-bench {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}

.cm-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.cm-row .btn,
.cm-row .chip {
  min-block-size: 44px;
  white-space: nowrap;
}

.cm-row--tones .chip {
  min-inline-size: 44px;
}

.cm-row .grid-label {
  min-inline-size: 72px;
}

.cm-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cm-bpm {
  inline-size: 92px;
  min-block-size: 44px;
  text-align: center;
}

.cm-map {
  display: block;
  inline-size: 100%;
  min-block-size: 60px;
  border: 1px solid var(--depth, #333);
  cursor: pointer;
  touch-action: manipulation;
}

.cm-recipe {
  overflow-wrap: anywhere;
  user-select: all;
}

.cm-busy .cm-map {
  opacity: 0.45;
}

.cm-deck {
  grid-template-columns: 1.2fr 1.4fr 1fr 1fr;
}

.cm-deck .deck-key:disabled,
.cm-row .btn:disabled {
  color: var(--muted);
  border-color: var(--depth);
  cursor: default;
}

@media (min-width: 1000px) {
  .cm-machine {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: start;
    gap: 16px;
  }

  .cm-top {
    grid-column: 1 / -1;
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .cm-stage {
    position: sticky;
    top: 8px;
  }
}
