/* Drum rack: pad surface, bank strip, step grid, kit/kick editors. */

.drum-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.012), transparent 40%), var(--panel);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-1);
}

.drum-rack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  min-height: 0;
  padding: 10px;
}

/* ------------------------------------------------------------------- head */

.drum-head {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.drum-name {
  flex: 1 1 130px;
  min-width: 96px;
  height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.drum-name:hover {
  border-color: var(--line-2);
}

.drum-name:focus {
  outline: 2px solid var(--accent-2);
  outline-offset: 1px;
}

.drum-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ banks */

.drum-banks {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px;
  flex: 0 0 auto;
  scrollbar-width: none;
}

.drum-banks::-webkit-scrollbar {
  display: none;
}

.bank-btn {
  position: relative;
  flex: 0 0 auto;
  min-width: 96px;
  max-width: 150px;
  height: 46px;
  padding: 6px 10px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--panel-3), var(--panel-2));
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  text-align: left;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
    color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.bank-btn:hover {
  border-color: var(--line-2);
}

.bank-btn.is-active {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent-lo));
  border-color: var(--accent-line);
  color: var(--accent-ink);
  box-shadow: var(--glow);
}

.bank-btn.is-queued {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 1px var(--accent-2), 0 0 16px var(--accent-2-glow);
  animation: bank-pulse 900ms ease-in-out infinite;
}

@keyframes bank-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 1px var(--accent-2), 0 0 10px var(--accent-2-soft);
  }
  50% {
    box-shadow: 0 0 0 1px var(--accent-2), 0 0 20px var(--accent-2-glow);
  }
}

.bank-name {
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.bank-meta {
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
}

.bank-btn.is-active .bank-meta {
  color: rgba(0, 0, 0, 0.65);
}

.bank-add {
  min-width: 40px;
  max-width: 40px;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
}

/* ------------------------------------------------------------------- body */

.drum-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ------------------------------------------------------------------- pads */

.drum-pads {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.drum-pad {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--panel-3), var(--panel-2));
  border: 1px solid var(--line);
  color: var(--text-2);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
    color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), transform 60ms var(--ease);
}

.drum-pad:hover {
  border-color: var(--line-2);
}

.drum-pad.is-selected {
  border-color: var(--accent-line);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.drum-pad.is-down {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent-lo));
  border-color: var(--accent-line);
  color: var(--accent-ink);
  box-shadow: var(--glow);
  transform: translateY(1px);
}

.drum-pad.is-muted {
  opacity: 0.45;
  border-style: dashed;
}

.drum-pad.is-solo {
  border-color: var(--accent-2);
  box-shadow: inset 0 0 0 1px var(--accent-2);
}

.drum-pad-name {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0 4px;
}

.drum-pad-key {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--dim);
}

.drum-pad.is-down .drum-pad-key {
  color: rgba(0, 0, 0, 0.6);
}

/* --------------------------------------------------------------- step grid */

.drum-seq-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid var(--line-soft);
  padding: 6px;
}

.drum-grid {
  display: grid;
  grid-template-columns: 64px repeat(var(--steps, 16), minmax(22px, 1fr));
  grid-template-rows: 18px repeat(var(--rows, 10), minmax(24px, 1fr));
  gap: 3px;
  min-height: 100%;
  min-width: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.drum-corner {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 800;
}

.drum-step-head {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}

.drum-step-head.beat {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
}

.drum-step-head.is-playing {
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-line);
}

.drum-row-label {
  position: sticky;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 6px;
  background: #141821;
  border: 1px solid transparent;
  overflow: hidden;
}

.drum-row-label.is-selected {
  border-color: var(--accent-line);
  background: var(--panel-2);
}

.drum-row-label.is-muted {
  opacity: 0.45;
}

.drum-row-label.is-solo {
  border-color: var(--accent-2);
}

.drum-row-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drum-row-label.is-selected .drum-row-name {
  color: var(--accent-hi);
}

.drum-cell {
  position: relative;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  touch-action: none;
  transition: background var(--fast) var(--ease), box-shadow var(--fast) var(--ease),
    border-color var(--fast) var(--ease), transform 60ms var(--ease);
}

.drum-cell.beat {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
}

.drum-cell:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.drum-cell.on {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent-lo));
  border-color: var(--accent-line);
  box-shadow:
    0 0 0 1px var(--accent-line),
    0 0 14px var(--accent-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.drum-cell.is-playing {
  box-shadow: inset 0 0 0 1px var(--accent-2-line);
}

.drum-cell.on.is-playing {
  box-shadow:
    0 0 0 1px var(--accent-2-line),
    0 0 20px var(--accent-2-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.drum-cell.flash {
  animation: drum-cell-flash 180ms var(--ease);
}

@keyframes drum-cell-flash {
  0% {
    transform: scale(0.92);
    filter: brightness(1.5);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

/* ------------------------------------------------------------- kit editor */

.kit-level {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.kit-level .knob {
  width: 84px;
}

.kit-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.kit-pads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 8px;
}

.kit-pad {
  height: 30px;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
    color var(--fast) var(--ease);
}

.kit-pad:hover {
  border-color: var(--line-2);
  color: var(--text-2);
}

.kit-pad.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-hi);
}

/* ------------------------------------------------------------- kick editor */

.kick-pad {
  width: 100%;
  height: 88px;
  margin-bottom: 8px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background:
    radial-gradient(120% 120% at 50% 0%, var(--accent-soft), transparent 60%),
    linear-gradient(180deg, var(--panel-3), var(--panel-2));
  border: 1px solid var(--accent-line);
  color: var(--accent-hi);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: background var(--fast) var(--ease), box-shadow var(--fast) var(--ease),
    transform 60ms var(--ease);
}

.kick-pad:hover {
  border-color: var(--accent);
}

.kick-pad.is-down {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent-lo));
  color: var(--accent-ink);
  box-shadow: var(--glow);
  transform: translateY(1px);
}

.kick-pad-label {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.18em;
  padding-left: 0.18em;
}

.kick-pad-hint {
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
}

.kick-pad.is-down .kick-pad-hint {
  color: rgba(0, 0, 0, 0.6);
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 600px) and (orientation: portrait) {
  .drum-pads {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
  }

  .drum-grid {
    grid-template-columns: 52px repeat(var(--steps, 16), minmax(20px, 1fr));
  }

  .drum-row-name {
    font-size: 9px;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .drum-rack {
    padding: 6px;
    gap: 5px;
  }

  .drum-head {
    gap: 4px;
  }

  .drum-name {
    height: 28px;
  }

  .bank-btn {
    height: 38px;
    min-width: 84px;
  }

  .drum-pad-name {
    font-size: 11px;
  }

  .kick-pad {
    height: 64px;
  }
}
