.sampler-page {
  min-height: 100vh;
  isolation: isolate;
  background: #181818;
  color: #f5f5f5;
}
.sampler-wallpaper {
  position: fixed;
  z-index: -1;
  inset: 0 0 auto;
  width: 100%;
  /* Keep the crop stable as the mobile browser toolbar retracts. */
  height: 100vh;
  height: 100lvh;
  transform: translateZ(0);
  object-fit: cover;
  filter: brightness(.55);
  pointer-events: none;
}
.sampler {
  --line: #ffffff33;
  --muted: #e1e1e1;
  max-width: 1520px;
  margin-inline: auto;
  padding: clamp(24px, 5vw, 65px) clamp(14px, 4vw, 42px) 48px;
  color-scheme: dark;
}
.sampler [hidden] { display: none; }
#status { margin: 6px 0 0; font-size: .85rem; color: var(--muted); }
#status:empty { display: none; }
.sampler :is(button, select, input) { font: inherit; color: inherit; }
.sampler input[type="range"] {
  width: 100%;
  min-height: 38px;
  margin: 0;
  accent-color: #fff;
  cursor: ew-resize;
}
.sampler :is(button, select) {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #232323;
  color: #fff;
}
.sampler select { width: 100%; min-width: 0; padding-inline: 7px; }
.sampler :is(button, select):hover { border-color: #ddd; }
.sampler :focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sampler button { cursor: pointer; }
.sampler button:disabled { opacity: .6; cursor: default; }
.sampler svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.sampler #beat button {
  background: #14141473;
  border-color: #ffffff5c;
}
.sampler #beat :is(.beat-button, .beat-bank-sound)[aria-pressed="true"] {
  color: #161616;
  background: #f1f1f1;
  border-color: #f1f1f1;
}
.sampler #beat {
  display: grid;
  gap: 13px;
}
.beat-transport, .beat-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.beat-track {
  display: grid;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}
.beat-track-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.beat-track-expand[aria-expanded="true"] svg { transform: rotate(180deg); }
.beat-track-effects {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.beat-track-effects .beat-channel-mix {
  flex: 1;
  max-width: 1160px;
}
.sampler .beat-button {
  display: grid;
  place-items: center;
  padding: 0;
  width: 42px;
  height: 42px;
}
.sampler :is(.beat-transport, .beat-track) .beat-button svg { width: 17px; height: 19px; }
.sampler .beat-transport :is(.beat-play, .beat-record-hits) svg,
.sampler .beat-transport #beat-export[aria-pressed="true"] svg { fill: currentColor; stroke: none; }
.sampler #beat .beat-record-hits[aria-pressed="true"] {
  background: #982d37;
  border-color: #f0959f;
  color: #fff;
}
.sampler #beat #beat-export { margin-inline-start: auto; }
.sampler #beat #beat-export[aria-pressed="true"] {
  background: #982d37;
  border-color: #f0959f;
  color: #fff;
}
#beat-export-time {
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}
.beat-slider {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  margin-inline-start: 6px;
  min-width: 92px;
  max-width: 220px;
  flex: 1 1 150px;
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}
.beat-pads {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.beat-pad-slot { position: relative; min-width: 0; }
.sampler #beat .beat-pad-mute {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 32px;
  height: 32px;
  min-height: 32px;
  background: transparent;
  border-color: transparent;
}
.sampler #beat .beat-pad-mute svg { width: 15px; height: 15px; }
.sampler .beat-pad {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: clamp(66px, 12vw, 112px);
  touch-action: manipulation;
}
.sampler #beat .beat-pad[aria-pressed="true"] { border-color: #fff; box-shadow: inset 0 0 0 1px #fff; }
.sampler #beat .beat-pad.assigning { outline: 2px dashed #fff; outline-offset: 2px; }
.sampler #beat button:hover { border-color: #fff; }
.sampler .beat-pad svg { width: 27px; height: 27px; }
.beat-pad kbd {
  position: absolute;
  right: 7px;
  bottom: 5px;
  font: 500 .72rem/1.2 system-ui, sans-serif;
  opacity: .85;
}
.beat-bank {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 5px;
}
.sampler .beat-bank-sound {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 2px;
  height: 42px;
  padding: 3px;
}
.beat-bank-sound svg { margin: 0 max(0px, calc((100% - 18px) / 2)); }
.beat-bank-sound i {
  width: 2px;
  height: 2px;
  background: currentColor;
  border-radius: 50%;
}
.beat-grid { display: grid; gap: 3px; }
.beat-bar {
  display: grid;
  grid-template-columns: repeat(16, minmax(0, 1fr));
  gap: 2px;
}
.sampler #beat .beat-step {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 30px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
}
.sampler .beat-step svg { width: 12px; height: 12px; stroke-width: 6; opacity: .4; }
.sampler .beat-step:nth-child(4n+1) svg { stroke-width: 9; opacity: .63; }
.sampler #beat .beat-step.current, .sampler #beat .beat-step:focus-visible { border-color: #fff; }
.sampler .beat-step[aria-pressed="true"] svg { stroke-width: 16; opacity: 1; }
@media (max-width: 570px) {
  .beat-bank { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .beat-transport .beat-slider { max-width: none; flex-basis: 35%; }
}
.sampler #beat[hidden] { display: none; }

.beat-tracks {
  display: grid;
  gap: 6px;
}
.beat-track-marker {
  display: grid;
  place-items: center;
  flex: none;
  color: var(--muted);
}
.sampler #beat .beat-track .beat-button {
  width: 38px;
  height: 38px;
  flex: none;
}
.beat-channel-mix {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  min-width: 0;
}
.beat-track-main > .beat-channel-mix { flex: 1; }
.beat-channel-mix label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
}
.sampler .beat-channel-mix svg { width: 16px; height: 16px; }
.beat-channel-mix input { min-width: 0; }
.beat-presets {
  display: flex;
  flex: none;
  gap: 3px;
}
.sampler #beat .beat-preset {
  width: 25px;
  height: 32px;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: #ffffffa1;
  font-size: .76rem;
  font-variant-numeric: tabular-nums;
}
.sampler #beat .beat-preset[data-saved] {
  background: #ffffff26;
  color: #fff;
}
.sampler #beat .beat-preset[aria-pressed="true"] {
  background: #fff;
  color: #181818;
}
@media (max-width: 1050px) {
  .beat-track-main { flex-wrap: wrap; }
  .beat-track-main > .beat-channel-mix {
    flex: 1 0 100%;
    order: 1;
  }
  .beat-track-main > .beat-presets { margin-inline-start: auto; }
}
@media (max-width: 570px) {
  .beat-track { padding: 5px; }
  .beat-track-main { gap: 4px; }
  .beat-presets { gap: 2px; }
  .sampler #beat .beat-preset { width: 19px; }
  .sampler #beat .beat-track .beat-button {
    width: 24px;
    height: 38px;
  }
  .sampler #beat .beat-track .beat-button svg,
  .sampler .beat-track-marker svg { width: 15px; height: 15px; }
  .beat-channel-mix {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 10px;
  }
  .sampler input[type="range"] { min-height: 44px; }
}
.sampler #beat .beat-pad.muted svg,
.sampler #beat .beat-pad.muted kbd { opacity: .4; }

.beat-catalogue {
  width: min(340px, calc(100vw - 40px));
  max-width: 100%;
  box-sizing: border-box;
  padding: 16px;
  border: 1px solid #fff6;
  border-radius: 8px;
  color: #f5f5f5;
  background: #181818;
}
.beat-catalogue[open] { display: grid; gap: 9px; }
.beat-catalogue::backdrop { background: #090909a6; }
.beat-catalogue-actions { display: flex; align-items: center; gap: 6px; }
.beat-catalogue-actions > svg { margin: 0 auto 0 4px; }
.beat-catalogue p { margin: 0; font-size: .85rem; }
.beat-catalogue p:empty { display: none; }


.sample-editor {
  box-sizing: border-box;
  width: min(700px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  padding: 14px;
  border: 1px solid #ffffff66;
  border-radius: 8px;
  color: #f5f5f5;
  background: #181818;
}
.sample-editor::backdrop { background: #0b0b0bc9; }
.sample-editor-head, .edit-toolbar, .edit-zoom, .edit-finish {
  display: flex;
  align-items: center;
  gap: 5px;
}
.edit-song {
  flex: 1;
  overflow: hidden;
  min-width: 0;
  font-size: .9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sample-editor .beat-button { flex: none; }
.sample-editor #edit-controls {
  display: grid;
  gap: 9px;
  margin-top: 11px;
}
#edit-status { margin: 8px 0 0; font-size: .86rem; }
#edit-status:empty { display: none; }
#edit-clock {
  font-size: .85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin: 0 2px;
}
.edit-zoom { margin-inline-start: auto; }
.sampler .sample-editor button[aria-pressed="true"],
.sampler .sample-editor #edit-commit:not(:disabled) {
  background: #f1f1f1;
  color: #161616;
}
.edit-waveform-wrap { position: relative; display: grid; touch-action: none; }
.edit-beat-markers {
  position: absolute;
  inset: 1px;
  overflow: hidden;
  pointer-events: none;
}
.edit-beat-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  padding: 4px 5px 0;
  border-left: 1px dashed #c3ddebcc;
  pointer-events: auto;
  cursor: ew-resize;
  user-select: none;
  color: #e6f5ff;
  font: 600 .76rem/1 system-ui, sans-serif;
  text-shadow: 0 1px 3px #101010, 0 0 3px #101010;
}
.edit-beat-marker:focus-visible { outline-offset: -2px; }
.sampler .edit-waveform {
  box-sizing: border-box;
  width: 100%;
  height: clamp(85px, 20vw, 138px);
  background: #101010;
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: crosshair;
  touch-action: none;
}
.edit-waveform path { vector-effect: non-scaling-stroke; }
.edit-waveform #edit-peaks { stroke: #aaa; stroke-width: 1; }
.edit-waveform #edit-selection { fill: #ffffff22; stroke: none; }
.edit-waveform #edit-playhead { stroke: #fff; stroke-width: 1; pointer-events: none; }
.edit-waveform [data-bound] { cursor: ew-resize; }
.edit-waveform .edit-marker-grip { stroke: transparent; stroke-width: 23; }
.edit-waveform [data-bound] path:not(.edit-marker-grip) { stroke: #fff; stroke-width: 2; }
.edit-bounds {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.edit-bounds > div {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.sampler .edit-bounds input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding-inline: 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #111;
  font-size: .88rem;
  font-variant-numeric: tabular-nums;
}
.edit-finish { justify-content: flex-end; }
.sampler .edit-finish select { width: auto; }
@media (max-width: 435px) {
  .sample-editor { padding: 9px; }
  .edit-toolbar { flex-wrap: wrap; }
  .edit-toolbar .beat-button { width: 36px; height: 38px; }
  .edit-zoom { margin-inline-start: 0; }
}

.sampler .sample-editor #edit-controls[hidden] { display: none; }



#track-rename-form { display: grid; gap: 8px; }
#track-name {
  min-width: 0;
  padding: 8px;
  border: 1px solid #fff6;
  border-radius: 5px;
  background: #101010;
}
.track-rename-actions { display: flex; justify-content: flex-end; gap: 6px; }

.beat-track-marker > span { display: none; }
@media (min-width: 650px) {
  .sampler #beat .beat-track-marker.has-name {
    display: flex;
    align-items: center;
    gap: 4px;
    width: auto;
    max-width: 116px;
    padding-inline: 6px;
  }
  .beat-track-marker.has-name > span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .76rem;
  }
}

.sampler #beat .beat-automation[aria-pressed="true"] {
  background: #b22533;
  border-color: #f0959f;
  color: #fff;
}
