:root {
  --app-min-width: 1180px;
  --ink: #f4efe5;
  --muted: #a9a197;
  --paper: #090b0c;
  --panel: rgba(23, 27, 29, 0.9);
  --panel-2: rgba(32, 36, 38, 0.92);
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.24);
  --accent: #e85d4f;
  --accent-2: #38b6a9;
  --accent-3: #e4ad39;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.46);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-width: 0;
  overflow-x: hidden;
  padding-bottom: 72px;
  background:
    radial-gradient(circle at 20% 12%, rgba(56, 182, 169, 0.18), transparent 28%),
    radial-gradient(circle at 82% 8%, rgba(232, 93, 79, 0.15), transparent 30%),
    linear-gradient(140deg, #101314 0%, #090b0c 48%, #191511 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body.mixer-open {
  padding-bottom: var(--mixer-open-padding, 510px);
}

body.mixer-open .master-footer {
  display: none !important;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 14px 0 32px;
}

.topbar,
.workspace,
.sequencer {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  position: relative;
  z-index: 60;
  display: grid;
  grid-template-columns: 300px minmax(500px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  min-height: 104px;
  padding: 18px 20px;
  border-radius: 12px 12px 0 0;
  overflow: visible;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.brand-mark {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 13px;
  filter: drop-shadow(0 10px 22px rgba(228, 173, 57, 0.22));
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
}

h1 {
  color: var(--ink);
  font-size: 34px;
  font-weight: 950;
  letter-spacing: 0;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
}

/* Native uses a slab-serif "DrumRoom" wordmark (Superclarendon, matching the
   DR app icon) — no icon, no tagline. */
.wordmark {
  font-family: Superclarendon, "Roboto Slab", Rockwell, "Sitka Heading", Georgia, serif;
  font-size: 30px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

h2 {
  font-size: 19px;
}

.project-strip,
.transport,
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-strip {
  flex-wrap: wrap;
}

.preset-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.preset-action-button {
  min-height: 28px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #151b1d;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.preset-action-button:hover {
  background: rgba(56, 182, 169, 0.18);
  color: #d5fffa;
}

.preset-action-button.danger:hover {
  background: rgba(232, 93, 79, 0.2);
  color: #ffd9d4;
}

.transport {
  flex-wrap: nowrap;
  justify-content: end;
}

.action-menu {
  position: relative;
  z-index: 70;
}

.menu-trigger {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.04)),
    rgba(0, 0, 0, 0.24);
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
  font-weight: 950;
  line-height: 1;
  list-style: none;
}

.menu-trigger::-webkit-details-marker {
  display: none;
}

.action-menu[open] .menu-trigger,
.menu-trigger:hover {
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
}

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  display: grid;
  min-width: 168px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)),
    rgba(9, 11, 12, 0.98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.44);
}

.menu-item {
  display: grid;
  min-height: 38px;
  place-items: center start;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.project-strip {
  justify-content: center;
  overflow: hidden;
  min-width: 520px;
  min-height: 46px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
}

.project-strip span {
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.preset-select {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.preset-select span {
  padding: 0;
  background: transparent;
}

.preset-select select {
  min-width: 260px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--ink);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
}

.mode-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.22);
}

/* Native header buttons: rounded pills, dark fill (#151b1d) with a subtle
   border; active = teal-green fill (#23544d), like the JUCE buttonOnColourId. */
.mode-tab,
.groove-toggle,
.mixer-toggle {
  min-height: 32px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151b1d;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.mode-tab:hover,
.groove-toggle:hover,
.mixer-toggle:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.mode-tab.active,
.groove-toggle.active,
.mixer-toggle.active {
  background: #23544d;
  border-color: rgba(85, 224, 210, 0.45);
  color: #fff;
}

.groove-toggle,
.mixer-toggle {
  margin-left: 8px;
}

.mixer-toggle.active {
  background:
    linear-gradient(180deg, rgba(56, 182, 169, 0.22), rgba(56, 182, 169, 0.07)),
    rgba(255, 255, 255, 0.06);
  color: #d5fffa;
}

.section-header {
  justify-content: space-between;
  margin-bottom: 16px;
}

.icon-button,
.text-button,
.file-button {
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04)),
    #171b1d;
  color: var(--ink);
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

.compact {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.icon-button:hover,
.text-button:hover,
.file-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  font-size: 18px;
}

.icon-button:first-child {
  border-color: rgba(56, 182, 169, 0.65);
  background:
    linear-gradient(180deg, rgba(85, 224, 210, 0.42), rgba(56, 182, 169, 0.15)),
    #12302e;
}

.icon-button.small {
  width: 34px;
  height: 34px;
}

.text-button,
.file-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 7px;
  font-weight: 900;
}

.file-button {
  display: inline-grid;
  place-items: center;
  border-color: rgba(232, 93, 79, 0.62);
  background:
    linear-gradient(180deg, rgba(232, 93, 79, 0.38), rgba(232, 93, 79, 0.1)),
    #241414;
}

.file-button input {
  display: none;
}

.import-button input {
  display: none;
}

.ghost {
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
}

.tempo {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.22);
  font-weight: 900;
}

.tempo span {
  color: var(--muted);
  font-size: 12px;
}

.tempo input {
  width: 74px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 950;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(760px, 1fr) clamp(360px, 28vw, 494px);
  gap: 0;
  border-top: 0;
  overflow-x: auto;
}

/* Sound editor hidden (native "Sound" toggle off): collapse to a single column. */
.workspace.sound-collapsed {
  grid-template-columns: minmax(760px, 1fr);
}

.edit-panel.hidden,
.stage.hidden {
  display: none;
}

.kit-workspace {
  display: grid;
  grid-template-rows: auto auto;
  border-right: 1px solid var(--line);
}

.kit-panel,
.edit-panel,
.stage {
  padding: 18px;
}

.kit-panel,
.edit-panel {
  overflow: hidden;
}

.kit-panel,
.edit-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 48%),
    rgba(11, 13, 14, 0.24);
}

.slot-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.slot-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sound-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.editable-title {
  cursor: text;
  border-radius: 6px;
  padding: 0 4px;
  margin: 0 -4px;
  transition:
    background 140ms ease,
    box-shadow 140ms ease;
}

.editable-title:hover,
.editable-title:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  box-shadow: 0 0 0 1px var(--line-strong);
}

.slot-color-input {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  flex: none;
  transition:
    transform 140ms ease,
    border-color 140ms ease;
}

.slot-color-input:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.42);
}

.slot-color-input::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.slot-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 999px;
}

.slot-color-input::-moz-color-swatch {
  border: none;
  border-radius: 999px;
}

.slot-audition-toggle {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 950;
}

.slot-audition-toggle.on {
  border-color: rgba(56, 182, 169, 0.65);
  background: rgba(56, 182, 169, 0.18);
  color: #d5fffa;
}

.slot {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
  aspect-ratio: 1 / 1;
  min-height: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--slot-color) 13%, transparent), transparent 44%),
    rgba(255, 255, 255, 0.045);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}

.slot[draggable="true"] {
  user-select: none;
}

.slot.dragging {
  opacity: 0.45;
  transform: scale(0.98);
}

.slot.drop-target {
  border-color: rgba(85, 224, 210, 0.76);
  box-shadow:
    inset 0 0 0 1px rgba(85, 224, 210, 0.42),
    0 16px 32px rgba(0, 0, 0, 0.24);
}

.slot::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, transparent 16%, var(--slot-color));
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.slot.hit::after {
  opacity: var(--hit-opacity);
}

.slot::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--slot-color);
  opacity: 0.72;
}

.slot.active {
  border-color: color-mix(in srgb, var(--slot-color) 68%, #ffffff);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--slot-color) 24%, transparent), transparent 55%),
    rgba(255, 255, 255, 0.07);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.23);
}

.slot-key,
.slot-key-input {
  display: grid;
  place-items: center;
  width: 36px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  font-weight: 950;
}

.slot-key-input {
  width: 40px;
  outline: 0;
  color: var(--ink);
  text-align: center;
  cursor: text;
}

.slot-key-input:focus {
  border-color: color-mix(in srgb, var(--slot-color) 72%, white);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--slot-color) 24%, transparent);
}

.slot-main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: end;
  min-width: 0;
  min-height: 0;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.slot-name {
  display: block;
  overflow: hidden;
  font-size: 14px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-file {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot.muted {
  opacity: 0.56;
}

.stage {
  position: relative;
  display: block;
  padding: 14px 18px 8px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 52%),
    rgba(255, 255, 255, 0.018);
}

.kit-panel {
  padding-top: 12px;
}

.kit-visual {
  position: relative;
  width: 100%;
  max-width: 800px;
}

.kit-view-toggle {
  position: absolute;
  top: 32px;
  right: 32px;
  z-index: 2;
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px);
}

.view-button {
  display: grid;
  place-items: center;
  min-height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 950;
}

.view-button.active {
  background: rgba(56, 182, 169, 0.2);
  color: #d5fffa;
}

#kitCanvas,
#waveformCanvas {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #101416;
}

#kitCanvas {
  display: block;
  aspect-ratio: 16 / 9;
  height: auto;
  min-height: 0;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.32);
}

#waveformCanvas {
  height: 120px;
}

.layer-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.16);
}

.mini-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.mini-actions {
  display: flex;
  gap: 6px;
}

.mini-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.layer-list {
  display: grid;
  gap: 7px;
  max-height: 176px;
  overflow-y: auto;
  padding-right: 2px;
}

.layer-row {
  display: grid;
  grid-template-columns: 40px 86px 76px 54px 54px minmax(0, 1fr) 30px;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 7px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.layer-row.selected {
  border-color: rgba(56, 182, 169, 0.62);
  background: rgba(56, 182, 169, 0.1);
}

.layer-row.missing {
  border-color: rgba(232, 168, 76, 0.55);
  background: rgba(232, 168, 76, 0.08);
}

.layer-relink {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(232, 168, 76, 0.6);
  border-radius: 6px;
  background: rgba(232, 168, 76, 0.14);
  color: #ffd9a8;
  cursor: pointer;
  font-weight: 850;
  text-align: left;
  transition:
    border-color 140ms ease,
    background 140ms ease;
}

.layer-relink:hover {
  border-color: rgba(232, 168, 76, 0.92);
  background: rgba(232, 168, 76, 0.22);
}

.layer-row label {
  display: grid;
  gap: 3px;
}

.layer-row label span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.layer-row input {
  width: 100%;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.layer-row select {
  width: 100%;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
}

.layer-pick,
.layer-remove {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 950;
}

.layer-pick {
  color: #d5fffa;
}

.layer-remove {
  color: #ffd9d4;
}

.layer-file {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-empty {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

/* Velocity range bar (drag handle) */
.layer-vel-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 2px;
}

.layer-vel-label {
  flex-shrink: 0;
  width: 30px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-align: right;
  user-select: none;
}

.layer-vel-track {
  position: relative;
  flex: 1;
  height: 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--line);
  cursor: default;
  touch-action: none;
}

.layer-vel-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(56, 182, 169, 0.38);
  border-radius: 4px;
  pointer-events: none;
}

.layer-vel-handle {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-2);
  border: 2px solid rgba(255, 255, 255, 0.55);
  transform: translate(-50%, -50%);
  cursor: ew-resize;
  touch-action: none;
  transition: background 100ms ease;
}

.layer-vel-handle:hover,
.layer-vel-handle.dragging {
  background: #5de0d3;
  border-color: rgba(255, 255, 255, 0.9);
}

/* File-drop highlight on pad slots */
.slot.file-drop-target {
  border-color: rgba(228, 173, 57, 0.88);
  box-shadow:
    inset 0 0 0 1px rgba(228, 173, 57, 0.44),
    0 16px 32px rgba(0, 0, 0, 0.24);
}

.midi-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.16);
}

.midi-panel-body {
  height: 268px;
  overflow: hidden;
}

.midi-panel-body.collapsed {
  height: 0;
}

.midi-status {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.midi-map-list {
  display: grid;
  gap: 7px;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 2px;
}

.midi-map-row {
  display: grid;
  grid-template-columns: minmax(116px, 1fr) 44px 72px;
  align-items: center;
  gap: 7px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.midi-map-row.selected {
  border-color: rgba(56, 182, 169, 0.62);
  background: rgba(56, 182, 169, 0.1);
}

.midi-audition {
  overflow: hidden;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 950;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.midi-open {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.midi-note {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

/* Native-style section label (e.g. "LEVEL") above a group of controls. */
.editor-section-label {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.6px;
}

.control-stack {
  display: grid;
  gap: 18px;
  margin-top: 12px;
}

.control-stack label {
  display: grid;
  gap: 9px;
  font-weight: 950;
}

.control-row {
  grid-template-columns: 58px minmax(0, 1fr) 72px;
  align-items: center;
}

.control-stack span {
  color: var(--muted);
  font-size: 12px;
}

.control-number {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.toggle-row {
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: start;
}

.toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.toggle-group label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  font-size: 12px;
  color: var(--ink);
}

.toggle-group input[type="checkbox"] {
  width: auto;
  min-height: 0;
  margin: 0;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.hint-line {
  min-height: 44px;
  margin-top: 20px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.kit-notice {
  position: absolute;
  right: 32px;
  bottom: 32px;
  left: 32px;
  z-index: 2;
  min-height: 0;
  margin: 0;
  padding: 9px 12px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(12px);
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mixer,
.sequencer {
  border-top: 0;
}

.tab-panel.hidden {
  display: none;
}

.mixer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 18;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: var(--mixer-height, 340px);
  min-height: 320px;
  max-height: min(760px, 100vh);
  padding: 14px 24px;
  border-top: 1px solid var(--line-strong);
  border-right: 0;
  border-left: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)),
    rgba(10, 12, 13, 0.97);
  box-shadow: 0 -22px 54px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.mixer-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 12px;
  cursor: ns-resize;
}

.mixer-resize-handle::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 50%;
  width: 74px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  transform: translateX(-50%);
}

.mixer-header {
  align-items: end;
  margin-bottom: 0;
}

.master-strip {
  display: flex;
  gap: 7px;
}

.master-strip span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.mixer-channels {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(102px, 120px);
  grid-template-columns: none;
  align-items: stretch;
  min-height: 0;
  gap: 8px;
  overflow: visible;
}

.mixer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 12px;
  align-items: stretch;
  min-height: 0;
}

.mixer-scroll {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 18px;
  scrollbar-color: rgba(255, 255, 255, 0.28) rgba(255, 255, 255, 0.06);
  scrollbar-width: auto;
}

.mixer-scroll::-webkit-scrollbar {
  height: 15px;
}

.mixer-scroll::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.mixer-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

.mixer-master {
  position: sticky;
  right: 0;
  display: grid;
  grid-template-rows: 36px minmax(0, 1fr) 22px 24px 30px;
  gap: 6px;
  min-height: 0;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(228, 173, 57, 0.13), transparent 48%),
    rgba(0, 0, 0, 0.24);
  box-shadow: -18px 0 32px rgba(0, 0, 0, 0.22);
}

.mixer-master .master-title,
.mixer-master .master-value {
  justify-self: center;
}

.mixer-master .master-title {
  display: grid;
  width: 100%;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent-3) 55%, var(--line));
  border-radius: 7px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent-3) 78%, #000),
    color-mix(in srgb, var(--accent-3) 50%, #000));
  color: #fff;
  font-size: 11px;
  font-weight: 950;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.master-channel-strip {
  height: 100%;
  min-height: 0;
}

.master-channel-meter {
  width: 16px;
}

.master-channel-fader {
  width: 24px;
  height: 100%;
  accent-color: var(--accent-3);
}

.master-pan-placeholder {
  width: 100%;
  height: 2px;
  align-self: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.master-buttons-placeholder {
  height: 30px;
}

.mixer-channel {
  position: relative;
  display: grid;
  grid-template-rows: 36px minmax(0, 1fr) 22px 24px 30px;
  gap: 6px;
  height: 100%;
  min-height: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--channel-color) 11%, transparent), transparent 48%),
    rgba(255, 255, 255, 0.04);
}

.mixer-channel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  border-radius: 9px 9px 0 0;
  background: var(--channel-color);
  opacity: 0.86;
}

.mixer-channel.selected {
  border-color: color-mix(in srgb, var(--channel-color) 64%, white);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.28);
}

.mixer-channel.muted {
  opacity: 0.52;
}

.mixer-channel.soloed {
  background:
    linear-gradient(180deg, rgba(228, 173, 57, 0.18), transparent 48%),
    rgba(255, 255, 255, 0.055);
}

/* Native mixer headers are solid drum-coloured bands with the channel name. */
.channel-select {
  height: 36px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--channel-color) 55%, var(--line));
  border-radius: 7px;
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--channel-color) 80%, #000),
      color-mix(in srgb, var(--channel-color) 52%, #000));
  color: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mixer-channel.muted .channel-select {
  filter: grayscale(0.5);
}

.channel-strip {
  position: relative;
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
  height: 100%;
  min-height: 0;
  padding: 8px 6px 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.channel-meter {
  position: relative;
  align-self: stretch;
  justify-self: center;
  width: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(232, 93, 79, 0.22), rgba(228, 173, 57, 0.2) 34%, rgba(56, 182, 169, 0.18) 100%),
    rgba(0, 0, 0, 0.34);
  overflow: hidden;
}

.channel-meter span {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 2%;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff6d5d, #ffd45f 35%, #55e0d2);
  box-shadow: 0 0 12px rgba(85, 224, 210, 0.34);
  transition: height 80ms linear;
}

.channel-fader {
  justify-self: center;
  width: 24px;
  height: 100%;
  min-height: 0;
  -webkit-appearance: slider-vertical;
  accent-color: var(--accent);
  writing-mode: vertical-lr;
  direction: rtl;
}

.channel-db {
  align-self: center;
  justify-self: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.channel-pan-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.channel-pan-value {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--ink);
  font-size: 10px;
  font-weight: 900;
}

.channel-pan {
  width: 100%;
  height: 24px;
  min-height: 24px;
  margin: 0;
  accent-color: var(--accent-3);
}

.value-popup {
  position: fixed;
  z-index: 120;
  display: none;
  min-width: 46px;
  padding: 6px 9px;
  border: 1px solid rgba(228, 173, 57, 0.54);
  border-radius: 999px;
  background: rgba(7, 9, 10, 0.92);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.36);
  color: #fff0bf;
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
}

.value-popup.visible {
  display: block;
}

.channel-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  height: 30px;
  min-height: 30px;
  align-self: end;
  overflow: hidden;
}

.channel-buttons button {
  min-width: 0;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
}

.mute-button.on {
  border-color: rgba(232, 93, 79, 0.72);
  background: rgba(232, 93, 79, 0.22);
  color: #ffd9d4;
}

.solo-button.on {
  border-color: rgba(228, 173, 57, 0.76);
  background: rgba(228, 173, 57, 0.22);
  color: #fff0bf;
}

.sequencer {
  border-radius: 0 0 12px 12px;
  padding: 18px;
  overflow-x: auto;
}

.groove-controls,
.loop-length {
  display: flex;
  align-items: center;
  gap: 8px;
}

.loop-length {
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.22);
}

.loop-button {
  min-height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 950;
}

.loop-button.active {
  background: rgba(56, 182, 169, 0.18);
  color: #d5fffa;
}

.master-footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(160px, 210px) minmax(220px, 1fr) minmax(160px, 260px);
  align-items: center;
  gap: 18px;
  min-width: 0;
  min-height: 64px;
  padding: 10px 28px;
  border-top: 1px solid var(--line-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)),
    rgba(7, 9, 10, 0.96);
  box-shadow: 0 -18px 42px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
}

.footer-transport {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-tempo {
  min-height: 42px;
}

.master-info {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.master-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 950;
}

.master-value {
  color: var(--accent-3);
  font-size: 14px;
  font-weight: 950;
}

.master-volume {
  width: 100%;
  accent-color: var(--accent-3);
}

.master-meter {
  height: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(56, 182, 169, 0.14), rgba(228, 173, 57, 0.16), rgba(232, 93, 79, 0.14)),
    rgba(0, 0, 0, 0.32);
  overflow: hidden;
}

.master-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #55e0d2, #ffd45f 72%, #ff6d5d);
  box-shadow: 0 0 18px rgba(228, 173, 57, 0.3);
  transition: width 80ms linear;
}

.steps {
  display: grid;
  gap: 7px;
  min-width: max-content;
}

.groove-ruler {
  display: grid;
  gap: 5px;
  min-width: max-content;
  margin-bottom: 7px;
}

.ruler-spacer {
  min-width: 92px;
}

.ruler-cell {
  min-width: 22px;
  height: 20px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
}

.ruler-cell.bar-start {
  color: var(--accent-3);
}

.step-row {
  display: grid;
  gap: 5px;
  align-items: center;
}

.row-name {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  min-width: 22px;
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015)),
    rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.step-cell:nth-child(5),
.step-cell:nth-child(9),
.step-cell:nth-child(13),
.step-cell:nth-child(17) {
  border-color: rgba(255, 255, 255, 0.22);
}

.step-cell.on {
  background:
    linear-gradient(180deg, rgba(84, 236, 220, 0.72), rgba(56, 182, 169, 0.42)),
    #12302e;
  border-color: rgba(126, 255, 241, 0.68);
  box-shadow: 0 0 18px rgba(56, 182, 169, 0.22);
}

.step-cell.playhead {
  outline: 3px solid var(--accent-3);
  outline-offset: 1px;
}

.metadata-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.58);
}

.metadata-overlay.hidden {
  display: none;
}

.metadata-dialog {
  width: min(640px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel-2);
  box-shadow: var(--shadow);
}

.metadata-note {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
}

.metadata-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.metadata-field {
  display: grid;
  gap: 5px;
}

.metadata-field.span-2 {
  grid-column: 1 / -1;
}

.metadata-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.metadata-field input[type="text"],
.metadata-field textarea,
.metadata-field select {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}

.metadata-field.checkbox-field {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
}

.metadata-field.checkbox-field span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.license-section {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.license-section > summary {
  cursor: pointer;
  padding: 12px 14px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  list-style: none;
}

.license-section > summary::-webkit-details-marker {
  display: none;
}

.license-section > summary::before {
  content: "▸ ";
  color: var(--muted);
}

.license-section[open] > summary::before {
  content: "▾ ";
}

.license-section .metadata-note {
  margin: 0 14px 12px;
}

.license-section > .metadata-field,
.license-fields {
  padding: 0 14px 14px;
}

.license-fields {
  display: grid;
  gap: 14px;
}

.license-fields.disabled {
  opacity: 0.5;
}

.license-fields input[readonly] {
  opacity: 0.7;
  cursor: default;
}

.license-modes {
  gap: 8px;
}

.license-mode-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.license-mode-checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink);
  font-weight: 700;
}

.metadata-readiness {
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid rgba(232, 168, 76, 0.4);
  border-radius: 8px;
  background: rgba(232, 168, 76, 0.08);
  color: var(--ink);
  font-size: 12px;
}

.metadata-readiness.ready {
  border-color: rgba(56, 182, 169, 0.5);
  background: rgba(56, 182, 169, 0.1);
}

.metadata-readiness ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.metadata-readiness li {
  margin: 2px 0;
}

.license-status-line {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--ink);
}

.license-status-line.tone-ok {
  color: rgb(56, 182, 169);
}

.license-status-line.tone-warn {
  color: rgb(232, 168, 76);
}

.metadata-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.metadata-actions .text-button {
  min-height: 38px;
  padding: 0 18px;
}

/* Phase 3: Sound / FX sub-tabs */
.editor-subtabs {
  display: flex;
  gap: 2px;
  margin: 10px 0 0;
  border-bottom: 1px solid var(--line);
}

.editor-subtab {
  flex: 1;
  min-height: 32px;
  padding: 0 12px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}

.editor-subtab:hover {
  color: var(--ink);
}

.editor-subtab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Phase 3: FX panel */
.fx-panel {
  padding-top: 4px;
}

.fx-section-heading {
  margin: 16px 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}

.fx-order-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.fx-order-label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  flex: 1;
}

/* Phase 4: Slot / Master toggle inside FX panel */
.fx-mode-toggle {
  display: flex;
  gap: 2px;
  margin: 6px 0 2px;
  border-bottom: 1px solid var(--line);
}

.fx-mode-btn {
  flex: 1;
  min-height: 28px;
  padding: 0 10px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}

.fx-mode-btn:hover {
  color: var(--ink);
}

.fx-mode-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Phase 6: Kit Builder slicer */
.kit-builder-panel {
  padding-top: 4px;
}

.slicer-note {
  color: var(--muted);
  font-size: 11px;
  margin: 6px 0 8px;
}

.slicer-file-label {
  display: inline-block;
  padding: 6px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  margin-bottom: 8px;
}

.slicer-file-label input {
  display: none;
}

#slicerCanvas {
  display: block;
  width: 100%;
  height: 100px;
  border-radius: 6px;
  background: #0c1012;
  cursor: crosshair;
  touch-action: none;
}

.slicer-controls {
  margin-top: 8px;
}

.slicer-buttons {
  display: flex;
  gap: 6px;
  margin: 8px 0;
  flex-wrap: wrap;
}

.slicer-assign-row {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.slicer-list {
  margin-top: 4px;
}

.slicer-slice-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.slicer-slice-row span {
  flex: 1;
  color: var(--muted);
}

.slicer-slice-play {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 11px;
  color: var(--ink);
}

.slicer-slice-play:hover {
  border-color: var(--accent);
  color: var(--accent);
}
