:root {
  --cell-bg: #262a3d;
  --cell-beat-bg: #2f3550;
  --cell-active: linear-gradient(160deg, #38e2c8, #1fa8d6);
  --cell-active-beat: linear-gradient(160deg, #ffb347, #ff7a59);
  --cell-size: 40px;
  --track-col: 200px;
}

body {
  background: radial-gradient(circle at 50% -10%, #1b1f30, #0e1018 60%);
  min-height: 100vh;
}

.seq-scroll {
  overflow-x: auto;
  padding-bottom: 4px;
}

.seq-grid {
  min-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seq-row {
  display: grid;
  grid-template-columns: var(--track-col) 1fr;
  gap: 12px;
  align-items: center;
}

.seq-row.header .seq-cell-num {
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  color: var(--bs-secondary-color);
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
}

.seq-row.header .seq-cell-num.beat {
  color: #ffb347;
  font-weight: 600;
}

.seq-cell-num.selected {
  background: #2b3560;
  color: #cbd3ff;
}

.seq-track-ctrl {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.seq-track-top {
  display: flex;
  gap: 4px;
  align-items: stretch;
}

.track-mute {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: #2b3048;
  color: #e9ecf5;
  border: 1px solid #3a4062;
  font-weight: 600;
  padding: .35rem .6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-mute:hover { background: #343b5a; color: #fff; }

.track-mute.muted {
  background: #3a2330;
  color: #c98a99;
  border-color: #5a2f42;
  text-decoration: line-through;
  opacity: .8;
}

.track-dup,
.track-remove {
  flex: 0 0 auto;
  background: transparent;
  color: #8892b8;
  border: 1px solid #3a4062;
  padding: .1rem .45rem;
  line-height: 1;
}

.track-dup:hover {
  color: #38e2c8;
  border-color: #2c7a6e;
}

.track-remove:hover {
  background: #3a2330;
  color: #ff8497;
  border-color: #5a2f42;
}

.track-vol { height: 1rem; }

.seq-steps {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 6px;
}

/* Celda = contenedor de 1 ó 2 sub-golpes */
.seq-cell {
  aspect-ratio: 1 / 1;
  min-height: var(--cell-size);
  display: flex;
  gap: 3px;
  border-radius: 7px;
  transition: transform .05s ease, box-shadow .1s ease;
}

.seq-subcell {
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid #363c58;
  border-radius: 6px;
  background: var(--cell-bg);
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .62rem;
  font-weight: 700;
  color: transparent;
  user-select: none;
  transition: box-shadow .1s ease, background .1s ease, filter .1s ease;
}

.seq-cell.beat .seq-subcell { background: var(--cell-beat-bg); }

.seq-subcell:hover { border-color: #5b64a0; filter: brightness(1.18); }

.seq-cell.split .seq-subcell { border-style: dashed; }

.seq-subcell.active {
  background: var(--cell-active);
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(56, 226, 200, .35);
}

.seq-cell.beat .seq-subcell.active {
  background: var(--cell-active-beat);
  box-shadow: 0 2px 10px rgba(255, 122, 89, .4);
}

.seq-cell.playing {
  box-shadow: 0 0 0 2px #fff, 0 0 14px rgba(255, 255, 255, .55);
  transform: scale(1.05);
}

.seq-cell.col-sel {
  outline: 2px solid rgba(122, 140, 255, .55);
  outline-offset: -2px;
}

kbd {
  background: #2b3048;
  border-radius: 4px;
  padding: 1px 6px;
}

/* Fila de bajo (melódica) */
.seq-row.bass-row {
  border-top: 1px dashed #3a4062;
  padding-top: 10px;
  margin-top: 4px;
}

.seq-cell.bass {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cell-bg);
  border: 1px solid #363c58;
  border-radius: 7px;
  cursor: pointer;
  font-size: .6rem;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
}

.seq-cell.bass.beat { background: var(--cell-beat-bg); }
.seq-cell.bass:hover { filter: brightness(1.12); border-color: #5b64a0; }

.seq-cell.bass.note { border-color: transparent; }

.seq-cell.bass.attack {
  background: linear-gradient(160deg, #b18cff, #7b5cff);
  box-shadow: 0 2px 10px rgba(123, 92, 255, .35);
}

.seq-cell.bass.sustain {
  background: linear-gradient(160deg, #8a67ee, #5b3fd0);
}

.bass-label { pointer-events: none; }

.note-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 9px;
  cursor: ew-resize;
  background: rgba(255, 255, 255, .35);
  border-radius: 0 6px 6px 0;
}

.note-handle:hover { background: rgba(255, 255, 255, .75); }

/* Mini teclado de piano (nota del bajo) */
.piano {
  overflow-x: auto;
  background: #0b0d14;
  border: 1px solid #363c58;
  border-radius: 8px;
  padding: 6px;
}

.piano-keys {
  position: relative;
  height: 88px;
}

.pkey {
  position: absolute;
  top: 0;
  padding: 0;
  cursor: pointer;
  box-sizing: border-box;
}

.pkey.white {
  width: 24px;
  height: 100%;
  background: linear-gradient(#f4f5fb, #d6daee);
  border: 1px solid #20243a;
  border-radius: 0 0 4px 4px;
  z-index: 1;
}

.pkey.black {
  width: 15px;
  height: 58%;
  background: linear-gradient(#3a3f57, #12141d);
  border: 1px solid #000;
  border-radius: 0 0 3px 3px;
  z-index: 2;
}

.pkey.white:hover { background: linear-gradient(#ffffff, #ccd1e8); }
.pkey.black:hover { background: linear-gradient(#4a5070, #191c27); }

.pkey.white.active { background: linear-gradient(#cbb8ff, #9b7bff); }
.pkey.black.active { background: linear-gradient(#a888ff, #6b4bd6); }

.pkey-label {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: .55rem;
  color: #6b7194;
  pointer-events: none;
}

.pkey.white.active .pkey-label { color: #2a1a5a; }
